[FFmpeg-devel] [PATCH] Port tinterlace filter from MPlayer.

Stefano Sabatini stefasab at gmail.com
Sat Dec 31 11:48:48 CET 2011


On date Saturday 2011-12-31 01:14:59 +0100, Stefano Sabatini encoded:
> On date Tuesday 2011-12-27 13:08:52 +0100, Stefano Sabatini encoded:
> > On date Tuesday 2011-08-30 10:50:12 +0200, Stefano Sabatini encoded:
> [...] 
> > Updated with misc cosmetics for improving readability, I'll apply soon
> > if I read no comments.
> > -- 
> > FFmpeg = Fascinating and Forgiving Magical Pacific Evangelical God
> 
> > From 9c00b7e9eed542938273b81f70dc0bb7d6d2d45e Mon Sep 17 00:00:00 2001
> > From: Stefano Sabatini <stefano.sabatini-lala at poste.it>
> > Date: Sat, 25 Jun 2011 13:06:24 +0200
> > Subject: [PATCH] lavfi: port tinterlace filter from MPlayer
> > 
> > Port MPlayer tinterlace filter from MPlayer, with some ideas taken
> > from the FFmbc/libavfilter port, with the following main differences:
> [...]
> > --- a/doc/filters.texi
> > +++ b/doc/filters.texi
> > @@ -2420,6 +2420,41 @@ Complete example of a thumbnail creation with @command{ffmpeg}:
> >  ffmpeg -i in.avi -vf thumbnail,scale=300:200 -frames:v 1 out.png
> >  @end example
> >  
> > + at section tinterlace
> > +
> > +Perform temporal field interlacing - merge pairs of frames into an
> > +interlaced frame, halving the framerate. Even frames are moved into
> > +the upper field, odd frames to the lower field.
> > +
> 
> > +The frames are counted starting from 1, so the first input frame is
> > +considered odd.
> 
> This is a little inconsistent with the convenction used in showinfo,
> which counts frames starting from 0...
> 
> > +
> > +This filter accepts a parameter specifying the mode. Available modes
> > +are:
> > +
> > + at table @samp
> > + at item 0
> > +Move odd frames into the upper field of the new frame, even into the
> > +lower field, generating a double height frame at half framerate.
> > +
> 
> > + at item 1
> > +Only output odd frames, even frames are dropped, generating a frame with
> > +unchanged height at half framerate.
> > +
> > + at item 2
> > +Only output even frames, odd frames are dropped, generating a frame with
> > +unchanged height at half framerate.
> 
> I previously copied this description from the MPlayer manual, but
> looks wrong to me, indeed in libmpcodecs we have:
> 
>     case 1:
>         if (vf->priv->frame & 1)
>             ret = vf_next_put_image(vf, mpi, MP_NOPTS_VALUE);
>         break;
>     case 2:
>         if ((vf->priv->frame & 1) == 0)
>             ret = vf_next_put_image(vf, mpi, MP_NOPTS_VALUE);
>         break;
> 
> For case 1, apparently we have odd frame -> output, but frame starts
> from 0.
> 
> I fixed the docs accordingly (since I want to keep the two filters
> equivalent), if I'm right the MPlayer manual should be fixed
> accordingly.
> -- 
> FFmpeg = Fancy Friendly Majestic Puritan Encoding/decoding Guru

> From 26020ec55c4373e6088e6f96a8dfcd803c69a1b9 Mon Sep 17 00:00:00 2001
> From: Stefano Sabatini <stefano.sabatini-lala at poste.it>
> Date: Sat, 25 Jun 2011 13:06:24 +0200
> Subject: [PATCH] lavfi: port tinterlace filter from MPlayer
> 
> Port MPlayer tinterlace filter from MPlayer, with some ideas taken
> from the FFmbc/libavfilter port, with the following main differences:
> 
> * added support for full-scale YUVJ formats
> * added support for YUVA420P
> * request_frame() on the filter is forced to return a frame
> * some code factorization (related to the copy_picture_fields() function)
> * fixed black padding values for mode 3
> ---
>  Changelog                   |    1 +
>  configure                   |    1 +
>  doc/filters.texi            |   34 +++++
>  libavfilter/Makefile        |    1 +
>  libavfilter/allfilters.c    |    1 +
>  libavfilter/vf_tinterlace.c |  325 +++++++++++++++++++++++++++++++++++++++++++
>  6 files changed, 363 insertions(+), 0 deletions(-)
>  create mode 100644 libavfilter/vf_tinterlace.c

Pushed.
-- 
FFmpeg = Forgiving Foolish Magnificient Purposeless EnGine


More information about the ffmpeg-devel mailing list