Fix av1_txb_init_levels clamping limit
This solves an enc/dec mismatch issue due to the fact that
SIMD implementation compares signed int8_t. Hence we need to
limit the base level reference to be under 127, to avoid cmpt
instruction taking it as a negative number.
BUG=aomedia:1045
Change-Id: I2ed616fda52415fbf50451660b9564df1adf77af
diff --git a/av1/encoder/encodetxb.c b/av1/encoder/encodetxb.c
index fc1e236..30a56e5 100644
--- a/av1/encoder/encodetxb.c
+++ b/av1/encoder/encodetxb.c
@@ -277,7 +277,7 @@
const TxbInfo *const txb_info) {
txb_info->qcoeff[coeff_idx] = qc;
txb_info->levels[get_paded_idx(coeff_idx, txb_info->bwl)] =
- (uint8_t)clamp(abs(qc), 0, UINT8_MAX);
+ (uint8_t)clamp(abs(qc), 0, INT8_MAX);
}
static INLINE void update_coeff(const int coeff_idx, const tran_low_t qc,
@@ -300,7 +300,7 @@
for (int i = 0; i < height; i++) {
for (int j = 0; j < width; j++) {
- *ls++ = (uint8_t)clamp(abs(coeff[i * width + j]), 0, UINT8_MAX);
+ *ls++ = (uint8_t)clamp(abs(coeff[i * width + j]), 0, INT8_MAX);
}
for (int j = 0; j < TX_PAD_HOR; j++) {
*ls++ = 0;