Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(601)

Side by Side Diff: source/libvpx/test/vp9_ethread_test.cc

Issue 1302353004: libvpx: Pull from upstream (Closed) Base URL: https://chromium.googlesource.com/chromium/deps/libvpx.git@master
Patch Set: Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « source/libvpx/test/vp9_end_to_end_test.cc ('k') | source/libvpx/test/vp9_lossless_test.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2014 The WebM project authors. All Rights Reserved. 2 * Copyright (c) 2014 The WebM project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
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 #include <string> 11 #include <string>
12 #include <vector> 12 #include <vector>
13 #include "third_party/googletest/src/include/gtest/gtest.h" 13 #include "third_party/googletest/src/include/gtest/gtest.h"
14 #include "test/codec_factory.h" 14 #include "test/codec_factory.h"
15 #include "test/encode_test_driver.h" 15 #include "test/encode_test_driver.h"
16 #include "test/md5_helper.h" 16 #include "test/md5_helper.h"
17 #include "test/util.h" 17 #include "test/util.h"
18 #include "test/y4m_video_source.h" 18 #include "test/y4m_video_source.h"
19 19
20 namespace { 20 namespace {
21 class VP9EncoderThreadTest 21 class VPxEncoderThreadTest
22 : public ::libvpx_test::EncoderTest, 22 : public ::libvpx_test::EncoderTest,
23 public ::libvpx_test::CodecTestWith2Params<libvpx_test::TestMode, int> { 23 public ::libvpx_test::CodecTestWith2Params<libvpx_test::TestMode, int> {
24 protected: 24 protected:
25 VP9EncoderThreadTest() 25 VPxEncoderThreadTest()
26 : EncoderTest(GET_PARAM(0)), 26 : EncoderTest(GET_PARAM(0)),
27 encoder_initialized_(false), 27 encoder_initialized_(false),
28 tiles_(2), 28 tiles_(2),
29 encoding_mode_(GET_PARAM(1)), 29 encoding_mode_(GET_PARAM(1)),
30 set_cpu_used_(GET_PARAM(2)) { 30 set_cpu_used_(GET_PARAM(2)) {
31 init_flags_ = VPX_CODEC_USE_PSNR; 31 init_flags_ = VPX_CODEC_USE_PSNR;
32 vpx_codec_dec_cfg_t cfg = vpx_codec_dec_cfg_t(); 32 vpx_codec_dec_cfg_t cfg = vpx_codec_dec_cfg_t();
33 cfg.w = 1280; 33 cfg.w = 1280;
34 cfg.h = 720; 34 cfg.h = 720;
35 decoder_ = codec_->CreateDecoder(cfg, 0); 35 decoder_ = codec_->CreateDecoder(cfg, 0);
36 36
37 md5_.clear(); 37 md5_.clear();
38 } 38 }
39 virtual ~VP9EncoderThreadTest() { 39 virtual ~VPxEncoderThreadTest() {
40 delete decoder_; 40 delete decoder_;
41 } 41 }
42 42
43 virtual void SetUp() { 43 virtual void SetUp() {
44 InitializeConfig(); 44 InitializeConfig();
45 SetMode(encoding_mode_); 45 SetMode(encoding_mode_);
46 46
47 if (encoding_mode_ != ::libvpx_test::kRealTime) { 47 if (encoding_mode_ != ::libvpx_test::kRealTime) {
48 cfg_.g_lag_in_frames = 3; 48 cfg_.g_lag_in_frames = 3;
49 cfg_.rc_end_usage = VPX_VBR; 49 cfg_.rc_end_usage = VPX_VBR;
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 } 98 }
99 99
100 bool encoder_initialized_; 100 bool encoder_initialized_;
101 int tiles_; 101 int tiles_;
102 ::libvpx_test::TestMode encoding_mode_; 102 ::libvpx_test::TestMode encoding_mode_;
103 int set_cpu_used_; 103 int set_cpu_used_;
104 ::libvpx_test::Decoder *decoder_; 104 ::libvpx_test::Decoder *decoder_;
105 std::vector<std::string> md5_; 105 std::vector<std::string> md5_;
106 }; 106 };
107 107
108 TEST_P(VP9EncoderThreadTest, EncoderResultTest) { 108 TEST_P(VPxEncoderThreadTest, EncoderResultTest) {
109 std::vector<std::string> single_thr_md5, multi_thr_md5; 109 std::vector<std::string> single_thr_md5, multi_thr_md5;
110 110
111 ::libvpx_test::Y4mVideoSource video("niklas_1280_720_30.y4m", 15, 20); 111 ::libvpx_test::Y4mVideoSource video("niklas_1280_720_30.y4m", 15, 20);
112 112
113 cfg_.rc_target_bitrate = 1000; 113 cfg_.rc_target_bitrate = 1000;
114 114
115 // Encode using single thread. 115 // Encode using single thread.
116 cfg_.g_threads = 1; 116 cfg_.g_threads = 1;
117 init_flags_ = VPX_CODEC_USE_PSNR; 117 init_flags_ = VPX_CODEC_USE_PSNR;
118 ASSERT_NO_FATAL_FAILURE(RunLoop(&video)); 118 ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
119 single_thr_md5 = md5_; 119 single_thr_md5 = md5_;
120 md5_.clear(); 120 md5_.clear();
121 121
122 // Encode using multiple threads. 122 // Encode using multiple threads.
123 cfg_.g_threads = 4; 123 cfg_.g_threads = 4;
124 ASSERT_NO_FATAL_FAILURE(RunLoop(&video)); 124 ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
125 multi_thr_md5 = md5_; 125 multi_thr_md5 = md5_;
126 md5_.clear(); 126 md5_.clear();
127 127
128 // Compare to check if two vectors are equal. 128 // Compare to check if two vectors are equal.
129 ASSERT_EQ(single_thr_md5, multi_thr_md5); 129 ASSERT_EQ(single_thr_md5, multi_thr_md5);
130 } 130 }
131 131
132 VP9_INSTANTIATE_TEST_CASE( 132 VP9_INSTANTIATE_TEST_CASE(
133 VP9EncoderThreadTest, 133 VPxEncoderThreadTest,
134 ::testing::Values(::libvpx_test::kTwoPassGood, ::libvpx_test::kOnePassGood, 134 ::testing::Values(::libvpx_test::kTwoPassGood, ::libvpx_test::kOnePassGood,
135 ::libvpx_test::kRealTime), 135 ::libvpx_test::kRealTime),
136 ::testing::Range(1, 9)); 136 ::testing::Range(1, 9));
137
138 VP10_INSTANTIATE_TEST_CASE(
139 VPxEncoderThreadTest,
140 ::testing::Values(::libvpx_test::kTwoPassGood, ::libvpx_test::kOnePassGood),
141 ::testing::Range(1, 3));
137 } // namespace 142 } // namespace
OLDNEW
« no previous file with comments | « source/libvpx/test/vp9_end_to_end_test.cc ('k') | source/libvpx/test/vp9_lossless_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698