Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > Capturing and Editing Video > Avisynth Usage

Reply
 
Thread Tools Search this Thread Display Modes
Old 19th June 2006, 23:04   #1  |  Link
manolito
Registered User
 
manolito's Avatar
 
Join Date: Sep 2003
Location: Berlin, Germany
Posts: 2,724
LanczosResize vs. SplineResize

AviSynth 2.56 introduced two new resizers GaussResize and SplineResize. The AviSynth documentation is quite vague about them, and a forum search only came up with some posts saying that Spline36Resize delivers a better quality than LanczosResize, especially when you are upsizing by a high factor.

I would like to hear some opinions about the strengths and weaknesses of these two resizers. Normally I use Bilinear for downscaling and Lanczos or Lanczos4 for upscaling. Is it a good idea to replace Lanczos by Spline36 in all my scripts, or are there situations where Lanczos beats Spline36 in quality?

Mostly I have to resize 480x576 TV captures to 720x576, and a quick comparison between Lanczos4 and Spline36 did not show any visible improvement for Spline36. But maybe this is due to the already limited source quality (analog cable), or to my standard CRT TV set.

Cheers
manolito
manolito is offline   Reply With Quote
Old 19th June 2006, 23:21   #2  |  Link
*.mp4 guy
Registered User
 
*.mp4 guy's Avatar
 
Join Date: Feb 2004
Posts: 1,350
Spline36 is only very slightly better then lanczos, the difference is not usually vissible with small resizing factors. In your case there would be no real benefit to using Spline36 over lanczos, especially when you consider that you will be encoding to a lossy format that will in all likelyhood get rid of what little differences there would be.
*.mp4 guy is offline   Reply With Quote
Old 20th June 2006, 06:41   #3  |  Link
foxyshadis
ангел смерти
 
foxyshadis's Avatar
 
Join Date: Nov 2004
Location: Lost
Posts: 9,452
The spline kernels are so much more complex that they're quite a bit slower, so if you have fast scripts don't bother. If they're crazy Dide-ish manifestations, or inside something like LimitedSharpen, you might be able to pull a little more sharpness from a good source without ringing (haloing) and softening that way, but you'd only notice a difference on a sharp source going at least 1.5x-2x up or down.
__________________
There are four boxes to be used in defense of liberty: soap, ballot, jury, and ammo. Please use in that order.
foxyshadis is offline   Reply With Quote
Old 20th June 2006, 09:13   #4  |  Link
MrTroy
Registered User
 
Join Date: Apr 2005
Posts: 224
From my post in the MultiSWAR thread:

Original image (1920x816)
MultiSWAR(2560,1088) - Lanczos
MultiSWAR(2560,1088) - Spline36

Spline36 is a tiny bit more precise.
__________________
PAL FACTS
* 20% more horizontal scan lines than NTSC
* No telecine judder
MrTroy is offline   Reply With Quote
Old 20th June 2006, 13:59   #5  |  Link
manolito
Registered User
 
manolito's Avatar
 
Join Date: Sep 2003
Location: Berlin, Germany
Posts: 2,724
Thanks guys!

Cheers
manolito
manolito is offline   Reply With Quote
Old 20th June 2006, 18:19   #6  |  Link
loro
Eraser
 
Join Date: Mar 2006
Posts: 18
Which filter do you guys suggest for downsizing? Lanczos, Natural Bicubic, Bilinear is too soft for my taste.
loro is offline   Reply With Quote
Old 20th June 2006, 18:22   #7  |  Link
Daodan
unrecognized user
 
Join Date: Oct 2005
Location: home of Stella Artois
Posts: 303
Well, usually they say for downsizing use a fast one. Still, I usually use spline16resize or 36. Most people use lanczos.
__________________
zzz
Daodan is offline   Reply With Quote
Old 22nd June 2006, 01:40   #8  |  Link
IanB
Avisynth Developer
 
Join Date: Jan 2003
Location: Melbourne, Australia
Posts: 3,173
There is no difference in speed between equivalent order Lanczos and Spline resizers, the Gauss Resizer is currently the same speed as Lanczos4.

All resizers use the same lookup table based MMX/SSE code. Speed is directly proportional to the number of taps.
IanB is offline   Reply With Quote
Old 22nd June 2006, 02:17   #9  |  Link
foxyshadis
ангел смерти
 
foxyshadis's Avatar
 
Join Date: Nov 2004
Location: Lost
Posts: 9,452
Yes but lanczos uses 4 taps (unless resizing way down), spline16/36 16 & 36 respectively. So there's the speed difference. Unless I'm wrong and you mean spline16=lanczos4 and spline36=lanczos(taps=6) speedwise?

