mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-24 16:52:18 +01:00
std/jpeg: check up-front for sufficient AC bits
The micro-benchmarks are mixed for now, but this sets us up to remove an inner-loop bounds check in a future commit. name old speed new speed delta wuffs_jpeg_decode_19k_8bpp/clang11 226MB/s ± 0% 224MB/s ± 1% -1.03% (p=0.029 n=4+4) wuffs_jpeg_decode_30k_24bpp_progressive/clang11 210MB/s ± 0% 206MB/s ± 0% -1.59% (p=0.029 n=4+4) wuffs_jpeg_decode_30k_24bpp_sequential/clang11 379MB/s ± 0% 374MB/s ± 0% -1.25% (p=0.016 n=4+5) wuffs_jpeg_decode_77k_24bpp/clang11 326MB/s ± 0% 319MB/s ± 0% -2.35% (p=0.029 n=4+4) wuffs_jpeg_decode_552k_24bpp_420/clang11 338MB/s ± 0% 329MB/s ± 0% -2.53% (p=0.008 n=5+5) wuffs_jpeg_decode_552k_24bpp_444/clang11 468MB/s ± 0% 465MB/s ± 0% -0.58% (p=0.008 n=5+5) wuffs_jpeg_decode_4002k_24bpp/clang11 347MB/s ± 0% 332MB/s ± 0% -4.41% (p=0.016 n=4+5) wuffs_jpeg_decode_19k_8bpp/gcc10 174MB/s ± 0% 176MB/s ± 0% +1.18% (p=0.008 n=5+5) wuffs_jpeg_decode_30k_24bpp_progressive/gcc10 247MB/s ± 0% 246MB/s ± 0% -0.55% (p=0.008 n=5+5) wuffs_jpeg_decode_30k_24bpp_sequential/gcc10 477MB/s ± 0% 472MB/s ± 0% -0.90% (p=0.008 n=5+5) wuffs_jpeg_decode_77k_24bpp/gcc10 328MB/s ± 0% 334MB/s ± 0% +1.69% (p=0.008 n=5+5) wuffs_jpeg_decode_552k_24bpp_420/gcc10 346MB/s ± 0% 351MB/s ± 0% +1.57% (p=0.008 n=5+5) wuffs_jpeg_decode_552k_24bpp_444/gcc10 424MB/s ± 0% 425MB/s ± 0% +0.39% (p=0.008 n=5+5) wuffs_jpeg_decode_4002k_24bpp/gcc10 350MB/s ± 0% 349MB/s ± 0% -0.23% (p=0.008 n=5+5)
This commit is contained in:
1 parent
2ca61b521f
commit
143991a301
5 files changed
+46
-8
No files matched your search
@@ -1514,11 +1514,11 @@ pri func decoder.fill_bitstream!(src: base.io_reader) {
|
||||
} endwhile
|
||||
|
||||
// If we hit a "\xFF\x??" marker then pad the bitstream. In this method
|
||||
// invocation, insert up to 32 bytes of implicit zeroes. Repeated calls to
|
||||
// invocation, insert up to 264 bytes of implicit zeroes. Repeated calls to
|
||||
// this method can insert even more.
|
||||
if args.src.length() > 1 {
|
||||
if (args.src.peek_u8() >= 0xFF) and ((args.src.peek_u16le() >> 8) > 0) {
|
||||
new_wi = wi.min(no_more_than: 0x800 - 32) + 32
|
||||
new_wi = wi.min(no_more_than: 0x800 - 264) + 264
|
||||
if wi < new_wi {
|
||||
this.bitstream_buffer[wi .. new_wi].bulk_memset!(byte_value: 0)
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user