diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2014-01-06 16:15:03 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2014-01-06 16:17:38 +0100 |
commit | 7ee8a1c562e8de3bf9627ff10bfb744392c018b7 (patch) | |
tree | ec9d423cfaf4e78f268333ec213d0b784cf7d9bc /libavcodec/h264.c | |
parent | a4f8a5649561906ccad7f15247f033e7b8df4a4e (diff) | |
parent | 9a026c72982faf20e1c8dfbe48f0b312cdea69c8 (diff) | |
download | ffmpeg-7ee8a1c562e8de3bf9627ff10bfb744392c018b7.tar.gz |
Merge commit '9a026c72982faf20e1c8dfbe48f0b312cdea69c8'
* commit '9a026c72982faf20e1c8dfbe48f0b312cdea69c8':
h264: rebuild the default ref list if the reference count changes
Conflicts:
libavcodec/h264.c
Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/h264.c')
-rw-r--r-- | libavcodec/h264.c | 32 |
1 files changed, 21 insertions, 11 deletions
diff --git a/libavcodec/h264.c b/libavcodec/h264.c index 777e67eec5..4a163869d8 100644 --- a/libavcodec/h264.c +++ b/libavcodec/h264.c @@ -3382,11 +3382,12 @@ static int h264_slice_header_init(H264Context *h, int reinit) int ff_set_ref_count(H264Context *h) { + int ref_count[2], list_count; int num_ref_idx_active_override_flag; // set defaults, might be overridden a few lines later - h->ref_count[0] = h->pps.ref_count[0]; - h->ref_count[1] = h->pps.ref_count[1]; + ref_count[0] = h->pps.ref_count[0]; + ref_count[1] = h->pps.ref_count[1]; if (h->slice_type_nos != AV_PICTURE_TYPE_I) { unsigned max[2]; @@ -3397,27 +3398,36 @@ int ff_set_ref_count(H264Context *h) num_ref_idx_active_override_flag = get_bits1(&h->gb); if (num_ref_idx_active_override_flag) { - h->ref_count[0] = get_ue_golomb(&h->gb) + 1; + ref_count[0] = get_ue_golomb(&h->gb) + 1; if (h->slice_type_nos == AV_PICTURE_TYPE_B) { - h->ref_count[1] = get_ue_golomb(&h->gb) + 1; + ref_count[1] = get_ue_golomb(&h->gb) + 1; } else // full range is spec-ok in this case, even for frames - h->ref_count[1] = 1; + ref_count[1] = 1; } - if (h->ref_count[0]-1 > max[0] || h->ref_count[1]-1 > max[1]){ - av_log(h->avctx, AV_LOG_ERROR, "reference overflow %u > %u or %u > %u\n", h->ref_count[0]-1, max[0], h->ref_count[1]-1, max[1]); + if (ref_count[0]-1 > max[0] || ref_count[1]-1 > max[1]){ + av_log(h->avctx, AV_LOG_ERROR, "reference overflow %u > %u or %u > %u\n", ref_count[0]-1, max[0], ref_count[1]-1, max[1]); h->ref_count[0] = h->ref_count[1] = 0; return AVERROR_INVALIDDATA; } if (h->slice_type_nos == AV_PICTURE_TYPE_B) - h->list_count = 2; + list_count = 2; else - h->list_count = 1; + list_count = 1; } else { - h->list_count = 0; - h->ref_count[0] = h->ref_count[1] = 0; + list_count = 0; + ref_count[0] = ref_count[1] = 0; + } + + if (list_count != h->list_count || + ref_count[0] != h->ref_count[0] || + ref_count[1] != h->ref_count[1]) { + h->ref_count[0] = ref_count[0]; + h->ref_count[1] = ref_count[1]; + h->list_count = list_count; + return 1; } return 0; |