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

Side by Side Diff: webrtc/common_video/h264/h264_bitstream_parser.cc

Issue 2521283002: Enable QP parsing from CABAC bitstreams (Closed)
Patch Set: Created 4 years 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
« no previous file with comments | « no previous file | webrtc/common_video/h264/h264_bitstream_parser_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/common_video/h264/h264_bitstream_parser.h" 10 #include "webrtc/common_video/h264/h264_bitstream_parser.h"
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 RETURN_INV_ON_FAIL(slice_reader.ReadExponentialGolomb(&golomb_tmp)); 235 RETURN_INV_ON_FAIL(slice_reader.ReadExponentialGolomb(&golomb_tmp));
236 } 236 }
237 if (memory_management_control_operation == 4) { 237 if (memory_management_control_operation == 4) {
238 // max_long_term_frame_idx_plus1: ue(v) 238 // max_long_term_frame_idx_plus1: ue(v)
239 RETURN_INV_ON_FAIL(slice_reader.ReadExponentialGolomb(&golomb_tmp)); 239 RETURN_INV_ON_FAIL(slice_reader.ReadExponentialGolomb(&golomb_tmp));
240 } 240 }
241 } while (memory_management_control_operation != 0); 241 } while (memory_management_control_operation != 0);
242 } 242 }
243 } 243 }
244 } 244 }
245 // cabac not supported: entropy_coding_mode_flag == 0 asserted above. 245 if (pps_->entropy_coding_mode_flag &&
246 // if (entropy_coding_mode_flag && slice_type != I && slice_type != SI) 246 slice_type != H264::SliceType::kI && slice_type != H264::SliceType::kSi) {
247 // cabac_init_idc 247 // cabac_init_idc: ue(v)
248 RETURN_INV_ON_FAIL(slice_reader.ReadExponentialGolomb(&golomb_tmp));
249 }
250
248 int32_t last_slice_qp_delta; 251 int32_t last_slice_qp_delta;
249 RETURN_INV_ON_FAIL( 252 RETURN_INV_ON_FAIL(
250 slice_reader.ReadSignedExponentialGolomb(&last_slice_qp_delta)); 253 slice_reader.ReadSignedExponentialGolomb(&last_slice_qp_delta));
251 last_slice_qp_delta_ = rtc::Optional<int32_t>(last_slice_qp_delta); 254 last_slice_qp_delta_ = rtc::Optional<int32_t>(last_slice_qp_delta);
252 return kOk; 255 return kOk;
253 } 256 }
254 257
255 void H264BitstreamParser::ParseSlice(const uint8_t* slice, size_t length) { 258 void H264BitstreamParser::ParseSlice(const uint8_t* slice, size_t length) {
256 H264::NaluType nalu_type = H264::ParseNaluType(slice[0]); 259 H264::NaluType nalu_type = H264::ParseNaluType(slice[0]);
257 switch (nalu_type) { 260 switch (nalu_type) {
(...skipping 28 matching lines...) Expand all
286 } 289 }
287 290
288 bool H264BitstreamParser::GetLastSliceQp(int* qp) const { 291 bool H264BitstreamParser::GetLastSliceQp(int* qp) const {
289 if (!last_slice_qp_delta_ || !pps_) 292 if (!last_slice_qp_delta_ || !pps_)
290 return false; 293 return false;
291 *qp = 26 + pps_->pic_init_qp_minus26 + *last_slice_qp_delta_; 294 *qp = 26 + pps_->pic_init_qp_minus26 + *last_slice_qp_delta_;
292 return true; 295 return true;
293 } 296 }
294 297
295 } // namespace webrtc 298 } // namespace webrtc
OLDNEW
« no previous file with comments | « no previous file | webrtc/common_video/h264/h264_bitstream_parser_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698