Nnedi3ocl/nnedi3x rpow2

From Avisynth wiki
Jump to: navigation, search

Back to nnedi3ocl


nnedi3x_rpow2 is a script function for advanced scaling with chroma and center correction. It supports all planar formats and YUY2 and RGB24 as well. nnedi3x_rpow2 also doesn't complain if you feed it with now removed parameters of original nnedi3_rpow2.

Syntax and Parameters

nnedi3x_rpow2 (clip a, int rfactor, int "nsize", int "nns", int "qual", int "etype", int "pscrn", string "cshift", int "fwidth", int "fheight", "ep0", "ep1", int "threads", int "opt", int "fapprox", bool "Y", bool "U", bool "V")

clip  a =
Input clip.

int  rfactor =
Image enlargement factor. Must be a power of 2 in the range [2,1024].

int  nsize = 0
Sets the size of the local neighborhood around each pixel that is used by the predictor neural network.
  • 0 - 8x6
Only nsize 0 is implemented, other values are simply ignored.

int  nns = 3
Sets the number of neurons in the predictor neural network. Possible settings are 0, 1, 2, 3, and 4. 0 is fastest. 4 is slowest, but should give the best quality.
This is a quality vs speed option; however, differences are usually small. The difference in speed will become larger as 'qual' is increased.
  • 0 - 16
  • 1 - 32
  • 2 - 64
  • 3 - 128
  • 4 - 256

int  qual = 1
Controls the number of different neural network predictions that are blended together to compute the final output value.
Each neural network was trained on a different set of training data. Blending the results of these different networks improves generalization to unseen data.
Possible values are 1 or 2. Essentially this is a quality vs speed option. Larger values will result in more processing time, but should give better results.
However, the difference is usually pretty small. I would recommend using qual>1 for things like single image enlargement.

int  etype = 0
Controls which set of weights to use in the predictor nn. Possible settings:
  • 0 - weights trained to minimize absolute error
  • 1 - weights trained to minimize squared error

int  pscrn =
This option is not implemented and is silently ignored.

string  cshift = ""
Sets the resizer used for correcting the image center shift that nnedi3x_rpow2 introduces. This can be any of Avisynth's internal resizers, such as "Spline36Resize", "LanczosResize", etc...
If not specified the shift is not corrected. The correction is accomplished by using the subpixel cropping capability of Avisynth's internal resizers.

int  fwidth =
int  fheight =
If correcting the image center shift by using the 'cshift' parameter, fwidth/fheight allow you to set a new output resolution.
First, the image is enlarged by 'rfactor' using nnedi3. Once that is completed the image center shift is corrected, and the image is resampled to fwidth x fheight resolution.
The shifting and resampling happen in one call using the internal Avisynth resizer you specify via the 'cshift' string. If fwidth/fheight are not specified, then they are set equal to rfactor*width and rfactor*height respectively (in other words they do nothing).

  ep0 =
  ep1 =
Some Avisynth resizers take optional arguments, such as 'taps' for LanczosResize or 'p' for GaussResize. ep0/ep1 allow you to pass values for these optional arguments when using the 'cshift' parameter.
If the resizer only takes one optional argument then ep0 is used. If the argument that the resizer takes is not a float value, then ep0 gets rounded to an integer.
If the resizer takes two optional arguments, then ep0 corresponds to the first one, and ep1 corresponds to the second. The only resizer that takes more than one optional argument is BicubicResize(), which takes 'b' and 'c'. So ep0 = b, and ep1 = c.
If ep0/ep1 are not set then the default value for the optional argument(s) of the resizer is used.

int  threads =
int  opt =
int  fapprox =
These parameters are not implemented and are silently ignored.

bool  Y = true
bool  U = true
bool  V = true
These control whether or not the specified plane is processed. Set to true to process or false to ignore.
Ignored planes are not copied, zero'd, or even considered. So what the ignored planes happen to contain on output is unpredictable.


  • nnedi3x_rpow2 with default settings. This example enlarges the image by 2x but does not correct for center shift.
nnedi3x_rpow2(rfactor=2, nsize=0, nns=3, qual=1, etype=0, cshift="", Y=true, U=true, V=true)

  • Enlarge image by 2x and correct for center shift using Spline36Resize.
nnedi3x_rpow2(rfactor=2, cshift="Spline36Resize")

  • Enlarge image by 8x, correct for center shift and downsample from 8x to 7x using LanczosResize with 5 taps.
nnedi3x_rpow2(rfactor=8, cshift="LanczosResize", fwidth=width*7, fheight=height*7, ep0=5)

Back to nnedi3ocl

Personal tools