Revert "Fix bug in round shift array unit test"
This reverts commit e61e970e3936cf5f4fdefc7fffcfe2aa9c884e7e.
Apparently the encoder has uses for this outside the decoder
specification
BUG=aomedia:1960,aomedia:1974
Change-Id: I6acef55dcf95d2dd35844ca7540d7ce203b5761f
diff --git a/av1/common/av1_txfm.c b/av1/common/av1_txfm.c
index 5a16209..1e66541 100644
--- a/av1/common/av1_txfm.c
+++ b/av1/common/av1_txfm.c
@@ -69,12 +69,19 @@
void av1_round_shift_array_c(int32_t *arr, int size, int bit) {
int i;
- // 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);
+ 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);
+ }
+ }
}
}
diff --git a/test/av1_round_shift_array_test.cc b/test/av1_round_shift_array_test.cc
index 394fda6..825d134 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[] = {
- 0, 1, 2, 3, 4,
+ -4, -3, -2, -1, 0, 1, 2, 3, 4,
};
typedef ::testing::tuple<comp_round_shift_array_func, BLOCK_SIZE, int>