PDA

View Full Version : Best filter to use in XMPEG


SpEeDaMiGo
14th December 2001, 09:14
Hi
I'd like to know which filter is best to use in XMPEG. Is it this standard "Bressenham" or whatever ?
I don't have the time for "trial and error". I'm sure some of you could give me some hints. For sure there's no generally best filter, but which filter ist best for which style of movie ?

Thanks

LigH
14th December 2001, 17:17
When you ask "what is best", I need to ask back "best for what?". Do you prefer high quality or fast processing, sharp or stable images? They all only work with a visible difference when resizing the image with a non-integer relation. Try to understand how they work, then it will be easier to decide which one you may like. In general, a subsampling algorithm calculates for each point in the new picture (after resizing), where in the original picture the color information has to be taken from.

"Nearest neighbour" choses one of the original points to be the new point. Very small details can get lost in one frame but pop up in the next. But it is the fastest way.

All other interpolating technologies calculate the exact location in the original picture and decide then how much of the color information from the surrounding pixels is used to calculate the color of the new point:

- "Bresenham" (yes, this person was written with only one "s"!) for example uses the distance weighted portion of the 4 (2x2) surrounding original pixels. Sharp edges are softened. The resulting picture will usually have no noticeable pixel flickering (remember DOOM when moving around very slowly and looking at far textures?) or stairs at slightly slanted lines.

- The so called "linear interploation" behaves a little differently, I'm not really sure how; at least it softens sharp edges a little, but some pixel flickering is possible, and slightly slanted lines can have some stairs.

- "Cubic interpolation" calculates the resulting color over the surrounding 16 (4x4) pixels. This is definitely slower. Sharp edges can be preserved, but slightly slanted lines can have stairs.

I would suggest you to create an own MPEG2 test movie with some patterns with small pixels and diagonal lines, with and without anti-aliasing. Then compare how they are resized, which edges are preserved/sharpened/softened, which pixels get lost and so on. It may be not easy to create a good example because strong contrasts are not the perfect material for MPEG, but then it would be a valuable guide for all of us.

LigH
15th December 2001, 16:06
I have some examples here - hope this helps you deciding which filtering to use:

Original: http://www.ligh.de/pics/Lines.gif

(Resized to 512x288)

Nearest neighbor: http://www.ligh.de/pics/Nearest.gif
Pseudo-Bicubic: http://www.ligh.de/pics/PseudoBQ.gif
Bilinear: http://www.ligh.de/pics/Bilinear.gif
Bicubic: http://www.ligh.de/pics/Bicubic.gif
Bresenham: http://www.ligh.de/pics/Bresenham.gif

(I hope someone will be able to see them, it's my first time posting images...)

SpEeDaMiGo
15th December 2001, 21:46
Hi LigH
Thanks a lot for your comprehensive answer. You're right regarding "which filter is best". Judging by your images, Bresenham and Bicubic look clearly best, but I'm gonna need some more experience to really know which filter to choose.

LigH
15th December 2001, 22:09
I must say, this similarity is only true for this example, I only have thin lines here. Bicubic may bring sharper borders than Bresenham for edges between bigger flat areas...