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

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

Issue 168343002: libvpx: Pull from upstream (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/deps/third_party/libvpx/
Patch Set: libvpx: Pull from upstream Created 6 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « source/libvpx/test/i420_video_source.h ('k') | source/libvpx/test/subtract_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) 2012 The WebM project authors. All Rights Reserved. 2 * Copyright (c) 2012 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 #include <climits> 10 #include <climits>
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 frame_info_list_.push_back(FrameInfo(pts, img.d_w, img.d_h)); 139 frame_info_list_.push_back(FrameInfo(pts, img.d_w, img.d_h));
140 } 140 }
141 141
142 std::vector< FrameInfo > frame_info_list_; 142 std::vector< FrameInfo > frame_info_list_;
143 }; 143 };
144 144
145 TEST_P(ResizeTest, TestExternalResizeWorks) { 145 TEST_P(ResizeTest, TestExternalResizeWorks) {
146 ResizingVideoSource video; 146 ResizingVideoSource video;
147 ASSERT_NO_FATAL_FAILURE(RunLoop(&video)); 147 ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
148 148
149 for (std::vector<FrameInfo>::iterator info = frame_info_list_.begin(); 149 for (std::vector<FrameInfo>::const_iterator info = frame_info_list_.begin();
150 info != frame_info_list_.end(); ++info) { 150 info != frame_info_list_.end(); ++info) {
151 const vpx_codec_pts_t pts = info->pts; 151 const unsigned int frame = static_cast<unsigned>(info->pts);
152 const unsigned int expected_w = ScaleForFrameNumber(pts, kInitialWidth); 152 const unsigned int expected_w = ScaleForFrameNumber(frame, kInitialWidth);
153 const unsigned int expected_h = ScaleForFrameNumber(pts, kInitialHeight); 153 const unsigned int expected_h = ScaleForFrameNumber(frame, kInitialHeight);
154 154
155 EXPECT_EQ(expected_w, info->w) 155 EXPECT_EQ(expected_w, info->w)
156 << "Frame " << pts << "had unexpected width"; 156 << "Frame " << frame << "had unexpected width";
157 EXPECT_EQ(expected_h, info->h) 157 EXPECT_EQ(expected_h, info->h)
158 << "Frame " << pts << "had unexpected height"; 158 << "Frame " << frame << "had unexpected height";
159 } 159 }
160 } 160 }
161 161
162 const unsigned int kStepDownFrame = 3; 162 const unsigned int kStepDownFrame = 3;
163 const unsigned int kStepUpFrame = 6; 163 const unsigned int kStepUpFrame = 6;
164 164
165 class ResizeInternalTest : public ResizeTest { 165 class ResizeInternalTest : public ResizeTest {
166 protected: 166 protected:
167 #if WRITE_COMPRESSED_STREAM 167 #if WRITE_COMPRESSED_STREAM
168 ResizeInternalTest() 168 ResizeInternalTest()
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 // q picked such that initial keyframe on this clip is ~30dB PSNR 240 // q picked such that initial keyframe on this clip is ~30dB PSNR
241 cfg_.rc_min_quantizer = cfg_.rc_max_quantizer = 48; 241 cfg_.rc_min_quantizer = cfg_.rc_max_quantizer = 48;
242 242
243 // If the number of frames being encoded is smaller than g_lag_in_frames 243 // If the number of frames being encoded is smaller than g_lag_in_frames
244 // the encoded frame is unavailable using the current API. Comparing 244 // the encoded frame is unavailable using the current API. Comparing
245 // frames to detect mismatch would then not be possible. Set 245 // frames to detect mismatch would then not be possible. Set
246 // g_lag_in_frames = 0 to get around this. 246 // g_lag_in_frames = 0 to get around this.
247 cfg_.g_lag_in_frames = 0; 247 cfg_.g_lag_in_frames = 0;
248 ASSERT_NO_FATAL_FAILURE(RunLoop(&video)); 248 ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
249 249
250 for (std::vector<FrameInfo>::iterator info = frame_info_list_.begin(); 250 for (std::vector<FrameInfo>::const_iterator info = frame_info_list_.begin();
251 info != frame_info_list_.end(); ++info) { 251 info != frame_info_list_.end(); ++info) {
252 const vpx_codec_pts_t pts = info->pts; 252 const vpx_codec_pts_t pts = info->pts;
253 if (pts >= kStepDownFrame && pts < kStepUpFrame) { 253 if (pts >= kStepDownFrame && pts < kStepUpFrame) {
254 ASSERT_EQ(282U, info->w) << "Frame " << pts << " had unexpected width"; 254 ASSERT_EQ(282U, info->w) << "Frame " << pts << " had unexpected width";
255 ASSERT_EQ(173U, info->h) << "Frame " << pts << " had unexpected height"; 255 ASSERT_EQ(173U, info->h) << "Frame " << pts << " had unexpected height";
256 } else { 256 } else {
257 EXPECT_EQ(352U, info->w) << "Frame " << pts << " had unexpected width"; 257 EXPECT_EQ(352U, info->w) << "Frame " << pts << " had unexpected width";
258 EXPECT_EQ(288U, info->h) << "Frame " << pts << " had unexpected height"; 258 EXPECT_EQ(288U, info->h) << "Frame " << pts << " had unexpected height";
259 } 259 }
260 } 260 }
261 } 261 }
262 262
263 VP8_INSTANTIATE_TEST_CASE(ResizeTest, ONE_PASS_TEST_MODES); 263 VP8_INSTANTIATE_TEST_CASE(ResizeTest, ONE_PASS_TEST_MODES);
264 VP9_INSTANTIATE_TEST_CASE(ResizeInternalTest, 264 VP9_INSTANTIATE_TEST_CASE(ResizeInternalTest,
265 ::testing::Values(::libvpx_test::kOnePassBest)); 265 ::testing::Values(::libvpx_test::kOnePassBest));
266 } // namespace 266 } // namespace
OLDNEW
« no previous file with comments | « source/libvpx/test/i420_video_source.h ('k') | source/libvpx/test/subtract_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698