std/jpeg: implement triangle-filter upsampling

"script/confirm-matches-djpeg.sh test/data/*.jpeg" is now all matches.
This commit is contained in:
Nigel Tao committed 2023-05-21 22:05:38 +10:00
1 parent 94df43c530
commit a41149e73c
4 files changed
+507 -27

No files matched your search

+11 -5
View File
@@ -523,14 +523,20 @@ test_wuffs_upsample_inv_h2v1() {
};
const uint8_t want_array[32] = {
0x41, 0x41, 0x20, 0x20, 0x6C, 0x6C, 0x6F, 0x6F, //
0x76, 0x76, 0x65, 0x65, 0x6C, 0x6C, 0x79, 0x79, //
0x20, 0x20, 0x65, 0x65, 0x78, 0x78, 0x61, 0x61, //
0x6D, 0x6D, 0x70, 0x70, 0x6C, 0x6C, 0x65, 0x65, //
// A box filter (nearest neighbor) would look like this:
// 0x41, 0x41, 0x20, 0x20, 0x6C, 0x6C, 0x6F, 0x6F,
// 0x76, 0x76, 0x65, 0x65, 0x6C, 0x6C, 0x79, 0x79,
// 0x20, 0x20, 0x65, 0x65, 0x78, 0x78, 0x61, 0x61,
// 0x6D, 0x6D, 0x70, 0x70, 0x6C, 0x6C, 0x65, 0x65,
// We use a triangle filter instead, matching libjpeg-turbo.
0x41, 0x39, 0x28, 0x33, 0x59, 0x6D, 0x6E, 0x71, //
0x74, 0x72, 0x69, 0x67, 0x6A, 0x6F, 0x76, 0x63, //
0x36, 0x31, 0x54, 0x6A, 0x73, 0x72, 0x67, 0x64, //
0x6A, 0x6E, 0x6F, 0x6F, 0x6D, 0x6A, 0x67, 0x65, //
};
const uint8_t* have_ptr =
wuffs_base__pixel_swizzler__swizzle_ycc__upsample_inv_h2vn_box(
wuffs_base__pixel_swizzler__swizzle_ycc__upsample_inv_h2v1_triangle(
g_have_array_u8, src_array0, src_array0, 16, 0, true, true);
const bool closed = true;