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

Stefano Sabatini stefasab at gmail.com
Sat Dec 31 01:14:59 CET 2011


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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-lavfi-port-tinterlace-filter-from-MPlayer.patch
Type: text/x-diff
Size: 16322 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20111231/35055ef1/attachment.bin>


More information about the ffmpeg-devel mailing list