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

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

Issue 1967893002: H264POC: Allow gaps in frame_num. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix gap detection. 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/gpu/vt_video_decode_accelerator_mac.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 <stddef.h> 5 #include <stddef.h>
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 55
56 bool H264POC::ComputePicOrderCnt( 56 bool H264POC::ComputePicOrderCnt(
57 const H264SPS* sps, 57 const H264SPS* sps,
58 const H264SliceHeader& slice_hdr, 58 const H264SliceHeader& slice_hdr,
59 int32_t *pic_order_cnt) { 59 int32_t *pic_order_cnt) {
60 if (slice_hdr.field_pic_flag) { 60 if (slice_hdr.field_pic_flag) {
61 DLOG(ERROR) << "Interlaced frames are not supported"; 61 DLOG(ERROR) << "Interlaced frames are not supported";
62 return false; 62 return false;
63 } 63 }
64 64
65 // TODO(sandersd): Handle |gaps_in_frame_num_value|.
66 if (prev_frame_num_ > 0 && prev_frame_num_ < slice_hdr.frame_num - 1) {
67 DLOG(ERROR) << "Gaps in frame_num are not supported";
68 return false;
69 }
70
71 bool mmco5 = HasMMCO5(slice_hdr); 65 bool mmco5 = HasMMCO5(slice_hdr);
72 int32_t max_frame_num = 1 << (sps->log2_max_frame_num_minus4 + 4); 66 int32_t max_frame_num = 1 << (sps->log2_max_frame_num_minus4 + 4);
73 int32_t max_pic_order_cnt_lsb = 67 int32_t max_pic_order_cnt_lsb =
74 1 << (sps->log2_max_pic_order_cnt_lsb_minus4 + 4); 68 1 << (sps->log2_max_pic_order_cnt_lsb_minus4 + 4);
75 69
70 if (!slice_hdr.idr_pic_flag &&
71 slice_hdr.frame_num != (prev_frame_num_ + 1) % max_frame_num) {
Pawel Osciak 2016/05/20 00:21:31 Not sure if this is intentional, but this changes
sandersd (OOO until July 31) 2016/05/20 00:39:09 My understanding of the spec is that this only hap
Pawel Osciak 2016/05/20 07:50:12 I just thought that not changing the condition wou
72 // We don't do any special handling of gaps in |frame_num|, because the
73 // computations below are unaffected by them. In particular, wrapping is
74 // handled the same whether we simulate the missing frames or not.
75 if (!sps->gaps_in_frame_num_value_allowed_flag)
76 DLOG(WARNING) << "Invalid gap in frame_num.";
77 }
78
76 // Based on T-REC-H.264 8.2.1, "Decoding process for picture order 79 // Based on T-REC-H.264 8.2.1, "Decoding process for picture order
77 // count", available from http://www.itu.int/rec/T-REC-H.264. 80 // count", available from http://www.itu.int/rec/T-REC-H.264.
78 // 81 //
79 // Reorganized slightly from spec pseudocode to handle MMCO5 when storing 82 // Reorganized slightly from spec pseudocode to handle MMCO5 when storing
80 // state instead of when loading it. 83 // state instead of when loading it.
81 switch (sps->pic_order_cnt_type) { 84 switch (sps->pic_order_cnt_type) {
82 case 0: { 85 case 0: {
83 int32_t prev_pic_order_cnt_msb = ref_pic_order_cnt_msb_; 86 int32_t prev_pic_order_cnt_msb = ref_pic_order_cnt_msb_;
84 int32_t prev_pic_order_cnt_lsb = ref_pic_order_cnt_lsb_; 87 int32_t prev_pic_order_cnt_lsb = ref_pic_order_cnt_lsb_;
85 88
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 222
220 default: 223 default:
221 DLOG(ERROR) << "Invalid pic_order_cnt_type: " << sps->pic_order_cnt_type; 224 DLOG(ERROR) << "Invalid pic_order_cnt_type: " << sps->pic_order_cnt_type;
222 return false; 225 return false;
223 } 226 }
224 227
225 return true; 228 return true;
226 } 229 }
227 230
228 } // namespace media 231 } // namespace media
OLDNEW
« no previous file with comments | « media/gpu/vt_video_decode_accelerator_mac.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698