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

+6 -33
View File
@@ -49,6 +49,8 @@ pub struct decoder? implements base.image_decoder(
// (/doc/std/image-decoders-call-sequence.md).
call_sequence : base.u8,
test_only_interrupt_decode_mcu : base.bool,
sof_marker : base.u8,
next_restart_marker : base.u8[..= 7],
@@ -289,6 +291,9 @@ pub struct decoder? implements base.image_decoder(
) + (
bitstream_buffer : array[0x800] base.u8, // 0x800 = 2048.
// Decoding sequential JPEGs only uses the first element of this array,
// since sequential decode_mcu calls decode_idct straight away.
// Decoding progressive JPEGs can use all of it.
mcu_blocks : array[10] array[64] base.u16,
swizzle_ycck_scratch_buffer_2k : array[2048] base.u8,
@@ -1135,11 +1140,6 @@ pri func decoder.decode_sos?(dst: ptr base.pixel_buffer, src: base.io_reader, wo
var decode_mcu_result : base.u32
var bitstream_length : base.u32
var b : base.u32
var csel : base.u8[..= 3]
var stride : base.u64[..= 0x1_0008]
var offset : base.u64
if this.scan_count >= 64 {
return "#unsupported scan count"
}
@@ -1173,16 +1173,13 @@ pri func decoder.decode_sos?(dst: ptr base.pixel_buffer, src: base.io_reader, wo
if this.sof_marker >= 0xC2 {
this.load_mcu_blocks!(mx: mx, my: my, workbuf: args.workbuf)
} else {
// Clear this.mcu_blocks.
this.mcu_blocks[.. this.mcu_num_blocks].bulk_memset!(byte_value: 0)
}
while.decode_mcu true,
inv my < 0x2000,
inv mx < 0x2000,
{
decode_mcu_result = this.decode_mcu!()
decode_mcu_result = this.decode_mcu!(workbuf: args.workbuf, mx: mx, my: my)
if decode_mcu_result == 0 {
break.decode_mcu
} else if decode_mcu_result <> 1 {
@@ -1204,29 +1201,6 @@ pri func decoder.decode_sos?(dst: ptr base.pixel_buffer, src: base.io_reader, wo
if this.sof_marker >= 0xC2 {
this.save_mcu_blocks!(mx: mx, my: my, workbuf: args.workbuf)
} else {
// Apply IDCT.
b = 0
while b < this.mcu_num_blocks,
inv my < 0x2000,
inv mx < 0x2000,
{
assert b < 10 via "a < b: a < c; c <= b"(c: this.mcu_num_blocks)
csel = this.scan_comps_cselector[this.mcu_blocks_sselector[b]]
stride = this.components_workbuf_widths[csel] as base.u64
offset = this.mcu_blocks_offset[b] +
((this.mcu_blocks_mx_mul[b] as base.u64) * (mx as base.u64)) +
((this.mcu_blocks_my_mul[b] as base.u64) * (my as base.u64))
if offset <= args.workbuf.length() {
this.decode_idct!(
dst_buffer: args.workbuf[offset ..],
dst_stride: stride,
b: b,
q: this.components_tq[csel] as base.u32)
}
b += 1
} endwhile
}
// Check for a restart.
@@ -1715,7 +1689,6 @@ pri func decoder.apply_progressive_idct!(workbuf: slice base.u8) {
this.decode_idct!(
dst_buffer: args.workbuf[offset ..],
dst_stride: stride,
b: 0,
q: this.components_tq[csel] as base.u32)
}