std/handsum: add Potato, Gray variants

This commit is contained in:
Nigel Tao committed 2026-04-13 00:20:06 +10:00
1 parent cbdc4d5f64
commit dd8db5dbb8
9 files changed
+465 -104

No files matched your search

+27 -5
View File
@@ -38,12 +38,12 @@ of running in a very restrictive sandbox (Linux's SECCOMP_MODE_STRICT).
See example/convert-to-nia and example/imageviewer in the Wuffs repository for
examples of using its C and C++ APIs.
Coming back to this program, pass the -demo flag to decode five versions of the
same image of the Mona Lisa, in Thumbhash, Handsum, PKM/ETC2, JPEG and PNG
formats. Only the last one is lossless.
Coming back to this program, pass the -demo flag to decode six versions of the
same image of the Mona Lisa, in Thumbhash, Handsum (HVXC), Handsum (HVPC),
PKM/ETC2, JPEG and PNG formats. Only the last one is lossless.
As of September 2024, the actual STB Image implementation only decodes two out
of five: JPEG and PNG. Wuffs' reimplementation decodes all five demo images.
As of April 2026, the actual STB Image implementation only decodes two out of
six: JPEG and PNG. Wuffs' reimplementation decodes all six demo images.
Define the DECODE_ONLY_JPEG macro to limit the variety of image file formats
that Wuffs decodes to just JPEG, for smaller binaries and faster compiles.
@@ -233,6 +233,23 @@ const uint8_t g_src_ptr__mona_lisa_21_32_hvxc_handsum[] = {
};
const size_t g_src_len__mona_lisa_21_32_hvxc_handsum = 48;
const uint8_t g_src_ptr__mona_lisa_21_32_hvpc_handsum[] = {
0xfe, 0xd7, 0xf4, 0x87, 0x7a, 0xa8, 0x87, 0x7b, 0x87, 0xa7, 0x84, 0x59,
0x47, 0x95, 0x98, 0xa4, 0x56, 0x78, 0x54, 0x77, 0x2a, 0x94, 0x59, 0x87,
0x93, 0x88, 0xfd, 0x96, 0x76, 0xa8, 0x97, 0x7b, 0xb8, 0x14, 0x5b, 0x2f,
0xb8, 0x97, 0x87, 0x14, 0x25, 0x7c, 0xa5, 0x66, 0x58, 0x18, 0x3e, 0xb8,
0xc4, 0x66, 0xa8, 0xb5, 0x48, 0x64, 0xb3, 0x66, 0x0a, 0x73, 0x36, 0x98,
0x83, 0x2b, 0x87, 0x71, 0x27, 0x6a, 0xa6, 0x66, 0x76, 0x81, 0x18, 0x79,
0x82, 0x14, 0x58, 0x34, 0x30, 0x88, 0x92, 0x48, 0x6b, 0x81, 0x17, 0x78,
0x91, 0x38, 0x7a, 0x63, 0x2a, 0x97, 0x81, 0x27, 0x8a, 0x71, 0x07, 0x78,
0x90, 0x18, 0x79, 0x87, 0x68, 0x77, 0x87, 0x79, 0x88, 0x87, 0x77, 0x85,
0xb7, 0x76, 0x78, 0x87, 0x79, 0xa7, 0x98, 0x8a, 0x97, 0x78, 0x79, 0xc8,
0x98, 0x9a, 0x88, 0x88, 0x99, 0xaa, 0x78, 0x89, 0x98, 0x88, 0x99, 0x8a,
0x69, 0x89, 0x98, 0x89, 0x97, 0x78, 0x88, 0x97, 0x79, 0x98, 0x98, 0x68,
0x89, 0x87, 0x89,
};
const size_t g_src_len__mona_lisa_21_32_hvpc_handsum = 147;
const uint8_t g_src_ptr__mona_lisa_21_32_etc2_pkm[] = {
0x50, 0x4b, 0x4d, 0x20, 0x32, 0x30, 0x00, 0x01, 0x00, 0x18, 0x00, 0x20,
0x00, 0x15, 0x00, 0x20, 0xb2, 0x74, 0x15, 0x32, 0x74, 0x8c, 0xb3, 0x18,
@@ -1021,6 +1038,11 @@ main(int argc, char** argv) {
g_src_ptr__mona_lisa_21_32_hvxc_handsum,
g_src_len__mona_lisa_21_32_hvxc_handsum,
},
{
"«demo»/mona-lisa.21x32.hvpc.handsum",
g_src_ptr__mona_lisa_21_32_hvpc_handsum,
g_src_len__mona_lisa_21_32_hvpc_handsum,
},
{
"«demo»/mona-lisa.21x32.etc2.pkm",
g_src_ptr__mona_lisa_21_32_etc2_pkm,
+202 -48
View File
@@ -10485,7 +10485,6 @@ struct wuffs_gzip__decoder__struct {
extern const char wuffs_handsum__error__bad_header[];
extern const char wuffs_handsum__error__truncated_input[];
extern const char wuffs_handsum__error__unsupported_handsum_file[];
// ---------------- Public Consts
@@ -10656,6 +10655,7 @@ struct wuffs_handsum__decoder__struct {
uint32_t f_width;
uint32_t f_height;
uint32_t f_variant;
uint8_t f_call_sequence;
uint16_t f_bit_offset;
uint16_t f_coeffs[40];
@@ -10670,7 +10670,7 @@ struct wuffs_handsum__decoder__struct {
} private_impl;
struct {
uint8_t f_bits[64];
uint8_t f_bits[256];
uint8_t f_buffers[2][32][128];
struct {
@@ -50313,10 +50313,14 @@ wuffs_gzip__decoder__do_transform_io(
const char wuffs_handsum__error__bad_header[] = "#handsum: bad header";
const char wuffs_handsum__error__truncated_input[] = "#handsum: truncated input";
const char wuffs_handsum__error__unsupported_handsum_file[] = "#handsum: unsupported Handsum file";
// ---------------- Private Consts
static const uint32_t
WUFFS_HANDSUM__PAYLOAD_SIZES[4] WUFFS_BASE__POTENTIALLY_UNUSED = {
30u, 45u, 96u, 144u,
};
static const uint8_t
WUFFS_HANDSUM__CLAMP_7[32] WUFFS_BASE__POTENTIALLY_UNUSED = {
0u, 1u, 2u, 3u, 4u, 5u, 6u, 7u,
@@ -50528,7 +50532,7 @@ wuffs_handsum__decoder__do_decode_frame(
WUFFS_BASE__GENERATED_C_CODE
static wuffs_base__empty_struct
wuffs_handsum__decoder__decode_block(
wuffs_handsum__decoder__decode_pblock(
wuffs_handsum__decoder* self,
uint32_t a_which,
uint32_t a_y_offset,
@@ -50536,7 +50540,15 @@ wuffs_handsum__decoder__decode_block(
WUFFS_BASE__GENERATED_C_CODE
static wuffs_base__empty_struct
wuffs_handsum__decoder__decode_coeffs(
wuffs_handsum__decoder__decode_xblock(
wuffs_handsum__decoder* self,
uint32_t a_which,
uint32_t a_y_offset,
uint32_t a_x_offset);
WUFFS_BASE__GENERATED_C_CODE
static wuffs_base__empty_struct
wuffs_handsum__decoder__decode_xcoeffs(
wuffs_handsum__decoder* self);
WUFFS_BASE__GENERATED_C_CODE
@@ -50546,27 +50558,38 @@ wuffs_handsum__decoder__smooth_luma_block_seams(
WUFFS_BASE__GENERATED_C_CODE
static wuffs_base__empty_struct
wuffs_handsum__decoder__upsample_chroma(
wuffs_handsum__decoder__upsample_8_to_16_chroma(
wuffs_handsum__decoder* self);
WUFFS_BASE__GENERATED_C_CODE
static wuffs_base__empty_struct
wuffs_handsum__decoder__upsample_bgr(
wuffs_handsum__decoder__upsample_16_to_32_bgr(
wuffs_handsum__decoder* self);
WUFFS_BASE__GENERATED_C_CODE
static wuffs_base__empty_struct
wuffs_handsum__decoder__convert_ycc_to_bgr(
wuffs_handsum__decoder__convert_32_bgr_to_y(
wuffs_handsum__decoder* self,
uint32_t a_which);
WUFFS_BASE__GENERATED_C_CODE
static wuffs_base__empty_struct
wuffs_handsum__decoder__convert_16_y_to_bgr(
wuffs_handsum__decoder* self);
WUFFS_BASE__GENERATED_C_CODE
static wuffs_base__empty_struct
wuffs_handsum__decoder__scale_1d_horizontal(
wuffs_handsum__decoder__convert_16_ycc_to_bgr(
wuffs_handsum__decoder* self);
WUFFS_BASE__GENERATED_C_CODE
static wuffs_base__empty_struct
wuffs_handsum__decoder__scale_1d_vertical(
wuffs_handsum__decoder__scale_32_horizontal(
wuffs_handsum__decoder* self);
WUFFS_BASE__GENERATED_C_CODE
static wuffs_base__empty_struct
wuffs_handsum__decoder__scale_32_vertical(
wuffs_handsum__decoder* self);
WUFFS_BASE__GENERATED_C_CODE
@@ -50801,6 +50824,7 @@ wuffs_handsum__decoder__do_decode_image_config(
wuffs_base__status status = wuffs_base__make_status(NULL);
uint32_t v_c32 = 0;
uint32_t v_pixfmt = 0;
const uint8_t* iop_a_src = NULL;
const uint8_t* io0_a_src WUFFS_BASE__POTENTIALLY_UNUSED = NULL;
@@ -50863,10 +50887,7 @@ wuffs_handsum__decoder__do_decode_image_config(
uint32_t t_1 = *iop_a_src++;
v_c32 = t_1;
}
if ((v_c32 & 192u) != 64u) {
status = wuffs_base__make_status(wuffs_handsum__error__unsupported_handsum_file);
goto exit;
}
self->private_impl.f_variant = (v_c32 >> 6u);
if ((v_c32 & 32u) == 0u) {
self->private_impl.f_width = 32u;
self->private_impl.f_height = ((v_c32 & 31u) + 1u);
@@ -50875,9 +50896,13 @@ wuffs_handsum__decoder__do_decode_image_config(
self->private_impl.f_height = 32u;
}
if (a_dst != NULL) {
v_pixfmt = 536870920u;
if ((self->private_impl.f_variant & 1u) != 0u) {
v_pixfmt = 2415954056u;
}
wuffs_base__image_config__set(
a_dst,
2415954056u,
v_pixfmt,
0u,
self->private_impl.f_width,
self->private_impl.f_height,
@@ -51145,6 +51170,7 @@ wuffs_handsum__decoder__do_decode_frame(
wuffs_base__decode_frame_options* a_opts) {
wuffs_base__status status = wuffs_base__make_status(NULL);
uint32_t v_pixfmt = 0;
wuffs_base__status v_status = wuffs_base__make_status(NULL);
uint32_t v_num_read = 0;
uint32_t v_which = 0;
@@ -51184,10 +51210,14 @@ wuffs_handsum__decoder__do_decode_frame(
status = wuffs_base__make_status(wuffs_base__note__end_of_data);
goto ok;
}
v_pixfmt = 536870920u;
if ((self->private_impl.f_variant & 1u) != 0u) {
v_pixfmt = 2415954056u;
}
v_status = wuffs_base__pixel_swizzler__prepare(&self->private_impl.f_swizzler,
wuffs_base__pixel_buffer__pixel_format(a_dst),
wuffs_base__pixel_buffer__palette(a_dst),
wuffs_base__utility__make_pixel_format(2415954056u),
wuffs_base__utility__make_pixel_format(v_pixfmt),
wuffs_base__utility__empty_slice_u8(),
a_blend);
if ( ! wuffs_base__status__is_ok(&v_status)) {
@@ -51200,32 +51230,52 @@ wuffs_handsum__decoder__do_decode_frame(
}
goto ok;
}
while (v_num_read < 45u) {
while (v_num_read < WUFFS_HANDSUM__PAYLOAD_SIZES[self->private_impl.f_variant]) {
v_num_read += wuffs_private_impl__io_reader__limited_copy_u32_to_slice(
&iop_a_src, io2_a_src,(45u - v_num_read), wuffs_base__make_slice_u8_ij(self->private_data.f_bits, v_num_read, 64));
if (v_num_read < 45u) {
&iop_a_src, io2_a_src,(WUFFS_HANDSUM__PAYLOAD_SIZES[self->private_impl.f_variant] - v_num_read), wuffs_base__make_slice_u8_ij(self->private_data.f_bits, v_num_read, 256));
if (v_num_read < WUFFS_HANDSUM__PAYLOAD_SIZES[self->private_impl.f_variant]) {
status = wuffs_base__make_status(wuffs_base__suspension__short_read);
WUFFS_BASE__COROUTINE_SUSPENSION_POINT_MAYBE_SUSPEND(2);
}
}
self->private_impl.f_bit_offset = 0u;
wuffs_handsum__decoder__decode_block(self, 0u, 0u, 0u);
wuffs_handsum__decoder__decode_block(self, 0u, 0u, 32u);
wuffs_handsum__decoder__decode_block(self, 0u, 8u, 0u);
wuffs_handsum__decoder__decode_block(self, 0u, 8u, 32u);
wuffs_handsum__decoder__decode_block(self, 1u, 0u, 1u);
wuffs_handsum__decoder__decode_block(self, 1u, 0u, 2u);
if (self->private_impl.f_variant < 2u) {
wuffs_handsum__decoder__decode_xblock(self, 0u, 0u, 0u);
wuffs_handsum__decoder__decode_xblock(self, 0u, 0u, 32u);
wuffs_handsum__decoder__decode_xblock(self, 0u, 8u, 0u);
wuffs_handsum__decoder__decode_xblock(self, 0u, 8u, 32u);
if (self->private_impl.f_variant == 1u) {
wuffs_handsum__decoder__decode_xblock(self, 1u, 0u, 1u);
wuffs_handsum__decoder__decode_xblock(self, 1u, 0u, 2u);
}
} else {
wuffs_handsum__decoder__decode_pblock(self, 0u, 0u, 0u);
wuffs_handsum__decoder__decode_pblock(self, 0u, 0u, 32u);
wuffs_handsum__decoder__decode_pblock(self, 0u, 8u, 0u);
wuffs_handsum__decoder__decode_pblock(self, 0u, 8u, 32u);
if (self->private_impl.f_variant == 3u) {
wuffs_handsum__decoder__decode_pblock(self, 1u, 0u, 1u);
wuffs_handsum__decoder__decode_pblock(self, 1u, 0u, 2u);
}
}
wuffs_handsum__decoder__smooth_luma_block_seams(self);
wuffs_handsum__decoder__upsample_chroma(self);
wuffs_handsum__decoder__convert_ycc_to_bgr(self);
wuffs_handsum__decoder__upsample_bgr(self);
if ((self->private_impl.f_variant & 1u) == 0u) {
wuffs_handsum__decoder__convert_16_y_to_bgr(self);
} else {
wuffs_handsum__decoder__upsample_8_to_16_chroma(self);
wuffs_handsum__decoder__convert_16_ycc_to_bgr(self);
}
wuffs_handsum__decoder__upsample_16_to_32_bgr(self);
v_which = 1u;
if (self->private_impl.f_width < 32u) {
v_which = 0u;
wuffs_handsum__decoder__scale_1d_horizontal(self);
wuffs_handsum__decoder__scale_32_horizontal(self);
} else if (self->private_impl.f_height < 32u) {
v_which = 0u;
wuffs_handsum__decoder__scale_1d_vertical(self);
wuffs_handsum__decoder__scale_32_vertical(self);
}
if ((self->private_impl.f_variant & 1u) == 0u) {
wuffs_handsum__decoder__convert_32_bgr_to_y(self, v_which);
}
v_status = wuffs_handsum__decoder__from_pixels_to_dst(self, a_dst, v_which);
if ( ! wuffs_base__status__is_ok(&v_status)) {
@@ -51259,11 +51309,64 @@ wuffs_handsum__decoder__do_decode_frame(
return status;
}
// -------- func handsum.decoder.decode_block
// -------- func handsum.decoder.decode_pblock
WUFFS_BASE__GENERATED_C_CODE
static wuffs_base__empty_struct
wuffs_handsum__decoder__decode_block(
wuffs_handsum__decoder__decode_pblock(
wuffs_handsum__decoder* self,
uint32_t a_which,
uint32_t a_y_offset,
uint32_t a_x_offset) {
uint32_t v_bo = 0;
uint32_t v_y = 0;
uint32_t v_x = 0;
uint32_t v_sw = 0;
uint32_t v_sx = 0;
uint32_t v_sy = 0;
uint8_t v_v00 = 0;
uint8_t v_v01 = 0;
uint8_t v_v10 = 0;
uint8_t v_v11 = 0;
v_bo = ((uint32_t)(self->private_impl.f_bit_offset));
v_y = 0u;
while (v_y < 8u) {
v_x = 0u;
while (v_x < 8u) {
v_sw = ((uint32_t)(((uint32_t)(((uint32_t)(((uint8_t)(((uint8_t)(self->private_data.f_bits[((v_bo >> 3u) & 255u)] >> (v_bo & 4u))) & 15u)))) * 17u)) - 128u));
v_bo += 4u;
v_sx = ((uint32_t)(((uint32_t)(((uint32_t)(((uint8_t)(((uint8_t)(self->private_data.f_bits[((v_bo >> 3u) & 255u)] >> (v_bo & 4u))) & 15u)))) * 8u)) - 64u));
v_bo += 4u;
v_sy = ((uint32_t)(((uint32_t)(((uint32_t)(((uint8_t)(((uint8_t)(self->private_data.f_bits[((v_bo >> 3u) & 255u)] >> (v_bo & 4u))) & 15u)))) * 8u)) - 64u));
v_bo += 4u;
v_v00 = WUFFS_HANDSUM__BIAS_AND_CLAMP[(((uint32_t)(((uint32_t)(v_sw - v_sy)) - v_sx)) & 1023u)];
v_v01 = WUFFS_HANDSUM__BIAS_AND_CLAMP[(((uint32_t)(((uint32_t)(v_sw - v_sy)) + v_sx)) & 1023u)];
v_v10 = WUFFS_HANDSUM__BIAS_AND_CLAMP[(((uint32_t)(((uint32_t)(v_sw + v_sy)) - v_sx)) & 1023u)];
v_v11 = WUFFS_HANDSUM__BIAS_AND_CLAMP[(((uint32_t)(((uint32_t)(v_sw + v_sy)) + v_sx)) & 1023u)];
if (a_which != 0u) {
v_v00 = WUFFS_HANDSUM__BIAS_AND_CLAMP[(((uint32_t)(((uint32_t)(v_v00)) - 136u)) & 1023u)];
v_v01 = WUFFS_HANDSUM__BIAS_AND_CLAMP[(((uint32_t)(((uint32_t)(v_v01)) - 136u)) & 1023u)];
v_v10 = WUFFS_HANDSUM__BIAS_AND_CLAMP[(((uint32_t)(((uint32_t)(v_v10)) - 136u)) & 1023u)];
v_v11 = WUFFS_HANDSUM__BIAS_AND_CLAMP[(((uint32_t)(((uint32_t)(v_v11)) - 136u)) & 1023u)];
}
self->private_data.f_buffers[a_which][(a_y_offset + v_y + 0u)][(a_x_offset + (4u * v_x) + 0u)] = v_v00;
self->private_data.f_buffers[a_which][(a_y_offset + v_y + 0u)][(a_x_offset + (4u * v_x) + 4u)] = v_v01;
self->private_data.f_buffers[a_which][(a_y_offset + v_y + 1u)][(a_x_offset + (4u * v_x) + 0u)] = v_v10;
self->private_data.f_buffers[a_which][(a_y_offset + v_y + 1u)][(a_x_offset + (4u * v_x) + 4u)] = v_v11;
v_x += 2u;
}
v_y += 2u;
}
self->private_impl.f_bit_offset = ((uint16_t)(v_bo));
return wuffs_base__make_empty_struct();
}
// -------- func handsum.decoder.decode_xblock
WUFFS_BASE__GENERATED_C_CODE
static wuffs_base__empty_struct
wuffs_handsum__decoder__decode_xblock(
wuffs_handsum__decoder* self,
uint32_t a_which,
uint32_t a_y_offset,
@@ -51280,7 +51383,7 @@ wuffs_handsum__decoder__decode_block(
uint64_t v_c_16 = 0;
uint64_t v_result_0 = 0;
wuffs_handsum__decoder__decode_coeffs(self);
wuffs_handsum__decoder__decode_xcoeffs(self);
v_y = 0u;
while (v_y < 8u) {
v_x = 0u;
@@ -51315,23 +51418,23 @@ wuffs_handsum__decoder__decode_block(
return wuffs_base__make_empty_struct();
}
// -------- func handsum.decoder.decode_coeffs
// -------- func handsum.decoder.decode_xcoeffs
WUFFS_BASE__GENERATED_C_CODE
static wuffs_base__empty_struct
wuffs_handsum__decoder__decode_coeffs(
wuffs_handsum__decoder__decode_xcoeffs(
wuffs_handsum__decoder* self) {
uint32_t v_bo = 0;
uint8_t v_nibble = 0;
uint32_t v_i = 0;
v_bo = ((uint32_t)(self->private_impl.f_bit_offset));
v_nibble = ((uint8_t)(((uint8_t)(self->private_data.f_bits[((v_bo >> 3u) & 63u)] >> (v_bo & 4u))) & 15u));
v_nibble = ((uint8_t)(((uint8_t)(self->private_data.f_bits[((v_bo >> 3u) & 255u)] >> (v_bo & 4u))) & 15u));
self->private_impl.f_coeffs[0u] = ((uint16_t)(((uint16_t)(((uint16_t)(v_nibble)) - 8u)) * 128u));
v_bo += 4u;
v_i = 1u;
while (v_i < 15u) {
v_nibble = ((uint8_t)(((uint8_t)(self->private_data.f_bits[((v_bo >> 3u) & 63u)] >> (v_bo & 4u))) & 15u));
v_nibble = ((uint8_t)(((uint8_t)(self->private_data.f_bits[((v_bo >> 3u) & 255u)] >> (v_bo & 4u))) & 15u));
self->private_impl.f_coeffs[WUFFS_HANDSUM__ZIGZAG[v_i]] = ((uint16_t)(((uint16_t)(((uint16_t)(v_nibble)) - 8u)) * 16u));
v_bo += 4u;
v_i += 1u;
@@ -51413,11 +51516,11 @@ wuffs_handsum__decoder__smooth_luma_block_seams(
return wuffs_base__make_empty_struct();
}
// -------- func handsum.decoder.upsample_chroma
// -------- func handsum.decoder.upsample_8_to_16_chroma
WUFFS_BASE__GENERATED_C_CODE
static wuffs_base__empty_struct
wuffs_handsum__decoder__upsample_chroma(
wuffs_handsum__decoder__upsample_8_to_16_chroma(
wuffs_handsum__decoder* self) {
uint32_t v_y = 0;
uint32_t v_dy = 0;
@@ -51455,11 +51558,11 @@ wuffs_handsum__decoder__upsample_chroma(
return wuffs_base__make_empty_struct();
}
// -------- func handsum.decoder.upsample_bgr
// -------- func handsum.decoder.upsample_16_to_32_bgr
WUFFS_BASE__GENERATED_C_CODE
static wuffs_base__empty_struct
wuffs_handsum__decoder__upsample_bgr(
wuffs_handsum__decoder__upsample_16_to_32_bgr(
wuffs_handsum__decoder* self) {
uint32_t v_y = 0;
uint32_t v_dy = 0;
@@ -51503,11 +51606,57 @@ wuffs_handsum__decoder__upsample_bgr(
return wuffs_base__make_empty_struct();
}
// -------- func handsum.decoder.convert_ycc_to_bgr
// -------- func handsum.decoder.convert_32_bgr_to_y
WUFFS_BASE__GENERATED_C_CODE
static wuffs_base__empty_struct
wuffs_handsum__decoder__convert_ycc_to_bgr(
wuffs_handsum__decoder__convert_32_bgr_to_y(
wuffs_handsum__decoder* self,
uint32_t a_which) {
uint32_t v_y = 0;
uint32_t v_x = 0;
v_y = 0u;
while (v_y < 32u) {
v_x = 1u;
while (v_x < 32u) {
self->private_data.f_buffers[a_which][v_y][v_x] = self->private_data.f_buffers[a_which][v_y][(4u * v_x)];
v_x += 1u;
}
v_y += 1u;
}
return wuffs_base__make_empty_struct();
}
// -------- func handsum.decoder.convert_16_y_to_bgr
WUFFS_BASE__GENERATED_C_CODE
static wuffs_base__empty_struct
wuffs_handsum__decoder__convert_16_y_to_bgr(
wuffs_handsum__decoder* self) {
uint32_t v_y = 0;
uint32_t v_x = 0;
uint8_t v_gray = 0;
v_y = 0u;
while (v_y < 16u) {
v_x = 0u;
while (v_x < 16u) {
v_gray = self->private_data.f_buffers[0u][v_y][((4u * v_x) + 0u)];
self->private_data.f_buffers[0u][v_y][((4u * v_x) + 1u)] = v_gray;
self->private_data.f_buffers[0u][v_y][((4u * v_x) + 2u)] = v_gray;
v_x += 1u;
}
v_y += 1u;
}
return wuffs_base__make_empty_struct();
}
// -------- func handsum.decoder.convert_16_ycc_to_bgr
WUFFS_BASE__GENERATED_C_CODE
static wuffs_base__empty_struct
wuffs_handsum__decoder__convert_16_ycc_to_bgr(
wuffs_handsum__decoder* self) {
uint32_t v_y = 0;
uint32_t v_x = 0;
@@ -51553,11 +51702,11 @@ wuffs_handsum__decoder__convert_ycc_to_bgr(
return wuffs_base__make_empty_struct();
}
// -------- func handsum.decoder.scale_1d_horizontal
// -------- func handsum.decoder.scale_32_horizontal
WUFFS_BASE__GENERATED_C_CODE
static wuffs_base__empty_struct
wuffs_handsum__decoder__scale_1d_horizontal(
wuffs_handsum__decoder__scale_32_horizontal(
wuffs_handsum__decoder* self) {
uint32_t v_y = 0;
uint32_t v_dstx = 0;
@@ -51610,11 +51759,11 @@ wuffs_handsum__decoder__scale_1d_horizontal(
return wuffs_base__make_empty_struct();
}
// -------- func handsum.decoder.scale_1d_vertical
// -------- func handsum.decoder.scale_32_vertical
WUFFS_BASE__GENERATED_C_CODE
static wuffs_base__empty_struct
wuffs_handsum__decoder__scale_1d_vertical(
wuffs_handsum__decoder__scale_32_vertical(
wuffs_handsum__decoder* self) {
uint32_t v_x = 0;
uint32_t v_dsty = 0;
@@ -51682,6 +51831,7 @@ wuffs_handsum__decoder__from_pixels_to_dst(
wuffs_base__table_u8 v_tab = {0};
uint32_t v_y = 0;
wuffs_base__slice_u8 v_dst = {0};
uint32_t v_src_bytes_per_pixel = 0;
wuffs_base__slice_u8 v_src = {0};
v_dst_pixfmt = wuffs_base__pixel_buffer__pixel_format(a_dst);
@@ -51692,8 +51842,12 @@ wuffs_handsum__decoder__from_pixels_to_dst(
v_dst_bytes_per_pixel = (v_dst_bits_per_pixel / 8u);
v_dst_bytes_per_row = ((uint64_t)((self->private_impl.f_width * v_dst_bytes_per_pixel)));
v_tab = wuffs_base__pixel_buffer__plane(a_dst, 0u);
v_src_bytes_per_pixel = 1u;
if ((self->private_impl.f_variant & 1u) != 0u) {
v_src_bytes_per_pixel = 4u;
}
while (v_y < self->private_impl.f_height) {
v_src = wuffs_base__make_slice_u8(self->private_data.f_buffers[a_which][v_y], (self->private_impl.f_width * 4u));
v_src = wuffs_base__make_slice_u8(self->private_data.f_buffers[a_which][v_y], (self->private_impl.f_width * v_src_bytes_per_pixel));
v_dst = wuffs_private_impl__table_u8__row_u32(v_tab, v_y);
if (v_dst_bytes_per_row < ((uint64_t)(v_dst.len))) {
v_dst = wuffs_base__slice_u8__subslice_j(v_dst, v_dst_bytes_per_row);
+183 -49
View File
@@ -10,30 +10,19 @@
// --------
// Handsum is a very lossy format for very small thumbnails. Very small in
// terms of image dimensions, up to 32×32 pixels, but also in terms of file
// size. Every Handsum image file is exactly 48 bytes (384 bits) long. This can
// imply using as little as 0.046875 bytes (0.375 bits) per pixel.
// Handsum is a very lossy format for very small thumbnails.
//
// Each Handsum image is essentially a scaled 16×16 pixel YCbCr 4:2:0 JPEG MCU
// (Minimum Coded Unit; 4 Luma and 2 Chroma blocks), keeping only the 15 lowest
// frequency DCT (Discrete Cosine Transform) coefficients. Each of the (6 × 15)
// = 90 coefficients are encoded as one nibble (4 bits) with fixed quantization
// factors, totalling 45 bytes. The initial 3 bytes holds a 16-bit magic
// signature, 2-bit version number and 6-bit aspect ratio.
//
// As of February 2025, the latest version is Version 0. All Version 0 files
// use the sRGB color profile.
// See the lib/handsum Go implementation for more about the file format.
pub status "#bad header"
pub status "#truncated input"
pub status "#unsupported Handsum file"
pub const DECODER_WORKBUF_LEN_MAX_INCL_WORST_CASE : base.u64 = 0
pub struct decoder? implements base.image_decoder(
width : base.u32[..= 32],
height : base.u32[..= 32],
width : base.u32[..= 32],
height : base.u32[..= 32],
variant : base.u32[..= 3],
// The call sequence state machine is discussed in
// (/doc/std/image-decoders-call-sequence.md).
@@ -46,7 +35,7 @@ pub struct decoder? implements base.image_decoder(
swizzler : base.pixel_swizzler,
util : base.utility,
) + (
bits : array[64] base.u8,
bits : array[256] base.u8,
buffers : array[2] array[32] array[128] base.u8,
)
@@ -71,7 +60,8 @@ pub func decoder.decode_image_config?(dst: nptr base.image_config, src: base.io_
}
pri func decoder.do_decode_image_config?(dst: nptr base.image_config, src: base.io_reader) {
var c32 : base.u32
var c32 : base.u32
var pixfmt : base.u32
if this.call_sequence <> 0x00 {
return base."#bad call sequence"
@@ -82,9 +72,7 @@ pri func decoder.do_decode_image_config?(dst: nptr base.image_config, src: base.
return "#bad header"
}
c32 = args.src.read_u8_as_u32?()
if (c32 & 0xC0) <> 0x40 {
return "#unsupported Handsum file"
}
this.variant = c32 >> 6
if (c32 & 0x20) == 0x00 { // Landscape.
this.width = 32
@@ -95,8 +83,13 @@ pri func decoder.do_decode_image_config?(dst: nptr base.image_config, src: base.
}
if args.dst <> nullptr {
pixfmt = base.PIXEL_FORMAT__Y
if (this.variant & 1) <> 0 {
pixfmt = base.PIXEL_FORMAT__BGRX
}
args.dst.set!(
pixfmt: base.PIXEL_FORMAT__BGRX,
pixfmt: pixfmt,
pixsub: 0,
width: this.width,
height: this.height,
@@ -166,6 +159,7 @@ pub func decoder.decode_frame?(dst: ptr base.pixel_buffer, src: base.io_reader,
}
pri func decoder.do_decode_frame?(dst: ptr base.pixel_buffer, src: base.io_reader, blend: base.pixel_blend, workbuf: slice base.u8, opts: nptr base.decode_frame_options) {
var pixfmt : base.u32
var status : base.status
var num_read : base.u32
var which : base.u32[..= 1]
@@ -178,44 +172,75 @@ pri func decoder.do_decode_frame?(dst: ptr base.pixel_buffer, src: base.io_reade
return base."@end of data"
}
pixfmt = base.PIXEL_FORMAT__Y
if (this.variant & 1) <> 0 {
pixfmt = base.PIXEL_FORMAT__BGRX
}
status = this.swizzler.prepare!(
dst_pixfmt: args.dst.pixel_format(),
dst_palette: args.dst.palette(),
src_pixfmt: this.util.make_pixel_format(repr: base.PIXEL_FORMAT__BGRX),
src_pixfmt: this.util.make_pixel_format(repr: pixfmt),
src_palette: this.util.empty_slice_u8(),
blend: args.blend)
if not status.is_ok() {
return status
}
while num_read < 45 {
while num_read < PAYLOAD_SIZES[this.variant] {
assert num_read < 256 via "a < b: a < c; c <= b"(c: PAYLOAD_SIZES[this.variant])
assert PAYLOAD_SIZES[this.variant] > num_read via "a > b: b < a"()
num_read ~mod+= args.src.limited_copy_u32_to_slice!(
up_to: 45 - num_read,
up_to: PAYLOAD_SIZES[this.variant] - num_read,
s: this.bits[num_read ..])
if num_read < 45 {
if num_read < PAYLOAD_SIZES[this.variant] {
yield? base."$short read"
}
}
this.bit_offset = 0
this.decode_block!(which: 0, y_offset: 0, x_offset: 4 * 0)
this.decode_block!(which: 0, y_offset: 0, x_offset: 4 * 8)
this.decode_block!(which: 0, y_offset: 8, x_offset: 4 * 0)
this.decode_block!(which: 0, y_offset: 8, x_offset: 4 * 8)
this.decode_block!(which: 1, y_offset: 0, x_offset: 1)
this.decode_block!(which: 1, y_offset: 0, x_offset: 2)
if this.variant < 2 {
this.decode_xblock!(which: 0, y_offset: 0, x_offset: 4 * 0)
this.decode_xblock!(which: 0, y_offset: 0, x_offset: 4 * 8)
this.decode_xblock!(which: 0, y_offset: 8, x_offset: 4 * 0)
this.decode_xblock!(which: 0, y_offset: 8, x_offset: 4 * 8)
if this.variant == 1 {
this.decode_xblock!(which: 1, y_offset: 0, x_offset: 1)
this.decode_xblock!(which: 1, y_offset: 0, x_offset: 2)
}
} else {
this.decode_pblock!(which: 0, y_offset: 0, x_offset: 4 * 0)
this.decode_pblock!(which: 0, y_offset: 0, x_offset: 4 * 8)
this.decode_pblock!(which: 0, y_offset: 8, x_offset: 4 * 0)
this.decode_pblock!(which: 0, y_offset: 8, x_offset: 4 * 8)
if this.variant == 3 {
this.decode_pblock!(which: 1, y_offset: 0, x_offset: 1)
this.decode_pblock!(which: 1, y_offset: 0, x_offset: 2)
}
}
this.smooth_luma_block_seams!()
this.upsample_chroma!()
this.convert_ycc_to_bgr!()
this.upsample_bgr!()
if (this.variant & 1) == 0 {
this.convert_16_y_to_bgr!()
} else {
this.upsample_8_to_16_chroma!()
this.convert_16_ycc_to_bgr!()
}
this.upsample_16_to_32_bgr!()
which = 1
if this.width < 32 {
which = 0
this.scale_1d_horizontal!()
this.scale_32_horizontal!()
} else if this.height < 32 {
which = 0
this.scale_1d_vertical!()
this.scale_32_vertical!()
}
if (this.variant & 1) == 0 {
this.convert_32_bgr_to_y!(which: which)
}
status = this.from_pixels_to_dst!(dst: args.dst, which: which)
@@ -226,11 +251,71 @@ pri func decoder.do_decode_frame?(dst: ptr base.pixel_buffer, src: base.io_reade
this.call_sequence = 0x60
}
// decode_block calls decode_coeffs and then performs an Inverse Discrete
pri func decoder.decode_pblock!(which: base.u32[..= 1], y_offset: base.u32[..= 8], x_offset: base.u32[..= 32]) {
var bo : base.u32
var y : base.u32
var x : base.u32
var sw : base.u32
var sx : base.u32
var sy : base.u32
var v00 : base.u8
var v01 : base.u8
var v10 : base.u8
var v11 : base.u8
bo = this.bit_offset as base.u32
y = 0
while y < 8 {
x = 0
while x < 8,
inv y < 8,
{
// sw, sx and sy are scaled-and-biased versions of lib/handsum's
// ew, ex and ey.
//
// sw's "~mod- 0x80" is because BIAS_AND_CLAMP[0] is 0x80.
sw = ((((this.bits[(bo >> 3) & 255] >> (bo & 4)) & 15) as base.u32) ~mod* 0x11) ~mod- 0x80
bo ~mod+= 4
sx = ((((this.bits[(bo >> 3) & 255] >> (bo & 4)) & 15) as base.u32) ~mod* 0x08) ~mod- 0x40
bo ~mod+= 4
sy = ((((this.bits[(bo >> 3) & 255] >> (bo & 4)) & 15) as base.u32) ~mod* 0x08) ~mod- 0x40
bo ~mod+= 4
v00 = BIAS_AND_CLAMP[((sw ~mod- sy) ~mod- sx) & 1023]
v01 = BIAS_AND_CLAMP[((sw ~mod- sy) ~mod+ sx) & 1023]
v10 = BIAS_AND_CLAMP[((sw ~mod+ sy) ~mod- sx) & 1023]
v11 = BIAS_AND_CLAMP[((sw ~mod+ sy) ~mod+ sx) & 1023]
if args.which <> 0 {
// This does what lib/handsum calls biasDown.
v00 = BIAS_AND_CLAMP[((v00 as base.u32) ~mod- 0x88) & 1023]
v01 = BIAS_AND_CLAMP[((v01 as base.u32) ~mod- 0x88) & 1023]
v10 = BIAS_AND_CLAMP[((v10 as base.u32) ~mod- 0x88) & 1023]
v11 = BIAS_AND_CLAMP[((v11 as base.u32) ~mod- 0x88) & 1023]
}
this.buffers[args.which][args.y_offset + y + 0][args.x_offset + (4 * x) + 0] = v00
this.buffers[args.which][args.y_offset + y + 0][args.x_offset + (4 * x) + 4] = v01
this.buffers[args.which][args.y_offset + y + 1][args.x_offset + (4 * x) + 0] = v10
this.buffers[args.which][args.y_offset + y + 1][args.x_offset + (4 * x) + 4] = v11
x += 2
}
y += 2
}
this.bit_offset = (bo & 0xFFFF) as base.u16
}
// decode_xblock calls decode_xcoeffs and then performs an Inverse Discrete
// Cosine Transform. The IDCT algorithm is equivalent to the lowleveljpeg Go
// package's BlockU8.InverseDCTFrom code, although Handsum only needs to go up
// to (5, 5) in DCT space, instead of (8, 8).
pri func decoder.decode_block!(which: base.u32[..= 1], y_offset: base.u32[..= 8], x_offset: base.u32[..= 32]) {
pri func decoder.decode_xblock!(which: base.u32[..= 1], y_offset: base.u32[..= 8], x_offset: base.u32[..= 32]) {
var y : base.u32
var x : base.u32
var v : base.u32
@@ -244,7 +329,7 @@ pri func decoder.decode_block!(which: base.u32[..= 1], y_offset: base.u32[..= 8]
var c_16 : base.u64
var result_0 : base.u64
this.decode_coeffs!()
this.decode_xcoeffs!()
y = 0
while y < 8 {
@@ -308,20 +393,20 @@ pri func decoder.decode_block!(which: base.u32[..= 1], y_offset: base.u32[..= 8]
}
}
pri func decoder.decode_coeffs!() {
pri func decoder.decode_xcoeffs!() {
var bo : base.u32
var nibble : base.u8[..= 15]
var i : base.u32
bo = this.bit_offset as base.u32
nibble = (this.bits[(bo >> 3) & 63] >> (bo & 4)) & 15
nibble = (this.bits[(bo >> 3) & 255] >> (bo & 4)) & 15
this.coeffs[0] = ((nibble as base.u16) ~mod- 8) ~mod* 128
bo ~mod+= 4
i = 1
while i < 15 {
nibble = (this.bits[(bo >> 3) & 63] >> (bo & 4)) & 15
nibble = (this.bits[(bo >> 3) & 255] >> (bo & 4)) & 15
this.coeffs[ZIGZAG[i]] = ((nibble as base.u16) ~mod- 8) ~mod* 16
bo ~mod+= 4
@@ -393,7 +478,7 @@ pri func decoder.smooth_luma_block_seams!() {
this.buffers[0][8][7 * 4] = w87 as base.u8
}
pri func decoder.upsample_chroma!() {
pri func decoder.upsample_8_to_16_chroma!() {
var y : base.u32
var dy : base.u32
var y0 : base.u32[..= 7]
@@ -435,7 +520,7 @@ pri func decoder.upsample_chroma!() {
}
}
pri func decoder.upsample_bgr!() {
pri func decoder.upsample_16_to_32_bgr!() {
var y : base.u32
var dy : base.u32
var y0 : base.u32[..= 15]
@@ -485,7 +570,46 @@ pri func decoder.upsample_bgr!() {
}
}
pri func decoder.convert_ycc_to_bgr!() {
pri func decoder.convert_32_bgr_to_y!(which: base.u32[..= 1]) {
var y : base.u32
var x : base.u32
y = 0
while y < 32 {
x = 1
while x < 32,
inv y < 32,
{
this.buffers[args.which][y][x] = this.buffers[args.which][y][4 * x]
x += 1
}
y += 1
}
}
pri func decoder.convert_16_y_to_bgr!() {
var y : base.u32
var x : base.u32
var gray : base.u8
y = 0
while y < 16 {
x = 0
while x < 16,
inv y < 16,
{
gray = this.buffers[0][y][(4 * x) + 0]
this.buffers[0][y][(4 * x) + 1] = gray
this.buffers[0][y][(4 * x) + 2] = gray
x += 1
}
y += 1
}
}
pri func decoder.convert_16_ycc_to_bgr!() {
var y : base.u32
var x : base.u32
var yy1 : base.u32
@@ -539,7 +663,7 @@ pri func decoder.convert_ycc_to_bgr!() {
}
}
pri func decoder.scale_1d_horizontal!() {
pri func decoder.scale_32_horizontal!() {
var y : base.u32
var dstx : base.u32[..= 31]
var srcx : base.u32
@@ -601,7 +725,7 @@ pri func decoder.scale_1d_horizontal!() {
}
}
pri func decoder.scale_1d_vertical!() {
pri func decoder.scale_32_vertical!() {
var x : base.u32
var dsty : base.u32[..= 31]
var srcy : base.u32
@@ -671,6 +795,7 @@ pri func decoder.from_pixels_to_dst!(dst: ptr base.pixel_buffer, which: base.u32
var tab : table base.u8
var y : base.u32
var dst : slice base.u8
var src_bytes_per_pixel : base.u32[..= 4]
var src : slice base.u8
// TODO: the dst_pixfmt variable shouldn't be necessary. We should be able
@@ -684,9 +809,14 @@ pri func decoder.from_pixels_to_dst!(dst: ptr base.pixel_buffer, which: base.u32
dst_bytes_per_row = (this.width * dst_bytes_per_pixel) as base.u64
tab = args.dst.plane(p: 0)
src_bytes_per_pixel = 1
if (this.variant & 1) <> 0 {
src_bytes_per_pixel = 4
}
while y < this.height {
assert y < 32 via "a < b: a < c; c <= b"(c: this.height)
src = this.buffers[args.which][y][.. this.width * 4]
src = this.buffers[args.which][y][.. this.width * src_bytes_per_pixel]
dst = tab.row_u32(y: y)
if dst_bytes_per_row < dst.length() {
@@ -753,6 +883,10 @@ pub func decoder.workbuf_len() base.range_ii_u64 {
return this.util.make_range_ii_u64(min_incl: 0, max_incl: 0)
}
pri const PAYLOAD_SIZES : roarray[4] base.u32[..= 144] = [
30, 45, 96, 144,
]
pri const CLAMP_7 : roarray[32] base.u8[..= 7] = [
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07,
+44 -2
View File
@@ -66,7 +66,33 @@ the first "./a.out" with "./a.out -bench". Combine these changes with the
// ---------------- Handsum Tests
const char* //
test_wuffs_handsum_decode_interface() {
test_wuffs_handsum_decode_interface_hvpc() {
CHECK_FOCUS(__func__);
wuffs_handsum__decoder dec;
CHECK_STATUS("initialize",
wuffs_handsum__decoder__initialize(
&dec, sizeof dec, WUFFS_VERSION,
WUFFS_INITIALIZE__LEAVE_INTERNAL_BUFFERS_UNINITIALIZED));
return do_test__wuffs_base__image_decoder(
wuffs_handsum__decoder__upcast_as__wuffs_base__image_decoder(&dec),
"test/data/bricks-color.hvpc.handsum", 0, SIZE_MAX, 32, 24, 0xFF052A90);
}
const char* //
test_wuffs_handsum_decode_interface_hvpg() {
CHECK_FOCUS(__func__);
wuffs_handsum__decoder dec;
CHECK_STATUS("initialize",
wuffs_handsum__decoder__initialize(
&dec, sizeof dec, WUFFS_VERSION,
WUFFS_INITIALIZE__LEAVE_INTERNAL_BUFFERS_UNINITIALIZED));
return do_test__wuffs_base__image_decoder(
wuffs_handsum__decoder__upcast_as__wuffs_base__image_decoder(&dec),
"test/data/bricks-gray.hvpg.handsum", 0, SIZE_MAX, 32, 24, 0xFF010101);
}
const char* //
test_wuffs_handsum_decode_interface_hvxc() {
CHECK_FOCUS(__func__);
wuffs_handsum__decoder dec;
CHECK_STATUS("initialize",
@@ -78,6 +104,19 @@ test_wuffs_handsum_decode_interface() {
"test/data/bricks-color.hvxc.handsum", 0, SIZE_MAX, 32, 24, 0xFF571218);
}
const char* //
test_wuffs_handsum_decode_interface_hvxg() {
CHECK_FOCUS(__func__);
wuffs_handsum__decoder dec;
CHECK_STATUS("initialize",
wuffs_handsum__decoder__initialize(
&dec, sizeof dec, WUFFS_VERSION,
WUFFS_INITIALIZE__LEAVE_INTERNAL_BUFFERS_UNINITIALIZED));
return do_test__wuffs_base__image_decoder(
wuffs_handsum__decoder__upcast_as__wuffs_base__image_decoder(&dec),
"test/data/bricks-gray.hvxg.handsum", 0, SIZE_MAX, 32, 24, 0xFF0D0D0D);
}
const char* //
test_wuffs_handsum_decode_truncated_input() {
CHECK_FOCUS(__func__);
@@ -164,7 +203,10 @@ test_wuffs_handsum_decode_frame_config() {
proc g_tests[] = {
test_wuffs_handsum_decode_frame_config,
test_wuffs_handsum_decode_interface,
test_wuffs_handsum_decode_interface_hvpc,
test_wuffs_handsum_decode_interface_hvpg,
test_wuffs_handsum_decode_interface_hvxc,
test_wuffs_handsum_decode_interface_hvxg,
test_wuffs_handsum_decode_truncated_input,
#ifdef WUFFS_MIMIC
+1
View File
@@ -0,0 +1 @@
ţ×וséĆ/Ą\ë„XY—WcŁFf—iĄS)z8‡’H|C#—’K¦rXš–7xbH;Ł(—–gxC9í†Hv•|Íd#Hö��f?ăĂeGv?´˛9…‰xa’'�x7fbHź–DČQ'z{�ÇŞ©uZxyę—cZ™Ţ{Š�kąhi“Ť•zŠvhhćČzZšĹx"µd�µVč�o§
+1
View File
@@ -0,0 +1 @@
þ×—’Dö¨’,Û�8j“7u¡'g“9–qyˆ€‹A˜�*•q(š”ˆp(;‘˜“(‡ã†¢LÍrgóiˆtıFGtµ�‡†Hb€ˆufp(®”$Èpy
+1
View File
@@ -0,0 +1 @@
ţ×#˙ŕÁđ_Z(›Öëď~ůŰ#4ţ'oG&źˇ_8T1z
+2
View File
@@ -0,0 +1,2 @@
þ×ô‡z¨‡{‡§„YG•˜¤VxTw*”Y‡“ˆý–v¨—{¸[/¸—‡%|¥fX>¸Äf¨µHd³f
s6˜ƒ+‡q'j¦fv�y‚X40ˆ’Hk�x‘8zc*—�'Šqx�y‡hw‡yˆ‡w…·vx‡y§˜Š—xyÈ˜šˆˆ™ªx‰˜ˆ™Ši‰˜‰—xˆ—y˜˜h‰‡‰
+4
View File
@@ -55,6 +55,7 @@ OK. 076cb375 test/data/bricks-color.bmp
OK. bdbbfadb test/data/bricks-color.etc1.pkm
OK. 41e6110e test/data/bricks-color.etc1s.pkm
OK. 5670f263 test/data/bricks-color.etc2.pkm
OK. 0fffe1d3 test/data/bricks-color.hvpc.handsum
OK. 1fef6814 test/data/bricks-color.hvxc.handsum
OK. 72a1f9cc test/data/bricks-color.jpeg
OK. 076cb375 test/data/bricks-color.lossless.webp
@@ -69,6 +70,8 @@ OK. f36c2e80 test/data/bricks-dither.no-ancillary.png
OK. f36c2e80 test/data/bricks-dither.png
OK. c2bce675 test/data/bricks-gray.bmp
OK. c2bce675 test/data/bricks-gray.gif
OK. 46a6768e test/data/bricks-gray.hvpg.handsum
OK. cd16ce62 test/data/bricks-gray.hvxg.handsum
OK. 3a2478ad test/data/bricks-gray.jpeg
OK. c2bce675 test/data/bricks-gray.lossless.webp
OK. 9d451b1c test/data/bricks-gray.lossy.webp
@@ -130,6 +133,7 @@ OK. ed4b78fc test/data/hippopotamus.regular.gif
OK. dcbb225a test/data/hippopotamus.regular.png
BAD e4c5926b test/data/hippopotamus.regular.truncated.png
OK. f6bb81e2 test/data/mona-lisa.21x32.etc2.pkm
OK. 7f351b34 test/data/mona-lisa.21x32.hvpc.handsum
OK. b507f884 test/data/mona-lisa.21x32.hvxc.handsum
OK. 012ce4cf test/data/mona-lisa.21x32.png
OK. 0a22e689 test/data/mona-lisa.21x32.q50.jpeg