shithub: libvpx

Download patch

ref: c7ebe8225334d0b057505df0f76ee3db74da054b
parent: cb61ba02f45b4729f43367d3a5e5625f3331c227
author: Johann <johannkoenig@google.com>
date: Tue Jul 18 05:55:45 EDT 2017

quantize test: extend arrays

Officially the quant structures are 8 elements, with one dc element and
7 repeated ac elements. The low bit depth optimizations take advantage
of this to fill the xmm registers. The high bit depth version manually
duplicates the values.

If all the optimizations were unified, the structure sizes could be
greatly reduced.

Change-Id: Ibd7a0337a7832ce2a1a05ee433c310077e1059ae

--- a/test/vp9_quantize_test.cc
+++ b/test/vp9_quantize_test.cc
@@ -85,10 +85,11 @@
   ACMRandom rnd(ACMRandom::DeterministicSeed());
   Buffer<tran_low_t> coeff = Buffer<tran_low_t>(16, 16, 0, 16);
   ASSERT_TRUE(coeff.Init());
-  DECLARE_ALIGNED(16, int16_t, zbin_ptr[2]);
-  DECLARE_ALIGNED(16, int16_t, round_ptr[2]);
-  DECLARE_ALIGNED(16, int16_t, quant_ptr[2]);
-  DECLARE_ALIGNED(16, int16_t, quant_shift_ptr[2]);
+  DECLARE_ALIGNED(16, int16_t, zbin_ptr[8]);
+  DECLARE_ALIGNED(16, int16_t, round_ptr[8]);
+  DECLARE_ALIGNED(16, int16_t, quant_ptr[8]);
+  DECLARE_ALIGNED(16, int16_t, quant_shift_ptr[8]);
+  DECLARE_ALIGNED(16, int16_t, dequant_ptr[8]);
   // These will need to be aligned to 32 when avx code is tested.
   Buffer<tran_low_t> qcoeff = Buffer<tran_low_t>(16, 16, 0, 16);
   ASSERT_TRUE(qcoeff.Init());
@@ -98,7 +99,6 @@
   ASSERT_TRUE(ref_qcoeff.Init());
   Buffer<tran_low_t> ref_dqcoeff = Buffer<tran_low_t>(16, 16, 0);
   ASSERT_TRUE(ref_dqcoeff.Init());
-  DECLARE_ALIGNED(16, int16_t, dequant_ptr[2]);
   uint16_t eob, ref_eob;
 
   for (int i = 0; i < number_of_iterations; ++i) {
@@ -125,6 +125,14 @@
       // dequant maxes out at 1828 for all cases.
       dequant_ptr[j] = rnd.RandRange(1828);
     }
