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. |
![]() |
#1 | Link |
Registered User
Join Date: Mar 2011
Posts: 8
|
Advice on Resizing
Lanczos, Lanczos4, Spline 16/36/64, nnedi3, etc. I’m in search of the overall best resizer for downscaling and the overall best resizer for upscaling. In the past I have been using spline 36 as I heard favorable things about the resizer, however, I have this feeling that spline 36 is not the ultimate answer to resizing. After reading “Upscaling in Avisynth – Comparision of resizers,” I felt incline to ask the community what I should use when downscaling and when I’m upscaling.
The writer of the article linked above, Jean, rated the resizers as so: nnedi3 > lanczos/lanczos4 > spline36 > everything else (slightly different than what I’ve read from other individuals). Would anyone agree that for general upscaling nnedi3 should be used before lanczos/4 and so forth? If not, what would be the best resizer for general upscaling? Are there any typical situations where one resizer will perform noticeably better than the “best” general upscaling resizer (if so explain)? Side note, when explaining a resizer, could you provide an example or two on how to execute it for reference on how to implement it into one’s script (I’m not sure how to use nnedi3 as a resize). ![]() As for downscaling video, would the resizer used in upscaling also be the best for downscaling or is there a resizer that is more appropriate? Are there any typical situations where one resizer will perform noticeably better than the “best” general downscaling resizer (if so explain)? If its dire to know what I will be using the resizers for in order to make a recommendation, I plan on downscaling 1080i footage to 1280 by 720 as well as upscaling 480i footage to 1280 by 720 (all interlaced footage will be deinterlaced beforehand with QTGMC). In some cases I will upscale the 1080i footage from 1440x1080 to 1920x1080 and in other cases 480i to 1920x1080 (or a 4:3 aspect ratio for 1080). Bonus question: Has anyone looked into the super resolution that is offered in vReveal? I’ve had the program since version 1.1 and I was curious how the super resolution performs in upscaling video in comparison to what Avisynth has to offer. I will probably run my own tests in my free time, but if anyone already has information and experience with vReveal’s super resolution feel free to post. |
![]() |
![]() |
![]() |
#2 | Link | |
Registered User
Join Date: Feb 2002
Location: San Jose, California
Posts: 4,448
|
Just a friendly note:
Don't ask what is best (check out the fourm rules) To use nnedi3 to upscale you use nnedi3_rpow2(). The first example from the help file for nnedi3: Quote:
I like this set of kernel visualizations from PhrostByte's ResampleHQ's documentation to understand the tradeoffs between resizers. |
|
![]() |
![]() |
![]() |
#3 | Link |
Avisynth Developer
Join Date: Jan 2003
Location: Melbourne, Australia
Posts: 3,167
|
All of the inbuilt Avisynth resizers effectively work the same way. The difference between them is how many taps each use and what weight do they apply to each tap. More taps allows for higher sharpening but risks more ripples (ringing). The actual choice of tap weights sets the actual degree of sharpening and risk of ringing. The spline family are generally considers conservative, with emphasis on avoiding ringing. The lanczos family is more aggressive, favouring higher sharpening at the risk of marginally observable ringing, blackman is a lanczos variant that favours a slightly more conservative sharpening for higher tap counts.
The nnedi family are neural net trained edge directed interpolaters. At a single pass they will double the height of the input image. All other size adjustments are made with combinations of 90 degree rotations, multiple passes and a final standard downsize to the actual size required. For up-sizing by a factor of 2 a nnedi interpolation is currently the state of the art. Your choice of actual resizer used should be subjectively based on the actual content of the material involved. There is no one size fits all. Crystal sharp sources almost certainly do not want any extra sharpening. Soft sources may withstand extreme sharpening particularly with large downsizing ratios. Avisynth provides many resizers so you can choose the best one for your current source material. Note 1: PointResize implements the nearest neighbour algorithm, so no taps or weighting is involved. Note 2: BilinearResize and GaussResize only use positive tap coefficients so provide no sharpening and cause no ringing. All the other resizers use some negative coefficients to provide sharpening and risk ringing. GaussResize at it's sharpest P setting is a PointResize. BicubicResize is a 3 tap resizer, user selectable B and C values make it fully tunable to suit any needs. |
![]() |
![]() |
![]() |
#4 | Link |
Registered User
Join Date: Feb 2004
Location: USA
Posts: 1,348
|
Negative lobe coefficients past the first are not directly analogous to sharpening, and the first is debatable. Additionally, you can get ringing without negative coefficients. "34 0 0 0 63 100 63 0 0 0 34" will cause ringing no matter what sign's you give. It's more about phase discontinuity then coefficient sign, hell look at a large radius box blur sometime, it almost looks like it is ringing itself.
Not to say that your advice is incorrect, it isn't. The whole "negative lobe coefficients=sharpening" thing just gets on my nerves as it is overly simplistic. Negative lobes give better roll-off then keeping everything positive unless you are willing to completely nuke the passband. |
![]() |
![]() |
![]() |
#5 | Link | |
Avisynth language lover
Join Date: Dec 2007
Location: Spain
Posts: 3,437
|
Something I've been meaning to point out for some time is that PointResize isn't strictly 'nearest' neigbour, as it is biased to one side.
A nearest neighbour kernel would look like this: Code:
-------- | | | | | | -0.5 0 0.5 Code:
-------- | | | | | | -1 0 Interestingly, in light of your other comment, Quote:
Last edited by Gavino; 14th April 2012 at 10:13. Reason: amend diagrams |
|
![]() |
![]() |
![]() |
#7 | Link |
Avisynth language lover
Join Date: Dec 2007
Location: Spain
Posts: 3,437
|
Thinking more about this, it's not always true and depends on resize ratio and where the resampling points fall.
Certainly, with P=100, the Gaussian kernel falls off so steeply that in many cases only the nearest pixel will have a non-zero weight, which I think is the basis of Ian's assertion. However, if a resampling point is halfway between two pixels, both neighbouring pixels will have equal weights (and if it's close to halfway, they will both still be non-zero and close to equal). Thus, for example, GaussResize(2*width, 2*height, 0.25, 0.25, P=100) gives identical results to BilinearResize(2*width, 2*height, 0.25, 0.25) for RGB clips and the luma of YUV clips. (For YUV chroma, the offsets need to be 0.5). (D-Dave, sorry for this technical hair-splitting which is really tangential to your original question. ![]() |
![]() |
![]() |
![]() |
#8 | Link |
Registered User
Join Date: Feb 2004
Location: USA
Posts: 1,348
|
Avisynth's bilinear kernel is expanded, compared to the norm, it uses just as many pixels as bicubic, so it will never be equivelent to GaussResize, or a box filter like standard bilinear would.
Anyway, to get closer to the original topic, most of the time I would now recommend using BlackmanResize(width, height, taps=5). The blackman windowing function is good enough that you can commonly get away with a higher number of taps then avisynth's other interpolators, which is good because it really needs them. BlackmanResize looks a bit more "neutral" then spline or lanczos, but occasionally it will let some aliasing through, especially with taps of 3 or less. |
![]() |
![]() |
![]() |
#9 | Link | ||
Avisynth language lover
Join Date: Dec 2007
Location: Spain
Posts: 3,437
|
Quote:
Here is the relevant code from resample_functions.h: Code:
class TriangleFilter : public ResamplingFunction /** * Simple triangle filter, used in BilinearResize **/ { ... double support() { return 1.0; } }; class MitchellNetravaliFilter : public ResamplingFunction /** * Mitchell-Netraveli filter, used in BicubicResize **/ { ... double support() { return 2.0; } ... }; Quote:
|
||
![]() |
![]() |
![]() |
Tags |
downscaling, resizer, super resolution, upscaling |
Thread Tools | Search this Thread |
Display Modes | |
|
|