[MPlayer-dev-eng] [PATCH] New mode for 'tinterlace' filter

Ivan Kalvachev ikalvachev at gmail.com
Mon Apr 3 09:41:13 CEST 2006


2006/4/2, Walter Belhaven <wbelhaven at yahoo.com>:
> Hi,
>
> Here's a patch to libmpcodecs/vf_tinterlace.c which adds a new
> mode (-vf tinterlace=4).  The new mode interleaves the even
> lines from Frame 'j' with the odd lines of Frame 'j+1', halving
> the Frame rate in the process while preserving the overall image
> height.  In ASCII art:
>
>    Original        Original             New Frame
>    Frame 'j'      Frame 'j+1'         (tinterlace=4)
>   ==========      ===========       ==================
>     Line 0  -------------------->    Frame 'j' Line 0
>     Line 1          Line 1  ---->   Frame 'j+1' Line 1
>     Line 2 --------------------->    Frame 'j' Line 2
>     Line 3          Line 3  ---->   Frame 'j+1' Line 3
>      ...              ...                   ...
>
> I'll use the following notation to explain this new option and
> why I need it:
>
>  o Capital 'F' means 'F'rames (typically progressive)
>  o lower-case 'f' means 'f'ields (interlaced)
>  o "film" means ~24 *unique* Fps (regardless of how transmitted)
>  o "video" means ~60 *unique* Fps or fps (NTSC)
>
> My application for this filter is transcoding 720p HD "video"
> sources (specifically, 720p/60Fps) to SD NTSC "video", at
> 480i/60fps (30Fps interlaced) for ultimate authoring to an NTSC
> DVD-Video.  Here's how it would be used in practice:
>
>   mencoder ... -vf tinterlace=4,scale=720:480:1 ...
>
> or
>
>   mencoder ... -vf scale=720:480,tinterlace=4 ...
>
> Please see the "@@ Need help" comments I included in the
> implementation of the new case for tinterlace.  I need to know
> whether I should set dmpi->fields to indicate that the (output)
> Frame is interlaced.
>
> Thanks for your review.  I'll be glad to incorporate this into
> the documentation if you folks approve and if someone can tell me
> how to do that. :)
>
> Cheers,
> WB
>
> P.S.  This filter MIGHT also be useful -- in conjunction with
> 'pullup' et. al. -- to recover the original "film" cadence in a
> 720p/60Fps transmission of a "film", in which the broadcaster
> simply duplicates the original "film" Frames in a 2:3:2:3
> pattern.  The 'tinterlace=4' filter can make the 720p/60Fps look
> like hard telecined 720i/30Fps (i.e., 720i/60fps) which is what
> 'pullup' expects to see.  I haven't tested this application yet,
> so I don't know if it works.  It probably doesn't work, unless it
> just magically happens to be at the correct phase of the 2:3:2:3
> pattern.


It would be better if you fix the memcpy_pic() instead of creating your own.
This means you can send patch to fix the special case dstStride==srcStride.
Either by removing it or by checking if Stride==BytesPerLine

It seems this "speed up" have been workarounded in the following filters too:
vf_filmdint,
vf_detc,
vf_ivtc,vf_pullup,
vf_softpulldown,
vf_telecine,
vf_tfields

(Rich isn't pullup yours? why you haven't fixed it!)

On second though, I'm gonna fix it.
something like

        if(dstStride == srcStride && abs(dstStride) == bytesPerLine)

should do the trick.
Comments? Did I miss something?




More information about the MPlayer-dev-eng mailing list