| Index: media/video/h264_poc.cc
|
| diff --git a/media/video/h264_poc.cc b/media/video/h264_poc.cc
|
| index 88a4a9063e569c508f4beca9be6804dde23f9ee4..164d704f13dd51eee5759fe65fd7bb0f03abea3e 100644
|
| --- a/media/video/h264_poc.cc
|
| +++ b/media/video/h264_poc.cc
|
| @@ -27,7 +27,6 @@
|
| ref_pic_order_cnt_lsb_ = 0;
|
| prev_frame_num_ = 0;
|
| prev_frame_num_offset_ = 0;
|
| - prev_poc_ = 0;
|
| }
|
|
|
| // Check if a slice includes memory management control operation 5, which
|
| @@ -63,32 +62,22 @@
|
| return false;
|
| }
|
|
|
| - if (!slice_hdr.idr_pic_flag && slice_hdr.frame_num == prev_frame_num_) {
|
| - DLOG(WARNING) << "Redundant picture passed to H264POC";
|
| - *pic_order_cnt = prev_poc_;
|
| - return true;
|
| + // TODO(sandersd): Handle |gaps_in_frame_num_value|.
|
| + if (prev_frame_num_ > 0 && prev_frame_num_ < slice_hdr.frame_num - 1) {
|
| + DLOG(ERROR) << "Gaps in frame_num are not supported";
|
| + return false;
|
| }
|
|
|
| bool mmco5 = HasMMCO5(slice_hdr);
|
| int32_t max_frame_num = 1 << (sps->log2_max_frame_num_minus4 + 4);
|
| int32_t max_pic_order_cnt_lsb =
|
| 1 << (sps->log2_max_pic_order_cnt_lsb_minus4 + 4);
|
| -
|
| - if (!slice_hdr.idr_pic_flag &&
|
| - slice_hdr.frame_num != (prev_frame_num_ + 1) % max_frame_num) {
|
| - // We don't do any special handling of gaps in |frame_num|, because the
|
| - // computations below are unaffected by them. In particular, wrapping is
|
| - // handled the same whether we simulate the missing frames or not.
|
| - if (!sps->gaps_in_frame_num_value_allowed_flag)
|
| - DLOG(WARNING) << "Invalid gap in frame_num";
|
| - }
|
|
|
| // Based on T-REC-H.264 8.2.1, "Decoding process for picture order
|
| // count", available from http://www.itu.int/rec/T-REC-H.264.
|
| //
|
| // Reorganized slightly from spec pseudocode to handle MMCO5 when storing
|
| // state instead of when loading it.
|
| - int32_t poc;
|
| switch (sps->pic_order_cnt_type) {
|
| case 0: {
|
| int32_t prev_pic_order_cnt_msb = ref_pic_order_cnt_msb_;
|
| @@ -120,7 +109,7 @@
|
| // (assuming no interlacing).
|
| int32_t top_foc = pic_order_cnt_msb + slice_hdr.pic_order_cnt_lsb;
|
| int32_t bottom_foc = top_foc + slice_hdr.delta_pic_order_cnt_bottom;
|
| - poc = std::min(top_foc, bottom_foc);
|
| + *pic_order_cnt = std::min(top_foc, bottom_foc);
|
|
|
| // Store state.
|
| prev_frame_num_ = slice_hdr.frame_num;
|
| @@ -189,7 +178,7 @@
|
| int32_t top_foc = expected_pic_order_cnt + slice_hdr.delta_pic_order_cnt0;
|
| int32_t bottom_foc = top_foc + sps->offset_for_top_to_bottom_field +
|
| slice_hdr.delta_pic_order_cnt1;
|
| - poc = std::min(top_foc, bottom_foc);
|
| + *pic_order_cnt = std::min(top_foc, bottom_foc);
|
|
|
| // Store state.
|
| prev_frame_num_ = slice_hdr.frame_num;
|
| @@ -213,11 +202,11 @@
|
| // 8-12, 8-13. Derive |temp_pic_order_count| (it's always the
|
| // |pic_order_cnt|, regardless of interlacing).
|
| if (slice_hdr.idr_pic_flag)
|
| - poc = 0;
|
| + *pic_order_cnt = 0;
|
| else if (slice_hdr.nal_ref_idc == 0)
|
| - poc = 2 * (frame_num_offset + slice_hdr.frame_num) - 1;
|
| - else
|
| - poc = 2 * (frame_num_offset + slice_hdr.frame_num);
|
| + *pic_order_cnt = 2 * (frame_num_offset + slice_hdr.frame_num) - 1;
|
| + else
|
| + *pic_order_cnt = 2 * (frame_num_offset + slice_hdr.frame_num);
|
|
|
| // Store state.
|
| prev_frame_num_ = slice_hdr.frame_num;
|
| @@ -233,7 +222,6 @@
|
| return false;
|
| }
|
|
|
| - *pic_order_cnt = prev_poc_ = poc;
|
| return true;
|
| }
|
|
|
|
|