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

Side by Side Diff: media/video/h264_poc_unittest.cc

Issue 2011353003: H264POC: Re-compute PicOrderCnt for duplicate frame_nums. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Unittest. Created 4 years, 6 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
« media/video/h264_poc.cc ('K') | « media/video/h264_poc.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <stdint.h> 5 #include <stdint.h>
6 6
7 #include "base/files/file_path.h" 7 #include "base/files/file_path.h"
8 #include "base/files/memory_mapped_file.h" 8 #include "base/files/memory_mapped_file.h"
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "media/base/test_data_util.h" 10 #include "media/base/test_data_util.h"
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 slice_hdr_.frame_num = 0; 185 slice_hdr_.frame_num = 0;
186 ASSERT_TRUE(ComputePOC()); 186 ASSERT_TRUE(ComputePOC());
187 ASSERT_EQ(24, poc_); 187 ASSERT_EQ(24, poc_);
188 188
189 // Ref frame, wrapping from before has been cleared. 189 // Ref frame, wrapping from before has been cleared.
190 slice_hdr_.frame_num = 1; 190 slice_hdr_.frame_num = 1;
191 ASSERT_TRUE(ComputePOC()); 191 ASSERT_TRUE(ComputePOC());
192 ASSERT_EQ(1, poc_); 192 ASSERT_EQ(1, poc_);
193 } 193 }
194 194
195 // Despite being invalid, videos with diplicate non-keyframe |frame_num| values
DaleCurtis 2016/06/02 18:53:02 duplicate.
sandersd (OOO until July 31) 2016/06/02 18:58:55 Done.
196 // are common.
DaleCurtis 2016/06/02 18:53:02 Add link to bugs?
sandersd (OOO until July 31) 2016/06/02 18:58:55 Done.
197 TEST_F(H264POCTest, PicOrderCntType1_DupFrameNum) {
198 sps_.pic_order_cnt_type = 1;
199 sps_.log2_max_frame_num_minus4 = 0; // 16
200 sps_.num_ref_frames_in_pic_order_cnt_cycle = 2;
201 sps_.expected_delta_per_pic_order_cnt_cycle = 3;
202 sps_.offset_for_ref_frame[0] = 1;
203 sps_.offset_for_ref_frame[1] = 2;
204
205 // Initial IDR with POC 0.
206 slice_hdr_.idr_pic_flag = true;
207 slice_hdr_.frame_num = 0;
208 ASSERT_TRUE(ComputePOC());
209 ASSERT_EQ(0, poc_);
210
211 // Ref frame.
212 slice_hdr_.idr_pic_flag = false;
213 slice_hdr_.frame_num = 1;
214 ASSERT_TRUE(ComputePOC());
215 ASSERT_EQ(1, poc_);
216
217 // Duplicate |frame_num| frame.
218 slice_hdr_.frame_num = 1;
219 slice_hdr_.delta_pic_order_cnt0 = 1;
220 ASSERT_TRUE(ComputePOC());
221 ASSERT_EQ(2, poc_);
222 }
223
195 TEST_F(H264POCTest, PicOrderCntType2) { 224 TEST_F(H264POCTest, PicOrderCntType2) {
196 sps_.pic_order_cnt_type = 2; 225 sps_.pic_order_cnt_type = 2;
197 226
198 // Initial IDR with POC 0. 227 // Initial IDR with POC 0.
199 slice_hdr_.idr_pic_flag = true; 228 slice_hdr_.idr_pic_flag = true;
200 slice_hdr_.frame_num = 0; 229 slice_hdr_.frame_num = 0;
201 ASSERT_TRUE(ComputePOC()); 230 ASSERT_TRUE(ComputePOC());
202 ASSERT_EQ(0, poc_); 231 ASSERT_EQ(0, poc_);
203 232
204 // Ref frame. 233 // Ref frame.
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 ASSERT_TRUE(ComputePOC()); 278 ASSERT_TRUE(ComputePOC());
250 ASSERT_EQ(32, poc_); 279 ASSERT_EQ(32, poc_);
251 280
252 // Ref frame, wrapping from before has been cleared. 281 // Ref frame, wrapping from before has been cleared.
253 slice_hdr_.frame_num = 1; 282 slice_hdr_.frame_num = 1;
254 ASSERT_TRUE(ComputePOC()); 283 ASSERT_TRUE(ComputePOC());
255 ASSERT_EQ(2, poc_); 284 ASSERT_EQ(2, poc_);
256 } 285 }
257 286
258 } // namespace media 287 } // namespace media
OLDNEW
« media/video/h264_poc.cc ('K') | « media/video/h264_poc.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698