mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-20 16:47:28 +01:00
std: rename some CLAMP and CLIP tables
This commit is contained in:
1 parent
5daeafbc6f
commit
18488a3bd0
6 files changed
+16
-14
No files matched your search
@@ -23,7 +23,9 @@ pri status "#internal error: inconsistent Huffman decoder state"
|
||||
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]
|
||||
pri const CLAMP_NO_MORE_THAN_5 : roarray[8] base.u8[..= 5] = [
|
||||
0, 1, 2, 3, 4, 5, 5, 5,
|
||||
]
|
||||
|
||||
pub struct decoder? implements base.io_transformer(
|
||||
bits : base.u32,
|
||||
@@ -197,7 +199,7 @@ pri func decoder.do_transform_io?(dst: base.io_writer, src: base.io_reader, work
|
||||
|
||||
this.block_size = 0
|
||||
this.decode_huffman_finished = false
|
||||
this.decode_huffman_which = CLAMP_TO_5[this.huffman_selectors[0] & 7]
|
||||
this.decode_huffman_which = CLAMP_NO_MORE_THAN_5[this.huffman_selectors[0] & 7]
|
||||
this.decode_huffman_ticks = 50
|
||||
this.decode_huffman_section = 0
|
||||
this.decode_huffman_run_shift = 0
|
||||
|
||||
@@ -44,7 +44,7 @@ pri func decoder.decode_huffman_fast!(src: base.io_reader) base.status {
|
||||
if section >= this.num_sections {
|
||||
return "#bad number of sections"
|
||||
}
|
||||
which = CLAMP_TO_5[this.huffman_selectors[section & 32767] & 7]
|
||||
which = CLAMP_NO_MORE_THAN_5[this.huffman_selectors[section & 32767] & 7]
|
||||
}
|
||||
|
||||
bits |= args.src.peek_u32be() >> n_bits
|
||||
|
||||
@@ -30,7 +30,7 @@ pri func decoder.decode_huffman_slow?(src: base.io_reader) {
|
||||
if this.decode_huffman_section >= this.num_sections {
|
||||
return "#bad number of sections"
|
||||
}
|
||||
this.decode_huffman_which = CLAMP_TO_5[this.huffman_selectors[this.decode_huffman_section & 32767] & 7]
|
||||
this.decode_huffman_which = CLAMP_NO_MORE_THAN_5[this.huffman_selectors[this.decode_huffman_section & 32767] & 7]
|
||||
}
|
||||
|
||||
node_index = 0
|
||||
|
||||
@@ -107,7 +107,7 @@ pri const RENORM_RANGE_M1 : roarray[256] base.u8[127 ..= 254] = [
|
||||
254,
|
||||
]
|
||||
|
||||
pri const CLIP_9 : roarray[16] base.u8[..= 9] = [
|
||||
pri const CLAMP_NO_MORE_THAN_9 : roarray[16] base.u8[..= 9] = [
|
||||
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 9, 9, 9, 9, 9, 9,
|
||||
]
|
||||
|
||||
|
||||
@@ -165,13 +165,13 @@ pri func decoder.decode_subblock_modes!(
|
||||
i = 0
|
||||
while i < 16 {
|
||||
if i < 4 {
|
||||
top_mode = CLIP_9[15 & (this.mb_states_top[args.mbx] >> (i * 4))]
|
||||
top_mode = CLAMP_NO_MORE_THAN_9[15 & (this.mb_states_top[args.mbx] >> (i * 4))]
|
||||
} else {
|
||||
top_mode = this.mb_subblock_modes[i - 4]
|
||||
}
|
||||
|
||||
if (i & 3) == 0 {
|
||||
left_mode = CLIP_9[15 & (this.mb_states_left >> (i & 12))]
|
||||
left_mode = CLAMP_NO_MORE_THAN_9[15 & (this.mb_states_left >> (i & 12))]
|
||||
} else {
|
||||
left_mode = this.mb_subblock_modes[(i ~mod+ 15) & 15]
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user