diff options
author | John Koleszar <jkoleszar@google.com> | 2012-05-23 13:47:48 -0700 |
---|---|---|
committer | Gerrit Code Review <gerrit@gerrit.golo.chromium.org> | 2012-05-23 13:47:48 -0700 |
commit | a419f0f232be2ada510304f96eb3270b31669e25 (patch) | |
tree | 5cff4d125ddaa3a7d6a4aaa8768c5a0945ca5a68 /vp8 | |
parent | ad479a9b3d510617f1400d2b168bd1594d422d67 (diff) | |
parent | b9180fc0499a7c1480a47e17328e7a35bb788086 (diff) | |
download | libvpx-a419f0f232be2ada510304f96eb3270b31669e25.tar libvpx-a419f0f232be2ada510304f96eb3270b31669e25.tar.gz libvpx-a419f0f232be2ada510304f96eb3270b31669e25.tar.bz2 libvpx-a419f0f232be2ada510304f96eb3270b31669e25.zip |
Merge changes I38e93fe2,I6d6a0fb6,I51155833,If4c3e5d4,Ia2f40ef2
* changes:
Add initial keyframe tests
Move all tests to test/ directory
Enable unit tests by default
Build unit tests monolithically
configure: initial support for CXX, CXXFLAGS variables
Diffstat (limited to 'vp8')
-rwxr-xr-x | vp8/common/idctllm_test.cc | 31 | ||||
-rwxr-xr-x | vp8/common/idctllm_test.h | 113 | ||||
-rwxr-xr-x | vp8/common/x86/idctllm_mmx_test.cc | 31 | ||||
-rw-r--r-- | vp8/encoder/boolcoder_test.cc | 129 | ||||
-rw-r--r-- | vp8/vp8_common.mk | 2 | ||||
-rw-r--r-- | vp8/vp8cx.mk | 2 |
6 files changed, 0 insertions, 308 deletions
diff --git a/vp8/common/idctllm_test.cc b/vp8/common/idctllm_test.cc deleted file mode 100755 index 0f6ebe7fe..000000000 --- a/vp8/common/idctllm_test.cc +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright (c) 2010 The WebM project authors. All Rights Reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - - - extern "C" { - void vp8_short_idct4x4llm_c(short *input, unsigned char *pred_ptr, - int pred_stride, unsigned char *dst_ptr, - int dst_stride); -} - -#include "vpx_config.h" -#include "idctllm_test.h" -namespace -{ - -INSTANTIATE_TEST_CASE_P(C, IDCTTest, - ::testing::Values(vp8_short_idct4x4llm_c)); - -} // namespace - -int main(int argc, char **argv) { - ::testing::InitGoogleTest(&argc, argv); - return RUN_ALL_TESTS(); -} diff --git a/vp8/common/idctllm_test.h b/vp8/common/idctllm_test.h deleted file mode 100755 index a6a694b18..000000000 --- a/vp8/common/idctllm_test.h +++ /dev/null @@ -1,113 +0,0 @@ -/* - * Copyright (c) 2010 The WebM project authors. All Rights Reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - - - #include "third_party/googletest/src/include/gtest/gtest.h" -typedef void (*idct_fn_t)(short *input, unsigned char *pred_ptr, - int pred_stride, unsigned char *dst_ptr, - int dst_stride); -namespace { -class IDCTTest : public ::testing::TestWithParam<idct_fn_t> -{ - protected: - virtual void SetUp() - { - int i; - - UUT = GetParam(); - memset(input, 0, sizeof(input)); - /* Set up guard blocks */ - for(i=0; i<256; i++) - output[i] = ((i&0xF)<4&&(i<64))?0:-1; - } - - idct_fn_t UUT; - short input[16]; - unsigned char output[256]; - unsigned char predict[256]; -}; - -TEST_P(IDCTTest, TestGuardBlocks) -{ - int i; - - for(i=0; i<256; i++) - if((i&0xF) < 4 && i<64) - EXPECT_EQ(0, output[i]) << i; - else - EXPECT_EQ(255, output[i]); -} - -TEST_P(IDCTTest, TestAllZeros) -{ - int i; - - UUT(input, output, 16, output, 16); - - for(i=0; i<256; i++) - if((i&0xF) < 4 && i<64) - EXPECT_EQ(0, output[i]) << "i==" << i; - else - EXPECT_EQ(255, output[i]) << "i==" << i; -} - -TEST_P(IDCTTest, TestAllOnes) -{ - int i; - - input[0] = 4; - UUT(input, output, 16, output, 16); - - for(i=0; i<256; i++) - if((i&0xF) < 4 && i<64) - EXPECT_EQ(1, output[i]) << "i==" << i; - else - EXPECT_EQ(255, output[i]) << "i==" << i; -} - -TEST_P(IDCTTest, TestAddOne) -{ - int i; - - for(i=0; i<256; i++) - predict[i] = i; - - input[0] = 4; - UUT(input, predict, 16, output, 16); - - for(i=0; i<256; i++) - if((i&0xF) < 4 && i<64) - EXPECT_EQ(i+1, output[i]) << "i==" << i; - else - EXPECT_EQ(255, output[i]) << "i==" << i; -} - -TEST_P(IDCTTest, TestWithData) -{ - int i; - - for(i=0; i<16; i++) - input[i] = i; - - UUT(input, output, 16, output, 16); - - for(i=0; i<256; i++) - if((i&0xF) > 3 || i>63) - EXPECT_EQ(255, output[i]) << "i==" << i; - else if(i == 0) - EXPECT_EQ(11, output[i]) << "i==" << i; - else if(i == 34) - EXPECT_EQ(1, output[i]) << "i==" << i; - else if(i == 2 || i == 17 || i == 32) - EXPECT_EQ(3, output[i]) << "i==" << i; - else - EXPECT_EQ(0, output[i]) << "i==" << i; -} -} diff --git a/vp8/common/x86/idctllm_mmx_test.cc b/vp8/common/x86/idctllm_mmx_test.cc deleted file mode 100755 index 8c115335e..000000000 --- a/vp8/common/x86/idctllm_mmx_test.cc +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright (c) 2010 The WebM project authors. All Rights Reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - - - extern "C" { - void vp8_short_idct4x4llm_mmx(short *input, unsigned char *pred_ptr, - int pred_stride, unsigned char *dst_ptr, - int dst_stride); -} - -#include "vp8/common/idctllm_test.h" - -namespace -{ - -INSTANTIATE_TEST_CASE_P(MMX, IDCTTest, - ::testing::Values(vp8_short_idct4x4llm_mmx)); - -} // namespace - -int main(int argc, char **argv) { - ::testing::InitGoogleTest(&argc, argv); - return RUN_ALL_TESTS(); -} diff --git a/vp8/encoder/boolcoder_test.cc b/vp8/encoder/boolcoder_test.cc deleted file mode 100644 index 9d9462690..000000000 --- a/vp8/encoder/boolcoder_test.cc +++ /dev/null @@ -1,129 +0,0 @@ -/* - * Copyright (c) 2012 The WebM project authors. All Rights Reserved. - * - * Use of this source code is governed by a BSD-style license - * that can be found in the LICENSE file in the root of the source - * tree. An additional intellectual property rights grant can be found - * in the file PATENTS. All contributing project authors may - * be found in the AUTHORS file in the root of the source tree. - */ - -extern "C" -{ -#include "vp8/encoder/boolhuff.h" -#include "vp8/decoder/dboolhuff.h" -} - -#include <math.h> -#include <stddef.h> -#include <stdint.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <sys/types.h> - -#include "third_party/googletest/src/include/gtest/gtest.h" - -typedef unsigned char uint8_t; - -namespace -{ -const int num_tests = 10; - -class ACMRandom -{ -public: - ACMRandom(int seed) { Reset(seed);} - - void Reset(int seed) { srand(seed); } - - uint8_t Rand8(void) { return (rand() >> 8) & 0xff; } - - int PseudoUniform(int range) { return (rand() >> 8) % range; } - - int operator()(int n) { return PseudoUniform(n); } - - static int DeterministicSeed(void) { return 0xbaba; } -}; -} - -TEST(VP8, TestBitIO) -{ - ACMRandom rnd(ACMRandom::DeterministicSeed()); - for (int n = 0; n < num_tests; ++n) - { - for (int method = 0; method <= 7; ++method) - { // we generate various proba - const int bits_to_test = 1000; - - uint8_t probas[bits_to_test]; - - for (int i = 0; i < bits_to_test; ++i) - { - const int parity = i & 1; - probas[i] = - (method == 0) ? 0 : - (method == 1) ? 255 : - (method == 2) ? 128 : - (method == 3) ? rnd.Rand8() : - (method == 4) ? (parity ? 0 : 255) : - // alternate between low and high proba: - (method == 5) ? (parity ? rnd(128) : 255 - rnd(128)) : - (method == 6) ? - (parity ? rnd(64) : 255 - rnd(64)) : - (parity ? rnd(32) : 255 - rnd(32)); - } - for (int bit_method = 0; bit_method <= 3; ++bit_method) - { - const int random_seed = 6432; - const int buffer_size = 10000; - ACMRandom bit_rnd(random_seed); - BOOL_CODER bw; - uint8_t bw_buffer[buffer_size]; - vp8_start_encode(&bw, bw_buffer, bw_buffer + buffer_size); - - int bit = (bit_method == 0) ? 0 : (bit_method == 1) ? 1 : 0; - for (int i = 0; i < bits_to_test; ++i) - { - if (bit_method == 2) - { - bit = (i & 1); - } - else if (bit_method == 3) - { - bit = bit_rnd(2); - } - vp8_encode_bool(&bw, bit, (int) probas[i]); - } - - vp8_stop_encode(&bw); - - BOOL_DECODER br; - vp8dx_start_decode(&br, bw_buffer, buffer_size); - bit_rnd.Reset(random_seed); - for (int i = 0; i < bits_to_test; ++i) - { - if (bit_method == 2) - { - bit = (i & 1); - } - else if (bit_method == 3) - { - bit = bit_rnd(2); - } - GTEST_ASSERT_EQ(vp8dx_decode_bool(&br, probas[i]), bit) - << "pos: " - << i << " / " << bits_to_test << " bit_method: " - << bit_method << " method: " << method; - } - - } - } - } -} - -int main(int argc, char **argv) -{ - ::testing::InitGoogleTest(&argc, argv); - return RUN_ALL_TESTS(); -} diff --git a/vp8/vp8_common.mk b/vp8/vp8_common.mk index 3a7b146fc..1fbe5d43b 100644 --- a/vp8/vp8_common.mk +++ b/vp8/vp8_common.mk @@ -30,7 +30,6 @@ VP8_COMMON_SRCS-yes += common/findnearmv.c VP8_COMMON_SRCS-yes += common/generic/systemdependent.c VP8_COMMON_SRCS-yes += common/idct_blk.c VP8_COMMON_SRCS-yes += common/idctllm.c -VP8_COMMON_SRCS-yes += common/idctllm_test.cc VP8_COMMON_SRCS-yes += common/alloccommon.h VP8_COMMON_SRCS-yes += common/blockd.h VP8_COMMON_SRCS-yes += common/common.h @@ -85,7 +84,6 @@ VP8_COMMON_SRCS-$(CONFIG_POSTPROC) += common/postproc.c VP8_COMMON_SRCS-$(HAVE_MMX) += common/x86/dequantize_mmx.asm VP8_COMMON_SRCS-$(HAVE_MMX) += common/x86/idct_blk_mmx.c VP8_COMMON_SRCS-$(HAVE_MMX) += common/x86/idctllm_mmx.asm -VP8_COMMON_SRCS-$(HAVE_MMX) += common/x86/idctllm_mmx_test.cc VP8_COMMON_SRCS-$(HAVE_MMX) += common/x86/iwalsh_mmx.asm VP8_COMMON_SRCS-$(HAVE_MMX) += common/x86/loopfilter_mmx.asm VP8_COMMON_SRCS-$(HAVE_MMX) += common/x86/recon_mmx.asm diff --git a/vp8/vp8cx.mk b/vp8/vp8cx.mk index 28deaf276..5976297bc 100644 --- a/vp8/vp8cx.mk +++ b/vp8/vp8cx.mk @@ -88,8 +88,6 @@ VP8_CX_SRCS-yes += encoder/temporal_filter.c VP8_CX_SRCS-$(CONFIG_MULTI_RES_ENCODING) += encoder/mr_dissim.c VP8_CX_SRCS-$(CONFIG_MULTI_RES_ENCODING) += encoder/mr_dissim.h -VP8_CX_SRCS-$(CONFIG_UNIT_TESTS) += encoder/boolcoder_test.cc - ifeq ($(CONFIG_REALTIME_ONLY),yes) VP8_CX_SRCS_REMOVE-yes += encoder/firstpass.c VP8_CX_SRCS_REMOVE-yes += encoder/temporal_filter.c |