| 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 <climits> | 10 #include <climits> |
| 11 #include <vector> | 11 #include <vector> |
| 12 #include "third_party/googletest/src/include/gtest/gtest.h" | 12 #include "third_party/googletest/src/include/gtest/gtest.h" |
| 13 #include "test/codec_factory.h" | 13 #include "test/codec_factory.h" |
| 14 #include "test/encode_test_driver.h" | 14 #include "test/encode_test_driver.h" |
| 15 #include "test/i420_video_source.h" | 15 #include "test/i420_video_source.h" |
| 16 #include "test/util.h" | 16 #include "test/util.h" |
| 17 | 17 |
| 18 namespace { | 18 namespace { |
| 19 | 19 |
| 20 class CpuSpeedTest : public ::libvpx_test::EncoderTest, | 20 class CpuSpeedTest : public ::libvpx_test::EncoderTest, |
| 21 public ::libvpx_test::CodecTestWith2Params< | 21 public ::libvpx_test::CodecTestWith2Params< |
| 22 libvpx_test::TestMode, int> { | 22 libvpx_test::TestMode, int> { |
| 23 protected: | 23 protected: |
| 24 CpuSpeedTest() : EncoderTest(GET_PARAM(0)) {} | 24 CpuSpeedTest() : EncoderTest(GET_PARAM(0)) {} |
| 25 virtual ~CpuSpeedTest() {} |
| 25 | 26 |
| 26 virtual void SetUp() { | 27 virtual void SetUp() { |
| 27 InitializeConfig(); | 28 InitializeConfig(); |
| 28 SetMode(GET_PARAM(1)); | 29 SetMode(GET_PARAM(1)); |
| 29 set_cpu_used_ = GET_PARAM(2); | 30 set_cpu_used_ = GET_PARAM(2); |
| 30 } | 31 } |
| 31 | 32 |
| 32 virtual void PreEncodeFrameHook(::libvpx_test::VideoSource *video, | 33 virtual void PreEncodeFrameHook(::libvpx_test::VideoSource *video, |
| 33 ::libvpx_test::Encoder *encoder) { | 34 ::libvpx_test::Encoder *encoder) { |
| 34 if (video->frame() == 1) { | 35 if (video->frame() == 1) { |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 // the encoder to producing lots of big partitions which will likely | 73 // the encoder to producing lots of big partitions which will likely |
| 73 // extend into the border and test the border condition. | 74 // extend into the border and test the border condition. |
| 74 cfg_.g_lag_in_frames = 25; | 75 cfg_.g_lag_in_frames = 25; |
| 75 cfg_.rc_2pass_vbr_minsection_pct = 5; | 76 cfg_.rc_2pass_vbr_minsection_pct = 5; |
| 76 cfg_.rc_2pass_vbr_minsection_pct = 2000; | 77 cfg_.rc_2pass_vbr_minsection_pct = 2000; |
| 77 cfg_.rc_target_bitrate = 12000; | 78 cfg_.rc_target_bitrate = 12000; |
| 78 cfg_.rc_max_quantizer = 10; | 79 cfg_.rc_max_quantizer = 10; |
| 79 cfg_.rc_min_quantizer = 0; | 80 cfg_.rc_min_quantizer = 0; |
| 80 | 81 |
| 81 ::libvpx_test::I420VideoSource video("hantro_odd.yuv", 208, 144, 30, 1, 0, | 82 ::libvpx_test::I420VideoSource video("hantro_odd.yuv", 208, 144, 30, 1, 0, |
| 82 40); | 83 20); |
| 83 | 84 |
| 84 ASSERT_NO_FATAL_FAILURE(RunLoop(&video)); | 85 ASSERT_NO_FATAL_FAILURE(RunLoop(&video)); |
| 85 } | 86 } |
| 86 TEST_P(CpuSpeedTest, TestLowBitrate) { | 87 TEST_P(CpuSpeedTest, TestLowBitrate) { |
| 87 // Validate that this clip encodes and decodes without a mismatch | 88 // Validate that this clip encodes and decodes without a mismatch |
| 88 // when passing in a very high min q. This pushes the encoder to producing | 89 // when passing in a very high min q. This pushes the encoder to producing |
| 89 // lots of small partitions which might will test the other condition. | 90 // lots of small partitions which might will test the other condition. |
| 90 | 91 |
| 91 cfg_.g_lag_in_frames = 25; | 92 cfg_.g_lag_in_frames = 25; |
| 92 cfg_.rc_2pass_vbr_minsection_pct = 5; | 93 cfg_.rc_2pass_vbr_minsection_pct = 5; |
| 93 cfg_.rc_2pass_vbr_minsection_pct = 2000; | 94 cfg_.rc_2pass_vbr_minsection_pct = 2000; |
| 94 cfg_.rc_target_bitrate = 200; | 95 cfg_.rc_target_bitrate = 200; |
| 95 cfg_.rc_min_quantizer = 40; | 96 cfg_.rc_min_quantizer = 40; |
| 96 | 97 |
| 97 ::libvpx_test::I420VideoSource video("hantro_odd.yuv", 208, 144, 30, 1, 0, | 98 ::libvpx_test::I420VideoSource video("hantro_odd.yuv", 208, 144, 30, 1, 0, |
| 98 40); | 99 20); |
| 99 | 100 |
| 100 ASSERT_NO_FATAL_FAILURE(RunLoop(&video)); | 101 ASSERT_NO_FATAL_FAILURE(RunLoop(&video)); |
| 101 } | 102 } |
| 102 | 103 |
| 103 using std::tr1::make_tuple; | 104 using std::tr1::make_tuple; |
| 104 | 105 |
| 105 #define VP9_FACTORY \ | 106 #define VP9_FACTORY \ |
| 106 static_cast<const libvpx_test::CodecFactory*> (&libvpx_test::kVP9) | 107 static_cast<const libvpx_test::CodecFactory*> (&libvpx_test::kVP9) |
| 107 | 108 |
| 108 VP9_INSTANTIATE_TEST_CASE( | 109 VP9_INSTANTIATE_TEST_CASE( |
| 109 CpuSpeedTest, | 110 CpuSpeedTest, |
| 110 ::testing::Values(::libvpx_test::kTwoPassGood), | 111 ::testing::Values(::libvpx_test::kTwoPassGood, ::libvpx_test::kOnePassGood), |
| 111 ::testing::Range(0, 5)); | 112 ::testing::Range(0, 8)); |
| 112 } // namespace | 113 } // namespace |
| OLD | NEW |