Update TEST_P(PartialIDctTest, RunQuantCheck)
authorLinfeng Zhang <linfengz@google.com>
Wed, 7 Dec 2016 19:34:00 +0000 (11:34 -0800)
committerLinfeng Zhang <linfengz@google.com>
Wed, 7 Dec 2016 19:34:00 +0000 (11:34 -0800)
1. Use correct projections when copying real dct/quant outputs.
2. Remove local random number generator and combine loops.
3. Quantization with minimum allowed step sizes instead of maximum.
   This may generate larger inputs.

Change-Id: I154afc26230c894d564671cff4b8fd5485b69598

test/partial_idct_test.cc

index cab93a3..509aeac 100644 (file)
@@ -178,35 +178,30 @@ TEST_P(PartialIDctTest, RunQuantCheck) {
   DECLARE_ALIGNED(16, int16_t, input_extreme_block[kMaxNumCoeffs]);
   DECLARE_ALIGNED(16, tran_low_t, output_ref_block[kMaxNumCoeffs]);
 
-  for (int i = 0; i < kCountTestBlock; ++i) {
-    InitMem();
-
-    ACMRandom rnd(ACMRandom::DeterministicSeed());
-
-    for (int j = 0; j < kCountTestBlock; ++j) {
-      // Initialize a test block with input range [-mask_, mask_].
-      if (j == 0) {
-        for (int k = 0; k < input_block_size_; ++k) {
-          input_extreme_block[k] = mask_;
-        }
-      } else if (j == 1) {
-        for (int k = 0; k < input_block_size_; ++k) {
-          input_extreme_block[k] = -mask_;
-        }
-      } else {
-        for (int k = 0; k < input_block_size_; ++k) {
-          input_extreme_block[k] = rnd.Rand8() % 2 ? mask_ : -mask_;
-        }
+  InitMem();
+  for (int i = 0; i < kCountTestBlock * kCountTestBlock; ++i) {
+    // Initialize a test block with input range [-mask_, mask_].
+    if (i == 0) {
+      for (int k = 0; k < input_block_size_; ++k) {
+        input_extreme_block[k] = mask_;
       }
+    } else if (i == 1) {
+      for (int k = 0; k < input_block_size_; ++k) {
+        input_extreme_block[k] = -mask_;
+      }
+    } else {
+      for (int k = 0; k < input_block_size_; ++k) {
+        input_extreme_block[k] = rnd_.Rand8() % 2 ? mask_ : -mask_;
+      }
+    }
 
-      ftxfm_(input_extreme_block, output_ref_block, size_);
+    ftxfm_(input_extreme_block, output_ref_block, size_);
 
-      // quantization with maximum allowed step sizes
-      input_block_[0] = (output_ref_block[0] / 1336) * 1336;
-      for (int k = 1; k < last_nonzero_; ++k) {
-        input_block_[vp9_default_scan_orders[tx_size_].scan[k]] =
-            (output_ref_block[k] / 1828) * 1828;
-      }
+    // quantization with minimum allowed step sizes
+    input_block_[0] = (output_ref_block[0] / 4) * 4;
+    for (int k = 1; k < last_nonzero_; ++k) {
+      const int pos = vp9_default_scan_orders[tx_size_].scan[k];
+      input_block_[pos] = (output_ref_block[pos] / 4) * 4;
     }
 
     ASM_REGISTER_STATE_CHECK(Exec(full_itxfm_, output_block_ref_));