mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-25 00:55:11 +01:00
Restore deflate.decoder.n_huffs_bits's refinement
This commit is contained in:
1 parent
b075fcbed9
commit
5aeb98c701
5 files changed
+20
-28
No files matched your search
@@ -69,6 +69,9 @@ pub struct decoder?(
|
||||
// history_index indexes the history array, defined below.
|
||||
history_index base.u32,
|
||||
|
||||
// n_huffs_bits is discussed in the huffs field comment.
|
||||
n_huffs_bits array[2] base.u32[..9],
|
||||
|
||||
// end_of_block is whether decode_huffman_xxx saw an end-of-block code.
|
||||
//
|
||||
// TODO: can decode_huffman_xxx signal this in band instead of out of band?
|
||||
@@ -106,8 +109,7 @@ pub struct decoder?(
|
||||
// - bits 3 .. 0 are the number of decoder.bits to consume.
|
||||
//
|
||||
// Exactly one of the eight bits 31-24 should be set.
|
||||
huffs array[2] array[huffs_table_size] base.u32,
|
||||
n_huffs_bits array[2] base.u32,
|
||||
huffs array[2] array[huffs_table_size] base.u32,
|
||||
|
||||
// history holds up to the last 32KiB of decoded output, if the decoding
|
||||
// was incomplete (e.g. due to a short read or write). RFC 1951 (DEFLATE)
|
||||
@@ -389,7 +391,7 @@ pri func decoder.init_dynamic_huffman?(src base.io_reader) {
|
||||
}
|
||||
|
||||
// Decode the code lengths for the next two Huffman tables.
|
||||
mask = ((1 as base.u32) << (this.n_huffs_bits[0].min(x:9))) - 1
|
||||
mask = ((1 as base.u32) << (this.n_huffs_bits[0])) - 1
|
||||
i = 0
|
||||
while i < (n_lit + n_dist) {
|
||||
assert i < (288 + 32) via "a < (b + c): a < (b0 + c0); b0 <= b; c0 <= c"(b0:n_lit, c0:n_dist)
|
||||
|
||||
Reference in new issue
Block a user