OLD | NEW |
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 26 matching lines...) Expand all Loading... |
37 frame_number_ = 0; | 37 frame_number_ = 0; |
38 first_drop_ = 0; | 38 first_drop_ = 0; |
39 bits_total_ = 0; | 39 bits_total_ = 0; |
40 duration_ = 0.0; | 40 duration_ = 0.0; |
41 denoiser_offon_test_ = 0; | 41 denoiser_offon_test_ = 0; |
42 denoiser_offon_period_ = -1; | 42 denoiser_offon_period_ = -1; |
43 } | 43 } |
44 | 44 |
45 virtual void PreEncodeFrameHook(::libvpx_test::VideoSource *video, | 45 virtual void PreEncodeFrameHook(::libvpx_test::VideoSource *video, |
46 ::libvpx_test::Encoder *encoder) { | 46 ::libvpx_test::Encoder *encoder) { |
47 if (video->frame() == 1) { | 47 if (video->frame() == 0) |
48 encoder->Control(VP8E_SET_NOISE_SENSITIVITY, denoiser_on_); | 48 encoder->Control(VP8E_SET_NOISE_SENSITIVITY, denoiser_on_); |
49 } | |
50 | 49 |
51 if (denoiser_offon_test_) { | 50 if (denoiser_offon_test_) { |
52 ASSERT_GT(denoiser_offon_period_, 0) | 51 ASSERT_GT(denoiser_offon_period_, 0) |
53 << "denoiser_offon_period_ is not positive."; | 52 << "denoiser_offon_period_ is not positive."; |
54 if ((video->frame() + 1) % denoiser_offon_period_ == 0) { | 53 if ((video->frame() + 1) % denoiser_offon_period_ == 0) { |
55 // Flip denoiser_on_ periodically | 54 // Flip denoiser_on_ periodically |
56 denoiser_on_ ^= 1; | 55 denoiser_on_ ^= 1; |
57 } | 56 } |
58 encoder->Control(VP8E_SET_NOISE_SENSITIVITY, denoiser_on_); | 57 encoder->Control(VP8E_SET_NOISE_SENSITIVITY, denoiser_on_); |
59 } | 58 } |
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
346 layer_id = 1; | 345 layer_id = 1; |
347 } else if ((frame_num - 1) % 2 == 0) { | 346 } else if ((frame_num - 1) % 2 == 0) { |
348 layer_id = 2; | 347 layer_id = 2; |
349 } | 348 } |
350 } | 349 } |
351 return layer_id; | 350 return layer_id; |
352 } | 351 } |
353 | 352 |
354 virtual void PreEncodeFrameHook(::libvpx_test::VideoSource *video, | 353 virtual void PreEncodeFrameHook(::libvpx_test::VideoSource *video, |
355 ::libvpx_test::Encoder *encoder) { | 354 ::libvpx_test::Encoder *encoder) { |
356 if (video->frame() == 1) | 355 if (video->frame() == 0) |
357 encoder->Control(VP8E_SET_CPUUSED, set_cpu_used_); | 356 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) |
361 << "denoiser_offon_period_ is not positive."; | 360 << "denoiser_offon_period_ is not positive."; |
362 if ((video->frame() + 1) % denoiser_offon_period_ == 0) { | 361 if ((video->frame() + 1) % denoiser_offon_period_ == 0) { |
363 // Flip denoiser_on_ periodically | 362 // Flip denoiser_on_ periodically |
364 denoiser_on_ ^= 1; | 363 denoiser_on_ ^= 1; |
365 } | 364 } |
366 } | 365 } |
367 | 366 |
368 encoder->Control(VP9E_SET_NOISE_SENSITIVITY, denoiser_on_); | 367 encoder->Control(VP9E_SET_NOISE_SENSITIVITY, denoiser_on_); |
369 | 368 |
370 if (cfg_.ts_number_layers > 1) { | 369 if (cfg_.ts_number_layers > 1) { |
371 if (video->frame() == 1) { | 370 if (video->frame() == 0) { |
372 encoder->Control(VP9E_SET_SVC, 1); | 371 encoder->Control(VP9E_SET_SVC, 1); |
373 } | 372 } |
374 vpx_svc_layer_id_t layer_id = {0, 0}; | 373 vpx_svc_layer_id_t layer_id = {0, 0}; |
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 = SetLayerId(video->frame(), |
378 cfg_.ts_number_layers); | 377 cfg_.ts_number_layers); |
379 if (video->frame() > 0) { | 378 encoder->Control(VP9E_SET_SVC_LAYER_ID, &layer_id); |
380 encoder->Control(VP9E_SET_SVC_LAYER_ID, &layer_id); | |
381 } | |
382 } | 379 } |
383 const vpx_rational_t tb = video->timebase(); | 380 const vpx_rational_t tb = video->timebase(); |
384 timebase_ = static_cast<double>(tb.num) / tb.den; | 381 timebase_ = static_cast<double>(tb.num) / tb.den; |
385 duration_ = 0; | 382 duration_ = 0; |
386 } | 383 } |
387 | 384 |
388 | 385 |
389 virtual void FramePktHook(const vpx_codec_cx_pkt_t *pkt) { | 386 virtual void FramePktHook(const vpx_codec_cx_pkt_t *pkt) { |
390 // Time since last timestamp = duration. | 387 // Time since last timestamp = duration. |
391 vpx_codec_pts_t duration = pkt->data.frame.pts - last_pts_; | 388 vpx_codec_pts_t duration = pkt->data.frame.pts - last_pts_; |
(...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
737 << " The datarate for the file is greater than target by too much!"; | 734 << " The datarate for the file is greater than target by too much!"; |
738 } | 735 } |
739 #endif // CONFIG_VP9_TEMPORAL_DENOISING | 736 #endif // CONFIG_VP9_TEMPORAL_DENOISING |
740 | 737 |
741 VP8_INSTANTIATE_TEST_CASE(DatarateTestLarge, ALL_TEST_MODES); | 738 VP8_INSTANTIATE_TEST_CASE(DatarateTestLarge, ALL_TEST_MODES); |
742 VP9_INSTANTIATE_TEST_CASE(DatarateTestVP9Large, | 739 VP9_INSTANTIATE_TEST_CASE(DatarateTestVP9Large, |
743 ::testing::Values(::libvpx_test::kOnePassGood, | 740 ::testing::Values(::libvpx_test::kOnePassGood, |
744 ::libvpx_test::kRealTime), | 741 ::libvpx_test::kRealTime), |
745 ::testing::Range(2, 7)); | 742 ::testing::Range(2, 7)); |
746 } // namespace | 743 } // namespace |
OLD | NEW |