photos

15/Apr/2010 PA
12/Apr/2009 Sunrise Circus
15/Mar/2009 Lego
08/Mar/2009 Moomba
13/Feb/2009 Car Smokey Sunset
26/Jan/2009 Fireworks
26/Oct/2008 Synchrotron
07/Jun/2008 Model Trains
06/Jun/2008 Wedding
04/Jun/2008 Central Coast Trip
more photos...

lavtools

03/Nov/2011 yuvvalues
03/Nov/2011 yuvrfps
03/Nov/2011 yuvdiff
03/Nov/2011 yuvaddetect
03/Nov/2011 yuv2jpeg
more lavtools...

Creativity

The TRIP is the mental projection of my digital self. Including all areas of digital work I have been involved with, including Music, video, photography...

All good web pages must have the collection of absolutely useless pictures. Designed for no purpose other than to consume kilobits. And hopefully show off some of my Photographic skills. Web design skills, and uses one php script to drive the whole index. Also see the Photography section of the Silicontrip Website.

The Creative section of the TRIP is my imagination trying to run free. I have a fascination with sexual, spiritual and meta physical abilities, and these stories show it.

Part of the images directory contains some of my digital artwork. These images have been created or enhanced by myself, with the help of the 1s and 0s machine.

album

23/Feb/2011 Trace
17/Jan/2010 Food
30/Oct/2009 Airbrush
18/Jun/2009 Focal
01/Jun/2009 Transport
01/Jun/2009 Misc
31/May/2009 Artwork
24/Apr/2009 AirbrushScales
18/Apr/2009 Probe
10/Jan/2009 Scanimation
more album...

blog

27/Jan/2012 ZFS for OSX
14/Dec/2011 Scripting Bridge
02/Dec/2011 Core Audio Units
01/Mar/2011 A useful bit of code
22/Dec/2010 Larger than 4G files on FAT for OSX
08/Dec/2009 Time machine on non HFS drives
21/Oct/2009 My Strengths
27/Aug/2009 Train Hitchiking
11/Jul/2009 A litre of onions
19/Jun/2009 FSCK for NTFS
18/Jun/2009 Automated Focal Deconstruction
12/Jun/2009 Perl code to write BMPs
07/Jun/2009 More Lego
01/Jun/2009 Latest Airbrushing
30/May/2009 Happy Birthday to me
24/May/2009 Comments Engine
09/May/2009 Skills Matrix
24/Apr/2009 Airbrush simulator
19/Apr/2009 Ben 10 Board game
29/Mar/2009 How fresh is your fresh food?
more blog...

BACK

22/Sep/2011 yuvdeinterlace

New version Lavtools code.

yuvdeinterlace.c

Double frame rate de-interlacer

A non destructive deinterlacer. Converts to a double frame rate, progressive yuv stream for further processing by temporal based non interlace aware filters. Then re-interlaced or frame rate converted before encoding.

This program uses an experimental detection algorithm to detect interlaced pixels and then uses cubic interpolation to replace pixels that are suffering comb effect. Image data is not lost as the frame rate is doubled. This adaptive algorithm is quite effective, however not ideal. Noisey artefacts may be apparent in (some) most material.

I have been looking into implimenting a 4 point DFT on the data and looking at the amplitude of the high (/2) frequency component. This has lead to better results but appears to still have issues at the boundary of interlace and non interlace material.

The above code could be extended to an arbitary number of pixels, comparing the /2 (interlace) frequency with the /4 frequency.

This release of the code I have played with comparing both the high frequency and the next frequency component. The high frequency shows areas of interlace however also detects edges. The second frequency component detects edges. By balancing these two results, by trial and error, I beleive to have come up with a better detection algorithm. However non interpolated interlace artefacts are still apparent. This is the best results so far.

Just when I thought I tuned the DFT algorithm to the best parameters. I came up with another method that simply looked for a "greater than, smaller than, greater than" pattern and as a result are now detecting interlace much more accurately than before. I also added an additional test on the AC value to eliminate non noticable interlace (or noise). This version is now available.

I am extremely happy with the results. Although not perfect, there are false positives, and a few false negatives. Of course I will be fine tuning this filter even more over time. For now I would use it as part of a yuv filter chain for my production videos.

TODO

Write a pixel merging algorithm for conversion of 25i material to 25p (rather than 50p).
Look at ways to perform anti-aliasing for fixing up nearest neighbour de-interlace filters. These sorts of filters should be shot, as it's quite easy to write a linear interpolator, not to difficult to write a cubic interpolator, and look I just wrote an adaptive type de-interlacer. I can't believe I saw this kind of de-interlace filter used on an episode of Top Gear the other night. Disgraceful!
Provide a screenshot...

Ideas

I have been experimenting with training a neural net to *learn* what the missing pixel may be from the surrounding pixels. My first attempts have not worked, if it is trained from images with many uphill lines, then uphill interpolation looks fantastic but downhill is very jaggered.

I am thinking about increasing the number of hidden layers in the neural net to see if it improves interpolation. The code is in java, I'll just need some encouragement to look at it again.

This part of the code would replace the cubic interpolator. Detection would still be separate algorithm, however comparing the interpolated pixel with the real pixel and replacing the real pixel with the interpolated if it is different by a threshold amount. May prove a better algorithm.

Example

by default yuvdeinterlace will double the frame rate and convert fields into full height frames. No arguments needed.