diff options
author | Yaowu Xu <yaowu@google.com> | 2013-09-19 09:27:59 -0700 |
---|---|---|
committer | Gerrit Code Review <gerrit@gerrit.golo.chromium.org> | 2013-09-19 09:27:59 -0700 |
commit | b0211e7edfa020ccd38b9358409675770908ff82 (patch) | |
tree | 927adce52cf9ab420aca22d4222b2e91f8ab52f4 /test/variance_test.cc | |
parent | 79af5913681dca800f35bee89b5f18c56b8eef45 (diff) | |
parent | a0fcbcfa5f8c3145e38b132f4db45451bff44954 (diff) | |
download | libvpx-b0211e7edfa020ccd38b9358409675770908ff82.tar libvpx-b0211e7edfa020ccd38b9358409675770908ff82.tar.gz libvpx-b0211e7edfa020ccd38b9358409675770908ff82.tar.bz2 libvpx-b0211e7edfa020ccd38b9358409675770908ff82.zip |
Merge "fix vp8-only build"
Diffstat (limited to 'test/variance_test.cc')
-rw-r--r-- | test/variance_test.cc | 60 |
1 files changed, 32 insertions, 28 deletions
diff --git a/test/variance_test.cc b/test/variance_test.cc index ca53ffb21..3f5560170 100644 --- a/test/variance_test.cc +++ b/test/variance_test.cc @@ -78,34 +78,6 @@ static unsigned int subpel_variance_ref(const uint8_t *ref, const uint8_t *src, return sse - (((int64_t) se * se) >> (l2w + l2h)); } -static unsigned int subpel_avg_variance_ref(const uint8_t *ref, - const uint8_t *src, - const uint8_t *second_pred, - int l2w, int l2h, - int xoff, int yoff, - unsigned int *sse_ptr) { - int se = 0; - unsigned int sse = 0; - const int w = 1 << l2w, h = 1 << l2h; - for (int y = 0; y < h; y++) { - for (int x = 0; x < w; x++) { - // bilinear interpolation at a 16th pel step - const int a1 = ref[(w + 1) * (y + 0) + x + 0]; - const int a2 = ref[(w + 1) * (y + 0) + x + 1]; - const int b1 = ref[(w + 1) * (y + 1) + x + 0]; - const int b2 = ref[(w + 1) * (y + 1) + x + 1]; - const int a = a1 + (((a2 - a1) * xoff + 8) >> 4); - const int b = b1 + (((b2 - b1) * xoff + 8) >> 4); - const int r = a + (((b - a) * yoff + 8) >> 4); - int diff = ((r + second_pred[w * y + x] + 1) >> 1) - src[w * y + x]; - se += diff; - sse += diff * diff; - } - } - *sse_ptr = sse; - return sse - (((int64_t) se * se) >> (l2w + l2h)); -} - template<typename VarianceFunctionType> class VarianceTest : public ::testing::TestWithParam<tuple<int, int, VarianceFunctionType> > { @@ -190,6 +162,36 @@ void VarianceTest<VarianceFunctionType>::OneQuarterTest() { EXPECT_EQ(expected, var); } +#if CONFIG_VP9_ENCODER + +unsigned int subpel_avg_variance_ref(const uint8_t *ref, + const uint8_t *src, + const uint8_t *second_pred, + int l2w, int l2h, + int xoff, int yoff, + unsigned int *sse_ptr) { + int se = 0; + unsigned int sse = 0; + const int w = 1 << l2w, h = 1 << l2h; + for (int y = 0; y < h; y++) { + for (int x = 0; x < w; x++) { + // bilinear interpolation at a 16th pel step + const int a1 = ref[(w + 1) * (y + 0) + x + 0]; + const int a2 = ref[(w + 1) * (y + 0) + x + 1]; + const int b1 = ref[(w + 1) * (y + 1) + x + 0]; + const int b2 = ref[(w + 1) * (y + 1) + x + 1]; + const int a = a1 + (((a2 - a1) * xoff + 8) >> 4); + const int b = b1 + (((b2 - b1) * xoff + 8) >> 4); + const int r = a + (((b - a) * yoff + 8) >> 4); + int diff = ((r + second_pred[w * y + x] + 1) >> 1) - src[w * y + x]; + se += diff; + sse += diff * diff; + } + } + *sse_ptr = sse; + return sse - (((int64_t) se * se) >> (l2w + l2h)); +} + template<typename SubpelVarianceFunctionType> class SubpelVarianceTest : public ::testing::TestWithParam<tuple<int, int, @@ -280,6 +282,8 @@ void SubpelVarianceTest<vp9_subp_avg_variance_fn_t>::RefTest() { } } +#endif // CONFIG_VP9_ENCODER + // ----------------------------------------------------------------------------- // VP8 test cases. |