Merge "Simplify rd_pick_intra_sby_mode()"
[platform/upstream/libvpx.git] / test / intrapred_test.cc
index 5fba700..f0d9c34 100644 (file)
 #include "test/clear_system_state.h"
 #include "test/register_state_check.h"
 #include "third_party/googletest/src/include/gtest/gtest.h"
-extern "C" {
+
 #include "./vpx_config.h"
 #include "./vp8_rtcd.h"
 #include "vp8/common/blockd.h"
 #include "vpx_mem/vpx_mem.h"
-}
 
 namespace {
 
@@ -27,11 +26,7 @@ using libvpx_test::ACMRandom;
 
 class IntraPredBase {
  public:
-  virtual ~IntraPredBase() {}
-
-  virtual void TearDown() {
-    libvpx_test::ClearSystemState();
-  }
+  virtual ~IntraPredBase() { libvpx_test::ClearSystemState(); }
 
  protected:
   void SetupMacroblock(MACROBLOCKD *mbptr,
@@ -221,15 +216,16 @@ class IntraPredBase {
   int num_planes_;
 };
 
-typedef void (*intra_pred_y_fn_t)(MACROBLOCKD *x,
-                                  uint8_t *yabove_row,
-                                  uint8_t *yleft,
-                                  int left_stride,
-                                  uint8_t *ypred_ptr,
-                                  int y_stride);
+typedef void (*IntraPredYFunc)(MACROBLOCKD *x,
+                               uint8_t *yabove_row,
+                               uint8_t *yleft,
+                               int left_stride,
+                               uint8_t *ypred_ptr,
+                               int y_stride);
 
-class IntraPredYTest : public ::testing::TestWithParam<intra_pred_y_fn_t>,
-    protected IntraPredBase {
+class IntraPredYTest
+    : public IntraPredBase,
+      public ::testing::TestWithParam<IntraPredYFunc> {
  public:
   static void SetUpTestCase() {
     mb_ = reinterpret_cast<MACROBLOCKD*>(
@@ -265,13 +261,13 @@ class IntraPredYTest : public ::testing::TestWithParam<intra_pred_y_fn_t>,
 
   virtual void Predict(MB_PREDICTION_MODE mode) {
     mbptr_->mode_info_context->mbmi.mode = mode;
-    REGISTER_STATE_CHECK(pred_fn_(mbptr_,
-                                  data_ptr_[0] - kStride,
-                                  data_ptr_[0] - 1, kStride,
-                                  data_ptr_[0], kStride));
+    ASM_REGISTER_STATE_CHECK(pred_fn_(mbptr_,
+                                      data_ptr_[0] - kStride,
+                                      data_ptr_[0] - 1, kStride,
+                                      data_ptr_[0], kStride));
   }
 
-  intra_pred_y_fn_t pred_fn_;
+  IntraPredYFunc pred_fn_;
   static uint8_t* data_array_;
   static MACROBLOCKD * mb_;
   static MODE_INFO *mi_;
@@ -298,19 +294,25 @@ INSTANTIATE_TEST_CASE_P(SSSE3, IntraPredYTest,
                         ::testing::Values(
                             vp8_build_intra_predictors_mby_s_ssse3));
 #endif
+#if HAVE_NEON
+INSTANTIATE_TEST_CASE_P(NEON, IntraPredYTest,
+                        ::testing::Values(
+                            vp8_build_intra_predictors_mby_s_neon));
+#endif
 
-typedef void (*intra_pred_uv_fn_t)(MACROBLOCKD *x,
-                                   uint8_t *uabove_row,
-                                   uint8_t *vabove_row,
-                                   uint8_t *uleft,
-                                   uint8_t *vleft,
-                                   int left_stride,
-                                   uint8_t *upred_ptr,
-                                   uint8_t *vpred_ptr,
-                                   int pred_stride);
-
-class IntraPredUVTest : public ::testing::TestWithParam<intra_pred_uv_fn_t>,
-    protected IntraPredBase {
+typedef void (*IntraPredUvFunc)(MACROBLOCKD *x,
+                                uint8_t *uabove_row,
+                                uint8_t *vabove_row,
+                                uint8_t *uleft,
+                                uint8_t *vleft,
+                                int left_stride,
+                                uint8_t *upred_ptr,
+                                uint8_t *vpred_ptr,
+                                int pred_stride);
+
+class IntraPredUVTest
+    : public IntraPredBase,
+      public ::testing::TestWithParam<IntraPredUvFunc> {
  public:
   static void SetUpTestCase() {
     mb_ = reinterpret_cast<MACROBLOCKD*>(
@@ -352,7 +354,7 @@ class IntraPredUVTest : public ::testing::TestWithParam<intra_pred_uv_fn_t>,
              data_ptr_[0], data_ptr_[1], kStride);
   }
 
-  intra_pred_uv_fn_t pred_fn_;
+  IntraPredUvFunc pred_fn_;
   // We use 24 so that the data pointer of the first pixel in each row of
   // each macroblock is 8-byte aligned, and this gives us access to the
   // top-left and top-right corner pixels belonging to the top-left/right
@@ -385,5 +387,10 @@ INSTANTIATE_TEST_CASE_P(SSSE3, IntraPredUVTest,
                         ::testing::Values(
                             vp8_build_intra_predictors_mbuv_s_ssse3));
 #endif
+#if HAVE_NEON
+INSTANTIATE_TEST_CASE_P(NEON, IntraPredUVTest,
+                        ::testing::Values(
+                            vp8_build_intra_predictors_mbuv_s_neon));
+#endif
 
 }  // namespace