mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-18 08:32:11 +01:00
Change gif workbuf_len worst case from 1 to 0
This commit is contained in:
1 parent
555e8eaaa3
commit
3fd6aca365
6 files changed
+13
-23
No files matched your search
@@ -10,6 +10,7 @@
|
||||
- Added `WUFFS_BASE__PIXEL_FORMAT__BGR_565`.
|
||||
- Added interfaces.
|
||||
- Added preprocessor.
|
||||
- Changed `gif.decoder_workbuf_len_max_incl_worst_case` from 1 to 0.
|
||||
- Made `wuffs_base__pixel_format` a struct.
|
||||
- Made `wuffs_base__pixel_subsampling` a struct.
|
||||
- Made `wuffs_base__status` a struct.
|
||||
|
||||
@@ -236,10 +236,15 @@ const char* try_allocate(wuffs_gif__decoder* dec) {
|
||||
return "could not allocate prev-dst buffer";
|
||||
}
|
||||
|
||||
workbuf = wuffs_base__malloc_slice_u8(
|
||||
malloc, wuffs_gif__decoder__workbuf_len(dec).max_incl);
|
||||
if (!workbuf.ptr) {
|
||||
return "could not allocate work buffer";
|
||||
uint64_t workbuf_len_max_incl = wuffs_gif__decoder__workbuf_len(dec).max_incl;
|
||||
if (workbuf_len_max_incl > 0) {
|
||||
workbuf = wuffs_base__malloc_slice_u8(
|
||||
malloc, wuffs_gif__decoder__workbuf_len(dec).max_incl);
|
||||
if (!workbuf.ptr) {
|
||||
return "could not allocate work buffer";
|
||||
}
|
||||
} else {
|
||||
workbuf = wuffs_base__make_slice_u8(NULL, 0);
|
||||
}
|
||||
|
||||
uint64_t plen = 1 + ((uint64_t)(width) + 1) * (uint64_t)(height);
|
||||
|
||||
@@ -3664,7 +3664,7 @@ extern const char* wuffs_gif__error__bad_palette;
|
||||
|
||||
// ---------------- Public Consts
|
||||
|
||||
#define WUFFS_GIF__DECODER_WORKBUF_LEN_MAX_INCL_WORST_CASE 1
|
||||
#define WUFFS_GIF__DECODER_WORKBUF_LEN_MAX_INCL_WORST_CASE 0
|
||||
|
||||
#define WUFFS_GIF__QUIRK_DELAY_NUM_DECODED_FRAMES 1041635328
|
||||
|
||||
@@ -13198,7 +13198,7 @@ wuffs_gif__decoder__workbuf_len(const wuffs_gif__decoder* self) {
|
||||
return wuffs_base__utility__empty_range_ii_u64();
|
||||
}
|
||||
|
||||
return wuffs_base__utility__make_range_ii_u64(1, 1);
|
||||
return wuffs_base__utility__make_range_ii_u64(0, 0);
|
||||
}
|
||||
|
||||
// -------- func gif.decoder.restart_frame
|
||||
@@ -15042,10 +15042,6 @@ wuffs_gif__decoder__decode_id_part2(wuffs_gif__decoder* self,
|
||||
(iop_a_src += 1, wuffs_base__make_empty_struct());
|
||||
}
|
||||
label_1_break:;
|
||||
if (1 > ((uint64_t)(a_workbuf.len))) {
|
||||
status = wuffs_base__make_status(wuffs_base__error__bad_workbuf_length);
|
||||
goto exit;
|
||||
}
|
||||
label_2_continue:;
|
||||
while (true) {
|
||||
if ((self->private_impl.f_compressed_ri >
|
||||
|
||||
@@ -24,10 +24,7 @@ pub status "#bad palette"
|
||||
|
||||
pri status "#internal error: inconsistent ri/wi"
|
||||
|
||||
// TODO: replace the placeholder 1 value with either 0 or 0xFFFF (plus
|
||||
// lzw.decoder_workbuf_len_max_incl_worst_case), depending on whether we'll
|
||||
// need a per-pixel-row workbuf.
|
||||
pub const decoder_workbuf_len_max_incl_worst_case base.u64 = 1
|
||||
pub const decoder_workbuf_len_max_incl_worst_case base.u64 = 0
|
||||
|
||||
// See the spec appendix E "Interlaced Images" on page 29. The first element
|
||||
// represents either that the frame was non-interlaced, or that all interlace
|
||||
|
||||
@@ -957,10 +957,6 @@ pri func decoder.decode_id_part2?(dst: ptr base.pixel_buffer, src: base.io_reade
|
||||
args.src.skip32_fast!(actual: 1, worst_case: 1)
|
||||
}
|
||||
|
||||
if decoder_workbuf_len_max_incl_worst_case > args.workbuf.length() {
|
||||
return base."#bad workbuf length"
|
||||
}
|
||||
|
||||
while.inner true {
|
||||
if (this.compressed_ri > this.compressed_wi) or (this.compressed_wi > 4096) {
|
||||
return "#internal error: inconsistent ri/wi"
|
||||
|
||||
@@ -288,11 +288,6 @@ const char* do_test_wuffs_gif_decode(const char* filename,
|
||||
}
|
||||
}
|
||||
|
||||
if (wuffs_gif__decoder__workbuf_len(&dec).min_incl != 1) {
|
||||
RETURN_FAIL("workbuf_len: got %" PRIu64 ", want 1",
|
||||
wuffs_gif__decoder__workbuf_len(&dec).min_incl);
|
||||
}
|
||||
|
||||
int num_iters = 0;
|
||||
while (true) {
|
||||
num_iters++;
|
||||
|
||||
Reference in new issue
Block a user