Merge "Clean convolve_test.cc"

This commit is contained in:
Linfeng Zhang 2016-09-28 00:20:27 +00:00 committed by Gerrit Code Review
commit 240726ac85

View File

@ -12,8 +12,8 @@
#include "third_party/googletest/src/include/gtest/gtest.h"
#include "./vpx_config.h"
#include "./vp9_rtcd.h"
#include "./vpx_config.h"
#include "./vpx_dsp_rtcd.h"
#include "test/acm_random.h"
#include "test/clear_system_state.h"
@ -36,6 +36,12 @@ typedef void (*ConvolveFunc)(const uint8_t *src, ptrdiff_t src_stride,
const int16_t *filter_y, int filter_y_stride,
int w, int h);
typedef void (*WrapperFilterBlock2d8Func)(
const uint8_t *src_ptr, const unsigned int src_stride,
const int16_t *hfilter, const int16_t *vfilter, uint8_t *dst_ptr,
unsigned int dst_stride, unsigned int output_width,
unsigned int output_height, int use_highbd);
struct ConvolveFunctions {
ConvolveFunctions(ConvolveFunc copy, ConvolveFunc avg, ConvolveFunc h8,
ConvolveFunc h8_avg, ConvolveFunc v8, ConvolveFunc v8_avg,
@ -43,25 +49,30 @@ struct ConvolveFunctions {
ConvolveFunc sh8_avg, ConvolveFunc sv8,
ConvolveFunc sv8_avg, ConvolveFunc shv8,
ConvolveFunc shv8_avg, int bd)
: copy_(copy), avg_(avg), h8_(h8), v8_(v8), hv8_(hv8), h8_avg_(h8_avg),
v8_avg_(v8_avg), hv8_avg_(hv8_avg), sh8_(sh8), sv8_(sv8), shv8_(shv8),
sh8_avg_(sh8_avg), sv8_avg_(sv8_avg), shv8_avg_(shv8_avg),
use_highbd_(bd) {}
: use_highbd_(bd) {
copy_[0] = copy;
copy_[1] = avg;
h8_[0] = h8;
h8_[1] = h8_avg;
v8_[0] = v8;
v8_[1] = v8_avg;
hv8_[0] = hv8;
hv8_[1] = hv8_avg;
sh8_[0] = sh8;
sh8_[1] = sh8_avg;
sv8_[0] = sv8;
sv8_[1] = sv8_avg;
shv8_[0] = shv8;
shv8_[1] = shv8_avg;
}
ConvolveFunc copy_;
ConvolveFunc avg_;
ConvolveFunc h8_;
ConvolveFunc v8_;
ConvolveFunc hv8_;
ConvolveFunc h8_avg_;
ConvolveFunc v8_avg_;
ConvolveFunc hv8_avg_;
ConvolveFunc sh8_; // scaled horiz
ConvolveFunc sv8_; // scaled vert
ConvolveFunc shv8_; // scaled horiz/vert
ConvolveFunc sh8_avg_; // scaled avg horiz
ConvolveFunc sv8_avg_; // scaled avg vert
ConvolveFunc shv8_avg_; // scaled avg horiz/vert
ConvolveFunc copy_[2];
ConvolveFunc h8_[2];
ConvolveFunc v8_[2];
ConvolveFunc hv8_[2];
ConvolveFunc sh8_[2]; // scaled horiz
ConvolveFunc sv8_[2]; // scaled vert
ConvolveFunc shv8_[2]; // scaled horiz/vert
int use_highbd_; // 0 if high bitdepth not used, else the actual bit depth.
};
@ -82,7 +93,7 @@ typedef std::tr1::tuple<int, int, const ConvolveFunctions *> ConvolveParam;
uint8_t clip_pixel(int x) { return x < 0 ? 0 : x > 255 ? 255 : x; }
void filter_block2d_8_c(const uint8_t *src_ptr, const unsigned int src_stride,
const int16_t *HFilter, const int16_t *VFilter,
const int16_t *hfilter, const int16_t *vfilter,
uint8_t *dst_ptr, unsigned int dst_stride,
unsigned int output_width, unsigned int output_height) {
// Between passes, we use an intermediate buffer whose height is extended to
@ -112,10 +123,10 @@ void filter_block2d_8_c(const uint8_t *src_ptr, const unsigned int src_stride,
for (i = 0; i < intermediate_height; ++i) {
for (j = 0; j < output_width; ++j) {
// Apply filter...
const int temp = (src_ptr[0] * HFilter[0]) + (src_ptr[1] * HFilter[1]) +
(src_ptr[2] * HFilter[2]) + (src_ptr[3] * HFilter[3]) +
(src_ptr[4] * HFilter[4]) + (src_ptr[5] * HFilter[5]) +
(src_ptr[6] * HFilter[6]) + (src_ptr[7] * HFilter[7]) +
const int temp = (src_ptr[0] * hfilter[0]) + (src_ptr[1] * hfilter[1]) +
(src_ptr[2] * hfilter[2]) + (src_ptr[3] * hfilter[3]) +
(src_ptr[4] * hfilter[4]) + (src_ptr[5] * hfilter[5]) +
(src_ptr[6] * hfilter[6]) + (src_ptr[7] * hfilter[7]) +
(VP9_FILTER_WEIGHT >> 1); // Rounding
// Normalize back to 0-255...
@ -133,10 +144,10 @@ void filter_block2d_8_c(const uint8_t *src_ptr, const unsigned int src_stride,
for (i = 0; i < output_height; ++i) {
for (j = 0; j < output_width; ++j) {
// Apply filter...
const int temp = (src_ptr[0] * VFilter[0]) + (src_ptr[1] * VFilter[1]) +
(src_ptr[2] * VFilter[2]) + (src_ptr[3] * VFilter[3]) +
(src_ptr[4] * VFilter[4]) + (src_ptr[5] * VFilter[5]) +
(src_ptr[6] * VFilter[6]) + (src_ptr[7] * VFilter[7]) +
const int temp = (src_ptr[0] * vfilter[0]) + (src_ptr[1] * vfilter[1]) +
(src_ptr[2] * vfilter[2]) + (src_ptr[3] * vfilter[3]) +
(src_ptr[4] * vfilter[4]) + (src_ptr[5] * vfilter[5]) +
(src_ptr[6] * vfilter[6]) + (src_ptr[7] * vfilter[7]) +
(VP9_FILTER_WEIGHT >> 1); // Rounding
// Normalize back to 0-255...
@ -162,7 +173,7 @@ void block2d_average_c(uint8_t *src, unsigned int src_stride,
void filter_average_block2d_8_c(const uint8_t *src_ptr,
const unsigned int src_stride,
const int16_t *HFilter, const int16_t *VFilter,
const int16_t *hfilter, const int16_t *vfilter,
uint8_t *dst_ptr, unsigned int dst_stride,
unsigned int output_width,
unsigned int output_height) {
@ -170,7 +181,7 @@ void filter_average_block2d_8_c(const uint8_t *src_ptr,
assert(output_width <= kMaxDimension);
assert(output_height <= kMaxDimension);
filter_block2d_8_c(src_ptr, src_stride, HFilter, VFilter, tmp, 64,
filter_block2d_8_c(src_ptr, src_stride, hfilter, vfilter, tmp, 64,
output_width, output_height);
block2d_average_c(tmp, 64, dst_ptr, dst_stride, output_width, output_height);
}
@ -178,7 +189,7 @@ void filter_average_block2d_8_c(const uint8_t *src_ptr,
#if CONFIG_VP9_HIGHBITDEPTH
void highbd_filter_block2d_8_c(const uint16_t *src_ptr,
const unsigned int src_stride,
const int16_t *HFilter, const int16_t *VFilter,
const int16_t *hfilter, const int16_t *vfilter,
uint16_t *dst_ptr, unsigned int dst_stride,
unsigned int output_width,
unsigned int output_height, int bd) {
@ -210,10 +221,10 @@ void highbd_filter_block2d_8_c(const uint16_t *src_ptr,
for (i = 0; i < intermediate_height; ++i) {
for (j = 0; j < output_width; ++j) {
// Apply filter...
const int temp = (src_ptr[0] * HFilter[0]) + (src_ptr[1] * HFilter[1]) +
(src_ptr[2] * HFilter[2]) + (src_ptr[3] * HFilter[3]) +
(src_ptr[4] * HFilter[4]) + (src_ptr[5] * HFilter[5]) +
(src_ptr[6] * HFilter[6]) + (src_ptr[7] * HFilter[7]) +
const int temp = (src_ptr[0] * hfilter[0]) + (src_ptr[1] * hfilter[1]) +
(src_ptr[2] * hfilter[2]) + (src_ptr[3] * hfilter[3]) +
(src_ptr[4] * hfilter[4]) + (src_ptr[5] * hfilter[5]) +
(src_ptr[6] * hfilter[6]) + (src_ptr[7] * hfilter[7]) +
(VP9_FILTER_WEIGHT >> 1); // Rounding
// Normalize back to 0-255...
@ -234,10 +245,10 @@ void highbd_filter_block2d_8_c(const uint16_t *src_ptr,
for (i = 0; i < output_height; ++i) {
for (j = 0; j < output_width; ++j) {
// Apply filter...
const int temp = (src_ptr[0] * VFilter[0]) + (src_ptr[1] * VFilter[1]) +
(src_ptr[2] * VFilter[2]) + (src_ptr[3] * VFilter[3]) +
(src_ptr[4] * VFilter[4]) + (src_ptr[5] * VFilter[5]) +
(src_ptr[6] * VFilter[6]) + (src_ptr[7] * VFilter[7]) +
const int temp = (src_ptr[0] * vfilter[0]) + (src_ptr[1] * vfilter[1]) +
(src_ptr[2] * vfilter[2]) + (src_ptr[3] * vfilter[3]) +
(src_ptr[4] * vfilter[4]) + (src_ptr[5] * vfilter[5]) +
(src_ptr[6] * vfilter[6]) + (src_ptr[7] * vfilter[7]) +
(VP9_FILTER_WEIGHT >> 1); // Rounding
// Normalize back to 0-255...
@ -265,20 +276,64 @@ void highbd_block2d_average_c(uint16_t *src, unsigned int src_stride,
void highbd_filter_average_block2d_8_c(
const uint16_t *src_ptr, const unsigned int src_stride,
const int16_t *HFilter, const int16_t *VFilter, uint16_t *dst_ptr,
const int16_t *hfilter, const int16_t *vfilter, uint16_t *dst_ptr,
unsigned int dst_stride, unsigned int output_width,
unsigned int output_height, int bd) {
uint16_t tmp[kMaxDimension * kMaxDimension];
assert(output_width <= kMaxDimension);
assert(output_height <= kMaxDimension);
highbd_filter_block2d_8_c(src_ptr, src_stride, HFilter, VFilter, tmp, 64,
highbd_filter_block2d_8_c(src_ptr, src_stride, hfilter, vfilter, tmp, 64,
output_width, output_height, bd);
highbd_block2d_average_c(tmp, 64, dst_ptr, dst_stride, output_width,
output_height);
}
#endif // CONFIG_VP9_HIGHBITDEPTH
void wrapper_filter_average_block2d_8_c(
const uint8_t *src_ptr, const unsigned int src_stride,
const int16_t *hfilter, const int16_t *vfilter, uint8_t *dst_ptr,
unsigned int dst_stride, unsigned int output_width,
unsigned int output_height, int use_highbd) {
#if CONFIG_VP9_HIGHBITDEPTH
if (use_highbd == 0) {
filter_average_block2d_8_c(src_ptr, src_stride, hfilter, vfilter, dst_ptr,
dst_stride, output_width, output_height);
} else {
highbd_filter_average_block2d_8_c(CONVERT_TO_SHORTPTR(src_ptr), src_stride,
hfilter, vfilter,
CONVERT_TO_SHORTPTR(dst_ptr), dst_stride,
output_width, output_height, use_highbd);
}
#else
ASSERT_EQ(0, use_highbd);
filter_average_block2d_8_c(src_ptr, src_stride, hfilter, vfilter, dst_ptr,
dst_stride, output_width, output_height);
#endif
}
void wrapper_filter_block2d_8_c(const uint8_t *src_ptr,
const unsigned int src_stride,
const int16_t *hfilter, const int16_t *vfilter,
uint8_t *dst_ptr, unsigned int dst_stride,
unsigned int output_width,
unsigned int output_height, int use_highbd) {
#if CONFIG_VP9_HIGHBITDEPTH
if (use_highbd == 0) {
filter_block2d_8_c(src_ptr, src_stride, hfilter, vfilter, dst_ptr,
dst_stride, output_width, output_height);
} else {
highbd_filter_block2d_8_c(CONVERT_TO_SHORTPTR(src_ptr), src_stride, hfilter,
vfilter, CONVERT_TO_SHORTPTR(dst_ptr), dst_stride,
output_width, output_height, use_highbd);
}
#else
ASSERT_EQ(0, use_highbd);
filter_block2d_8_c(src_ptr, src_stride, hfilter, vfilter, dst_ptr, dst_stride,
output_width, output_height);
#endif
}
class ConvolveTest : public ::testing::TestWithParam<ConvolveParam> {
public:
static void SetUpTestCase() {
@ -461,50 +516,6 @@ class ConvolveTest : public ::testing::TestWithParam<ConvolveParam> {
#endif
}
void wrapper_filter_average_block2d_8_c(
const uint8_t *src_ptr, const unsigned int src_stride,
const int16_t *HFilter, const int16_t *VFilter, uint8_t *dst_ptr,
unsigned int dst_stride, unsigned int output_width,
unsigned int output_height) {
#if CONFIG_VP9_HIGHBITDEPTH
if (UUT_->use_highbd_ == 0) {
filter_average_block2d_8_c(src_ptr, src_stride, HFilter, VFilter, dst_ptr,
dst_stride, output_width, output_height);
} else {
highbd_filter_average_block2d_8_c(
CONVERT_TO_SHORTPTR(src_ptr), src_stride, HFilter, VFilter,
CONVERT_TO_SHORTPTR(dst_ptr), dst_stride, output_width, output_height,
UUT_->use_highbd_);
}
#else
filter_average_block2d_8_c(src_ptr, src_stride, HFilter, VFilter, dst_ptr,
dst_stride, output_width, output_height);
#endif
}
void wrapper_filter_block2d_8_c(const uint8_t *src_ptr,
const unsigned int src_stride,
const int16_t *HFilter,
const int16_t *VFilter, uint8_t *dst_ptr,
unsigned int dst_stride,
unsigned int output_width,
unsigned int output_height) {
#if CONFIG_VP9_HIGHBITDEPTH
if (UUT_->use_highbd_ == 0) {
filter_block2d_8_c(src_ptr, src_stride, HFilter, VFilter, dst_ptr,
dst_stride, output_width, output_height);
} else {
highbd_filter_block2d_8_c(CONVERT_TO_SHORTPTR(src_ptr), src_stride,
HFilter, VFilter, CONVERT_TO_SHORTPTR(dst_ptr),
dst_stride, output_width, output_height,
UUT_->use_highbd_);
}
#else
filter_block2d_8_c(src_ptr, src_stride, HFilter, VFilter, dst_ptr,
dst_stride, output_width, output_height);
#endif
}
const ConvolveFunctions *UUT_;
static uint8_t *input_;
static uint8_t *output_;
@ -532,8 +543,8 @@ TEST_P(ConvolveTest, Copy) {
uint8_t *const in = input();
uint8_t *const out = output();
ASM_REGISTER_STATE_CHECK(UUT_->copy_(in, kInputStride, out, kOutputStride,
NULL, 0, NULL, 0, Width(), Height()));
ASM_REGISTER_STATE_CHECK(UUT_->copy_[0](in, kInputStride, out, kOutputStride,
NULL, 0, NULL, 0, Width(), Height()));
CheckGuardBlocks();
@ -551,8 +562,8 @@ TEST_P(ConvolveTest, Avg) {
uint8_t *const out_ref = output_ref();
CopyOutputToRef();
ASM_REGISTER_STATE_CHECK(UUT_->avg_(in, kInputStride, out, kOutputStride,
NULL, 0, NULL, 0, Width(), Height()));
ASM_REGISTER_STATE_CHECK(UUT_->copy_[1](in, kInputStride, out, kOutputStride,
NULL, 0, NULL, 0, Width(), Height()));
CheckGuardBlocks();
@ -572,9 +583,9 @@ TEST_P(ConvolveTest, CopyHoriz) {
DECLARE_ALIGNED(256, const int16_t,
filter8[8]) = { 0, 0, 0, 128, 0, 0, 0, 0 };
ASM_REGISTER_STATE_CHECK(UUT_->sh8_(in, kInputStride, out, kOutputStride,
filter8, 16, filter8, 16, Width(),
Height()));
ASM_REGISTER_STATE_CHECK(UUT_->sh8_[0](in, kInputStride, out, kOutputStride,
filter8, 16, filter8, 16, Width(),
Height()));
CheckGuardBlocks();
@ -592,9 +603,9 @@ TEST_P(ConvolveTest, CopyVert) {
DECLARE_ALIGNED(256, const int16_t,
filter8[8]) = { 0, 0, 0, 128, 0, 0, 0, 0 };
ASM_REGISTER_STATE_CHECK(UUT_->sv8_(in, kInputStride, out, kOutputStride,
filter8, 16, filter8, 16, Width(),
Height()));
ASM_REGISTER_STATE_CHECK(UUT_->sv8_[0](in, kInputStride, out, kOutputStride,
filter8, 16, filter8, 16, Width(),
Height()));
CheckGuardBlocks();
@ -612,9 +623,9 @@ TEST_P(ConvolveTest, Copy2D) {
DECLARE_ALIGNED(256, const int16_t,
filter8[8]) = { 0, 0, 0, 128, 0, 0, 0, 0 };
ASM_REGISTER_STATE_CHECK(UUT_->shv8_(in, kInputStride, out, kOutputStride,
filter8, 16, filter8, 16, Width(),
Height()));
ASM_REGISTER_STATE_CHECK(UUT_->shv8_[0](in, kInputStride, out, kOutputStride,
filter8, 16, filter8, 16, Width(),
Height()));
CheckGuardBlocks();
@ -651,137 +662,84 @@ TEST(ConvolveTest, FiltersWontSaturateWhenAddedPairwise) {
}
const int16_t kInvalidFilter[8] = { 0 };
static const WrapperFilterBlock2d8Func wrapper_filter_block2d_8[2] = {
wrapper_filter_block2d_8_c, wrapper_filter_average_block2d_8_c
};
TEST_P(ConvolveTest, MatchesReferenceSubpixelFilter) {
uint8_t *const in = input();
uint8_t *const out = output();
for (int i = 0; i < 2; ++i) {
uint8_t *const in = input();
uint8_t *const out = output();
#if CONFIG_VP9_HIGHBITDEPTH
uint8_t ref8[kOutputStride * kMaxDimension];
uint16_t ref16[kOutputStride * kMaxDimension];
uint8_t *ref;
if (UUT_->use_highbd_ == 0) {
ref = ref8;
} else {
ref = CONVERT_TO_BYTEPTR(ref16);
}
uint8_t ref8[kOutputStride * kMaxDimension];
uint16_t ref16[kOutputStride * kMaxDimension];
uint8_t *ref;
if (UUT_->use_highbd_ == 0) {
ref = ref8;
} else {
ref = CONVERT_TO_BYTEPTR(ref16);
}
#else
uint8_t ref[kOutputStride * kMaxDimension];
uint8_t ref[kOutputStride * kMaxDimension];
#endif
for (int filter_bank = 0; filter_bank < kNumFilterBanks; ++filter_bank) {
const InterpKernel *filters =
vp9_filter_kernels[static_cast<INTERP_FILTER>(filter_bank)];
for (int filter_x = 0; filter_x < kNumFilters; ++filter_x) {
for (int filter_y = 0; filter_y < kNumFilters; ++filter_y) {
wrapper_filter_block2d_8_c(in, kInputStride, filters[filter_x],
filters[filter_y], ref, kOutputStride,
Width(), Height());
if (filter_x && filter_y)
ASM_REGISTER_STATE_CHECK(UUT_->hv8_(
in, kInputStride, out, kOutputStride, filters[filter_x], 16,
filters[filter_y], 16, Width(), Height()));
else if (filter_y)
ASM_REGISTER_STATE_CHECK(
UUT_->v8_(in, kInputStride, out, kOutputStride, kInvalidFilter,
16, filters[filter_y], 16, Width(), Height()));
else if (filter_x)
ASM_REGISTER_STATE_CHECK(
UUT_->h8_(in, kInputStride, out, kOutputStride, filters[filter_x],
16, kInvalidFilter, 16, Width(), Height()));
else
ASM_REGISTER_STATE_CHECK(
UUT_->copy_(in, kInputStride, out, kOutputStride, kInvalidFilter,
0, kInvalidFilter, 0, Width(), Height()));
CheckGuardBlocks();
for (int y = 0; y < Height(); ++y) {
for (int x = 0; x < Width(); ++x)
ASSERT_EQ(lookup(ref, y * kOutputStride + x),
lookup(out, y * kOutputStride + x))
<< "mismatch at (" << x << "," << y << "), "
<< "filters (" << filter_bank << "," << filter_x << ","
<< filter_y << ")";
// Populate ref and out with some random data
::libvpx_test::ACMRandom prng;
for (int y = 0; y < Height(); ++y) {
for (int x = 0; x < Width(); ++x) {
uint16_t r;
#if CONFIG_VP9_HIGHBITDEPTH
if (UUT_->use_highbd_ == 0 || UUT_->use_highbd_ == 8) {
r = prng.Rand8Extremes();
} else {
r = prng.Rand16() & mask_;
}
}
}
}
}
TEST_P(ConvolveTest, MatchesReferenceAveragingSubpixelFilter) {
uint8_t *const in = input();
uint8_t *const out = output();
#if CONFIG_VP9_HIGHBITDEPTH
uint8_t ref8[kOutputStride * kMaxDimension];
uint16_t ref16[kOutputStride * kMaxDimension];
uint8_t *ref;
if (UUT_->use_highbd_ == 0) {
ref = ref8;
} else {
ref = CONVERT_TO_BYTEPTR(ref16);
}
#else
uint8_t ref[kOutputStride * kMaxDimension];
#endif
// Populate ref and out with some random data
::libvpx_test::ACMRandom prng;
for (int y = 0; y < Height(); ++y) {
for (int x = 0; x < Width(); ++x) {
uint16_t r;
#if CONFIG_VP9_HIGHBITDEPTH
if (UUT_->use_highbd_ == 0 || UUT_->use_highbd_ == 8) {
r = prng.Rand8Extremes();
} else {
r = prng.Rand16() & mask_;
}
#else
r = prng.Rand8Extremes();
#endif
assign_val(out, y * kOutputStride + x, r);
assign_val(ref, y * kOutputStride + x, r);
assign_val(out, y * kOutputStride + x, r);
assign_val(ref, y * kOutputStride + x, r);
}
}
}
for (int filter_bank = 0; filter_bank < kNumFilterBanks; ++filter_bank) {
const InterpKernel *filters =
vp9_filter_kernels[static_cast<INTERP_FILTER>(filter_bank)];
for (int filter_bank = 0; filter_bank < kNumFilterBanks; ++filter_bank) {
const InterpKernel *filters =
vp9_filter_kernels[static_cast<INTERP_FILTER>(filter_bank)];
for (int filter_x = 0; filter_x < kNumFilters; ++filter_x) {
for (int filter_y = 0; filter_y < kNumFilters; ++filter_y) {
wrapper_filter_average_block2d_8_c(in, kInputStride, filters[filter_x],
filters[filter_y], ref,
kOutputStride, Width(), Height());
for (int filter_x = 0; filter_x < kNumFilters; ++filter_x) {
for (int filter_y = 0; filter_y < kNumFilters; ++filter_y) {
wrapper_filter_block2d_8[i](in, kInputStride, filters[filter_x],
filters[filter_y], ref, kOutputStride,
Width(), Height(), UUT_->use_highbd_);
if (filter_x && filter_y)
ASM_REGISTER_STATE_CHECK(UUT_->hv8_avg_(
in, kInputStride, out, kOutputStride, filters[filter_x], 16,
filters[filter_y], 16, Width(), Height()));
else if (filter_y)
ASM_REGISTER_STATE_CHECK(UUT_->v8_avg_(
in, kInputStride, out, kOutputStride, kInvalidFilter, 16,
filters[filter_y], 16, Width(), Height()));
else if (filter_x)
ASM_REGISTER_STATE_CHECK(UUT_->h8_avg_(
in, kInputStride, out, kOutputStride, filters[filter_x], 16,
kInvalidFilter, 16, Width(), Height()));
else
ASM_REGISTER_STATE_CHECK(
UUT_->avg_(in, kInputStride, out, kOutputStride, kInvalidFilter,
0, kInvalidFilter, 0, Width(), Height()));
if (filter_x && filter_y)
ASM_REGISTER_STATE_CHECK(UUT_->hv8_[i](
in, kInputStride, out, kOutputStride, filters[filter_x], 16,
filters[filter_y], 16, Width(), Height()));
else if (filter_y)
ASM_REGISTER_STATE_CHECK(UUT_->v8_[i](
in, kInputStride, out, kOutputStride, kInvalidFilter, 16,
filters[filter_y], 16, Width(), Height()));
else if (filter_x)
ASM_REGISTER_STATE_CHECK(UUT_->h8_[i](
in, kInputStride, out, kOutputStride, filters[filter_x], 16,
kInvalidFilter, 16, Width(), Height()));
else
ASM_REGISTER_STATE_CHECK(UUT_->copy_[i](
in, kInputStride, out, kOutputStride, kInvalidFilter, 0,
kInvalidFilter, 0, Width(), Height()));
CheckGuardBlocks();
CheckGuardBlocks();
for (int y = 0; y < Height(); ++y) {
for (int x = 0; x < Width(); ++x)
ASSERT_EQ(lookup(ref, y * kOutputStride + x),
lookup(out, y * kOutputStride + x))
<< "mismatch at (" << x << "," << y << "), "
<< "filters (" << filter_bank << "," << filter_x << ","
<< filter_y << ")";
for (int y = 0; y < Height(); ++y) {
for (int x = 0; x < Width(); ++x)
ASSERT_EQ(lookup(ref, y * kOutputStride + x),
lookup(out, y * kOutputStride + x))
<< "mismatch at (" << x << "," << y << "), "
<< "filters (" << filter_bank << "," << filter_x << ","
<< filter_y << ")";
}
}
}
}
@ -852,21 +810,21 @@ TEST_P(ConvolveTest, FilterExtremes) {
for (int filter_y = 0; filter_y < kNumFilters; ++filter_y) {
wrapper_filter_block2d_8_c(in, kInputStride, filters[filter_x],
filters[filter_y], ref, kOutputStride,
Width(), Height());
Width(), Height(), UUT_->use_highbd_);
if (filter_x && filter_y)
ASM_REGISTER_STATE_CHECK(UUT_->hv8_(
ASM_REGISTER_STATE_CHECK(UUT_->hv8_[0](
in, kInputStride, out, kOutputStride, filters[filter_x], 16,
filters[filter_y], 16, Width(), Height()));
else if (filter_y)
ASM_REGISTER_STATE_CHECK(UUT_->v8_(
ASM_REGISTER_STATE_CHECK(UUT_->v8_[0](
in, kInputStride, out, kOutputStride, kInvalidFilter, 16,
filters[filter_y], 16, Width(), Height()));
else if (filter_x)
ASM_REGISTER_STATE_CHECK(UUT_->h8_(
ASM_REGISTER_STATE_CHECK(UUT_->h8_[0](
in, kInputStride, out, kOutputStride, filters[filter_x], 16,
kInvalidFilter, 16, Width(), Height()));
else
ASM_REGISTER_STATE_CHECK(UUT_->copy_(
ASM_REGISTER_STATE_CHECK(UUT_->copy_[0](
in, kInputStride, out, kOutputStride, kInvalidFilter, 0,
kInvalidFilter, 0, Width(), Height()));
@ -897,9 +855,9 @@ TEST_P(ConvolveTest, CheckScalingFiltering) {
for (int frac = 0; frac < 16; ++frac) {
for (int step = 1; step <= 32; ++step) {
/* Test the horizontal and vertical filters in combination. */
ASM_REGISTER_STATE_CHECK(UUT_->shv8_(in, kInputStride, out, kOutputStride,
eighttap[frac], step, eighttap[frac],
step, Width(), Height()));
ASM_REGISTER_STATE_CHECK(
UUT_->shv8_[0](in, kInputStride, out, kOutputStride, eighttap[frac],
step, eighttap[frac], step, Width(), Height()));
CheckGuardBlocks();
@ -1085,21 +1043,12 @@ INSTANTIATE_TEST_CASE_P(AVX2, ConvolveTest,
#endif // HAVE_AVX2 && HAVE_SSSE3
#if HAVE_NEON
#if HAVE_NEON_ASM
const ConvolveFunctions convolve8_neon(
vpx_convolve_copy_neon, vpx_convolve_avg_neon, vpx_convolve8_horiz_neon,
vpx_convolve8_avg_horiz_neon, vpx_convolve8_vert_neon,
vpx_convolve8_avg_vert_neon, vpx_convolve8_neon, vpx_convolve8_avg_neon,
vpx_scaled_horiz_c, vpx_scaled_avg_horiz_c, vpx_scaled_vert_c,
vpx_scaled_avg_vert_c, vpx_scaled_2d_c, vpx_scaled_avg_2d_c, 0);
#else // HAVE_NEON
const ConvolveFunctions convolve8_neon(
vpx_convolve_copy_neon, vpx_convolve_avg_neon, vpx_convolve8_horiz_neon,
vpx_convolve8_avg_horiz_neon, vpx_convolve8_vert_neon,
vpx_convolve8_avg_vert_neon, vpx_convolve8_neon, vpx_convolve8_avg_neon,
vpx_scaled_horiz_c, vpx_scaled_avg_horiz_c, vpx_scaled_vert_c,
vpx_scaled_avg_vert_c, vpx_scaled_2d_c, vpx_scaled_avg_2d_c, 0);
#endif // HAVE_NEON_ASM
const ConvolveParam kArrayConvolve8_neon[] = { ALL_SIZES(convolve8_neon) };
INSTANTIATE_TEST_CASE_P(NEON, ConvolveTest,