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

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

Issue 2008473002: Revert of H264POC: Allow gaps in frame_num. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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
« no previous file with comments | « 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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 45
46 DISALLOW_COPY_AND_ASSIGN(H264POCTest); 46 DISALLOW_COPY_AND_ASSIGN(H264POCTest);
47 }; 47 };
48 48
49 TEST_F(H264POCTest, PicOrderCntType0) { 49 TEST_F(H264POCTest, PicOrderCntType0) {
50 sps_.pic_order_cnt_type = 0; 50 sps_.pic_order_cnt_type = 0;
51 sps_.log2_max_pic_order_cnt_lsb_minus4 = 0; // 16 51 sps_.log2_max_pic_order_cnt_lsb_minus4 = 0; // 16
52 52
53 // Initial IDR with POC 0. 53 // Initial IDR with POC 0.
54 slice_hdr_.idr_pic_flag = true; 54 slice_hdr_.idr_pic_flag = true;
55 slice_hdr_.frame_num = 0;
56 ASSERT_TRUE(ComputePOC()); 55 ASSERT_TRUE(ComputePOC());
57 ASSERT_EQ(0, poc_); 56 ASSERT_EQ(0, poc_);
58 57
59 // Ref frame with POC lsb 8. 58 // Ref frame with POC lsb 8.
60 slice_hdr_.idr_pic_flag = false; 59 slice_hdr_.idr_pic_flag = false;
61 slice_hdr_.frame_num = 1;
62 slice_hdr_.pic_order_cnt_lsb = 8; 60 slice_hdr_.pic_order_cnt_lsb = 8;
63 ASSERT_TRUE(ComputePOC()); 61 ASSERT_TRUE(ComputePOC());
64 ASSERT_EQ(8, poc_); 62 ASSERT_EQ(8, poc_);
65 63
66 // Ref frame with POC lsb 0. This should be detected as wrapping, as the 64 // Ref frame with POC lsb 0. This should be detected as wrapping, as the
67 // (negative) gap is at least half the maximum. 65 // (negative) gap is at least half the maximum.
68 slice_hdr_.pic_order_cnt_lsb = 0; 66 slice_hdr_.pic_order_cnt_lsb = 0;
69 slice_hdr_.frame_num = 2;
70 ASSERT_TRUE(ComputePOC()); 67 ASSERT_TRUE(ComputePOC());
71 ASSERT_EQ(16, poc_); 68 ASSERT_EQ(16, poc_);
72 69
73 // Ref frame with POC lsb 9. This should be detected as negative wrapping, 70 // Ref frame with POC lsb 9. This should be detected as negative wrapping,
74 // as the (positive) gap is more than half the maximum. 71 // as the (positive) gap is more than half the maximum.
75 slice_hdr_.pic_order_cnt_lsb = 9; 72 slice_hdr_.pic_order_cnt_lsb = 9;
76 slice_hdr_.frame_num = 3;
77 ASSERT_TRUE(ComputePOC()); 73 ASSERT_TRUE(ComputePOC());
78 ASSERT_EQ(9, poc_); 74 ASSERT_EQ(9, poc_);
79 } 75 }
80 76
81 TEST_F(H264POCTest, PicOrderCntType0_WithMMCO5) { 77 TEST_F(H264POCTest, PicOrderCntType0_WithMMCO5) {
82 sps_.pic_order_cnt_type = 0; 78 sps_.pic_order_cnt_type = 0;
83 sps_.log2_max_pic_order_cnt_lsb_minus4 = 0; // 16 79 sps_.log2_max_pic_order_cnt_lsb_minus4 = 0; // 16
84 80
85 // Initial IDR with POC 0. 81 // Initial IDR with POC 0.
86 slice_hdr_.idr_pic_flag = true; 82 slice_hdr_.idr_pic_flag = true;
87 slice_hdr_.frame_num = 0;
88 ASSERT_TRUE(ComputePOC()); 83 ASSERT_TRUE(ComputePOC());
89 ASSERT_EQ(0, poc_); 84 ASSERT_EQ(0, poc_);
90 85
91 // Skip ahead. 86 // Skip ahead.
92 slice_hdr_.idr_pic_flag = false; 87 slice_hdr_.idr_pic_flag = false;
93 slice_hdr_.frame_num = 1;
94 slice_hdr_.pic_order_cnt_lsb = 8; 88 slice_hdr_.pic_order_cnt_lsb = 8;
95 ASSERT_TRUE(ComputePOC()); 89 ASSERT_TRUE(ComputePOC());
96 ASSERT_EQ(8, poc_); 90 ASSERT_EQ(8, poc_);
97 91
98 slice_hdr_.frame_num = 2;
99 slice_hdr_.pic_order_cnt_lsb = 0; 92 slice_hdr_.pic_order_cnt_lsb = 0;
100 ASSERT_TRUE(ComputePOC()); 93 ASSERT_TRUE(ComputePOC());
101 ASSERT_EQ(16, poc_); 94 ASSERT_EQ(16, poc_);
102 95
103 slice_hdr_.frame_num = 3;
104 slice_hdr_.pic_order_cnt_lsb = 8; 96 slice_hdr_.pic_order_cnt_lsb = 8;
105 ASSERT_TRUE(ComputePOC()); 97 ASSERT_TRUE(ComputePOC());
106 ASSERT_EQ(24, poc_); 98 ASSERT_EQ(24, poc_);
107 99
108 slice_hdr_.frame_num = 4; 100 SetMMCO5();
109 slice_hdr_.pic_order_cnt_lsb = 0; 101 slice_hdr_.pic_order_cnt_lsb = 0;
110 SetMMCO5();
111 ASSERT_TRUE(ComputePOC()); 102 ASSERT_TRUE(ComputePOC());
112 ASSERT_EQ(32, poc_); 103 ASSERT_EQ(32, poc_);
113 104
114 // Due to the MMCO5 above, this is relative to 0, but also detected as 105 // Due to the MMCO5 above, this is relative to 0, but also detected as
115 // positive wrapping. 106 // positive wrapping.
116 slice_hdr_.frame_num = 5;
117 slice_hdr_.pic_order_cnt_lsb = 8; 107 slice_hdr_.pic_order_cnt_lsb = 8;
118 ASSERT_TRUE(ComputePOC()); 108 ASSERT_TRUE(ComputePOC());
119 ASSERT_EQ(24, poc_); 109 ASSERT_EQ(24, poc_);
120 } 110 }
121 111
122 TEST_F(H264POCTest, PicOrderCntType1) { 112 TEST_F(H264POCTest, PicOrderCntType1) {
123 sps_.pic_order_cnt_type = 1; 113 sps_.pic_order_cnt_type = 1;
124 sps_.log2_max_frame_num_minus4 = 0; // 16 114 sps_.log2_max_frame_num_minus4 = 0; // 16
125 sps_.num_ref_frames_in_pic_order_cnt_cycle = 2; 115 sps_.num_ref_frames_in_pic_order_cnt_cycle = 2;
126 sps_.expected_delta_per_pic_order_cnt_cycle = 3; 116 sps_.expected_delta_per_pic_order_cnt_cycle = 3;
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 ASSERT_TRUE(ComputePOC()); 239 ASSERT_TRUE(ComputePOC());
250 ASSERT_EQ(32, poc_); 240 ASSERT_EQ(32, poc_);
251 241
252 // Ref frame, wrapping from before has been cleared. 242 // Ref frame, wrapping from before has been cleared.
253 slice_hdr_.frame_num = 1; 243 slice_hdr_.frame_num = 1;
254 ASSERT_TRUE(ComputePOC()); 244 ASSERT_TRUE(ComputePOC());
255 ASSERT_EQ(2, poc_); 245 ASSERT_EQ(2, poc_);
256 } 246 }
257 247
258 } // namespace media 248 } // namespace media
OLDNEW
« no previous file with comments | « media/video/h264_poc.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698