std/jpeg: remove decode_idct block-selector arg

name                                             old speed     new speed     delta

wuffs_jpeg_decode_19k_8bpp/clang11               210MB/s ± 0%  213MB/s ± 0%  +1.54%  (p=0.008 n=5+5)
wuffs_jpeg_decode_30k_24bpp_progressive/clang11  200MB/s ± 0%  197MB/s ± 0%  -1.31%  (p=0.008 n=5+5)
wuffs_jpeg_decode_30k_24bpp_sequential/clang11   362MB/s ± 0%  373MB/s ± 0%  +3.04%  (p=0.008 n=5+5)
wuffs_jpeg_decode_77k_24bpp/clang11              307MB/s ± 0%  318MB/s ± 0%  +3.82%  (p=0.008 n=5+5)
wuffs_jpeg_decode_552k_24bpp_420/clang11         318MB/s ± 0%  331MB/s ± 0%  +4.09%  (p=0.008 n=5+5)
wuffs_jpeg_decode_552k_24bpp_444/clang11         434MB/s ± 0%  440MB/s ± 0%  +1.34%  (p=0.016 n=4+5)
wuffs_jpeg_decode_4002k_24bpp/clang11            320MB/s ± 0%  340MB/s ± 0%  +6.29%  (p=0.008 n=5+5)

wuffs_jpeg_decode_19k_8bpp/gcc10                 165MB/s ± 0%  172MB/s ± 0%  +4.32%  (p=0.008 n=5+5)
wuffs_jpeg_decode_30k_24bpp_progressive/gcc10    224MB/s ± 0%  227MB/s ± 0%  +1.30%  (p=0.008 n=5+5)
wuffs_jpeg_decode_30k_24bpp_sequential/gcc10     454MB/s ± 0%  465MB/s ± 0%  +2.40%  (p=0.008 n=5+5)
wuffs_jpeg_decode_77k_24bpp/gcc10                311MB/s ± 0%  324MB/s ± 0%  +4.38%  (p=0.008 n=5+5)
wuffs_jpeg_decode_552k_24bpp_420/gcc10           327MB/s ± 0%  342MB/s ± 0%  +4.52%  (p=0.008 n=5+5)
wuffs_jpeg_decode_552k_24bpp_444/gcc10           384MB/s ± 0%  393MB/s ± 0%  +2.34%  (p=0.008 n=5+5)
wuffs_jpeg_decode_4002k_24bpp/gcc10              324MB/s ± 0%  345MB/s ± 1%  +6.26%  (p=0.008 n=5+5)
This commit is contained in:
Nigel Tao committed 2023-06-10 14:12:08 +10:00
1 parent d248ade0e6
commit c0d7d7d046
9 files changed
+381 -359

No files matched your search

+27 -3
View File
@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
pri func decoder.decode_mcu!() base.u32,
pri func decoder.decode_mcu!(workbuf: slice base.u8, mx: base.u32[..= 0x1FFF], my: base.u32[..= 0x1FFF]) base.u32,
choosy,
{
var ret : base.u32
@@ -51,6 +51,10 @@ pri func decoder.decode_mcu!() base.u32,
var z : base.u32[..= 78] // 78 = 63 + 15.
var mcb : base.u32[..= 9]
var stride : base.u64[..= 0x1_0008]
var offset : base.u64
bits = this.bitstream_bits
n_bits = this.bitstream_n_bits
@@ -65,6 +69,8 @@ pri func decoder.decode_mcu!() base.u32,
while.dc_component this.mcu_zig_index <= 0,
inv this.mcu_current_block < 10,
{
this.mcu_blocks[.. 1].bulk_memset!(byte_value: 0)
// Load at least 31 bits, by keeping 56 .. 64 loaded.
if r.length() < 8 {
ret = 1 // Request another fill_bitstream call.
@@ -118,7 +124,7 @@ pri func decoder.decode_mcu!() base.u32,
n_bits ~mod-= dc_symbol
csel = this.scan_comps_cselector[this.mcu_blocks_sselector[this.mcu_current_block]]
this.mcu_previous_dc_values[csel] ~mod+= (dc_value & 0xFFFF) as base.u16
this.mcu_blocks[this.mcu_current_block][0] =
this.mcu_blocks[0][0] =
this.mcu_previous_dc_values[csel]
this.mcu_zig_index = 1
@@ -183,7 +189,7 @@ pri func decoder.decode_mcu!() base.u32,
bits ~mod<<= ac_ssss
n_bits ~mod-= ac_ssss
z = this.mcu_zig_index + ac_rrrr
this.mcu_blocks[this.mcu_current_block][UNZIG[z]] =
this.mcu_blocks[0][UNZIG[z]] =
(ac_value & 0xFFFF) as base.u16
if (z + 1) > 63 {
break.ac_components
@@ -200,7 +206,25 @@ pri func decoder.decode_mcu!() base.u32,
this.mcu_zig_index = 0
assert this.mcu_current_block < 10
mcb = this.mcu_current_block
this.mcu_current_block += 1
if this.test_only_interrupt_decode_mcu {
break.goto_done
}
// Apply IDCT.
csel = this.scan_comps_cselector[this.mcu_blocks_sselector[mcb]]
stride = this.components_workbuf_widths[csel] as base.u64
offset = this.mcu_blocks_offset[mcb] +
((this.mcu_blocks_mx_mul[mcb] as base.u64) * (args.mx as base.u64)) +
((this.mcu_blocks_my_mul[mcb] as base.u64) * (args.my as base.u64))
if offset <= args.workbuf.length() {
this.decode_idct!(
dst_buffer: args.workbuf[offset ..],
dst_stride: stride,
q: this.components_tq[csel] as base.u32)
}
} endwhile.block
this.mcu_current_block = 0