Oh, and out of curiosity, why is there a Mitchell-Netravali filter in the source but unexposed? Just for testing? In other image software it looks about halfway between lanczos and bicubic (presumably it's quite configurable though, being a family of filters).
__________________
There are four boxes to be used in defense of liberty: soap, ballot, jury, and ammo. Please use in that order.
foxyshadis is offline   Reply With Quote
Old 22nd June 2006, 09:28   #10  |  Link
IanB
Avisynth Developer
 
Join Date: Jan 2003
Location: Melbourne, Australia
Posts: 3,173
@foxyshadis, No! The overloadable function ResamplingFunction::support() determines the range for a given resizer. The code samples symetrically left and right upto the value returned.
Code:
Filter    Support  Taps
Point      0.0001   1
Bilinear   1        2
Bicubic    2        4
Spline16   2        4
Lanczos    3        6
Spline36   3        6
Lanczos4   4        8
Gauss      4        8
The Mitchell-Netravali is used to implement the Bicubic resizer.
IanB is offline   Reply With Quote
Old 23rd June 2006, 00:13   #11  |  Link
manolito
Registered User
 
manolito's Avatar
 
Join Date: Sep 2003
Location: Berlin, Germany
Posts: 2,724
Just did a few real world tests using Bicubic(b=0,c=0.6), Lanczos, Lanczos4 and Spline36. I used CCE 2.67 in OPV mode with the standard matrix and tested speed and Q factor. My source was a 115 min PAL TV capture from analog cable (progressive). Capture size was 464 x 576 using Picvideo MJPEG codec. My script was:

AviSource("MyCapture.avi")
AddBorders(8,0,8,0)
xxxResize(720,576)

No filters, no color conversion. I used DVD2SVCD with the D2SRoBa plugin to determine the Q factor. I watched the resulting DVDs with my 28" standard 4:3 CRT TV set (100Hz flicker free).

For quality I have to say that I was completely unable to tell any difference between the resizers. All resizers looked the same to me.

Code:
			Q factor	Speed

Spline36		   39		 0.54
Lanczos4		   40		 0.55
Lanczos			   39		 0.57
Bicubic(b=0,c=0.6)	   38		 0.58
Conclusion:

There is a difference in speed, but it is not too significant. When more filters are present in the script, the speed difference will be even less.

The Q factor can be used to determine how compressible a clip is. A sharper clip will result in a higher Q factor. It seems that Lanczos4 is sharper than Spline 36, Lanczos is about the same as Spline36, and Bicubic(b=0,c=0.6) is a little less sharp. Of course this does not say anything about the precison of the interpolation.


Cheers
manolito
manolito is offline   Reply With Quote
Old 24th June 2006, 15:10   #12  |  Link
sh0dan
Retired AviSynth Dev ;)
 
sh0dan's Avatar
 
Join Date: Nov 2001
Location: Dark Side of the Moon
Posts: 3,480
As Ian pointed out, the speed difference is not in the resizer. You are most probably seeing small differences due to CCE having to choose different motion estimation.

Regarding "precision of interpolation". There is no such thing, there are "softer" and "sharper" interpolation methods.
__________________
Regards, sh0dan // VoxPod
sh0dan is offline   Reply With Quote
Old 24th June 2006, 16:07   #13  |  Link
manolito
Registered User
 
manolito's Avatar
 
Join Date: Sep 2003
Location: Berlin, Germany
Posts: 2,724
Quote:
Originally Posted by sh0dan
Regarding "precision of interpolation". There is no such thing, there are "softer" and "sharper" interpolation methods.
I was referring to something like "visual quality". BilinearResize with a high value for c is extremely sharp, but it is more "crispness" than sharpness, and Lanczos has much fewer artifacts. So I would say that Lanczos has a higher quality and is "more precise".

Anyone about GaussResize? Analyzing resizer algorithms is way over my head, so I would like to hear some opinions from people who are actually using Gauss. How does it compare to Lanczos4 and Spline36?

Cheers
manolito
manolito is offline   Reply With Quote
Old 24th June 2006, 16:51   #14  |  Link
Chainmax
Huh?
 
Chainmax's Avatar
 
Join Date: Sep 2003
Location: Uruguay
Posts: 3,103
I've compared GaussResize(H,V,p=100) to Lanczos4Resize on several projects and in my opinion p=100 looks sharper than Lanczos4 but artificially so. Bear in mind that my projects all included low detail, severely filtered video though, I have no idea how they compare on more usual scenarios.
__________________
Read Decomb's readmes and tutorials, the IVTC tutorial and the capture guide in order to learn about combing and how to deal with it.
Chainmax is offline   Reply With Quote
Old 25th June 2006, 03:54   #15  |  Link
IanB
Avisynth Developer
 
Join Date: Jan 2003
Location: Melbourne, Australia
Posts: 3,173
Digital sampling theory is best left to the Mathemagicians of this world. The premise "I don't know art, but I know what I like" serves best here.