+    for (int j = 2; j < 8; j++) {
+      zbin_ptr[j] = zbin_ptr[1];
+      round_ptr[j] = round_ptr[1];
+      quant_ptr[j] = quant_ptr[1];
+      quant_shift_ptr[j] = quant_shift_ptr[1];
+      dequant_ptr[j] = dequant_ptr[1];
+    }
+
     ref_quantize_op_(
         coeff.TopLeftPixel(), count, skip_block, zbin_ptr, round_ptr, quant_ptr,
         quant_shift_ptr, ref_qcoeff.TopLeftPixel(), ref_dqcoeff.TopLeftPixel(),
@@ -152,10 +160,11 @@
   ACMRandom rnd(ACMRandom::DeterministicSeed());
   Buffer<tran_low_t> coeff = Buffer<tran_low_t>(32, 32, 0, 16);
   ASSERT_TRUE(coeff.Init());
-  DECLARE_ALIGNED(16, int16_t, zbin_ptr[2]);
-  DECLARE_ALIGNED(16, int16_t, round_ptr[2]);
-  DECLARE_ALIGNED(16, int16_t, quant_ptr[2]);
-  DECLARE_ALIGNED(16, int16_t, quant_shift_ptr[2]);
+  DECLARE_ALIGNED(16, int16_t, zbin_ptr[8]);
+  DECLARE_ALIGNED(16, int16_t, round_ptr[8]);
+  DECLARE_ALIGNED(16, int16_t, quant_ptr[8]);
+  DECLARE_ALIGNED(16, int16_t, quant_shift_ptr[8]);
+  DECLARE_ALIGNED(16, int16_t, dequant_ptr[8]);
   Buffer<tran_low_t> qcoeff = Buffer<tran_low_t>(32, 32, 0, 16);
   ASSERT_TRUE(qcoeff.Init());
   Buffer<tran_low_t> dqcoeff = Buffer<tran_low_t>(32, 32, 0, 16);
@@ -164,7 +173,6 @@
   ASSERT_TRUE(ref_qcoeff.Init());
   Buffer<tran_low_t> ref_dqcoeff = Buffer<tran_low_t>(32, 32, 0);
   ASSERT_TRUE(ref_dqcoeff.Init());
-  DECLARE_ALIGNED(16, int16_t, dequant_ptr[2]);
   uint16_t eob, ref_eob;
 
   for (int i = 0; i < number_of_iterations; ++i) {
@@ -183,6 +191,14 @@
       quant_shift_ptr[j] = rnd.RandRange(16384);
       dequant_ptr[j] = rnd.RandRange(1828);
     }
+    for (int j = 2; j < 8; j++) {
+      zbin_ptr[j] = zbin_ptr[1];
+      round_ptr[j] = round_ptr[1];
+      quant_ptr[j] = quant_ptr[1];
+      quant_shift_ptr[j] = quant_shift_ptr[1];
+      dequant_ptr[j] = dequant_ptr[1];
+    }
+
     ref_quantize_op_(
         coeff.TopLeftPixel(), count, skip_block, zbin_ptr, round_ptr, quant_ptr,
         quant_shift_ptr, ref_qcoeff.TopLeftPixel(), ref_dqcoeff.TopLeftPixel(),
@@ -210,10 +226,11 @@
   ACMRandom rnd(ACMRandom::DeterministicSeed());
   Buffer<tran_low_t> coeff = Buffer<tran_low_t>(16, 16, 0, 16);
   ASSERT_TRUE(coeff.Init());
-  DECLARE_ALIGNED(16, int16_t, zbin_ptr[2]);
-  DECLARE_ALIGNED(16, int16_t, round_ptr[2]);
-  DECLARE_ALIGNED(16, int16_t, quant_ptr[2]);
-  DECLARE_ALIGNED(16, int16_t, quant_shift_ptr[2]);
+  DECLARE_ALIGNED(16, int16_t, zbin_ptr[8]);
+  DECLARE_ALIGNED(16, int16_t, round_ptr[8]);
+  DECLARE_ALIGNED(16, int16_t, quant_ptr[8]);
+  DECLARE_ALIGNED(16, int16_t, quant_shift_ptr[8]);
+  DECLARE_ALIGNED(16, int16_t, dequant_ptr[8]);
   Buffer<tran_low_t> qcoeff = Buffer<tran_low_t>(16, 16, 0, 16);
   ASSERT_TRUE(qcoeff.Init());
   Buffer<tran_low_t> dqcoeff = Buffer<tran_low_t>(16, 16, 0, 16);
@@ -222,7 +239,6 @@
   ASSERT_TRUE(ref_qcoeff.Init());
   Buffer<tran_low_t> ref_dqcoeff = Buffer<tran_low_t>(16, 16, 0);
   ASSERT_TRUE(ref_dqcoeff.Init());
-  DECLARE_ALIGNED(16, int16_t, dequant_ptr[2]);
   uint16_t eob, ref_eob;
 
   for (int i = 0; i < number_of_iterations; ++i) {
@@ -244,6 +260,13 @@
       quant_shift_ptr[j] = rnd.RandRange(16384);
       dequant_ptr[j] = rnd.RandRange(1828);
     }
+    for (int j = 2; j < 8; j++) {
+      zbin_ptr[j] = zbin_ptr[1];
+      round_ptr[j] = round_ptr[1];
+      quant_ptr[j] = quant_ptr[1];
+      quant_shift_ptr[j] = quant_shift_ptr[1];
+      dequant_ptr[j] = dequant_ptr[1];
+    }
 
     ref_quantize_op_(
         coeff.TopLeftPixel(), count, skip_block, zbin_ptr, round_ptr, quant_ptr,
@@ -272,10 +295,11 @@
   ACMRandom rnd(ACMRandom::DeterministicSeed());
   Buffer<tran_low_t> coeff = Buffer<tran_low_t>(32, 32, 0, 16);
   ASSERT_TRUE(coeff.Init());
-  DECLARE_ALIGNED(16, int16_t, zbin_ptr[2]);
-  DECLARE_ALIGNED(16, int16_t, round_ptr[2]);
-  DECLARE_ALIGNED(16, int16_t, quant_ptr[2]);
-  DECLARE_ALIGNED(16, int16_t, quant_shift_ptr[2]);
+  DECLARE_ALIGNED(16, int16_t, zbin_ptr[8]);
+  DECLARE_ALIGNED(16, int16_t, round_ptr[8]);
+  DECLARE_ALIGNED(16, int16_t, quant_ptr[8]);
+  DECLARE_ALIGNED(16, int16_t, quant_shift_ptr[8]);
+  DECLARE_ALIGNED(16, int16_t, dequant_ptr[8]);
   Buffer<tran_low_t> qcoeff = Buffer<tran_low_t>(32, 32, 0, 16);
   ASSERT_TRUE(qcoeff.Init());
   Buffer<tran_low_t> dqcoeff = Buffer<tran_low_t>(32, 32, 0, 16);
@@ -284,7 +308,6 @@
   ASSERT_TRUE(ref_qcoeff.Init());
   Buffer<tran_low_t> ref_dqcoeff = Buffer<tran_low_t>(32, 32, 0);
   ASSERT_TRUE(ref_dqcoeff.Init());
-  DECLARE_ALIGNED(16, int16_t, dequant_ptr[2]);
   uint16_t eob, ref_eob;
 
   for (int i = 0; i < number_of_iterations; ++i) {
@@ -305,6 +328,13 @@
       quant_ptr[j] = rnd.RandRange(32704) - 32703;
       quant_shift_ptr[j] = rnd.RandRange(16384);
       dequant_ptr[j] = rnd.RandRange(1828);
+    }
+    for (int j = 2; j < 8; j++) {
+      zbin_ptr[j] = zbin_ptr[1];
+      round_ptr[j] = round_ptr[1];
+      quant_ptr[j] = quant_ptr[1];
+      quant_shift_ptr[j] = quant_shift_ptr[1];
+      dequant_ptr[j] = dequant_ptr[1];
     }
 
     ref_quantize_op_(