| OLD | NEW |
| 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 <algorithm> | 5 #include <algorithm> |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "media/filters/h264_parser.h" | 8 #include "media/filters/h264_parser.h" |
| 9 #include "media/video/h264_poc.h" | 9 #include "media/video/h264_poc.h" |
| 10 | 10 |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 expected_pic_order_cnt = pic_order_cnt_cycle_cnt * | 165 expected_pic_order_cnt = pic_order_cnt_cycle_cnt * |
| 166 sps->expected_delta_per_pic_order_cnt_cycle; | 166 sps->expected_delta_per_pic_order_cnt_cycle; |
| 167 for (int32_t i = 0; i <= frame_num_in_pic_order_cnt_cycle; i++) | 167 for (int32_t i = 0; i <= frame_num_in_pic_order_cnt_cycle; i++) |
| 168 expected_pic_order_cnt += sps->offset_for_ref_frame[i]; | 168 expected_pic_order_cnt += sps->offset_for_ref_frame[i]; |
| 169 } | 169 } |
| 170 if (slice_hdr.nal_ref_idc == 0) | 170 if (slice_hdr.nal_ref_idc == 0) |
| 171 expected_pic_order_cnt += sps->offset_for_non_ref_pic; | 171 expected_pic_order_cnt += sps->offset_for_non_ref_pic; |
| 172 | 172 |
| 173 // 8-10. Derive |top_field_order_cnt| and |bottom_field_order_cnt| | 173 // 8-10. Derive |top_field_order_cnt| and |bottom_field_order_cnt| |
| 174 // (assuming no interlacing). | 174 // (assuming no interlacing). |
| 175 int32_t top_foc = expected_pic_order_cnt + slice_hdr.delta_pic_order_cnt0; | 175 int32_t top_foc = expected_pic_order_cnt + |
| 176 slice_hdr.delta_pic_order_cnt[0]; |
| 176 int32_t bottom_foc = top_foc + sps->offset_for_top_to_bottom_field + | 177 int32_t bottom_foc = top_foc + sps->offset_for_top_to_bottom_field + |
| 177 slice_hdr.delta_pic_order_cnt1; | 178 slice_hdr.delta_pic_order_cnt[1]; |
| 178 *pic_order_cnt = std::min(top_foc, bottom_foc); | 179 *pic_order_cnt = std::min(top_foc, bottom_foc); |
| 179 | 180 |
| 180 // Store state. | 181 // Store state. |
| 181 prev_frame_num_ = slice_hdr.frame_num; | 182 prev_frame_num_ = slice_hdr.frame_num; |
| 182 prev_frame_num_offset_ = frame_num_offset; | 183 prev_frame_num_offset_ = frame_num_offset; |
| 183 if (mmco5) | 184 if (mmco5) |
| 184 prev_frame_num_offset_ = 0; | 185 prev_frame_num_offset_ = 0; |
| 185 | 186 |
| 186 break; | 187 break; |
| 187 } | 188 } |
| (...skipping 28 matching lines...) Expand all Loading... |
| 216 | 217 |
| 217 default: | 218 default: |
| 218 DLOG(ERROR) << "Invalid pic_order_cnt_type: " << sps->pic_order_cnt_type; | 219 DLOG(ERROR) << "Invalid pic_order_cnt_type: " << sps->pic_order_cnt_type; |
| 219 return false; | 220 return false; |
| 220 } | 221 } |
| 221 | 222 |
| 222 return true; | 223 return true; |
| 223 } | 224 } |
| 224 | 225 |
| 225 } // namespace media | 226 } // namespace media |
| OLD | NEW |