jpeginfo: human-friendly frame content description

This commit is contained in:
Přemysl Eric Janouch 2021-12-01 09:09:30 +01:00
parent 5bcaf39b32
commit 9707b6a254
Signed by: p
GPG Key ID: A0420B94F92B9493
1 changed files with 1 additions and 2 deletions

View File

@ -77,7 +77,6 @@ static const char *marker_ids[0xFF] = {
[JPG12] = "JPG12", [JPG13] = "JPG13", [COM] = "COM" [JPG12] = "JPG12", [JPG13] = "JPG13", [COM] = "COM"
}; };
/*
// The rest is "RES (Reserved)", except for 0xFF (filler) and 0x00 (invalid). // The rest is "RES (Reserved)", except for 0xFF (filler) and 0x00 (invalid).
static const char *marker_descriptions[0xFF] = { static const char *marker_descriptions[0xFF] = {
[TEM] = "For temporary private use in arithmetic coding", [TEM] = "For temporary private use in arithmetic coding",
@ -145,7 +144,6 @@ static const char *marker_descriptions[0xFF] = {
[JPG13] = "Reserved for JPEG extensions, 13", [JPG13] = "Reserved for JPEG extensions, 13",
[COM] = "Comment", [COM] = "Comment",
}; };
*/
// --- Analysis ---------------------------------------------------------------- // --- Analysis ----------------------------------------------------------------
// Because the JPEG file format is simple, just do it manually. // Because the JPEG file format is simple, just do it manually.
@ -231,6 +229,7 @@ parse_marker(uint8_t marker, const uint8_t *p, const uint8_t *end,
case DHP: // B.2.2 and B.3.2. case DHP: // B.2.2 and B.3.2.
// As per B.2.5, Y can be zero, then there needs to be a DNL segment. // As per B.2.5, Y can be zero, then there needs to be a DNL segment.
*o = add_to_subarray(*o, "info", JV_OBJECT( *o = add_to_subarray(*o, "info", JV_OBJECT(
jv_string("type"), jv_string(marker_descriptions[marker]),
jv_string("bits"), jv_number(payload[0]), jv_string("bits"), jv_number(payload[0]),
jv_string("height"), jv_number(payload[1] << 8 | payload[2]), jv_string("height"), jv_number(payload[1] << 8 | payload[2]),
jv_string("width"), jv_number(payload[3] << 8 | payload[4]), jv_string("width"), jv_number(payload[3] << 8 | payload[4]),