diff options
author | Anton Khirnov <anton@khirnov.net> | 2016-03-22 13:31:21 +0100 |
---|---|---|
committer | Anton Khirnov <anton@khirnov.net> | 2016-04-24 10:06:23 +0200 |
commit | 3176217c60ca7828712985092d9102d331ea4f3d (patch) | |
tree | 1124709788c4b1b3ec4da9cd8e204cc63039cc8f /libavcodec/h264_sei.c | |
parent | 44d16df413878588659dd8901bba016b5a869fd1 (diff) | |
download | ffmpeg-3176217c60ca7828712985092d9102d331ea4f3d.tar.gz |
h264: decouple h264_ps from the h264 decoder
Make the SPS/PPS parsing independent of the H264Context, to allow
decoupling the parser from the decoder. The change is modelled after the
one done earlier for HEVC.
Move the dequant buffers to the PPS to avoid complex checks whether they
changed and an expensive copy for frame threads.
Diffstat (limited to 'libavcodec/h264_sei.c')
-rw-r--r-- | libavcodec/h264_sei.c | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/libavcodec/h264_sei.c b/libavcodec/h264_sei.c index 1fb1fc5db4..aedb295f4f 100644 --- a/libavcodec/h264_sei.c +++ b/libavcodec/h264_sei.c @@ -50,14 +50,19 @@ void ff_h264_reset_sei(H264Context *h) static int decode_picture_timing(H264Context *h) { - if (h->sps.nal_hrd_parameters_present_flag || - h->sps.vcl_hrd_parameters_present_flag) { + const SPS *sps = h->ps.sps; + + if (!sps) + return AVERROR_INVALIDDATA; + + if (sps->nal_hrd_parameters_present_flag || + sps->vcl_hrd_parameters_present_flag) { h->sei_cpb_removal_delay = get_bits(&h->gb, - h->sps.cpb_removal_delay_length); + sps->cpb_removal_delay_length); h->sei_dpb_output_delay = get_bits(&h->gb, - h->sps.dpb_output_delay_length); + sps->dpb_output_delay_length); } - if (h->sps.pic_struct_present_flag) { + if (sps->pic_struct_present_flag) { unsigned int i, num_clock_ts; h->sei_pic_struct = get_bits(&h->gb, 4); @@ -93,9 +98,9 @@ static int decode_picture_timing(H264Context *h) } } } - if (h->sps.time_offset_length > 0) + if (sps->time_offset_length > 0) skip_bits(&h->gb, - h->sps.time_offset_length); /* time_offset */ + sps->time_offset_length); /* time_offset */ } } @@ -259,12 +264,12 @@ static int decode_buffering_period(H264Context *h) SPS *sps; sps_id = get_ue_golomb_31(&h->gb); - if (sps_id > 31 || !h->sps_buffers[sps_id]) { + if (sps_id > 31 || !h->ps.sps_list[sps_id]) { av_log(h->avctx, AV_LOG_ERROR, "non-existing SPS %d referenced in buffering period\n", sps_id); return AVERROR_INVALIDDATA; } - sps = h->sps_buffers[sps_id]; + sps = (SPS*)h->ps.sps_list[sps_id]->data; // NOTE: This is really so duplicated in the standard... See H.264, D.1.1 if (sps->nal_hrd_parameters_present_flag) { |