diff options
author | Andreas Rheinhardt <andreas.rheinhardt@gmail.com> | 2020-07-14 16:20:09 +0300 |
---|---|---|
committer | Andreas Rheinhardt <andreas.rheinhardt@gmail.com> | 2020-07-29 06:11:54 +0300 |
commit | cbb6ba2e86923349ff9c5602976bb02ffa9d3fff (patch) | |
tree | e5bee7cbe6e680cec6c9b4c29ce5feb99db4bcbe /libavcodec/h264_ps.c | |
parent | 2d5407d390728d4d4a4d8f36a8fe69ff490f54e4 (diff) |
avcodec/cavsdec, h264*, hevc_parser: Use get_ue_golomb_31 where possible
instead of get_ue_golomb(). The difference between the two is that the
latter also has to take into account the case in which the read code is
more than 9 bits (four preceding zeroes + at most five value bits) long,
leading to more code.
Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Diffstat (limited to 'libavcodec/h264_ps.c')
-rw-r--r-- | libavcodec/h264_ps.c | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/libavcodec/h264_ps.c b/libavcodec/h264_ps.c index e774929e21..e21c2b56ac 100644 --- a/libavcodec/h264_ps.c +++ b/libavcodec/h264_ps.c @@ -181,8 +181,8 @@ static inline int decode_vui_parameters(GetBitContext *gb, void *logctx, /* chroma_location_info_present_flag */ if (get_bits1(gb)) { /* chroma_sample_location_type_top_field */ - sps->chroma_location = get_ue_golomb(gb) + 1; - get_ue_golomb(gb); /* chroma_sample_location_type_bottom_field */ + sps->chroma_location = get_ue_golomb_31(gb) + 1; + get_ue_golomb_31(gb); /* chroma_sample_location_type_bottom_field */ } else sps->chroma_location = AVCHROMA_LOC_LEFT; @@ -224,12 +224,12 @@ static inline int decode_vui_parameters(GetBitContext *gb, void *logctx, sps->bitstream_restriction_flag = get_bits1(gb); if (sps->bitstream_restriction_flag) { get_bits1(gb); /* motion_vectors_over_pic_boundaries_flag */ - get_ue_golomb(gb); /* max_bytes_per_pic_denom */ - get_ue_golomb(gb); /* max_bits_per_mb_denom */ - get_ue_golomb(gb); /* log2_max_mv_length_horizontal */ - get_ue_golomb(gb); /* log2_max_mv_length_vertical */ - sps->num_reorder_frames = get_ue_golomb(gb); - get_ue_golomb(gb); /*max_dec_frame_buffering*/ + get_ue_golomb_31(gb); /* max_bytes_per_pic_denom */ + get_ue_golomb_31(gb); /* max_bits_per_mb_denom */ + get_ue_golomb_31(gb); /* log2_max_mv_length_horizontal */ + get_ue_golomb_31(gb); /* log2_max_mv_length_vertical */ + sps->num_reorder_frames = get_ue_golomb_31(gb); + get_ue_golomb_31(gb); /*max_dec_frame_buffering*/ if (get_bits_left(gb) < 0) { sps->num_reorder_frames = 0; @@ -403,8 +403,8 @@ int ff_h264_decode_seq_parameter_set(GetBitContext *gb, AVCodecContext *avctx, goto fail; } } - sps->bit_depth_luma = get_ue_golomb(gb) + 8; - sps->bit_depth_chroma = get_ue_golomb(gb) + 8; + sps->bit_depth_luma = get_ue_golomb_31(gb) + 8; + sps->bit_depth_chroma = get_ue_golomb_31(gb) + 8; if (sps->bit_depth_chroma != sps->bit_depth_luma) { avpriv_request_sample(avctx, "Different chroma and luma bit depth"); @@ -428,7 +428,7 @@ int ff_h264_decode_seq_parameter_set(GetBitContext *gb, AVCodecContext *avctx, sps->bit_depth_chroma = 8; } - log2_max_frame_num_minus4 = get_ue_golomb(gb); + log2_max_frame_num_minus4 = get_ue_golomb_31(gb); if (log2_max_frame_num_minus4 < MIN_LOG2_MAX_FRAME_NUM - 4 || log2_max_frame_num_minus4 > MAX_LOG2_MAX_FRAME_NUM - 4) { av_log(avctx, AV_LOG_ERROR, @@ -441,7 +441,7 @@ int ff_h264_decode_seq_parameter_set(GetBitContext *gb, AVCodecContext *avctx, sps->poc_type = get_ue_golomb_31(gb); if (sps->poc_type == 0) { // FIXME #define - unsigned t = get_ue_golomb(gb); + unsigned t = get_ue_golomb_31(gb); if (t>12) { av_log(avctx, AV_LOG_ERROR, "log2_max_poc_lsb (%d) is out of range\n", t); goto fail; |