View Full Version : Optimized Spline36 and Lanczos3 Resizers
joearmstrong
27th May 2022, 10:15
I read in Kodi Wiki about optimized Spline36 and Lanczos3 Resizers:
Spline36 Optimized - 4-tap + 3-lobe filter, more precise than Lanczos2, which tries to produce the sharpest image with slightly less ringing artifacts then Lanczos3 Optimized (differences only noticeable with high resizing factors or when downsizing).
Lanczos3 Optimized - 4-tap filter that uses a 3-lobe Lanczos windowed sinc function (comparable results to Spline36 Optimized, with less aliasing and more sharpness, but more ringing artifacts).
Characteristics of different methods:
Sharpness - Bilinear < Bicubic < Lanczos2 < Spline36 Optim < Lanczos3 Optim < Spline36 < Lanczos3
Aliasing artifacts - Lanczos3 < Spline36 < Lanczos3 Optim < Spline36 Optim < Lanczos2 < Bicubic < Bilinear
Ringing artifacts - Bilinear (no ringing) - Bicubic < Lanczos2 < Spline36 Optim < Lanczos3 Optim < Spline36 < Lanczos3
Is it possible to use these in Avisynth? I want wo test them but I don't know how to configure the resizers accordingly (4-tap, 3-lobe).
" I don't know how to configure the resizers accordingly"
Because they are simply 'linear' methods with just different kernels it is good to simply take kernel functions from sources and apply to some AVS resizers like built-it with AVS rebuild or jpsdr's ResampleMT plugin (may be easier to build and test/debug).
There is also plugin ftmc https://forum.doom9.org/showthread.php?p=1949930#post1949930 where you can provide impulse response of kernel in a text form but you need to calculate its samples for each resample ratio and enter in a long text form.
joearmstrong
27th May 2022, 11:30
Thank you for your hint. This will be more difficult than expected. Taps are easy to set, but lobes...
The idea is not about taps/lobes - the result of a kernel in its shape. The number of lobes/taps is mostly balance of speed/quality. The AVS resampler do not count taps/lobes - it have 'support' value and require kernel function in simple f(x) form. For example gauss kernel do not have any taps. The 'support' value is a hint to resampler to set balance of performance/quality or just to save time from multiplication to zero if kernel function f(x) fades quickly to zero. Like gauss with low enough param value.
So to set a new linear resize function you need to select 'support' value and provide float f(x) kernel sampler function to resampler.
'Optim' mostly probably mean it have some tweaked shape of a kernel so you need not only provide taps/lobes/support value to resampling engine but more important the new 'optimized' kernel function.
joearmstrong
27th May 2022, 12:22
Thank you again - I will take a look at it.
Katie Boundary
30th May 2022, 07:09
What is a Kodi wiki? What makes your filters "optimized"? How can a filter have 4 taps but only 3 lobes? Nothing you're saying makes any sense.
"How can a filter have 4 taps but only 3 lobes?"
It may be different way to count lobes/taps. If skip main lobe around zero and count zero-taps it may be named as 3 lobes and last zero tap counted is 4. The way AVS name taps may be a bit different that give +-1 difference. With large enough taps (filter 'support') the result is about equal if count last touching of zero as +1 tap or not. If I need some close to 'ideal sinc' performance I simply set some 'large enough' taps param like 10 or 20 and not think about ways of counting taps/lobes that may give +-1 difference in actual taps/lobes used.
joearmstrong
30th May 2022, 13:56
What is a Kodi wiki? What makes your filters "optimized"? How can a filter have 4 taps but only 3 lobes? Nothing you're saying makes any sense.
Here is the Official Kodi Wiki where the information about Spline36 Optimized and Lanczos 3 Optimized came from:
https://kodi.wiki/view/Video_playback#Video_Settings
Dogway
30th May 2022, 14:54
The code is here (https://github.com/xbmc/xbmc/blob/139e39995e9ffe38b583aef84dde0b1f03fa3deb/xbmc/cores/VideoPlayer/VideoRenderers/VideoShaders/ConvolutionKernels.cpp#L83).
I think "optimized" stands for faster but lower quality here. I have no experience on scaling kernels but I doubt there is any need on "optimizing" lanczos or spline, they are fast enough already. If you want to suppress ringing in lanzos while keeping same speed you can use a different sinc function like blackman.
joearmstrong
30th May 2022, 18:06
Thank you, Dogway. The filters are named Spline36 Fast and Lanczos3 Fast here. I was hoping for improved quality, not improved speed. But now I know.
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.