diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2015-03-21 14:59:58 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2015-03-21 15:18:10 +0100 |
commit | cc2cfdc49786a8268d1514661c17ea96035d6f1d (patch) | |
tree | fd17d2f29472b84fce724d66fc982ee51f7cd42f /libavcodec/h264.c | |
parent | 27b3522ba3cf539e13bb0f8f9c68d2dd513a8f73 (diff) | |
parent | 95eb35f30513e335990ad0d5dca6ddc318477291 (diff) | |
download | ffmpeg-cc2cfdc49786a8268d1514661c17ea96035d6f1d.tar.gz |
Merge commit '95eb35f30513e335990ad0d5dca6ddc318477291'
* commit '95eb35f30513e335990ad0d5dca6ddc318477291':
h264: move the ref lists variables into the per-slice context
Conflicts:
libavcodec/h264.c
libavcodec/h264.h
libavcodec/h264_cabac.c
libavcodec/h264_cavlc.c
libavcodec/h264_direct.c
libavcodec/h264_mb.c
libavcodec/h264_picture.c
libavcodec/h264_refs.c
libavcodec/h264_slice.c
Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/h264.c')
-rw-r--r-- | libavcodec/h264.c | 36 |
1 files changed, 19 insertions, 17 deletions
diff --git a/libavcodec/h264.c b/libavcodec/h264.c index b2cf137754..1849cc32d2 100644 --- a/libavcodec/h264.c +++ b/libavcodec/h264.c @@ -75,13 +75,13 @@ static void h264_er_decode_mb(void *opaque, int ref, int mv_dir, int mv_type, * differ between slices. We take the easy approach and ignore * it for now. If this turns out to have any relevance in * practice then correct remapping should be added. */ - if (ref >= h->ref_count[0]) + if (ref >= sl->ref_count[0]) ref = 0; - if (!h->ref_list[0][ref].f.data[0]) { + if (!sl->ref_list[0][ref].f.data[0]) { av_log(h->avctx, AV_LOG_DEBUG, "Reference not available for error concealing\n"); ref = 0; } - if ((h->ref_list[0][ref].reference&3) != 3) { + if ((sl->ref_list[0][ref].reference&3) != 3) { av_log(h->avctx, AV_LOG_DEBUG, "Reference invalid\n"); return; } @@ -95,11 +95,12 @@ static void h264_er_decode_mb(void *opaque, int ref, int mv_dir, int mv_type, ff_h264_hl_decode_mb(h, &h->slice_ctx[0]); } -void ff_h264_draw_horiz_band(H264Context *h, int y, int height) +void ff_h264_draw_horiz_band(H264Context *h, H264SliceContext *sl, + int y, int height) { AVCodecContext *avctx = h->avctx; AVFrame *cur = &h->cur_pic.f; - AVFrame *last = h->ref_list[0][0].f.data[0] ? &h->ref_list[0][0].f : NULL; + AVFrame *last = sl->ref_list[0][0].f.data[0] ? &sl->ref_list[0][0].f : NULL; const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(avctx->pix_fmt); int vshift = desc->log2_chroma_h; const int field_pic = h->picture_structure != PICT_FRAME; @@ -1033,7 +1034,7 @@ int ff_pred_weight_table(H264Context *h, H264SliceContext *sl) for (list = 0; list < 2; list++) { sl->luma_weight_flag[list] = 0; sl->chroma_weight_flag[list] = 0; - for (i = 0; i < h->ref_count[list]; i++) { + for (i = 0; i < sl->ref_count[list]; i++) { int luma_weight_flag, chroma_weight_flag; luma_weight_flag = get_bits1(&h->gb); @@ -1117,9 +1118,10 @@ void ff_h264_flush_change(H264Context *h) ff_h264_reset_sei(h); h->recovery_frame = -1; h->frame_recovered = 0; - h->list_count = 0; h->current_slice = 0; h->mmco_reset = 1; + for (i = 0; i < h->nb_slice_ctx; i++) + h->slice_ctx[i].list_count = 0; } /* forget old pics after a seek */ @@ -1324,8 +1326,8 @@ int ff_set_ref_count(H264Context *h, H264SliceContext *sl) 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; - h->list_count = 0; + sl->ref_count[0] = sl->ref_count[1] = 0; + sl->list_count = 0; return AVERROR_INVALIDDATA; } @@ -1338,12 +1340,12 @@ int ff_set_ref_count(H264Context *h, H264SliceContext *sl) 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; + if (list_count != sl->list_count || + ref_count[0] != sl->ref_count[0] || + ref_count[1] != sl->ref_count[1]) { + sl->ref_count[0] = ref_count[0]; + sl->ref_count[1] = ref_count[1]; + sl->list_count = list_count; return 1; } @@ -1701,7 +1703,7 @@ again: if (err < 0 || err == SLICE_SKIPED) { if (err < 0) av_log(h->avctx, AV_LOG_ERROR, "decode_slice_header error\n"); - h->ref_count[0] = h->ref_count[1] = h->list_count = 0; + sl->ref_count[0] = sl->ref_count[1] = sl->list_count = 0; } else if (err == SLICE_SINGLETHREAD) { /* Slice could not be decoded in parallel mode, copy down * NAL unit stuff to context 0 and restart. Note that @@ -1875,7 +1877,7 @@ static int h264_decode_frame(AVCodecContext *avctx, void *data, if (avctx->flags2 & CODEC_FLAG2_CHUNKS) decode_postinit(h, 1); - ff_h264_field_end(h, 0); + ff_h264_field_end(h, &h->slice_ctx[0], 0); /* Wait for second field. */ *got_frame = 0; |