summaryrefslogtreecommitdiffstats
path: root/libavcodec/h264_slice.c
diff options
context:
space:
mode:
Diffstat (limited to 'libavcodec/h264_slice.c')
-rw-r--r--libavcodec/h264_slice.c21
1 files changed, 10 insertions, 11 deletions
diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c
index 634f181..6967edb 100644
--- a/libavcodec/h264_slice.c
+++ b/libavcodec/h264_slice.c
@@ -1201,10 +1201,12 @@ static int h264_slice_header_parse(H264Context *h, H264SliceContext *sl)
h->cur_pic_ptr->frame_num = h->poc.prev_frame_num;
ff_thread_report_progress(&h->cur_pic_ptr->tf, INT_MAX, 0);
ff_thread_report_progress(&h->cur_pic_ptr->tf, INT_MAX, 1);
- ret = ff_generate_sliding_window_mmcos(h, 1);
+
+ ret = ff_generate_sliding_window_mmcos(h, sl);
if (ret < 0 && (h->avctx->err_recognition & AV_EF_EXPLODE))
return ret;
- ret = ff_h264_execute_ref_pic_marking(h, h->mmco, h->nb_mmco);
+
+ ret = ff_h264_execute_ref_pic_marking(h, sl->mmco, sl->nb_mmco);
if (ret < 0 && (h->avctx->err_recognition & AV_EF_EXPLODE))
return ret;
/* Error concealment: If a ref is missing, copy the previous ref
@@ -1342,15 +1344,8 @@ static int h264_slice_header_parse(H264Context *h, H264SliceContext *sl)
ff_h264_pred_weight_table(&sl->gb, sps, sl->ref_count,
sl->slice_type_nos, &sl->pwt);
- // If frame-mt is enabled, only update mmco tables for the first slice
- // in a field. Subsequent slices can temporarily clobber h->nb_mmco
- // or h->mmco, which will cause ref list mix-ups and decoding errors
- // further down the line. This may break decoding if the first slice is
- // corrupt, thus we only do this if frame-mt is enabled.
if (h->nal_ref_idc) {
- ret = ff_h264_decode_ref_pic_marking(h, &sl->gb,
- !(h->avctx->active_thread_type & FF_THREAD_FRAME) ||
- h->current_slice == 0);
+ ret = ff_h264_decode_ref_pic_marking(h, sl, &sl->gb);
if (ret < 0 && (h->avctx->err_recognition & AV_EF_EXPLODE))
return AVERROR_INVALIDDATA;
}
@@ -1441,10 +1436,14 @@ int ff_h264_decode_slice_header(H264Context *h, H264SliceContext *sl)
sl->resync_mb_y = sl->mb_y = sl->mb_y + 1;
assert(sl->mb_y < h->mb_height);
- if (!h->setup_finished)
+ if (!h->setup_finished) {
ff_h264_init_poc(h->cur_pic_ptr->field_poc, &h->cur_pic_ptr->poc,
h->ps.sps, &h->poc, h->picture_structure, h->nal_ref_idc);
+ memcpy(h->mmco, sl->mmco, sl->nb_mmco * sizeof(*h->mmco));
+ h->nb_mmco = sl->nb_mmco;
+ }
+
ret = ff_h264_build_ref_list(h, sl);
if (ret < 0)
return ret;
OpenPOWER on IntegriCloud