View Full Version : Why don't the built-in resizers use a 2D kernel?
mimungr
23rd November 2005, 18:11
I'm digging through the AVISynth source code. If I'm reading it correctly, the built-in resize filters don't do a 2D resize. Instead, they resize horizontal and vertical independently. Is this purely for performance reasons? I would think that a 2D kernel would yield better results. I'm tempted to implement such a filter, but don't want to waste my time if that avenue has already been explored and rejected. I'm particularly interested in a 2D version of Lanczos3.
Manao
23rd November 2005, 19:11
The kernel used are separable, so the only loss in quality is due to rounding to a 8 bits integer between the horizontal and the vertical step.
mimungr
23rd November 2005, 21:50
I understand that. But wouldn't a non-separable 2D kernel yield better results?
In other words, AVS is effectively using f(x) + f(y). I'm proposing f(sqrt(x^2 + y^2)). So the Lanczos window is a circle, not a square, and the matrix isn't separable.
Does AVS use a separable kernel because it yields better image quality? Or because it's good enough and a non-separable kernel is too slow?
Manao
23rd November 2005, 22:29
mimungr : it's not f(x) + f(y), it's f(x)*g(y) ( else it wouldn't be separable ).
Anyway, a separable kernel is chosen because pixels are squares, not circles, and the sampling grid is made of squares. ( that's the quickest explanation without having to go into the fourier space and having to write some formulas )
Fizick
25th November 2005, 18:07
I always wondered too, why do not exist some simple non-separable 2D resizer filter (similar to bi-linear for example). Or may be it is named "precise" bilinear?
MfA
25th November 2005, 18:56
Anyway, a separable kernel is chosen because pixels are squares, not circles, and the sampling grid is made of squares. ( that's the quickest explanation without having to go into the fourier space and having to write some formulas )I dunno ... I think if you implemented something like lanczos with a circularly symmetric sinc function it would look a little better, just not enough better to justify the cost.
IanB
28th November 2005, 09:31
@mimungr,
If you are so keen knock yourself out. However with the use of only 8 bit data the difference will struggle to exceed the 1/256th needed to be detectable and it will probably be as slow as ...
If 15 bit data is ever implemented you might have a case, but you are probably going to want to start with 5 or 6 tap filters first.
vBulletin® v3.8.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.