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 + | 175 int32_t top_foc = expected_pic_order_cnt + slice_hdr.delta_pic_order_cnt0; |
176 slice_hdr.delta_pic_order_cnt[0]; | |
177 int32_t bottom_foc = top_foc + sps->offset_for_top_to_bottom_field + | 176 int32_t bottom_foc = top_foc + sps->offset_for_top_to_bottom_field + |
178 slice_hdr.delta_pic_order_cnt[1]; | 177 slice_hdr.delta_pic_order_cnt1; |
179 *pic_order_cnt = std::min(top_foc, bottom_foc); | 178 *pic_order_cnt = std::min(top_foc, bottom_foc); |
180 | 179 |
181 // Store state. | 180 // Store state. |
182 prev_frame_num_ = slice_hdr.frame_num; | 181 prev_frame_num_ = slice_hdr.frame_num; |
183 prev_frame_num_offset_ = frame_num_offset; | 182 prev_frame_num_offset_ = frame_num_offset; |
184 if (mmco5) | 183 if (mmco5) |
185 prev_frame_num_offset_ = 0; | 184 prev_frame_num_offset_ = 0; |
186 | 185 |
187 break; | 186 break; |
188 } | 187 } |
(...skipping 28 matching lines...) Expand all Loading... |
217 | 216 |
218 default: | 217 default: |
219 DLOG(ERROR) << "Invalid pic_order_cnt_type: " << sps->pic_order_cnt_type; | 218 DLOG(ERROR) << "Invalid pic_order_cnt_type: " << sps->pic_order_cnt_type; |
220 return false; | 219 return false; |
221 } | 220 } |
222 | 221 |
223 return true; | 222 return true; |
224 } | 223 } |
225 | 224 |
226 } // namespace media | 225 } // namespace media |
OLD | NEW |