mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-18 00:32:11 +01:00
base: rename history_retain_length
It was renamed to dst_history_retain_length. It also was removed from image_decoders and token_decoders. It only applies to io_transformers, as retaining history applies to the destination (not source) IO buffer. Also adjust example/bzcat and example/zcat to apply the history retain length to the dst (not src) buffer.
This commit is contained in:
1 parent
b4e09690a7
commit
eed1af7bee
34 files changed
+179
-640
No files matched your search
@@ -15,8 +15,7 @@ pub status "#unsupported BMP file"
|
||||
|
||||
pri status "@internal note: short read"
|
||||
|
||||
pub const DECODER_HISTORY_RETAIN_LENGTH_MAX_INCL_WORST_CASE : base.u64 = 0
|
||||
pub const DECODER_WORKBUF_LEN_MAX_INCL_WORST_CASE : base.u64 = 0
|
||||
pub const DECODER_WORKBUF_LEN_MAX_INCL_WORST_CASE : base.u64 = 0
|
||||
|
||||
pri const COMPRESSION_NONE : base.u32 = 0
|
||||
pri const COMPRESSION_RLE8 : base.u32 = 1
|
||||
@@ -1257,10 +1256,6 @@ pri func decoder.do_tell_me_more?(dst: base.io_writer, minfo: nptr base.more_inf
|
||||
this.io_redirect_fourcc = 1
|
||||
}
|
||||
|
||||
pub func decoder.history_retain_length() base.optional_u63 {
|
||||
return this.util.make_optional_u63(has_value: true, value: 0)
|
||||
}
|
||||
|
||||
pub func decoder.workbuf_len() base.range_ii_u64 {
|
||||
return this.util.make_range_ii_u64(min_incl: 0, max_incl: 0)
|
||||
}
|
||||
|
||||
@@ -20,8 +20,8 @@ pub status "#unsupported block randomization"
|
||||
|
||||
pri status "#internal error: inconsistent Huffman decoder state"
|
||||
|
||||
pub const DECODER_HISTORY_RETAIN_LENGTH_MAX_INCL_WORST_CASE : base.u64 = 0
|
||||
pub const DECODER_WORKBUF_LEN_MAX_INCL_WORST_CASE : base.u64 = 0
|
||||
pub const DECODER_DST_HISTORY_RETAIN_LENGTH_MAX_INCL_WORST_CASE : base.u64 = 0
|
||||
pub const DECODER_WORKBUF_LEN_MAX_INCL_WORST_CASE : base.u64 = 0
|
||||
|
||||
pri const CLAMP_TO_5 : roarray[8] base.u8[..= 5] = [0, 1, 2, 3, 4, 5, 5, 5]
|
||||
|
||||
@@ -121,7 +121,7 @@ pub func decoder.set_quirk!(key: base.u32, value: base.u64) base.status {
|
||||
return base."#unsupported option"
|
||||
}
|
||||
|
||||
pub func decoder.history_retain_length() base.optional_u63 {
|
||||
pub func decoder.dst_history_retain_length() base.optional_u63 {
|
||||
return this.util.make_optional_u63(has_value: true, value: 0)
|
||||
}
|
||||
|
||||
|
||||
@@ -16,10 +16,6 @@ pri status "#internal error: inconsistent token length"
|
||||
|
||||
// --------
|
||||
|
||||
// DECODER_HISTORY_RETAIN_LENGTH_MAX_INCL_WORST_CASE is the largest
|
||||
// history_retain_length (for compact_retaining) that a decoder will request.
|
||||
pub const DECODER_HISTORY_RETAIN_LENGTH_MAX_INCL_WORST_CASE : base.u64 = 0
|
||||
|
||||
// DECODER_WORKBUF_LEN_MAX_INCL_WORST_CASE is the largest workbuf length that a
|
||||
// decoder will request.
|
||||
pub const DECODER_WORKBUF_LEN_MAX_INCL_WORST_CASE : base.u64 = 0
|
||||
@@ -121,10 +117,6 @@ pub func decoder.set_quirk!(key: base.u32, value: base.u64) base.status {
|
||||
return base."#unsupported option"
|
||||
}
|
||||
|
||||
pub func decoder.history_retain_length() base.optional_u63 {
|
||||
return this.util.make_optional_u63(has_value: true, value: 0)
|
||||
}
|
||||
|
||||
pub func decoder.workbuf_len() base.range_ii_u64 {
|
||||
return this.util.empty_range_ii_u64()
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ pri status "#internal error: inconsistent I/O"
|
||||
pri status "#internal error: inconsistent distance"
|
||||
pri status "#internal error: inconsistent n_bits"
|
||||
|
||||
pub const DECODER_HISTORY_RETAIN_LENGTH_MAX_INCL_WORST_CASE : base.u64 = 0
|
||||
pub const DECODER_DST_HISTORY_RETAIN_LENGTH_MAX_INCL_WORST_CASE : base.u64 = 0
|
||||
|
||||
// TODO: replace the placeholder 1 value with either 0 or (32768 + 512),
|
||||
// depending on whether we'll move decoder.history into the workbuf.
|
||||
@@ -205,7 +205,7 @@ pub func decoder.set_quirk!(key: base.u32, value: base.u64) base.status {
|
||||
return base."#unsupported option"
|
||||
}
|
||||
|
||||
pub func decoder.history_retain_length() base.optional_u63 {
|
||||
pub func decoder.dst_history_retain_length() base.optional_u63 {
|
||||
return this.util.make_optional_u63(has_value: true, value: 0)
|
||||
}
|
||||
|
||||
|
||||
@@ -19,8 +19,7 @@ pub status "#truncated input"
|
||||
|
||||
pri status "#internal error: inconsistent I/O"
|
||||
|
||||
pub const DECODER_HISTORY_RETAIN_LENGTH_MAX_INCL_WORST_CASE : base.u64 = 0
|
||||
pub const DECODER_WORKBUF_LEN_MAX_INCL_WORST_CASE : base.u64 = 0
|
||||
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
|
||||
|
||||
@@ -333,10 +333,6 @@ pub func decoder.frame_dirty_rect() base.rect_ie_u32 {
|
||||
max_excl_y: this.dirty_max_excl_y.min(no_more_than: this.height))
|
||||
}
|
||||
|
||||
pub func decoder.history_retain_length() base.optional_u63 {
|
||||
return this.util.make_optional_u63(has_value: true, value: 0)
|
||||
}
|
||||
|
||||
pub func decoder.workbuf_len() base.range_ii_u64 {
|
||||
return this.util.make_range_ii_u64(
|
||||
min_incl: DECODER_WORKBUF_LEN_MAX_INCL_WORST_CASE,
|
||||
|
||||
@@ -17,7 +17,7 @@ pub status "#bad encoding flags"
|
||||
pub status "#bad header"
|
||||
pub status "#truncated input"
|
||||
|
||||
pub const DECODER_HISTORY_RETAIN_LENGTH_MAX_INCL_WORST_CASE : base.u64 = 0
|
||||
pub const DECODER_DST_HISTORY_RETAIN_LENGTH_MAX_INCL_WORST_CASE : base.u64 = 0
|
||||
|
||||
// TODO: reference deflate.DECODER_WORKBUF_LEN_MAX_INCL_WORST_CASE.
|
||||
pub const DECODER_WORKBUF_LEN_MAX_INCL_WORST_CASE : base.u64 = 1
|
||||
@@ -46,7 +46,7 @@ pub func decoder.set_quirk!(key: base.u32, value: base.u64) base.status {
|
||||
return base."#unsupported option"
|
||||
}
|
||||
|
||||
pub func decoder.history_retain_length() base.optional_u63 {
|
||||
pub func decoder.dst_history_retain_length() base.optional_u63 {
|
||||
return this.util.make_optional_u63(has_value: true, value: 0)
|
||||
}
|
||||
|
||||
|
||||
@@ -32,8 +32,7 @@ pub status "#unsupported scan count"
|
||||
|
||||
pri status "#internal error: inconsistent decoder state"
|
||||
|
||||
pub const DECODER_HISTORY_RETAIN_LENGTH_MAX_INCL_WORST_CASE : base.u64 = 0
|
||||
pub const DECODER_WORKBUF_LEN_MAX_INCL_WORST_CASE : base.u64 = 0xC_00C0_0300
|
||||
pub const DECODER_WORKBUF_LEN_MAX_INCL_WORST_CASE : base.u64 = 0xC_00C0_0300
|
||||
|
||||
pub struct decoder? implements base.image_decoder(
|
||||
width : base.u32[..= 0xFFFF],
|
||||
@@ -2107,10 +2106,6 @@ pub func decoder.tell_me_more?(dst: base.io_writer, minfo: nptr base.more_inform
|
||||
return base."#no more information"
|
||||
}
|
||||
|
||||
pub func decoder.history_retain_length() base.optional_u63 {
|
||||
return this.util.make_optional_u63(has_value: true, value: 0)
|
||||
}
|
||||
|
||||
pub func decoder.workbuf_len() base.range_ii_u64 {
|
||||
return this.util.make_range_ii_u64(
|
||||
min_incl: this.components_workbuf_offsets[8],
|
||||
|
||||
@@ -21,10 +21,6 @@ pri status "#internal error: inconsistent I/O"
|
||||
|
||||
// --------
|
||||
|
||||
// DECODER_HISTORY_RETAIN_LENGTH_MAX_INCL_WORST_CASE is the largest
|
||||
// history_retain_length (for compact_retaining) that a decoder will request.
|
||||
pub const DECODER_HISTORY_RETAIN_LENGTH_MAX_INCL_WORST_CASE : base.u64 = 0
|
||||
|
||||
// DECODER_WORKBUF_LEN_MAX_INCL_WORST_CASE is the largest workbuf length that a
|
||||
// decoder will request.
|
||||
pub const DECODER_WORKBUF_LEN_MAX_INCL_WORST_CASE : base.u64 = 0
|
||||
|
||||
@@ -82,10 +82,6 @@ pub func decoder.set_quirk!(key: base.u32, value: base.u64) base.status {
|
||||
return base."#unsupported option"
|
||||
}
|
||||
|
||||
pub func decoder.history_retain_length() base.optional_u63 {
|
||||
return this.util.make_optional_u63(has_value: true, value: 0)
|
||||
}
|
||||
|
||||
pub func decoder.workbuf_len() base.range_ii_u64 {
|
||||
return this.util.empty_range_ii_u64()
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ pub status "#truncated input"
|
||||
pub status "#unsupported decoded length"
|
||||
pub status "#unsupported properties"
|
||||
|
||||
pub const DECODER_HISTORY_RETAIN_LENGTH_MAX_INCL_WORST_CASE : base.u64 = 0xFFFF_FFFF
|
||||
pub const DECODER_DST_HISTORY_RETAIN_LENGTH_MAX_INCL_WORST_CASE : base.u64 = 0xFFFF_FFFF
|
||||
|
||||
pub const DECODER_WORKBUF_LEN_MAX_INCL_WORST_CASE : base.u64 = 0
|
||||
|
||||
@@ -103,7 +103,7 @@ pub func decoder.set_quirk!(key: base.u32, value: base.u64) base.status {
|
||||
return base."#unsupported option"
|
||||
}
|
||||
|
||||
pub func decoder.history_retain_length() base.optional_u63 {
|
||||
pub func decoder.dst_history_retain_length() base.optional_u63 {
|
||||
if this.dict_size == 0 {
|
||||
return this.util.make_optional_u63(has_value: false, value: 0)
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ pub status "#truncated input"
|
||||
|
||||
pri status "#internal error: inconsistent I/O"
|
||||
|
||||
pub const DECODER_HISTORY_RETAIN_LENGTH_MAX_INCL_WORST_CASE : base.u64 = 0
|
||||
pub const DECODER_DST_HISTORY_RETAIN_LENGTH_MAX_INCL_WORST_CASE : base.u64 = 0
|
||||
|
||||
// TODO: move bulk data buffers like decoder.suffixes or decoder.output into
|
||||
// the workbuf? The first attempt at this was a performance regression for
|
||||
@@ -86,7 +86,7 @@ pub func decoder.set_quirk!(key: base.u32, value: base.u64) base.status {
|
||||
return base."#unsupported option"
|
||||
}
|
||||
|
||||
pub func decoder.history_retain_length() base.optional_u63 {
|
||||
pub func decoder.dst_history_retain_length() base.optional_u63 {
|
||||
return this.util.make_optional_u63(has_value: true, value: 0)
|
||||
}
|
||||
|
||||
|
||||
@@ -14,8 +14,7 @@ pub status "#unsupported Netpbm file"
|
||||
|
||||
pri status "@internal note: short read"
|
||||
|
||||
pub const DECODER_HISTORY_RETAIN_LENGTH_MAX_INCL_WORST_CASE : base.u64 = 0
|
||||
pub const DECODER_WORKBUF_LEN_MAX_INCL_WORST_CASE : base.u64 = 0
|
||||
pub const DECODER_WORKBUF_LEN_MAX_INCL_WORST_CASE : base.u64 = 0
|
||||
|
||||
pub struct decoder? implements base.image_decoder(
|
||||
pixfmt : base.u32,
|
||||
@@ -429,10 +428,6 @@ pub func decoder.tell_me_more?(dst: base.io_writer, minfo: nptr base.more_inform
|
||||
return base."#no more information"
|
||||
}
|
||||
|
||||
pub func decoder.history_retain_length() base.optional_u63 {
|
||||
return this.util.make_optional_u63(has_value: true, value: 0)
|
||||
}
|
||||
|
||||
pub func decoder.workbuf_len() base.range_ii_u64 {
|
||||
return this.util.make_range_ii_u64(min_incl: 0, max_incl: 0)
|
||||
}
|
||||
@@ -14,8 +14,7 @@ pub status "#unsupported NIE file"
|
||||
|
||||
pri status "@internal note: short read"
|
||||
|
||||
pub const DECODER_HISTORY_RETAIN_LENGTH_MAX_INCL_WORST_CASE : base.u64 = 0
|
||||
pub const DECODER_WORKBUF_LEN_MAX_INCL_WORST_CASE : base.u64 = 0
|
||||
pub const DECODER_WORKBUF_LEN_MAX_INCL_WORST_CASE : base.u64 = 0
|
||||
|
||||
pub struct decoder? implements base.image_decoder(
|
||||
pixfmt : base.u32,
|
||||
@@ -325,10 +324,6 @@ pub func decoder.tell_me_more?(dst: base.io_writer, minfo: nptr base.more_inform
|
||||
return base."#no more information"
|
||||
}
|
||||
|
||||
pub func decoder.history_retain_length() base.optional_u63 {
|
||||
return this.util.make_optional_u63(has_value: true, value: 0)
|
||||
}
|
||||
|
||||
pub func decoder.workbuf_len() base.range_ii_u64 {
|
||||
return this.util.make_range_ii_u64(min_incl: 0, max_incl: 0)
|
||||
}
|
||||
@@ -25,8 +25,7 @@ pri status "#internal error: inconsistent chunk type"
|
||||
pri status "#internal error: inconsistent workbuf length"
|
||||
pri status "#internal error: zlib decoder did not exhaust its input"
|
||||
|
||||
pub const DECODER_HISTORY_RETAIN_LENGTH_MAX_INCL_WORST_CASE : base.u64 = 0
|
||||
pub const DECODER_WORKBUF_LEN_MAX_INCL_WORST_CASE : base.u64 = 0x0007_FFFF_F100_0007
|
||||
pub const DECODER_WORKBUF_LEN_MAX_INCL_WORST_CASE : base.u64 = 0x0007_FFFF_F100_0007
|
||||
|
||||
// DECODER_SRC_IO_BUFFER_LENGTH_MIN_INCL is the minimum length of the src
|
||||
// wuffs_base__io_buffer passed to the decoder.
|
||||
|
||||
@@ -1719,10 +1719,6 @@ pri func decoder.do_tell_me_more?(dst: base.io_writer, minfo: nptr base.more_inf
|
||||
return ok
|
||||
}
|
||||
|
||||
pub func decoder.history_retain_length() base.optional_u63 {
|
||||
return this.util.make_optional_u63(has_value: true, value: 0)
|
||||
}
|
||||
|
||||
pub func decoder.workbuf_len() base.range_ii_u64 {
|
||||
return this.util.make_range_ii_u64(
|
||||
min_incl: this.overall_workbuf_length,
|
||||
|
||||
@@ -13,8 +13,7 @@ pub status "#bad run length encoding"
|
||||
pub status "#truncated input"
|
||||
pub status "#unsupported TGA file"
|
||||
|
||||
pub const DECODER_HISTORY_RETAIN_LENGTH_MAX_INCL_WORST_CASE : base.u64 = 0
|
||||
pub const DECODER_WORKBUF_LEN_MAX_INCL_WORST_CASE : base.u64 = 0
|
||||
pub const DECODER_WORKBUF_LEN_MAX_INCL_WORST_CASE : base.u64 = 0
|
||||
|
||||
pub struct decoder? implements base.image_decoder(
|
||||
width : base.u32[..= 0xFFFF],
|
||||
@@ -612,10 +611,6 @@ pub func decoder.tell_me_more?(dst: base.io_writer, minfo: nptr base.more_inform
|
||||
return base."#no more information"
|
||||
}
|
||||
|
||||
pub func decoder.history_retain_length() base.optional_u63 {
|
||||
return this.util.make_optional_u63(has_value: true, value: 0)
|
||||
}
|
||||
|
||||
pub func decoder.workbuf_len() base.range_ii_u64 {
|
||||
return this.util.make_range_ii_u64(min_incl: 0, max_incl: 0)
|
||||
}
|
||||
@@ -11,8 +11,7 @@
|
||||
pub status "#bad header"
|
||||
pub status "#truncated input"
|
||||
|
||||
pub const DECODER_HISTORY_RETAIN_LENGTH_MAX_INCL_WORST_CASE : base.u64 = 0
|
||||
pub const DECODER_WORKBUF_LEN_MAX_INCL_WORST_CASE : base.u64 = 0
|
||||
pub const DECODER_WORKBUF_LEN_MAX_INCL_WORST_CASE : base.u64 = 0
|
||||
|
||||
pub struct decoder? implements base.image_decoder(
|
||||
width : base.u32[..= 0xFF_FFFF],
|
||||
@@ -310,10 +309,6 @@ pub func decoder.tell_me_more?(dst: base.io_writer, minfo: nptr base.more_inform
|
||||
return base."#no more information"
|
||||
}
|
||||
|
||||
pub func decoder.history_retain_length() base.optional_u63 {
|
||||
return this.util.make_optional_u63(has_value: true, value: 0)
|
||||
}
|
||||
|
||||
pub func decoder.workbuf_len() base.range_ii_u64 {
|
||||
return this.util.make_range_ii_u64(min_incl: 0, max_incl: 0)
|
||||
}
|
||||
@@ -20,7 +20,7 @@ pub status "#bad parity check"
|
||||
pub status "#incorrect dictionary"
|
||||
pub status "#truncated input"
|
||||
|
||||
pub const DECODER_HISTORY_RETAIN_LENGTH_MAX_INCL_WORST_CASE : base.u64 = 0
|
||||
pub const DECODER_DST_HISTORY_RETAIN_LENGTH_MAX_INCL_WORST_CASE : base.u64 = 0
|
||||
|
||||
// TODO: reference deflate.DECODER_WORKBUF_LEN_MAX_INCL_WORST_CASE.
|
||||
pub const DECODER_WORKBUF_LEN_MAX_INCL_WORST_CASE : base.u64 = 1
|
||||
@@ -93,7 +93,7 @@ pub func decoder.set_quirk!(key: base.u32, value: base.u64) base.status {
|
||||
return base."#unsupported option"
|
||||
}
|
||||
|
||||
pub func decoder.history_retain_length() base.optional_u63 {
|
||||
pub func decoder.dst_history_retain_length() base.optional_u63 {
|
||||
return this.util.make_optional_u63(has_value: true, value: 0)
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user