Log in

View Full Version : Shifting Resizer?


jmac698
7th July 2012, 11:21
In preparation for (hopefully) writing my software TBC as a plugin, I'm wondering which resizer to use. I've noticed that my script makes blurry images; is that because even a simple .5 pixel shift causes the same interpolation headaches as upsizing, meaning there's no perfect linear resizer and it's always going to be blurry or ringy?
How would I crop to one line at a time and shift it by (float) inside a plugin?

pandy
9th July 2012, 16:21
oversample? point resize x2 x4 x8 x16 ?

jmac698
9th July 2012, 20:14
Yeah, that's what I'm thinking - for simplicity, the plugin will accept externally upsized videos and just do the simplest point sampling internally.
I wish there were more of an image-processing core inside avisynth like Intel IPP.

pandy
10th July 2012, 11:00
Nearest-neighbor (point sampling) interpolation in DSP world is named Zero-order hold - perfect from mathematical point of view so nothing wrong and it is simple and fast.

Didée
10th July 2012, 14:18
Imagine you have a 1-pixel-wide image feature. For simplicity, a 1-pixel line.

Now you want to shift by 0.5 pixels. And you expect to happen ... what?

jmac698
11th July 2012, 09:05
Well well ... I managed to write a working binlinear resizer :)

pandy
11th July 2012, 10:27
Imagine you have a 1-pixel-wide image feature. For simplicity, a 1-pixel line.

Now you want to shift by 0.5 pixels. And you expect to happen ... what?

Nothing, based on Nyquist/Shannon/Kotielnikow - you need at least two samples or you can expect something named aliasing.

Didée
11th July 2012, 11:03
It was just in response to the Q "do I have to face the same blurring/ringing headaches as during upsizing".
==> Sure you have.

Also, Nyquist is fine and all, however the problem is that it's often not respected. If images would always be "as soft as they should" acc. to Nyquist theorem, then ringing would be almost a non-issue with lanczosresize.

pandy
11th July 2012, 15:37
Perhaps i'm wrong but Lanczos is just a sin x/x with limited length - limited to first lobe or by truncation (bad) or by some window function...

*.mp4 guy
11th July 2012, 16:26
Lanczos is indeed a windowed sinc function. The window used is the first lobe of the sinc function itself, scaled so that it will not reach zero until after the last tap of the filter it is windowing. Lanczos can function at any filter length.

jmac698
11th July 2012, 21:55
Great explanation - I could code one from that one sentence. Here's how to visualize it:
http://zone.ni.com/cms/images/devzone/ph/3e5f7a871017.gif