mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-18 00:32:11 +01:00
name old speed new speed delta wuffs_jpeg_decode_19k_8bpp/clang11 236MB/s ± 0% 237MB/s ± 0% +0.11% (p=0.032 n=4+5) wuffs_jpeg_decode_30k_24bpp_progressive/clang11 210MB/s ± 0% 213MB/s ± 0% +1.20% (p=0.008 n=5+5) wuffs_jpeg_decode_30k_24bpp_sequential/clang11 385MB/s ± 0% 384MB/s ± 0% ~ (p=0.095 n=5+5) wuffs_jpeg_decode_77k_24bpp/clang11 338MB/s ± 0% 338MB/s ± 0% ~ (p=0.151 n=5+5) wuffs_jpeg_decode_552k_24bpp_420/clang11 353MB/s ± 0% 353MB/s ± 0% ~ (p=0.548 n=5+5) wuffs_jpeg_decode_552k_24bpp_444/clang11 481MB/s ± 0% 481MB/s ± 0% ~ (p=0.690 n=5+5) wuffs_jpeg_decode_4002k_24bpp/clang11 360MB/s ± 0% 359MB/s ± 0% -0.35% (p=0.008 n=5+5) wuffs_jpeg_decode_19k_8bpp/gcc10 244MB/s ± 0% 245MB/s ± 0% +0.44% (p=0.008 n=5+5) wuffs_jpeg_decode_30k_24bpp_progressive/gcc10 251MB/s ± 0% 247MB/s ± 0% -1.46% (p=0.008 n=5+5) wuffs_jpeg_decode_30k_24bpp_sequential/gcc10 509MB/s ± 0% 510MB/s ± 0% +0.13% (p=0.008 n=5+5) wuffs_jpeg_decode_77k_24bpp/gcc10 431MB/s ± 0% 432MB/s ± 0% +0.24% (p=0.008 n=5+5) wuffs_jpeg_decode_552k_24bpp_420/gcc10 455MB/s ± 0% 456MB/s ± 0% +0.26% (p=0.008 n=5+5) wuffs_jpeg_decode_552k_24bpp_444/gcc10 481MB/s ± 0% 484MB/s ± 0% +0.56% (p=0.016 n=4+5) wuffs_jpeg_decode_4002k_24bpp/gcc10 463MB/s ± 0% 465MB/s ± 0% +0.36% (p=0.008 n=5+5)
93 lines
3.2 KiB
Plaintext
93 lines
3.2 KiB
Plaintext
// Copyright 2023 The Wuffs Authors.
|
|
//
|
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
// you may not use this file except in compliance with the License.
|
|
// You may obtain a copy of the License at
|
|
//
|
|
// https://www.apache.org/licenses/LICENSE-2.0
|
|
//
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
// See the License for the specific language governing permissions and
|
|
// limitations under the License.
|
|
|
|
pri func decoder.decode_mcu_progressive_dc_low_bit!(workbuf: slice base.u8, mx: base.u32[..= 0x1FFF], my: base.u32[..= 0x1FFF]) base.u32 {
|
|
var ret : base.u32
|
|
|
|
var bits : base.u64
|
|
var n_bits : base.u32
|
|
|
|
var one_lshift_scan_al : base.u16[..= 0x2000]
|
|
|
|
var r : base.io_reader
|
|
var pos : base.u32
|
|
|
|
bits = this.bitstream_bits
|
|
n_bits = this.bitstream_n_bits
|
|
|
|
one_lshift_scan_al = (1 as base.u16) << this.scan_al
|
|
|
|
if this.bitstream_ri > this.bitstream_wi {
|
|
return 2 // Internal error.
|
|
}
|
|
io_bind (io: r, data: this.bitstream_buffer[this.bitstream_ri .. this.bitstream_wi], history_position: this.bitstream_ri as base.u64) {
|
|
while.goto_done true {{
|
|
|
|
while.block this.mcu_current_block < this.mcu_num_blocks {
|
|
assert this.mcu_current_block < 10 via "a < b: a < c; c <= b"(c: this.mcu_num_blocks)
|
|
|
|
// Ensure that we have enough bits for this iteration of the
|
|
// while.block loop body. Worst case, there are 64 components and
|
|
// each one needs (16 + 15) bits (round that up to 4 bytes), so we
|
|
// need (64 * 4) = 256 bytes available. 8 more bytes of slack means
|
|
// that we can always call peek_u64be.
|
|
if r.length() < 264 {
|
|
ret = 1 // Request another fill_bitstream call.
|
|
break.goto_done
|
|
}
|
|
|
|
while.dc_component true,
|
|
inv this.mcu_current_block < 10,
|
|
{
|
|
// Load at least 56 bits.
|
|
if r.length() < 8 {
|
|
ret = 2 // Internal error.
|
|
break.goto_done
|
|
}
|
|
bits |= r.peek_u64be() >> (n_bits & 63)
|
|
r.skip_u32_fast!(actual: (63 - (n_bits & 63)) >> 3, worst_case: 8)
|
|
n_bits |= 56
|
|
|
|
// Refine a bit.
|
|
if (bits >> 63) <> 0 {
|
|
this.mcu_blocks[this.mcu_current_block][0] |= one_lshift_scan_al
|
|
}
|
|
bits ~mod<<= 1
|
|
n_bits ~mod-= 1
|
|
|
|
break.dc_component
|
|
} endwhile.dc_component
|
|
|
|
assert this.mcu_current_block < 10
|
|
this.mcu_current_block += 1
|
|
} endwhile.block
|
|
this.mcu_current_block = 0
|
|
|
|
break.goto_done
|
|
}} endwhile.goto_done
|
|
|
|
pos = (r.position() & 0xFFFF_FFFF) as base.u32
|
|
if pos > this.bitstream_wi {
|
|
ret = 2 // Internal error.
|
|
} else {
|
|
assert pos <= 0x800 via "a <= b: a <= c; c <= b"(c: this.bitstream_wi)
|
|
this.bitstream_ri = pos
|
|
}
|
|
}
|
|
|
|
this.bitstream_bits = bits
|
|
this.bitstream_n_bits = n_bits
|
|
return ret
|
|
}
|