Fix bug in round shift array unit test
According to AV1 decoder specification (section 7.13.3) round shift value can not be negative.
Range of row shift: 0 to 2
Range of column shift: 0 to 4
Thus unit test case is corrected with valid range of bit shift values.
BUG=aomedia:1960
Change-Id: I2c9f67a9c7577b53f0574434ab4171e75144080c
diff --git a/av1/common/av1_txfm.c b/av1/common/av1_txfm.c
index 1e66541..5a16209 100644
--- a/av1/common/av1_txfm.c
+++ b/av1/common/av1_txfm.c
@@ -69,19 +69,12 @@
void av1_round_shift_array_c(int32_t *arr, int size, int bit) {
int i;
- if (bit == 0) {
- return;
- } else {
- if (bit > 0) {
- for (i = 0; i < size; i++) {
- arr[i] = round_shift(arr[i], bit);
- }
- } else {
- for (i = 0; i < size; i++) {
- arr[i] = (int32_t)clamp64(((int64_t)1 << (-bit)) * arr[i], INT32_MIN,
- INT32_MAX);
- }
- }
+ // Bit range is specified in section 7.13.3
+ assert(bit >= 0);
+ assert(bit <= 4);
+ if (bit == 0) return;
+ for (i = 0; i < size; i++) {
+ arr[i] = round_shift(arr[i], bit);
}
}
diff --git a/test/av1_round_shift_array_test.cc b/test/av1_round_shift_array_test.cc
index 825d134..394fda6 100644
--- a/test/av1_round_shift_array_test.cc
+++ b/test/av1_round_shift_array_test.cc
@@ -28,7 +28,7 @@
typedef void (*comp_round_shift_array_func)(int32_t *arr, int size, int bit);
const int kValidBitCheck[] = {
- -4, -3, -2, -1, 0, 1, 2, 3, 4,
+ 0, 1, 2, 3, 4,
};
typedef ::testing::tuple<comp_round_shift_array_func, BLOCK_SIZE, int>