mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-18 08:32:11 +01:00
std/jpeg: skip 0xFF filler before restart search
This commit is contained in:
1 parent
6a9347843b
commit
d4bab677b0
2 files changed
+16
-8
No files matched your search
@@ -51399,13 +51399,17 @@ wuffs_jpeg__decoder__fill_bitstream(
|
||||
continue;
|
||||
} else if (((uint64_t)(io2_a_src - iop_a_src)) <= 1u) {
|
||||
break;
|
||||
} else if (((uint16_t)(wuffs_base__peek_u16le__no_bounds_check(iop_a_src) >> 8u)) > 0u) {
|
||||
break;
|
||||
} else {
|
||||
}
|
||||
v_c8 = ((uint8_t)(((uint16_t)(wuffs_base__peek_u16le__no_bounds_check(iop_a_src) >> 8u))));
|
||||
if (v_c8 == 0u) {
|
||||
self->private_data.f_bitstream_buffer[v_wi] = 255u;
|
||||
v_wi += 1u;
|
||||
iop_a_src += 2u;
|
||||
continue;
|
||||
} else if (v_c8 < 255u) {
|
||||
break;
|
||||
}
|
||||
iop_a_src += 1u;
|
||||
}
|
||||
if (((uint64_t)(io2_a_src - iop_a_src)) > 1u) {
|
||||
if ((wuffs_base__peek_u8be__no_bounds_check(iop_a_src) >= 255u) && (((uint16_t)(wuffs_base__peek_u16le__no_bounds_check(iop_a_src) >> 8u)) > 0u)) {
|
||||
|
||||
@@ -1745,18 +1745,22 @@ pri func decoder.fill_bitstream!(src: base.io_reader) {
|
||||
wi += 1
|
||||
args.src.skip_u32_fast!(actual: 1, worst_case: 1)
|
||||
continue
|
||||
|
||||
} else if args.src.length() <= 1 {
|
||||
break
|
||||
}
|
||||
|
||||
} else if (args.src.peek_u16le() >> 8) > 0 {
|
||||
break
|
||||
|
||||
} else {
|
||||
c8 = (args.src.peek_u16le() >> 8) as base.u8
|
||||
if c8 == 0x00 {
|
||||
this.bitstream_buffer[wi] = 0xFF
|
||||
wi += 1
|
||||
args.src.skip_u32_fast!(actual: 2, worst_case: 2)
|
||||
continue
|
||||
} else if c8 < 0xFF {
|
||||
break
|
||||
}
|
||||
// Section B.1.1.2: "Any marker may optionally be preceded by any
|
||||
// number of [0xFF] fill bytes".
|
||||
args.src.skip_u32_fast!(actual: 1, worst_case: 1)
|
||||
}
|
||||
|
||||
// If we hit a "\xFF\x??" marker then pad the bitstream. In this method
|
||||
|
||||
Reference in new issue
Block a user