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 14th April 2012, 01:25   #1  |  Link
D-Dave
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.
D-Dave is offline   Reply With Quote
Old 14th April 2012, 02:33   #2  |  Link
Asmodian
Registered User
 
Join Date: Feb 2002
Location: San Jose, California
Posts: 2,602
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:
enlarge image by 4x, don't correct for center shift.

nnedi3_rpow2(rfactor=4)
I prefer a less ringing resize compaired to lanczos4, lanczos4 also requires more bits to encode. I like spline36 for most of my down scale resizes. Doing a large upscale I would use nnedi3 followed by spline36 to downscale again to the desired resolution, if I had the time.

I like this set of kernel visualizations from PhrostByte's ResampleHQ's documentation to understand the tradeoffs between resizers.
Asmodian is offline   Reply With Quote
Old 14th April 2012, 02:58   #3  |  Link
IanB
Avisynth Developer
 
Join Date: Jan 2003
Location: Melbourne, Australia
Posts: 3,168
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.
IanB is offline   Reply With Quote
Old 14th April 2012, 07:52   #4  |  Link
*.mp4 guy
Registered User
 
*.mp4 guy's Avatar
 
Join Date: Feb 2004
Posts: 1,350
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.
*.mp4 guy is offline   Reply With Quote
Old 14th April 2012, 09:11   #5  |  Link
Gavino
Avisynth language lover
 
Join Date: Dec 2007
Location: Spain
Posts: 3,374
Quote:
Originally Posted by IanB View Post
PointResize implements the nearest neighbour algorithm
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
PointResize effectively has this:
Code:
  --------
 |       |
 |       |
 |       |

-1       0
Essentially, this is the root of the different behaviour between RGB and YUV with vertical PointResize.

Interestingly, in light of your other comment,
Quote:
GaussResize at it's sharpest P setting is a PointResize.
GaussResize(P=100) does provide a true nearest neighbour.
__________________
GScript and GRunT - complex Avisynth scripting made easier

Last edited by Gavino; 14th April 2012 at 10:13. Reason: amend diagrams
Gavino is offline   Reply With Quote
Old 14th April 2012, 13:44   #6  |  Link
gyth
Registered User
 
Join Date: Sep 2011
Posts: 86
I found the cambridge in colour tutorials helpful.
1 2 3

ImageMagick guide
upsizing pixel art
gyth is offline   Reply With Quote
Old 14th April 2012, 15:08   #7  |  Link
Gavino
Avisynth language lover
 
Join Date: Dec 2007
Location: Spain
Posts: 3,374
Quote:
Originally Posted by IanB View Post
GaussResize at it's sharpest P setting is a PointResize.
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. )
__________________
GScript and GRunT - complex Avisynth scripting made easier
Gavino is offline   Reply With Quote
Old 17th April 2012, 07:32   #8  |  Link
*.mp4 guy
Registered User
 
*.mp4 guy's Avatar
 
Join Date: Feb 2004
Posts: 1,350
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.
*.mp4 guy is offline   Reply With Quote
Old 17th April 2012, 09:36   #9  |  Link
Gavino
Avisynth language lover
 
Join Date: Dec 2007
Location: Spain
Posts: 3,374
Quote:
Originally Posted by *.mp4 guy View Post
Avisynth's bilinear kernel is expanded, compared to the norm, it uses just as many pixels as bicubic
I don't know where you get that idea from.
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:
so it will never be equivelent to GaussResize, or a box filter like standard bilinear would.
But with a high P (small radius), GaussResize can reduce to using only one or two pixels, making it equivalent to PointResize or (in certain cases, like the example I gave) BilinearResize.
__________________
GScript and GRunT - complex Avisynth scripting made easier
Gavino is offline   Reply With Quote
Reply

Tags
downscaling, resizer, super resolution, upscaling

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 04:01.


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