mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-24 08:52:18 +01:00
std/jpeg: memoize ac_huff_table_fast
name old speed new speed delta wuffs_jpeg_decode_19k_8bpp/clang11 215MB/s ± 0% 226MB/s ± 0% +5.17% (p=0.008 n=5+5) wuffs_jpeg_decode_30k_24bpp_progressive/clang11 209MB/s ± 0% 210MB/s ± 0% +0.50% (p=0.008 n=5+5) wuffs_jpeg_decode_30k_24bpp_sequential/clang11 368MB/s ± 0% 380MB/s ± 1% +3.11% (p=0.008 n=5+5) wuffs_jpeg_decode_77k_24bpp/clang11 313MB/s ± 0% 327MB/s ± 0% +4.27% (p=0.008 n=5+5) wuffs_jpeg_decode_552k_24bpp_420/clang11 326MB/s ± 0% 338MB/s ± 0% +3.50% (p=0.008 n=5+5) wuffs_jpeg_decode_552k_24bpp_444/clang11 462MB/s ± 0% 468MB/s ± 0% +1.14% (p=0.008 n=5+5) wuffs_jpeg_decode_4002k_24bpp/clang11 329MB/s ± 1% 346MB/s ± 0% +5.39% (p=0.008 n=5+5) wuffs_jpeg_decode_19k_8bpp/gcc10 174MB/s ± 0% 175MB/s ± 0% +0.55% (p=0.008 n=5+5) wuffs_jpeg_decode_30k_24bpp_progressive/gcc10 228MB/s ± 0% 248MB/s ± 0% +8.49% (p=0.008 n=5+5) wuffs_jpeg_decode_30k_24bpp_sequential/gcc10 472MB/s ± 0% 478MB/s ± 0% +1.20% (p=0.008 n=5+5) wuffs_jpeg_decode_77k_24bpp/gcc10 327MB/s ± 0% 328MB/s ± 0% +0.47% (p=0.008 n=5+5) wuffs_jpeg_decode_552k_24bpp_420/gcc10 344MB/s ± 0% 346MB/s ± 0% +0.46% (p=0.016 n=4+5) wuffs_jpeg_decode_552k_24bpp_444/gcc10 422MB/s ± 0% 424MB/s ± 0% +0.49% (p=0.008 n=5+5) wuffs_jpeg_decode_4002k_24bpp/gcc10 349MB/s ± 0% 348MB/s ± 0% -0.24% (p=0.008 n=5+5)
This commit is contained in:
1 parent
19f56ebfd2
commit
dd6a5d5435
4 files changed
+44
-17
No files matched your search
@@ -21,6 +21,8 @@ pri func decoder.decode_mcu_progressive_ac_high_bits!(workbuf: slice base.u8, mx
|
||||
var r : base.io_reader
|
||||
var pos : base.u32
|
||||
|
||||
var ac_huff_table_fast : nptr roarray[256] base.u16
|
||||
|
||||
var ac_h : base.u8[..= 7]
|
||||
var ac_symbol : base.u32[..= 0xFF]
|
||||
var ac_ht_fast : base.u32
|
||||
@@ -50,7 +52,11 @@ pri func decoder.decode_mcu_progressive_ac_high_bits!(workbuf: slice base.u8, mx
|
||||
while.goto_done true {{
|
||||
|
||||
while.block true {
|
||||
while.ac_components true {
|
||||
ac_h = this.mcu_blocks_ac_hselector[0]
|
||||
ac_huff_table_fast = this.huff_tables_fast[ac_h][..] as ptr array[256] base.u16
|
||||
while.ac_components true,
|
||||
inv ac_huff_table_fast <> nullptr,
|
||||
{
|
||||
// Load at least 31 bits, by keeping 56 .. 64 loaded.
|
||||
if r.length() < 8 {
|
||||
ret = 1 // Request another fill_bitstream call.
|
||||
@@ -61,8 +67,7 @@ pri func decoder.decode_mcu_progressive_ac_high_bits!(workbuf: slice base.u8, mx
|
||||
n_bits |= 56
|
||||
|
||||
// Read the Huffman-encoded ac_symbol, up to 16 bits long.
|
||||
ac_h = this.mcu_blocks_ac_hselector[0]
|
||||
ac_ht_fast = this.huff_tables_fast[ac_h][bits >> 56] as base.u32
|
||||
ac_ht_fast = ac_huff_table_fast[bits >> 56] as base.u32
|
||||
ac_bl = ac_ht_fast >> 8
|
||||
if n_bits >= ac_bl {
|
||||
ac_symbol = 0xFF & ac_ht_fast
|
||||
@@ -73,7 +78,9 @@ pri func decoder.decode_mcu_progressive_ac_high_bits!(workbuf: slice base.u8, mx
|
||||
ac_blm1 = 8
|
||||
bits ~mod<<= 9
|
||||
n_bits ~mod-= 9
|
||||
while true {
|
||||
while true,
|
||||
inv ac_huff_table_fast <> nullptr,
|
||||
{
|
||||
ac_ht_slow = this.huff_tables_slow[ac_h][ac_blm1]
|
||||
if ac_code < (ac_ht_slow >> 8) {
|
||||
ac_symbol = this.huff_tables_symbols[ac_h][0xFF & (ac_code ~mod+ ac_ht_slow)] as base.u32
|
||||
|
||||
Reference in new issue
Block a user