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 | 10 |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 nframes_++; | 55 nframes_++; |
56 } | 56 } |
57 | 57 |
58 virtual void PreEncodeFrameHook(libvpx_test::VideoSource *video) { | 58 virtual void PreEncodeFrameHook(libvpx_test::VideoSource *video) { |
59 frame_flags_ &= ~(VP8_EFLAG_NO_UPD_LAST | | 59 frame_flags_ &= ~(VP8_EFLAG_NO_UPD_LAST | |
60 VP8_EFLAG_NO_UPD_GF | | 60 VP8_EFLAG_NO_UPD_GF | |
61 VP8_EFLAG_NO_UPD_ARF); | 61 VP8_EFLAG_NO_UPD_ARF); |
62 if (droppable_nframes_ > 0 && | 62 if (droppable_nframes_ > 0 && |
63 (cfg_.g_pass == VPX_RC_LAST_PASS || cfg_.g_pass == VPX_RC_ONE_PASS)) { | 63 (cfg_.g_pass == VPX_RC_LAST_PASS || cfg_.g_pass == VPX_RC_ONE_PASS)) { |
64 for (unsigned int i = 0; i < droppable_nframes_; ++i) { | 64 for (unsigned int i = 0; i < droppable_nframes_; ++i) { |
65 if (droppable_frames_[i] == nframes_) { | 65 if (droppable_frames_[i] == video->frame()) { |
66 std::cout << " Encoding droppable frame: " | 66 std::cout << " Encoding droppable frame: " |
67 << droppable_frames_[i] << "\n"; | 67 << droppable_frames_[i] << "\n"; |
68 frame_flags_ |= (VP8_EFLAG_NO_UPD_LAST | | 68 frame_flags_ |= (VP8_EFLAG_NO_UPD_LAST | |
69 VP8_EFLAG_NO_UPD_GF | | 69 VP8_EFLAG_NO_UPD_GF | |
70 VP8_EFLAG_NO_UPD_ARF); | 70 VP8_EFLAG_NO_UPD_ARF); |
71 return; | 71 return; |
72 } | 72 } |
73 } | 73 } |
74 } | 74 } |
75 } | 75 } |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 unsigned int mismatch_nframes_; | 141 unsigned int mismatch_nframes_; |
142 unsigned int error_frames_[kMaxErrorFrames]; | 142 unsigned int error_frames_[kMaxErrorFrames]; |
143 unsigned int droppable_frames_[kMaxDroppableFrames]; | 143 unsigned int droppable_frames_[kMaxDroppableFrames]; |
144 libvpx_test::TestMode encoding_mode_; | 144 libvpx_test::TestMode encoding_mode_; |
145 }; | 145 }; |
146 | 146 |
147 TEST_P(ErrorResilienceTest, OnVersusOff) { | 147 TEST_P(ErrorResilienceTest, OnVersusOff) { |
148 const vpx_rational timebase = { 33333333, 1000000000 }; | 148 const vpx_rational timebase = { 33333333, 1000000000 }; |
149 cfg_.g_timebase = timebase; | 149 cfg_.g_timebase = timebase; |
150 cfg_.rc_target_bitrate = 2000; | 150 cfg_.rc_target_bitrate = 2000; |
151 cfg_.g_lag_in_frames = 25; | 151 cfg_.g_lag_in_frames = 10; |
152 | 152 |
153 init_flags_ = VPX_CODEC_USE_PSNR; | 153 init_flags_ = VPX_CODEC_USE_PSNR; |
154 | 154 |
155 libvpx_test::I420VideoSource video("hantro_collage_w352h288.yuv", 352, 288, | 155 libvpx_test::I420VideoSource video("hantro_collage_w352h288.yuv", 352, 288, |
156 timebase.den, timebase.num, 0, 30); | 156 timebase.den, timebase.num, 0, 30); |
157 | 157 |
158 // Error resilient mode OFF. | 158 // Error resilient mode OFF. |
159 cfg_.g_error_resilient = 0; | 159 cfg_.g_error_resilient = 0; |
160 ASSERT_NO_FATAL_FAILURE(RunLoop(&video)); | 160 ASSERT_NO_FATAL_FAILURE(RunLoop(&video)); |
161 const double psnr_resilience_off = GetAveragePsnr(); | 161 const double psnr_resilience_off = GetAveragePsnr(); |
(...skipping 10 matching lines...) Expand all Loading... |
172 const double psnr_ratio = psnr_resilience_on / psnr_resilience_off; | 172 const double psnr_ratio = psnr_resilience_on / psnr_resilience_off; |
173 EXPECT_GE(psnr_ratio, 0.9); | 173 EXPECT_GE(psnr_ratio, 0.9); |
174 EXPECT_LE(psnr_ratio, 1.1); | 174 EXPECT_LE(psnr_ratio, 1.1); |
175 } | 175 } |
176 } | 176 } |
177 | 177 |
178 TEST_P(ErrorResilienceTest, DropFramesWithoutRecovery) { | 178 TEST_P(ErrorResilienceTest, DropFramesWithoutRecovery) { |
179 const vpx_rational timebase = { 33333333, 1000000000 }; | 179 const vpx_rational timebase = { 33333333, 1000000000 }; |
180 cfg_.g_timebase = timebase; | 180 cfg_.g_timebase = timebase; |
181 cfg_.rc_target_bitrate = 500; | 181 cfg_.rc_target_bitrate = 500; |
| 182 // FIXME(debargha): Fix this to work for any lag. |
| 183 // Currently this test only works for lag = 0 |
| 184 cfg_.g_lag_in_frames = 0; |
182 | 185 |
183 init_flags_ = VPX_CODEC_USE_PSNR; | 186 init_flags_ = VPX_CODEC_USE_PSNR; |
184 | 187 |
185 libvpx_test::I420VideoSource video("hantro_collage_w352h288.yuv", 352, 288, | 188 libvpx_test::I420VideoSource video("hantro_collage_w352h288.yuv", 352, 288, |
186 timebase.den, timebase.num, 0, 30); | 189 timebase.den, timebase.num, 0, 30); |
187 | 190 |
188 // Error resilient mode ON. | 191 // Error resilient mode ON. |
189 cfg_.g_error_resilient = 1; | 192 cfg_.g_error_resilient = 1; |
190 | 193 |
191 // Set an arbitrary set of error frames same as droppable frames | 194 // Set an arbitrary set of error frames same as droppable frames |
(...skipping 29 matching lines...) Expand all Loading... |
221 std::cout << " Mismatch PSNR: " | 224 std::cout << " Mismatch PSNR: " |
222 << psnr_resilience_mismatch << "\n"; | 225 << psnr_resilience_mismatch << "\n"; |
223 EXPECT_GT(psnr_resilience_mismatch, 20.0); | 226 EXPECT_GT(psnr_resilience_mismatch, 20.0); |
224 #endif | 227 #endif |
225 } | 228 } |
226 | 229 |
227 VP8_INSTANTIATE_TEST_CASE(ErrorResilienceTest, ONE_PASS_TEST_MODES); | 230 VP8_INSTANTIATE_TEST_CASE(ErrorResilienceTest, ONE_PASS_TEST_MODES); |
228 VP9_INSTANTIATE_TEST_CASE(ErrorResilienceTest, ONE_PASS_TEST_MODES); | 231 VP9_INSTANTIATE_TEST_CASE(ErrorResilienceTest, ONE_PASS_TEST_MODES); |
229 | 232 |
230 } // namespace | 233 } // namespace |
OLD | NEW |