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

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

Issue 11974002: libvpx: Pull from upstream (Closed) Base URL: svn://chrome-svn/chrome/trunk/deps/third_party/libvpx/
Patch Set: Created 7 years, 11 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/libs.mk ('k') | source/libvpx/test/dct32x32_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) 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 "test/encode_test_driver.h" 10 #include "test/encode_test_driver.h"
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 if (last_pts_ == 0) 52 if (last_pts_ == 0)
53 duration = 1; 53 duration = 1;
54 54
55 // Add to the buffer the bits we'd expect from a constant bitrate server. 55 // Add to the buffer the bits we'd expect from a constant bitrate server.
56 bits_in_buffer_model_ += duration * timebase_ * cfg_.rc_target_bitrate 56 bits_in_buffer_model_ += duration * timebase_ * cfg_.rc_target_bitrate
57 * 1000; 57 * 1000;
58 58
59 /* Test the buffer model here before subtracting the frame. Do so because 59 /* Test the buffer model here before subtracting the frame. Do so because
60 * the way the leaky bucket model works in libvpx is to allow the buffer to 60 * the way the leaky bucket model works in libvpx is to allow the buffer to
61 * empty - and then stop showing frames until we've got enough bits to 61 * empty - and then stop showing frames until we've got enough bits to
62 * show one. */ 62 * show one. As noted in comment below (issue 495), this does not currently
63 ASSERT_GE(bits_in_buffer_model_, 0) << "Buffer Underrun at frame " 63 * apply to key frames. For now exclude key frames in condition below. */
64 << pkt->data.frame.pts; 64 bool key_frame = (pkt->data.frame.flags & VPX_FRAME_IS_KEY) ? true: false;
65 if (!key_frame) {
66 ASSERT_GE(bits_in_buffer_model_, 0) << "Buffer Underrun at frame "
67 << pkt->data.frame.pts;
68 }
65 69
66 const int frame_size_in_bits = pkt->data.frame.sz * 8; 70 const int frame_size_in_bits = pkt->data.frame.sz * 8;
67 71
68 // Subtract from the buffer the bits associated with a played back frame. 72 // Subtract from the buffer the bits associated with a played back frame.
69 bits_in_buffer_model_ -= frame_size_in_bits; 73 bits_in_buffer_model_ -= frame_size_in_bits;
70 74
71 // Update the running total of bits for end of test datarate checks. 75 // Update the running total of bits for end of test datarate checks.
72 bits_total_ += frame_size_in_bits ; 76 bits_total_ += frame_size_in_bits ;
73 77
74 // If first drop not set and we have a drop set it to this time. 78 // If first drop not set and we have a drop set it to this time.
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 cfg_.rc_end_usage = VPX_CBR; 122 cfg_.rc_end_usage = VPX_CBR;
119 // 2 pass cbr datarate control has a bug hidden by the small # of 123 // 2 pass cbr datarate control has a bug hidden by the small # of
120 // frames selected in this encode. The problem is that even if the buffer is 124 // frames selected in this encode. The problem is that even if the buffer is
121 // negative we produce a keyframe on a cutscene. Ignoring datarate 125 // negative we produce a keyframe on a cutscene. Ignoring datarate
122 // constraints 126 // constraints
123 // TODO(jimbankoski): ( Fix when issue 127 // TODO(jimbankoski): ( Fix when issue
124 // http://code.google.com/p/webm/issues/detail?id=495 is addressed. ) 128 // http://code.google.com/p/webm/issues/detail?id=495 is addressed. )
125 ::libvpx_test::I420VideoSource video("hantro_collage_w352h288.yuv", 352, 288, 129 ::libvpx_test::I420VideoSource video("hantro_collage_w352h288.yuv", 352, 288,
126 30, 1, 0, 140); 130 30, 1, 0, 140);
127 131
128 for (int i = 70; i < 700; i += 200) { 132 // There is an issue for low bitrates in real-time mode, where the
133 // effective_datarate slightly overshoots the target bitrate.
134 // This is same the issue as noted about (#495).
135 // TODO(jimbankoski/marpan): Update test to run for lower bitrates (< 100),
136 // when the issue is resolved.
137 for (int i = 100; i < 800; i += 200) {
129 cfg_.rc_target_bitrate = i; 138 cfg_.rc_target_bitrate = i;
130 ResetModel(); 139 ResetModel();
131 ASSERT_NO_FATAL_FAILURE(RunLoop(&video)); 140 ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
132 ASSERT_GE(cfg_.rc_target_bitrate, effective_datarate_) 141 ASSERT_GE(cfg_.rc_target_bitrate, effective_datarate_)
133 << " The datarate for the file exceeds the target!"; 142 << " The datarate for the file exceeds the target!";
134 143
135 ASSERT_LE(cfg_.rc_target_bitrate, file_datarate_ * 1.3) 144 ASSERT_LE(cfg_.rc_target_bitrate, file_datarate_ * 1.3)
136 << " The datarate for the file missed the target!"; 145 << " The datarate for the file missed the target!";
137 } 146 }
138 } 147 }
(...skipping 21 matching lines...) Expand all
160 ASSERT_LE(first_drop_, last_drop) 169 ASSERT_LE(first_drop_, last_drop)
161 << " The first dropped frame for drop_thresh " << i 170 << " The first dropped frame for drop_thresh " << i
162 << " > first dropped frame for drop_thresh " 171 << " > first dropped frame for drop_thresh "
163 << i - kDropFrameThreshTestStep; 172 << i - kDropFrameThreshTestStep;
164 last_drop = first_drop_; 173 last_drop = first_drop_;
165 } 174 }
166 } 175 }
167 176
168 INSTANTIATE_TEST_CASE_P(AllModes, DatarateTest, ALL_TEST_MODES); 177 INSTANTIATE_TEST_CASE_P(AllModes, DatarateTest, ALL_TEST_MODES);
169 } // namespace 178 } // namespace
OLDNEW
« no previous file with comments | « source/libvpx/libs.mk ('k') | source/libvpx/test/dct32x32_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698