std/jpeg: memoize Huffman table selectors

This commit is contained in:
Nigel Tao committed 2023-06-12 16:23:53 +10:00
1 parent 04344db374
commit 1f0f323414
6 files changed
+31 -14

No files matched your search

@@ -23,7 +23,7 @@ pri func decoder.decode_mcu_progressive_dc_high_bits!(workbuf: slice base.u8, mx
var r : base.io_reader
var pos : base.u32
var dc_h : base.u8[..= 7]
var dc_h : base.u8[..= 3]
var dc_symbol : base.u32[..= 0x0F]
var dc_ht_fast : base.u32
var dc_bl : base.u32
@@ -56,7 +56,7 @@ pri func decoder.decode_mcu_progressive_dc_high_bits!(workbuf: slice base.u8, mx
n_bits |= 56
// Read the Huffman-encoded dc_symbol, up to 16 bits long.
dc_h = 0 | this.scan_comps_td[this.mcu_blocks_sselector[this.mcu_current_block]]
dc_h = this.mcu_blocks_dc_hselector[this.mcu_current_block]
dc_ht_fast = this.huff_tables_fast[dc_h][bits >> 56] as base.u32
dc_bl = dc_ht_fast >> 8
if n_bits >= dc_bl {