base: tweak swizzle_ycck ycc_upsampling parameter

This moves from a 2-valued "basic (box) or fancy (triangle)" upsampling
parameter to a 3-valued one, which can now represent the fact that
libjpeg's and libwebp's fancy (triangle) upsampling is ever-so-slightly
different (see script/script/replicate-libwebp-chroma-upsampling.go and
its comments).

This is not an optimization or pessimization per se, but for the record,
the performance impact is mixed.

name                                             old speed     new speed     delta

wuffs_jpeg_decode_19k_8bpp/clang14               317MB/s ± 0%  314MB/s ± 0%  -0.99%  (p=0.008 n=5+5)
wuffs_jpeg_decode_30k_24bpp_progressive/clang14  318MB/s ± 0%  328MB/s ± 0%  +3.13%  (p=0.008 n=5+5)
wuffs_jpeg_decode_30k_24bpp_sequential/clang14   879MB/s ± 0%  871MB/s ± 0%  -0.83%  (p=0.008 n=5+5)
wuffs_jpeg_decode_77k_24bpp/clang14              719MB/s ± 0%  713MB/s ± 0%  -0.89%  (p=0.008 n=5+5)
wuffs_jpeg_decode_552k_24bpp_420/clang14         779MB/s ± 0%  771MB/s ± 0%  -1.01%  (p=0.008 n=5+5)
wuffs_jpeg_decode_552k_24bpp_444/clang14         902MB/s ± 0%  890MB/s ± 0%  -1.32%  (p=0.008 n=5+5)
wuffs_jpeg_decode_4002k_24bpp/clang14            784MB/s ± 0%  779MB/s ± 0%  -0.66%  (p=0.008 n=5+5)

wuffs_jpeg_decode_19k_8bpp/gcc12                 358MB/s ± 0%  362MB/s ± 0%  +0.93%  (p=0.008 n=5+5)
wuffs_jpeg_decode_30k_24bpp_progressive/gcc12    305MB/s ± 0%  311MB/s ± 0%  +1.91%  (p=0.008 n=5+5)
wuffs_jpeg_decode_30k_24bpp_sequential/gcc12     912MB/s ± 0%  918MB/s ± 0%  +0.73%  (p=0.016 n=4+5)
wuffs_jpeg_decode_77k_24bpp/gcc12                749MB/s ± 0%  763MB/s ± 0%  +1.83%  (p=0.008 n=5+5)
wuffs_jpeg_decode_552k_24bpp_420/gcc12           813MB/s ± 0%  824MB/s ± 0%  +1.37%  (p=0.008 n=5+5)
wuffs_jpeg_decode_552k_24bpp_444/gcc12           969MB/s ± 0%  984MB/s ± 0%  +1.62%  (p=0.008 n=5+5)
wuffs_jpeg_decode_4002k_24bpp/gcc12              815MB/s ± 0%  832MB/s ± 0%  +2.06%  (p=0.008 n=5+5)
This commit is contained in:
Nigel Tao committed 2026-07-03 21:38:28 +10:00
1 parent e3b5a7d506
commit 85a0283cfc
8 files changed
+211 -61

No files matched your search

+5 -5
View File
@@ -237,11 +237,11 @@ fuzz_swizzle_ycck(wuffs_base__io_buffer* src, uint64_t hash) {
uint32_t height_in_mcus = (3 & (hash >> 34)) + 1;
uint32_t allow_hv3 = 1 & (hash >> 36);
bool is_rgb_or_cmyk = 1 & (hash >> 37);
bool triangle_filter_for_2to1 = 1 & (hash >> 38);
uint8_t ycc_model = (1 & (hash >> 37)) ? 0x80 : 0x00;
uint8_t ycc_upsampling = 1 & (hash >> 38);
bool use_4th_component = 1 & (hash >> 39);
if (triangle_filter_for_2to1) {
if (ycc_upsampling) {
x_min_incl = 0;
y_min_incl = 0;
} else {
@@ -411,8 +411,8 @@ fuzz_swizzle_ycck(wuffs_base__io_buffer* src, uint64_t hash) {
width0, width1, width2, width3, //
h0, h1, h2, h3, //
v0, v1, v2, v3, //
is_rgb_or_cmyk, //
triangle_filter_for_2to1, //
ycc_model, //
ycc_upsampling, //
wuffs_base__make_slice_u8(scratch_buffer, sizeof(scratch_buffer)));
if (status.repr) {
return wuffs_base__status__message(&status);