Jim Bankoski | 533470c | 2012-10-29 19:54:06 -0700 | [diff] [blame] | 1 | /* |
Yaowu Xu | 2ab7ff0 | 2016-09-02 12:04:54 -0700 | [diff] [blame] | 2 | * Copyright (c) 2016, Alliance for Open Media. All rights reserved |
Jim Bankoski | 533470c | 2012-10-29 19:54:06 -0700 | [diff] [blame] | 3 | * |
Yaowu Xu | 2ab7ff0 | 2016-09-02 12:04:54 -0700 | [diff] [blame] | 4 | * This source code is subject to the terms of the BSD 2 Clause License and |
| 5 | * the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License |
| 6 | * was not distributed with this source code in the LICENSE file, you can |
| 7 | * obtain it at www.aomedia.org/license/software. If the Alliance for Open |
| 8 | * Media Patent License 1.0 was not distributed with this source code in the |
| 9 | * PATENTS file, you can obtain it at www.aomedia.org/license/patent. |
| 10 | */ |
| 11 | |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 12 | #include "./aom_config.h" |
John Koleszar | 706cafe | 2013-01-18 11:51:12 -0800 | [diff] [blame] | 13 | #include "third_party/googletest/src/include/gtest/gtest.h" |
| 14 | #include "test/codec_factory.h" |
Jim Bankoski | 533470c | 2012-10-29 19:54:06 -0700 | [diff] [blame] | 15 | #include "test/encode_test_driver.h" |
| 16 | #include "test/i420_video_source.h" |
John Koleszar | 706cafe | 2013-01-18 11:51:12 -0800 | [diff] [blame] | 17 | #include "test/util.h" |
Alex Converse | f5949fa | 2014-01-17 13:52:23 -0800 | [diff] [blame] | 18 | #include "test/y4m_video_source.h" |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 19 | #include "aom/aom_codec.h" |
John Koleszar | 706cafe | 2013-01-18 11:51:12 -0800 | [diff] [blame] | 20 | |
Jim Bankoski | 533470c | 2012-10-29 19:54:06 -0700 | [diff] [blame] | 21 | namespace { |
| 22 | |
clang-format | 3a826f1 | 2016-08-11 17:46:05 -0700 | [diff] [blame] | 23 | class DatarateTestLarge |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 24 | : public ::libaom_test::EncoderTest, |
| 25 | public ::libaom_test::CodecTestWith2Params<libaom_test::TestMode, int> { |
John Koleszar | 706cafe | 2013-01-18 11:51:12 -0800 | [diff] [blame] | 26 | public: |
Jim Bankoski | 6505b07 | 2014-03-12 17:20:16 -0700 | [diff] [blame] | 27 | DatarateTestLarge() : EncoderTest(GET_PARAM(0)) {} |
| 28 | |
James Zern | cc73e1f | 2016-08-08 15:09:30 -0700 | [diff] [blame] | 29 | protected: |
Jim Bankoski | 6505b07 | 2014-03-12 17:20:16 -0700 | [diff] [blame] | 30 | virtual ~DatarateTestLarge() {} |
John Koleszar | 706cafe | 2013-01-18 11:51:12 -0800 | [diff] [blame] | 31 | |
Marco Paniconi | b26ce8b | 2013-10-22 11:30:06 -0700 | [diff] [blame] | 32 | virtual void SetUp() { |
| 33 | InitializeConfig(); |
| 34 | SetMode(GET_PARAM(1)); |
| 35 | set_cpu_used_ = GET_PARAM(2); |
| 36 | ResetModel(); |
| 37 | } |
| 38 | |
| 39 | virtual void ResetModel() { |
| 40 | last_pts_ = 0; |
Marco Paniconi | 1b8b8b0 | 2013-12-17 15:45:30 -0800 | [diff] [blame] | 41 | bits_in_buffer_model_ = cfg_.rc_target_bitrate * cfg_.rc_buf_initial_sz; |
Marco Paniconi | b26ce8b | 2013-10-22 11:30:06 -0700 | [diff] [blame] | 42 | frame_number_ = 0; |
Marco Paniconi | 640885d | 2014-02-11 08:48:34 -0800 | [diff] [blame] | 43 | tot_frame_number_ = 0; |
Marco Paniconi | 1b8b8b0 | 2013-12-17 15:45:30 -0800 | [diff] [blame] | 44 | first_drop_ = 0; |
| 45 | num_drops_ = 0; |
JackyChen | a86e6e8 | 2014-09-17 13:54:48 -0700 | [diff] [blame] | 46 | // Denoiser is off by default. |
| 47 | denoiser_on_ = 0; |
James Zern | cc73e1f | 2016-08-08 15:09:30 -0700 | [diff] [blame] | 48 | bits_total_ = 0; |
JackyChen | e82a3b2 | 2015-01-07 16:34:25 -0800 | [diff] [blame] | 49 | denoiser_offon_test_ = 0; |
| 50 | denoiser_offon_period_ = -1; |
Marco Paniconi | 4864ab2 | 2014-02-06 09:23:17 -0800 | [diff] [blame] | 51 | } |
| 52 | |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 53 | virtual void PreEncodeFrameHook(::libaom_test::VideoSource *video, |
| 54 | ::libaom_test::Encoder *encoder) { |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 55 | if (video->frame() == 0) encoder->Control(AOME_SET_CPUUSED, set_cpu_used_); |
Jingning Han | 5b860e1 | 2015-01-06 10:04:56 -0800 | [diff] [blame] | 56 | |
JackyChen | e82a3b2 | 2015-01-07 16:34:25 -0800 | [diff] [blame] | 57 | if (denoiser_offon_test_) { |
| 58 | ASSERT_GT(denoiser_offon_period_, 0) |
| 59 | << "denoiser_offon_period_ is not positive."; |
| 60 | if ((video->frame() + 1) % denoiser_offon_period_ == 0) { |
| 61 | // Flip denoiser_on_ periodically |
| 62 | denoiser_on_ ^= 1; |
| 63 | } |
| 64 | } |
| 65 | |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 66 | encoder->Control(AV1E_SET_NOISE_SENSITIVITY, denoiser_on_); |
Jingning Han | 5b860e1 | 2015-01-06 10:04:56 -0800 | [diff] [blame] | 67 | |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 68 | const aom_rational_t tb = video->timebase(); |
Marco Paniconi | e078c3d | 2013-10-02 17:13:59 -0700 | [diff] [blame] | 69 | timebase_ = static_cast<double>(tb.num) / tb.den; |
| 70 | duration_ = 0; |
| 71 | } |
| 72 | |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 73 | virtual void FramePktHook(const aom_codec_cx_pkt_t *pkt) { |
Marco Paniconi | 1b8b8b0 | 2013-12-17 15:45:30 -0800 | [diff] [blame] | 74 | // Time since last timestamp = duration. |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 75 | aom_codec_pts_t duration = pkt->data.frame.pts - last_pts_; |
Marco Paniconi | 1b8b8b0 | 2013-12-17 15:45:30 -0800 | [diff] [blame] | 76 | |
Marco Paniconi | 640885d | 2014-02-11 08:48:34 -0800 | [diff] [blame] | 77 | if (duration > 1) { |
| 78 | // If first drop not set and we have a drop set it to this time. |
clang-format | 3a826f1 | 2016-08-11 17:46:05 -0700 | [diff] [blame] | 79 | if (!first_drop_) first_drop_ = last_pts_ + 1; |
Marco Paniconi | 640885d | 2014-02-11 08:48:34 -0800 | [diff] [blame] | 80 | // Update the number of frame drops. |
| 81 | num_drops_ += static_cast<int>(duration - 1); |
| 82 | // Update counter for total number of frames (#frames input to encoder). |
| 83 | // Needed for setting the proper layer_id below. |
| 84 | tot_frame_number_ += static_cast<int>(duration - 1); |
| 85 | } |
| 86 | |
Marco Paniconi | 1b8b8b0 | 2013-12-17 15:45:30 -0800 | [diff] [blame] | 87 | // Add to the buffer the bits we'd expect from a constant bitrate server. |
James Zern | cac85f8 | 2013-12-18 16:58:43 -0800 | [diff] [blame] | 88 | bits_in_buffer_model_ += static_cast<int64_t>( |
| 89 | duration * timebase_ * cfg_.rc_target_bitrate * 1000); |
Marco Paniconi | 1b8b8b0 | 2013-12-17 15:45:30 -0800 | [diff] [blame] | 90 | |
| 91 | // Buffer should not go negative. |
| 92 | ASSERT_GE(bits_in_buffer_model_, 0) << "Buffer Underrun at frame " |
clang-format | 3a826f1 | 2016-08-11 17:46:05 -0700 | [diff] [blame] | 93 | << pkt->data.frame.pts; |
Marco Paniconi | 1b8b8b0 | 2013-12-17 15:45:30 -0800 | [diff] [blame] | 94 | |
James Zern | cac85f8 | 2013-12-18 16:58:43 -0800 | [diff] [blame] | 95 | const size_t frame_size_in_bits = pkt->data.frame.sz * 8; |
Marco Paniconi | 4864ab2 | 2014-02-06 09:23:17 -0800 | [diff] [blame] | 96 | |
James Zern | cc73e1f | 2016-08-08 15:09:30 -0700 | [diff] [blame] | 97 | // Update the total encoded bits. |
| 98 | bits_total_ += frame_size_in_bits; |
Marco Paniconi | 1b8b8b0 | 2013-12-17 15:45:30 -0800 | [diff] [blame] | 99 | |
Marco Paniconi | e078c3d | 2013-10-02 17:13:59 -0700 | [diff] [blame] | 100 | // Update the most recent pts. |
| 101 | last_pts_ = pkt->data.frame.pts; |
| 102 | ++frame_number_; |
Marco Paniconi | 640885d | 2014-02-11 08:48:34 -0800 | [diff] [blame] | 103 | ++tot_frame_number_; |
Marco Paniconi | e078c3d | 2013-10-02 17:13:59 -0700 | [diff] [blame] | 104 | } |
| 105 | |
| 106 | virtual void EndPassHook(void) { |
James Zern | cc73e1f | 2016-08-08 15:09:30 -0700 | [diff] [blame] | 107 | duration_ = (last_pts_ + 1) * timebase_; |
| 108 | // Effective file datarate: |
| 109 | effective_datarate_ = (bits_total_ / 1000.0) / duration_; |
Marco Paniconi | e078c3d | 2013-10-02 17:13:59 -0700 | [diff] [blame] | 110 | } |
Marco Paniconi | b26ce8b | 2013-10-22 11:30:06 -0700 | [diff] [blame] | 111 | |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 112 | aom_codec_pts_t last_pts_; |
Marco Paniconi | b26ce8b | 2013-10-22 11:30:06 -0700 | [diff] [blame] | 113 | double timebase_; |
Marco Paniconi | 640885d | 2014-02-11 08:48:34 -0800 | [diff] [blame] | 114 | int frame_number_; // Counter for number of non-dropped/encoded frames. |
| 115 | int tot_frame_number_; // Counter for total number of input frames. |
James Zern | cc73e1f | 2016-08-08 15:09:30 -0700 | [diff] [blame] | 116 | int64_t bits_total_; |
Marco Paniconi | b26ce8b | 2013-10-22 11:30:06 -0700 | [diff] [blame] | 117 | double duration_; |
James Zern | cc73e1f | 2016-08-08 15:09:30 -0700 | [diff] [blame] | 118 | double effective_datarate_; |
Marco Paniconi | b26ce8b | 2013-10-22 11:30:06 -0700 | [diff] [blame] | 119 | int set_cpu_used_; |
James Zern | cac85f8 | 2013-12-18 16:58:43 -0800 | [diff] [blame] | 120 | int64_t bits_in_buffer_model_; |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 121 | aom_codec_pts_t first_drop_; |
Marco Paniconi | 1b8b8b0 | 2013-12-17 15:45:30 -0800 | [diff] [blame] | 122 | int num_drops_; |
JackyChen | a86e6e8 | 2014-09-17 13:54:48 -0700 | [diff] [blame] | 123 | int denoiser_on_; |
JackyChen | e82a3b2 | 2015-01-07 16:34:25 -0800 | [diff] [blame] | 124 | int denoiser_offon_test_; |
| 125 | int denoiser_offon_period_; |
Marco Paniconi | e078c3d | 2013-10-02 17:13:59 -0700 | [diff] [blame] | 126 | }; |
| 127 | |
Marco | 75d5517 | 2016-05-25 14:19:01 -0700 | [diff] [blame] | 128 | // Check basic rate targeting for VBR mode. |
James Zern | cc73e1f | 2016-08-08 15:09:30 -0700 | [diff] [blame] | 129 | TEST_P(DatarateTestLarge, BasicRateTargetingVBR) { |
Marco | 75d5517 | 2016-05-25 14:19:01 -0700 | [diff] [blame] | 130 | cfg_.rc_min_quantizer = 0; |
| 131 | cfg_.rc_max_quantizer = 63; |
| 132 | cfg_.g_error_resilient = 0; |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 133 | cfg_.rc_end_usage = AOM_VBR; |
Marco | 75d5517 | 2016-05-25 14:19:01 -0700 | [diff] [blame] | 134 | cfg_.g_lag_in_frames = 0; |
| 135 | |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 136 | ::libaom_test::I420VideoSource video("hantro_collage_w352h288.yuv", 352, 288, |
Marco | 75d5517 | 2016-05-25 14:19:01 -0700 | [diff] [blame] | 137 | 30, 1, 0, 300); |
| 138 | for (int i = 400; i <= 800; i += 400) { |
| 139 | cfg_.rc_target_bitrate = i; |
| 140 | ResetModel(); |
| 141 | ASSERT_NO_FATAL_FAILURE(RunLoop(&video)); |
James Zern | cc73e1f | 2016-08-08 15:09:30 -0700 | [diff] [blame] | 142 | ASSERT_GE(effective_datarate_, cfg_.rc_target_bitrate * 0.75) |
Marco | 75d5517 | 2016-05-25 14:19:01 -0700 | [diff] [blame] | 143 | << " The datarate for the file is lower than target by too much!"; |
James Zern | cc73e1f | 2016-08-08 15:09:30 -0700 | [diff] [blame] | 144 | ASSERT_LE(effective_datarate_, cfg_.rc_target_bitrate * 1.25) |
Marco | 75d5517 | 2016-05-25 14:19:01 -0700 | [diff] [blame] | 145 | << " The datarate for the file is greater than target by too much!"; |
| 146 | } |
| 147 | } |
| 148 | |
| 149 | // Check basic rate targeting for CBR, |
James Zern | cc73e1f | 2016-08-08 15:09:30 -0700 | [diff] [blame] | 150 | TEST_P(DatarateTestLarge, BasicRateTargeting) { |
Marco Paniconi | 1b8b8b0 | 2013-12-17 15:45:30 -0800 | [diff] [blame] | 151 | cfg_.rc_buf_initial_sz = 500; |
| 152 | cfg_.rc_buf_optimal_sz = 500; |
| 153 | cfg_.rc_buf_sz = 1000; |
| 154 | cfg_.rc_dropframe_thresh = 1; |
Marco Paniconi | e078c3d | 2013-10-02 17:13:59 -0700 | [diff] [blame] | 155 | cfg_.rc_min_quantizer = 0; |
| 156 | cfg_.rc_max_quantizer = 63; |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 157 | cfg_.rc_end_usage = AOM_CBR; |
Marco Paniconi | 4864ab2 | 2014-02-06 09:23:17 -0800 | [diff] [blame] | 158 | cfg_.g_lag_in_frames = 0; |
Marco Paniconi | e078c3d | 2013-10-02 17:13:59 -0700 | [diff] [blame] | 159 | |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 160 | ::libaom_test::I420VideoSource video("hantro_collage_w352h288.yuv", 352, 288, |
Marco Paniconi | e078c3d | 2013-10-02 17:13:59 -0700 | [diff] [blame] | 161 | 30, 1, 0, 140); |
Marco Paniconi | b26ce8b | 2013-10-22 11:30:06 -0700 | [diff] [blame] | 162 | for (int i = 150; i < 800; i += 200) { |
Marco Paniconi | e078c3d | 2013-10-02 17:13:59 -0700 | [diff] [blame] | 163 | cfg_.rc_target_bitrate = i; |
| 164 | ResetModel(); |
| 165 | ASSERT_NO_FATAL_FAILURE(RunLoop(&video)); |
James Zern | cc73e1f | 2016-08-08 15:09:30 -0700 | [diff] [blame] | 166 | ASSERT_GE(effective_datarate_, cfg_.rc_target_bitrate * 0.85) |
Marco Paniconi | 4864ab2 | 2014-02-06 09:23:17 -0800 | [diff] [blame] | 167 | << " The datarate for the file is lower than target by too much!"; |
James Zern | cc73e1f | 2016-08-08 15:09:30 -0700 | [diff] [blame] | 168 | ASSERT_LE(effective_datarate_, cfg_.rc_target_bitrate * 1.15) |
Marco Paniconi | 4864ab2 | 2014-02-06 09:23:17 -0800 | [diff] [blame] | 169 | << " The datarate for the file is greater than target by too much!"; |
Marco Paniconi | e078c3d | 2013-10-02 17:13:59 -0700 | [diff] [blame] | 170 | } |
| 171 | } |
| 172 | |
Marco | 75d5517 | 2016-05-25 14:19:01 -0700 | [diff] [blame] | 173 | // Check basic rate targeting for CBR. |
James Zern | cc73e1f | 2016-08-08 15:09:30 -0700 | [diff] [blame] | 174 | TEST_P(DatarateTestLarge, BasicRateTargeting444) { |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 175 | ::libaom_test::Y4mVideoSource video("rush_hour_444.y4m", 0, 140); |
Alex Converse | f5949fa | 2014-01-17 13:52:23 -0800 | [diff] [blame] | 176 | |
| 177 | cfg_.g_profile = 1; |
| 178 | cfg_.g_timebase = video.timebase(); |
| 179 | |
| 180 | cfg_.rc_buf_initial_sz = 500; |
| 181 | cfg_.rc_buf_optimal_sz = 500; |
| 182 | cfg_.rc_buf_sz = 1000; |
| 183 | cfg_.rc_dropframe_thresh = 1; |
| 184 | cfg_.rc_min_quantizer = 0; |
| 185 | cfg_.rc_max_quantizer = 63; |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 186 | cfg_.rc_end_usage = AOM_CBR; |
Alex Converse | f5949fa | 2014-01-17 13:52:23 -0800 | [diff] [blame] | 187 | |
| 188 | for (int i = 250; i < 900; i += 200) { |
| 189 | cfg_.rc_target_bitrate = i; |
| 190 | ResetModel(); |
| 191 | ASSERT_NO_FATAL_FAILURE(RunLoop(&video)); |
| 192 | ASSERT_GE(static_cast<double>(cfg_.rc_target_bitrate), |
James Zern | cc73e1f | 2016-08-08 15:09:30 -0700 | [diff] [blame] | 193 | effective_datarate_ * 0.85) |
Alex Converse | f5949fa | 2014-01-17 13:52:23 -0800 | [diff] [blame] | 194 | << " The datarate for the file exceeds the target by too much!"; |
| 195 | ASSERT_LE(static_cast<double>(cfg_.rc_target_bitrate), |
James Zern | cc73e1f | 2016-08-08 15:09:30 -0700 | [diff] [blame] | 196 | effective_datarate_ * 1.15) |
Alex Converse | f5949fa | 2014-01-17 13:52:23 -0800 | [diff] [blame] | 197 | << " The datarate for the file missed the target!" |
clang-format | 3a826f1 | 2016-08-11 17:46:05 -0700 | [diff] [blame] | 198 | << cfg_.rc_target_bitrate << " " << effective_datarate_; |
Alex Converse | f5949fa | 2014-01-17 13:52:23 -0800 | [diff] [blame] | 199 | } |
| 200 | } |
Alex Converse | f5949fa | 2014-01-17 13:52:23 -0800 | [diff] [blame] | 201 | |
Marco Paniconi | 1b8b8b0 | 2013-12-17 15:45:30 -0800 | [diff] [blame] | 202 | // Check that (1) the first dropped frame gets earlier and earlier |
| 203 | // as the drop frame threshold is increased, and (2) that the total number of |
| 204 | // frame drops does not decrease as we increase frame drop threshold. |
| 205 | // Use a lower qp-max to force some frame drops. |
James Zern | cc73e1f | 2016-08-08 15:09:30 -0700 | [diff] [blame] | 206 | TEST_P(DatarateTestLarge, ChangingDropFrameThresh) { |
Marco Paniconi | 1b8b8b0 | 2013-12-17 15:45:30 -0800 | [diff] [blame] | 207 | cfg_.rc_buf_initial_sz = 500; |
| 208 | cfg_.rc_buf_optimal_sz = 500; |
| 209 | cfg_.rc_buf_sz = 1000; |
| 210 | cfg_.rc_undershoot_pct = 20; |
| 211 | cfg_.rc_undershoot_pct = 20; |
| 212 | cfg_.rc_dropframe_thresh = 10; |
| 213 | cfg_.rc_min_quantizer = 0; |
| 214 | cfg_.rc_max_quantizer = 50; |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 215 | cfg_.rc_end_usage = AOM_CBR; |
Marco Paniconi | 1b8b8b0 | 2013-12-17 15:45:30 -0800 | [diff] [blame] | 216 | cfg_.rc_target_bitrate = 200; |
Marco Paniconi | 4864ab2 | 2014-02-06 09:23:17 -0800 | [diff] [blame] | 217 | cfg_.g_lag_in_frames = 0; |
James Zern | 4b00f0e | 2016-02-26 15:14:46 -0800 | [diff] [blame] | 218 | // TODO(marpan): Investigate datarate target failures with a smaller keyframe |
| 219 | // interval (128). |
| 220 | cfg_.kf_max_dist = 9999; |
Marco Paniconi | 1b8b8b0 | 2013-12-17 15:45:30 -0800 | [diff] [blame] | 221 | |
Yaowu Xu | c27fc14 | 2016-08-22 16:08:15 -0700 | [diff] [blame] | 222 | ::libaom_test::I420VideoSource video("hantro_collage_w352h288.yuv", 352, 288, |
Marco Paniconi | 1b8b8b0 | 2013-12-17 15:45:30 -0800 | [diff] [blame] | 223 | 30, 1, 0, 140); |
| 224 | |
| 225 | const int kDropFrameThreshTestStep = 30; |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 226 | aom_codec_pts_t last_drop = 140; |
Marco Paniconi | 1b8b8b0 | 2013-12-17 15:45:30 -0800 | [diff] [blame] | 227 | int last_num_drops = 0; |
| 228 | for (int i = 10; i < 100; i += kDropFrameThreshTestStep) { |
| 229 | cfg_.rc_dropframe_thresh = i; |
| 230 | ResetModel(); |
| 231 | ASSERT_NO_FATAL_FAILURE(RunLoop(&video)); |
James Zern | cc73e1f | 2016-08-08 15:09:30 -0700 | [diff] [blame] | 232 | ASSERT_GE(effective_datarate_, cfg_.rc_target_bitrate * 0.85) |
Marco Paniconi | 4864ab2 | 2014-02-06 09:23:17 -0800 | [diff] [blame] | 233 | << " The datarate for the file is lower than target by too much!"; |
James Zern | cc73e1f | 2016-08-08 15:09:30 -0700 | [diff] [blame] | 234 | ASSERT_LE(effective_datarate_, cfg_.rc_target_bitrate * 1.15) |
Marco Paniconi | 4864ab2 | 2014-02-06 09:23:17 -0800 | [diff] [blame] | 235 | << " The datarate for the file is greater than target by too much!"; |
Marco Paniconi | 1b8b8b0 | 2013-12-17 15:45:30 -0800 | [diff] [blame] | 236 | ASSERT_LE(first_drop_, last_drop) |
| 237 | << " The first dropped frame for drop_thresh " << i |
| 238 | << " > first dropped frame for drop_thresh " |
| 239 | << i - kDropFrameThreshTestStep; |
Marco | cb7b2a4 | 2015-11-03 08:15:04 -0800 | [diff] [blame] | 240 | ASSERT_GE(num_drops_, last_num_drops * 0.85) |
Marco Paniconi | 1b8b8b0 | 2013-12-17 15:45:30 -0800 | [diff] [blame] | 241 | << " The number of dropped frames for drop_thresh " << i |
| 242 | << " < number of dropped frames for drop_thresh " |
| 243 | << i - kDropFrameThreshTestStep; |
| 244 | last_drop = first_drop_; |
| 245 | last_num_drops = num_drops_; |
| 246 | } |
| 247 | } |
| 248 | |
Yaowu Xu | f883b42 | 2016-08-30 14:01:10 -0700 | [diff] [blame] | 249 | AV1_INSTANTIATE_TEST_CASE(DatarateTestLarge, |
| 250 | ::testing::Values(::libaom_test::kOnePassGood, |
| 251 | ::libaom_test::kRealTime), |
| 252 | ::testing::Range(2, 9)); |
Jim Bankoski | 533470c | 2012-10-29 19:54:06 -0700 | [diff] [blame] | 253 | } // namespace |