[FFmpeg-devel] [PATCH] avcodec/h264: Fix regression caused by removial of default_ref_list
Michael Niedermayer
michael at niedermayer.cc
Mon Jan 4 02:33:29 CET 2016
On Mon, Jan 04, 2016 at 12:14:44AM +0100, Hendrik Leppkes wrote:
> On Sun, Jan 3, 2016 at 7:03 PM, Michael Niedermayer <michaelni at gmx.at> wrote:
> > From: Michael Niedermayer <michael at niedermayer.cc>
> >
> > This fixes a regression of the sample from Ticket 2371
> >
> > Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
> > ---
> > libavcodec/h264.h | 1 +
> > libavcodec/h264_refs.c | 11 +++++++++--
> > 2 files changed, 10 insertions(+), 2 deletions(-)
> >
> > diff --git a/libavcodec/h264.h b/libavcodec/h264.h
> > index 5d9aecd..a5fc3a0 100644
> > --- a/libavcodec/h264.h
> > +++ b/libavcodec/h264.h
> > @@ -669,6 +669,7 @@ typedef struct H264Context {
> > */
> > int max_pic_num;
> >
> > + H264Ref default_ref[2];
> > H264Picture *short_ref[32];
> > H264Picture *long_ref[32];
> > H264Picture *delayed_pic[MAX_DELAYED_PIC_COUNT + 2]; // FIXME size?
> > diff --git a/libavcodec/h264_refs.c b/libavcodec/h264_refs.c
> > index 52fedc1..f42d6a2 100644
> > --- a/libavcodec/h264_refs.c
> > +++ b/libavcodec/h264_refs.c
> > @@ -208,6 +208,8 @@ static void h264_initialise_ref_list(H264Context *h, H264SliceContext *sl)
> > }
> > }
> > }
> > + for (i = 0; i < sl->list_count; i++)
> > + h->default_ref[i] = sl->ref_list[i][0];
> > }
> >
> > static void print_short_term(H264Context *h);
> > @@ -351,10 +353,14 @@ int ff_h264_decode_ref_pic_list_reordering(H264Context *h, H264SliceContext *sl)
> > if ( !sl->ref_list[list][index].parent
> > || (!FIELD_PICTURE(h) && (sl->ref_list[list][index].reference&3) != 3)) {
> > int i;
> > - av_log(h->avctx, AV_LOG_ERROR, "Missing reference picture\n");
> > + av_log(h->avctx, AV_LOG_ERROR, "Missing reference picture, default is %d\n", h->default_ref[list].poc);
> > for (i = 0; i < FF_ARRAY_ELEMS(h->last_pocs); i++)
> > h->last_pocs[i] = INT_MIN;
> > - return -1;
> > + if (h->default_ref[list].parent
> > + && !(!FIELD_PICTURE(h) && (h->default_ref[list].reference&3) != 3))
> > + sl->ref_list[list][index] = h->default_ref[list];
> > + else
> > + return -1;
> > }
> > av_assert0(av_buffer_get_ref_count(sl->ref_list[list][index].parent->f->buf[0]) > 0);
> > }
> > @@ -524,6 +530,7 @@ void ff_h264_remove_all_refs(H264Context *h)
> > }
> > h->short_ref_count = 0;
> >
> > + memset(h->default_ref, 0, sizeof(h->default_ref));
> > for (i = 0; i < h->nb_slice_ctx; i++) {
> > H264SliceContext *sl = &h->slice_ctx[i];
> > sl->list_count = sl->ref_count[0] = sl->ref_count[1] = 0;
> > --
>
> Patch works for me. But I don't have a big opinion on which to use.
> This one makes future merges easier, buty ou are the most likely to
> work on the H264 decoder in the future, so if noone else has any
> opinions, i would just let you push whichever of the two you prefer.
ok, applied
thanks
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
No snowflake in an avalanche ever feels responsible. -- Voltaire
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20160104/e3f0d06c/attachment.sig>
More information about the ffmpeg-devel
mailing list