The rational for Spline is to be as sharp as possible without the ringing Lanczos implies. Lanczos wants to be as sharp as possible without being visually displeasing. Gauss? Hmm, is a strange beast, but it can look very nice sometimes.
Code:
class GaussianFilter : public ResamplingFunction
...
double support() { return 4.0; };
...
GaussianFilter::GaussianFilter(double p = 30.0) {
  param = min(100.0,max(0.1,p));
}

double GaussianFilter::f(double value) {
  value = fabs(value);
  double p = param*0.1;
  return pow(2.0, - p*value*value);
}
Above is the guts from the GaussResize() filter. Support dictates 4 tap sampling. P the blur/sharpness parameter can be between 0.1 and 100 (Chainmax want us to play with P=100).

As the lookup table for the resamler is being evaluated, the function f() will be sampled with -4 < value < 4. Here is a table of typical returned values
Code:
value f(value)
0.0   1.0
0.25  0.648
0.5   0.177
0.95  0.002 = (1/521)
1.0   0.001
2.0   9.1e-13
3.0   8.1e-28
4.0   0
As can be seen only the taps in the -0.95 < T < 0.95 range can contribute usefull weight to the output pixel. At maximum sharpness this filter is almost a point resizer.

An obvious performance enhancment here could be to limit support() based on P and also possibly increase it for low values of P.
IanB is offline   Reply With Quote
Old 9th July 2006, 04:38   #16  |  Link
Chainmax
Huh?
 
Chainmax's Avatar
 
Join Date: Sep 2003
Location: Uruguay
Posts: 3,103
That looks interesting, if you implement it I'll compare Lanczos4 to Gauss again.
__________________
Read Decomb's readmes and tutorials, the IVTC tutorial and the capture guide in order to learn about combing and how to deal with it.
Chainmax is offline   Reply With Quote
Old 9th July 2006, 08:34   #17  |  Link
IanB
Avisynth Developer
 
Join Date: Jan 2003
Location: Melbourne, Australia
Posts: 3,173
@Chainmax,

Twidling the Support() value based on P won't change the look of the filter (well maybe for very small P, i.e. lots of blur, it might) it might however boost performance significantly.
IanB is offline   Reply With Quote
Old 6th February 2007, 10:25   #18  |  Link
.Sp!dr
Registered User
 
Join Date: Jan 2007
Posts: 26
Sorry to dig up old threads, but I do have a few questions. Hope you don't mind. Also I would like to say Hi since this is my first post on Doom9 and complain about waiting 5 days till I could post... I forgot most of my inquiries. Damn.

Recently, MeGUI added support for Gauss, Point, Spline16 and Spline36 even though these were added in AviSynth a long time ago. June according to the first post here . I know Spline36 is more advanced, so I was wondering what to use for downscaling anime content.

Up untill now, I used "Lanczos (Sharp)" and not Lanczos4. Lanczos4 is a bit too sharp for my taste... Or was I wrong ?

The other thing I was wondering about is why do I need to resize at all. My source is 704x396 and I was told you need to resize to a mod16 resolution for a better compression. At least that's what MeGUI (x264) said. So I was like Ok and choose "Clever anamorphic... blablabla" at a width of 640 so the height was instanlty choosen at 352.

Did I do something wrong ? Is more bitrate allocated on a smaller resolution video stream ? Is there any 'visual' improvement achieved from downscaling animated video content, apart from the height being too small and getting blocky ? I would say 352 pixels are quite acceptable... Anything near 240 is plain horrible.

Also, please note I'm using x264.

I've got a perfect memory so any advice is thoroughly noted, and I will not ask these questions again. Sorry for being a n00b. We all gotta start somewhere.

Last edited by .Sp!dr; 6th February 2007 at 10:27.
.Sp!dr is offline   Reply With Quote
Old 6th February 2007, 10:31   #19  |  Link
*.mp4 guy
Registered User
 
*.mp4 guy's Avatar
 
Join Date: Feb 2004
Posts: 1,350
Spline36 is very good for downsizing (imo the best downscalar) it has less artifacts than anything else, better aliasing avoidance then bilinear, sharper then bicubic, 99% as sharp as lanczos without the ringing.

reasons to downscale are
-better sharpness/artifacts tradeoff at low bitrates (very low for avc)
-more efficient storage of low spatial resolution content (ie better storage of blurry sources)
-keeping mod 16 resolutions to aid compresion (you can also upscale, if you really don't want to lose pixels)
-keeping a 1:1 pixel aspect ratio for better compatibility and compresion (you can also upscale, if you really don't want to lose pixels)

Last edited by *.mp4 guy; 6th February 2007 at 10:36.
*.mp4 guy is offline   Reply With Quote
Old 6th February 2007, 10:54   #20  |  Link
.Sp!dr
Registered User
 
Join Date: Jan 2007
Posts: 26
Hmm... Thanks for the info.

What about Spline64 ?
.Sp!dr is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 03:51.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2020, vBulletin Solutions Inc.