]> granicus.if.org Git - libvpx/commitdiff
quantize test: test sse2 and avx optimizations
authorJohann <johannkoenig@google.com>
Tue, 18 Jul 2017 17:06:23 +0000 (10:06 -0700)
committerJohann <johannkoenig@google.com>
Tue, 18 Jul 2017 19:08:16 +0000 (12:08 -0700)
ssse3 does not pass either of the tests.

avx 32x32 does not pass.

Change-Id: I62c2e31336fd2327327afaa0da896ad79a3def44

test/vp9_quantize_test.cc

index 04cd10ddab178e8ea0af91be8354e63d8a4a08aa..138e3176fccb78fa73aa27ca72989d9373bbdd58 100644 (file)
@@ -30,7 +30,6 @@ using libvpx_test::ACMRandom;
 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 @@ TEST_P(VP9QuantizeTest, OperationCheck) {
   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 @@ TEST_P(VP9Quantize32Test, OperationCheck) {
   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 @@ TEST_P(VP9QuantizeTest, EOBCheck) {
   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 @@ TEST_P(VP9Quantize32Test, EOBCheck) {
   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 @@ TEST_P(VP9Quantize32Test, EOBCheck) {
 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 @@ INSTANTIATE_TEST_CASE_P(
                                  &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