diff options
author | Mark Harris <mark.hsj@gmail.com> | 2015-12-28 23:04:08 -0800 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2015-12-29 13:11:51 +0100 |
commit | c51c08e0e70c186971385bdbb225f69edd4e3375 (patch) | |
tree | cdced95a7ae4749374e575984e7e5c956c45f8a2 /libavcodec/h264_parser.c | |
parent | efa666e0da5e5fd2ded2e7dce4191bf04ac35952 (diff) | |
download | ffmpeg-streaming-c51c08e0e70c186971385bdbb225f69edd4e3375.zip ffmpeg-streaming-c51c08e0e70c186971385bdbb225f69edd4e3375.tar.gz |
avcodec: Use get_ue_golomb_long() when needed
get_ue_golomb() cannot decode values larger than 8190 (the maximum
value that can be golomb encoded in 25 bits) and produces the error
"Invalid UE golomb code" if a larger value is encountered. Use
get_ue_golomb_long() instead (which supports 63 bits, up to 4294967294)
when valid h264/hevc values can exceed 8190.
This updates decoding of the following values: (maximum)
first_mb_in_slice 36863* for level 5.2
abs_diff_pic_num_minus1 131071
difference_of_pic_nums_minus1 131071
idr_pic_id 65535
recovery_frame_cnt 65535
frame_packing_arrangement_id 4294967294
frame_packing_arrangement_repetition_period 16384
display_orientation_repetition_period 16384
An alternative would be to modify get_ue_golomb() to handle encoded
values of up to 49 bits as was done for get_se_golomb() in a92816c.
In that case get_ue_golomb() could continue to be used for all of
these except frame_packing_arrangement_id.
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavcodec/h264_parser.c')
-rw-r--r-- | libavcodec/h264_parser.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/libavcodec/h264_parser.c b/libavcodec/h264_parser.c index 19d1aa3..12d6397 100644 --- a/libavcodec/h264_parser.c +++ b/libavcodec/h264_parser.c @@ -152,7 +152,7 @@ static int scan_mmco_reset(AVCodecParserContext *s) unsigned int reordering_of_pic_nums_idc = get_ue_golomb_31(&sl->gb); if (reordering_of_pic_nums_idc < 3) - get_ue_golomb(&sl->gb); + get_ue_golomb_long(&sl->gb); else if (reordering_of_pic_nums_idc > 3) { av_log(h->avctx, AV_LOG_ERROR, "illegal reordering_of_pic_nums_idc %d\n", @@ -191,7 +191,7 @@ static int scan_mmco_reset(AVCodecParserContext *s) return 1; if (opcode == MMCO_SHORT2UNUSED || opcode == MMCO_SHORT2LONG) - get_ue_golomb(&sl->gb); + get_ue_golomb_long(&sl->gb); // difference_of_pic_nums_minus1 if (opcode == MMCO_SHORT2LONG || opcode == MMCO_LONG2UNUSED || opcode == MMCO_LONG || opcode == MMCO_SET_MAX_LONG) get_ue_golomb_31(&sl->gb); @@ -373,7 +373,7 @@ static inline int parse_nal_units(AVCodecParserContext *s, } if (h->nal_unit_type == NAL_IDR_SLICE) - get_ue_golomb(&sl->gb); /* idr_pic_id */ + get_ue_golomb_long(&sl->gb); /* idr_pic_id */ if (h->sps.poc_type == 0) { h->poc_lsb = get_bits(&sl->gb, h->sps.log2_max_poc_lsb); |