[vlc-devel] [PATCH] Added IVTC deinterlacer (NTSC film mode)

Juha Jeronen juha.jeronen at jyu.fi
Sat Jan 8 10:34:36 CET 2011

Hi Laurent,

I've now completed the changes requested.

A big thanks for your fast MMX version of CalculateInterlaceScore(). I 
benchmarked the different versions of  on my netbook:

C version: 5000us per call (on average)
My updated MMX: 2500us per call
Your fast MMX: 1330us per call

You win ;)

Your version is now integrated to the new patch.

Also, thanks for the extra microseconds given by the faster detector ;)

I used them for an updated lock-on mechanism, using (and rewriting) 
parts of the aggressive lock-on patch I posted earlier. It turned out 
the best solution was to simply disable the cadence analysis while no 
motion is detected.

The motion detection (of the trivial "yes" or "no" type) required a 
full-frame pixel diff. In the MMX version, I used the same eight-pixel 
approach as your fast MMX for interlace calculation does. First movq, 
then diff using psubusb (both ways), then pcmpgtb, psadbw and paddd. The 
diff finishes in 2100us on average (on the same netbook).

Thus the total time required for number-crunching per arriving frame is 
approximately 3*1330us + 2100us ~ 6.1ms on this machine. Given that the 
input frame interval is about 33ms (and deinterlacing is not the only 
thing that needs to be done), I'd say the filter is fast enough. Even 
with the motion detector added, the new version has lower CPU usage than 
the original.

This simplified lock-on change required less code changes than the 
original lock-on patch, so I've integrated it to the IVTC patch itself. 
Search for "i_blocks_with_motion" and "b_no_invalids" to find the 
changes in RenderIVTC(). In addition to that, there are two new 
functions: EstimateNumBlocksWithMotion() and TestForMotionInBlock().

The filter still makes the occasional mistake, but I think this change 
gives a noticeable accuracy improvement in some talking scenes, as the 
filter no longer switches off the IVTC as soon as it sees no motion.

I'll post the updated patch itself in a separate message. It's a bit 
over 70kB, so the post needs to be approved before it reaches the list.


More information about the vlc-devel mailing list