Log in

View Full Version : SincResize taps=128


Divet
1st February 2015, 15:27
Hi!
Could anybody answer, does the taps parameter of SincResize really work?
I've tried taps=128, taps=256, taps=512 and see no difference!
It's impossible because such giant taps must produce giant ringing halo and must reduce the speed almost to zero!

taps=20 and taps=10 looks the same as taps=512! No ringing at all!

Is this parameter completely disabled?
If yes, how many taps does SincResize use instead?

Groucho2004
1st February 2015, 16:02
Hi!
Could anybody answer, does the taps parameter of SincResize really work?
I've tried taps=128, taps=256, taps=512 and see no difference!
It's impossible because such giant taps must produce giant ringing halo and must reduce the speed almost to zero!

taps=20 and taps=10 looks the same as taps=512! No ringing at all!

Is this parameter completely disabled?
If yes, how many taps does SincResize use instead?
The documentation (http://avisynth.nl/index.php/SincResize) would suggest that "taps" gets clamped to 20 for sincresize.

A look at the code confirms it:
/***********************
*** Sinc filter ***
***********************/
SincFilter::SincFilter(int t = 4) {
taps = (double)(max( 1,min(20,t)));
}

Divet
1st February 2015, 16:31
taps = (double)(max( 1,min(20,t)));
Oh, thanks!
So, if taps>20 than 20 uses!

But I am confused that I can't see any difference between taps=10 and taps=20. Why?

Could You look to the screenshots, please? taps=10 and taps=20 are almost identical!

taps=10 (http://molodechno.by/10.png)
taps=20 (http://molodechno.by/20.png)

Groucho2004
1st February 2015, 19:38
But I am confused that I can't see any difference between taps=10 and taps=20. Why?
I can clearly see a difference.
Try this script to visualize and amplify the difference:
a = imagesource("10.png")
b = imagesource("20.png")
Overlay(a, b, mode="Subtract").Levels(0,5,100,0,255)

Divet
1st February 2015, 23:49
I can clearly see a difference.
I am sorry, this is because these are not the same frames (frame number from the beginning).

Now I write this script:

FFVideoSource("D:\Kiki.mkv")
a=SincResize(1280,720,taps=1)
b=SincResize(1280,720,taps=20)
Overlay(a,b,mode="Subtract")

Kiki.mkv is BDRemux 1920x1080

Result - Oh My God, absolutely black rectangle!
So, the taps parameter is ignored. It's terrible!
But no, I'm mistaken! Taps aren't ignored!
Next I tried this:

FFVideoSource("D:\Kiki.mkv")
a=SincResize(640,360,taps=1)
b=SincResize(640,360,taps=20)
Overlay(a,b,mode="Subtract")

And now I see something. A few white curves and stars.

Does it mean that the difference between taps=1 and taps=20 is very, very little and is practically visible only if resize ratio is very, very big?

But where are giant ringing artefacts which must be produced by taps=20? I don't understand this...

Groucho2004
2nd February 2015, 00:39
Try comparing two completely different resizers like this:
a=bicubicResize(640,360)
b=spline64Resize(640,360)
Overlay(a,b,mode="Subtract").Levels(0,5,100,0,255)

Even with enhanced levels you can barely see the difference. Maybe you should try Compare() (http://avisynth.nl/index.php/Compare).

foxyshadis
3rd February 2015, 01:55
Why would you assume you'll get giant horrifying ringing artifacts with 20 taps? The effect of each further tap is reduced exponentially; by the time you get to 6 or 7 you're probably already below the precision floor of 8-bit video. (I don't feel like doing any math right now.) Using 10 or 20 only makes your CPU burn extra calories on the treadmill.

With 16 bit video there might be a minute difference, but it would never be visible.

*.mp4 guy
3rd February 2015, 06:45
You certainly aren't the only person to think this, but it isn't true.

The normalised sinc function is given by sin(pi*x)/(pi*x). from this it should be clear that the sinc function decays linearly as you move away from the origin. Its decay is directly analogous to the decay of the function 1/x.

It is easiest to show the ringing cause by large tap sinc filters unambiguously using very large images. Make sure to view them at a 1 to1 zoom or the ringing may not be visible.

10 tap sinc (http://www.imagebam.com/image/4f2c82386818277)
256 tap sinc (http://www.imagebam.com/image/27668f386818348)

colours
10th February 2015, 01:11
One interesting tidbit about sinc interpolation is that it's not guaranteed to converge as you increase the number of taps because it's not absolutely convergent. For a particularly pathological case, try working out what truncated sinc interpolation does to …,0,1,0,1,0,1,1,0,1,0,1,0,…

In other words, not only does sinc decay slowly, there isn't even a large number of taps such that the error will always fall below −48 dB (or any arbitrary threshold).

(When working with images of bounded size, though, sinc will always converge under the assumption of reasonable border handling, such as tiling, mirroring or extension.)

pandy
10th February 2015, 09:36
Why would you assume you'll get giant horrifying ringing artifacts with 20 taps? The effect of each further tap is reduced exponentially; by the time you get to 6 or 7 you're probably already below the precision floor of 8-bit video. (I don't feel like doing any math right now.)

Here you are - Sinc with ω=0.495 (at 13.5Mhz sample rate this should give somewhere 6.68 MHz bandwidth)


55,55,55,54,55,54,55,54,55,54,55,54,55,54,55,54,55,54,55,54,55,54,55,54,55,54,55,54,55,54,55,54,55,54,55,54,55,54,55,54,55,54,55,54,55,54,55,54,55,54,55,54,55,54,55,54,55,54,55,54,55,55,55,55,55,55,55,55,55,55,55,55,55,55,55,55,55,55,55,55,55,55,55,55,55,55,55,55,54,55,54,55,54,55,54,55,54,55,54,55,54,55,54,55,54,55,54,55,54,55,54,56,54,56,54,56,54,56,54,56,54,56,54,56,54,56,54,56,54,56,53,56,53,56,53,56,53,56,53,56,53,56,53,56,53,56,53,56,53,56,53,56,53,56,53,56,53,56,53,56,53,56,53,56,53,57,53,57,53,57,53,57,53,57,53,57,235,57,53,57,53,57,53,57,53,57,53,57,53,56,53,56,53,56,53,56,53,56,53,56,53,56,53,56,53,56,53,56,53,56,53,56,53,56,53,56,53,56,53,56,53,56,53,56,54,56,54,56,54,56,54,56,54,56,54,56,54,56,54,56,54,56,54,55,54,55,54,55,54,55,54,55,54,55,54,55,54,55,54,55,54,55,54,55,54,55,55,55,55,55,55,55,55,55,55,55,55,55,55,55,55,55,55,55,55,55,55,55,55,55,55,55,55,54,55,54,55,54,55,54,55,54,55,54,55,54,55,54,55,54,55,54,55,54,55,54,55,54,55,54,55,54,55,54,55,54,55,54,55,54,55,54,55,54,55,54,55,54,55,54,55,54,55,54,55,54,55,54,55,54,55,54,55,55,55,55,

It still rings after over 150 taps... and this why you need to window it...
http://s1.postimg.org/4pqmokl1r/Sinc.png