[FFmpeg-devel] [PATCH] yadif port to libavfitler

Stefano Sabatini stefano.sabatini-lala
Fri Sep 10 01:24:08 CEST 2010


On date Thursday 2010-09-09 12:21:10 -0700, Baptiste Coudurier encoded:
> On 09/08/2010 08:50 AM, Stefano Sabatini wrote:
> >On date Saturday 2010-09-04 12:45:08 +0200, Stefano Sabatini encoded:
> >[...]
> >>Updated against the av_get_cpu_flags() patch.
> >>
> >>Still missing documentation (Baptiste feel free to continue to work on
> >>this, I don't even know how did you test it).
> >
> >Updated again. Documentation for the second param should be extended,
> >(Mplayer docs is outdated as well), also maybe ASM code should be
> >placed in /ARCH dirs.
> >
> >I'll let someone else work on this though, so don't expect other
> >updated patches from me.
> >
> >Regards.
> >
> >
> >0001-Add-yadif-filter.patch
> >
> >[...]
> >
> >+
> >+    if (!yadif->prev)
> >+        yadif->prev = avfilter_get_video_buffer(link, AV_PERM_WRITE | AV_PERM_PRESERVE |
> >+                                                AV_PERM_REUSE, link->w, link->h);
> 
> If prev is not available (ie first frame) it is better to duplicate
> cur, it produces better results, even if it differs from mplayer.
> 
> >+
> >+    picref = avfilter_get_video_buffer(link, AV_PERM_WRITE | AV_PERM_PRESERVE |
> >+                                       AV_PERM_REUSE, link->w, link->h);
> >+
> >+    parity = yadif->parity == -1 ? yadif->parity : yadif->cur->video->top_field_first;
> 
> This is wrong on my part, it parity is -1 it should be
> cur->video->top_field_first.
> 
> >+    filter(ctx, picref, 1 ^ yadif->cur->video->top_field_first, parity);
> 
> This could be simplified to 1^parity, parity, but I'm not familiar
> with the "field" output mode, Michael should know better.

Please fix these and add documentation for parity, then I have no
further objections for the applications of yadif, other fixes can be
applied thereafter (but maybe we *should* already add a regtest for
it).

> > +static int poll_frame(AVFilterLink *link)
> > +{
> > +    YADIFContext *yadif = link->src->priv;
> > +    int val = avfilter_poll_frame(link->src->inputs[0]);
> > +    if (val > 1 || (yadif->cur && (yadif->next || val > 0)))
> > +        return 1;
> > +    return 0;
> 
> There is one more important problem that must addressed in the
> libavfilter framework. Yadif cannot know if the previous filter has
> hit EOF, and should output the last buffered frame.
> 
> Currently the filter looses the last frame.

Regards.
-- 
FFmpeg = Fostering and Foolish Murdering Proud Ephemeral God



More information about the ffmpeg-devel mailing list