shithub: libvpx

Download patch

ref: 101981b736a7d5fbfef41a9785cac17070910e4b
parent: c7ebe8225334d0b057505df0f76ee3db74da054b
author: Johann <johannkoenig@google.com>
date: Tue Jul 18 06:06:23 EDT 2017

quantize test: test sse2 and avx optimizations

ssse3 does not pass either of the tests.

avx 32x32 does not pass.

Change-Id: I62c2e31336fd2327327afaa0da896ad79a3def44

--- a/test/vp9_quantize_test.cc
+++ b/test/vp9_quantize_test.cc
@@ -30,7 +30,6 @@
 using libvpx_test::Buffer;
 
 namespace {
-#if CONFIG_VP9_HIGHBITDEPTH
 const int number_of_iterations = 100;
 
 typedef void (*QuantizeFunc)(const tran_low_t *coeff, intptr_t count,
@@ -90,10 +89,9 @@
   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);
+  Buffer<tran_low_t> qcoeff = Buffer<tran_low_t>(16, 16, 0, 32);
   ASSERT_TRUE(qcoeff.Init());
-  Buffer<tran_low_t> dqcoeff = Buffer<tran_low_t>(16, 16, 0, 16);
+  Buffer<tran_low_t> dqcoeff = Buffer<tran_low_t>(16, 16, 0, 32);
   ASSERT_TRUE(dqcoeff.Init());
   Buffer<tran_low_t> ref_qcoeff = Buffer<tran_low_t>(16, 16, 0);
   ASSERT_TRUE(ref_qcoeff.Init());
@@ -165,9 +163,9 @@
   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);
+  Buffer<tran_low_t> qcoeff = Buffer<tran_low_t>(32, 32, 0, 32);
   ASSERT_TRUE(qcoeff.Init());
-  Buffer<tran_low_t> dqcoeff = Buffer<tran_low_t>(32, 32, 0, 16);
+  Buffer<tran_low_t> dqcoeff = Buffer<tran_low_t>(32, 32, 0, 32);
   ASSERT_TRUE(dqcoeff.Init());
   Buffer<tran_low_t> ref_qcoeff = Buffer<tran_low_t>(32, 32, 0);
   ASSERT_TRUE(ref_qcoeff.Init());
@@ -231,9 +229,9 @@
   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);
+  Buffer<tran_low_t> qcoeff = Buffer<tran_low_t>(16, 16, 0, 32);
   ASSERT_TRUE(qcoeff.Init());
-  Buffer<tran_low_t> dqcoeff = Buffer<tran_low_t>(16, 16, 0, 16);
+  Buffer<tran_low_t> dqcoeff = Buffer<tran_low_t>(16, 16, 0, 32);
   ASSERT_TRUE(dqcoeff.Init());
   Buffer<tran_low_t> ref_qcoeff = Buffer<tran_low_t>(16, 16, 0);
   ASSERT_TRUE(ref_qcoeff.Init());
@@ -300,9 +298,9 @@
   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);
+  Buffer<tran_low_t> qcoeff = Buffer<tran_low_t>(32, 32, 0, 32);
   ASSERT_TRUE(qcoeff.Init());
-  Buffer<tran_low_t> dqcoeff = Buffer<tran_low_t>(32, 32, 0, 16);
+  Buffer<tran_low_t> dqcoeff = Buffer<tran_low_t>(32, 32, 0, 32);
   ASSERT_TRUE(dqcoeff.Init());
   Buffer<tran_low_t> ref_qcoeff = Buffer<tran_low_t>(32, 32, 0);
   ASSERT_TRUE(ref_qcoeff.Init());
@@ -362,9 +360,12 @@
 using std::tr1::make_tuple;
 
 #if HAVE_SSE2
+#if CONFIG_VP9_HIGHBITDEPTH
 INSTANTIATE_TEST_CASE_P(
     SSE2, VP9QuantizeTest,
-    ::testing::Values(make_tuple(&vpx_highbd_quantize_b_sse2,
+    ::testing::Values(make_tuple(&vpx_quantize_b_sse2, &vpx_highbd_quantize_b_c,
+                                 VPX_BITS_8),
+                      make_tuple(&vpx_highbd_quantize_b_sse2,
                                  &vpx_highbd_quantize_b_c, VPX_BITS_8),
                       make_tuple(&vpx_highbd_quantize_b_sse2,
                                  &vpx_highbd_quantize_b_c, VPX_BITS_10),
@@ -378,6 +379,37 @@
                                  &vpx_highbd_quantize_b_32x32_c, VPX_BITS_10),
                       make_tuple(&vpx_highbd_quantize_b_32x32_sse2,
                                  &vpx_highbd_quantize_b_32x32_c, VPX_BITS_12)));
-#endif  // HAVE_SSE2
+#else
+INSTANTIATE_TEST_CASE_P(SSE2, VP9QuantizeTest,
+                        ::testing::Values(make_tuple(&vpx_quantize_b_sse2,
+                                                     &vpx_quantize_b_c,
+                                                     VPX_BITS_8)));
 #endif  // CONFIG_VP9_HIGHBITDEPTH
+#endif  // HAVE_SSE2
+
+// TODO(johannkoenig): SSSE3 optimizations do not yet pass these tests.
+#if HAVE_SSSE3 && ARCH_X86_64
+INSTANTIATE_TEST_CASE_P(DISABLED_SSSE3, VP9QuantizeTest,
+                        ::testing::Values(make_tuple(&vpx_quantize_b_ssse3,
+                                                     &vpx_quantize_b_c,
+                                                     VPX_BITS_8)));
+
+INSTANTIATE_TEST_CASE_P(
+    DISABLED_SSSE3, VP9Quantize32Test,
+    ::testing::Values(make_tuple(&vpx_quantize_b_32x32_ssse3,
+                                 &vpx_quantize_b_32x32_c, VPX_BITS_8)));
+#endif  // HAVE_SSSE3 && ARCH_X86_64
+
+// TODO(johannkoenig): AVX optimizations do not yet pass the 32x32 test.
+#if HAVE_AVX && ARCH_X86_64
+INSTANTIATE_TEST_CASE_P(AVX, VP9QuantizeTest,
+                        ::testing::Values(make_tuple(&vpx_quantize_b_avx,
+                                                     &vpx_quantize_b_c,
+                                                     VPX_BITS_8)));
+
+INSTANTIATE_TEST_CASE_P(DISABLED_AVX, VP9Quantize32Test,
+                        ::testing::Values(make_tuple(&vpx_quantize_b_32x32_avx,
+                                                     &vpx_quantize_b_32x32_c,
+                                                     VPX_BITS_8)));
+#endif  // HAVE_AVX && ARCH_X86_64
 }  // namespace