From 0460bfcd7af3a398340711a5dc4f010fc65a210d Mon Sep 17 00:00:00 2001 From: Nigel Tao Date: Sun, 17 Oct 2021 23:18:58 +1100 Subject: [PATCH] Add FourCC comment --- internal/cgen/base/fundamental-public.h | 12 +++++++++++- release/c/wuffs-unsupported-snapshot.c | 12 +++++++++++- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/internal/cgen/base/fundamental-public.h b/internal/cgen/base/fundamental-public.h index c6e468d9..d908b206 100644 --- a/internal/cgen/base/fundamental-public.h +++ b/internal/cgen/base/fundamental-public.h @@ -474,7 +474,17 @@ typedef struct wuffs_base__transform__output__struct { // -------- -// FourCC constants. +// FourCC constants. Four Character Codes are literally four ASCII characters +// (sometimes padded with ' ' spaces) that pack neatly into a signed or +// unsigned 32-bit integer. ASCII letters are conventionally upper case. +// +// They are often used to identify video codecs (e.g. "H265") and pixel formats +// (e.g. "YV12"). Wuffs uses them for that but also generally for naming +// various things: compression formats (e.g. "BZ2 "), image metadata (e.g. +// "EXIF"), file formats (e.g. "HTML"), etc. +// +// Wuffs' u32 values are big-endian ("JPEG" is 0x4A504547 not 0x4745504A) to +// preserve ordering: "JPEG" < "MP3 " and 0x4A504547 < 0x4D503320. // ยก INSERT FourCCs. diff --git a/release/c/wuffs-unsupported-snapshot.c b/release/c/wuffs-unsupported-snapshot.c index c8a96ea2..d105b997 100644 --- a/release/c/wuffs-unsupported-snapshot.c +++ b/release/c/wuffs-unsupported-snapshot.c @@ -560,7 +560,17 @@ typedef struct wuffs_base__transform__output__struct { // -------- -// FourCC constants. +// FourCC constants. Four Character Codes are literally four ASCII characters +// (sometimes padded with ' ' spaces) that pack neatly into a signed or +// unsigned 32-bit integer. ASCII letters are conventionally upper case. +// +// They are often used to identify video codecs (e.g. "H265") and pixel formats +// (e.g. "YV12"). Wuffs uses them for that but also generally for naming +// various things: compression formats (e.g. "BZ2 "), image metadata (e.g. +// "EXIF"), file formats (e.g. "HTML"), etc. +// +// Wuffs' u32 values are big-endian ("JPEG" is 0x4A504547 not 0x4745504A) to +// preserve ordering: "JPEG" < "MP3 " and 0x4A504547 < 0x4D503320. // Bitmap. #define WUFFS_BASE__FOURCC__BMP 0x424D5020