Commit 6b653cba authored by John Koleszar's avatar John Koleszar

Add VP9 1 block SAD functions to unit test

Change-Id: I06b5ba5c457944cfa4cd9f53c3bd8cda132439c2
parent 69c67c95
......@@ -15,8 +15,13 @@
extern "C" {
#include "./vpx_config.h"
#if CONFIG_VP8_ENCODER
#include "./vp8_rtcd.h"
#include "vp8/common/blockd.h"
//#include "vp8/common/blockd.h"
#endif
#if CONFIG_VP9_ENCODER
#include "./vp9_rtcd.h"
#endif
#include "vpx_mem/vpx_mem.h"
}
......@@ -52,14 +57,15 @@ class SADTest : public PARAMS(int, int, sad_m_by_n_fn_t) {
}
protected:
// Handle blocks up to 4 blocks 64x64 with stride up to 128
static const int kDataAlignment = 16;
static const int kDataBufferSize = 16 * 32;
static const int kDataBufferSize = 4 * 64 * 128;
virtual void SetUp() {
sad_fn_ = GET_PARAM(2);
height_ = GET_PARAM(1);
width_ = GET_PARAM(0);
source_stride_ = width_ * 2;
source_stride_ = (width_ + 31) & ~31;
reference_stride_ = width_ * 2;
rnd_.Reset(ACMRandom::DeterministicSeed());
}
......@@ -120,7 +126,6 @@ class SADTest : public PARAMS(int, int, sad_m_by_n_fn_t) {
}
}
// Handle blocks up to 16x16 with stride up to 32
int height_, width_;
static uint8_t* source_data_;
int source_stride_;
......@@ -184,17 +189,47 @@ TEST_P(SADTest, MaxSAD) {
using std::tr1::make_tuple;
#if CONFIG_VP8_ENCODER && CONFIG_VP9_ENCODER
#define VP8_VP9_SEPARATOR ,
#else
#define VP8_VP9_SEPARATOR
#endif
#if CONFIG_VP8_ENCODER
const sad_m_by_n_fn_t sad_16x16_c = vp8_sad16x16_c;
const sad_m_by_n_fn_t sad_8x16_c = vp8_sad8x16_c;
const sad_m_by_n_fn_t sad_16x8_c = vp8_sad16x8_c;
const sad_m_by_n_fn_t sad_8x8_c = vp8_sad8x8_c;
const sad_m_by_n_fn_t sad_4x4_c = vp8_sad4x4_c;
#endif
#if CONFIG_VP9_ENCODER
const sad_m_by_n_fn_t sad_64x64_c_vp9 = vp9_sad64x64_c;
const sad_m_by_n_fn_t sad_32x32_c_vp9 = vp9_sad32x32_c;
const sad_m_by_n_fn_t sad_16x16_c_vp9 = vp9_sad16x16_c;
const sad_m_by_n_fn_t sad_8x16_c_vp9 = vp9_sad8x16_c;
const sad_m_by_n_fn_t sad_16x8_c_vp9 = vp9_sad16x8_c;
const sad_m_by_n_fn_t sad_8x8_c_vp9 = vp9_sad8x8_c;
const sad_m_by_n_fn_t sad_4x4_c_vp9 = vp9_sad4x4_c;
#endif
INSTANTIATE_TEST_CASE_P(C, SADTest, ::testing::Values(
#if CONFIG_VP8_ENCODER
make_tuple(16, 16, sad_16x16_c),
make_tuple(8, 16, sad_8x16_c),
make_tuple(16, 8, sad_16x8_c),
make_tuple(8, 8, sad_8x8_c),
make_tuple(4, 4, sad_4x4_c)));
make_tuple(4, 4, sad_4x4_c)
#endif
VP8_VP9_SEPARATOR
#if CONFIG_VP9_ENCODER
make_tuple(64, 64, sad_64x64_c_vp9),
make_tuple(32, 32, sad_32x32_c_vp9),
make_tuple(16, 16, sad_16x16_c_vp9),
make_tuple(8, 16, sad_8x16_c_vp9),
make_tuple(16, 8, sad_16x8_c_vp9),
make_tuple(8, 8, sad_8x8_c_vp9),
make_tuple(4, 4, sad_4x4_c_vp9)
#endif
));
// ARM tests
#if HAVE_MEDIA
......@@ -219,31 +254,84 @@ INSTANTIATE_TEST_CASE_P(NEON, SADTest, ::testing::Values(
// X86 tests
#if HAVE_MMX
#if CONFIG_VP8_ENCODER
const sad_m_by_n_fn_t sad_16x16_mmx = vp8_sad16x16_mmx;
const sad_m_by_n_fn_t sad_8x16_mmx = vp8_sad8x16_mmx;
const sad_m_by_n_fn_t sad_16x8_mmx = vp8_sad16x8_mmx;
const sad_m_by_n_fn_t sad_8x8_mmx = vp8_sad8x8_mmx;
const sad_m_by_n_fn_t sad_4x4_mmx = vp8_sad4x4_mmx;
#endif
#if CONFIG_VP9_ENCODER
const sad_m_by_n_fn_t sad_16x16_mmx_vp9 = vp9_sad16x16_mmx;
const sad_m_by_n_fn_t sad_8x16_mmx_vp9 = vp9_sad8x16_mmx;
const sad_m_by_n_fn_t sad_16x8_mmx_vp9 = vp9_sad16x8_mmx;
const sad_m_by_n_fn_t sad_8x8_mmx_vp9 = vp9_sad8x8_mmx;
const sad_m_by_n_fn_t sad_4x4_mmx_vp9 = vp9_sad4x4_mmx;
#endif
INSTANTIATE_TEST_CASE_P(MMX, SADTest, ::testing::Values(
#if CONFIG_VP8_ENCODER
make_tuple(16, 16, sad_16x16_mmx),
make_tuple(8, 16, sad_8x16_mmx),
make_tuple(16, 8, sad_16x8_mmx),
make_tuple(8, 8, sad_8x8_mmx),
make_tuple(4, 4, sad_4x4_mmx)));
make_tuple(4, 4, sad_4x4_mmx)
#endif
VP8_VP9_SEPARATOR
#if CONFIG_VP9_ENCODER
make_tuple(16, 16, sad_16x16_mmx_vp9),
make_tuple(8, 16, sad_8x16_mmx_vp9),
make_tuple(16, 8, sad_16x8_mmx_vp9),
make_tuple(8, 8, sad_8x8_mmx_vp9),
make_tuple(4, 4, sad_4x4_mmx_vp9)
#endif
));
#endif
#if HAVE_SSE
#if CONFIG_VP9_ENCODER
const sad_m_by_n_fn_t sad_4x4_sse_vp9 = vp9_sad4x4_sse;
INSTANTIATE_TEST_CASE_P(SSE, SADTest, ::testing::Values(
make_tuple(4, 4, sad_4x4_sse_vp9)));
#endif
#endif
#if HAVE_SSE2
#if CONFIG_VP8_ENCODER
const sad_m_by_n_fn_t sad_16x16_wmt = vp8_sad16x16_wmt;
const sad_m_by_n_fn_t sad_8x16_wmt = vp8_sad8x16_wmt;
const sad_m_by_n_fn_t sad_16x8_wmt = vp8_sad16x8_wmt;
const sad_m_by_n_fn_t sad_8x8_wmt = vp8_sad8x8_wmt;
const sad_m_by_n_fn_t sad_4x4_wmt = vp8_sad4x4_wmt;
#endif
#if CONFIG_VP9_ENCODER
const sad_m_by_n_fn_t sad_64x64_sse2_vp9 = vp9_sad64x64_sse2;
const sad_m_by_n_fn_t sad_32x32_sse2_vp9 = vp9_sad32x32_sse2;
const sad_m_by_n_fn_t sad_16x16_sse2_vp9 = vp9_sad16x16_sse2;
const sad_m_by_n_fn_t sad_8x16_sse2_vp9 = vp9_sad8x16_sse2;
const sad_m_by_n_fn_t sad_16x8_sse2_vp9 = vp9_sad16x8_sse2;
const sad_m_by_n_fn_t sad_8x8_sse2_vp9 = vp9_sad8x8_sse2;
#endif
INSTANTIATE_TEST_CASE_P(SSE2, SADTest, ::testing::Values(
#if CONFIG_VP8_ENCODER
make_tuple(16, 16, sad_16x16_wmt),
make_tuple(8, 16, sad_8x16_wmt),
make_tuple(16, 8, sad_16x8_wmt),
make_tuple(8, 8, sad_8x8_wmt),
make_tuple(4, 4, sad_4x4_wmt)));
make_tuple(4, 4, sad_4x4_wmt)
#endif
VP8_VP9_SEPARATOR
#if CONFIG_VP9_ENCODER
make_tuple(64, 64, sad_64x64_sse2_vp9),
make_tuple(32, 32, sad_32x32_sse2_vp9),
make_tuple(16, 16, sad_16x16_sse2_vp9),
make_tuple(8, 16, sad_8x16_sse2_vp9),
make_tuple(16, 8, sad_16x8_sse2_vp9),
make_tuple(8, 8, sad_8x8_sse2_vp9)
#endif
));
#endif
#if HAVE_SSSE3
const sad_m_by_n_fn_t sad_16x16_sse3 = vp8_sad16x16_sse3;
INSTANTIATE_TEST_CASE_P(SSE3, SADTest, ::testing::Values(
......
......@@ -50,7 +50,7 @@ endif
LIBVPX_TEST_SRCS-yes += idctllm_test.cc
LIBVPX_TEST_SRCS-yes += intrapred_test.cc
LIBVPX_TEST_SRCS-$(CONFIG_POSTPROC) += pp_filter_test.cc
LIBVPX_TEST_SRCS-yes += sad_test.cc
LIBVPX_TEST_SRCS-$(CONFIG_ENCODERS) += sad_test.cc
LIBVPX_TEST_SRCS-$(CONFIG_VP8_ENCODER) += set_roi.cc
LIBVPX_TEST_SRCS-yes += sixtap_predict_test.cc
LIBVPX_TEST_SRCS-$(CONFIG_VP8_ENCODER) += subtract_test.cc
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment