std/jpeg: tweak UNZIG array

We'll hopefully claw back the performance in a follow-up commit.

name                                             old speed     new speed     delta

wuffs_jpeg_decode_19k_8bpp/clang11               222MB/s ± 0%  224MB/s ± 0%   +1.11%  (p=0.008 n=5+5)
wuffs_jpeg_decode_30k_24bpp_progressive/clang11  213MB/s ± 0%  210MB/s ± 0%   -1.53%  (p=0.008 n=5+5)
wuffs_jpeg_decode_30k_24bpp_sequential/clang11   376MB/s ± 0%  378MB/s ± 0%   +0.37%  (p=0.008 n=5+5)
wuffs_jpeg_decode_77k_24bpp/clang11              325MB/s ± 0%  328MB/s ± 0%   +0.66%  (p=0.008 n=5+5)
wuffs_jpeg_decode_552k_24bpp_420/clang11         339MB/s ± 0%  340MB/s ± 0%   +0.46%  (p=0.008 n=5+5)
wuffs_jpeg_decode_552k_24bpp_444/clang11         468MB/s ± 0%  469MB/s ± 0%   +0.27%  (p=0.008 n=5+5)
wuffs_jpeg_decode_4002k_24bpp/clang11            344MB/s ± 0%  346MB/s ± 0%   +0.37%  (p=0.008 n=5+5)

wuffs_jpeg_decode_19k_8bpp/gcc10                 212MB/s ± 0%  213MB/s ± 0%   +0.46%  (p=0.008 n=5+5)
wuffs_jpeg_decode_30k_24bpp_progressive/gcc10    246MB/s ± 0%  221MB/s ± 0%   -9.98%  (p=0.008 n=5+5)
wuffs_jpeg_decode_30k_24bpp_sequential/gcc10     484MB/s ± 0%  484MB/s ± 0%     ~     (p=0.056 n=5+5)
wuffs_jpeg_decode_77k_24bpp/gcc10                390MB/s ± 0%  392MB/s ± 0%   +0.47%  (p=0.008 n=5+5)
wuffs_jpeg_decode_552k_24bpp_420/gcc10           415MB/s ± 0%  414MB/s ± 0%   -0.17%  (p=0.008 n=5+5)
wuffs_jpeg_decode_552k_24bpp_444/gcc10           463MB/s ± 0%  459MB/s ± 0%   -0.78%  (p=0.008 n=5+5)
wuffs_jpeg_decode_4002k_24bpp/gcc10              420MB/s ± 0%  419MB/s ± 0%   -0.19%  (p=0.008 n=5+5)
This commit is contained in:
Nigel Tao committed 2023-06-18 20:57:50 +10:00
1 parent 19e5cccee3
commit 9b97c27ec6
6 files changed
+35 -33

No files matched your search

+4 -2
View File
@@ -16,6 +16,8 @@
// UNZIG[3] is the column and row of the fourth element in zig-zag order. The
// value is 16, which means first column (16%8 == 0) and third row (16/8 == 2).
pri const UNZIG : roarray[80] base.u8[..= 63] = [
0x00,
// The 8x8 indexes are below.
0x00, 0x01, 0x08, 0x10, 0x09, 0x02, 0x03, 0x0A,
0x11, 0x18, 0x20, 0x19, 0x12, 0x0B, 0x04, 0x05,
0x0C, 0x13, 0x1A, 0x21, 0x28, 0x30, 0x29, 0x22,
@@ -24,11 +26,11 @@ pri const UNZIG : roarray[80] base.u8[..= 63] = [
0x1D, 0x16, 0x0F, 0x17, 0x1E, 0x25, 0x2C, 0x33,
0x3A, 0x3B, 0x34, 0x2D, 0x26, 0x1F, 0x27, 0x2E,
0x35, 0x3C, 0x3D, 0x36, 0x2F, 0x37, 0x3E, 0x3F,
// The 16 extra elements are for invalid JPEGs where "the z in UNZIG[z]
// The 15 extra elements are for invalid JPEGs where "the z in UNZIG[z]
// overflows 63, when saving the AC value". This isn't in the spec but
// matches how libjpeg-turbo treats "above 63".
0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F,
0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F,
0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F,
]
// BIAS_AND_CLAMP maps 10-bit signed values (0 centered, in the range -512 ..