sad: remove aom_sad*xh_c
These functions have been unused since their introduction.
Also make the functions in jnt_sad_ssse3.c static. There may be some
further work that can be done to reuse other sad functions in this file.
This removes DistWtdSADTest, which was testing them, but they're covered
by their use in aom_dist_wtd_sad*_avg and DistWtdSADavgTest.
Bug: aomedia:3416
Change-Id: I490da7c9685d7f94e3a9bc115889a9056a9732c5
diff --git a/aom_dsp/aom_dsp_rtcd_defs.pl b/aom_dsp/aom_dsp_rtcd_defs.pl
index f3358d0..16f32f8 100755
--- a/aom_dsp/aom_dsp_rtcd_defs.pl
+++ b/aom_dsp/aom_dsp_rtcd_defs.pl
@@ -862,20 +862,6 @@
specialize qw/aom_dist_wtd_sad16x64_avg ssse3/;
specialize qw/aom_dist_wtd_sad64x16_avg ssse3/;
- add_proto qw/unsigned int/, "aom_sad4xh", "const uint8_t *a, int a_stride, const uint8_t *b, int b_stride, int width, int height";
- add_proto qw/unsigned int/, "aom_sad8xh", "const uint8_t *a, int a_stride, const uint8_t *b, int b_stride, int width, int height";
- add_proto qw/unsigned int/, "aom_sad16xh", "const uint8_t *a, int a_stride, const uint8_t *b, int b_stride, int width, int height";
- add_proto qw/unsigned int/, "aom_sad32xh", "const uint8_t *a, int a_stride, const uint8_t *b, int b_stride, int width, int height";
- add_proto qw/unsigned int/, "aom_sad64xh", "const uint8_t *a, int a_stride, const uint8_t *b, int b_stride, int width, int height";
- add_proto qw/unsigned int/, "aom_sad128xh", "const uint8_t *a, int a_stride, const uint8_t *b, int b_stride, int width, int height";
-
- specialize qw/aom_sad4xh sse2/;
- specialize qw/aom_sad8xh sse2/;
- specialize qw/aom_sad16xh sse2/;
- specialize qw/aom_sad32xh sse2/;
- specialize qw/aom_sad64xh sse2/;
- specialize qw/aom_sad128xh sse2/;
-
if (aom_config("CONFIG_AV1_HIGHBITDEPTH") eq "yes") {
foreach (@encoder_block_sizes) {
($w, $h) = @$_;
diff --git a/aom_dsp/sad.c b/aom_dsp/sad.c
index 5b7b0e4..3e7fbf16 100644
--- a/aom_dsp/sad.c
+++ b/aom_dsp/sad.c
@@ -35,13 +35,6 @@
return sad;
}
-#define SAD_MXH(m) \
- unsigned int aom_sad##m##xh_c(const uint8_t *a, int a_stride, \
- const uint8_t *b, int b_stride, int width, \
- int height) { \
- return sad(a, a_stride, b, b_stride, width, height); \
- }
-
#define SADMXN(m, n) \
unsigned int aom_sad##m##x##n##_c(const uint8_t *src, int src_stride, \
const uint8_t *ref, int ref_stride) { \
@@ -208,13 +201,6 @@
SAD_MXNX4D(4, 4)
SAD_MXNX3D(4, 4)
-SAD_MXH(128)
-SAD_MXH(64)
-SAD_MXH(32)
-SAD_MXH(16)
-SAD_MXH(8)
-SAD_MXH(4)
-
SADMXN(4, 16)
SAD_MXNX4D(4, 16)
SADMXN(16, 4)
diff --git a/aom_dsp/x86/jnt_sad_ssse3.c b/aom_dsp/x86/jnt_sad_ssse3.c
index 357f70a..d969cd0 100644
--- a/aom_dsp/x86/jnt_sad_ssse3.c
+++ b/aom_dsp/x86/jnt_sad_ssse3.c
@@ -18,8 +18,9 @@
#include "aom_dsp/x86/synonyms.h"
-unsigned int aom_sad4xh_sse2(const uint8_t *a, int a_stride, const uint8_t *b,
- int b_stride, int width, int height) {
+static unsigned int sad4xh_sse2(const uint8_t *a, int a_stride,
+ const uint8_t *b, int b_stride, int width,
+ int height) {
int i;
assert(width == 4);
(void)width;
@@ -59,8 +60,9 @@
return res;
}
-unsigned int aom_sad8xh_sse2(const uint8_t *a, int a_stride, const uint8_t *b,
- int b_stride, int width, int height) {
+static unsigned int sad8xh_sse2(const uint8_t *a, int a_stride,
+ const uint8_t *b, int b_stride, int width,
+ int height) {
int i;
assert(width == 8);
(void)width;
@@ -91,8 +93,9 @@
return res;
}
-unsigned int aom_sad16xh_sse2(const uint8_t *a, int a_stride, const uint8_t *b,
- int b_stride, int width, int height) {
+static unsigned int sad16xh_sse2(const uint8_t *a, int a_stride,
+ const uint8_t *b, int b_stride, int width,
+ int height) {
int i;
assert(width == 16);
(void)width;
@@ -116,8 +119,9 @@
return res;
}
-unsigned int aom_sad32xh_sse2(const uint8_t *a, int a_stride, const uint8_t *b,
- int b_stride, int width, int height) {
+static unsigned int sad32xh_sse2(const uint8_t *a, int a_stride,
+ const uint8_t *b, int b_stride, int width,
+ int height) {
int i, j;
assert(width == 32);
(void)width;
@@ -143,8 +147,9 @@
return res;
}
-unsigned int aom_sad64xh_sse2(const uint8_t *a, int a_stride, const uint8_t *b,
- int b_stride, int width, int height) {
+static unsigned int sad64xh_sse2(const uint8_t *a, int a_stride,
+ const uint8_t *b, int b_stride, int width,
+ int height) {
int i, j;
assert(width == 64);
(void)width;
@@ -170,8 +175,9 @@
return res;
}
-unsigned int aom_sad128xh_sse2(const uint8_t *a, int a_stride, const uint8_t *b,
- int b_stride, int width, int height) {
+static unsigned int sad128xh_sse2(const uint8_t *a, int a_stride,
+ const uint8_t *b, int b_stride, int width,
+ int height) {
int i, j;
assert(width == 128);
(void)width;
@@ -204,7 +210,7 @@
uint8_t comp_pred[m * n]; \
aom_dist_wtd_comp_avg_pred(comp_pred, second_pred, m, n, ref, ref_stride, \
jcp_param); \
- return aom_sad##m##xh_sse2(src, src_stride, comp_pred, m, m, n); \
+ return sad##m##xh_sse2(src, src_stride, comp_pred, m, m, n); \
}
#define dist_wtd_sadMxN_avx2(m, n) \
diff --git a/test/sad_test.cc b/test/sad_test.cc
index 98c8f51..6f08f59 100644
--- a/test/sad_test.cc
+++ b/test/sad_test.cc
@@ -635,39 +635,6 @@
}
};
-class DistWtdSADTest : public ::testing::WithParamInterface<DistWtdSadMxhParam>,
- public SADTestBase {
- public:
- DistWtdSADTest() : SADTestBase(GET_PARAM(0), GET_PARAM(1), GET_PARAM(3)) {}
-
- protected:
- unsigned int SAD(int block_idx) {
- unsigned int ret;
- const uint8_t *const reference = GetReference(block_idx);
-
- API_REGISTER_STATE_CHECK(ret = GET_PARAM(2)(source_data_, source_stride_,
- reference, reference_stride_,
- GET_PARAM(0), GET_PARAM(1)));
- return ret;
- }
-
- void CheckSAD() {
- const unsigned int reference_sad = ReferenceSAD(0);
- const unsigned int exp_sad = SAD(0);
-
- ASSERT_EQ(reference_sad, exp_sad);
- }
-
- void SADForSpeedTest(unsigned int *results,
- const uint8_t *const *references) {
- GET_PARAM(2)
- (source_data_, source_stride_, references[0], reference_stride_, width_,
- height_);
- (void)results;
- }
-};
-GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(DistWtdSADTest);
-
class DistWtdSADavgTest
: public ::testing::WithParamInterface<DistWtdSadMxNAvgParam>,
public SADTestBase {
@@ -908,52 +875,6 @@
reference_stride_ = tmp_stride;
}
-TEST_P(DistWtdSADTest, MaxRef) {
- FillConstant(source_data_, source_stride_, 0);
- FillConstant(reference_data_, reference_stride_, mask_);
- CheckSAD();
-}
-
-TEST_P(DistWtdSADTest, MaxSrc) {
- FillConstant(source_data_, source_stride_, mask_);
- FillConstant(reference_data_, reference_stride_, 0);
- CheckSAD();
-}
-
-TEST_P(DistWtdSADTest, ShortRef) {
- const int tmp_stride = reference_stride_;
- reference_stride_ >>= 1;
- FillRandom(source_data_, source_stride_);
- FillRandom(reference_data_, reference_stride_);
- CheckSAD();
- reference_stride_ = tmp_stride;
-}
-
-TEST_P(DistWtdSADTest, UnalignedRef) {
- // The reference frame, but not the source frame, may be unaligned for
- // certain types of searches.
- const int tmp_stride = reference_stride_;
- reference_stride_ -= 1;
- FillRandom(source_data_, source_stride_);
- FillRandom(reference_data_, reference_stride_);
- CheckSAD();
- reference_stride_ = tmp_stride;
-}
-
-TEST_P(DistWtdSADTest, ShortSrc) {
- const int tmp_stride = source_stride_;
- source_stride_ >>= 1;
- int test_count = 2000;
- while (test_count > 0) {
- FillRandom(source_data_, source_stride_);
- FillRandom(reference_data_, reference_stride_);
- CheckSAD();
- if (testing::Test::HasFatalFailure()) break;
- test_count -= 1;
- }
- source_stride_ = tmp_stride;
-}
-
TEST_P(DistWtdSADavgTest, MaxRef) {
FillConstant(source_data_, source_stride_, 0);
FillConstant(reference_data_, reference_stride_, mask_);
@@ -2638,46 +2559,6 @@
#endif // !CONFIG_REALTIME_ONLY
#endif // HAVE_SSE2
-#if HAVE_SSSE3
-// Note: These are named sse2, but part of ssse3 file and only built and linked
-// when ssse3 is enabled.
-const DistWtdSadMxhParam dist_wtd_sad_sse2_tests[] = {
- make_tuple(4, 4, &aom_sad4xh_sse2, -1),
- make_tuple(4, 8, &aom_sad4xh_sse2, -1),
- make_tuple(8, 4, &aom_sad8xh_sse2, -1),
- make_tuple(8, 8, &aom_sad8xh_sse2, -1),
- make_tuple(8, 16, &aom_sad8xh_sse2, -1),
- make_tuple(16, 8, &aom_sad16xh_sse2, -1),
- make_tuple(16, 16, &aom_sad16xh_sse2, -1),
- make_tuple(16, 32, &aom_sad16xh_sse2, -1),
- make_tuple(32, 16, &aom_sad32xh_sse2, -1),
- make_tuple(32, 32, &aom_sad32xh_sse2, -1),
- make_tuple(32, 64, &aom_sad32xh_sse2, -1),
- make_tuple(64, 32, &aom_sad64xh_sse2, -1),
- make_tuple(64, 64, &aom_sad64xh_sse2, -1),
- make_tuple(128, 128, &aom_sad128xh_sse2, -1),
- make_tuple(128, 64, &aom_sad128xh_sse2, -1),
- make_tuple(64, 128, &aom_sad64xh_sse2, -1),
- make_tuple(4, 16, &aom_sad4xh_sse2, -1),
- make_tuple(16, 4, &aom_sad16xh_sse2, -1),
- make_tuple(8, 32, &aom_sad8xh_sse2, -1),
- make_tuple(32, 8, &aom_sad32xh_sse2, -1),
- make_tuple(16, 64, &aom_sad16xh_sse2, -1),
- make_tuple(64, 16, &aom_sad64xh_sse2, -1),
-#if !CONFIG_REALTIME_ONLY
- make_tuple(16, 64, &aom_sad16xh_sse2, -1),
- make_tuple(64, 16, &aom_sad64xh_sse2, -1),
- make_tuple(8, 32, &aom_sad8xh_sse2, -1),
- make_tuple(32, 8, &aom_sad32xh_sse2, -1),
- make_tuple(4, 16, &aom_sad4xh_sse2, -1),
- make_tuple(16, 4, &aom_sad16xh_sse2, -1),
-#endif
-};
-INSTANTIATE_TEST_SUITE_P(SSE2, DistWtdSADTest,
- ::testing::ValuesIn(dist_wtd_sad_sse2_tests));
-
-#endif // HAVE_SSSE3
-
#if HAVE_SSE3
// Only functions are x3, which do not have tests.
#endif // HAVE_SSE3