OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 #include "webrtc/modules/video_coding/utility/h264_bitstream_parser.h" | 10 #include "webrtc/modules/video_coding/utility/h264_bitstream_parser.h" |
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
233 } | 233 } |
234 if (memory_management_control_operation == 4) { | 234 if (memory_management_control_operation == 4) { |
235 // max_long_term_frame_idx_plus1: ue(v) | 235 // max_long_term_frame_idx_plus1: ue(v) |
236 RETURN_FALSE_ON_FAIL( | 236 RETURN_FALSE_ON_FAIL( |
237 slice_reader.ReadExponentialGolomb(&golomb_tmp)); | 237 slice_reader.ReadExponentialGolomb(&golomb_tmp)); |
238 } | 238 } |
239 } while (memory_management_control_operation != 0); | 239 } while (memory_management_control_operation != 0); |
240 } | 240 } |
241 } | 241 } |
242 } | 242 } |
243 // cabac not supported: entropy_coding_mode_flag == 0 asserted above. | 243 if (pps_->entropy_coding_mode_flag && |
244 // if (entropy_coding_mode_flag && slice_type != I && slice_type != SI) | 244 slice_type != H264::SliceType::kI && slice_type != H264::SliceType::kSi) { |
245 // cabac_init_idc | 245 // cabac_init_idc: ue(v) |
| 246 RETURN_FALSE_ON_FAIL(slice_reader.ReadExponentialGolomb(&golomb_tmp)); |
| 247 } |
246 int32_t last_slice_qp_delta; | 248 int32_t last_slice_qp_delta; |
247 RETURN_FALSE_ON_FAIL( | 249 RETURN_FALSE_ON_FAIL( |
248 slice_reader.ReadSignedExponentialGolomb(&last_slice_qp_delta)); | 250 slice_reader.ReadSignedExponentialGolomb(&last_slice_qp_delta)); |
249 last_slice_qp_delta_ = rtc::Optional<int32_t>(last_slice_qp_delta); | 251 last_slice_qp_delta_ = rtc::Optional<int32_t>(last_slice_qp_delta); |
250 return true; | 252 return true; |
251 } | 253 } |
252 | 254 |
253 void H264BitstreamParser::ParseSlice(const uint8_t* slice, size_t length) { | 255 void H264BitstreamParser::ParseSlice(const uint8_t* slice, size_t length) { |
254 H264::NaluType nalu_type = H264::ParseNaluType(slice[0]); | 256 H264::NaluType nalu_type = H264::ParseNaluType(slice[0]); |
255 switch (nalu_type) { | 257 switch (nalu_type) { |
(...skipping 28 matching lines...) Expand all Loading... |
284 } | 286 } |
285 | 287 |
286 bool H264BitstreamParser::GetLastSliceQp(int* qp) const { | 288 bool H264BitstreamParser::GetLastSliceQp(int* qp) const { |
287 if (!last_slice_qp_delta_ || !pps_) | 289 if (!last_slice_qp_delta_ || !pps_) |
288 return false; | 290 return false; |
289 *qp = 26 + pps_->pic_init_qp_minus26 + *last_slice_qp_delta_; | 291 *qp = 26 + pps_->pic_init_qp_minus26 + *last_slice_qp_delta_; |
290 return true; | 292 return true; |
291 } | 293 } |
292 | 294 |
293 } // namespace webrtc | 295 } // namespace webrtc |
OLD | NEW |