History

test: apply clang-format

clang-format committed 10 years ago

Commit 33e40cb1 parent e42908088 files · +2933 −3658Browse files

Unified · Split

88 files
  1. test/acm_random.h +4 −12
  2. test/active_map_refresh_test.cc +2 −2
  3. test/active_map_test.cc +4 −2
  4. test/add_noise_test.cc +14 −17
  5. test/altref_test.cc +11 −18
  6. test/aq_segment_test.cc +3 −3
  7. test/avg_test.cc +89 −106
  8. test/blockiness_test.cc +17 −25
  9. test/borders_test.cc +5 −4
  10. test/byte_alignment_test.cc +20 −26
  11. test/clear_system_state.h +1 −1
  12. test/codec_factory.h +38 −37
  13. test/config_test.cc +8 −6
  14. test/consistency_test.cc +21 −31
  15. test/convolve_test.cc +271 −369
  16. test/cpu_speed_test.cc +9 −14
  17. test/cq_test.cc +4 −7
  18. test/datarate_test.cc +83 −91
  19. test/dct16x16_test.cc +131 −183
  20. test/dct32x32_test.cc +41 −60
  21. test/decode_api_test.cc +12 −19
  22. test/decode_perf_test.cc +13 −26
  23. test/decode_test_driver.cc +11 −17
  24. test/decode_test_driver.h +30 −42
  25. test/encode_api_test.cc +1 −1
  26. test/encode_perf_test.cc +13 −28
  27. test/encode_test_driver.cc +34 −51
  28. test/encode_test_driver.h +41 −55
  29. test/error_resilience_test.cc +95 −115
  30. test/external_frame_buffer_test.cc +47 −62
  31. test/fdct4x4_test.cc +60 −95
  32. test/fdct8x8_test.cc +94 −133
  33. test/frame_size_tests.cc +12 −13
  34. test/hadamard_test.cc +2 −2
  35. test/i420_video_source.h +4 −7
  36. test/idct8x8_test.cc +10 −18
  37. test/invalid_file_test.cc +32 −35
  38. test/ivf_video_source.h +9 −14
  39. test/keyframe_test.cc +6 −7
  40. test/level_test.cc +3 −6
  41. test/lpf_8_test.cc +221 −271
  42. test/md5_helper.h +10 −9
  43. test/minmax_test.cc +6 −8
  44. test/partial_idct_test.cc +77 −164
  45. test/pp_filter_test.cc +18 −22
  46. test/realtime_test.cc +1 −2
  47. test/register_state_check.h +23 −20
  48. test/resize_test.cc +43 −60
  49. test/sad_test.cc +18 −20
  50. test/set_roi.cc +43 −53
  51. test/sixtap_predict_test.cc +97 −101
  52. test/sum_squares_test.cc +10 −12
  53. test/superframe_test.cc +19 −23
  54. test/svc_test.cc +45 −53
  55. test/test_intra_pred_speed.cc +55 −82
  56. test/test_libvpx.cc +6 −12
  57. test/test_vector_test.cc +15 −22
  58. test/test_vectors.cc +323 −192
  59. test/tile_independence_test.cc +2 −4
  60. test/user_priv_test.cc +2 −2
  61. test/util.h +3 −4
  62. test/variance_test.cc +131 −145
  63. test/video_source.h +14 −29
  64. test/vp8_boolcoder_test.cc +9 −10
  65. test/vp8_decrypt_test.cc +4 −6
  66. test/vp8_denoiser_sse2_test.cc +3 −5
  67. test/vp8_fdct4x4_test.cc +12 −11
  68. test/vp8_fragments_test.cc +2 −3
  69. test/vp9_arf_freq_test.cc +31 −47
  70. test/vp9_boolcoder_test.cc +4 −3
  71. test/vp9_decrypt_test.cc +4 −6
  72. test/vp9_denoiser_sse2_test.cc +13 −15
  73. test/vp9_encoder_parms_get_to_decoder.cc +5 −5
  74. test/vp9_end_to_end_test.cc +34 −47
  75. test/vp9_error_block_test.cc +26 −28
  76. test/vp9_ethread_test.cc +8 −11
  77. test/vp9_frame_parallel_test.cc +14 −17
  78. test/vp9_intrapred_test.cc +92 −93
  79. test/vp9_lossless_test.cc +7 −12
  80. test/vp9_quantize_test.cc +60 −67
  81. test/vp9_skip_loopfilter_test.cc +5 −11
  82. test/vp9_subtract_test.cc +16 −21
  83. test/vp9_thread_test.cc +16 −22
  84. test/vpx_scale_test.cc +20 −39
  85. test/webm_video_source.h +7 −16
  86. test/y4m_test.cc +33 −37
  87. test/y4m_video_source.h +4 −12
  88. test/yuv_video_source.h +17 −44
test/acm_random.h+4−12
@@ -23,9 +23,7 @@ class ACMRandom { · 22 unmodified lines
23 23
24 explicit ACMRandom(int seed) : random_(seed) {}24 explicit ACMRandom(int seed) : random_(seed) {}
25 25
26 void Reset(int seed) {26 void Reset(int seed) { random_.Reseed(seed); }
27 random_.Reseed(seed);
28 }
29 uint16_t Rand16(void) {27 uint16_t Rand16(void) {
30 const uint32_t value =28 const uint32_t value =
31 random_.Generate(testing::internal::Random::kMaxRange);29 random_.Generate(testing::internal::Random::kMaxRange);
@@ -52,17 +50,11 @@ class ACMRandom { · 20 unmodified lines
52 return r < 128 ? r << 4 : r >> 4;50 return r < 128 ? r << 4 : r >> 4;
53 }51 }
54 52
55 int PseudoUniform(int range) {53 int PseudoUniform(int range) { return random_.Generate(range); }
56 return random_.Generate(range);
57 }
58 54
59 int operator()(int n) {55 int operator()(int n) { return PseudoUniform(n); }
60 return PseudoUniform(n);
61 }
62 56
63 static int DeterministicSeed(void) {57 static int DeterministicSeed(void) { return 0xbaba; }
64 return 0xbaba;
65 }
66 58
67 private:59 private:
68 testing::internal::Random random_;60 testing::internal::Random random_;
test/active_map_refresh_test.cc+2−2
@@ -17,8 +17,8 @@ · 16 unmodified lines
17namespace {17namespace {
18 18
19// Check if any pixel in a 16x16 macroblock varies between frames.19// Check if any pixel in a 16x16 macroblock varies between frames.
20int CheckMb(const vpx_image_t &current, const vpx_image_t &previous,20int CheckMb(const vpx_image_t &current, const vpx_image_t &previous, int mb_r,
21 int mb_r, int mb_c) {21 int mb_c) {
22 for (int plane = 0; plane < 3; plane++) {22 for (int plane = 0; plane < 3; plane++) {
23 int r = 16 * mb_r;23 int r = 16 * mb_r;
24 int c0 = 16 * mb_c;24 int c0 = 16 * mb_c;
test/active_map_test.cc+4−2
@@ -39,6 +39,7 @@ class ActiveMapTest · 38 unmodified lines
39 encoder->Control(VP8E_SET_CPUUSED, cpu_used_);39 encoder->Control(VP8E_SET_CPUUSED, cpu_used_);
40 } else if (video->frame() == 3) {40 } else if (video->frame() == 3) {
41 vpx_active_map_t map = vpx_active_map_t();41 vpx_active_map_t map = vpx_active_map_t();
42 /* clang-format off */
42 uint8_t active_map[9 * 13] = {43 uint8_t active_map[9 * 13] = {
43 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0,44 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0,
44 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0,45 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0,
@@ -50,6 +51,7 @@ class ActiveMapTest · 5 unmodified lines
50 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 0, 1, 1,51 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 0, 1, 1,
51 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0,52 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0,
52 };53 };
54 /* clang-format on */
53 map.cols = (kWidth + 15) / 16;55 map.cols = (kWidth + 15) / 16;
54 map.rows = (kHeight + 15) / 16;56 map.rows = (kHeight + 15) / 16;
55 ASSERT_EQ(map.cols, 13u);57 ASSERT_EQ(map.cols, 13u);
@@ -77,8 +79,8 @@ TEST_P(ActiveMapTest, Test) { · 21 unmodified lines
77 cfg_.rc_end_usage = VPX_CBR;79 cfg_.rc_end_usage = VPX_CBR;
78 cfg_.kf_max_dist = 90000;80 cfg_.kf_max_dist = 90000;
79 81
80 ::libvpx_test::I420VideoSource video("hantro_odd.yuv", kWidth, kHeight, 30,82 ::libvpx_test::I420VideoSource video("hantro_odd.yuv", kWidth, kHeight, 30, 1,
81 1, 0, 20);83 0, 20);
82 84
83 ASSERT_NO_FATAL_FAILURE(RunLoop(&video));85 ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
84}86}
test/add_noise_test.cc+14−17
@@ -22,15 +22,12 @@ static const int kNoiseSize = 3072; · 21 unmodified lines
22 22
23// TODO(jimbankoski): make width and height integers not unsigned.23// TODO(jimbankoski): make width and height integers not unsigned.
24typedef void (*AddNoiseFunc)(uint8_t *start, const int8_t *noise,24typedef void (*AddNoiseFunc)(uint8_t *start, const int8_t *noise,
25 int blackclamp, int whiteclamp,25 int blackclamp, int whiteclamp, int width,
26 int width, int height, int pitch);26 int height, int pitch);
27 27
28class AddNoiseTest28class AddNoiseTest : public ::testing::TestWithParam<AddNoiseFunc> {
29 : public ::testing::TestWithParam<AddNoiseFunc> {
30 public:29 public:
31 virtual void TearDown() {30 virtual void TearDown() { libvpx_test::ClearSystemState(); }
32 libvpx_test::ClearSystemState();
33 }
34 virtual ~AddNoiseTest() {}31 virtual ~AddNoiseTest() {}
35};32};
36 33
@@ -43,18 +40,18 @@ double stddev6(char a, char b, char c, char d, char e, char f) { · 6 unmodified lines
43}40}
44 41
45TEST_P(AddNoiseTest, CheckNoiseAdded) {42TEST_P(AddNoiseTest, CheckNoiseAdded) {
46 const int width = 64;43 const int width = 64;
47 const int height = 64;44 const int height = 64;
48 const int image_size = width * height;45 const int image_size = width * height;
49 int8_t noise[kNoiseSize];46 int8_t noise[kNoiseSize];
50 const int clamp = vpx_setup_noise(4.4, noise, kNoiseSize);47 const int clamp = vpx_setup_noise(4.4, noise, kNoiseSize);
51 uint8_t *const s = reinterpret_cast<uint8_t *>(vpx_calloc(image_size,48 uint8_t *const s =
52 sizeof(*s)));49 reinterpret_cast<uint8_t *>(vpx_calloc(image_size, sizeof(*s)));
53 ASSERT_TRUE(s != NULL);50 ASSERT_TRUE(s != NULL);
54 memset(s, 99, image_size * sizeof(*s));51 memset(s, 99, image_size * sizeof(*s));
55 52
56 ASM_REGISTER_STATE_CHECK(GetParam()(s, noise, clamp, clamp,53 ASM_REGISTER_STATE_CHECK(
57 width, height, width));54 GetParam()(s, noise, clamp, clamp, width, height, width));
58 55
59 // Check to make sure we don't end up having either the same or no added56 // Check to make sure we don't end up having either the same or no added
60 // noise either vertically or horizontally.57 // noise either vertically or horizontally.
@@ -72,8 +69,8 @@ TEST_P(AddNoiseTest, CheckNoiseAdded) { · 11 unmodified lines
72 // Initialize pixels in the image to 255 and check for roll over.69 // Initialize pixels in the image to 255 and check for roll over.
73 memset(s, 255, image_size);70 memset(s, 255, image_size);
74 71
75 ASM_REGISTER_STATE_CHECK(GetParam()(s, noise, clamp, clamp,72 ASM_REGISTER_STATE_CHECK(
76 width, height, width));73 GetParam()(s, noise, clamp, clamp, width, height, width));
77 74
78 // Check to make sure don't roll over.75 // Check to make sure don't roll over.
79 for (int i = 0; i < image_size; ++i) {76 for (int i = 0; i < image_size; ++i) {
@@ -83,8 +80,8 @@ TEST_P(AddNoiseTest, CheckNoiseAdded) { · 3 unmodified lines
83 // Initialize pixels in the image to 0 and check for roll under.80 // Initialize pixels in the image to 0 and check for roll under.
84 memset(s, 0, image_size);81 memset(s, 0, image_size);
85 82
86 ASM_REGISTER_STATE_CHECK(GetParam()(s, noise, clamp, clamp,83 ASM_REGISTER_STATE_CHECK(
87 width, height, width));84 GetParam()(s, noise, clamp, clamp, width, height, width));
88 85
89 // Check to make sure don't roll under.86 // Check to make sure don't roll under.
90 for (int i = 0; i < image_size; ++i) {87 for (int i = 0; i < image_size; ++i) {
@@ -95,7 +92,7 @@ TEST_P(AddNoiseTest, CheckNoiseAdded) { · 4 unmodified lines
95}92}
96 93
97TEST_P(AddNoiseTest, CheckCvsAssembly) {94TEST_P(AddNoiseTest, CheckCvsAssembly) {
98 const int width = 64;95 const int width = 64;
99 const int height = 64;96 const int height = 64;
100 const int image_size = width * height;97 const int image_size = width * height;
101 int8_t noise[kNoiseSize];98 int8_t noise[kNoiseSize];
test/altref_test.cc+11−18
@@ -21,7 +21,7 @@ const int kLookAheadMin = 5; · 20 unmodified lines
21const int kLookAheadMax = 26;21const int kLookAheadMax = 26;
22 22
23class AltRefTest : public ::libvpx_test::EncoderTest,23class AltRefTest : public ::libvpx_test::EncoderTest,
24 public ::libvpx_test::CodecTestWithParam<int> {24 public ::libvpx_test::CodecTestWithParam<int> {
25 protected:25 protected:
26 AltRefTest() : EncoderTest(GET_PARAM(0)), altref_count_(0) {}26 AltRefTest() : EncoderTest(GET_PARAM(0)), altref_count_(0) {}
27 virtual ~AltRefTest() {}27 virtual ~AltRefTest() {}
@@ -31,9 +31,7 @@ class AltRefTest : public ::libvpx_test::EncoderTest, · 3 unmodified lines
31 SetMode(libvpx_test::kTwoPassGood);31 SetMode(libvpx_test::kTwoPassGood);
32 }32 }
33 33
34 virtual void BeginPassHook(unsigned int pass) {34 virtual void BeginPassHook(unsigned int pass) { altref_count_ = 0; }
35 altref_count_ = 0;
36 }
37 35
38 virtual void PreEncodeFrameHook(libvpx_test::VideoSource *video,36 virtual void PreEncodeFrameHook(libvpx_test::VideoSource *video,
39 libvpx_test::Encoder *encoder) {37 libvpx_test::Encoder *encoder) {
@@ -75,11 +73,8 @@ class AltRefForcedKeyTestLarge · 35 unmodified lines
75 public ::libvpx_test::CodecTestWith2Params<libvpx_test::TestMode, int> {73 public ::libvpx_test::CodecTestWith2Params<libvpx_test::TestMode, int> {
76 protected:74 protected:
77 AltRefForcedKeyTestLarge()75 AltRefForcedKeyTestLarge()
78 : EncoderTest(GET_PARAM(0)),76 : EncoderTest(GET_PARAM(0)), encoding_mode_(GET_PARAM(1)),
79 encoding_mode_(GET_PARAM(1)),77 cpu_used_(GET_PARAM(2)), forced_kf_frame_num_(1), frame_num_(0) {}
80 cpu_used_(GET_PARAM(2)),
81 forced_kf_frame_num_(1),
82 frame_num_(0) {}
83 virtual ~AltRefForcedKeyTestLarge() {}78 virtual ~AltRefForcedKeyTestLarge() {}
84 79
85 virtual void SetUp() {80 virtual void SetUp() {
@@ -94,8 +89,8 @@ class AltRefForcedKeyTestLarge · 8 unmodified lines
94 if (video->frame() == 0) {89 if (video->frame() == 0) {
95 encoder->Control(VP8E_SET_CPUUSED, cpu_used_);90 encoder->Control(VP8E_SET_CPUUSED, cpu_used_);
96 encoder->Control(VP8E_SET_ENABLEAUTOALTREF, 1);91 encoder->Control(VP8E_SET_ENABLEAUTOALTREF, 1);
97 // override test default for tile columns if necessary.
98#if CONFIG_VP9_ENCODER92#if CONFIG_VP9_ENCODER
93 // override test default for tile columns if necessary.
99 if (GET_PARAM(0) == &libvpx_test::kVP9) {94 if (GET_PARAM(0) == &libvpx_test::kVP9) {
100 encoder->Control(VP9E_SET_TILE_COLUMNS, 6);95 encoder->Control(VP9E_SET_TILE_COLUMNS, 6);
101 }96 }
@@ -147,13 +142,11 @@ TEST_P(AltRefForcedKeyTestLarge, ForcedFrameIsKey) { · 45 unmodified lines
147 }142 }
148}143}
149 144
150VP8_INSTANTIATE_TEST_CASE(145VP8_INSTANTIATE_TEST_CASE(AltRefForcedKeyTestLarge,
151 AltRefForcedKeyTestLarge,146 ::testing::Values(::libvpx_test::kOnePassGood),
152 ::testing::Values(::libvpx_test::kOnePassGood),147 ::testing::Range(0, 9));
153 ::testing::Range(0, 9));
154 148
155VP9_INSTANTIATE_TEST_CASE(149VP9_INSTANTIATE_TEST_CASE(AltRefForcedKeyTestLarge,
156 AltRefForcedKeyTestLarge,150 ::testing::Values(::libvpx_test::kOnePassGood),
157 ::testing::Values(::libvpx_test::kOnePassGood),151 ::testing::Range(0, 9));
158 ::testing::Range(0, 9));
159} // namespace152} // namespace
test/aq_segment_test.cc+3−3
@@ -57,7 +57,7 @@ TEST_P(AqSegmentTest, TestNoMisMatchAQ1) { · 56 unmodified lines
57 aq_mode_ = 1;57 aq_mode_ = 1;
58 58
59 ::libvpx_test::I420VideoSource video("hantro_collage_w352h288.yuv", 352, 288,59 ::libvpx_test::I420VideoSource video("hantro_collage_w352h288.yuv", 352, 288,
60 30, 1, 0, 100);60 30, 1, 0, 100);
61 61
62 ASSERT_NO_FATAL_FAILURE(RunLoop(&video));62 ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
63}63}
@@ -77,7 +77,7 @@ TEST_P(AqSegmentTest, TestNoMisMatchAQ2) { · 13 unmodified lines
77 aq_mode_ = 2;77 aq_mode_ = 2;
78 78
79 ::libvpx_test::I420VideoSource video("hantro_collage_w352h288.yuv", 352, 288,79 ::libvpx_test::I420VideoSource video("hantro_collage_w352h288.yuv", 352, 288,
80 30, 1, 0, 100);80 30, 1, 0, 100);
81 81
82 ASSERT_NO_FATAL_FAILURE(RunLoop(&video));82 ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
83}83}
@@ -97,7 +97,7 @@ TEST_P(AqSegmentTest, TestNoMisMatchAQ3) { · 13 unmodified lines
97 aq_mode_ = 3;97 aq_mode_ = 3;
98 98
99 ::libvpx_test::I420VideoSource video("hantro_collage_w352h288.yuv", 352, 288,99 ::libvpx_test::I420VideoSource video("hantro_collage_w352h288.yuv", 352, 288,
100 30, 1, 0, 100);100 30, 1, 0, 100);
101 101
102 ASSERT_NO_FATAL_FAILURE(RunLoop(&video));102 ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
103}103}
test/avg_test.cc+89−106
@@ -31,7 +31,7 @@ class AverageTestBase : public ::testing::Test { · 30 unmodified lines
31 AverageTestBase(int width, int height) : width_(width), height_(height) {}31 AverageTestBase(int width, int height) : width_(width), height_(height) {}
32 32
33 static void SetUpTestCase() {33 static void SetUpTestCase() {
34 source_data_ = reinterpret_cast<uint8_t*>(34 source_data_ = reinterpret_cast<uint8_t *>(
35 vpx_memalign(kDataAlignment, kDataBlockSize));35 vpx_memalign(kDataAlignment, kDataBlockSize));
36 }36 }
37 37
@@ -40,9 +40,7 @@ class AverageTestBase : public ::testing::Test { · 2 unmodified lines
40 source_data_ = NULL;40 source_data_ = NULL;
41 }41 }
42 42
43 virtual void TearDown() {43 virtual void TearDown() { libvpx_test::ClearSystemState(); }
44 libvpx_test::ClearSystemState();
45 }
46 44
47 protected:45 protected:
48 // Handle blocks up to 4 blocks 64x64 with stride up to 12846 // Handle blocks up to 4 blocks 64x64 with stride up to 128
@@ -55,47 +53,44 @@ class AverageTestBase : public ::testing::Test { · 6 unmodified lines
55 }53 }
56 54
57 // Sum Pixels55 // Sum Pixels
58 unsigned int ReferenceAverage8x8(const uint8_t* source, int pitch) {56 unsigned int ReferenceAverage8x8(const uint8_t *source, int pitch) {
59 unsigned int average = 0;57 unsigned int average = 0;
60 for (int h = 0; h < 8; ++h)58 for (int h = 0; h < 8; ++h)
61 for (int w = 0; w < 8; ++w)59 for (int w = 0; w < 8; ++w) average += source[h * pitch + w];
62 average += source[h * pitch + w];
63 return ((average + 32) >> 6);60 return ((average + 32) >> 6);
64 }61 }
65 62
66 unsigned int ReferenceAverage4x4(const uint8_t* source, int pitch) {63 unsigned int ReferenceAverage4x4(const uint8_t *source, int pitch) {
67 unsigned int average = 0;64 unsigned int average = 0;
68 for (int h = 0; h < 4; ++h)65 for (int h = 0; h < 4; ++h)
69 for (int w = 0; w < 4; ++w)66 for (int w = 0; w < 4; ++w) average += source[h * pitch + w];
70 average += source[h * pitch + w];
71 return ((average + 8) >> 4);67 return ((average + 8) >> 4);
72 }68 }
73 69
74 void FillConstant(uint8_t fill_constant) {70 void FillConstant(uint8_t fill_constant) {
75 for (int i = 0; i < width_ * height_; ++i) {71 for (int i = 0; i < width_ * height_; ++i) {
76 source_data_[i] = fill_constant;72 source_data_[i] = fill_constant;
77 }73 }
78 }74 }
79 75
80 void FillRandom() {76 void FillRandom() {
81 for (int i = 0; i < width_ * height_; ++i) {77 for (int i = 0; i < width_ * height_; ++i) {
82 source_data_[i] = rnd_.Rand8();78 source_data_[i] = rnd_.Rand8();
83 }79 }
84 }80 }
85 81
86 int width_, height_;82 int width_, height_;
87 static uint8_t* source_data_;83 static uint8_t *source_data_;
88 int source_stride_;84 int source_stride_;
89 85
90 ACMRandom rnd_;86 ACMRandom rnd_;
91};87};
92typedef unsigned int (*AverageFunction)(const uint8_t* s, int pitch);88typedef unsigned int (*AverageFunction)(const uint8_t *s, int pitch);
93 89
94typedef std::tr1::tuple<int, int, int, int, AverageFunction> AvgFunc;90typedef std::tr1::tuple<int, int, int, int, AverageFunction> AvgFunc;
95 91
96class AverageTest92class AverageTest : public AverageTestBase,
97 : public AverageTestBase,93 public ::testing::WithParamInterface<AvgFunc> {
98 public ::testing::WithParamInterface<AvgFunc>{
99 public:94 public:
100 AverageTest() : AverageTestBase(GET_PARAM(0), GET_PARAM(1)) {}95 AverageTest() : AverageTestBase(GET_PARAM(0), GET_PARAM(1)) {}
101 96
@@ -103,17 +98,17 @@ class AverageTest · 1 unmodified line
103 void CheckAverages() {98 void CheckAverages() {
104 unsigned int expected = 0;99 unsigned int expected = 0;
105 if (GET_PARAM(3) == 8) {100 if (GET_PARAM(3) == 8) {
106 expected = ReferenceAverage8x8(source_data_+ GET_PARAM(2),101 expected =
107 source_stride_);102 ReferenceAverage8x8(source_data_ + GET_PARAM(2), source_stride_);
108 } else if (GET_PARAM(3) == 4) {103 } else if (GET_PARAM(3) == 4) {
109 expected = ReferenceAverage4x4(source_data_+ GET_PARAM(2),104 expected =
110 source_stride_);105 ReferenceAverage4x4(source_data_ + GET_PARAM(2), source_stride_);
111 }106 }
112 107
113 ASM_REGISTER_STATE_CHECK(GET_PARAM(4)(source_data_+ GET_PARAM(2),108 ASM_REGISTER_STATE_CHECK(
114 source_stride_));109 GET_PARAM(4)(source_data_ + GET_PARAM(2), source_stride_));
115 unsigned int actual = GET_PARAM(4)(source_data_+ GET_PARAM(2),110 unsigned int actual =
116 source_stride_);111 GET_PARAM(4)(source_data_ + GET_PARAM(2), source_stride_);
117 112
118 EXPECT_EQ(expected, actual);113 EXPECT_EQ(expected, actual);
119 }114 }
@@ -124,23 +119,20 @@ typedef void (*IntProRowFunc)(int16_t hbuf[16], uint8_t const *ref, · 4 unmodified lines
124 119
125typedef std::tr1::tuple<int, IntProRowFunc, IntProRowFunc> IntProRowParam;120typedef std::tr1::tuple<int, IntProRowFunc, IntProRowFunc> IntProRowParam;
126 121
127class IntProRowTest122class IntProRowTest : public AverageTestBase,
128 : public AverageTestBase,123 public ::testing::WithParamInterface<IntProRowParam> {
129 public ::testing::WithParamInterface<IntProRowParam> {
130 public:124 public:
131 IntProRowTest()125 IntProRowTest()
132 : AverageTestBase(16, GET_PARAM(0)),126 : AverageTestBase(16, GET_PARAM(0)), hbuf_asm_(NULL), hbuf_c_(NULL) {
133 hbuf_asm_(NULL),
134 hbuf_c_(NULL) {
135 asm_func_ = GET_PARAM(1);127 asm_func_ = GET_PARAM(1);
136 c_func_ = GET_PARAM(2);128 c_func_ = GET_PARAM(2);
137 }129 }
138 130
139 protected:131 protected:
140 virtual void SetUp() {132 virtual void SetUp() {
141 hbuf_asm_ = reinterpret_cast<int16_t*>(133 hbuf_asm_ = reinterpret_cast<int16_t *>(
142 vpx_memalign(kDataAlignment, sizeof(*hbuf_asm_) * 16));134 vpx_memalign(kDataAlignment, sizeof(*hbuf_asm_) * 16));
143 hbuf_c_ = reinterpret_cast<int16_t*>(135 hbuf_c_ = reinterpret_cast<int16_t *>(
144 vpx_memalign(kDataAlignment, sizeof(*hbuf_c_) * 16));136 vpx_memalign(kDataAlignment, sizeof(*hbuf_c_) * 16));
145 }137 }
146 138
@@ -169,9 +161,8 @@ typedef int16_t (*IntProColFunc)(uint8_t const *ref, const int width); · 22 unmodified lines
169 161
170typedef std::tr1::tuple<int, IntProColFunc, IntProColFunc> IntProColParam;162typedef std::tr1::tuple<int, IntProColFunc, IntProColFunc> IntProColParam;
171 163
172class IntProColTest164class IntProColTest : public AverageTestBase,
173 : public AverageTestBase,165 public ::testing::WithParamInterface<IntProColParam> {
174 public ::testing::WithParamInterface<IntProColParam> {
175 public:166 public:
176 IntProColTest() : AverageTestBase(GET_PARAM(0), 1), sum_asm_(0), sum_c_(0) {167 IntProColTest() : AverageTestBase(GET_PARAM(0), 1), sum_asm_(0), sum_c_(0) {
177 asm_func_ = GET_PARAM(1);168 asm_func_ = GET_PARAM(1);
@@ -195,15 +186,14 @@ class IntProColTest · 17 unmodified lines
195typedef int (*SatdFunc)(const int16_t *coeffs, int length);186typedef int (*SatdFunc)(const int16_t *coeffs, int length);
196typedef std::tr1::tuple<int, SatdFunc> SatdTestParam;187typedef std::tr1::tuple<int, SatdFunc> SatdTestParam;
197 188
198class SatdTest189class SatdTest : public ::testing::Test,
199 : public ::testing::Test,190 public ::testing::WithParamInterface<SatdTestParam> {
200 public ::testing::WithParamInterface<SatdTestParam> {
201 protected:191 protected:
202 virtual void SetUp() {192 virtual void SetUp() {
203 satd_size_ = GET_PARAM(0);193 satd_size_ = GET_PARAM(0);
204 satd_func_ = GET_PARAM(1);194 satd_func_ = GET_PARAM(1);
205 rnd_.Reset(ACMRandom::DeterministicSeed());195 rnd_.Reset(ACMRandom::DeterministicSeed());
206 src_ = reinterpret_cast<int16_t*>(196 src_ = reinterpret_cast<int16_t *>(
207 vpx_memalign(16, sizeof(*src_) * satd_size_));197 vpx_memalign(16, sizeof(*src_) * satd_size_));
208 ASSERT_TRUE(src_ != NULL);198 ASSERT_TRUE(src_ != NULL);
209 }199 }
@@ -235,7 +225,7 @@ class SatdTest · 25 unmodified lines
235 ACMRandom rnd_;225 ACMRandom rnd_;
236};226};
237 227
238uint8_t* AverageTestBase::source_data_ = NULL;228uint8_t *AverageTestBase::source_data_ = NULL;
239 229
240TEST_P(AverageTest, MinValue) {230TEST_P(AverageTest, MinValue) {
241 FillConstant(0);231 FillConstant(0);
@@ -286,7 +276,6 @@ TEST_P(IntProColTest, Random) { · 44 unmodified lines
286 RunComparison();276 RunComparison();
287}277}
288 278
289
290TEST_P(SatdTest, MinValue) {279TEST_P(SatdTest, MinValue) {
291 const int kMin = -32640;280 const int kMin = -32640;
292 const int expected = -kMin * satd_size_;281 const int expected = -kMin * satd_size_;
@@ -320,92 +309,86 @@ using std::tr1::make_tuple; · 27 unmodified lines
320 309
321INSTANTIATE_TEST_CASE_P(310INSTANTIATE_TEST_CASE_P(
322 C, AverageTest,311 C, AverageTest,
323 ::testing::Values(312 ::testing::Values(make_tuple(16, 16, 1, 8, &vpx_avg_8x8_c),
324 make_tuple(16, 16, 1, 8, &vpx_avg_8x8_c),313 make_tuple(16, 16, 1, 4, &vpx_avg_4x4_c)));
325 make_tuple(16, 16, 1, 4, &vpx_avg_4x4_c)));
326 314
327INSTANTIATE_TEST_CASE_P(315INSTANTIATE_TEST_CASE_P(C, SatdTest,
328 C, SatdTest,316 ::testing::Values(make_tuple(16, &vpx_satd_c),
329 ::testing::Values(317 make_tuple(64, &vpx_satd_c),
330 make_tuple(16, &vpx_satd_c),318 make_tuple(256, &vpx_satd_c),
331 make_tuple(64, &vpx_satd_c),319 make_tuple(1024, &vpx_satd_c)));
332 make_tuple(256, &vpx_satd_c),
333 make_tuple(1024, &vpx_satd_c)));
334 320
335#if HAVE_SSE2321#if HAVE_SSE2
336INSTANTIATE_TEST_CASE_P(322INSTANTIATE_TEST_CASE_P(
337 SSE2, AverageTest,323 SSE2, AverageTest,
338 ::testing::Values(324 ::testing::Values(make_tuple(16, 16, 0, 8, &vpx_avg_8x8_sse2),
339 make_tuple(16, 16, 0, 8, &vpx_avg_8x8_sse2),325 make_tuple(16, 16, 5, 8, &vpx_avg_8x8_sse2),
340 make_tuple(16, 16, 5, 8, &vpx_avg_8x8_sse2),326 make_tuple(32, 32, 15, 8, &vpx_avg_8x8_sse2),
341 make_tuple(32, 32, 15, 8, &vpx_avg_8x8_sse2),327 make_tuple(16, 16, 0, 4, &vpx_avg_4x4_sse2),
342 make_tuple(16, 16, 0, 4, &vpx_avg_4x4_sse2),328 make_tuple(16, 16, 5, 4, &vpx_avg_4x4_sse2),
343 make_tuple(16, 16, 5, 4, &vpx_avg_4x4_sse2),329 make_tuple(32, 32, 15, 4, &vpx_avg_4x4_sse2)));
344 make_tuple(32, 32, 15, 4, &vpx_avg_4x4_sse2)));
345 330
346INSTANTIATE_TEST_CASE_P(331INSTANTIATE_TEST_CASE_P(
347 SSE2, IntProRowTest, ::testing::Values(332 SSE2, IntProRowTest,
348 make_tuple(16, &vpx_int_pro_row_sse2, &vpx_int_pro_row_c),333 ::testing::Values(make_tuple(16, &vpx_int_pro_row_sse2, &vpx_int_pro_row_c),
349 make_tuple(32, &vpx_int_pro_row_sse2, &vpx_int_pro_row_c),334 make_tuple(32, &vpx_int_pro_row_sse2, &vpx_int_pro_row_c),
350 make_tuple(64, &vpx_int_pro_row_sse2, &vpx_int_pro_row_c)));335 make_tuple(64, &vpx_int_pro_row_sse2,
336 &vpx_int_pro_row_c)));
351 337
352INSTANTIATE_TEST_CASE_P(338INSTANTIATE_TEST_CASE_P(
353 SSE2, IntProColTest, ::testing::Values(339 SSE2, IntProColTest,
354 make_tuple(16, &vpx_int_pro_col_sse2, &vpx_int_pro_col_c),340 ::testing::Values(make_tuple(16, &vpx_int_pro_col_sse2, &vpx_int_pro_col_c),
355 make_tuple(32, &vpx_int_pro_col_sse2, &vpx_int_pro_col_c),341 make_tuple(32, &vpx_int_pro_col_sse2, &vpx_int_pro_col_c),
356 make_tuple(64, &vpx_int_pro_col_sse2, &vpx_int_pro_col_c)));342 make_tuple(64, &vpx_int_pro_col_sse2,
357 343 &vpx_int_pro_col_c)));
358INSTANTIATE_TEST_CASE_P(344
359 SSE2, SatdTest,345INSTANTIATE_TEST_CASE_P(SSE2, SatdTest,
360 ::testing::Values(346 ::testing::Values(make_tuple(16, &vpx_satd_sse2),
361 make_tuple(16, &vpx_satd_sse2),347 make_tuple(64, &vpx_satd_sse2),
362 make_tuple(64, &vpx_satd_sse2),348 make_tuple(256, &vpx_satd_sse2),
363 make_tuple(256, &vpx_satd_sse2),349 make_tuple(1024, &vpx_satd_sse2)));
364 make_tuple(1024, &vpx_satd_sse2)));
365#endif350#endif
366 351
367#if HAVE_NEON352#if HAVE_NEON
368INSTANTIATE_TEST_CASE_P(353INSTANTIATE_TEST_CASE_P(
369 NEON, AverageTest,354 NEON, AverageTest,
370 ::testing::Values(355 ::testing::Values(make_tuple(16, 16, 0, 8, &vpx_avg_8x8_neon),
371 make_tuple(16, 16, 0, 8, &vpx_avg_8x8_neon),356 make_tuple(16, 16, 5, 8, &vpx_avg_8x8_neon),
372 make_tuple(16, 16, 5, 8, &vpx_avg_8x8_neon),357 make_tuple(32, 32, 15, 8, &vpx_avg_8x8_neon),
373 make_tuple(32, 32, 15, 8, &vpx_avg_8x8_neon),358 make_tuple(16, 16, 0, 4, &vpx_avg_4x4_neon),
374 make_tuple(16, 16, 0, 4, &vpx_avg_4x4_neon),359 make_tuple(16, 16, 5, 4, &vpx_avg_4x4_neon),
375 make_tuple(16, 16, 5, 4, &vpx_avg_4x4_neon),360 make_tuple(32, 32, 15, 4, &vpx_avg_4x4_neon)));
376 make_tuple(32, 32, 15, 4, &vpx_avg_4x4_neon)));
377
378INSTANTIATE_TEST_CASE_P(
379 NEON, IntProRowTest, ::testing::Values(
380 make_tuple(16, &vpx_int_pro_row_neon, &vpx_int_pro_row_c),
381 make_tuple(32, &vpx_int_pro_row_neon, &vpx_int_pro_row_c),
382 make_tuple(64, &vpx_int_pro_row_neon, &vpx_int_pro_row_c)));
383 361
384INSTANTIATE_TEST_CASE_P(362INSTANTIATE_TEST_CASE_P(
385 NEON, IntProColTest, ::testing::Values(363 NEON, IntProRowTest,
386 make_tuple(16, &vpx_int_pro_col_neon, &vpx_int_pro_col_c),364 ::testing::Values(make_tuple(16, &vpx_int_pro_row_neon, &vpx_int_pro_row_c),
387 make_tuple(32, &vpx_int_pro_col_neon, &vpx_int_pro_col_c),365 make_tuple(32, &vpx_int_pro_row_neon, &vpx_int_pro_row_c),
388 make_tuple(64, &vpx_int_pro_col_neon, &vpx_int_pro_col_c)));366 make_tuple(64, &vpx_int_pro_row_neon,
367 &vpx_int_pro_row_c)));
389 368
390INSTANTIATE_TEST_CASE_P(369INSTANTIATE_TEST_CASE_P(
391 NEON, SatdTest,370 NEON, IntProColTest,
392 ::testing::Values(371 ::testing::Values(make_tuple(16, &vpx_int_pro_col_neon, &vpx_int_pro_col_c),
393 make_tuple(16, &vpx_satd_neon),372 make_tuple(32, &vpx_int_pro_col_neon, &vpx_int_pro_col_c),
394 make_tuple(64, &vpx_satd_neon),373 make_tuple(64, &vpx_int_pro_col_neon,
395 make_tuple(256, &vpx_satd_neon),374 &vpx_int_pro_col_c)));
396 make_tuple(1024, &vpx_satd_neon)));375
376INSTANTIATE_TEST_CASE_P(NEON, SatdTest,
377 ::testing::Values(make_tuple(16, &vpx_satd_neon),
378 make_tuple(64, &vpx_satd_neon),
379 make_tuple(256, &vpx_satd_neon),
380 make_tuple(1024, &vpx_satd_neon)));
397#endif381#endif
398 382
399#if HAVE_MSA383#if HAVE_MSA
400INSTANTIATE_TEST_CASE_P(384INSTANTIATE_TEST_CASE_P(
401 MSA, AverageTest,385 MSA, AverageTest,
402 ::testing::Values(386 ::testing::Values(make_tuple(16, 16, 0, 8, &vpx_avg_8x8_msa),
403 make_tuple(16, 16, 0, 8, &vpx_avg_8x8_msa),387 make_tuple(16, 16, 5, 8, &vpx_avg_8x8_msa),
404 make_tuple(16, 16, 5, 8, &vpx_avg_8x8_msa),388 make_tuple(32, 32, 15, 8, &vpx_avg_8x8_msa),
405 make_tuple(32, 32, 15, 8, &vpx_avg_8x8_msa),389 make_tuple(16, 16, 0, 4, &vpx_avg_4x4_msa),
406 make_tuple(16, 16, 0, 4, &vpx_avg_4x4_msa),390 make_tuple(16, 16, 5, 4, &vpx_avg_4x4_msa),
407 make_tuple(16, 16, 5, 4, &vpx_avg_4x4_msa),391 make_tuple(32, 32, 15, 4, &vpx_avg_4x4_msa)));
408 make_tuple(32, 32, 15, 4, &vpx_avg_4x4_msa)));
409#endif392#endif
410 393
411} // namespace394} // namespace
test/blockiness_test.cc+17−25
@@ -26,11 +26,9 @@ · 25 unmodified lines
26 26
27#include "vpx_mem/vpx_mem.h"27#include "vpx_mem/vpx_mem.h"
28 28
29 29extern "C" double vp9_get_blockiness(const unsigned char *img1, int img1_pitch,
30extern "C"30 const unsigned char *img2, int img2_pitch,
31double vp9_get_blockiness(const unsigned char *img1, int img1_pitch,31 int width, int height);
32 const unsigned char *img2, int img2_pitch,
33 int width, int height);
34 32
35using libvpx_test::ACMRandom;33using libvpx_test::ACMRandom;
36 34
@@ -40,9 +38,9 @@ class BlockinessTestBase : public ::testing::Test { · 3 unmodified lines
40 BlockinessTestBase(int width, int height) : width_(width), height_(height) {}38 BlockinessTestBase(int width, int height) : width_(width), height_(height) {}
41 39
42 static void SetUpTestCase() {40 static void SetUpTestCase() {
43 source_data_ = reinterpret_cast<uint8_t*>(41 source_data_ = reinterpret_cast<uint8_t *>(
44 vpx_memalign(kDataAlignment, kDataBufferSize));42 vpx_memalign(kDataAlignment, kDataBufferSize));
45 reference_data_ = reinterpret_cast<uint8_t*>(43 reference_data_ = reinterpret_cast<uint8_t *>(
46 vpx_memalign(kDataAlignment, kDataBufferSize));44 vpx_memalign(kDataAlignment, kDataBufferSize));
47 }45 }
48 46
@@ -53,14 +51,12 @@ class BlockinessTestBase : public ::testing::Test { · 4 unmodified lines
53 reference_data_ = NULL;51 reference_data_ = NULL;
54 }52 }
55 53
56 virtual void TearDown() {54 virtual void TearDown() { libvpx_test::ClearSystemState(); }
57 libvpx_test::ClearSystemState();
58 }
59 55
60 protected:56 protected:
61 // Handle frames up to 640x48057 // Handle frames up to 640x480
62 static const int kDataAlignment = 16;58 static const int kDataAlignment = 16;
63 static const int kDataBufferSize = 640*480;59 static const int kDataBufferSize = 640 * 480;
64 60
65 virtual void SetUp() {61 virtual void SetUp() {
66 source_stride_ = (width_ + 31) & ~31;62 source_stride_ = (width_ + 31) & ~31;
@@ -68,8 +64,8 @@ class BlockinessTestBase : public ::testing::Test { · 1 unmodified line
68 rnd_.Reset(ACMRandom::DeterministicSeed());64 rnd_.Reset(ACMRandom::DeterministicSeed());
69 }65 }
70 66
71 void FillConstant(uint8_t *data, int stride, uint8_t fill_constant,67 void FillConstant(uint8_t *data, int stride, uint8_t fill_constant, int width,
72 int width, int height) {68 int height) {
73 for (int h = 0; h < height; ++h) {69 for (int h = 0; h < height; ++h) {
74 for (int w = 0; w < width; ++w) {70 for (int w = 0; w < width; ++w) {
75 data[h * stride + w] = fill_constant;71 data[h * stride + w] = fill_constant;
@@ -104,7 +100,7 @@ class BlockinessTestBase : public ::testing::Test { · 28 unmodified lines
104 void FillCheckerboard(uint8_t *data, int stride) {100 void FillCheckerboard(uint8_t *data, int stride) {
105 for (int h = 0; h < height_; h += 4) {101 for (int h = 0; h < height_; h += 4) {
106 for (int w = 0; w < width_; w += 4) {102 for (int w = 0; w < width_; w += 4) {
107 if (((h/4) ^ (w/4)) & 1)103 if (((h / 4) ^ (w / 4)) & 1)
108 FillConstant(data + h * stride + w, stride, 255, 4, 4);104 FillConstant(data + h * stride + w, stride, 255, 4, 4);
109 else105 else
110 FillConstant(data + h * stride + w, stride, 0, 4, 4);106 FillConstant(data + h * stride + w, stride, 0, 4, 4);
@@ -135,9 +131,9 @@ class BlockinessTestBase : public ::testing::Test { · 24 unmodified lines
135 }131 }
136 }132 }
137 int width_, height_;133 int width_, height_;
138 static uint8_t* source_data_;134 static uint8_t *source_data_;
139 int source_stride_;135 int source_stride_;
140 static uint8_t* reference_data_;136 static uint8_t *reference_data_;
141 int reference_stride_;137 int reference_stride_;
142 138
143 ACMRandom rnd_;139 ACMRandom rnd_;
@@ -153,15 +149,14 @@ class BlockinessVP9Test · 9 unmodified lines
153 149
154 protected:150 protected:
155 double GetBlockiness() const {151 double GetBlockiness() const {
156 return vp9_get_blockiness(source_data_, source_stride_,152 return vp9_get_blockiness(source_data_, source_stride_, reference_data_,
157 reference_data_, reference_stride_,153 reference_stride_, width_, height_);
158 width_, height_);
159 }154 }
160};155};
161#endif // CONFIG_VP9_ENCODER156#endif // CONFIG_VP9_ENCODER
162 157
163uint8_t* BlockinessTestBase::source_data_ = NULL;158uint8_t *BlockinessTestBase::source_data_ = NULL;
164uint8_t* BlockinessTestBase::reference_data_ = NULL;159uint8_t *BlockinessTestBase::reference_data_ = NULL;
165 160
166#if CONFIG_VP9_ENCODER161#if CONFIG_VP9_ENCODER
167TEST_P(BlockinessVP9Test, SourceBlockierThanReference) {162TEST_P(BlockinessVP9Test, SourceBlockierThanReference) {
@@ -212,7 +207,6 @@ TEST_P(BlockinessVP9Test, WorstCaseBlockiness) { · 44 unmodified lines
212}207}
213#endif // CONFIG_VP9_ENCODER208#endif // CONFIG_VP9_ENCODER
214 209
215
216using std::tr1::make_tuple;210using std::tr1::make_tuple;
217 211
218//------------------------------------------------------------------------------212//------------------------------------------------------------------------------
@@ -220,9 +214,7 @@ using std::tr1::make_tuple; · 1 unmodified line
220 214
221#if CONFIG_VP9_ENCODER215#if CONFIG_VP9_ENCODER
222const BlockinessParam c_vp9_tests[] = {216const BlockinessParam c_vp9_tests[] = {
223 make_tuple(320, 240),217 make_tuple(320, 240), make_tuple(318, 242), make_tuple(318, 238),
224 make_tuple(318, 242),
225 make_tuple(318, 238),
226};218};
227INSTANTIATE_TEST_CASE_P(C, BlockinessVP9Test, ::testing::ValuesIn(c_vp9_tests));219INSTANTIATE_TEST_CASE_P(C, BlockinessVP9Test, ::testing::ValuesIn(c_vp9_tests));
228#endif220#endif
test/borders_test.cc+5−4
@@ -17,8 +17,9 @@ · 16 unmodified lines
17 17
18namespace {18namespace {
19 19
20class BordersTest : public ::libvpx_test::EncoderTest,20class BordersTest
21 public ::libvpx_test::CodecTestWithParam<libvpx_test::TestMode> {21 : public ::libvpx_test::EncoderTest,
22 public ::libvpx_test::CodecTestWithParam<libvpx_test::TestMode> {
22 protected:23 protected:
23 BordersTest() : EncoderTest(GET_PARAM(0)) {}24 BordersTest() : EncoderTest(GET_PARAM(0)) {}
24 virtual ~BordersTest() {}25 virtual ~BordersTest() {}
@@ -78,6 +79,6 @@ TEST_P(BordersTest, TestLowBitrate) { · 53 unmodified lines
78 ASSERT_NO_FATAL_FAILURE(RunLoop(&video));79 ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
79}80}
80 81
81VP9_INSTANTIATE_TEST_CASE(BordersTest, ::testing::Values(82VP9_INSTANTIATE_TEST_CASE(BordersTest,
82 ::libvpx_test::kTwoPassGood));83 ::testing::Values(::libvpx_test::kTwoPassGood));
83} // namespace84} // namespace
test/byte_alignment_test.cc+20−26
@@ -36,29 +36,26 @@ struct ByteAlignmentTestParam { · 35 unmodified lines
36};36};
37 37
38const ByteAlignmentTestParam kBaTestParams[] = {38const ByteAlignmentTestParam kBaTestParams[] = {
39 {kLegacyByteAlignment, VPX_CODEC_OK, true},39 { kLegacyByteAlignment, VPX_CODEC_OK, true },
40 {32, VPX_CODEC_OK, true},40 { 32, VPX_CODEC_OK, true },
41 {64, VPX_CODEC_OK, true},41 { 64, VPX_CODEC_OK, true },
42 {128, VPX_CODEC_OK, true},42 { 128, VPX_CODEC_OK, true },
43 {256, VPX_CODEC_OK, true},43 { 256, VPX_CODEC_OK, true },
44 {512, VPX_CODEC_OK, true},44 { 512, VPX_CODEC_OK, true },
45 {1024, VPX_CODEC_OK, true},45 { 1024, VPX_CODEC_OK, true },
46 {1, VPX_CODEC_INVALID_PARAM, false},46 { 1, VPX_CODEC_INVALID_PARAM, false },
47 {-2, VPX_CODEC_INVALID_PARAM, false},47 { -2, VPX_CODEC_INVALID_PARAM, false },
48 {4, VPX_CODEC_INVALID_PARAM, false},48 { 4, VPX_CODEC_INVALID_PARAM, false },
49 {16, VPX_CODEC_INVALID_PARAM, false},49 { 16, VPX_CODEC_INVALID_PARAM, false },
50 {255, VPX_CODEC_INVALID_PARAM, false},50 { 255, VPX_CODEC_INVALID_PARAM, false },
51 {2048, VPX_CODEC_INVALID_PARAM, false},51 { 2048, VPX_CODEC_INVALID_PARAM, false },
52};52};
53 53
54// Class for testing byte alignment of reference buffers.54// Class for testing byte alignment of reference buffers.
55class ByteAlignmentTest55class ByteAlignmentTest
56 : public ::testing::TestWithParam<ByteAlignmentTestParam> {56 : public ::testing::TestWithParam<ByteAlignmentTestParam> {
57 protected:57 protected:
58 ByteAlignmentTest()58 ByteAlignmentTest() : video_(NULL), decoder_(NULL), md5_file_(NULL) {}
59 : video_(NULL),
60 decoder_(NULL),
61 md5_file_(NULL) {}
62 59
63 virtual void SetUp() {60 virtual void SetUp() {
64 video_ = new libvpx_test::WebMVideoSource(kVP9TestFile);61 video_ = new libvpx_test::WebMVideoSource(kVP9TestFile);
@@ -74,8 +71,7 @@ class ByteAlignmentTest · 9 unmodified lines
74 }71 }
75 72
76 virtual void TearDown() {73 virtual void TearDown() {
77 if (md5_file_ != NULL)74 if (md5_file_ != NULL) fclose(md5_file_);
78 fclose(md5_file_);
79 75
80 delete decoder_;76 delete decoder_;
81 delete video_;77 delete video_;
@@ -89,8 +85,7 @@ class ByteAlignmentTest · 7 unmodified lines
89 const vpx_codec_err_t res =85 const vpx_codec_err_t res =
90 decoder_->DecodeFrame(video_->cxdata(), video_->frame_size());86 decoder_->DecodeFrame(video_->cxdata(), video_->frame_size());
91 CheckDecodedFrames(byte_alignment_to_check);87 CheckDecodedFrames(byte_alignment_to_check);
92 if (res == VPX_CODEC_OK)88 if (res == VPX_CODEC_OK) video_->Next();
93 video_->Next();
94 return res;89 return res;
95 }90 }
96 91
@@ -98,8 +93,7 @@ class ByteAlignmentTest · 1 unmodified line
98 for (; video_->cxdata() != NULL; video_->Next()) {93 for (; video_->cxdata() != NULL; video_->Next()) {
99 const vpx_codec_err_t res =94 const vpx_codec_err_t res =
100 decoder_->DecodeFrame(video_->cxdata(), video_->frame_size());95 decoder_->DecodeFrame(video_->cxdata(), video_->frame_size());
101 if (res != VPX_CODEC_OK)96 if (res != VPX_CODEC_OK) return res;
102 return res;
103 CheckDecodedFrames(byte_alignment_to_check);97 CheckDecodedFrames(byte_alignment_to_check);
104 }98 }
105 return VPX_CODEC_OK;99 return VPX_CODEC_OK;
@@ -135,7 +129,7 @@ class ByteAlignmentTest · 29 unmodified lines
135 void OpenMd5File(const std::string &md5_file_name_) {129 void OpenMd5File(const std::string &md5_file_name_) {
136 md5_file_ = libvpx_test::OpenTestDataFile(md5_file_name_);130 md5_file_ = libvpx_test::OpenTestDataFile(md5_file_name_);
137 ASSERT_TRUE(md5_file_ != NULL) << "MD5 file open failed. Filename: "131 ASSERT_TRUE(md5_file_ != NULL) << "MD5 file open failed. Filename: "
138 << md5_file_name_;132 << md5_file_name_;
139 }133 }
140 134
141 void CheckMd5(const vpx_image_t &img) {135 void CheckMd5(const vpx_image_t &img) {
@@ -163,8 +157,8 @@ class ByteAlignmentTest · 21 unmodified lines
163 157
164TEST_F(ByteAlignmentTest, SwitchByteAlignment) {158TEST_F(ByteAlignmentTest, SwitchByteAlignment) {
165 const int num_elements = 14;159 const int num_elements = 14;
166 const int byte_alignments[] = { 0, 32, 64, 128, 256, 512, 1024,160 const int byte_alignments[] = { 0, 32, 64, 128, 256, 512, 1024,
167 0, 1024, 32, 512, 64, 256, 128 };161 0, 1024, 32, 512, 64, 256, 128 };
168 162
169 for (int i = 0; i < num_elements; ++i) {163 for (int i = 0; i < num_elements; ++i) {
170 SetByteAlignment(byte_alignments[i], VPX_CODEC_OK);164 SetByteAlignment(byte_alignments[i], VPX_CODEC_OK);
test/clear_system_state.h+1−1
@@ -12,7 +12,7 @@ · 11 unmodified lines
12 12
13#include "./vpx_config.h"13#include "./vpx_config.h"
14#if ARCH_X86 || ARCH_X86_6414#if ARCH_X86 || ARCH_X86_64
15# include "vpx_ports/x86.h"15#include "vpx_ports/x86.h"
16#endif16#endif
17 17
18namespace libvpx_test {18namespace libvpx_test {
test/codec_factory.h+38−37
@@ -32,15 +32,15 @@ class CodecFactory { · 31 unmodified lines
32 32
33 virtual ~CodecFactory() {}33 virtual ~CodecFactory() {}
34 34
35 virtual Decoder* CreateDecoder(vpx_codec_dec_cfg_t cfg,35 virtual Decoder *CreateDecoder(vpx_codec_dec_cfg_t cfg,
36 unsigned long deadline) const = 0;36 unsigned long deadline) const = 0;
37 37
38 virtual Decoder* CreateDecoder(vpx_codec_dec_cfg_t cfg,38 virtual Decoder *CreateDecoder(vpx_codec_dec_cfg_t cfg,
39 const vpx_codec_flags_t flags,39 const vpx_codec_flags_t flags,
40 unsigned long deadline) // NOLINT(runtime/int)40 unsigned long deadline) // NOLINT(runtime/int)
41 const = 0;41 const = 0;
42 42
43 virtual Encoder* CreateEncoder(vpx_codec_enc_cfg_t cfg,43 virtual Encoder *CreateEncoder(vpx_codec_enc_cfg_t cfg,
44 unsigned long deadline,44 unsigned long deadline,
45 const unsigned long init_flags,45 const unsigned long init_flags,
46 TwopassStatsStore *stats) const = 0;46 TwopassStatsStore *stats) const = 0;
@@ -53,20 +53,20 @@ class CodecFactory { · 6 unmodified lines
53 * to avoid having to include a pointer to the CodecFactory in every test53 * to avoid having to include a pointer to the CodecFactory in every test
54 * definition.54 * definition.
55 */55 */
56template<class T1>56template <class T1>
57class CodecTestWithParam : public ::testing::TestWithParam<57class CodecTestWithParam
58 std::tr1::tuple< const libvpx_test::CodecFactory*, T1 > > {58 : public ::testing::TestWithParam<
59};59 std::tr1::tuple<const libvpx_test::CodecFactory *, T1> > {};
60 60
61template<class T1, class T2>61template <class T1, class T2>
62class CodecTestWith2Params : public ::testing::TestWithParam<62class CodecTestWith2Params
63 std::tr1::tuple< const libvpx_test::CodecFactory*, T1, T2 > > {63 : public ::testing::TestWithParam<
64};64 std::tr1::tuple<const libvpx_test::CodecFactory *, T1, T2> > {};
65 65
66template<class T1, class T2, class T3>66template <class T1, class T2, class T3>
67class CodecTestWith3Params : public ::testing::TestWithParam<67class CodecTestWith3Params
68 std::tr1::tuple< const libvpx_test::CodecFactory*, T1, T2, T3 > > {68 : public ::testing::TestWithParam<
69};69 std::tr1::tuple<const libvpx_test::CodecFactory *, T1, T2, T3> > {};
70 70
71/*71/*
72 * VP8 Codec Definitions72 * VP8 Codec Definitions
@@ -82,7 +82,7 @@ class VP8Decoder : public Decoder { · 9 unmodified lines
82 : Decoder(cfg, flag, deadline) {}82 : Decoder(cfg, flag, deadline) {}
83 83
84 protected:84 protected:
85 virtual vpx_codec_iface_t* CodecInterface() const {85 virtual vpx_codec_iface_t *CodecInterface() const {
86#if CONFIG_VP8_DECODER86#if CONFIG_VP8_DECODER
87 return &vpx_codec_vp8_dx_algo;87 return &vpx_codec_vp8_dx_algo;
88#else88#else
@@ -98,7 +98,7 @@ class VP8Encoder : public Encoder { · 9 unmodified lines
98 : Encoder(cfg, deadline, init_flags, stats) {}98 : Encoder(cfg, deadline, init_flags, stats) {}
99 99
100 protected:100 protected:
101 virtual vpx_codec_iface_t* CodecInterface() const {101 virtual vpx_codec_iface_t *CodecInterface() const {
102#if CONFIG_VP8_ENCODER102#if CONFIG_VP8_ENCODER
103 return &vpx_codec_vp8_cx_algo;103 return &vpx_codec_vp8_cx_algo;
104#else104#else
@@ -111,12 +111,12 @@ class VP8CodecFactory : public CodecFactory { · 6 unmodified lines
111 public:111 public:
112 VP8CodecFactory() : CodecFactory() {}112 VP8CodecFactory() : CodecFactory() {}
113 113
114 virtual Decoder* CreateDecoder(vpx_codec_dec_cfg_t cfg,114 virtual Decoder *CreateDecoder(vpx_codec_dec_cfg_t cfg,
115 unsigned long deadline) const {115 unsigned long deadline) const {
116 return CreateDecoder(cfg, 0, deadline);116 return CreateDecoder(cfg, 0, deadline);
117 }117 }
118 118
119 virtual Decoder* CreateDecoder(vpx_codec_dec_cfg_t cfg,119 virtual Decoder *CreateDecoder(vpx_codec_dec_cfg_t cfg,
120 const vpx_codec_flags_t flags,120 const vpx_codec_flags_t flags,
121 unsigned long deadline) const { // NOLINT121 unsigned long deadline) const { // NOLINT
122#if CONFIG_VP8_DECODER122#if CONFIG_VP8_DECODER
@@ -126,7 +126,7 @@ class VP8CodecFactory : public CodecFactory { · 3 unmodified lines
126#endif126#endif
127 }127 }
128 128
129 virtual Encoder* CreateEncoder(vpx_codec_enc_cfg_t cfg,129 virtual Encoder *CreateEncoder(vpx_codec_enc_cfg_t cfg,
130 unsigned long deadline,130 unsigned long deadline,
131 const unsigned long init_flags,131 const unsigned long init_flags,
132 TwopassStatsStore *stats) const {132 TwopassStatsStore *stats) const {
@@ -149,17 +149,17 @@ class VP8CodecFactory : public CodecFactory { · 16 unmodified lines
149 149
150const libvpx_test::VP8CodecFactory kVP8;150const libvpx_test::VP8CodecFactory kVP8;
151 151
152#define VP8_INSTANTIATE_TEST_CASE(test, ...)\152#define VP8_INSTANTIATE_TEST_CASE(test, ...) \
153 INSTANTIATE_TEST_CASE_P(VP8, test, \153 INSTANTIATE_TEST_CASE_P( \
154 ::testing::Combine( \154 VP8, test, \
155 ::testing::Values(static_cast<const libvpx_test::CodecFactory*>( \155 ::testing::Combine( \
156 &libvpx_test::kVP8)), \156 ::testing::Values(static_cast<const libvpx_test::CodecFactory *>( \
157 &libvpx_test::kVP8)), \
157 __VA_ARGS__))158 __VA_ARGS__))
158#else159#else
159#define VP8_INSTANTIATE_TEST_CASE(test, ...)160#define VP8_INSTANTIATE_TEST_CASE(test, ...)
160#endif // CONFIG_VP8161#endif // CONFIG_VP8
161 162
162
163/*163/*
164 * VP9 Codec Definitions164 * VP9 Codec Definitions
165 */165 */
@@ -174,7 +174,7 @@ class VP9Decoder : public Decoder { · 8 unmodified lines
174 : Decoder(cfg, flag, deadline) {}174 : Decoder(cfg, flag, deadline) {}
175 175
176 protected:176 protected:
177 virtual vpx_codec_iface_t* CodecInterface() const {177 virtual vpx_codec_iface_t *CodecInterface() const {
178#if CONFIG_VP9_DECODER178#if CONFIG_VP9_DECODER
179 return &vpx_codec_vp9_dx_algo;179 return &vpx_codec_vp9_dx_algo;
180#else180#else
@@ -190,7 +190,7 @@ class VP9Encoder : public Encoder { · 9 unmodified lines
190 : Encoder(cfg, deadline, init_flags, stats) {}190 : Encoder(cfg, deadline, init_flags, stats) {}
191 191
192 protected:192 protected:
193 virtual vpx_codec_iface_t* CodecInterface() const {193 virtual vpx_codec_iface_t *CodecInterface() const {
194#if CONFIG_VP9_ENCODER194#if CONFIG_VP9_ENCODER
195 return &vpx_codec_vp9_cx_algo;195 return &vpx_codec_vp9_cx_algo;
196#else196#else
@@ -203,12 +203,12 @@ class VP9CodecFactory : public CodecFactory { · 6 unmodified lines
203 public:203 public:
204 VP9CodecFactory() : CodecFactory() {}204 VP9CodecFactory() : CodecFactory() {}
205 205
206 virtual Decoder* CreateDecoder(vpx_codec_dec_cfg_t cfg,206 virtual Decoder *CreateDecoder(vpx_codec_dec_cfg_t cfg,
207 unsigned long deadline) const {207 unsigned long deadline) const {
208 return CreateDecoder(cfg, 0, deadline);208 return CreateDecoder(cfg, 0, deadline);
209 }209 }
210 210
211 virtual Decoder* CreateDecoder(vpx_codec_dec_cfg_t cfg,211 virtual Decoder *CreateDecoder(vpx_codec_dec_cfg_t cfg,
212 const vpx_codec_flags_t flags,212 const vpx_codec_flags_t flags,
213 unsigned long deadline) const { // NOLINT213 unsigned long deadline) const { // NOLINT
214#if CONFIG_VP9_DECODER214#if CONFIG_VP9_DECODER
@@ -218,7 +218,7 @@ class VP9CodecFactory : public CodecFactory { · 3 unmodified lines
218#endif218#endif
219 }219 }
220 220
221 virtual Encoder* CreateEncoder(vpx_codec_enc_cfg_t cfg,221 virtual Encoder *CreateEncoder(vpx_codec_enc_cfg_t cfg,
222 unsigned long deadline,222 unsigned long deadline,
223 const unsigned long init_flags,223 const unsigned long init_flags,
224 TwopassStatsStore *stats) const {224 TwopassStatsStore *stats) const {
@@ -241,11 +241,12 @@ class VP9CodecFactory : public CodecFactory { · 16 unmodified lines
241 241
242const libvpx_test::VP9CodecFactory kVP9;242const libvpx_test::VP9CodecFactory kVP9;
243 243
244#define VP9_INSTANTIATE_TEST_CASE(test, ...)\244#define VP9_INSTANTIATE_TEST_CASE(test, ...) \
245 INSTANTIATE_TEST_CASE_P(VP9, test, \245 INSTANTIATE_TEST_CASE_P( \
246 ::testing::Combine( \246 VP9, test, \
247 ::testing::Values(static_cast<const libvpx_test::CodecFactory*>( \247 ::testing::Combine( \
248 &libvpx_test::kVP9)), \248 ::testing::Values(static_cast<const libvpx_test::CodecFactory *>( \
249 &libvpx_test::kVP9)), \
249 __VA_ARGS__))250 __VA_ARGS__))
250#else251#else
251#define VP9_INSTANTIATE_TEST_CASE(test, ...)252#define VP9_INSTANTIATE_TEST_CASE(test, ...)
test/config_test.cc+8−6
@@ -15,11 +15,13 @@ · 14 unmodified lines
15 15
16namespace {16namespace {
17 17
18class ConfigTest : public ::libvpx_test::EncoderTest,18class ConfigTest
19 public ::libvpx_test::CodecTestWithParam<libvpx_test::TestMode> {19 : public ::libvpx_test::EncoderTest,
20 public ::libvpx_test::CodecTestWithParam<libvpx_test::TestMode> {
20 protected:21 protected:
21 ConfigTest() : EncoderTest(GET_PARAM(0)),22 ConfigTest()
22 frame_count_in_(0), frame_count_out_(0), frame_count_max_(0) {}23 : EncoderTest(GET_PARAM(0)), frame_count_in_(0), frame_count_out_(0),
24 frame_count_max_(0) {}
23 virtual ~ConfigTest() {}25 virtual ~ConfigTest() {}
24 26
25 virtual void SetUp() {27 virtual void SetUp() {
@@ -32,12 +34,12 @@ class ConfigTest : public ::libvpx_test::EncoderTest, · 6 unmodified lines
32 frame_count_out_ = 0;34 frame_count_out_ = 0;
33 }35 }
34 36
35 virtual void PreEncodeFrameHook(libvpx_test::VideoSource* /*video*/) {37 virtual void PreEncodeFrameHook(libvpx_test::VideoSource * /*video*/) {
36 ++frame_count_in_;38 ++frame_count_in_;
37 abort_ |= (frame_count_in_ >= frame_count_max_);39 abort_ |= (frame_count_in_ >= frame_count_max_);
38 }40 }
39 41
40 virtual void FramePktHook(const vpx_codec_cx_pkt_t* /*pkt*/) {42 virtual void FramePktHook(const vpx_codec_cx_pkt_t * /*pkt*/) {
41 ++frame_count_out_;43 ++frame_count_out_;
42 }44 }
43 45
test/consistency_test.cc+21−31
@@ -26,12 +26,10 @@ · 25 unmodified lines
26#include "vpx_dsp/ssim.h"26#include "vpx_dsp/ssim.h"
27#include "vpx_mem/vpx_mem.h"27#include "vpx_mem/vpx_mem.h"
28 28
29extern "C"29extern "C" double vpx_get_ssim_metrics(uint8_t *img1, int img1_pitch,
30double vpx_get_ssim_metrics(uint8_t *img1, int img1_pitch,30 uint8_t *img2, int img2_pitch, int width,
31 uint8_t *img2, int img2_pitch,31 int height, Ssimv *sv2, Metrics *m,
32 int width, int height,32 int do_inconsistency);
33 Ssimv *sv2, Metrics *m,
34 int do_inconsistency);
35 33
36using libvpx_test::ACMRandom;34using libvpx_test::ACMRandom;
37 35
@@ -41,20 +39,18 @@ class ConsistencyTestBase : public ::testing::Test { · 3 unmodified lines
41 ConsistencyTestBase(int width, int height) : width_(width), height_(height) {}39 ConsistencyTestBase(int width, int height) : width_(width), height_(height) {}
42 40
43 static void SetUpTestCase() {41 static void SetUpTestCase() {
44 source_data_[0] = reinterpret_cast<uint8_t*>(42 source_data_[0] = reinterpret_cast<uint8_t *>(
45 vpx_memalign(kDataAlignment, kDataBufferSize));43 vpx_memalign(kDataAlignment, kDataBufferSize));
46 reference_data_[0] = reinterpret_cast<uint8_t*>(44 reference_data_[0] = reinterpret_cast<uint8_t *>(
47 vpx_memalign(kDataAlignment, kDataBufferSize));45 vpx_memalign(kDataAlignment, kDataBufferSize));
48 source_data_[1] = reinterpret_cast<uint8_t*>(46 source_data_[1] = reinterpret_cast<uint8_t *>(
49 vpx_memalign(kDataAlignment, kDataBufferSize));47 vpx_memalign(kDataAlignment, kDataBufferSize));
50 reference_data_[1] = reinterpret_cast<uint8_t*>(48 reference_data_[1] = reinterpret_cast<uint8_t *>(
51 vpx_memalign(kDataAlignment, kDataBufferSize));49 vpx_memalign(kDataAlignment, kDataBufferSize));
52 ssim_array_ = new Ssimv[kDataBufferSize / 16];50 ssim_array_ = new Ssimv[kDataBufferSize / 16];
53 }51 }
54 52
55 static void ClearSsim() {53 static void ClearSsim() { memset(ssim_array_, 0, kDataBufferSize / 16); }
56 memset(ssim_array_, 0, kDataBufferSize / 16);
57 }
58 static void TearDownTestCase() {54 static void TearDownTestCase() {
59 vpx_free(source_data_[0]);55 vpx_free(source_data_[0]);
60 source_data_[0] = NULL;56 source_data_[0] = NULL;
@@ -68,14 +64,12 @@ class ConsistencyTestBase : public ::testing::Test { · 7 unmodified lines
68 delete[] ssim_array_;64 delete[] ssim_array_;
69 }65 }
70 66
71 virtual void TearDown() {67 virtual void TearDown() { libvpx_test::ClearSystemState(); }
72 libvpx_test::ClearSystemState();
73 }
74 68
75 protected:69 protected:
76 // Handle frames up to 640x48070 // Handle frames up to 640x480
77 static const int kDataAlignment = 16;71 static const int kDataAlignment = 16;
78 static const int kDataBufferSize = 640*480;72 static const int kDataBufferSize = 640 * 480;
79 73
80 virtual void SetUp() {74 virtual void SetUp() {
81 source_stride_ = (width_ + 31) & ~31;75 source_stride_ = (width_ + 31) & ~31;
@@ -122,9 +116,9 @@ class ConsistencyTestBase : public ::testing::Test { · 40 unmodified lines
122 }116 }
123 }117 }
124 int width_, height_;118 int width_, height_;
125 static uint8_t* source_data_[2];119 static uint8_t *source_data_[2];
126 int source_stride_;120 int source_stride_;
127 static uint8_t* reference_data_[2];121 static uint8_t *reference_data_[2];
128 int reference_stride_;122 int reference_stride_;
129 static Ssimv *ssim_array_;123 static Ssimv *ssim_array_;
130 Metrics metrics_;124 Metrics metrics_;
@@ -142,18 +136,17 @@ class ConsistencyVP9Test · 11 unmodified lines
142 136
143 protected:137 protected:
144 double CheckConsistency(int frame) {138 double CheckConsistency(int frame) {
145 EXPECT_LT(frame, 2)<< "Frame to check has to be less than 2.";139 EXPECT_LT(frame, 2) << "Frame to check has to be less than 2.";
146 return140 return vpx_get_ssim_metrics(source_data_[frame], source_stride_,
147 vpx_get_ssim_metrics(source_data_[frame], source_stride_,141 reference_data_[frame], reference_stride_,
148 reference_data_[frame], reference_stride_,142 width_, height_, ssim_array_, &metrics_, 1);
149 width_, height_, ssim_array_, &metrics_, 1);
150 }143 }
151};144};
152#endif // CONFIG_VP9_ENCODER145#endif // CONFIG_VP9_ENCODER
153 146
154uint8_t* ConsistencyTestBase::source_data_[2] = {NULL, NULL};147uint8_t *ConsistencyTestBase::source_data_[2] = { NULL, NULL };
155uint8_t* ConsistencyTestBase::reference_data_[2] = {NULL, NULL};148uint8_t *ConsistencyTestBase::reference_data_[2] = { NULL, NULL };
156Ssimv* ConsistencyTestBase::ssim_array_ = NULL;149Ssimv *ConsistencyTestBase::ssim_array_ = NULL;
157 150
158#if CONFIG_VP9_ENCODER151#if CONFIG_VP9_ENCODER
159TEST_P(ConsistencyVP9Test, ConsistencyIsZero) {152TEST_P(ConsistencyVP9Test, ConsistencyIsZero) {
@@ -205,7 +198,6 @@ TEST_P(ConsistencyVP9Test, ConsistencyIsZero) { · 45 unmodified lines
205}198}
206#endif // CONFIG_VP9_ENCODER199#endif // CONFIG_VP9_ENCODER
207 200
208
209using std::tr1::make_tuple;201using std::tr1::make_tuple;
210 202
211//------------------------------------------------------------------------------203//------------------------------------------------------------------------------
@@ -213,9 +205,7 @@ using std::tr1::make_tuple; · 1 unmodified line
213 205
214#if CONFIG_VP9_ENCODER206#if CONFIG_VP9_ENCODER
215const ConsistencyParam c_vp9_tests[] = {207const ConsistencyParam c_vp9_tests[] = {
216 make_tuple(320, 240),208 make_tuple(320, 240), make_tuple(318, 242), make_tuple(318, 238),
217 make_tuple(318, 242),
218 make_tuple(318, 238),
219};209};
220INSTANTIATE_TEST_CASE_P(C, ConsistencyVP9Test,210INSTANTIATE_TEST_CASE_P(C, ConsistencyVP9Test,
221 ::testing::ValuesIn(c_vp9_tests));211 ::testing::ValuesIn(c_vp9_tests));
test/convolve_test.cc+271−369
@@ -37,14 +37,12 @@ typedef void (*ConvolveFunc)(const uint8_t *src, ptrdiff_t src_stride, · 36 unmodified lines
37 int w, int h);37 int w, int h);
38 38
39struct ConvolveFunctions {39struct ConvolveFunctions {
40 ConvolveFunctions(ConvolveFunc copy, ConvolveFunc avg,40 ConvolveFunctions(ConvolveFunc copy, ConvolveFunc avg, ConvolveFunc h8,
41 ConvolveFunc h8, ConvolveFunc h8_avg,41 ConvolveFunc h8_avg, ConvolveFunc v8, ConvolveFunc v8_avg,
42 ConvolveFunc v8, ConvolveFunc v8_avg,42 ConvolveFunc hv8, ConvolveFunc hv8_avg, ConvolveFunc sh8,
43 ConvolveFunc hv8, ConvolveFunc hv8_avg,43 ConvolveFunc sh8_avg, ConvolveFunc sv8,
44 ConvolveFunc sh8, ConvolveFunc sh8_avg,44 ConvolveFunc sv8_avg, ConvolveFunc shv8,
45 ConvolveFunc sv8, ConvolveFunc sv8_avg,45 ConvolveFunc shv8_avg, int bd)
46 ConvolveFunc shv8, ConvolveFunc shv8_avg,
47 int bd)
48 : copy_(copy), avg_(avg), h8_(h8), v8_(v8), hv8_(hv8), h8_avg_(h8_avg),46 : copy_(copy), avg_(avg), h8_(h8), v8_(v8), hv8_(hv8), h8_avg_(h8_avg),
49 v8_avg_(v8_avg), hv8_avg_(hv8_avg), sh8_(sh8), sv8_(sv8), shv8_(shv8),47 v8_avg_(v8_avg), hv8_avg_(hv8_avg), sh8_(sh8), sv8_(sv8), shv8_(shv8),
50 sh8_avg_(sh8_avg), sv8_avg_(sv8_avg), shv8_avg_(shv8_avg),48 sh8_avg_(sh8_avg), sv8_avg_(sv8_avg), shv8_avg_(shv8_avg),
@@ -58,49 +56,35 @@ struct ConvolveFunctions { · 7 unmodified lines
58 ConvolveFunc h8_avg_;56 ConvolveFunc h8_avg_;
59 ConvolveFunc v8_avg_;57 ConvolveFunc v8_avg_;
60 ConvolveFunc hv8_avg_;58 ConvolveFunc hv8_avg_;
61 ConvolveFunc sh8_; // scaled horiz59 ConvolveFunc sh8_; // scaled horiz
62 ConvolveFunc sv8_; // scaled vert60 ConvolveFunc sv8_; // scaled vert
63 ConvolveFunc shv8_; // scaled horiz/vert61 ConvolveFunc shv8_; // scaled horiz/vert
64 ConvolveFunc sh8_avg_; // scaled avg horiz62 ConvolveFunc sh8_avg_; // scaled avg horiz
65 ConvolveFunc sv8_avg_; // scaled avg vert63 ConvolveFunc sv8_avg_; // scaled avg vert
66 ConvolveFunc shv8_avg_; // scaled avg horiz/vert64 ConvolveFunc shv8_avg_; // scaled avg horiz/vert
67 int use_highbd_; // 0 if high bitdepth not used, else the actual bit depth.65 int use_highbd_; // 0 if high bitdepth not used, else the actual bit depth.
68};66};
69 67
70typedef std::tr1::tuple<int, int, const ConvolveFunctions *> ConvolveParam;68typedef std::tr1::tuple<int, int, const ConvolveFunctions *> ConvolveParam;
71 69
72#define ALL_SIZES(convolve_fn) \70#define ALL_SIZES(convolve_fn) \
73 make_tuple(4, 4, &convolve_fn), \71 make_tuple(4, 4, &convolve_fn), make_tuple(8, 4, &convolve_fn), \
74 make_tuple(8, 4, &convolve_fn), \72 make_tuple(4, 8, &convolve_fn), make_tuple(8, 8, &convolve_fn), \
75 make_tuple(4, 8, &convolve_fn), \73 make_tuple(16, 8, &convolve_fn), make_tuple(8, 16, &convolve_fn), \
76 make_tuple(8, 8, &convolve_fn), \74 make_tuple(16, 16, &convolve_fn), make_tuple(32, 16, &convolve_fn), \
77 make_tuple(16, 8, &convolve_fn), \75 make_tuple(16, 32, &convolve_fn), make_tuple(32, 32, &convolve_fn), \
78 make_tuple(8, 16, &convolve_fn), \76 make_tuple(64, 32, &convolve_fn), make_tuple(32, 64, &convolve_fn), \
79 make_tuple(16, 16, &convolve_fn), \77 make_tuple(64, 64, &convolve_fn)
80 make_tuple(32, 16, &convolve_fn), \
81 make_tuple(16, 32, &convolve_fn), \
82 make_tuple(32, 32, &convolve_fn), \
83 make_tuple(64, 32, &convolve_fn), \
84 make_tuple(32, 64, &convolve_fn), \
85 make_tuple(64, 64, &convolve_fn)
86 78
87// Reference 8-tap subpixel filter, slightly modified to fit into this test.79// Reference 8-tap subpixel filter, slightly modified to fit into this test.
88#define VP9_FILTER_WEIGHT 12880#define VP9_FILTER_WEIGHT 128
89#define VP9_FILTER_SHIFT 781#define VP9_FILTER_SHIFT 7
90uint8_t clip_pixel(int x) {82uint8_t clip_pixel(int x) { return x < 0 ? 0 : x > 255 ? 255 : x; }
91 return x < 0 ? 0 :
92 x > 255 ? 255 :
93 x;
94}
95 83
96void filter_block2d_8_c(const uint8_t *src_ptr,84void filter_block2d_8_c(const uint8_t *src_ptr, const unsigned int src_stride,
97 const unsigned int src_stride,85 const int16_t *HFilter, const int16_t *VFilter,
98 const int16_t *HFilter,86 uint8_t *dst_ptr, unsigned int dst_stride,
99 const int16_t *VFilter,87 unsigned int output_width, unsigned int output_height) {
100 uint8_t *dst_ptr,
101 unsigned int dst_stride,
102 unsigned int output_width,
103 unsigned int output_height) {
104 // Between passes, we use an intermediate buffer whose height is extended to88 // Between passes, we use an intermediate buffer whose height is extended to
105 // have enough horizontally filtered values as input for the vertical pass.89 // have enough horizontally filtered values as input for the vertical pass.
106 // This buffer is allocated to be big enough for the largest block type we90 // This buffer is allocated to be big enough for the largest block type we
@@ -128,15 +112,11 @@ void filter_block2d_8_c(const uint8_t *src_ptr, · 21 unmodified lines
128 for (i = 0; i < intermediate_height; ++i) {112 for (i = 0; i < intermediate_height; ++i) {
129 for (j = 0; j < output_width; ++j) {113 for (j = 0; j < output_width; ++j) {
130 // Apply filter...114 // Apply filter...
131 const int temp = (src_ptr[0] * HFilter[0]) +115 const int temp = (src_ptr[0] * HFilter[0]) + (src_ptr[1] * HFilter[1]) +
132 (src_ptr[1] * HFilter[1]) +116 (src_ptr[2] * HFilter[2]) + (src_ptr[3] * HFilter[3]) +
133 (src_ptr[2] * HFilter[2]) +117 (src_ptr[4] * HFilter[4]) + (src_ptr[5] * HFilter[5]) +
134 (src_ptr[3] * HFilter[3]) +118 (src_ptr[6] * HFilter[6]) + (src_ptr[7] * HFilter[7]) +
135 (src_ptr[4] * HFilter[4]) +119 (VP9_FILTER_WEIGHT >> 1); // Rounding
136 (src_ptr[5] * HFilter[5]) +
137 (src_ptr[6] * HFilter[6]) +
138 (src_ptr[7] * HFilter[7]) +
139 (VP9_FILTER_WEIGHT >> 1); // Rounding
140 120
141 // Normalize back to 0-255...121 // Normalize back to 0-255...
142 *output_ptr = clip_pixel(temp >> VP9_FILTER_SHIFT);122 *output_ptr = clip_pixel(temp >> VP9_FILTER_SHIFT);
@@ -153,15 +133,11 @@ void filter_block2d_8_c(const uint8_t *src_ptr, · 10 unmodified lines
153 for (i = 0; i < output_height; ++i) {133 for (i = 0; i < output_height; ++i) {
154 for (j = 0; j < output_width; ++j) {134 for (j = 0; j < output_width; ++j) {
155 // Apply filter...135 // Apply filter...
156 const int temp = (src_ptr[0] * VFilter[0]) +136 const int temp = (src_ptr[0] * VFilter[0]) + (src_ptr[1] * VFilter[1]) +
157 (src_ptr[1] * VFilter[1]) +137 (src_ptr[2] * VFilter[2]) + (src_ptr[3] * VFilter[3]) +
158 (src_ptr[2] * VFilter[2]) +138 (src_ptr[4] * VFilter[4]) + (src_ptr[5] * VFilter[5]) +
159 (src_ptr[3] * VFilter[3]) +139 (src_ptr[6] * VFilter[6]) + (src_ptr[7] * VFilter[7]) +
160 (src_ptr[4] * VFilter[4]) +140 (VP9_FILTER_WEIGHT >> 1); // Rounding
161 (src_ptr[5] * VFilter[5]) +
162 (src_ptr[6] * VFilter[6]) +
163 (src_ptr[7] * VFilter[7]) +
164 (VP9_FILTER_WEIGHT >> 1); // Rounding
165 141
166 // Normalize back to 0-255...142 // Normalize back to 0-255...
167 *dst_ptr++ = clip_pixel(temp >> VP9_FILTER_SHIFT);143 *dst_ptr++ = clip_pixel(temp >> VP9_FILTER_SHIFT);
@@ -172,12 +148,9 @@ void filter_block2d_8_c(const uint8_t *src_ptr, · 4 unmodified lines
172 }148 }
173}149}
174 150
175void block2d_average_c(uint8_t *src,151void block2d_average_c(uint8_t *src, unsigned int src_stride,
176 unsigned int src_stride,152 uint8_t *output_ptr, unsigned int output_stride,
177 uint8_t *output_ptr,153 unsigned int output_width, unsigned int output_height) {
178 unsigned int output_stride,
179 unsigned int output_width,
180 unsigned int output_height) {
181 unsigned int i, j;154 unsigned int i, j;
182 for (i = 0; i < output_height; ++i) {155 for (i = 0; i < output_height; ++i) {
183 for (j = 0; j < output_width; ++j) {156 for (j = 0; j < output_width; ++j) {
@@ -189,10 +162,8 @@ void block2d_average_c(uint8_t *src, · 5 unmodified lines
189 162
190void filter_average_block2d_8_c(const uint8_t *src_ptr,163void filter_average_block2d_8_c(const uint8_t *src_ptr,
191 const unsigned int src_stride,164 const unsigned int src_stride,
192 const int16_t *HFilter,165 const int16_t *HFilter, const int16_t *VFilter,
193 const int16_t *VFilter,166 uint8_t *dst_ptr, unsigned int dst_stride,
194 uint8_t *dst_ptr,
195 unsigned int dst_stride,
196 unsigned int output_width,167 unsigned int output_width,
197 unsigned int output_height) {168 unsigned int output_height) {
198 uint8_t tmp[kMaxDimension * kMaxDimension];169 uint8_t tmp[kMaxDimension * kMaxDimension];
@@ -201,20 +172,16 @@ void filter_average_block2d_8_c(const uint8_t *src_ptr, · 2 unmodified lines
201 assert(output_height <= kMaxDimension);172 assert(output_height <= kMaxDimension);
202 filter_block2d_8_c(src_ptr, src_stride, HFilter, VFilter, tmp, 64,173 filter_block2d_8_c(src_ptr, src_stride, HFilter, VFilter, tmp, 64,
203 output_width, output_height);174 output_width, output_height);
204 block2d_average_c(tmp, 64, dst_ptr, dst_stride,175 block2d_average_c(tmp, 64, dst_ptr, dst_stride, output_width, output_height);
205 output_width, output_height);
206}176}
207 177
208#if CONFIG_VP9_HIGHBITDEPTH178#if CONFIG_VP9_HIGHBITDEPTH
209void highbd_filter_block2d_8_c(const uint16_t *src_ptr,179void highbd_filter_block2d_8_c(const uint16_t *src_ptr,
210 const unsigned int src_stride,180 const unsigned int src_stride,
211 const int16_t *HFilter,181 const int16_t *HFilter, const int16_t *VFilter,
212 const int16_t *VFilter,182 uint16_t *dst_ptr, unsigned int dst_stride,
213 uint16_t *dst_ptr,
214 unsigned int dst_stride,
215 unsigned int output_width,183 unsigned int output_width,
216 unsigned int output_height,184 unsigned int output_height, int bd) {
217 int bd) {
218 // Between passes, we use an intermediate buffer whose height is extended to185 // Between passes, we use an intermediate buffer whose height is extended to
219 // have enough horizontally filtered values as input for the vertical pass.186 // have enough horizontally filtered values as input for the vertical pass.
220 // This buffer is allocated to be big enough for the largest block type we187 // This buffer is allocated to be big enough for the largest block type we
@@ -243,14 +210,10 @@ void highbd_filter_block2d_8_c(const uint16_t *src_ptr, · 22 unmodified lines
243 for (i = 0; i < intermediate_height; ++i) {210 for (i = 0; i < intermediate_height; ++i) {
244 for (j = 0; j < output_width; ++j) {211 for (j = 0; j < output_width; ++j) {
245 // Apply filter...212 // Apply filter...
246 const int temp = (src_ptr[0] * HFilter[0]) +213 const int temp = (src_ptr[0] * HFilter[0]) + (src_ptr[1] * HFilter[1]) +
247 (src_ptr[1] * HFilter[1]) +214 (src_ptr[2] * HFilter[2]) + (src_ptr[3] * HFilter[3]) +
248 (src_ptr[2] * HFilter[2]) +215 (src_ptr[4] * HFilter[4]) + (src_ptr[5] * HFilter[5]) +
249 (src_ptr[3] * HFilter[3]) +216 (src_ptr[6] * HFilter[6]) + (src_ptr[7] * HFilter[7]) +
250 (src_ptr[4] * HFilter[4]) +
251 (src_ptr[5] * HFilter[5]) +
252 (src_ptr[6] * HFilter[6]) +
253 (src_ptr[7] * HFilter[7]) +
254 (VP9_FILTER_WEIGHT >> 1); // Rounding217 (VP9_FILTER_WEIGHT >> 1); // Rounding
255 218
256 // Normalize back to 0-255...219 // Normalize back to 0-255...
@@ -271,14 +234,10 @@ void highbd_filter_block2d_8_c(const uint16_t *src_ptr, · 14 unmodified lines
271 for (i = 0; i < output_height; ++i) {234 for (i = 0; i < output_height; ++i) {
272 for (j = 0; j < output_width; ++j) {235 for (j = 0; j < output_width; ++j) {
273 // Apply filter...236 // Apply filter...
274 const int temp = (src_ptr[0] * VFilter[0]) +237 const int temp = (src_ptr[0] * VFilter[0]) + (src_ptr[1] * VFilter[1]) +
275 (src_ptr[1] * VFilter[1]) +238 (src_ptr[2] * VFilter[2]) + (src_ptr[3] * VFilter[3]) +
276 (src_ptr[2] * VFilter[2]) +239 (src_ptr[4] * VFilter[4]) + (src_ptr[5] * VFilter[5]) +
277 (src_ptr[3] * VFilter[3]) +240 (src_ptr[6] * VFilter[6]) + (src_ptr[7] * VFilter[7]) +
278 (src_ptr[4] * VFilter[4]) +
279 (src_ptr[5] * VFilter[5]) +
280 (src_ptr[6] * VFilter[6]) +
281 (src_ptr[7] * VFilter[7]) +
282 (VP9_FILTER_WEIGHT >> 1); // Rounding241 (VP9_FILTER_WEIGHT >> 1); // Rounding
283 242
284 // Normalize back to 0-255...243 // Normalize back to 0-255...
@@ -291,10 +250,8 @@ void highbd_filter_block2d_8_c(const uint16_t *src_ptr, · 6 unmodified lines
291 }250 }
292}251}
293 252
294void highbd_block2d_average_c(uint16_t *src,253void highbd_block2d_average_c(uint16_t *src, unsigned int src_stride,
295 unsigned int src_stride,254 uint16_t *output_ptr, unsigned int output_stride,
296 uint16_t *output_ptr,
297 unsigned int output_stride,
298 unsigned int output_width,255 unsigned int output_width,
299 unsigned int output_height) {256 unsigned int output_height) {
300 unsigned int i, j;257 unsigned int i, j;
@@ -306,23 +263,19 @@ void highbd_block2d_average_c(uint16_t *src, · 5 unmodified lines
306 }263 }
307}264}
308 265
309void highbd_filter_average_block2d_8_c(const uint16_t *src_ptr,266void highbd_filter_average_block2d_8_c(
310 const unsigned int src_stride,267 const uint16_t *src_ptr, const unsigned int src_stride,
311 const int16_t *HFilter,268 const int16_t *HFilter, const int16_t *VFilter, uint16_t *dst_ptr,
312 const int16_t *VFilter,269 unsigned int dst_stride, unsigned int output_width,
313 uint16_t *dst_ptr,270 unsigned int output_height, int bd) {
314 unsigned int dst_stride,
315 unsigned int output_width,
316 unsigned int output_height,
317 int bd) {
318 uint16_t tmp[kMaxDimension * kMaxDimension];271 uint16_t tmp[kMaxDimension * kMaxDimension];
319 272
320 assert(output_width <= kMaxDimension);273 assert(output_width <= kMaxDimension);
321 assert(output_height <= kMaxDimension);274 assert(output_height <= kMaxDimension);
322 highbd_filter_block2d_8_c(src_ptr, src_stride, HFilter, VFilter, tmp, 64,275 highbd_filter_block2d_8_c(src_ptr, src_stride, HFilter, VFilter, tmp, 64,
323 output_width, output_height, bd);276 output_width, output_height, bd);
324 highbd_block2d_average_c(tmp, 64, dst_ptr, dst_stride,277 highbd_block2d_average_c(tmp, 64, dst_ptr, dst_stride, output_width,
325 output_width, output_height);278 output_height);
326}279}
327#endif // CONFIG_VP9_HIGHBITDEPTH280#endif // CONFIG_VP9_HIGHBITDEPTH
328 281
@@ -330,19 +283,20 @@ class ConvolveTest : public ::testing::TestWithParam<ConvolveParam> { · 1 unmodified line
330 public:283 public:
331 static void SetUpTestCase() {284 static void SetUpTestCase() {
332 // Force input_ to be unaligned, output to be 16 byte aligned.285 // Force input_ to be unaligned, output to be 16 byte aligned.
333 input_ = reinterpret_cast<uint8_t*>(286 input_ = reinterpret_cast<uint8_t *>(
334 vpx_memalign(kDataAlignment, kInputBufferSize + 1)) + 1;287 vpx_memalign(kDataAlignment, kInputBufferSize + 1)) +
335 output_ = reinterpret_cast<uint8_t*>(288 1;
289 output_ = reinterpret_cast<uint8_t *>(
336 vpx_memalign(kDataAlignment, kOutputBufferSize));290 vpx_memalign(kDataAlignment, kOutputBufferSize));
337 output_ref_ = reinterpret_cast<uint8_t*>(291 output_ref_ = reinterpret_cast<uint8_t *>(
338 vpx_memalign(kDataAlignment, kOutputBufferSize));292 vpx_memalign(kDataAlignment, kOutputBufferSize));
339#if CONFIG_VP9_HIGHBITDEPTH293#if CONFIG_VP9_HIGHBITDEPTH
340 input16_ = reinterpret_cast<uint16_t*>(294 input16_ = reinterpret_cast<uint16_t *>(vpx_memalign(
341 vpx_memalign(kDataAlignment,295 kDataAlignment, (kInputBufferSize + 1) * sizeof(uint16_t))) +
342 (kInputBufferSize + 1) * sizeof(uint16_t))) + 1;296 1;
343 output16_ = reinterpret_cast<uint16_t*>(297 output16_ = reinterpret_cast<uint16_t *>(
344 vpx_memalign(kDataAlignment, (kOutputBufferSize) * sizeof(uint16_t)));298 vpx_memalign(kDataAlignment, (kOutputBufferSize) * sizeof(uint16_t)));
345 output16_ref_ = reinterpret_cast<uint16_t*>(299 output16_ref_ = reinterpret_cast<uint16_t *>(
346 vpx_memalign(kDataAlignment, (kOutputBufferSize) * sizeof(uint16_t)));300 vpx_memalign(kDataAlignment, (kOutputBufferSize) * sizeof(uint16_t)));
347#endif301#endif
348 }302 }
@@ -438,8 +392,7 @@ class ConvolveTest : public ::testing::TestWithParam<ConvolveParam> { · 89 unmodified lines
438 392
439 void CheckGuardBlocks() {393 void CheckGuardBlocks() {
440 for (int i = 0; i < kOutputBufferSize; ++i) {394 for (int i = 0; i < kOutputBufferSize; ++i) {
441 if (IsIndexInBorder(i))395 if (IsIndexInBorder(i)) EXPECT_EQ(255, output_[i]);
442 EXPECT_EQ(255, output_[i]);
443 }396 }
444 }397 }
445 398
@@ -497,98 +450,88 @@ class ConvolveTest : public ::testing::TestWithParam<ConvolveParam> { · 51 unmodified lines
497 void assign_val(uint8_t *list, int index, uint16_t val) const {450 void assign_val(uint8_t *list, int index, uint16_t val) const {
498#if CONFIG_VP9_HIGHBITDEPTH451#if CONFIG_VP9_HIGHBITDEPTH
499 if (UUT_->use_highbd_ == 0) {452 if (UUT_->use_highbd_ == 0) {
500 list[index] = (uint8_t) val;453 list[index] = (uint8_t)val;
501 } else {454 } else {
502 CONVERT_TO_SHORTPTR(list)[index] = val;455 CONVERT_TO_SHORTPTR(list)[index] = val;
503 }456 }
504#else457#else
505 list[index] = (uint8_t) val;458 list[index] = (uint8_t)val;
506#endif459#endif
507 }460 }
508 461
509 void wrapper_filter_average_block2d_8_c(const uint8_t *src_ptr,462 void wrapper_filter_average_block2d_8_c(
510 const unsigned int src_stride,463 const uint8_t *src_ptr, const unsigned int src_stride,
511 const int16_t *HFilter,464 const int16_t *HFilter, const int16_t *VFilter, uint8_t *dst_ptr,
512 const int16_t *VFilter,465 unsigned int dst_stride, unsigned int output_width,
513 uint8_t *dst_ptr,466 unsigned int output_height) {
514 unsigned int dst_stride,
515 unsigned int output_width,
516 unsigned int output_height) {
517#if CONFIG_VP9_HIGHBITDEPTH467#if CONFIG_VP9_HIGHBITDEPTH
518 if (UUT_->use_highbd_ == 0) {468 if (UUT_->use_highbd_ == 0) {
519 filter_average_block2d_8_c(src_ptr, src_stride, HFilter, VFilter,469 filter_average_block2d_8_c(src_ptr, src_stride, HFilter, VFilter, dst_ptr,
520 dst_ptr, dst_stride, output_width,470 dst_stride, output_width, output_height);
521 output_height);
522 } else {471 } else {
523 highbd_filter_average_block2d_8_c(CONVERT_TO_SHORTPTR(src_ptr),472 highbd_filter_average_block2d_8_c(
524 src_stride, HFilter, VFilter,473 CONVERT_TO_SHORTPTR(src_ptr), src_stride, HFilter, VFilter,
525 CONVERT_TO_SHORTPTR(dst_ptr),474 CONVERT_TO_SHORTPTR(dst_ptr), dst_stride, output_width, output_height,
526 dst_stride, output_width, output_height,475 UUT_->use_highbd_);
527 UUT_->use_highbd_);
528 }476 }
529#else477#else
530 filter_average_block2d_8_c(src_ptr, src_stride, HFilter, VFilter,478 filter_average_block2d_8_c(src_ptr, src_stride, HFilter, VFilter, dst_ptr,
531 dst_ptr, dst_stride, output_width,479 dst_stride, output_width, output_height);
532 output_height);
533#endif480#endif
534 }481 }
535 482
536 void wrapper_filter_block2d_8_c(const uint8_t *src_ptr,483 void wrapper_filter_block2d_8_c(const uint8_t *src_ptr,
537 const unsigned int src_stride,484 const unsigned int src_stride,
538 const int16_t *HFilter,485 const int16_t *HFilter,
539 const int16_t *VFilter,486 const int16_t *VFilter, uint8_t *dst_ptr,
540 uint8_t *dst_ptr,
541 unsigned int dst_stride,487 unsigned int dst_stride,
542 unsigned int output_width,488 unsigned int output_width,
543 unsigned int output_height) {489 unsigned int output_height) {
544#if CONFIG_VP9_HIGHBITDEPTH490#if CONFIG_VP9_HIGHBITDEPTH
545 if (UUT_->use_highbd_ == 0) {491 if (UUT_->use_highbd_ == 0) {
546 filter_block2d_8_c(src_ptr, src_stride, HFilter, VFilter,492 filter_block2d_8_c(src_ptr, src_stride, HFilter, VFilter, dst_ptr,
547 dst_ptr, dst_stride, output_width, output_height);493 dst_stride, output_width, output_height);
548 } else {494 } else {
549 highbd_filter_block2d_8_c(CONVERT_TO_SHORTPTR(src_ptr), src_stride,495 highbd_filter_block2d_8_c(CONVERT_TO_SHORTPTR(src_ptr), src_stride,
550 HFilter, VFilter,496 HFilter, VFilter, CONVERT_TO_SHORTPTR(dst_ptr),
551 CONVERT_TO_SHORTPTR(dst_ptr), dst_stride,497 dst_stride, output_width, output_height,
552 output_width, output_height, UUT_->use_highbd_);498 UUT_->use_highbd_);
553 }499 }
554#else500#else
555 filter_block2d_8_c(src_ptr, src_stride, HFilter, VFilter,501 filter_block2d_8_c(src_ptr, src_stride, HFilter, VFilter, dst_ptr,
556 dst_ptr, dst_stride, output_width, output_height);502 dst_stride, output_width, output_height);
557#endif503#endif
558 }504 }
559 505
560 const ConvolveFunctions* UUT_;506 const ConvolveFunctions *UUT_;
561 static uint8_t* input_;507 static uint8_t *input_;
562 static uint8_t* output_;508 static uint8_t *output_;
563 static uint8_t* output_ref_;509 static uint8_t *output_ref_;
564#if CONFIG_VP9_HIGHBITDEPTH510#if CONFIG_VP9_HIGHBITDEPTH
565 static uint16_t* input16_;511 static uint16_t *input16_;
566 static uint16_t* output16_;512 static uint16_t *output16_;
567 static uint16_t* output16_ref_;513 static uint16_t *output16_ref_;
568 int mask_;514 int mask_;
569#endif515#endif
570};516};
571 517
572uint8_t* ConvolveTest::input_ = NULL;518uint8_t *ConvolveTest::input_ = NULL;
573uint8_t* ConvolveTest::output_ = NULL;519uint8_t *ConvolveTest::output_ = NULL;
574uint8_t* ConvolveTest::output_ref_ = NULL;520uint8_t *ConvolveTest::output_ref_ = NULL;
575#if CONFIG_VP9_HIGHBITDEPTH521#if CONFIG_VP9_HIGHBITDEPTH
576uint16_t* ConvolveTest::input16_ = NULL;522uint16_t *ConvolveTest::input16_ = NULL;
577uint16_t* ConvolveTest::output16_ = NULL;523uint16_t *ConvolveTest::output16_ = NULL;
578uint16_t* ConvolveTest::output16_ref_ = NULL;524uint16_t *ConvolveTest::output16_ref_ = NULL;
579#endif525#endif
580 526
581TEST_P(ConvolveTest, GuardBlocks) {527TEST_P(ConvolveTest, GuardBlocks) { CheckGuardBlocks(); }
582 CheckGuardBlocks();
583}
584 528
585TEST_P(ConvolveTest, Copy) {529TEST_P(ConvolveTest, Copy) {
586 uint8_t* const in = input();530 uint8_t *const in = input();
587 uint8_t* const out = output();531 uint8_t *const out = output();
588 532
589 ASM_REGISTER_STATE_CHECK(533 ASM_REGISTER_STATE_CHECK(UUT_->copy_(in, kInputStride, out, kOutputStride,
590 UUT_->copy_(in, kInputStride, out, kOutputStride, NULL, 0, NULL, 0,534 NULL, 0, NULL, 0, Width(), Height()));
591 Width(), Height()));
592 535
593 CheckGuardBlocks();536 CheckGuardBlocks();
594 537
@@ -600,14 +543,13 @@ TEST_P(ConvolveTest, Copy) { · 5 unmodified lines
600}543}
601 544
602TEST_P(ConvolveTest, Avg) {545TEST_P(ConvolveTest, Avg) {
603 uint8_t* const in = input();546 uint8_t *const in = input();
604 uint8_t* const out = output();547 uint8_t *const out = output();
605 uint8_t* const out_ref = output_ref();548 uint8_t *const out_ref = output_ref();
606 CopyOutputToRef();549 CopyOutputToRef();
607 550
608 ASM_REGISTER_STATE_CHECK(551 ASM_REGISTER_STATE_CHECK(UUT_->avg_(in, kInputStride, out, kOutputStride,
609 UUT_->avg_(in, kInputStride, out, kOutputStride, NULL, 0, NULL, 0,552 NULL, 0, NULL, 0, Width(), Height()));
610 Width(), Height()));
611 553
612 CheckGuardBlocks();554 CheckGuardBlocks();
613 555
@@ -615,18 +557,20 @@ TEST_P(ConvolveTest, Avg) { · 1 unmodified line
615 for (int x = 0; x < Width(); ++x)557 for (int x = 0; x < Width(); ++x)
616 ASSERT_EQ(lookup(out, y * kOutputStride + x),558 ASSERT_EQ(lookup(out, y * kOutputStride + x),
617 ROUND_POWER_OF_TWO(lookup(in, y * kInputStride + x) +559 ROUND_POWER_OF_TWO(lookup(in, y * kInputStride + x) +
618 lookup(out_ref, y * kOutputStride + x), 1))560 lookup(out_ref, y * kOutputStride + x),
561 1))
619 << "(" << x << "," << y << ")";562 << "(" << x << "," << y << ")";
620}563}
621 564
622TEST_P(ConvolveTest, CopyHoriz) {565TEST_P(ConvolveTest, CopyHoriz) {
623 uint8_t* const in = input();566 uint8_t *const in = input();
624 uint8_t* const out = output();567 uint8_t *const out = output();
625 DECLARE_ALIGNED(256, const int16_t, filter8[8]) = {0, 0, 0, 128, 0, 0, 0, 0};568 DECLARE_ALIGNED(256, const int16_t,
569 filter8[8]) = { 0, 0, 0, 128, 0, 0, 0, 0 };
626 570
627 ASM_REGISTER_STATE_CHECK(571 ASM_REGISTER_STATE_CHECK(UUT_->sh8_(in, kInputStride, out, kOutputStride,
628 UUT_->sh8_(in, kInputStride, out, kOutputStride, filter8, 16, filter8, 16,572 filter8, 16, filter8, 16, Width(),
629 Width(), Height()));573 Height()));
630 574
631 CheckGuardBlocks();575 CheckGuardBlocks();
632 576
@@ -638,13 +582,14 @@ TEST_P(ConvolveTest, CopyHoriz) { · 5 unmodified lines
638}582}
639 583
640TEST_P(ConvolveTest, CopyVert) {584TEST_P(ConvolveTest, CopyVert) {
641 uint8_t* const in = input();585 uint8_t *const in = input();
642 uint8_t* const out = output();586 uint8_t *const out = output();
643 DECLARE_ALIGNED(256, const int16_t, filter8[8]) = {0, 0, 0, 128, 0, 0, 0, 0};587 DECLARE_ALIGNED(256, const int16_t,
588 filter8[8]) = { 0, 0, 0, 128, 0, 0, 0, 0 };
644 589
645 ASM_REGISTER_STATE_CHECK(590 ASM_REGISTER_STATE_CHECK(UUT_->sv8_(in, kInputStride, out, kOutputStride,
646 UUT_->sv8_(in, kInputStride, out, kOutputStride, filter8, 16, filter8, 16,591 filter8, 16, filter8, 16, Width(),
647 Width(), Height()));592 Height()));
648 593
649 CheckGuardBlocks();594 CheckGuardBlocks();
650 595
@@ -656,13 +601,14 @@ TEST_P(ConvolveTest, CopyVert) { · 5 unmodified lines
656}601}
657 602
658TEST_P(ConvolveTest, Copy2D) {603TEST_P(ConvolveTest, Copy2D) {
659 uint8_t* const in = input();604 uint8_t *const in = input();
660 uint8_t* const out = output();605 uint8_t *const out = output();
661 DECLARE_ALIGNED(256, const int16_t, filter8[8]) = {0, 0, 0, 128, 0, 0, 0, 0};606 DECLARE_ALIGNED(256, const int16_t,
607 filter8[8]) = { 0, 0, 0, 128, 0, 0, 0, 0 };
662 608
663 ASM_REGISTER_STATE_CHECK(609 ASM_REGISTER_STATE_CHECK(UUT_->shv8_(in, kInputStride, out, kOutputStride,
664 UUT_->shv8_(in, kInputStride, out, kOutputStride, filter8, 16, filter8,610 filter8, 16, filter8, 16, Width(),
665 16, Width(), Height()));611 Height()));
666 612
667 CheckGuardBlocks();613 CheckGuardBlocks();
668 614
@@ -700,12 +646,12 @@ TEST(ConvolveTest, FiltersWontSaturateWhenAddedPairwise) { · 31 unmodified lines
700const int16_t kInvalidFilter[8] = { 0 };646const int16_t kInvalidFilter[8] = { 0 };
701 647
702TEST_P(ConvolveTest, MatchesReferenceSubpixelFilter) {648TEST_P(ConvolveTest, MatchesReferenceSubpixelFilter) {
703 uint8_t* const in = input();649 uint8_t *const in = input();
704 uint8_t* const out = output();650 uint8_t *const out = output();
705#if CONFIG_VP9_HIGHBITDEPTH651#if CONFIG_VP9_HIGHBITDEPTH
706 uint8_t ref8[kOutputStride * kMaxDimension];652 uint8_t ref8[kOutputStride * kMaxDimension];
707 uint16_t ref16[kOutputStride * kMaxDimension];653 uint16_t ref16[kOutputStride * kMaxDimension];
708 uint8_t* ref;654 uint8_t *ref;
709 if (UUT_->use_highbd_ == 0) {655 if (UUT_->use_highbd_ == 0) {
710 ref = ref8;656 ref = ref8;
711 } else {657 } else {
@@ -721,31 +667,26 @@ TEST_P(ConvolveTest, MatchesReferenceSubpixelFilter) { · 9 unmodified lines
721 667
722 for (int filter_x = 0; filter_x < kNumFilters; ++filter_x) {668 for (int filter_x = 0; filter_x < kNumFilters; ++filter_x) {
723 for (int filter_y = 0; filter_y < kNumFilters; ++filter_y) {669 for (int filter_y = 0; filter_y < kNumFilters; ++filter_y) {
724 wrapper_filter_block2d_8_c(in, kInputStride,670 wrapper_filter_block2d_8_c(in, kInputStride, filters[filter_x],
725 filters[filter_x], filters[filter_y],671 filters[filter_y], ref, kOutputStride,
726 ref, kOutputStride,
727 Width(), Height());672 Width(), Height());
728 673
729 if (filter_x && filter_y)674 if (filter_x && filter_y)
730 ASM_REGISTER_STATE_CHECK(675 ASM_REGISTER_STATE_CHECK(UUT_->hv8_(
731 UUT_->hv8_(in, kInputStride, out, kOutputStride,676 in, kInputStride, out, kOutputStride, filters[filter_x], 16,
732 filters[filter_x], 16, filters[filter_y], 16,677 filters[filter_y], 16, Width(), Height()));
733 Width(), Height()));
734 else if (filter_y)678 else if (filter_y)
735 ASM_REGISTER_STATE_CHECK(679 ASM_REGISTER_STATE_CHECK(
736 UUT_->v8_(in, kInputStride, out, kOutputStride,680 UUT_->v8_(in, kInputStride, out, kOutputStride, kInvalidFilter,
737 kInvalidFilter, 16, filters[filter_y], 16,681 16, filters[filter_y], 16, Width(), Height()));
738 Width(), Height()));
739 else if (filter_x)682 else if (filter_x)
740 ASM_REGISTER_STATE_CHECK(683 ASM_REGISTER_STATE_CHECK(
741 UUT_->h8_(in, kInputStride, out, kOutputStride,684 UUT_->h8_(in, kInputStride, out, kOutputStride, filters[filter_x],
742 filters[filter_x], 16, kInvalidFilter, 16,685 16, kInvalidFilter, 16, Width(), Height()));
743 Width(), Height()));
744 else686 else
745 ASM_REGISTER_STATE_CHECK(687 ASM_REGISTER_STATE_CHECK(
746 UUT_->copy_(in, kInputStride, out, kOutputStride,688 UUT_->copy_(in, kInputStride, out, kOutputStride, kInvalidFilter,
747 kInvalidFilter, 0, kInvalidFilter, 0,689 0, kInvalidFilter, 0, Width(), Height()));
748 Width(), Height()));
749 690
750 CheckGuardBlocks();691 CheckGuardBlocks();
751 692
@@ -754,20 +695,20 @@ TEST_P(ConvolveTest, MatchesReferenceSubpixelFilter) { · 2 unmodified lines
754 ASSERT_EQ(lookup(ref, y * kOutputStride + x),695 ASSERT_EQ(lookup(ref, y * kOutputStride + x),
755 lookup(out, y * kOutputStride + x))696 lookup(out, y * kOutputStride + x))
756 << "mismatch at (" << x << "," << y << "), "697 << "mismatch at (" << x << "," << y << "), "
757 << "filters (" << filter_bank << ","698 << "filters (" << filter_bank << "," << filter_x << ","
758 << filter_x << "," << filter_y << ")";699 << filter_y << ")";
759 }700 }
760 }701 }
761 }702 }
762}703}
763 704
764TEST_P(ConvolveTest, MatchesReferenceAveragingSubpixelFilter) {705TEST_P(ConvolveTest, MatchesReferenceAveragingSubpixelFilter) {
765 uint8_t* const in = input();706 uint8_t *const in = input();
766 uint8_t* const out = output();707 uint8_t *const out = output();
767#if CONFIG_VP9_HIGHBITDEPTH708#if CONFIG_VP9_HIGHBITDEPTH
768 uint8_t ref8[kOutputStride * kMaxDimension];709 uint8_t ref8[kOutputStride * kMaxDimension];
769 uint16_t ref16[kOutputStride * kMaxDimension];710 uint16_t ref16[kOutputStride * kMaxDimension];
770 uint8_t* ref;711 uint8_t *ref;
771 if (UUT_->use_highbd_ == 0) {712 if (UUT_->use_highbd_ == 0) {
772 ref = ref8;713 ref = ref8;
773 } else {714 } else {
@@ -803,31 +744,26 @@ TEST_P(ConvolveTest, MatchesReferenceAveragingSubpixelFilter) { · 29 unmodified lines
803 744
804 for (int filter_x = 0; filter_x < kNumFilters; ++filter_x) {745 for (int filter_x = 0; filter_x < kNumFilters; ++filter_x) {
805 for (int filter_y = 0; filter_y < kNumFilters; ++filter_y) {746 for (int filter_y = 0; filter_y < kNumFilters; ++filter_y) {
806 wrapper_filter_average_block2d_8_c(in, kInputStride,747 wrapper_filter_average_block2d_8_c(in, kInputStride, filters[filter_x],
807 filters[filter_x], filters[filter_y],748 filters[filter_y], ref,
808 ref, kOutputStride,749 kOutputStride, Width(), Height());
809 Width(), Height());
810 750
811 if (filter_x && filter_y)751 if (filter_x && filter_y)
812 ASM_REGISTER_STATE_CHECK(752 ASM_REGISTER_STATE_CHECK(UUT_->hv8_avg_(
813 UUT_->hv8_avg_(in, kInputStride, out, kOutputStride,753 in, kInputStride, out, kOutputStride, filters[filter_x], 16,
814 filters[filter_x], 16, filters[filter_y], 16,754 filters[filter_y], 16, Width(), Height()));
815 Width(), Height()));
816 else if (filter_y)755 else if (filter_y)
817 ASM_REGISTER_STATE_CHECK(756 ASM_REGISTER_STATE_CHECK(UUT_->v8_avg_(
818 UUT_->v8_avg_(in, kInputStride, out, kOutputStride,757 in, kInputStride, out, kOutputStride, kInvalidFilter, 16,
819 kInvalidFilter, 16, filters[filter_y], 16,758 filters[filter_y], 16, Width(), Height()));
820 Width(), Height()));
821 else if (filter_x)759 else if (filter_x)
822 ASM_REGISTER_STATE_CHECK(760 ASM_REGISTER_STATE_CHECK(UUT_->h8_avg_(
823 UUT_->h8_avg_(in, kInputStride, out, kOutputStride,761 in, kInputStride, out, kOutputStride, filters[filter_x], 16,
824 filters[filter_x], 16, kInvalidFilter, 16,762 kInvalidFilter, 16, Width(), Height()));
825 Width(), Height()));
826 else763 else
827 ASM_REGISTER_STATE_CHECK(764 ASM_REGISTER_STATE_CHECK(
828 UUT_->avg_(in, kInputStride, out, kOutputStride,765 UUT_->avg_(in, kInputStride, out, kOutputStride, kInvalidFilter,
829 kInvalidFilter, 0, kInvalidFilter, 0,766 0, kInvalidFilter, 0, Width(), Height()));
830 Width(), Height()));
831 767
832 CheckGuardBlocks();768 CheckGuardBlocks();
833 769
@@ -836,8 +772,8 @@ TEST_P(ConvolveTest, MatchesReferenceAveragingSubpixelFilter) { · 2 unmodified lines
836 ASSERT_EQ(lookup(ref, y * kOutputStride + x),772 ASSERT_EQ(lookup(ref, y * kOutputStride + x),
837 lookup(out, y * kOutputStride + x))773 lookup(out, y * kOutputStride + x))
838 << "mismatch at (" << x << "," << y << "), "774 << "mismatch at (" << x << "," << y << "), "
839 << "filters (" << filter_bank << ","775 << "filters (" << filter_bank << "," << filter_x << ","
840 << filter_x << "," << filter_y << ")";776 << filter_y << ")";
841 }777 }
842 }778 }
843 }779 }
@@ -884,16 +820,16 @@ TEST_P(ConvolveTest, FilterExtremes) { · 40 unmodified lines
884 for (int y = 0; y < 8; ++y) {820 for (int y = 0; y < 8; ++y) {
885 for (int x = 0; x < 8; ++x) {821 for (int x = 0; x < 8; ++x) {
886#if CONFIG_VP9_HIGHBITDEPTH822#if CONFIG_VP9_HIGHBITDEPTH
887 assign_val(in, y * kOutputStride + x - SUBPEL_TAPS / 2 + 1,823 assign_val(in, y * kOutputStride + x - SUBPEL_TAPS / 2 + 1,
888 ((seed_val >> (axis ? y : x)) & 1) * mask_);824 ((seed_val >> (axis ? y : x)) & 1) * mask_);
889#else825#else
890 assign_val(in, y * kOutputStride + x - SUBPEL_TAPS / 2 + 1,826 assign_val(in, y * kOutputStride + x - SUBPEL_TAPS / 2 + 1,
891 ((seed_val >> (axis ? y : x)) & 1) * 255);827 ((seed_val >> (axis ? y : x)) & 1) * 255);
892#endif828#endif
893 if (axis) seed_val++;829 if (axis) seed_val++;
894 }830 }
895 if (axis)831 if (axis)
896 seed_val-= 8;832 seed_val -= 8;
897 else833 else
898 seed_val++;834 seed_val++;
899 }835 }
@@ -904,38 +840,33 @@ TEST_P(ConvolveTest, FilterExtremes) { · 4 unmodified lines
904 vp9_filter_kernels[static_cast<INTERP_FILTER>(filter_bank)];840 vp9_filter_kernels[static_cast<INTERP_FILTER>(filter_bank)];
905 for (int filter_x = 0; filter_x < kNumFilters; ++filter_x) {841 for (int filter_x = 0; filter_x < kNumFilters; ++filter_x) {
906 for (int filter_y = 0; filter_y < kNumFilters; ++filter_y) {842 for (int filter_y = 0; filter_y < kNumFilters; ++filter_y) {
907 wrapper_filter_block2d_8_c(in, kInputStride,843 wrapper_filter_block2d_8_c(in, kInputStride, filters[filter_x],
908 filters[filter_x], filters[filter_y],844 filters[filter_y], ref, kOutputStride,
909 ref, kOutputStride,
910 Width(), Height());845 Width(), Height());
911 if (filter_x && filter_y)846 if (filter_x && filter_y)
912 ASM_REGISTER_STATE_CHECK(847 ASM_REGISTER_STATE_CHECK(UUT_->hv8_(
913 UUT_->hv8_(in, kInputStride, out, kOutputStride,848 in, kInputStride, out, kOutputStride, filters[filter_x], 16,
914 filters[filter_x], 16, filters[filter_y], 16,849 filters[filter_y], 16, Width(), Height()));
915 Width(), Height()));
916 else if (filter_y)850 else if (filter_y)
917 ASM_REGISTER_STATE_CHECK(851 ASM_REGISTER_STATE_CHECK(UUT_->v8_(
918 UUT_->v8_(in, kInputStride, out, kOutputStride,852 in, kInputStride, out, kOutputStride, kInvalidFilter, 16,
919 kInvalidFilter, 16, filters[filter_y], 16,853 filters[filter_y], 16, Width(), Height()));
920 Width(), Height()));
921 else if (filter_x)854 else if (filter_x)
922 ASM_REGISTER_STATE_CHECK(855 ASM_REGISTER_STATE_CHECK(UUT_->h8_(
923 UUT_->h8_(in, kInputStride, out, kOutputStride,856 in, kInputStride, out, kOutputStride, filters[filter_x], 16,
924 filters[filter_x], 16, kInvalidFilter, 16,857 kInvalidFilter, 16, Width(), Height()));
925 Width(), Height()));
926 else858 else
927 ASM_REGISTER_STATE_CHECK(859 ASM_REGISTER_STATE_CHECK(UUT_->copy_(
928 UUT_->copy_(in, kInputStride, out, kOutputStride,860 in, kInputStride, out, kOutputStride, kInvalidFilter, 0,
929 kInvalidFilter, 0, kInvalidFilter, 0,861 kInvalidFilter, 0, Width(), Height()));
930 Width(), Height()));
931 862
932 for (int y = 0; y < Height(); ++y)863 for (int y = 0; y < Height(); ++y)
933 for (int x = 0; x < Width(); ++x)864 for (int x = 0; x < Width(); ++x)
934 ASSERT_EQ(lookup(ref, y * kOutputStride + x),865 ASSERT_EQ(lookup(ref, y * kOutputStride + x),
935 lookup(out, y * kOutputStride + x))866 lookup(out, y * kOutputStride + x))
936 << "mismatch at (" << x << "," << y << "), "867 << "mismatch at (" << x << "," << y << "), "
937 << "filters (" << filter_bank << ","868 << "filters (" << filter_bank << "," << filter_x << ","
938 << filter_x << "," << filter_y << ")";869 << filter_y << ")";
939 }870 }
940 }871 }
941 }872 }
@@ -946,8 +877,8 @@ TEST_P(ConvolveTest, FilterExtremes) { · 4 unmodified lines
946/* This test exercises that enough rows and columns are filtered with every877/* This test exercises that enough rows and columns are filtered with every
947 possible initial fractional positions and scaling steps. */878 possible initial fractional positions and scaling steps. */
948TEST_P(ConvolveTest, CheckScalingFiltering) {879TEST_P(ConvolveTest, CheckScalingFiltering) {
949 uint8_t* const in = input();880 uint8_t *const in = input();
950 uint8_t* const out = output();881 uint8_t *const out = output();
951 const InterpKernel *const eighttap = vp9_filter_kernels[EIGHTTAP];882 const InterpKernel *const eighttap = vp9_filter_kernels[EIGHTTAP];
952 883
953 SetConstantInput(127);884 SetConstantInput(127);
@@ -956,9 +887,8 @@ TEST_P(ConvolveTest, CheckScalingFiltering) { · 2 unmodified lines
956 for (int step = 1; step <= 32; ++step) {887 for (int step = 1; step <= 32; ++step) {
957 /* Test the horizontal and vertical filters in combination. */888 /* Test the horizontal and vertical filters in combination. */
958 ASM_REGISTER_STATE_CHECK(UUT_->shv8_(in, kInputStride, out, kOutputStride,889 ASM_REGISTER_STATE_CHECK(UUT_->shv8_(in, kInputStride, out, kOutputStride,
959 eighttap[frac], step,890 eighttap[frac], step, eighttap[frac],
960 eighttap[frac], step,891 step, Width(), Height()));
961 Width(), Height()));
962 892
963 CheckGuardBlocks();893 CheckGuardBlocks();
964 894
@@ -966,8 +896,8 @@ TEST_P(ConvolveTest, CheckScalingFiltering) { · 1 unmodified line
966 for (int x = 0; x < Width(); ++x) {896 for (int x = 0; x < Width(); ++x) {
967 ASSERT_EQ(lookup(in, y * kInputStride + x),897 ASSERT_EQ(lookup(in, y * kInputStride + x),
968 lookup(out, y * kOutputStride + x))898 lookup(out, y * kOutputStride + x))
969 << "x == " << x << ", y == " << y899 << "x == " << x << ", y == " << y << ", frac == " << frac
970 << ", frac == " << frac << ", step == " << step;900 << ", step == " << step;
971 }901 }
972 }902 }
973 }903 }
@@ -977,18 +907,14 @@ TEST_P(ConvolveTest, CheckScalingFiltering) { · 3 unmodified lines
977using std::tr1::make_tuple;907using std::tr1::make_tuple;
978 908
979#if CONFIG_VP9_HIGHBITDEPTH909#if CONFIG_VP9_HIGHBITDEPTH
980#define WRAP(func, bd) \910#define WRAP(func, bd) \
981void wrap_ ## func ## _ ## bd(const uint8_t *src, ptrdiff_t src_stride, \911 void wrap_##func##_##bd( \
982 uint8_t *dst, ptrdiff_t dst_stride, \912 const uint8_t *src, ptrdiff_t src_stride, uint8_t *dst, \
983 const int16_t *filter_x, \913 ptrdiff_t dst_stride, const int16_t *filter_x, int filter_x_stride, \
984 int filter_x_stride, \914 const int16_t *filter_y, int filter_y_stride, int w, int h) { \
985 const int16_t *filter_y, \915 vpx_highbd_##func(src, src_stride, dst, dst_stride, filter_x, \
986 int filter_y_stride, \916 filter_x_stride, filter_y, filter_y_stride, w, h, bd); \
987 int w, int h) { \917 }
988 vpx_highbd_ ## func(src, src_stride, dst, dst_stride, filter_x, \
989 filter_x_stride, filter_y, filter_y_stride, \
990 w, h, bd); \
991}
992#if HAVE_SSE2 && ARCH_X86_64918#if HAVE_SSE2 && ARCH_X86_64
993WRAP(convolve_copy_sse2, 8)919WRAP(convolve_copy_sse2, 8)
994WRAP(convolve_avg_sse2, 8)920WRAP(convolve_avg_sse2, 8)
@@ -1043,48 +969,40 @@ WRAP(convolve8_avg_c, 12) · 48 unmodified lines
1043#undef WRAP969#undef WRAP
1044 970
1045const ConvolveFunctions convolve8_c(971const ConvolveFunctions convolve8_c(
1046 wrap_convolve_copy_c_8, wrap_convolve_avg_c_8,972 wrap_convolve_copy_c_8, wrap_convolve_avg_c_8, wrap_convolve8_horiz_c_8,
1047 wrap_convolve8_horiz_c_8, wrap_convolve8_avg_horiz_c_8,973 wrap_convolve8_avg_horiz_c_8, wrap_convolve8_vert_c_8,
1048 wrap_convolve8_vert_c_8, wrap_convolve8_avg_vert_c_8,974 wrap_convolve8_avg_vert_c_8, wrap_convolve8_c_8, wrap_convolve8_avg_c_8,
1049 wrap_convolve8_c_8, wrap_convolve8_avg_c_8,
1050 wrap_convolve8_horiz_c_8, wrap_convolve8_avg_horiz_c_8,975 wrap_convolve8_horiz_c_8, wrap_convolve8_avg_horiz_c_8,
1051 wrap_convolve8_vert_c_8, wrap_convolve8_avg_vert_c_8,976 wrap_convolve8_vert_c_8, wrap_convolve8_avg_vert_c_8, wrap_convolve8_c_8,
1052 wrap_convolve8_c_8, wrap_convolve8_avg_c_8, 8);977 wrap_convolve8_avg_c_8, 8);
1053const ConvolveFunctions convolve10_c(978const ConvolveFunctions convolve10_c(
1054 wrap_convolve_copy_c_10, wrap_convolve_avg_c_10,979 wrap_convolve_copy_c_10, wrap_convolve_avg_c_10, wrap_convolve8_horiz_c_10,
980 wrap_convolve8_avg_horiz_c_10, wrap_convolve8_vert_c_10,
981 wrap_convolve8_avg_vert_c_10, wrap_convolve8_c_10, wrap_convolve8_avg_c_10,
1055 wrap_convolve8_horiz_c_10, wrap_convolve8_avg_horiz_c_10,982 wrap_convolve8_horiz_c_10, wrap_convolve8_avg_horiz_c_10,
1056 wrap_convolve8_vert_c_10, wrap_convolve8_avg_vert_c_10,983 wrap_convolve8_vert_c_10, wrap_convolve8_avg_vert_c_10, wrap_convolve8_c_10,
1057 wrap_convolve8_c_10, wrap_convolve8_avg_c_10,984 wrap_convolve8_avg_c_10, 10);
1058 wrap_convolve8_horiz_c_10, wrap_convolve8_avg_horiz_c_10,
1059 wrap_convolve8_vert_c_10, wrap_convolve8_avg_vert_c_10,
1060 wrap_convolve8_c_10, wrap_convolve8_avg_c_10, 10);
1061const ConvolveFunctions convolve12_c(985const ConvolveFunctions convolve12_c(
1062 wrap_convolve_copy_c_12, wrap_convolve_avg_c_12,986 wrap_convolve_copy_c_12, wrap_convolve_avg_c_12, wrap_convolve8_horiz_c_12,
1063 wrap_convolve8_horiz_c_12, wrap_convolve8_avg_horiz_c_12,987 wrap_convolve8_avg_horiz_c_12, wrap_convolve8_vert_c_12,
1064 wrap_convolve8_vert_c_12, wrap_convolve8_avg_vert_c_12,988 wrap_convolve8_avg_vert_c_12, wrap_convolve8_c_12, wrap_convolve8_avg_c_12,
1065 wrap_convolve8_c_12, wrap_convolve8_avg_c_12,
1066 wrap_convolve8_horiz_c_12, wrap_convolve8_avg_horiz_c_12,989 wrap_convolve8_horiz_c_12, wrap_convolve8_avg_horiz_c_12,
1067 wrap_convolve8_vert_c_12, wrap_convolve8_avg_vert_c_12,990 wrap_convolve8_vert_c_12, wrap_convolve8_avg_vert_c_12, wrap_convolve8_c_12,
1068 wrap_convolve8_c_12, wrap_convolve8_avg_c_12, 12);991 wrap_convolve8_avg_c_12, 12);
1069const ConvolveParam kArrayConvolve_c[] = {992const ConvolveParam kArrayConvolve_c[] = {
1070 ALL_SIZES(convolve8_c),993 ALL_SIZES(convolve8_c), ALL_SIZES(convolve10_c), ALL_SIZES(convolve12_c)
1071 ALL_SIZES(convolve10_c),
1072 ALL_SIZES(convolve12_c)
1073};994};
1074 995
1075#else996#else
1076const ConvolveFunctions convolve8_c(997const ConvolveFunctions convolve8_c(
1077 vpx_convolve_copy_c, vpx_convolve_avg_c,998 vpx_convolve_copy_c, vpx_convolve_avg_c, vpx_convolve8_horiz_c,
1078 vpx_convolve8_horiz_c, vpx_convolve8_avg_horiz_c,999 vpx_convolve8_avg_horiz_c, vpx_convolve8_vert_c, vpx_convolve8_avg_vert_c,
1079 vpx_convolve8_vert_c, vpx_convolve8_avg_vert_c,1000 vpx_convolve8_c, vpx_convolve8_avg_c, vpx_scaled_horiz_c,
1080 vpx_convolve8_c, vpx_convolve8_avg_c,1001 vpx_scaled_avg_horiz_c, vpx_scaled_vert_c, vpx_scaled_avg_vert_c,
1081 vpx_scaled_horiz_c, vpx_scaled_avg_horiz_c,
1082 vpx_scaled_vert_c, vpx_scaled_avg_vert_c,
1083 vpx_scaled_2d_c, vpx_scaled_avg_2d_c, 0);1002 vpx_scaled_2d_c, vpx_scaled_avg_2d_c, 0);
1084const ConvolveParam kArrayConvolve_c[] = { ALL_SIZES(convolve8_c) };1003const ConvolveParam kArrayConvolve_c[] = { ALL_SIZES(convolve8_c) };
1085#endif1004#endif
1086INSTANTIATE_TEST_CASE_P(C, ConvolveTest,1005INSTANTIATE_TEST_CASE_P(C, ConvolveTest, ::testing::ValuesIn(kArrayConvolve_c));
1087 ::testing::ValuesIn(kArrayConvolve_c));
1088 1006
1089#if HAVE_SSE2 && ARCH_X86_641007#if HAVE_SSE2 && ARCH_X86_64
1090#if CONFIG_VP9_HIGHBITDEPTH1008#if CONFIG_VP9_HIGHBITDEPTH
@@ -1112,20 +1030,16 @@ const ConvolveFunctions convolve12_sse2( · 21 unmodified lines
1112 wrap_convolve8_horiz_sse2_12, wrap_convolve8_avg_horiz_sse2_12,1030 wrap_convolve8_horiz_sse2_12, wrap_convolve8_avg_horiz_sse2_12,
1113 wrap_convolve8_vert_sse2_12, wrap_convolve8_avg_vert_sse2_12,1031 wrap_convolve8_vert_sse2_12, wrap_convolve8_avg_vert_sse2_12,
1114 wrap_convolve8_sse2_12, wrap_convolve8_avg_sse2_12, 12);1032 wrap_convolve8_sse2_12, wrap_convolve8_avg_sse2_12, 12);
1115const ConvolveParam kArrayConvolve_sse2[] = {1033const ConvolveParam kArrayConvolve_sse2[] = { ALL_SIZES(convolve8_sse2),
1116 ALL_SIZES(convolve8_sse2),1034 ALL_SIZES(convolve10_sse2),
1117 ALL_SIZES(convolve10_sse2),1035 ALL_SIZES(convolve12_sse2) };
1118 ALL_SIZES(convolve12_sse2)
1119};
1120#else1036#else
1121const ConvolveFunctions convolve8_sse2(1037const ConvolveFunctions convolve8_sse2(
1122 vpx_convolve_copy_sse2, vpx_convolve_avg_sse2,1038 vpx_convolve_copy_sse2, vpx_convolve_avg_sse2, vpx_convolve8_horiz_sse2,
1123 vpx_convolve8_horiz_sse2, vpx_convolve8_avg_horiz_sse2,1039 vpx_convolve8_avg_horiz_sse2, vpx_convolve8_vert_sse2,
1124 vpx_convolve8_vert_sse2, vpx_convolve8_avg_vert_sse2,1040 vpx_convolve8_avg_vert_sse2, vpx_convolve8_sse2, vpx_convolve8_avg_sse2,
1125 vpx_convolve8_sse2, vpx_convolve8_avg_sse2,1041 vpx_scaled_horiz_c, vpx_scaled_avg_horiz_c, vpx_scaled_vert_c,
1126 vpx_scaled_horiz_c, vpx_scaled_avg_horiz_c,1042 vpx_scaled_avg_vert_c, vpx_scaled_2d_c, vpx_scaled_avg_2d_c, 0);
1127 vpx_scaled_vert_c, vpx_scaled_avg_vert_c,
1128 vpx_scaled_2d_c, vpx_scaled_avg_2d_c, 0);
1129 1043
1130const ConvolveParam kArrayConvolve_sse2[] = { ALL_SIZES(convolve8_sse2) };1044const ConvolveParam kArrayConvolve_sse2[] = { ALL_SIZES(convolve8_sse2) };
1131#endif // CONFIG_VP9_HIGHBITDEPTH1045#endif // CONFIG_VP9_HIGHBITDEPTH
@@ -1135,13 +1049,11 @@ INSTANTIATE_TEST_CASE_P(SSE2, ConvolveTest, · 3 unmodified lines
1135 1049
1136#if HAVE_SSSE31050#if HAVE_SSSE3
1137const ConvolveFunctions convolve8_ssse3(1051const ConvolveFunctions convolve8_ssse3(
1138 vpx_convolve_copy_c, vpx_convolve_avg_c,1052 vpx_convolve_copy_c, vpx_convolve_avg_c, vpx_convolve8_horiz_ssse3,
1139 vpx_convolve8_horiz_ssse3, vpx_convolve8_avg_horiz_ssse3,1053 vpx_convolve8_avg_horiz_ssse3, vpx_convolve8_vert_ssse3,
1140 vpx_convolve8_vert_ssse3, vpx_convolve8_avg_vert_ssse3,1054 vpx_convolve8_avg_vert_ssse3, vpx_convolve8_ssse3, vpx_convolve8_avg_ssse3,
1141 vpx_convolve8_ssse3, vpx_convolve8_avg_ssse3,1055 vpx_scaled_horiz_c, vpx_scaled_avg_horiz_c, vpx_scaled_vert_c,
1142 vpx_scaled_horiz_c, vpx_scaled_avg_horiz_c,1056 vpx_scaled_avg_vert_c, vpx_scaled_2d_ssse3, vpx_scaled_avg_2d_c, 0);
1143 vpx_scaled_vert_c, vpx_scaled_avg_vert_c,
1144 vpx_scaled_2d_ssse3, vpx_scaled_avg_2d_c, 0);
1145 1057
1146const ConvolveParam kArrayConvolve8_ssse3[] = { ALL_SIZES(convolve8_ssse3) };1058const ConvolveParam kArrayConvolve8_ssse3[] = { ALL_SIZES(convolve8_ssse3) };
1147INSTANTIATE_TEST_CASE_P(SSSE3, ConvolveTest,1059INSTANTIATE_TEST_CASE_P(SSSE3, ConvolveTest,
@@ -1150,13 +1062,11 @@ INSTANTIATE_TEST_CASE_P(SSSE3, ConvolveTest, · 2 unmodified lines
1150 1062
1151#if HAVE_AVX2 && HAVE_SSSE31063#if HAVE_AVX2 && HAVE_SSSE3
1152const ConvolveFunctions convolve8_avx2(1064const ConvolveFunctions convolve8_avx2(
1153 vpx_convolve_copy_c, vpx_convolve_avg_c,1065 vpx_convolve_copy_c, vpx_convolve_avg_c, vpx_convolve8_horiz_avx2,
1154 vpx_convolve8_horiz_avx2, vpx_convolve8_avg_horiz_ssse3,1066 vpx_convolve8_avg_horiz_ssse3, vpx_convolve8_vert_avx2,
1155 vpx_convolve8_vert_avx2, vpx_convolve8_avg_vert_ssse3,1067 vpx_convolve8_avg_vert_ssse3, vpx_convolve8_avx2, vpx_convolve8_avg_ssse3,
1156 vpx_convolve8_avx2, vpx_convolve8_avg_ssse3,1068 vpx_scaled_horiz_c, vpx_scaled_avg_horiz_c, vpx_scaled_vert_c,
1157 vpx_scaled_horiz_c, vpx_scaled_avg_horiz_c,1069 vpx_scaled_avg_vert_c, vpx_scaled_2d_c, vpx_scaled_avg_2d_c, 0);
1158 vpx_scaled_vert_c, vpx_scaled_avg_vert_c,
1159 vpx_scaled_2d_c, vpx_scaled_avg_2d_c, 0);
1160 1070
1161const ConvolveParam kArrayConvolve8_avx2[] = { ALL_SIZES(convolve8_avx2) };1071const ConvolveParam kArrayConvolve8_avx2[] = { ALL_SIZES(convolve8_avx2) };
1162INSTANTIATE_TEST_CASE_P(AVX2, ConvolveTest,1072INSTANTIATE_TEST_CASE_P(AVX2, ConvolveTest,
@@ -1166,22 +1076,18 @@ INSTANTIATE_TEST_CASE_P(AVX2, ConvolveTest, · 3 unmodified lines
1166#if HAVE_NEON1076#if HAVE_NEON
1167#if HAVE_NEON_ASM1077#if HAVE_NEON_ASM
1168const ConvolveFunctions convolve8_neon(1078const ConvolveFunctions convolve8_neon(
1169 vpx_convolve_copy_neon, vpx_convolve_avg_neon,1079 vpx_convolve_copy_neon, vpx_convolve_avg_neon, vpx_convolve8_horiz_neon,
1170 vpx_convolve8_horiz_neon, vpx_convolve8_avg_horiz_neon,1080 vpx_convolve8_avg_horiz_neon, vpx_convolve8_vert_neon,
1171 vpx_convolve8_vert_neon, vpx_convolve8_avg_vert_neon,1081 vpx_convolve8_avg_vert_neon, vpx_convolve8_neon, vpx_convolve8_avg_neon,
1172 vpx_convolve8_neon, vpx_convolve8_avg_neon,1082 vpx_scaled_horiz_c, vpx_scaled_avg_horiz_c, vpx_scaled_vert_c,
1173 vpx_scaled_horiz_c, vpx_scaled_avg_horiz_c,1083 vpx_scaled_avg_vert_c, vpx_scaled_2d_c, vpx_scaled_avg_2d_c, 0);
1174 vpx_scaled_vert_c, vpx_scaled_avg_vert_c,1084#else // HAVE_NEON
1175 vpx_scaled_2d_c, vpx_scaled_avg_2d_c, 0);
1176#else // HAVE_NEON
1177const ConvolveFunctions convolve8_neon(1085const ConvolveFunctions convolve8_neon(
1178 vpx_convolve_copy_neon, vpx_convolve_avg_neon,1086 vpx_convolve_copy_neon, vpx_convolve_avg_neon, vpx_convolve8_horiz_neon,
1179 vpx_convolve8_horiz_neon, vpx_convolve8_avg_horiz_neon,1087 vpx_convolve8_avg_horiz_neon, vpx_convolve8_vert_neon,
1180 vpx_convolve8_vert_neon, vpx_convolve8_avg_vert_neon,1088 vpx_convolve8_avg_vert_neon, vpx_convolve8_neon, vpx_convolve8_avg_neon,
1181 vpx_convolve8_neon, vpx_convolve8_avg_neon,1089 vpx_scaled_horiz_c, vpx_scaled_avg_horiz_c, vpx_scaled_vert_c,
1182 vpx_scaled_horiz_c, vpx_scaled_avg_horiz_c,1090 vpx_scaled_avg_vert_c, vpx_scaled_2d_c, vpx_scaled_avg_2d_c, 0);
1183 vpx_scaled_vert_c, vpx_scaled_avg_vert_c,
1184 vpx_scaled_2d_c, vpx_scaled_avg_2d_c, 0);
1185#endif // HAVE_NEON_ASM1091#endif // HAVE_NEON_ASM
1186 1092
1187const ConvolveParam kArrayConvolve8_neon[] = { ALL_SIZES(convolve8_neon) };1093const ConvolveParam kArrayConvolve8_neon[] = { ALL_SIZES(convolve8_neon) };
@@ -1191,13 +1097,11 @@ INSTANTIATE_TEST_CASE_P(NEON, ConvolveTest, · 3 unmodified lines
1191 1097
1192#if HAVE_DSPR21098#if HAVE_DSPR2
1193const ConvolveFunctions convolve8_dspr2(1099const ConvolveFunctions convolve8_dspr2(
1194 vpx_convolve_copy_dspr2, vpx_convolve_avg_dspr2,1100 vpx_convolve_copy_dspr2, vpx_convolve_avg_dspr2, vpx_convolve8_horiz_dspr2,
1195 vpx_convolve8_horiz_dspr2, vpx_convolve8_avg_horiz_dspr2,1101 vpx_convolve8_avg_horiz_dspr2, vpx_convolve8_vert_dspr2,
1196 vpx_convolve8_vert_dspr2, vpx_convolve8_avg_vert_dspr2,1102 vpx_convolve8_avg_vert_dspr2, vpx_convolve8_dspr2, vpx_convolve8_avg_dspr2,
1197 vpx_convolve8_dspr2, vpx_convolve8_avg_dspr2,1103 vpx_scaled_horiz_c, vpx_scaled_avg_horiz_c, vpx_scaled_vert_c,
1198 vpx_scaled_horiz_c, vpx_scaled_avg_horiz_c,1104 vpx_scaled_avg_vert_c, vpx_scaled_2d_c, vpx_scaled_avg_2d_c, 0);
1199 vpx_scaled_vert_c, vpx_scaled_avg_vert_c,
1200 vpx_scaled_2d_c, vpx_scaled_avg_2d_c, 0);
1201 1105
1202const ConvolveParam kArrayConvolve8_dspr2[] = { ALL_SIZES(convolve8_dspr2) };1106const ConvolveParam kArrayConvolve8_dspr2[] = { ALL_SIZES(convolve8_dspr2) };
1203INSTANTIATE_TEST_CASE_P(DSPR2, ConvolveTest,1107INSTANTIATE_TEST_CASE_P(DSPR2, ConvolveTest,
@@ -1206,13 +1110,11 @@ INSTANTIATE_TEST_CASE_P(DSPR2, ConvolveTest, · 2 unmodified lines
1206 1110
1207#if HAVE_MSA1111#if HAVE_MSA
1208const ConvolveFunctions convolve8_msa(1112const ConvolveFunctions convolve8_msa(
1209 vpx_convolve_copy_msa, vpx_convolve_avg_msa,1113 vpx_convolve_copy_msa, vpx_convolve_avg_msa, vpx_convolve8_horiz_msa,
1210 vpx_convolve8_horiz_msa, vpx_convolve8_avg_horiz_msa,1114 vpx_convolve8_avg_horiz_msa, vpx_convolve8_vert_msa,
1211 vpx_convolve8_vert_msa, vpx_convolve8_avg_vert_msa,1115 vpx_convolve8_avg_vert_msa, vpx_convolve8_msa, vpx_convolve8_avg_msa,
1212 vpx_convolve8_msa, vpx_convolve8_avg_msa,1116 vpx_scaled_horiz_c, vpx_scaled_avg_horiz_c, vpx_scaled_vert_c,
1213 vpx_scaled_horiz_c, vpx_scaled_avg_horiz_c,1117 vpx_scaled_avg_vert_c, vpx_scaled_2d_c, vpx_scaled_avg_2d_c, 0);
1214 vpx_scaled_vert_c, vpx_scaled_avg_vert_c,
1215 vpx_scaled_2d_c, vpx_scaled_avg_2d_c, 0);
1216 1118
1217const ConvolveParam kArrayConvolve8_msa[] = { ALL_SIZES(convolve8_msa) };1119const ConvolveParam kArrayConvolve8_msa[] = { ALL_SIZES(convolve8_msa) };
1218INSTANTIATE_TEST_CASE_P(MSA, ConvolveTest,1120INSTANTIATE_TEST_CASE_P(MSA, ConvolveTest,
test/cpu_speed_test.cc+9−14
@@ -23,10 +23,8 @@ class CpuSpeedTest · 22 unmodified lines
23 public ::libvpx_test::CodecTestWith2Params<libvpx_test::TestMode, int> {23 public ::libvpx_test::CodecTestWith2Params<libvpx_test::TestMode, int> {
24 protected:24 protected:
25 CpuSpeedTest()25 CpuSpeedTest()
26 : EncoderTest(GET_PARAM(0)),26 : EncoderTest(GET_PARAM(0)), encoding_mode_(GET_PARAM(1)),
27 encoding_mode_(GET_PARAM(1)),27 set_cpu_used_(GET_PARAM(2)), min_psnr_(kMaxPSNR),
28 set_cpu_used_(GET_PARAM(2)),
29 min_psnr_(kMaxPSNR),
30 tune_content_(VP9E_CONTENT_DEFAULT) {}28 tune_content_(VP9E_CONTENT_DEFAULT) {}
31 virtual ~CpuSpeedTest() {}29 virtual ~CpuSpeedTest() {}
32 30
@@ -42,9 +40,7 @@ class CpuSpeedTest · 9 unmodified lines
42 }40 }
43 }41 }
44 42
45 virtual void BeginPassHook(unsigned int /*pass*/) {43 virtual void BeginPassHook(unsigned int /*pass*/) { min_psnr_ = kMaxPSNR; }
46 min_psnr_ = kMaxPSNR;
47 }
48 44
49 virtual void PreEncodeFrameHook(::libvpx_test::VideoSource *video,45 virtual void PreEncodeFrameHook(::libvpx_test::VideoSource *video,
50 ::libvpx_test::Encoder *encoder) {46 ::libvpx_test::Encoder *encoder) {
@@ -61,8 +57,7 @@ class CpuSpeedTest · 10 unmodified lines
61 }57 }
62 58
63 virtual void PSNRPktHook(const vpx_codec_cx_pkt_t *pkt) {59 virtual void PSNRPktHook(const vpx_codec_cx_pkt_t *pkt) {
64 if (pkt->data.psnr.psnr[0] < min_psnr_)60 if (pkt->data.psnr.psnr[0] < min_psnr_) min_psnr_ = pkt->data.psnr.psnr[0];
65 min_psnr_ = pkt->data.psnr.psnr[0];
66 }61 }
67 62
68 ::libvpx_test::TestMode encoding_mode_;63 ::libvpx_test::TestMode encoding_mode_;
@@ -153,9 +148,9 @@ TEST_P(CpuSpeedTest, TestLowBitrate) { · 84 unmodified lines
153 ASSERT_NO_FATAL_FAILURE(RunLoop(&video));148 ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
154}149}
155 150
156VP9_INSTANTIATE_TEST_CASE(151VP9_INSTANTIATE_TEST_CASE(CpuSpeedTest,
157 CpuSpeedTest,152 ::testing::Values(::libvpx_test::kTwoPassGood,
158 ::testing::Values(::libvpx_test::kTwoPassGood, ::libvpx_test::kOnePassGood,153 ::libvpx_test::kOnePassGood,
159 ::libvpx_test::kRealTime),154 ::libvpx_test::kRealTime),
160 ::testing::Range(0, 9));155 ::testing::Range(0, 9));
161} // namespace156} // namespace
test/cq_test.cc+4−7
@@ -24,14 +24,12 @@ const int kCQLevelStep = 8; · 23 unmodified lines
24const unsigned int kCQTargetBitrate = 2000;24const unsigned int kCQTargetBitrate = 2000;
25 25
26class CQTest : public ::libvpx_test::EncoderTest,26class CQTest : public ::libvpx_test::EncoderTest,
27 public ::libvpx_test::CodecTestWithParam<int> {27 public ::libvpx_test::CodecTestWithParam<int> {
28 public:28 public:
29 // maps the cqlevel to the bitrate produced.29 // maps the cqlevel to the bitrate produced.
30 typedef std::map<int, uint32_t> BitrateMap;30 typedef std::map<int, uint32_t> BitrateMap;
31 31
32 static void SetUpTestCase() {32 static void SetUpTestCase() { bitrates_.clear(); }
33 bitrates_.clear();
34 }
35 33
36 static void TearDownTestCase() {34 static void TearDownTestCase() {
37 ASSERT_TRUE(!HasFailure())35 ASSERT_TRUE(!HasFailure())
@@ -128,7 +126,6 @@ TEST_P(CQTest, LinearPSNRIsHigherForCQLevel) { · 90 unmodified lines
128 EXPECT_GE(cq_psnr_lin, vbr_psnr_lin);126 EXPECT_GE(cq_psnr_lin, vbr_psnr_lin);
129}127}
130 128
131VP8_INSTANTIATE_TEST_CASE(CQTest,129VP8_INSTANTIATE_TEST_CASE(CQTest, ::testing::Range(kCQLevelMin, kCQLevelMax,
132 ::testing::Range(kCQLevelMin, kCQLevelMax,130 kCQLevelStep));
133 kCQLevelStep));
134} // namespace131} // namespace
test/datarate_test.cc+83−91
@@ -18,8 +18,9 @@ · 17 unmodified lines
18 18
19namespace {19namespace {
20 20
21class DatarateTestLarge : public ::libvpx_test::EncoderTest,21class DatarateTestLarge
22 public ::libvpx_test::CodecTestWithParam<libvpx_test::TestMode> {22 : public ::libvpx_test::EncoderTest,
23 public ::libvpx_test::CodecTestWithParam<libvpx_test::TestMode> {
23 public:24 public:
24 DatarateTestLarge() : EncoderTest(GET_PARAM(0)) {}25 DatarateTestLarge() : EncoderTest(GET_PARAM(0)) {}
25 26
@@ -71,8 +72,7 @@ class DatarateTestLarge : public ::libvpx_test::EncoderTest, · 45 unmodified lines
71 // http://code.google.com/p/webm/issues/detail?id=496 is fixed.72 // http://code.google.com/p/webm/issues/detail?id=496 is fixed.
72 // For now the codec assumes buffer starts at starting buffer rate73 // For now the codec assumes buffer starts at starting buffer rate
73 // plus one frame's time.74 // plus one frame's time.
74 if (last_pts_ == 0)75 if (last_pts_ == 0) duration = 1;
75 duration = 1;
76 76
77 // Add to the buffer the bits we'd expect from a constant bitrate server.77 // Add to the buffer the bits we'd expect from a constant bitrate server.
78 bits_in_buffer_model_ += static_cast<int64_t>(78 bits_in_buffer_model_ += static_cast<int64_t>(
@@ -83,11 +83,11 @@ class DatarateTestLarge : public ::libvpx_test::EncoderTest, · 4 unmodified lines
83 * empty - and then stop showing frames until we've got enough bits to83 * empty - and then stop showing frames until we've got enough bits to
84 * show one. As noted in comment below (issue 495), this does not currently84 * show one. As noted in comment below (issue 495), this does not currently
85 * apply to key frames. For now exclude key frames in condition below. */85 * apply to key frames. For now exclude key frames in condition below. */
86 const bool key_frame = (pkt->data.frame.flags & VPX_FRAME_IS_KEY)86 const bool key_frame =
87 ? true: false;87 (pkt->data.frame.flags & VPX_FRAME_IS_KEY) ? true : false;
88 if (!key_frame) {88 if (!key_frame) {
89 ASSERT_GE(bits_in_buffer_model_, 0) << "Buffer Underrun at frame "89 ASSERT_GE(bits_in_buffer_model_, 0) << "Buffer Underrun at frame "
90 << pkt->data.frame.pts;90 << pkt->data.frame.pts;
91 }91 }
92 92
93 const int64_t frame_size_in_bits = pkt->data.frame.sz * 8;93 const int64_t frame_size_in_bits = pkt->data.frame.sz * 8;
@@ -99,8 +99,7 @@ class DatarateTestLarge : public ::libvpx_test::EncoderTest, · 5 unmodified lines
99 bits_total_ += frame_size_in_bits;99 bits_total_ += frame_size_in_bits;
100 100
101 // If first drop not set and we have a drop set it to this time.101 // If first drop not set and we have a drop set it to this time.
102 if (!first_drop_ && duration > 1)102 if (!first_drop_ && duration > 1) first_drop_ = last_pts_ + 1;
103 first_drop_ = last_pts_ + 1;
104 103
105 // Update the most recent pts.104 // Update the most recent pts.
106 last_pts_ = pkt->data.frame.pts;105 last_pts_ = pkt->data.frame.pts;
@@ -119,8 +118,8 @@ class DatarateTestLarge : public ::libvpx_test::EncoderTest, · 12 unmodified lines
119 duration_ = (last_pts_ + 1) * timebase_;118 duration_ = (last_pts_ + 1) * timebase_;
120 119
121 // Effective file datarate includes the time spent prebuffering.120 // Effective file datarate includes the time spent prebuffering.
122 effective_datarate_ = (bits_total_ - bits_in_last_frame_) / 1000.0121 effective_datarate_ = (bits_total_ - bits_in_last_frame_) / 1000.0 /
123 / (cfg_.rc_buf_initial_sz / 1000.0 + duration_);122 (cfg_.rc_buf_initial_sz / 1000.0 + duration_);
124 123
125 file_datarate_ = file_size_in_kb / duration_;124 file_datarate_ = file_size_in_kb / duration_;
126 }125 }
@@ -256,8 +255,9 @@ TEST_P(DatarateTestLarge, ChangingDropFrameThresh) { · 129 unmodified lines
256 }255 }
257}256}
258 257
259class DatarateTestVP9Large : public ::libvpx_test::EncoderTest,258class DatarateTestVP9Large
260 public ::libvpx_test::CodecTestWith2Params<libvpx_test::TestMode, int> {259 : public ::libvpx_test::EncoderTest,
260 public ::libvpx_test::CodecTestWith2Params<libvpx_test::TestMode, int> {
261 public:261 public:
262 DatarateTestVP9Large() : EncoderTest(GET_PARAM(0)) {}262 DatarateTestVP9Large() : EncoderTest(GET_PARAM(0)) {}
263 263
@@ -307,8 +307,8 @@ class DatarateTestVP9Large : public ::libvpx_test::EncoderTest, · 43 unmodified lines
307 if (num_temp_layers == 2) {307 if (num_temp_layers == 2) {
308 if (frame_num % 2 == 0) {308 if (frame_num % 2 == 0) {
309 // Layer 0: predict from L and ARF, update L.309 // Layer 0: predict from L and ARF, update L.
310 frame_flags = VP8_EFLAG_NO_REF_GF | VP8_EFLAG_NO_UPD_GF |310 frame_flags =
311 VP8_EFLAG_NO_UPD_ARF;311 VP8_EFLAG_NO_REF_GF | VP8_EFLAG_NO_UPD_GF | VP8_EFLAG_NO_UPD_ARF;
312 } else {312 } else {
313 // Layer 1: predict from L, G and ARF, and update G.313 // Layer 1: predict from L, G and ARF, and update G.
314 frame_flags = VP8_EFLAG_NO_UPD_ARF | VP8_EFLAG_NO_UPD_LAST |314 frame_flags = VP8_EFLAG_NO_UPD_ARF | VP8_EFLAG_NO_UPD_LAST |
@@ -317,15 +317,15 @@ class DatarateTestVP9Large : public ::libvpx_test::EncoderTest, · 2 unmodified lines
317 } else if (num_temp_layers == 3) {317 } else if (num_temp_layers == 3) {
318 if (frame_num % 4 == 0) {318 if (frame_num % 4 == 0) {
319 // Layer 0: predict from L and ARF; update L.319 // Layer 0: predict from L and ARF; update L.
320 frame_flags = VP8_EFLAG_NO_UPD_GF | VP8_EFLAG_NO_UPD_ARF |320 frame_flags =
321 VP8_EFLAG_NO_REF_GF;321 VP8_EFLAG_NO_UPD_GF | VP8_EFLAG_NO_UPD_ARF | VP8_EFLAG_NO_REF_GF;
322 } else if ((frame_num - 2) % 4 == 0) {322 } else if ((frame_num - 2) % 4 == 0) {
323 // Layer 1: predict from L, G, ARF; update G.323 // Layer 1: predict from L, G, ARF; update G.
324 frame_flags = VP8_EFLAG_NO_UPD_ARF | VP8_EFLAG_NO_UPD_LAST;324 frame_flags = VP8_EFLAG_NO_UPD_ARF | VP8_EFLAG_NO_UPD_LAST;
325 } else if ((frame_num - 1) % 2 == 0) {325 } else if ((frame_num - 1) % 2 == 0) {
326 // Layer 2: predict from L, G, ARF; update none.326 // Layer 2: predict from L, G, ARF; update none.
327 frame_flags = VP8_EFLAG_NO_UPD_GF | VP8_EFLAG_NO_UPD_ARF |327 frame_flags =
328 VP8_EFLAG_NO_UPD_LAST;328 VP8_EFLAG_NO_UPD_GF | VP8_EFLAG_NO_UPD_ARF | VP8_EFLAG_NO_UPD_LAST;
329 }329 }
330 }330 }
331 return frame_flags;331 return frame_flags;
@@ -353,8 +353,7 @@ class DatarateTestVP9Large : public ::libvpx_test::EncoderTest, · 21 unmodified lines
353 353
354 virtual void PreEncodeFrameHook(::libvpx_test::VideoSource *video,354 virtual void PreEncodeFrameHook(::libvpx_test::VideoSource *video,
355 ::libvpx_test::Encoder *encoder) {355 ::libvpx_test::Encoder *encoder) {
356 if (video->frame() == 0)356 if (video->frame() == 0) encoder->Control(VP8E_SET_CPUUSED, set_cpu_used_);
357 encoder->Control(VP8E_SET_CPUUSED, set_cpu_used_);
358 357
359 if (denoiser_offon_test_) {358 if (denoiser_offon_test_) {
360 ASSERT_GT(denoiser_offon_period_, 0)359 ASSERT_GT(denoiser_offon_period_, 0)
@@ -374,8 +373,8 @@ class DatarateTestVP9Large : public ::libvpx_test::EncoderTest, · 13 unmodified lines
374 vpx_svc_layer_id_t layer_id;373 vpx_svc_layer_id_t layer_id;
375 layer_id.spatial_layer_id = 0;374 layer_id.spatial_layer_id = 0;
376 frame_flags_ = SetFrameFlags(video->frame(), cfg_.ts_number_layers);375 frame_flags_ = SetFrameFlags(video->frame(), cfg_.ts_number_layers);
377 layer_id.temporal_layer_id = SetLayerId(video->frame(),376 layer_id.temporal_layer_id =
378 cfg_.ts_number_layers);377 SetLayerId(video->frame(), cfg_.ts_number_layers);
379 encoder->Control(VP9E_SET_SVC_LAYER_ID, &layer_id);378 encoder->Control(VP9E_SET_SVC_LAYER_ID, &layer_id);
380 }379 }
381 const vpx_rational_t tb = video->timebase();380 const vpx_rational_t tb = video->timebase();
@@ -383,15 +382,13 @@ class DatarateTestVP9Large : public ::libvpx_test::EncoderTest, · 1 unmodified line
383 duration_ = 0;382 duration_ = 0;
384 }383 }
385 384
386
387 virtual void FramePktHook(const vpx_codec_cx_pkt_t *pkt) {385 virtual void FramePktHook(const vpx_codec_cx_pkt_t *pkt) {
388 // Time since last timestamp = duration.386 // Time since last timestamp = duration.
389 vpx_codec_pts_t duration = pkt->data.frame.pts - last_pts_;387 vpx_codec_pts_t duration = pkt->data.frame.pts - last_pts_;
390 388
391 if (duration > 1) {389 if (duration > 1) {
392 // If first drop not set and we have a drop set it to this time.390 // If first drop not set and we have a drop set it to this time.
393 if (!first_drop_)391 if (!first_drop_) first_drop_ = last_pts_ + 1;
394 first_drop_ = last_pts_ + 1;
395 // Update the number of frame drops.392 // Update the number of frame drops.
396 num_drops_ += static_cast<int>(duration - 1);393 num_drops_ += static_cast<int>(duration - 1);
397 // Update counter for total number of frames (#frames input to encoder).394 // Update counter for total number of frames (#frames input to encoder).
@@ -407,7 +404,7 @@ class DatarateTestVP9Large : public ::libvpx_test::EncoderTest, · 9 unmodified lines
407 404
408 // Buffer should not go negative.405 // Buffer should not go negative.
409 ASSERT_GE(bits_in_buffer_model_, 0) << "Buffer Underrun at frame "406 ASSERT_GE(bits_in_buffer_model_, 0) << "Buffer Underrun at frame "
410 << pkt->data.frame.pts;407 << pkt->data.frame.pts;
411 408
412 const size_t frame_size_in_bits = pkt->data.frame.sz * 8;409 const size_t frame_size_in_bits = pkt->data.frame.sz * 8;
413 410
@@ -425,7 +422,7 @@ class DatarateTestVP9Large : public ::libvpx_test::EncoderTest, · 11 unmodified lines
425 422
426 virtual void EndPassHook(void) {423 virtual void EndPassHook(void) {
427 for (int layer = 0; layer < static_cast<int>(cfg_.ts_number_layers);424 for (int layer = 0; layer < static_cast<int>(cfg_.ts_number_layers);
428 ++layer) {425 ++layer) {
429 duration_ = (last_pts_ + 1) * timebase_;426 duration_ = (last_pts_ + 1) * timebase_;
430 if (bits_total_[layer]) {427 if (bits_total_[layer]) {
431 // Effective file datarate:428 // Effective file datarate:
@@ -546,7 +543,7 @@ TEST_P(DatarateTestVP9Large, BasicRateTargeting444) { · 114 unmodified lines
546 ASSERT_LE(static_cast<double>(cfg_.rc_target_bitrate),543 ASSERT_LE(static_cast<double>(cfg_.rc_target_bitrate),
547 effective_datarate_[0] * 1.15)544 effective_datarate_[0] * 1.15)
548 << " The datarate for the file missed the target!"545 << " The datarate for the file missed the target!"
549 << cfg_.rc_target_bitrate << " "<< effective_datarate_;546 << cfg_.rc_target_bitrate << " " << effective_datarate_;
550 }547 }
551}548}
552 549
@@ -616,8 +613,7 @@ TEST_P(DatarateTestVP9Large, BasicRateTargeting2TemporalLayers) { · 63 unmodified lines
616 613
617 cfg_.temporal_layering_mode = VP9E_TEMPORAL_LAYERING_MODE_BYPASS;614 cfg_.temporal_layering_mode = VP9E_TEMPORAL_LAYERING_MODE_BYPASS;
618 615
619 if (deadline_ == VPX_DL_REALTIME)616 if (deadline_ == VPX_DL_REALTIME) cfg_.g_error_resilient = 1;
620 cfg_.g_error_resilient = 1;
621 617
622 ::libvpx_test::I420VideoSource video("hantro_collage_w352h288.yuv", 352, 288,618 ::libvpx_test::I420VideoSource video("hantro_collage_w352h288.yuv", 352, 288,
623 30, 1, 0, 200);619 30, 1, 0, 200);
@@ -631,10 +627,12 @@ TEST_P(DatarateTestVP9Large, BasicRateTargeting2TemporalLayers) { · 7 unmodified lines
631 for (int j = 0; j < static_cast<int>(cfg_.ts_number_layers); ++j) {627 for (int j = 0; j < static_cast<int>(cfg_.ts_number_layers); ++j) {
632 ASSERT_GE(effective_datarate_[j], cfg_.layer_target_bitrate[j] * 0.85)628 ASSERT_GE(effective_datarate_[j], cfg_.layer_target_bitrate[j] * 0.85)
633 << " The datarate for the file is lower than target by too much, "629 << " The datarate for the file is lower than target by too much, "
634 "for layer: " << j;630 "for layer: "
631 << j;
635 ASSERT_LE(effective_datarate_[j], cfg_.layer_target_bitrate[j] * 1.15)632 ASSERT_LE(effective_datarate_[j], cfg_.layer_target_bitrate[j] * 1.15)
636 << " The datarate for the file is greater than target by too much, "633 << " The datarate for the file is greater than target by too much, "
637 "for layer: " << j;634 "for layer: "
635 << j;
638 }636 }
639 }637 }
640}638}
@@ -674,12 +672,14 @@ TEST_P(DatarateTestVP9Large, BasicRateTargeting3TemporalLayers) { · 33 unmodified lines
674 // Adjust the thresholds to be tighter than .75.672 // Adjust the thresholds to be tighter than .75.
675 ASSERT_GE(effective_datarate_[j], cfg_.layer_target_bitrate[j] * 0.75)673 ASSERT_GE(effective_datarate_[j], cfg_.layer_target_bitrate[j] * 0.75)
676 << " The datarate for the file is lower than target by too much, "674 << " The datarate for the file is lower than target by too much, "
677 "for layer: " << j;675 "for layer: "
676 << j;
678 // TODO(yaowu): Work out more stable rc control strategy and677 // TODO(yaowu): Work out more stable rc control strategy and
679 // Adjust the thresholds to be tighter than 1.25.678 // Adjust the thresholds to be tighter than 1.25.
680 ASSERT_LE(effective_datarate_[j], cfg_.layer_target_bitrate[j] * 1.25)679 ASSERT_LE(effective_datarate_[j], cfg_.layer_target_bitrate[j] * 1.25)
681 << " The datarate for the file is greater than target by too much, "680 << " The datarate for the file is greater than target by too much, "
682 "for layer: " << j;681 "for layer: "
682 << j;
683 }683 }
684 }684 }
685}685}
@@ -719,10 +719,12 @@ TEST_P(DatarateTestVP9Large, BasicRateTargeting3TemporalLayersFrameDropping) { · 33 unmodified lines
719 for (int j = 0; j < static_cast<int>(cfg_.ts_number_layers); ++j) {719 for (int j = 0; j < static_cast<int>(cfg_.ts_number_layers); ++j) {
720 ASSERT_GE(effective_datarate_[j], cfg_.layer_target_bitrate[j] * 0.85)720 ASSERT_GE(effective_datarate_[j], cfg_.layer_target_bitrate[j] * 0.85)
721 << " The datarate for the file is lower than target by too much, "721 << " The datarate for the file is lower than target by too much, "
722 "for layer: " << j;722 "for layer: "
723 << j;
723 ASSERT_LE(effective_datarate_[j], cfg_.layer_target_bitrate[j] * 1.15)724 ASSERT_LE(effective_datarate_[j], cfg_.layer_target_bitrate[j] * 1.15)
724 << " The datarate for the file is greater than target by too much, "725 << " The datarate for the file is greater than target by too much, "
725 "for layer: " << j;726 "for layer: "
727 << j;
726 // Expect some frame drops in this test: for this 200 frames test,728 // Expect some frame drops in this test: for this 200 frames test,
727 // expect at least 10% and not more than 60% drops.729 // expect at least 10% and not more than 60% drops.
728 ASSERT_GE(num_drops_, 20);730 ASSERT_GE(num_drops_, 20);
@@ -792,11 +794,13 @@ TEST_P(DatarateTestVP9Large, DenoiserOffOn) { · 63 unmodified lines
792}794}
793#endif // CONFIG_VP9_TEMPORAL_DENOISING795#endif // CONFIG_VP9_TEMPORAL_DENOISING
794 796
795class DatarateOnePassCbrSvc : public ::libvpx_test::EncoderTest,797class DatarateOnePassCbrSvc
796 public ::libvpx_test::CodecTestWith2Params<libvpx_test::TestMode, int> {798 : public ::libvpx_test::EncoderTest,
799 public ::libvpx_test::CodecTestWith2Params<libvpx_test::TestMode, int> {
797 public:800 public:
798 DatarateOnePassCbrSvc() : EncoderTest(GET_PARAM(0)) {}801 DatarateOnePassCbrSvc() : EncoderTest(GET_PARAM(0)) {}
799 virtual ~DatarateOnePassCbrSvc() {}802 virtual ~DatarateOnePassCbrSvc() {}
803
800 protected:804 protected:
801 virtual void SetUp() {805 virtual void SetUp() {
802 InitializeConfig();806 InitializeConfig();
@@ -814,8 +818,7 @@ class DatarateOnePassCbrSvc : public ::libvpx_test::EncoderTest, · 11 unmodified lines
814 mismatch_psnr_ = 0.0;818 mismatch_psnr_ = 0.0;
815 mismatch_nframes_ = 0;819 mismatch_nframes_ = 0;
816 }820 }
817 virtual void BeginPassHook(unsigned int /*pass*/) {821 virtual void BeginPassHook(unsigned int /*pass*/) {}
818 }
819 virtual void PreEncodeFrameHook(::libvpx_test::VideoSource *video,822 virtual void PreEncodeFrameHook(::libvpx_test::VideoSource *video,
820 ::libvpx_test::Encoder *encoder) {823 ::libvpx_test::Encoder *encoder) {
821 if (video->frame() == 0) {824 if (video->frame() == 0) {
@@ -837,21 +840,19 @@ class DatarateOnePassCbrSvc : public ::libvpx_test::EncoderTest, · 15 unmodified lines
837 }840 }
838 virtual void FramePktHook(const vpx_codec_cx_pkt_t *pkt) {841 virtual void FramePktHook(const vpx_codec_cx_pkt_t *pkt) {
839 vpx_codec_pts_t duration = pkt->data.frame.pts - last_pts_;842 vpx_codec_pts_t duration = pkt->data.frame.pts - last_pts_;
840 if (last_pts_ == 0)843 if (last_pts_ == 0) duration = 1;
841 duration = 1;
842 bits_in_buffer_model_ += static_cast<int64_t>(844 bits_in_buffer_model_ += static_cast<int64_t>(
843 duration * timebase_ * cfg_.rc_target_bitrate * 1000);845 duration * timebase_ * cfg_.rc_target_bitrate * 1000);
844 const bool key_frame = (pkt->data.frame.flags & VPX_FRAME_IS_KEY)846 const bool key_frame =
845 ? true: false;847 (pkt->data.frame.flags & VPX_FRAME_IS_KEY) ? true : false;
846 if (!key_frame) {848 if (!key_frame) {
847 ASSERT_GE(bits_in_buffer_model_, 0) << "Buffer Underrun at frame "849 ASSERT_GE(bits_in_buffer_model_, 0) << "Buffer Underrun at frame "
848 << pkt->data.frame.pts;850 << pkt->data.frame.pts;
849 }851 }
850 const size_t frame_size_in_bits = pkt->data.frame.sz * 8;852 const size_t frame_size_in_bits = pkt->data.frame.sz * 8;
851 bits_in_buffer_model_ -= frame_size_in_bits;853 bits_in_buffer_model_ -= frame_size_in_bits;
852 bits_total_ += frame_size_in_bits;854 bits_total_ += frame_size_in_bits;
853 if (!first_drop_ && duration > 1)855 if (!first_drop_ && duration > 1) first_drop_ = last_pts_ + 1;
854 first_drop_ = last_pts_ + 1;
855 last_pts_ = pkt->data.frame.pts;856 last_pts_ = pkt->data.frame.pts;
856 bits_in_last_frame_ = frame_size_in_bits;857 bits_in_last_frame_ = frame_size_in_bits;
857 ++frame_number_;858 ++frame_number_;
@@ -864,16 +865,13 @@ class DatarateOnePassCbrSvc : public ::libvpx_test::EncoderTest, · 6 unmodified lines
864 }865 }
865 }866 }
866 867
867 virtual void MismatchHook(const vpx_image_t *img1,868 virtual void MismatchHook(const vpx_image_t *img1, const vpx_image_t *img2) {
868 const vpx_image_t *img2) {
869 double mismatch_psnr = compute_psnr(img1, img2);869 double mismatch_psnr = compute_psnr(img1, img2);
870 mismatch_psnr_ += mismatch_psnr;870 mismatch_psnr_ += mismatch_psnr;
871 ++mismatch_nframes_;871 ++mismatch_nframes_;
872 }872 }
873 873
874 unsigned int GetMismatchFrames() {874 unsigned int GetMismatchFrames() { return mismatch_nframes_; }
875 return mismatch_nframes_;
876 }
877 875
878 vpx_codec_pts_t last_pts_;876 vpx_codec_pts_t last_pts_;
879 int64_t bits_in_buffer_model_;877 int64_t bits_in_buffer_model_;
@@ -890,37 +888,31 @@ class DatarateOnePassCbrSvc : public ::libvpx_test::EncoderTest, · 10 unmodified lines
890 int mismatch_nframes_;888 int mismatch_nframes_;
891};889};
892static void assign_layer_bitrates(vpx_codec_enc_cfg_t *const enc_cfg,890static void assign_layer_bitrates(vpx_codec_enc_cfg_t *const enc_cfg,
893 const vpx_svc_extra_cfg_t *svc_params,891 const vpx_svc_extra_cfg_t *svc_params,
894 int spatial_layers,892 int spatial_layers, int temporal_layers,
895 int temporal_layers,893 int temporal_layering_mode) {
896 int temporal_layering_mode) {
897 int sl, spatial_layer_target;894 int sl, spatial_layer_target;
898 float total = 0;895 float total = 0;
899 float alloc_ratio[VPX_MAX_LAYERS] = {0};896 float alloc_ratio[VPX_MAX_LAYERS] = { 0 };
900 for (sl = 0; sl < spatial_layers; ++sl) {897 for (sl = 0; sl < spatial_layers; ++sl) {
901 if (svc_params->scaling_factor_den[sl] > 0) {898 if (svc_params->scaling_factor_den[sl] > 0) {
902 alloc_ratio[sl] = (float)(svc_params->scaling_factor_num[sl] *899 alloc_ratio[sl] = (float)(svc_params->scaling_factor_num[sl] * 1.0 /
903 1.0 / svc_params->scaling_factor_den[sl]);900 svc_params->scaling_factor_den[sl]);
904 total += alloc_ratio[sl];901 total += alloc_ratio[sl];
905 }902 }
906 }903 }
907 for (sl = 0; sl < spatial_layers; ++sl) {904 for (sl = 0; sl < spatial_layers; ++sl) {
908 enc_cfg->ss_target_bitrate[sl] = spatial_layer_target =905 enc_cfg->ss_target_bitrate[sl] = spatial_layer_target =
909 (unsigned int)(enc_cfg->rc_target_bitrate *906 (unsigned int)(enc_cfg->rc_target_bitrate * alloc_ratio[sl] / total);
910 alloc_ratio[sl] / total);
911 const int index = sl * temporal_layers;907 const int index = sl * temporal_layers;
912 if (temporal_layering_mode == 3) {908 if (temporal_layering_mode == 3) {
913 enc_cfg->layer_target_bitrate[index] =909 enc_cfg->layer_target_bitrate[index] = spatial_layer_target >> 1;
914 spatial_layer_target >> 1;
915 enc_cfg->layer_target_bitrate[index + 1] =910 enc_cfg->layer_target_bitrate[index + 1] =
916 (spatial_layer_target >> 1) + (spatial_layer_target >> 2);911 (spatial_layer_target >> 1) + (spatial_layer_target >> 2);
917 enc_cfg->layer_target_bitrate[index + 2] =912 enc_cfg->layer_target_bitrate[index + 2] = spatial_layer_target;
918 spatial_layer_target;
919 } else if (temporal_layering_mode == 2) {913 } else if (temporal_layering_mode == 2) {
920 enc_cfg->layer_target_bitrate[index] =914 enc_cfg->layer_target_bitrate[index] = spatial_layer_target * 2 / 3;
921 spatial_layer_target * 2 / 3;915 enc_cfg->layer_target_bitrate[index + 1] = spatial_layer_target;
922 enc_cfg->layer_target_bitrate[index + 1] =
923 spatial_layer_target;
924 }916 }
925 }917 }
926}918}
@@ -957,10 +949,10 @@ TEST_P(DatarateOnePassCbrSvc, OnePassCbrSvc2SpatialLayers) { · 30 unmodified lines
957 cfg_.rc_target_bitrate = i;949 cfg_.rc_target_bitrate = i;
958 ResetModel();950 ResetModel();
959 assign_layer_bitrates(&cfg_, &svc_params_, cfg_.ss_number_layers,951 assign_layer_bitrates(&cfg_, &svc_params_, cfg_.ss_number_layers,
960 cfg_.ts_number_layers, cfg_.temporal_layering_mode);952 cfg_.ts_number_layers, cfg_.temporal_layering_mode);
961 ASSERT_NO_FATAL_FAILURE(RunLoop(&video));953 ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
962 ASSERT_GE(cfg_.rc_target_bitrate, file_datarate_ * 0.85)954 ASSERT_GE(cfg_.rc_target_bitrate, file_datarate_ * 0.85)
963 << " The datarate for the file exceeds the target by too much!";955 << " The datarate for the file exceeds the target by too much!";
964 ASSERT_LE(cfg_.rc_target_bitrate, file_datarate_ * 1.15)956 ASSERT_LE(cfg_.rc_target_bitrate, file_datarate_ * 1.15)
965 << " The datarate for the file is lower than the target by too much!";957 << " The datarate for the file is lower than the target by too much!";
966 EXPECT_EQ(static_cast<unsigned int>(0), GetMismatchFrames());958 EXPECT_EQ(static_cast<unsigned int>(0), GetMismatchFrames());
@@ -999,10 +991,10 @@ TEST_P(DatarateOnePassCbrSvc, OnePassCbrSvc2SpatialLayersSmallKf) { · 32 unmodified lines
999 cfg_.kf_max_dist = j;991 cfg_.kf_max_dist = j;
1000 ResetModel();992 ResetModel();
1001 assign_layer_bitrates(&cfg_, &svc_params_, cfg_.ss_number_layers,993 assign_layer_bitrates(&cfg_, &svc_params_, cfg_.ss_number_layers,
1002 cfg_.ts_number_layers, cfg_.temporal_layering_mode);994 cfg_.ts_number_layers, cfg_.temporal_layering_mode);
1003 ASSERT_NO_FATAL_FAILURE(RunLoop(&video));995 ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
1004 ASSERT_GE(cfg_.rc_target_bitrate, file_datarate_ * 0.85)996 ASSERT_GE(cfg_.rc_target_bitrate, file_datarate_ * 0.85)
1005 << " The datarate for the file exceeds the target by too much!";997 << " The datarate for the file exceeds the target by too much!";
1006 ASSERT_LE(cfg_.rc_target_bitrate, file_datarate_ * 1.15)998 ASSERT_LE(cfg_.rc_target_bitrate, file_datarate_ * 1.15)
1007 << " The datarate for the file is lower than the target by too much!";999 << " The datarate for the file is lower than the target by too much!";
1008 EXPECT_EQ(static_cast<unsigned int>(0), GetMismatchFrames());1000 EXPECT_EQ(static_cast<unsigned int>(0), GetMismatchFrames());
@@ -1033,15 +1025,15 @@ TEST_P(DatarateOnePassCbrSvc, OnePassCbrSvc2SpatialLayers4threads) { · 24 unmodified lines
1033 svc_params_.scaling_factor_den[1] = 288;1025 svc_params_.scaling_factor_den[1] = 288;
1034 cfg_.rc_dropframe_thresh = 10;1026 cfg_.rc_dropframe_thresh = 10;
1035 cfg_.kf_max_dist = 9999;1027 cfg_.kf_max_dist = 9999;
1036 ::libvpx_test::I420VideoSource video("niklas_1280_720_30.y4m", 1280, 720,1028 ::libvpx_test::I420VideoSource video("niklas_1280_720_30.y4m", 1280, 720, 30,
1037 30, 1, 0, 300);1029 1, 0, 300);
1038 cfg_.rc_target_bitrate = 800;1030 cfg_.rc_target_bitrate = 800;
1039 ResetModel();1031 ResetModel();
1040 assign_layer_bitrates(&cfg_, &svc_params_, cfg_.ss_number_layers,1032 assign_layer_bitrates(&cfg_, &svc_params_, cfg_.ss_number_layers,
1041 cfg_.ts_number_layers, cfg_.temporal_layering_mode);1033 cfg_.ts_number_layers, cfg_.temporal_layering_mode);
1042 ASSERT_NO_FATAL_FAILURE(RunLoop(&video));1034 ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
1043 ASSERT_GE(cfg_.rc_target_bitrate, file_datarate_ * 0.85)1035 ASSERT_GE(cfg_.rc_target_bitrate, file_datarate_ * 0.85)
1044 << " The datarate for the file exceeds the target by too much!";1036 << " The datarate for the file exceeds the target by too much!";
1045 ASSERT_LE(cfg_.rc_target_bitrate, file_datarate_ * 1.15)1037 ASSERT_LE(cfg_.rc_target_bitrate, file_datarate_ * 1.15)
1046 << " The datarate for the file is lower than the target by too much!";1038 << " The datarate for the file is lower than the target by too much!";
1047 EXPECT_EQ(static_cast<unsigned int>(0), GetMismatchFrames());1039 EXPECT_EQ(static_cast<unsigned int>(0), GetMismatchFrames());
@@ -1073,15 +1065,15 @@ TEST_P(DatarateOnePassCbrSvc, OnePassCbrSvc3SpatialLayers) { · 25 unmodified lines
1073 svc_params_.scaling_factor_den[2] = 288;1065 svc_params_.scaling_factor_den[2] = 288;
1074 cfg_.rc_dropframe_thresh = 10;1066 cfg_.rc_dropframe_thresh = 10;
1075 cfg_.kf_max_dist = 9999;1067 cfg_.kf_max_dist = 9999;
1076 ::libvpx_test::I420VideoSource video("niklas_1280_720_30.y4m", 1280, 720,1068 ::libvpx_test::I420VideoSource video("niklas_1280_720_30.y4m", 1280, 720, 30,
1077 30, 1, 0, 300);1069 1, 0, 300);
1078 cfg_.rc_target_bitrate = 800;1070 cfg_.rc_target_bitrate = 800;
1079 ResetModel();1071 ResetModel();
1080 assign_layer_bitrates(&cfg_, &svc_params_, cfg_.ss_number_layers,1072 assign_layer_bitrates(&cfg_, &svc_params_, cfg_.ss_number_layers,
1081 cfg_.ts_number_layers, cfg_.temporal_layering_mode);1073 cfg_.ts_number_layers, cfg_.temporal_layering_mode);
1082 ASSERT_NO_FATAL_FAILURE(RunLoop(&video));1074 ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
1083 ASSERT_GE(cfg_.rc_target_bitrate, file_datarate_ * 0.85)1075 ASSERT_GE(cfg_.rc_target_bitrate, file_datarate_ * 0.85)
1084 << " The datarate for the file exceeds the target by too much!";1076 << " The datarate for the file exceeds the target by too much!";
1085 ASSERT_LE(cfg_.rc_target_bitrate, file_datarate_ * 1.22)1077 ASSERT_LE(cfg_.rc_target_bitrate, file_datarate_ * 1.22)
1086 << " The datarate for the file is lower than the target by too much!";1078 << " The datarate for the file is lower than the target by too much!";
1087 EXPECT_EQ(static_cast<unsigned int>(0), GetMismatchFrames());1079 EXPECT_EQ(static_cast<unsigned int>(0), GetMismatchFrames());
@@ -1112,8 +1104,8 @@ TEST_P(DatarateOnePassCbrSvc, OnePassCbrSvc3SpatialLayersSmallKf) { · 24 unmodified lines
1112 svc_params_.scaling_factor_num[2] = 288;1104 svc_params_.scaling_factor_num[2] = 288;
1113 svc_params_.scaling_factor_den[2] = 288;1105 svc_params_.scaling_factor_den[2] = 288;
1114 cfg_.rc_dropframe_thresh = 10;1106 cfg_.rc_dropframe_thresh = 10;
1115 ::libvpx_test::I420VideoSource video("niklas_1280_720_30.y4m", 1280, 720,1107 ::libvpx_test::I420VideoSource video("niklas_1280_720_30.y4m", 1280, 720, 30,
1116 30, 1, 0, 300);1108 1, 0, 300);
1117 cfg_.rc_target_bitrate = 800;1109 cfg_.rc_target_bitrate = 800;
1118 // For this 3 temporal layer case, pattern repeats every 4 frames, so choose1110 // For this 3 temporal layer case, pattern repeats every 4 frames, so choose
1119 // 4 key neighboring key frame periods (so key frame will land on 0-2-1-2).1111 // 4 key neighboring key frame periods (so key frame will land on 0-2-1-2).
@@ -1121,10 +1113,10 @@ TEST_P(DatarateOnePassCbrSvc, OnePassCbrSvc3SpatialLayersSmallKf) { · 1 unmodified line
1121 cfg_.kf_max_dist = j;1113 cfg_.kf_max_dist = j;
1122 ResetModel();1114 ResetModel();
1123 assign_layer_bitrates(&cfg_, &svc_params_, cfg_.ss_number_layers,1115 assign_layer_bitrates(&cfg_, &svc_params_, cfg_.ss_number_layers,
1124 cfg_.ts_number_layers, cfg_.temporal_layering_mode);1116 cfg_.ts_number_layers, cfg_.temporal_layering_mode);
1125 ASSERT_NO_FATAL_FAILURE(RunLoop(&video));1117 ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
1126 ASSERT_GE(cfg_.rc_target_bitrate, file_datarate_ * 0.85)1118 ASSERT_GE(cfg_.rc_target_bitrate, file_datarate_ * 0.85)
1127 << " The datarate for the file exceeds the target by too much!";1119 << " The datarate for the file exceeds the target by too much!";
1128 ASSERT_LE(cfg_.rc_target_bitrate, file_datarate_ * 1.30)1120 ASSERT_LE(cfg_.rc_target_bitrate, file_datarate_ * 1.30)
1129 << " The datarate for the file is lower than the target by too much!";1121 << " The datarate for the file is lower than the target by too much!";
1130 EXPECT_EQ(static_cast<unsigned int>(0), GetMismatchFrames());1122 EXPECT_EQ(static_cast<unsigned int>(0), GetMismatchFrames());
@@ -1157,15 +1149,15 @@ TEST_P(DatarateOnePassCbrSvc, OnePassCbrSvc3SpatialLayers4threads) { · 26 unmodified lines
1157 svc_params_.scaling_factor_den[2] = 288;1149 svc_params_.scaling_factor_den[2] = 288;
1158 cfg_.rc_dropframe_thresh = 10;1150 cfg_.rc_dropframe_thresh = 10;
1159 cfg_.kf_max_dist = 9999;1151 cfg_.kf_max_dist = 9999;
1160 ::libvpx_test::I420VideoSource video("niklas_1280_720_30.y4m", 1280, 720,1152 ::libvpx_test::I420VideoSource video("niklas_1280_720_30.y4m", 1280, 720, 30,
1161 30, 1, 0, 300);1153 1, 0, 300);
1162 cfg_.rc_target_bitrate = 800;1154 cfg_.rc_target_bitrate = 800;
1163 ResetModel();1155 ResetModel();
1164 assign_layer_bitrates(&cfg_, &svc_params_, cfg_.ss_number_layers,1156 assign_layer_bitrates(&cfg_, &svc_params_, cfg_.ss_number_layers,
1165 cfg_.ts_number_layers, cfg_.temporal_layering_mode);1157 cfg_.ts_number_layers, cfg_.temporal_layering_mode);
1166 ASSERT_NO_FATAL_FAILURE(RunLoop(&video));1158 ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
1167 ASSERT_GE(cfg_.rc_target_bitrate, file_datarate_ * 0.85)1159 ASSERT_GE(cfg_.rc_target_bitrate, file_datarate_ * 0.85)
1168 << " The datarate for the file exceeds the target by too much!";1160 << " The datarate for the file exceeds the target by too much!";
1169 ASSERT_LE(cfg_.rc_target_bitrate, file_datarate_ * 1.22)1161 ASSERT_LE(cfg_.rc_target_bitrate, file_datarate_ * 1.22)
1170 << " The datarate for the file is lower than the target by too much!";1162 << " The datarate for the file is lower than the target by too much!";
1171 EXPECT_EQ(static_cast<unsigned int>(0), GetMismatchFrames());1163 EXPECT_EQ(static_cast<unsigned int>(0), GetMismatchFrames());
test/dct16x16_test.cc+131−183
@@ -54,16 +54,16 @@ void butterfly_16x16_dct_1d(double input[16], double output[16]) { · 53 unmodified lines
54 double temp1, temp2;54 double temp1, temp2;
55 55
56 // step 156 // step 1
57 step[ 0] = input[0] + input[15];57 step[0] = input[0] + input[15];
58 step[ 1] = input[1] + input[14];58 step[1] = input[1] + input[14];
59 step[ 2] = input[2] + input[13];59 step[2] = input[2] + input[13];
60 step[ 3] = input[3] + input[12];60 step[3] = input[3] + input[12];
61 step[ 4] = input[4] + input[11];61 step[4] = input[4] + input[11];
62 step[ 5] = input[5] + input[10];62 step[5] = input[5] + input[10];
63 step[ 6] = input[6] + input[ 9];63 step[6] = input[6] + input[9];
64 step[ 7] = input[7] + input[ 8];64 step[7] = input[7] + input[8];
65 step[ 8] = input[7] - input[ 8];65 step[8] = input[7] - input[8];
66 step[ 9] = input[6] - input[ 9];66 step[9] = input[6] - input[9];
67 step[10] = input[5] - input[10];67 step[10] = input[5] - input[10];
68 step[11] = input[4] - input[11];68 step[11] = input[4] - input[11];
69 step[12] = input[3] - input[12];69 step[12] = input[3] - input[12];
@@ -81,13 +81,13 @@ void butterfly_16x16_dct_1d(double input[16], double output[16]) { · 11 unmodified lines
81 output[6] = step[1] - step[6];81 output[6] = step[1] - step[6];
82 output[7] = step[0] - step[7];82 output[7] = step[0] - step[7];
83 83
84 temp1 = step[ 8] * C7;84 temp1 = step[8] * C7;
85 temp2 = step[15] * C9;85 temp2 = step[15] * C9;
86 output[ 8] = temp1 + temp2;86 output[8] = temp1 + temp2;
87 87
88 temp1 = step[ 9] * C11;88 temp1 = step[9] * C11;
89 temp2 = step[14] * C5;89 temp2 = step[14] * C5;
90 output[ 9] = temp1 - temp2;90 output[9] = temp1 - temp2;
91 91
92 temp1 = step[10] * C3;92 temp1 = step[10] * C3;
93 temp2 = step[13] * C13;93 temp2 = step[13] * C13;
@@ -105,40 +105,40 @@ void butterfly_16x16_dct_1d(double input[16], double output[16]) { · 11 unmodified lines
105 temp2 = step[13] * C3;105 temp2 = step[13] * C3;
106 output[13] = temp2 - temp1;106 output[13] = temp2 - temp1;
107 107
108 temp1 = step[ 9] * C5;108 temp1 = step[9] * C5;
109 temp2 = step[14] * C11;109 temp2 = step[14] * C11;
110 output[14] = temp2 + temp1;110 output[14] = temp2 + temp1;
111 111
112 temp1 = step[ 8] * C9;112 temp1 = step[8] * C9;
113 temp2 = step[15] * C7;113 temp2 = step[15] * C7;
114 output[15] = temp2 - temp1;114 output[15] = temp2 - temp1;
115 115
116 // step 3116 // step 3
117 step[ 0] = output[0] + output[3];117 step[0] = output[0] + output[3];
118 step[ 1] = output[1] + output[2];118 step[1] = output[1] + output[2];
119 step[ 2] = output[1] - output[2];119 step[2] = output[1] - output[2];
120 step[ 3] = output[0] - output[3];120 step[3] = output[0] - output[3];
121 121
122 temp1 = output[4] * C14;122 temp1 = output[4] * C14;
123 temp2 = output[7] * C2;123 temp2 = output[7] * C2;
124 step[ 4] = temp1 + temp2;124 step[4] = temp1 + temp2;
125 125
126 temp1 = output[5] * C10;126 temp1 = output[5] * C10;
127 temp2 = output[6] * C6;127 temp2 = output[6] * C6;
128 step[ 5] = temp1 + temp2;128 step[5] = temp1 + temp2;
129 129
130 temp1 = output[5] * C6;130 temp1 = output[5] * C6;
131 temp2 = output[6] * C10;131 temp2 = output[6] * C10;
132 step[ 6] = temp2 - temp1;132 step[6] = temp2 - temp1;
133 133
134 temp1 = output[4] * C2;134 temp1 = output[4] * C2;
135 temp2 = output[7] * C14;135 temp2 = output[7] * C14;
136 step[ 7] = temp2 - temp1;136 step[7] = temp2 - temp1;
137 137
138 step[ 8] = output[ 8] + output[11];138 step[8] = output[8] + output[11];
139 step[ 9] = output[ 9] + output[10];139 step[9] = output[9] + output[10];
140 step[10] = output[ 9] - output[10];140 step[10] = output[9] - output[10];
141 step[11] = output[ 8] - output[11];141 step[11] = output[8] - output[11];
142 142
143 step[12] = output[12] + output[15];143 step[12] = output[12] + output[15];
144 step[13] = output[13] + output[14];144 step[13] = output[13] + output[14];
@@ -146,25 +146,25 @@ void butterfly_16x16_dct_1d(double input[16], double output[16]) { · 1 unmodified line
146 step[15] = output[12] - output[15];146 step[15] = output[12] - output[15];
147 147
148 // step 4148 // step 4
149 output[ 0] = (step[ 0] + step[ 1]);149 output[0] = (step[0] + step[1]);
150 output[ 8] = (step[ 0] - step[ 1]);150 output[8] = (step[0] - step[1]);
151 151
152 temp1 = step[2] * C12;152 temp1 = step[2] * C12;
153 temp2 = step[3] * C4;153 temp2 = step[3] * C4;
154 temp1 = temp1 + temp2;154 temp1 = temp1 + temp2;
155 output[ 4] = 2*(temp1 * C8);155 output[4] = 2 * (temp1 * C8);
156 156
157 temp1 = step[2] * C4;157 temp1 = step[2] * C4;
158 temp2 = step[3] * C12;158 temp2 = step[3] * C12;
159 temp1 = temp2 - temp1;159 temp1 = temp2 - temp1;
160 output[12] = 2 * (temp1 * C8);160 output[12] = 2 * (temp1 * C8);
161 161
162 output[ 2] = 2 * ((step[4] + step[ 5]) * C8);162 output[2] = 2 * ((step[4] + step[5]) * C8);
163 output[14] = 2 * ((step[7] - step[ 6]) * C8);163 output[14] = 2 * ((step[7] - step[6]) * C8);
164 164
165 temp1 = step[4] - step[5];165 temp1 = step[4] - step[5];
166 temp2 = step[6] + step[7];166 temp2 = step[6] + step[7];
167 output[ 6] = (temp1 + temp2);167 output[6] = (temp1 + temp2);
168 output[10] = (temp1 - temp2);168 output[10] = (temp1 - temp2);
169 169
170 intermediate[8] = step[8] + step[14];170 intermediate[8] = step[8] + step[14];
@@ -180,18 +180,18 @@ void butterfly_16x16_dct_1d(double input[16], double output[16]) { · 9 unmodified lines
180 temp1 = temp2 + temp1;180 temp1 = temp2 + temp1;
181 output[13] = 2 * (temp1 * C8);181 output[13] = 2 * (temp1 * C8);
182 182
183 output[ 9] = 2 * ((step[10] + step[11]) * C8);183 output[9] = 2 * ((step[10] + step[11]) * C8);
184 184
185 intermediate[11] = step[10] - step[11];185 intermediate[11] = step[10] - step[11];
186 intermediate[12] = step[12] + step[13];186 intermediate[12] = step[12] + step[13];
187 intermediate[13] = step[12] - step[13];187 intermediate[13] = step[12] - step[13];
188 intermediate[14] = step[ 8] - step[14];188 intermediate[14] = step[8] - step[14];
189 intermediate[15] = step[ 9] - step[15];189 intermediate[15] = step[9] - step[15];
190 190
191 output[15] = (intermediate[11] + intermediate[12]);191 output[15] = (intermediate[11] + intermediate[12]);
192 output[ 1] = -(intermediate[11] - intermediate[12]);192 output[1] = -(intermediate[11] - intermediate[12]);
193 193
194 output[ 7] = 2 * (intermediate[13] * C8);194 output[7] = 2 * (intermediate[13] * C8);
195 195
196 temp1 = intermediate[14] * C12;196 temp1 = intermediate[14] * C12;
197 temp2 = intermediate[15] * C4;197 temp2 = intermediate[15] * C4;
@@ -201,28 +201,24 @@ void butterfly_16x16_dct_1d(double input[16], double output[16]) { · 3 unmodified lines
201 temp1 = intermediate[14] * C4;201 temp1 = intermediate[14] * C4;
202 temp2 = intermediate[15] * C12;202 temp2 = intermediate[15] * C12;
203 temp1 = temp2 + temp1;203 temp1 = temp2 + temp1;
204 output[ 5] = 2 * (temp1 * C8);204 output[5] = 2 * (temp1 * C8);
205}205}
206 206
207void reference_16x16_dct_2d(int16_t input[256], double output[256]) {207void reference_16x16_dct_2d(int16_t input[256], double output[256]) {
208 // First transform columns208 // First transform columns
209 for (int i = 0; i < 16; ++i) {209 for (int i = 0; i < 16; ++i) {
210 double temp_in[16], temp_out[16];210 double temp_in[16], temp_out[16];
211 for (int j = 0; j < 16; ++j)211 for (int j = 0; j < 16; ++j) temp_in[j] = input[j * 16 + i];
212 temp_in[j] = input[j * 16 + i];
213 butterfly_16x16_dct_1d(temp_in, temp_out);212 butterfly_16x16_dct_1d(temp_in, temp_out);
214 for (int j = 0; j < 16; ++j)213 for (int j = 0; j < 16; ++j) output[j * 16 + i] = temp_out[j];
215 output[j * 16 + i] = temp_out[j];
216 }214 }
217 // Then transform rows215 // Then transform rows
218 for (int i = 0; i < 16; ++i) {216 for (int i = 0; i < 16; ++i) {
219 double temp_in[16], temp_out[16];217 double temp_in[16], temp_out[16];
220 for (int j = 0; j < 16; ++j)218 for (int j = 0; j < 16; ++j) temp_in[j] = output[j + i * 16];
221 temp_in[j] = output[j + i * 16];
222 butterfly_16x16_dct_1d(temp_in, temp_out);219 butterfly_16x16_dct_1d(temp_in, temp_out);
223 // Scale by some magic number220 // Scale by some magic number
224 for (int j = 0; j < 16; ++j)221 for (int j = 0; j < 16; ++j) output[j + i * 16] = temp_out[j] / 2;
225 output[j + i * 16] = temp_out[j]/2;
226 }222 }
227}223}
228 224
@@ -248,8 +244,7 @@ void idct16x16_ref(const tran_low_t *in, uint8_t *dest, int stride, · 19 unmodified lines
248 vpx_idct16x16_256_add_c(in, dest, stride);244 vpx_idct16x16_256_add_c(in, dest, stride);
249}245}
250 246
251void fht16x16_ref(const int16_t *in, tran_low_t *out, int stride,247void fht16x16_ref(const int16_t *in, tran_low_t *out, int stride, int tx_type) {
252 int tx_type) {
253 vp9_fht16x16_c(in, out, stride, tx_type);248 vp9_fht16x16_c(in, out, stride, tx_type);
254}249}
255 250
@@ -351,11 +346,10 @@ class Trans16x16TestBase { · 95 unmodified lines
351 }346 }
352 }347 }
353 348
354 ASM_REGISTER_STATE_CHECK(RunFwdTxfm(test_input_block,349 ASM_REGISTER_STATE_CHECK(
355 test_temp_block, pitch_));350 RunFwdTxfm(test_input_block, test_temp_block, pitch_));
356 if (bit_depth_ == VPX_BITS_8) {351 if (bit_depth_ == VPX_BITS_8) {
357 ASM_REGISTER_STATE_CHECK(352 ASM_REGISTER_STATE_CHECK(RunInvTxfm(test_temp_block, dst, pitch_));
358 RunInvTxfm(test_temp_block, dst, pitch_));
359#if CONFIG_VP9_HIGHBITDEPTH353#if CONFIG_VP9_HIGHBITDEPTH
360 } else {354 } else {
361 ASM_REGISTER_STATE_CHECK(355 ASM_REGISTER_STATE_CHECK(
@@ -366,18 +360,17 @@ class Trans16x16TestBase { · 4 unmodified lines
366 for (int j = 0; j < kNumCoeffs; ++j) {360 for (int j = 0; j < kNumCoeffs; ++j) {
367#if CONFIG_VP9_HIGHBITDEPTH361#if CONFIG_VP9_HIGHBITDEPTH
368 const int32_t diff =362 const int32_t diff =
369 bit_depth_ == VPX_BITS_8 ? dst[j] - src[j] : dst16[j] - src16[j];363 bit_depth_ == VPX_BITS_8 ? dst[j] - src[j] : dst16[j] - src16[j];
370#else364#else
371 const int32_t diff = dst[j] - src[j];365 const int32_t diff = dst[j] - src[j];
372#endif366#endif
373 const uint32_t error = diff * diff;367 const uint32_t error = diff * diff;
374 if (max_error < error)368 if (max_error < error) max_error = error;
375 max_error = error;
376 total_error += error;369 total_error += error;
377 }370 }
378 }371 }
379 372
380 EXPECT_GE(1u << 2 * (bit_depth_ - 8), max_error)373 EXPECT_GE(1u << 2 * (bit_depth_ - 8), max_error)
381 << "Error: 16x16 FHT/IHT has an individual round trip error > 1";374 << "Error: 16x16 FHT/IHT has an individual round trip error > 1";
382 375
383 EXPECT_GE(count_test_block << 2 * (bit_depth_ - 8), total_error)376 EXPECT_GE(count_test_block << 2 * (bit_depth_ - 8), total_error)
@@ -418,16 +411,14 @@ class Trans16x16TestBase { · 34 unmodified lines
418 input_extreme_block[j] = rnd.Rand8() % 2 ? mask_ : -mask_;411 input_extreme_block[j] = rnd.Rand8() % 2 ? mask_ : -mask_;
419 }412 }
420 if (i == 0) {413 if (i == 0) {
421 for (int j = 0; j < kNumCoeffs; ++j)414 for (int j = 0; j < kNumCoeffs; ++j) input_extreme_block[j] = mask_;
422 input_extreme_block[j] = mask_;
423 } else if (i == 1) {415 } else if (i == 1) {
424 for (int j = 0; j < kNumCoeffs; ++j)416 for (int j = 0; j < kNumCoeffs; ++j) input_extreme_block[j] = -mask_;
425 input_extreme_block[j] = -mask_;
426 }417 }
427 418
428 fwd_txfm_ref(input_extreme_block, output_ref_block, pitch_, tx_type_);419 fwd_txfm_ref(input_extreme_block, output_ref_block, pitch_, tx_type_);
429 ASM_REGISTER_STATE_CHECK(RunFwdTxfm(input_extreme_block,420 ASM_REGISTER_STATE_CHECK(
430 output_block, pitch_));421 RunFwdTxfm(input_extreme_block, output_block, pitch_));
431 422
432 // The minimum quant value is 4.423 // The minimum quant value is 4.
433 for (int j = 0; j < kNumCoeffs; ++j) {424 for (int j = 0; j < kNumCoeffs; ++j) {
@@ -457,11 +448,9 @@ class Trans16x16TestBase { · 23 unmodified lines
457 input_extreme_block[j] = rnd.Rand8() % 2 ? mask_ : -mask_;448 input_extreme_block[j] = rnd.Rand8() % 2 ? mask_ : -mask_;
458 }449 }
459 if (i == 0)450 if (i == 0)
460 for (int j = 0; j < kNumCoeffs; ++j)451 for (int j = 0; j < kNumCoeffs; ++j) input_extreme_block[j] = mask_;
461 input_extreme_block[j] = mask_;
462 if (i == 1)452 if (i == 1)
463 for (int j = 0; j < kNumCoeffs; ++j)453 for (int j = 0; j < kNumCoeffs; ++j) input_extreme_block[j] = -mask_;
464 input_extreme_block[j] = -mask_;
465 454
466 fwd_txfm_ref(input_extreme_block, output_ref_block, pitch_, tx_type_);455 fwd_txfm_ref(input_extreme_block, output_ref_block, pitch_, tx_type_);
467 456
@@ -484,17 +473,15 @@ class Trans16x16TestBase { · 16 unmodified lines
484 } else {473 } else {
485 inv_txfm_ref(output_ref_block, CONVERT_TO_BYTEPTR(ref16), pitch_,474 inv_txfm_ref(output_ref_block, CONVERT_TO_BYTEPTR(ref16), pitch_,
486 tx_type_);475 tx_type_);
487 ASM_REGISTER_STATE_CHECK(RunInvTxfm(output_ref_block,476 ASM_REGISTER_STATE_CHECK(
488 CONVERT_TO_BYTEPTR(dst16), pitch_));477 RunInvTxfm(output_ref_block, CONVERT_TO_BYTEPTR(dst16), pitch_));
489#endif478#endif
490 }479 }
491 if (bit_depth_ == VPX_BITS_8) {480 if (bit_depth_ == VPX_BITS_8) {
492 for (int j = 0; j < kNumCoeffs; ++j)481 for (int j = 0; j < kNumCoeffs; ++j) EXPECT_EQ(ref[j], dst[j]);
493 EXPECT_EQ(ref[j], dst[j]);
494#if CONFIG_VP9_HIGHBITDEPTH482#if CONFIG_VP9_HIGHBITDEPTH
495 } else {483 } else {
496 for (int j = 0; j < kNumCoeffs; ++j)484 for (int j = 0; j < kNumCoeffs; ++j) EXPECT_EQ(ref16[j], dst16[j]);
497 EXPECT_EQ(ref16[j], dst16[j]);
498#endif485#endif
499 }486 }
500 }487 }
@@ -538,8 +525,8 @@ class Trans16x16TestBase { · 37 unmodified lines
538 ASM_REGISTER_STATE_CHECK(RunInvTxfm(coeff, dst, 16));525 ASM_REGISTER_STATE_CHECK(RunInvTxfm(coeff, dst, 16));
539#if CONFIG_VP9_HIGHBITDEPTH526#if CONFIG_VP9_HIGHBITDEPTH
540 } else {527 } else {
541 ASM_REGISTER_STATE_CHECK(RunInvTxfm(coeff, CONVERT_TO_BYTEPTR(dst16),528 ASM_REGISTER_STATE_CHECK(
542 16));529 RunInvTxfm(coeff, CONVERT_TO_BYTEPTR(dst16), 16));
543#endif // CONFIG_VP9_HIGHBITDEPTH530#endif // CONFIG_VP9_HIGHBITDEPTH
544 }531 }
545 532
@@ -551,9 +538,8 @@ class Trans16x16TestBase { · 5 unmodified lines
551 const uint32_t diff = dst[j] - src[j];538 const uint32_t diff = dst[j] - src[j];
552#endif // CONFIG_VP9_HIGHBITDEPTH539#endif // CONFIG_VP9_HIGHBITDEPTH
553 const uint32_t error = diff * diff;540 const uint32_t error = diff * diff;
554 EXPECT_GE(1u, error)541 EXPECT_GE(1u, error) << "Error: 16x16 IDCT has error " << error
555 << "Error: 16x16 IDCT has error " << error542 << " at index " << j;
556 << " at index " << j;
557 }543 }
558 }544 }
559 }545 }
@@ -595,8 +581,8 @@ class Trans16x16TestBase { · 35 unmodified lines
595 } else {581 } else {
596#if CONFIG_VP9_HIGHBITDEPTH582#if CONFIG_VP9_HIGHBITDEPTH
597 ref_txfm(coeff, CONVERT_TO_BYTEPTR(ref16), pitch_);583 ref_txfm(coeff, CONVERT_TO_BYTEPTR(ref16), pitch_);
598 ASM_REGISTER_STATE_CHECK(RunInvTxfm(coeff, CONVERT_TO_BYTEPTR(dst16),584 ASM_REGISTER_STATE_CHECK(
599 pitch_));585 RunInvTxfm(coeff, CONVERT_TO_BYTEPTR(dst16), pitch_));
600#endif // CONFIG_VP9_HIGHBITDEPTH586#endif // CONFIG_VP9_HIGHBITDEPTH
601 }587 }
602 588
@@ -608,9 +594,8 @@ class Trans16x16TestBase { · 5 unmodified lines
608 const uint32_t diff = dst[j] - ref[j];594 const uint32_t diff = dst[j] - ref[j];
609#endif // CONFIG_VP9_HIGHBITDEPTH595#endif // CONFIG_VP9_HIGHBITDEPTH
610 const uint32_t error = diff * diff;596 const uint32_t error = diff * diff;
611 EXPECT_EQ(0u, error)597 EXPECT_EQ(0u, error) << "Error: 16x16 IDCT Comparison has error "
612 << "Error: 16x16 IDCT Comparison has error " << error598 << error << " at index " << j;
613 << " at index " << j;
614 }599 }
615 }600 }
616 }601 }
@@ -623,32 +608,25 @@ class Trans16x16TestBase { · 6 unmodified lines
623 IhtFunc inv_txfm_ref;608 IhtFunc inv_txfm_ref;
624};609};
625 610
626class Trans16x16DCT611class Trans16x16DCT : public Trans16x16TestBase,
627 : public Trans16x16TestBase,612 public ::testing::TestWithParam<Dct16x16Param> {
628 public ::testing::TestWithParam<Dct16x16Param> {
629 public:613 public:
630 virtual ~Trans16x16DCT() {}614 virtual ~Trans16x16DCT() {}
631 615
632 virtual void SetUp() {616 virtual void SetUp() {
633 fwd_txfm_ = GET_PARAM(0);617 fwd_txfm_ = GET_PARAM(0);
634 inv_txfm_ = GET_PARAM(1);618 inv_txfm_ = GET_PARAM(1);
635 tx_type_ = GET_PARAM(2);619 tx_type_ = GET_PARAM(2);
636 bit_depth_ = GET_PARAM(3);620 bit_depth_ = GET_PARAM(3);
637 pitch_ = 16;621 pitch_ = 16;
638 fwd_txfm_ref = fdct16x16_ref;622 fwd_txfm_ref = fdct16x16_ref;
639 inv_txfm_ref = idct16x16_ref;623 inv_txfm_ref = idct16x16_ref;
640 mask_ = (1 << bit_depth_) - 1;624 mask_ = (1 << bit_depth_) - 1;
641#if CONFIG_VP9_HIGHBITDEPTH625#if CONFIG_VP9_HIGHBITDEPTH
642 switch (bit_depth_) {626 switch (bit_depth_) {
643 case VPX_BITS_10:627 case VPX_BITS_10: inv_txfm_ref = idct16x16_10_ref; break;
644 inv_txfm_ref = idct16x16_10_ref;628 case VPX_BITS_12: inv_txfm_ref = idct16x16_12_ref; break;
645 break;629 default: inv_txfm_ref = idct16x16_ref; break;
646 case VPX_BITS_12:
647 inv_txfm_ref = idct16x16_12_ref;
648 break;
649 default:
650 inv_txfm_ref = idct16x16_ref;
651 break;
652 }630 }
653#else631#else
654 inv_txfm_ref = idct16x16_ref;632 inv_txfm_ref = idct16x16_ref;
@@ -668,17 +646,11 @@ class Trans16x16DCT · 13 unmodified lines
668 IdctFunc inv_txfm_;646 IdctFunc inv_txfm_;
669};647};
670 648
671TEST_P(Trans16x16DCT, AccuracyCheck) {649TEST_P(Trans16x16DCT, AccuracyCheck) { RunAccuracyCheck(); }
672 RunAccuracyCheck();
673}
674 650
675TEST_P(Trans16x16DCT, CoeffCheck) {651TEST_P(Trans16x16DCT, CoeffCheck) { RunCoeffCheck(); }
676 RunCoeffCheck();
677}
678 652
679TEST_P(Trans16x16DCT, MemCheck) {653TEST_P(Trans16x16DCT, MemCheck) { RunMemCheck(); }
680 RunMemCheck();
681}
682 654
683TEST_P(Trans16x16DCT, QuantCheck) {655TEST_P(Trans16x16DCT, QuantCheck) {
684 // Use maximally allowed quantization step sizes for DC and AC656 // Use maximally allowed quantization step sizes for DC and AC
@@ -686,36 +658,27 @@ TEST_P(Trans16x16DCT, QuantCheck) { · 1 unmodified line
686 RunQuantCheck(1336, 1828);658 RunQuantCheck(1336, 1828);
687}659}
688 660
689TEST_P(Trans16x16DCT, InvAccuracyCheck) {661TEST_P(Trans16x16DCT, InvAccuracyCheck) { RunInvAccuracyCheck(); }
690 RunInvAccuracyCheck();
691}
692 662
693class Trans16x16HT663class Trans16x16HT : public Trans16x16TestBase,
694 : public Trans16x16TestBase,664 public ::testing::TestWithParam<Ht16x16Param> {
695 public ::testing::TestWithParam<Ht16x16Param> {
696 public:665 public:
697 virtual ~Trans16x16HT() {}666 virtual ~Trans16x16HT() {}
698 667
699 virtual void SetUp() {668 virtual void SetUp() {
700 fwd_txfm_ = GET_PARAM(0);669 fwd_txfm_ = GET_PARAM(0);
701 inv_txfm_ = GET_PARAM(1);670 inv_txfm_ = GET_PARAM(1);
702 tx_type_ = GET_PARAM(2);671 tx_type_ = GET_PARAM(2);
703 bit_depth_ = GET_PARAM(3);672 bit_depth_ = GET_PARAM(3);
704 pitch_ = 16;673 pitch_ = 16;
705 fwd_txfm_ref = fht16x16_ref;674 fwd_txfm_ref = fht16x16_ref;
706 inv_txfm_ref = iht16x16_ref;675 inv_txfm_ref = iht16x16_ref;
707 mask_ = (1 << bit_depth_) - 1;676 mask_ = (1 << bit_depth_) - 1;
708#if CONFIG_VP9_HIGHBITDEPTH677#if CONFIG_VP9_HIGHBITDEPTH
709 switch (bit_depth_) {678 switch (bit_depth_) {
710 case VPX_BITS_10:679 case VPX_BITS_10: inv_txfm_ref = iht16x16_10; break;
711 inv_txfm_ref = iht16x16_10;680 case VPX_BITS_12: inv_txfm_ref = iht16x16_12; break;
712 break;681 default: inv_txfm_ref = iht16x16_ref; break;
713 case VPX_BITS_12:
714 inv_txfm_ref = iht16x16_12;
715 break;
716 default:
717 inv_txfm_ref = iht16x16_ref;
718 break;
719 }682 }
720#else683#else
721 inv_txfm_ref = iht16x16_ref;684 inv_txfm_ref = iht16x16_ref;
@@ -735,17 +698,11 @@ class Trans16x16HT · 13 unmodified lines
735 IhtFunc inv_txfm_;698 IhtFunc inv_txfm_;
736};699};
737 700
738TEST_P(Trans16x16HT, AccuracyCheck) {701TEST_P(Trans16x16HT, AccuracyCheck) { RunAccuracyCheck(); }
739 RunAccuracyCheck();
740}
741 702
742TEST_P(Trans16x16HT, CoeffCheck) {703TEST_P(Trans16x16HT, CoeffCheck) { RunCoeffCheck(); }
743 RunCoeffCheck();
744}
745 704
746TEST_P(Trans16x16HT, MemCheck) {705TEST_P(Trans16x16HT, MemCheck) { RunMemCheck(); }
747 RunMemCheck();
748}
749 706
750TEST_P(Trans16x16HT, QuantCheck) {707TEST_P(Trans16x16HT, QuantCheck) {
751 // The encoder skips any non-DC intra prediction modes,708 // The encoder skips any non-DC intra prediction modes,
@@ -753,9 +710,8 @@ TEST_P(Trans16x16HT, QuantCheck) { · 1 unmodified line
753 RunQuantCheck(429, 729);710 RunQuantCheck(429, 729);
754}711}
755 712
756class InvTrans16x16DCT713class InvTrans16x16DCT : public Trans16x16TestBase,
757 : public Trans16x16TestBase,714 public ::testing::TestWithParam<Idct16x16Param> {
758 public ::testing::TestWithParam<Idct16x16Param> {
759 public:715 public:
760 virtual ~InvTrans16x16DCT() {}716 virtual ~InvTrans16x16DCT() {}
761 717
@@ -766,7 +722,7 @@ class InvTrans16x16DCT · 4 unmodified lines
766 bit_depth_ = GET_PARAM(3);722 bit_depth_ = GET_PARAM(3);
767 pitch_ = 16;723 pitch_ = 16;
768 mask_ = (1 << bit_depth_) - 1;724 mask_ = (1 << bit_depth_) - 1;
769}725 }
770 virtual void TearDown() { libvpx_test::ClearSystemState(); }726 virtual void TearDown() { libvpx_test::ClearSystemState(); }
771 727
772 protected:728 protected:
@@ -784,9 +740,8 @@ TEST_P(InvTrans16x16DCT, CompareReference) { · 11 unmodified lines
784 CompareInvReference(ref_txfm_, thresh_);740 CompareInvReference(ref_txfm_, thresh_);
785}741}
786 742
787class PartialTrans16x16Test743class PartialTrans16x16Test : public ::testing::TestWithParam<
788 : public ::testing::TestWithParam<744 std::tr1::tuple<FdctFunc, vpx_bit_depth_t> > {
789 std::tr1::tuple<FdctFunc, vpx_bit_depth_t> > {
790 public:745 public:
791 virtual ~PartialTrans16x16Test() {}746 virtual ~PartialTrans16x16Test() {}
792 virtual void SetUp() {747 virtual void SetUp() {
@@ -855,10 +810,10 @@ INSTANTIATE_TEST_CASE_P( · 62 unmodified lines
855 make_tuple(&vpx_highbd_fdct16x16_c, &idct16x16_12, 0, VPX_BITS_12),810 make_tuple(&vpx_highbd_fdct16x16_c, &idct16x16_12, 0, VPX_BITS_12),
856 make_tuple(&vpx_fdct16x16_c, &vpx_idct16x16_256_add_c, 0, VPX_BITS_8)));811 make_tuple(&vpx_fdct16x16_c, &vpx_idct16x16_256_add_c, 0, VPX_BITS_8)));
857#else812#else
858INSTANTIATE_TEST_CASE_P(813INSTANTIATE_TEST_CASE_P(C, Trans16x16DCT,
859 C, Trans16x16DCT,814 ::testing::Values(make_tuple(&vpx_fdct16x16_c,
860 ::testing::Values(815 &vpx_idct16x16_256_add_c,
861 make_tuple(&vpx_fdct16x16_c, &vpx_idct16x16_256_add_c, 0, VPX_BITS_8)));816 0, VPX_BITS_8)));
862#endif // CONFIG_VP9_HIGHBITDEPTH817#endif // CONFIG_VP9_HIGHBITDEPTH
863 818
864#if CONFIG_VP9_HIGHBITDEPTH819#if CONFIG_VP9_HIGHBITDEPTH
@@ -898,28 +853,25 @@ INSTANTIATE_TEST_CASE_P(C, PartialTrans16x16Test, · 33 unmodified lines
898#if HAVE_NEON_ASM && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE853#if HAVE_NEON_ASM && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
899INSTANTIATE_TEST_CASE_P(854INSTANTIATE_TEST_CASE_P(
900 NEON, Trans16x16DCT,855 NEON, Trans16x16DCT,
901 ::testing::Values(856 ::testing::Values(make_tuple(&vpx_fdct16x16_c, &vpx_idct16x16_256_add_neon,
902 make_tuple(&vpx_fdct16x16_c,857 0, VPX_BITS_8)));
903 &vpx_idct16x16_256_add_neon, 0, VPX_BITS_8)));
904#endif858#endif
905 859
906#if HAVE_SSE2 && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE860#if HAVE_SSE2 && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
907INSTANTIATE_TEST_CASE_P(861INSTANTIATE_TEST_CASE_P(
908 SSE2, Trans16x16DCT,862 SSE2, Trans16x16DCT,
909 ::testing::Values(863 ::testing::Values(make_tuple(&vpx_fdct16x16_sse2,
910 make_tuple(&vpx_fdct16x16_sse2,864 &vpx_idct16x16_256_add_sse2, 0, VPX_BITS_8)));
911 &vpx_idct16x16_256_add_sse2, 0, VPX_BITS_8)));
912INSTANTIATE_TEST_CASE_P(865INSTANTIATE_TEST_CASE_P(
913 SSE2, Trans16x16HT,866 SSE2, Trans16x16HT,
914 ::testing::Values(867 ::testing::Values(make_tuple(&vp9_fht16x16_sse2, &vp9_iht16x16_256_add_sse2,
915 make_tuple(&vp9_fht16x16_sse2, &vp9_iht16x16_256_add_sse2, 0,868 0, VPX_BITS_8),
916 VPX_BITS_8),869 make_tuple(&vp9_fht16x16_sse2, &vp9_iht16x16_256_add_sse2,
917 make_tuple(&vp9_fht16x16_sse2, &vp9_iht16x16_256_add_sse2, 1,870 1, VPX_BITS_8),
918 VPX_BITS_8),871 make_tuple(&vp9_fht16x16_sse2, &vp9_iht16x16_256_add_sse2,
919 make_tuple(&vp9_fht16x16_sse2, &vp9_iht16x16_256_add_sse2, 2,872 2, VPX_BITS_8),
920 VPX_BITS_8),873 make_tuple(&vp9_fht16x16_sse2, &vp9_iht16x16_256_add_sse2,
921 make_tuple(&vp9_fht16x16_sse2, &vp9_iht16x16_256_add_sse2, 3,874 3, VPX_BITS_8)));
922 VPX_BITS_8)));
923INSTANTIATE_TEST_CASE_P(SSE2, PartialTrans16x16Test,875INSTANTIATE_TEST_CASE_P(SSE2, PartialTrans16x16Test,
924 ::testing::Values(make_tuple(&vpx_fdct16x16_1_sse2,876 ::testing::Values(make_tuple(&vpx_fdct16x16_1_sse2,
925 VPX_BITS_8)));877 VPX_BITS_8)));
@@ -929,16 +881,14 @@ INSTANTIATE_TEST_CASE_P(SSE2, PartialTrans16x16Test, · 3 unmodified lines
929INSTANTIATE_TEST_CASE_P(881INSTANTIATE_TEST_CASE_P(
930 SSE2, Trans16x16DCT,882 SSE2, Trans16x16DCT,
931 ::testing::Values(883 ::testing::Values(
932 make_tuple(&vpx_highbd_fdct16x16_sse2,884 make_tuple(&vpx_highbd_fdct16x16_sse2, &idct16x16_10, 0, VPX_BITS_10),
933 &idct16x16_10, 0, VPX_BITS_10),885 make_tuple(&vpx_highbd_fdct16x16_c, &idct16x16_256_add_10_sse2, 0,
934 make_tuple(&vpx_highbd_fdct16x16_c,886 VPX_BITS_10),
935 &idct16x16_256_add_10_sse2, 0, VPX_BITS_10),887 make_tuple(&vpx_highbd_fdct16x16_sse2, &idct16x16_12, 0, VPX_BITS_12),
936 make_tuple(&vpx_highbd_fdct16x16_sse2,888 make_tuple(&vpx_highbd_fdct16x16_c, &idct16x16_256_add_12_sse2, 0,
937 &idct16x16_12, 0, VPX_BITS_12),889 VPX_BITS_12),
938 make_tuple(&vpx_highbd_fdct16x16_c,890 make_tuple(&vpx_fdct16x16_sse2, &vpx_idct16x16_256_add_c, 0,
939 &idct16x16_256_add_12_sse2, 0, VPX_BITS_12),891 VPX_BITS_8)));
940 make_tuple(&vpx_fdct16x16_sse2,
941 &vpx_idct16x16_256_add_c, 0, VPX_BITS_8)));
942INSTANTIATE_TEST_CASE_P(892INSTANTIATE_TEST_CASE_P(
943 SSE2, Trans16x16HT,893 SSE2, Trans16x16HT,
944 ::testing::Values(894 ::testing::Values(
@@ -951,26 +901,24 @@ INSTANTIATE_TEST_CASE_P( · 6 unmodified lines
951// that to test both branches.901// that to test both branches.
952INSTANTIATE_TEST_CASE_P(902INSTANTIATE_TEST_CASE_P(
953 SSE2, InvTrans16x16DCT,903 SSE2, InvTrans16x16DCT,
954 ::testing::Values(904 ::testing::Values(make_tuple(&idct16x16_10_add_10_c,
955 make_tuple(&idct16x16_10_add_10_c,905 &idct16x16_10_add_10_sse2, 3167, VPX_BITS_10),
956 &idct16x16_10_add_10_sse2, 3167, VPX_BITS_10),906 make_tuple(&idct16x16_10, &idct16x16_256_add_10_sse2,
957 make_tuple(&idct16x16_10,907 3167, VPX_BITS_10),
958 &idct16x16_256_add_10_sse2, 3167, VPX_BITS_10),908 make_tuple(&idct16x16_10_add_12_c,
959 make_tuple(&idct16x16_10_add_12_c,909 &idct16x16_10_add_12_sse2, 3167, VPX_BITS_12),
960 &idct16x16_10_add_12_sse2, 3167, VPX_BITS_12),910 make_tuple(&idct16x16_12, &idct16x16_256_add_12_sse2,
961 make_tuple(&idct16x16_12,911 3167, VPX_BITS_12)));
962 &idct16x16_256_add_12_sse2, 3167, VPX_BITS_12)));
963INSTANTIATE_TEST_CASE_P(SSE2, PartialTrans16x16Test,912INSTANTIATE_TEST_CASE_P(SSE2, PartialTrans16x16Test,
964 ::testing::Values(make_tuple(&vpx_fdct16x16_1_sse2,913 ::testing::Values(make_tuple(&vpx_fdct16x16_1_sse2,
965 VPX_BITS_8)));914 VPX_BITS_8)));
966#endif // HAVE_SSE2 && CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE915#endif // HAVE_SSE2 && CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
967 916
968#if HAVE_MSA && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE917#if HAVE_MSA && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
969INSTANTIATE_TEST_CASE_P(918INSTANTIATE_TEST_CASE_P(MSA, Trans16x16DCT,
970 MSA, Trans16x16DCT,919 ::testing::Values(make_tuple(&vpx_fdct16x16_msa,
971 ::testing::Values(920 &vpx_idct16x16_256_add_msa,
972 make_tuple(&vpx_fdct16x16_msa,921 0, VPX_BITS_8)));
973 &vpx_idct16x16_256_add_msa, 0, VPX_BITS_8)));
974INSTANTIATE_TEST_CASE_P(922INSTANTIATE_TEST_CASE_P(
975 MSA, Trans16x16HT,923 MSA, Trans16x16HT,
976 ::testing::Values(924 ::testing::Values(
test/dct32x32_test.cc+41−60
@@ -39,8 +39,7 @@ void reference_32x32_dct_1d(const double in[32], double out[32]) { · 38 unmodified lines
39 out[k] = 0.0;39 out[k] = 0.0;
40 for (int n = 0; n < 32; n++)40 for (int n = 0; n < 32; n++)
41 out[k] += in[n] * cos(kPi * (2 * n + 1) * k / 64.0);41 out[k] += in[n] * cos(kPi * (2 * n + 1) * k / 64.0);
42 if (k == 0)42 if (k == 0) out[k] = out[k] * kInvSqrt2;
43 out[k] = out[k] * kInvSqrt2;
44 }43 }
45}44}
46 45
@@ -49,21 +48,17 @@ void reference_32x32_dct_2d(const int16_t input[kNumCoeffs], · 2 unmodified lines
49 // First transform columns48 // First transform columns
50 for (int i = 0; i < 32; ++i) {49 for (int i = 0; i < 32; ++i) {
51 double temp_in[32], temp_out[32];50 double temp_in[32], temp_out[32];
52 for (int j = 0; j < 32; ++j)51 for (int j = 0; j < 32; ++j) temp_in[j] = input[j * 32 + i];
53 temp_in[j] = input[j*32 + i];
54 reference_32x32_dct_1d(temp_in, temp_out);52 reference_32x32_dct_1d(temp_in, temp_out);
55 for (int j = 0; j < 32; ++j)53 for (int j = 0; j < 32; ++j) output[j * 32 + i] = temp_out[j];
56 output[j * 32 + i] = temp_out[j];
57 }54 }
58 // Then transform rows55 // Then transform rows
59 for (int i = 0; i < 32; ++i) {56 for (int i = 0; i < 32; ++i) {
60 double temp_in[32], temp_out[32];57 double temp_in[32], temp_out[32];
61 for (int j = 0; j < 32; ++j)58 for (int j = 0; j < 32; ++j) temp_in[j] = output[j + i * 32];
62 temp_in[j] = output[j + i*32];
63 reference_32x32_dct_1d(temp_in, temp_out);59 reference_32x32_dct_1d(temp_in, temp_out);
64 // Scale by some magic number60 // Scale by some magic number
65 for (int j = 0; j < 32; ++j)61 for (int j = 0; j < 32; ++j) output[j + i * 32] = temp_out[j] / 4;
66 output[j + i * 32] = temp_out[j] / 4;
67 }62 }
68}63}
69 64
@@ -89,8 +84,8 @@ class Trans32x32Test : public ::testing::TestWithParam<Trans32x32Param> { · 19 unmodified lines
89 virtual void SetUp() {84 virtual void SetUp() {
90 fwd_txfm_ = GET_PARAM(0);85 fwd_txfm_ = GET_PARAM(0);
91 inv_txfm_ = GET_PARAM(1);86 inv_txfm_ = GET_PARAM(1);
92 version_ = GET_PARAM(2); // 0: high precision forward transform87 version_ = GET_PARAM(2); // 0: high precision forward transform
93 // 1: low precision version for rd loop88 // 1: low precision version for rd loop
94 bit_depth_ = GET_PARAM(3);89 bit_depth_ = GET_PARAM(3);
95 mask_ = (1 << bit_depth_) - 1;90 mask_ = (1 << bit_depth_) - 1;
96 }91 }
@@ -140,8 +135,8 @@ TEST_P(Trans32x32Test, AccuracyCheck) { · 43 unmodified lines
140 ASM_REGISTER_STATE_CHECK(inv_txfm_(test_temp_block, dst, 32));135 ASM_REGISTER_STATE_CHECK(inv_txfm_(test_temp_block, dst, 32));
141#if CONFIG_VP9_HIGHBITDEPTH136#if CONFIG_VP9_HIGHBITDEPTH
142 } else {137 } else {
143 ASM_REGISTER_STATE_CHECK(inv_txfm_(test_temp_block,138 ASM_REGISTER_STATE_CHECK(
144 CONVERT_TO_BYTEPTR(dst16), 32));139 inv_txfm_(test_temp_block, CONVERT_TO_BYTEPTR(dst16), 32));
145#endif140#endif
146 }141 }
147 142
@@ -153,8 +148,7 @@ TEST_P(Trans32x32Test, AccuracyCheck) { · 5 unmodified lines
153 const int32_t diff = dst[j] - src[j];148 const int32_t diff = dst[j] - src[j];
154#endif149#endif
155 const uint32_t error = diff * diff;150 const uint32_t error = diff * diff;
156 if (max_error < error)151 if (max_error < error) max_error = error;
157 max_error = error;
158 total_error += error;152 total_error += error;
159 }153 }
160 }154 }
@@ -213,11 +207,9 @@ TEST_P(Trans32x32Test, MemCheck) { · 52 unmodified lines
213 input_extreme_block[j] = rnd.Rand8() & 1 ? mask_ : -mask_;207 input_extreme_block[j] = rnd.Rand8() & 1 ? mask_ : -mask_;
214 }208 }
215 if (i == 0) {209 if (i == 0) {
216 for (int j = 0; j < kNumCoeffs; ++j)210 for (int j = 0; j < kNumCoeffs; ++j) input_extreme_block[j] = mask_;
217 input_extreme_block[j] = mask_;
218 } else if (i == 1) {211 } else if (i == 1) {
219 for (int j = 0; j < kNumCoeffs; ++j)212 for (int j = 0; j < kNumCoeffs; ++j) input_extreme_block[j] = -mask_;
220 input_extreme_block[j] = -mask_;
221 }213 }
222 214
223 const int stride = 32;215 const int stride = 32;
@@ -291,9 +283,8 @@ TEST_P(Trans32x32Test, InverseAccuracy) { · 67 unmodified lines
291 const int diff = dst[j] - src[j];283 const int diff = dst[j] - src[j];
292#endif284#endif
293 const int error = diff * diff;285 const int error = diff * diff;
294 EXPECT_GE(1, error)286 EXPECT_GE(1, error) << "Error: 32x32 IDCT has error " << error
295 << "Error: 32x32 IDCT has error " << error287 << " at index " << j;
296 << " at index " << j;
297 }288 }
298 }289 }
299}290}
@@ -365,18 +356,13 @@ using std::tr1::make_tuple; · 65 unmodified lines
365INSTANTIATE_TEST_CASE_P(356INSTANTIATE_TEST_CASE_P(
366 C, Trans32x32Test,357 C, Trans32x32Test,
367 ::testing::Values(358 ::testing::Values(
368 make_tuple(&vpx_highbd_fdct32x32_c,359 make_tuple(&vpx_highbd_fdct32x32_c, &idct32x32_10, 0, VPX_BITS_10),
369 &idct32x32_10, 0, VPX_BITS_10),360 make_tuple(&vpx_highbd_fdct32x32_rd_c, &idct32x32_10, 1, VPX_BITS_10),
370 make_tuple(&vpx_highbd_fdct32x32_rd_c,361 make_tuple(&vpx_highbd_fdct32x32_c, &idct32x32_12, 0, VPX_BITS_12),
371 &idct32x32_10, 1, VPX_BITS_10),362 make_tuple(&vpx_highbd_fdct32x32_rd_c, &idct32x32_12, 1, VPX_BITS_12),
372 make_tuple(&vpx_highbd_fdct32x32_c,363 make_tuple(&vpx_fdct32x32_c, &vpx_idct32x32_1024_add_c, 0, VPX_BITS_8),
373 &idct32x32_12, 0, VPX_BITS_12),364 make_tuple(&vpx_fdct32x32_rd_c, &vpx_idct32x32_1024_add_c, 1,
374 make_tuple(&vpx_highbd_fdct32x32_rd_c,365 VPX_BITS_8)));
375 &idct32x32_12, 1, VPX_BITS_12),
376 make_tuple(&vpx_fdct32x32_c,
377 &vpx_idct32x32_1024_add_c, 0, VPX_BITS_8),
378 make_tuple(&vpx_fdct32x32_rd_c,
379 &vpx_idct32x32_1024_add_c, 1, VPX_BITS_8)));
380INSTANTIATE_TEST_CASE_P(366INSTANTIATE_TEST_CASE_P(
381 C, PartialTrans32x32Test,367 C, PartialTrans32x32Test,
382 ::testing::Values(make_tuple(&vpx_highbd_fdct32x32_1_c, VPX_BITS_8),368 ::testing::Values(make_tuple(&vpx_highbd_fdct32x32_1_c, VPX_BITS_8),
@@ -385,11 +371,10 @@ INSTANTIATE_TEST_CASE_P( · 2 unmodified lines
385#else371#else
386INSTANTIATE_TEST_CASE_P(372INSTANTIATE_TEST_CASE_P(
387 C, Trans32x32Test,373 C, Trans32x32Test,
388 ::testing::Values(374 ::testing::Values(make_tuple(&vpx_fdct32x32_c, &vpx_idct32x32_1024_add_c, 0,
389 make_tuple(&vpx_fdct32x32_c,375 VPX_BITS_8),
390 &vpx_idct32x32_1024_add_c, 0, VPX_BITS_8),376 make_tuple(&vpx_fdct32x32_rd_c, &vpx_idct32x32_1024_add_c,
391 make_tuple(&vpx_fdct32x32_rd_c,377 1, VPX_BITS_8)));
392 &vpx_idct32x32_1024_add_c, 1, VPX_BITS_8)));
393INSTANTIATE_TEST_CASE_P(C, PartialTrans32x32Test,378INSTANTIATE_TEST_CASE_P(C, PartialTrans32x32Test,
394 ::testing::Values(make_tuple(&vpx_fdct32x32_1_c,379 ::testing::Values(make_tuple(&vpx_fdct32x32_1_c,
395 VPX_BITS_8)));380 VPX_BITS_8)));
@@ -398,21 +383,19 @@ INSTANTIATE_TEST_CASE_P(C, PartialTrans32x32Test, · 2 unmodified lines
398#if HAVE_NEON && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE383#if HAVE_NEON && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
399INSTANTIATE_TEST_CASE_P(384INSTANTIATE_TEST_CASE_P(
400 NEON, Trans32x32Test,385 NEON, Trans32x32Test,
401 ::testing::Values(386 ::testing::Values(make_tuple(&vpx_fdct32x32_c, &vpx_idct32x32_1024_add_neon,
402 make_tuple(&vpx_fdct32x32_c,387 0, VPX_BITS_8),
403 &vpx_idct32x32_1024_add_neon, 0, VPX_BITS_8),388 make_tuple(&vpx_fdct32x32_rd_c,
404 make_tuple(&vpx_fdct32x32_rd_c,389 &vpx_idct32x32_1024_add_neon, 1, VPX_BITS_8)));
405 &vpx_idct32x32_1024_add_neon, 1, VPX_BITS_8)));
406#endif // HAVE_NEON && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE390#endif // HAVE_NEON && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
407 391
408#if HAVE_SSE2 && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE392#if HAVE_SSE2 && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
409INSTANTIATE_TEST_CASE_P(393INSTANTIATE_TEST_CASE_P(
410 SSE2, Trans32x32Test,394 SSE2, Trans32x32Test,
411 ::testing::Values(395 ::testing::Values(make_tuple(&vpx_fdct32x32_sse2,
412 make_tuple(&vpx_fdct32x32_sse2,396 &vpx_idct32x32_1024_add_sse2, 0, VPX_BITS_8),
413 &vpx_idct32x32_1024_add_sse2, 0, VPX_BITS_8),397 make_tuple(&vpx_fdct32x32_rd_sse2,
414 make_tuple(&vpx_fdct32x32_rd_sse2,398 &vpx_idct32x32_1024_add_sse2, 1, VPX_BITS_8)));
415 &vpx_idct32x32_1024_add_sse2, 1, VPX_BITS_8)));
416INSTANTIATE_TEST_CASE_P(SSE2, PartialTrans32x32Test,399INSTANTIATE_TEST_CASE_P(SSE2, PartialTrans32x32Test,
417 ::testing::Values(make_tuple(&vpx_fdct32x32_1_sse2,400 ::testing::Values(make_tuple(&vpx_fdct32x32_1_sse2,
418 VPX_BITS_8)));401 VPX_BITS_8)));
@@ -440,21 +423,19 @@ INSTANTIATE_TEST_CASE_P(SSE2, PartialTrans32x32Test, · 21 unmodified lines
440#if HAVE_AVX2 && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE423#if HAVE_AVX2 && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
441INSTANTIATE_TEST_CASE_P(424INSTANTIATE_TEST_CASE_P(
442 AVX2, Trans32x32Test,425 AVX2, Trans32x32Test,
443 ::testing::Values(426 ::testing::Values(make_tuple(&vpx_fdct32x32_avx2,
444 make_tuple(&vpx_fdct32x32_avx2,427 &vpx_idct32x32_1024_add_sse2, 0, VPX_BITS_8),
445 &vpx_idct32x32_1024_add_sse2, 0, VPX_BITS_8),428 make_tuple(&vpx_fdct32x32_rd_avx2,
446 make_tuple(&vpx_fdct32x32_rd_avx2,429 &vpx_idct32x32_1024_add_sse2, 1, VPX_BITS_8)));
447 &vpx_idct32x32_1024_add_sse2, 1, VPX_BITS_8)));
448#endif // HAVE_AVX2 && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE430#endif // HAVE_AVX2 && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
449 431
450#if HAVE_MSA && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE432#if HAVE_MSA && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
451INSTANTIATE_TEST_CASE_P(433INSTANTIATE_TEST_CASE_P(
452 MSA, Trans32x32Test,434 MSA, Trans32x32Test,
453 ::testing::Values(435 ::testing::Values(make_tuple(&vpx_fdct32x32_msa,
454 make_tuple(&vpx_fdct32x32_msa,436 &vpx_idct32x32_1024_add_msa, 0, VPX_BITS_8),
455 &vpx_idct32x32_1024_add_msa, 0, VPX_BITS_8),437 make_tuple(&vpx_fdct32x32_rd_msa,
456 make_tuple(&vpx_fdct32x32_rd_msa,438 &vpx_idct32x32_1024_add_msa, 1, VPX_BITS_8)));
457 &vpx_idct32x32_1024_add_msa, 1, VPX_BITS_8)));
458INSTANTIATE_TEST_CASE_P(MSA, PartialTrans32x32Test,439INSTANTIATE_TEST_CASE_P(MSA, PartialTrans32x32Test,
459 ::testing::Values(make_tuple(&vpx_fdct32x32_1_msa,440 ::testing::Values(make_tuple(&vpx_fdct32x32_1_msa,
460 VPX_BITS_8)));441 VPX_BITS_8)));
test/decode_api_test.cc+12−19
@@ -28,7 +28,7 @@ TEST(DecodeAPI, InvalidParams) { · 27 unmodified lines
28 &vpx_codec_vp9_dx_algo,28 &vpx_codec_vp9_dx_algo,
29#endif29#endif
30 };30 };
31 uint8_t buf[1] = {0};31 uint8_t buf[1] = { 0 };
32 vpx_codec_ctx_t dec;32 vpx_codec_ctx_t dec;
33 33
34 EXPECT_EQ(VPX_CODEC_INVALID_PARAM, vpx_codec_dec_init(NULL, NULL, NULL, 0));34 EXPECT_EQ(VPX_CODEC_INVALID_PARAM, vpx_codec_dec_init(NULL, NULL, NULL, 0));
@@ -51,8 +51,7 @@ TEST(DecodeAPI, InvalidParams) { · 16 unmodified lines
51 vpx_codec_decode(&dec, buf, NELEMENTS(buf), NULL, 0));51 vpx_codec_decode(&dec, buf, NELEMENTS(buf), NULL, 0));
52 EXPECT_EQ(VPX_CODEC_INVALID_PARAM,52 EXPECT_EQ(VPX_CODEC_INVALID_PARAM,
53 vpx_codec_decode(&dec, NULL, NELEMENTS(buf), NULL, 0));53 vpx_codec_decode(&dec, NULL, NELEMENTS(buf), NULL, 0));
54 EXPECT_EQ(VPX_CODEC_INVALID_PARAM,54 EXPECT_EQ(VPX_CODEC_INVALID_PARAM, vpx_codec_decode(&dec, buf, 0, NULL, 0));
55 vpx_codec_decode(&dec, buf, 0, NULL, 0));
56 55
57 EXPECT_EQ(VPX_CODEC_OK, vpx_codec_destroy(&dec));56 EXPECT_EQ(VPX_CODEC_OK, vpx_codec_destroy(&dec));
58 }57 }
@@ -77,12 +76,9 @@ TEST(DecodeAPI, OptionalParams) { · 18 unmodified lines
77// Test VP9 codec controls after a decode error to ensure the code doesn't76// Test VP9 codec controls after a decode error to ensure the code doesn't
78// misbehave.77// misbehave.
79void TestVp9Controls(vpx_codec_ctx_t *dec) {78void TestVp9Controls(vpx_codec_ctx_t *dec) {
80 static const int kControls[] = {79 static const int kControls[] = { VP8D_GET_LAST_REF_UPDATES,
81 VP8D_GET_LAST_REF_UPDATES,80 VP8D_GET_FRAME_CORRUPTED,
82 VP8D_GET_FRAME_CORRUPTED,81 VP9D_GET_DISPLAY_SIZE, VP9D_GET_FRAME_SIZE };
83 VP9D_GET_DISPLAY_SIZE,
84 VP9D_GET_FRAME_SIZE
85 };
86 int val[2];82 int val[2];
87 83
88 for (int i = 0; i < NELEMENTS(kControls); ++i) {84 for (int i = 0; i < NELEMENTS(kControls); ++i) {
@@ -91,9 +87,7 @@ void TestVp9Controls(vpx_codec_ctx_t *dec) { · 2 unmodified lines
91 case VP8D_GET_FRAME_CORRUPTED:87 case VP8D_GET_FRAME_CORRUPTED:
92 EXPECT_EQ(VPX_CODEC_ERROR, res) << kControls[i];88 EXPECT_EQ(VPX_CODEC_ERROR, res) << kControls[i];
93 break;89 break;
94 default:90 default: EXPECT_EQ(VPX_CODEC_OK, res) << kControls[i]; break;
95 EXPECT_EQ(VPX_CODEC_OK, res) << kControls[i];
96 break;
97 }91 }
98 EXPECT_EQ(VPX_CODEC_INVALID_PARAM,92 EXPECT_EQ(VPX_CODEC_INVALID_PARAM,
99 vpx_codec_control_(dec, kControls[i], NULL));93 vpx_codec_control_(dec, kControls[i], NULL));
@@ -150,10 +144,9 @@ TEST(DecodeAPI, Vp9PeekSI) { · 50 unmodified lines
150 // size 10, this should return VPX_CODEC_UNSUP_BITSTREAM and after that it144 // size 10, this should return VPX_CODEC_UNSUP_BITSTREAM and after that it
151 // should return VPX_CODEC_CORRUPT_FRAME.145 // should return VPX_CODEC_CORRUPT_FRAME.
152 const uint8_t data[32] = {146 const uint8_t data[32] = {
153 0x85, 0xa4, 0xc1, 0xa1, 0x38, 0x81, 0xa3, 0x49,147 0x85, 0xa4, 0xc1, 0xa1, 0x38, 0x81, 0xa3, 0x49, 0x83, 0xff, 0xff,
154 0x83, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,148 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
155 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,149 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
156 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
157 };150 };
158 151
159 for (uint32_t data_sz = 1; data_sz <= 32; ++data_sz) {152 for (uint32_t data_sz = 1; data_sz <= 32; ++data_sz) {
@@ -162,9 +155,9 @@ TEST(DecodeAPI, Vp9PeekSI) { · 2 unmodified lines
162 if (data_sz >= 8) {155 if (data_sz >= 8) {
163 vpx_codec_ctx_t dec;156 vpx_codec_ctx_t dec;
164 EXPECT_EQ(VPX_CODEC_OK, vpx_codec_dec_init(&dec, codec, NULL, 0));157 EXPECT_EQ(VPX_CODEC_OK, vpx_codec_dec_init(&dec, codec, NULL, 0));
165 EXPECT_EQ((data_sz < 10) ?158 EXPECT_EQ(
166 VPX_CODEC_UNSUP_BITSTREAM : VPX_CODEC_CORRUPT_FRAME,159 (data_sz < 10) ? VPX_CODEC_UNSUP_BITSTREAM : VPX_CODEC_CORRUPT_FRAME,
167 vpx_codec_decode(&dec, data, data_sz, NULL, 0));160 vpx_codec_decode(&dec, data, data_sz, NULL, 0));
168 vpx_codec_iter_t iter = NULL;161 vpx_codec_iter_t iter = NULL;
169 EXPECT_EQ(NULL, vpx_codec_get_frame(&dec, &iter));162 EXPECT_EQ(NULL, vpx_codec_get_frame(&dec, &iter));
170 EXPECT_EQ(VPX_CODEC_OK, vpx_codec_destroy(&dec));163 EXPECT_EQ(VPX_CODEC_OK, vpx_codec_destroy(&dec));
test/decode_perf_test.cc+13−26
@@ -70,8 +70,7 @@ const DecodePerfParam kVP9DecodePerfVectors[] = { · 69 unmodified lines
70 power/temp/min max frame decode times/etc70 power/temp/min max frame decode times/etc
71 */71 */
72 72
73class DecodePerfTest : public ::testing::TestWithParam<DecodePerfParam> {73class DecodePerfTest : public ::testing::TestWithParam<DecodePerfParam> {};
74};
75 74
76TEST_P(DecodePerfTest, PerfTest) {75TEST_P(DecodePerfTest, PerfTest) {
77 const char *const video_name = GET_PARAM(VIDEO_NAME);76 const char *const video_name = GET_PARAM(VIDEO_NAME);
@@ -92,8 +91,7 @@ TEST_P(DecodePerfTest, PerfTest) { · 14 unmodified lines
92 }91 }
93 92
94 vpx_usec_timer_mark(&t);93 vpx_usec_timer_mark(&t);
95 const double elapsed_secs = double(vpx_usec_timer_elapsed(&t))94 const double elapsed_secs = double(vpx_usec_timer_elapsed(&t)) / kUsecsInSec;
96 / kUsecsInSec;
97 const unsigned frames = video.frame_number();95 const unsigned frames = video.frame_number();
98 const double fps = double(frames) / elapsed_secs;96 const double fps = double(frames) / elapsed_secs;
99 97
@@ -111,17 +109,13 @@ TEST_P(DecodePerfTest, PerfTest) { · 11 unmodified lines
111INSTANTIATE_TEST_CASE_P(VP9, DecodePerfTest,109INSTANTIATE_TEST_CASE_P(VP9, DecodePerfTest,
112 ::testing::ValuesIn(kVP9DecodePerfVectors));110 ::testing::ValuesIn(kVP9DecodePerfVectors));
113 111
114class VP9NewEncodeDecodePerfTest :112class VP9NewEncodeDecodePerfTest
115 public ::libvpx_test::EncoderTest,113 : public ::libvpx_test::EncoderTest,
116 public ::libvpx_test::CodecTestWithParam<libvpx_test::TestMode> {114 public ::libvpx_test::CodecTestWithParam<libvpx_test::TestMode> {
117 protected:115 protected:
118 VP9NewEncodeDecodePerfTest()116 VP9NewEncodeDecodePerfTest()
119 : EncoderTest(GET_PARAM(0)),117 : EncoderTest(GET_PARAM(0)), encoding_mode_(GET_PARAM(1)), speed_(0),
120 encoding_mode_(GET_PARAM(1)),118 outfile_(0), out_frames_(0) {}
121 speed_(0),
122 outfile_(0),
123 out_frames_(0) {
124 }
125 119
126 virtual ~VP9NewEncodeDecodePerfTest() {}120 virtual ~VP9NewEncodeDecodePerfTest() {}
127 121
@@ -182,9 +176,7 @@ class VP9NewEncodeDecodePerfTest : · 54 unmodified lines
182 176
183 virtual bool DoDecode() { return false; }177 virtual bool DoDecode() { return false; }
184 178
185 void set_speed(unsigned int speed) {179 void set_speed(unsigned int speed) { speed_ = speed; }
186 speed_ = speed;
187 }
188 180
189 private:181 private:
190 libvpx_test::TestMode encoding_mode_;182 libvpx_test::TestMode encoding_mode_;
@@ -196,10 +188,7 @@ class VP9NewEncodeDecodePerfTest : · 5 unmodified lines
196struct EncodePerfTestVideo {188struct EncodePerfTestVideo {
197 EncodePerfTestVideo(const char *name_, uint32_t width_, uint32_t height_,189 EncodePerfTestVideo(const char *name_, uint32_t width_, uint32_t height_,
198 uint32_t bitrate_, int frames_)190 uint32_t bitrate_, int frames_)
199 : name(name_),191 : name(name_), width(width_), height(height_), bitrate(bitrate_),
200 width(width_),
201 height(height_),
202 bitrate(bitrate_),
203 frames(frames_) {}192 frames(frames_) {}
204 const char *name;193 const char *name;
205 uint32_t width;194 uint32_t width;
@@ -225,10 +214,8 @@ TEST_P(VP9NewEncodeDecodePerfTest, PerfTest) { · 19 unmodified lines
225 214
226 const char *video_name = kVP9EncodePerfTestVectors[i].name;215 const char *video_name = kVP9EncodePerfTestVectors[i].name;
227 libvpx_test::I420VideoSource video(216 libvpx_test::I420VideoSource video(
228 video_name,217 video_name, kVP9EncodePerfTestVectors[i].width,
229 kVP9EncodePerfTestVectors[i].width,218 kVP9EncodePerfTestVectors[i].height, timebase.den, timebase.num, 0,
230 kVP9EncodePerfTestVectors[i].height,
231 timebase.den, timebase.num, 0,
232 kVP9EncodePerfTestVectors[i].frames);219 kVP9EncodePerfTestVectors[i].frames);
233 set_speed(2);220 set_speed(2);
234 221
@@ -268,6 +255,6 @@ TEST_P(VP9NewEncodeDecodePerfTest, PerfTest) { · 33 unmodified lines
268 printf("}\n");255 printf("}\n");
269}256}
270 257
271VP9_INSTANTIATE_TEST_CASE(258VP9_INSTANTIATE_TEST_CASE(VP9NewEncodeDecodePerfTest,
272 VP9NewEncodeDecodePerfTest, ::testing::Values(::libvpx_test::kTwoPassGood));259 ::testing::Values(::libvpx_test::kTwoPassGood));
273} // namespace260} // namespace
test/decode_test_driver.cc+11−17
@@ -21,9 +21,8 @@ const char kVP8Name[] = "WebM Project VP8"; · 20 unmodified lines
21 21
22vpx_codec_err_t Decoder::PeekStream(const uint8_t *cxdata, size_t size,22vpx_codec_err_t Decoder::PeekStream(const uint8_t *cxdata, size_t size,
23 vpx_codec_stream_info_t *stream_info) {23 vpx_codec_stream_info_t *stream_info) {
24 return vpx_codec_peek_stream_info(CodecInterface(),24 return vpx_codec_peek_stream_info(
25 cxdata, static_cast<unsigned int>(size),25 CodecInterface(), cxdata, static_cast<unsigned int>(size), stream_info);
26 stream_info);
27}26}
28 27
29vpx_codec_err_t Decoder::DecodeFrame(const uint8_t *cxdata, size_t size) {28vpx_codec_err_t Decoder::DecodeFrame(const uint8_t *cxdata, size_t size) {
@@ -35,9 +34,8 @@ vpx_codec_err_t Decoder::DecodeFrame(const uint8_t *cxdata, size_t size, · 5 unmodified lines
35 vpx_codec_err_t res_dec;34 vpx_codec_err_t res_dec;
36 InitOnce();35 InitOnce();
37 API_REGISTER_STATE_CHECK(36 API_REGISTER_STATE_CHECK(
38 res_dec = vpx_codec_decode(&decoder_,37 res_dec = vpx_codec_decode(
39 cxdata, static_cast<unsigned int>(size),38 &decoder_, cxdata, static_cast<unsigned int>(size), user_priv, 0));
40 user_priv, 0));
41 return res_dec;39 return res_dec;
42}40}
43 41
@@ -67,7 +65,7 @@ void DecoderTest::HandlePeekResult(Decoder *const decoder, · 23 unmodified lines
67 65
68void DecoderTest::RunLoop(CompressedVideoSource *video,66void DecoderTest::RunLoop(CompressedVideoSource *video,
69 const vpx_codec_dec_cfg_t &dec_cfg) {67 const vpx_codec_dec_cfg_t &dec_cfg) {
70 Decoder* const decoder = codec_->CreateDecoder(dec_cfg, flags_, 0);68 Decoder *const decoder = codec_->CreateDecoder(dec_cfg, flags_, 0);
71 ASSERT_TRUE(decoder != NULL);69 ASSERT_TRUE(decoder != NULL);
72 bool end_of_file = false;70 bool end_of_file = false;
73 71
@@ -80,16 +78,14 @@ void DecoderTest::RunLoop(CompressedVideoSource *video, · 6 unmodified lines
80 stream_info.sz = sizeof(stream_info);78 stream_info.sz = sizeof(stream_info);
81 79
82 if (video->cxdata() != NULL) {80 if (video->cxdata() != NULL) {
83 const vpx_codec_err_t res_peek = decoder->PeekStream(video->cxdata(),81 const vpx_codec_err_t res_peek = decoder->PeekStream(
84 video->frame_size(),82 video->cxdata(), video->frame_size(), &stream_info);
85 &stream_info);
86 HandlePeekResult(decoder, video, res_peek);83 HandlePeekResult(decoder, video, res_peek);
87 ASSERT_FALSE(::testing::Test::HasFailure());84 ASSERT_FALSE(::testing::Test::HasFailure());
88 85
89 vpx_codec_err_t res_dec = decoder->DecodeFrame(video->cxdata(),86 vpx_codec_err_t res_dec =
90 video->frame_size());87 decoder->DecodeFrame(video->cxdata(), video->frame_size());
91 if (!HandleDecodeResult(res_dec, *video, decoder))88 if (!HandleDecodeResult(res_dec, *video, decoder)) break;
92 break;
93 } else {89 } else {
94 // Signal end of the file to the decoder.90 // Signal end of the file to the decoder.
95 const vpx_codec_err_t res_dec = decoder->DecodeFrame(NULL, 0);91 const vpx_codec_err_t res_dec = decoder->DecodeFrame(NULL, 0);
@@ -116,8 +112,6 @@ void DecoderTest::set_cfg(const vpx_codec_dec_cfg_t &dec_cfg) { · 20 unmodified lines
116 memcpy(&cfg_, &dec_cfg, sizeof(cfg_));112 memcpy(&cfg_, &dec_cfg, sizeof(cfg_));
117}113}
118 114
119void DecoderTest::set_flags(const vpx_codec_flags_t flags) {115void DecoderTest::set_flags(const vpx_codec_flags_t flags) { flags_ = flags; }
120 flags_ = flags;
121}
122 116
123} // namespace libvpx_test117} // namespace libvpx_test
test/decode_test_driver.h+30−42
@@ -26,13 +26,11 @@ class DxDataIterator { · 25 unmodified lines
26 explicit DxDataIterator(vpx_codec_ctx_t *decoder)26 explicit DxDataIterator(vpx_codec_ctx_t *decoder)
27 : decoder_(decoder), iter_(NULL) {}27 : decoder_(decoder), iter_(NULL) {}
28 28
29 const vpx_image_t *Next() {29 const vpx_image_t *Next() { return vpx_codec_get_frame(decoder_, &iter_); }
30 return vpx_codec_get_frame(decoder_, &iter_);
31 }
32 30
33 private:31 private:
34 vpx_codec_ctx_t *decoder_;32 vpx_codec_ctx_t *decoder_;
35 vpx_codec_iter_t iter_;33 vpx_codec_iter_t iter_;
36};34};
37 35
38// Provides a simplified interface to manage one video decoding.36// Provides a simplified interface to manage one video decoding.
@@ -47,13 +45,14 @@ class Decoder { · 8 unmodified lines
47 45
48 Decoder(vpx_codec_dec_cfg_t cfg, const vpx_codec_flags_t flag,46 Decoder(vpx_codec_dec_cfg_t cfg, const vpx_codec_flags_t flag,
49 unsigned long deadline) // NOLINT47 unsigned long deadline) // NOLINT
50 : cfg_(cfg), flags_(flag), deadline_(deadline), init_done_(false) {48 : cfg_(cfg),
49 flags_(flag),
50 deadline_(deadline),
51 init_done_(false) {
51 memset(&decoder_, 0, sizeof(decoder_));52 memset(&decoder_, 0, sizeof(decoder_));
52 }53 }
53 54
54 virtual ~Decoder() {55 virtual ~Decoder() { vpx_codec_destroy(&decoder_); }
55 vpx_codec_destroy(&decoder_);
56 }
57 56
58 vpx_codec_err_t PeekStream(const uint8_t *cxdata, size_t size,57 vpx_codec_err_t PeekStream(const uint8_t *cxdata, size_t size,
59 vpx_codec_stream_info_t *stream_info);58 vpx_codec_stream_info_t *stream_info);
@@ -63,17 +62,11 @@ class Decoder { · 3 unmodified lines
63 vpx_codec_err_t DecodeFrame(const uint8_t *cxdata, size_t size,62 vpx_codec_err_t DecodeFrame(const uint8_t *cxdata, size_t size,
64 void *user_priv);63 void *user_priv);
65 64
66 DxDataIterator GetDxData() {65 DxDataIterator GetDxData() { return DxDataIterator(&decoder_); }
67 return DxDataIterator(&decoder_);
68 }
69 66
70 void set_deadline(unsigned long deadline) {67 void set_deadline(unsigned long deadline) { deadline_ = deadline; }
71 deadline_ = deadline;
72 }
73 68
74 void Control(int ctrl_id, int arg) {69 void Control(int ctrl_id, int arg) { Control(ctrl_id, arg, VPX_CODEC_OK); }
75 Control(ctrl_id, arg, VPX_CODEC_OK);
76 }
77 70
78 void Control(int ctrl_id, const void *arg) {71 void Control(int ctrl_id, const void *arg) {
79 InitOnce();72 InitOnce();
@@ -87,7 +80,7 @@ class Decoder { · 7 unmodified lines
87 ASSERT_EQ(expected_value, res) << DecodeError();80 ASSERT_EQ(expected_value, res) << DecodeError();
88 }81 }
89 82
90 const char* DecodeError() {83 const char *DecodeError() {
91 const char *detail = vpx_codec_error_detail(&decoder_);84 const char *detail = vpx_codec_error_detail(&decoder_);
92 return detail ? detail : vpx_codec_error(&decoder_);85 return detail ? detail : vpx_codec_error(&decoder_);
93 }86 }
@@ -97,38 +90,35 @@ class Decoder { · 3 unmodified lines
97 vpx_get_frame_buffer_cb_fn_t cb_get,90 vpx_get_frame_buffer_cb_fn_t cb_get,
98 vpx_release_frame_buffer_cb_fn_t cb_release, void *user_priv) {91 vpx_release_frame_buffer_cb_fn_t cb_release, void *user_priv) {
99 InitOnce();92 InitOnce();
100 return vpx_codec_set_frame_buffer_functions(93 return vpx_codec_set_frame_buffer_functions(&decoder_, cb_get, cb_release,
101 &decoder_, cb_get, cb_release, user_priv);94 user_priv);
102 }95 }
103 96
104 const char* GetDecoderName() const {97 const char *GetDecoderName() const {
105 return vpx_codec_iface_name(CodecInterface());98 return vpx_codec_iface_name(CodecInterface());
106 }99 }
107 100
108 bool IsVP8() const;101 bool IsVP8() const;
109 102
110 vpx_codec_ctx_t * GetDecoder() {103 vpx_codec_ctx_t *GetDecoder() { return &decoder_; }
111 return &decoder_;
112 }
113 104
114 protected:105 protected:
115 virtual vpx_codec_iface_t* CodecInterface() const = 0;106 virtual vpx_codec_iface_t *CodecInterface() const = 0;
116 107
117 void InitOnce() {108 void InitOnce() {
118 if (!init_done_) {109 if (!init_done_) {
119 const vpx_codec_err_t res = vpx_codec_dec_init(&decoder_,110 const vpx_codec_err_t res =
120 CodecInterface(),111 vpx_codec_dec_init(&decoder_, CodecInterface(), &cfg_, flags_);
121 &cfg_, flags_);
122 ASSERT_EQ(VPX_CODEC_OK, res) << DecodeError();112 ASSERT_EQ(VPX_CODEC_OK, res) << DecodeError();
123 init_done_ = true;113 init_done_ = true;
124 }114 }
125 }115 }
126 116
127 vpx_codec_ctx_t decoder_;117 vpx_codec_ctx_t decoder_;
128 vpx_codec_dec_cfg_t cfg_;118 vpx_codec_dec_cfg_t cfg_;
129 vpx_codec_flags_t flags_;119 vpx_codec_flags_t flags_;
130 unsigned int deadline_;120 unsigned int deadline_;
131 bool init_done_;121 bool init_done_;
132};122};
133 123
134// Common test functionality for all Decoder tests.124// Common test functionality for all Decoder tests.
@@ -143,37 +133,35 @@ class DecoderTest { · 8 unmodified lines
143 virtual void set_flags(const vpx_codec_flags_t flags);133 virtual void set_flags(const vpx_codec_flags_t flags);
144 134
145 // Hook to be called before decompressing every frame.135 // Hook to be called before decompressing every frame.
146 virtual void PreDecodeFrameHook(const CompressedVideoSource& /*video*/,136 virtual void PreDecodeFrameHook(const CompressedVideoSource & /*video*/,
147 Decoder* /*decoder*/) {}137 Decoder * /*decoder*/) {}
148 138
149 // Hook to be called to handle decode result. Return true to continue.139 // Hook to be called to handle decode result. Return true to continue.
150 virtual bool HandleDecodeResult(const vpx_codec_err_t res_dec,140 virtual bool HandleDecodeResult(const vpx_codec_err_t res_dec,
151 const CompressedVideoSource& /*video*/,141 const CompressedVideoSource & /*video*/,
152 Decoder *decoder) {142 Decoder *decoder) {
153 EXPECT_EQ(VPX_CODEC_OK, res_dec) << decoder->DecodeError();143 EXPECT_EQ(VPX_CODEC_OK, res_dec) << decoder->DecodeError();
154 return VPX_CODEC_OK == res_dec;144 return VPX_CODEC_OK == res_dec;
155 }145 }
156 146
157 // Hook to be called on every decompressed frame.147 // Hook to be called on every decompressed frame.
158 virtual void DecompressedFrameHook(const vpx_image_t& /*img*/,148 virtual void DecompressedFrameHook(const vpx_image_t & /*img*/,
159 const unsigned int /*frame_number*/) {}149 const unsigned int /*frame_number*/) {}
160 150
161 // Hook to be called on peek result151 // Hook to be called on peek result
162 virtual void HandlePeekResult(Decoder* const decoder,152 virtual void HandlePeekResult(Decoder *const decoder,
163 CompressedVideoSource *video,153 CompressedVideoSource *video,
164 const vpx_codec_err_t res_peek);154 const vpx_codec_err_t res_peek);
165 155
166 protected:156 protected:
167 explicit DecoderTest(const CodecFactory *codec)157 explicit DecoderTest(const CodecFactory *codec)
168 : codec_(codec),158 : codec_(codec), cfg_(), flags_(0) {}
169 cfg_(),
170 flags_(0) {}
171 159
172 virtual ~DecoderTest() {}160 virtual ~DecoderTest() {}
173 161
174 const CodecFactory *codec_;162 const CodecFactory *codec_;
175 vpx_codec_dec_cfg_t cfg_;163 vpx_codec_dec_cfg_t cfg_;
176 vpx_codec_flags_t flags_;164 vpx_codec_flags_t flags_;
177};165};
178 166
179} // namespace libvpx_test167} // namespace libvpx_test
test/encode_api_test.cc+1−1
@@ -27,7 +27,7 @@ TEST(EncodeAPI, InvalidParams) { · 26 unmodified lines
27 &vpx_codec_vp9_cx_algo,27 &vpx_codec_vp9_cx_algo,
28#endif28#endif
29 };29 };
30 uint8_t buf[1] = {0};30 uint8_t buf[1] = { 0 };
31 vpx_image_t img;31 vpx_image_t img;
32 vpx_codec_ctx_t enc;32 vpx_codec_ctx_t enc;
33 vpx_codec_enc_cfg_t cfg;33 vpx_codec_enc_cfg_t cfg;
test/encode_perf_test.cc+13−28
@@ -26,10 +26,7 @@ const double kUsecsInSec = 1000000.0; · 25 unmodified lines
26struct EncodePerfTestVideo {26struct EncodePerfTestVideo {
27 EncodePerfTestVideo(const char *name_, uint32_t width_, uint32_t height_,27 EncodePerfTestVideo(const char *name_, uint32_t width_, uint32_t height_,
28 uint32_t bitrate_, int frames_)28 uint32_t bitrate_, int frames_)
29 : name(name_),29 : name(name_), width(width_), height(height_), bitrate(bitrate_),
30 width(width_),
31 height(height_),
32 bitrate(bitrate_),
33 frames(frames_) {}30 frames(frames_) {}
34 const char *name;31 const char *name;
35 uint32_t width;32 uint32_t width;
@@ -45,8 +42,8 @@ const EncodePerfTestVideo kVP9EncodePerfTestVectors[] = { · 9 unmodified lines
45 EncodePerfTestVideo("macmarcostationary_640_480_30.yuv", 640, 480, 200, 718),42 EncodePerfTestVideo("macmarcostationary_640_480_30.yuv", 640, 480, 200, 718),
46 EncodePerfTestVideo("niklas_640_480_30.yuv", 640, 480, 200, 471),43 EncodePerfTestVideo("niklas_640_480_30.yuv", 640, 480, 200, 471),
47 EncodePerfTestVideo("tacomanarrows_640_480_30.yuv", 640, 480, 200, 300),44 EncodePerfTestVideo("tacomanarrows_640_480_30.yuv", 640, 480, 200, 300),
48 EncodePerfTestVideo("tacomasmallcameramovement_640_480_30.yuv",45 EncodePerfTestVideo("tacomasmallcameramovement_640_480_30.yuv", 640, 480, 200,
49 640, 480, 200, 300),46 300),
50 EncodePerfTestVideo("thaloundeskmtg_640_480_30.yuv", 640, 480, 200, 300),47 EncodePerfTestVideo("thaloundeskmtg_640_480_30.yuv", 640, 480, 200, 300),
51 EncodePerfTestVideo("niklas_1280_720_30.yuv", 1280, 720, 600, 470),48 EncodePerfTestVideo("niklas_1280_720_30.yuv", 1280, 720, 600, 470),
52};49};
@@ -61,12 +58,8 @@ class VP9EncodePerfTest · 8 unmodified lines
61 public ::libvpx_test::CodecTestWithParam<libvpx_test::TestMode> {58 public ::libvpx_test::CodecTestWithParam<libvpx_test::TestMode> {
62 protected:59 protected:
63 VP9EncodePerfTest()60 VP9EncodePerfTest()
64 : EncoderTest(GET_PARAM(0)),61 : EncoderTest(GET_PARAM(0)), min_psnr_(kMaxPsnr), nframes_(0),
65 min_psnr_(kMaxPsnr),62 encoding_mode_(GET_PARAM(1)), speed_(0), threads_(1) {}
66 nframes_(0),
67 encoding_mode_(GET_PARAM(1)),
68 speed_(0),
69 threads_(1) {}
70 63
71 virtual ~VP9EncodePerfTest() {}64 virtual ~VP9EncodePerfTest() {}
72 65
@@ -107,24 +100,18 @@ class VP9EncodePerfTest · 34 unmodified lines
107 100
108 virtual void PSNRPktHook(const vpx_codec_cx_pkt_t *pkt) {101 virtual void PSNRPktHook(const vpx_codec_cx_pkt_t *pkt) {
109 if (pkt->data.psnr.psnr[0] < min_psnr_) {102 if (pkt->data.psnr.psnr[0] < min_psnr_) {
110 min_psnr_= pkt->data.psnr.psnr[0];103 min_psnr_ = pkt->data.psnr.psnr[0];
111 }104 }
112 }105 }
113 106
114 // for performance reasons don't decode107 // for performance reasons don't decode
115 virtual bool DoDecode() { return 0; }108 virtual bool DoDecode() { return 0; }
116 109
117 double min_psnr() const {110 double min_psnr() const { return min_psnr_; }
118 return min_psnr_;
119 }
120 111
121 void set_speed(unsigned int speed) {112 void set_speed(unsigned int speed) { speed_ = speed; }
122 speed_ = speed;
123 }
124 113
125 void set_threads(unsigned int threads) {114 void set_threads(unsigned int threads) { threads_ = threads; }
126 threads_ = threads;
127 }
128 115
129 private:116 private:
130 double min_psnr_;117 double min_psnr_;
@@ -157,10 +144,8 @@ TEST_P(VP9EncodePerfTest, PerfTest) { · 26 unmodified lines
157 const unsigned frames = kVP9EncodePerfTestVectors[i].frames;144 const unsigned frames = kVP9EncodePerfTestVectors[i].frames;
158 const char *video_name = kVP9EncodePerfTestVectors[i].name;145 const char *video_name = kVP9EncodePerfTestVectors[i].name;
159 libvpx_test::I420VideoSource video(146 libvpx_test::I420VideoSource video(
160 video_name,147 video_name, kVP9EncodePerfTestVectors[i].width,
161 kVP9EncodePerfTestVectors[i].width,148 kVP9EncodePerfTestVectors[i].height, timebase.den, timebase.num, 0,
162 kVP9EncodePerfTestVectors[i].height,
163 timebase.den, timebase.num, 0,
164 kVP9EncodePerfTestVectors[i].frames);149 kVP9EncodePerfTestVectors[i].frames);
165 set_speed(kEncodePerfTestSpeeds[j]);150 set_speed(kEncodePerfTestSpeeds[j]);
166 151
@@ -197,6 +182,6 @@ TEST_P(VP9EncodePerfTest, PerfTest) { · 30 unmodified lines
197 }182 }
198}183}
199 184
200VP9_INSTANTIATE_TEST_CASE(185VP9_INSTANTIATE_TEST_CASE(VP9EncodePerfTest,
201 VP9EncodePerfTest, ::testing::Values(::libvpx_test::kRealTime));186 ::testing::Values(::libvpx_test::kRealTime));
202} // namespace187} // namespace
test/encode_test_driver.cc+34−51
@@ -30,8 +30,7 @@ void Encoder::InitEncoder(VideoSource *video) { · 29 unmodified lines
30 cfg_.g_timebase = video->timebase();30 cfg_.g_timebase = video->timebase();
31 cfg_.rc_twopass_stats_in = stats_->buf();31 cfg_.rc_twopass_stats_in = stats_->buf();
32 32
33 res = vpx_codec_enc_init(&encoder_, CodecInterface(), &cfg_,33 res = vpx_codec_enc_init(&encoder_, CodecInterface(), &cfg_, init_flags_);
34 init_flags_);
35 ASSERT_EQ(VPX_CODEC_OK, res) << EncoderError();34 ASSERT_EQ(VPX_CODEC_OK, res) << EncoderError();
36 35
37#if CONFIG_VP9_ENCODER36#if CONFIG_VP9_ENCODER
@@ -62,8 +61,7 @@ void Encoder::EncodeFrame(VideoSource *video, const unsigned long frame_flags) { · 24 unmodified lines
62 CxDataIterator iter = GetCxData();61 CxDataIterator iter = GetCxData();
63 62
64 while (const vpx_codec_cx_pkt_t *pkt = iter.Next()) {63 while (const vpx_codec_cx_pkt_t *pkt = iter.Next()) {
65 if (pkt->kind != VPX_CODEC_STATS_PKT)64 if (pkt->kind != VPX_CODEC_STATS_PKT) continue;
66 continue;
67 65
68 stats_->Append(*pkt);66 stats_->Append(*pkt);
69 }67 }
@@ -83,15 +81,15 @@ void Encoder::EncodeFrameInternal(const VideoSource &video, · 13 unmodified lines
83 }81 }
84 82
85 // Encode the frame83 // Encode the frame
86 API_REGISTER_STATE_CHECK(84 API_REGISTER_STATE_CHECK(res = vpx_codec_encode(&encoder_, img, video.pts(),
87 res = vpx_codec_encode(&encoder_, img, video.pts(), video.duration(),85 video.duration(), frame_flags,
88 frame_flags, deadline_));86 deadline_));
89 ASSERT_EQ(VPX_CODEC_OK, res) << EncoderError();87 ASSERT_EQ(VPX_CODEC_OK, res) << EncoderError();
90}88}
91 89
92void Encoder::Flush() {90void Encoder::Flush() {
93 const vpx_codec_err_t res = vpx_codec_encode(&encoder_, NULL, 0, 0, 0,91 const vpx_codec_err_t res =
94 deadline_);92 vpx_codec_encode(&encoder_, NULL, 0, 0, 0, deadline_);
95 if (!encoder_.priv)93 if (!encoder_.priv)
96 ASSERT_EQ(VPX_CODEC_ERROR, res) << EncoderError();94 ASSERT_EQ(VPX_CODEC_ERROR, res) << EncoderError();
97 else95 else
@@ -106,22 +104,15 @@ void EncoderTest::InitializeConfig() { · 8 unmodified lines
106 104
107void EncoderTest::SetMode(TestMode mode) {105void EncoderTest::SetMode(TestMode mode) {
108 switch (mode) {106 switch (mode) {
109 case kRealTime:107 case kRealTime: deadline_ = VPX_DL_REALTIME; break;
110 deadline_ = VPX_DL_REALTIME;
111 break;
112 108
113 case kOnePassGood:109 case kOnePassGood:
114 case kTwoPassGood:110 case kTwoPassGood: deadline_ = VPX_DL_GOOD_QUALITY; break;
115 deadline_ = VPX_DL_GOOD_QUALITY;
116 break;
117 111
118 case kOnePassBest:112 case kOnePassBest:
119 case kTwoPassBest:113 case kTwoPassBest: deadline_ = VPX_DL_BEST_QUALITY; break;
120 deadline_ = VPX_DL_BEST_QUALITY;
121 break;
122 114
123 default:115 default: ASSERT_TRUE(false) << "Unexpected mode " << mode;
124 ASSERT_TRUE(false) << "Unexpected mode " << mode;
125 }116 }
126 117
127 if (mode == kTwoPassGood || mode == kTwoPassBest)118 if (mode == kTwoPassGood || mode == kTwoPassBest)
@@ -131,35 +122,35 @@ void EncoderTest::SetMode(TestMode mode) { · 3 unmodified lines
131}122}
132// The function should return "true" most of the time, therefore no early123// The function should return "true" most of the time, therefore no early
133// break-out is implemented within the match checking process.124// break-out is implemented within the match checking process.
134static bool compare_img(const vpx_image_t *img1,125static bool compare_img(const vpx_image_t *img1, const vpx_image_t *img2) {
135 const vpx_image_t *img2) {126 bool match = (img1->fmt == img2->fmt) && (img1->cs == img2->cs) &&
136 bool match = (img1->fmt == img2->fmt) &&127 (img1->d_w == img2->d_w) && (img1->d_h == img2->d_h);
137 (img1->cs == img2->cs) &&128
138 (img1->d_w == img2->d_w) &&129 const unsigned int width_y = img1->d_w;
139 (img1->d_h == img2->d_h);
140
141 const unsigned int width_y = img1->d_w;
142 const unsigned int height_y = img1->d_h;130 const unsigned int height_y = img1->d_h;
143 unsigned int i;131 unsigned int i;
144 for (i = 0; i < height_y; ++i)132 for (i = 0; i < height_y; ++i)
145 match = (memcmp(img1->planes[VPX_PLANE_Y] + i * img1->stride[VPX_PLANE_Y],133 match = (memcmp(img1->planes[VPX_PLANE_Y] + i * img1->stride[VPX_PLANE_Y],
146 img2->planes[VPX_PLANE_Y] + i * img2->stride[VPX_PLANE_Y],134 img2->planes[VPX_PLANE_Y] + i * img2->stride[VPX_PLANE_Y],
147 width_y) == 0) && match;135 width_y) == 0) &&
148 const unsigned int width_uv = (img1->d_w + 1) >> 1;136 match;
137 const unsigned int width_uv = (img1->d_w + 1) >> 1;
149 const unsigned int height_uv = (img1->d_h + 1) >> 1;138 const unsigned int height_uv = (img1->d_h + 1) >> 1;
150 for (i = 0; i < height_uv; ++i)139 for (i = 0; i < height_uv; ++i)
151 match = (memcmp(img1->planes[VPX_PLANE_U] + i * img1->stride[VPX_PLANE_U],140 match = (memcmp(img1->planes[VPX_PLANE_U] + i * img1->stride[VPX_PLANE_U],
152 img2->planes[VPX_PLANE_U] + i * img2->stride[VPX_PLANE_U],141 img2->planes[VPX_PLANE_U] + i * img2->stride[VPX_PLANE_U],
153 width_uv) == 0) && match;142 width_uv) == 0) &&
143 match;
154 for (i = 0; i < height_uv; ++i)144 for (i = 0; i < height_uv; ++i)
155 match = (memcmp(img1->planes[VPX_PLANE_V] + i * img1->stride[VPX_PLANE_V],145 match = (memcmp(img1->planes[VPX_PLANE_V] + i * img1->stride[VPX_PLANE_V],
156 img2->planes[VPX_PLANE_V] + i * img2->stride[VPX_PLANE_V],146 img2->planes[VPX_PLANE_V] + i * img2->stride[VPX_PLANE_V],
157 width_uv) == 0) && match;147 width_uv) == 0) &&
148 match;
158 return match;149 return match;
159}150}
160 151
161void EncoderTest::MismatchHook(const vpx_image_t* /*img1*/,152void EncoderTest::MismatchHook(const vpx_image_t * /*img1*/,
162 const vpx_image_t* /*img2*/) {153 const vpx_image_t * /*img2*/) {
163 ASSERT_TRUE(0) << "Encode/Decode mismatch found";154 ASSERT_TRUE(0) << "Encode/Decode mismatch found";
164}155}
165 156
@@ -215,10 +206,9 @@ void EncoderTest::RunLoop(VideoSource *video) { · 49 unmodified lines
215 has_cxdata = true;206 has_cxdata = true;
216 if (decoder.get() != NULL && DoDecode()) {207 if (decoder.get() != NULL && DoDecode()) {
217 vpx_codec_err_t res_dec = decoder->DecodeFrame(208 vpx_codec_err_t res_dec = decoder->DecodeFrame(
218 (const uint8_t*)pkt->data.frame.buf, pkt->data.frame.sz);209 (const uint8_t *)pkt->data.frame.buf, pkt->data.frame.sz);
219 210
220 if (!HandleDecodeResult(res_dec, *video, decoder.get()))211 if (!HandleDecodeResult(res_dec, *video, decoder.get())) break;
221 break;
222 212
223 has_dxdata = true;213 has_dxdata = true;
224 }214 }
@@ -227,20 +217,16 @@ void EncoderTest::RunLoop(VideoSource *video) { · 2 unmodified lines
227 FramePktHook(pkt);217 FramePktHook(pkt);
228 break;218 break;
229 219
230 case VPX_CODEC_PSNR_PKT:220 case VPX_CODEC_PSNR_PKT: PSNRPktHook(pkt); break;
231 PSNRPktHook(pkt);
232 break;
233 221
234 default:222 default: break;
235 break;
236 }223 }
237 }224 }
238 225
239 // Flush the decoder when there are no more fragments.226 // Flush the decoder when there are no more fragments.
240 if ((init_flags_ & VPX_CODEC_USE_OUTPUT_PARTITION) && has_dxdata) {227 if ((init_flags_ & VPX_CODEC_USE_OUTPUT_PARTITION) && has_dxdata) {
241 const vpx_codec_err_t res_dec = decoder->DecodeFrame(NULL, 0);228 const vpx_codec_err_t res_dec = decoder->DecodeFrame(NULL, 0);
242 if (!HandleDecodeResult(res_dec, *video, decoder.get()))229 if (!HandleDecodeResult(res_dec, *video, decoder.get())) break;
243 break;
244 }230 }
245 231
246 if (has_dxdata && has_cxdata) {232 if (has_dxdata && has_cxdata) {
@@ -253,17 +239,14 @@ void EncoderTest::RunLoop(VideoSource *video) { · 6 unmodified lines
253 MismatchHook(img_enc, img_dec);239 MismatchHook(img_enc, img_dec);
254 }240 }
255 }241 }
256 if (img_dec)242 if (img_dec) DecompressedFrameHook(*img_dec, video->pts());
257 DecompressedFrameHook(*img_dec, video->pts());
258 }243 }
259 if (!Continue())244 if (!Continue()) break;
260 break;
261 }245 }
262 246
263 EndPassHook();247 EndPassHook();
264 248
265 if (!Continue())249 if (!Continue()) break;
266 break;
267 }250 }
268}251}
269 252
test/encode_test_driver.h+41−55
@@ -33,19 +33,17 @@ enum TestMode { · 32 unmodified lines
33 kTwoPassGood,33 kTwoPassGood,
34 kTwoPassBest34 kTwoPassBest
35};35};
36#define ALL_TEST_MODES ::testing::Values(::libvpx_test::kRealTime, \36#define ALL_TEST_MODES \
37 ::libvpx_test::kOnePassGood, \37 ::testing::Values(::libvpx_test::kRealTime, ::libvpx_test::kOnePassGood, \
38 ::libvpx_test::kOnePassBest, \38 ::libvpx_test::kOnePassBest, ::libvpx_test::kTwoPassGood, \
39 ::libvpx_test::kTwoPassGood, \39 ::libvpx_test::kTwoPassBest)
40 ::libvpx_test::kTwoPassBest)
41 40
42#define ONE_PASS_TEST_MODES ::testing::Values(::libvpx_test::kRealTime, \41#define ONE_PASS_TEST_MODES \
43 ::libvpx_test::kOnePassGood, \42 ::testing::Values(::libvpx_test::kRealTime, ::libvpx_test::kOnePassGood, \
44 ::libvpx_test::kOnePassBest)43 ::libvpx_test::kOnePassBest)
45
46#define TWO_PASS_TEST_MODES ::testing::Values(::libvpx_test::kTwoPassGood, \
47 ::libvpx_test::kTwoPassBest)
48 44
45#define TWO_PASS_TEST_MODES \
46 ::testing::Values(::libvpx_test::kTwoPassGood, ::libvpx_test::kTwoPassBest)
49 47
50// Provides an object to handle the libvpx get_cx_data() iteration pattern48// Provides an object to handle the libvpx get_cx_data() iteration pattern
51class CxDataIterator {49class CxDataIterator {
@@ -58,8 +56,8 @@ class CxDataIterator { · 6 unmodified lines
58 }56 }
59 57
60 private:58 private:
61 vpx_codec_ctx_t *encoder_;59 vpx_codec_ctx_t *encoder_;
62 vpx_codec_iter_t iter_;60 vpx_codec_iter_t iter_;
63};61};
64 62
65// Implements an in-memory store for libvpx twopass statistics63// Implements an in-memory store for libvpx twopass statistics
@@ -75,15 +73,12 @@ class TwopassStatsStore { · 9 unmodified lines
75 return buf;73 return buf;
76 }74 }
77 75
78 void Reset() {76 void Reset() { buffer_.clear(); }
79 buffer_.clear();
80 }
81 77
82 protected:78 protected:
83 std::string buffer_;79 std::string buffer_;
84};80};
85 81
86
87// Provides a simplified interface to manage one video encoding pass, given82// Provides a simplified interface to manage one video encoding pass, given
88// a configuration and video source.83// a configuration and video source.
89//84//
@@ -97,13 +92,9 @@ class Encoder { · 7 unmodified lines
97 memset(&encoder_, 0, sizeof(encoder_));92 memset(&encoder_, 0, sizeof(encoder_));
98 }93 }
99 94
100 virtual ~Encoder() {95 virtual ~Encoder() { vpx_codec_destroy(&encoder_); }
101 vpx_codec_destroy(&encoder_);
102 }
103 96
104 CxDataIterator GetCxData() {97 CxDataIterator GetCxData() { return CxDataIterator(&encoder_); }
105 return CxDataIterator(&encoder_);
106 }
107 98
108 void InitEncoder(VideoSource *video);99 void InitEncoder(VideoSource *video);
109 100
@@ -115,9 +106,7 @@ class Encoder { · 5 unmodified lines
115 void EncodeFrame(VideoSource *video, const unsigned long frame_flags);106 void EncodeFrame(VideoSource *video, const unsigned long frame_flags);
116 107
117 // Convenience wrapper for EncodeFrame()108 // Convenience wrapper for EncodeFrame()
118 void EncodeFrame(VideoSource *video) {109 void EncodeFrame(VideoSource *video) { EncodeFrame(video, 0); }
119 EncodeFrame(video, 0);
120 }
121 110
122 void Control(int ctrl_id, int arg) {111 void Control(int ctrl_id, int arg) {
123 const vpx_codec_err_t res = vpx_codec_control_(&encoder_, ctrl_id, arg);112 const vpx_codec_err_t res = vpx_codec_control_(&encoder_, ctrl_id, arg);
@@ -156,12 +145,10 @@ class Encoder { · 32 unmodified lines
156 cfg_ = *cfg;145 cfg_ = *cfg;
157 }146 }
158 147
159 void set_deadline(unsigned long deadline) {148 void set_deadline(unsigned long deadline) { deadline_ = deadline; }
160 deadline_ = deadline;
161 }
162 149
163 protected:150 protected:
164 virtual vpx_codec_iface_t* CodecInterface() const = 0;151 virtual vpx_codec_iface_t *CodecInterface() const = 0;
165 152
166 const char *EncoderError() {153 const char *EncoderError() {
167 const char *detail = vpx_codec_error_detail(&encoder_);154 const char *detail = vpx_codec_error_detail(&encoder_);
@@ -175,11 +162,11 @@ class Encoder { · 7 unmodified lines
175 // Flush the encoder on EOS162 // Flush the encoder on EOS
176 void Flush();163 void Flush();
177 164
178 vpx_codec_ctx_t encoder_;165 vpx_codec_ctx_t encoder_;
179 vpx_codec_enc_cfg_t cfg_;166 vpx_codec_enc_cfg_t cfg_;
180 unsigned long deadline_;167 unsigned long deadline_;
181 unsigned long init_flags_;168 unsigned long init_flags_;
182 TwopassStatsStore *stats_;169 TwopassStatsStore *stats_;
183};170};
184 171
185// Common test functionality for all Encoder tests.172// Common test functionality for all Encoder tests.
@@ -221,36 +208,35 @@ class EncoderTest { · 35 unmodified lines
221 virtual void EndPassHook() {}208 virtual void EndPassHook() {}
222 209
223 // Hook to be called before encoding a frame.210 // Hook to be called before encoding a frame.
224 virtual void PreEncodeFrameHook(VideoSource* /*video*/) {}211 virtual void PreEncodeFrameHook(VideoSource * /*video*/) {}
225 virtual void PreEncodeFrameHook(VideoSource* /*video*/,212 virtual void PreEncodeFrameHook(VideoSource * /*video*/,
226 Encoder* /*encoder*/) {}213 Encoder * /*encoder*/) {}
227 214
228 // Hook to be called on every compressed data packet.215 // Hook to be called on every compressed data packet.
229 virtual void FramePktHook(const vpx_codec_cx_pkt_t* /*pkt*/) {}216 virtual void FramePktHook(const vpx_codec_cx_pkt_t * /*pkt*/) {}
230 217
231 // Hook to be called on every PSNR packet.218 // Hook to be called on every PSNR packet.
232 virtual void PSNRPktHook(const vpx_codec_cx_pkt_t* /*pkt*/) {}219 virtual void PSNRPktHook(const vpx_codec_cx_pkt_t * /*pkt*/) {}
233 220
234 // Hook to determine whether the encode loop should continue.221 // Hook to determine whether the encode loop should continue.
235 virtual bool Continue() const {222 virtual bool Continue() const {
236 return !(::testing::Test::HasFatalFailure() || abort_);223 return !(::testing::Test::HasFatalFailure() || abort_);
237 }224 }
238 225
239 const CodecFactory *codec_;226 const CodecFactory *codec_;
240 // Hook to determine whether to decode frame after encoding227 // Hook to determine whether to decode frame after encoding
241 virtual bool DoDecode() const { return 1; }228 virtual bool DoDecode() const { return 1; }
242 229
243 // Hook to handle encode/decode mismatch230 // Hook to handle encode/decode mismatch
244 virtual void MismatchHook(const vpx_image_t *img1,231 virtual void MismatchHook(const vpx_image_t *img1, const vpx_image_t *img2);
245 const vpx_image_t *img2);
246 232
247 // Hook to be called on every decompressed frame.233 // Hook to be called on every decompressed frame.
248 virtual void DecompressedFrameHook(const vpx_image_t& /*img*/,234 virtual void DecompressedFrameHook(const vpx_image_t & /*img*/,
249 vpx_codec_pts_t /*pts*/) {}235 vpx_codec_pts_t /*pts*/) {}
250 236
251 // Hook to be called to handle decode result. Return true to continue.237 // Hook to be called to handle decode result. Return true to continue.
252 virtual bool HandleDecodeResult(const vpx_codec_err_t res_dec,238 virtual bool HandleDecodeResult(const vpx_codec_err_t res_dec,
253 const VideoSource& /*video*/,239 const VideoSource & /*video*/,
254 Decoder *decoder) {240 Decoder *decoder) {
255 EXPECT_EQ(VPX_CODEC_OK, res_dec) << decoder->DecodeError();241 EXPECT_EQ(VPX_CODEC_OK, res_dec) << decoder->DecodeError();
256 return VPX_CODEC_OK == res_dec;242 return VPX_CODEC_OK == res_dec;
@@ -262,15 +248,15 @@ class EncoderTest { · 5 unmodified lines
262 return pkt;248 return pkt;
263 }249 }
264 250
265 bool abort_;251 bool abort_;
266 vpx_codec_enc_cfg_t cfg_;252 vpx_codec_enc_cfg_t cfg_;
267 vpx_codec_dec_cfg_t dec_cfg_;253 vpx_codec_dec_cfg_t dec_cfg_;
268 unsigned int passes_;254 unsigned int passes_;
269 unsigned long deadline_;255 unsigned long deadline_;
270 TwopassStatsStore stats_;256 TwopassStatsStore stats_;
271 unsigned long init_flags_;257 unsigned long init_flags_;
272 unsigned long frame_flags_;258 unsigned long frame_flags_;
273 vpx_codec_pts_t last_pts_;259 vpx_codec_pts_t last_pts_;
274};260};
275 261
276} // namespace libvpx_test262} // namespace libvpx_test
test/error_resilience_test.cc+95−115
@@ -19,16 +19,13 @@ namespace { · 18 unmodified lines
19const int kMaxErrorFrames = 12;19const int kMaxErrorFrames = 12;
20const int kMaxDroppableFrames = 12;20const int kMaxDroppableFrames = 12;
21 21
22class ErrorResilienceTestLarge : public ::libvpx_test::EncoderTest,22class ErrorResilienceTestLarge
23 public ::libvpx_test::CodecTestWith2Params<libvpx_test::TestMode, bool> {23 : public ::libvpx_test::EncoderTest,
24 public ::libvpx_test::CodecTestWith2Params<libvpx_test::TestMode, bool> {
24 protected:25 protected:
25 ErrorResilienceTestLarge()26 ErrorResilienceTestLarge()
26 : EncoderTest(GET_PARAM(0)),27 : EncoderTest(GET_PARAM(0)), svc_support_(GET_PARAM(2)), psnr_(0.0),
27 svc_support_(GET_PARAM(2)),28 nframes_(0), mismatch_psnr_(0.0), mismatch_nframes_(0),
28 psnr_(0.0),
29 nframes_(0),
30 mismatch_psnr_(0.0),
31 mismatch_nframes_(0),
32 encoding_mode_(GET_PARAM(1)) {29 encoding_mode_(GET_PARAM(1)) {
33 Reset();30 Reset();
34 }31 }
@@ -66,81 +63,70 @@ class ErrorResilienceTestLarge : public ::libvpx_test::EncoderTest, · 31 unmodified lines
66 // LAST is updated on base/layer 0, GOLDEN updated on layer 1.63 // LAST is updated on base/layer 0, GOLDEN updated on layer 1.
67 // Non-zero pattern_switch parameter means pattern will switch to64 // Non-zero pattern_switch parameter means pattern will switch to
68 // not using LAST for frame_num >= pattern_switch.65 // not using LAST for frame_num >= pattern_switch.
69 int SetFrameFlags(int frame_num,66 int SetFrameFlags(int frame_num, int num_temp_layers, int pattern_switch) {
70 int num_temp_layers,
71 int pattern_switch) {
72 int frame_flags = 0;67 int frame_flags = 0;
73 if (num_temp_layers == 2) {68 if (num_temp_layers == 2) {
74 if (frame_num % 2 == 0) {69 if (frame_num % 2 == 0) {
75 if (frame_num < pattern_switch || pattern_switch == 0) {70 if (frame_num < pattern_switch || pattern_switch == 0) {
76 // Layer 0: predict from LAST and ARF, update LAST.71 // Layer 0: predict from LAST and ARF, update LAST.
77 frame_flags = VP8_EFLAG_NO_REF_GF |72 frame_flags =
78 VP8_EFLAG_NO_UPD_GF |73 VP8_EFLAG_NO_REF_GF | VP8_EFLAG_NO_UPD_GF | VP8_EFLAG_NO_UPD_ARF;
79 VP8_EFLAG_NO_UPD_ARF;
80 } else {
81 // Layer 0: predict from GF and ARF, update GF.
82 frame_flags = VP8_EFLAG_NO_REF_LAST |
83 VP8_EFLAG_NO_UPD_LAST |
84 VP8_EFLAG_NO_UPD_ARF;
85 }
86 } else {74 } else {
87 if (frame_num < pattern_switch || pattern_switch == 0) {75 // Layer 0: predict from GF and ARF, update GF.
88 // Layer 1: predict from L, GF, and ARF, update GF.76 frame_flags = VP8_EFLAG_NO_REF_LAST | VP8_EFLAG_NO_UPD_LAST |
89 frame_flags = VP8_EFLAG_NO_UPD_ARF |77 VP8_EFLAG_NO_UPD_ARF;
90 VP8_EFLAG_NO_UPD_LAST;78 }
91 } else {79 } else {
92 // Layer 1: predict from GF and ARF, update GF.80 if (frame_num < pattern_switch || pattern_switch == 0) {
93 frame_flags = VP8_EFLAG_NO_REF_LAST |81 // Layer 1: predict from L, GF, and ARF, update GF.
94 VP8_EFLAG_NO_UPD_LAST |82 frame_flags = VP8_EFLAG_NO_UPD_ARF | VP8_EFLAG_NO_UPD_LAST;
95 VP8_EFLAG_NO_UPD_ARF;83 } else {
96 }84 // Layer 1: predict from GF and ARF, update GF.
85 frame_flags = VP8_EFLAG_NO_REF_LAST | VP8_EFLAG_NO_UPD_LAST |
86 VP8_EFLAG_NO_UPD_ARF;
97 }87 }
88 }
98 }89 }
99 return frame_flags;90 return frame_flags;
100 }91 }
101 92
102 virtual void PreEncodeFrameHook(libvpx_test::VideoSource *video,93 virtual void PreEncodeFrameHook(libvpx_test::VideoSource *video,
103 ::libvpx_test::Encoder * /*encoder*/) {94 ::libvpx_test::Encoder * /*encoder*/) {
104 frame_flags_ &= ~(VP8_EFLAG_NO_UPD_LAST |95 frame_flags_ &=
105 VP8_EFLAG_NO_UPD_GF |96 ~(VP8_EFLAG_NO_UPD_LAST | VP8_EFLAG_NO_UPD_GF | VP8_EFLAG_NO_UPD_ARF);
106 VP8_EFLAG_NO_UPD_ARF);
107 // For temporal layer case.97 // For temporal layer case.
108 if (cfg_.ts_number_layers > 1) {98 if (cfg_.ts_number_layers > 1) {
109 frame_flags_ = SetFrameFlags(video->frame(),99 frame_flags_ =
110 cfg_.ts_number_layers,100 SetFrameFlags(video->frame(), cfg_.ts_number_layers, pattern_switch_);
111 pattern_switch_);
112 for (unsigned int i = 0; i < droppable_nframes_; ++i) {101 for (unsigned int i = 0; i < droppable_nframes_; ++i) {
113 if (droppable_frames_[i] == video->frame()) {102 if (droppable_frames_[i] == video->frame()) {
114 std::cout << "Encoding droppable frame: "103 std::cout << "Encoding droppable frame: " << droppable_frames_[i]
115 << droppable_frames_[i] << "\n";104 << "\n";
116 }105 }
117 }106 }
118 } else {107 } else {
119 if (droppable_nframes_ > 0 &&108 if (droppable_nframes_ > 0 &&
120 (cfg_.g_pass == VPX_RC_LAST_PASS || cfg_.g_pass == VPX_RC_ONE_PASS)) {109 (cfg_.g_pass == VPX_RC_LAST_PASS || cfg_.g_pass == VPX_RC_ONE_PASS)) {
121 for (unsigned int i = 0; i < droppable_nframes_; ++i) {110 for (unsigned int i = 0; i < droppable_nframes_; ++i) {
122 if (droppable_frames_[i] == video->frame()) {111 if (droppable_frames_[i] == video->frame()) {
123 std::cout << "Encoding droppable frame: "112 std::cout << "Encoding droppable frame: " << droppable_frames_[i]
124 << droppable_frames_[i] << "\n";113 << "\n";
125 frame_flags_ |= (VP8_EFLAG_NO_UPD_LAST |114 frame_flags_ |= (VP8_EFLAG_NO_UPD_LAST | VP8_EFLAG_NO_UPD_GF |
126 VP8_EFLAG_NO_UPD_GF |115 VP8_EFLAG_NO_UPD_ARF);
127 VP8_EFLAG_NO_UPD_ARF);116 return;
128 return;117 }
129 }118 }
130 }119 }
131 }
132 }120 }
133 }121 }
134 122
135 double GetAveragePsnr() const {123 double GetAveragePsnr() const {
136 if (nframes_)124 if (nframes_) return psnr_ / nframes_;
137 return psnr_ / nframes_;
138 return 0.0;125 return 0.0;
139 }126 }
140 127
141 double GetAverageMismatchPsnr() const {128 double GetAverageMismatchPsnr() const {
142 if (mismatch_nframes_)129 if (mismatch_nframes_) return mismatch_psnr_ / mismatch_nframes_;
143 return mismatch_psnr_ / mismatch_nframes_;
144 return 0.0;130 return 0.0;
145 }131 }
146 132
@@ -158,8 +144,7 @@ class ErrorResilienceTestLarge : public ::libvpx_test::EncoderTest, · 11 unmodified lines
158 return 1;144 return 1;
159 }145 }
160 146
161 virtual void MismatchHook(const vpx_image_t *img1,147 virtual void MismatchHook(const vpx_image_t *img1, const vpx_image_t *img2) {
162 const vpx_image_t *img2) {
163 double mismatch_psnr = compute_psnr(img1, img2);148 double mismatch_psnr = compute_psnr(img1, img2);
164 mismatch_psnr_ += mismatch_psnr;149 mismatch_psnr_ += mismatch_psnr;
165 ++mismatch_nframes_;150 ++mismatch_nframes_;
@@ -186,13 +171,9 @@ class ErrorResilienceTestLarge : public ::libvpx_test::EncoderTest, · 20 unmodified lines
186 droppable_frames_[i] = list[i];171 droppable_frames_[i] = list[i];
187 }172 }
188 173
189 unsigned int GetMismatchFrames() {174 unsigned int GetMismatchFrames() { return mismatch_nframes_; }
190 return mismatch_nframes_;
191 }
192 175
193 void SetPatternSwitch(int frame_switch) {176 void SetPatternSwitch(int frame_switch) { pattern_switch_ = frame_switch; }
194 pattern_switch_ = frame_switch;
195 }
196 177
197 bool svc_support_;178 bool svc_support_;
198 179
@@ -265,15 +246,14 @@ TEST_P(ErrorResilienceTestLarge, DropFramesWithoutRecovery) { · 66 unmodified lines
265 // In addition to isolated loss/drop, add a long consecutive series246 // In addition to isolated loss/drop, add a long consecutive series
266 // (of size 9) of dropped frames.247 // (of size 9) of dropped frames.
267 unsigned int num_droppable_frames = 11;248 unsigned int num_droppable_frames = 11;
268 unsigned int droppable_frame_list[] = {5, 16, 22, 23, 24, 25, 26, 27, 28,249 unsigned int droppable_frame_list[] = { 5, 16, 22, 23, 24, 25,
269 29, 30};250 26, 27, 28, 29, 30 };
270 SetDroppableFrames(num_droppable_frames, droppable_frame_list);251 SetDroppableFrames(num_droppable_frames, droppable_frame_list);
271 SetErrorFrames(num_droppable_frames, droppable_frame_list);252 SetErrorFrames(num_droppable_frames, droppable_frame_list);
272 ASSERT_NO_FATAL_FAILURE(RunLoop(&video));253 ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
273 // Test that no mismatches have been found254 // Test that no mismatches have been found
274 std::cout << " Mismatch frames: "255 std::cout << " Mismatch frames: " << GetMismatchFrames() << "\n";
275 << GetMismatchFrames() << "\n";256 EXPECT_EQ(GetMismatchFrames(), (unsigned int)0);
276 EXPECT_EQ(GetMismatchFrames(), (unsigned int) 0);
277 257
278 // Reset previously set of error/droppable frames.258 // Reset previously set of error/droppable frames.
279 Reset();259 Reset();
@@ -306,8 +286,7 @@ TEST_P(ErrorResilienceTestLarge, DropFramesWithoutRecovery) { · 26 unmodified lines
306// layer, so successful decoding is expected.286// layer, so successful decoding is expected.
307TEST_P(ErrorResilienceTestLarge, 2LayersDropEnhancement) {287TEST_P(ErrorResilienceTestLarge, 2LayersDropEnhancement) {
308 // This test doesn't run if SVC is not supported.288 // This test doesn't run if SVC is not supported.
309 if (!svc_support_)289 if (!svc_support_) return;
310 return;
311 290
312 const vpx_rational timebase = { 33333333, 1000000000 };291 const vpx_rational timebase = { 33333333, 1000000000 };
313 cfg_.g_timebase = timebase;292 cfg_.g_timebase = timebase;
@@ -337,14 +316,13 @@ TEST_P(ErrorResilienceTestLarge, 2LayersDropEnhancement) { · 23 unmodified lines
337 // The odd frames are the enhancement layer for 2 layer pattern, so set316 // The odd frames are the enhancement layer for 2 layer pattern, so set
338 // those frames as droppable. Drop the last 7 frames.317 // those frames as droppable. Drop the last 7 frames.
339 unsigned int num_droppable_frames = 7;318 unsigned int num_droppable_frames = 7;
340 unsigned int droppable_frame_list[] = {27, 29, 31, 33, 35, 37, 39};319 unsigned int droppable_frame_list[] = { 27, 29, 31, 33, 35, 37, 39 };
341 SetDroppableFrames(num_droppable_frames, droppable_frame_list);320 SetDroppableFrames(num_droppable_frames, droppable_frame_list);
342 SetErrorFrames(num_droppable_frames, droppable_frame_list);321 SetErrorFrames(num_droppable_frames, droppable_frame_list);
343 ASSERT_NO_FATAL_FAILURE(RunLoop(&video));322 ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
344 // Test that no mismatches have been found323 // Test that no mismatches have been found
345 std::cout << " Mismatch frames: "324 std::cout << " Mismatch frames: " << GetMismatchFrames() << "\n";
346 << GetMismatchFrames() << "\n";325 EXPECT_EQ(GetMismatchFrames(), (unsigned int)0);
347 EXPECT_EQ(GetMismatchFrames(), (unsigned int) 0);
348 326
349 // Reset previously set of error/droppable frames.327 // Reset previously set of error/droppable frames.
350 Reset();328 Reset();
@@ -355,8 +333,7 @@ TEST_P(ErrorResilienceTestLarge, 2LayersDropEnhancement) { · 4 unmodified lines
355// sequence, the LAST ref is not used anymore.333// sequence, the LAST ref is not used anymore.
356TEST_P(ErrorResilienceTestLarge, 2LayersNoRefLast) {334TEST_P(ErrorResilienceTestLarge, 2LayersNoRefLast) {
357 // This test doesn't run if SVC is not supported.335 // This test doesn't run if SVC is not supported.
358 if (!svc_support_)336 if (!svc_support_) return;
359 return;
360 337
361 const vpx_rational timebase = { 33333333, 1000000000 };338 const vpx_rational timebase = { 33333333, 1000000000 };
362 cfg_.g_timebase = timebase;339 cfg_.g_timebase = timebase;
@@ -385,20 +362,19 @@ TEST_P(ErrorResilienceTestLarge, 2LayersNoRefLast) { · 22 unmodified lines
385 362
386 ASSERT_NO_FATAL_FAILURE(RunLoop(&video));363 ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
387 // Test that no mismatches have been found364 // Test that no mismatches have been found
388 std::cout << " Mismatch frames: "365 std::cout << " Mismatch frames: " << GetMismatchFrames() << "\n";
389 << GetMismatchFrames() << "\n";366 EXPECT_EQ(GetMismatchFrames(), (unsigned int)0);
390 EXPECT_EQ(GetMismatchFrames(), (unsigned int) 0);
391 367
392 // Reset previously set of error/droppable frames.368 // Reset previously set of error/droppable frames.
393 Reset();369 Reset();
394}370}
395 371
396class ErrorResilienceTestLargeCodecControls : public ::libvpx_test::EncoderTest,372class ErrorResilienceTestLargeCodecControls
397 public ::libvpx_test::CodecTestWithParam<libvpx_test::TestMode> {373 : public ::libvpx_test::EncoderTest,
374 public ::libvpx_test::CodecTestWithParam<libvpx_test::TestMode> {
398 protected:375 protected:
399 ErrorResilienceTestLargeCodecControls()376 ErrorResilienceTestLargeCodecControls()
400 : EncoderTest(GET_PARAM(0)),377 : EncoderTest(GET_PARAM(0)), encoding_mode_(GET_PARAM(1)) {
401 encoding_mode_(GET_PARAM(1)) {
402 Reset();378 Reset();
403 }379 }
404 380
@@ -437,8 +413,8 @@ class ErrorResilienceTestLargeCodecControls : public ::libvpx_test::EncoderTest, · 32 unmodified lines
437 if (num_temp_layers == 2) {413 if (num_temp_layers == 2) {
438 if (frame_num % 2 == 0) {414 if (frame_num % 2 == 0) {
439 // Layer 0: predict from L and ARF, update L.415 // Layer 0: predict from L and ARF, update L.
440 frame_flags = VP8_EFLAG_NO_REF_GF | VP8_EFLAG_NO_UPD_GF |416 frame_flags =
441 VP8_EFLAG_NO_UPD_ARF;417 VP8_EFLAG_NO_REF_GF | VP8_EFLAG_NO_UPD_GF | VP8_EFLAG_NO_UPD_ARF;
442 } else {418 } else {
443 // Layer 1: predict from L, G and ARF, and update G.419 // Layer 1: predict from L, G and ARF, and update G.
444 frame_flags = VP8_EFLAG_NO_UPD_ARF | VP8_EFLAG_NO_UPD_LAST |420 frame_flags = VP8_EFLAG_NO_UPD_ARF | VP8_EFLAG_NO_UPD_LAST |
@@ -451,9 +427,9 @@ class ErrorResilienceTestLargeCodecControls : public ::libvpx_test::EncoderTest, · 6 unmodified lines
451 VP8_EFLAG_NO_REF_GF | VP8_EFLAG_NO_REF_ARF;427 VP8_EFLAG_NO_REF_GF | VP8_EFLAG_NO_REF_ARF;
452 } else if ((frame_num - 2) % 4 == 0) {428 } else if ((frame_num - 2) % 4 == 0) {
453 // Layer 1: predict from L, G, update G.429 // Layer 1: predict from L, G, update G.
454 frame_flags = VP8_EFLAG_NO_UPD_ARF | VP8_EFLAG_NO_UPD_LAST |430 frame_flags =
455 VP8_EFLAG_NO_REF_ARF;431 VP8_EFLAG_NO_UPD_ARF | VP8_EFLAG_NO_UPD_LAST | VP8_EFLAG_NO_REF_ARF;
456 } else if ((frame_num - 1) % 2 == 0) {432 } else if ((frame_num - 1) % 2 == 0) {
457 // Layer 2: predict from L, G, ARF; update ARG.433 // Layer 2: predict from L, G, ARF; update ARG.
458 frame_flags = VP8_EFLAG_NO_UPD_GF | VP8_EFLAG_NO_UPD_LAST;434 frame_flags = VP8_EFLAG_NO_UPD_GF | VP8_EFLAG_NO_UPD_LAST;
459 }435 }
@@ -467,7 +443,7 @@ class ErrorResilienceTestLargeCodecControls : public ::libvpx_test::EncoderTest, · 7 unmodified lines
467 if (frame_num % 2 == 0) {443 if (frame_num % 2 == 0) {
468 layer_id = 0;444 layer_id = 0;
469 } else {445 } else {
470 layer_id = 1;446 layer_id = 1;
471 }447 }
472 } else if (num_temp_layers == 3) {448 } else if (num_temp_layers == 3) {
473 if (frame_num % 4 == 0) {449 if (frame_num % 4 == 0) {
@@ -484,16 +460,16 @@ class ErrorResilienceTestLargeCodecControls : public ::libvpx_test::EncoderTest, · 10 unmodified lines
484 virtual void PreEncodeFrameHook(libvpx_test::VideoSource *video,460 virtual void PreEncodeFrameHook(libvpx_test::VideoSource *video,
485 libvpx_test::Encoder *encoder) {461 libvpx_test::Encoder *encoder) {
486 if (cfg_.ts_number_layers > 1) {462 if (cfg_.ts_number_layers > 1) {
487 int layer_id = SetLayerId(video->frame(), cfg_.ts_number_layers);463 int layer_id = SetLayerId(video->frame(), cfg_.ts_number_layers);
488 int frame_flags = SetFrameFlags(video->frame(), cfg_.ts_number_layers);464 int frame_flags = SetFrameFlags(video->frame(), cfg_.ts_number_layers);
489 if (video->frame() > 0) {465 if (video->frame() > 0) {
490 encoder->Control(VP8E_SET_TEMPORAL_LAYER_ID, layer_id);466 encoder->Control(VP8E_SET_TEMPORAL_LAYER_ID, layer_id);
491 encoder->Control(VP8E_SET_FRAME_FLAGS, frame_flags);467 encoder->Control(VP8E_SET_FRAME_FLAGS, frame_flags);
492 }468 }
493 const vpx_rational_t tb = video->timebase();469 const vpx_rational_t tb = video->timebase();
494 timebase_ = static_cast<double>(tb.num) / tb.den;470 timebase_ = static_cast<double>(tb.num) / tb.den;
495 duration_ = 0;471 duration_ = 0;
496 return;472 return;
497 }473 }
498 }474 }
499 475
@@ -519,26 +495,28 @@ class ErrorResilienceTestLargeCodecControls : public ::libvpx_test::EncoderTest, · 19 unmodified lines
519 495
520 virtual void EndPassHook(void) {496 virtual void EndPassHook(void) {
521 duration_ = (last_pts_ + 1) * timebase_;497 duration_ = (last_pts_ + 1) * timebase_;
522 if (cfg_.ts_number_layers > 1) {498 if (cfg_.ts_number_layers > 1) {
523 for (int layer = 0; layer < static_cast<int>(cfg_.ts_number_layers);499 for (int layer = 0; layer < static_cast<int>(cfg_.ts_number_layers);
524 ++layer) {500 ++layer) {
525 if (bits_total_[layer]) {501 if (bits_total_[layer]) {
526 // Effective file datarate:502 // Effective file datarate:
527 effective_datarate_[layer] = (bits_total_[layer] / 1000.0) / duration_;503 effective_datarate_[layer] =
504 (bits_total_[layer] / 1000.0) / duration_;
528 }505 }
529 }506 }
530 }507 }
531 }508 }
532 509
533 double effective_datarate_[3];510 double effective_datarate_[3];
534 private:511
535 libvpx_test::TestMode encoding_mode_;512 private:
536 vpx_codec_pts_t last_pts_;513 libvpx_test::TestMode encoding_mode_;
537 double timebase_;514 vpx_codec_pts_t last_pts_;
538 int64_t bits_total_[3];515 double timebase_;
539 double duration_;516 int64_t bits_total_[3];
540 int tot_frame_number_;517 double duration_;
541 };518 int tot_frame_number_;
519};
542 520
543// Check two codec controls used for:521// Check two codec controls used for:
544// (1) for setting temporal layer id, and (2) for settings encoder flags.522// (1) for setting temporal layer id, and (2) for settings encoder flags.
@@ -582,10 +560,12 @@ TEST_P(ErrorResilienceTestLargeCodecControls, CodecControl3TemporalLayers) { · 37 unmodified lines
582 for (int j = 0; j < static_cast<int>(cfg_.ts_number_layers); ++j) {560 for (int j = 0; j < static_cast<int>(cfg_.ts_number_layers); ++j) {
583 ASSERT_GE(effective_datarate_[j], cfg_.ts_target_bitrate[j] * 0.75)561 ASSERT_GE(effective_datarate_[j], cfg_.ts_target_bitrate[j] * 0.75)
584 << " The datarate for the file is lower than target by too much, "562 << " The datarate for the file is lower than target by too much, "
585 "for layer: " << j;563 "for layer: "
564 << j;
586 ASSERT_LE(effective_datarate_[j], cfg_.ts_target_bitrate[j] * 1.25)565 ASSERT_LE(effective_datarate_[j], cfg_.ts_target_bitrate[j] * 1.25)
587 << " The datarate for the file is greater than target by too much, "566 << " The datarate for the file is greater than target by too much, "
588 "for layer: " << j;567 "for layer: "
568 << j;
589 }569 }
590 }570 }
591}571}
test/external_frame_buffer_test.cc+47−62
@@ -34,21 +34,18 @@ struct ExternalFrameBuffer { · 33 unmodified lines
34// Class to manipulate a list of external frame buffers.34// Class to manipulate a list of external frame buffers.
35class ExternalFrameBufferList {35class ExternalFrameBufferList {
36 public:36 public:
37 ExternalFrameBufferList()37 ExternalFrameBufferList() : num_buffers_(0), ext_fb_list_(NULL) {}
38 : num_buffers_(0),
39 ext_fb_list_(NULL) {}
40 38
41 virtual ~ExternalFrameBufferList() {39 virtual ~ExternalFrameBufferList() {
42 for (int i = 0; i < num_buffers_; ++i) {40 for (int i = 0; i < num_buffers_; ++i) {
43 delete [] ext_fb_list_[i].data;41 delete[] ext_fb_list_[i].data;
44 }42 }
45 delete [] ext_fb_list_;43 delete[] ext_fb_list_;
46 }44 }
47 45
48 // Creates the list to hold the external buffers. Returns true on success.46 // Creates the list to hold the external buffers. Returns true on success.
49 bool CreateBufferList(int num_buffers) {47 bool CreateBufferList(int num_buffers) {
50 if (num_buffers < 0)48 if (num_buffers < 0) return false;
51 return false;
52 49
53 num_buffers_ = num_buffers;50 num_buffers_ = num_buffers;
54 ext_fb_list_ = new ExternalFrameBuffer[num_buffers_];51 ext_fb_list_ = new ExternalFrameBuffer[num_buffers_];
@@ -64,11 +61,10 @@ class ExternalFrameBufferList { · 9 unmodified lines
64 int GetFreeFrameBuffer(size_t min_size, vpx_codec_frame_buffer_t *fb) {61 int GetFreeFrameBuffer(size_t min_size, vpx_codec_frame_buffer_t *fb) {
65 EXPECT_TRUE(fb != NULL);62 EXPECT_TRUE(fb != NULL);
66 const int idx = FindFreeBufferIndex();63 const int idx = FindFreeBufferIndex();
67 if (idx == num_buffers_)64 if (idx == num_buffers_) return -1;
68 return -1;
69 65
70 if (ext_fb_list_[idx].size < min_size) {66 if (ext_fb_list_[idx].size < min_size) {
71 delete [] ext_fb_list_[idx].data;67 delete[] ext_fb_list_[idx].data;
72 ext_fb_list_[idx].data = new uint8_t[min_size];68 ext_fb_list_[idx].data = new uint8_t[min_size];
73 memset(ext_fb_list_[idx].data, 0, min_size);69 memset(ext_fb_list_[idx].data, 0, min_size);
74 ext_fb_list_[idx].size = min_size;70 ext_fb_list_[idx].size = min_size;
@@ -83,11 +79,10 @@ class ExternalFrameBufferList { · 8 unmodified lines
83 int GetZeroFrameBuffer(size_t min_size, vpx_codec_frame_buffer_t *fb) {79 int GetZeroFrameBuffer(size_t min_size, vpx_codec_frame_buffer_t *fb) {
84 EXPECT_TRUE(fb != NULL);80 EXPECT_TRUE(fb != NULL);
85 const int idx = FindFreeBufferIndex();81 const int idx = FindFreeBufferIndex();
86 if (idx == num_buffers_)82 if (idx == num_buffers_) return -1;
87 return -1;
88 83
89 if (ext_fb_list_[idx].size < min_size) {84 if (ext_fb_list_[idx].size < min_size) {
90 delete [] ext_fb_list_[idx].data;85 delete[] ext_fb_list_[idx].data;
91 ext_fb_list_[idx].data = NULL;86 ext_fb_list_[idx].data = NULL;
92 ext_fb_list_[idx].size = min_size;87 ext_fb_list_[idx].size = min_size;
93 }88 }
@@ -104,7 +99,7 @@ class ExternalFrameBufferList { · 10 unmodified lines
104 return -1;99 return -1;
105 }100 }
106 ExternalFrameBuffer *const ext_fb =101 ExternalFrameBuffer *const ext_fb =
107 reinterpret_cast<ExternalFrameBuffer*>(fb->priv);102 reinterpret_cast<ExternalFrameBuffer *>(fb->priv);
108 if (ext_fb == NULL) {103 if (ext_fb == NULL) {
109 EXPECT_TRUE(ext_fb != NULL);104 EXPECT_TRUE(ext_fb != NULL);
110 return -1;105 return -1;
@@ -119,7 +114,7 @@ class ExternalFrameBufferList { · 8 unmodified lines
119 void CheckXImageFrameBuffer(const vpx_image_t *img) {114 void CheckXImageFrameBuffer(const vpx_image_t *img) {
120 if (img->fb_priv != NULL) {115 if (img->fb_priv != NULL) {
121 const struct ExternalFrameBuffer *const ext_fb =116 const struct ExternalFrameBuffer *const ext_fb =
122 reinterpret_cast<ExternalFrameBuffer*>(img->fb_priv);117 reinterpret_cast<ExternalFrameBuffer *>(img->fb_priv);
123 118
124 ASSERT_TRUE(img->planes[0] >= ext_fb->data &&119 ASSERT_TRUE(img->planes[0] >= ext_fb->data &&
125 img->planes[0] < (ext_fb->data + ext_fb->size));120 img->planes[0] < (ext_fb->data + ext_fb->size));
@@ -133,8 +128,7 @@ class ExternalFrameBufferList { · 7 unmodified lines
133 int i;128 int i;
134 // Find a free frame buffer.129 // Find a free frame buffer.
135 for (i = 0; i < num_buffers_; ++i) {130 for (i = 0; i < num_buffers_; ++i) {
136 if (!ext_fb_list_[i].in_use)131 if (!ext_fb_list_[i].in_use) break;
137 break;
138 }132 }
139 return i;133 return i;
140 }134 }
@@ -161,16 +155,15 @@ class ExternalFrameBufferList { · 20 unmodified lines
161int get_vp9_frame_buffer(void *user_priv, size_t min_size,155int get_vp9_frame_buffer(void *user_priv, size_t min_size,
162 vpx_codec_frame_buffer_t *fb) {156 vpx_codec_frame_buffer_t *fb) {
163 ExternalFrameBufferList *const fb_list =157 ExternalFrameBufferList *const fb_list =
164 reinterpret_cast<ExternalFrameBufferList*>(user_priv);158 reinterpret_cast<ExternalFrameBufferList *>(user_priv);
165 return fb_list->GetFreeFrameBuffer(min_size, fb);159 return fb_list->GetFreeFrameBuffer(min_size, fb);
166}160}
167 161
168// Callback used by libvpx to tell the application that |fb| is not needed162// Callback used by libvpx to tell the application that |fb| is not needed
169// anymore.163// anymore.
170int release_vp9_frame_buffer(void *user_priv,164int release_vp9_frame_buffer(void *user_priv, vpx_codec_frame_buffer_t *fb) {
171 vpx_codec_frame_buffer_t *fb) {
172 ExternalFrameBufferList *const fb_list =165 ExternalFrameBufferList *const fb_list =
173 reinterpret_cast<ExternalFrameBufferList*>(user_priv);166 reinterpret_cast<ExternalFrameBufferList *>(user_priv);
174 return fb_list->ReturnFrameBuffer(fb);167 return fb_list->ReturnFrameBuffer(fb);
175}168}
176 169
@@ -178,7 +171,7 @@ int release_vp9_frame_buffer(void *user_priv, · 1 unmodified line
178int get_vp9_zero_frame_buffer(void *user_priv, size_t min_size,171int get_vp9_zero_frame_buffer(void *user_priv, size_t min_size,
179 vpx_codec_frame_buffer_t *fb) {172 vpx_codec_frame_buffer_t *fb) {
180 ExternalFrameBufferList *const fb_list =173 ExternalFrameBufferList *const fb_list =
181 reinterpret_cast<ExternalFrameBufferList*>(user_priv);174 reinterpret_cast<ExternalFrameBufferList *>(user_priv);
182 return fb_list->GetZeroFrameBuffer(min_size, fb);175 return fb_list->GetZeroFrameBuffer(min_size, fb);
183}176}
184 177
@@ -186,7 +179,7 @@ int get_vp9_zero_frame_buffer(void *user_priv, size_t min_size, · 1 unmodified line
186int get_vp9_one_less_byte_frame_buffer(void *user_priv, size_t min_size,179int get_vp9_one_less_byte_frame_buffer(void *user_priv, size_t min_size,
187 vpx_codec_frame_buffer_t *fb) {180 vpx_codec_frame_buffer_t *fb) {
188 ExternalFrameBufferList *const fb_list =181 ExternalFrameBufferList *const fb_list =
189 reinterpret_cast<ExternalFrameBufferList*>(user_priv);182 reinterpret_cast<ExternalFrameBufferList *>(user_priv);
190 return fb_list->GetFreeFrameBuffer(min_size - 1, fb);183 return fb_list->GetFreeFrameBuffer(min_size - 1, fb);
191}184}
192 185
@@ -203,16 +196,14 @@ int do_not_release_vp9_frame_buffer(void *user_priv, · 10 unmodified lines
203// Class for testing passing in external frame buffers to libvpx.196// Class for testing passing in external frame buffers to libvpx.
204class ExternalFrameBufferMD5Test197class ExternalFrameBufferMD5Test
205 : public ::libvpx_test::DecoderTest,198 : public ::libvpx_test::DecoderTest,
206 public ::libvpx_test::CodecTestWithParam<const char*> {199 public ::libvpx_test::CodecTestWithParam<const char *> {
207 protected:200 protected:
208 ExternalFrameBufferMD5Test()201 ExternalFrameBufferMD5Test()
209 : DecoderTest(GET_PARAM(::libvpx_test::kCodecFactoryParam)),202 : DecoderTest(GET_PARAM(::libvpx_test::kCodecFactoryParam)),
210 md5_file_(NULL),203 md5_file_(NULL), num_buffers_(0) {}
211 num_buffers_(0) {}
212 204
213 virtual ~ExternalFrameBufferMD5Test() {205 virtual ~ExternalFrameBufferMD5Test() {
214 if (md5_file_ != NULL)206 if (md5_file_ != NULL) fclose(md5_file_);
215 fclose(md5_file_);
216 }207 }
217 208
218 virtual void PreDecodeFrameHook(209 virtual void PreDecodeFrameHook(
@@ -222,15 +213,15 @@ class ExternalFrameBufferMD5Test · 3 unmodified lines
222 // Have libvpx use frame buffers we create.213 // Have libvpx use frame buffers we create.
223 ASSERT_TRUE(fb_list_.CreateBufferList(num_buffers_));214 ASSERT_TRUE(fb_list_.CreateBufferList(num_buffers_));
224 ASSERT_EQ(VPX_CODEC_OK,215 ASSERT_EQ(VPX_CODEC_OK,
225 decoder->SetFrameBufferFunctions(216 decoder->SetFrameBufferFunctions(GetVP9FrameBuffer,
226 GetVP9FrameBuffer, ReleaseVP9FrameBuffer, this));217 ReleaseVP9FrameBuffer, this));
227 }218 }
228 }219 }
229 220
230 void OpenMD5File(const std::string &md5_file_name_) {221 void OpenMD5File(const std::string &md5_file_name_) {
231 md5_file_ = libvpx_test::OpenTestDataFile(md5_file_name_);222 md5_file_ = libvpx_test::OpenTestDataFile(md5_file_name_);
232 ASSERT_TRUE(md5_file_ != NULL) << "Md5 file open failed. Filename: "223 ASSERT_TRUE(md5_file_ != NULL) << "Md5 file open failed. Filename: "
233 << md5_file_name_;224 << md5_file_name_;
234 }225 }
235 226
236 virtual void DecompressedFrameHook(const vpx_image_t &img,227 virtual void DecompressedFrameHook(const vpx_image_t &img,
@@ -258,7 +249,7 @@ class ExternalFrameBufferMD5Test · 21 unmodified lines
258 static int GetVP9FrameBuffer(void *user_priv, size_t min_size,249 static int GetVP9FrameBuffer(void *user_priv, size_t min_size,
259 vpx_codec_frame_buffer_t *fb) {250 vpx_codec_frame_buffer_t *fb) {
260 ExternalFrameBufferMD5Test *const md5Test =251 ExternalFrameBufferMD5Test *const md5Test =
261 reinterpret_cast<ExternalFrameBufferMD5Test*>(user_priv);252 reinterpret_cast<ExternalFrameBufferMD5Test *>(user_priv);
262 return md5Test->fb_list_.GetFreeFrameBuffer(min_size, fb);253 return md5Test->fb_list_.GetFreeFrameBuffer(min_size, fb);
263 }254 }
264 255
@@ -267,7 +258,7 @@ class ExternalFrameBufferMD5Test · 2 unmodified lines
267 static int ReleaseVP9FrameBuffer(void *user_priv,258 static int ReleaseVP9FrameBuffer(void *user_priv,
268 vpx_codec_frame_buffer_t *fb) {259 vpx_codec_frame_buffer_t *fb) {
269 ExternalFrameBufferMD5Test *const md5Test =260 ExternalFrameBufferMD5Test *const md5Test =
270 reinterpret_cast<ExternalFrameBufferMD5Test*>(user_priv);261 reinterpret_cast<ExternalFrameBufferMD5Test *>(user_priv);
271 return md5Test->fb_list_.ReturnFrameBuffer(fb);262 return md5Test->fb_list_.ReturnFrameBuffer(fb);
272 }263 }
273 264
@@ -286,10 +277,7 @@ const char kVP9TestFile[] = "vp90-2-02-size-lf-1920x1080.webm"; · 12 unmodified lines
286// Class for testing passing in external frame buffers to libvpx.277// Class for testing passing in external frame buffers to libvpx.
287class ExternalFrameBufferTest : public ::testing::Test {278class ExternalFrameBufferTest : public ::testing::Test {
288 protected:279 protected:
289 ExternalFrameBufferTest()280 ExternalFrameBufferTest() : video_(NULL), decoder_(NULL), num_buffers_(0) {}
290 : video_(NULL),
291 decoder_(NULL),
292 num_buffers_(0) {}
293 281
294 virtual void SetUp() {282 virtual void SetUp() {
295 video_ = new libvpx_test::WebMVideoSource(kVP9TestFile);283 video_ = new libvpx_test::WebMVideoSource(kVP9TestFile);
@@ -309,8 +297,7 @@ class ExternalFrameBufferTest : public ::testing::Test { · 13 unmodified lines
309 297
310 // Passes the external frame buffer information to libvpx.298 // Passes the external frame buffer information to libvpx.
311 vpx_codec_err_t SetFrameBufferFunctions(299 vpx_codec_err_t SetFrameBufferFunctions(
312 int num_buffers,300 int num_buffers, vpx_get_frame_buffer_cb_fn_t cb_get,
313 vpx_get_frame_buffer_cb_fn_t cb_get,
314 vpx_release_frame_buffer_cb_fn_t cb_release) {301 vpx_release_frame_buffer_cb_fn_t cb_release) {
315 if (num_buffers > 0) {302 if (num_buffers > 0) {
316 num_buffers_ = num_buffers;303 num_buffers_ = num_buffers;
@@ -324,8 +311,7 @@ class ExternalFrameBufferTest : public ::testing::Test { · 7 unmodified lines
324 const vpx_codec_err_t res =311 const vpx_codec_err_t res =
325 decoder_->DecodeFrame(video_->cxdata(), video_->frame_size());312 decoder_->DecodeFrame(video_->cxdata(), video_->frame_size());
326 CheckDecodedFrames();313 CheckDecodedFrames();
327 if (res == VPX_CODEC_OK)314 if (res == VPX_CODEC_OK) video_->Next();
328 video_->Next();
329 return res;315 return res;
330 }316 }
331 317
@@ -333,8 +319,7 @@ class ExternalFrameBufferTest : public ::testing::Test { · 1 unmodified line
333 for (; video_->cxdata() != NULL; video_->Next()) {319 for (; video_->cxdata() != NULL; video_->Next()) {
334 const vpx_codec_err_t res =320 const vpx_codec_err_t res =
335 decoder_->DecodeFrame(video_->cxdata(), video_->frame_size());321 decoder_->DecodeFrame(video_->cxdata(), video_->frame_size());
336 if (res != VPX_CODEC_OK)322 if (res != VPX_CODEC_OK) return res;
337 return res;
338 CheckDecodedFrames();323 CheckDecodedFrames();
339 }324 }
340 return VPX_CODEC_OK;325 return VPX_CODEC_OK;
@@ -409,8 +394,8 @@ TEST_F(ExternalFrameBufferTest, MinFrameBuffers) { · 68 unmodified lines
409 // #VP9_MAXIMUM_REF_BUFFERS + #VPX_MAXIMUM_WORK_BUFFERS.394 // #VP9_MAXIMUM_REF_BUFFERS + #VPX_MAXIMUM_WORK_BUFFERS.
410 const int num_buffers = VP9_MAXIMUM_REF_BUFFERS + VPX_MAXIMUM_WORK_BUFFERS;395 const int num_buffers = VP9_MAXIMUM_REF_BUFFERS + VPX_MAXIMUM_WORK_BUFFERS;
411 ASSERT_EQ(VPX_CODEC_OK,396 ASSERT_EQ(VPX_CODEC_OK,
412 SetFrameBufferFunctions(397 SetFrameBufferFunctions(num_buffers, get_vp9_frame_buffer,
413 num_buffers, get_vp9_frame_buffer, release_vp9_frame_buffer));398 release_vp9_frame_buffer));
414 ASSERT_EQ(VPX_CODEC_OK, DecodeRemainingFrames());399 ASSERT_EQ(VPX_CODEC_OK, DecodeRemainingFrames());
415}400}
416 401
@@ -421,8 +406,8 @@ TEST_F(ExternalFrameBufferTest, EightJitterBuffers) { · 4 unmodified lines
421 const int num_buffers =406 const int num_buffers =
422 VP9_MAXIMUM_REF_BUFFERS + VPX_MAXIMUM_WORK_BUFFERS + jitter_buffers;407 VP9_MAXIMUM_REF_BUFFERS + VPX_MAXIMUM_WORK_BUFFERS + jitter_buffers;
423 ASSERT_EQ(VPX_CODEC_OK,408 ASSERT_EQ(VPX_CODEC_OK,
424 SetFrameBufferFunctions(409 SetFrameBufferFunctions(num_buffers, get_vp9_frame_buffer,
425 num_buffers, get_vp9_frame_buffer, release_vp9_frame_buffer));410 release_vp9_frame_buffer));
426 ASSERT_EQ(VPX_CODEC_OK, DecodeRemainingFrames());411 ASSERT_EQ(VPX_CODEC_OK, DecodeRemainingFrames());
427}412}
428 413
@@ -432,8 +417,8 @@ TEST_F(ExternalFrameBufferTest, NotEnoughBuffers) { · 3 unmodified lines
432 // only use 5 frame buffers at one time.417 // only use 5 frame buffers at one time.
433 const int num_buffers = 2;418 const int num_buffers = 2;
434 ASSERT_EQ(VPX_CODEC_OK,419 ASSERT_EQ(VPX_CODEC_OK,
435 SetFrameBufferFunctions(420 SetFrameBufferFunctions(num_buffers, get_vp9_frame_buffer,
436 num_buffers, get_vp9_frame_buffer, release_vp9_frame_buffer));421 release_vp9_frame_buffer));
437 ASSERT_EQ(VPX_CODEC_OK, DecodeOneFrame());422 ASSERT_EQ(VPX_CODEC_OK, DecodeOneFrame());
438 ASSERT_EQ(VPX_CODEC_MEM_ERROR, DecodeRemainingFrames());423 ASSERT_EQ(VPX_CODEC_MEM_ERROR, DecodeRemainingFrames());
439}424}
@@ -457,18 +442,17 @@ TEST_F(ExternalFrameBufferTest, NullRealloc) { · 17 unmodified lines
457 442
458TEST_F(ExternalFrameBufferTest, ReallocOneLessByte) {443TEST_F(ExternalFrameBufferTest, ReallocOneLessByte) {
459 const int num_buffers = VP9_MAXIMUM_REF_BUFFERS + VPX_MAXIMUM_WORK_BUFFERS;444 const int num_buffers = VP9_MAXIMUM_REF_BUFFERS + VPX_MAXIMUM_WORK_BUFFERS;
460 ASSERT_EQ(VPX_CODEC_OK,445 ASSERT_EQ(VPX_CODEC_OK, SetFrameBufferFunctions(
461 SetFrameBufferFunctions(446 num_buffers, get_vp9_one_less_byte_frame_buffer,
462 num_buffers, get_vp9_one_less_byte_frame_buffer,447 release_vp9_frame_buffer));
463 release_vp9_frame_buffer));
464 ASSERT_EQ(VPX_CODEC_MEM_ERROR, DecodeOneFrame());448 ASSERT_EQ(VPX_CODEC_MEM_ERROR, DecodeOneFrame());
465}449}
466 450
467TEST_F(ExternalFrameBufferTest, NullGetFunction) {451TEST_F(ExternalFrameBufferTest, NullGetFunction) {
468 const int num_buffers = VP9_MAXIMUM_REF_BUFFERS + VPX_MAXIMUM_WORK_BUFFERS;452 const int num_buffers = VP9_MAXIMUM_REF_BUFFERS + VPX_MAXIMUM_WORK_BUFFERS;
469 ASSERT_EQ(VPX_CODEC_INVALID_PARAM,453 ASSERT_EQ(
470 SetFrameBufferFunctions(num_buffers, NULL,454 VPX_CODEC_INVALID_PARAM,
471 release_vp9_frame_buffer));455 SetFrameBufferFunctions(num_buffers, NULL, release_vp9_frame_buffer));
472}456}
473 457
474TEST_F(ExternalFrameBufferTest, NullReleaseFunction) {458TEST_F(ExternalFrameBufferTest, NullReleaseFunction) {
@@ -481,13 +465,14 @@ TEST_F(ExternalFrameBufferTest, SetAfterDecode) { · 6 unmodified lines
481 const int num_buffers = VP9_MAXIMUM_REF_BUFFERS + VPX_MAXIMUM_WORK_BUFFERS;465 const int num_buffers = VP9_MAXIMUM_REF_BUFFERS + VPX_MAXIMUM_WORK_BUFFERS;
482 ASSERT_EQ(VPX_CODEC_OK, DecodeOneFrame());466 ASSERT_EQ(VPX_CODEC_OK, DecodeOneFrame());
483 ASSERT_EQ(VPX_CODEC_ERROR,467 ASSERT_EQ(VPX_CODEC_ERROR,
484 SetFrameBufferFunctions(468 SetFrameBufferFunctions(num_buffers, get_vp9_frame_buffer,
485 num_buffers, get_vp9_frame_buffer, release_vp9_frame_buffer));469 release_vp9_frame_buffer));
486}470}
487#endif // CONFIG_WEBM_IO471#endif // CONFIG_WEBM_IO
488 472
489VP9_INSTANTIATE_TEST_CASE(ExternalFrameBufferMD5Test,473VP9_INSTANTIATE_TEST_CASE(
490 ::testing::ValuesIn(libvpx_test::kVP9TestVectors,474 ExternalFrameBufferMD5Test,
491 libvpx_test::kVP9TestVectors +475 ::testing::ValuesIn(libvpx_test::kVP9TestVectors,
492 libvpx_test::kNumVP9TestVectors));476 libvpx_test::kVP9TestVectors +
477 libvpx_test::kNumVP9TestVectors));
493} // namespace478} // namespace
test/fdct4x4_test.cc+60−95
@@ -128,14 +128,14 @@ class Trans4x4TestBase { · 127 unmodified lines
128 }128 }
129 }129 }
130 130
131 ASM_REGISTER_STATE_CHECK(RunFwdTxfm(test_input_block,131 ASM_REGISTER_STATE_CHECK(
132 test_temp_block, pitch_));132 RunFwdTxfm(test_input_block, test_temp_block, pitch_));
133 if (bit_depth_ == VPX_BITS_8) {133 if (bit_depth_ == VPX_BITS_8) {
134 ASM_REGISTER_STATE_CHECK(RunInvTxfm(test_temp_block, dst, pitch_));134 ASM_REGISTER_STATE_CHECK(RunInvTxfm(test_temp_block, dst, pitch_));
135#if CONFIG_VP9_HIGHBITDEPTH135#if CONFIG_VP9_HIGHBITDEPTH
136 } else {136 } else {
137 ASM_REGISTER_STATE_CHECK(RunInvTxfm(test_temp_block,137 ASM_REGISTER_STATE_CHECK(
138 CONVERT_TO_BYTEPTR(dst16), pitch_));138 RunInvTxfm(test_temp_block, CONVERT_TO_BYTEPTR(dst16), pitch_));
139#endif139#endif
140 }140 }
141 141
@@ -148,15 +148,13 @@ class Trans4x4TestBase { · 6 unmodified lines
148 const int diff = dst[j] - src[j];148 const int diff = dst[j] - src[j];
149#endif149#endif
150 const uint32_t error = diff * diff;150 const uint32_t error = diff * diff;
151 if (max_error < error)151 if (max_error < error) max_error = error;
152 max_error = error;
153 total_error += error;152 total_error += error;
154 }153 }
155 }154 }
156 155
157 EXPECT_GE(static_cast<uint32_t>(limit), max_error)156 EXPECT_GE(static_cast<uint32_t>(limit), max_error)
158 << "Error: 4x4 FHT/IHT has an individual round trip error > "157 << "Error: 4x4 FHT/IHT has an individual round trip error > " << limit;
159 << limit;
160 158
161 EXPECT_GE(count_test_block * limit, total_error)159 EXPECT_GE(count_test_block * limit, total_error)
162 << "Error: 4x4 FHT/IHT has average round trip error > " << limit160 << "Error: 4x4 FHT/IHT has average round trip error > " << limit
@@ -197,16 +195,14 @@ class Trans4x4TestBase { · 34 unmodified lines
197 input_extreme_block[j] = rnd.Rand8() % 2 ? mask_ : -mask_;195 input_extreme_block[j] = rnd.Rand8() % 2 ? mask_ : -mask_;
198 }196 }
199 if (i == 0) {197 if (i == 0) {
200 for (int j = 0; j < kNumCoeffs; ++j)198 for (int j = 0; j < kNumCoeffs; ++j) input_extreme_block[j] = mask_;
201 input_extreme_block[j] = mask_;
202 } else if (i == 1) {199 } else if (i == 1) {
203 for (int j = 0; j < kNumCoeffs; ++j)200 for (int j = 0; j < kNumCoeffs; ++j) input_extreme_block[j] = -mask_;
204 input_extreme_block[j] = -mask_;
205 }201 }
206 202
207 fwd_txfm_ref(input_extreme_block, output_ref_block, pitch_, tx_type_);203 fwd_txfm_ref(input_extreme_block, output_ref_block, pitch_, tx_type_);
208 ASM_REGISTER_STATE_CHECK(RunFwdTxfm(input_extreme_block,204 ASM_REGISTER_STATE_CHECK(
209 output_block, pitch_));205 RunFwdTxfm(input_extreme_block, output_block, pitch_));
210 206
211 // The minimum quant value is 4.207 // The minimum quant value is 4.
212 for (int j = 0; j < kNumCoeffs; ++j) {208 for (int j = 0; j < kNumCoeffs; ++j) {
@@ -251,8 +247,8 @@ class Trans4x4TestBase { · 38 unmodified lines
251 ASM_REGISTER_STATE_CHECK(RunInvTxfm(coeff, dst, pitch_));247 ASM_REGISTER_STATE_CHECK(RunInvTxfm(coeff, dst, pitch_));
252#if CONFIG_VP9_HIGHBITDEPTH248#if CONFIG_VP9_HIGHBITDEPTH
253 } else {249 } else {
254 ASM_REGISTER_STATE_CHECK(RunInvTxfm(coeff, CONVERT_TO_BYTEPTR(dst16),250 ASM_REGISTER_STATE_CHECK(
255 pitch_));251 RunInvTxfm(coeff, CONVERT_TO_BYTEPTR(dst16), pitch_));
256#endif252#endif
257 }253 }
258 254
@@ -265,8 +261,7 @@ class Trans4x4TestBase { · 6 unmodified lines
265#endif261#endif
266 const uint32_t error = diff * diff;262 const uint32_t error = diff * diff;
267 EXPECT_GE(static_cast<uint32_t>(limit), error)263 EXPECT_GE(static_cast<uint32_t>(limit), error)
268 << "Error: 4x4 IDCT has error " << error264 << "Error: 4x4 IDCT has error " << error << " at index " << j;
269 << " at index " << j;
270 }265 }
271 }266 }
272 }267 }
@@ -278,17 +273,16 @@ class Trans4x4TestBase { · 5 unmodified lines
278 int mask_;273 int mask_;
279};274};
280 275
281class Trans4x4DCT276class Trans4x4DCT : public Trans4x4TestBase,
282 : public Trans4x4TestBase,277 public ::testing::TestWithParam<Dct4x4Param> {
283 public ::testing::TestWithParam<Dct4x4Param> {
284 public:278 public:
285 virtual ~Trans4x4DCT() {}279 virtual ~Trans4x4DCT() {}
286 280
287 virtual void SetUp() {281 virtual void SetUp() {
288 fwd_txfm_ = GET_PARAM(0);282 fwd_txfm_ = GET_PARAM(0);
289 inv_txfm_ = GET_PARAM(1);283 inv_txfm_ = GET_PARAM(1);
290 tx_type_ = GET_PARAM(2);284 tx_type_ = GET_PARAM(2);
291 pitch_ = 4;285 pitch_ = 4;
292 fwd_txfm_ref = fdct4x4_ref;286 fwd_txfm_ref = fdct4x4_ref;
293 bit_depth_ = GET_PARAM(3);287 bit_depth_ = GET_PARAM(3);
294 mask_ = (1 << bit_depth_) - 1;288 mask_ = (1 << bit_depth_) - 1;
@@ -307,33 +301,24 @@ class Trans4x4DCT · 12 unmodified lines
307 IdctFunc inv_txfm_;301 IdctFunc inv_txfm_;
308};302};
309 303
310TEST_P(Trans4x4DCT, AccuracyCheck) {304TEST_P(Trans4x4DCT, AccuracyCheck) { RunAccuracyCheck(1); }
311 RunAccuracyCheck(1);
312}
313 305
314TEST_P(Trans4x4DCT, CoeffCheck) {306TEST_P(Trans4x4DCT, CoeffCheck) { RunCoeffCheck(); }
315 RunCoeffCheck();
316}
317 307
318TEST_P(Trans4x4DCT, MemCheck) {308TEST_P(Trans4x4DCT, MemCheck) { RunMemCheck(); }
319 RunMemCheck();
320}
321 309
322TEST_P(Trans4x4DCT, InvAccuracyCheck) {310TEST_P(Trans4x4DCT, InvAccuracyCheck) { RunInvAccuracyCheck(1); }
323 RunInvAccuracyCheck(1);
324}
325 311
326class Trans4x4HT312class Trans4x4HT : public Trans4x4TestBase,
327 : public Trans4x4TestBase,313 public ::testing::TestWithParam<Ht4x4Param> {
328 public ::testing::TestWithParam<Ht4x4Param> {
329 public:314 public:
330 virtual ~Trans4x4HT() {}315 virtual ~Trans4x4HT() {}
331 316
332 virtual void SetUp() {317 virtual void SetUp() {
333 fwd_txfm_ = GET_PARAM(0);318 fwd_txfm_ = GET_PARAM(0);
334 inv_txfm_ = GET_PARAM(1);319 inv_txfm_ = GET_PARAM(1);
335 tx_type_ = GET_PARAM(2);320 tx_type_ = GET_PARAM(2);
336 pitch_ = 4;321 pitch_ = 4;
337 fwd_txfm_ref = fht4x4_ref;322 fwd_txfm_ref = fht4x4_ref;
338 bit_depth_ = GET_PARAM(3);323 bit_depth_ = GET_PARAM(3);
339 mask_ = (1 << bit_depth_) - 1;324 mask_ = (1 << bit_depth_) - 1;
@@ -353,33 +338,24 @@ class Trans4x4HT · 13 unmodified lines
353 IhtFunc inv_txfm_;338 IhtFunc inv_txfm_;
354};339};
355 340
356TEST_P(Trans4x4HT, AccuracyCheck) {341TEST_P(Trans4x4HT, AccuracyCheck) { RunAccuracyCheck(1); }
357 RunAccuracyCheck(1);
358}
359 342
360TEST_P(Trans4x4HT, CoeffCheck) {343TEST_P(Trans4x4HT, CoeffCheck) { RunCoeffCheck(); }
361 RunCoeffCheck();
362}
363 344
364TEST_P(Trans4x4HT, MemCheck) {345TEST_P(Trans4x4HT, MemCheck) { RunMemCheck(); }
365 RunMemCheck();
366}
367 346
368TEST_P(Trans4x4HT, InvAccuracyCheck) {347TEST_P(Trans4x4HT, InvAccuracyCheck) { RunInvAccuracyCheck(1); }
369 RunInvAccuracyCheck(1);
370}
371 348
372class Trans4x4WHT349class Trans4x4WHT : public Trans4x4TestBase,
373 : public Trans4x4TestBase,350 public ::testing::TestWithParam<Dct4x4Param> {
374 public ::testing::TestWithParam<Dct4x4Param> {
375 public:351 public:
376 virtual ~Trans4x4WHT() {}352 virtual ~Trans4x4WHT() {}
377 353
378 virtual void SetUp() {354 virtual void SetUp() {
379 fwd_txfm_ = GET_PARAM(0);355 fwd_txfm_ = GET_PARAM(0);
380 inv_txfm_ = GET_PARAM(1);356 inv_txfm_ = GET_PARAM(1);
381 tx_type_ = GET_PARAM(2);357 tx_type_ = GET_PARAM(2);
382 pitch_ = 4;358 pitch_ = 4;
383 fwd_txfm_ref = fwht4x4_ref;359 fwd_txfm_ref = fwht4x4_ref;
384 bit_depth_ = GET_PARAM(3);360 bit_depth_ = GET_PARAM(3);
385 mask_ = (1 << bit_depth_) - 1;361 mask_ = (1 << bit_depth_) - 1;
@@ -398,21 +374,13 @@ class Trans4x4WHT · 12 unmodified lines
398 IdctFunc inv_txfm_;374 IdctFunc inv_txfm_;
399};375};
400 376
401TEST_P(Trans4x4WHT, AccuracyCheck) {377TEST_P(Trans4x4WHT, AccuracyCheck) { RunAccuracyCheck(0); }
402 RunAccuracyCheck(0);
403}
404 378
405TEST_P(Trans4x4WHT, CoeffCheck) {379TEST_P(Trans4x4WHT, CoeffCheck) { RunCoeffCheck(); }
406 RunCoeffCheck();
407}
408 380
409TEST_P(Trans4x4WHT, MemCheck) {381TEST_P(Trans4x4WHT, MemCheck) { RunMemCheck(); }
410 RunMemCheck();
411}
412 382
413TEST_P(Trans4x4WHT, InvAccuracyCheck) {383TEST_P(Trans4x4WHT, InvAccuracyCheck) { RunInvAccuracyCheck(0); }
414 RunInvAccuracyCheck(0);
415}
416using std::tr1::make_tuple;384using std::tr1::make_tuple;
417 385
418#if CONFIG_VP9_HIGHBITDEPTH386#if CONFIG_VP9_HIGHBITDEPTH
@@ -423,10 +391,10 @@ INSTANTIATE_TEST_CASE_P( · 4 unmodified lines
423 make_tuple(&vpx_highbd_fdct4x4_c, &idct4x4_12, 0, VPX_BITS_12),391 make_tuple(&vpx_highbd_fdct4x4_c, &idct4x4_12, 0, VPX_BITS_12),
424 make_tuple(&vpx_fdct4x4_c, &vpx_idct4x4_16_add_c, 0, VPX_BITS_8)));392 make_tuple(&vpx_fdct4x4_c, &vpx_idct4x4_16_add_c, 0, VPX_BITS_8)));
425#else393#else
426INSTANTIATE_TEST_CASE_P(394INSTANTIATE_TEST_CASE_P(C, Trans4x4DCT,
427 C, Trans4x4DCT,395 ::testing::Values(make_tuple(&vpx_fdct4x4_c,
428 ::testing::Values(396 &vpx_idct4x4_16_add_c, 0,
429 make_tuple(&vpx_fdct4x4_c, &vpx_idct4x4_16_add_c, 0, VPX_BITS_8)));397 VPX_BITS_8)));
430#endif // CONFIG_VP9_HIGHBITDEPTH398#endif // CONFIG_VP9_HIGHBITDEPTH
431 399
432#if CONFIG_VP9_HIGHBITDEPTH400#if CONFIG_VP9_HIGHBITDEPTH
@@ -463,18 +431,17 @@ INSTANTIATE_TEST_CASE_P( · 30 unmodified lines
463 make_tuple(&vp9_highbd_fwht4x4_c, &iwht4x4_12, 0, VPX_BITS_12),431 make_tuple(&vp9_highbd_fwht4x4_c, &iwht4x4_12, 0, VPX_BITS_12),
464 make_tuple(&vp9_fwht4x4_c, &vpx_iwht4x4_16_add_c, 0, VPX_BITS_8)));432 make_tuple(&vp9_fwht4x4_c, &vpx_iwht4x4_16_add_c, 0, VPX_BITS_8)));
465#else433#else
466INSTANTIATE_TEST_CASE_P(434INSTANTIATE_TEST_CASE_P(C, Trans4x4WHT,
467 C, Trans4x4WHT,435 ::testing::Values(make_tuple(&vp9_fwht4x4_c,
468 ::testing::Values(436 &vpx_iwht4x4_16_add_c, 0,
469 make_tuple(&vp9_fwht4x4_c, &vpx_iwht4x4_16_add_c, 0, VPX_BITS_8)));437 VPX_BITS_8)));
470#endif // CONFIG_VP9_HIGHBITDEPTH438#endif // CONFIG_VP9_HIGHBITDEPTH
471 439
472#if HAVE_NEON_ASM && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE440#if HAVE_NEON_ASM && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
473INSTANTIATE_TEST_CASE_P(441INSTANTIATE_TEST_CASE_P(NEON, Trans4x4DCT,
474 NEON, Trans4x4DCT,442 ::testing::Values(make_tuple(&vpx_fdct4x4_c,
475 ::testing::Values(443 &vpx_idct4x4_16_add_neon,
476 make_tuple(&vpx_fdct4x4_c,444 0, VPX_BITS_8)));
477 &vpx_idct4x4_16_add_neon, 0, VPX_BITS_8)));
478#endif // HAVE_NEON_ASM && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE445#endif // HAVE_NEON_ASM && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
479 446
480#if HAVE_NEON && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE447#if HAVE_NEON && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
@@ -496,11 +463,10 @@ INSTANTIATE_TEST_CASE_P( · 15 unmodified lines
496#endif463#endif
497 464
498#if HAVE_SSE2 && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE465#if HAVE_SSE2 && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
499INSTANTIATE_TEST_CASE_P(466INSTANTIATE_TEST_CASE_P(SSE2, Trans4x4DCT,
500 SSE2, Trans4x4DCT,467 ::testing::Values(make_tuple(&vpx_fdct4x4_sse2,
501 ::testing::Values(468 &vpx_idct4x4_16_add_sse2,
502 make_tuple(&vpx_fdct4x4_sse2,469 0, VPX_BITS_8)));
503 &vpx_idct4x4_16_add_sse2, 0, VPX_BITS_8)));
504INSTANTIATE_TEST_CASE_P(470INSTANTIATE_TEST_CASE_P(
505 SSE2, Trans4x4HT,471 SSE2, Trans4x4HT,
506 ::testing::Values(472 ::testing::Values(
@@ -514,12 +480,11 @@ INSTANTIATE_TEST_CASE_P( · 7 unmodified lines
514INSTANTIATE_TEST_CASE_P(480INSTANTIATE_TEST_CASE_P(
515 SSE2, Trans4x4DCT,481 SSE2, Trans4x4DCT,
516 ::testing::Values(482 ::testing::Values(
517 make_tuple(&vpx_highbd_fdct4x4_c, &idct4x4_10_sse2, 0, VPX_BITS_10),483 make_tuple(&vpx_highbd_fdct4x4_c, &idct4x4_10_sse2, 0, VPX_BITS_10),
518 make_tuple(&vpx_highbd_fdct4x4_sse2, &idct4x4_10_sse2, 0, VPX_BITS_10),484 make_tuple(&vpx_highbd_fdct4x4_sse2, &idct4x4_10_sse2, 0, VPX_BITS_10),
519 make_tuple(&vpx_highbd_fdct4x4_c, &idct4x4_12_sse2, 0, VPX_BITS_12),485 make_tuple(&vpx_highbd_fdct4x4_c, &idct4x4_12_sse2, 0, VPX_BITS_12),
520 make_tuple(&vpx_highbd_fdct4x4_sse2, &idct4x4_12_sse2, 0, VPX_BITS_12),486 make_tuple(&vpx_highbd_fdct4x4_sse2, &idct4x4_12_sse2, 0, VPX_BITS_12),
521 make_tuple(&vpx_fdct4x4_sse2, &vpx_idct4x4_16_add_c, 0,487 make_tuple(&vpx_fdct4x4_sse2, &vpx_idct4x4_16_add_c, 0, VPX_BITS_8)));
522 VPX_BITS_8)));
523 488
524INSTANTIATE_TEST_CASE_P(489INSTANTIATE_TEST_CASE_P(
525 SSE2, Trans4x4HT,490 SSE2, Trans4x4HT,
@@ -531,10 +496,10 @@ INSTANTIATE_TEST_CASE_P( · 5 unmodified lines
531#endif // HAVE_SSE2 && CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE496#endif // HAVE_SSE2 && CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
532 497
533#if HAVE_MSA && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE498#if HAVE_MSA && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
534INSTANTIATE_TEST_CASE_P(499INSTANTIATE_TEST_CASE_P(MSA, Trans4x4DCT,
535 MSA, Trans4x4DCT,500 ::testing::Values(make_tuple(&vpx_fdct4x4_msa,
536 ::testing::Values(501 &vpx_idct4x4_16_add_msa, 0,
537 make_tuple(&vpx_fdct4x4_msa, &vpx_idct4x4_16_add_msa, 0, VPX_BITS_8)));502 VPX_BITS_8)));
538INSTANTIATE_TEST_CASE_P(503INSTANTIATE_TEST_CASE_P(
539 MSA, Trans4x4HT,504 MSA, Trans4x4HT,
540 ::testing::Values(505 ::testing::Values(
test/fdct8x8_test.cc+94−133
@@ -53,8 +53,7 @@ void reference_8x8_dct_1d(const double in[8], double out[8]) { · 52 unmodified lines
53 out[k] = 0.0;53 out[k] = 0.0;
54 for (int n = 0; n < 8; n++)54 for (int n = 0; n < 8; n++)
55 out[k] += in[n] * cos(kPi * (2 * n + 1) * k / 16.0);55 out[k] += in[n] * cos(kPi * (2 * n + 1) * k / 16.0);
56 if (k == 0)56 if (k == 0) out[k] = out[k] * kInvSqrt2;
57 out[k] = out[k] * kInvSqrt2;
58 }57 }
59}58}
60 59
@@ -63,25 +62,20 @@ void reference_8x8_dct_2d(const int16_t input[kNumCoeffs], · 2 unmodified lines
63 // First transform columns62 // First transform columns
64 for (int i = 0; i < 8; ++i) {63 for (int i = 0; i < 8; ++i) {
65 double temp_in[8], temp_out[8];64 double temp_in[8], temp_out[8];
66 for (int j = 0; j < 8; ++j)65 for (int j = 0; j < 8; ++j) temp_in[j] = input[j * 8 + i];
67 temp_in[j] = input[j*8 + i];
68 reference_8x8_dct_1d(temp_in, temp_out);66 reference_8x8_dct_1d(temp_in, temp_out);
69 for (int j = 0; j < 8; ++j)67 for (int j = 0; j < 8; ++j) output[j * 8 + i] = temp_out[j];
70 output[j * 8 + i] = temp_out[j];
71 }68 }
72 // Then transform rows69 // Then transform rows
73 for (int i = 0; i < 8; ++i) {70 for (int i = 0; i < 8; ++i) {
74 double temp_in[8], temp_out[8];71 double temp_in[8], temp_out[8];
75 for (int j = 0; j < 8; ++j)72 for (int j = 0; j < 8; ++j) temp_in[j] = output[j + i * 8];
76 temp_in[j] = output[j + i*8];
77 reference_8x8_dct_1d(temp_in, temp_out);73 reference_8x8_dct_1d(temp_in, temp_out);
78 // Scale by some magic number74 // Scale by some magic number
79 for (int j = 0; j < 8; ++j)75 for (int j = 0; j < 8; ++j) output[j + i * 8] = temp_out[j] * 2;
80 output[j + i * 8] = temp_out[j] * 2;
81 }76 }
82}77}
83 78
84
85void fdct8x8_ref(const int16_t *in, tran_low_t *out, int stride,79void fdct8x8_ref(const int16_t *in, tran_low_t *out, int stride,
86 int /*tx_type*/) {80 int /*tx_type*/) {
87 vpx_fdct8x8_c(in, out, stride);81 vpx_fdct8x8_c(in, out, stride);
@@ -177,8 +171,7 @@ class FwdTrans8x8TestBase { · 89 unmodified lines
177 << 1. * max_diff / count_test_block * 100 << "%"171 << 1. * max_diff / count_test_block * 100 << "%"
178 << " for input range [-255, 255] at index " << j172 << " for input range [-255, 255] at index " << j
179 << " count0: " << count_sign_block[j][0]173 << " count0: " << count_sign_block[j][0]
180 << " count1: " << count_sign_block[j][1]174 << " count1: " << count_sign_block[j][1] << " diff: " << diff;
181 << " diff: " << diff;
182 }175 }
183 176
184 memset(count_sign_block, 0, sizeof(count_sign_block));177 memset(count_sign_block, 0, sizeof(count_sign_block));
@@ -186,8 +179,8 @@ class FwdTrans8x8TestBase { · 1 unmodified line
186 for (int i = 0; i < count_test_block; ++i) {179 for (int i = 0; i < count_test_block; ++i) {
187 // Initialize a test block with input range [-mask_ / 16, mask_ / 16].180 // Initialize a test block with input range [-mask_ / 16, mask_ / 16].
188 for (int j = 0; j < 64; ++j)181 for (int j = 0; j < 64; ++j)
189 test_input_block[j] = ((rnd.Rand16() & mask_) >> 4) -182 test_input_block[j] =
190 ((rnd.Rand16() & mask_) >> 4);183 ((rnd.Rand16() & mask_) >> 4) - ((rnd.Rand16() & mask_) >> 4);
191 ASM_REGISTER_STATE_CHECK(184 ASM_REGISTER_STATE_CHECK(
192 RunFwdTxfm(test_input_block, test_output_block, pitch_));185 RunFwdTxfm(test_input_block, test_output_block, pitch_));
193 186
@@ -207,8 +200,7 @@ class FwdTrans8x8TestBase { · 13 unmodified lines
207 << 1. * max_diff / count_test_block * 100 << "%"200 << 1. * max_diff / count_test_block * 100 << "%"
208 << " for input range [-15, 15] at index " << j201 << " for input range [-15, 15] at index " << j
209 << " count0: " << count_sign_block[j][0]202 << " count0: " << count_sign_block[j][0]
210 << " count1: " << count_sign_block[j][1]203 << " count1: " << count_sign_block[j][1] << " diff: " << diff;
211 << " diff: " << diff;
212 }204 }
213 }205 }
214 206
@@ -245,19 +237,18 @@ class FwdTrans8x8TestBase { · 30 unmodified lines
245 ASM_REGISTER_STATE_CHECK(237 ASM_REGISTER_STATE_CHECK(
246 RunFwdTxfm(test_input_block, test_temp_block, pitch_));238 RunFwdTxfm(test_input_block, test_temp_block, pitch_));
247 for (int j = 0; j < 64; ++j) {239 for (int j = 0; j < 64; ++j) {
248 if (test_temp_block[j] > 0) {240 if (test_temp_block[j] > 0) {
249 test_temp_block[j] += 2;241 test_temp_block[j] += 2;
250 test_temp_block[j] /= 4;242 test_temp_block[j] /= 4;
251 test_temp_block[j] *= 4;243 test_temp_block[j] *= 4;
252 } else {244 } else {
253 test_temp_block[j] -= 2;245 test_temp_block[j] -= 2;
254 test_temp_block[j] /= 4;246 test_temp_block[j] /= 4;
255 test_temp_block[j] *= 4;247 test_temp_block[j] *= 4;
256 }248 }
257 }249 }
258 if (bit_depth_ == VPX_BITS_8) {250 if (bit_depth_ == VPX_BITS_8) {
259 ASM_REGISTER_STATE_CHECK(251 ASM_REGISTER_STATE_CHECK(RunInvTxfm(test_temp_block, dst, pitch_));
260 RunInvTxfm(test_temp_block, dst, pitch_));
261#if CONFIG_VP9_HIGHBITDEPTH252#if CONFIG_VP9_HIGHBITDEPTH
262 } else {253 } else {
263 ASM_REGISTER_STATE_CHECK(254 ASM_REGISTER_STATE_CHECK(
@@ -273,19 +264,18 @@ class FwdTrans8x8TestBase { · 9 unmodified lines
273 const int diff = dst[j] - src[j];264 const int diff = dst[j] - src[j];
274#endif265#endif
275 const int error = diff * diff;266 const int error = diff * diff;
276 if (max_error < error)267 if (max_error < error) max_error = error;
277 max_error = error;
278 total_error += error;268 total_error += error;
279 }269 }
280 }270 }
281 271
282 EXPECT_GE(1 << 2 * (bit_depth_ - 8), max_error)272 EXPECT_GE(1 << 2 * (bit_depth_ - 8), max_error)
283 << "Error: 8x8 FDCT/IDCT or FHT/IHT has an individual"273 << "Error: 8x8 FDCT/IDCT or FHT/IHT has an individual"
284 << " roundtrip error > 1";274 << " roundtrip error > 1";
285 275
286 EXPECT_GE((count_test_block << 2 * (bit_depth_ - 8))/5, total_error)276 EXPECT_GE((count_test_block << 2 * (bit_depth_ - 8)) / 5, total_error)
287 << "Error: 8x8 FDCT/IDCT or FHT/IHT has average roundtrip "277 << "Error: 8x8 FDCT/IDCT or FHT/IHT has average roundtrip "
288 << "error > 1/5 per block";278 << "error > 1/5 per block";
289 }279 }
290 280
291 void RunExtremalCheck() {281 void RunExtremalCheck() {
@@ -341,8 +331,7 @@ class FwdTrans8x8TestBase { · 49 unmodified lines
341 ASM_REGISTER_STATE_CHECK(331 ASM_REGISTER_STATE_CHECK(
342 fwd_txfm_ref(test_input_block, ref_temp_block, pitch_, tx_type_));332 fwd_txfm_ref(test_input_block, ref_temp_block, pitch_, tx_type_));
343 if (bit_depth_ == VPX_BITS_8) {333 if (bit_depth_ == VPX_BITS_8) {
344 ASM_REGISTER_STATE_CHECK(334 ASM_REGISTER_STATE_CHECK(RunInvTxfm(test_temp_block, dst, pitch_));
345 RunInvTxfm(test_temp_block, dst, pitch_));
346#if CONFIG_VP9_HIGHBITDEPTH335#if CONFIG_VP9_HIGHBITDEPTH
347 } else {336 } else {
348 ASM_REGISTER_STATE_CHECK(337 ASM_REGISTER_STATE_CHECK(
@@ -358,8 +347,7 @@ class FwdTrans8x8TestBase { · 9 unmodified lines
358 const int diff = dst[j] - src[j];347 const int diff = dst[j] - src[j];
359#endif348#endif
360 const int error = diff * diff;349 const int error = diff * diff;
361 if (max_error < error)350 if (max_error < error) max_error = error;
362 max_error = error;
363 total_error += error;351 total_error += error;
364 352
365 const int coeff_diff = test_temp_block[j] - ref_temp_block[j];353 const int coeff_diff = test_temp_block[j] - ref_temp_block[j];
@@ -370,7 +358,7 @@ class FwdTrans8x8TestBase { · 4 unmodified lines
370 << "Error: Extremal 8x8 FDCT/IDCT or FHT/IHT has"358 << "Error: Extremal 8x8 FDCT/IDCT or FHT/IHT has"
371 << "an individual roundtrip error > 1";359 << "an individual roundtrip error > 1";
372 360
373 EXPECT_GE((count_test_block << 2 * (bit_depth_ - 8))/5, total_error)361 EXPECT_GE((count_test_block << 2 * (bit_depth_ - 8)) / 5, total_error)
374 << "Error: Extremal 8x8 FDCT/IDCT or FHT/IHT has average"362 << "Error: Extremal 8x8 FDCT/IDCT or FHT/IHT has average"
375 << " roundtrip error > 1/5 per block";363 << " roundtrip error > 1/5 per block";
376 364
@@ -418,8 +406,8 @@ class FwdTrans8x8TestBase { · 41 unmodified lines
418 ASM_REGISTER_STATE_CHECK(RunInvTxfm(coeff, dst, pitch_));406 ASM_REGISTER_STATE_CHECK(RunInvTxfm(coeff, dst, pitch_));
419#if CONFIG_VP9_HIGHBITDEPTH407#if CONFIG_VP9_HIGHBITDEPTH
420 } else {408 } else {
421 ASM_REGISTER_STATE_CHECK(RunInvTxfm(coeff, CONVERT_TO_BYTEPTR(dst16),409 ASM_REGISTER_STATE_CHECK(
422 pitch_));410 RunInvTxfm(coeff, CONVERT_TO_BYTEPTR(dst16), pitch_));
423#endif411#endif
424 }412 }
425 413
@@ -432,8 +420,7 @@ class FwdTrans8x8TestBase { · 6 unmodified lines
432#endif420#endif
433 const uint32_t error = diff * diff;421 const uint32_t error = diff * diff;
434 EXPECT_GE(1u << 2 * (bit_depth_ - 8), error)422 EXPECT_GE(1u << 2 * (bit_depth_ - 8), error)
435 << "Error: 8x8 IDCT has error " << error423 << "Error: 8x8 IDCT has error " << error << " at index " << j;
436 << " at index " << j;
437 }424 }
438 }425 }
439 }426 }
@@ -461,13 +448,12 @@ class FwdTrans8x8TestBase { · 21 unmodified lines
461 const int32_t diff = coeff[j] - coeff_r[j];448 const int32_t diff = coeff[j] - coeff_r[j];
462 const uint32_t error = diff * diff;449 const uint32_t error = diff * diff;
463 EXPECT_GE(9u << 2 * (bit_depth_ - 8), error)450 EXPECT_GE(9u << 2 * (bit_depth_ - 8), error)
464 << "Error: 8x8 DCT has error " << error451 << "Error: 8x8 DCT has error " << error << " at index " << j;
465 << " at index " << j;
466 }452 }
467 }453 }
468 }454 }
469 455
470void CompareInvReference(IdctFunc ref_txfm, int thresh) {456 void CompareInvReference(IdctFunc ref_txfm, int thresh) {
471 ACMRandom rnd(ACMRandom::DeterministicSeed());457 ACMRandom rnd(ACMRandom::DeterministicSeed());
472 const int count_test_block = 10000;458 const int count_test_block = 10000;
473 const int eob = 12;459 const int eob = 12;
@@ -484,7 +470,7 @@ void CompareInvReference(IdctFunc ref_txfm, int thresh) { · 10 unmodified lines
484 for (int j = 0; j < kNumCoeffs; ++j) {470 for (int j = 0; j < kNumCoeffs; ++j) {
485 if (j < eob) {471 if (j < eob) {
486 // Random values less than the threshold, either positive or negative472 // Random values less than the threshold, either positive or negative
487 coeff[scan[j]] = rnd(thresh) * (1-2*(i%2));473 coeff[scan[j]] = rnd(thresh) * (1 - 2 * (i % 2));
488 } else {474 } else {
489 coeff[scan[j]] = 0;475 coeff[scan[j]] = 0;
490 }476 }
@@ -504,8 +490,8 @@ void CompareInvReference(IdctFunc ref_txfm, int thresh) { · 13 unmodified lines
504#if CONFIG_VP9_HIGHBITDEPTH490#if CONFIG_VP9_HIGHBITDEPTH
505 } else {491 } else {
506 ref_txfm(coeff, CONVERT_TO_BYTEPTR(ref16), pitch_);492 ref_txfm(coeff, CONVERT_TO_BYTEPTR(ref16), pitch_);
507 ASM_REGISTER_STATE_CHECK(RunInvTxfm(coeff, CONVERT_TO_BYTEPTR(dst16),493 ASM_REGISTER_STATE_CHECK(
508 pitch_));494 RunInvTxfm(coeff, CONVERT_TO_BYTEPTR(dst16), pitch_));
509#endif495#endif
510 }496 }
511 497
@@ -517,9 +503,8 @@ void CompareInvReference(IdctFunc ref_txfm, int thresh) { · 5 unmodified lines
517 const int diff = dst[j] - ref[j];503 const int diff = dst[j] - ref[j];
518#endif504#endif
519 const uint32_t error = diff * diff;505 const uint32_t error = diff * diff;
520 EXPECT_EQ(0u, error)506 EXPECT_EQ(0u, error) << "Error: 8x8 IDCT has error " << error
521 << "Error: 8x8 IDCT has error " << error507 << " at index " << j;
522 << " at index " << j;
523 }508 }
524 }509 }
525 }510 }
@@ -530,17 +515,16 @@ void CompareInvReference(IdctFunc ref_txfm, int thresh) { · 4 unmodified lines
530 int mask_;515 int mask_;
531};516};
532 517
533class FwdTrans8x8DCT518class FwdTrans8x8DCT : public FwdTrans8x8TestBase,
534 : public FwdTrans8x8TestBase,519 public ::testing::TestWithParam<Dct8x8Param> {
535 public ::testing::TestWithParam<Dct8x8Param> {
536 public:520 public:
537 virtual ~FwdTrans8x8DCT() {}521 virtual ~FwdTrans8x8DCT() {}
538 522
539 virtual void SetUp() {523 virtual void SetUp() {
540 fwd_txfm_ = GET_PARAM(0);524 fwd_txfm_ = GET_PARAM(0);
541 inv_txfm_ = GET_PARAM(1);525 inv_txfm_ = GET_PARAM(1);
542 tx_type_ = GET_PARAM(2);526 tx_type_ = GET_PARAM(2);
543 pitch_ = 8;527 pitch_ = 8;
544 fwd_txfm_ref = fdct8x8_ref;528 fwd_txfm_ref = fdct8x8_ref;
545 bit_depth_ = GET_PARAM(3);529 bit_depth_ = GET_PARAM(3);
546 mask_ = (1 << bit_depth_) - 1;530 mask_ = (1 << bit_depth_) - 1;
@@ -560,37 +544,26 @@ class FwdTrans8x8DCT · 13 unmodified lines
560 IdctFunc inv_txfm_;544 IdctFunc inv_txfm_;
561};545};
562 546
563TEST_P(FwdTrans8x8DCT, SignBiasCheck) {547TEST_P(FwdTrans8x8DCT, SignBiasCheck) { RunSignBiasCheck(); }
564 RunSignBiasCheck();
565}
566 548
567TEST_P(FwdTrans8x8DCT, RoundTripErrorCheck) {549TEST_P(FwdTrans8x8DCT, RoundTripErrorCheck) { RunRoundTripErrorCheck(); }
568 RunRoundTripErrorCheck();
569}
570 550
571TEST_P(FwdTrans8x8DCT, ExtremalCheck) {551TEST_P(FwdTrans8x8DCT, ExtremalCheck) { RunExtremalCheck(); }
572 RunExtremalCheck();
573}
574 552
575TEST_P(FwdTrans8x8DCT, FwdAccuracyCheck) {553TEST_P(FwdTrans8x8DCT, FwdAccuracyCheck) { RunFwdAccuracyCheck(); }
576 RunFwdAccuracyCheck();
577}
578 554
579TEST_P(FwdTrans8x8DCT, InvAccuracyCheck) {555TEST_P(FwdTrans8x8DCT, InvAccuracyCheck) { RunInvAccuracyCheck(); }
580 RunInvAccuracyCheck();
581}
582 556
583class FwdTrans8x8HT557class FwdTrans8x8HT : public FwdTrans8x8TestBase,
584 : public FwdTrans8x8TestBase,558 public ::testing::TestWithParam<Ht8x8Param> {
585 public ::testing::TestWithParam<Ht8x8Param> {
586 public:559 public:
587 virtual ~FwdTrans8x8HT() {}560 virtual ~FwdTrans8x8HT() {}
588 561
589 virtual void SetUp() {562 virtual void SetUp() {
590 fwd_txfm_ = GET_PARAM(0);563 fwd_txfm_ = GET_PARAM(0);
591 inv_txfm_ = GET_PARAM(1);564 inv_txfm_ = GET_PARAM(1);
592 tx_type_ = GET_PARAM(2);565 tx_type_ = GET_PARAM(2);
593 pitch_ = 8;566 pitch_ = 8;
594 fwd_txfm_ref = fht8x8_ref;567 fwd_txfm_ref = fht8x8_ref;
595 bit_depth_ = GET_PARAM(3);568 bit_depth_ = GET_PARAM(3);
596 mask_ = (1 << bit_depth_) - 1;569 mask_ = (1 << bit_depth_) - 1;
@@ -610,21 +583,14 @@ class FwdTrans8x8HT · 13 unmodified lines
610 IhtFunc inv_txfm_;583 IhtFunc inv_txfm_;
611};584};
612 585
613TEST_P(FwdTrans8x8HT, SignBiasCheck) {586TEST_P(FwdTrans8x8HT, SignBiasCheck) { RunSignBiasCheck(); }
614 RunSignBiasCheck();
615}
616 587
617TEST_P(FwdTrans8x8HT, RoundTripErrorCheck) {588TEST_P(FwdTrans8x8HT, RoundTripErrorCheck) { RunRoundTripErrorCheck(); }
618 RunRoundTripErrorCheck();
619}
620 589
621TEST_P(FwdTrans8x8HT, ExtremalCheck) {590TEST_P(FwdTrans8x8HT, ExtremalCheck) { RunExtremalCheck(); }
622 RunExtremalCheck();
623}
624 591
625class InvTrans8x8DCT592class InvTrans8x8DCT : public FwdTrans8x8TestBase,
626 : public FwdTrans8x8TestBase,593 public ::testing::TestWithParam<Idct8x8Param> {
627 public ::testing::TestWithParam<Idct8x8Param> {
628 public:594 public:
629 virtual ~InvTrans8x8DCT() {}595 virtual ~InvTrans8x8DCT() {}
630 596
@@ -664,10 +630,10 @@ INSTANTIATE_TEST_CASE_P( · 33 unmodified lines
664 make_tuple(&vpx_highbd_fdct8x8_c, &idct8x8_10, 0, VPX_BITS_10),630 make_tuple(&vpx_highbd_fdct8x8_c, &idct8x8_10, 0, VPX_BITS_10),
665 make_tuple(&vpx_highbd_fdct8x8_c, &idct8x8_12, 0, VPX_BITS_12)));631 make_tuple(&vpx_highbd_fdct8x8_c, &idct8x8_12, 0, VPX_BITS_12)));
666#else632#else
667INSTANTIATE_TEST_CASE_P(633INSTANTIATE_TEST_CASE_P(C, FwdTrans8x8DCT,
668 C, FwdTrans8x8DCT,634 ::testing::Values(make_tuple(&vpx_fdct8x8_c,
669 ::testing::Values(635 &vpx_idct8x8_64_add_c, 0,
670 make_tuple(&vpx_fdct8x8_c, &vpx_idct8x8_64_add_c, 0, VPX_BITS_8)));636 VPX_BITS_8)));
671#endif // CONFIG_VP9_HIGHBITDEPTH637#endif // CONFIG_VP9_HIGHBITDEPTH
672 638
673#if CONFIG_VP9_HIGHBITDEPTH639#if CONFIG_VP9_HIGHBITDEPTH
@@ -697,11 +663,10 @@ INSTANTIATE_TEST_CASE_P( · 23 unmodified lines
697#endif // CONFIG_VP9_HIGHBITDEPTH663#endif // CONFIG_VP9_HIGHBITDEPTH
698 664
699#if HAVE_NEON_ASM && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE665#if HAVE_NEON_ASM && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
700INSTANTIATE_TEST_CASE_P(666INSTANTIATE_TEST_CASE_P(NEON, FwdTrans8x8DCT,
701 NEON, FwdTrans8x8DCT,667 ::testing::Values(make_tuple(&vpx_fdct8x8_neon,
702 ::testing::Values(668 &vpx_idct8x8_64_add_neon,
703 make_tuple(&vpx_fdct8x8_neon, &vpx_idct8x8_64_add_neon, 0,669 0, VPX_BITS_8)));
704 VPX_BITS_8)));
705#endif // HAVE_NEON_ASM && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE670#endif // HAVE_NEON_ASM && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
706 671
707#if HAVE_NEON && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE672#if HAVE_NEON && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
@@ -715,11 +680,10 @@ INSTANTIATE_TEST_CASE_P( · 7 unmodified lines
715#endif // HAVE_NEON && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE680#endif // HAVE_NEON && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
716 681
717#if HAVE_SSE2 && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE682#if HAVE_SSE2 && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
718INSTANTIATE_TEST_CASE_P(683INSTANTIATE_TEST_CASE_P(SSE2, FwdTrans8x8DCT,
719 SSE2, FwdTrans8x8DCT,684 ::testing::Values(make_tuple(&vpx_fdct8x8_sse2,
720 ::testing::Values(685 &vpx_idct8x8_64_add_sse2,
721 make_tuple(&vpx_fdct8x8_sse2, &vpx_idct8x8_64_add_sse2, 0,686 0, VPX_BITS_8)));
722 VPX_BITS_8)));
723INSTANTIATE_TEST_CASE_P(687INSTANTIATE_TEST_CASE_P(
724 SSE2, FwdTrans8x8HT,688 SSE2, FwdTrans8x8HT,
725 ::testing::Values(689 ::testing::Values(
@@ -732,16 +696,16 @@ INSTANTIATE_TEST_CASE_P( · 6 unmodified lines
732#if HAVE_SSE2 && CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE696#if HAVE_SSE2 && CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
733INSTANTIATE_TEST_CASE_P(697INSTANTIATE_TEST_CASE_P(
734 SSE2, FwdTrans8x8DCT,698 SSE2, FwdTrans8x8DCT,
735 ::testing::Values(699 ::testing::Values(make_tuple(&vpx_fdct8x8_sse2, &vpx_idct8x8_64_add_c, 0,
736 make_tuple(&vpx_fdct8x8_sse2, &vpx_idct8x8_64_add_c, 0, VPX_BITS_8),700 VPX_BITS_8),
737 make_tuple(&vpx_highbd_fdct8x8_c,701 make_tuple(&vpx_highbd_fdct8x8_c, &idct8x8_64_add_10_sse2,
738 &idct8x8_64_add_10_sse2, 12, VPX_BITS_10),702 12, VPX_BITS_10),
739 make_tuple(&vpx_highbd_fdct8x8_sse2,703 make_tuple(&vpx_highbd_fdct8x8_sse2,
740 &idct8x8_64_add_10_sse2, 12, VPX_BITS_10),704 &idct8x8_64_add_10_sse2, 12, VPX_BITS_10),
741 make_tuple(&vpx_highbd_fdct8x8_c,705 make_tuple(&vpx_highbd_fdct8x8_c, &idct8x8_64_add_12_sse2,
742 &idct8x8_64_add_12_sse2, 12, VPX_BITS_12),706 12, VPX_BITS_12),
743 make_tuple(&vpx_highbd_fdct8x8_sse2,707 make_tuple(&vpx_highbd_fdct8x8_sse2,
744 &idct8x8_64_add_12_sse2, 12, VPX_BITS_12)));708 &idct8x8_64_add_12_sse2, 12, VPX_BITS_12)));
745 709
746INSTANTIATE_TEST_CASE_P(710INSTANTIATE_TEST_CASE_P(
747 SSE2, FwdTrans8x8HT,711 SSE2, FwdTrans8x8HT,
@@ -756,30 +720,27 @@ INSTANTIATE_TEST_CASE_P( · 8 unmodified lines
756INSTANTIATE_TEST_CASE_P(720INSTANTIATE_TEST_CASE_P(
757 SSE2, InvTrans8x8DCT,721 SSE2, InvTrans8x8DCT,
758 ::testing::Values(722 ::testing::Values(
759 make_tuple(&idct8x8_10_add_10_c,723 make_tuple(&idct8x8_10_add_10_c, &idct8x8_10_add_10_sse2, 6225,
760 &idct8x8_10_add_10_sse2, 6225, VPX_BITS_10),724 VPX_BITS_10),
761 make_tuple(&idct8x8_10,725 make_tuple(&idct8x8_10, &idct8x8_64_add_10_sse2, 6225, VPX_BITS_10),
762 &idct8x8_64_add_10_sse2, 6225, VPX_BITS_10),726 make_tuple(&idct8x8_10_add_12_c, &idct8x8_10_add_12_sse2, 6225,
763 make_tuple(&idct8x8_10_add_12_c,727 VPX_BITS_12),
764 &idct8x8_10_add_12_sse2, 6225, VPX_BITS_12),728 make_tuple(&idct8x8_12, &idct8x8_64_add_12_sse2, 6225, VPX_BITS_12)));
765 make_tuple(&idct8x8_12,
766 &idct8x8_64_add_12_sse2, 6225, VPX_BITS_12)));
767#endif // HAVE_SSE2 && CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE729#endif // HAVE_SSE2 && CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
768 730
769#if HAVE_SSSE3 && ARCH_X86_64 && \731#if HAVE_SSSE3 && ARCH_X86_64 && !CONFIG_VP9_HIGHBITDEPTH && \
770 !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE732 !CONFIG_EMULATE_HARDWARE
771INSTANTIATE_TEST_CASE_P(733INSTANTIATE_TEST_CASE_P(SSSE3, FwdTrans8x8DCT,
772 SSSE3, FwdTrans8x8DCT,734 ::testing::Values(make_tuple(&vpx_fdct8x8_ssse3,
773 ::testing::Values(735 &vpx_idct8x8_64_add_ssse3,
774 make_tuple(&vpx_fdct8x8_ssse3, &vpx_idct8x8_64_add_ssse3, 0,736 0, VPX_BITS_8)));
775 VPX_BITS_8)));
776#endif737#endif
777 738
778#if HAVE_MSA && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE739#if HAVE_MSA && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
779INSTANTIATE_TEST_CASE_P(740INSTANTIATE_TEST_CASE_P(MSA, FwdTrans8x8DCT,
780 MSA, FwdTrans8x8DCT,741 ::testing::Values(make_tuple(&vpx_fdct8x8_msa,
781 ::testing::Values(742 &vpx_idct8x8_64_add_msa, 0,
782 make_tuple(&vpx_fdct8x8_msa, &vpx_idct8x8_64_add_msa, 0, VPX_BITS_8)));743 VPX_BITS_8)));
783INSTANTIATE_TEST_CASE_P(744INSTANTIATE_TEST_CASE_P(
784 MSA, FwdTrans8x8HT,745 MSA, FwdTrans8x8HT,
785 ::testing::Values(746 ::testing::Values(
test/frame_size_tests.cc+12−13
@@ -13,12 +13,11 @@ · 12 unmodified lines
13 13
14namespace {14namespace {
15 15
16class VP9FrameSizeTestsLarge16class VP9FrameSizeTestsLarge : public ::libvpx_test::EncoderTest,
17 : public ::libvpx_test::EncoderTest,17 public ::testing::Test {
18 public ::testing::Test {
19 protected:18 protected:
20 VP9FrameSizeTestsLarge() : EncoderTest(&::libvpx_test::kVP9),19 VP9FrameSizeTestsLarge()
21 expected_res_(VPX_CODEC_OK) {}20 : EncoderTest(&::libvpx_test::kVP9), expected_res_(VPX_CODEC_OK) {}
22 virtual ~VP9FrameSizeTestsLarge() {}21 virtual ~VP9FrameSizeTestsLarge() {}
23 22
24 virtual void SetUp() {23 virtual void SetUp() {
@@ -27,7 +26,7 @@ class VP9FrameSizeTestsLarge · 2 unmodified lines
27 }26 }
28 27
29 virtual bool HandleDecodeResult(const vpx_codec_err_t res_dec,28 virtual bool HandleDecodeResult(const vpx_codec_err_t res_dec,
30 const libvpx_test::VideoSource& /*video*/,29 const libvpx_test::VideoSource & /*video*/,
31 libvpx_test::Decoder *decoder) {30 libvpx_test::Decoder *decoder) {
32 EXPECT_EQ(expected_res_, res_dec) << decoder->DecodeError();31 EXPECT_EQ(expected_res_, res_dec) << decoder->DecodeError();
33 return !::testing::Test::HasFailure();32 return !::testing::Test::HasFailure();
@@ -67,13 +66,13 @@ TEST_F(VP9FrameSizeTestsLarge, ValidSizes) { · 33 unmodified lines
67 expected_res_ = VPX_CODEC_OK;66 expected_res_ = VPX_CODEC_OK;
68 ASSERT_NO_FATAL_FAILURE(RunLoop(&video));67 ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
69#else68#else
70 // This test produces a pretty large single frame allocation, (roughly69// This test produces a pretty large single frame allocation, (roughly
71 // 25 megabits). The encoder allocates a good number of these frames70// 25 megabits). The encoder allocates a good number of these frames
72 // one for each lag in frames (for 2 pass), and then one for each possible71// one for each lag in frames (for 2 pass), and then one for each possible
73 // reference buffer (8) - we can end up with up to 30 buffers of roughly this72// reference buffer (8) - we can end up with up to 30 buffers of roughly this
74 // size or almost 1 gig of memory.73// size or almost 1 gig of memory.
75 // In total the allocations will exceed 2GiB which may cause a failure with74// In total the allocations will exceed 2GiB which may cause a failure with
76 // mingw + wine, use a smaller size in that case.75// mingw + wine, use a smaller size in that case.
77#if defined(_WIN32) && !defined(_WIN64) || defined(__OS2__)76#if defined(_WIN32) && !defined(_WIN64) || defined(__OS2__)
78 video.SetSize(4096, 3072);77 video.SetSize(4096, 3072);
79#else78#else
test/hadamard_test.cc+2−2
@@ -80,8 +80,8 @@ void reference_hadamard16x16(const int16_t *a, int a_stride, int16_t *b) { · 79 unmodified lines
80 const int16_t b3 = (a2 - a3) >> 1;80 const int16_t b3 = (a2 - a3) >> 1;
81 81
82 /* Store a 16 bit value. */82 /* Store a 16 bit value. */
83 b[ 0] = b0 + b2;83 b[0] = b0 + b2;
84 b[ 64] = b1 + b3;84 b[64] = b1 + b3;
85 b[128] = b0 - b2;85 b[128] = b0 - b2;
86 b[192] = b1 - b3;86 b[192] = b1 - b3;
87 87
test/i420_video_source.h+4−7
@@ -21,14 +21,11 @@ namespace libvpx_test { · 20 unmodified lines
21// so that we can do actual file encodes.21// so that we can do actual file encodes.
22class I420VideoSource : public YUVVideoSource {22class I420VideoSource : public YUVVideoSource {
23 public:23 public:
24 I420VideoSource(const std::string &file_name,24 I420VideoSource(const std::string &file_name, unsigned int width,
25 unsigned int width, unsigned int height,25 unsigned int height, int rate_numerator, int rate_denominator,
26 int rate_numerator, int rate_denominator,
27 unsigned int start, int limit)26 unsigned int start, int limit)
28 : YUVVideoSource(file_name, VPX_IMG_FMT_I420,27 : YUVVideoSource(file_name, VPX_IMG_FMT_I420, width, height,
29 width, height,28 rate_numerator, rate_denominator, start, limit) {}
30 rate_numerator, rate_denominator,
31 start, limit) {}
32};29};
33 30
34} // namespace libvpx_test31} // namespace libvpx_test
test/idct8x8_test.cc+10−18
@@ -29,9 +29,8 @@ void reference_dct_1d(double input[8], double output[8]) { · 28 unmodified lines
29 for (int k = 0; k < 8; k++) {29 for (int k = 0; k < 8; k++) {
30 output[k] = 0.0;30 output[k] = 0.0;
31 for (int n = 0; n < 8; n++)31 for (int n = 0; n < 8; n++)
32 output[k] += input[n]*cos(kPi*(2*n+1)*k/16.0);32 output[k] += input[n] * cos(kPi * (2 * n + 1) * k / 16.0);
33 if (k == 0)33 if (k == 0) output[k] = output[k] * kInvSqrt2;
34 output[k] = output[k]*kInvSqrt2;
35 }34 }
36}35}
37 36
@@ -39,24 +38,19 @@ void reference_dct_2d(int16_t input[64], double output[64]) { · 1 unmodified line
39 // First transform columns38 // First transform columns
40 for (int i = 0; i < 8; ++i) {39 for (int i = 0; i < 8; ++i) {
41 double temp_in[8], temp_out[8];40 double temp_in[8], temp_out[8];
42 for (int j = 0; j < 8; ++j)41 for (int j = 0; j < 8; ++j) temp_in[j] = input[j * 8 + i];
43 temp_in[j] = input[j*8 + i];
44 reference_dct_1d(temp_in, temp_out);42 reference_dct_1d(temp_in, temp_out);
45 for (int j = 0; j < 8; ++j)43 for (int j = 0; j < 8; ++j) output[j * 8 + i] = temp_out[j];
46 output[j*8 + i] = temp_out[j];
47 }44 }
48 // Then transform rows45 // Then transform rows
49 for (int i = 0; i < 8; ++i) {46 for (int i = 0; i < 8; ++i) {
50 double temp_in[8], temp_out[8];47 double temp_in[8], temp_out[8];
51 for (int j = 0; j < 8; ++j)48 for (int j = 0; j < 8; ++j) temp_in[j] = output[j + i * 8];
52 temp_in[j] = output[j + i*8];
53 reference_dct_1d(temp_in, temp_out);49 reference_dct_1d(temp_in, temp_out);
54 for (int j = 0; j < 8; ++j)50 for (int j = 0; j < 8; ++j) output[j + i * 8] = temp_out[j];
55 output[j + i*8] = temp_out[j];
56 }51 }
57 // Scale by some magic number52 // Scale by some magic number
58 for (int i = 0; i < 64; ++i)53 for (int i = 0; i < 64; ++i) output[i] *= 2;
59 output[i] *= 2;
60}54}
61 55
62TEST(VP9Idct8x8Test, AccuracyCheck) {56TEST(VP9Idct8x8Test, AccuracyCheck) {
@@ -73,8 +67,7 @@ TEST(VP9Idct8x8Test, AccuracyCheck) { · 10 unmodified lines
73 dst[j] = rnd.Rand8();67 dst[j] = rnd.Rand8();
74 }68 }
75 // Initialize a test block with input range [-255, 255].69 // Initialize a test block with input range [-255, 255].
76 for (int j = 0; j < 64; ++j)70 for (int j = 0; j < 64; ++j) input[j] = src[j] - dst[j];
77 input[j] = src[j] - dst[j];
78 71
79 reference_dct_2d(input, output_r);72 reference_dct_2d(input, output_r);
80 for (int j = 0; j < 64; ++j)73 for (int j = 0; j < 64; ++j)
@@ -83,9 +76,8 @@ TEST(VP9Idct8x8Test, AccuracyCheck) { · 2 unmodified lines
83 for (int j = 0; j < 64; ++j) {76 for (int j = 0; j < 64; ++j) {
84 const int diff = dst[j] - src[j];77 const int diff = dst[j] - src[j];
85 const int error = diff * diff;78 const int error = diff * diff;
86 EXPECT_GE(1, error)79 EXPECT_GE(1, error) << "Error: 8x8 FDCT/IDCT has error " << error
87 << "Error: 8x8 FDCT/IDCT has error " << error80 << " at index " << j;
88 << " at index " << j;
89 }81 }
90 }82 }
91}83}
test/invalid_file_test.cc+32−35
@@ -34,21 +34,19 @@ std::ostream &operator<<(std::ostream &os, const DecodeParam &dp) { · 33 unmodified lines
34 return os << "threads: " << dp.threads << " file: " << dp.filename;34 return os << "threads: " << dp.threads << " file: " << dp.filename;
35}35}
36 36
37class InvalidFileTest37class InvalidFileTest : public ::libvpx_test::DecoderTest,
38 : public ::libvpx_test::DecoderTest,38 public ::libvpx_test::CodecTestWithParam<DecodeParam> {
39 public ::libvpx_test::CodecTestWithParam<DecodeParam> {
40 protected:39 protected:
41 InvalidFileTest() : DecoderTest(GET_PARAM(0)), res_file_(NULL) {}40 InvalidFileTest() : DecoderTest(GET_PARAM(0)), res_file_(NULL) {}
42 41
43 virtual ~InvalidFileTest() {42 virtual ~InvalidFileTest() {
44 if (res_file_ != NULL)43 if (res_file_ != NULL) fclose(res_file_);
45 fclose(res_file_);
46 }44 }
47 45
48 void OpenResFile(const std::string &res_file_name_) {46 void OpenResFile(const std::string &res_file_name_) {
49 res_file_ = libvpx_test::OpenTestDataFile(res_file_name_);47 res_file_ = libvpx_test::OpenTestDataFile(res_file_name_);
50 ASSERT_TRUE(res_file_ != NULL) << "Result file open failed. Filename: "48 ASSERT_TRUE(res_file_ != NULL) << "Result file open failed. Filename: "
51 << res_file_name_;49 << res_file_name_;
52 }50 }
53 51
54 virtual bool HandleDecodeResult(52 virtual bool HandleDecodeResult(
@@ -72,8 +70,9 @@ class InvalidFileTest · 17 unmodified lines
72 EXPECT_TRUE(res_dec == expected_res_dec ||70 EXPECT_TRUE(res_dec == expected_res_dec ||
73 res_dec == VPX_CODEC_CORRUPT_FRAME)71 res_dec == VPX_CODEC_CORRUPT_FRAME)
74 << "Results don't match: frame number = " << video.frame_number()72 << "Results don't match: frame number = " << video.frame_number()
75 << ". (" << decoder->DecodeError() << "). Expected: "73 << ". (" << decoder->DecodeError()
76 << expected_res_dec << " or " << VPX_CODEC_CORRUPT_FRAME;74 << "). Expected: " << expected_res_dec << " or "
75 << VPX_CODEC_CORRUPT_FRAME;
77 } else {76 } else {
78 EXPECT_EQ(expected_res_dec, res_dec)77 EXPECT_EQ(expected_res_dec, res_dec)
79 << "Results don't match: frame number = " << video.frame_number()78 << "Results don't match: frame number = " << video.frame_number()
@@ -119,25 +118,23 @@ class InvalidFileTest · 39 unmodified lines
119 FILE *res_file_;118 FILE *res_file_;
120};119};
121 120
122TEST_P(InvalidFileTest, ReturnCode) {121TEST_P(InvalidFileTest, ReturnCode) { RunTest(); }
123 RunTest();
124}
125 122
126const DecodeParam kVP9InvalidFileTests[] = {123const DecodeParam kVP9InvalidFileTests[] = {
127 {1, "invalid-vp90-02-v2.webm"},124 { 1, "invalid-vp90-02-v2.webm" },
128#if CONFIG_VP9_HIGHBITDEPTH125#if CONFIG_VP9_HIGHBITDEPTH
129 {1, "invalid-vp90-2-00-quantizer-00.webm.ivf.s5861_r01-05_b6-.v2.ivf"},126 { 1, "invalid-vp90-2-00-quantizer-00.webm.ivf.s5861_r01-05_b6-.v2.ivf" },
130#endif127#endif
131 {1, "invalid-vp90-03-v3.webm"},128 { 1, "invalid-vp90-03-v3.webm" },
132 {1, "invalid-vp90-2-00-quantizer-11.webm.ivf.s52984_r01-05_b6-.ivf"},129 { 1, "invalid-vp90-2-00-quantizer-11.webm.ivf.s52984_r01-05_b6-.ivf" },
133 {1, "invalid-vp90-2-00-quantizer-11.webm.ivf.s52984_r01-05_b6-z.ivf"},130 { 1, "invalid-vp90-2-00-quantizer-11.webm.ivf.s52984_r01-05_b6-z.ivf" },
134 {1, "invalid-vp90-2-12-droppable_1.ivf.s3676_r01-05_b6-.ivf"},131 { 1, "invalid-vp90-2-12-droppable_1.ivf.s3676_r01-05_b6-.ivf" },
135 {1, "invalid-vp90-2-05-resize.ivf.s59293_r01-05_b6-.ivf"},132 { 1, "invalid-vp90-2-05-resize.ivf.s59293_r01-05_b6-.ivf" },
136 {1, "invalid-vp90-2-09-subpixel-00.ivf.s20492_r01-05_b6-.v2.ivf"},133 { 1, "invalid-vp90-2-09-subpixel-00.ivf.s20492_r01-05_b6-.v2.ivf" },
137 {1, "invalid-vp91-2-mixedrefcsp-444to420.ivf"},134 { 1, "invalid-vp91-2-mixedrefcsp-444to420.ivf" },
138 {1, "invalid-vp90-2-12-droppable_1.ivf.s73804_r01-05_b6-.ivf"},135 { 1, "invalid-vp90-2-12-droppable_1.ivf.s73804_r01-05_b6-.ivf" },
139 {1, "invalid-vp90-2-03-size-224x196.webm.ivf.s44156_r01-05_b6-.ivf"},136 { 1, "invalid-vp90-2-03-size-224x196.webm.ivf.s44156_r01-05_b6-.ivf" },
140 {1, "invalid-vp90-2-03-size-202x210.webm.ivf.s113306_r01-05_b6-.ivf"},137 { 1, "invalid-vp90-2-03-size-202x210.webm.ivf.s113306_r01-05_b6-.ivf" },
141};138};
142 139
143VP9_INSTANTIATE_TEST_CASE(InvalidFileTest,140VP9_INSTANTIATE_TEST_CASE(InvalidFileTest,
@@ -149,34 +146,34 @@ class InvalidFileInvalidPeekTest : public InvalidFileTest { · 5 unmodified lines
149 protected:146 protected:
150 InvalidFileInvalidPeekTest() : InvalidFileTest() {}147 InvalidFileInvalidPeekTest() : InvalidFileTest() {}
151 virtual void HandlePeekResult(libvpx_test::Decoder *const /*decoder*/,148 virtual void HandlePeekResult(libvpx_test::Decoder *const /*decoder*/,
152 libvpx_test::CompressedVideoSource* /*video*/,149 libvpx_test::CompressedVideoSource * /*video*/,
153 const vpx_codec_err_t /*res_peek*/) {}150 const vpx_codec_err_t /*res_peek*/) {}
154};151};
155 152
156TEST_P(InvalidFileInvalidPeekTest, ReturnCode) {153TEST_P(InvalidFileInvalidPeekTest, ReturnCode) { RunTest(); }
157 RunTest();
158}
159 154
160const DecodeParam kVP9InvalidFileInvalidPeekTests[] = {155const DecodeParam kVP9InvalidFileInvalidPeekTests[] = {
161 {1, "invalid-vp90-01-v3.webm"},156 { 1, "invalid-vp90-01-v3.webm" },
162};157};
163 158
164VP9_INSTANTIATE_TEST_CASE(InvalidFileInvalidPeekTest,159VP9_INSTANTIATE_TEST_CASE(InvalidFileInvalidPeekTest,
165 ::testing::ValuesIn(kVP9InvalidFileInvalidPeekTests));160 ::testing::ValuesIn(kVP9InvalidFileInvalidPeekTests));
166 161
167const DecodeParam kMultiThreadedVP9InvalidFileTests[] = {162const DecodeParam kMultiThreadedVP9InvalidFileTests[] = {
168 {4, "invalid-vp90-2-08-tile_1x4_frame_parallel_all_key.webm"},163 { 4, "invalid-vp90-2-08-tile_1x4_frame_parallel_all_key.webm" },
169 {4, "invalid-"164 { 4,
170 "vp90-2-08-tile_1x2_frame_parallel.webm.ivf.s47039_r01-05_b6-.ivf"},165 "invalid-"
171 {4, "invalid-vp90-2-08-tile_1x8_frame_parallel.webm.ivf.s288_r01-05_b6-.ivf"},166 "vp90-2-08-tile_1x2_frame_parallel.webm.ivf.s47039_r01-05_b6-.ivf" },
172 {2, "invalid-vp90-2-09-aq2.webm.ivf.s3984_r01-05_b6-.v2.ivf"},167 { 4,
173 {4, "invalid-vp90-2-09-subpixel-00.ivf.s19552_r01-05_b6-.v2.ivf"},168 "invalid-vp90-2-08-tile_1x8_frame_parallel.webm.ivf.s288_r01-05_b6-.ivf" },
169 { 2, "invalid-vp90-2-09-aq2.webm.ivf.s3984_r01-05_b6-.v2.ivf" },
170 { 4, "invalid-vp90-2-09-subpixel-00.ivf.s19552_r01-05_b6-.v2.ivf" },
174};171};
175 172
176INSTANTIATE_TEST_CASE_P(173INSTANTIATE_TEST_CASE_P(
177 VP9MultiThreaded, InvalidFileTest,174 VP9MultiThreaded, InvalidFileTest,
178 ::testing::Combine(175 ::testing::Combine(
179 ::testing::Values(176 ::testing::Values(
180 static_cast<const libvpx_test::CodecFactory*>(&libvpx_test::kVP9)),177 static_cast<const libvpx_test::CodecFactory *>(&libvpx_test::kVP9)),
181 ::testing::ValuesIn(kMultiThreadedVP9InvalidFileTests)));178 ::testing::ValuesIn(kMultiThreadedVP9InvalidFileTests)));
182} // namespace179} // namespace
test/ivf_video_source.h+9−14
@@ -29,19 +29,13 @@ static unsigned int MemGetLe32(const uint8_t *mem) { · 28 unmodified lines
29class IVFVideoSource : public CompressedVideoSource {29class IVFVideoSource : public CompressedVideoSource {
30 public:30 public:
31 explicit IVFVideoSource(const std::string &file_name)31 explicit IVFVideoSource(const std::string &file_name)
32 : file_name_(file_name),32 : file_name_(file_name), input_file_(NULL), compressed_frame_buf_(NULL),
33 input_file_(NULL),33 frame_sz_(0), frame_(0), end_of_file_(false) {}
34 compressed_frame_buf_(NULL),
35 frame_sz_(0),
36 frame_(0),
37 end_of_file_(false) {
38 }
39 34
40 virtual ~IVFVideoSource() {35 virtual ~IVFVideoSource() {
41 delete[] compressed_frame_buf_;36 delete[] compressed_frame_buf_;
42 37
43 if (input_file_)38 if (input_file_) fclose(input_file_);
44 fclose(input_file_);
45 }39 }
46 40
47 virtual void Init() {41 virtual void Init() {
@@ -54,15 +48,16 @@ class IVFVideoSource : public CompressedVideoSource { · 6 unmodified lines
54 virtual void Begin() {48 virtual void Begin() {
55 input_file_ = OpenTestDataFile(file_name_);49 input_file_ = OpenTestDataFile(file_name_);
56 ASSERT_TRUE(input_file_ != NULL) << "Input file open failed. Filename: "50 ASSERT_TRUE(input_file_ != NULL) << "Input file open failed. Filename: "
57 << file_name_;51 << file_name_;
58 52
59 // Read file header53 // Read file header
60 uint8_t file_hdr[kIvfFileHdrSize];54 uint8_t file_hdr[kIvfFileHdrSize];
61 ASSERT_EQ(kIvfFileHdrSize, fread(file_hdr, 1, kIvfFileHdrSize, input_file_))55 ASSERT_EQ(kIvfFileHdrSize, fread(file_hdr, 1, kIvfFileHdrSize, input_file_))
62 << "File header read failed.";56 << "File header read failed.";
63 // Check file header57 // Check file header
64 ASSERT_TRUE(file_hdr[0] == 'D' && file_hdr[1] == 'K' && file_hdr[2] == 'I'58 ASSERT_TRUE(file_hdr[0] == 'D' && file_hdr[1] == 'K' &&
65 && file_hdr[3] == 'F') << "Input is not an IVF file.";59 file_hdr[2] == 'I' && file_hdr[3] == 'F')
60 << "Input is not an IVF file.";
66 61
67 FillFrame();62 FillFrame();
68 }63 }
@@ -76,8 +71,8 @@ class IVFVideoSource : public CompressedVideoSource { · 7 unmodified lines
76 ASSERT_TRUE(input_file_ != NULL);71 ASSERT_TRUE(input_file_ != NULL);
77 uint8_t frame_hdr[kIvfFrameHdrSize];72 uint8_t frame_hdr[kIvfFrameHdrSize];
78 // Check frame header and read a frame from input_file.73 // Check frame header and read a frame from input_file.
79 if (fread(frame_hdr, 1, kIvfFrameHdrSize, input_file_)74 if (fread(frame_hdr, 1, kIvfFrameHdrSize, input_file_) !=
80 != kIvfFrameHdrSize) {75 kIvfFrameHdrSize) {
81 end_of_file_ = true;76 end_of_file_ = true;
82 } else {77 } else {
83 end_of_file_ = false;78 end_of_file_ = false;
test/keyframe_test.cc+6−7
@@ -17,8 +17,9 @@ · 16 unmodified lines
17 17
18namespace {18namespace {
19 19
20class KeyframeTest : public ::libvpx_test::EncoderTest,20class KeyframeTest
21 public ::libvpx_test::CodecTestWithParam<libvpx_test::TestMode> {21 : public ::libvpx_test::EncoderTest,
22 public ::libvpx_test::CodecTestWithParam<libvpx_test::TestMode> {
22 protected:23 protected:
23 KeyframeTest() : EncoderTest(GET_PARAM(0)) {}24 KeyframeTest() : EncoderTest(GET_PARAM(0)) {}
24 virtual ~KeyframeTest() {}25 virtual ~KeyframeTest() {}
@@ -65,8 +66,7 @@ TEST_P(KeyframeTest, TestRandomVideoSource) { · 40 unmodified lines
65 66
66 // In realtime mode - auto placed keyframes are exceedingly rare, don't67 // In realtime mode - auto placed keyframes are exceedingly rare, don't
67 // bother with this check if(GetParam() > 0)68 // bother with this check if(GetParam() > 0)
68 if (GET_PARAM(1) > 0)69 if (GET_PARAM(1) > 0) EXPECT_GT(kf_count_, 1);
69 EXPECT_GT(kf_count_, 1);
70}70}
71 71
72TEST_P(KeyframeTest, TestDisableKeyframes) {72TEST_P(KeyframeTest, TestDisableKeyframes) {
@@ -114,8 +114,7 @@ TEST_P(KeyframeTest, TestAutoKeyframe) { · 41 unmodified lines
114 // may not produce a keyframe like we expect. This is necessary when running114 // may not produce a keyframe like we expect. This is necessary when running
115 // on very slow environments (like Valgrind). The step -11 was determined115 // on very slow environments (like Valgrind). The step -11 was determined
116 // experimentally as the fastest mode that still throws the keyframe.116 // experimentally as the fastest mode that still throws the keyframe.
117 if (deadline_ == VPX_DL_REALTIME)117 if (deadline_ == VPX_DL_REALTIME) set_cpu_used_ = -11;
118 set_cpu_used_ = -11;
119 118
120 // This clip has a cut scene every 30 frames -> Frame 0, 30, 60, 90, 120.119 // This clip has a cut scene every 30 frames -> Frame 0, 30, 60, 90, 120.
121 // I check only the first 40 frames to make sure there's a keyframe at frame120 // I check only the first 40 frames to make sure there's a keyframe at frame
@@ -135,7 +134,7 @@ TEST_P(KeyframeTest, TestAutoKeyframe) { · 13 unmodified lines
135 iter != kf_pts_list_.end(); ++iter) {134 iter != kf_pts_list_.end(); ++iter) {
136 if (deadline_ == VPX_DL_REALTIME && *iter > 0)135 if (deadline_ == VPX_DL_REALTIME && *iter > 0)
137 EXPECT_EQ(0, (*iter - 1) % 30) << "Unexpected keyframe at frame "136 EXPECT_EQ(0, (*iter - 1) % 30) << "Unexpected keyframe at frame "
138 << *iter;137 << *iter;
139 else138 else
140 EXPECT_EQ(0, *iter % 30) << "Unexpected keyframe at frame " << *iter;139 EXPECT_EQ(0, *iter % 30) << "Unexpected keyframe at frame " << *iter;
141 }140 }
test/level_test.cc+3−6
@@ -19,12 +19,9 @@ class LevelTest · 18 unmodified lines
19 public ::libvpx_test::CodecTestWith2Params<libvpx_test::TestMode, int> {19 public ::libvpx_test::CodecTestWith2Params<libvpx_test::TestMode, int> {
20 protected:20 protected:
21 LevelTest()21 LevelTest()
22 : EncoderTest(GET_PARAM(0)),22 : EncoderTest(GET_PARAM(0)), encoding_mode_(GET_PARAM(1)),
23 encoding_mode_(GET_PARAM(1)),23 cpu_used_(GET_PARAM(2)), min_gf_internal_(24), target_level_(0),
24 cpu_used_(GET_PARAM(2)),24 level_(0) {}
25 min_gf_internal_(24),
26 target_level_(0),
27 level_(0) {}
28 virtual ~LevelTest() {}25 virtual ~LevelTest() {}
29 26
30 virtual void SetUp() {27 virtual void SetUp() {
test/lpf_8_test.cc+221−271
@@ -36,8 +36,7 @@ const int number_of_iterations = 10000; · 35 unmodified lines
36 36
37#if CONFIG_VP9_HIGHBITDEPTH37#if CONFIG_VP9_HIGHBITDEPTH
38typedef void (*loop_op_t)(uint16_t *s, int p, const uint8_t *blimit,38typedef void (*loop_op_t)(uint16_t *s, int p, const uint8_t *blimit,
39 const uint8_t *limit, const uint8_t *thresh,39 const uint8_t *limit, const uint8_t *thresh, int bd);
40 int bd);
41typedef void (*dual_loop_op_t)(uint16_t *s, int p, const uint8_t *blimit0,40typedef void (*dual_loop_op_t)(uint16_t *s, int p, const uint8_t *blimit0,
42 const uint8_t *limit0, const uint8_t *thresh0,41 const uint8_t *limit0, const uint8_t *thresh0,
43 const uint8_t *blimit1, const uint8_t *limit1,42 const uint8_t *blimit1, const uint8_t *limit1,
@@ -108,21 +107,18 @@ TEST_P(Loop8Test6Param, OperationCheck) { · 64 unmodified lines
108 for (int i = 0; i < count_test_block; ++i) {107 for (int i = 0; i < count_test_block; ++i) {
109 int err_count = 0;108 int err_count = 0;
110 uint8_t tmp = static_cast<uint8_t>(rnd(3 * MAX_LOOP_FILTER + 4));109 uint8_t tmp = static_cast<uint8_t>(rnd(3 * MAX_LOOP_FILTER + 4));
111 DECLARE_ALIGNED(16, const uint8_t, blimit[16]) = {110 DECLARE_ALIGNED(16, const uint8_t,
112 tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp,111 blimit[16]) = { tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp,
113 tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp112 tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp };
114 };
115 tmp = static_cast<uint8_t>(rnd(MAX_LOOP_FILTER));113 tmp = static_cast<uint8_t>(rnd(MAX_LOOP_FILTER));
116 DECLARE_ALIGNED(16, const uint8_t, limit[16]) = {114 DECLARE_ALIGNED(16, const uint8_t,
117 tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp,115 limit[16]) = { tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp,
118 tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp116 tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp };
119 };
120 tmp = rnd.Rand8();117 tmp = rnd.Rand8();
121 DECLARE_ALIGNED(16, const uint8_t, thresh[16]) = {118 DECLARE_ALIGNED(16, const uint8_t,
122 tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp,119 thresh[16]) = { tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp,
123 tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp120 tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp };
124 };121 int32_t p = kNumCoeffs / 32;
125 int32_t p = kNumCoeffs/32;
126 122
127 uint16_t tmp_s[kNumCoeffs];123 uint16_t tmp_s[kNumCoeffs];
128 int j = 0;124 int j = 0;
@@ -158,7 +154,7 @@ TEST_P(Loop8Test6Param, OperationCheck) { · 29 unmodified lines
158 ASM_REGISTER_STATE_CHECK(154 ASM_REGISTER_STATE_CHECK(
159 loopfilter_op_(s + 8 + p * 8, p, blimit, limit, thresh, bd));155 loopfilter_op_(s + 8 + p * 8, p, blimit, limit, thresh, bd));
160#else156#else
161 ref_loopfilter_op_(ref_s+8+p*8, p, blimit, limit, thresh);157 ref_loopfilter_op_(ref_s + 8 + p * 8, p, blimit, limit, thresh);
162 ASM_REGISTER_STATE_CHECK(158 ASM_REGISTER_STATE_CHECK(
163 loopfilter_op_(s + 8 + p * 8, p, blimit, limit, thresh));159 loopfilter_op_(s + 8 + p * 8, p, blimit, limit, thresh));
164#endif // CONFIG_VP9_HIGHBITDEPTH160#endif // CONFIG_VP9_HIGHBITDEPTH
@@ -206,20 +202,17 @@ TEST_P(Loop8Test6Param, ValueCheck) { · 41 unmodified lines
206 for (int i = 0; i < count_test_block; ++i) {202 for (int i = 0; i < count_test_block; ++i) {
207 int err_count = 0;203 int err_count = 0;
208 uint8_t tmp = static_cast<uint8_t>(rnd(3 * MAX_LOOP_FILTER + 4));204 uint8_t tmp = static_cast<uint8_t>(rnd(3 * MAX_LOOP_FILTER + 4));
209 DECLARE_ALIGNED(16, const uint8_t, blimit[16]) = {205 DECLARE_ALIGNED(16, const uint8_t,
210 tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp,206 blimit[16]) = { tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp,
211 tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp207 tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp };
212 };
213 tmp = static_cast<uint8_t>(rnd(MAX_LOOP_FILTER));208 tmp = static_cast<uint8_t>(rnd(MAX_LOOP_FILTER));
214 DECLARE_ALIGNED(16, const uint8_t, limit[16]) = {209 DECLARE_ALIGNED(16, const uint8_t,
215 tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp,210 limit[16]) = { tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp,
216 tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp211 tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp };
217 };
218 tmp = rnd.Rand8();212 tmp = rnd.Rand8();
219 DECLARE_ALIGNED(16, const uint8_t, thresh[16]) = {213 DECLARE_ALIGNED(16, const uint8_t,
220 tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp,214 thresh[16]) = { tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp,
221 tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp215 tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp };
222 };
223 int32_t p = kNumCoeffs / 32;216 int32_t p = kNumCoeffs / 32;
224 for (int j = 0; j < kNumCoeffs; ++j) {217 for (int j = 0; j < kNumCoeffs; ++j) {
225 s[j] = rnd.Rand16() & mask_;218 s[j] = rnd.Rand16() & mask_;
@@ -230,7 +223,7 @@ TEST_P(Loop8Test6Param, ValueCheck) { · 4 unmodified lines
230 ASM_REGISTER_STATE_CHECK(223 ASM_REGISTER_STATE_CHECK(
231 loopfilter_op_(s + 8 + p * 8, p, blimit, limit, thresh, bd));224 loopfilter_op_(s + 8 + p * 8, p, blimit, limit, thresh, bd));
232#else225#else
233 ref_loopfilter_op_(ref_s+8+p*8, p, blimit, limit, thresh);226 ref_loopfilter_op_(ref_s + 8 + p * 8, p, blimit, limit, thresh);
234 ASM_REGISTER_STATE_CHECK(227 ASM_REGISTER_STATE_CHECK(
235 loopfilter_op_(s + 8 + p * 8, p, blimit, limit, thresh));228 loopfilter_op_(s + 8 + p * 8, p, blimit, limit, thresh));
236#endif // CONFIG_VP9_HIGHBITDEPTH229#endif // CONFIG_VP9_HIGHBITDEPTH
@@ -256,43 +249,37 @@ TEST_P(Loop8Test9Param, OperationCheck) { · 19 unmodified lines
256 DECLARE_ALIGNED(16, uint16_t, s[kNumCoeffs]);249 DECLARE_ALIGNED(16, uint16_t, s[kNumCoeffs]);
257 DECLARE_ALIGNED(16, uint16_t, ref_s[kNumCoeffs]);250 DECLARE_ALIGNED(16, uint16_t, ref_s[kNumCoeffs]);
258#else251#else
259 DECLARE_ALIGNED(8, uint8_t, s[kNumCoeffs]);252 DECLARE_ALIGNED(8, uint8_t, s[kNumCoeffs]);
260 DECLARE_ALIGNED(8, uint8_t, ref_s[kNumCoeffs]);253 DECLARE_ALIGNED(8, uint8_t, ref_s[kNumCoeffs]);
261#endif // CONFIG_VP9_HIGHBITDEPTH254#endif // CONFIG_VP9_HIGHBITDEPTH
262 int err_count_total = 0;255 int err_count_total = 0;
263 int first_failure = -1;256 int first_failure = -1;
264 for (int i = 0; i < count_test_block; ++i) {257 for (int i = 0; i < count_test_block; ++i) {
265 int err_count = 0;258 int err_count = 0;
266 uint8_t tmp = static_cast<uint8_t>(rnd(3 * MAX_LOOP_FILTER + 4));259 uint8_t tmp = static_cast<uint8_t>(rnd(3 * MAX_LOOP_FILTER + 4));
267 DECLARE_ALIGNED(16, const uint8_t, blimit0[16]) = {260 DECLARE_ALIGNED(16, const uint8_t,
268 tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp,261 blimit0[16]) = { tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp,
269 tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp262 tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp };
270 };
271 tmp = static_cast<uint8_t>(rnd(MAX_LOOP_FILTER));263 tmp = static_cast<uint8_t>(rnd(MAX_LOOP_FILTER));
272 DECLARE_ALIGNED(16, const uint8_t, limit0[16]) = {264 DECLARE_ALIGNED(16, const uint8_t,
273 tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp,265 limit0[16]) = { tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp,
274 tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp266 tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp };
275 };
276 tmp = rnd.Rand8();267 tmp = rnd.Rand8();
277 DECLARE_ALIGNED(16, const uint8_t, thresh0[16]) = {268 DECLARE_ALIGNED(16, const uint8_t,
278 tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp,269 thresh0[16]) = { tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp,
279 tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp270 tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp };
280 };
281 tmp = static_cast<uint8_t>(rnd(3 * MAX_LOOP_FILTER + 4));271 tmp = static_cast<uint8_t>(rnd(3 * MAX_LOOP_FILTER + 4));
282 DECLARE_ALIGNED(16, const uint8_t, blimit1[16]) = {272 DECLARE_ALIGNED(16, const uint8_t,
283 tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp,273 blimit1[16]) = { tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp,
284 tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp274 tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp };
285 };
286 tmp = static_cast<uint8_t>(rnd(MAX_LOOP_FILTER));275 tmp = static_cast<uint8_t>(rnd(MAX_LOOP_FILTER));
287 DECLARE_ALIGNED(16, const uint8_t, limit1[16]) = {276 DECLARE_ALIGNED(16, const uint8_t,
288 tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp,277 limit1[16]) = { tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp,
289 tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp278 tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp };
290 };
291 tmp = rnd.Rand8();279 tmp = rnd.Rand8();
292 DECLARE_ALIGNED(16, const uint8_t, thresh1[16]) = {280 DECLARE_ALIGNED(16, const uint8_t,
293 tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp,281 thresh1[16]) = { tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp,
294 tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp282 tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp };
295 };
296 int32_t p = kNumCoeffs / 32;283 int32_t p = kNumCoeffs / 32;
297 uint16_t tmp_s[kNumCoeffs];284 uint16_t tmp_s[kNumCoeffs];
298 int j = 0;285 int j = 0;
@@ -325,17 +312,16 @@ TEST_P(Loop8Test9Param, OperationCheck) { · 26 unmodified lines
325 ref_s[j] = s[j];312 ref_s[j] = s[j];
326 }313 }
327#if CONFIG_VP9_HIGHBITDEPTH314#if CONFIG_VP9_HIGHBITDEPTH
328 ref_loopfilter_op_(ref_s + 8 + p * 8, p, blimit0, limit0, thresh0,315 ref_loopfilter_op_(ref_s + 8 + p * 8, p, blimit0, limit0, thresh0, blimit1,
329 blimit1, limit1, thresh1, bd);316 limit1, thresh1, bd);
330 ASM_REGISTER_STATE_CHECK(317 ASM_REGISTER_STATE_CHECK(loopfilter_op_(s + 8 + p * 8, p, blimit0, limit0,
331 loopfilter_op_(s + 8 + p * 8, p, blimit0, limit0, thresh0,318 thresh0, blimit1, limit1, thresh1,
332 blimit1, limit1, thresh1, bd));319 bd));
333#else320#else
334 ref_loopfilter_op_(ref_s + 8 + p * 8, p, blimit0, limit0, thresh0,321 ref_loopfilter_op_(ref_s + 8 + p * 8, p, blimit0, limit0, thresh0, blimit1,
335 blimit1, limit1, thresh1);322 limit1, thresh1);
336 ASM_REGISTER_STATE_CHECK(323 ASM_REGISTER_STATE_CHECK(loopfilter_op_(s + 8 + p * 8, p, blimit0, limit0,
337 loopfilter_op_(s + 8 + p * 8, p, blimit0, limit0, thresh0,324 thresh0, blimit1, limit1, thresh1));
338 blimit1, limit1, thresh1));
339#endif // CONFIG_VP9_HIGHBITDEPTH325#endif // CONFIG_VP9_HIGHBITDEPTH
340 for (int j = 0; j < kNumCoeffs; ++j) {326 for (int j = 0; j < kNumCoeffs; ++j) {
341 err_count += ref_s[j] != s[j];327 err_count += ref_s[j] != s[j];
@@ -358,43 +344,37 @@ TEST_P(Loop8Test9Param, ValueCheck) { · 16 unmodified lines
358 DECLARE_ALIGNED(16, uint16_t, s[kNumCoeffs]);344 DECLARE_ALIGNED(16, uint16_t, s[kNumCoeffs]);
359 DECLARE_ALIGNED(16, uint16_t, ref_s[kNumCoeffs]);345 DECLARE_ALIGNED(16, uint16_t, ref_s[kNumCoeffs]);
360#else346#else
361 DECLARE_ALIGNED(8, uint8_t, s[kNumCoeffs]);347 DECLARE_ALIGNED(8, uint8_t, s[kNumCoeffs]);
362 DECLARE_ALIGNED(8, uint8_t, ref_s[kNumCoeffs]);348 DECLARE_ALIGNED(8, uint8_t, ref_s[kNumCoeffs]);
363#endif // CONFIG_VP9_HIGHBITDEPTH349#endif // CONFIG_VP9_HIGHBITDEPTH
364 int err_count_total = 0;350 int err_count_total = 0;
365 int first_failure = -1;351 int first_failure = -1;
366 for (int i = 0; i < count_test_block; ++i) {352 for (int i = 0; i < count_test_block; ++i) {
367 int err_count = 0;353 int err_count = 0;
368 uint8_t tmp = static_cast<uint8_t>(rnd(3 * MAX_LOOP_FILTER + 4));354 uint8_t tmp = static_cast<uint8_t>(rnd(3 * MAX_LOOP_FILTER + 4));
369 DECLARE_ALIGNED(16, const uint8_t, blimit0[16]) = {355 DECLARE_ALIGNED(16, const uint8_t,
370 tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp,356 blimit0[16]) = { tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp,
371 tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp357 tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp };
372 };
373 tmp = static_cast<uint8_t>(rnd(MAX_LOOP_FILTER));358 tmp = static_cast<uint8_t>(rnd(MAX_LOOP_FILTER));
374 DECLARE_ALIGNED(16, const uint8_t, limit0[16]) = {359 DECLARE_ALIGNED(16, const uint8_t,
375 tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp,360 limit0[16]) = { tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp,
376 tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp361 tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp };
377 };
378 tmp = rnd.Rand8();362 tmp = rnd.Rand8();
379 DECLARE_ALIGNED(16, const uint8_t, thresh0[16]) = {363 DECLARE_ALIGNED(16, const uint8_t,
380 tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp,364 thresh0[16]) = { tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp,
381 tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp365 tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp };
382 };
383 tmp = static_cast<uint8_t>(rnd(3 * MAX_LOOP_FILTER + 4));366 tmp = static_cast<uint8_t>(rnd(3 * MAX_LOOP_FILTER + 4));
384 DECLARE_ALIGNED(16, const uint8_t, blimit1[16]) = {367 DECLARE_ALIGNED(16, const uint8_t,
385 tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp,368 blimit1[16]) = { tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp,
386 tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp369 tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp };
387 };
388 tmp = static_cast<uint8_t>(rnd(MAX_LOOP_FILTER));370 tmp = static_cast<uint8_t>(rnd(MAX_LOOP_FILTER));
389 DECLARE_ALIGNED(16, const uint8_t, limit1[16]) = {371 DECLARE_ALIGNED(16, const uint8_t,
390 tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp,372 limit1[16]) = { tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp,
391 tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp373 tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp };
392 };
393 tmp = rnd.Rand8();374 tmp = rnd.Rand8();
394 DECLARE_ALIGNED(16, const uint8_t, thresh1[16]) = {375 DECLARE_ALIGNED(16, const uint8_t,
395 tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp,376 thresh1[16]) = { tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp,
396 tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp377 tmp, tmp, tmp, tmp, tmp, tmp, tmp, tmp };
397 };
398 int32_t p = kNumCoeffs / 32; // TODO(pdlf) can we have non-square here?378 int32_t p = kNumCoeffs / 32; // TODO(pdlf) can we have non-square here?
399 for (int j = 0; j < kNumCoeffs; ++j) {379 for (int j = 0; j < kNumCoeffs; ++j) {
400 s[j] = rnd.Rand16() & mask_;380 s[j] = rnd.Rand16() & mask_;
@@ -402,17 +382,16 @@ TEST_P(Loop8Test9Param, ValueCheck) { · 1 unmodified line
402 }382 }
403#if CONFIG_VP9_HIGHBITDEPTH383#if CONFIG_VP9_HIGHBITDEPTH
404 const int32_t bd = bit_depth_;384 const int32_t bd = bit_depth_;
405 ref_loopfilter_op_(ref_s + 8 + p * 8, p, blimit0, limit0, thresh0,385 ref_loopfilter_op_(ref_s + 8 + p * 8, p, blimit0, limit0, thresh0, blimit1,
406 blimit1, limit1, thresh1, bd);386 limit1, thresh1, bd);
407 ASM_REGISTER_STATE_CHECK(387 ASM_REGISTER_STATE_CHECK(loopfilter_op_(s + 8 + p * 8, p, blimit0, limit0,
408 loopfilter_op_(s + 8 + p * 8, p, blimit0, limit0,388 thresh0, blimit1, limit1, thresh1,
409 thresh0, blimit1, limit1, thresh1, bd));389 bd));
410#else390#else
411 ref_loopfilter_op_(ref_s + 8 + p * 8, p, blimit0, limit0, thresh0,391 ref_loopfilter_op_(ref_s + 8 + p * 8, p, blimit0, limit0, thresh0, blimit1,
412 blimit1, limit1, thresh1);392 limit1, thresh1);
413 ASM_REGISTER_STATE_CHECK(393 ASM_REGISTER_STATE_CHECK(loopfilter_op_(s + 8 + p * 8, p, blimit0, limit0,
414 loopfilter_op_(s + 8 + p * 8, p, blimit0, limit0, thresh0,394 thresh0, blimit1, limit1, thresh1));
415 blimit1, limit1, thresh1));
416#endif // CONFIG_VP9_HIGHBITDEPTH395#endif // CONFIG_VP9_HIGHBITDEPTH
417 for (int j = 0; j < kNumCoeffs; ++j) {396 for (int j = 0; j < kNumCoeffs; ++j) {
418 err_count += ref_s[j] != s[j];397 err_count += ref_s[j] != s[j];
@@ -434,129 +413,120 @@ using std::tr1::make_tuple; · 15 unmodified lines
434#if CONFIG_VP9_HIGHBITDEPTH413#if CONFIG_VP9_HIGHBITDEPTH
435INSTANTIATE_TEST_CASE_P(414INSTANTIATE_TEST_CASE_P(
436 SSE2, Loop8Test6Param,415 SSE2, Loop8Test6Param,
437 ::testing::Values(416 ::testing::Values(make_tuple(&vpx_highbd_lpf_horizontal_4_sse2,
438 make_tuple(&vpx_highbd_lpf_horizontal_4_sse2,417 &vpx_highbd_lpf_horizontal_4_c, 8),
439 &vpx_highbd_lpf_horizontal_4_c, 8),418 make_tuple(&vpx_highbd_lpf_vertical_4_sse2,
440 make_tuple(&vpx_highbd_lpf_vertical_4_sse2,419 &vpx_highbd_lpf_vertical_4_c, 8),
441 &vpx_highbd_lpf_vertical_4_c, 8),420 make_tuple(&vpx_highbd_lpf_horizontal_8_sse2,
442 make_tuple(&vpx_highbd_lpf_horizontal_8_sse2,421 &vpx_highbd_lpf_horizontal_8_c, 8),
443 &vpx_highbd_lpf_horizontal_8_c, 8),422 make_tuple(&vpx_highbd_lpf_horizontal_edge_8_sse2,
444 make_tuple(&vpx_highbd_lpf_horizontal_edge_8_sse2,423 &vpx_highbd_lpf_horizontal_edge_8_c, 8),
445 &vpx_highbd_lpf_horizontal_edge_8_c, 8),424 make_tuple(&vpx_highbd_lpf_horizontal_edge_16_sse2,
446 make_tuple(&vpx_highbd_lpf_horizontal_edge_16_sse2,425 &vpx_highbd_lpf_horizontal_edge_16_c, 8),
447 &vpx_highbd_lpf_horizontal_edge_16_c, 8),426 make_tuple(&vpx_highbd_lpf_vertical_8_sse2,
448 make_tuple(&vpx_highbd_lpf_vertical_8_sse2,427 &vpx_highbd_lpf_vertical_8_c, 8),
449 &vpx_highbd_lpf_vertical_8_c, 8),428 make_tuple(&vpx_highbd_lpf_vertical_16_sse2,
450 make_tuple(&vpx_highbd_lpf_vertical_16_sse2,429 &vpx_highbd_lpf_vertical_16_c, 8),
451 &vpx_highbd_lpf_vertical_16_c, 8),430 make_tuple(&vpx_highbd_lpf_horizontal_4_sse2,
452 make_tuple(&vpx_highbd_lpf_horizontal_4_sse2,431 &vpx_highbd_lpf_horizontal_4_c, 10),
453 &vpx_highbd_lpf_horizontal_4_c, 10),432 make_tuple(&vpx_highbd_lpf_vertical_4_sse2,
454 make_tuple(&vpx_highbd_lpf_vertical_4_sse2,433 &vpx_highbd_lpf_vertical_4_c, 10),
455 &vpx_highbd_lpf_vertical_4_c, 10),434 make_tuple(&vpx_highbd_lpf_horizontal_8_sse2,
456 make_tuple(&vpx_highbd_lpf_horizontal_8_sse2,435 &vpx_highbd_lpf_horizontal_8_c, 10),
457 &vpx_highbd_lpf_horizontal_8_c, 10),436 make_tuple(&vpx_highbd_lpf_horizontal_edge_8_sse2,
458 make_tuple(&vpx_highbd_lpf_horizontal_edge_8_sse2,437 &vpx_highbd_lpf_horizontal_edge_8_c, 10),
459 &vpx_highbd_lpf_horizontal_edge_8_c, 10),438 make_tuple(&vpx_highbd_lpf_horizontal_edge_16_sse2,
460 make_tuple(&vpx_highbd_lpf_horizontal_edge_16_sse2,439 &vpx_highbd_lpf_horizontal_edge_16_c, 10),
461 &vpx_highbd_lpf_horizontal_edge_16_c, 10),440 make_tuple(&vpx_highbd_lpf_vertical_8_sse2,
462 make_tuple(&vpx_highbd_lpf_vertical_8_sse2,441 &vpx_highbd_lpf_vertical_8_c, 10),
463 &vpx_highbd_lpf_vertical_8_c, 10),442 make_tuple(&vpx_highbd_lpf_vertical_16_sse2,
464 make_tuple(&vpx_highbd_lpf_vertical_16_sse2,443 &vpx_highbd_lpf_vertical_16_c, 10),
465 &vpx_highbd_lpf_vertical_16_c, 10),444 make_tuple(&vpx_highbd_lpf_horizontal_4_sse2,
466 make_tuple(&vpx_highbd_lpf_horizontal_4_sse2,445 &vpx_highbd_lpf_horizontal_4_c, 12),
467 &vpx_highbd_lpf_horizontal_4_c, 12),446 make_tuple(&vpx_highbd_lpf_vertical_4_sse2,
468 make_tuple(&vpx_highbd_lpf_vertical_4_sse2,447 &vpx_highbd_lpf_vertical_4_c, 12),
469 &vpx_highbd_lpf_vertical_4_c, 12),448 make_tuple(&vpx_highbd_lpf_horizontal_8_sse2,
470 make_tuple(&vpx_highbd_lpf_horizontal_8_sse2,449 &vpx_highbd_lpf_horizontal_8_c, 12),
471 &vpx_highbd_lpf_horizontal_8_c, 12),450 make_tuple(&vpx_highbd_lpf_horizontal_edge_8_sse2,
472 make_tuple(&vpx_highbd_lpf_horizontal_edge_8_sse2,451 &vpx_highbd_lpf_horizontal_edge_8_c, 12),
473 &vpx_highbd_lpf_horizontal_edge_8_c, 12),452 make_tuple(&vpx_highbd_lpf_horizontal_edge_16_sse2,
474 make_tuple(&vpx_highbd_lpf_horizontal_edge_16_sse2,453 &vpx_highbd_lpf_horizontal_edge_16_c, 12),
475 &vpx_highbd_lpf_horizontal_edge_16_c, 12),454 make_tuple(&vpx_highbd_lpf_vertical_8_sse2,
476 make_tuple(&vpx_highbd_lpf_vertical_8_sse2,455 &vpx_highbd_lpf_vertical_8_c, 12),
477 &vpx_highbd_lpf_vertical_8_c, 12),456 make_tuple(&vpx_highbd_lpf_vertical_16_sse2,
478 make_tuple(&vpx_highbd_lpf_vertical_16_sse2,457 &vpx_highbd_lpf_vertical_16_c, 12),
479 &vpx_highbd_lpf_vertical_16_c, 12),458 make_tuple(&vpx_highbd_lpf_vertical_16_dual_sse2,
480 make_tuple(&vpx_highbd_lpf_vertical_16_dual_sse2,459 &vpx_highbd_lpf_vertical_16_dual_c, 8),
481 &vpx_highbd_lpf_vertical_16_dual_c, 8),460 make_tuple(&vpx_highbd_lpf_vertical_16_dual_sse2,
482 make_tuple(&vpx_highbd_lpf_vertical_16_dual_sse2,461 &vpx_highbd_lpf_vertical_16_dual_c, 10),
483 &vpx_highbd_lpf_vertical_16_dual_c, 10),462 make_tuple(&vpx_highbd_lpf_vertical_16_dual_sse2,
484 make_tuple(&vpx_highbd_lpf_vertical_16_dual_sse2,463 &vpx_highbd_lpf_vertical_16_dual_c, 12)));
485 &vpx_highbd_lpf_vertical_16_dual_c, 12)));
486#else464#else
487INSTANTIATE_TEST_CASE_P(465INSTANTIATE_TEST_CASE_P(
488 SSE2, Loop8Test6Param,466 SSE2, Loop8Test6Param,
489 ::testing::Values(467 ::testing::Values(
490 make_tuple(&vpx_lpf_horizontal_4_sse2,468 make_tuple(&vpx_lpf_horizontal_4_sse2, &vpx_lpf_horizontal_4_c, 8),
491 &vpx_lpf_horizontal_4_c, 8),469 make_tuple(&vpx_lpf_horizontal_8_sse2, &vpx_lpf_horizontal_8_c, 8),
492 make_tuple(&vpx_lpf_horizontal_8_sse2,
493 &vpx_lpf_horizontal_8_c, 8),
494 make_tuple(&vpx_lpf_horizontal_edge_8_sse2,470 make_tuple(&vpx_lpf_horizontal_edge_8_sse2,
495 &vpx_lpf_horizontal_edge_8_c, 8),471 &vpx_lpf_horizontal_edge_8_c, 8),
496 make_tuple(&vpx_lpf_horizontal_edge_16_sse2,472 make_tuple(&vpx_lpf_horizontal_edge_16_sse2,
497 &vpx_lpf_horizontal_edge_16_c, 8),473 &vpx_lpf_horizontal_edge_16_c, 8),
498 make_tuple(&vpx_lpf_vertical_4_sse2,474 make_tuple(&vpx_lpf_vertical_4_sse2, &vpx_lpf_vertical_4_c, 8),
499 &vpx_lpf_vertical_4_c, 8),475 make_tuple(&vpx_lpf_vertical_8_sse2, &vpx_lpf_vertical_8_c, 8),
500 make_tuple(&vpx_lpf_vertical_8_sse2,476 make_tuple(&vpx_lpf_vertical_16_sse2, &vpx_lpf_vertical_16_c, 8),
501 &vpx_lpf_vertical_8_c, 8),477 make_tuple(&vpx_lpf_vertical_16_dual_sse2, &vpx_lpf_vertical_16_dual_c,
502 make_tuple(&vpx_lpf_vertical_16_sse2,478 8)));
503 &vpx_lpf_vertical_16_c, 8),
504 make_tuple(&vpx_lpf_vertical_16_dual_sse2,
505 &vpx_lpf_vertical_16_dual_c, 8)));
506#endif // CONFIG_VP9_HIGHBITDEPTH479#endif // CONFIG_VP9_HIGHBITDEPTH
507#endif480#endif
508 481
509#if HAVE_AVX2 && (!CONFIG_VP9_HIGHBITDEPTH)482#if HAVE_AVX2 && (!CONFIG_VP9_HIGHBITDEPTH)
510INSTANTIATE_TEST_CASE_P(483INSTANTIATE_TEST_CASE_P(
511 AVX2, Loop8Test6Param,484 AVX2, Loop8Test6Param,
512 ::testing::Values(485 ::testing::Values(make_tuple(&vpx_lpf_horizontal_edge_8_avx2,
513 make_tuple(&vpx_lpf_horizontal_edge_8_avx2,486 &vpx_lpf_horizontal_edge_8_c, 8),
514 &vpx_lpf_horizontal_edge_8_c, 8),487 make_tuple(&vpx_lpf_horizontal_edge_16_avx2,
515 make_tuple(&vpx_lpf_horizontal_edge_16_avx2,488 &vpx_lpf_horizontal_edge_16_c, 8)));
516 &vpx_lpf_horizontal_edge_16_c, 8)));
517#endif489#endif
518 490
519#if HAVE_SSE2491#if HAVE_SSE2
520#if CONFIG_VP9_HIGHBITDEPTH492#if CONFIG_VP9_HIGHBITDEPTH
521INSTANTIATE_TEST_CASE_P(493INSTANTIATE_TEST_CASE_P(
522 SSE2, Loop8Test9Param,494 SSE2, Loop8Test9Param,
523 ::testing::Values(495 ::testing::Values(make_tuple(&vpx_highbd_lpf_horizontal_4_dual_sse2,
524 make_tuple(&vpx_highbd_lpf_horizontal_4_dual_sse2,496 &vpx_highbd_lpf_horizontal_4_dual_c, 8),
525 &vpx_highbd_lpf_horizontal_4_dual_c, 8),497 make_tuple(&vpx_highbd_lpf_horizontal_8_dual_sse2,
526 make_tuple(&vpx_highbd_lpf_horizontal_8_dual_sse2,498 &vpx_highbd_lpf_horizontal_8_dual_c, 8),
527 &vpx_highbd_lpf_horizontal_8_dual_c, 8),499 make_tuple(&vpx_highbd_lpf_vertical_4_dual_sse2,
528 make_tuple(&vpx_highbd_lpf_vertical_4_dual_sse2,500 &vpx_highbd_lpf_vertical_4_dual_c, 8),
529 &vpx_highbd_lpf_vertical_4_dual_c, 8),501 make_tuple(&vpx_highbd_lpf_vertical_8_dual_sse2,
530 make_tuple(&vpx_highbd_lpf_vertical_8_dual_sse2,502 &vpx_highbd_lpf_vertical_8_dual_c, 8),
531 &vpx_highbd_lpf_vertical_8_dual_c, 8),503 make_tuple(&vpx_highbd_lpf_horizontal_4_dual_sse2,
532 make_tuple(&vpx_highbd_lpf_horizontal_4_dual_sse2,504 &vpx_highbd_lpf_horizontal_4_dual_c, 10),
533 &vpx_highbd_lpf_horizontal_4_dual_c, 10),505 make_tuple(&vpx_highbd_lpf_horizontal_8_dual_sse2,
534 make_tuple(&vpx_highbd_lpf_horizontal_8_dual_sse2,506 &vpx_highbd_lpf_horizontal_8_dual_c, 10),
535 &vpx_highbd_lpf_horizontal_8_dual_c, 10),507 make_tuple(&vpx_highbd_lpf_vertical_4_dual_sse2,
536 make_tuple(&vpx_highbd_lpf_vertical_4_dual_sse2,508 &vpx_highbd_lpf_vertical_4_dual_c, 10),
537 &vpx_highbd_lpf_vertical_4_dual_c, 10),509 make_tuple(&vpx_highbd_lpf_vertical_8_dual_sse2,
538 make_tuple(&vpx_highbd_lpf_vertical_8_dual_sse2,510 &vpx_highbd_lpf_vertical_8_dual_c, 10),
539 &vpx_highbd_lpf_vertical_8_dual_c, 10),511 make_tuple(&vpx_highbd_lpf_horizontal_4_dual_sse2,
540 make_tuple(&vpx_highbd_lpf_horizontal_4_dual_sse2,512 &vpx_highbd_lpf_horizontal_4_dual_c, 12),
541 &vpx_highbd_lpf_horizontal_4_dual_c, 12),513 make_tuple(&vpx_highbd_lpf_horizontal_8_dual_sse2,
542 make_tuple(&vpx_highbd_lpf_horizontal_8_dual_sse2,514 &vpx_highbd_lpf_horizontal_8_dual_c, 12),
543 &vpx_highbd_lpf_horizontal_8_dual_c, 12),515 make_tuple(&vpx_highbd_lpf_vertical_4_dual_sse2,
544 make_tuple(&vpx_highbd_lpf_vertical_4_dual_sse2,516 &vpx_highbd_lpf_vertical_4_dual_c, 12),
545 &vpx_highbd_lpf_vertical_4_dual_c, 12),517 make_tuple(&vpx_highbd_lpf_vertical_8_dual_sse2,
546 make_tuple(&vpx_highbd_lpf_vertical_8_dual_sse2,518 &vpx_highbd_lpf_vertical_8_dual_c, 12)));
547 &vpx_highbd_lpf_vertical_8_dual_c, 12)));
548#else519#else
549INSTANTIATE_TEST_CASE_P(520INSTANTIATE_TEST_CASE_P(
550 SSE2, Loop8Test9Param,521 SSE2, Loop8Test9Param,
551 ::testing::Values(522 ::testing::Values(make_tuple(&vpx_lpf_horizontal_4_dual_sse2,
552 make_tuple(&vpx_lpf_horizontal_4_dual_sse2,523 &vpx_lpf_horizontal_4_dual_c, 8),
553 &vpx_lpf_horizontal_4_dual_c, 8),524 make_tuple(&vpx_lpf_horizontal_8_dual_sse2,
554 make_tuple(&vpx_lpf_horizontal_8_dual_sse2,525 &vpx_lpf_horizontal_8_dual_c, 8),
555 &vpx_lpf_horizontal_8_dual_c, 8),526 make_tuple(&vpx_lpf_vertical_4_dual_sse2,
556 make_tuple(&vpx_lpf_vertical_4_dual_sse2,527 &vpx_lpf_vertical_4_dual_c, 8),
557 &vpx_lpf_vertical_4_dual_c, 8),528 make_tuple(&vpx_lpf_vertical_8_dual_sse2,
558 make_tuple(&vpx_lpf_vertical_8_dual_sse2,529 &vpx_lpf_vertical_8_dual_c, 8)));
559 &vpx_lpf_vertical_8_dual_c, 8)));
560#endif // CONFIG_VP9_HIGHBITDEPTH530#endif // CONFIG_VP9_HIGHBITDEPTH
561#endif531#endif
562 532
@@ -567,39 +537,33 @@ INSTANTIATE_TEST_CASE_P( · 4 unmodified lines
567INSTANTIATE_TEST_CASE_P(537INSTANTIATE_TEST_CASE_P(
568 NEON, Loop8Test6Param,538 NEON, Loop8Test6Param,
569 ::testing::Values(539 ::testing::Values(
570#if HAVE_NEON_ASM
571// Using #if inside the macro is unsupported on MSVS but the tests are not540// Using #if inside the macro is unsupported on MSVS but the tests are not
572// currently built for MSVS with ARM and NEON.541// currently built for MSVS with ARM and NEON.
542#if HAVE_NEON_ASM
573 make_tuple(&vpx_lpf_horizontal_edge_8_neon,543 make_tuple(&vpx_lpf_horizontal_edge_8_neon,
574 &vpx_lpf_horizontal_edge_8_c, 8),544 &vpx_lpf_horizontal_edge_8_c, 8),
575 make_tuple(&vpx_lpf_horizontal_edge_16_neon,545 make_tuple(&vpx_lpf_horizontal_edge_16_neon,
576 &vpx_lpf_horizontal_edge_16_c, 8),546 &vpx_lpf_horizontal_edge_16_c, 8),
577 make_tuple(&vpx_lpf_vertical_16_neon,547 make_tuple(&vpx_lpf_vertical_16_neon, &vpx_lpf_vertical_16_c, 8),
578 &vpx_lpf_vertical_16_c, 8),548 make_tuple(&vpx_lpf_vertical_16_dual_neon, &vpx_lpf_vertical_16_dual_c,
579 make_tuple(&vpx_lpf_vertical_16_dual_neon,549 8),
580 &vpx_lpf_vertical_16_dual_c, 8),
581#endif // HAVE_NEON_ASM550#endif // HAVE_NEON_ASM
582 make_tuple(&vpx_lpf_horizontal_8_neon,551 make_tuple(&vpx_lpf_horizontal_8_neon, &vpx_lpf_horizontal_8_c, 8),
583 &vpx_lpf_horizontal_8_c, 8),552 make_tuple(&vpx_lpf_vertical_8_neon, &vpx_lpf_vertical_8_c, 8),
584 make_tuple(&vpx_lpf_vertical_8_neon,553 make_tuple(&vpx_lpf_horizontal_4_neon, &vpx_lpf_horizontal_4_c, 8),
585 &vpx_lpf_vertical_8_c, 8),554 make_tuple(&vpx_lpf_vertical_4_neon, &vpx_lpf_vertical_4_c, 8)));
586 make_tuple(&vpx_lpf_horizontal_4_neon,555INSTANTIATE_TEST_CASE_P(NEON, Loop8Test9Param,
587 &vpx_lpf_horizontal_4_c, 8),556 ::testing::Values(
588 make_tuple(&vpx_lpf_vertical_4_neon,
589 &vpx_lpf_vertical_4_c, 8)));
590INSTANTIATE_TEST_CASE_P(
591 NEON, Loop8Test9Param,
592 ::testing::Values(
593#if HAVE_NEON_ASM557#if HAVE_NEON_ASM
594 make_tuple(&vpx_lpf_horizontal_8_dual_neon,558 make_tuple(&vpx_lpf_horizontal_8_dual_neon,
595 &vpx_lpf_horizontal_8_dual_c, 8),559 &vpx_lpf_horizontal_8_dual_c, 8),
596 make_tuple(&vpx_lpf_vertical_8_dual_neon,560 make_tuple(&vpx_lpf_vertical_8_dual_neon,
597 &vpx_lpf_vertical_8_dual_c, 8),561 &vpx_lpf_vertical_8_dual_c, 8),
598#endif // HAVE_NEON_ASM562#endif // HAVE_NEON_ASM
599 make_tuple(&vpx_lpf_horizontal_4_dual_neon,563 make_tuple(&vpx_lpf_horizontal_4_dual_neon,
600 &vpx_lpf_horizontal_4_dual_c, 8),564 &vpx_lpf_horizontal_4_dual_c, 8),
601 make_tuple(&vpx_lpf_vertical_4_dual_neon,565 make_tuple(&vpx_lpf_vertical_4_dual_neon,
602 &vpx_lpf_vertical_4_dual_c, 8)));566 &vpx_lpf_vertical_4_dual_c, 8)));
603#endif // CONFIG_VP9_HIGHBITDEPTH567#endif // CONFIG_VP9_HIGHBITDEPTH
604#endif // HAVE_NEON568#endif // HAVE_NEON
605 569
@@ -607,66 +571,52 @@ INSTANTIATE_TEST_CASE_P( · 1 unmodified line
607INSTANTIATE_TEST_CASE_P(571INSTANTIATE_TEST_CASE_P(
608 DSPR2, Loop8Test6Param,572 DSPR2, Loop8Test6Param,
609 ::testing::Values(573 ::testing::Values(
610 make_tuple(&vpx_lpf_horizontal_4_dspr2,574 make_tuple(&vpx_lpf_horizontal_4_dspr2, &vpx_lpf_horizontal_4_c, 8),
611 &vpx_lpf_horizontal_4_c, 8),575 make_tuple(&vpx_lpf_horizontal_8_dspr2, &vpx_lpf_horizontal_8_c, 8),
612 make_tuple(&vpx_lpf_horizontal_8_dspr2,576 make_tuple(&vpx_lpf_horizontal_edge_8, &vpx_lpf_horizontal_edge_8, 8),
613 &vpx_lpf_horizontal_8_c, 8),577 make_tuple(&vpx_lpf_horizontal_edge_16, &vpx_lpf_horizontal_edge_16, 8),
614 make_tuple(&vpx_lpf_horizontal_edge_8,578 make_tuple(&vpx_lpf_vertical_4_dspr2, &vpx_lpf_vertical_4_c, 8),
615 &vpx_lpf_horizontal_edge_8, 8),579 make_tuple(&vpx_lpf_vertical_8_dspr2, &vpx_lpf_vertical_8_c, 8),
616 make_tuple(&vpx_lpf_horizontal_edge_16,580 make_tuple(&vpx_lpf_vertical_16_dspr2, &vpx_lpf_vertical_16_c, 8),
617 &vpx_lpf_horizontal_edge_16, 8),581 make_tuple(&vpx_lpf_vertical_16_dual_dspr2, &vpx_lpf_vertical_16_dual_c,
618 make_tuple(&vpx_lpf_vertical_4_dspr2,582 8)));
619 &vpx_lpf_vertical_4_c, 8),
620 make_tuple(&vpx_lpf_vertical_8_dspr2,
621 &vpx_lpf_vertical_8_c, 8),
622 make_tuple(&vpx_lpf_vertical_16_dspr2,
623 &vpx_lpf_vertical_16_c, 8),
624 make_tuple(&vpx_lpf_vertical_16_dual_dspr2,
625 &vpx_lpf_vertical_16_dual_c, 8)));
626 583
627INSTANTIATE_TEST_CASE_P(584INSTANTIATE_TEST_CASE_P(
628 DSPR2, Loop8Test9Param,585 DSPR2, Loop8Test9Param,
629 ::testing::Values(586 ::testing::Values(make_tuple(&vpx_lpf_horizontal_4_dual_dspr2,
630 make_tuple(&vpx_lpf_horizontal_4_dual_dspr2,587 &vpx_lpf_horizontal_4_dual_c, 8),
631 &vpx_lpf_horizontal_4_dual_c, 8),588 make_tuple(&vpx_lpf_horizontal_8_dual_dspr2,
632 make_tuple(&vpx_lpf_horizontal_8_dual_dspr2,589 &vpx_lpf_horizontal_8_dual_c, 8),
633 &vpx_lpf_horizontal_8_dual_c, 8),590 make_tuple(&vpx_lpf_vertical_4_dual_dspr2,
634 make_tuple(&vpx_lpf_vertical_4_dual_dspr2,591 &vpx_lpf_vertical_4_dual_c, 8),
635 &vpx_lpf_vertical_4_dual_c, 8),592 make_tuple(&vpx_lpf_vertical_8_dual_dspr2,
636 make_tuple(&vpx_lpf_vertical_8_dual_dspr2,593 &vpx_lpf_vertical_8_dual_c, 8)));
637 &vpx_lpf_vertical_8_dual_c, 8)));
638#endif // HAVE_DSPR2 && !CONFIG_VP9_HIGHBITDEPTH594#endif // HAVE_DSPR2 && !CONFIG_VP9_HIGHBITDEPTH
639 595
640#if HAVE_MSA && (!CONFIG_VP9_HIGHBITDEPTH)596#if HAVE_MSA && (!CONFIG_VP9_HIGHBITDEPTH)
641INSTANTIATE_TEST_CASE_P(597INSTANTIATE_TEST_CASE_P(
642 MSA, Loop8Test6Param,598 MSA, Loop8Test6Param,
643 ::testing::Values(599 ::testing::Values(
644 make_tuple(&vpx_lpf_horizontal_4_msa,600 make_tuple(&vpx_lpf_horizontal_4_msa, &vpx_lpf_horizontal_4_c, 8),
645 &vpx_lpf_horizontal_4_c, 8),601 make_tuple(&vpx_lpf_horizontal_8_msa, &vpx_lpf_horizontal_8_c, 8),
646 make_tuple(&vpx_lpf_horizontal_8_msa,602 make_tuple(&vpx_lpf_horizontal_edge_8_msa, &vpx_lpf_horizontal_edge_8_c,
647 &vpx_lpf_horizontal_8_c, 8),603 8),
648 make_tuple(&vpx_lpf_horizontal_edge_8_msa,
649 &vpx_lpf_horizontal_edge_8_c, 8),
650 make_tuple(&vpx_lpf_horizontal_edge_16_msa,604 make_tuple(&vpx_lpf_horizontal_edge_16_msa,
651 &vpx_lpf_horizontal_edge_16_c, 8),605 &vpx_lpf_horizontal_edge_16_c, 8),
652 make_tuple(&vpx_lpf_vertical_4_msa,606 make_tuple(&vpx_lpf_vertical_4_msa, &vpx_lpf_vertical_4_c, 8),
653 &vpx_lpf_vertical_4_c, 8),607 make_tuple(&vpx_lpf_vertical_8_msa, &vpx_lpf_vertical_8_c, 8),
654 make_tuple(&vpx_lpf_vertical_8_msa,608 make_tuple(&vpx_lpf_vertical_16_msa, &vpx_lpf_vertical_16_c, 8)));
655 &vpx_lpf_vertical_8_c, 8),
656 make_tuple(&vpx_lpf_vertical_16_msa,
657 &vpx_lpf_vertical_16_c, 8)));
658 609
659INSTANTIATE_TEST_CASE_P(610INSTANTIATE_TEST_CASE_P(
660 MSA, Loop8Test9Param,611 MSA, Loop8Test9Param,
661 ::testing::Values(612 ::testing::Values(make_tuple(&vpx_lpf_horizontal_4_dual_msa,
662 make_tuple(&vpx_lpf_horizontal_4_dual_msa,613 &vpx_lpf_horizontal_4_dual_c, 8),
663 &vpx_lpf_horizontal_4_dual_c, 8),614 make_tuple(&vpx_lpf_horizontal_8_dual_msa,
664 make_tuple(&vpx_lpf_horizontal_8_dual_msa,615 &vpx_lpf_horizontal_8_dual_c, 8),
665 &vpx_lpf_horizontal_8_dual_c, 8),616 make_tuple(&vpx_lpf_vertical_4_dual_msa,
666 make_tuple(&vpx_lpf_vertical_4_dual_msa,617 &vpx_lpf_vertical_4_dual_c, 8),
667 &vpx_lpf_vertical_4_dual_c, 8),618 make_tuple(&vpx_lpf_vertical_8_dual_msa,
668 make_tuple(&vpx_lpf_vertical_8_dual_msa,619 &vpx_lpf_vertical_8_dual_c, 8)));
669 &vpx_lpf_vertical_8_dual_c, 8)));
670#endif // HAVE_MSA && (!CONFIG_VP9_HIGHBITDEPTH)620#endif // HAVE_MSA && (!CONFIG_VP9_HIGHBITDEPTH)
671 621
672} // namespace622} // namespace
test/md5_helper.h+10−9
@@ -17,9 +17,7 @@ · 16 unmodified lines
17namespace libvpx_test {17namespace libvpx_test {
18class MD5 {18class MD5 {
19 public:19 public:
20 MD5() {20 MD5() { MD5Init(&md5_); }
21 MD5Init(&md5_);
22 }
23 21
24 void Add(const vpx_image_t *img) {22 void Add(const vpx_image_t *img) {
25 for (int plane = 0; plane < 3; ++plane) {23 for (int plane = 0; plane < 3; ++plane) {
@@ -30,10 +28,13 @@ class MD5 { · 4 unmodified lines
30 // This works only for chroma_shift of 0 and 1.28 // This works only for chroma_shift of 0 and 1.
31 const int bytes_per_sample =29 const int bytes_per_sample =
32 (img->fmt & VPX_IMG_FMT_HIGHBITDEPTH) ? 2 : 1;30 (img->fmt & VPX_IMG_FMT_HIGHBITDEPTH) ? 2 : 1;
33 const int h = plane ? (img->d_h + img->y_chroma_shift) >>31 const int h =
34 img->y_chroma_shift : img->d_h;32 plane ? (img->d_h + img->y_chroma_shift) >> img->y_chroma_shift
35 const int w = (plane ? (img->d_w + img->x_chroma_shift) >>33 : img->d_h;
36 img->x_chroma_shift : img->d_w) * bytes_per_sample;34 const int w =
35 (plane ? (img->d_w + img->x_chroma_shift) >> img->x_chroma_shift
36 : img->d_w) *
37 bytes_per_sample;
37 38
38 for (int y = 0; y < h; ++y) {39 for (int y = 0; y < h; ++y) {
39 MD5Update(&md5_, buf, w);40 MD5Update(&md5_, buf, w);
@@ -56,8 +57,8 @@ class MD5 { · 16 unmodified lines
56 57
57 MD5Final(tmp, &ctx_tmp);58 MD5Final(tmp, &ctx_tmp);
58 for (int i = 0; i < 16; i++) {59 for (int i = 0; i < 16; i++) {
59 res_[i * 2 + 0] = hex[tmp[i] >> 4];60 res_[i * 2 + 0] = hex[tmp[i] >> 4];
60 res_[i * 2 + 1] = hex[tmp[i] & 0xf];61 res_[i * 2 + 1] = hex[tmp[i] & 0xf];
61 }62 }
62 res_[32] = 0;63 res_[32] = 0;
63 64
test/minmax_test.cc+6−8
@@ -23,9 +23,8 @@ namespace { · 22 unmodified lines
23 23
24using ::libvpx_test::ACMRandom;24using ::libvpx_test::ACMRandom;
25 25
26typedef void (*MinMaxFunc)(const uint8_t *a, int a_stride,26typedef void (*MinMaxFunc)(const uint8_t *a, int a_stride, const uint8_t *b,
27 const uint8_t *b, int b_stride,27 int b_stride, int *min, int *max);
28 int *min, int *max);
29 28
30class MinMaxTest : public ::testing::TestWithParam<MinMaxFunc> {29class MinMaxTest : public ::testing::TestWithParam<MinMaxFunc> {
31 public:30 public:
@@ -39,9 +38,8 @@ class MinMaxTest : public ::testing::TestWithParam<MinMaxFunc> { · 7 unmodified lines
39 ACMRandom rnd_;38 ACMRandom rnd_;
40};39};
41 40
42void reference_minmax(const uint8_t *a, int a_stride,41void reference_minmax(const uint8_t *a, int a_stride, const uint8_t *b,
43 const uint8_t *b, int b_stride,42 int b_stride, int *min_ret, int *max_ret) {
44 int *min_ret, int *max_ret) {
45 int min = 255;43 int min = 255;
46 int max = 0;44 int max = 0;
47 for (int i = 0; i < 8; i++) {45 for (int i = 0; i < 8; i++) {
@@ -110,9 +108,9 @@ TEST_P(MinMaxTest, CompareReferenceAndVaryStride) { · 62 unmodified lines
110 reference_minmax(a, a_stride, b, b_stride, &min_ref, &max_ref);108 reference_minmax(a, a_stride, b, b_stride, &min_ref, &max_ref);
111 ASM_REGISTER_STATE_CHECK(mm_func_(a, a_stride, b, b_stride, &min, &max));109 ASM_REGISTER_STATE_CHECK(mm_func_(a, a_stride, b, b_stride, &min, &max));
112 EXPECT_EQ(max_ref, max) << "when a_stride = " << a_stride110 EXPECT_EQ(max_ref, max) << "when a_stride = " << a_stride
113 << " and b_stride = " << b_stride;;111 << " and b_stride = " << b_stride;
114 EXPECT_EQ(min_ref, min) << "when a_stride = " << a_stride112 EXPECT_EQ(min_ref, min) << "when a_stride = " << a_stride
115 << " and b_stride = " << b_stride;;113 << " and b_stride = " << b_stride;
116 }114 }
117 }115 }
118}116}
test/partial_idct_test.cc+77−164
@@ -29,10 +29,8 @@ using libvpx_test::ACMRandom; · 28 unmodified lines
29namespace {29namespace {
30typedef void (*FwdTxfmFunc)(const int16_t *in, tran_low_t *out, int stride);30typedef void (*FwdTxfmFunc)(const int16_t *in, tran_low_t *out, int stride);
31typedef void (*InvTxfmFunc)(const tran_low_t *in, uint8_t *out, int stride);31typedef void (*InvTxfmFunc)(const tran_low_t *in, uint8_t *out, int stride);
32typedef std::tr1::tuple<FwdTxfmFunc,32typedef std::tr1::tuple<FwdTxfmFunc, InvTxfmFunc, InvTxfmFunc, TX_SIZE, int>
33 InvTxfmFunc,33 PartialInvTxfmParam;
34 InvTxfmFunc,
35 TX_SIZE, int> PartialInvTxfmParam;
36const int kMaxNumCoeffs = 1024;34const int kMaxNumCoeffs = 1024;
37class PartialIDctTest : public ::testing::TestWithParam<PartialInvTxfmParam> {35class PartialIDctTest : public ::testing::TestWithParam<PartialInvTxfmParam> {
38 public:36 public:
@@ -41,7 +39,7 @@ class PartialIDctTest : public ::testing::TestWithParam<PartialInvTxfmParam> { · 2 unmodified lines
41 ftxfm_ = GET_PARAM(0);39 ftxfm_ = GET_PARAM(0);
42 full_itxfm_ = GET_PARAM(1);40 full_itxfm_ = GET_PARAM(1);
43 partial_itxfm_ = GET_PARAM(2);41 partial_itxfm_ = GET_PARAM(2);
44 tx_size_ = GET_PARAM(3);42 tx_size_ = GET_PARAM(3);
45 last_nonzero_ = GET_PARAM(4);43 last_nonzero_ = GET_PARAM(4);
46 }44 }
47 45
@@ -59,21 +57,11 @@ TEST_P(PartialIDctTest, RunQuantCheck) { · 11 unmodified lines
59 ACMRandom rnd(ACMRandom::DeterministicSeed());57 ACMRandom rnd(ACMRandom::DeterministicSeed());
60 int size;58 int size;
61 switch (tx_size_) {59 switch (tx_size_) {
62 case TX_4X4:60 case TX_4X4: size = 4; break;
63 size = 4;61 case TX_8X8: size = 8; break;
64 break;62 case TX_16X16: size = 16; break;
65 case TX_8X8:63 case TX_32X32: size = 32; break;
66 size = 8;64 default: FAIL() << "Wrong Size!"; break;
67 break;
68 case TX_16X16:
69 size = 16;
70 break;
71 case TX_32X32:
72 size = 32;
73 break;
74 default:
75 FAIL() << "Wrong Size!";
76 break;
77 }65 }
78 DECLARE_ALIGNED(16, tran_low_t, test_coef_block1[kMaxNumCoeffs]);66 DECLARE_ALIGNED(16, tran_low_t, test_coef_block1[kMaxNumCoeffs]);
79 DECLARE_ALIGNED(16, tran_low_t, test_coef_block2[kMaxNumCoeffs]);67 DECLARE_ALIGNED(16, tran_low_t, test_coef_block2[kMaxNumCoeffs]);
@@ -99,11 +87,9 @@ TEST_P(PartialIDctTest, RunQuantCheck) { · 19 unmodified lines
99 for (int i = 0; i < count_test_block; ++i) {87 for (int i = 0; i < count_test_block; ++i) {
100 // Initialize a test block with input range [-255, 255].88 // Initialize a test block with input range [-255, 255].
101 if (i == 0) {89 if (i == 0) {
102 for (int j = 0; j < block_size; ++j)90 for (int j = 0; j < block_size; ++j) input_extreme_block[j] = 255;
103 input_extreme_block[j] = 255;
104 } else if (i == 1) {91 } else if (i == 1) {
105 for (int j = 0; j < block_size; ++j)92 for (int j = 0; j < block_size; ++j) input_extreme_block[j] = -255;
106 input_extreme_block[j] = -255;
107 } else {93 } else {
108 for (int j = 0; j < block_size; ++j) {94 for (int j = 0; j < block_size; ++j) {
109 input_extreme_block[j] = rnd.Rand8() % 2 ? 255 : -255;95 input_extreme_block[j] = rnd.Rand8() % 2 ? 255 : -255;
@@ -115,8 +101,8 @@ TEST_P(PartialIDctTest, RunQuantCheck) { · 5 unmodified lines
115 // quantization with maximum allowed step sizes101 // quantization with maximum allowed step sizes
116 test_coef_block1[0] = (output_ref_block[0] / 1336) * 1336;102 test_coef_block1[0] = (output_ref_block[0] / 1336) * 1336;
117 for (int j = 1; j < last_nonzero_; ++j)103 for (int j = 1; j < last_nonzero_; ++j)
118 test_coef_block1[vp9_default_scan_orders[tx_size_].scan[j]]104 test_coef_block1[vp9_default_scan_orders[tx_size_].scan[j]] =
119 = (output_ref_block[j] / 1828) * 1828;105 (output_ref_block[j] / 1828) * 1828;
120 }106 }
121 107
122 ASM_REGISTER_STATE_CHECK(full_itxfm_(test_coef_block1, dst1, size));108 ASM_REGISTER_STATE_CHECK(full_itxfm_(test_coef_block1, dst1, size));
@@ -125,8 +111,7 @@ TEST_P(PartialIDctTest, RunQuantCheck) { · 2 unmodified lines
125 for (int j = 0; j < block_size; ++j) {111 for (int j = 0; j < block_size; ++j) {
126 const int diff = dst1[j] - dst2[j];112 const int diff = dst1[j] - dst2[j];
127 const int error = diff * diff;113 const int error = diff * diff;
128 if (max_error < error)114 if (max_error < error) max_error = error;
129 max_error = error;
130 }115 }
131 }116 }
132 117
@@ -138,21 +123,11 @@ TEST_P(PartialIDctTest, ResultsMatch) { · 5 unmodified lines
138 ACMRandom rnd(ACMRandom::DeterministicSeed());123 ACMRandom rnd(ACMRandom::DeterministicSeed());
139 int size;124 int size;
140 switch (tx_size_) {125 switch (tx_size_) {
141 case TX_4X4:126 case TX_4X4: size = 4; break;
142 size = 4;127 case TX_8X8: size = 8; break;
143 break;128 case TX_16X16: size = 16; break;
144 case TX_8X8:129 case TX_32X32: size = 32; break;
145 size = 8;130 default: FAIL() << "Wrong Size!"; break;
146 break;
147 case TX_16X16:
148 size = 16;
149 break;
150 case TX_32X32:
151 size = 32;
152 break;
153 default:
154 FAIL() << "Wrong Size!";
155 break;
156 }131 }
157 DECLARE_ALIGNED(16, tran_low_t, test_coef_block1[kMaxNumCoeffs]);132 DECLARE_ALIGNED(16, tran_low_t, test_coef_block1[kMaxNumCoeffs]);
158 DECLARE_ALIGNED(16, tran_low_t, test_coef_block2[kMaxNumCoeffs]);133 DECLARE_ALIGNED(16, tran_low_t, test_coef_block2[kMaxNumCoeffs]);
@@ -189,8 +164,7 @@ TEST_P(PartialIDctTest, ResultsMatch) { · 30 unmodified lines
189 for (int j = 0; j < block_size; ++j) {164 for (int j = 0; j < block_size; ++j) {
190 const int diff = dst1[j] - dst2[j];165 const int diff = dst1[j] - dst2[j];
191 const int error = diff * diff;166 const int error = diff * diff;
192 if (max_error < error)167 if (max_error < error) max_error = error;
193 max_error = error;
194 }168 }
195 }169 }
196 170
@@ -201,143 +175,82 @@ using std::tr1::make_tuple; · 4 unmodified lines
201 175
202INSTANTIATE_TEST_CASE_P(176INSTANTIATE_TEST_CASE_P(
203 C, PartialIDctTest,177 C, PartialIDctTest,
204 ::testing::Values(178 ::testing::Values(make_tuple(&vpx_fdct32x32_c, &vpx_idct32x32_1024_add_c,
205 make_tuple(&vpx_fdct32x32_c,179 &vpx_idct32x32_34_add_c, TX_32X32, 34),
206 &vpx_idct32x32_1024_add_c,180 make_tuple(&vpx_fdct32x32_c, &vpx_idct32x32_1024_add_c,
207 &vpx_idct32x32_34_add_c,181 &vpx_idct32x32_1_add_c, TX_32X32, 1),
208 TX_32X32, 34),182 make_tuple(&vpx_fdct16x16_c, &vpx_idct16x16_256_add_c,
209 make_tuple(&vpx_fdct32x32_c,183 &vpx_idct16x16_10_add_c, TX_16X16, 10),
210 &vpx_idct32x32_1024_add_c,184 make_tuple(&vpx_fdct16x16_c, &vpx_idct16x16_256_add_c,
211 &vpx_idct32x32_1_add_c,185 &vpx_idct16x16_1_add_c, TX_16X16, 1),
212 TX_32X32, 1),186 make_tuple(&vpx_fdct8x8_c, &vpx_idct8x8_64_add_c,
213 make_tuple(&vpx_fdct16x16_c,187 &vpx_idct8x8_12_add_c, TX_8X8, 12),
214 &vpx_idct16x16_256_add_c,188 make_tuple(&vpx_fdct8x8_c, &vpx_idct8x8_64_add_c,
215 &vpx_idct16x16_10_add_c,189 &vpx_idct8x8_1_add_c, TX_8X8, 1),
216 TX_16X16, 10),190 make_tuple(&vpx_fdct4x4_c, &vpx_idct4x4_16_add_c,
217 make_tuple(&vpx_fdct16x16_c,191 &vpx_idct4x4_1_add_c, TX_4X4, 1)));
218 &vpx_idct16x16_256_add_c,
219 &vpx_idct16x16_1_add_c,
220 TX_16X16, 1),
221 make_tuple(&vpx_fdct8x8_c,
222 &vpx_idct8x8_64_add_c,
223 &vpx_idct8x8_12_add_c,
224 TX_8X8, 12),
225 make_tuple(&vpx_fdct8x8_c,
226 &vpx_idct8x8_64_add_c,
227 &vpx_idct8x8_1_add_c,
228 TX_8X8, 1),
229 make_tuple(&vpx_fdct4x4_c,
230 &vpx_idct4x4_16_add_c,
231 &vpx_idct4x4_1_add_c,
232 TX_4X4, 1)));
233 192
234#if HAVE_NEON && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE193#if HAVE_NEON && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
235INSTANTIATE_TEST_CASE_P(194INSTANTIATE_TEST_CASE_P(
236 NEON, PartialIDctTest,195 NEON, PartialIDctTest,
237 ::testing::Values(196 ::testing::Values(make_tuple(&vpx_fdct32x32_c, &vpx_idct32x32_1024_add_c,
238 make_tuple(&vpx_fdct32x32_c,197 &vpx_idct32x32_1_add_neon, TX_32X32, 1),
239 &vpx_idct32x32_1024_add_c,198 make_tuple(&vpx_fdct16x16_c, &vpx_idct16x16_256_add_c,
240 &vpx_idct32x32_1_add_neon,199 &vpx_idct16x16_10_add_neon, TX_16X16, 10),
241 TX_32X32, 1),200 make_tuple(&vpx_fdct16x16_c, &vpx_idct16x16_256_add_c,
242 make_tuple(&vpx_fdct16x16_c,201 &vpx_idct16x16_1_add_neon, TX_16X16, 1),
243 &vpx_idct16x16_256_add_c,202 make_tuple(&vpx_fdct8x8_c, &vpx_idct8x8_64_add_c,
244 &vpx_idct16x16_10_add_neon,203 &vpx_idct8x8_12_add_neon, TX_8X8, 12),
245 TX_16X16, 10),204 make_tuple(&vpx_fdct8x8_c, &vpx_idct8x8_64_add_c,
246 make_tuple(&vpx_fdct16x16_c,205 &vpx_idct8x8_1_add_neon, TX_8X8, 1),
247 &vpx_idct16x16_256_add_c,206 make_tuple(&vpx_fdct4x4_c, &vpx_idct4x4_16_add_c,
248 &vpx_idct16x16_1_add_neon,207 &vpx_idct4x4_1_add_neon, TX_4X4, 1)));
249 TX_16X16, 1),
250 make_tuple(&vpx_fdct8x8_c,
251 &vpx_idct8x8_64_add_c,
252 &vpx_idct8x8_12_add_neon,
253 TX_8X8, 12),
254 make_tuple(&vpx_fdct8x8_c,
255 &vpx_idct8x8_64_add_c,
256 &vpx_idct8x8_1_add_neon,
257 TX_8X8, 1),
258 make_tuple(&vpx_fdct4x4_c,
259 &vpx_idct4x4_16_add_c,
260 &vpx_idct4x4_1_add_neon,
261 TX_4X4, 1)));
262#endif // HAVE_NEON && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE208#endif // HAVE_NEON && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
263 209
264#if HAVE_SSE2 && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE210#if HAVE_SSE2 && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
265INSTANTIATE_TEST_CASE_P(211INSTANTIATE_TEST_CASE_P(
266 SSE2, PartialIDctTest,212 SSE2, PartialIDctTest,
267 ::testing::Values(213 ::testing::Values(make_tuple(&vpx_fdct32x32_c, &vpx_idct32x32_1024_add_c,
268 make_tuple(&vpx_fdct32x32_c,214 &vpx_idct32x32_34_add_sse2, TX_32X32, 34),
269 &vpx_idct32x32_1024_add_c,215 make_tuple(&vpx_fdct32x32_c, &vpx_idct32x32_1024_add_c,
270 &vpx_idct32x32_34_add_sse2,216 &vpx_idct32x32_1_add_sse2, TX_32X32, 1),
271 TX_32X32, 34),217 make_tuple(&vpx_fdct16x16_c, &vpx_idct16x16_256_add_c,
272 make_tuple(&vpx_fdct32x32_c,218 &vpx_idct16x16_10_add_sse2, TX_16X16, 10),
273 &vpx_idct32x32_1024_add_c,219 make_tuple(&vpx_fdct16x16_c, &vpx_idct16x16_256_add_c,
274 &vpx_idct32x32_1_add_sse2,220 &vpx_idct16x16_1_add_sse2, TX_16X16, 1),
275 TX_32X32, 1),221 make_tuple(&vpx_fdct8x8_c, &vpx_idct8x8_64_add_c,
276 make_tuple(&vpx_fdct16x16_c,222 &vpx_idct8x8_12_add_sse2, TX_8X8, 12),
277 &vpx_idct16x16_256_add_c,223 make_tuple(&vpx_fdct8x8_c, &vpx_idct8x8_64_add_c,
278 &vpx_idct16x16_10_add_sse2,224 &vpx_idct8x8_1_add_sse2, TX_8X8, 1),
279 TX_16X16, 10),225 make_tuple(&vpx_fdct4x4_c, &vpx_idct4x4_16_add_c,
280 make_tuple(&vpx_fdct16x16_c,226 &vpx_idct4x4_1_add_sse2, TX_4X4, 1)));
281 &vpx_idct16x16_256_add_c,
282 &vpx_idct16x16_1_add_sse2,
283 TX_16X16, 1),
284 make_tuple(&vpx_fdct8x8_c,
285 &vpx_idct8x8_64_add_c,
286 &vpx_idct8x8_12_add_sse2,
287 TX_8X8, 12),
288 make_tuple(&vpx_fdct8x8_c,
289 &vpx_idct8x8_64_add_c,
290 &vpx_idct8x8_1_add_sse2,
291 TX_8X8, 1),
292 make_tuple(&vpx_fdct4x4_c,
293 &vpx_idct4x4_16_add_c,
294 &vpx_idct4x4_1_add_sse2,
295 TX_4X4, 1)));
296#endif227#endif
297 228
298#if HAVE_SSSE3 && ARCH_X86_64 && \229#if HAVE_SSSE3 && ARCH_X86_64 && !CONFIG_VP9_HIGHBITDEPTH && \
299 !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE230 !CONFIG_EMULATE_HARDWARE
300INSTANTIATE_TEST_CASE_P(231INSTANTIATE_TEST_CASE_P(
301 SSSE3_64, PartialIDctTest,232 SSSE3_64, PartialIDctTest,
302 ::testing::Values(233 ::testing::Values(make_tuple(&vpx_fdct8x8_c, &vpx_idct8x8_64_add_c,
303 make_tuple(&vpx_fdct8x8_c,234 &vpx_idct8x8_12_add_ssse3, TX_8X8, 12)));
304 &vpx_idct8x8_64_add_c,
305 &vpx_idct8x8_12_add_ssse3,
306 TX_8X8, 12)));
307#endif235#endif
308 236
309#if HAVE_MSA && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE237#if HAVE_MSA && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
310INSTANTIATE_TEST_CASE_P(238INSTANTIATE_TEST_CASE_P(
311 MSA, PartialIDctTest,239 MSA, PartialIDctTest,
312 ::testing::Values(240 ::testing::Values(make_tuple(&vpx_fdct32x32_c, &vpx_idct32x32_1024_add_c,
313 make_tuple(&vpx_fdct32x32_c,241 &vpx_idct32x32_34_add_msa, TX_32X32, 34),
314 &vpx_idct32x32_1024_add_c,242 make_tuple(&vpx_fdct32x32_c, &vpx_idct32x32_1024_add_c,
315 &vpx_idct32x32_34_add_msa,243 &vpx_idct32x32_1_add_msa, TX_32X32, 1),
316 TX_32X32, 34),244 make_tuple(&vpx_fdct16x16_c, &vpx_idct16x16_256_add_c,
317 make_tuple(&vpx_fdct32x32_c,245 &vpx_idct16x16_10_add_msa, TX_16X16, 10),
318 &vpx_idct32x32_1024_add_c,246 make_tuple(&vpx_fdct16x16_c, &vpx_idct16x16_256_add_c,
319 &vpx_idct32x32_1_add_msa,247 &vpx_idct16x16_1_add_msa, TX_16X16, 1),
320 TX_32X32, 1),248 make_tuple(&vpx_fdct8x8_c, &vpx_idct8x8_64_add_c,
321 make_tuple(&vpx_fdct16x16_c,249 &vpx_idct8x8_12_add_msa, TX_8X8, 10),
322 &vpx_idct16x16_256_add_c,250 make_tuple(&vpx_fdct8x8_c, &vpx_idct8x8_64_add_c,
323 &vpx_idct16x16_10_add_msa,251 &vpx_idct8x8_1_add_msa, TX_8X8, 1),
324 TX_16X16, 10),252 make_tuple(&vpx_fdct4x4_c, &vpx_idct4x4_16_add_c,
325 make_tuple(&vpx_fdct16x16_c,253 &vpx_idct4x4_1_add_msa, TX_4X4, 1)));
326 &vpx_idct16x16_256_add_c,
327 &vpx_idct16x16_1_add_msa,
328 TX_16X16, 1),
329 make_tuple(&vpx_fdct8x8_c,
330 &vpx_idct8x8_64_add_c,
331 &vpx_idct8x8_12_add_msa,
332 TX_8X8, 10),
333 make_tuple(&vpx_fdct8x8_c,
334 &vpx_idct8x8_64_add_c,
335 &vpx_idct8x8_1_add_msa,
336 TX_8X8, 1),
337 make_tuple(&vpx_fdct4x4_c,
338 &vpx_idct4x4_16_add_c,
339 &vpx_idct4x4_1_add_msa,
340 TX_4X4, 1)));
341#endif // HAVE_MSA && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE254#endif // HAVE_MSA && !CONFIG_VP9_HIGHBITDEPTH && !CONFIG_EMULATE_HARDWARE
342 255
343} // namespace256} // namespace
test/pp_filter_test.cc+18−22
@@ -15,22 +15,16 @@ · 14 unmodified lines
15#include "vpx/vpx_integer.h"15#include "vpx/vpx_integer.h"
16#include "vpx_mem/vpx_mem.h"16#include "vpx_mem/vpx_mem.h"
17 17
18typedef void (*PostProcFunc)(unsigned char *src_ptr,18typedef void (*PostProcFunc)(unsigned char *src_ptr, unsigned char *dst_ptr,
19 unsigned char *dst_ptr,19 int src_pixels_per_line, int dst_pixels_per_line,
20 int src_pixels_per_line,20 int cols, unsigned char *flimit, int size);
21 int dst_pixels_per_line,
22 int cols,
23 unsigned char *flimit,
24 int size);
25 21
26namespace {22namespace {
27 23
28class VPxPostProcessingFilterTest24class VPxPostProcessingFilterTest
29 : public ::testing::TestWithParam<PostProcFunc> {25 : public ::testing::TestWithParam<PostProcFunc> {
30 public:26 public:
31 virtual void TearDown() {27 virtual void TearDown() { libvpx_test::ClearSystemState(); }
32 libvpx_test::ClearSystemState();
33 }
34};28};
35 29
36// Test routine for the VPx post-processing function30// Test routine for the VPx post-processing function
@@ -38,7 +32,7 @@ class VPxPostProcessingFilterTest · 1 unmodified line
38 32
39TEST_P(VPxPostProcessingFilterTest, FilterOutputCheck) {33TEST_P(VPxPostProcessingFilterTest, FilterOutputCheck) {
40 // Size of the underlying data block that will be filtered.34 // Size of the underlying data block that will be filtered.
41 const int block_width = 16;35 const int block_width = 16;
42 const int block_height = 16;36 const int block_height = 16;
43 37
44 // 5-tap filter needs 2 padding rows above and below the block in the input.38 // 5-tap filter needs 2 padding rows above and below the block in the input.
@@ -54,9 +48,9 @@ TEST_P(VPxPostProcessingFilterTest, FilterOutputCheck) { · 9 unmodified lines
54 const int output_size = output_width * output_height;48 const int output_size = output_width * output_height;
55 49
56 uint8_t *const src_image =50 uint8_t *const src_image =
57 reinterpret_cast<uint8_t*>(vpx_calloc(input_size, 1));51 reinterpret_cast<uint8_t *>(vpx_calloc(input_size, 1));
58 uint8_t *const dst_image =52 uint8_t *const dst_image =
59 reinterpret_cast<uint8_t*>(vpx_calloc(output_size, 1));53 reinterpret_cast<uint8_t *>(vpx_calloc(output_size, 1));
60 54
61 // Pointers to top-left pixel of block in the input and output images.55 // Pointers to top-left pixel of block in the input and output images.
62 uint8_t *const src_image_ptr = src_image + (input_stride << 1);56 uint8_t *const src_image_ptr = src_image + (input_stride << 1);
@@ -80,13 +74,12 @@ TEST_P(VPxPostProcessingFilterTest, FilterOutputCheck) { · 17 unmodified lines
80 // Initialize pixels in the output to 99.74 // Initialize pixels in the output to 99.
81 (void)memset(dst_image, 99, output_size);75 (void)memset(dst_image, 99, output_size);
82 76
83 ASM_REGISTER_STATE_CHECK(77 ASM_REGISTER_STATE_CHECK(GetParam()(src_image_ptr, dst_image_ptr,
84 GetParam()(src_image_ptr, dst_image_ptr, input_stride,78 input_stride, output_stride, block_width,
85 output_stride, block_width, flimits, 16));79 flimits, 16));
86 80
87 static const uint8_t expected_data[block_height] = {81 static const uint8_t expected_data[block_height] = { 4, 3, 1, 1, 1, 1, 1, 1,
88 4, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 482 1, 1, 1, 1, 1, 1, 3, 4 };
89 };
90 83
91 pixel_ptr = dst_image_ptr;84 pixel_ptr = dst_image_ptr;
92 for (int i = 0; i < block_height; ++i) {85 for (int i = 0; i < block_height; ++i) {
@@ -102,16 +95,19 @@ TEST_P(VPxPostProcessingFilterTest, FilterOutputCheck) { · 9 unmodified lines
102 vpx_free(flimits);95 vpx_free(flimits);
103};96};
104 97
105INSTANTIATE_TEST_CASE_P(C, VPxPostProcessingFilterTest,98INSTANTIATE_TEST_CASE_P(
99 C, VPxPostProcessingFilterTest,
106 ::testing::Values(vpx_post_proc_down_and_across_mb_row_c));100 ::testing::Values(vpx_post_proc_down_and_across_mb_row_c));
107 101
108#if HAVE_SSE2102#if HAVE_SSE2
109INSTANTIATE_TEST_CASE_P(SSE2, VPxPostProcessingFilterTest,103INSTANTIATE_TEST_CASE_P(
104 SSE2, VPxPostProcessingFilterTest,
110 ::testing::Values(vpx_post_proc_down_and_across_mb_row_sse2));105 ::testing::Values(vpx_post_proc_down_and_across_mb_row_sse2));
111#endif106#endif
112 107
113#if HAVE_MSA108#if HAVE_MSA
114INSTANTIATE_TEST_CASE_P(MSA, VPxPostProcessingFilterTest,109INSTANTIATE_TEST_CASE_P(
110 MSA, VPxPostProcessingFilterTest,
115 ::testing::Values(vpx_post_proc_down_and_across_mb_row_msa));111 ::testing::Values(vpx_post_proc_down_and_across_mb_row_msa));
116#endif112#endif
117 113
test/realtime_test.cc+1−2
@@ -23,8 +23,7 @@ class RealtimeTest · 22 unmodified lines
23 : public ::libvpx_test::EncoderTest,23 : public ::libvpx_test::EncoderTest,
24 public ::libvpx_test::CodecTestWithParam<libvpx_test::TestMode> {24 public ::libvpx_test::CodecTestWithParam<libvpx_test::TestMode> {
25 protected:25 protected:
26 RealtimeTest()26 RealtimeTest() : EncoderTest(GET_PARAM(0)), frame_packets_(0) {}
27 : EncoderTest(GET_PARAM(0)), frame_packets_(0) {}
28 virtual ~RealtimeTest() {}27 virtual ~RealtimeTest() {}
29 28
30 virtual void SetUp() {29 virtual void SetUp() {
test/register_state_check.h+23−20
@@ -36,7 +36,7 @@ · 35 unmodified lines
36#include <windows.h>36#include <windows.h>
37#include <winnt.h>37#include <winnt.h>
38 38
39inline bool operator==(const M128A& lhs, const M128A& rhs) {39inline bool operator==(const M128A &lhs, const M128A &rhs) {
40 return (lhs.Low == rhs.Low && lhs.High == rhs.High);40 return (lhs.Low == rhs.Low && lhs.High == rhs.High);
41}41}
42 42
@@ -51,7 +51,7 @@ class RegisterStateCheck { · 8 unmodified lines
51 ~RegisterStateCheck() { Check(); }51 ~RegisterStateCheck() { Check(); }
52 52
53 private:53 private:
54 static bool StoreRegisters(CONTEXT* const context) {54 static bool StoreRegisters(CONTEXT *const context) {
55 const HANDLE this_thread = GetCurrentThread();55 const HANDLE this_thread = GetCurrentThread();
56 EXPECT_TRUE(this_thread != NULL);56 EXPECT_TRUE(this_thread != NULL);
57 context->ContextFlags = CONTEXT_FLOATING_POINT;57 context->ContextFlags = CONTEXT_FLOATING_POINT;
@@ -66,8 +66,8 @@ class RegisterStateCheck { · 8 unmodified lines
66 CONTEXT post_context;66 CONTEXT post_context;
67 ASSERT_TRUE(StoreRegisters(&post_context));67 ASSERT_TRUE(StoreRegisters(&post_context));
68 68
69 const M128A* xmm_pre = &pre_context_.Xmm6;69 const M128A *xmm_pre = &pre_context_.Xmm6;
70 const M128A* xmm_post = &post_context.Xmm6;70 const M128A *xmm_post = &post_context.Xmm6;
71 for (int i = 6; i <= 15; ++i) {71 for (int i = 6; i <= 15; ++i) {
72 EXPECT_EQ(*xmm_pre, *xmm_post) << "xmm" << i << " has been modified!";72 EXPECT_EQ(*xmm_pre, *xmm_post) << "xmm" << i << " has been modified!";
73 ++xmm_pre;73 ++xmm_pre;
@@ -79,15 +79,16 @@ class RegisterStateCheck { · 5 unmodified lines
79 CONTEXT pre_context_;79 CONTEXT pre_context_;
80};80};
81 81
82#define ASM_REGISTER_STATE_CHECK(statement) do { \82#define ASM_REGISTER_STATE_CHECK(statement) \
83 libvpx_test::RegisterStateCheck reg_check; \83 do { \
84 statement; \84 libvpx_test::RegisterStateCheck reg_check; \
85} while (false)85 statement; \
86 } while (false)
86 87
87} // namespace libvpx_test88} // namespace libvpx_test
88 89
89#elif defined(CONFIG_SHARED) && defined(HAVE_NEON_ASM) && defined(CONFIG_VP9) \90#elif defined(CONFIG_SHARED) && defined(HAVE_NEON_ASM) && \
90 && !CONFIG_SHARED && HAVE_NEON_ASM && CONFIG_VP991 defined(CONFIG_VP9) && !CONFIG_SHARED && HAVE_NEON_ASM && CONFIG_VP9
91 92
92extern "C" {93extern "C" {
93// Save the d8-d15 registers into store.94// Save the d8-d15 registers into store.
@@ -110,18 +111,19 @@ class RegisterStateCheck { · 16 unmodified lines
110 int64_t post_store[8];111 int64_t post_store[8];
111 vpx_push_neon(post_store);112 vpx_push_neon(post_store);
112 for (int i = 0; i < 8; ++i) {113 for (int i = 0; i < 8; ++i) {
113 EXPECT_EQ(pre_store_[i], post_store[i]) << "d"114 EXPECT_EQ(pre_store_[i], post_store[i]) << "d" << i + 8
114 << i + 8 << " has been modified";115 << " has been modified";
115 }116 }
116 }117 }
117 118
118 int64_t pre_store_[8];119 int64_t pre_store_[8];
119};120};
120 121
121#define ASM_REGISTER_STATE_CHECK(statement) do { \122#define ASM_REGISTER_STATE_CHECK(statement) \
122 libvpx_test::RegisterStateCheck reg_check; \123 do { \
123 statement; \124 libvpx_test::RegisterStateCheck reg_check; \
124} while (false)125 statement; \
126 } while (false)
125 127
126} // namespace libvpx_test128} // namespace libvpx_test
127 129
@@ -165,10 +167,11 @@ class RegisterStateCheckMMX { · 37 unmodified lines
165 uint16_t pre_fpu_env_[14];167 uint16_t pre_fpu_env_[14];
166};168};
167 169
168#define API_REGISTER_STATE_CHECK(statement) do { \170#define API_REGISTER_STATE_CHECK(statement) \
169 libvpx_test::RegisterStateCheckMMX reg_check; \171 do { \
170 ASM_REGISTER_STATE_CHECK(statement); \172 libvpx_test::RegisterStateCheckMMX reg_check; \
171} while (false)173 ASM_REGISTER_STATE_CHECK(statement); \
174 } while (false)
172 175
173} // namespace libvpx_test176} // namespace libvpx_test
174 177
test/resize_test.cc+43−60
@@ -44,9 +44,9 @@ static void write_ivf_file_header(const vpx_codec_enc_cfg_t *const cfg, · 43 unmodified lines
44 header[1] = 'K';44 header[1] = 'K';
45 header[2] = 'I';45 header[2] = 'I';
46 header[3] = 'F';46 header[3] = 'F';
47 mem_put_le16(header + 4, 0); /* version */47 mem_put_le16(header + 4, 0); /* version */
48 mem_put_le16(header + 6, 32); /* headersize */48 mem_put_le16(header + 6, 32); /* headersize */
49 mem_put_le32(header + 8, 0x30395056); /* fourcc (vp9) */49 mem_put_le32(header + 8, 0x30395056); /* fourcc (vp9) */
50 mem_put_le16(header + 12, cfg->g_w); /* width */50 mem_put_le16(header + 12, cfg->g_w); /* width */
51 mem_put_le16(header + 14, cfg->g_h); /* height */51 mem_put_le16(header + 14, cfg->g_h); /* height */
52 mem_put_le32(header + 16, cfg->g_timebase.den); /* rate */52 mem_put_le32(header + 16, cfg->g_timebase.den); /* rate */
@@ -68,8 +68,7 @@ static void write_ivf_frame_header(const vpx_codec_cx_pkt_t *const pkt, · 15 unmodified lines
68 char header[12];68 char header[12];
69 vpx_codec_pts_t pts;69 vpx_codec_pts_t pts;
70 70
71 if (pkt->kind != VPX_CODEC_CX_FRAME_PKT)71 if (pkt->kind != VPX_CODEC_CX_FRAME_PKT) return;
72 return;
73 72
74 pts = pkt->data.frame.pts;73 pts = pkt->data.frame.pts;
75 mem_put_le32(header, static_cast<unsigned int>(pkt->data.frame.sz));74 mem_put_le32(header, static_cast<unsigned int>(pkt->data.frame.sz));
@@ -92,12 +91,9 @@ struct FrameInfo { · 16 unmodified lines
92 unsigned int h;91 unsigned int h;
93};92};
94 93
95void ScaleForFrameNumber(unsigned int frame,94void ScaleForFrameNumber(unsigned int frame, unsigned int initial_w,
96 unsigned int initial_w,95 unsigned int initial_h, unsigned int *w,
97 unsigned int initial_h,96 unsigned int *h, int flag_codec) {
98 unsigned int *w,
99 unsigned int *h,
100 int flag_codec) {
101 if (frame < 10) {97 if (frame < 10) {
102 *w = initial_w;98 *w = initial_w;
103 *h = initial_h;99 *h = initial_h;
@@ -219,7 +215,7 @@ void ScaleForFrameNumber(unsigned int frame, · 115 unmodified lines
219 return;215 return;
220 }216 }
221 if (frame < 250) {217 if (frame < 250) {
222 *w = initial_w / 2;218 *w = initial_w / 2;
223 *h = initial_h / 2;219 *h = initial_h / 2;
224 return;220 return;
225 }221 }
@@ -268,8 +264,9 @@ class ResizingVideoSource : public ::libvpx_test::DummyVideoSource { · 42 unmodified lines
268 }264 }
269};265};
270 266
271class ResizeTest : public ::libvpx_test::EncoderTest,267class ResizeTest
272 public ::libvpx_test::CodecTestWithParam<libvpx_test::TestMode> {268 : public ::libvpx_test::EncoderTest,
269 public ::libvpx_test::CodecTestWithParam<libvpx_test::TestMode> {
273 protected:270 protected:
274 ResizeTest() : EncoderTest(GET_PARAM(0)) {}271 ResizeTest() : EncoderTest(GET_PARAM(0)) {}
275 272
@@ -285,7 +282,7 @@ class ResizeTest : public ::libvpx_test::EncoderTest, · 9 unmodified lines
285 frame_info_list_.push_back(FrameInfo(pts, img.d_w, img.d_h));282 frame_info_list_.push_back(FrameInfo(pts, img.d_w, img.d_h));
286 }283 }
287 284
288 std::vector< FrameInfo > frame_info_list_;285 std::vector<FrameInfo> frame_info_list_;
289};286};
290 287
291TEST_P(ResizeTest, TestExternalResizeWorks) {288TEST_P(ResizeTest, TestExternalResizeWorks) {
@@ -299,12 +296,12 @@ TEST_P(ResizeTest, TestExternalResizeWorks) { · 7 unmodified lines
299 const unsigned int frame = static_cast<unsigned>(info->pts);296 const unsigned int frame = static_cast<unsigned>(info->pts);
300 unsigned int expected_w;297 unsigned int expected_w;
301 unsigned int expected_h;298 unsigned int expected_h;
302 ScaleForFrameNumber(frame, kInitialWidth, kInitialHeight,299 ScaleForFrameNumber(frame, kInitialWidth, kInitialHeight, &expected_w,
303 &expected_w, &expected_h, 0);300 &expected_h, 0);
304 EXPECT_EQ(expected_w, info->w)301 EXPECT_EQ(expected_w, info->w) << "Frame " << frame
305 << "Frame " << frame << " had unexpected width";302 << " had unexpected width";
306 EXPECT_EQ(expected_h, info->h)303 EXPECT_EQ(expected_h, info->h) << "Frame " << frame
307 << "Frame " << frame << " had unexpected height";304 << " had unexpected height";
308 }305 }
309}306}
310 307
@@ -315,10 +312,7 @@ class ResizeInternalTest : public ResizeTest { · 4 unmodified lines
315 protected:312 protected:
316#if WRITE_COMPRESSED_STREAM313#if WRITE_COMPRESSED_STREAM
317 ResizeInternalTest()314 ResizeInternalTest()
318 : ResizeTest(),315 : ResizeTest(), frame0_psnr_(0.0), outfile_(NULL), out_frames_(0) {}
319 frame0_psnr_(0.0),
320 outfile_(NULL),
321 out_frames_(0) {}
322#else316#else
323 ResizeInternalTest() : ResizeTest(), frame0_psnr_(0.0) {}317 ResizeInternalTest() : ResizeTest(), frame0_psnr_(0.0) {}
324#endif318#endif
@@ -347,30 +341,29 @@ class ResizeInternalTest : public ResizeTest { · 22 unmodified lines
347 if (change_config_) {341 if (change_config_) {
348 int new_q = 60;342 int new_q = 60;
349 if (video->frame() == 0) {343 if (video->frame() == 0) {
350 struct vpx_scaling_mode mode = {VP8E_ONETWO, VP8E_ONETWO};344 struct vpx_scaling_mode mode = { VP8E_ONETWO, VP8E_ONETWO };
351 encoder->Control(VP8E_SET_SCALEMODE, &mode);345 encoder->Control(VP8E_SET_SCALEMODE, &mode);
352 }346 }
353 if (video->frame() == 1) {347 if (video->frame() == 1) {
354 struct vpx_scaling_mode mode = {VP8E_NORMAL, VP8E_NORMAL};348 struct vpx_scaling_mode mode = { VP8E_NORMAL, VP8E_NORMAL };
355 encoder->Control(VP8E_SET_SCALEMODE, &mode);349 encoder->Control(VP8E_SET_SCALEMODE, &mode);
356 cfg_.rc_min_quantizer = cfg_.rc_max_quantizer = new_q;350 cfg_.rc_min_quantizer = cfg_.rc_max_quantizer = new_q;
357 encoder->Config(&cfg_);351 encoder->Config(&cfg_);
358 }352 }
359 } else {353 } else {
360 if (video->frame() == kStepDownFrame) {354 if (video->frame() == kStepDownFrame) {
361 struct vpx_scaling_mode mode = {VP8E_FOURFIVE, VP8E_THREEFIVE};355 struct vpx_scaling_mode mode = { VP8E_FOURFIVE, VP8E_THREEFIVE };
362 encoder->Control(VP8E_SET_SCALEMODE, &mode);356 encoder->Control(VP8E_SET_SCALEMODE, &mode);
363 }357 }
364 if (video->frame() == kStepUpFrame) {358 if (video->frame() == kStepUpFrame) {
365 struct vpx_scaling_mode mode = {VP8E_NORMAL, VP8E_NORMAL};359 struct vpx_scaling_mode mode = { VP8E_NORMAL, VP8E_NORMAL };
366 encoder->Control(VP8E_SET_SCALEMODE, &mode);360 encoder->Control(VP8E_SET_SCALEMODE, &mode);
367 }361 }
368 }362 }
369 }363 }
370 364
371 virtual void PSNRPktHook(const vpx_codec_cx_pkt_t *pkt) {365 virtual void PSNRPktHook(const vpx_codec_cx_pkt_t *pkt) {
372 if (frame0_psnr_ == 0.)366 if (frame0_psnr_ == 0.) frame0_psnr_ = pkt->data.psnr.psnr[0];
373 frame0_psnr_ = pkt->data.psnr.psnr[0];
374 EXPECT_NEAR(pkt->data.psnr.psnr[0], frame0_psnr_, 2.0);367 EXPECT_NEAR(pkt->data.psnr.psnr[0], frame0_psnr_, 2.0);
375 }368 }
376 369
@@ -379,8 +372,7 @@ class ResizeInternalTest : public ResizeTest { · 2 unmodified lines
379 ++out_frames_;372 ++out_frames_;
380 373
381 // Write initial file header if first frame.374 // Write initial file header if first frame.
382 if (pkt->data.frame.pts == 0)375 if (pkt->data.frame.pts == 0) write_ivf_file_header(&cfg_, 0, outfile_);
383 write_ivf_file_header(&cfg_, 0, outfile_);
384 376
385 // Write frame header and data.377 // Write frame header and data.
386 write_ivf_frame_header(pkt, outfile_);378 write_ivf_frame_header(pkt, outfile_);
@@ -434,8 +426,9 @@ TEST_P(ResizeInternalTest, TestInternalResizeChangeConfig) { · 47 unmodified lines
434 ASSERT_NO_FATAL_FAILURE(RunLoop(&video));426 ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
435}427}
436 428
437class ResizeRealtimeTest : public ::libvpx_test::EncoderTest,429class ResizeRealtimeTest
438 public ::libvpx_test::CodecTestWith2Params<libvpx_test::TestMode, int> {430 : public ::libvpx_test::EncoderTest,
431 public ::libvpx_test::CodecTestWith2Params<libvpx_test::TestMode, int> {
439 protected:432 protected:
440 ResizeRealtimeTest() : EncoderTest(GET_PARAM(0)) {}433 ResizeRealtimeTest() : EncoderTest(GET_PARAM(0)) {}
441 virtual ~ResizeRealtimeTest() {}434 virtual ~ResizeRealtimeTest() {}
@@ -465,16 +458,13 @@ class ResizeRealtimeTest : public ::libvpx_test::EncoderTest, · 23 unmodified lines
465 frame_info_list_.push_back(FrameInfo(pts, img.d_w, img.d_h));458 frame_info_list_.push_back(FrameInfo(pts, img.d_w, img.d_h));
466 }459 }
467 460
468 virtual void MismatchHook(const vpx_image_t *img1,461 virtual void MismatchHook(const vpx_image_t *img1, const vpx_image_t *img2) {
469 const vpx_image_t *img2) {
470 double mismatch_psnr = compute_psnr(img1, img2);462 double mismatch_psnr = compute_psnr(img1, img2);
471 mismatch_psnr_ += mismatch_psnr;463 mismatch_psnr_ += mismatch_psnr;
472 ++mismatch_nframes_;464 ++mismatch_nframes_;
473 }465 }
474 466
475 unsigned int GetMismatchFrames() {467 unsigned int GetMismatchFrames() { return mismatch_nframes_; }
476 return mismatch_nframes_;
477 }
478 468
479 void DefaultConfig() {469 void DefaultConfig() {
480 cfg_.rc_buf_initial_sz = 500;470 cfg_.rc_buf_initial_sz = 500;
@@ -491,14 +481,14 @@ class ResizeRealtimeTest : public ::libvpx_test::EncoderTest, · 10 unmodified lines
491 // Enable dropped frames.481 // Enable dropped frames.
492 cfg_.rc_dropframe_thresh = 1;482 cfg_.rc_dropframe_thresh = 1;
493 // Enable error_resilience mode.483 // Enable error_resilience mode.
494 cfg_.g_error_resilient = 1;484 cfg_.g_error_resilient = 1;
495 // Enable dynamic resizing.485 // Enable dynamic resizing.
496 cfg_.rc_resize_allowed = 1;486 cfg_.rc_resize_allowed = 1;
497 // Run at low bitrate.487 // Run at low bitrate.
498 cfg_.rc_target_bitrate = 200;488 cfg_.rc_target_bitrate = 200;
499 }489 }
500 490
501 std::vector< FrameInfo > frame_info_list_;491 std::vector<FrameInfo> frame_info_list_;
502 int set_cpu_used_;492 int set_cpu_used_;
503 bool change_bitrate_;493 bool change_bitrate_;
504 double mismatch_psnr_;494 double mismatch_psnr_;
@@ -521,12 +511,12 @@ TEST_P(ResizeRealtimeTest, TestExternalResizeWorks) { · 16 unmodified lines
521 const unsigned int frame = static_cast<unsigned>(info->pts);511 const unsigned int frame = static_cast<unsigned>(info->pts);
522 unsigned int expected_w;512 unsigned int expected_w;
523 unsigned int expected_h;513 unsigned int expected_h;
524 ScaleForFrameNumber(frame, kInitialWidth, kInitialHeight,514 ScaleForFrameNumber(frame, kInitialWidth, kInitialHeight, &expected_w,
525 &expected_w, &expected_h, 1);515 &expected_h, 1);
526 EXPECT_EQ(expected_w, info->w)516 EXPECT_EQ(expected_w, info->w) << "Frame " << frame
527 << "Frame " << frame << " had unexpected width";517 << " had unexpected width";
528 EXPECT_EQ(expected_h, info->h)518 EXPECT_EQ(expected_h, info->h) << "Frame " << frame
529 << "Frame " << frame << " had unexpected height";519 << " had unexpected height";
530 EXPECT_EQ(static_cast<unsigned int>(0), GetMismatchFrames());520 EXPECT_EQ(static_cast<unsigned int>(0), GetMismatchFrames());
531 }521 }
532}522}
@@ -618,10 +608,8 @@ TEST_P(ResizeRealtimeTest, TestInternalResizeDownUpChangeBitRate) { · 85 unmodified lines
618}608}
619 609
620vpx_img_fmt_t CspForFrameNumber(int frame) {610vpx_img_fmt_t CspForFrameNumber(int frame) {
621 if (frame < 10)611 if (frame < 10) return VPX_IMG_FMT_I420;
622 return VPX_IMG_FMT_I420;612 if (frame < 20) return VPX_IMG_FMT_I444;
623 if (frame < 20)
624 return VPX_IMG_FMT_I444;
625 return VPX_IMG_FMT_I420;613 return VPX_IMG_FMT_I420;
626}614}
627 615
@@ -629,10 +617,7 @@ class ResizeCspTest : public ResizeTest { · 1 unmodified line
629 protected:617 protected:
630#if WRITE_COMPRESSED_STREAM618#if WRITE_COMPRESSED_STREAM
631 ResizeCspTest()619 ResizeCspTest()
632 : ResizeTest(),620 : ResizeTest(), frame0_psnr_(0.0), outfile_(NULL), out_frames_(0) {}
633 frame0_psnr_(0.0),
634 outfile_(NULL),
635 out_frames_(0) {}
636#else621#else
637 ResizeCspTest() : ResizeTest(), frame0_psnr_(0.0) {}622 ResizeCspTest() : ResizeTest(), frame0_psnr_(0.0) {}
638#endif623#endif
@@ -671,8 +656,7 @@ class ResizeCspTest : public ResizeTest { · 32 unmodified lines
671 }656 }
672 657
673 virtual void PSNRPktHook(const vpx_codec_cx_pkt_t *pkt) {658 virtual void PSNRPktHook(const vpx_codec_cx_pkt_t *pkt) {
674 if (frame0_psnr_ == 0.)659 if (frame0_psnr_ == 0.) frame0_psnr_ = pkt->data.psnr.psnr[0];
675 frame0_psnr_ = pkt->data.psnr.psnr[0];
676 EXPECT_NEAR(pkt->data.psnr.psnr[0], frame0_psnr_, 2.0);660 EXPECT_NEAR(pkt->data.psnr.psnr[0], frame0_psnr_, 2.0);
677 }661 }
678 662
@@ -681,8 +665,7 @@ class ResizeCspTest : public ResizeTest { · 2 unmodified lines
681 ++out_frames_;665 ++out_frames_;
682 666
683 // Write initial file header if first frame.667 // Write initial file header if first frame.
684 if (pkt->data.frame.pts == 0)668 if (pkt->data.frame.pts == 0) write_ivf_file_header(&cfg_, 0, outfile_);
685 write_ivf_file_header(&cfg_, 0, outfile_);
686 669
687 // Write frame header and data.670 // Write frame header and data.
688 write_ivf_frame_header(pkt, outfile_);671 write_ivf_frame_header(pkt, outfile_);
test/sad_test.cc+18−20
@@ -8,7 +8,6 @@ · 7 unmodified lines
8 * be found in the AUTHORS file in the root of the source tree.8 * be found in the AUTHORS file in the root of the source tree.
9 */9 */
10 10
11
12#include <string.h>11#include <string.h>
13#include <limits.h>12#include <limits.h>
14#include <stdio.h>13#include <stdio.h>
@@ -25,7 +24,7 @@ · 10 unmodified lines
25#include "vpx_mem/vpx_mem.h"24#include "vpx_mem/vpx_mem.h"
26#include "vpx_ports/mem.h"25#include "vpx_ports/mem.h"
27 26
28template<typename Function>27template <typename Function>
29struct TestParams {28struct TestParams {
30 TestParams(int w, int h, Function f, int bd = -1)29 TestParams(int w, int h, Function f, int bd = -1)
31 : width(w), height(h), bit_depth(bd), func(f) {}30 : width(w), height(h), bit_depth(bd), func(f) {}
@@ -50,24 +49,24 @@ typedef TestParams<SadMxNx4Func> SadMxNx4Param; · 18 unmodified lines
50using libvpx_test::ACMRandom;49using libvpx_test::ACMRandom;
51 50
52namespace {51namespace {
53template<typename ParamType>52template <typename ParamType>
54class SADTestBase : public ::testing::TestWithParam<ParamType> {53class SADTestBase : public ::testing::TestWithParam<ParamType> {
55 public:54 public:
56 explicit SADTestBase(const ParamType& params) : params_(params) {}55 explicit SADTestBase(const ParamType &params) : params_(params) {}
57 56
58 virtual void SetUp() {57 virtual void SetUp() {
59 source_data8_ = reinterpret_cast<uint8_t*>(58 source_data8_ = reinterpret_cast<uint8_t *>(
60 vpx_memalign(kDataAlignment, kDataBlockSize));59 vpx_memalign(kDataAlignment, kDataBlockSize));
61 reference_data8_ = reinterpret_cast<uint8_t*>(60 reference_data8_ = reinterpret_cast<uint8_t *>(
62 vpx_memalign(kDataAlignment, kDataBufferSize));61 vpx_memalign(kDataAlignment, kDataBufferSize));
63 second_pred8_ = reinterpret_cast<uint8_t*>(62 second_pred8_ =
64 vpx_memalign(kDataAlignment, 64*64));63 reinterpret_cast<uint8_t *>(vpx_memalign(kDataAlignment, 64 * 64));
65 source_data16_ = reinterpret_cast<uint16_t*>(64 source_data16_ = reinterpret_cast<uint16_t *>(
66 vpx_memalign(kDataAlignment, kDataBlockSize*sizeof(uint16_t)));65 vpx_memalign(kDataAlignment, kDataBlockSize * sizeof(uint16_t)));
67 reference_data16_ = reinterpret_cast<uint16_t*>(66 reference_data16_ = reinterpret_cast<uint16_t *>(
68 vpx_memalign(kDataAlignment, kDataBufferSize*sizeof(uint16_t)));67 vpx_memalign(kDataAlignment, kDataBufferSize * sizeof(uint16_t)));
69 second_pred16_ = reinterpret_cast<uint16_t*>(68 second_pred16_ = reinterpret_cast<uint16_t *>(
70 vpx_memalign(kDataAlignment, 64*64*sizeof(uint16_t)));69 vpx_memalign(kDataAlignment, 64 * 64 * sizeof(uint16_t)));
71 70
72 if (params_.bit_depth == -1) {71 if (params_.bit_depth == -1) {
73 use_high_bit_depth_ = false;72 use_high_bit_depth_ = false;
@@ -167,13 +166,13 @@ class SADTestBase : public ::testing::TestWithParam<ParamType> { · 93 unmodified lines
167 for (int w = 0; w < params_.width; ++w) {166 for (int w = 0; w < params_.width; ++w) {
168 if (!use_high_bit_depth_) {167 if (!use_high_bit_depth_) {
169 const int tmp = second_pred8[h * params_.width + w] +168 const int tmp = second_pred8[h * params_.width + w] +
170 reference8[h * reference_stride_ + w];169 reference8[h * reference_stride_ + w];
171 const uint8_t comp_pred = ROUND_POWER_OF_TWO(tmp, 1);170 const uint8_t comp_pred = ROUND_POWER_OF_TWO(tmp, 1);
172 sad += abs(source8[h * source_stride_ + w] - comp_pred);171 sad += abs(source8[h * source_stride_ + w] - comp_pred);
173#if CONFIG_VP9_HIGHBITDEPTH172#if CONFIG_VP9_HIGHBITDEPTH
174 } else {173 } else {
175 const int tmp = second_pred16[h * params_.width + w] +174 const int tmp = second_pred16[h * params_.width + w] +
176 reference16[h * reference_stride_ + w];175 reference16[h * reference_stride_ + w];
177 const uint16_t comp_pred = ROUND_POWER_OF_TWO(tmp, 1);176 const uint16_t comp_pred = ROUND_POWER_OF_TWO(tmp, 1);
178 sad += abs(source16[h * source_stride_ + w] - comp_pred);177 sad += abs(source16[h * source_stride_ + w] - comp_pred);
179#endif // CONFIG_VP9_HIGHBITDEPTH178#endif // CONFIG_VP9_HIGHBITDEPTH
@@ -248,9 +247,8 @@ class SADx4Test : public SADTestBase<SadMxNx4Param> { · 68 unmodified lines
248 const uint8_t *references[] = { GetReference(0), GetReference(1),247 const uint8_t *references[] = { GetReference(0), GetReference(1),
249 GetReference(2), GetReference(3) };248 GetReference(2), GetReference(3) };
250 249
251 ASM_REGISTER_STATE_CHECK(params_.func(source_data_, source_stride_,250 ASM_REGISTER_STATE_CHECK(params_.func(
252 references, reference_stride_,251 source_data_, source_stride_, references, reference_stride_, results));
253 results));
254 }252 }
255 253
256 void CheckSADs() const {254 void CheckSADs() const {
@@ -453,7 +451,7 @@ TEST_P(SADx4Test, ShortSrc) { · 196 unmodified lines
453}451}
454 452
455TEST_P(SADx4Test, SrcAlignedByWidth) {453TEST_P(SADx4Test, SrcAlignedByWidth) {
456 uint8_t * tmp_source_data = source_data_;454 uint8_t *tmp_source_data = source_data_;
457 source_data_ += params_.width;455 source_data_ += params_.width;
458 FillRandom(source_data_, source_stride_);456 FillRandom(source_data_, source_stride_);
459 FillRandom(GetReference(0), reference_stride_);457 FillRandom(GetReference(0), reference_stride_);
test/set_roi.cc+43−53
@@ -8,7 +8,6 @@ · 7 unmodified lines
8 * be found in the AUTHORS file in the root of the source tree.8 * be found in the AUTHORS file in the root of the source tree.
9 */9 */
10 10
11
12#include <math.h>11#include <math.h>
13#include <stddef.h>12#include <stddef.h>
14#include <stdio.h>13#include <stdio.h>
@@ -33,14 +32,10 @@ TEST(VP8RoiMapTest, ParameterCheck) { · 18 unmodified lines
33 unsigned int threshold[MAX_MB_SEGMENTS] = { 0, 100, 200, 300 };32 unsigned int threshold[MAX_MB_SEGMENTS] = { 0, 100, 200, 300 };
34 33
35 const int internalq_trans[] = {34 const int internalq_trans[] = {
36 0, 1, 2, 3, 4, 5, 7, 8,35 0, 1, 2, 3, 4, 5, 7, 8, 9, 10, 12, 13, 15, 17, 18, 19,
37 9, 10, 12, 13, 15, 17, 18, 19,36 20, 21, 23, 24, 25, 26, 27, 28, 29, 30, 31, 33, 35, 37, 39, 41,
38 20, 21, 23, 24, 25, 26, 27, 28,37 43, 45, 47, 49, 51, 53, 55, 57, 59, 61, 64, 67, 70, 73, 76, 79,
39 29, 30, 31, 33, 35, 37, 39, 41,38 82, 85, 88, 91, 94, 97, 100, 103, 106, 109, 112, 115, 118, 121, 124, 127,
40 43, 45, 47, 49, 51, 53, 55, 57,
41 59, 61, 64, 67, 70, 73, 76, 79,
42 82, 85, 88, 91, 94, 97, 100, 103,
43 106, 109, 112, 115, 118, 121, 124, 127,
44 };39 };
45 40
46 // Initialize elements of cpi with valid defaults.41 // Initialize elements of cpi with valid defaults.
@@ -60,17 +55,17 @@ TEST(VP8RoiMapTest, ParameterCheck) { · 13 unmodified lines
60 55
61 // Allocate memory for the source memory map.56 // Allocate memory for the source memory map.
62 unsigned char *roi_map =57 unsigned char *roi_map =
63 reinterpret_cast<unsigned char *>(vpx_calloc(mbs, 1));58 reinterpret_cast<unsigned char *>(vpx_calloc(mbs, 1));
64 memset(&roi_map[mbs >> 2], 1, (mbs >> 2));59 memset(&roi_map[mbs >> 2], 1, (mbs >> 2));
65 memset(&roi_map[mbs >> 1], 2, (mbs >> 2));60 memset(&roi_map[mbs >> 1], 2, (mbs >> 2));
66 memset(&roi_map[mbs -(mbs >> 2)], 3, (mbs >> 2));61 memset(&roi_map[mbs - (mbs >> 2)], 3, (mbs >> 2));
67 62
68 // Do a test call with valid parameters.63 // Do a test call with valid parameters.
69 int roi_retval = vp8_set_roimap(&cpi, roi_map, cpi.common.mb_rows,64 int roi_retval =
70 cpi.common.mb_cols, delta_q, delta_lf,65 vp8_set_roimap(&cpi, roi_map, cpi.common.mb_rows, cpi.common.mb_cols,
71 threshold);66 delta_q, delta_lf, threshold);
72 EXPECT_EQ(0, roi_retval)67 EXPECT_EQ(0, roi_retval)
73 << "vp8_set_roimap roi failed with default test parameters";68 << "vp8_set_roimap roi failed with default test parameters";
74 69
75 // Check that the values in the cpi structure get set as expected.70 // Check that the values in the cpi structure get set as expected.
76 if (roi_retval == 0) {71 if (roi_retval == 0) {
@@ -83,9 +78,9 @@ TEST(VP8RoiMapTest, ParameterCheck) { · 6 unmodified lines
83 for (int i = 0; i < MAX_MB_SEGMENTS; ++i) {78 for (int i = 0; i < MAX_MB_SEGMENTS; ++i) {
84 const int transq = internalq_trans[abs(delta_q[i])];79 const int transq = internalq_trans[abs(delta_q[i])];
85 if (abs(cpi.segment_feature_data[MB_LVL_ALT_Q][i]) != transq) {80 if (abs(cpi.segment_feature_data[MB_LVL_ALT_Q][i]) != transq) {
86 EXPECT_EQ(transq, cpi.segment_feature_data[MB_LVL_ALT_Q][i])81 EXPECT_EQ(transq, cpi.segment_feature_data[MB_LVL_ALT_Q][i])
87 << "segment delta_q error";82 << "segment delta_q error";
88 break;83 break;
89 }84 }
90 }85 }
91 86
@@ -93,7 +88,7 @@ TEST(VP8RoiMapTest, ParameterCheck) { · 1 unmodified line
93 for (int i = 0; i < MAX_MB_SEGMENTS; ++i) {88 for (int i = 0; i < MAX_MB_SEGMENTS; ++i) {
94 if (cpi.segment_feature_data[MB_LVL_ALT_LF][i] != delta_lf[i]) {89 if (cpi.segment_feature_data[MB_LVL_ALT_LF][i] != delta_lf[i]) {
95 EXPECT_EQ(delta_lf[i], cpi.segment_feature_data[MB_LVL_ALT_LF][i])90 EXPECT_EQ(delta_lf[i], cpi.segment_feature_data[MB_LVL_ALT_LF][i])
96 << "segment delta_lf error";91 << "segment delta_lf error";
97 break;92 break;
98 }93 }
99 }94 }
@@ -101,23 +96,21 @@ TEST(VP8RoiMapTest, ParameterCheck) { · 1 unmodified line
101 // Check the breakout thresholds96 // Check the breakout thresholds
102 for (int i = 0; i < MAX_MB_SEGMENTS; ++i) {97 for (int i = 0; i < MAX_MB_SEGMENTS; ++i) {
103 unsigned int breakout =98 unsigned int breakout =
104 static_cast<unsigned int>(cpi.segment_encode_breakout[i]);99 static_cast<unsigned int>(cpi.segment_encode_breakout[i]);
105 100
106 if (threshold[i] != breakout) {101 if (threshold[i] != breakout) {
107 EXPECT_EQ(threshold[i], breakout)102 EXPECT_EQ(threshold[i], breakout) << "breakout threshold error";
108 << "breakout threshold error";
109 break;103 break;
110 }104 }
111 }105 }
112 106
113 // Segmentation, and segmentation update flages should be set.107 // Segmentation, and segmentation update flages should be set.
114 EXPECT_EQ(1, cpi.mb.e_mbd.segmentation_enabled)108 EXPECT_EQ(1, cpi.mb.e_mbd.segmentation_enabled)
115 << "segmentation_enabled error";109 << "segmentation_enabled error";
116 EXPECT_EQ(1, cpi.mb.e_mbd.update_mb_segmentation_map)110 EXPECT_EQ(1, cpi.mb.e_mbd.update_mb_segmentation_map)
117 << "update_mb_segmentation_map error";111 << "update_mb_segmentation_map error";
118 EXPECT_EQ(1, cpi.mb.e_mbd.update_mb_segmentation_data)112 EXPECT_EQ(1, cpi.mb.e_mbd.update_mb_segmentation_data)
119 << "update_mb_segmentation_data error";113 << "update_mb_segmentation_data error";
120
121 114
122 // Try a range of delta q and lf parameters (some legal, some not)115 // Try a range of delta q and lf parameters (some legal, some not)
123 for (int i = 0; i < 1000; ++i) {116 for (int i = 0; i < 1000; ++i) {
@@ -128,57 +121,54 @@ TEST(VP8RoiMapTest, ParameterCheck) { · 4 unmodified lines
128 rand_deltas[2] = rnd(160) - 80;121 rand_deltas[2] = rnd(160) - 80;
129 rand_deltas[3] = rnd(160) - 80;122 rand_deltas[3] = rnd(160) - 80;
130 123
131 deltas_valid = ((abs(rand_deltas[0]) <= 63) &&124 deltas_valid =
132 (abs(rand_deltas[1]) <= 63) &&125 ((abs(rand_deltas[0]) <= 63) && (abs(rand_deltas[1]) <= 63) &&
133 (abs(rand_deltas[2]) <= 63) &&126 (abs(rand_deltas[2]) <= 63) && (abs(rand_deltas[3]) <= 63))
134 (abs(rand_deltas[3]) <= 63)) ? 0 : -1;127 ? 0
128 : -1;
135 129
136 // Test with random delta q values.130 // Test with random delta q values.
137 roi_retval = vp8_set_roimap(&cpi, roi_map, cpi.common.mb_rows,131 roi_retval =
138 cpi.common.mb_cols, rand_deltas,132 vp8_set_roimap(&cpi, roi_map, cpi.common.mb_rows, cpi.common.mb_cols,
139 delta_lf, threshold);133 rand_deltas, delta_lf, threshold);
140 EXPECT_EQ(deltas_valid, roi_retval) << "dq range check error";134 EXPECT_EQ(deltas_valid, roi_retval) << "dq range check error";
141 135
142 // One delta_q error shown at a time136 // One delta_q error shown at a time
143 if (deltas_valid != roi_retval)137 if (deltas_valid != roi_retval) break;
144 break;
145 138
146 // Test with random loop filter values.139 // Test with random loop filter values.
147 roi_retval = vp8_set_roimap(&cpi, roi_map, cpi.common.mb_rows,140 roi_retval =
148 cpi.common.mb_cols, delta_q,141 vp8_set_roimap(&cpi, roi_map, cpi.common.mb_rows, cpi.common.mb_cols,
149 rand_deltas, threshold);142 delta_q, rand_deltas, threshold);
150 EXPECT_EQ(deltas_valid, roi_retval) << "dlf range check error";143 EXPECT_EQ(deltas_valid, roi_retval) << "dlf range check error";
151 144
152 // One delta loop filter error shown at a time145 // One delta loop filter error shown at a time
153 if (deltas_valid != roi_retval)146 if (deltas_valid != roi_retval) break;
154 break;
155 }147 }
156 148
157 // Test that we report and error if cyclic refresh is enabled.149 // Test that we report and error if cyclic refresh is enabled.
158 cpi.cyclic_refresh_mode_enabled = 1;150 cpi.cyclic_refresh_mode_enabled = 1;
159 roi_retval = vp8_set_roimap(&cpi, roi_map, cpi.common.mb_rows,151 roi_retval =
160 cpi.common.mb_cols, delta_q,152 vp8_set_roimap(&cpi, roi_map, cpi.common.mb_rows, cpi.common.mb_cols,
161 delta_lf, threshold);153 delta_q, delta_lf, threshold);
162 EXPECT_EQ(-1, roi_retval) << "cyclic refresh check error";154 EXPECT_EQ(-1, roi_retval) << "cyclic refresh check error";
163 cpi.cyclic_refresh_mode_enabled = 0;155 cpi.cyclic_refresh_mode_enabled = 0;
164 156
165 // Test invalid number of rows or colums.157 // Test invalid number of rows or colums.
166 roi_retval = vp8_set_roimap(&cpi, roi_map, cpi.common.mb_rows + 1,158 roi_retval =
167 cpi.common.mb_cols, delta_q,159 vp8_set_roimap(&cpi, roi_map, cpi.common.mb_rows + 1,
168 delta_lf, threshold);160 cpi.common.mb_cols, delta_q, delta_lf, threshold);
169 EXPECT_EQ(-1, roi_retval) << "MB rows bounds check error";161 EXPECT_EQ(-1, roi_retval) << "MB rows bounds check error";
170 162
171 roi_retval = vp8_set_roimap(&cpi, roi_map, cpi.common.mb_rows,163 roi_retval =
172 cpi.common.mb_cols - 1, delta_q,164 vp8_set_roimap(&cpi, roi_map, cpi.common.mb_rows,
173 delta_lf, threshold);165 cpi.common.mb_cols - 1, delta_q, delta_lf, threshold);
174 EXPECT_EQ(-1, roi_retval) << "MB cols bounds check error";166 EXPECT_EQ(-1, roi_retval) << "MB cols bounds check error";
175 }167 }
176 168
177 // Free allocated memory169 // Free allocated memory
178 if (cpi.segmentation_map)170 if (cpi.segmentation_map) vpx_free(cpi.segmentation_map);
179 vpx_free(cpi.segmentation_map);171 if (roi_map) vpx_free(roi_map);
180 if (roi_map)
181 vpx_free(roi_map);
182};172};
183 173
184} // namespace174} // namespace
test/sixtap_predict_test.cc+97−101
@@ -25,22 +25,19 @@ · 24 unmodified lines
25 25
26namespace {26namespace {
27 27
28typedef void (*SixtapPredictFunc)(uint8_t *src_ptr,28typedef void (*SixtapPredictFunc)(uint8_t *src_ptr, int src_pixels_per_line,
29 int src_pixels_per_line,29 int xoffset, int yoffset, uint8_t *dst_ptr,
30 int xoffset,
31 int yoffset,
32 uint8_t *dst_ptr,
33 int dst_pitch);30 int dst_pitch);
34 31
35typedef std::tr1::tuple<int, int, SixtapPredictFunc> SixtapPredictParam;32typedef std::tr1::tuple<int, int, SixtapPredictFunc> SixtapPredictParam;
36 33
37class SixtapPredictTest34class SixtapPredictTest : public ::testing::TestWithParam<SixtapPredictParam> {
38 : public ::testing::TestWithParam<SixtapPredictParam> {
39 public:35 public:
40 static void SetUpTestCase() {36 static void SetUpTestCase() {
41 src_ = reinterpret_cast<uint8_t*>(vpx_memalign(kDataAlignment, kSrcSize));37 src_ = reinterpret_cast<uint8_t *>(vpx_memalign(kDataAlignment, kSrcSize));
42 dst_ = reinterpret_cast<uint8_t*>(vpx_memalign(kDataAlignment, kDstSize));38 dst_ = reinterpret_cast<uint8_t *>(vpx_memalign(kDataAlignment, kDstSize));
43 dst_c_ = reinterpret_cast<uint8_t*>(vpx_memalign(kDataAlignment, kDstSize));39 dst_c_ =
40 reinterpret_cast<uint8_t *>(vpx_memalign(kDataAlignment, kDstSize));
44 }41 }
45 42
46 static void TearDownTestCase() {43 static void TearDownTestCase() {
@@ -52,9 +49,7 @@ class SixtapPredictTest · 5 unmodified lines
52 dst_c_ = NULL;49 dst_c_ = NULL;
53 }50 }
54 51
55 virtual void TearDown() {52 virtual void TearDown() { libvpx_test::ClearSystemState(); }
56 libvpx_test::ClearSystemState();
57 }
58 53
59 protected:54 protected:
60 // Make test arrays big enough for 16x16 functions. Six-tap filters55 // Make test arrays big enough for 16x16 functions. Six-tap filters
@@ -80,74 +75,76 @@ class SixtapPredictTest · 19 unmodified lines
80 // The src stores the macroblock we will filter on, and makes it 1 byte larger75 // The src stores the macroblock we will filter on, and makes it 1 byte larger
81 // in order to test unaligned access. The result is stored in dst and dst_c(c76 // in order to test unaligned access. The result is stored in dst and dst_c(c
82 // reference code result).77 // reference code result).
83 static uint8_t* src_;78 static uint8_t *src_;
84 static uint8_t* dst_;79 static uint8_t *dst_;
85 static uint8_t* dst_c_;80 static uint8_t *dst_c_;
86};81};
87 82
88uint8_t* SixtapPredictTest::src_ = NULL;83uint8_t *SixtapPredictTest::src_ = NULL;
89uint8_t* SixtapPredictTest::dst_ = NULL;84uint8_t *SixtapPredictTest::dst_ = NULL;
90uint8_t* SixtapPredictTest::dst_c_ = NULL;85uint8_t *SixtapPredictTest::dst_c_ = NULL;
91 86
92TEST_P(SixtapPredictTest, TestWithPresetData) {87TEST_P(SixtapPredictTest, TestWithPresetData) {
93 // Test input88 // Test input
94 static const uint8_t test_data[kSrcSize] = {89 static const uint8_t test_data[kSrcSize] = {
95 216, 184, 4, 191, 82, 92, 41, 0, 1, 226, 236, 172, 20, 182, 42, 226, 177,90 216, 184, 4, 191, 82, 92, 41, 0, 1, 226, 236, 172, 20, 182, 42,
96 79, 94, 77, 179, 203, 206, 198, 22, 192, 19, 75, 17, 192, 44, 233, 120,91 226, 177, 79, 94, 77, 179, 203, 206, 198, 22, 192, 19, 75, 17, 192,
97 48, 168, 203, 141, 210, 203, 143, 180, 184, 59, 201, 110, 102, 171, 32,92 44, 233, 120, 48, 168, 203, 141, 210, 203, 143, 180, 184, 59, 201, 110,
98 182, 10, 109, 105, 213, 60, 47, 236, 253, 67, 55, 14, 3, 99, 247, 124,93 102, 171, 32, 182, 10, 109, 105, 213, 60, 47, 236, 253, 67, 55, 14,
99 148, 159, 71, 34, 114, 19, 177, 38, 203, 237, 239, 58, 83, 155, 91, 10,94 3, 99, 247, 124, 148, 159, 71, 34, 114, 19, 177, 38, 203, 237, 239,
100 166, 201, 115, 124, 5, 163, 104, 2, 231, 160, 16, 234, 4, 8, 103, 153,95 58, 83, 155, 91, 10, 166, 201, 115, 124, 5, 163, 104, 2, 231, 160,
101 167, 174, 187, 26, 193, 109, 64, 141, 90, 48, 200, 174, 204, 36, 184,96 16, 234, 4, 8, 103, 153, 167, 174, 187, 26, 193, 109, 64, 141, 90,
102 114, 237, 43, 238, 242, 207, 86, 245, 182, 247, 6, 161, 251, 14, 8, 148,97 48, 200, 174, 204, 36, 184, 114, 237, 43, 238, 242, 207, 86, 245, 182,
103 182, 182, 79, 208, 120, 188, 17, 6, 23, 65, 206, 197, 13, 242, 126, 128,98 247, 6, 161, 251, 14, 8, 148, 182, 182, 79, 208, 120, 188, 17, 6,
104 224, 170, 110, 211, 121, 197, 200, 47, 188, 207, 208, 184, 221, 216, 76,99 23, 65, 206, 197, 13, 242, 126, 128, 224, 170, 110, 211, 121, 197, 200,
105 148, 143, 156, 100, 8, 89, 117, 14, 112, 183, 221, 54, 197, 208, 180, 69,100 47, 188, 207, 208, 184, 221, 216, 76, 148, 143, 156, 100, 8, 89, 117,
106 176, 94, 180, 131, 215, 121, 76, 7, 54, 28, 216, 238, 249, 176, 58, 142,101 14, 112, 183, 221, 54, 197, 208, 180, 69, 176, 94, 180, 131, 215, 121,
107 64, 215, 242, 72, 49, 104, 87, 161, 32, 52, 216, 230, 4, 141, 44, 181,102 76, 7, 54, 28, 216, 238, 249, 176, 58, 142, 64, 215, 242, 72, 49,
108 235, 224, 57, 195, 89, 134, 203, 144, 162, 163, 126, 156, 84, 185, 42,103 104, 87, 161, 32, 52, 216, 230, 4, 141, 44, 181, 235, 224, 57, 195,
109 148, 145, 29, 221, 194, 134, 52, 100, 166, 105, 60, 140, 110, 201, 184,104 89, 134, 203, 144, 162, 163, 126, 156, 84, 185, 42, 148, 145, 29, 221,
110 35, 181, 153, 93, 121, 243, 227, 68, 131, 134, 232, 2, 35, 60, 187, 77,105 194, 134, 52, 100, 166, 105, 60, 140, 110, 201, 184, 35, 181, 153, 93,
111 209, 76, 106, 174, 15, 241, 227, 115, 151, 77, 175, 36, 187, 121, 221,106 121, 243, 227, 68, 131, 134, 232, 2, 35, 60, 187, 77, 209, 76, 106,
112 223, 47, 118, 61, 168, 105, 32, 237, 236, 167, 213, 238, 202, 17, 170,107 174, 15, 241, 227, 115, 151, 77, 175, 36, 187, 121, 221, 223, 47, 118,
113 24, 226, 247, 131, 145, 6, 116, 117, 121, 11, 194, 41, 48, 126, 162, 13,108 61, 168, 105, 32, 237, 236, 167, 213, 238, 202, 17, 170, 24, 226, 247,
114 93, 209, 131, 154, 122, 237, 187, 103, 217, 99, 60, 200, 45, 78, 115, 69,109 131, 145, 6, 116, 117, 121, 11, 194, 41, 48, 126, 162, 13, 93, 209,
115 49, 106, 200, 194, 112, 60, 56, 234, 72, 251, 19, 120, 121, 182, 134, 215,110 131, 154, 122, 237, 187, 103, 217, 99, 60, 200, 45, 78, 115, 69, 49,
116 135, 10, 114, 2, 247, 46, 105, 209, 145, 165, 153, 191, 243, 12, 5, 36,111 106, 200, 194, 112, 60, 56, 234, 72, 251, 19, 120, 121, 182, 134, 215,
117 119, 206, 231, 231, 11, 32, 209, 83, 27, 229, 204, 149, 155, 83, 109, 35,112 135, 10, 114, 2, 247, 46, 105, 209, 145, 165, 153, 191, 243, 12, 5,
118 93, 223, 37, 84, 14, 142, 37, 160, 52, 191, 96, 40, 204, 101, 77, 67, 52,113 36, 119, 206, 231, 231, 11, 32, 209, 83, 27, 229, 204, 149, 155, 83,
119 53, 43, 63, 85, 253, 147, 113, 226, 96, 6, 125, 179, 115, 161, 17, 83,114 109, 35, 93, 223, 37, 84, 14, 142, 37, 160, 52, 191, 96, 40, 204,
120 198, 101, 98, 85, 139, 3, 137, 75, 99, 178, 23, 201, 255, 91, 253, 52,115 101, 77, 67, 52, 53, 43, 63, 85, 253, 147, 113, 226, 96, 6, 125,
121 134, 60, 138, 131, 208, 251, 101, 48, 2, 227, 228, 118, 132, 245, 202,116 179, 115, 161, 17, 83, 198, 101, 98, 85, 139, 3, 137, 75, 99, 178,
122 75, 91, 44, 160, 231, 47, 41, 50, 147, 220, 74, 92, 219, 165, 89, 16117 23, 201, 255, 91, 253, 52, 134, 60, 138, 131, 208, 251, 101, 48, 2,
118 227, 228, 118, 132, 245, 202, 75, 91, 44, 160, 231, 47, 41, 50, 147,
119 220, 74, 92, 219, 165, 89, 16
123 };120 };
124 121
125 // Expected result122 // Expected result
126 static const uint8_t expected_dst[kDstSize] = {123 static const uint8_t expected_dst[kDstSize] = {
127 117, 102, 74, 135, 42, 98, 175, 206, 70, 73, 222, 197, 50, 24, 39, 49, 38,124 117, 102, 74, 135, 42, 98, 175, 206, 70, 73, 222, 197, 50, 24, 39,
128 105, 90, 47, 169, 40, 171, 215, 200, 73, 109, 141, 53, 85, 177, 164, 79,125 49, 38, 105, 90, 47, 169, 40, 171, 215, 200, 73, 109, 141, 53, 85,
129 208, 124, 89, 212, 18, 81, 145, 151, 164, 217, 153, 91, 154, 102, 102,126 177, 164, 79, 208, 124, 89, 212, 18, 81, 145, 151, 164, 217, 153, 91,
130 159, 75, 164, 152, 136, 51, 213, 219, 186, 116, 193, 224, 186, 36, 231,127 154, 102, 102, 159, 75, 164, 152, 136, 51, 213, 219, 186, 116, 193, 224,
131 208, 84, 211, 155, 167, 35, 59, 42, 76, 216, 149, 73, 201, 78, 149, 184,128 186, 36, 231, 208, 84, 211, 155, 167, 35, 59, 42, 76, 216, 149, 73,
132 100, 96, 196, 189, 198, 188, 235, 195, 117, 129, 120, 129, 49, 25, 133,129 201, 78, 149, 184, 100, 96, 196, 189, 198, 188, 235, 195, 117, 129, 120,
133 113, 69, 221, 114, 70, 143, 99, 157, 108, 189, 140, 78, 6, 55, 65, 240,130 129, 49, 25, 133, 113, 69, 221, 114, 70, 143, 99, 157, 108, 189, 140,
134 255, 245, 184, 72, 90, 100, 116, 131, 39, 60, 234, 167, 33, 160, 88, 185,131 78, 6, 55, 65, 240, 255, 245, 184, 72, 90, 100, 116, 131, 39, 60,
135 200, 157, 159, 176, 127, 151, 138, 102, 168, 106, 170, 86, 82, 219, 189,132 234, 167, 33, 160, 88, 185, 200, 157, 159, 176, 127, 151, 138, 102, 168,
136 76, 33, 115, 197, 106, 96, 198, 136, 97, 141, 237, 151, 98, 137, 191,133 106, 170, 86, 82, 219, 189, 76, 33, 115, 197, 106, 96, 198, 136, 97,
137 185, 2, 57, 95, 142, 91, 255, 185, 97, 137, 76, 162, 94, 173, 131, 193,134 141, 237, 151, 98, 137, 191, 185, 2, 57, 95, 142, 91, 255, 185, 97,
138 161, 81, 106, 72, 135, 222, 234, 137, 66, 137, 106, 243, 210, 147, 95,135 137, 76, 162, 94, 173, 131, 193, 161, 81, 106, 72, 135, 222, 234, 137,
139 15, 137, 110, 85, 66, 16, 96, 167, 147, 150, 173, 203, 140, 118, 196,136 66, 137, 106, 243, 210, 147, 95, 15, 137, 110, 85, 66, 16, 96, 167,
140 84, 147, 160, 19, 95, 101, 123, 74, 132, 202, 82, 166, 12, 131, 166,137 147, 150, 173, 203, 140, 118, 196, 84, 147, 160, 19, 95, 101, 123, 74,
141 189, 170, 159, 85, 79, 66, 57, 152, 132, 203, 194, 0, 1, 56, 146, 180,138 132, 202, 82, 166, 12, 131, 166, 189, 170, 159, 85, 79, 66, 57, 152,
142 224, 156, 28, 83, 181, 79, 76, 80, 46, 160, 175, 59, 106, 43, 87, 75,139 132, 203, 194, 0, 1, 56, 146, 180, 224, 156, 28, 83, 181, 79, 76,
143 136, 85, 189, 46, 71, 200, 90140 80, 46, 160, 175, 59, 106, 43, 87, 75, 136, 85, 189, 46, 71, 200,
141 90
144 };142 };
145 143
146 uint8_t *src = const_cast<uint8_t*>(test_data);144 uint8_t *src = const_cast<uint8_t *>(test_data);
147 145
148 ASM_REGISTER_STATE_CHECK(146 ASM_REGISTER_STATE_CHECK(sixtap_predict_(&src[kSrcStride * 2 + 2 + 1],
149 sixtap_predict_(&src[kSrcStride * 2 + 2 + 1], kSrcStride,147 kSrcStride, 2, 2, dst_, kDstStride));
150 2, 2, dst_, kDstStride));
151 148
152 for (int i = 0; i < height_; ++i)149 for (int i = 0; i < height_; ++i)
153 for (int j = 0; j < width_; ++j)150 for (int j = 0; j < width_; ++j)
@@ -159,8 +156,7 @@ using libvpx_test::ACMRandom; · 5 unmodified lines
159 156
160TEST_P(SixtapPredictTest, TestWithRandomData) {157TEST_P(SixtapPredictTest, TestWithRandomData) {
161 ACMRandom rnd(ACMRandom::DeterministicSeed());158 ACMRandom rnd(ACMRandom::DeterministicSeed());
162 for (int i = 0; i < kSrcSize; ++i)159 for (int i = 0; i < kSrcSize; ++i) src_[i] = rnd.Rand8();
163 src_[i] = rnd.Rand8();
164 160
165 // Run tests for all possible offsets.161 // Run tests for all possible offsets.
166 for (int xoffset = 0; xoffset < 8; ++xoffset) {162 for (int xoffset = 0; xoffset < 8; ++xoffset) {
@@ -172,9 +168,9 @@ TEST_P(SixtapPredictTest, TestWithRandomData) { · 5 unmodified lines
172 xoffset, yoffset, dst_c_, kDstStride);168 xoffset, yoffset, dst_c_, kDstStride);
173 169
174 // Run test.170 // Run test.
175 ASM_REGISTER_STATE_CHECK(171 ASM_REGISTER_STATE_CHECK(sixtap_predict_(&src_[kSrcStride * 2 + 2 + 1],
176 sixtap_predict_(&src_[kSrcStride * 2 + 2 + 1], kSrcStride,172 kSrcStride, xoffset, yoffset,
177 xoffset, yoffset, dst_, kDstStride));173 dst_, kDstStride));
178 174
179 for (int i = 0; i < height_; ++i)175 for (int i = 0; i < height_; ++i)
180 for (int j = 0; j < width_; ++j)176 for (int j = 0; j < width_; ++j)
@@ -187,47 +183,47 @@ TEST_P(SixtapPredictTest, TestWithRandomData) { · 6 unmodified lines
187using std::tr1::make_tuple;183using std::tr1::make_tuple;
188 184
189INSTANTIATE_TEST_CASE_P(185INSTANTIATE_TEST_CASE_P(
190 C, SixtapPredictTest, ::testing::Values(186 C, SixtapPredictTest,
191 make_tuple(16, 16, &vp8_sixtap_predict16x16_c),187 ::testing::Values(make_tuple(16, 16, &vp8_sixtap_predict16x16_c),
192 make_tuple(8, 8, &vp8_sixtap_predict8x8_c),188 make_tuple(8, 8, &vp8_sixtap_predict8x8_c),
193 make_tuple(8, 4, &vp8_sixtap_predict8x4_c),189 make_tuple(8, 4, &vp8_sixtap_predict8x4_c),
194 make_tuple(4, 4, &vp8_sixtap_predict4x4_c)));190 make_tuple(4, 4, &vp8_sixtap_predict4x4_c)));
195#if HAVE_NEON191#if HAVE_NEON
196INSTANTIATE_TEST_CASE_P(192INSTANTIATE_TEST_CASE_P(
197 NEON, SixtapPredictTest, ::testing::Values(193 NEON, SixtapPredictTest,
198 make_tuple(16, 16, &vp8_sixtap_predict16x16_neon),194 ::testing::Values(make_tuple(16, 16, &vp8_sixtap_predict16x16_neon),
199 make_tuple(8, 8, &vp8_sixtap_predict8x8_neon),195 make_tuple(8, 8, &vp8_sixtap_predict8x8_neon),
200 make_tuple(8, 4, &vp8_sixtap_predict8x4_neon)));196 make_tuple(8, 4, &vp8_sixtap_predict8x4_neon)));
201#endif197#endif
202#if HAVE_MMX198#if HAVE_MMX
203INSTANTIATE_TEST_CASE_P(199INSTANTIATE_TEST_CASE_P(
204 MMX, SixtapPredictTest, ::testing::Values(200 MMX, SixtapPredictTest,
205 make_tuple(16, 16, &vp8_sixtap_predict16x16_mmx),201 ::testing::Values(make_tuple(16, 16, &vp8_sixtap_predict16x16_mmx),
206 make_tuple(8, 8, &vp8_sixtap_predict8x8_mmx),202 make_tuple(8, 8, &vp8_sixtap_predict8x8_mmx),
207 make_tuple(8, 4, &vp8_sixtap_predict8x4_mmx),203 make_tuple(8, 4, &vp8_sixtap_predict8x4_mmx),
208 make_tuple(4, 4, &vp8_sixtap_predict4x4_mmx)));204 make_tuple(4, 4, &vp8_sixtap_predict4x4_mmx)));
209#endif205#endif
210#if HAVE_SSE2206#if HAVE_SSE2
211INSTANTIATE_TEST_CASE_P(207INSTANTIATE_TEST_CASE_P(
212 SSE2, SixtapPredictTest, ::testing::Values(208 SSE2, SixtapPredictTest,
213 make_tuple(16, 16, &vp8_sixtap_predict16x16_sse2),209 ::testing::Values(make_tuple(16, 16, &vp8_sixtap_predict16x16_sse2),
214 make_tuple(8, 8, &vp8_sixtap_predict8x8_sse2),210 make_tuple(8, 8, &vp8_sixtap_predict8x8_sse2),
215 make_tuple(8, 4, &vp8_sixtap_predict8x4_sse2)));211 make_tuple(8, 4, &vp8_sixtap_predict8x4_sse2)));
216#endif212#endif
217#if HAVE_SSSE3213#if HAVE_SSSE3
218INSTANTIATE_TEST_CASE_P(214INSTANTIATE_TEST_CASE_P(
219 SSSE3, SixtapPredictTest, ::testing::Values(215 SSSE3, SixtapPredictTest,
220 make_tuple(16, 16, &vp8_sixtap_predict16x16_ssse3),216 ::testing::Values(make_tuple(16, 16, &vp8_sixtap_predict16x16_ssse3),
221 make_tuple(8, 8, &vp8_sixtap_predict8x8_ssse3),217 make_tuple(8, 8, &vp8_sixtap_predict8x8_ssse3),
222 make_tuple(8, 4, &vp8_sixtap_predict8x4_ssse3),218 make_tuple(8, 4, &vp8_sixtap_predict8x4_ssse3),
223 make_tuple(4, 4, &vp8_sixtap_predict4x4_ssse3)));219 make_tuple(4, 4, &vp8_sixtap_predict4x4_ssse3)));
224#endif220#endif
225#if HAVE_MSA221#if HAVE_MSA
226INSTANTIATE_TEST_CASE_P(222INSTANTIATE_TEST_CASE_P(
227 MSA, SixtapPredictTest, ::testing::Values(223 MSA, SixtapPredictTest,
228 make_tuple(16, 16, &vp8_sixtap_predict16x16_msa),224 ::testing::Values(make_tuple(16, 16, &vp8_sixtap_predict16x16_msa),
229 make_tuple(8, 8, &vp8_sixtap_predict8x8_msa),225 make_tuple(8, 8, &vp8_sixtap_predict8x8_msa),
230 make_tuple(8, 4, &vp8_sixtap_predict8x4_msa),226 make_tuple(8, 4, &vp8_sixtap_predict8x4_msa),
231 make_tuple(4, 4, &vp8_sixtap_predict4x4_msa)));227 make_tuple(4, 4, &vp8_sixtap_predict4x4_msa)));
232#endif228#endif
233} // namespace229} // namespace
test/sum_squares_test.cc+10−12
@@ -52,9 +52,9 @@ TEST_P(SumSquaresTest, OperationCheck) { · 51 unmodified lines
52 const int limit = 1 << (msb + 1);52 const int limit = 1 << (msb + 1);
53 53
54 for (int k = 0; k < kNumIterations; k++) {54 for (int k = 0; k < kNumIterations; k++) {
55 const int size = 4 << rnd(6); // Up to 128x12855 const int size = 4 << rnd(6); // Up to 128x128
56 int stride = 4 << rnd(7); // Up to 256 stride56 int stride = 4 << rnd(7); // Up to 256 stride
57 while (stride < size) { // Make sure it's valid57 while (stride < size) { // Make sure it's valid
58 stride = 4 << rnd(7);58 stride = 4 << rnd(7);
59 }59 }
60 60
@@ -68,9 +68,8 @@ TEST_P(SumSquaresTest, OperationCheck) { · 7 unmodified lines
68 uint64_t res_tst;68 uint64_t res_tst;
69 ASM_REGISTER_STATE_CHECK(res_tst = tst_func_(src, stride, size));69 ASM_REGISTER_STATE_CHECK(res_tst = tst_func_(src, stride, size));
70 70
71 ASSERT_EQ(res_ref, res_tst)71 ASSERT_EQ(res_ref, res_tst) << "Error: Sum Squares Test"
72 << "Error: Sum Squares Test"72 << " C output does not match optimized output.";
73 << " C output does not match optimized output.";
74 }73 }
75}74}
76 75
@@ -81,9 +80,9 @@ TEST_P(SumSquaresTest, ExtremeValues) { · 4 unmodified lines
81 const int limit = 1 << (msb + 1);80 const int limit = 1 << (msb + 1);
82 81
83 for (int k = 0; k < kNumIterations; k++) {82 for (int k = 0; k < kNumIterations; k++) {
84 const int size = 4 << rnd(6); // Up to 128x12883 const int size = 4 << rnd(6); // Up to 128x128
85 int stride = 4 << rnd(7); // Up to 256 stride84 int stride = 4 << rnd(7); // Up to 256 stride
86 while (stride < size) { // Make sure it's valid85 while (stride < size) { // Make sure it's valid
87 stride = 4 << rnd(7);86 stride = 4 << rnd(7);
88 }87 }
89 88
@@ -98,9 +97,8 @@ TEST_P(SumSquaresTest, ExtremeValues) { · 8 unmodified lines
98 uint64_t res_tst;97 uint64_t res_tst;
99 ASM_REGISTER_STATE_CHECK(res_tst = tst_func_(src, stride, size));98 ASM_REGISTER_STATE_CHECK(res_tst = tst_func_(src, stride, size));
100 99
101 ASSERT_EQ(res_ref, res_tst)100 ASSERT_EQ(res_ref, res_tst) << "Error: Sum Squares Test"
102 << "Error: Sum Squares Test"101 << " C output does not match optimized output.";
103 << " C output does not match optimized output.";
104 }102 }
105}103}
106 104
test/superframe_test.cc+19−23
@@ -18,13 +18,14 @@ namespace { · 17 unmodified lines
18 18
19const int kTestMode = 0;19const int kTestMode = 0;
20 20
21typedef std::tr1::tuple<libvpx_test::TestMode,int> SuperframeTestParam;21typedef std::tr1::tuple<libvpx_test::TestMode, int> SuperframeTestParam;
22 22
23class SuperframeTest : public ::libvpx_test::EncoderTest,23class SuperframeTest
24 public ::libvpx_test::CodecTestWithParam<SuperframeTestParam> {24 : public ::libvpx_test::EncoderTest,
25 public ::libvpx_test::CodecTestWithParam<SuperframeTestParam> {
25 protected:26 protected:
26 SuperframeTest() : EncoderTest(GET_PARAM(0)), modified_buf_(NULL),27 SuperframeTest()
27 last_sf_pts_(0) {}28 : EncoderTest(GET_PARAM(0)), modified_buf_(NULL), last_sf_pts_(0) {}
28 virtual ~SuperframeTest() {}29 virtual ~SuperframeTest() {}
29 30
30 virtual void SetUp() {31 virtual void SetUp() {
@@ -36,9 +37,7 @@ class SuperframeTest : public ::libvpx_test::EncoderTest, · 5 unmodified lines
36 sf_count_max_ = INT_MAX;37 sf_count_max_ = INT_MAX;
37 }38 }
38 39
39 virtual void TearDown() {40 virtual void TearDown() { delete[] modified_buf_; }
40 delete[] modified_buf_;
41 }
42 41
43 virtual void PreEncodeFrameHook(libvpx_test::VideoSource *video,42 virtual void PreEncodeFrameHook(libvpx_test::VideoSource *video,
44 libvpx_test::Encoder *encoder) {43 libvpx_test::Encoder *encoder) {
@@ -47,25 +46,21 @@ class SuperframeTest : public ::libvpx_test::EncoderTest, · 2 unmodified lines
47 }46 }
48 }47 }
49 48
50 virtual const vpx_codec_cx_pkt_t * MutateEncoderOutputHook(49 virtual const vpx_codec_cx_pkt_t *MutateEncoderOutputHook(
51 const vpx_codec_cx_pkt_t *pkt) {50 const vpx_codec_cx_pkt_t *pkt) {
52 if (pkt->kind != VPX_CODEC_CX_FRAME_PKT)51 if (pkt->kind != VPX_CODEC_CX_FRAME_PKT) return pkt;
53 return pkt;
54 52
55 const uint8_t *buffer = reinterpret_cast<uint8_t*>(pkt->data.frame.buf);53 const uint8_t *buffer = reinterpret_cast<uint8_t *>(pkt->data.frame.buf);
56 const uint8_t marker = buffer[pkt->data.frame.sz - 1];54 const uint8_t marker = buffer[pkt->data.frame.sz - 1];
57 const int frames = (marker & 0x7) + 1;55 const int frames = (marker & 0x7) + 1;
58 const int mag = ((marker >> 3) & 3) + 1;56 const int mag = ((marker >> 3) & 3) + 1;
59 const unsigned int index_sz = 2 + mag * frames;57 const unsigned int index_sz = 2 + mag * frames;
60 if ((marker & 0xe0) == 0xc0 &&58 if ((marker & 0xe0) == 0xc0 && pkt->data.frame.sz >= index_sz &&
61 pkt->data.frame.sz >= index_sz &&
62 buffer[pkt->data.frame.sz - index_sz] == marker) {59 buffer[pkt->data.frame.sz - index_sz] == marker) {
63 // frame is a superframe. strip off the index.60 // frame is a superframe. strip off the index.
64 if (modified_buf_)61 if (modified_buf_) delete[] modified_buf_;
65 delete[] modified_buf_;
66 modified_buf_ = new uint8_t[pkt->data.frame.sz - index_sz];62 modified_buf_ = new uint8_t[pkt->data.frame.sz - index_sz];
67 memcpy(modified_buf_, pkt->data.frame.buf,63 memcpy(modified_buf_, pkt->data.frame.buf, pkt->data.frame.sz - index_sz);
68 pkt->data.frame.sz - index_sz);
69 modified_pkt_ = *pkt;64 modified_pkt_ = *pkt;
70 modified_pkt_.data.frame.buf = modified_buf_;65 modified_pkt_.data.frame.buf = modified_buf_;
71 modified_pkt_.data.frame.sz -= index_sz;66 modified_pkt_.data.frame.sz -= index_sz;
@@ -76,8 +71,8 @@ class SuperframeTest : public ::libvpx_test::EncoderTest, · 4 unmodified lines
76 }71 }
77 72
78 // Make sure we do a few frames after the last SF73 // Make sure we do a few frames after the last SF
79 abort_ |= sf_count_ > sf_count_max_ &&74 abort_ |=
80 pkt->data.frame.pts - last_sf_pts_ >= 5;75 sf_count_ > sf_count_max_ && pkt->data.frame.pts - last_sf_pts_ >= 5;
81 return pkt;76 return pkt;
82 }77 }
83 78
@@ -98,7 +93,8 @@ TEST_P(SuperframeTest, TestSuperframeIndexIsOptional) { · 14 unmodified lines
98 EXPECT_EQ(sf_count_, 1);93 EXPECT_EQ(sf_count_, 1);
99}94}
100 95
101VP9_INSTANTIATE_TEST_CASE(SuperframeTest, ::testing::Combine(96VP9_INSTANTIATE_TEST_CASE(
102 ::testing::Values(::libvpx_test::kTwoPassGood),97 SuperframeTest,
103 ::testing::Values(0)));98 ::testing::Combine(::testing::Values(::libvpx_test::kTwoPassGood),
99 ::testing::Values(0)));
104} // namespace100} // namespace
test/svc_test.cc+45−53
@@ -33,10 +33,8 @@ class SvcTest : public ::testing::Test { · 32 unmodified lines
33 static const uint32_t kHeight = 288;33 static const uint32_t kHeight = 288;
34 34
35 SvcTest()35 SvcTest()
36 : codec_iface_(0),36 : codec_iface_(0), test_file_name_("hantro_collage_w352h288.yuv"),
37 test_file_name_("hantro_collage_w352h288.yuv"),37 codec_initialized_(false), decoder_(0) {
38 codec_initialized_(false),
39 decoder_(0) {
40 memset(&svc_, 0, sizeof(svc_));38 memset(&svc_, 0, sizeof(svc_));
41 memset(&codec_, 0, sizeof(codec_));39 memset(&codec_, 0, sizeof(codec_));
42 memset(&codec_enc_, 0, sizeof(codec_enc_));40 memset(&codec_enc_, 0, sizeof(codec_enc_));
@@ -70,7 +68,7 @@ class SvcTest : public ::testing::Test { · 27 unmodified lines
70 68
71 virtual void TearDown() {69 virtual void TearDown() {
72 ReleaseEncoder();70 ReleaseEncoder();
73 delete(decoder_);71 delete (decoder_);
74 }72 }
75 73
76 void InitializeEncoder() {74 void InitializeEncoder() {
@@ -97,7 +95,7 @@ class SvcTest : public ::testing::Test { · 20 unmodified lines
97 if (cx_pkt->kind == VPX_CODEC_STATS_PKT) {95 if (cx_pkt->kind == VPX_CODEC_STATS_PKT) {
98 EXPECT_GT(cx_pkt->data.twopass_stats.sz, 0U);96 EXPECT_GT(cx_pkt->data.twopass_stats.sz, 0U);
99 ASSERT_TRUE(cx_pkt->data.twopass_stats.buf != NULL);97 ASSERT_TRUE(cx_pkt->data.twopass_stats.buf != NULL);
100 stats_buf->append(static_cast<char*>(cx_pkt->data.twopass_stats.buf),98 stats_buf->append(static_cast<char *>(cx_pkt->data.twopass_stats.buf),
101 cx_pkt->data.twopass_stats.sz);99 cx_pkt->data.twopass_stats.sz);
102 }100 }
103 }101 }
@@ -113,10 +111,9 @@ class SvcTest : public ::testing::Test { · 9 unmodified lines
113 codec_enc_.g_pass = VPX_RC_FIRST_PASS;111 codec_enc_.g_pass = VPX_RC_FIRST_PASS;
114 InitializeEncoder();112 InitializeEncoder();
115 113
116 libvpx_test::I420VideoSource video(test_file_name_,114 libvpx_test::I420VideoSource video(
117 codec_enc_.g_w, codec_enc_.g_h,115 test_file_name_, codec_enc_.g_w, codec_enc_.g_h,
118 codec_enc_.g_timebase.den,116 codec_enc_.g_timebase.den, codec_enc_.g_timebase.num, 0, 30);
119 codec_enc_.g_timebase.num, 0, 30);
120 video.Begin();117 video.Begin();
121 118
122 for (int i = 0; i < n; ++i) {119 for (int i = 0; i < n; ++i) {
@@ -128,8 +125,8 @@ class SvcTest : public ::testing::Test { · 5 unmodified lines
128 }125 }
129 126
130 // Flush encoder and test EOS packet.127 // Flush encoder and test EOS packet.
131 res = vpx_svc_encode(&svc_, &codec_, NULL, video.pts(),128 res = vpx_svc_encode(&svc_, &codec_, NULL, video.pts(), video.duration(),
132 video.duration(), VPX_DL_GOOD_QUALITY);129 VPX_DL_GOOD_QUALITY);
133 ASSERT_EQ(VPX_CODEC_OK, res);130 ASSERT_EQ(VPX_CODEC_OK, res);
134 GetStatsData(stats_buf);131 GetStatsData(stats_buf);
135 132
@@ -163,8 +160,8 @@ class SvcTest : public ::testing::Test { · 27 unmodified lines
163 }160 }
164 }161 }
165 162
166 void Pass2EncodeNFrames(std::string *const stats_buf,163 void Pass2EncodeNFrames(std::string *const stats_buf, const int n,
167 const int n, const int layers,164 const int layers,
168 struct vpx_fixed_buf *const outputs) {165 struct vpx_fixed_buf *const outputs) {
169 vpx_codec_err_t res;166 vpx_codec_err_t res;
170 size_t frame_received = 0;167 size_t frame_received = 0;
@@ -182,10 +179,9 @@ class SvcTest : public ::testing::Test { · 11 unmodified lines
182 }179 }
183 InitializeEncoder();180 InitializeEncoder();
184 181
185 libvpx_test::I420VideoSource video(test_file_name_,182 libvpx_test::I420VideoSource video(
186 codec_enc_.g_w, codec_enc_.g_h,183 test_file_name_, codec_enc_.g_w, codec_enc_.g_h,
187 codec_enc_.g_timebase.den,184 codec_enc_.g_timebase.den, codec_enc_.g_timebase.num, 0, 30);
188 codec_enc_.g_timebase.num, 0, 30);
189 video.Begin();185 video.Begin();
190 186
191 for (int i = 0; i < n; ++i) {187 for (int i = 0; i < n; ++i) {
@@ -197,8 +193,8 @@ class SvcTest : public ::testing::Test { · 5 unmodified lines
197 }193 }
198 194
199 // Flush encoder.195 // Flush encoder.
200 res = vpx_svc_encode(&svc_, &codec_, NULL, 0,196 res = vpx_svc_encode(&svc_, &codec_, NULL, 0, video.duration(),
201 video.duration(), VPX_DL_GOOD_QUALITY);197 VPX_DL_GOOD_QUALITY);
202 EXPECT_EQ(VPX_CODEC_OK, res);198 EXPECT_EQ(VPX_CODEC_OK, res);
203 StoreFrames(n, outputs, &frame_received);199 StoreFrames(n, outputs, &frame_received);
204 200
@@ -217,9 +213,8 @@ class SvcTest : public ::testing::Test { · 12 unmodified lines
217 for (int i = 0; i < n; ++i) {213 for (int i = 0; i < n; ++i) {
218 ASSERT_TRUE(inputs[i].buf != NULL);214 ASSERT_TRUE(inputs[i].buf != NULL);
219 ASSERT_GT(inputs[i].sz, 0U);215 ASSERT_GT(inputs[i].sz, 0U);
220 const vpx_codec_err_t res_dec =216 const vpx_codec_err_t res_dec = decoder_->DecodeFrame(
221 decoder_->DecodeFrame(static_cast<const uint8_t *>(inputs[i].buf),217 static_cast<const uint8_t *>(inputs[i].buf), inputs[i].sz);
222 inputs[i].sz);
223 ASSERT_EQ(VPX_CODEC_OK, res_dec) << decoder_->DecodeError();218 ASSERT_EQ(VPX_CODEC_OK, res_dec) << decoder_->DecodeError();
224 ++decoded_frames;219 ++decoded_frames;
225 220
@@ -240,17 +235,16 @@ class SvcTest : public ::testing::Test { · 14 unmodified lines
240 ASSERT_GT(remained_spatial_layers, 0);235 ASSERT_GT(remained_spatial_layers, 0);
241 236
242 for (int i = 0; i < num_super_frames; ++i) {237 for (int i = 0; i < num_super_frames; ++i) {
243 uint32_t frame_sizes[8] = {0};238 uint32_t frame_sizes[8] = { 0 };
244 int frame_count = 0;239 int frame_count = 0;
245 int frames_found = 0;240 int frames_found = 0;
246 int frame;241 int frame;
247 ASSERT_TRUE(inputs[i].buf != NULL);242 ASSERT_TRUE(inputs[i].buf != NULL);
248 ASSERT_GT(inputs[i].sz, 0U);243 ASSERT_GT(inputs[i].sz, 0U);
249 244
250 vpx_codec_err_t res =245 vpx_codec_err_t res = vp9_parse_superframe_index(
251 vp9_parse_superframe_index(static_cast<const uint8_t*>(inputs[i].buf),246 static_cast<const uint8_t *>(inputs[i].buf), inputs[i].sz,
252 inputs[i].sz, frame_sizes, &frame_count,247 frame_sizes, &frame_count, NULL, NULL);
253 NULL, NULL);
254 ASSERT_EQ(VPX_CODEC_OK, res);248 ASSERT_EQ(VPX_CODEC_OK, res);
255 249
256 if (frame_count == 0) {250 if (frame_count == 0) {
@@ -258,28 +252,27 @@ class SvcTest : public ::testing::Test { · 1 unmodified line
258 ASSERT_EQ(1, remained_spatial_layers);252 ASSERT_EQ(1, remained_spatial_layers);
259 } else {253 } else {
260 // Found a super frame.254 // Found a super frame.
261 uint8_t *frame_data = static_cast<uint8_t*>(inputs[i].buf);255 uint8_t *frame_data = static_cast<uint8_t *>(inputs[i].buf);
262 uint8_t *frame_start = frame_data;256 uint8_t *frame_start = frame_data;
263 for (frame = 0; frame < frame_count; ++frame) {257 for (frame = 0; frame < frame_count; ++frame) {
264 // Looking for a visible frame.258 // Looking for a visible frame.
265 if (frame_data[0] & 0x02) {259 if (frame_data[0] & 0x02) {
266 ++frames_found;260 ++frames_found;
267 if (frames_found == remained_spatial_layers)261 if (frames_found == remained_spatial_layers) break;
268 break;
269 }262 }
270 frame_data += frame_sizes[frame];263 frame_data += frame_sizes[frame];
271 }264 }
272 ASSERT_LT(frame, frame_count) << "Couldn't find a visible frame. "265 ASSERT_LT(frame, frame_count)
266 << "Couldn't find a visible frame. "
273 << "remained_spatial_layers: " << remained_spatial_layers267 << "remained_spatial_layers: " << remained_spatial_layers
274 << " super_frame: " << i;268 << " super_frame: " << i;
275 if (frame == frame_count - 1)269 if (frame == frame_count - 1) continue;
276 continue;
277 270
278 frame_data += frame_sizes[frame];271 frame_data += frame_sizes[frame];
279 272
280 // We need to add one more frame for multiple frame contexts.273 // We need to add one more frame for multiple frame contexts.
281 uint8_t marker =274 uint8_t marker =
282 static_cast<const uint8_t*>(inputs[i].buf)[inputs[i].sz - 1];275 static_cast<const uint8_t *>(inputs[i].buf)[inputs[i].sz - 1];
283 const uint32_t mag = ((marker >> 3) & 0x3) + 1;276 const uint32_t mag = ((marker >> 3) & 0x3) + 1;
284 const size_t index_sz = 2 + mag * frame_count;277 const size_t index_sz = 2 + mag * frame_count;
285 const size_t new_index_sz = 2 + mag * (frame + 1);278 const size_t new_index_sz = 2 + mag * (frame + 1);
@@ -445,7 +438,7 @@ TEST_F(SvcTest, SetAutoAltRefOption) { · 159 unmodified lines
445// Test that decoder can handle an SVC frame as the first frame in a sequence.438// Test that decoder can handle an SVC frame as the first frame in a sequence.
446TEST_F(SvcTest, OnePassEncodeOneFrame) {439TEST_F(SvcTest, OnePassEncodeOneFrame) {
447 codec_enc_.g_pass = VPX_RC_ONE_PASS;440 codec_enc_.g_pass = VPX_RC_ONE_PASS;
448 vpx_fixed_buf output = {0};441 vpx_fixed_buf output = { 0 };
449 Pass2EncodeNFrames(NULL, 1, 2, &output);442 Pass2EncodeNFrames(NULL, 1, 2, &output);
450 DecodeNFrames(&output, 1);443 DecodeNFrames(&output, 1);
451 FreeBitstreamBuffers(&output, 1);444 FreeBitstreamBuffers(&output, 1);
@@ -539,8 +532,7 @@ TEST_F(SvcTest, TwoPassEncode2SNRLayers) { · 87 unmodified lines
539 532
540 // Second pass encode533 // Second pass encode
541 codec_enc_.g_pass = VPX_RC_LAST_PASS;534 codec_enc_.g_pass = VPX_RC_LAST_PASS;
542 vpx_svc_set_options(&svc_,535 vpx_svc_set_options(&svc_, "auto-alt-refs=1,1 scale-factors=1/1,1/1");
543 "auto-alt-refs=1,1 scale-factors=1/1,1/1");
544 vpx_fixed_buf outputs[20];536 vpx_fixed_buf outputs[20];
545 memset(&outputs[0], 0, sizeof(outputs));537 memset(&outputs[0], 0, sizeof(outputs));
546 Pass2EncodeNFrames(&stats_buf, 20, 2, &outputs[0]);538 Pass2EncodeNFrames(&stats_buf, 20, 2, &outputs[0]);
@@ -556,8 +548,7 @@ TEST_F(SvcTest, TwoPassEncode3SNRLayersDecode321Layers) { · 9 unmodified lines
556 548
557 // Second pass encode549 // Second pass encode
558 codec_enc_.g_pass = VPX_RC_LAST_PASS;550 codec_enc_.g_pass = VPX_RC_LAST_PASS;
559 vpx_svc_set_options(&svc_,551 vpx_svc_set_options(&svc_, "auto-alt-refs=1,1,1 scale-factors=1/1,1/1,1/1");
560 "auto-alt-refs=1,1,1 scale-factors=1/1,1/1,1/1");
561 vpx_fixed_buf outputs[20];552 vpx_fixed_buf outputs[20];
562 memset(&outputs[0], 0, sizeof(outputs));553 memset(&outputs[0], 0, sizeof(outputs));
563 Pass2EncodeNFrames(&stats_buf, 20, 3, &outputs[0]);554 Pass2EncodeNFrames(&stats_buf, 20, 3, &outputs[0]);
@@ -572,8 +563,7 @@ TEST_F(SvcTest, TwoPassEncode3SNRLayersDecode321Layers) { · 8 unmodified lines
572 563
573TEST_F(SvcTest, SetMultipleFrameContextsOption) {564TEST_F(SvcTest, SetMultipleFrameContextsOption) {
574 svc_.spatial_layers = 5;565 svc_.spatial_layers = 5;
575 vpx_codec_err_t res =566 vpx_codec_err_t res = vpx_svc_set_options(&svc_, "multi-frame-contexts=1");
576 vpx_svc_set_options(&svc_, "multi-frame-contexts=1");
577 EXPECT_EQ(VPX_CODEC_OK, res);567 EXPECT_EQ(VPX_CODEC_OK, res);
578 res = vpx_svc_init(&svc_, &codec_, vpx_codec_vp9_cx(), &codec_enc_);568 res = vpx_svc_init(&svc_, &codec_, vpx_codec_vp9_cx(), &codec_enc_);
579 EXPECT_EQ(VPX_CODEC_INVALID_PARAM, res);569 EXPECT_EQ(VPX_CODEC_INVALID_PARAM, res);
@@ -626,7 +616,8 @@ TEST_F(SvcTest, TwoPassEncode2SNRLayersWithMultipleFrameContexts) { · 46 unmodified lines
626 // Second pass encode616 // Second pass encode
627 codec_enc_.g_pass = VPX_RC_LAST_PASS;617 codec_enc_.g_pass = VPX_RC_LAST_PASS;
628 codec_enc_.g_error_resilient = 0;618 codec_enc_.g_error_resilient = 0;
629 vpx_svc_set_options(&svc_, "auto-alt-refs=1,1 scale-factors=1/1,1/1 "619 vpx_svc_set_options(&svc_,
620 "auto-alt-refs=1,1 scale-factors=1/1,1/1 "
630 "multi-frame-contexts=1");621 "multi-frame-contexts=1");
631 vpx_fixed_buf outputs[10];622 vpx_fixed_buf outputs[10];
632 memset(&outputs[0], 0, sizeof(outputs));623 memset(&outputs[0], 0, sizeof(outputs));
@@ -645,7 +636,8 @@ TEST_F(SvcTest, · 12 unmodified lines
645 // Second pass encode636 // Second pass encode
646 codec_enc_.g_pass = VPX_RC_LAST_PASS;637 codec_enc_.g_pass = VPX_RC_LAST_PASS;
647 codec_enc_.g_error_resilient = 0;638 codec_enc_.g_error_resilient = 0;
648 vpx_svc_set_options(&svc_, "auto-alt-refs=1,1,1 scale-factors=1/1,1/1,1/1 "639 vpx_svc_set_options(&svc_,
640 "auto-alt-refs=1,1,1 scale-factors=1/1,1/1,1/1 "
649 "multi-frame-contexts=1");641 "multi-frame-contexts=1");
650 vpx_fixed_buf outputs[10];642 vpx_fixed_buf outputs[10];
651 memset(&outputs[0], 0, sizeof(outputs));643 memset(&outputs[0], 0, sizeof(outputs));
@@ -689,7 +681,8 @@ TEST_F(SvcTest, TwoPassEncode2TemporalLayersWithMultipleFrameContexts) { · 37 unmodified lines
689 codec_enc_.g_pass = VPX_RC_LAST_PASS;681 codec_enc_.g_pass = VPX_RC_LAST_PASS;
690 svc_.temporal_layers = 2;682 svc_.temporal_layers = 2;
691 codec_enc_.g_error_resilient = 0;683 codec_enc_.g_error_resilient = 0;
692 vpx_svc_set_options(&svc_, "auto-alt-refs=1 scale-factors=1/1 "684 vpx_svc_set_options(&svc_,
685 "auto-alt-refs=1 scale-factors=1/1 "
693 "multi-frame-contexts=1");686 "multi-frame-contexts=1");
694 vpx_fixed_buf outputs[10];687 vpx_fixed_buf outputs[10];
695 memset(&outputs[0], 0, sizeof(outputs));688 memset(&outputs[0], 0, sizeof(outputs));
@@ -714,8 +707,7 @@ TEST_F(SvcTest, TwoPassEncode2TemporalLayersDecodeBaseLayer) { · 18 unmodified lines
714 Pass2EncodeNFrames(&stats_buf, 10, 1, &outputs[0]);707 Pass2EncodeNFrames(&stats_buf, 10, 1, &outputs[0]);
715 708
716 vpx_fixed_buf base_layer[5];709 vpx_fixed_buf base_layer[5];
717 for (int i = 0; i < 5; ++i)710 for (int i = 0; i < 5; ++i) base_layer[i] = outputs[i * 2];
718 base_layer[i] = outputs[i * 2];
719 711
720 DecodeNFrames(&base_layer[0], 5);712 DecodeNFrames(&base_layer[0], 5);
721 FreeBitstreamBuffers(&outputs[0], 10);713 FreeBitstreamBuffers(&outputs[0], 10);
@@ -733,15 +725,15 @@ TEST_F(SvcTest, · 11 unmodified lines
733 codec_enc_.g_pass = VPX_RC_LAST_PASS;725 codec_enc_.g_pass = VPX_RC_LAST_PASS;
734 svc_.temporal_layers = 2;726 svc_.temporal_layers = 2;
735 codec_enc_.g_error_resilient = 0;727 codec_enc_.g_error_resilient = 0;
736 vpx_svc_set_options(&svc_, "auto-alt-refs=1 scale-factors=1/1 "728 vpx_svc_set_options(&svc_,
729 "auto-alt-refs=1 scale-factors=1/1 "
737 "multi-frame-contexts=1");730 "multi-frame-contexts=1");
738 vpx_fixed_buf outputs[10];731 vpx_fixed_buf outputs[10];
739 memset(&outputs[0], 0, sizeof(outputs));732 memset(&outputs[0], 0, sizeof(outputs));
740 Pass2EncodeNFrames(&stats_buf, 10, 1, &outputs[0]);733 Pass2EncodeNFrames(&stats_buf, 10, 1, &outputs[0]);
741 734
742 vpx_fixed_buf base_layer[5];735 vpx_fixed_buf base_layer[5];
743 for (int i = 0; i < 5; ++i)736 for (int i = 0; i < 5; ++i) base_layer[i] = outputs[i * 2];
744 base_layer[i] = outputs[i * 2];
745 737
746 DecodeNFrames(&base_layer[0], 5);738 DecodeNFrames(&base_layer[0], 5);
747 FreeBitstreamBuffers(&outputs[0], 10);739 FreeBitstreamBuffers(&outputs[0], 10);
@@ -769,8 +761,7 @@ TEST_F(SvcTest, TwoPassEncode2TemporalLayersWithTiles) { · 21 unmodified lines
769 FreeBitstreamBuffers(&outputs[0], 10);761 FreeBitstreamBuffers(&outputs[0], 10);
770}762}
771 763
772TEST_F(SvcTest,764TEST_F(SvcTest, TwoPassEncode2TemporalLayersWithMultipleFrameContextsAndTiles) {
773 TwoPassEncode2TemporalLayersWithMultipleFrameContextsAndTiles) {
774 // First pass encode765 // First pass encode
775 std::string stats_buf;766 std::string stats_buf;
776 vpx_svc_set_options(&svc_, "scale-factors=1/1");767 vpx_svc_set_options(&svc_, "scale-factors=1/1");
@@ -785,7 +776,8 @@ TEST_F(SvcTest, · 8 unmodified lines
785 codec_enc_.g_h = 144;776 codec_enc_.g_h = 144;
786 tile_columns_ = 1;777 tile_columns_ = 1;
787 tile_rows_ = 1;778 tile_rows_ = 1;
788 vpx_svc_set_options(&svc_, "auto-alt-refs=1 scale-factors=1/1 "779 vpx_svc_set_options(&svc_,
780 "auto-alt-refs=1 scale-factors=1/1 "
789 "multi-frame-contexts=1");781 "multi-frame-contexts=1");
790 vpx_fixed_buf outputs[10];782 vpx_fixed_buf outputs[10];
791 memset(&outputs[0], 0, sizeof(outputs));783 memset(&outputs[0], 0, sizeof(outputs));
test/test_intra_pred_speed.cc+55−82
@@ -31,9 +31,9 @@ typedef void (*VpxPredFunc)(uint8_t *dst, ptrdiff_t y_stride, · 30 unmodified lines
31 31
32const int kNumVp9IntraPredFuncs = 13;32const int kNumVp9IntraPredFuncs = 13;
33const char *kVp9IntraPredNames[kNumVp9IntraPredFuncs] = {33const char *kVp9IntraPredNames[kNumVp9IntraPredFuncs] = {
34 "DC_PRED", "DC_LEFT_PRED", "DC_TOP_PRED", "DC_128_PRED", "V_PRED", "H_PRED",34 "DC_PRED", "DC_LEFT_PRED", "DC_TOP_PRED", "DC_128_PRED", "V_PRED",
35 "D45_PRED", "D135_PRED", "D117_PRED", "D153_PRED", "D207_PRED", "D63_PRED",35 "H_PRED", "D45_PRED", "D135_PRED", "D117_PRED", "D153_PRED",
36 "TM_PRED"36 "D207_PRED", "D63_PRED", "TM_PRED"
37};37};
38 38
39void TestIntraPred(const char name[], VpxPredFunc const *pred_funcs,39void TestIntraPred(const char name[], VpxPredFunc const *pred_funcs,
@@ -82,18 +82,12 @@ void TestIntraPred(const char name[], VpxPredFunc const *pred_funcs, · 42 unmodified lines
82void TestIntraPred4(VpxPredFunc const *pred_funcs) {82void TestIntraPred4(VpxPredFunc const *pred_funcs) {
83 static const int kNumVp9IntraFuncs = 13;83 static const int kNumVp9IntraFuncs = 13;
84 static const char *const kSignatures[kNumVp9IntraFuncs] = {84 static const char *const kSignatures[kNumVp9IntraFuncs] = {
85 "4334156168b34ab599d9b5b30f522fe9",85 "4334156168b34ab599d9b5b30f522fe9", "bc4649d5ba47c7ff178d92e475960fb0",
86 "bc4649d5ba47c7ff178d92e475960fb0",86 "8d316e5933326dcac24e1064794b5d12", "a27270fed024eafd762c95de85f4da51",
87 "8d316e5933326dcac24e1064794b5d12",87 "c33dff000d4256c2b8f3bf9e9bab14d2", "44d8cddc2ad8f79b8ed3306051722b4f",
88 "a27270fed024eafd762c95de85f4da51",88 "eb54839b2bad6699d8946f01ec041cd0", "ecb0d56ae5f677ea45127ce9d5c058e4",
89 "c33dff000d4256c2b8f3bf9e9bab14d2",89 "0b7936841f6813da818275944895b574", "9117972ef64f91a58ff73e1731c81db2",
90 "44d8cddc2ad8f79b8ed3306051722b4f",90 "c56d5e8c729e46825f46dd5d3b5d508a", "c0889e2039bcf7bcb5d2f33cdca69adc",
91 "eb54839b2bad6699d8946f01ec041cd0",
92 "ecb0d56ae5f677ea45127ce9d5c058e4",
93 "0b7936841f6813da818275944895b574",
94 "9117972ef64f91a58ff73e1731c81db2",
95 "c56d5e8c729e46825f46dd5d3b5d508a",
96 "c0889e2039bcf7bcb5d2f33cdca69adc",
97 "309a618577b27c648f9c5ee45252bc8f",91 "309a618577b27c648f9c5ee45252bc8f",
98 };92 };
99 TestIntraPred("Intra4", pred_funcs, kVp9IntraPredNames, kNumVp9IntraFuncs,93 TestIntraPred("Intra4", pred_funcs, kVp9IntraPredNames, kNumVp9IntraFuncs,
@@ -103,18 +97,12 @@ void TestIntraPred4(VpxPredFunc const *pred_funcs) { · 3 unmodified lines
103void TestIntraPred8(VpxPredFunc const *pred_funcs) {97void TestIntraPred8(VpxPredFunc const *pred_funcs) {
104 static const int kNumVp9IntraFuncs = 13;98 static const int kNumVp9IntraFuncs = 13;
105 static const char *const kSignatures[kNumVp9IntraFuncs] = {99 static const char *const kSignatures[kNumVp9IntraFuncs] = {
106 "7694ddeeefed887faf9d339d18850928",100 "7694ddeeefed887faf9d339d18850928", "7d726b1213591b99f736be6dec65065b",
107 "7d726b1213591b99f736be6dec65065b",101 "19c5711281357a485591aaf9c96c0a67", "ba6b66877a089e71cd938e3b8c40caac",
108 "19c5711281357a485591aaf9c96c0a67",102 "802440c93317e0f8ba93fab02ef74265", "9e09a47a15deb0b9d8372824f9805080",
109 "ba6b66877a089e71cd938e3b8c40caac",103 "b7c2d8c662268c0c427da412d7b0311d", "78339c1c60bb1d67d248ab8c4da08b7f",
110 "802440c93317e0f8ba93fab02ef74265",104 "5c97d70f7d47de1882a6cd86c165c8a9", "8182bf60688b42205acd95e59e967157",
111 "9e09a47a15deb0b9d8372824f9805080",105 "08323400005a297f16d7e57e7fe1eaac", "95f7bfc262329a5849eda66d8f7c68ce",
112 "b7c2d8c662268c0c427da412d7b0311d",
113 "78339c1c60bb1d67d248ab8c4da08b7f",
114 "5c97d70f7d47de1882a6cd86c165c8a9",
115 "8182bf60688b42205acd95e59e967157",
116 "08323400005a297f16d7e57e7fe1eaac",
117 "95f7bfc262329a5849eda66d8f7c68ce",
118 "815b75c8e0d91cc1ae766dc5d3e445a3",106 "815b75c8e0d91cc1ae766dc5d3e445a3",
119 };107 };
120 TestIntraPred("Intra8", pred_funcs, kVp9IntraPredNames, kNumVp9IntraFuncs,108 TestIntraPred("Intra8", pred_funcs, kVp9IntraPredNames, kNumVp9IntraFuncs,
@@ -124,18 +112,12 @@ void TestIntraPred8(VpxPredFunc const *pred_funcs) { · 3 unmodified lines
124void TestIntraPred16(VpxPredFunc const *pred_funcs) {112void TestIntraPred16(VpxPredFunc const *pred_funcs) {
125 static const int kNumVp9IntraFuncs = 13;113 static const int kNumVp9IntraFuncs = 13;
126 static const char *const kSignatures[kNumVp9IntraFuncs] = {114 static const char *const kSignatures[kNumVp9IntraFuncs] = {
127 "b40dbb555d5d16a043dc361e6694fe53",115 "b40dbb555d5d16a043dc361e6694fe53", "fb08118cee3b6405d64c1fd68be878c6",
128 "fb08118cee3b6405d64c1fd68be878c6",116 "6c190f341475c837cc38c2e566b64875", "db5c34ccbe2c7f595d9b08b0dc2c698c",
129 "6c190f341475c837cc38c2e566b64875",117 "a62cbfd153a1f0b9fed13e62b8408a7a", "143df5b4c89335e281103f610f5052e4",
130 "db5c34ccbe2c7f595d9b08b0dc2c698c",118 "d87feb124107cdf2cfb147655aa0bb3c", "7841fae7d4d47b519322e6a03eeed9dc",
131 "a62cbfd153a1f0b9fed13e62b8408a7a",119 "f6ebed3f71cbcf8d6d0516ce87e11093", "3cc480297dbfeed01a1c2d78dd03d0c5",
132 "143df5b4c89335e281103f610f5052e4",120 "b9f69fa6532b372c545397dcb78ef311", "a8fe1c70432f09d0c20c67bdb6432c4d",
133 "d87feb124107cdf2cfb147655aa0bb3c",
134 "7841fae7d4d47b519322e6a03eeed9dc",
135 "f6ebed3f71cbcf8d6d0516ce87e11093",
136 "3cc480297dbfeed01a1c2d78dd03d0c5",
137 "b9f69fa6532b372c545397dcb78ef311",
138 "a8fe1c70432f09d0c20c67bdb6432c4d",
139 "b8a41aa968ec108af447af4217cba91b",121 "b8a41aa968ec108af447af4217cba91b",
140 };122 };
141 TestIntraPred("Intra16", pred_funcs, kVp9IntraPredNames, kNumVp9IntraFuncs,123 TestIntraPred("Intra16", pred_funcs, kVp9IntraPredNames, kNumVp9IntraFuncs,
@@ -145,18 +127,12 @@ void TestIntraPred16(VpxPredFunc const *pred_funcs) { · 3 unmodified lines
145void TestIntraPred32(VpxPredFunc const *pred_funcs) {127void TestIntraPred32(VpxPredFunc const *pred_funcs) {
146 static const int kNumVp9IntraFuncs = 13;128 static const int kNumVp9IntraFuncs = 13;
147 static const char *const kSignatures[kNumVp9IntraFuncs] = {129 static const char *const kSignatures[kNumVp9IntraFuncs] = {
148 "558541656d84f9ae7896db655826febe",130 "558541656d84f9ae7896db655826febe", "b3587a1f9a01495fa38c8cd3c8e2a1bf",
149 "b3587a1f9a01495fa38c8cd3c8e2a1bf",131 "4c6501e64f25aacc55a2a16c7e8f0255", "b3b01379ba08916ef6b1b35f7d9ad51c",
150 "4c6501e64f25aacc55a2a16c7e8f0255",132 "0f1eb38b6cbddb3d496199ef9f329071", "911c06efb9ed1c3b4c104b232b55812f",
151 "b3b01379ba08916ef6b1b35f7d9ad51c",133 "9225beb0ddfa7a1d24eaa1be430a6654", "0a6d584a44f8db9aa7ade2e2fdb9fc9e",
152 "0f1eb38b6cbddb3d496199ef9f329071",134 "b01c9076525216925f3456f034fb6eee", "d267e20ad9e5cd2915d1a47254d3d149",
153 "911c06efb9ed1c3b4c104b232b55812f",135 "ed012a4a5da71f36c2393023184a0e59", "f162b51ed618d28b936974cff4391da5",
154 "9225beb0ddfa7a1d24eaa1be430a6654",
155 "0a6d584a44f8db9aa7ade2e2fdb9fc9e",
156 "b01c9076525216925f3456f034fb6eee",
157 "d267e20ad9e5cd2915d1a47254d3d149",
158 "ed012a4a5da71f36c2393023184a0e59",
159 "f162b51ed618d28b936974cff4391da5",
160 "9e1370c6d42e08d357d9612c93a71cfc",136 "9e1370c6d42e08d357d9612c93a71cfc",
161 };137 };
162 TestIntraPred("Intra32", pred_funcs, kVp9IntraPredNames, kNumVp9IntraFuncs,138 TestIntraPred("Intra32", pred_funcs, kVp9IntraPredNames, kNumVp9IntraFuncs,
@@ -167,13 +143,13 @@ void TestIntraPred32(VpxPredFunc const *pred_funcs) { · 4 unmodified lines
167 143
168// Defines a test case for |arch| (e.g., C, SSE2, ...) passing the predictors144// Defines a test case for |arch| (e.g., C, SSE2, ...) passing the predictors
169// to |test_func|. The test name is 'arch.test_func', e.g., C.TestIntraPred4.145// to |test_func|. The test name is 'arch.test_func', e.g., C.TestIntraPred4.
170#define INTRA_PRED_TEST(arch, test_func, dc, dc_left, dc_top, dc_128, v, h, \146#define INTRA_PRED_TEST(arch, test_func, dc, dc_left, dc_top, dc_128, v, h, \
171 d45, d135, d117, d153, d207, d63, tm) \147 d45, d135, d117, d153, d207, d63, tm) \
172 TEST(arch, test_func) { \148 TEST(arch, test_func) { \
173 static const VpxPredFunc vpx_intra_pred[] = { \149 static const VpxPredFunc vpx_intra_pred[] = { \
174 dc, dc_left, dc_top, dc_128, v, h, d45, \150 dc, dc_left, dc_top, dc_128, v, h, d45, d135, d117, d153, d207, d63, tm \
175 d135, d117, d153, d207, d63, tm}; \151 }; \
176 test_func(vpx_intra_pred); \152 test_func(vpx_intra_pred); \
177 }153 }
178 154
179// -----------------------------------------------------------------------------155// -----------------------------------------------------------------------------
@@ -197,9 +173,8 @@ INTRA_PRED_TEST(SSE2, TestIntraPred4, vpx_dc_predictor_4x4_sse2, · 17 unmodified lines
197#endif // HAVE_SSE2173#endif // HAVE_SSE2
198 174
199#if HAVE_SSSE3175#if HAVE_SSSE3
200INTRA_PRED_TEST(SSSE3, TestIntraPred4, NULL, NULL, NULL, NULL, NULL,176INTRA_PRED_TEST(SSSE3, TestIntraPred4, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
201 NULL, NULL, NULL, NULL,177 NULL, NULL, vpx_d153_predictor_4x4_ssse3, NULL,
202 vpx_d153_predictor_4x4_ssse3, NULL,
203 vpx_d63_predictor_4x4_ssse3, NULL)178 vpx_d63_predictor_4x4_ssse3, NULL)
204#endif // HAVE_SSSE3179#endif // HAVE_SSSE3
205 180
@@ -222,8 +197,8 @@ INTRA_PRED_TEST(NEON, TestIntraPred4, vpx_dc_predictor_4x4_neon, · 16 unmodified lines
222INTRA_PRED_TEST(MSA, TestIntraPred4, vpx_dc_predictor_4x4_msa,197INTRA_PRED_TEST(MSA, TestIntraPred4, vpx_dc_predictor_4x4_msa,
223 vpx_dc_left_predictor_4x4_msa, vpx_dc_top_predictor_4x4_msa,198 vpx_dc_left_predictor_4x4_msa, vpx_dc_top_predictor_4x4_msa,
224 vpx_dc_128_predictor_4x4_msa, vpx_v_predictor_4x4_msa,199 vpx_dc_128_predictor_4x4_msa, vpx_v_predictor_4x4_msa,
225 vpx_h_predictor_4x4_msa, NULL, NULL, NULL, NULL, NULL,200 vpx_h_predictor_4x4_msa, NULL, NULL, NULL, NULL, NULL, NULL,
226 NULL, vpx_tm_predictor_4x4_msa)201 vpx_tm_predictor_4x4_msa)
227#endif // HAVE_MSA202#endif // HAVE_MSA
228 203
229// -----------------------------------------------------------------------------204// -----------------------------------------------------------------------------
@@ -246,10 +221,9 @@ INTRA_PRED_TEST(SSE2, TestIntraPred8, vpx_dc_predictor_8x8_sse2, · 16 unmodified lines
246#endif // HAVE_SSE2221#endif // HAVE_SSE2
247 222
248#if HAVE_SSSE3223#if HAVE_SSSE3
249INTRA_PRED_TEST(SSSE3, TestIntraPred8, NULL, NULL, NULL, NULL, NULL,224INTRA_PRED_TEST(SSSE3, TestIntraPred8, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
250 NULL, NULL, NULL, NULL,225 NULL, NULL, vpx_d153_predictor_8x8_ssse3,
251 vpx_d153_predictor_8x8_ssse3, vpx_d207_predictor_8x8_ssse3,226 vpx_d207_predictor_8x8_ssse3, vpx_d63_predictor_8x8_ssse3, NULL)
252 vpx_d63_predictor_8x8_ssse3, NULL)
253#endif // HAVE_SSSE3227#endif // HAVE_SSSE3
254 228
255#if HAVE_DSPR2229#if HAVE_DSPR2
@@ -271,8 +245,8 @@ INTRA_PRED_TEST(NEON, TestIntraPred8, vpx_dc_predictor_8x8_neon, · 15 unmodified lines
271INTRA_PRED_TEST(MSA, TestIntraPred8, vpx_dc_predictor_8x8_msa,245INTRA_PRED_TEST(MSA, TestIntraPred8, vpx_dc_predictor_8x8_msa,
272 vpx_dc_left_predictor_8x8_msa, vpx_dc_top_predictor_8x8_msa,246 vpx_dc_left_predictor_8x8_msa, vpx_dc_top_predictor_8x8_msa,
273 vpx_dc_128_predictor_8x8_msa, vpx_v_predictor_8x8_msa,247 vpx_dc_128_predictor_8x8_msa, vpx_v_predictor_8x8_msa,
274 vpx_h_predictor_8x8_msa, NULL, NULL, NULL, NULL, NULL,248 vpx_h_predictor_8x8_msa, NULL, NULL, NULL, NULL, NULL, NULL,
275 NULL, vpx_tm_predictor_8x8_msa)249 vpx_tm_predictor_8x8_msa)
276#endif // HAVE_MSA250#endif // HAVE_MSA
277 251
278// -----------------------------------------------------------------------------252// -----------------------------------------------------------------------------
@@ -296,11 +270,10 @@ INTRA_PRED_TEST(SSE2, TestIntraPred16, vpx_dc_predictor_16x16_sse2, · 17 unmodified lines
296#endif // HAVE_SSE2270#endif // HAVE_SSE2
297 271
298#if HAVE_SSSE3272#if HAVE_SSSE3
299INTRA_PRED_TEST(SSSE3, TestIntraPred16, NULL, NULL, NULL, NULL, NULL,273INTRA_PRED_TEST(SSSE3, TestIntraPred16, NULL, NULL, NULL, NULL, NULL, NULL,
300 NULL, vpx_d45_predictor_16x16_ssse3,274 vpx_d45_predictor_16x16_ssse3, NULL, NULL,
301 NULL, NULL, vpx_d153_predictor_16x16_ssse3,275 vpx_d153_predictor_16x16_ssse3, vpx_d207_predictor_16x16_ssse3,
302 vpx_d207_predictor_16x16_ssse3, vpx_d63_predictor_16x16_ssse3,276 vpx_d63_predictor_16x16_ssse3, NULL)
303 NULL)
304#endif // HAVE_SSSE3277#endif // HAVE_SSSE3
305 278
306#if HAVE_DSPR2279#if HAVE_DSPR2
@@ -322,8 +295,8 @@ INTRA_PRED_TEST(NEON, TestIntraPred16, vpx_dc_predictor_16x16_neon, · 15 unmodified lines
322INTRA_PRED_TEST(MSA, TestIntraPred16, vpx_dc_predictor_16x16_msa,295INTRA_PRED_TEST(MSA, TestIntraPred16, vpx_dc_predictor_16x16_msa,
323 vpx_dc_left_predictor_16x16_msa, vpx_dc_top_predictor_16x16_msa,296 vpx_dc_left_predictor_16x16_msa, vpx_dc_top_predictor_16x16_msa,
324 vpx_dc_128_predictor_16x16_msa, vpx_v_predictor_16x16_msa,297 vpx_dc_128_predictor_16x16_msa, vpx_v_predictor_16x16_msa,
325 vpx_h_predictor_16x16_msa, NULL, NULL, NULL, NULL, NULL,298 vpx_h_predictor_16x16_msa, NULL, NULL, NULL, NULL, NULL, NULL,
326 NULL, vpx_tm_predictor_16x16_msa)299 vpx_tm_predictor_16x16_msa)
327#endif // HAVE_MSA300#endif // HAVE_MSA
328 301
329// -----------------------------------------------------------------------------302// -----------------------------------------------------------------------------
@@ -342,13 +315,13 @@ INTRA_PRED_TEST(SSE2, TestIntraPred32, vpx_dc_predictor_32x32_sse2, · 12 unmodified lines
342 vpx_dc_left_predictor_32x32_sse2,315 vpx_dc_left_predictor_32x32_sse2,
343 vpx_dc_top_predictor_32x32_sse2,316 vpx_dc_top_predictor_32x32_sse2,
344 vpx_dc_128_predictor_32x32_sse2, vpx_v_predictor_32x32_sse2,317 vpx_dc_128_predictor_32x32_sse2, vpx_v_predictor_32x32_sse2,
345 vpx_h_predictor_32x32_sse2, NULL, NULL, NULL, NULL, NULL,318 vpx_h_predictor_32x32_sse2, NULL, NULL, NULL, NULL, NULL, NULL,
346 NULL, vpx_tm_predictor_32x32_sse2)319 vpx_tm_predictor_32x32_sse2)
347#endif // HAVE_SSE2320#endif // HAVE_SSE2
348 321
349#if HAVE_SSSE3322#if HAVE_SSSE3
350INTRA_PRED_TEST(SSSE3, TestIntraPred32, NULL, NULL, NULL, NULL, NULL,323INTRA_PRED_TEST(SSSE3, TestIntraPred32, NULL, NULL, NULL, NULL, NULL, NULL,
351 NULL, vpx_d45_predictor_32x32_ssse3, NULL, NULL,324 vpx_d45_predictor_32x32_ssse3, NULL, NULL,
352 vpx_d153_predictor_32x32_ssse3, vpx_d207_predictor_32x32_ssse3,325 vpx_d153_predictor_32x32_ssse3, vpx_d207_predictor_32x32_ssse3,
353 vpx_d63_predictor_32x32_ssse3, NULL)326 vpx_d63_predictor_32x32_ssse3, NULL)
354#endif // HAVE_SSSE3327#endif // HAVE_SSSE3
@@ -366,8 +339,8 @@ INTRA_PRED_TEST(NEON, TestIntraPred32, vpx_dc_predictor_32x32_neon, · 11 unmodified lines
366INTRA_PRED_TEST(MSA, TestIntraPred32, vpx_dc_predictor_32x32_msa,339INTRA_PRED_TEST(MSA, TestIntraPred32, vpx_dc_predictor_32x32_msa,
367 vpx_dc_left_predictor_32x32_msa, vpx_dc_top_predictor_32x32_msa,340 vpx_dc_left_predictor_32x32_msa, vpx_dc_top_predictor_32x32_msa,
368 vpx_dc_128_predictor_32x32_msa, vpx_v_predictor_32x32_msa,341 vpx_dc_128_predictor_32x32_msa, vpx_v_predictor_32x32_msa,
369 vpx_h_predictor_32x32_msa, NULL, NULL, NULL, NULL, NULL,342 vpx_h_predictor_32x32_msa, NULL, NULL, NULL, NULL, NULL, NULL,
370 NULL, vpx_tm_predictor_32x32_msa)343 vpx_tm_predictor_32x32_msa)
371#endif // HAVE_MSA344#endif // HAVE_MSA
372 345
373#include "test/test_libvpx.cc"346#include "test/test_libvpx.cc"
test/test_libvpx.cc+6−12
@@ -41,22 +41,16 @@ int main(int argc, char **argv) { · 40 unmodified lines
41 41
42#if ARCH_X86 || ARCH_X86_6442#if ARCH_X86 || ARCH_X86_64
43 const int simd_caps = x86_simd_caps();43 const int simd_caps = x86_simd_caps();
44 if (!(simd_caps & HAS_MMX))44 if (!(simd_caps & HAS_MMX)) append_negative_gtest_filter(":MMX.*:MMX/*");
45 append_negative_gtest_filter(":MMX.*:MMX/*");45 if (!(simd_caps & HAS_SSE)) append_negative_gtest_filter(":SSE.*:SSE/*");
46 if (!(simd_caps & HAS_SSE))46 if (!(simd_caps & HAS_SSE2)) append_negative_gtest_filter(":SSE2.*:SSE2/*");
47 append_negative_gtest_filter(":SSE.*:SSE/*");47 if (!(simd_caps & HAS_SSE3)) append_negative_gtest_filter(":SSE3.*:SSE3/*");
48 if (!(simd_caps & HAS_SSE2))
49 append_negative_gtest_filter(":SSE2.*:SSE2/*");
50 if (!(simd_caps & HAS_SSE3))
51 append_negative_gtest_filter(":SSE3.*:SSE3/*");
52 if (!(simd_caps & HAS_SSSE3))48 if (!(simd_caps & HAS_SSSE3))
53 append_negative_gtest_filter(":SSSE3.*:SSSE3/*");49 append_negative_gtest_filter(":SSSE3.*:SSSE3/*");
54 if (!(simd_caps & HAS_SSE4_1))50 if (!(simd_caps & HAS_SSE4_1))
55 append_negative_gtest_filter(":SSE4_1.*:SSE4_1/*");51 append_negative_gtest_filter(":SSE4_1.*:SSE4_1/*");
56 if (!(simd_caps & HAS_AVX))52 if (!(simd_caps & HAS_AVX)) append_negative_gtest_filter(":AVX.*:AVX/*");
57 append_negative_gtest_filter(":AVX.*:AVX/*");53 if (!(simd_caps & HAS_AVX2)) append_negative_gtest_filter(":AVX2.*:AVX2/*");
58 if (!(simd_caps & HAS_AVX2))
59 append_negative_gtest_filter(":AVX2.*:AVX2/*");
60#endif // ARCH_X86 || ARCH_X86_6454#endif // ARCH_X86 || ARCH_X86_64
61 55
62#if !CONFIG_SHARED56#if !CONFIG_SHARED
test/test_vector_test.cc+15−22
@@ -28,43 +28,36 @@ · 27 unmodified lines
28 28
29namespace {29namespace {
30 30
31enum DecodeMode {31enum DecodeMode { kSerialMode, kFrameParallelMode };
32 kSerialMode,
33 kFrameParallelMode
34};
35 32
36const int kDecodeMode = 0;33const int kDecodeMode = 0;
37const int kThreads = 1;34const int kThreads = 1;
38const int kFileName = 2;35const int kFileName = 2;
39 36
40typedef std::tr1::tuple<int, int, const char*> DecodeParam;37typedef std::tr1::tuple<int, int, const char *> DecodeParam;
41 38
42class TestVectorTest : public ::libvpx_test::DecoderTest,39class TestVectorTest : public ::libvpx_test::DecoderTest,
43 public ::libvpx_test::CodecTestWithParam<DecodeParam> {40 public ::libvpx_test::CodecTestWithParam<DecodeParam> {
44 protected:41 protected:
45 TestVectorTest()42 TestVectorTest() : DecoderTest(GET_PARAM(0)), md5_file_(NULL) {
46 : DecoderTest(GET_PARAM(0)),
47 md5_file_(NULL) {
48#if CONFIG_VP9_DECODER43#if CONFIG_VP9_DECODER
49 resize_clips_.insert(44 resize_clips_.insert(::libvpx_test::kVP9TestVectorsResize,
50 ::libvpx_test::kVP9TestVectorsResize,45 ::libvpx_test::kVP9TestVectorsResize +
51 ::libvpx_test::kVP9TestVectorsResize +46 ::libvpx_test::kNumVP9TestVectorsResize);
52 ::libvpx_test::kNumVP9TestVectorsResize);
53#endif47#endif
54 }48 }
55 49
56 virtual ~TestVectorTest() {50 virtual ~TestVectorTest() {
57 if (md5_file_)51 if (md5_file_) fclose(md5_file_);
58 fclose(md5_file_);
59 }52 }
60 53
61 void OpenMD5File(const std::string& md5_file_name_) {54 void OpenMD5File(const std::string &md5_file_name_) {
62 md5_file_ = libvpx_test::OpenTestDataFile(md5_file_name_);55 md5_file_ = libvpx_test::OpenTestDataFile(md5_file_name_);
63 ASSERT_TRUE(md5_file_ != NULL) << "Md5 file open failed. Filename: "56 ASSERT_TRUE(md5_file_ != NULL) << "Md5 file open failed. Filename: "
64 << md5_file_name_;57 << md5_file_name_;
65 }58 }
66 59
67 virtual void DecompressedFrameHook(const vpx_image_t& img,60 virtual void DecompressedFrameHook(const vpx_image_t &img,
68 const unsigned int frame_number) {61 const unsigned int frame_number) {
69 ASSERT_TRUE(md5_file_ != NULL);62 ASSERT_TRUE(md5_file_ != NULL);
70 char expected_md5[33];63 char expected_md5[33];
@@ -121,8 +114,8 @@ TEST_P(TestVectorTest, MD5Match) { · 50 unmodified lines
121 cfg.threads = threads;114 cfg.threads = threads;
122 115
123 snprintf(str, sizeof(str) / sizeof(str[0]) - 1,116 snprintf(str, sizeof(str) / sizeof(str[0]) - 1,
124 "file: %s mode: %s threads: %d",117 "file: %s mode: %s threads: %d", filename.c_str(),
125 filename.c_str(), mode == 0 ? "Serial" : "Parallel", threads);118 mode == 0 ? "Serial" : "Parallel", threads);
126 SCOPED_TRACE(str);119 SCOPED_TRACE(str);
127 120
128 // Open compressed video file.121 // Open compressed video file.
@@ -183,8 +176,8 @@ INSTANTIATE_TEST_CASE_P( · 54 unmodified lines
183 ::testing::Values(176 ::testing::Values(
184 static_cast<const libvpx_test::CodecFactory *>(&libvpx_test::kVP9)),177 static_cast<const libvpx_test::CodecFactory *>(&libvpx_test::kVP9)),
185 ::testing::Combine(178 ::testing::Combine(
186 ::testing::Values(1), // Frame Parallel mode.179 ::testing::Values(1), // Frame Parallel mode.
187 ::testing::Range(2, 9), // With 2 ~ 8 threads.180 ::testing::Range(2, 9), // With 2 ~ 8 threads.
188 ::testing::ValuesIn(libvpx_test::kVP9TestVectors,181 ::testing::ValuesIn(libvpx_test::kVP9TestVectors,
189 libvpx_test::kVP9TestVectors +182 libvpx_test::kVP9TestVectors +
190 libvpx_test::kNumVP9TestVectors))));183 libvpx_test::kNumVP9TestVectors))));
test/test_vectors.cc+323−192
@@ -16,201 +16,324 @@ namespace libvpx_test { · 15 unmodified lines
16 16
17#if CONFIG_VP8_DECODER17#if CONFIG_VP8_DECODER
18const char *const kVP8TestVectors[] = {18const char *const kVP8TestVectors[] = {
19 "vp80-00-comprehensive-001.ivf",19 "vp80-00-comprehensive-001.ivf", "vp80-00-comprehensive-002.ivf",
20 "vp80-00-comprehensive-002.ivf", "vp80-00-comprehensive-003.ivf",20 "vp80-00-comprehensive-003.ivf", "vp80-00-comprehensive-004.ivf",
21 "vp80-00-comprehensive-004.ivf", "vp80-00-comprehensive-005.ivf",21 "vp80-00-comprehensive-005.ivf", "vp80-00-comprehensive-006.ivf",
22 "vp80-00-comprehensive-006.ivf", "vp80-00-comprehensive-007.ivf",22 "vp80-00-comprehensive-007.ivf", "vp80-00-comprehensive-008.ivf",
23 "vp80-00-comprehensive-008.ivf", "vp80-00-comprehensive-009.ivf",23 "vp80-00-comprehensive-009.ivf", "vp80-00-comprehensive-010.ivf",
24 "vp80-00-comprehensive-010.ivf", "vp80-00-comprehensive-011.ivf",24 "vp80-00-comprehensive-011.ivf", "vp80-00-comprehensive-012.ivf",
25 "vp80-00-comprehensive-012.ivf", "vp80-00-comprehensive-013.ivf",25 "vp80-00-comprehensive-013.ivf", "vp80-00-comprehensive-014.ivf",
26 "vp80-00-comprehensive-014.ivf", "vp80-00-comprehensive-015.ivf",26 "vp80-00-comprehensive-015.ivf", "vp80-00-comprehensive-016.ivf",
27 "vp80-00-comprehensive-016.ivf", "vp80-00-comprehensive-017.ivf",27 "vp80-00-comprehensive-017.ivf", "vp80-00-comprehensive-018.ivf",
28 "vp80-00-comprehensive-018.ivf", "vp80-01-intra-1400.ivf",28 "vp80-01-intra-1400.ivf", "vp80-01-intra-1411.ivf",
29 "vp80-01-intra-1411.ivf", "vp80-01-intra-1416.ivf",29 "vp80-01-intra-1416.ivf", "vp80-01-intra-1417.ivf",
30 "vp80-01-intra-1417.ivf", "vp80-02-inter-1402.ivf",30 "vp80-02-inter-1402.ivf", "vp80-02-inter-1412.ivf",
31 "vp80-02-inter-1412.ivf", "vp80-02-inter-1418.ivf",31 "vp80-02-inter-1418.ivf", "vp80-02-inter-1424.ivf",
32 "vp80-02-inter-1424.ivf", "vp80-03-segmentation-01.ivf",32 "vp80-03-segmentation-01.ivf", "vp80-03-segmentation-02.ivf",
33 "vp80-03-segmentation-02.ivf", "vp80-03-segmentation-03.ivf",33 "vp80-03-segmentation-03.ivf", "vp80-03-segmentation-04.ivf",
34 "vp80-03-segmentation-04.ivf", "vp80-03-segmentation-1401.ivf",34 "vp80-03-segmentation-1401.ivf", "vp80-03-segmentation-1403.ivf",
35 "vp80-03-segmentation-1403.ivf", "vp80-03-segmentation-1407.ivf",35 "vp80-03-segmentation-1407.ivf", "vp80-03-segmentation-1408.ivf",
36 "vp80-03-segmentation-1408.ivf", "vp80-03-segmentation-1409.ivf",36 "vp80-03-segmentation-1409.ivf", "vp80-03-segmentation-1410.ivf",
37 "vp80-03-segmentation-1410.ivf", "vp80-03-segmentation-1413.ivf",37 "vp80-03-segmentation-1413.ivf", "vp80-03-segmentation-1414.ivf",
38 "vp80-03-segmentation-1414.ivf", "vp80-03-segmentation-1415.ivf",38 "vp80-03-segmentation-1415.ivf", "vp80-03-segmentation-1425.ivf",
39 "vp80-03-segmentation-1425.ivf", "vp80-03-segmentation-1426.ivf",39 "vp80-03-segmentation-1426.ivf", "vp80-03-segmentation-1427.ivf",
40 "vp80-03-segmentation-1427.ivf", "vp80-03-segmentation-1432.ivf",40 "vp80-03-segmentation-1432.ivf", "vp80-03-segmentation-1435.ivf",
41 "vp80-03-segmentation-1435.ivf", "vp80-03-segmentation-1436.ivf",41 "vp80-03-segmentation-1436.ivf", "vp80-03-segmentation-1437.ivf",
42 "vp80-03-segmentation-1437.ivf", "vp80-03-segmentation-1441.ivf",42 "vp80-03-segmentation-1441.ivf", "vp80-03-segmentation-1442.ivf",
43 "vp80-03-segmentation-1442.ivf", "vp80-04-partitions-1404.ivf",43 "vp80-04-partitions-1404.ivf", "vp80-04-partitions-1405.ivf",
44 "vp80-04-partitions-1405.ivf", "vp80-04-partitions-1406.ivf",44 "vp80-04-partitions-1406.ivf", "vp80-05-sharpness-1428.ivf",
45 "vp80-05-sharpness-1428.ivf", "vp80-05-sharpness-1429.ivf",45 "vp80-05-sharpness-1429.ivf", "vp80-05-sharpness-1430.ivf",
46 "vp80-05-sharpness-1430.ivf", "vp80-05-sharpness-1431.ivf",46 "vp80-05-sharpness-1431.ivf", "vp80-05-sharpness-1433.ivf",
47 "vp80-05-sharpness-1433.ivf", "vp80-05-sharpness-1434.ivf",47 "vp80-05-sharpness-1434.ivf", "vp80-05-sharpness-1438.ivf",
48 "vp80-05-sharpness-1438.ivf", "vp80-05-sharpness-1439.ivf",48 "vp80-05-sharpness-1439.ivf", "vp80-05-sharpness-1440.ivf",
49 "vp80-05-sharpness-1440.ivf", "vp80-05-sharpness-1443.ivf",49 "vp80-05-sharpness-1443.ivf", "vp80-06-smallsize.ivf"
50 "vp80-06-smallsize.ivf"
51};50};
52const int kNumVP8TestVectors = NELEMENTS(kVP8TestVectors);51const int kNumVP8TestVectors = NELEMENTS(kVP8TestVectors);
53#endif // CONFIG_VP8_DECODER52#endif // CONFIG_VP8_DECODER
54#if CONFIG_VP9_DECODER53#if CONFIG_VP9_DECODER
55#define RESIZE_TEST_VECTORS "vp90-2-21-resize_inter_320x180_5_1-2.webm", \54#define RESIZE_TEST_VECTORS \
56 "vp90-2-21-resize_inter_320x180_5_3-4.webm", \55 "vp90-2-21-resize_inter_320x180_5_1-2.webm", \
57 "vp90-2-21-resize_inter_320x180_7_1-2.webm", \56 "vp90-2-21-resize_inter_320x180_5_3-4.webm", \
58 "vp90-2-21-resize_inter_320x180_7_3-4.webm", \57 "vp90-2-21-resize_inter_320x180_7_1-2.webm", \
59 "vp90-2-21-resize_inter_320x240_5_1-2.webm", \58 "vp90-2-21-resize_inter_320x180_7_3-4.webm", \
60 "vp90-2-21-resize_inter_320x240_5_3-4.webm", \59 "vp90-2-21-resize_inter_320x240_5_1-2.webm", \
61 "vp90-2-21-resize_inter_320x240_7_1-2.webm", \60 "vp90-2-21-resize_inter_320x240_5_3-4.webm", \
62 "vp90-2-21-resize_inter_320x240_7_3-4.webm", \61 "vp90-2-21-resize_inter_320x240_7_1-2.webm", \
63 "vp90-2-21-resize_inter_640x360_5_1-2.webm", \62 "vp90-2-21-resize_inter_320x240_7_3-4.webm", \
64 "vp90-2-21-resize_inter_640x360_5_3-4.webm", \63 "vp90-2-21-resize_inter_640x360_5_1-2.webm", \
65 "vp90-2-21-resize_inter_640x360_7_1-2.webm", \64 "vp90-2-21-resize_inter_640x360_5_3-4.webm", \
66 "vp90-2-21-resize_inter_640x360_7_3-4.webm", \65 "vp90-2-21-resize_inter_640x360_7_1-2.webm", \
67 "vp90-2-21-resize_inter_640x480_5_1-2.webm", \66 "vp90-2-21-resize_inter_640x360_7_3-4.webm", \
68 "vp90-2-21-resize_inter_640x480_5_3-4.webm", \67 "vp90-2-21-resize_inter_640x480_5_1-2.webm", \
69 "vp90-2-21-resize_inter_640x480_7_1-2.webm", \68 "vp90-2-21-resize_inter_640x480_5_3-4.webm", \
70 "vp90-2-21-resize_inter_640x480_7_3-4.webm", \69 "vp90-2-21-resize_inter_640x480_7_1-2.webm", \
71 "vp90-2-21-resize_inter_1280x720_5_1-2.webm", \70 "vp90-2-21-resize_inter_640x480_7_3-4.webm", \
72 "vp90-2-21-resize_inter_1280x720_5_3-4.webm", \71 "vp90-2-21-resize_inter_1280x720_5_1-2.webm", \
73 "vp90-2-21-resize_inter_1280x720_7_1-2.webm", \72 "vp90-2-21-resize_inter_1280x720_5_3-4.webm", \
74 "vp90-2-21-resize_inter_1280x720_7_3-4.webm", \73 "vp90-2-21-resize_inter_1280x720_7_1-2.webm", \
75 "vp90-2-21-resize_inter_1920x1080_5_1-2.webm", \74 "vp90-2-21-resize_inter_1280x720_7_3-4.webm", \
76 "vp90-2-21-resize_inter_1920x1080_5_3-4.webm", \75 "vp90-2-21-resize_inter_1920x1080_5_1-2.webm", \
77 "vp90-2-21-resize_inter_1920x1080_7_1-2.webm", \76 "vp90-2-21-resize_inter_1920x1080_5_3-4.webm", \
78 "vp90-2-21-resize_inter_1920x1080_7_3-4.webm",77 "vp90-2-21-resize_inter_1920x1080_7_1-2.webm", \
78 "vp90-2-21-resize_inter_1920x1080_7_3-4.webm",
79 79
80const char *const kVP9TestVectors[] = {80const char *const kVP9TestVectors[] = {
81 "vp90-2-00-quantizer-00.webm", "vp90-2-00-quantizer-01.webm",81 "vp90-2-00-quantizer-00.webm",
82 "vp90-2-00-quantizer-02.webm", "vp90-2-00-quantizer-03.webm",82 "vp90-2-00-quantizer-01.webm",
83 "vp90-2-00-quantizer-04.webm", "vp90-2-00-quantizer-05.webm",83 "vp90-2-00-quantizer-02.webm",
84 "vp90-2-00-quantizer-06.webm", "vp90-2-00-quantizer-07.webm",84 "vp90-2-00-quantizer-03.webm",
85 "vp90-2-00-quantizer-08.webm", "vp90-2-00-quantizer-09.webm",85 "vp90-2-00-quantizer-04.webm",
86 "vp90-2-00-quantizer-10.webm", "vp90-2-00-quantizer-11.webm",86 "vp90-2-00-quantizer-05.webm",
87 "vp90-2-00-quantizer-12.webm", "vp90-2-00-quantizer-13.webm",87 "vp90-2-00-quantizer-06.webm",
88 "vp90-2-00-quantizer-14.webm", "vp90-2-00-quantizer-15.webm",88 "vp90-2-00-quantizer-07.webm",
89 "vp90-2-00-quantizer-16.webm", "vp90-2-00-quantizer-17.webm",89 "vp90-2-00-quantizer-08.webm",
90 "vp90-2-00-quantizer-18.webm", "vp90-2-00-quantizer-19.webm",90 "vp90-2-00-quantizer-09.webm",
91 "vp90-2-00-quantizer-20.webm", "vp90-2-00-quantizer-21.webm",91 "vp90-2-00-quantizer-10.webm",
92 "vp90-2-00-quantizer-22.webm", "vp90-2-00-quantizer-23.webm",92 "vp90-2-00-quantizer-11.webm",
93 "vp90-2-00-quantizer-24.webm", "vp90-2-00-quantizer-25.webm",93 "vp90-2-00-quantizer-12.webm",
94 "vp90-2-00-quantizer-26.webm", "vp90-2-00-quantizer-27.webm",94 "vp90-2-00-quantizer-13.webm",
95 "vp90-2-00-quantizer-28.webm", "vp90-2-00-quantizer-29.webm",95 "vp90-2-00-quantizer-14.webm",
96 "vp90-2-00-quantizer-30.webm", "vp90-2-00-quantizer-31.webm",96 "vp90-2-00-quantizer-15.webm",
97 "vp90-2-00-quantizer-32.webm", "vp90-2-00-quantizer-33.webm",97 "vp90-2-00-quantizer-16.webm",
98 "vp90-2-00-quantizer-34.webm", "vp90-2-00-quantizer-35.webm",98 "vp90-2-00-quantizer-17.webm",
99 "vp90-2-00-quantizer-36.webm", "vp90-2-00-quantizer-37.webm",99 "vp90-2-00-quantizer-18.webm",
100 "vp90-2-00-quantizer-38.webm", "vp90-2-00-quantizer-39.webm",100 "vp90-2-00-quantizer-19.webm",
101 "vp90-2-00-quantizer-40.webm", "vp90-2-00-quantizer-41.webm",101 "vp90-2-00-quantizer-20.webm",
102 "vp90-2-00-quantizer-42.webm", "vp90-2-00-quantizer-43.webm",102 "vp90-2-00-quantizer-21.webm",
103 "vp90-2-00-quantizer-44.webm", "vp90-2-00-quantizer-45.webm",103 "vp90-2-00-quantizer-22.webm",
104 "vp90-2-00-quantizer-46.webm", "vp90-2-00-quantizer-47.webm",104 "vp90-2-00-quantizer-23.webm",
105 "vp90-2-00-quantizer-48.webm", "vp90-2-00-quantizer-49.webm",105 "vp90-2-00-quantizer-24.webm",
106 "vp90-2-00-quantizer-50.webm", "vp90-2-00-quantizer-51.webm",106 "vp90-2-00-quantizer-25.webm",
107 "vp90-2-00-quantizer-52.webm", "vp90-2-00-quantizer-53.webm",107 "vp90-2-00-quantizer-26.webm",
108 "vp90-2-00-quantizer-54.webm", "vp90-2-00-quantizer-55.webm",108 "vp90-2-00-quantizer-27.webm",
109 "vp90-2-00-quantizer-56.webm", "vp90-2-00-quantizer-57.webm",109 "vp90-2-00-quantizer-28.webm",
110 "vp90-2-00-quantizer-58.webm", "vp90-2-00-quantizer-59.webm",110 "vp90-2-00-quantizer-29.webm",
111 "vp90-2-00-quantizer-60.webm", "vp90-2-00-quantizer-61.webm",111 "vp90-2-00-quantizer-30.webm",
112 "vp90-2-00-quantizer-62.webm", "vp90-2-00-quantizer-63.webm",112 "vp90-2-00-quantizer-31.webm",
113 "vp90-2-01-sharpness-1.webm", "vp90-2-01-sharpness-2.webm",113 "vp90-2-00-quantizer-32.webm",
114 "vp90-2-01-sharpness-3.webm", "vp90-2-01-sharpness-4.webm",114 "vp90-2-00-quantizer-33.webm",
115 "vp90-2-01-sharpness-5.webm", "vp90-2-01-sharpness-6.webm",115 "vp90-2-00-quantizer-34.webm",
116 "vp90-2-01-sharpness-7.webm", "vp90-2-02-size-08x08.webm",116 "vp90-2-00-quantizer-35.webm",
117 "vp90-2-02-size-08x10.webm", "vp90-2-02-size-08x16.webm",117 "vp90-2-00-quantizer-36.webm",
118 "vp90-2-02-size-08x18.webm", "vp90-2-02-size-08x32.webm",118 "vp90-2-00-quantizer-37.webm",
119 "vp90-2-02-size-08x34.webm", "vp90-2-02-size-08x64.webm",119 "vp90-2-00-quantizer-38.webm",
120 "vp90-2-02-size-08x66.webm", "vp90-2-02-size-10x08.webm",120 "vp90-2-00-quantizer-39.webm",
121 "vp90-2-02-size-10x10.webm", "vp90-2-02-size-10x16.webm",121 "vp90-2-00-quantizer-40.webm",
122 "vp90-2-02-size-10x18.webm", "vp90-2-02-size-10x32.webm",122 "vp90-2-00-quantizer-41.webm",
123 "vp90-2-02-size-10x34.webm", "vp90-2-02-size-10x64.webm",123 "vp90-2-00-quantizer-42.webm",
124 "vp90-2-02-size-10x66.webm", "vp90-2-02-size-16x08.webm",124 "vp90-2-00-quantizer-43.webm",
125 "vp90-2-02-size-16x10.webm", "vp90-2-02-size-16x16.webm",125 "vp90-2-00-quantizer-44.webm",
126 "vp90-2-02-size-16x18.webm", "vp90-2-02-size-16x32.webm",126 "vp90-2-00-quantizer-45.webm",
127 "vp90-2-02-size-16x34.webm", "vp90-2-02-size-16x64.webm",127 "vp90-2-00-quantizer-46.webm",
128 "vp90-2-02-size-16x66.webm", "vp90-2-02-size-18x08.webm",128 "vp90-2-00-quantizer-47.webm",
129 "vp90-2-02-size-18x10.webm", "vp90-2-02-size-18x16.webm",129 "vp90-2-00-quantizer-48.webm",
130 "vp90-2-02-size-18x18.webm", "vp90-2-02-size-18x32.webm",130 "vp90-2-00-quantizer-49.webm",
131 "vp90-2-02-size-18x34.webm", "vp90-2-02-size-18x64.webm",131 "vp90-2-00-quantizer-50.webm",
132 "vp90-2-02-size-18x66.webm", "vp90-2-02-size-32x08.webm",132 "vp90-2-00-quantizer-51.webm",
133 "vp90-2-02-size-32x10.webm", "vp90-2-02-size-32x16.webm",133 "vp90-2-00-quantizer-52.webm",
134 "vp90-2-02-size-32x18.webm", "vp90-2-02-size-32x32.webm",134 "vp90-2-00-quantizer-53.webm",
135 "vp90-2-02-size-32x34.webm", "vp90-2-02-size-32x64.webm",135 "vp90-2-00-quantizer-54.webm",
136 "vp90-2-02-size-32x66.webm", "vp90-2-02-size-34x08.webm",136 "vp90-2-00-quantizer-55.webm",
137 "vp90-2-02-size-34x10.webm", "vp90-2-02-size-34x16.webm",137 "vp90-2-00-quantizer-56.webm",
138 "vp90-2-02-size-34x18.webm", "vp90-2-02-size-34x32.webm",138 "vp90-2-00-quantizer-57.webm",
139 "vp90-2-02-size-34x34.webm", "vp90-2-02-size-34x64.webm",139 "vp90-2-00-quantizer-58.webm",
140 "vp90-2-02-size-34x66.webm", "vp90-2-02-size-64x08.webm",140 "vp90-2-00-quantizer-59.webm",
141 "vp90-2-02-size-64x10.webm", "vp90-2-02-size-64x16.webm",141 "vp90-2-00-quantizer-60.webm",
142 "vp90-2-02-size-64x18.webm", "vp90-2-02-size-64x32.webm",142 "vp90-2-00-quantizer-61.webm",
143 "vp90-2-02-size-64x34.webm", "vp90-2-02-size-64x64.webm",143 "vp90-2-00-quantizer-62.webm",
144 "vp90-2-02-size-64x66.webm", "vp90-2-02-size-66x08.webm",144 "vp90-2-00-quantizer-63.webm",
145 "vp90-2-02-size-66x10.webm", "vp90-2-02-size-66x16.webm",145 "vp90-2-01-sharpness-1.webm",
146 "vp90-2-02-size-66x18.webm", "vp90-2-02-size-66x32.webm",146 "vp90-2-01-sharpness-2.webm",
147 "vp90-2-02-size-66x34.webm", "vp90-2-02-size-66x64.webm",147 "vp90-2-01-sharpness-3.webm",
148 "vp90-2-02-size-66x66.webm", "vp90-2-02-size-130x132.webm",148 "vp90-2-01-sharpness-4.webm",
149 "vp90-2-02-size-132x130.webm", "vp90-2-02-size-132x132.webm",149 "vp90-2-01-sharpness-5.webm",
150 "vp90-2-02-size-178x180.webm", "vp90-2-02-size-180x178.webm",150 "vp90-2-01-sharpness-6.webm",
151 "vp90-2-02-size-180x180.webm", "vp90-2-03-size-196x196.webm",151 "vp90-2-01-sharpness-7.webm",
152 "vp90-2-03-size-196x198.webm", "vp90-2-03-size-196x200.webm",152 "vp90-2-02-size-08x08.webm",
153 "vp90-2-03-size-196x202.webm", "vp90-2-03-size-196x208.webm",153 "vp90-2-02-size-08x10.webm",
154 "vp90-2-03-size-196x210.webm", "vp90-2-03-size-196x224.webm",154 "vp90-2-02-size-08x16.webm",
155 "vp90-2-03-size-196x226.webm", "vp90-2-03-size-198x196.webm",155 "vp90-2-02-size-08x18.webm",
156 "vp90-2-03-size-198x198.webm", "vp90-2-03-size-198x200.webm",156 "vp90-2-02-size-08x32.webm",
157 "vp90-2-03-size-198x202.webm", "vp90-2-03-size-198x208.webm",157 "vp90-2-02-size-08x34.webm",
158 "vp90-2-03-size-198x210.webm", "vp90-2-03-size-198x224.webm",158 "vp90-2-02-size-08x64.webm",
159 "vp90-2-03-size-198x226.webm", "vp90-2-03-size-200x196.webm",159 "vp90-2-02-size-08x66.webm",
160 "vp90-2-03-size-200x198.webm", "vp90-2-03-size-200x200.webm",160 "vp90-2-02-size-10x08.webm",
161 "vp90-2-03-size-200x202.webm", "vp90-2-03-size-200x208.webm",161 "vp90-2-02-size-10x10.webm",
162 "vp90-2-03-size-200x210.webm", "vp90-2-03-size-200x224.webm",162 "vp90-2-02-size-10x16.webm",
163 "vp90-2-03-size-200x226.webm", "vp90-2-03-size-202x196.webm",163 "vp90-2-02-size-10x18.webm",
164 "vp90-2-03-size-202x198.webm", "vp90-2-03-size-202x200.webm",164 "vp90-2-02-size-10x32.webm",
165 "vp90-2-03-size-202x202.webm", "vp90-2-03-size-202x208.webm",165 "vp90-2-02-size-10x34.webm",
166 "vp90-2-03-size-202x210.webm", "vp90-2-03-size-202x224.webm",166 "vp90-2-02-size-10x64.webm",
167 "vp90-2-03-size-202x226.webm", "vp90-2-03-size-208x196.webm",167 "vp90-2-02-size-10x66.webm",
168 "vp90-2-03-size-208x198.webm", "vp90-2-03-size-208x200.webm",168 "vp90-2-02-size-16x08.webm",
169 "vp90-2-03-size-208x202.webm", "vp90-2-03-size-208x208.webm",169 "vp90-2-02-size-16x10.webm",
170 "vp90-2-03-size-208x210.webm", "vp90-2-03-size-208x224.webm",170 "vp90-2-02-size-16x16.webm",
171 "vp90-2-03-size-208x226.webm", "vp90-2-03-size-210x196.webm",171 "vp90-2-02-size-16x18.webm",
172 "vp90-2-03-size-210x198.webm", "vp90-2-03-size-210x200.webm",172 "vp90-2-02-size-16x32.webm",
173 "vp90-2-03-size-210x202.webm", "vp90-2-03-size-210x208.webm",173 "vp90-2-02-size-16x34.webm",
174 "vp90-2-03-size-210x210.webm", "vp90-2-03-size-210x224.webm",174 "vp90-2-02-size-16x64.webm",
175 "vp90-2-03-size-210x226.webm", "vp90-2-03-size-224x196.webm",175 "vp90-2-02-size-16x66.webm",
176 "vp90-2-03-size-224x198.webm", "vp90-2-03-size-224x200.webm",176 "vp90-2-02-size-18x08.webm",
177 "vp90-2-03-size-224x202.webm", "vp90-2-03-size-224x208.webm",177 "vp90-2-02-size-18x10.webm",
178 "vp90-2-03-size-224x210.webm", "vp90-2-03-size-224x224.webm",178 "vp90-2-02-size-18x16.webm",
179 "vp90-2-03-size-224x226.webm", "vp90-2-03-size-226x196.webm",179 "vp90-2-02-size-18x18.webm",
180 "vp90-2-03-size-226x198.webm", "vp90-2-03-size-226x200.webm",180 "vp90-2-02-size-18x32.webm",
181 "vp90-2-03-size-226x202.webm", "vp90-2-03-size-226x208.webm",181 "vp90-2-02-size-18x34.webm",
182 "vp90-2-03-size-226x210.webm", "vp90-2-03-size-226x224.webm",182 "vp90-2-02-size-18x64.webm",
183 "vp90-2-03-size-226x226.webm", "vp90-2-03-size-352x288.webm",183 "vp90-2-02-size-18x66.webm",
184 "vp90-2-02-size-32x08.webm",
185 "vp90-2-02-size-32x10.webm",
186 "vp90-2-02-size-32x16.webm",
187 "vp90-2-02-size-32x18.webm",
188 "vp90-2-02-size-32x32.webm",
189 "vp90-2-02-size-32x34.webm",
190 "vp90-2-02-size-32x64.webm",
191 "vp90-2-02-size-32x66.webm",
192 "vp90-2-02-size-34x08.webm",
193 "vp90-2-02-size-34x10.webm",
194 "vp90-2-02-size-34x16.webm",
195 "vp90-2-02-size-34x18.webm",
196 "vp90-2-02-size-34x32.webm",
197 "vp90-2-02-size-34x34.webm",
198 "vp90-2-02-size-34x64.webm",
199 "vp90-2-02-size-34x66.webm",
200 "vp90-2-02-size-64x08.webm",
201 "vp90-2-02-size-64x10.webm",
202 "vp90-2-02-size-64x16.webm",
203 "vp90-2-02-size-64x18.webm",
204 "vp90-2-02-size-64x32.webm",
205 "vp90-2-02-size-64x34.webm",
206 "vp90-2-02-size-64x64.webm",
207 "vp90-2-02-size-64x66.webm",
208 "vp90-2-02-size-66x08.webm",
209 "vp90-2-02-size-66x10.webm",
210 "vp90-2-02-size-66x16.webm",
211 "vp90-2-02-size-66x18.webm",
212 "vp90-2-02-size-66x32.webm",
213 "vp90-2-02-size-66x34.webm",
214 "vp90-2-02-size-66x64.webm",
215 "vp90-2-02-size-66x66.webm",
216 "vp90-2-02-size-130x132.webm",
217 "vp90-2-02-size-132x130.webm",
218 "vp90-2-02-size-132x132.webm",
219 "vp90-2-02-size-178x180.webm",
220 "vp90-2-02-size-180x178.webm",
221 "vp90-2-02-size-180x180.webm",
222 "vp90-2-03-size-196x196.webm",
223 "vp90-2-03-size-196x198.webm",
224 "vp90-2-03-size-196x200.webm",
225 "vp90-2-03-size-196x202.webm",
226 "vp90-2-03-size-196x208.webm",
227 "vp90-2-03-size-196x210.webm",
228 "vp90-2-03-size-196x224.webm",
229 "vp90-2-03-size-196x226.webm",
230 "vp90-2-03-size-198x196.webm",
231 "vp90-2-03-size-198x198.webm",
232 "vp90-2-03-size-198x200.webm",
233 "vp90-2-03-size-198x202.webm",
234 "vp90-2-03-size-198x208.webm",
235 "vp90-2-03-size-198x210.webm",
236 "vp90-2-03-size-198x224.webm",
237 "vp90-2-03-size-198x226.webm",
238 "vp90-2-03-size-200x196.webm",
239 "vp90-2-03-size-200x198.webm",
240 "vp90-2-03-size-200x200.webm",
241 "vp90-2-03-size-200x202.webm",
242 "vp90-2-03-size-200x208.webm",
243 "vp90-2-03-size-200x210.webm",
244 "vp90-2-03-size-200x224.webm",
245 "vp90-2-03-size-200x226.webm",
246 "vp90-2-03-size-202x196.webm",
247 "vp90-2-03-size-202x198.webm",
248 "vp90-2-03-size-202x200.webm",
249 "vp90-2-03-size-202x202.webm",
250 "vp90-2-03-size-202x208.webm",
251 "vp90-2-03-size-202x210.webm",
252 "vp90-2-03-size-202x224.webm",
253 "vp90-2-03-size-202x226.webm",
254 "vp90-2-03-size-208x196.webm",
255 "vp90-2-03-size-208x198.webm",
256 "vp90-2-03-size-208x200.webm",
257 "vp90-2-03-size-208x202.webm",
258 "vp90-2-03-size-208x208.webm",
259 "vp90-2-03-size-208x210.webm",
260 "vp90-2-03-size-208x224.webm",
261 "vp90-2-03-size-208x226.webm",
262 "vp90-2-03-size-210x196.webm",
263 "vp90-2-03-size-210x198.webm",
264 "vp90-2-03-size-210x200.webm",
265 "vp90-2-03-size-210x202.webm",
266 "vp90-2-03-size-210x208.webm",
267 "vp90-2-03-size-210x210.webm",
268 "vp90-2-03-size-210x224.webm",
269 "vp90-2-03-size-210x226.webm",
270 "vp90-2-03-size-224x196.webm",
271 "vp90-2-03-size-224x198.webm",
272 "vp90-2-03-size-224x200.webm",
273 "vp90-2-03-size-224x202.webm",
274 "vp90-2-03-size-224x208.webm",
275 "vp90-2-03-size-224x210.webm",
276 "vp90-2-03-size-224x224.webm",
277 "vp90-2-03-size-224x226.webm",
278 "vp90-2-03-size-226x196.webm",
279 "vp90-2-03-size-226x198.webm",
280 "vp90-2-03-size-226x200.webm",
281 "vp90-2-03-size-226x202.webm",
282 "vp90-2-03-size-226x208.webm",
283 "vp90-2-03-size-226x210.webm",
284 "vp90-2-03-size-226x224.webm",
285 "vp90-2-03-size-226x226.webm",
286 "vp90-2-03-size-352x288.webm",
184 "vp90-2-03-deltaq.webm",287 "vp90-2-03-deltaq.webm",
185 "vp90-2-05-resize.ivf", "vp90-2-06-bilinear.webm",288 "vp90-2-05-resize.ivf",
186 "vp90-2-07-frame_parallel.webm", "vp90-2-08-tile_1x2_frame_parallel.webm",289 "vp90-2-06-bilinear.webm",
187 "vp90-2-08-tile_1x2.webm", "vp90-2-08-tile_1x4_frame_parallel.webm",290 "vp90-2-07-frame_parallel.webm",
188 "vp90-2-08-tile_1x4.webm", "vp90-2-08-tile_1x8_frame_parallel.webm",291 "vp90-2-08-tile_1x2_frame_parallel.webm",
189 "vp90-2-08-tile_1x8.webm", "vp90-2-08-tile-4x4.webm",292 "vp90-2-08-tile_1x2.webm",
190 "vp90-2-08-tile-4x1.webm", "vp90-2-09-subpixel-00.ivf",293 "vp90-2-08-tile_1x4_frame_parallel.webm",
191 "vp90-2-02-size-lf-1920x1080.webm", "vp90-2-09-aq2.webm",294 "vp90-2-08-tile_1x4.webm",
192 "vp90-2-09-lf_deltas.webm", "vp90-2-10-show-existing-frame.webm",295 "vp90-2-08-tile_1x8_frame_parallel.webm",
296 "vp90-2-08-tile_1x8.webm",
297 "vp90-2-08-tile-4x4.webm",
298 "vp90-2-08-tile-4x1.webm",
299 "vp90-2-09-subpixel-00.ivf",
300 "vp90-2-02-size-lf-1920x1080.webm",
301 "vp90-2-09-aq2.webm",
302 "vp90-2-09-lf_deltas.webm",
303 "vp90-2-10-show-existing-frame.webm",
193 "vp90-2-10-show-existing-frame2.webm",304 "vp90-2-10-show-existing-frame2.webm",
194 "vp90-2-11-size-351x287.webm", "vp90-2-11-size-351x288.webm",305 "vp90-2-11-size-351x287.webm",
195 "vp90-2-11-size-352x287.webm", "vp90-2-12-droppable_1.ivf",306 "vp90-2-11-size-351x288.webm",
196 "vp90-2-12-droppable_2.ivf", "vp90-2-12-droppable_3.ivf",307 "vp90-2-11-size-352x287.webm",
308 "vp90-2-12-droppable_1.ivf",
309 "vp90-2-12-droppable_2.ivf",
310 "vp90-2-12-droppable_3.ivf",
197#if !CONFIG_SIZE_LIMIT || \311#if !CONFIG_SIZE_LIMIT || \
198 (DECODE_WIDTH_LIMIT >= 20400 && DECODE_HEIGHT_LIMIT >= 120)312 (DECODE_WIDTH_LIMIT >= 20400 && DECODE_HEIGHT_LIMIT >= 120)
199 "vp90-2-13-largescaling.webm",313 "vp90-2-13-largescaling.webm",
200#endif314#endif
201 "vp90-2-14-resize-fp-tiles-1-16.webm",315 "vp90-2-14-resize-fp-tiles-1-16.webm",
202 "vp90-2-14-resize-fp-tiles-1-2-4-8-16.webm",316 "vp90-2-14-resize-fp-tiles-1-2-4-8-16.webm",
203 "vp90-2-14-resize-fp-tiles-1-2.webm", "vp90-2-14-resize-fp-tiles-1-4.webm",317 "vp90-2-14-resize-fp-tiles-1-2.webm",
204 "vp90-2-14-resize-fp-tiles-16-1.webm", "vp90-2-14-resize-fp-tiles-16-2.webm",318 "vp90-2-14-resize-fp-tiles-1-4.webm",
319 "vp90-2-14-resize-fp-tiles-16-1.webm",
320 "vp90-2-14-resize-fp-tiles-16-2.webm",
205 "vp90-2-14-resize-fp-tiles-16-4.webm",321 "vp90-2-14-resize-fp-tiles-16-4.webm",
206 "vp90-2-14-resize-fp-tiles-16-8-4-2-1.webm",322 "vp90-2-14-resize-fp-tiles-16-8-4-2-1.webm",
207 "vp90-2-14-resize-fp-tiles-16-8.webm", "vp90-2-14-resize-fp-tiles-1-8.webm",323 "vp90-2-14-resize-fp-tiles-16-8.webm",
208 "vp90-2-14-resize-fp-tiles-2-16.webm", "vp90-2-14-resize-fp-tiles-2-1.webm",324 "vp90-2-14-resize-fp-tiles-1-8.webm",
209 "vp90-2-14-resize-fp-tiles-2-4.webm", "vp90-2-14-resize-fp-tiles-2-8.webm",325 "vp90-2-14-resize-fp-tiles-2-16.webm",
210 "vp90-2-14-resize-fp-tiles-4-16.webm", "vp90-2-14-resize-fp-tiles-4-1.webm",326 "vp90-2-14-resize-fp-tiles-2-1.webm",
211 "vp90-2-14-resize-fp-tiles-4-2.webm", "vp90-2-14-resize-fp-tiles-4-8.webm",327 "vp90-2-14-resize-fp-tiles-2-4.webm",
212 "vp90-2-14-resize-fp-tiles-8-16.webm", "vp90-2-14-resize-fp-tiles-8-1.webm",328 "vp90-2-14-resize-fp-tiles-2-8.webm",
213 "vp90-2-14-resize-fp-tiles-8-2.webm", "vp90-2-14-resize-fp-tiles-8-4.webm",329 "vp90-2-14-resize-fp-tiles-4-16.webm",
330 "vp90-2-14-resize-fp-tiles-4-1.webm",
331 "vp90-2-14-resize-fp-tiles-4-2.webm",
332 "vp90-2-14-resize-fp-tiles-4-8.webm",
333 "vp90-2-14-resize-fp-tiles-8-16.webm",
334 "vp90-2-14-resize-fp-tiles-8-1.webm",
335 "vp90-2-14-resize-fp-tiles-8-2.webm",
336 "vp90-2-14-resize-fp-tiles-8-4.webm",
214 "vp90-2-14-resize-10frames-fp-tiles-1-2-4-8.webm",337 "vp90-2-14-resize-10frames-fp-tiles-1-2-4-8.webm",
215 "vp90-2-14-resize-10frames-fp-tiles-1-2.webm",338 "vp90-2-14-resize-10frames-fp-tiles-1-2.webm",
216 "vp90-2-14-resize-10frames-fp-tiles-1-4.webm",339 "vp90-2-14-resize-10frames-fp-tiles-1-4.webm",
@@ -225,25 +348,33 @@ const char *const kVP9TestVectors[] = { · 8 unmodified lines
225 "vp90-2-14-resize-10frames-fp-tiles-8-2.webm",348 "vp90-2-14-resize-10frames-fp-tiles-8-2.webm",
226 "vp90-2-14-resize-10frames-fp-tiles-8-4-2-1.webm",349 "vp90-2-14-resize-10frames-fp-tiles-8-4-2-1.webm",
227 "vp90-2-14-resize-10frames-fp-tiles-8-4.webm",350 "vp90-2-14-resize-10frames-fp-tiles-8-4.webm",
228 "vp90-2-15-segkey.webm", "vp90-2-15-segkey_adpq.webm",351 "vp90-2-15-segkey.webm",
229 "vp90-2-16-intra-only.webm", "vp90-2-17-show-existing-frame.webm",352 "vp90-2-15-segkey_adpq.webm",
230 "vp90-2-18-resize.ivf", "vp90-2-19-skip.webm",353 "vp90-2-16-intra-only.webm",
231 "vp90-2-19-skip-01.webm", "vp90-2-19-skip-02.webm",354 "vp90-2-17-show-existing-frame.webm",
355 "vp90-2-18-resize.ivf",
356 "vp90-2-19-skip.webm",
357 "vp90-2-19-skip-01.webm",
358 "vp90-2-19-skip-02.webm",
232 "vp91-2-04-yuv444.webm",359 "vp91-2-04-yuv444.webm",
233 "vp91-2-04-yuv422.webm", "vp91-2-04-yuv440.webm",360 "vp91-2-04-yuv422.webm",
361 "vp91-2-04-yuv440.webm",
234#if CONFIG_VP9_HIGHBITDEPTH362#if CONFIG_VP9_HIGHBITDEPTH
235 "vp92-2-20-10bit-yuv420.webm", "vp92-2-20-12bit-yuv420.webm",363 "vp92-2-20-10bit-yuv420.webm",
236 "vp93-2-20-10bit-yuv422.webm", "vp93-2-20-12bit-yuv422.webm",364 "vp92-2-20-12bit-yuv420.webm",
237 "vp93-2-20-10bit-yuv440.webm", "vp93-2-20-12bit-yuv440.webm",365 "vp93-2-20-10bit-yuv422.webm",
238 "vp93-2-20-10bit-yuv444.webm", "vp93-2-20-12bit-yuv444.webm",366 "vp93-2-20-12bit-yuv422.webm",
367 "vp93-2-20-10bit-yuv440.webm",
368 "vp93-2-20-12bit-yuv440.webm",
369 "vp93-2-20-10bit-yuv444.webm",
370 "vp93-2-20-12bit-yuv444.webm",
239#endif // CONFIG_VP9_HIGHBITDEPTH371#endif // CONFIG_VP9_HIGHBITDEPTH
240 "vp90-2-20-big_superframe-01.webm", "vp90-2-20-big_superframe-02.webm",372 "vp90-2-20-big_superframe-01.webm",
373 "vp90-2-20-big_superframe-02.webm",
241 RESIZE_TEST_VECTORS374 RESIZE_TEST_VECTORS
242};375};
243const int kNumVP9TestVectors = NELEMENTS(kVP9TestVectors);376const int kNumVP9TestVectors = NELEMENTS(kVP9TestVectors);
244const char *const kVP9TestVectorsResize[] = {377const char *const kVP9TestVectorsResize[] = { RESIZE_TEST_VECTORS };
245 RESIZE_TEST_VECTORS
246};
247const int kNumVP9TestVectorsResize = NELEMENTS(kVP9TestVectorsResize);378const int kNumVP9TestVectorsResize = NELEMENTS(kVP9TestVectorsResize);
248#undef RESIZE_TEST_VECTORS379#undef RESIZE_TEST_VECTORS
249#endif // CONFIG_VP9_DECODER380#endif // CONFIG_VP9_DECODER
test/tile_independence_test.cc+2−4
@@ -24,9 +24,7 @@ class TileIndependenceTest : public ::libvpx_test::EncoderTest, · 23 unmodified lines
24 public ::libvpx_test::CodecTestWithParam<int> {24 public ::libvpx_test::CodecTestWithParam<int> {
25 protected:25 protected:
26 TileIndependenceTest()26 TileIndependenceTest()
27 : EncoderTest(GET_PARAM(0)),27 : EncoderTest(GET_PARAM(0)), md5_fw_order_(), md5_inv_order_(),
28 md5_fw_order_(),
29 md5_inv_order_(),
30 n_tiles_(GET_PARAM(1)) {28 n_tiles_(GET_PARAM(1)) {
31 init_flags_ = VPX_CODEC_USE_PSNR;29 init_flags_ = VPX_CODEC_USE_PSNR;
32 vpx_codec_dec_cfg_t cfg = vpx_codec_dec_cfg_t();30 vpx_codec_dec_cfg_t cfg = vpx_codec_dec_cfg_t();
@@ -58,7 +56,7 @@ class TileIndependenceTest : public ::libvpx_test::EncoderTest, · 25 unmodified lines
58 void UpdateMD5(::libvpx_test::Decoder *dec, const vpx_codec_cx_pkt_t *pkt,56 void UpdateMD5(::libvpx_test::Decoder *dec, const vpx_codec_cx_pkt_t *pkt,
59 ::libvpx_test::MD5 *md5) {57 ::libvpx_test::MD5 *md5) {
60 const vpx_codec_err_t res = dec->DecodeFrame(58 const vpx_codec_err_t res = dec->DecodeFrame(
61 reinterpret_cast<uint8_t*>(pkt->data.frame.buf), pkt->data.frame.sz);59 reinterpret_cast<uint8_t *>(pkt->data.frame.buf), pkt->data.frame.sz);
62 if (res != VPX_CODEC_OK) {60 if (res != VPX_CODEC_OK) {
63 abort_ = true;61 abort_ = true;
64 ASSERT_EQ(VPX_CODEC_OK, res);62 ASSERT_EQ(VPX_CODEC_OK, res);
test/user_priv_test.cc+2−2
@@ -34,8 +34,8 @@ using libvpx_test::ACMRandom; · 33 unmodified lines
34 34
35void CheckUserPrivateData(void *user_priv, int *target) {35void CheckUserPrivateData(void *user_priv, int *target) {
36 // actual pointer value should be the same as expected.36 // actual pointer value should be the same as expected.
37 EXPECT_EQ(reinterpret_cast<void *>(target), user_priv) <<37 EXPECT_EQ(reinterpret_cast<void *>(target), user_priv)
38 "user_priv pointer value does not match.";38 << "user_priv pointer value does not match.";
39}39}
40 40
41// Decodes |filename|. Passes in user_priv data when calling DecodeFrame and41// Decodes |filename|. Passes in user_priv data when calling DecodeFrame and
test/util.h+3−4
@@ -17,14 +17,13 @@ · 16 unmodified lines
17#include "vpx/vpx_image.h"17#include "vpx/vpx_image.h"
18 18
19// Macros19// Macros
20#define GET_PARAM(k) std::tr1::get< k >(GetParam())20#define GET_PARAM(k) std::tr1::get<k>(GetParam())
21 21
22inline double compute_psnr(const vpx_image_t *img1, const vpx_image_t *img2) {22inline double compute_psnr(const vpx_image_t *img1, const vpx_image_t *img2) {
23 assert((img1->fmt == img2->fmt) &&23 assert((img1->fmt == img2->fmt) && (img1->d_w == img2->d_w) &&
24 (img1->d_w == img2->d_w) &&
25 (img1->d_h == img2->d_h));24 (img1->d_h == img2->d_h));
26 25
27 const unsigned int width_y = img1->d_w;26 const unsigned int width_y = img1->d_w;
28 const unsigned int height_y = img1->d_h;27 const unsigned int height_y = img1->d_h;
29 unsigned int i, j;28 unsigned int i, j;
30 29
test/variance_test.cc+131−145
@@ -57,8 +57,7 @@ static void RoundHighBitDepth(int bit_depth, int64_t *se, uint64_t *sse) { · 56 unmodified lines
57 *se = (*se + 2) >> 2;57 *se = (*se + 2) >> 2;
58 break;58 break;
59 case VPX_BITS_8:59 case VPX_BITS_8:
60 default:60 default: break;
61 break;
62 }61 }
63}62}
64 63
@@ -74,10 +73,9 @@ static unsigned int mb_ss_ref(const int16_t *src) { · 9 unmodified lines
74 * Our codebase calculates the "diff" value in the variance algorithm by73 * Our codebase calculates the "diff" value in the variance algorithm by
75 * (src - ref).74 * (src - ref).
76 */75 */
77static uint32_t variance_ref(const uint8_t *src, const uint8_t *ref,76static uint32_t variance_ref(const uint8_t *src, const uint8_t *ref, int l2w,
78 int l2w, int l2h, int src_stride,77 int l2h, int src_stride, int ref_stride,
79 int ref_stride, uint32_t *sse_ptr,78 uint32_t *sse_ptr, bool use_high_bit_depth_,
80 bool use_high_bit_depth_,
81 vpx_bit_depth_t bit_depth) {79 vpx_bit_depth_t bit_depth) {
82 int64_t se = 0;80 int64_t se = 0;
83 uint64_t sse = 0;81 uint64_t sse = 0;
@@ -87,8 +85,7 @@ static uint32_t variance_ref(const uint8_t *src, const uint8_t *ref, · 3 unmodified lines
87 for (int x = 0; x < w; x++) {85 for (int x = 0; x < w; x++) {
88 int diff;86 int diff;
89 if (!use_high_bit_depth_) {87 if (!use_high_bit_depth_) {
90 diff = src[y * src_stride + x] -88 diff = src[y * src_stride + x] - ref[y * ref_stride + x];
91 ref[y * ref_stride + x];
92 se += diff;89 se += diff;
93 sse += diff * diff;90 sse += diff * diff;
94#if CONFIG_VP9_HIGHBITDEPTH91#if CONFIG_VP9_HIGHBITDEPTH
@@ -103,9 +100,8 @@ static uint32_t variance_ref(const uint8_t *src, const uint8_t *ref, · 8 unmodified lines
103 }100 }
104 RoundHighBitDepth(bit_depth, &se, &sse);101 RoundHighBitDepth(bit_depth, &se, &sse);
105 *sse_ptr = static_cast<uint32_t>(sse);102 *sse_ptr = static_cast<uint32_t>(sse);
106 return static_cast<uint32_t>(sse -103 return static_cast<uint32_t>(
107 ((static_cast<int64_t>(se) * se) >>104 sse - ((static_cast<int64_t>(se) * se) >> (l2w + l2h)));
108 (l2w + l2h)));
109}105}
110 106
111/* The subpel reference functions differ from the codec version in one aspect:107/* The subpel reference functions differ from the codec version in one aspect:
@@ -116,8 +112,7 @@ static uint32_t variance_ref(const uint8_t *src, const uint8_t *ref, · 4 unmodified lines
116 */112 */
117static uint32_t subpel_variance_ref(const uint8_t *ref, const uint8_t *src,113static uint32_t subpel_variance_ref(const uint8_t *ref, const uint8_t *src,
118 int l2w, int l2h, int xoff, int yoff,114 int l2w, int l2h, int xoff, int yoff,
119 uint32_t *sse_ptr,115 uint32_t *sse_ptr, bool use_high_bit_depth_,
120 bool use_high_bit_depth_,
121 vpx_bit_depth_t bit_depth) {116 vpx_bit_depth_t bit_depth) {
122 int64_t se = 0;117 int64_t se = 0;
123 uint64_t sse = 0;118 uint64_t sse = 0;
@@ -161,16 +156,13 @@ static uint32_t subpel_variance_ref(const uint8_t *ref, const uint8_t *src, · 37 unmodified lines
161 }156 }
162 RoundHighBitDepth(bit_depth, &se, &sse);157 RoundHighBitDepth(bit_depth, &se, &sse);
163 *sse_ptr = static_cast<uint32_t>(sse);158 *sse_ptr = static_cast<uint32_t>(sse);
164 return static_cast<uint32_t>(sse -159 return static_cast<uint32_t>(
165 ((static_cast<int64_t>(se) * se) >>160 sse - ((static_cast<int64_t>(se) * se) >> (l2w + l2h)));
166 (l2w + l2h)));
167}161}
168 162
169static uint32_t subpel_avg_variance_ref(const uint8_t *ref,163static uint32_t subpel_avg_variance_ref(const uint8_t *ref, const uint8_t *src,
170 const uint8_t *src,164 const uint8_t *second_pred, int l2w,
171 const uint8_t *second_pred,165 int l2h, int xoff, int yoff,
172 int l2w, int l2h,
173 int xoff, int yoff,
174 uint32_t *sse_ptr,166 uint32_t *sse_ptr,
175 bool use_high_bit_depth,167 bool use_high_bit_depth,
176 vpx_bit_depth_t bit_depth) {168 vpx_bit_depth_t bit_depth) {
@@ -218,9 +210,8 @@ static uint32_t subpel_avg_variance_ref(const uint8_t *ref, · 41 unmodified lines
218 }210 }
219 RoundHighBitDepth(bit_depth, &se, &sse);211 RoundHighBitDepth(bit_depth, &se, &sse);
220 *sse_ptr = static_cast<uint32_t>(sse);212 *sse_ptr = static_cast<uint32_t>(sse);
221 return static_cast<uint32_t>(sse -213 return static_cast<uint32_t>(
222 ((static_cast<int64_t>(se) * se) >>214 sse - ((static_cast<int64_t>(se) * se) >> (l2w + l2h)));
223 (l2w + l2h)));
224}215}
225 216
226////////////////////////////////////////////////////////////////////////////////217////////////////////////////////////////////////////////////////////////////////
@@ -229,9 +220,7 @@ class SumOfSquaresTest : public ::testing::TestWithParam<SumOfSquaresFunction> { · 2 unmodified lines
229 public:220 public:
230 SumOfSquaresTest() : func_(GetParam()) {}221 SumOfSquaresTest() : func_(GetParam()) {}
231 222
232 virtual ~SumOfSquaresTest() {223 virtual ~SumOfSquaresTest() { libvpx_test::ClearSystemState(); }
233 libvpx_test::ClearSystemState();
234 }
235 224
236 protected:225 protected:
237 void ConstTest();226 void ConstTest();
@@ -272,10 +261,10 @@ void SumOfSquaresTest::RefTest() { · 34 unmodified lines
272// some testing context.261// some testing context.
273// Can be used for MSE, SSE, Variance, etc.262// Can be used for MSE, SSE, Variance, etc.
274 263
275template<typename Func>264template <typename Func>
276struct TestParams {265struct TestParams {
277 TestParams(int log2w = 0, int log2h = 0,266 TestParams(int log2w = 0, int log2h = 0, Func function = NULL,
278 Func function = NULL, int bit_depth_value = 0)267 int bit_depth_value = 0)
279 : log2width(log2w), log2height(log2h), func(function) {268 : log2width(log2w), log2height(log2h), func(function) {
280 use_high_bit_depth = (bit_depth_value > 0);269 use_high_bit_depth = (bit_depth_value > 0);
281 if (use_high_bit_depth) {270 if (use_high_bit_depth) {
@@ -298,17 +287,17 @@ struct TestParams { · 16 unmodified lines
298 uint32_t mask;287 uint32_t mask;
299};288};
300 289
301template<typename Func>290template <typename Func>
302std::ostream &operator<<(std::ostream &os, const TestParams<Func> &p) {291std::ostream &operator<<(std::ostream &os, const TestParams<Func> &p) {
303 return os << "log2width/height:" << p.log2width << "/" << p.log2height292 return os << "log2width/height:" << p.log2width << "/" << p.log2height
304 << " function:" << reinterpret_cast<const void*>(p.func)293 << " function:" << reinterpret_cast<const void *>(p.func)
305 << " bit-depth:" << p.bit_depth;294 << " bit-depth:" << p.bit_depth;
306}295}
307 296
308// Main class for testing a function type297// Main class for testing a function type
309template<typename FunctionType>298template <typename FunctionType>
310class MainTestClass :299class MainTestClass
311 public ::testing::TestWithParam<TestParams<FunctionType> > {300 : public ::testing::TestWithParam<TestParams<FunctionType> > {
312 public:301 public:
313 virtual void SetUp() {302 virtual void SetUp() {
314 params_ = this->GetParam();303 params_ = this->GetParam();
@@ -316,7 +305,7 @@ class MainTestClass : · 1 unmodified line
316 rnd_.Reset(ACMRandom::DeterministicSeed());305 rnd_.Reset(ACMRandom::DeterministicSeed());
317 const size_t unit =306 const size_t unit =
318 use_high_bit_depth() ? sizeof(uint16_t) : sizeof(uint8_t);307 use_high_bit_depth() ? sizeof(uint16_t) : sizeof(uint8_t);
319 src_ = reinterpret_cast<uint8_t*>(vpx_memalign(16, block_size() * unit));308 src_ = reinterpret_cast<uint8_t *>(vpx_memalign(16, block_size() * unit));
320 ref_ = new uint8_t[block_size() * unit];309 ref_ = new uint8_t[block_size() * unit];
321 ASSERT_TRUE(src_ != NULL);310 ASSERT_TRUE(src_ != NULL);
322 ASSERT_TRUE(ref_ != NULL);311 ASSERT_TRUE(ref_ != NULL);
@@ -333,8 +322,8 @@ class MainTestClass : · 10 unmodified lines
333#if CONFIG_VP9_HIGHBITDEPTH322#if CONFIG_VP9_HIGHBITDEPTH
334 if (use_high_bit_depth()) {323 if (use_high_bit_depth()) {
335 // TODO(skal): remove!324 // TODO(skal): remove!
336 src_ = reinterpret_cast<uint8_t*>(CONVERT_TO_SHORTPTR(src_));325 src_ = reinterpret_cast<uint8_t *>(CONVERT_TO_SHORTPTR(src_));
337 ref_ = reinterpret_cast<uint8_t*>(CONVERT_TO_SHORTPTR(ref_));326 ref_ = reinterpret_cast<uint8_t *>(CONVERT_TO_SHORTPTR(ref_));
338 }327 }
339#endif328#endif
340 329
@@ -380,20 +369,20 @@ class MainTestClass : · 39 unmodified lines
380////////////////////////////////////////////////////////////////////////////////369////////////////////////////////////////////////////////////////////////////////
381// Tests related to variance.370// Tests related to variance.
382 371
383template<typename VarianceFunctionType>372template <typename VarianceFunctionType>
384void MainTestClass<VarianceFunctionType>::ZeroTest() {373void MainTestClass<VarianceFunctionType>::ZeroTest() {
385 for (int i = 0; i <= 255; ++i) {374 for (int i = 0; i <= 255; ++i) {
386 if (!use_high_bit_depth()) {375 if (!use_high_bit_depth()) {
387 memset(src_, i, block_size());376 memset(src_, i, block_size());
388 } else {377 } else {
389 uint16_t* const src16 = CONVERT_TO_SHORTPTR(src_);378 uint16_t *const src16 = CONVERT_TO_SHORTPTR(src_);
390 for (int k = 0; k < block_size(); ++k) src16[k] = i << byte_shift();379 for (int k = 0; k < block_size(); ++k) src16[k] = i << byte_shift();
391 }380 }
392 for (int j = 0; j <= 255; ++j) {381 for (int j = 0; j <= 255; ++j) {
393 if (!use_high_bit_depth()) {382 if (!use_high_bit_depth()) {
394 memset(ref_, j, block_size());383 memset(ref_, j, block_size());
395 } else {384 } else {
396 uint16_t* const ref16 = CONVERT_TO_SHORTPTR(ref_);385 uint16_t *const ref16 = CONVERT_TO_SHORTPTR(ref_);
397 for (int k = 0; k < block_size(); ++k) ref16[k] = j << byte_shift();386 for (int k = 0; k < block_size(); ++k) ref16[k] = j << byte_shift();
398 }387 }
399 unsigned int sse, var;388 unsigned int sse, var;
@@ -404,7 +393,7 @@ void MainTestClass<VarianceFunctionType>::ZeroTest() { · 4 unmodified lines
404 }393 }
405}394}
406 395
407template<typename VarianceFunctionType>396template <typename VarianceFunctionType>
408void MainTestClass<VarianceFunctionType>::RefTest() {397void MainTestClass<VarianceFunctionType>::RefTest() {
409 for (int i = 0; i < 10; ++i) {398 for (int i = 0; i < 10; ++i) {
410 for (int j = 0; j < block_size(); j++) {399 for (int j = 0; j < block_size(); j++) {
@@ -422,15 +411,15 @@ void MainTestClass<VarianceFunctionType>::RefTest() { · 11 unmodified lines
422 const int stride = width();411 const int stride = width();
423 ASM_REGISTER_STATE_CHECK(412 ASM_REGISTER_STATE_CHECK(
424 var1 = params_.func(src_, stride, ref_, stride, &sse1));413 var1 = params_.func(src_, stride, ref_, stride, &sse1));
425 var2 = variance_ref(src_, ref_, params_.log2width, params_.log2height,414 var2 =
426 stride, stride, &sse2,415 variance_ref(src_, ref_, params_.log2width, params_.log2height, stride,
427 use_high_bit_depth(), params_.bit_depth);416 stride, &sse2, use_high_bit_depth(), params_.bit_depth);
428 EXPECT_EQ(sse1, sse2) << "Error at test index: " << i;417 EXPECT_EQ(sse1, sse2) << "Error at test index: " << i;
429 EXPECT_EQ(var1, var2) << "Error at test index: " << i;418 EXPECT_EQ(var1, var2) << "Error at test index: " << i;
430 }419 }
431}420}
432 421
433template<typename VarianceFunctionType>422template <typename VarianceFunctionType>
434void MainTestClass<VarianceFunctionType>::RefStrideTest() {423void MainTestClass<VarianceFunctionType>::RefStrideTest() {
435 for (int i = 0; i < 10; ++i) {424 for (int i = 0; i < 10; ++i) {
436 const int ref_stride = (i & 1) * width();425 const int ref_stride = (i & 1) * width();
@@ -453,16 +442,15 @@ void MainTestClass<VarianceFunctionType>::RefStrideTest() { · 16 unmodified lines
453 442
454 ASM_REGISTER_STATE_CHECK(443 ASM_REGISTER_STATE_CHECK(
455 var1 = params_.func(src_, src_stride, ref_, ref_stride, &sse1));444 var1 = params_.func(src_, src_stride, ref_, ref_stride, &sse1));
456 var2 = variance_ref(src_, ref_,445 var2 = variance_ref(src_, ref_, params_.log2width, params_.log2height,
457 params_.log2width, params_.log2height,446 src_stride, ref_stride, &sse2, use_high_bit_depth(),
458 src_stride, ref_stride, &sse2,447 params_.bit_depth);
459 use_high_bit_depth(), params_.bit_depth);
460 EXPECT_EQ(sse1, sse2) << "Error at test index: " << i;448 EXPECT_EQ(sse1, sse2) << "Error at test index: " << i;
461 EXPECT_EQ(var1, var2) << "Error at test index: " << i;449 EXPECT_EQ(var1, var2) << "Error at test index: " << i;
462 }450 }
463}451}
464 452
465template<typename VarianceFunctionType>453template <typename VarianceFunctionType>
466void MainTestClass<VarianceFunctionType>::OneQuarterTest() {454void MainTestClass<VarianceFunctionType>::OneQuarterTest() {
467 const int half = block_size() / 2;455 const int half = block_size() / 2;
468 if (!use_high_bit_depth()) {456 if (!use_high_bit_depth()) {
@@ -486,7 +474,7 @@ void MainTestClass<VarianceFunctionType>::OneQuarterTest() { · 17 unmodified lines
486////////////////////////////////////////////////////////////////////////////////474////////////////////////////////////////////////////////////////////////////////
487// Tests related to MSE / SSE.475// Tests related to MSE / SSE.
488 476
489template<typename FunctionType>477template <typename FunctionType>
490void MainTestClass<FunctionType>::RefTestMse() {478void MainTestClass<FunctionType>::RefTestMse() {
491 for (int i = 0; i < 10; ++i) {479 for (int i = 0; i < 10; ++i) {
492 for (int j = 0; j < block_size(); ++j) {480 for (int j = 0; j < block_size(); ++j) {
@@ -496,13 +484,13 @@ void MainTestClass<FunctionType>::RefTestMse() { · 3 unmodified lines
496 unsigned int sse1, sse2;484 unsigned int sse1, sse2;
497 const int stride = width();485 const int stride = width();
498 ASM_REGISTER_STATE_CHECK(params_.func(src_, stride, ref_, stride, &sse1));486 ASM_REGISTER_STATE_CHECK(params_.func(src_, stride, ref_, stride, &sse1));
499 variance_ref(src_, ref_, params_.log2width, params_.log2height,487 variance_ref(src_, ref_, params_.log2width, params_.log2height, stride,
500 stride, stride, &sse2, false, VPX_BITS_8);488 stride, &sse2, false, VPX_BITS_8);
501 EXPECT_EQ(sse1, sse2);489 EXPECT_EQ(sse1, sse2);
502 }490 }
503}491}
504 492
505template<typename FunctionType>493template <typename FunctionType>
506void MainTestClass<FunctionType>::RefTestSse() {494void MainTestClass<FunctionType>::RefTestSse() {
507 for (int i = 0; i < 10; ++i) {495 for (int i = 0; i < 10; ++i) {
508 for (int j = 0; j < block_size(); ++j) {496 for (int j = 0; j < block_size(); ++j) {
@@ -513,13 +501,13 @@ void MainTestClass<FunctionType>::RefTestSse() { · 4 unmodified lines
513 unsigned int var1;501 unsigned int var1;
514 const int stride = width();502 const int stride = width();
515 ASM_REGISTER_STATE_CHECK(var1 = params_.func(src_, stride, ref_, stride));503 ASM_REGISTER_STATE_CHECK(var1 = params_.func(src_, stride, ref_, stride));
516 variance_ref(src_, ref_, params_.log2width, params_.log2height,504 variance_ref(src_, ref_, params_.log2width, params_.log2height, stride,
517 stride, stride, &sse2, false, VPX_BITS_8);505 stride, &sse2, false, VPX_BITS_8);
518 EXPECT_EQ(var1, sse2);506 EXPECT_EQ(var1, sse2);
519 }507 }
520}508}
521 509
522template<typename FunctionType>510template <typename FunctionType>
523void MainTestClass<FunctionType>::MaxTestMse() {511void MainTestClass<FunctionType>::MaxTestMse() {
524 memset(src_, 255, block_size());512 memset(src_, 255, block_size());
525 memset(ref_, 0, block_size());513 memset(ref_, 0, block_size());
@@ -529,7 +517,7 @@ void MainTestClass<FunctionType>::MaxTestMse() { · 3 unmodified lines
529 EXPECT_EQ(expected, sse);517 EXPECT_EQ(expected, sse);
530}518}
531 519
532template<typename FunctionType>520template <typename FunctionType>
533void MainTestClass<FunctionType>::MaxTestSse() {521void MainTestClass<FunctionType>::MaxTestSse() {
534 memset(src_, 255, block_size());522 memset(src_, 255, block_size());
535 memset(ref_, 0, block_size());523 memset(ref_, 0, block_size());
@@ -545,27 +533,27 @@ using ::std::tr1::get; · 9 unmodified lines
545using ::std::tr1::make_tuple;533using ::std::tr1::make_tuple;
546using ::std::tr1::tuple;534using ::std::tr1::tuple;
547 535
548template<typename SubpelVarianceFunctionType>536template <typename SubpelVarianceFunctionType>
549class SubpelVarianceTest537class SubpelVarianceTest
550 : public ::testing::TestWithParam<tuple<int, int,538 : public ::testing::TestWithParam<
551 SubpelVarianceFunctionType, int> > {539 tuple<int, int, SubpelVarianceFunctionType, int> > {
552 public:540 public:
553 virtual void SetUp() {541 virtual void SetUp() {
554 const tuple<int, int, SubpelVarianceFunctionType, int>& params =542 const tuple<int, int, SubpelVarianceFunctionType, int> &params =
555 this->GetParam();543 this->GetParam();
556 log2width_ = get<0>(params);544 log2width_ = get<0>(params);
557 width_ = 1 << log2width_;545 width_ = 1 << log2width_;
558 log2height_ = get<1>(params);546 log2height_ = get<1>(params);
559 height_ = 1 << log2height_;547 height_ = 1 << log2height_;
560 subpel_variance_ = get<2>(params);548 subpel_variance_ = get<2>(params);
561 if (get<3>(params)) {549 if (get<3>(params)) {
562 bit_depth_ = (vpx_bit_depth_t) get<3>(params);550 bit_depth_ = (vpx_bit_depth_t)get<3>(params);
563 use_high_bit_depth_ = true;551 use_high_bit_depth_ = true;
564 } else {552 } else {
565 bit_depth_ = VPX_BITS_8;553 bit_depth_ = VPX_BITS_8;
566 use_high_bit_depth_ = false;554 use_high_bit_depth_ = false;
567 }555 }
568 mask_ = (1 << bit_depth_)-1;556 mask_ = (1 << bit_depth_) - 1;
569 557
570 rnd_.Reset(ACMRandom::DeterministicSeed());558 rnd_.Reset(ACMRandom::DeterministicSeed());
571 block_size_ = width_ * height_;559 block_size_ = width_ * height_;
@@ -575,14 +563,12 @@ class SubpelVarianceTest · 3 unmodified lines
575 ref_ = new uint8_t[block_size_ + width_ + height_ + 1];563 ref_ = new uint8_t[block_size_ + width_ + height_ + 1];
576#if CONFIG_VP9_HIGHBITDEPTH564#if CONFIG_VP9_HIGHBITDEPTH
577 } else {565 } else {
578 src_ = CONVERT_TO_BYTEPTR(566 src_ = CONVERT_TO_BYTEPTR(reinterpret_cast<uint16_t *>(
579 reinterpret_cast<uint16_t *>(567 vpx_memalign(16, block_size_ * sizeof(uint16_t))));
580 vpx_memalign(16, block_size_*sizeof(uint16_t))));568 sec_ = CONVERT_TO_BYTEPTR(reinterpret_cast<uint16_t *>(
581 sec_ = CONVERT_TO_BYTEPTR(569 vpx_memalign(16, block_size_ * sizeof(uint16_t))));
582 reinterpret_cast<uint16_t *>(570 ref_ =
583 vpx_memalign(16, block_size_*sizeof(uint16_t))));571 CONVERT_TO_BYTEPTR(new uint16_t[block_size_ + width_ + height_ + 1]);
584 ref_ = CONVERT_TO_BYTEPTR(
585 new uint16_t[block_size_ + width_ + height_ + 1]);
586#endif // CONFIG_VP9_HIGHBITDEPTH572#endif // CONFIG_VP9_HIGHBITDEPTH
587 }573 }
588 ASSERT_TRUE(src_ != NULL);574 ASSERT_TRUE(src_ != NULL);
@@ -617,11 +603,11 @@ class SubpelVarianceTest · 28 unmodified lines
617 vpx_bit_depth_t bit_depth_;603 vpx_bit_depth_t bit_depth_;
618 int width_, log2width_;604 int width_, log2width_;
619 int height_, log2height_;605 int height_, log2height_;
620 int block_size_, mask_;606 int block_size_, mask_;
621 SubpelVarianceFunctionType subpel_variance_;607 SubpelVarianceFunctionType subpel_variance_;
622};608};
623 609
624template<typename SubpelVarianceFunctionType>610template <typename SubpelVarianceFunctionType>
625void SubpelVarianceTest<SubpelVarianceFunctionType>::RefTest() {611void SubpelVarianceTest<SubpelVarianceFunctionType>::RefTest() {
626 for (int x = 0; x < 8; ++x) {612 for (int x = 0; x < 8; ++x) {
627 for (int y = 0; y < 8; ++y) {613 for (int y = 0; y < 8; ++y) {
@@ -644,20 +630,18 @@ void SubpelVarianceTest<SubpelVarianceFunctionType>::RefTest() { · 16 unmodified lines
644 }630 }
645 unsigned int sse1, sse2;631 unsigned int sse1, sse2;
646 unsigned int var1;632 unsigned int var1;
647 ASM_REGISTER_STATE_CHECK(var1 = subpel_variance_(ref_, width_ + 1, x, y,633 ASM_REGISTER_STATE_CHECK(
648 src_, width_, &sse1));634 var1 = subpel_variance_(ref_, width_ + 1, x, y, src_, width_, &sse1));
649 const unsigned int var2 = subpel_variance_ref(ref_, src_,635 const unsigned int var2 =
650 log2width_, log2height_,636 subpel_variance_ref(ref_, src_, log2width_, log2height_, x, y, &sse2,
651 x, y, &sse2,637 use_high_bit_depth_, bit_depth_);
652 use_high_bit_depth_,
653 bit_depth_);
654 EXPECT_EQ(sse1, sse2) << "at position " << x << ", " << y;638 EXPECT_EQ(sse1, sse2) << "at position " << x << ", " << y;
655 EXPECT_EQ(var1, var2) << "at position " << x << ", " << y;639 EXPECT_EQ(var1, var2) << "at position " << x << ", " << y;
656 }640 }
657 }641 }
658}642}
659 643
660template<typename SubpelVarianceFunctionType>644template <typename SubpelVarianceFunctionType>
661void SubpelVarianceTest<SubpelVarianceFunctionType>::ExtremeRefTest() {645void SubpelVarianceTest<SubpelVarianceFunctionType>::ExtremeRefTest() {
662 // Compare against reference.646 // Compare against reference.
663 // Src: Set the first half of values to 0, the second half to the maximum.647 // Src: Set the first half of values to 0, the second half to the maximum.
@@ -684,15 +668,15 @@ void SubpelVarianceTest<SubpelVarianceFunctionType>::ExtremeRefTest() { · 20 unmodified lines
684 ASM_REGISTER_STATE_CHECK(668 ASM_REGISTER_STATE_CHECK(
685 var1 = subpel_variance_(ref_, width_ + 1, x, y, src_, width_, &sse1));669 var1 = subpel_variance_(ref_, width_ + 1, x, y, src_, width_, &sse1));
686 const unsigned int var2 =670 const unsigned int var2 =
687 subpel_variance_ref(ref_, src_, log2width_, log2height_,671 subpel_variance_ref(ref_, src_, log2width_, log2height_, x, y, &sse2,
688 x, y, &sse2, use_high_bit_depth_, bit_depth_);672 use_high_bit_depth_, bit_depth_);
689 EXPECT_EQ(sse1, sse2) << "for xoffset " << x << " and yoffset " << y;673 EXPECT_EQ(sse1, sse2) << "for xoffset " << x << " and yoffset " << y;
690 EXPECT_EQ(var1, var2) << "for xoffset " << x << " and yoffset " << y;674 EXPECT_EQ(var1, var2) << "for xoffset " << x << " and yoffset " << y;
691 }675 }
692 }676 }
693}677}
694 678
695template<>679template <>
696void SubpelVarianceTest<SubpixAvgVarMxNFunc>::RefTest() {680void SubpelVarianceTest<SubpixAvgVarMxNFunc>::RefTest() {
697 for (int x = 0; x < 8; ++x) {681 for (int x = 0; x < 8; ++x) {
698 for (int y = 0; y < 8; ++y) {682 for (int y = 0; y < 8; ++y) {
@@ -717,13 +701,11 @@ void SubpelVarianceTest<SubpixAvgVarMxNFunc>::RefTest() { · 18 unmodified lines
717 }701 }
718 uint32_t sse1, sse2;702 uint32_t sse1, sse2;
719 uint32_t var1, var2;703 uint32_t var1, var2;
720 ASM_REGISTER_STATE_CHECK(704 ASM_REGISTER_STATE_CHECK(var1 =
721 var1 = subpel_variance_(ref_, width_ + 1, x, y,705 subpel_variance_(ref_, width_ + 1, x, y,
722 src_, width_, &sse1, sec_));706 src_, width_, &sse1, sec_));
723 var2 = subpel_avg_variance_ref(ref_, src_, sec_,707 var2 = subpel_avg_variance_ref(ref_, src_, sec_, log2width_, log2height_,
724 log2width_, log2height_,708 x, y, &sse2, use_high_bit_depth_,
725 x, y, &sse2,
726 use_high_bit_depth_,
727 static_cast<vpx_bit_depth_t>(bit_depth_));709 static_cast<vpx_bit_depth_t>(bit_depth_));
728 EXPECT_EQ(sse1, sse2) << "at position " << x << ", " << y;710 EXPECT_EQ(sse1, sse2) << "at position " << x << ", " << y;
729 EXPECT_EQ(var1, var2) << "at position " << x << ", " << y;711 EXPECT_EQ(var1, var2) << "at position " << x << ", " << y;
@@ -756,14 +738,15 @@ INSTANTIATE_TEST_CASE_P(C, SumOfSquaresTest, · 26 unmodified lines
756 738
757typedef TestParams<Get4x4SseFunc> SseParams;739typedef TestParams<Get4x4SseFunc> SseParams;
758INSTANTIATE_TEST_CASE_P(C, VpxSseTest,740INSTANTIATE_TEST_CASE_P(C, VpxSseTest,
759 ::testing::Values(SseParams(2, 2, &vpx_get4x4sse_cs_c)));741 ::testing::Values(SseParams(2, 2,
742 &vpx_get4x4sse_cs_c)));
760 743
761typedef TestParams<VarianceMxNFunc> MseParams;744typedef TestParams<VarianceMxNFunc> MseParams;
762INSTANTIATE_TEST_CASE_P(C, VpxMseTest,745INSTANTIATE_TEST_CASE_P(C, VpxMseTest,
763 ::testing::Values(MseParams(4, 4, &vpx_mse16x16_c),746 ::testing::Values(MseParams(4, 4, &vpx_mse16x16_c),
764 MseParams(4, 3, &vpx_mse16x8_c),747 MseParams(4, 3, &vpx_mse16x8_c),
765 MseParams(3, 4, &vpx_mse8x16_c),748 MseParams(3, 4, &vpx_mse8x16_c),
766 MseParams(3, 3, &vpx_mse8x8_c)));749 MseParams(3, 3, &vpx_mse8x8_c)));
767 750
768typedef TestParams<VarianceMxNFunc> VarianceParams;751typedef TestParams<VarianceMxNFunc> VarianceParams;
769INSTANTIATE_TEST_CASE_P(752INSTANTIATE_TEST_CASE_P(
@@ -818,8 +801,7 @@ INSTANTIATE_TEST_CASE_P( · 48 unmodified lines
818typedef MainTestClass<VarianceMxNFunc> VpxHBDMseTest;801typedef MainTestClass<VarianceMxNFunc> VpxHBDMseTest;
819typedef MainTestClass<VarianceMxNFunc> VpxHBDVarianceTest;802typedef MainTestClass<VarianceMxNFunc> VpxHBDVarianceTest;
820typedef SubpelVarianceTest<SubpixVarMxNFunc> VpxHBDSubpelVarianceTest;803typedef SubpelVarianceTest<SubpixVarMxNFunc> VpxHBDSubpelVarianceTest;
821typedef SubpelVarianceTest<SubpixAvgVarMxNFunc>804typedef SubpelVarianceTest<SubpixAvgVarMxNFunc> VpxHBDSubpelAvgVarianceTest;
822 VpxHBDSubpelAvgVarianceTest;
823 805
824TEST_P(VpxHBDMseTest, RefMse) { RefTestMse(); }806TEST_P(VpxHBDMseTest, RefMse) { RefTestMse(); }
825TEST_P(VpxHBDMseTest, MaxMse) { MaxTestMse(); }807TEST_P(VpxHBDMseTest, MaxMse) { MaxTestMse(); }
@@ -982,10 +964,10 @@ INSTANTIATE_TEST_CASE_P(SSE2, SumOfSquaresTest, · 156 unmodified lines
982 ::testing::Values(vpx_get_mb_ss_sse2));964 ::testing::Values(vpx_get_mb_ss_sse2));
983 965
984INSTANTIATE_TEST_CASE_P(SSE2, VpxMseTest,966INSTANTIATE_TEST_CASE_P(SSE2, VpxMseTest,
985 ::testing::Values(MseParams(4, 4, &vpx_mse16x16_sse2),967 ::testing::Values(MseParams(4, 4, &vpx_mse16x16_sse2),
986 MseParams(4, 3, &vpx_mse16x8_sse2),968 MseParams(4, 3, &vpx_mse16x8_sse2),
987 MseParams(3, 4, &vpx_mse8x16_sse2),969 MseParams(3, 4, &vpx_mse8x16_sse2),
988 MseParams(3, 3, &vpx_mse8x8_sse2)));970 MseParams(3, 3, &vpx_mse8x8_sse2)));
989 971
990INSTANTIATE_TEST_CASE_P(972INSTANTIATE_TEST_CASE_P(
991 SSE2, VpxVarianceTest,973 SSE2, VpxVarianceTest,
@@ -1055,37 +1037,38 @@ INSTANTIATE_TEST_CASE_P( · 63 unmodified lines
1055*/1037*/
1056 1038
1057INSTANTIATE_TEST_CASE_P(1039INSTANTIATE_TEST_CASE_P(
1058 SSE2, VpxHBDVarianceTest, ::testing::Values(1040 SSE2, VpxHBDVarianceTest,
1059 VarianceParams(6, 6, &vpx_highbd_12_variance64x64_sse2, 12),1041 ::testing::Values(
1060 VarianceParams(6, 5, &vpx_highbd_12_variance64x32_sse2, 12),1042 VarianceParams(6, 6, &vpx_highbd_12_variance64x64_sse2, 12),
1061 VarianceParams(5, 6, &vpx_highbd_12_variance32x64_sse2, 12),1043 VarianceParams(6, 5, &vpx_highbd_12_variance64x32_sse2, 12),
1062 VarianceParams(5, 5, &vpx_highbd_12_variance32x32_sse2, 12),1044 VarianceParams(5, 6, &vpx_highbd_12_variance32x64_sse2, 12),
1063 VarianceParams(5, 4, &vpx_highbd_12_variance32x16_sse2, 12),1045 VarianceParams(5, 5, &vpx_highbd_12_variance32x32_sse2, 12),
1064 VarianceParams(4, 5, &vpx_highbd_12_variance16x32_sse2, 12),1046 VarianceParams(5, 4, &vpx_highbd_12_variance32x16_sse2, 12),
1065 VarianceParams(4, 4, &vpx_highbd_12_variance16x16_sse2, 12),1047 VarianceParams(4, 5, &vpx_highbd_12_variance16x32_sse2, 12),
1066 VarianceParams(4, 3, &vpx_highbd_12_variance16x8_sse2, 12),1048 VarianceParams(4, 4, &vpx_highbd_12_variance16x16_sse2, 12),
1067 VarianceParams(3, 4, &vpx_highbd_12_variance8x16_sse2, 12),1049 VarianceParams(4, 3, &vpx_highbd_12_variance16x8_sse2, 12),
1068 VarianceParams(3, 3, &vpx_highbd_12_variance8x8_sse2, 12),1050 VarianceParams(3, 4, &vpx_highbd_12_variance8x16_sse2, 12),
1069 VarianceParams(6, 6, &vpx_highbd_10_variance64x64_sse2, 10),1051 VarianceParams(3, 3, &vpx_highbd_12_variance8x8_sse2, 12),
1070 VarianceParams(6, 5, &vpx_highbd_10_variance64x32_sse2, 10),1052 VarianceParams(6, 6, &vpx_highbd_10_variance64x64_sse2, 10),
1071 VarianceParams(5, 6, &vpx_highbd_10_variance32x64_sse2, 10),1053 VarianceParams(6, 5, &vpx_highbd_10_variance64x32_sse2, 10),
1072 VarianceParams(5, 5, &vpx_highbd_10_variance32x32_sse2, 10),1054 VarianceParams(5, 6, &vpx_highbd_10_variance32x64_sse2, 10),
1073 VarianceParams(5, 4, &vpx_highbd_10_variance32x16_sse2, 10),1055 VarianceParams(5, 5, &vpx_highbd_10_variance32x32_sse2, 10),
1074 VarianceParams(4, 5, &vpx_highbd_10_variance16x32_sse2, 10),1056 VarianceParams(5, 4, &vpx_highbd_10_variance32x16_sse2, 10),
1075 VarianceParams(4, 4, &vpx_highbd_10_variance16x16_sse2, 10),1057 VarianceParams(4, 5, &vpx_highbd_10_variance16x32_sse2, 10),
1076 VarianceParams(4, 3, &vpx_highbd_10_variance16x8_sse2, 10),1058 VarianceParams(4, 4, &vpx_highbd_10_variance16x16_sse2, 10),
1077 VarianceParams(3, 4, &vpx_highbd_10_variance8x16_sse2, 10),1059 VarianceParams(4, 3, &vpx_highbd_10_variance16x8_sse2, 10),
1078 VarianceParams(3, 3, &vpx_highbd_10_variance8x8_sse2, 10),1060 VarianceParams(3, 4, &vpx_highbd_10_variance8x16_sse2, 10),
1079 VarianceParams(6, 6, &vpx_highbd_8_variance64x64_sse2, 8),1061 VarianceParams(3, 3, &vpx_highbd_10_variance8x8_sse2, 10),
1080 VarianceParams(6, 5, &vpx_highbd_8_variance64x32_sse2, 8),1062 VarianceParams(6, 6, &vpx_highbd_8_variance64x64_sse2, 8),
1081 VarianceParams(5, 6, &vpx_highbd_8_variance32x64_sse2, 8),1063 VarianceParams(6, 5, &vpx_highbd_8_variance64x32_sse2, 8),
1082 VarianceParams(5, 5, &vpx_highbd_8_variance32x32_sse2, 8),1064 VarianceParams(5, 6, &vpx_highbd_8_variance32x64_sse2, 8),
1083 VarianceParams(5, 4, &vpx_highbd_8_variance32x16_sse2, 8),1065 VarianceParams(5, 5, &vpx_highbd_8_variance32x32_sse2, 8),
1084 VarianceParams(4, 5, &vpx_highbd_8_variance16x32_sse2, 8),1066 VarianceParams(5, 4, &vpx_highbd_8_variance32x16_sse2, 8),
1085 VarianceParams(4, 4, &vpx_highbd_8_variance16x16_sse2, 8),1067 VarianceParams(4, 5, &vpx_highbd_8_variance16x32_sse2, 8),
1086 VarianceParams(4, 3, &vpx_highbd_8_variance16x8_sse2, 8),1068 VarianceParams(4, 4, &vpx_highbd_8_variance16x16_sse2, 8),
1087 VarianceParams(3, 4, &vpx_highbd_8_variance8x16_sse2, 8),1069 VarianceParams(4, 3, &vpx_highbd_8_variance16x8_sse2, 8),
1088 VarianceParams(3, 3, &vpx_highbd_8_variance8x8_sse2, 8)));1070 VarianceParams(3, 4, &vpx_highbd_8_variance8x16_sse2, 8),
1071 VarianceParams(3, 3, &vpx_highbd_8_variance8x8_sse2, 8)));
1089 1072
1090INSTANTIATE_TEST_CASE_P(1073INSTANTIATE_TEST_CASE_P(
1091 SSE2, VpxHBDSubpelVarianceTest,1074 SSE2, VpxHBDSubpelVarianceTest,
@@ -1200,7 +1183,7 @@ INSTANTIATE_TEST_CASE_P( · 108 unmodified lines
1200 1183
1201#if HAVE_AVX21184#if HAVE_AVX2
1202INSTANTIATE_TEST_CASE_P(AVX2, VpxMseTest,1185INSTANTIATE_TEST_CASE_P(AVX2, VpxMseTest,
1203 ::testing::Values(MseParams(4, 4, &vpx_mse16x16_avx2)));1186 ::testing::Values(MseParams(4, 4, &vpx_mse16x16_avx2)));
1204 1187
1205INSTANTIATE_TEST_CASE_P(1188INSTANTIATE_TEST_CASE_P(
1206 AVX2, VpxVarianceTest,1189 AVX2, VpxVarianceTest,
@@ -1224,7 +1207,8 @@ INSTANTIATE_TEST_CASE_P( · 17 unmodified lines
1224 1207
1225#if HAVE_MEDIA1208#if HAVE_MEDIA
1226INSTANTIATE_TEST_CASE_P(MEDIA, VpxMseTest,1209INSTANTIATE_TEST_CASE_P(MEDIA, VpxMseTest,
1227 ::testing::Values(MseParams(4, 4, &vpx_mse16x16_media)));1210 ::testing::Values(MseParams(4, 4,
1211 &vpx_mse16x16_media)));
1228 1212
1229INSTANTIATE_TEST_CASE_P(1213INSTANTIATE_TEST_CASE_P(
1230 MEDIA, VpxVarianceTest,1214 MEDIA, VpxVarianceTest,
@@ -1239,10 +1223,11 @@ INSTANTIATE_TEST_CASE_P( · 8 unmodified lines
1239 1223
1240#if HAVE_NEON1224#if HAVE_NEON
1241INSTANTIATE_TEST_CASE_P(NEON, VpxSseTest,1225INSTANTIATE_TEST_CASE_P(NEON, VpxSseTest,
1242 ::testing::Values(SseParams(2, 2, &vpx_get4x4sse_cs_neon)));1226 ::testing::Values(SseParams(2, 2,
1227 &vpx_get4x4sse_cs_neon)));
1243 1228
1244INSTANTIATE_TEST_CASE_P(NEON, VpxMseTest,1229INSTANTIATE_TEST_CASE_P(NEON, VpxMseTest,
1245 ::testing::Values(MseParams(4, 4, &vpx_mse16x16_neon)));1230 ::testing::Values(MseParams(4, 4, &vpx_mse16x16_neon)));
1246 1231
1247INSTANTIATE_TEST_CASE_P(1232INSTANTIATE_TEST_CASE_P(
1248 NEON, VpxVarianceTest,1233 NEON, VpxVarianceTest,
@@ -1268,13 +1253,14 @@ INSTANTIATE_TEST_CASE_P(MSA, SumOfSquaresTest, · 19 unmodified lines
1268 ::testing::Values(vpx_get_mb_ss_msa));1253 ::testing::Values(vpx_get_mb_ss_msa));
1269 1254
1270INSTANTIATE_TEST_CASE_P(MSA, VpxSseTest,1255INSTANTIATE_TEST_CASE_P(MSA, VpxSseTest,
1271 ::testing::Values(SseParams(2, 2, &vpx_get4x4sse_cs_msa)));1256 ::testing::Values(SseParams(2, 2,
1257 &vpx_get4x4sse_cs_msa)));
1272 1258
1273INSTANTIATE_TEST_CASE_P(MSA, VpxMseTest,1259INSTANTIATE_TEST_CASE_P(MSA, VpxMseTest,
1274 ::testing::Values(MseParams(4, 4, &vpx_mse16x16_msa),1260 ::testing::Values(MseParams(4, 4, &vpx_mse16x16_msa),
1275 MseParams(4, 3, &vpx_mse16x8_msa),1261 MseParams(4, 3, &vpx_mse16x8_msa),
1276 MseParams(3, 4, &vpx_mse8x16_msa),1262 MseParams(3, 4, &vpx_mse8x16_msa),
1277 MseParams(3, 3, &vpx_mse8x8_msa)));1263 MseParams(3, 3, &vpx_mse8x8_msa)));
1278 1264
1279INSTANTIATE_TEST_CASE_P(1265INSTANTIATE_TEST_CASE_P(
1280 MSA, VpxVarianceTest,1266 MSA, VpxVarianceTest,
test/video_source.h+14−29
@@ -51,7 +51,7 @@ static std::string GetDataPath() { · 50 unmodified lines
51#undef TO_STRING51#undef TO_STRING
52#undef STRINGIFY52#undef STRINGIFY
53 53
54inline FILE *OpenTestDataFile(const std::string& file_name) {54inline FILE *OpenTestDataFile(const std::string &file_name) {
55 const std::string path_to_source = GetDataPath() + "/" + file_name;55 const std::string path_to_source = GetDataPath() + "/" + file_name;
56 return fopen(path_to_source.c_str(), "rb");56 return fopen(path_to_source.c_str(), "rb");
57}57}
@@ -76,21 +76,15 @@ static FILE *GetTempOutFile(std::string *file_name) { · 18 unmodified lines
76 76
77class TempOutFile {77class TempOutFile {
78 public:78 public:
79 TempOutFile() {79 TempOutFile() { file_ = GetTempOutFile(&file_name_); }
80 file_ = GetTempOutFile(&file_name_);
81 }
82 ~TempOutFile() {80 ~TempOutFile() {
83 CloseFile();81 CloseFile();
84 if (!file_name_.empty()) {82 if (!file_name_.empty()) {
85 EXPECT_EQ(0, remove(file_name_.c_str()));83 EXPECT_EQ(0, remove(file_name_.c_str()));
86 }84 }
87 }85 }
88 FILE *file() {86 FILE *file() { return file_; }
89 return file_;87 const std::string &file_name() { return file_name_; }
90 }
91 const std::string& file_name() {
92 return file_name_;
93 }
94 88
95 protected:89 protected:
96 void CloseFile() {90 void CloseFile() {
@@ -134,14 +128,10 @@ class VideoSource { · 37 unmodified lines
134 virtual unsigned int limit() const = 0;128 virtual unsigned int limit() const = 0;
135};129};
136 130
137
138class DummyVideoSource : public VideoSource {131class DummyVideoSource : public VideoSource {
139 public:132 public:
140 DummyVideoSource()133 DummyVideoSource()
141 : img_(NULL),134 : img_(NULL), limit_(100), width_(80), height_(64),
142 limit_(100),
143 width_(80),
144 height_(64),
145 format_(VPX_IMG_FMT_I420) {135 format_(VPX_IMG_FMT_I420) {
146 ReallocImage();136 ReallocImage();
147 }137 }
@@ -158,9 +148,7 @@ class DummyVideoSource : public VideoSource { · 10 unmodified lines
158 FillFrame();148 FillFrame();
159 }149 }
160 150
161 virtual vpx_image_t *img() const {151 virtual vpx_image_t *img() const { return (frame_ < limit_) ? img_ : NULL; }
162 return (frame_ < limit_) ? img_ : NULL;
163 }
164 152
165 // Models a stream where Timebase = 1/FPS, so pts == frame.153 // Models a stream where Timebase = 1/FPS, so pts == frame.
166 virtual vpx_codec_pts_t pts() const { return frame_; }154 virtual vpx_codec_pts_t pts() const { return frame_; }
@@ -168,7 +156,7 @@ class DummyVideoSource : public VideoSource { · 1 unmodified line
168 virtual unsigned long duration() const { return 1; }156 virtual unsigned long duration() const { return 1; }
169 157
170 virtual vpx_rational_t timebase() const {158 virtual vpx_rational_t timebase() const {
171 const vpx_rational_t t = {1, 30};159 const vpx_rational_t t = { 1, 30 };
172 return t;160 return t;
173 }161 }
174 162
@@ -176,9 +164,7 @@ class DummyVideoSource : public VideoSource { · 1 unmodified line
176 164
177 virtual unsigned int limit() const { return limit_; }165 virtual unsigned int limit() const { return limit_; }
178 166
179 void set_limit(unsigned int limit) {167 void set_limit(unsigned int limit) { limit_ = limit; }
180 limit_ = limit;
181 }
182 168
183 void SetSize(unsigned int width, unsigned int height) {169 void SetSize(unsigned int width, unsigned int height) {
184 if (width != width_ || height != height_) {170 if (width != width_ || height != height_) {
@@ -196,7 +182,9 @@ class DummyVideoSource : public VideoSource { · 11 unmodified lines
196 }182 }
197 183
198 protected:184 protected:
199 virtual void FillFrame() { if (img_) memset(img_->img_data, 0, raw_sz_); }185 virtual void FillFrame() {
186 if (img_) memset(img_->img_data, 0, raw_sz_);
187 }
200 188
201 void ReallocImage() {189 void ReallocImage() {
202 vpx_img_free(img_);190 vpx_img_free(img_);
@@ -205,7 +193,7 @@ class DummyVideoSource : public VideoSource { · 2 unmodified lines
205 }193 }
206 194
207 vpx_image_t *img_;195 vpx_image_t *img_;
208 size_t raw_sz_;196 size_t raw_sz_;
209 unsigned int limit_;197 unsigned int limit_;
210 unsigned int frame_;198 unsigned int frame_;
211 unsigned int width_;199 unsigned int width_;
@@ -213,12 +201,10 @@ class DummyVideoSource : public VideoSource { · 1 unmodified line
213 vpx_img_fmt_t format_;201 vpx_img_fmt_t format_;
214};202};
215 203
216
217class RandomVideoSource : public DummyVideoSource {204class RandomVideoSource : public DummyVideoSource {
218 public:205 public:
219 RandomVideoSource(int seed = ACMRandom::DeterministicSeed())206 RandomVideoSource(int seed = ACMRandom::DeterministicSeed())
220 : rnd_(seed),207 : rnd_(seed), seed_(seed) {}
221 seed_(seed) { }
222 208
223 protected:209 protected:
224 // Reset the RNG to get a matching stream for the second pass210 // Reset the RNG to get a matching stream for the second pass
@@ -233,8 +219,7 @@ class RandomVideoSource : public DummyVideoSource { · 8 unmodified lines
233 virtual void FillFrame() {219 virtual void FillFrame() {
234 if (img_) {220 if (img_) {
235 if (frame_ % 30 < 15)221 if (frame_ % 30 < 15)
236 for (size_t i = 0; i < raw_sz_; ++i)222 for (size_t i = 0; i < raw_sz_; ++i) img_->img_data[i] = rnd_.Rand8();
237 img_->img_data[i] = rnd_.Rand8();
238 else223 else
239 memset(img_->img_data, 0, raw_sz_);224 memset(img_->img_data, 0, raw_sz_);
240 }225 }
test/vp8_boolcoder_test.cc+9−10
@@ -8,7 +8,6 @@ · 7 unmodified lines
8 * be found in the AUTHORS file in the root of the source tree.8 * be found in the AUTHORS file in the root of the source tree.
9 */9 */
10 10
11
12#include <math.h>11#include <math.h>
13#include <stddef.h>12#include <stddef.h>
14#include <stdio.h>13#include <stdio.h>
@@ -41,9 +40,9 @@ void encrypt_buffer(uint8_t *buffer, size_t size) { · 26 unmodified lines
41 }40 }
42}41}
43 42
44void test_decrypt_cb(void *decrypt_state, const uint8_t *input,43void test_decrypt_cb(void *decrypt_state, const uint8_t *input, uint8_t *output,
45 uint8_t *output, int count) {44 int count) {
46 const size_t offset = input - reinterpret_cast<uint8_t*>(decrypt_state);45 const size_t offset = input - reinterpret_cast<uint8_t *>(decrypt_state);
47 for (int i = 0; i < count; i++) {46 for (int i = 0; i < count; i++) {
48 output[i] = input[i] ^ secret_key[(offset + i) & 15];47 output[i] = input[i] ^ secret_key[(offset + i) & 15];
49 }48 }
@@ -56,12 +55,13 @@ using libvpx_test::ACMRandom; · 6 unmodified lines
56TEST(VP8, TestBitIO) {55TEST(VP8, TestBitIO) {
57 ACMRandom rnd(ACMRandom::DeterministicSeed());56 ACMRandom rnd(ACMRandom::DeterministicSeed());
58 for (int n = 0; n < num_tests; ++n) {57 for (int n = 0; n < num_tests; ++n) {
59 for (int method = 0; method <= 7; ++method) { // we generate various proba58 for (int method = 0; method <= 7; ++method) { // we generate various proba
60 const int kBitsToTest = 1000;59 const int kBitsToTest = 1000;
61 uint8_t probas[kBitsToTest];60 uint8_t probas[kBitsToTest];
62 61
63 for (int i = 0; i < kBitsToTest; ++i) {62 for (int i = 0; i < kBitsToTest; ++i) {
64 const int parity = i & 1;63 const int parity = i & 1;
64 /* clang-format off */
65 probas[i] =65 probas[i] =
66 (method == 0) ? 0 : (method == 1) ? 255 :66 (method == 0) ? 0 : (method == 1) ? 255 :
67 (method == 2) ? 128 :67 (method == 2) ? 128 :
@@ -72,6 +72,7 @@ TEST(VP8, TestBitIO) { · 4 unmodified lines
72 (method == 6) ?72 (method == 6) ?
73 (parity ? rnd(64) : 255 - rnd(64)) :73 (parity ? rnd(64) : 255 - rnd(64)) :
74 (parity ? rnd(32) : 255 - rnd(32));74 (parity ? rnd(32) : 255 - rnd(32));
75 /* clang-format on */
75 }76 }
76 for (int bit_method = 0; bit_method <= 3; ++bit_method) {77 for (int bit_method = 0; bit_method <= 3; ++bit_method) {
77 const int random_seed = 6432;78 const int random_seed = 6432;
@@ -95,8 +96,7 @@ TEST(VP8, TestBitIO) { · 17 unmodified lines
95 96
96 BOOL_DECODER br;97 BOOL_DECODER br;
97 encrypt_buffer(bw_buffer, kBufferSize);98 encrypt_buffer(bw_buffer, kBufferSize);
98 vp8dx_start_decode(&br, bw_buffer, kBufferSize,99 vp8dx_start_decode(&br, bw_buffer, kBufferSize, test_decrypt_cb,
99 test_decrypt_cb,
100 reinterpret_cast<void *>(bw_buffer));100 reinterpret_cast<void *>(bw_buffer));
101 bit_rnd.Reset(random_seed);101 bit_rnd.Reset(random_seed);
102 for (int i = 0; i < kBitsToTest; ++i) {102 for (int i = 0; i < kBitsToTest; ++i) {
@@ -106,9 +106,8 @@ TEST(VP8, TestBitIO) { · 3 unmodified lines
106 bit = bit_rnd(2);106 bit = bit_rnd(2);
107 }107 }
108 GTEST_ASSERT_EQ(vp8dx_decode_bool(&br, probas[i]), bit)108 GTEST_ASSERT_EQ(vp8dx_decode_bool(&br, probas[i]), bit)
109 << "pos: "<< i << " / " << kBitsToTest109 << "pos: " << i << " / " << kBitsToTest
110 << " bit_method: " << bit_method110 << " bit_method: " << bit_method << " method: " << method;
111 << " method: " << method;
112 }111 }
113 }112 }
114 }113 }
test/vp8_decrypt_test.cc+4−6
@@ -21,10 +21,8 @@ namespace { · 20 unmodified lines
21// with whatever internal state the decryptor uses. For testing we'll just21// with whatever internal state the decryptor uses. For testing we'll just
22// xor with a constant key, and decrypt_state will point to the start of22// xor with a constant key, and decrypt_state will point to the start of
23// the original buffer.23// the original buffer.
24const uint8_t test_key[16] = {24const uint8_t test_key[16] = { 0x01, 0x12, 0x23, 0x34, 0x45, 0x56, 0x67, 0x78,
25 0x01, 0x12, 0x23, 0x34, 0x45, 0x56, 0x67, 0x78,25 0x89, 0x9a, 0xab, 0xbc, 0xcd, 0xde, 0xef, 0xf0 };
26 0x89, 0x9a, 0xab, 0xbc, 0xcd, 0xde, 0xef, 0xf0
27};
28 26
29void encrypt_buffer(const uint8_t *src, uint8_t *dst, size_t size,27void encrypt_buffer(const uint8_t *src, uint8_t *dst, size_t size,
30 ptrdiff_t offset) {28 ptrdiff_t offset) {
@@ -33,8 +31,8 @@ void encrypt_buffer(const uint8_t *src, uint8_t *dst, size_t size, · 2 unmodified lines
33 }31 }
34}32}
35 33
36void test_decrypt_cb(void *decrypt_state, const uint8_t *input,34void test_decrypt_cb(void *decrypt_state, const uint8_t *input, uint8_t *output,
37 uint8_t *output, int count) {35 int count) {
38 encrypt_buffer(input, output, count,36 encrypt_buffer(input, output, count,
39 input - reinterpret_cast<uint8_t *>(decrypt_state));37 input - reinterpret_cast<uint8_t *>(decrypt_state));
40}38}
test/vp8_denoiser_sse2_test.cc+3−5
@@ -32,9 +32,7 @@ class VP8DenoiserTest : public ::testing::TestWithParam<int> { · 31 unmodified lines
32 public:32 public:
33 virtual ~VP8DenoiserTest() {}33 virtual ~VP8DenoiserTest() {}
34 34
35 virtual void SetUp() {35 virtual void SetUp() { increase_denoising_ = GetParam(); }
36 increase_denoising_ = GetParam();
37 }
38 36
39 virtual void TearDown() { libvpx_test::ClearSystemState(); }37 virtual void TearDown() { libvpx_test::ClearSystemState(); }
40 38
@@ -71,8 +69,8 @@ TEST_P(VP8DenoiserTest, BitexactCheck) { · 30 unmodified lines
71 sig_block_sse2[j] = sig_block_c[j] = rnd.Rand8();69 sig_block_sse2[j] = sig_block_c[j] = rnd.Rand8();
72 // The pixels in mc_avg_block are generated by adding a random70 // The pixels in mc_avg_block are generated by adding a random
73 // number in range [-19, 19] to corresponding pixels in sig_block.71 // number in range [-19, 19] to corresponding pixels in sig_block.
74 temp = sig_block_c[j] + (rnd.Rand8() % 2 == 0 ? -1 : 1) *72 temp =
75 (rnd.Rand8() % 20);73 sig_block_c[j] + (rnd.Rand8() % 2 == 0 ? -1 : 1) * (rnd.Rand8() % 20);
76 // Clip.74 // Clip.
77 mc_avg_block[j] = (temp < 0) ? 0 : ((temp > 255) ? 255 : temp);75 mc_avg_block[j] = (temp < 0) ? 0 : ((temp > 255) ? 255 : temp);
78 }76 }
test/vp8_fdct4x4_test.cc+12−11
@@ -95,11 +95,12 @@ TEST(VP8FdctTest, SignBiasCheck) { · 94 unmodified lines
95 95
96 bool bias_acceptable = true;96 bool bias_acceptable = true;
97 for (int j = 0; j < 16; ++j)97 for (int j = 0; j < 16; ++j)
98 bias_acceptable = bias_acceptable &&98 bias_acceptable =
99 (abs(count_sign_block[j][0] - count_sign_block[j][1]) < 10000);99 bias_acceptable &&
100 (abs(count_sign_block[j][0] - count_sign_block[j][1]) < 10000);
100 101
101 EXPECT_EQ(true, bias_acceptable)102 EXPECT_EQ(true, bias_acceptable)
102 << "Error: 4x4 FDCT has a sign bias > 1% for input range [-255, 255]";103 << "Error: 4x4 FDCT has a sign bias > 1% for input range [-255, 255]";
103 104
104 memset(count_sign_block, 0, sizeof(count_sign_block));105 memset(count_sign_block, 0, sizeof(count_sign_block));
105 106
@@ -120,11 +121,12 @@ TEST(VP8FdctTest, SignBiasCheck) { · 14 unmodified lines
120 121
121 bias_acceptable = true;122 bias_acceptable = true;
122 for (int j = 0; j < 16; ++j)123 for (int j = 0; j < 16; ++j)
123 bias_acceptable = bias_acceptable &&124 bias_acceptable =
124 (abs(count_sign_block[j][0] - count_sign_block[j][1]) < 100000);125 bias_acceptable &&
126 (abs(count_sign_block[j][0] - count_sign_block[j][1]) < 100000);
125 127
126 EXPECT_EQ(true, bias_acceptable)128 EXPECT_EQ(true, bias_acceptable)
127 << "Error: 4x4 FDCT has a sign bias > 10% for input range [-15, 15]";129 << "Error: 4x4 FDCT has a sign bias > 10% for input range [-15, 15]";
128};130};
129 131
130TEST(VP8FdctTest, RoundTripErrorCheck) {132TEST(VP8FdctTest, RoundTripErrorCheck) {
@@ -148,17 +150,16 @@ TEST(VP8FdctTest, RoundTripErrorCheck) { · 17 unmodified lines
148 for (int j = 0; j < 16; ++j) {150 for (int j = 0; j < 16; ++j) {
149 const int diff = test_input_block[j] - test_output_block[j];151 const int diff = test_input_block[j] - test_output_block[j];
150 const int error = diff * diff;152 const int error = diff * diff;
151 if (max_error < error)153 if (max_error < error) max_error = error;
152 max_error = error;
153 total_error += error;154 total_error += error;
154 }155 }
155 }156 }
156 157
157 EXPECT_GE(1, max_error )158 EXPECT_GE(1, max_error)
158 << "Error: FDCT/IDCT has an individual roundtrip error > 1";159 << "Error: FDCT/IDCT has an individual roundtrip error > 1";
159 160
160 EXPECT_GE(count_test_block, total_error)161 EXPECT_GE(count_test_block, total_error)
161 << "Error: FDCT/IDCT has average roundtrip error > 1 per block";162 << "Error: FDCT/IDCT has average roundtrip error > 1 per block";
162};163};
163 164
164} // namespace165} // namespace
test/vp8_fragments_test.cc+2−3
@@ -13,9 +13,8 @@ · 12 unmodified lines
13 13
14namespace {14namespace {
15 15
16class VP8FramgmentsTest16class VP8FramgmentsTest : public ::libvpx_test::EncoderTest,
17 : public ::libvpx_test::EncoderTest,17 public ::testing::Test {
18 public ::testing::Test {
19 protected:18 protected:
20 VP8FramgmentsTest() : EncoderTest(&::libvpx_test::kVP8) {}19 VP8FramgmentsTest() : EncoderTest(&::libvpx_test::kVP8) {}
21 virtual ~VP8FramgmentsTest() {}20 virtual ~VP8FramgmentsTest() {}
test/vp9_arf_freq_test.cc+31−47
@@ -22,8 +22,8 @@ namespace { · 21 unmodified lines
22const unsigned int kFrames = 100;22const unsigned int kFrames = 100;
23const int kBitrate = 500;23const int kBitrate = 500;
24 24
25#define ARF_NOT_SEEN 100000125#define ARF_NOT_SEEN 1000001
26#define ARF_SEEN_ONCE 100000026#define ARF_SEEN_ONCE 1000000
27 27
28typedef struct {28typedef struct {
29 const char *filename;29 const char *filename;
@@ -44,24 +44,20 @@ typedef struct { · 14 unmodified lines
44 44
45const TestVideoParam kTestVectors[] = {45const TestVideoParam kTestVectors[] = {
46 // artificially increase framerate to trigger default check46 // artificially increase framerate to trigger default check
47 {"hantro_collage_w352h288.yuv", 352, 288, 5000, 1,47 { "hantro_collage_w352h288.yuv", 352, 288, 5000, 1, 8, VPX_IMG_FMT_I420,
48 8, VPX_IMG_FMT_I420, VPX_BITS_8, 0},48 VPX_BITS_8, 0 },
49 {"hantro_collage_w352h288.yuv", 352, 288, 30, 1,49 { "hantro_collage_w352h288.yuv", 352, 288, 30, 1, 8, VPX_IMG_FMT_I420,
50 8, VPX_IMG_FMT_I420, VPX_BITS_8, 0},50 VPX_BITS_8, 0 },
51 {"rush_hour_444.y4m", 352, 288, 30, 1,51 { "rush_hour_444.y4m", 352, 288, 30, 1, 8, VPX_IMG_FMT_I444, VPX_BITS_8, 1 },
52 8, VPX_IMG_FMT_I444, VPX_BITS_8, 1},
53#if CONFIG_VP9_HIGHBITDEPTH52#if CONFIG_VP9_HIGHBITDEPTH
54 // Add list of profile 2/3 test videos here ...53// Add list of profile 2/3 test videos here ...
55#endif // CONFIG_VP9_HIGHBITDEPTH54#endif // CONFIG_VP9_HIGHBITDEPTH
56};55};
57 56
58const TestEncodeParam kEncodeVectors[] = {57const TestEncodeParam kEncodeVectors[] = {
59 {::libvpx_test::kOnePassGood, 2},58 { ::libvpx_test::kOnePassGood, 2 }, { ::libvpx_test::kOnePassGood, 5 },
60 {::libvpx_test::kOnePassGood, 5},59 { ::libvpx_test::kTwoPassGood, 1 }, { ::libvpx_test::kTwoPassGood, 2 },
61 {::libvpx_test::kTwoPassGood, 1},60 { ::libvpx_test::kTwoPassGood, 5 }, { ::libvpx_test::kRealTime, 5 },
62 {::libvpx_test::kTwoPassGood, 2},
63 {::libvpx_test::kTwoPassGood, 5},
64 {::libvpx_test::kRealTime, 5},
65};61};
66 62
67const int kMinArfVectors[] = {63const int kMinArfVectors[] = {
@@ -80,15 +76,12 @@ int is_extension_y4m(const char *filename) { · 12 unmodified lines
80 76
81class ArfFreqTest77class ArfFreqTest
82 : public ::libvpx_test::EncoderTest,78 : public ::libvpx_test::EncoderTest,
83 public ::libvpx_test::CodecTestWith3Params<TestVideoParam, \79 public ::libvpx_test::CodecTestWith3Params<TestVideoParam,
84 TestEncodeParam, int> {80 TestEncodeParam, int> {
85 protected:81 protected:
86 ArfFreqTest()82 ArfFreqTest()
87 : EncoderTest(GET_PARAM(0)),83 : EncoderTest(GET_PARAM(0)), test_video_param_(GET_PARAM(1)),
88 test_video_param_(GET_PARAM(1)),84 test_encode_param_(GET_PARAM(2)), min_arf_requested_(GET_PARAM(3)) {}
89 test_encode_param_(GET_PARAM(2)),
90 min_arf_requested_(GET_PARAM(3)) {
91 }
92 85
93 virtual ~ArfFreqTest() {}86 virtual ~ArfFreqTest() {}
94 87
@@ -114,17 +107,16 @@ class ArfFreqTest · 19 unmodified lines
114 }107 }
115 108
116 int GetNumFramesInPkt(const vpx_codec_cx_pkt_t *pkt) {109 int GetNumFramesInPkt(const vpx_codec_cx_pkt_t *pkt) {
117 const uint8_t *buffer = reinterpret_cast<uint8_t*>(pkt->data.frame.buf);110 const uint8_t *buffer = reinterpret_cast<uint8_t *>(pkt->data.frame.buf);
118 const uint8_t marker = buffer[pkt->data.frame.sz - 1];111 const uint8_t marker = buffer[pkt->data.frame.sz - 1];
119 const int mag = ((marker >> 3) & 3) + 1;112 const int mag = ((marker >> 3) & 3) + 1;
120 int frames = (marker & 0x7) + 1;113 int frames = (marker & 0x7) + 1;
121 const unsigned int index_sz = 2 + mag * frames;114 const unsigned int index_sz = 2 + mag * frames;
122 // Check for superframe or not.115 // Check for superframe or not.
123 // Assume superframe has only one visible frame, the rest being116 // Assume superframe has only one visible frame, the rest being
124 // invisible. If superframe index is not found, then there is only117 // invisible. If superframe index is not found, then there is only
125 // one frame.118 // one frame.
126 if (!((marker & 0xe0) == 0xc0 &&119 if (!((marker & 0xe0) == 0xc0 && pkt->data.frame.sz >= index_sz &&
127 pkt->data.frame.sz >= index_sz &&
128 buffer[pkt->data.frame.sz - index_sz] == marker)) {120 buffer[pkt->data.frame.sz - index_sz] == marker)) {
129 frames = 1;121 frames = 1;
130 }122 }
@@ -132,8 +124,7 @@ class ArfFreqTest · 1 unmodified line
132 }124 }
133 125
134 virtual void FramePktHook(const vpx_codec_cx_pkt_t *pkt) {126 virtual void FramePktHook(const vpx_codec_cx_pkt_t *pkt) {
135 if (pkt->kind != VPX_CODEC_CX_FRAME_PKT)127 if (pkt->kind != VPX_CODEC_CX_FRAME_PKT) return;
136 return;
137 const int frames = GetNumFramesInPkt(pkt);128 const int frames = GetNumFramesInPkt(pkt);
138 if (frames == 1) {129 if (frames == 1) {
139 run_of_visible_frames_++;130 run_of_visible_frames_++;
@@ -167,9 +158,7 @@ class ArfFreqTest · 27 unmodified lines
167 }158 }
168 }159 }
169 160
170 int GetMinVisibleRun() const {161 int GetMinVisibleRun() const { return min_run_; }
171 return min_run_;
172 }
173 162
174 int GetMinArfDistanceRequested() const {163 int GetMinArfDistanceRequested() const {
175 if (min_arf_requested_)164 if (min_arf_requested_)
@@ -178,7 +167,7 @@ class ArfFreqTest · 2 unmodified lines
178 return vp9_rc_get_default_min_gf_interval(167 return vp9_rc_get_default_min_gf_interval(
179 test_video_param_.width, test_video_param_.height,168 test_video_param_.width, test_video_param_.height,
180 (double)test_video_param_.framerate_num /169 (double)test_video_param_.framerate_num /
181 test_video_param_.framerate_den);170 test_video_param_.framerate_den);
182 }171 }
183 172
184 TestVideoParam test_video_param_;173 TestVideoParam test_video_param_;
@@ -197,21 +186,18 @@ TEST_P(ArfFreqTest, MinArfFreqTest) { · 12 unmodified lines
197 cfg_.g_input_bit_depth = test_video_param_.input_bit_depth;186 cfg_.g_input_bit_depth = test_video_param_.input_bit_depth;
198 cfg_.g_bit_depth = test_video_param_.bit_depth;187 cfg_.g_bit_depth = test_video_param_.bit_depth;
199 init_flags_ = VPX_CODEC_USE_PSNR;188 init_flags_ = VPX_CODEC_USE_PSNR;
200 if (cfg_.g_bit_depth > 8)189 if (cfg_.g_bit_depth > 8) init_flags_ |= VPX_CODEC_USE_HIGHBITDEPTH;
201 init_flags_ |= VPX_CODEC_USE_HIGHBITDEPTH;
202 190
203 testing::internal::scoped_ptr<libvpx_test::VideoSource> video;191 testing::internal::scoped_ptr<libvpx_test::VideoSource> video;
204 if (is_extension_y4m(test_video_param_.filename)) {192 if (is_extension_y4m(test_video_param_.filename)) {
205 video.reset(new libvpx_test::Y4mVideoSource(test_video_param_.filename,193 video.reset(new libvpx_test::Y4mVideoSource(test_video_param_.filename, 0,
206 0, kFrames));194 kFrames));
207 } else {195 } else {
208 video.reset(new libvpx_test::YUVVideoSource(test_video_param_.filename,196 video.reset(new libvpx_test::YUVVideoSource(
209 test_video_param_.fmt,197 test_video_param_.filename, test_video_param_.fmt,
210 test_video_param_.width,198 test_video_param_.width, test_video_param_.height,
211 test_video_param_.height,199 test_video_param_.framerate_num, test_video_param_.framerate_den, 0,
212 test_video_param_.framerate_num,200 kFrames));
213 test_video_param_.framerate_den,
214 0, kFrames));
215 }201 }
216 202
217 ASSERT_NO_FATAL_FAILURE(RunLoop(video.get()));203 ASSERT_NO_FATAL_FAILURE(RunLoop(video.get()));
@@ -223,9 +209,7 @@ TEST_P(ArfFreqTest, MinArfFreqTest) { · 5 unmodified lines
223 }209 }
224}210}
225 211
226VP9_INSTANTIATE_TEST_CASE(212VP9_INSTANTIATE_TEST_CASE(ArfFreqTest, ::testing::ValuesIn(kTestVectors),
227 ArfFreqTest,213 ::testing::ValuesIn(kEncodeVectors),
228 ::testing::ValuesIn(kTestVectors),214 ::testing::ValuesIn(kMinArfVectors));
229 ::testing::ValuesIn(kEncodeVectors),
230 ::testing::ValuesIn(kMinArfVectors));
231} // namespace215} // namespace
test/vp9_boolcoder_test.cc+4−3
@@ -28,12 +28,13 @@ const int num_tests = 10; · 27 unmodified lines
28TEST(VP9, TestBitIO) {28TEST(VP9, TestBitIO) {
29 ACMRandom rnd(ACMRandom::DeterministicSeed());29 ACMRandom rnd(ACMRandom::DeterministicSeed());
30 for (int n = 0; n < num_tests; ++n) {30 for (int n = 0; n < num_tests; ++n) {
31 for (int method = 0; method <= 7; ++method) { // we generate various proba31 for (int method = 0; method <= 7; ++method) { // we generate various proba
32 const int kBitsToTest = 1000;32 const int kBitsToTest = 1000;
33 uint8_t probas[kBitsToTest];33 uint8_t probas[kBitsToTest];
34 34
35 for (int i = 0; i < kBitsToTest; ++i) {35 for (int i = 0; i < kBitsToTest; ++i) {
36 const int parity = i & 1;36 const int parity = i & 1;
37 /* clang-format off */
37 probas[i] =38 probas[i] =
38 (method == 0) ? 0 : (method == 1) ? 255 :39 (method == 0) ? 0 : (method == 1) ? 255 :
39 (method == 2) ? 128 :40 (method == 2) ? 128 :
@@ -44,6 +45,7 @@ TEST(VP9, TestBitIO) { · 4 unmodified lines
44 (method == 6) ?45 (method == 6) ?
45 (parity ? rnd(64) : 255 - rnd(64)) :46 (parity ? rnd(64) : 255 - rnd(64)) :
46 (parity ? rnd(32) : 255 - rnd(32));47 (parity ? rnd(32) : 255 - rnd(32));
48 /* clang-format on */
47 }49 }
48 for (int bit_method = 0; bit_method <= 3; ++bit_method) {50 for (int bit_method = 0; bit_method <= 3; ++bit_method) {
49 const int random_seed = 6432;51 const int random_seed = 6432;
@@ -79,8 +81,7 @@ TEST(VP9, TestBitIO) { · 29 unmodified lines
79 }81 }
80 GTEST_ASSERT_EQ(vpx_read(&br, probas[i]), bit)82 GTEST_ASSERT_EQ(vpx_read(&br, probas[i]), bit)
81 << "pos: " << i << " / " << kBitsToTest83 << "pos: " << i << " / " << kBitsToTest
82 << " bit_method: " << bit_method84 << " bit_method: " << bit_method << " method: " << method;
83 << " method: " << method;
84 }85 }
85 }86 }
86 }87 }
test/vp9_decrypt_test.cc+4−6
@@ -21,10 +21,8 @@ namespace { · 20 unmodified lines
21// with whatever internal state the decryptor uses. For testing we'll just21// with whatever internal state the decryptor uses. For testing we'll just
22// xor with a constant key, and decrypt_state will point to the start of22// xor with a constant key, and decrypt_state will point to the start of
23// the original buffer.23// the original buffer.
24const uint8_t test_key[16] = {24const uint8_t test_key[16] = { 0x01, 0x12, 0x23, 0x34, 0x45, 0x56, 0x67, 0x78,
25 0x01, 0x12, 0x23, 0x34, 0x45, 0x56, 0x67, 0x78,25 0x89, 0x9a, 0xab, 0xbc, 0xcd, 0xde, 0xef, 0xf0 };
26 0x89, 0x9a, 0xab, 0xbc, 0xcd, 0xde, 0xef, 0xf0
27};
28 26
29void encrypt_buffer(const uint8_t *src, uint8_t *dst, size_t size,27void encrypt_buffer(const uint8_t *src, uint8_t *dst, size_t size,
30 ptrdiff_t offset) {28 ptrdiff_t offset) {
@@ -33,8 +31,8 @@ void encrypt_buffer(const uint8_t *src, uint8_t *dst, size_t size, · 2 unmodified lines
33 }31 }
34}32}
35 33
36void test_decrypt_cb(void *decrypt_state, const uint8_t *input,34void test_decrypt_cb(void *decrypt_state, const uint8_t *input, uint8_t *output,
37 uint8_t *output, int count) {35 int count) {
38 encrypt_buffer(input, output, count,36 encrypt_buffer(input, output, count,
39 input - reinterpret_cast<uint8_t *>(decrypt_state));37 input - reinterpret_cast<uint8_t *>(decrypt_state));
40}38}
test/vp9_denoiser_sse2_test.cc+13−15
@@ -33,9 +33,7 @@ class VP9DenoiserTest : public ::testing::TestWithParam<BLOCK_SIZE> { · 32 unmodified lines
33 public:33 public:
34 virtual ~VP9DenoiserTest() {}34 virtual ~VP9DenoiserTest() {}
35 35
36 virtual void SetUp() {36 virtual void SetUp() { bs_ = GetParam(); }
37 bs_ = GetParam();
38 }
39 37
40 virtual void TearDown() { libvpx_test::ClearSystemState(); }38 virtual void TearDown() { libvpx_test::ClearSystemState(); }
41 39
@@ -68,19 +66,19 @@ TEST_P(VP9DenoiserTest, BitexactCheck) { · 26 unmodified lines
68 sig_block[j] = rnd.Rand8();66 sig_block[j] = rnd.Rand8();
69 // The pixels in mc_avg_block are generated by adding a random67 // The pixels in mc_avg_block are generated by adding a random
70 // number in range [-19, 19] to corresponding pixels in sig_block.68 // number in range [-19, 19] to corresponding pixels in sig_block.
71 temp = sig_block[j] + ((rnd.Rand8() % 2 == 0) ? -1 : 1) *69 temp =
72 (rnd.Rand8() % 20);70 sig_block[j] + ((rnd.Rand8() % 2 == 0) ? -1 : 1) * (rnd.Rand8() % 20);
73 // Clip.71 // Clip.
74 mc_avg_block[j] = (temp < 0) ? 0 : ((temp > 255) ? 255 : temp);72 mc_avg_block[j] = (temp < 0) ? 0 : ((temp > 255) ? 255 : temp);
75 }73 }
76 74
77 ASM_REGISTER_STATE_CHECK(vp9_denoiser_filter_c(75 ASM_REGISTER_STATE_CHECK(vp9_denoiser_filter_c(sig_block, 64, mc_avg_block,
78 sig_block, 64, mc_avg_block, 64, avg_block_c,76 64, avg_block_c, 64, 0, bs_,
79 64, 0, bs_, motion_magnitude_random));77 motion_magnitude_random));
80 78
81 ASM_REGISTER_STATE_CHECK(vp9_denoiser_filter_sse2(79 ASM_REGISTER_STATE_CHECK(vp9_denoiser_filter_sse2(
82 sig_block, 64, mc_avg_block, 64, avg_block_sse2,80 sig_block, 64, mc_avg_block, 64, avg_block_sse2, 64, 0, bs_,
83 64, 0, bs_, motion_magnitude_random));81 motion_magnitude_random));
84 82
85 // Test bitexactness.83 // Test bitexactness.
86 for (int h = 0; h < (4 << b_height_log2_lookup[bs_]); ++h) {84 for (int h = 0; h < (4 << b_height_log2_lookup[bs_]); ++h) {
@@ -92,9 +90,9 @@ TEST_P(VP9DenoiserTest, BitexactCheck) { · 5 unmodified lines
92}90}
93 91
94// Test for all block size.92// Test for all block size.
95INSTANTIATE_TEST_CASE_P(93INSTANTIATE_TEST_CASE_P(SSE2, VP9DenoiserTest,
96 SSE2, VP9DenoiserTest,94 ::testing::Values(BLOCK_8X8, BLOCK_8X16, BLOCK_16X8,
97 ::testing::Values(BLOCK_8X8, BLOCK_8X16, BLOCK_16X8, BLOCK_16X16,95 BLOCK_16X16, BLOCK_16X32, BLOCK_32X16,
98 BLOCK_16X32, BLOCK_32X16, BLOCK_32X32, BLOCK_32X64,96 BLOCK_32X32, BLOCK_32X64, BLOCK_64X32,
99 BLOCK_64X32, BLOCK_64X64));97 BLOCK_64X64));
100} // namespace98} // namespace
test/vp9_encoder_parms_get_to_decoder.cc+5−5
@@ -29,7 +29,7 @@ struct EncodePerfTestVideo { · 28 unmodified lines
29};29};
30 30
31const EncodePerfTestVideo kVP9EncodePerfTestVectors[] = {31const EncodePerfTestVideo kVP9EncodePerfTestVectors[] = {
32 {"niklas_1280_720_30.y4m", 1280, 720, 600, 10},32 { "niklas_1280_720_30.y4m", 1280, 720, 600, 10 },
33};33};
34 34
35struct EncodeParameters {35struct EncodeParameters {
@@ -45,10 +45,10 @@ struct EncodeParameters { · 9 unmodified lines
45};45};
46 46
47const EncodeParameters kVP9EncodeParameterSet[] = {47const EncodeParameters kVP9EncodeParameterSet[] = {
48 {0, 0, 0, 1, 0, VPX_CR_STUDIO_RANGE, VPX_CS_BT_601, { 0, 0 }},48 { 0, 0, 0, 1, 0, VPX_CR_STUDIO_RANGE, VPX_CS_BT_601, { 0, 0 } },
49 {0, 0, 0, 0, 0, VPX_CR_FULL_RANGE, VPX_CS_BT_709, { 0, 0 }},49 { 0, 0, 0, 0, 0, VPX_CR_FULL_RANGE, VPX_CS_BT_709, { 0, 0 } },
50 {0, 0, 1, 0, 0, VPX_CR_FULL_RANGE, VPX_CS_BT_2020, { 0, 0 }},50 { 0, 0, 1, 0, 0, VPX_CR_FULL_RANGE, VPX_CS_BT_2020, { 0, 0 } },
51 {0, 2, 0, 0, 1, VPX_CR_STUDIO_RANGE, VPX_CS_UNKNOWN, { 640, 480 }},51 { 0, 2, 0, 0, 1, VPX_CR_STUDIO_RANGE, VPX_CS_UNKNOWN, { 640, 480 } },
52 // TODO(JBB): Test profiles (requires more work).52 // TODO(JBB): Test profiles (requires more work).
53};53};
54 54
test/vp9_end_to_end_test.cc+34−47
@@ -18,21 +18,17 @@ · 17 unmodified lines
18 18
19namespace {19namespace {
20 20
21const unsigned int kWidth = 160;21const unsigned int kWidth = 160;
22const unsigned int kHeight = 90;22const unsigned int kHeight = 90;
23const unsigned int kFramerate = 50;23const unsigned int kFramerate = 50;
24const unsigned int kFrames = 10;24const unsigned int kFrames = 10;
25const int kBitrate = 500;25const int kBitrate = 500;
26// List of psnr thresholds for speed settings 0-7 and 5 encoding modes26// List of psnr thresholds for speed settings 0-7 and 5 encoding modes
27const double kPsnrThreshold[][5] = {27const double kPsnrThreshold[][5] = {
28 { 36.0, 37.0, 37.0, 37.0, 37.0 },28 { 36.0, 37.0, 37.0, 37.0, 37.0 }, { 35.0, 36.0, 36.0, 36.0, 36.0 },
29 { 35.0, 36.0, 36.0, 36.0, 36.0 },29 { 34.0, 35.0, 35.0, 35.0, 35.0 }, { 33.0, 34.0, 34.0, 34.0, 34.0 },
30 { 34.0, 35.0, 35.0, 35.0, 35.0 },30 { 32.0, 33.0, 33.0, 33.0, 33.0 }, { 31.0, 32.0, 32.0, 32.0, 32.0 },
31 { 33.0, 34.0, 34.0, 34.0, 34.0 },31 { 30.0, 31.0, 31.0, 31.0, 31.0 }, { 29.0, 30.0, 30.0, 30.0, 30.0 },
32 { 32.0, 33.0, 33.0, 33.0, 33.0 },
33 { 31.0, 32.0, 32.0, 32.0, 32.0 },
34 { 30.0, 31.0, 31.0, 31.0, 31.0 },
35 { 29.0, 30.0, 30.0, 30.0, 30.0 },
36};32};
37 33
38typedef struct {34typedef struct {
@@ -44,31 +40,30 @@ typedef struct { · 5 unmodified lines
44} TestVideoParam;40} TestVideoParam;
45 41
46const TestVideoParam kTestVectors[] = {42const TestVideoParam kTestVectors[] = {
47 {"park_joy_90p_8_420.y4m", 8, VPX_IMG_FMT_I420, VPX_BITS_8, 0},43 { "park_joy_90p_8_420.y4m", 8, VPX_IMG_FMT_I420, VPX_BITS_8, 0 },
48 {"park_joy_90p_8_422.y4m", 8, VPX_IMG_FMT_I422, VPX_BITS_8, 1},44 { "park_joy_90p_8_422.y4m", 8, VPX_IMG_FMT_I422, VPX_BITS_8, 1 },
49 {"park_joy_90p_8_444.y4m", 8, VPX_IMG_FMT_I444, VPX_BITS_8, 1},45 { "park_joy_90p_8_444.y4m", 8, VPX_IMG_FMT_I444, VPX_BITS_8, 1 },
50 {"park_joy_90p_8_440.yuv", 8, VPX_IMG_FMT_I440, VPX_BITS_8, 1},46 { "park_joy_90p_8_440.yuv", 8, VPX_IMG_FMT_I440, VPX_BITS_8, 1 },
51#if CONFIG_VP9_HIGHBITDEPTH47#if CONFIG_VP9_HIGHBITDEPTH
52 {"park_joy_90p_10_420.y4m", 10, VPX_IMG_FMT_I42016, VPX_BITS_10, 2},48 { "park_joy_90p_10_420.y4m", 10, VPX_IMG_FMT_I42016, VPX_BITS_10, 2 },
53 {"park_joy_90p_10_422.y4m", 10, VPX_IMG_FMT_I42216, VPX_BITS_10, 3},49 { "park_joy_90p_10_422.y4m", 10, VPX_IMG_FMT_I42216, VPX_BITS_10, 3 },
54 {"park_joy_90p_10_444.y4m", 10, VPX_IMG_FMT_I44416, VPX_BITS_10, 3},50 { "park_joy_90p_10_444.y4m", 10, VPX_IMG_FMT_I44416, VPX_BITS_10, 3 },
55 {"park_joy_90p_10_440.yuv", 10, VPX_IMG_FMT_I44016, VPX_BITS_10, 3},51 { "park_joy_90p_10_440.yuv", 10, VPX_IMG_FMT_I44016, VPX_BITS_10, 3 },
56 {"park_joy_90p_12_420.y4m", 12, VPX_IMG_FMT_I42016, VPX_BITS_12, 2},52 { "park_joy_90p_12_420.y4m", 12, VPX_IMG_FMT_I42016, VPX_BITS_12, 2 },
57 {"park_joy_90p_12_422.y4m", 12, VPX_IMG_FMT_I42216, VPX_BITS_12, 3},53 { "park_joy_90p_12_422.y4m", 12, VPX_IMG_FMT_I42216, VPX_BITS_12, 3 },
58 {"park_joy_90p_12_444.y4m", 12, VPX_IMG_FMT_I44416, VPX_BITS_12, 3},54 { "park_joy_90p_12_444.y4m", 12, VPX_IMG_FMT_I44416, VPX_BITS_12, 3 },
59 {"park_joy_90p_12_440.yuv", 12, VPX_IMG_FMT_I44016, VPX_BITS_12, 3},55 { "park_joy_90p_12_440.yuv", 12, VPX_IMG_FMT_I44016, VPX_BITS_12, 3 },
60#endif // CONFIG_VP9_HIGHBITDEPTH56#endif // CONFIG_VP9_HIGHBITDEPTH
61};57};
62 58
63// Encoding modes tested59// Encoding modes tested
64const libvpx_test::TestMode kEncodingModeVectors[] = {60const libvpx_test::TestMode kEncodingModeVectors[] = {
65 ::libvpx_test::kTwoPassGood,61 ::libvpx_test::kTwoPassGood, ::libvpx_test::kOnePassGood,
66 ::libvpx_test::kOnePassGood,
67 ::libvpx_test::kRealTime,62 ::libvpx_test::kRealTime,
68};63};
69 64
70// Speed settings tested65// Speed settings tested
71const int kCpuUsedVectors[] = {1, 2, 3, 5, 6};66const int kCpuUsedVectors[] = { 1, 2, 3, 5, 6 };
72 67
73int is_extension_y4m(const char *filename) {68int is_extension_y4m(const char *filename) {
74 const char *dot = strrchr(filename, '.');69 const char *dot = strrchr(filename, '.');
@@ -80,17 +75,13 @@ int is_extension_y4m(const char *filename) { · 5 unmodified lines
80 75
81class EndToEndTestLarge76class EndToEndTestLarge
82 : public ::libvpx_test::EncoderTest,77 : public ::libvpx_test::EncoderTest,
83 public ::libvpx_test::CodecTestWith3Params<libvpx_test::TestMode, \78 public ::libvpx_test::CodecTestWith3Params<libvpx_test::TestMode,
84 TestVideoParam, int> {79 TestVideoParam, int> {
85 protected:80 protected:
86 EndToEndTestLarge()81 EndToEndTestLarge()
87 : EncoderTest(GET_PARAM(0)),82 : EncoderTest(GET_PARAM(0)), test_video_param_(GET_PARAM(2)),
88 test_video_param_(GET_PARAM(2)),83 cpu_used_(GET_PARAM(3)), psnr_(0.0), nframes_(0),
89 cpu_used_(GET_PARAM(3)),84 encoding_mode_(GET_PARAM(1)) {}
90 psnr_(0.0),
91 nframes_(0),
92 encoding_mode_(GET_PARAM(1)) {
93 }
94 85
95 virtual ~EndToEndTestLarge() {}86 virtual ~EndToEndTestLarge() {}
96 87
@@ -136,8 +127,7 @@ class EndToEndTestLarge · 39 unmodified lines
136 }127 }
137 128
138 double GetAveragePsnr() const {129 double GetAveragePsnr() const {
139 if (nframes_)130 if (nframes_) return psnr_ / nframes_;
140 return psnr_ / nframes_;
141 return 0.0;131 return 0.0;
142 }132 }
143 133
@@ -161,29 +151,26 @@ TEST_P(EndToEndTestLarge, EndtoEndPSNRTest) { · 17 unmodified lines
161 cfg_.g_input_bit_depth = test_video_param_.input_bit_depth;151 cfg_.g_input_bit_depth = test_video_param_.input_bit_depth;
162 cfg_.g_bit_depth = test_video_param_.bit_depth;152 cfg_.g_bit_depth = test_video_param_.bit_depth;
163 init_flags_ = VPX_CODEC_USE_PSNR;153 init_flags_ = VPX_CODEC_USE_PSNR;
164 if (cfg_.g_bit_depth > 8)154 if (cfg_.g_bit_depth > 8) init_flags_ |= VPX_CODEC_USE_HIGHBITDEPTH;
165 init_flags_ |= VPX_CODEC_USE_HIGHBITDEPTH;
166 155
167 libvpx_test::VideoSource *video;156 libvpx_test::VideoSource *video;
168 if (is_extension_y4m(test_video_param_.filename)) {157 if (is_extension_y4m(test_video_param_.filename)) {
169 video = new libvpx_test::Y4mVideoSource(test_video_param_.filename,158 video =
170 0, kFrames);159 new libvpx_test::Y4mVideoSource(test_video_param_.filename, 0, kFrames);
171 } else {160 } else {
172 video = new libvpx_test::YUVVideoSource(test_video_param_.filename,161 video = new libvpx_test::YUVVideoSource(test_video_param_.filename,
173 test_video_param_.fmt,162 test_video_param_.fmt, kWidth,
174 kWidth, kHeight,163 kHeight, kFramerate, 1, 0, kFrames);
175 kFramerate, 1, 0, kFrames);
176 }164 }
177 165
178 ASSERT_NO_FATAL_FAILURE(RunLoop(video));166 ASSERT_NO_FATAL_FAILURE(RunLoop(video));
179 const double psnr = GetAveragePsnr();167 const double psnr = GetAveragePsnr();
180 EXPECT_GT(psnr, GetPsnrThreshold());168 EXPECT_GT(psnr, GetPsnrThreshold());
181 delete(video);169 delete (video);
182}170}
183 171
184VP9_INSTANTIATE_TEST_CASE(172VP9_INSTANTIATE_TEST_CASE(EndToEndTestLarge,
185 EndToEndTestLarge,173 ::testing::ValuesIn(kEncodingModeVectors),
186 ::testing::ValuesIn(kEncodingModeVectors),174 ::testing::ValuesIn(kTestVectors),
187 ::testing::ValuesIn(kTestVectors),175 ::testing::ValuesIn(kCpuUsedVectors));
188 ::testing::ValuesIn(kCpuUsedVectors));
189} // namespace176} // namespace
test/vp9_error_block_test.cc+26−28
@@ -32,11 +32,10 @@ const int kNumIterations = 1000; · 31 unmodified lines
32 32
33typedef int64_t (*ErrorBlockFunc)(const tran_low_t *coeff,33typedef int64_t (*ErrorBlockFunc)(const tran_low_t *coeff,
34 const tran_low_t *dqcoeff,34 const tran_low_t *dqcoeff,
35 intptr_t block_size,35 intptr_t block_size, int64_t *ssz, int bps);
36 int64_t *ssz, int bps);
37 36
38typedef std::tr1::tuple<ErrorBlockFunc, ErrorBlockFunc, vpx_bit_depth_t>37typedef std::tr1::tuple<ErrorBlockFunc, ErrorBlockFunc, vpx_bit_depth_t>
39 ErrorBlockParam;38 ErrorBlockParam;
40 39
41// wrapper for 8-bit block error functions without a 'bps' param.40// wrapper for 8-bit block error functions without a 'bps' param.
42typedef int64_t (*HighBdBlockError8bit)(const tran_low_t *coeff,41typedef int64_t (*HighBdBlockError8bit)(const tran_low_t *coeff,
@@ -51,14 +50,13 @@ int64_t HighBdBlockError8bitWrapper(const tran_low_t *coeff, · 8 unmodified lines
51 return fn(coeff, dqcoeff, block_size, ssz);50 return fn(coeff, dqcoeff, block_size, ssz);
52}51}
53 52
54class ErrorBlockTest53class ErrorBlockTest : public ::testing::TestWithParam<ErrorBlockParam> {
55 : public ::testing::TestWithParam<ErrorBlockParam> {
56 public:54 public:
57 virtual ~ErrorBlockTest() {}55 virtual ~ErrorBlockTest() {}
58 virtual void SetUp() {56 virtual void SetUp() {
59 error_block_op_ = GET_PARAM(0);57 error_block_op_ = GET_PARAM(0);
60 ref_error_block_op_ = GET_PARAM(1);58 ref_error_block_op_ = GET_PARAM(1);
61 bit_depth_ = GET_PARAM(2);59 bit_depth_ = GET_PARAM(2);
62 }60 }
63 61
64 virtual void TearDown() { libvpx_test::ClearSystemState(); }62 virtual void TearDown() { libvpx_test::ClearSystemState(); }
@@ -89,18 +87,18 @@ TEST_P(ErrorBlockTest, OperationCheck) { · 24 unmodified lines
89 // can be used for optimization, so generate test input precisely.87 // can be used for optimization, so generate test input precisely.
90 if (rnd(2)) {88 if (rnd(2)) {
91 // Positive number89 // Positive number
92 coeff[j] = rnd(1 << msb);90 coeff[j] = rnd(1 << msb);
93 dqcoeff[j] = rnd(1 << msb);91 dqcoeff[j] = rnd(1 << msb);
94 } else {92 } else {
95 // Negative number93 // Negative number
96 coeff[j] = -rnd(1 << msb);94 coeff[j] = -rnd(1 << msb);
97 dqcoeff[j] = -rnd(1 << msb);95 dqcoeff[j] = -rnd(1 << msb);
98 }96 }
99 }97 }
100 ref_ret = ref_error_block_op_(coeff, dqcoeff, block_size, &ref_ssz,98 ref_ret =
101 bit_depth_);99 ref_error_block_op_(coeff, dqcoeff, block_size, &ref_ssz, bit_depth_);
102 ASM_REGISTER_STATE_CHECK(ret = error_block_op_(coeff, dqcoeff, block_size,100 ASM_REGISTER_STATE_CHECK(
103 &ssz, bit_depth_));101 ret = error_block_op_(coeff, dqcoeff, block_size, &ssz, bit_depth_));
104 err_count += (ref_ret != ret) | (ref_ssz != ssz);102 err_count += (ref_ret != ret) | (ref_ssz != ssz);
105 if (err_count && !err_count_total) {103 if (err_count && !err_count_total) {
106 first_failure = i;104 first_failure = i;
@@ -130,35 +128,35 @@ TEST_P(ErrorBlockTest, ExtremeValues) { · 23 unmodified lines
130 int k = (i / 9) % 9;128 int k = (i / 9) % 9;
131 129
132 // Change the maximum coeff value, to test different bit boundaries130 // Change the maximum coeff value, to test different bit boundaries
133 if ( k == 8 && (i % 9) == 0 ) {131 if (k == 8 && (i % 9) == 0) {
134 max_val >>= 1;132 max_val >>= 1;
135 }133 }
136 block_size = 16 << (i % 9); // All block sizes from 4x4, 8x4 ..64x64134 block_size = 16 << (i % 9); // All block sizes from 4x4, 8x4 ..64x64
137 for (int j = 0; j < block_size; j++) {135 for (int j = 0; j < block_size; j++) {
138 if (k < 4) {136 if (k < 4) {
139 // Test at positive maximum values137 // Test at positive maximum values
140 coeff[j] = k % 2 ? max_val : 0;138 coeff[j] = k % 2 ? max_val : 0;
141 dqcoeff[j] = (k >> 1) % 2 ? max_val : 0;139 dqcoeff[j] = (k >> 1) % 2 ? max_val : 0;
142 } else if (k < 8) {140 } else if (k < 8) {
143 // Test at negative maximum values141 // Test at negative maximum values
144 coeff[j] = k % 2 ? -max_val : 0;142 coeff[j] = k % 2 ? -max_val : 0;
145 dqcoeff[j] = (k >> 1) % 2 ? -max_val : 0;143 dqcoeff[j] = (k >> 1) % 2 ? -max_val : 0;
146 } else {144 } else {
147 if (rnd(2)) {145 if (rnd(2)) {
148 // Positive number146 // Positive number
149 coeff[j] = rnd(1 << 14);147 coeff[j] = rnd(1 << 14);
150 dqcoeff[j] = rnd(1 << 14);148 dqcoeff[j] = rnd(1 << 14);
151 } else {149 } else {
152 // Negative number150 // Negative number
153 coeff[j] = -rnd(1 << 14);151 coeff[j] = -rnd(1 << 14);
154 dqcoeff[j] = -rnd(1 << 14);152 dqcoeff[j] = -rnd(1 << 14);
155 }153 }
156 }154 }
157 }155 }
158 ref_ret = ref_error_block_op_(coeff, dqcoeff, block_size, &ref_ssz,156 ref_ret =
159 bit_depth_);157 ref_error_block_op_(coeff, dqcoeff, block_size, &ref_ssz, bit_depth_);
160 ASM_REGISTER_STATE_CHECK(ret = error_block_op_(coeff, dqcoeff, block_size,158 ASM_REGISTER_STATE_CHECK(
161 &ssz, bit_depth_));159 ret = error_block_op_(coeff, dqcoeff, block_size, &ssz, bit_depth_));
162 err_count += (ref_ret != ret) | (ref_ssz != ssz);160 err_count += (ref_ret != ret) | (ref_ssz != ssz);
163 if (err_count && !err_count_total) {161 if (err_count && !err_count_total) {
164 first_failure = i;162 first_failure = i;
@@ -176,12 +174,12 @@ using std::tr1::make_tuple; · 11 unmodified lines
176INSTANTIATE_TEST_CASE_P(174INSTANTIATE_TEST_CASE_P(
177 SSE2, ErrorBlockTest,175 SSE2, ErrorBlockTest,
178 ::testing::Values(176 ::testing::Values(
179 make_tuple(&vp9_highbd_block_error_sse2,177 make_tuple(&vp9_highbd_block_error_sse2, &vp9_highbd_block_error_c,
180 &vp9_highbd_block_error_c, VPX_BITS_10),178 VPX_BITS_10),
181 make_tuple(&vp9_highbd_block_error_sse2,179 make_tuple(&vp9_highbd_block_error_sse2, &vp9_highbd_block_error_c,
182 &vp9_highbd_block_error_c, VPX_BITS_12),180 VPX_BITS_12),
183 make_tuple(&vp9_highbd_block_error_sse2,181 make_tuple(&vp9_highbd_block_error_sse2, &vp9_highbd_block_error_c,
184 &vp9_highbd_block_error_c, VPX_BITS_8),182 VPX_BITS_8),
185 make_tuple(183 make_tuple(
186 &HighBdBlockError8bitWrapper<vp9_highbd_block_error_8bit_sse2>,184 &HighBdBlockError8bitWrapper<vp9_highbd_block_error_8bit_sse2>,
187 &HighBdBlockError8bitWrapper<vp9_highbd_block_error_8bit_c>,185 &HighBdBlockError8bitWrapper<vp9_highbd_block_error_8bit_c>,
test/vp9_ethread_test.cc+8−11
@@ -23,11 +23,8 @@ class VPxEncoderThreadTest · 22 unmodified lines
23 public ::libvpx_test::CodecTestWith2Params<libvpx_test::TestMode, int> {23 public ::libvpx_test::CodecTestWith2Params<libvpx_test::TestMode, int> {
24 protected:24 protected:
25 VPxEncoderThreadTest()25 VPxEncoderThreadTest()
26 : EncoderTest(GET_PARAM(0)),26 : EncoderTest(GET_PARAM(0)), encoder_initialized_(false), tiles_(2),
27 encoder_initialized_(false),27 encoding_mode_(GET_PARAM(1)), set_cpu_used_(GET_PARAM(2)) {
28 tiles_(2),
29 encoding_mode_(GET_PARAM(1)),
30 set_cpu_used_(GET_PARAM(2)) {
31 init_flags_ = VPX_CODEC_USE_PSNR;28 init_flags_ = VPX_CODEC_USE_PSNR;
32 md5_.clear();29 md5_.clear();
33 }30 }
@@ -82,7 +79,7 @@ class VPxEncoderThreadTest · 48 unmodified lines
82 }79 }
83 80
84 virtual bool HandleDecodeResult(const vpx_codec_err_t res,81 virtual bool HandleDecodeResult(const vpx_codec_err_t res,
85 const libvpx_test::VideoSource& /*video*/,82 const libvpx_test::VideoSource & /*video*/,
86 libvpx_test::Decoder * /*decoder*/) {83 libvpx_test::Decoder * /*decoder*/) {
87 if (res != VPX_CODEC_OK) {84 if (res != VPX_CODEC_OK) {
88 EXPECT_EQ(VPX_CODEC_OK, res);85 EXPECT_EQ(VPX_CODEC_OK, res);
@@ -123,9 +120,9 @@ TEST_P(VPxEncoderThreadTest, EncoderResultTest) { · 34 unmodified lines
123 ASSERT_EQ(single_thr_md5, multi_thr_md5);120 ASSERT_EQ(single_thr_md5, multi_thr_md5);
124}121}
125 122
126VP9_INSTANTIATE_TEST_CASE(123VP9_INSTANTIATE_TEST_CASE(VPxEncoderThreadTest,
127 VPxEncoderThreadTest,124 ::testing::Values(::libvpx_test::kTwoPassGood,
128 ::testing::Values(::libvpx_test::kTwoPassGood, ::libvpx_test::kOnePassGood,125 ::libvpx_test::kOnePassGood,
129 ::libvpx_test::kRealTime),126 ::libvpx_test::kRealTime),
130 ::testing::Range(1, 9));127 ::testing::Range(1, 9));
131} // namespace128} // namespace
test/vp9_frame_parallel_test.cc+14−17
@@ -46,7 +46,7 @@ string DecodeFileWithPause(const string &filename, int num_threads, · 45 unmodified lines
46 int in_frames = 0;46 int in_frames = 0;
47 int out_frames = 0;47 int out_frames = 0;
48 48
49 vpx_codec_dec_cfg_t cfg = {0};49 vpx_codec_dec_cfg_t cfg = { 0 };
50 cfg.threads = num_threads;50 cfg.threads = num_threads;
51 vpx_codec_flags_t flags = 0;51 vpx_codec_flags_t flags = 0;
52 flags |= VPX_CODEC_USE_FRAME_THREADING;52 flags |= VPX_CODEC_USE_FRAME_THREADING;
@@ -74,8 +74,7 @@ string DecodeFileWithPause(const string &filename, int num_threads, · 21 unmodified lines
74 }74 }
75 75
76 // Flush the decoder at the end of the video.76 // Flush the decoder at the end of the video.
77 if (!video.cxdata())77 if (!video.cxdata()) decoder.DecodeFrame(NULL, 0);
78 decoder.DecodeFrame(NULL, 0);
79 78
80 libvpx_test::DxDataIterator dec_iter = decoder.GetDxData();79 libvpx_test::DxDataIterator dec_iter = decoder.GetDxData();
81 const vpx_image_t *img;80 const vpx_image_t *img;
@@ -87,8 +86,8 @@ string DecodeFileWithPause(const string &filename, int num_threads, · 5 unmodified lines
87 }86 }
88 } while (video.cxdata() != NULL);87 } while (video.cxdata() != NULL);
89 88
90 EXPECT_EQ(in_frames, out_frames) <<89 EXPECT_EQ(in_frames, out_frames)
91 "Input frame count does not match output frame count";90 << "Input frame count does not match output frame count";
92 91
93 return string(md5.Get());92 return string(md5.Get());
94}93}
@@ -108,12 +107,12 @@ TEST(VP9MultiThreadedFrameParallel, PauseSeekResume) { · 13 unmodified lines
108 // vp90-2-07-frame_parallel-1.webm is a 40 frame video file with107 // vp90-2-07-frame_parallel-1.webm is a 40 frame video file with
109 // one key frame for every ten frames.108 // one key frame for every ten frames.
110 static const PauseFileList files[] = {109 static const PauseFileList files[] = {
111 { "vp90-2-07-frame_parallel-1.webm",110 { "vp90-2-07-frame_parallel-1.webm", "6ea7c3875d67252e7caf2bc6e75b36b1",
112 "6ea7c3875d67252e7caf2bc6e75b36b1", 6 },111 6 },
113 { "vp90-2-07-frame_parallel-1.webm",112 { "vp90-2-07-frame_parallel-1.webm", "4bb634160c7356a8d7d4299b6dc83a45",
114 "4bb634160c7356a8d7d4299b6dc83a45", 12 },113 12 },
115 { "vp90-2-07-frame_parallel-1.webm",114 { "vp90-2-07-frame_parallel-1.webm", "89772591e6ef461f9fa754f916c78ed8",
116 "89772591e6ef461f9fa754f916c78ed8", 26 },115 26 },
117 { NULL, NULL, 0 },116 { NULL, NULL, 0 },
118 };117 };
119 DecodeFilesWithPause(files);118 DecodeFilesWithPause(files);
@@ -155,8 +154,7 @@ string DecodeFile(const string &filename, int num_threads, · 35 unmodified lines
155 video.Next();154 video.Next();
156 155
157 // Flush the decoder at the end of the video.156 // Flush the decoder at the end of the video.
158 if (!video.cxdata())157 if (!video.cxdata()) decoder.DecodeFrame(NULL, 0);
159 decoder.DecodeFrame(NULL, 0);
160 158
161 libvpx_test::DxDataIterator dec_iter = decoder.GetDxData();159 libvpx_test::DxDataIterator dec_iter = decoder.GetDxData();
162 const vpx_image_t *img;160 const vpx_image_t *img;
@@ -168,8 +166,8 @@ string DecodeFile(const string &filename, int num_threads, · 5 unmodified lines
168 }166 }
169 } while (video.cxdata() != NULL);167 } while (video.cxdata() != NULL);
170 168
171 EXPECT_EQ(expected_frame_count, out_frames) <<169 EXPECT_EQ(expected_frame_count, out_frames)
172 "Input frame count does not match expected output frame count";170 << "Input frame count does not match expected output frame count";
173 171
174 return string(md5.Get());172 return string(md5.Get());
175}173}
@@ -209,8 +207,7 @@ TEST(VP9MultiThreadedFrameParallel, InvalidFileTest) { · 33 unmodified lines
209TEST(VP9MultiThreadedFrameParallel, ValidFileTest) {207TEST(VP9MultiThreadedFrameParallel, ValidFileTest) {
210 static const FileList files[] = {208 static const FileList files[] = {
211#if CONFIG_VP9_HIGHBITDEPTH209#if CONFIG_VP9_HIGHBITDEPTH
212 { "vp92-2-20-10bit-yuv420.webm",210 { "vp92-2-20-10bit-yuv420.webm", "a16b99df180c584e8db2ffeda987d293", 10 },
213 "a16b99df180c584e8db2ffeda987d293", 10 },
214#endif211#endif
215 { NULL, NULL, 0 },212 { NULL, NULL, 0 },
216 };213 };
test/vp9_intrapred_test.cc+92−93
@@ -28,15 +28,14 @@ using libvpx_test::ACMRandom; · 27 unmodified lines
28 28
29const int count_test_block = 100000;29const int count_test_block = 100000;
30 30
31typedef void (*IntraPred)(uint16_t* dst, ptrdiff_t stride,31typedef void (*IntraPred)(uint16_t *dst, ptrdiff_t stride,
32 const uint16_t* above, const uint16_t* left,32 const uint16_t *above, const uint16_t *left, int bps);
33 int bps);
34 33
35struct IntraPredFunc {34struct IntraPredFunc {
36 IntraPredFunc(IntraPred pred = NULL, IntraPred ref = NULL,35 IntraPredFunc(IntraPred pred = NULL, IntraPred ref = NULL,
37 int block_size_value = 0, int bit_depth_value = 0)36 int block_size_value = 0, int bit_depth_value = 0)
38 : pred_fn(pred), ref_fn(ref),37 : pred_fn(pred), ref_fn(ref), block_size(block_size_value),
39 block_size(block_size_value), bit_depth(bit_depth_value) {}38 bit_depth(bit_depth_value) {}
40 39
41 IntraPred pred_fn;40 IntraPred pred_fn;
42 IntraPred ref_fn;41 IntraPred ref_fn;
@@ -46,8 +45,8 @@ struct IntraPredFunc { · 3 unmodified lines
46 45
47class VP9IntraPredTest : public ::testing::TestWithParam<IntraPredFunc> {46class VP9IntraPredTest : public ::testing::TestWithParam<IntraPredFunc> {
48 public:47 public:
49 void RunTest(uint16_t* left_col, uint16_t* above_data,48 void RunTest(uint16_t *left_col, uint16_t *above_data, uint16_t *dst,
50 uint16_t* dst, uint16_t* ref_dst) {49 uint16_t *ref_dst) {
51 ACMRandom rnd(ACMRandom::DeterministicSeed());50 ACMRandom rnd(ACMRandom::DeterministicSeed());
52 const int block_size = params_.block_size;51 const int block_size = params_.block_size;
53 above_row_ = above_data + 16;52 above_row_ = above_data + 16;
@@ -81,14 +80,14 @@ class VP9IntraPredTest : public ::testing::TestWithParam<IntraPredFunc> { · 27 unmodified lines
81 virtual void SetUp() {80 virtual void SetUp() {
82 params_ = GetParam();81 params_ = GetParam();
83 stride_ = params_.block_size * 3;82 stride_ = params_.block_size * 3;
84 mask_ = (1 << params_.bit_depth) - 1;83 mask_ = (1 << params_.bit_depth) - 1;
85 }84 }
86 85
87 void Predict() {86 void Predict() {
88 const int bit_depth = params_.bit_depth;87 const int bit_depth = params_.bit_depth;
89 params_.ref_fn(ref_dst_, stride_, above_row_, left_col_, bit_depth);88 params_.ref_fn(ref_dst_, stride_, above_row_, left_col_, bit_depth);
90 ASM_REGISTER_STATE_CHECK(params_.pred_fn(dst_, stride_,89 ASM_REGISTER_STATE_CHECK(
91 above_row_, left_col_, bit_depth));90 params_.pred_fn(dst_, stride_, above_row_, left_col_, bit_depth));
92 }91 }
93 92
94 void CheckPrediction(int test_case_number, int *error_count) const {93 void CheckPrediction(int test_case_number, int *error_count) const {
@@ -99,7 +98,7 @@ class VP9IntraPredTest : public ::testing::TestWithParam<IntraPredFunc> { · 4 unmodified lines
99 *error_count += ref_dst_[x + y * stride_] != dst_[x + y * stride_];98 *error_count += ref_dst_[x + y * stride_] != dst_[x + y * stride_];
100 if (*error_count == 1) {99 if (*error_count == 1) {
101 ASSERT_EQ(ref_dst_[x + y * stride_], dst_[x + y * stride_])100 ASSERT_EQ(ref_dst_[x + y * stride_], dst_[x + y * stride_])
102 << " Failed on Test Case Number "<< test_case_number;101 << " Failed on Test Case Number " << test_case_number;
103 }102 }
104 }103 }
105 }104 }
@@ -117,8 +116,8 @@ class VP9IntraPredTest : public ::testing::TestWithParam<IntraPredFunc> { · 11 unmodified lines
117 116
118TEST_P(VP9IntraPredTest, IntraPredTests) {117TEST_P(VP9IntraPredTest, IntraPredTests) {
119 // max block size is 32118 // max block size is 32
120 DECLARE_ALIGNED(16, uint16_t, left_col[2*32]);119 DECLARE_ALIGNED(16, uint16_t, left_col[2 * 32]);
121 DECLARE_ALIGNED(16, uint16_t, above_data[2*32+32]);120 DECLARE_ALIGNED(16, uint16_t, above_data[2 * 32 + 32]);
122 DECLARE_ALIGNED(16, uint16_t, dst[3 * 32 * 32]);121 DECLARE_ALIGNED(16, uint16_t, dst[3 * 32 * 32]);
123 DECLARE_ALIGNED(16, uint16_t, ref_dst[3 * 32 * 32]);122 DECLARE_ALIGNED(16, uint16_t, ref_dst[3 * 32 * 32]);
124 RunTest(left_col, above_data, dst, ref_dst);123 RunTest(left_col, above_data, dst, ref_dst);
@@ -126,86 +125,86 @@ TEST_P(VP9IntraPredTest, IntraPredTests) { · 1 unmodified line
126 125
127#if HAVE_SSE2126#if HAVE_SSE2
128#if CONFIG_VP9_HIGHBITDEPTH127#if CONFIG_VP9_HIGHBITDEPTH
129INSTANTIATE_TEST_CASE_P(SSE2_TO_C_8, VP9IntraPredTest,128INSTANTIATE_TEST_CASE_P(
130 ::testing::Values(129 SSE2_TO_C_8, VP9IntraPredTest,
131 IntraPredFunc(&vpx_highbd_dc_predictor_32x32_sse2,130 ::testing::Values(IntraPredFunc(&vpx_highbd_dc_predictor_32x32_sse2,
132 &vpx_highbd_dc_predictor_32x32_c, 32, 8),131 &vpx_highbd_dc_predictor_32x32_c, 32, 8),
133 IntraPredFunc(&vpx_highbd_tm_predictor_16x16_sse2,132 IntraPredFunc(&vpx_highbd_tm_predictor_16x16_sse2,
134 &vpx_highbd_tm_predictor_16x16_c, 16, 8),133 &vpx_highbd_tm_predictor_16x16_c, 16, 8),
135 IntraPredFunc(&vpx_highbd_tm_predictor_32x32_sse2,134 IntraPredFunc(&vpx_highbd_tm_predictor_32x32_sse2,
136 &vpx_highbd_tm_predictor_32x32_c, 32, 8),135 &vpx_highbd_tm_predictor_32x32_c, 32, 8),
137 IntraPredFunc(&vpx_highbd_dc_predictor_4x4_sse2,136 IntraPredFunc(&vpx_highbd_dc_predictor_4x4_sse2,
138 &vpx_highbd_dc_predictor_4x4_c, 4, 8),137 &vpx_highbd_dc_predictor_4x4_c, 4, 8),
139 IntraPredFunc(&vpx_highbd_dc_predictor_8x8_sse2,138 IntraPredFunc(&vpx_highbd_dc_predictor_8x8_sse2,
140 &vpx_highbd_dc_predictor_8x8_c, 8, 8),139 &vpx_highbd_dc_predictor_8x8_c, 8, 8),
141 IntraPredFunc(&vpx_highbd_dc_predictor_16x16_sse2,140 IntraPredFunc(&vpx_highbd_dc_predictor_16x16_sse2,
142 &vpx_highbd_dc_predictor_16x16_c, 16, 8),141 &vpx_highbd_dc_predictor_16x16_c, 16, 8),
143 IntraPredFunc(&vpx_highbd_v_predictor_4x4_sse2,142 IntraPredFunc(&vpx_highbd_v_predictor_4x4_sse2,
144 &vpx_highbd_v_predictor_4x4_c, 4, 8),143 &vpx_highbd_v_predictor_4x4_c, 4, 8),
145 IntraPredFunc(&vpx_highbd_v_predictor_8x8_sse2,144 IntraPredFunc(&vpx_highbd_v_predictor_8x8_sse2,
146 &vpx_highbd_v_predictor_8x8_c, 8, 8),145 &vpx_highbd_v_predictor_8x8_c, 8, 8),
147 IntraPredFunc(&vpx_highbd_v_predictor_16x16_sse2,146 IntraPredFunc(&vpx_highbd_v_predictor_16x16_sse2,
148 &vpx_highbd_v_predictor_16x16_c, 16, 8),147 &vpx_highbd_v_predictor_16x16_c, 16, 8),
149 IntraPredFunc(&vpx_highbd_v_predictor_32x32_sse2,148 IntraPredFunc(&vpx_highbd_v_predictor_32x32_sse2,
150 &vpx_highbd_v_predictor_32x32_c, 32, 8),149 &vpx_highbd_v_predictor_32x32_c, 32, 8),
151 IntraPredFunc(&vpx_highbd_tm_predictor_4x4_sse2,150 IntraPredFunc(&vpx_highbd_tm_predictor_4x4_sse2,
152 &vpx_highbd_tm_predictor_4x4_c, 4, 8),151 &vpx_highbd_tm_predictor_4x4_c, 4, 8),
153 IntraPredFunc(&vpx_highbd_tm_predictor_8x8_sse2,152 IntraPredFunc(&vpx_highbd_tm_predictor_8x8_sse2,
154 &vpx_highbd_tm_predictor_8x8_c, 8, 8)));153 &vpx_highbd_tm_predictor_8x8_c, 8, 8)));
155 154
156INSTANTIATE_TEST_CASE_P(SSE2_TO_C_10, VP9IntraPredTest,155INSTANTIATE_TEST_CASE_P(
157 ::testing::Values(156 SSE2_TO_C_10, VP9IntraPredTest,
158 IntraPredFunc(&vpx_highbd_dc_predictor_32x32_sse2,157 ::testing::Values(IntraPredFunc(&vpx_highbd_dc_predictor_32x32_sse2,
159 &vpx_highbd_dc_predictor_32x32_c, 32, 10),158 &vpx_highbd_dc_predictor_32x32_c, 32, 10),
160 IntraPredFunc(&vpx_highbd_tm_predictor_16x16_sse2,159 IntraPredFunc(&vpx_highbd_tm_predictor_16x16_sse2,
161 &vpx_highbd_tm_predictor_16x16_c, 16, 10),160 &vpx_highbd_tm_predictor_16x16_c, 16, 10),
162 IntraPredFunc(&vpx_highbd_tm_predictor_32x32_sse2,161 IntraPredFunc(&vpx_highbd_tm_predictor_32x32_sse2,
163 &vpx_highbd_tm_predictor_32x32_c, 32, 10),162 &vpx_highbd_tm_predictor_32x32_c, 32, 10),
164 IntraPredFunc(&vpx_highbd_dc_predictor_4x4_sse2,163 IntraPredFunc(&vpx_highbd_dc_predictor_4x4_sse2,
165 &vpx_highbd_dc_predictor_4x4_c, 4, 10),164 &vpx_highbd_dc_predictor_4x4_c, 4, 10),
166 IntraPredFunc(&vpx_highbd_dc_predictor_8x8_sse2,165 IntraPredFunc(&vpx_highbd_dc_predictor_8x8_sse2,
167 &vpx_highbd_dc_predictor_8x8_c, 8, 10),166 &vpx_highbd_dc_predictor_8x8_c, 8, 10),
168 IntraPredFunc(&vpx_highbd_dc_predictor_16x16_sse2,167 IntraPredFunc(&vpx_highbd_dc_predictor_16x16_sse2,
169 &vpx_highbd_dc_predictor_16x16_c, 16, 10),168 &vpx_highbd_dc_predictor_16x16_c, 16, 10),
170 IntraPredFunc(&vpx_highbd_v_predictor_4x4_sse2,169 IntraPredFunc(&vpx_highbd_v_predictor_4x4_sse2,
171 &vpx_highbd_v_predictor_4x4_c, 4, 10),170 &vpx_highbd_v_predictor_4x4_c, 4, 10),
172 IntraPredFunc(&vpx_highbd_v_predictor_8x8_sse2,171 IntraPredFunc(&vpx_highbd_v_predictor_8x8_sse2,
173 &vpx_highbd_v_predictor_8x8_c, 8, 10),172 &vpx_highbd_v_predictor_8x8_c, 8, 10),
174 IntraPredFunc(&vpx_highbd_v_predictor_16x16_sse2,173 IntraPredFunc(&vpx_highbd_v_predictor_16x16_sse2,
175 &vpx_highbd_v_predictor_16x16_c, 16, 10),174 &vpx_highbd_v_predictor_16x16_c, 16, 10),
176 IntraPredFunc(&vpx_highbd_v_predictor_32x32_sse2,175 IntraPredFunc(&vpx_highbd_v_predictor_32x32_sse2,
177 &vpx_highbd_v_predictor_32x32_c, 32, 10),176 &vpx_highbd_v_predictor_32x32_c, 32, 10),
178 IntraPredFunc(&vpx_highbd_tm_predictor_4x4_sse2,177 IntraPredFunc(&vpx_highbd_tm_predictor_4x4_sse2,
179 &vpx_highbd_tm_predictor_4x4_c, 4, 10),178 &vpx_highbd_tm_predictor_4x4_c, 4, 10),
180 IntraPredFunc(&vpx_highbd_tm_predictor_8x8_sse2,179 IntraPredFunc(&vpx_highbd_tm_predictor_8x8_sse2,
181 &vpx_highbd_tm_predictor_8x8_c, 8, 10)));180 &vpx_highbd_tm_predictor_8x8_c, 8, 10)));
182 181
183INSTANTIATE_TEST_CASE_P(SSE2_TO_C_12, VP9IntraPredTest,182INSTANTIATE_TEST_CASE_P(
184 ::testing::Values(183 SSE2_TO_C_12, VP9IntraPredTest,
185 IntraPredFunc(&vpx_highbd_dc_predictor_32x32_sse2,184 ::testing::Values(IntraPredFunc(&vpx_highbd_dc_predictor_32x32_sse2,
186 &vpx_highbd_dc_predictor_32x32_c, 32, 12),185 &vpx_highbd_dc_predictor_32x32_c, 32, 12),
187 IntraPredFunc(&vpx_highbd_tm_predictor_16x16_sse2,186 IntraPredFunc(&vpx_highbd_tm_predictor_16x16_sse2,
188 &vpx_highbd_tm_predictor_16x16_c, 16, 12),187 &vpx_highbd_tm_predictor_16x16_c, 16, 12),
189 IntraPredFunc(&vpx_highbd_tm_predictor_32x32_sse2,188 IntraPredFunc(&vpx_highbd_tm_predictor_32x32_sse2,
190 &vpx_highbd_tm_predictor_32x32_c, 32, 12),189 &vpx_highbd_tm_predictor_32x32_c, 32, 12),
191 IntraPredFunc(&vpx_highbd_dc_predictor_4x4_sse2,190 IntraPredFunc(&vpx_highbd_dc_predictor_4x4_sse2,
192 &vpx_highbd_dc_predictor_4x4_c, 4, 12),191 &vpx_highbd_dc_predictor_4x4_c, 4, 12),
193 IntraPredFunc(&vpx_highbd_dc_predictor_8x8_sse2,192 IntraPredFunc(&vpx_highbd_dc_predictor_8x8_sse2,
194 &vpx_highbd_dc_predictor_8x8_c, 8, 12),193 &vpx_highbd_dc_predictor_8x8_c, 8, 12),
195 IntraPredFunc(&vpx_highbd_dc_predictor_16x16_sse2,194 IntraPredFunc(&vpx_highbd_dc_predictor_16x16_sse2,
196 &vpx_highbd_dc_predictor_16x16_c, 16, 12),195 &vpx_highbd_dc_predictor_16x16_c, 16, 12),
197 IntraPredFunc(&vpx_highbd_v_predictor_4x4_sse2,196 IntraPredFunc(&vpx_highbd_v_predictor_4x4_sse2,
198 &vpx_highbd_v_predictor_4x4_c, 4, 12),197 &vpx_highbd_v_predictor_4x4_c, 4, 12),
199 IntraPredFunc(&vpx_highbd_v_predictor_8x8_sse2,198 IntraPredFunc(&vpx_highbd_v_predictor_8x8_sse2,
200 &vpx_highbd_v_predictor_8x8_c, 8, 12),199 &vpx_highbd_v_predictor_8x8_c, 8, 12),
201 IntraPredFunc(&vpx_highbd_v_predictor_16x16_sse2,200 IntraPredFunc(&vpx_highbd_v_predictor_16x16_sse2,
202 &vpx_highbd_v_predictor_16x16_c, 16, 12),201 &vpx_highbd_v_predictor_16x16_c, 16, 12),
203 IntraPredFunc(&vpx_highbd_v_predictor_32x32_sse2,202 IntraPredFunc(&vpx_highbd_v_predictor_32x32_sse2,
204 &vpx_highbd_v_predictor_32x32_c, 32, 12),203 &vpx_highbd_v_predictor_32x32_c, 32, 12),
205 IntraPredFunc(&vpx_highbd_tm_predictor_4x4_sse2,204 IntraPredFunc(&vpx_highbd_tm_predictor_4x4_sse2,
206 &vpx_highbd_tm_predictor_4x4_c, 4, 12),205 &vpx_highbd_tm_predictor_4x4_c, 4, 12),
207 IntraPredFunc(&vpx_highbd_tm_predictor_8x8_sse2,206 IntraPredFunc(&vpx_highbd_tm_predictor_8x8_sse2,
208 &vpx_highbd_tm_predictor_8x8_c, 8, 12)));207 &vpx_highbd_tm_predictor_8x8_c, 8, 12)));
209 208
210#endif // CONFIG_VP9_HIGHBITDEPTH209#endif // CONFIG_VP9_HIGHBITDEPTH
211#endif // HAVE_SSE2210#endif // HAVE_SSE2
test/vp9_lossless_test.cc+7−12
@@ -21,15 +21,13 @@ namespace { · 20 unmodified lines
21 21
22const int kMaxPsnr = 100;22const int kMaxPsnr = 100;
23 23
24class LosslessTest : public ::libvpx_test::EncoderTest,24class LosslessTest
25 public ::libvpx_test::CodecTestWithParam<libvpx_test::TestMode> {25 : public ::libvpx_test::EncoderTest,
26 public ::libvpx_test::CodecTestWithParam<libvpx_test::TestMode> {
26 protected:27 protected:
27 LosslessTest()28 LosslessTest()
28 : EncoderTest(GET_PARAM(0)),29 : EncoderTest(GET_PARAM(0)), psnr_(kMaxPsnr), nframes_(0),
29 psnr_(kMaxPsnr),30 encoding_mode_(GET_PARAM(1)) {}
30 nframes_(0),
31 encoding_mode_(GET_PARAM(1)) {
32 }
33 31
34 virtual ~LosslessTest() {}32 virtual ~LosslessTest() {}
35 33
@@ -55,13 +53,10 @@ class LosslessTest : public ::libvpx_test::EncoderTest, · 19 unmodified lines
55 }53 }
56 54
57 virtual void PSNRPktHook(const vpx_codec_cx_pkt_t *pkt) {55 virtual void PSNRPktHook(const vpx_codec_cx_pkt_t *pkt) {
58 if (pkt->data.psnr.psnr[0] < psnr_)56 if (pkt->data.psnr.psnr[0] < psnr_) psnr_ = pkt->data.psnr.psnr[0];
59 psnr_= pkt->data.psnr.psnr[0];
60 }57 }
61 58
62 double GetMinPsnr() const {59 double GetMinPsnr() const { return psnr_; }
63 return psnr_;
64 }
65 60
66 private:61 private:
67 double psnr_;62 double psnr_;
test/vp9_quantize_test.cc+60−67
@@ -34,9 +34,8 @@ const int number_of_iterations = 100; · 33 unmodified lines
34typedef void (*QuantizeFunc)(const tran_low_t *coeff, intptr_t count,34typedef void (*QuantizeFunc)(const tran_low_t *coeff, intptr_t count,
35 int skip_block, const int16_t *zbin,35 int skip_block, const int16_t *zbin,
36 const int16_t *round, const int16_t *quant,36 const int16_t *round, const int16_t *quant,
37 const int16_t *quant_shift,37 const int16_t *quant_shift, tran_low_t *qcoeff,
38 tran_low_t *qcoeff, tran_low_t *dqcoeff,38 tran_low_t *dqcoeff, const int16_t *dequant,
39 const int16_t *dequant,
40 uint16_t *eob, const int16_t *scan,39 uint16_t *eob, const int16_t *scan,
41 const int16_t *iscan);40 const int16_t *iscan);
42typedef std::tr1::tuple<QuantizeFunc, QuantizeFunc, vpx_bit_depth_t>41typedef std::tr1::tuple<QuantizeFunc, QuantizeFunc, vpx_bit_depth_t>
@@ -46,9 +45,9 @@ class VP9QuantizeTest : public ::testing::TestWithParam<QuantizeParam> { · 3 unmodified lines
46 public:45 public:
47 virtual ~VP9QuantizeTest() {}46 virtual ~VP9QuantizeTest() {}
48 virtual void SetUp() {47 virtual void SetUp() {
49 quantize_op_ = GET_PARAM(0);48 quantize_op_ = GET_PARAM(0);
50 ref_quantize_op_ = GET_PARAM(1);49 ref_quantize_op_ = GET_PARAM(1);
51 bit_depth_ = GET_PARAM(2);50 bit_depth_ = GET_PARAM(2);
52 mask_ = (1 << bit_depth_) - 1;51 mask_ = (1 << bit_depth_) - 1;
53 }52 }
54 53
@@ -65,9 +64,9 @@ class VP9Quantize32Test : public ::testing::TestWithParam<QuantizeParam> { · 10 unmodified lines
65 public:64 public:
66 virtual ~VP9Quantize32Test() {}65 virtual ~VP9Quantize32Test() {}
67 virtual void SetUp() {66 virtual void SetUp() {
68 quantize_op_ = GET_PARAM(0);67 quantize_op_ = GET_PARAM(0);
69 ref_quantize_op_ = GET_PARAM(1);68 ref_quantize_op_ = GET_PARAM(1);
70 bit_depth_ = GET_PARAM(2);69 bit_depth_ = GET_PARAM(2);
71 mask_ = (1 << bit_depth_) - 1;70 mask_ = (1 << bit_depth_) - 1;
72 }71 }
73 72
@@ -106,10 +105,10 @@ TEST_P(VP9QuantizeTest, OperationCheck) { · 32 unmodified lines
106 *eob_ptr = rnd.Rand16();105 *eob_ptr = rnd.Rand16();
107 *ref_eob_ptr = *eob_ptr;106 *ref_eob_ptr = *eob_ptr;
108 for (int j = 0; j < count; j++) {107 for (int j = 0; j < count; j++) {
109 coeff_ptr[j] = rnd.Rand16()&mask_;108 coeff_ptr[j] = rnd.Rand16() & mask_;
110 }109 }
111 for (int j = 0; j < 2; j++) {110 for (int j = 0; j < 2; j++) {
112 zbin_ptr[j] = rnd.Rand16()&mask_;111 zbin_ptr[j] = rnd.Rand16() & mask_;
113 round_ptr[j] = rnd.Rand16();112 round_ptr[j] = rnd.Rand16();
114 quant_ptr[j] = rnd.Rand16();113 quant_ptr[j] = rnd.Rand16();
115 quant_shift_ptr[j] = rnd.Rand16();114 quant_shift_ptr[j] = rnd.Rand16();
@@ -117,16 +116,15 @@ TEST_P(VP9QuantizeTest, OperationCheck) { · 1 unmodified line
117 }116 }
118 ref_quantize_op_(coeff_ptr, count, skip_block, zbin_ptr, round_ptr,117 ref_quantize_op_(coeff_ptr, count, skip_block, zbin_ptr, round_ptr,
119 quant_ptr, quant_shift_ptr, ref_qcoeff_ptr,118 quant_ptr, quant_shift_ptr, ref_qcoeff_ptr,
120 ref_dqcoeff_ptr, dequant_ptr,119 ref_dqcoeff_ptr, dequant_ptr, ref_eob_ptr,
121 ref_eob_ptr, scan_order->scan, scan_order->iscan);120 scan_order->scan, scan_order->iscan);
122 ASM_REGISTER_STATE_CHECK(quantize_op_(coeff_ptr, count, skip_block,121 ASM_REGISTER_STATE_CHECK(quantize_op_(
123 zbin_ptr, round_ptr, quant_ptr,122 coeff_ptr, count, skip_block, zbin_ptr, round_ptr, quant_ptr,
124 quant_shift_ptr, qcoeff_ptr,123 quant_shift_ptr, qcoeff_ptr, dqcoeff_ptr, dequant_ptr, eob_ptr,
125 dqcoeff_ptr, dequant_ptr, eob_ptr,124 scan_order->scan, scan_order->iscan));
126 scan_order->scan, scan_order->iscan));
127 for (int j = 0; j < sz; ++j) {125 for (int j = 0; j < sz; ++j) {
128 err_count += (ref_qcoeff_ptr[j] != qcoeff_ptr[j]) |126 err_count += (ref_qcoeff_ptr[j] != qcoeff_ptr[j]) |
129 (ref_dqcoeff_ptr[j] != dqcoeff_ptr[j]);127 (ref_dqcoeff_ptr[j] != dqcoeff_ptr[j]);
130 }128 }
131 err_count += (*ref_eob_ptr != *eob_ptr);129 err_count += (*ref_eob_ptr != *eob_ptr);
132 if (err_count && !err_count_total) {130 if (err_count && !err_count_total) {
@@ -165,10 +163,10 @@ TEST_P(VP9Quantize32Test, OperationCheck) { · 32 unmodified lines
165 *eob_ptr = rnd.Rand16();163 *eob_ptr = rnd.Rand16();
166 *ref_eob_ptr = *eob_ptr;164 *ref_eob_ptr = *eob_ptr;
167 for (int j = 0; j < count; j++) {165 for (int j = 0; j < count; j++) {
168 coeff_ptr[j] = rnd.Rand16()&mask_;166 coeff_ptr[j] = rnd.Rand16() & mask_;
169 }167 }
170 for (int j = 0; j < 2; j++) {168 for (int j = 0; j < 2; j++) {
171 zbin_ptr[j] = rnd.Rand16()&mask_;169 zbin_ptr[j] = rnd.Rand16() & mask_;
172 round_ptr[j] = rnd.Rand16();170 round_ptr[j] = rnd.Rand16();
173 quant_ptr[j] = rnd.Rand16();171 quant_ptr[j] = rnd.Rand16();
174 quant_shift_ptr[j] = rnd.Rand16();172 quant_shift_ptr[j] = rnd.Rand16();
@@ -176,16 +174,15 @@ TEST_P(VP9Quantize32Test, OperationCheck) { · 1 unmodified line
176 }174 }
177 ref_quantize_op_(coeff_ptr, count, skip_block, zbin_ptr, round_ptr,175 ref_quantize_op_(coeff_ptr, count, skip_block, zbin_ptr, round_ptr,
178 quant_ptr, quant_shift_ptr, ref_qcoeff_ptr,176 quant_ptr, quant_shift_ptr, ref_qcoeff_ptr,
179 ref_dqcoeff_ptr, dequant_ptr,177 ref_dqcoeff_ptr, dequant_ptr, ref_eob_ptr,
180 ref_eob_ptr, scan_order->scan, scan_order->iscan);178 scan_order->scan, scan_order->iscan);
181 ASM_REGISTER_STATE_CHECK(quantize_op_(coeff_ptr, count, skip_block,179 ASM_REGISTER_STATE_CHECK(quantize_op_(
182 zbin_ptr, round_ptr, quant_ptr,180 coeff_ptr, count, skip_block, zbin_ptr, round_ptr, quant_ptr,
183 quant_shift_ptr, qcoeff_ptr,181 quant_shift_ptr, qcoeff_ptr, dqcoeff_ptr, dequant_ptr, eob_ptr,
184 dqcoeff_ptr, dequant_ptr, eob_ptr,182 scan_order->scan, scan_order->iscan));
185 scan_order->scan, scan_order->iscan));
186 for (int j = 0; j < sz; ++j) {183 for (int j = 0; j < sz; ++j) {
187 err_count += (ref_qcoeff_ptr[j] != qcoeff_ptr[j]) |184 err_count += (ref_qcoeff_ptr[j] != qcoeff_ptr[j]) |
188 (ref_dqcoeff_ptr[j] != dqcoeff_ptr[j]);185 (ref_dqcoeff_ptr[j] != dqcoeff_ptr[j]);
189 }186 }
190 err_count += (*ref_eob_ptr != *eob_ptr);187 err_count += (*ref_eob_ptr != *eob_ptr);
191 if (err_count && !err_count_total) {188 if (err_count && !err_count_total) {
@@ -227,10 +224,10 @@ TEST_P(VP9QuantizeTest, EOBCheck) { · 35 unmodified lines
227 for (int j = 0; j < count; j++) {224 for (int j = 0; j < count; j++) {
228 coeff_ptr[j] = 0;225 coeff_ptr[j] = 0;
229 }226 }
230 coeff_ptr[rnd(count)] = rnd.Rand16()&mask_;227 coeff_ptr[rnd(count)] = rnd.Rand16() & mask_;
231 coeff_ptr[rnd(count)] = rnd.Rand16()&mask_;228 coeff_ptr[rnd(count)] = rnd.Rand16() & mask_;
232 for (int j = 0; j < 2; j++) {229 for (int j = 0; j < 2; j++) {
233 zbin_ptr[j] = rnd.Rand16()&mask_;230 zbin_ptr[j] = rnd.Rand16() & mask_;
234 round_ptr[j] = rnd.Rand16();231 round_ptr[j] = rnd.Rand16();
235 quant_ptr[j] = rnd.Rand16();232 quant_ptr[j] = rnd.Rand16();
236 quant_shift_ptr[j] = rnd.Rand16();233 quant_shift_ptr[j] = rnd.Rand16();
@@ -239,17 +236,16 @@ TEST_P(VP9QuantizeTest, EOBCheck) { · 2 unmodified lines
239 236
240 ref_quantize_op_(coeff_ptr, count, skip_block, zbin_ptr, round_ptr,237 ref_quantize_op_(coeff_ptr, count, skip_block, zbin_ptr, round_ptr,
241 quant_ptr, quant_shift_ptr, ref_qcoeff_ptr,238 quant_ptr, quant_shift_ptr, ref_qcoeff_ptr,
242 ref_dqcoeff_ptr, dequant_ptr,239 ref_dqcoeff_ptr, dequant_ptr, ref_eob_ptr,
243 ref_eob_ptr, scan_order->scan, scan_order->iscan);240 scan_order->scan, scan_order->iscan);
244 ASM_REGISTER_STATE_CHECK(quantize_op_(coeff_ptr, count, skip_block,241 ASM_REGISTER_STATE_CHECK(quantize_op_(
245 zbin_ptr, round_ptr, quant_ptr,242 coeff_ptr, count, skip_block, zbin_ptr, round_ptr, quant_ptr,
246 quant_shift_ptr, qcoeff_ptr,243 quant_shift_ptr, qcoeff_ptr, dqcoeff_ptr, dequant_ptr, eob_ptr,
247 dqcoeff_ptr, dequant_ptr, eob_ptr,244 scan_order->scan, scan_order->iscan));
248 scan_order->scan, scan_order->iscan));
249 245
250 for (int j = 0; j < sz; ++j) {246 for (int j = 0; j < sz; ++j) {
251 err_count += (ref_qcoeff_ptr[j] != qcoeff_ptr[j]) |247 err_count += (ref_qcoeff_ptr[j] != qcoeff_ptr[j]) |
252 (ref_dqcoeff_ptr[j] != dqcoeff_ptr[j]);248 (ref_dqcoeff_ptr[j] != dqcoeff_ptr[j]);
253 }249 }
254 err_count += (*ref_eob_ptr != *eob_ptr);250 err_count += (*ref_eob_ptr != *eob_ptr);
255 if (err_count && !err_count_total) {251 if (err_count && !err_count_total) {
@@ -291,10 +287,10 @@ TEST_P(VP9Quantize32Test, EOBCheck) { · 35 unmodified lines
291 coeff_ptr[j] = 0;287 coeff_ptr[j] = 0;
292 }288 }
293 // Two random entries289 // Two random entries
294 coeff_ptr[rnd(count)] = rnd.Rand16()&mask_;290 coeff_ptr[rnd(count)] = rnd.Rand16() & mask_;
295 coeff_ptr[rnd(count)] = rnd.Rand16()&mask_;291 coeff_ptr[rnd(count)] = rnd.Rand16() & mask_;
296 for (int j = 0; j < 2; j++) {292 for (int j = 0; j < 2; j++) {
297 zbin_ptr[j] = rnd.Rand16()&mask_;293 zbin_ptr[j] = rnd.Rand16() & mask_;
298 round_ptr[j] = rnd.Rand16();294 round_ptr[j] = rnd.Rand16();
299 quant_ptr[j] = rnd.Rand16();295 quant_ptr[j] = rnd.Rand16();
300 quant_shift_ptr[j] = rnd.Rand16();296 quant_shift_ptr[j] = rnd.Rand16();
@@ -303,17 +299,16 @@ TEST_P(VP9Quantize32Test, EOBCheck) { · 2 unmodified lines
303 299
304 ref_quantize_op_(coeff_ptr, count, skip_block, zbin_ptr, round_ptr,300 ref_quantize_op_(coeff_ptr, count, skip_block, zbin_ptr, round_ptr,
305 quant_ptr, quant_shift_ptr, ref_qcoeff_ptr,301 quant_ptr, quant_shift_ptr, ref_qcoeff_ptr,
306 ref_dqcoeff_ptr, dequant_ptr,302 ref_dqcoeff_ptr, dequant_ptr, ref_eob_ptr,
307 ref_eob_ptr, scan_order->scan, scan_order->iscan);303 scan_order->scan, scan_order->iscan);
308 ASM_REGISTER_STATE_CHECK(quantize_op_(coeff_ptr, count, skip_block,304 ASM_REGISTER_STATE_CHECK(quantize_op_(
309 zbin_ptr, round_ptr, quant_ptr,305 coeff_ptr, count, skip_block, zbin_ptr, round_ptr, quant_ptr,
310 quant_shift_ptr, qcoeff_ptr,306 quant_shift_ptr, qcoeff_ptr, dqcoeff_ptr, dequant_ptr, eob_ptr,
311 dqcoeff_ptr, dequant_ptr, eob_ptr,307 scan_order->scan, scan_order->iscan));
312 scan_order->scan, scan_order->iscan));
313 308
314 for (int j = 0; j < sz; ++j) {309 for (int j = 0; j < sz; ++j) {
315 err_count += (ref_qcoeff_ptr[j] != qcoeff_ptr[j]) |310 err_count += (ref_qcoeff_ptr[j] != qcoeff_ptr[j]) |
316 (ref_dqcoeff_ptr[j] != dqcoeff_ptr[j]);311 (ref_dqcoeff_ptr[j] != dqcoeff_ptr[j]);
317 }312 }
318 err_count += (*ref_eob_ptr != *eob_ptr);313 err_count += (*ref_eob_ptr != *eob_ptr);
319 if (err_count && !err_count_total) {314 if (err_count && !err_count_total) {
@@ -330,22 +325,20 @@ using std::tr1::make_tuple; · 10 unmodified lines
330#if HAVE_SSE2325#if HAVE_SSE2
331INSTANTIATE_TEST_CASE_P(326INSTANTIATE_TEST_CASE_P(
332 SSE2, VP9QuantizeTest,327 SSE2, VP9QuantizeTest,
333 ::testing::Values(328 ::testing::Values(make_tuple(&vpx_highbd_quantize_b_sse2,
334 make_tuple(&vpx_highbd_quantize_b_sse2,329 &vpx_highbd_quantize_b_c, VPX_BITS_8),
335 &vpx_highbd_quantize_b_c, VPX_BITS_8),330 make_tuple(&vpx_highbd_quantize_b_sse2,
336 make_tuple(&vpx_highbd_quantize_b_sse2,331 &vpx_highbd_quantize_b_c, VPX_BITS_10),
337 &vpx_highbd_quantize_b_c, VPX_BITS_10),332 make_tuple(&vpx_highbd_quantize_b_sse2,
338 make_tuple(&vpx_highbd_quantize_b_sse2,333 &vpx_highbd_quantize_b_c, VPX_BITS_12)));
339 &vpx_highbd_quantize_b_c, VPX_BITS_12)));
340INSTANTIATE_TEST_CASE_P(334INSTANTIATE_TEST_CASE_P(
341 SSE2, VP9Quantize32Test,335 SSE2, VP9Quantize32Test,
342 ::testing::Values(336 ::testing::Values(make_tuple(&vpx_highbd_quantize_b_32x32_sse2,
343 make_tuple(&vpx_highbd_quantize_b_32x32_sse2,337 &vpx_highbd_quantize_b_32x32_c, VPX_BITS_8),
344 &vpx_highbd_quantize_b_32x32_c, VPX_BITS_8),338 make_tuple(&vpx_highbd_quantize_b_32x32_sse2,
345 make_tuple(&vpx_highbd_quantize_b_32x32_sse2,339 &vpx_highbd_quantize_b_32x32_c, VPX_BITS_10),
346 &vpx_highbd_quantize_b_32x32_c, VPX_BITS_10),340 make_tuple(&vpx_highbd_quantize_b_32x32_sse2,
347 make_tuple(&vpx_highbd_quantize_b_32x32_sse2,341 &vpx_highbd_quantize_b_32x32_c, VPX_BITS_12)));
348 &vpx_highbd_quantize_b_32x32_c, VPX_BITS_12)));
349#endif // HAVE_SSE2342#endif // HAVE_SSE2
350#endif // CONFIG_VP9_HIGHBITDEPTH343#endif // CONFIG_VP9_HIGHBITDEPTH
351} // namespace344} // namespace
test/vp9_skip_loopfilter_test.cc+5−11
@@ -24,14 +24,10 @@ const char kVp9Md5File[] = "vp90-2-08-tile_1x8_frame_parallel.webm.md5"; · 23 unmodified lines
24// Class for testing shutting off the loop filter.24// Class for testing shutting off the loop filter.
25class SkipLoopFilterTest {25class SkipLoopFilterTest {
26 public:26 public:
27 SkipLoopFilterTest()27 SkipLoopFilterTest() : video_(NULL), decoder_(NULL), md5_file_(NULL) {}
28 : video_(NULL),
29 decoder_(NULL),
30 md5_file_(NULL) {}
31 28
32 ~SkipLoopFilterTest() {29 ~SkipLoopFilterTest() {
33 if (md5_file_ != NULL)30 if (md5_file_ != NULL) fclose(md5_file_);
34 fclose(md5_file_);
35 delete decoder_;31 delete decoder_;
36 delete video_;32 delete video_;
37 }33 }
@@ -46,8 +42,7 @@ class SkipLoopFilterTest { · 8 unmodified lines
46 video_->Begin();42 video_->Begin();
47 43
48 vpx_codec_dec_cfg_t cfg = vpx_codec_dec_cfg_t();44 vpx_codec_dec_cfg_t cfg = vpx_codec_dec_cfg_t();
49 if (num_threads > 0)45 if (num_threads > 0) cfg.threads = num_threads;
50 cfg.threads = num_threads;
51 decoder_ = new libvpx_test::VP9Decoder(cfg, 0);46 decoder_ = new libvpx_test::VP9Decoder(cfg, 0);
52 ASSERT_TRUE(decoder_ != NULL);47 ASSERT_TRUE(decoder_ != NULL);
53 48
@@ -73,8 +68,7 @@ class SkipLoopFilterTest { · 19 unmodified lines
73 for (; video_->cxdata() != NULL; video_->Next()) {68 for (; video_->cxdata() != NULL; video_->Next()) {
74 const vpx_codec_err_t res =69 const vpx_codec_err_t res =
75 decoder_->DecodeFrame(video_->cxdata(), video_->frame_size());70 decoder_->DecodeFrame(video_->cxdata(), video_->frame_size());
76 if (res != VPX_CODEC_OK)71 if (res != VPX_CODEC_OK) return res;
77 return res;
78 ReadMd5();72 ReadMd5();
79 }73 }
80 return VPX_CODEC_OK;74 return VPX_CODEC_OK;
@@ -92,7 +86,7 @@ class SkipLoopFilterTest { · 11 unmodified lines
92 void OpenMd5File(const std::string &md5_file_name) {86 void OpenMd5File(const std::string &md5_file_name) {
93 md5_file_ = libvpx_test::OpenTestDataFile(md5_file_name);87 md5_file_ = libvpx_test::OpenTestDataFile(md5_file_name);
94 ASSERT_TRUE(md5_file_ != NULL) << "MD5 file open failed. Filename: "88 ASSERT_TRUE(md5_file_ != NULL) << "MD5 file open failed. Filename: "
95 << md5_file_name;89 << md5_file_name;
96 }90 }
97 91
98 // Reads the next line of the MD5 file.92 // Reads the next line of the MD5 file.
test/vp9_subtract_test.cc+16−21
@@ -19,18 +19,16 @@ · 18 unmodified lines
19#include "vp9/common/vp9_blockd.h"19#include "vp9/common/vp9_blockd.h"
20#include "vpx_mem/vpx_mem.h"20#include "vpx_mem/vpx_mem.h"
21 21
22typedef void (*SubtractFunc)(int rows, int cols,22typedef void (*SubtractFunc)(int rows, int cols, int16_t *diff_ptr,
23 int16_t *diff_ptr, ptrdiff_t diff_stride,23 ptrdiff_t diff_stride, const uint8_t *src_ptr,
24 const uint8_t *src_ptr, ptrdiff_t src_stride,24 ptrdiff_t src_stride, const uint8_t *pred_ptr,
25 const uint8_t *pred_ptr, ptrdiff_t pred_stride);25 ptrdiff_t pred_stride);
26 26
27namespace vp9 {27namespace vp9 {
28 28
29class VP9SubtractBlockTest : public ::testing::TestWithParam<SubtractFunc> {29class VP9SubtractBlockTest : public ::testing::TestWithParam<SubtractFunc> {
30 public:30 public:
31 virtual void TearDown() {31 virtual void TearDown() { libvpx_test::ClearSystemState(); }
32 libvpx_test::ClearSystemState();
33 }
34};32};
35 33
36using libvpx_test::ACMRandom;34using libvpx_test::ACMRandom;
@@ -47,7 +45,7 @@ TEST_P(VP9SubtractBlockTest, SimpleSubtract) { · 10 unmodified lines
47 vpx_memalign(16, sizeof(*diff) * block_width * block_height * 2));45 vpx_memalign(16, sizeof(*diff) * block_width * block_height * 2));
48 uint8_t *pred = reinterpret_cast<uint8_t *>(46 uint8_t *pred = reinterpret_cast<uint8_t *>(
49 vpx_memalign(16, block_width * block_height * 2));47 vpx_memalign(16, block_width * block_height * 2));
50 uint8_t *src = reinterpret_cast<uint8_t *>(48 uint8_t *src = reinterpret_cast<uint8_t *>(
51 vpx_memalign(16, block_width * block_height * 2));49 vpx_memalign(16, block_width * block_height * 2));
52 50
53 for (int n = 0; n < 100; n++) {51 for (int n = 0; n < 100; n++) {
@@ -58,29 +56,26 @@ TEST_P(VP9SubtractBlockTest, SimpleSubtract) { · 4 unmodified lines
58 }56 }
59 }57 }
60 58
61 GetParam()(block_height, block_width, diff, block_width,59 GetParam()(block_height, block_width, diff, block_width, src, block_width,
62 src, block_width, pred, block_width);60 pred, block_width);
63 61
64 for (int r = 0; r < block_height; ++r) {62 for (int r = 0; r < block_height; ++r) {
65 for (int c = 0; c < block_width; ++c) {63 for (int c = 0; c < block_width; ++c) {
66 EXPECT_EQ(diff[r * block_width + c],64 EXPECT_EQ(diff[r * block_width + c],
67 (src[r * block_width + c] -65 (src[r * block_width + c] - pred[r * block_width + c]))
68 pred[r * block_width + c])) << "r = " << r66 << "r = " << r << ", c = " << c << ", bs = " << bsize;
69 << ", c = " << c
70 << ", bs = " << bsize;
71 }67 }
72 }68 }
73 69
74 GetParam()(block_height, block_width, diff, block_width * 2,70 GetParam()(block_height, block_width, diff, block_width * 2, src,
75 src, block_width * 2, pred, block_width * 2);71 block_width * 2, pred, block_width * 2);
76 72
77 for (int r = 0; r < block_height; ++r) {73 for (int r = 0; r < block_height; ++r) {
78 for (int c = 0; c < block_width; ++c) {74 for (int c = 0; c < block_width; ++c) {
79 EXPECT_EQ(diff[r * block_width * 2 + c],75 EXPECT_EQ(
80 (src[r * block_width * 2 + c] -76 diff[r * block_width * 2 + c],
81 pred[r * block_width * 2 + c])) << "r = " << r77 (src[r * block_width * 2 + c] - pred[r * block_width * 2 + c]))
82 << ", c = " << c78 << "r = " << r << ", c = " << c << ", bs = " << bsize;
83 << ", bs = " << bsize;
84 }79 }
85 }80 }
86 }81 }
test/vp9_thread_test.cc+16−22
@@ -27,15 +27,11 @@ using std::string; · 26 unmodified lines
27class VPxWorkerThreadTest : public ::testing::TestWithParam<bool> {27class VPxWorkerThreadTest : public ::testing::TestWithParam<bool> {
28 protected:28 protected:
29 virtual ~VPxWorkerThreadTest() {}29 virtual ~VPxWorkerThreadTest() {}
30 virtual void SetUp() {30 virtual void SetUp() { vpx_get_worker_interface()->init(&worker_); }
31 vpx_get_worker_interface()->init(&worker_);
32 }
33 31
34 virtual void TearDown() {32 virtual void TearDown() { vpx_get_worker_interface()->end(&worker_); }
35 vpx_get_worker_interface()->end(&worker_);
36 }
37 33
38 void Run(VPxWorker* worker) {34 void Run(VPxWorker *worker) {
39 const bool synchronous = GetParam();35 const bool synchronous = GetParam();
40 if (synchronous) {36 if (synchronous) {
41 vpx_get_worker_interface()->execute(worker);37 vpx_get_worker_interface()->execute(worker);
@@ -47,10 +43,10 @@ class VPxWorkerThreadTest : public ::testing::TestWithParam<bool> { · 5 unmodified lines
47 VPxWorker worker_;43 VPxWorker worker_;
48};44};
49 45
50int ThreadHook(void* data, void* return_value) {46int ThreadHook(void *data, void *return_value) {
51 int* const hook_data = reinterpret_cast<int*>(data);47 int *const hook_data = reinterpret_cast<int *>(data);
52 *hook_data = 5;48 *hook_data = 5;
53 return *reinterpret_cast<int*>(return_value);49 return *reinterpret_cast<int *>(return_value);
54}50}
55 51
56TEST_P(VPxWorkerThreadTest, HookSuccess) {52TEST_P(VPxWorkerThreadTest, HookSuccess) {
@@ -159,7 +155,7 @@ struct FileList { · 102 unmodified lines
159};155};
160 156
161// Decodes |filename| with |num_threads|. Returns the md5 of the decoded frames.157// Decodes |filename| with |num_threads|. Returns the md5 of the decoded frames.
162string DecodeFile(const string& filename, int num_threads) {158string DecodeFile(const string &filename, int num_threads) {
163 libvpx_test::WebMVideoSource video(filename);159 libvpx_test::WebMVideoSource video(filename);
164 video.Init();160 video.Init();
165 161
@@ -191,8 +187,8 @@ void DecodeFiles(const FileList files[]) { · 25 unmodified lines
191 for (const FileList *iter = files; iter->name != NULL; ++iter) {187 for (const FileList *iter = files; iter->name != NULL; ++iter) {
192 SCOPED_TRACE(iter->name);188 SCOPED_TRACE(iter->name);
193 for (int t = 1; t <= 8; ++t) {189 for (int t = 1; t <= 8; ++t) {
194 EXPECT_EQ(iter->expected_md5, DecodeFile(iter->name, t))190 EXPECT_EQ(iter->expected_md5, DecodeFile(iter->name, t)) << "threads = "
195 << "threads = " << t;191 << t;
196 }192 }
197 }193 }
198}194}
@@ -242,15 +238,13 @@ TEST(VP9DecodeMultiThreadedTest, NoTilesNonFrameParallel) { · 43 unmodified lines
242}238}
243 239
244TEST(VP9DecodeMultiThreadedTest, FrameParallel) {240TEST(VP9DecodeMultiThreadedTest, FrameParallel) {
245 static const FileList files[] = {241 static const FileList files[] = { { "vp90-2-08-tile_1x2_frame_parallel.webm",
246 { "vp90-2-08-tile_1x2_frame_parallel.webm",242 "68ede6abd66bae0a2edf2eb9232241b6" },
247 "68ede6abd66bae0a2edf2eb9232241b6" },243 { "vp90-2-08-tile_1x4_frame_parallel.webm",
248 { "vp90-2-08-tile_1x4_frame_parallel.webm",244 "368ebc6ebf3a5e478d85b2c3149b2848" },
249 "368ebc6ebf3a5e478d85b2c3149b2848" },245 { "vp90-2-08-tile_1x8_frame_parallel.webm",
250 { "vp90-2-08-tile_1x8_frame_parallel.webm",246 "17e439da2388aff3a0f69cb22579c6c1" },
251 "17e439da2388aff3a0f69cb22579c6c1" },247 { NULL, NULL } };
252 { NULL, NULL }
253 };
254 248
255 DecodeFiles(files);249 DecodeFiles(files);
256}250}
test/vpx_scale_test.cc+20−39
@@ -25,9 +25,7 @@ typedef void (*CopyFrameFunc)(const YV12_BUFFER_CONFIG *src_ybf, · 24 unmodified lines
25 25
26class VpxScaleBase {26class VpxScaleBase {
27 public:27 public:
28 virtual ~VpxScaleBase() {28 virtual ~VpxScaleBase() { libvpx_test::ClearSystemState(); }
29 libvpx_test::ClearSystemState();
30 }
31 29
32 void ResetImage(int width, int height) {30 void ResetImage(int width, int height) {
33 width_ = width;31 width_ = width;
@@ -105,28 +103,22 @@ class VpxScaleBase { · 71 unmodified lines
105 }103 }
106 104
107 uint8_t *bottom = left + (crop_height * stride);105 uint8_t *bottom = left + (crop_height * stride);
108 for (int y = 0; y < bottom_extend; ++y) {106 for (int y = 0; y < bottom_extend; ++y) {
109 memcpy(bottom, left + (crop_height - 1) * stride, extend_width);107 memcpy(bottom, left + (crop_height - 1) * stride, extend_width);
110 bottom += stride;108 bottom += stride;
111 }109 }
112 }110 }
113 111
114 void ReferenceExtendBorder() {112 void ReferenceExtendBorder() {
115 ExtendPlane(ref_img_.y_buffer,113 ExtendPlane(ref_img_.y_buffer, ref_img_.y_crop_width,
116 ref_img_.y_crop_width, ref_img_.y_crop_height,114 ref_img_.y_crop_height, ref_img_.y_width, ref_img_.y_height,
117 ref_img_.y_width, ref_img_.y_height,115 ref_img_.y_stride, ref_img_.border);
118 ref_img_.y_stride,116 ExtendPlane(ref_img_.u_buffer, ref_img_.uv_crop_width,
119 ref_img_.border);117 ref_img_.uv_crop_height, ref_img_.uv_width, ref_img_.uv_height,
120 ExtendPlane(ref_img_.u_buffer,118 ref_img_.uv_stride, ref_img_.border / 2);
121 ref_img_.uv_crop_width, ref_img_.uv_crop_height,119 ExtendPlane(ref_img_.v_buffer, ref_img_.uv_crop_width,
122 ref_img_.uv_width, ref_img_.uv_height,120 ref_img_.uv_crop_height, ref_img_.uv_width, ref_img_.uv_height,
123 ref_img_.uv_stride,121 ref_img_.uv_stride, ref_img_.border / 2);
124 ref_img_.border / 2);
125 ExtendPlane(ref_img_.v_buffer,
126 ref_img_.uv_crop_width, ref_img_.uv_crop_height,
127 ref_img_.uv_width, ref_img_.uv_height,
128 ref_img_.uv_stride,
129 ref_img_.border / 2);
130 }122 }
131 123
132 void ReferenceCopyFrame() {124 void ReferenceCopyFrame() {
@@ -172,13 +164,9 @@ class ExtendBorderTest · 39 unmodified lines
172 virtual ~ExtendBorderTest() {}164 virtual ~ExtendBorderTest() {}
173 165
174 protected:166 protected:
175 virtual void SetUp() {167 virtual void SetUp() { extend_fn_ = GetParam(); }
176 extend_fn_ = GetParam();
177 }
178 168
179 void ExtendBorder() {169 void ExtendBorder() { ASM_REGISTER_STATE_CHECK(extend_fn_(&img_)); }
180 ASM_REGISTER_STATE_CHECK(extend_fn_(&img_));
181 }
182 170
183 void RunTest() {171 void RunTest() {
184#if ARCH_ARM172#if ARCH_ARM
@@ -187,7 +175,7 @@ class ExtendBorderTest · 2 unmodified lines
187#else175#else
188 static const int kNumSizesToTest = 7;176 static const int kNumSizesToTest = 7;
189#endif177#endif
190 static const int kSizesToTest[] = {1, 15, 33, 145, 512, 1025, 16383};178 static const int kSizesToTest[] = { 1, 15, 33, 145, 512, 1025, 16383 };
191 for (int h = 0; h < kNumSizesToTest; ++h) {179 for (int h = 0; h < kNumSizesToTest; ++h) {
192 for (int w = 0; w < kNumSizesToTest; ++w) {180 for (int w = 0; w < kNumSizesToTest; ++w) {
193 ResetImage(kSizesToTest[w], kSizesToTest[h]);181 ResetImage(kSizesToTest[w], kSizesToTest[h]);
@@ -202,23 +190,18 @@ class ExtendBorderTest · 8 unmodified lines
202 ExtendFrameBorderFunc extend_fn_;190 ExtendFrameBorderFunc extend_fn_;
203};191};
204 192
205TEST_P(ExtendBorderTest, ExtendBorder) {193TEST_P(ExtendBorderTest, ExtendBorder) { ASSERT_NO_FATAL_FAILURE(RunTest()); }
206 ASSERT_NO_FATAL_FAILURE(RunTest());
207}
208 194
209INSTANTIATE_TEST_CASE_P(C, ExtendBorderTest,195INSTANTIATE_TEST_CASE_P(C, ExtendBorderTest,
210 ::testing::Values(vp8_yv12_extend_frame_borders_c));196 ::testing::Values(vp8_yv12_extend_frame_borders_c));
211 197
212class CopyFrameTest198class CopyFrameTest : public VpxScaleBase,
213 : public VpxScaleBase,199 public ::testing::TestWithParam<CopyFrameFunc> {
214 public ::testing::TestWithParam<CopyFrameFunc> {
215 public:200 public:
216 virtual ~CopyFrameTest() {}201 virtual ~CopyFrameTest() {}
217 202
218 protected:203 protected:
219 virtual void SetUp() {204 virtual void SetUp() { copy_frame_fn_ = GetParam(); }
220 copy_frame_fn_ = GetParam();
221 }
222 205
223 void CopyFrame() {206 void CopyFrame() {
224 ASM_REGISTER_STATE_CHECK(copy_frame_fn_(&img_, &cpy_img_));207 ASM_REGISTER_STATE_CHECK(copy_frame_fn_(&img_, &cpy_img_));
@@ -231,7 +214,7 @@ class CopyFrameTest · 6 unmodified lines
231#else214#else
232 static const int kNumSizesToTest = 7;215 static const int kNumSizesToTest = 7;
233#endif216#endif
234 static const int kSizesToTest[] = {1, 15, 33, 145, 512, 1025, 16383};217 static const int kSizesToTest[] = { 1, 15, 33, 145, 512, 1025, 16383 };
235 for (int h = 0; h < kNumSizesToTest; ++h) {218 for (int h = 0; h < kNumSizesToTest; ++h) {
236 for (int w = 0; w < kNumSizesToTest; ++w) {219 for (int w = 0; w < kNumSizesToTest; ++w) {
237 ResetImage(kSizesToTest[w], kSizesToTest[h]);220 ResetImage(kSizesToTest[w], kSizesToTest[h]);
@@ -246,9 +229,7 @@ class CopyFrameTest · 8 unmodified lines
246 CopyFrameFunc copy_frame_fn_;229 CopyFrameFunc copy_frame_fn_;
247};230};
248 231
249TEST_P(CopyFrameTest, CopyFrame) {232TEST_P(CopyFrameTest, CopyFrame) { ASSERT_NO_FATAL_FAILURE(RunTest()); }
250 ASSERT_NO_FATAL_FAILURE(RunTest());
251}
252 233
253INSTANTIATE_TEST_CASE_P(C, CopyFrameTest,234INSTANTIATE_TEST_CASE_P(C, CopyFrameTest,
254 ::testing::Values(vp8_yv12_copy_frame_c));235 ::testing::Values(vp8_yv12_copy_frame_c));
test/webm_video_source.h+7−16
@@ -25,30 +25,23 @@ namespace libvpx_test { · 24 unmodified lines
25class WebMVideoSource : public CompressedVideoSource {25class WebMVideoSource : public CompressedVideoSource {
26 public:26 public:
27 explicit WebMVideoSource(const std::string &file_name)27 explicit WebMVideoSource(const std::string &file_name)
28 : file_name_(file_name),28 : file_name_(file_name), vpx_ctx_(new VpxInputContext()),
29 vpx_ctx_(new VpxInputContext()),29 webm_ctx_(new WebmInputContext()), buf_(NULL), buf_sz_(0), frame_(0),
30 webm_ctx_(new WebmInputContext()),30 end_of_file_(false) {}
31 buf_(NULL),
32 buf_sz_(0),
33 frame_(0),
34 end_of_file_(false) {
35 }
36 31
37 virtual ~WebMVideoSource() {32 virtual ~WebMVideoSource() {
38 if (vpx_ctx_->file != NULL)33 if (vpx_ctx_->file != NULL) fclose(vpx_ctx_->file);
39 fclose(vpx_ctx_->file);
40 webm_free(webm_ctx_);34 webm_free(webm_ctx_);
41 delete vpx_ctx_;35 delete vpx_ctx_;
42 delete webm_ctx_;36 delete webm_ctx_;
43 }37 }
44 38
45 virtual void Init() {39 virtual void Init() {}
46 }
47 40
48 virtual void Begin() {41 virtual void Begin() {
49 vpx_ctx_->file = OpenTestDataFile(file_name_);42 vpx_ctx_->file = OpenTestDataFile(file_name_);
50 ASSERT_TRUE(vpx_ctx_->file != NULL) << "Input file open failed. Filename: "43 ASSERT_TRUE(vpx_ctx_->file != NULL) << "Input file open failed. Filename: "
51 << file_name_;44 << file_name_;
52 45
53 ASSERT_EQ(file_is_webm(webm_ctx_, vpx_ctx_), 1) << "file is not WebM";46 ASSERT_EQ(file_is_webm(webm_ctx_, vpx_ctx_), 1) << "file is not WebM";
54 47
@@ -81,9 +74,7 @@ class WebMVideoSource : public CompressedVideoSource { · 26 unmodified lines
81 } while (!webm_ctx_->is_key_frame && !end_of_file_);74 } while (!webm_ctx_->is_key_frame && !end_of_file_);
82 }75 }
83 76
84 virtual const uint8_t *cxdata() const {77 virtual const uint8_t *cxdata() const { return end_of_file_ ? NULL : buf_; }
85 return end_of_file_ ? NULL : buf_;
86 }
87 virtual size_t frame_size() const { return buf_sz_; }78 virtual size_t frame_size() const { return buf_sz_; }
88 virtual unsigned int frame_number() const { return frame_; }79 virtual unsigned int frame_number() const { return frame_; }
89 80
test/y4m_test.cc+33−37
@@ -22,7 +22,7 @@ namespace { · 21 unmodified lines
22 22
23using std::string;23using std::string;
24 24
25static const unsigned int kWidth = 160;25static const unsigned int kWidth = 160;
26static const unsigned int kHeight = 90;26static const unsigned int kHeight = 90;
27static const unsigned int kFrames = 10;27static const unsigned int kFrames = 10;
28 28
@@ -34,24 +34,24 @@ struct Y4mTestParam { · 5 unmodified lines
34};34};
35 35
36const Y4mTestParam kY4mTestVectors[] = {36const Y4mTestParam kY4mTestVectors[] = {
37 {"park_joy_90p_8_420.y4m", 8, VPX_IMG_FMT_I420,37 { "park_joy_90p_8_420.y4m", 8, VPX_IMG_FMT_I420,
38 "e5406275b9fc6bb3436c31d4a05c1cab"},38 "e5406275b9fc6bb3436c31d4a05c1cab" },
39 {"park_joy_90p_8_422.y4m", 8, VPX_IMG_FMT_I422,39 { "park_joy_90p_8_422.y4m", 8, VPX_IMG_FMT_I422,
40 "284a47a47133b12884ec3a14e959a0b6"},40 "284a47a47133b12884ec3a14e959a0b6" },
41 {"park_joy_90p_8_444.y4m", 8, VPX_IMG_FMT_I444,41 { "park_joy_90p_8_444.y4m", 8, VPX_IMG_FMT_I444,
42 "90517ff33843d85de712fd4fe60dbed0"},42 "90517ff33843d85de712fd4fe60dbed0" },
43 {"park_joy_90p_10_420.y4m", 10, VPX_IMG_FMT_I42016,43 { "park_joy_90p_10_420.y4m", 10, VPX_IMG_FMT_I42016,
44 "63f21f9f717d8b8631bd2288ee87137b"},44 "63f21f9f717d8b8631bd2288ee87137b" },
45 {"park_joy_90p_10_422.y4m", 10, VPX_IMG_FMT_I42216,45 { "park_joy_90p_10_422.y4m", 10, VPX_IMG_FMT_I42216,
46 "48ab51fb540aed07f7ff5af130c9b605"},46 "48ab51fb540aed07f7ff5af130c9b605" },
47 {"park_joy_90p_10_444.y4m", 10, VPX_IMG_FMT_I44416,47 { "park_joy_90p_10_444.y4m", 10, VPX_IMG_FMT_I44416,
48 "067bfd75aa85ff9bae91fa3e0edd1e3e"},48 "067bfd75aa85ff9bae91fa3e0edd1e3e" },
49 {"park_joy_90p_12_420.y4m", 12, VPX_IMG_FMT_I42016,49 { "park_joy_90p_12_420.y4m", 12, VPX_IMG_FMT_I42016,
50 "9e6d8f6508c6e55625f6b697bc461cef"},50 "9e6d8f6508c6e55625f6b697bc461cef" },
51 {"park_joy_90p_12_422.y4m", 12, VPX_IMG_FMT_I42216,51 { "park_joy_90p_12_422.y4m", 12, VPX_IMG_FMT_I42216,
52 "b239c6b301c0b835485be349ca83a7e3"},52 "b239c6b301c0b835485be349ca83a7e3" },
53 {"park_joy_90p_12_444.y4m", 12, VPX_IMG_FMT_I44416,53 { "park_joy_90p_12_444.y4m", 12, VPX_IMG_FMT_I44416,
54 "5a6481a550821dab6d0192f5c63845e9"},54 "5a6481a550821dab6d0192f5c63845e9" },
55};55};
56 56
57static void write_image_file(const vpx_image_t *img, FILE *file) {57static void write_image_file(const vpx_image_t *img, FILE *file) {
@@ -60,10 +60,12 @@ static void write_image_file(const vpx_image_t *img, FILE *file) { · 2 unmodified lines
60 const unsigned char *buf = img->planes[plane];60 const unsigned char *buf = img->planes[plane];
61 const int stride = img->stride[plane];61 const int stride = img->stride[plane];
62 const int bytes_per_sample = (img->fmt & VPX_IMG_FMT_HIGHBITDEPTH) ? 2 : 1;62 const int bytes_per_sample = (img->fmt & VPX_IMG_FMT_HIGHBITDEPTH) ? 2 : 1;
63 const int h = (plane ? (img->d_h + img->y_chroma_shift) >>63 const int h =
64 img->y_chroma_shift : img->d_h);64 (plane ? (img->d_h + img->y_chroma_shift) >> img->y_chroma_shift
65 const int w = (plane ? (img->d_w + img->x_chroma_shift) >>65 : img->d_h);
66 img->x_chroma_shift : img->d_w);66 const int w =
67 (plane ? (img->d_w + img->x_chroma_shift) >> img->x_chroma_shift
68 : img->d_w);
67 for (y = 0; y < h; ++y) {69 for (y = 0; y < h; ++y) {
68 fwrite(buf, bytes_per_sample, w, file);70 fwrite(buf, bytes_per_sample, w, file);
69 buf += stride;71 buf += stride;
@@ -71,15 +73,12 @@ static void write_image_file(const vpx_image_t *img, FILE *file) { · 1 unmodified line
71 }73 }
72}74}
73 75
74class Y4mVideoSourceTest76class Y4mVideoSourceTest : public ::testing::TestWithParam<Y4mTestParam>,
75 : public ::testing::TestWithParam<Y4mTestParam>,77 public ::libvpx_test::Y4mVideoSource {
76 public ::libvpx_test::Y4mVideoSource {
77 protected:78 protected:
78 Y4mVideoSourceTest() : Y4mVideoSource("", 0, 0) {}79 Y4mVideoSourceTest() : Y4mVideoSource("", 0, 0) {}
79 80
80 virtual ~Y4mVideoSourceTest() {81 virtual ~Y4mVideoSourceTest() { CloseSource(); }
81 CloseSource();
82 }
83 82
84 virtual void Init(const std::string &file_name, int limit) {83 virtual void Init(const std::string &file_name, int limit) {
85 file_name_ = file_name;84 file_name_ = file_name;
@@ -137,8 +136,7 @@ TEST_P(Y4mVideoSourceTest, SourceTest) { · 51 unmodified lines
137INSTANTIATE_TEST_CASE_P(C, Y4mVideoSourceTest,136INSTANTIATE_TEST_CASE_P(C, Y4mVideoSourceTest,
138 ::testing::ValuesIn(kY4mTestVectors));137 ::testing::ValuesIn(kY4mTestVectors));
139 138
140class Y4mVideoWriteTest139class Y4mVideoWriteTest : public Y4mVideoSourceTest {
141 : public Y4mVideoSourceTest {
142 protected:140 protected:
143 Y4mVideoWriteTest() {}141 Y4mVideoWriteTest() {}
144 142
@@ -158,14 +156,12 @@ class Y4mVideoWriteTest · 13 unmodified lines
158 // Writes out a y4m file and then reads it back156 // Writes out a y4m file and then reads it back
159 void WriteY4mAndReadBack() {157 void WriteY4mAndReadBack() {
160 ASSERT_TRUE(input_file_ != NULL);158 ASSERT_TRUE(input_file_ != NULL);
161 char buf[Y4M_BUFFER_SIZE] = {0};159 char buf[Y4M_BUFFER_SIZE] = { 0 };
162 const struct VpxRational framerate = {y4m_.fps_n, y4m_.fps_d};160 const struct VpxRational framerate = { y4m_.fps_n, y4m_.fps_d };
163 tmpfile_ = new libvpx_test::TempOutFile;161 tmpfile_ = new libvpx_test::TempOutFile;
164 ASSERT_TRUE(tmpfile_->file() != NULL);162 ASSERT_TRUE(tmpfile_->file() != NULL);
165 y4m_write_file_header(buf, sizeof(buf),163 y4m_write_file_header(buf, sizeof(buf), kWidth, kHeight, &framerate,
166 kWidth, kHeight,164 y4m_.vpx_fmt, y4m_.bit_depth);
167 &framerate, y4m_.vpx_fmt,
168 y4m_.bit_depth);
169 fputs(buf, tmpfile_->file());165 fputs(buf, tmpfile_->file());
170 for (unsigned int i = start_; i < limit_; i++) {166 for (unsigned int i = start_; i < limit_; i++) {
171 y4m_write_frame_header(buf, sizeof(buf));167 y4m_write_frame_header(buf, sizeof(buf));
test/y4m_video_source.h+4−12
@@ -21,18 +21,10 @@ namespace libvpx_test { · 20 unmodified lines
21// so that we can do actual file encodes.21// so that we can do actual file encodes.
22class Y4mVideoSource : public VideoSource {22class Y4mVideoSource : public VideoSource {
23 public:23 public:
24 Y4mVideoSource(const std::string &file_name,24 Y4mVideoSource(const std::string &file_name, unsigned int start, int limit)
25 unsigned int start, int limit)25 : file_name_(file_name), input_file_(NULL), img_(new vpx_image_t()),
26 : file_name_(file_name),26 start_(start), limit_(limit), frame_(0), framerate_numerator_(0),
27 input_file_(NULL),27 framerate_denominator_(0), y4m_() {}
28 img_(new vpx_image_t()),
29 start_(start),
30 limit_(limit),
31 frame_(0),
32 framerate_numerator_(0),
33 framerate_denominator_(0),
34 y4m_() {
35 }
36 28
37 virtual ~Y4mVideoSource() {29 virtual ~Y4mVideoSource() {
38 vpx_img_free(img_.get());30 vpx_img_free(img_.get());
test/yuv_video_source.h+17−44
@@ -25,19 +25,11 @@ namespace libvpx_test { · 24 unmodified lines
25class YUVVideoSource : public VideoSource {25class YUVVideoSource : public VideoSource {
26 public:26 public:
27 YUVVideoSource(const std::string &file_name, vpx_img_fmt format,27 YUVVideoSource(const std::string &file_name, vpx_img_fmt format,
28 unsigned int width, unsigned int height,28 unsigned int width, unsigned int height, int rate_numerator,
29 int rate_numerator, int rate_denominator,29 int rate_denominator, unsigned int start, int limit)
30 unsigned int start, int limit)30 : file_name_(file_name), input_file_(NULL), img_(NULL), start_(start),
31 : file_name_(file_name),31 limit_(limit), frame_(0), width_(0), height_(0),
32 input_file_(NULL),32 format_(VPX_IMG_FMT_NONE), framerate_numerator_(rate_numerator),
33 img_(NULL),
34 start_(start),
35 limit_(limit),
36 frame_(0),
37 width_(0),
38 height_(0),
39 format_(VPX_IMG_FMT_NONE),
40 framerate_numerator_(rate_numerator),
41 framerate_denominator_(rate_denominator) {33 framerate_denominator_(rate_denominator) {
42 // This initializes format_, raw_size_, width_, height_ and allocates img.34 // This initializes format_, raw_size_, width_, height_ and allocates img.
43 SetSize(width, height, format);35 SetSize(width, height, format);
@@ -45,13 +37,11 @@ class YUVVideoSource : public VideoSource { · 1 unmodified line
45 37
46 virtual ~YUVVideoSource() {38 virtual ~YUVVideoSource() {
47 vpx_img_free(img_);39 vpx_img_free(img_);
48 if (input_file_)40 if (input_file_) fclose(input_file_);
49 fclose(input_file_);
50 }41 }
51 42
52 virtual void Begin() {43 virtual void Begin() {
53 if (input_file_)44 if (input_file_) fclose(input_file_);
54 fclose(input_file_);
55 input_file_ = OpenTestDataFile(file_name_);45 input_file_ = OpenTestDataFile(file_name_);
56 ASSERT_TRUE(input_file_ != NULL) << "Input file open failed. Filename: "46 ASSERT_TRUE(input_file_ != NULL) << "Input file open failed. Filename: "
57 << file_name_;47 << file_name_;
@@ -67,7 +57,7 @@ class YUVVideoSource : public VideoSource { · 9 unmodified lines
67 FillFrame();57 FillFrame();
68 }58 }
69 59
70 virtual vpx_image_t *img() const { return (frame_ < limit_) ? img_ : NULL; }60 virtual vpx_image_t *img() const { return (frame_ < limit_) ? img_ : NULL; }
71 61
72 // Models a stream where Timebase = 1/FPS, so pts == frame.62 // Models a stream where Timebase = 1/FPS, so pts == frame.
73 virtual vpx_codec_pts_t pts() const { return frame_; }63 virtual vpx_codec_pts_t pts() const { return frame_; }
@@ -93,32 +83,15 @@ class YUVVideoSource : public VideoSource { · 19 unmodified lines
93 height_ = height;83 height_ = height;
94 format_ = format;84 format_ = format;
95 switch (format) {85 switch (format) {
96 case VPX_IMG_FMT_I420:86 case VPX_IMG_FMT_I420: raw_size_ = width * height * 3 / 2; break;
97 raw_size_ = width * height * 3 / 2;87 case VPX_IMG_FMT_I422: raw_size_ = width * height * 2; break;
98 break;88 case VPX_IMG_FMT_I440: raw_size_ = width * height * 2; break;
99 case VPX_IMG_FMT_I422:89 case VPX_IMG_FMT_I444: raw_size_ = width * height * 3; break;
100 raw_size_ = width * height * 2;90 case VPX_IMG_FMT_I42016: raw_size_ = width * height * 3; break;
101 break;91 case VPX_IMG_FMT_I42216: raw_size_ = width * height * 4; break;
102 case VPX_IMG_FMT_I440:92 case VPX_IMG_FMT_I44016: raw_size_ = width * height * 4; break;
103 raw_size_ = width * height * 2;93 case VPX_IMG_FMT_I44416: raw_size_ = width * height * 6; break;
104 break;94 default: ASSERT_TRUE(0);
105 case VPX_IMG_FMT_I444:
106 raw_size_ = width * height * 3;
107 break;
108 case VPX_IMG_FMT_I42016:
109 raw_size_ = width * height * 3;
110 break;
111 case VPX_IMG_FMT_I42216:
112 raw_size_ = width * height * 4;
113 break;
114 case VPX_IMG_FMT_I44016:
115 raw_size_ = width * height * 4;
116 break;
117 case VPX_IMG_FMT_I44416:
118 raw_size_ = width * height * 6;
119 break;
120 default:
121 ASSERT_TRUE(0);
122 }95 }
123 }96 }
124 }97 }

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t