diff options
author | Anton Khirnov <anton@khirnov.net> | 2016-03-21 16:14:31 +0100 |
---|---|---|
committer | Anton Khirnov <anton@khirnov.net> | 2016-04-24 10:06:23 +0200 |
commit | a6e27f7add2698fdd89911632b570c3d0c3f2aaa (patch) | |
tree | 8e345bf225e923c9c8fc0e68809dd28b8aa27ad7 /libavcodec/h264.c | |
parent | 56b17a33f231859cbccbd741b4763617cb4ecf03 (diff) |
h264: factor out parsing the reference count into a separate file
This will allow decoupling the parser from the decoder.
Diffstat (limited to 'libavcodec/h264.c')
-rw-r--r-- | libavcodec/h264.c | 47 |
1 files changed, 0 insertions, 47 deletions
diff --git a/libavcodec/h264.c b/libavcodec/h264.c index f1f9c7304b..e9dffa6b92 100644 --- a/libavcodec/h264.c +++ b/libavcodec/h264.c @@ -965,53 +965,6 @@ int ff_h264_get_profile(SPS *sps) return profile; } -int ff_set_ref_count(H264Context *h, H264SliceContext *sl) -{ - int ref_count[2], list_count; - int num_ref_idx_active_override_flag, max_refs; - - // set defaults, might be overridden a few lines later - ref_count[0] = h->pps.ref_count[0]; - ref_count[1] = h->pps.ref_count[1]; - - if (sl->slice_type_nos != AV_PICTURE_TYPE_I) { - num_ref_idx_active_override_flag = get_bits1(&sl->gb); - - if (num_ref_idx_active_override_flag) { - ref_count[0] = get_ue_golomb(&sl->gb) + 1; - if (ref_count[0] < 1) - return AVERROR_INVALIDDATA; - if (sl->slice_type_nos == AV_PICTURE_TYPE_B) { - ref_count[1] = get_ue_golomb(&sl->gb) + 1; - if (ref_count[1] < 1) - return AVERROR_INVALIDDATA; - } - } - - if (sl->slice_type_nos == AV_PICTURE_TYPE_B) - list_count = 2; - else - list_count = 1; - } else { - list_count = 0; - ref_count[0] = ref_count[1] = 0; - } - - max_refs = h->picture_structure == PICT_FRAME ? 16 : 32; - - if (ref_count[0] > max_refs || ref_count[1] > max_refs) { - av_log(h->avctx, AV_LOG_ERROR, "reference overflow\n"); - sl->ref_count[0] = sl->ref_count[1] = 0; - return AVERROR_INVALIDDATA; - } - - sl->ref_count[0] = ref_count[0]; - sl->ref_count[1] = ref_count[1]; - sl->list_count = list_count; - - return 0; -} - static int get_last_needed_nal(H264Context *h) { int nals_needed = 0; |