ffmpeg | branch: master | Clément Bœsch <u...@pkh.me> | Fri Jul 29 10:24:06 2016 +0200| [13872d2aa1f454f103e501b91417c44f0f184d53] | committer: Clément Bœsch
Merge commit 'bcd91f1644b46dd142c5355c8b742b27d9028903' * commit 'bcd91f1644b46dd142c5355c8b742b27d9028903': h264: move a per-field block from decode_slice_header() to field_start() Merged-by: Clément Bœsch <u...@pkh.me> > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=13872d2aa1f454f103e501b91417c44f0f184d53 --- libavcodec/h264_slice.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c index e1de971..7dcfd84 100644 --- a/libavcodec/h264_slice.c +++ b/libavcodec/h264_slice.c @@ -1331,6 +1331,13 @@ static int h264_field_start(H264Context *h, const H264SliceContext *sl, (h->mb_height * h->mb_stride - 1) * sizeof(*h->slice_table)); } + ff_h264_init_poc(h->cur_pic_ptr->field_poc, &h->cur_pic_ptr->poc, + h->ps.sps, &h->poc, h->picture_structure, nal->ref_idc); + + memcpy(h->mmco, sl->mmco, sl->nb_mmco * sizeof(*h->mmco)); + h->nb_mmco = sl->nb_mmco; + h->explicit_ref_marking = sl->explicit_ref_marking; + return 0; } @@ -1667,15 +1674,6 @@ int ff_h264_decode_slice_header(H264Context *h, H264SliceContext *sl, sl->resync_mb_y = sl->mb_y = sl->mb_y + 1; av_assert1(sl->mb_y < h->mb_height); - 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, nal->ref_idc); - - memcpy(h->mmco, sl->mmco, sl->nb_mmco * sizeof(*h->mmco)); - h->nb_mmco = sl->nb_mmco; - h->explicit_ref_marking = sl->explicit_ref_marking; - } - ret = ff_h264_build_ref_list(h, sl); if (ret < 0) return ret; ====================================================================== diff --cc libavcodec/h264_slice.c index e1de971,ec8a82c..7dcfd84 --- a/libavcodec/h264_slice.c +++ b/libavcodec/h264_slice.c @@@ -1321,16 -1166,14 +1321,23 @@@ static int h264_field_start(H264Contex } else { release_unused_pictures(h, 0); } + /* Some macroblocks can be accessed before they're available in case + * of lost slices, MBAFF or threading. */ + if (FIELD_PICTURE(h)) { + for(i = (h->picture_structure == PICT_BOTTOM_FIELD); i<h->mb_height; i++) + memset(h->slice_table + i*h->mb_stride, -1, (h->mb_stride - (i+1==h->mb_height)) * sizeof(*h->slice_table)); + } else { + memset(h->slice_table, -1, + (h->mb_height * h->mb_stride - 1) * sizeof(*h->slice_table)); + } + ff_h264_init_poc(h->cur_pic_ptr->field_poc, &h->cur_pic_ptr->poc, + h->ps.sps, &h->poc, h->picture_structure, nal->ref_idc); + + memcpy(h->mmco, sl->mmco, sl->nb_mmco * sizeof(*h->mmco)); + h->nb_mmco = sl->nb_mmco; + h->explicit_ref_marking = sl->explicit_ref_marking; + return 0; } @@@ -1665,17 -1442,8 +1672,8 @@@ int ff_h264_decode_slice_header(H264Con FIELD_OR_MBAFF_PICTURE(h); if (h->picture_structure == PICT_BOTTOM_FIELD) sl->resync_mb_y = sl->mb_y = sl->mb_y + 1; - assert(sl->mb_y < h->mb_height); + av_assert1(sl->mb_y < h->mb_height); - 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, nal->ref_idc); - - memcpy(h->mmco, sl->mmco, sl->nb_mmco * sizeof(*h->mmco)); - h->nb_mmco = sl->nb_mmco; - h->explicit_ref_marking = sl->explicit_ref_marking; - } - ret = ff_h264_build_ref_list(h, sl); if (ret < 0) return ret; _______________________________________________ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog