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

Side by Side Diff: webrtc/modules/video_coding/utility/h264_bitstream_parser.cc

Issue 2373393002: Support for parsing CABAC coded bitstreams (Closed)
Patch Set: update test data Created 4 years, 2 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
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « webrtc/common_video/h264/pps_parser_unittest.cc ('k') | webrtc/modules/video_coding/utility/h264_bitstream_parser_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698