mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-25 08:55:11 +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
@@ -37938,7 +37938,7 @@ const char wuffs_bzip2__error__internal_error_inconsistent_huffman_decoder_state
|
|||||||
// ---------------- Private Consts
|
// ---------------- Private Consts
|
||||||
|
|
||||||
static const uint8_t
|
static const uint8_t
|
||||||
WUFFS_BZIP2__CLAMP_TO_5[8] WUFFS_BASE__POTENTIALLY_UNUSED = {
|
WUFFS_BZIP2__CLAMP_NO_MORE_THAN_5[8] WUFFS_BASE__POTENTIALLY_UNUSED = {
|
||||||
0u, 1u, 2u, 3u, 4u, 5u, 5u, 5u,
|
0u, 1u, 2u, 3u, 4u, 5u, 5u, 5u,
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -38410,7 +38410,7 @@ wuffs_bzip2__decoder__do_transform_io(
|
|||||||
}
|
}
|
||||||
self->private_impl.f_block_size = 0u;
|
self->private_impl.f_block_size = 0u;
|
||||||
self->private_impl.f_decode_huffman_finished = false;
|
self->private_impl.f_decode_huffman_finished = false;
|
||||||
self->private_impl.f_decode_huffman_which = WUFFS_BZIP2__CLAMP_TO_5[((uint8_t)(self->private_data.f_huffman_selectors[0u] & 7u))];
|
self->private_impl.f_decode_huffman_which = WUFFS_BZIP2__CLAMP_NO_MORE_THAN_5[((uint8_t)(self->private_data.f_huffman_selectors[0u] & 7u))];
|
||||||
self->private_impl.f_decode_huffman_ticks = 50u;
|
self->private_impl.f_decode_huffman_ticks = 50u;
|
||||||
self->private_impl.f_decode_huffman_section = 0u;
|
self->private_impl.f_decode_huffman_section = 0u;
|
||||||
self->private_impl.f_decode_huffman_run_shift = 0u;
|
self->private_impl.f_decode_huffman_run_shift = 0u;
|
||||||
@@ -39364,7 +39364,7 @@ wuffs_bzip2__decoder__decode_huffman_fast(
|
|||||||
status = wuffs_base__make_status(wuffs_bzip2__error__bad_number_of_sections);
|
status = wuffs_base__make_status(wuffs_bzip2__error__bad_number_of_sections);
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
v_which = WUFFS_BZIP2__CLAMP_TO_5[((uint8_t)(self->private_data.f_huffman_selectors[(v_section & 32767u)] & 7u))];
|
v_which = WUFFS_BZIP2__CLAMP_NO_MORE_THAN_5[((uint8_t)(self->private_data.f_huffman_selectors[(v_section & 32767u)] & 7u))];
|
||||||
}
|
}
|
||||||
v_bits |= (wuffs_base__peek_u32be__no_bounds_check(iop_a_src) >> v_n_bits);
|
v_bits |= (wuffs_base__peek_u32be__no_bounds_check(iop_a_src) >> v_n_bits);
|
||||||
iop_a_src += ((31u - v_n_bits) >> 3u);
|
iop_a_src += ((31u - v_n_bits) >> 3u);
|
||||||
@@ -39487,7 +39487,7 @@ wuffs_bzip2__decoder__decode_huffman_slow(
|
|||||||
status = wuffs_base__make_status(wuffs_bzip2__error__bad_number_of_sections);
|
status = wuffs_base__make_status(wuffs_bzip2__error__bad_number_of_sections);
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
self->private_impl.f_decode_huffman_which = WUFFS_BZIP2__CLAMP_TO_5[((uint8_t)(self->private_data.f_huffman_selectors[(self->private_impl.f_decode_huffman_section & 32767u)] & 7u))];
|
self->private_impl.f_decode_huffman_which = WUFFS_BZIP2__CLAMP_NO_MORE_THAN_5[((uint8_t)(self->private_data.f_huffman_selectors[(self->private_impl.f_decode_huffman_section & 32767u)] & 7u))];
|
||||||
}
|
}
|
||||||
v_node_index = 0u;
|
v_node_index = 0u;
|
||||||
while (true) {
|
while (true) {
|
||||||
@@ -80970,7 +80970,7 @@ WUFFS_VP8__RENORM_RANGE_M1[256] WUFFS_BASE__POTENTIALLY_UNUSED = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
static const uint8_t
|
static const uint8_t
|
||||||
WUFFS_VP8__CLIP_9[16] WUFFS_BASE__POTENTIALLY_UNUSED = {
|
WUFFS_VP8__CLAMP_NO_MORE_THAN_9[16] WUFFS_BASE__POTENTIALLY_UNUSED = {
|
||||||
0u, 1u, 2u, 3u, 4u, 5u, 6u, 7u,
|
0u, 1u, 2u, 3u, 4u, 5u, 6u, 7u,
|
||||||
8u, 9u, 9u, 9u, 9u, 9u, 9u, 9u,
|
8u, 9u, 9u, 9u, 9u, 9u, 9u, 9u,
|
||||||
};
|
};
|
||||||
@@ -82511,12 +82511,12 @@ wuffs_vp8__decoder__decode_subblock_modes(
|
|||||||
v_i = 0u;
|
v_i = 0u;
|
||||||
while (v_i < 16u) {
|
while (v_i < 16u) {
|
||||||
if (v_i < 4u) {
|
if (v_i < 4u) {
|
||||||
v_top_mode = WUFFS_VP8__CLIP_9[(15u & (self->private_data.f_mb_states_top[a_mbx] >> (v_i * 4u)))];
|
v_top_mode = WUFFS_VP8__CLAMP_NO_MORE_THAN_9[(15u & (self->private_data.f_mb_states_top[a_mbx] >> (v_i * 4u)))];
|
||||||
} else {
|
} else {
|
||||||
v_top_mode = self->private_impl.f_mb_subblock_modes[(v_i - 4u)];
|
v_top_mode = self->private_impl.f_mb_subblock_modes[(v_i - 4u)];
|
||||||
}
|
}
|
||||||
if ((v_i & 3u) == 0u) {
|
if ((v_i & 3u) == 0u) {
|
||||||
v_left_mode = WUFFS_VP8__CLIP_9[(15u & (self->private_data.f_mb_states_left >> (v_i & 12u)))];
|
v_left_mode = WUFFS_VP8__CLAMP_NO_MORE_THAN_9[(15u & (self->private_data.f_mb_states_left >> (v_i & 12u)))];
|
||||||
} else {
|
} else {
|
||||||
v_left_mode = self->private_impl.f_mb_subblock_modes[(((uint32_t)(v_i + 15u)) & 15u)];
|
v_left_mode = self->private_impl.f_mb_subblock_modes[(((uint32_t)(v_i + 15u)) & 15u)];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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_DST_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 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(
|
pub struct decoder? implements base.io_transformer(
|
||||||
bits : base.u32,
|
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.block_size = 0
|
||||||
this.decode_huffman_finished = false
|
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_ticks = 50
|
||||||
this.decode_huffman_section = 0
|
this.decode_huffman_section = 0
|
||||||
this.decode_huffman_run_shift = 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 {
|
if section >= this.num_sections {
|
||||||
return "#bad number of 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
|
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 {
|
if this.decode_huffman_section >= this.num_sections {
|
||||||
return "#bad number of 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
|
node_index = 0
|
||||||
|
|||||||
@@ -107,7 +107,7 @@ pri const RENORM_RANGE_M1 : roarray[256] base.u8[127 ..= 254] = [
|
|||||||
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,
|
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
|
i = 0
|
||||||
while i < 16 {
|
while i < 16 {
|
||||||
if i < 4 {
|
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 {
|
} else {
|
||||||
top_mode = this.mb_subblock_modes[i - 4]
|
top_mode = this.mb_subblock_modes[i - 4]
|
||||||
}
|
}
|
||||||
|
|
||||||
if (i & 3) == 0 {
|
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 {
|
} else {
|
||||||
left_mode = this.mb_subblock_modes[(i ~mod+ 15) & 15]
|
left_mode = this.mb_subblock_modes[(i ~mod+ 15) & 15]
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user