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

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

Issue 181493009: libvpx: Pull from upstream (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/deps/third_party/libvpx/
Patch Set: Created 6 years, 9 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/dct32x32_test.cc ('k') | source/libvpx/test/fdct4x4_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) 2013 The WebM project authors. All Rights Reserved. 2 * Copyright (c) 2013 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
11 #include "third_party/googletest/src/include/gtest/gtest.h" 11 #include "third_party/googletest/src/include/gtest/gtest.h"
12 #include "test/codec_factory.h" 12 #include "test/codec_factory.h"
13 #include "test/encode_test_driver.h" 13 #include "test/encode_test_driver.h"
14 #include "test/i420_video_source.h" 14 #include "test/i420_video_source.h"
15 #include "test/util.h" 15 #include "test/util.h"
16 16
17 namespace { 17 namespace {
18 18
19 const int kMaxErrorFrames = 8; 19 const int kMaxErrorFrames = 12;
20 const int kMaxDroppableFrames = 8; 20 const int kMaxDroppableFrames = 12;
21 21
22 class ErrorResilienceTest : public ::libvpx_test::EncoderTest, 22 class ErrorResilienceTest : public ::libvpx_test::EncoderTest,
23 public ::libvpx_test::CodecTestWithParam<libvpx_test::TestMode> { 23 public ::libvpx_test::CodecTestWithParam<libvpx_test::TestMode> {
24 protected: 24 protected:
25 ErrorResilienceTest() : EncoderTest(GET_PARAM(0)), 25 ErrorResilienceTest() : EncoderTest(GET_PARAM(0)),
26 psnr_(0.0), 26 psnr_(0.0),
27 nframes_(0), 27 nframes_(0),
28 mismatch_psnr_(0.0), 28 mismatch_psnr_(0.0),
29 mismatch_nframes_(0), 29 mismatch_nframes_(0),
30 encoding_mode_(GET_PARAM(1)) { 30 encoding_mode_(GET_PARAM(1)) {
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 EXPECT_GT(psnr_resilience_on, 25.0); 168 EXPECT_GT(psnr_resilience_on, 25.0);
169 169
170 // Test that turning on error resilient mode hurts by 10% at most. 170 // Test that turning on error resilient mode hurts by 10% at most.
171 if (psnr_resilience_off > 0.0) { 171 if (psnr_resilience_off > 0.0) {
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 // Check for successful decoding and no encoder/decoder mismatch
179 // if we lose (i.e., drop before decoding) a set of droppable
180 // frames (i.e., frames that don't update any reference buffers).
181 // Check both isolated and consecutive loss.
178 TEST_P(ErrorResilienceTest, DropFramesWithoutRecovery) { 182 TEST_P(ErrorResilienceTest, DropFramesWithoutRecovery) {
179 const vpx_rational timebase = { 33333333, 1000000000 }; 183 const vpx_rational timebase = { 33333333, 1000000000 };
180 cfg_.g_timebase = timebase; 184 cfg_.g_timebase = timebase;
181 cfg_.rc_target_bitrate = 500; 185 cfg_.rc_target_bitrate = 500;
182 // FIXME(debargha): Fix this to work for any lag. 186 // FIXME(debargha): Fix this to work for any lag.
183 // Currently this test only works for lag = 0 187 // Currently this test only works for lag = 0
184 cfg_.g_lag_in_frames = 0; 188 cfg_.g_lag_in_frames = 0;
185 189
186 init_flags_ = VPX_CODEC_USE_PSNR; 190 init_flags_ = VPX_CODEC_USE_PSNR;
187 191
188 libvpx_test::I420VideoSource video("hantro_collage_w352h288.yuv", 352, 288, 192 libvpx_test::I420VideoSource video("hantro_collage_w352h288.yuv", 352, 288,
189 timebase.den, timebase.num, 0, 30); 193 timebase.den, timebase.num, 0, 40);
190 194
191 // Error resilient mode ON. 195 // Error resilient mode ON.
192 cfg_.g_error_resilient = 1; 196 cfg_.g_error_resilient = 1;
197 cfg_.kf_mode = VPX_KF_DISABLED;
193 198
194 // Set an arbitrary set of error frames same as droppable frames 199 // Set an arbitrary set of error frames same as droppable frames.
195 unsigned int num_droppable_frames = 2; 200 // In addition to isolated loss/drop, add a long consecutive series
196 unsigned int droppable_frame_list[] = {5, 16}; 201 // (of size 9) of dropped frames.
202 unsigned int num_droppable_frames = 11;
203 unsigned int droppable_frame_list[] = {5, 16, 22, 23, 24, 25, 26, 27, 28,
204 29, 30};
197 SetDroppableFrames(num_droppable_frames, droppable_frame_list); 205 SetDroppableFrames(num_droppable_frames, droppable_frame_list);
198 SetErrorFrames(num_droppable_frames, droppable_frame_list); 206 SetErrorFrames(num_droppable_frames, droppable_frame_list);
199 ASSERT_NO_FATAL_FAILURE(RunLoop(&video)); 207 ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
200 // Test that no mismatches have been found 208 // Test that no mismatches have been found
201 std::cout << " Mismatch frames: " 209 std::cout << " Mismatch frames: "
202 << GetMismatchFrames() << "\n"; 210 << GetMismatchFrames() << "\n";
203 EXPECT_EQ(GetMismatchFrames(), (unsigned int) 0); 211 EXPECT_EQ(GetMismatchFrames(), (unsigned int) 0);
204 212
205 // reset previously set error/droppable frames 213 // Reset previously set of error/droppable frames.
206 Reset(); 214 Reset();
207 215
208 #if 0 216 #if 0
209 // TODO(jkoleszar): This test is disabled for the time being as too 217 // TODO(jkoleszar): This test is disabled for the time being as too
210 // sensitive. It's not clear how to set a reasonable threshold for 218 // sensitive. It's not clear how to set a reasonable threshold for
211 // this behavior. 219 // this behavior.
212 220
213 // Now set an arbitrary set of error frames that are non-droppable 221 // Now set an arbitrary set of error frames that are non-droppable
214 unsigned int num_error_frames = 3; 222 unsigned int num_error_frames = 3;
215 unsigned int error_frame_list[] = {3, 10, 20}; 223 unsigned int error_frame_list[] = {3, 10, 20};
216 SetErrorFrames(num_error_frames, error_frame_list); 224 SetErrorFrames(num_error_frames, error_frame_list);
217 ASSERT_NO_FATAL_FAILURE(RunLoop(&video)); 225 ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
218 226
219 // Test that dropping an arbitrary set of inter frames does not hurt too much 227 // Test that dropping an arbitrary set of inter frames does not hurt too much
220 // Note the Average Mismatch PSNR is the average of the PSNR between 228 // Note the Average Mismatch PSNR is the average of the PSNR between
221 // decoded frame and encoder's version of the same frame for all frames 229 // decoded frame and encoder's version of the same frame for all frames
222 // with mismatch. 230 // with mismatch.
223 const double psnr_resilience_mismatch = GetAverageMismatchPsnr(); 231 const double psnr_resilience_mismatch = GetAverageMismatchPsnr();
224 std::cout << " Mismatch PSNR: " 232 std::cout << " Mismatch PSNR: "
225 << psnr_resilience_mismatch << "\n"; 233 << psnr_resilience_mismatch << "\n";
226 EXPECT_GT(psnr_resilience_mismatch, 20.0); 234 EXPECT_GT(psnr_resilience_mismatch, 20.0);
227 #endif 235 #endif
228 } 236 }
229 237
230 VP8_INSTANTIATE_TEST_CASE(ErrorResilienceTest, ONE_PASS_TEST_MODES); 238 VP8_INSTANTIATE_TEST_CASE(ErrorResilienceTest, ONE_PASS_TEST_MODES);
231 VP9_INSTANTIATE_TEST_CASE(ErrorResilienceTest, ONE_PASS_TEST_MODES); 239 VP9_INSTANTIATE_TEST_CASE(ErrorResilienceTest, ONE_PASS_TEST_MODES);
232 240
233 } // namespace 241 } // namespace
OLDNEW
« no previous file with comments | « source/libvpx/test/dct32x32_test.cc ('k') | source/libvpx/test/fdct4x4_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698