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

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

Issue 812033011: libvpx: Pull from upstream (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/deps/third_party/libvpx/
Patch Set: Created 5 years, 11 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/convolve_test.cc ('k') | source/libvpx/test/decode_perf_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 "./vpx_config.h" 10 #include "./vpx_config.h"
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
239 frame_number_ = 0; 239 frame_number_ = 0;
240 tot_frame_number_ = 0; 240 tot_frame_number_ = 0;
241 first_drop_ = 0; 241 first_drop_ = 0;
242 num_drops_ = 0; 242 num_drops_ = 0;
243 // Denoiser is off by default. 243 // Denoiser is off by default.
244 denoiser_on_ = 0; 244 denoiser_on_ = 0;
245 // For testing up to 3 layers. 245 // For testing up to 3 layers.
246 for (int i = 0; i < 3; ++i) { 246 for (int i = 0; i < 3; ++i) {
247 bits_total_[i] = 0; 247 bits_total_[i] = 0;
248 } 248 }
249 denoiser_offon_test_ = 0;
250 denoiser_offon_period_ = -1;
249 } 251 }
250 252
251 // 253 //
252 // Frame flags and layer id for temporal layers. 254 // Frame flags and layer id for temporal layers.
253 // 255 //
254 256
255 // For two layers, test pattern is: 257 // For two layers, test pattern is:
256 // 1 3 258 // 1 3
257 // 0 2 ..... 259 // 0 2 .....
258 // For three layers, test pattern is: 260 // For three layers, test pattern is:
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
306 layer_id = 1; 308 layer_id = 1;
307 } else if ((frame_num - 1) % 2 == 0) { 309 } else if ((frame_num - 1) % 2 == 0) {
308 layer_id = 2; 310 layer_id = 2;
309 } 311 }
310 } 312 }
311 return layer_id; 313 return layer_id;
312 } 314 }
313 315
314 virtual void PreEncodeFrameHook(::libvpx_test::VideoSource *video, 316 virtual void PreEncodeFrameHook(::libvpx_test::VideoSource *video,
315 ::libvpx_test::Encoder *encoder) { 317 ::libvpx_test::Encoder *encoder) {
316 if (video->frame() == 1) { 318 if (video->frame() == 1)
317 encoder->Control(VP8E_SET_CPUUSED, set_cpu_used_); 319 encoder->Control(VP8E_SET_CPUUSED, set_cpu_used_);
318 encoder->Control(VP9E_SET_NOISE_SENSITIVITY, denoiser_on_); 320
321 if (denoiser_offon_test_) {
322 ASSERT_GT(denoiser_offon_period_, 0)
323 << "denoiser_offon_period_ is not positive.";
324 if ((video->frame() + 1) % denoiser_offon_period_ == 0) {
325 // Flip denoiser_on_ periodically
326 denoiser_on_ ^= 1;
327 }
319 } 328 }
329
330 encoder->Control(VP9E_SET_NOISE_SENSITIVITY, denoiser_on_);
331
320 if (cfg_.ts_number_layers > 1) { 332 if (cfg_.ts_number_layers > 1) {
321 if (video->frame() == 1) { 333 if (video->frame() == 1) {
322 encoder->Control(VP9E_SET_SVC, 1); 334 encoder->Control(VP9E_SET_SVC, 1);
323 } 335 }
324 vpx_svc_layer_id_t layer_id = {0, 0}; 336 vpx_svc_layer_id_t layer_id = {0, 0};
325 layer_id.spatial_layer_id = 0; 337 layer_id.spatial_layer_id = 0;
326 frame_flags_ = SetFrameFlags(video->frame(), cfg_.ts_number_layers); 338 frame_flags_ = SetFrameFlags(video->frame(), cfg_.ts_number_layers);
327 layer_id.temporal_layer_id = SetLayerId(video->frame(), 339 layer_id.temporal_layer_id = SetLayerId(video->frame(),
328 cfg_.ts_number_layers); 340 cfg_.ts_number_layers);
329 if (video->frame() > 0) { 341 if (video->frame() > 0) {
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
391 int frame_number_; // Counter for number of non-dropped/encoded frames. 403 int frame_number_; // Counter for number of non-dropped/encoded frames.
392 int tot_frame_number_; // Counter for total number of input frames. 404 int tot_frame_number_; // Counter for total number of input frames.
393 int64_t bits_total_[3]; 405 int64_t bits_total_[3];
394 double duration_; 406 double duration_;
395 double effective_datarate_[3]; 407 double effective_datarate_[3];
396 int set_cpu_used_; 408 int set_cpu_used_;
397 int64_t bits_in_buffer_model_; 409 int64_t bits_in_buffer_model_;
398 vpx_codec_pts_t first_drop_; 410 vpx_codec_pts_t first_drop_;
399 int num_drops_; 411 int num_drops_;
400 int denoiser_on_; 412 int denoiser_on_;
413 int denoiser_offon_test_;
414 int denoiser_offon_period_;
401 }; 415 };
402 416
403 // Check basic rate targeting, 417 // Check basic rate targeting,
404 TEST_P(DatarateTestVP9Large, BasicRateTargeting) { 418 TEST_P(DatarateTestVP9Large, BasicRateTargeting) {
405 cfg_.rc_buf_initial_sz = 500; 419 cfg_.rc_buf_initial_sz = 500;
406 cfg_.rc_buf_optimal_sz = 500; 420 cfg_.rc_buf_optimal_sz = 500;
407 cfg_.rc_buf_sz = 1000; 421 cfg_.rc_buf_sz = 1000;
408 cfg_.rc_dropframe_thresh = 1; 422 cfg_.rc_dropframe_thresh = 1;
409 cfg_.rc_min_quantizer = 0; 423 cfg_.rc_min_quantizer = 0;
410 cfg_.rc_max_quantizer = 63; 424 cfg_.rc_max_quantizer = 63;
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
645 cfg_.rc_target_bitrate = 300; 659 cfg_.rc_target_bitrate = 300;
646 ResetModel(); 660 ResetModel();
647 // Turn on the denoiser. 661 // Turn on the denoiser.
648 denoiser_on_ = 1; 662 denoiser_on_ = 1;
649 ASSERT_NO_FATAL_FAILURE(RunLoop(&video)); 663 ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
650 ASSERT_GE(effective_datarate_[0], cfg_.rc_target_bitrate * 0.85) 664 ASSERT_GE(effective_datarate_[0], cfg_.rc_target_bitrate * 0.85)
651 << " The datarate for the file is lower than target by too much!"; 665 << " The datarate for the file is lower than target by too much!";
652 ASSERT_LE(effective_datarate_[0], cfg_.rc_target_bitrate * 1.15) 666 ASSERT_LE(effective_datarate_[0], cfg_.rc_target_bitrate * 1.15)
653 << " The datarate for the file is greater than target by too much!"; 667 << " The datarate for the file is greater than target by too much!";
654 } 668 }
669
670 // Check basic datarate targeting, for a single bitrate, when denoiser is off
671 // and on.
672 TEST_P(DatarateTestVP9Large, DenoiserOffon) {
673 cfg_.rc_buf_initial_sz = 500;
674 cfg_.rc_buf_optimal_sz = 500;
675 cfg_.rc_buf_sz = 1000;
676 cfg_.rc_dropframe_thresh = 1;
677 cfg_.rc_min_quantizer = 2;
678 cfg_.rc_max_quantizer = 56;
679 cfg_.rc_end_usage = VPX_CBR;
680 cfg_.g_lag_in_frames = 0;
681
682 ::libvpx_test::I420VideoSource video("hantro_collage_w352h288.yuv", 352, 288,
683 30, 1, 0, 299);
684
685 // For the temporal denoiser (#if CONFIG_VP9_TEMPORAL_DENOISING),
686 // there is only one denoiser mode: denoiserYonly(which is 1),
687 // but may add more modes in the future.
688 cfg_.rc_target_bitrate = 300;
689 ResetModel();
690 // The denoiser is off by default.
691 denoiser_on_ = 0;
692 // Set the offon test flag.
693 denoiser_offon_test_ = 1;
694 denoiser_offon_period_ = 100;
695 ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
696 ASSERT_GE(effective_datarate_[0], cfg_.rc_target_bitrate * 0.85)
697 << " The datarate for the file is lower than target by too much!";
698 ASSERT_LE(effective_datarate_[0], cfg_.rc_target_bitrate * 1.15)
699 << " The datarate for the file is greater than target by too much!";
700 }
655 #endif // CONFIG_VP9_TEMPORAL_DENOISING 701 #endif // CONFIG_VP9_TEMPORAL_DENOISING
656 702
657 VP8_INSTANTIATE_TEST_CASE(DatarateTestLarge, ALL_TEST_MODES); 703 VP8_INSTANTIATE_TEST_CASE(DatarateTestLarge, ALL_TEST_MODES);
658 VP9_INSTANTIATE_TEST_CASE(DatarateTestVP9Large, 704 VP9_INSTANTIATE_TEST_CASE(DatarateTestVP9Large,
659 ::testing::Values(::libvpx_test::kOnePassGood, 705 ::testing::Values(::libvpx_test::kOnePassGood,
660 ::libvpx_test::kRealTime), 706 ::libvpx_test::kRealTime),
661 ::testing::Range(2, 7)); 707 ::testing::Range(2, 7));
662 } // namespace 708 } // namespace
OLDNEW
« no previous file with comments | « source/libvpx/test/convolve_test.cc ('k') | source/libvpx/test/decode_perf_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698