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

Baptiste Coudurier baptiste.coudurier
Thu Sep 9 21:21:10 CEST 2010


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.

 > +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.

[...]

-- 
Baptiste COUDURIER
Key fingerprint                 8D77134D20CC9220201FC5DB0AC9325C5C1ABAAA
FFmpeg maintainer                                  http://www.ffmpeg.org



More information about the ffmpeg-devel mailing list