[MPlayer-DOCS] Draft doc on deinterlacers

D Richard Felker III dalias at aerifal.cx
Wed Mar 2 00:23:53 CET 2005


Hey, here's a doc I whipped up really quickly in relation to recent
discussions I've had on deinterlacing. It's just a draft but maybe at
some point we can incorporate this into the docs or just put it in
DOCS/tech.

Rich

-------------- next part --------------
Deinterlacing 101
or "How and why every single deinterlacer sucks"



Interpolative filters (pp=li or pp=ci)

These filters are absolutely, 100% useless. They completely throw away
one field of the image and interpolate a replacement from the other
field. You'll get the same result by using -vf field=0 followed by
scaling back up to full height, with either hardware or software
scaling. Or, in other words, half of the output pixels are entirely
redundant and just wasting storage space.

Advantages: None whatsoever.

Disadvantages: A complete waste.



Linear blend (pp=lb)

The linear blend deinterlacer operates by "blending" the two fields
together, i.e. averaging each field with an linear-interpolated copy
of the other field.

Seen as a convolution operator, it has a (1,2,1)/4 kernel applied on
the whole frame as one progressive image.

Linear blend can also be seen as a lowpass vertical filter on the
whole frame, with linear falloff, ranging from 1 (full transmission)
at the constant coefficient (DC) to 0 (full masking) at the highest
frequency coefficients (height/2).

The pp=l5 filter is identical except that it's composed with a
sharpening kernel to counteract the blurring effects of the lowpass
filter.

Advantages: These are the only filters that unconditionally keep the
same amount of information from both fields. They will never introduce
jagged edges or aliasing-type artifacts.

Disadvantages: Whenever the two fields do not match (i.e. whenever
there is motion), moving objects will appear as two "ghosts" of the
same object. With very-low-motion or high-fieldrate video this may be
tolerable, but usually it will be extremely ugly. Don't even think
about applying blend filters to telecined video.



Median deinterlacer (pp=md)

The median deinterlacer is the only nonlinear transformation in
libpostproc's suite of deinterlacers. It replaces every pixel in odd
fields by the median of its original value and the values of the two
pixels immediately above and below it. Or, said differently, it
destroys all isolated local extrema and replaces them with whichever
of the pixel above or below is closer to the original value.

Advantages: Being nonlinear, this filter actually has a hope of doing
the right thing. If the individual fields are not aliased (i.e.
band-limited to frameheight/4) then this filter will be almost
entirely non-destructive to still frames.

Disadvantages: Video will appear pixellated during motion, and any
high-frequency content in the vertical direction will be mangled --
the damage done to sharp, thin near-horizontal lines is particularly
noticable.



"FFmpeg deinterlacer" (pp=fd or lavcdeint)

This filter is convolution-kernel-based, like the linear blends, but
operates only on the odd field, leaving the even field intact. It can
be seen as a hybrid between interpolative filters (the useless ones)
and blend filters (the ghosting ones), meaning you get the best of
both worlds and the worst of both worlds.

The kernel used on odd lines is (-1 4 2 4 -1)/8, which can be
decomposed into (-1 0 2 0 -1)/8 and (0 4 0 4 0)/8. The latter is
simply the linear interpolation of the two surrounding lines, which
come from the even field, but the additional part with the negative
coefficients is a discrete Laplacian operator or second derivative,
which serves as a sort of edge-detection. This means, in effect, we
end up adding the edges of the odd field to the linear interpolated
even field to make up the new odd field.

Advantages: On still frames without high-frequency content (sharp
edges), this filter almost leaves the picture unchanged. It's for this
reason that many users naively like it and claim it has the best
output.

Disadvantages: Like with interpolative filters, sharp edges in still
images become aliased. If the odd field does not line up with the even
field, and if it has sharp edges, these edges will get superimposed
over the image. The result is that you see an "outlined ghost" of the
dropped field. In content with any sharp edges, this is very visible
and very ugly. In content without sharp edges, the Laplace operator
yields nearly zero, so you're no better off than if you just did
linear interpolation, and of course that's no better than just
discarding a field.






Donald Graft's adaptive kernel deinterlacer (kerndeint)

FIXME: Analyze and document this.





More information about the MPlayer-DOCS mailing list