Improve unit tests for CDEF
Add boundary testing for both dering and CLPF. Also add a CDEF prefix to make it easy to select all CDEF tests. Change-Id: Icd4fa4d778889cff1fd4a4e01c2b901703a431d3
This commit is contained in:
Родитель
bab3d6ac28
Коммит
f8abdb031f
|
@ -17,6 +17,7 @@
|
|||
#include "./aom_config.h"
|
||||
#include "./av1_rtcd.h"
|
||||
#include "aom_ports/aom_timer.h"
|
||||
#include "av1/common/od_dering.h"
|
||||
#include "test/acm_random.h"
|
||||
#include "test/clear_system_state.h"
|
||||
#include "test/register_state_check.h"
|
||||
|
@ -33,9 +34,9 @@ typedef void (*clpf_block_t)(uint8_t *dst, const uint16_t *src, int dstride,
|
|||
typedef std::tr1::tuple<clpf_block_t, clpf_block_t, int, int>
|
||||
clpf_block_param_t;
|
||||
|
||||
class ClpfBlockTest : public ::testing::TestWithParam<clpf_block_param_t> {
|
||||
class CDEFClpfBlockTest : public ::testing::TestWithParam<clpf_block_param_t> {
|
||||
public:
|
||||
virtual ~ClpfBlockTest() {}
|
||||
virtual ~CDEFClpfBlockTest() {}
|
||||
virtual void SetUp() {
|
||||
clpf = GET_PARAM(0);
|
||||
ref_clpf = GET_PARAM(1);
|
||||
|
@ -52,7 +53,7 @@ class ClpfBlockTest : public ::testing::TestWithParam<clpf_block_param_t> {
|
|||
clpf_block_t ref_clpf;
|
||||
};
|
||||
|
||||
typedef ClpfBlockTest ClpfSpeedTest;
|
||||
typedef CDEFClpfBlockTest CDEFClpfSpeedTest;
|
||||
|
||||
#if CONFIG_AOM_HIGHBITDEPTH
|
||||
typedef void (*clpf_block_hbd_t)(uint16_t *dst, const uint16_t *src,
|
||||
|
@ -62,10 +63,10 @@ typedef void (*clpf_block_hbd_t)(uint16_t *dst, const uint16_t *src,
|
|||
typedef std::tr1::tuple<clpf_block_hbd_t, clpf_block_hbd_t, int, int>
|
||||
clpf_block_hbd_param_t;
|
||||
|
||||
class ClpfBlockHbdTest
|
||||
class CDEFClpfBlockHbdTest
|
||||
: public ::testing::TestWithParam<clpf_block_hbd_param_t> {
|
||||
public:
|
||||
virtual ~ClpfBlockHbdTest() {}
|
||||
virtual ~CDEFClpfBlockHbdTest() {}
|
||||
virtual void SetUp() {
|
||||
clpf = GET_PARAM(0);
|
||||
ref_clpf = GET_PARAM(1);
|
||||
|
@ -82,7 +83,7 @@ class ClpfBlockHbdTest
|
|||
clpf_block_hbd_t ref_clpf;
|
||||
};
|
||||
|
||||
typedef ClpfBlockHbdTest ClpfHbdSpeedTest;
|
||||
typedef CDEFClpfBlockHbdTest ClpfHbdSpeedTest;
|
||||
#endif
|
||||
|
||||
template <typename pixel>
|
||||
|
@ -102,7 +103,7 @@ void test_clpf(int w, int h, int depth, int iterations,
|
|||
memset(d, 0, size * size * sizeof(*d));
|
||||
|
||||
int error = 0, pos = 0, strength = 0, xpos = 8, ypos = 8;
|
||||
int bits, level, count, damp = 0;
|
||||
int bits, level, count, damp = 0, boundary = 0;
|
||||
|
||||
assert(size >= w + 16 && size >= h + 16);
|
||||
|
||||
|
@ -111,26 +112,53 @@ void test_clpf(int w, int h, int depth, int iterations,
|
|||
// * Noise level around every value from 0 to (1<<depth)-1
|
||||
// * All strengths
|
||||
// * All dampings
|
||||
// * Boundaries
|
||||
// If clpf and ref_clpf are the same, we're just testing speed
|
||||
for (count = 0; count < iterations; count++) {
|
||||
for (level = 0; level < (1 << depth) && !error; level++) {
|
||||
for (bits = 1; bits <= depth && !error; bits++) {
|
||||
for (damp = 4; damp < depth - 1 && !error; damp++) {
|
||||
for (int i = 0; i < size * size; i++)
|
||||
s[i] = clamp((rnd.Rand16() & ((1 << bits) - 1)) + level, 0,
|
||||
(1 << depth) - 1);
|
||||
for (strength = depth - 8; strength < depth - 5 && !error;
|
||||
strength += !error) {
|
||||
ref_clpf(ref_d + ypos * size + xpos, s + ypos * size + xpos, size,
|
||||
size, w, h, 1 << strength, damp);
|
||||
if (clpf != ref_clpf)
|
||||
ASM_REGISTER_STATE_CHECK(clpf(d + ypos * size + xpos,
|
||||
s + ypos * size + xpos, size, size,
|
||||
w, h, 1 << strength, damp));
|
||||
if (ref_clpf != clpf)
|
||||
for (pos = 0; pos < size * size && !error; pos++) {
|
||||
error = ref_d[pos] != d[pos];
|
||||
for (boundary = 0; boundary < 16; boundary++) {
|
||||
for (count = 0; count < iterations; count++) {
|
||||
for (level = 0; level < (1 << depth) && !error;
|
||||
level += (1 + 4 * !!boundary) << (depth - 8)) {
|
||||
for (bits = 1; bits <= depth && !error; bits++) {
|
||||
for (damp = 4; damp < depth - 1 && !error; damp++) {
|
||||
for (int i = 0; i < size * size; i++)
|
||||
s[i] = clamp((rnd.Rand16() & ((1 << bits) - 1)) + level, 0,
|
||||
(1 << depth) - 1);
|
||||
if (boundary) {
|
||||
if (boundary & 1) { // Left
|
||||
for (int i = 0; i < size; i++)
|
||||
for (int j = 0; j < xpos; j++)
|
||||
s[i * size + j] = OD_DERING_VERY_LARGE;
|
||||
}
|
||||
if (boundary & 2) { // Right
|
||||
for (int i = 0; i < size; i++)
|
||||
for (int j = xpos + w; j < size; j++)
|
||||
s[i * size + j] = OD_DERING_VERY_LARGE;
|
||||
}
|
||||
if (boundary & 4) { // Above
|
||||
for (int i = 0; i < ypos; i++)
|
||||
for (int j = 0; j < size; j++)
|
||||
s[i * size + j] = OD_DERING_VERY_LARGE;
|
||||
}
|
||||
if (boundary & 8) { // Below
|
||||
for (int i = ypos + h; i < size; i++)
|
||||
for (int j = 0; j < size; j++)
|
||||
s[i * size + j] = OD_DERING_VERY_LARGE;
|
||||
}
|
||||
}
|
||||
for (strength = depth - 8; strength < depth - 5 && !error;
|
||||
strength += !error) {
|
||||
ref_clpf(ref_d + ypos * size + xpos, s + ypos * size + xpos, size,
|
||||
size, w, h, 1 << strength, damp);
|
||||
if (clpf != ref_clpf)
|
||||
ASM_REGISTER_STATE_CHECK(clpf(d + ypos * size + xpos,
|
||||
s + ypos * size + xpos, size,
|
||||
size, w, h, 1 << strength, damp));
|
||||
if (ref_clpf != clpf) {
|
||||
for (pos = 0; pos < size * size && !error; pos++) {
|
||||
error = ref_d[pos] != d[pos];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -139,11 +167,13 @@ void test_clpf(int w, int h, int depth, int iterations,
|
|||
|
||||
pos--;
|
||||
EXPECT_EQ(0, error)
|
||||
<< "Error: ClpfBlockTest, SIMD and C mismatch." << std::endl
|
||||
<< "Error: CDEFClpfBlockTest, SIMD and C mismatch." << std::endl
|
||||
<< "First error at " << pos % size << "," << pos / size << " ("
|
||||
<< (int16_t)ref_d[pos] << " != " << (int16_t)d[pos] << ") " << std::endl
|
||||
<< "strength: " << (1 << strength) << std::endl
|
||||
<< "damping: " << damp << std::endl
|
||||
<< "depth: " << depth << std::endl
|
||||
<< "boundary: " << boundary << std::endl
|
||||
<< "w: " << w << std::endl
|
||||
<< "h: " << h << std::endl
|
||||
<< "A=" << (pos > 2 * size ? (int16_t)s[pos - 2 * size] : -1) << std::endl
|
||||
|
@ -188,26 +218,26 @@ void test_clpf_speed(int w, int h, int depth, int iterations,
|
|||
#endif
|
||||
|
||||
EXPECT_GT(ref_elapsed_time, elapsed_time)
|
||||
<< "Error: ClpfSpeedTest, SIMD slower than C." << std::endl
|
||||
<< "Error: CDEFClpfSpeedTest, SIMD slower than C." << std::endl
|
||||
<< "C time: " << ref_elapsed_time << " us" << std::endl
|
||||
<< "SIMD time: " << elapsed_time << " us" << std::endl;
|
||||
}
|
||||
|
||||
TEST_P(ClpfBlockTest, TestSIMDNoMismatch) {
|
||||
test_clpf(sizex, sizey, 8, 16, clpf, ref_clpf);
|
||||
TEST_P(CDEFClpfBlockTest, TestSIMDNoMismatch) {
|
||||
test_clpf(sizex, sizey, 8, 1, clpf, ref_clpf);
|
||||
}
|
||||
|
||||
TEST_P(ClpfSpeedTest, DISABLED_TestSpeed) {
|
||||
test_clpf_speed(sizex, sizey, 8, 256, clpf, ref_clpf);
|
||||
TEST_P(CDEFClpfSpeedTest, DISABLED_TestSpeed) {
|
||||
test_clpf_speed(sizex, sizey, 8, 16, clpf, ref_clpf);
|
||||
}
|
||||
|
||||
#if CONFIG_AOM_HIGHBITDEPTH
|
||||
TEST_P(ClpfBlockHbdTest, TestSIMDNoMismatch) {
|
||||
TEST_P(CDEFClpfBlockHbdTest, TestSIMDNoMismatch) {
|
||||
test_clpf(sizex, sizey, 12, 1, clpf, ref_clpf);
|
||||
}
|
||||
|
||||
TEST_P(ClpfHbdSpeedTest, DISABLED_TestSpeed) {
|
||||
test_clpf_speed(sizex, sizey, 12, 1, clpf, ref_clpf);
|
||||
test_clpf_speed(sizex, sizey, 12, 4, clpf, ref_clpf);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -220,7 +250,7 @@ using std::tr1::make_tuple;
|
|||
// Test all supported architectures and block sizes
|
||||
#if HAVE_SSE2
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
SSE2, ClpfBlockTest,
|
||||
SSE2, CDEFClpfBlockTest,
|
||||
::testing::Values(
|
||||
make_tuple(&aom_clpf_block_sse2, &aom_clpf_block_c, 8, 8),
|
||||
make_tuple(&aom_clpf_block_sse2, &aom_clpf_block_c, 8, 4),
|
||||
|
@ -234,7 +264,7 @@ INSTANTIATE_TEST_CASE_P(
|
|||
|
||||
#if HAVE_SSSE3
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
SSSE3, ClpfBlockTest,
|
||||
SSSE3, CDEFClpfBlockTest,
|
||||
::testing::Values(
|
||||
make_tuple(&aom_clpf_block_ssse3, &aom_clpf_block_c, 8, 8),
|
||||
make_tuple(&aom_clpf_block_ssse3, &aom_clpf_block_c, 8, 4),
|
||||
|
@ -248,7 +278,7 @@ INSTANTIATE_TEST_CASE_P(
|
|||
|
||||
#if HAVE_SSE4_1
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
SSE4_1, ClpfBlockTest,
|
||||
SSE4_1, CDEFClpfBlockTest,
|
||||
::testing::Values(
|
||||
make_tuple(&aom_clpf_block_sse4_1, &aom_clpf_block_c, 8, 8),
|
||||
make_tuple(&aom_clpf_block_sse4_1, &aom_clpf_block_c, 8, 4),
|
||||
|
@ -262,7 +292,7 @@ INSTANTIATE_TEST_CASE_P(
|
|||
|
||||
#if HAVE_NEON
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
NEON, ClpfBlockTest,
|
||||
NEON, CDEFClpfBlockTest,
|
||||
::testing::Values(
|
||||
make_tuple(&aom_clpf_block_neon, &aom_clpf_block_c, 8, 8),
|
||||
make_tuple(&aom_clpf_block_neon, &aom_clpf_block_c, 8, 4),
|
||||
|
@ -277,7 +307,7 @@ INSTANTIATE_TEST_CASE_P(
|
|||
#if CONFIG_AOM_HIGHBITDEPTH
|
||||
#if HAVE_SSE2
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
SSE2, ClpfBlockHbdTest,
|
||||
SSE2, CDEFClpfBlockHbdTest,
|
||||
::testing::Values(
|
||||
make_tuple(&aom_clpf_block_hbd_sse2, &aom_clpf_block_hbd_c, 8, 8),
|
||||
make_tuple(&aom_clpf_block_hbd_sse2, &aom_clpf_block_hbd_c, 8, 4),
|
||||
|
@ -291,7 +321,7 @@ INSTANTIATE_TEST_CASE_P(
|
|||
|
||||
#if HAVE_SSSE3
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
SSSE3, ClpfBlockHbdTest,
|
||||
SSSE3, CDEFClpfBlockHbdTest,
|
||||
::testing::Values(
|
||||
make_tuple(&aom_clpf_block_hbd_ssse3, &aom_clpf_block_hbd_c, 8, 8),
|
||||
make_tuple(&aom_clpf_block_hbd_ssse3, &aom_clpf_block_hbd_c, 8, 4),
|
||||
|
@ -305,7 +335,7 @@ INSTANTIATE_TEST_CASE_P(
|
|||
|
||||
#if HAVE_SSE4_1
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
SSE4_1, ClpfBlockHbdTest,
|
||||
SSE4_1, CDEFClpfBlockHbdTest,
|
||||
::testing::Values(
|
||||
make_tuple(&aom_clpf_block_hbd_sse4_1, &aom_clpf_block_hbd_c, 8, 8),
|
||||
make_tuple(&aom_clpf_block_hbd_sse4_1, &aom_clpf_block_hbd_c, 8, 4),
|
||||
|
@ -319,7 +349,7 @@ INSTANTIATE_TEST_CASE_P(
|
|||
|
||||
#if HAVE_NEON
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
NEON, ClpfBlockHbdTest,
|
||||
NEON, CDEFClpfBlockHbdTest,
|
||||
::testing::Values(
|
||||
make_tuple(&aom_clpf_block_hbd_neon, &aom_clpf_block_hbd_c, 8, 8),
|
||||
make_tuple(&aom_clpf_block_hbd_neon, &aom_clpf_block_hbd_c, 8, 4),
|
||||
|
@ -335,14 +365,14 @@ INSTANTIATE_TEST_CASE_P(
|
|||
// Test speed for all supported architectures
|
||||
#if HAVE_SSE2
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
SSE2, ClpfSpeedTest,
|
||||
SSE2, CDEFClpfSpeedTest,
|
||||
::testing::Values(make_tuple(&aom_clpf_block_sse2, &aom_clpf_block_c, 8, 8),
|
||||
make_tuple(&aom_clpf_hblock_sse2, &aom_clpf_hblock_c, 8,
|
||||
8)));
|
||||
#endif
|
||||
|
||||
#if HAVE_SSSE3
|
||||
INSTANTIATE_TEST_CASE_P(SSSE3, ClpfSpeedTest,
|
||||
INSTANTIATE_TEST_CASE_P(SSSE3, CDEFClpfSpeedTest,
|
||||
::testing::Values(make_tuple(&aom_clpf_block_ssse3,
|
||||
&aom_clpf_block_c, 8, 8),
|
||||
make_tuple(&aom_clpf_hblock_ssse3,
|
||||
|
@ -351,7 +381,7 @@ INSTANTIATE_TEST_CASE_P(SSSE3, ClpfSpeedTest,
|
|||
#endif
|
||||
|
||||
#if HAVE_SSE4_1
|
||||
INSTANTIATE_TEST_CASE_P(SSE4_1, ClpfSpeedTest,
|
||||
INSTANTIATE_TEST_CASE_P(SSE4_1, CDEFClpfSpeedTest,
|
||||
::testing::Values(make_tuple(&aom_clpf_block_sse4_1,
|
||||
&aom_clpf_block_c, 8, 8),
|
||||
make_tuple(&aom_clpf_hblock_sse4_1,
|
||||
|
@ -362,7 +392,7 @@ INSTANTIATE_TEST_CASE_P(SSE4_1, ClpfSpeedTest,
|
|||
|
||||
#if HAVE_NEON
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
NEON, ClpfSpeedTest,
|
||||
NEON, CDEFClpfSpeedTest,
|
||||
::testing::Values(make_tuple(&aom_clpf_block_neon, &aom_clpf_block_c, 8, 8),
|
||||
make_tuple(&aom_clpf_hblock_neon, &aom_clpf_hblock_c, 8,
|
||||
8)));
|
||||
|
|
|
@ -32,9 +32,9 @@ typedef int (*dering_dir_t)(uint16_t *y, int ystride, const uint16_t *in,
|
|||
|
||||
typedef std::tr1::tuple<dering_dir_t, dering_dir_t, int> dering_dir_param_t;
|
||||
|
||||
class DeringDirTest : public ::testing::TestWithParam<dering_dir_param_t> {
|
||||
class CDEFDeringDirTest : public ::testing::TestWithParam<dering_dir_param_t> {
|
||||
public:
|
||||
virtual ~DeringDirTest() {}
|
||||
virtual ~CDEFDeringDirTest() {}
|
||||
virtual void SetUp() {
|
||||
dering = GET_PARAM(0);
|
||||
ref_dering = GET_PARAM(1);
|
||||
|
@ -49,7 +49,7 @@ class DeringDirTest : public ::testing::TestWithParam<dering_dir_param_t> {
|
|||
dering_dir_t ref_dering;
|
||||
};
|
||||
|
||||
typedef DeringDirTest DeringSpeedTest;
|
||||
typedef CDEFDeringDirTest CDEFDeringSpeedTest;
|
||||
|
||||
void test_dering(int bsize, int iterations,
|
||||
int (*dering)(uint16_t *y, int ystride, const uint16_t *in,
|
||||
|
@ -66,38 +66,66 @@ void test_dering(int bsize, int iterations,
|
|||
memset(d, 0, sizeof(d));
|
||||
|
||||
int error = 0, threshold = 0, dir;
|
||||
int depth, bits, level, count, errdepth = 0, errthreshold = 0;
|
||||
int boundary, depth, bits, level, count, errdepth = 0, errthreshold = 0,
|
||||
errboundary = 0;
|
||||
unsigned int pos = 0;
|
||||
int ref_res = 0, res = 0;
|
||||
|
||||
for (depth = 8; depth <= 12; depth += 2) {
|
||||
for (count = 0; count < iterations; count++) {
|
||||
for (level = 0; level < (1 << depth) && !error;
|
||||
level += 1 << (depth - 8)) {
|
||||
for (bits = 1; bits <= depth && !error; bits++) {
|
||||
for (unsigned int i = 0; i < sizeof(s) / sizeof(*s); i++)
|
||||
s[i] = clamp((rnd.Rand16() & ((1 << bits) - 1)) + level, 0,
|
||||
(1 << depth) - 1);
|
||||
for (dir = 0; dir < 8; dir++) {
|
||||
for (threshold = 0; threshold < 64 << (depth - 8) && !error;
|
||||
threshold += !error << (depth - 8)) {
|
||||
ref_res = ref_dering(
|
||||
ref_d, size,
|
||||
s + OD_FILT_HBORDER + OD_FILT_VBORDER * OD_FILT_BSTRIDE,
|
||||
threshold, dir);
|
||||
// If dering and ref_dering are the same, we're just testing speed
|
||||
if (dering != ref_dering)
|
||||
ASM_REGISTER_STATE_CHECK(
|
||||
res = dering(d, size, s + OD_FILT_HBORDER +
|
||||
for (boundary = 0; boundary < 16; boundary++) {
|
||||
for (depth = 8; depth <= 12; depth += 2) {
|
||||
for (count = 0; count < iterations; count++) {
|
||||
for (level = 0; level < (1 << depth) && !error;
|
||||
level += (1 + 4 * !!boundary) << (depth - 8)) {
|
||||
for (bits = 1; bits <= depth && !error; bits++) {
|
||||
for (unsigned int i = 0; i < sizeof(s) / sizeof(*s); i++)
|
||||
s[i] = clamp((rnd.Rand16() & ((1 << bits) - 1)) + level, 0,
|
||||
(1 << depth) - 1);
|
||||
if (boundary) {
|
||||
if (boundary & 1) { // Left
|
||||
for (int i = 0; i < ysize; i++)
|
||||
for (int j = 0; j < OD_FILT_HBORDER; j++)
|
||||
s[i * OD_FILT_BSTRIDE + j] = OD_DERING_VERY_LARGE;
|
||||
}
|
||||
if (boundary & 2) { // Right
|
||||
for (int i = 0; i < ysize; i++)
|
||||
for (int j = OD_FILT_HBORDER + size; j < OD_FILT_BSTRIDE; j++)
|
||||
s[i * OD_FILT_BSTRIDE + j] = OD_DERING_VERY_LARGE;
|
||||
}
|
||||
if (boundary & 4) { // Above
|
||||
for (int i = 0; i < OD_FILT_VBORDER; i++)
|
||||
for (int j = 0; j < OD_FILT_BSTRIDE; j++)
|
||||
s[i * OD_FILT_BSTRIDE + j] = OD_DERING_VERY_LARGE;
|
||||
}
|
||||
if (boundary & 8) { // Below
|
||||
for (int i = OD_FILT_VBORDER + size; i < ysize; i++)
|
||||
for (int j = 0; j < OD_FILT_BSTRIDE; j++)
|
||||
s[i * OD_FILT_BSTRIDE + j] = OD_DERING_VERY_LARGE;
|
||||
}
|
||||
}
|
||||
for (dir = 0; dir < 8; dir++) {
|
||||
for (threshold = 0; threshold < 64 << (depth - 8) && !error;
|
||||
threshold += !error << (depth - 8)) {
|
||||
ref_res = ref_dering(
|
||||
ref_d, size,
|
||||
s + OD_FILT_HBORDER + OD_FILT_VBORDER * OD_FILT_BSTRIDE,
|
||||
threshold, dir);
|
||||
// If dering and ref_dering are the same, we're just testing
|
||||
// speed
|
||||
if (dering != ref_dering)
|
||||
ASM_REGISTER_STATE_CHECK(
|
||||
res =
|
||||
dering(d, size, s + OD_FILT_HBORDER +
|
||||
OD_FILT_VBORDER * OD_FILT_BSTRIDE,
|
||||
threshold, dir));
|
||||
if (ref_dering != dering) {
|
||||
for (pos = 0; pos < sizeof(d) / sizeof(*d) && !error; pos++) {
|
||||
error = ref_d[pos] != d[pos];
|
||||
errdepth = depth;
|
||||
errthreshold = threshold;
|
||||
if (ref_dering != dering) {
|
||||
for (pos = 0; pos < sizeof(d) / sizeof(*d) && !error; pos++) {
|
||||
error = ref_d[pos] != d[pos];
|
||||
errdepth = depth;
|
||||
errthreshold = threshold;
|
||||
errboundary = boundary;
|
||||
}
|
||||
error |= res != ref_res;
|
||||
}
|
||||
error |= res != ref_res;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -107,7 +135,7 @@ void test_dering(int bsize, int iterations,
|
|||
}
|
||||
|
||||
pos--;
|
||||
EXPECT_EQ(0, error) << "Error: DeringDirTest, SIMD and C mismatch."
|
||||
EXPECT_EQ(0, error) << "Error: CDEFDeringDirTest, SIMD and C mismatch."
|
||||
<< std::endl
|
||||
<< "First error at " << pos % size << "," << pos / size
|
||||
<< " (" << (int16_t)ref_d[pos] << " : " << (int16_t)d[pos]
|
||||
|
@ -116,6 +144,7 @@ void test_dering(int bsize, int iterations,
|
|||
<< "threshold: " << errthreshold << std::endl
|
||||
<< "depth: " << errdepth << std::endl
|
||||
<< "size: " << bsize << std::endl
|
||||
<< "boundary: " << errboundary << std::endl
|
||||
<< std::endl;
|
||||
}
|
||||
|
||||
|
@ -145,7 +174,7 @@ void test_dering_speed(int bsize, int iterations,
|
|||
#endif
|
||||
|
||||
EXPECT_GT(ref_elapsed_time, elapsed_time)
|
||||
<< "Error: DeringSpeedTest, SIMD slower than C." << std::endl
|
||||
<< "Error: CDEFDeringSpeedTest, SIMD slower than C." << std::endl
|
||||
<< "C time: " << ref_elapsed_time << " us" << std::endl
|
||||
<< "SIMD time: " << elapsed_time << " us" << std::endl;
|
||||
}
|
||||
|
@ -155,9 +184,10 @@ typedef int (*find_dir_t)(const od_dering_in *img, int stride, int32_t *var,
|
|||
|
||||
typedef std::tr1::tuple<find_dir_t, find_dir_t> find_dir_param_t;
|
||||
|
||||
class DeringFindDirTest : public ::testing::TestWithParam<find_dir_param_t> {
|
||||
class CDEFDeringFindDirTest
|
||||
: public ::testing::TestWithParam<find_dir_param_t> {
|
||||
public:
|
||||
virtual ~DeringFindDirTest() {}
|
||||
virtual ~CDEFDeringFindDirTest() {}
|
||||
virtual void SetUp() {
|
||||
finddir = GET_PARAM(0);
|
||||
ref_finddir = GET_PARAM(1);
|
||||
|
@ -170,7 +200,7 @@ class DeringFindDirTest : public ::testing::TestWithParam<find_dir_param_t> {
|
|||
find_dir_t ref_finddir;
|
||||
};
|
||||
|
||||
typedef DeringFindDirTest DeringFindDirSpeedTest;
|
||||
typedef CDEFDeringFindDirTest CDEFDeringFindDirSpeedTest;
|
||||
|
||||
void test_finddir(int (*finddir)(const od_dering_in *img, int stride,
|
||||
int32_t *var, int coeff_shift),
|
||||
|
@ -206,7 +236,7 @@ void test_finddir(int (*finddir)(const od_dering_in *img, int stride,
|
|||
}
|
||||
}
|
||||
|
||||
EXPECT_EQ(0, error) << "Error: DeringFindDirTest, SIMD and C mismatch."
|
||||
EXPECT_EQ(0, error) << "Error: CDEFDeringFindDirTest, SIMD and C mismatch."
|
||||
<< std::endl
|
||||
<< "return: " << res << " : " << ref_res << std::endl
|
||||
<< "var: " << var << " : " << ref_var << std::endl
|
||||
|
@ -237,24 +267,24 @@ void test_finddir_speed(int (*finddir)(const od_dering_in *img, int stride,
|
|||
#endif
|
||||
|
||||
EXPECT_GT(ref_elapsed_time, elapsed_time)
|
||||
<< "Error: DeringFindDirSpeedTest, SIMD slower than C." << std::endl
|
||||
<< "Error: CDEFDeringFindDirSpeedTest, SIMD slower than C." << std::endl
|
||||
<< "C time: " << ref_elapsed_time << " us" << std::endl
|
||||
<< "SIMD time: " << elapsed_time << " us" << std::endl;
|
||||
}
|
||||
|
||||
TEST_P(DeringDirTest, TestSIMDNoMismatch) {
|
||||
TEST_P(CDEFDeringDirTest, TestSIMDNoMismatch) {
|
||||
test_dering(bsize, 1, dering, ref_dering);
|
||||
}
|
||||
|
||||
TEST_P(DeringSpeedTest, DISABLED_TestSpeed) {
|
||||
TEST_P(CDEFDeringSpeedTest, DISABLED_TestSpeed) {
|
||||
test_dering_speed(bsize, 4, dering, ref_dering);
|
||||
}
|
||||
|
||||
TEST_P(DeringFindDirTest, TestSIMDNoMismatch) {
|
||||
TEST_P(CDEFDeringFindDirTest, TestSIMDNoMismatch) {
|
||||
test_finddir(finddir, ref_finddir);
|
||||
}
|
||||
|
||||
TEST_P(DeringFindDirSpeedTest, DISABLED_TestSpeed) {
|
||||
TEST_P(CDEFDeringFindDirSpeedTest, DISABLED_TestSpeed) {
|
||||
test_finddir_speed(finddir, ref_finddir);
|
||||
}
|
||||
|
||||
|
@ -266,47 +296,47 @@ using std::tr1::make_tuple;
|
|||
#if defined(_WIN64) || !defined(_MSC_VER) || defined(__clang__)
|
||||
#if HAVE_SSE2
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
SSE2, DeringDirTest,
|
||||
SSE2, CDEFDeringDirTest,
|
||||
::testing::Values(make_tuple(&od_filter_dering_direction_4x4_sse2,
|
||||
&od_filter_dering_direction_4x4_c, 4),
|
||||
make_tuple(&od_filter_dering_direction_8x8_sse2,
|
||||
&od_filter_dering_direction_8x8_c, 8)));
|
||||
INSTANTIATE_TEST_CASE_P(SSE2, DeringFindDirTest,
|
||||
INSTANTIATE_TEST_CASE_P(SSE2, CDEFDeringFindDirTest,
|
||||
::testing::Values(make_tuple(&od_dir_find8_sse2,
|
||||
&od_dir_find8_c)));
|
||||
#endif
|
||||
#if HAVE_SSSE3
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
SSSE3, DeringDirTest,
|
||||
SSSE3, CDEFDeringDirTest,
|
||||
::testing::Values(make_tuple(&od_filter_dering_direction_4x4_ssse3,
|
||||
&od_filter_dering_direction_4x4_c, 4),
|
||||
make_tuple(&od_filter_dering_direction_8x8_ssse3,
|
||||
&od_filter_dering_direction_8x8_c, 8)));
|
||||
INSTANTIATE_TEST_CASE_P(SSSE3, DeringFindDirTest,
|
||||
INSTANTIATE_TEST_CASE_P(SSSE3, CDEFDeringFindDirTest,
|
||||
::testing::Values(make_tuple(&od_dir_find8_ssse3,
|
||||
&od_dir_find8_c)));
|
||||
#endif
|
||||
|
||||
#if HAVE_SSE4_1
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
SSE4_1, DeringDirTest,
|
||||
SSE4_1, CDEFDeringDirTest,
|
||||
::testing::Values(make_tuple(&od_filter_dering_direction_4x4_sse4_1,
|
||||
&od_filter_dering_direction_4x4_c, 4),
|
||||
make_tuple(&od_filter_dering_direction_8x8_sse4_1,
|
||||
&od_filter_dering_direction_8x8_c, 8)));
|
||||
INSTANTIATE_TEST_CASE_P(SSE4_1, DeringFindDirTest,
|
||||
INSTANTIATE_TEST_CASE_P(SSE4_1, CDEFDeringFindDirTest,
|
||||
::testing::Values(make_tuple(&od_dir_find8_sse4_1,
|
||||
&od_dir_find8_c)));
|
||||
#endif
|
||||
|
||||
#if HAVE_NEON
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
NEON, DeringDirTest,
|
||||
NEON, CDEFDeringDirTest,
|
||||
::testing::Values(make_tuple(&od_filter_dering_direction_4x4_neon,
|
||||
&od_filter_dering_direction_4x4_c, 4),
|
||||
make_tuple(&od_filter_dering_direction_8x8_neon,
|
||||
&od_filter_dering_direction_8x8_c, 8)));
|
||||
INSTANTIATE_TEST_CASE_P(NEON, DeringFindDirTest,
|
||||
INSTANTIATE_TEST_CASE_P(NEON, CDEFDeringFindDirTest,
|
||||
::testing::Values(make_tuple(&od_dir_find8_neon,
|
||||
&od_dir_find8_c)));
|
||||
#endif
|
||||
|
@ -314,48 +344,48 @@ INSTANTIATE_TEST_CASE_P(NEON, DeringFindDirTest,
|
|||
// Test speed for all supported architectures
|
||||
#if HAVE_SSE2
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
SSE2, DeringSpeedTest,
|
||||
SSE2, CDEFDeringSpeedTest,
|
||||
::testing::Values(make_tuple(&od_filter_dering_direction_4x4_sse2,
|
||||
&od_filter_dering_direction_4x4_c, 4),
|
||||
make_tuple(&od_filter_dering_direction_8x8_sse2,
|
||||
&od_filter_dering_direction_8x8_c, 8)));
|
||||
INSTANTIATE_TEST_CASE_P(SSE2, DeringFindDirSpeedTest,
|
||||
INSTANTIATE_TEST_CASE_P(SSE2, CDEFDeringFindDirSpeedTest,
|
||||
::testing::Values(make_tuple(&od_dir_find8_sse2,
|
||||
&od_dir_find8_c)));
|
||||
#endif
|
||||
|
||||
#if HAVE_SSSE3
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
SSSE3, DeringSpeedTest,
|
||||
SSSE3, CDEFDeringSpeedTest,
|
||||
::testing::Values(make_tuple(&od_filter_dering_direction_4x4_ssse3,
|
||||
&od_filter_dering_direction_4x4_c, 4),
|
||||
make_tuple(&od_filter_dering_direction_8x8_ssse3,
|
||||
&od_filter_dering_direction_8x8_c, 8)));
|
||||
INSTANTIATE_TEST_CASE_P(SSSE3, DeringFindDirSpeedTest,
|
||||
INSTANTIATE_TEST_CASE_P(SSSE3, CDEFDeringFindDirSpeedTest,
|
||||
::testing::Values(make_tuple(&od_dir_find8_ssse3,
|
||||
&od_dir_find8_c)));
|
||||
#endif
|
||||
|
||||
#if HAVE_SSE4_1
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
SSE4_1, DeringSpeedTest,
|
||||
SSE4_1, CDEFDeringSpeedTest,
|
||||
::testing::Values(make_tuple(&od_filter_dering_direction_4x4_sse4_1,
|
||||
&od_filter_dering_direction_4x4_c, 4),
|
||||
make_tuple(&od_filter_dering_direction_8x8_sse4_1,
|
||||
&od_filter_dering_direction_8x8_c, 8)));
|
||||
INSTANTIATE_TEST_CASE_P(SSE4_1, DeringFindDirSpeedTest,
|
||||
INSTANTIATE_TEST_CASE_P(SSE4_1, CDEFDeringFindDirSpeedTest,
|
||||
::testing::Values(make_tuple(&od_dir_find8_sse4_1,
|
||||
&od_dir_find8_c)));
|
||||
#endif
|
||||
|
||||
#if HAVE_NEON
|
||||
INSTANTIATE_TEST_CASE_P(
|
||||
NEON, DeringSpeedTest,
|
||||
NEON, CDEFDeringSpeedTest,
|
||||
::testing::Values(make_tuple(&od_filter_dering_direction_4x4_neon,
|
||||
&od_filter_dering_direction_4x4_c, 4),
|
||||
make_tuple(&od_filter_dering_direction_8x8_neon,
|
||||
&od_filter_dering_direction_8x8_c, 8)));
|
||||
INSTANTIATE_TEST_CASE_P(NEON, DeringFindDirSpeedTest,
|
||||
INSTANTIATE_TEST_CASE_P(NEON, CDEFDeringFindDirSpeedTest,
|
||||
::testing::Values(make_tuple(&od_dir_find8_neon,
|
||||
&od_dir_find8_c)));
|
||||
#endif
|
||||
|
|
Загрузка…
Ссылка в новой задаче