Nnedi3/nnedi3 rpow2
From Avisynth wiki
Back to nnedi3 ←
Contents |
Description
nnedi3_rpow2 is for enlarging images by powers of 2.
Requirements
- Progressive input only
- Supported color formats: RGB24, YUY2, YV12
Syntax and Parameters
- nnedi3_rpow2 (clip, int rfactor, int "nsize", int "nns", int "qual", int "etype", int "pscrn", string "cshift", int "fwidth", int "fheight", float "ep0", float "ep1", int "threads", int "opt", int "fapprox")
- clip =
- Input clip.
- clip =
- int rfactor =
- Image enlargement factor. Must be a power of 2 in the range [2 to 1024].
- int rfactor =
- int nsize = 0
- Sets the size of the local neighborhood around each pixel that is used by the predictor neural network.
- Possible settings (x_diameter x y_diameter):
- int nsize = 0
- 0 - 8x6
- 1 - 16x6
- 2 - 32x6
- 3 - 48x6
- 4 - 8x4
- 5 - 16x4
- 6 - 32x4
- For image enlargement it is recommended to use 0 or 4. Larger y_diameter settings will result in sharper output.
- For deinterlacing larger x_diameter settings will allow connecting lines of smaller slope. However, what setting to use really depends on the amount of aliasing (lost information) in the source.
- If the source was heavily low-pass filtered before interlacing then aliasing will be low and a large x_diameter setting wont be needed, and vice versa.
- 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.
- int nns = 3
- 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 should in theory improve generalization to unseen data.
- In practice, however, blending the results of two networks can lead to hallucinations and therefore introduce artifacts.
- Possible values are 1 or 2. When 1 is selected, a single network is gonna be used, while when 2 is selected, the results of two networks are blended together.
- In some cases, 2 can provide better results, however the difference is pretty small. The downside is that it can lead to hallucinations.
- The recommended setting is therefore to set qual to 1 unless you know what you're doing.
- int qual = 1
- int etype = 0
- Controls which set of weights to use in the predictor nn. Possible settings:
- int etype = 0
- 0 - weights trained to minimize absolute error
- 1 - weights trained to minimize squared error
- int pscrn = 2
- Controls whether or not the prescreener neural network is used to decide which pixels should be processed by the predictor neural network and which can be handled by simple cubic interpolation.
- The prescreener is trained to know whether cubic interpolation will be sufficient for a pixel or whether it should be predicted by the predictor nn. The computational complexity of the prescreener nn is much less than that of the predictor nn.
- Since most pixels can be handled by cubic interpolation, using the prescreener generally results in much faster processing. The prescreener is pretty accurate, so the difference between using it and not using it is almost always unnoticeable.
- int pscrn = 2
- Version 0.9.3 adds a new, faster prescreener with three selectable 'levels', which trade off the number of pixels detected as only requiring cubic interpolation versus incurred error.
- Therefore, pscrn is now an integer with possible values of 0, 1, 2, 3, and 4.
- 0 - no prescreening (same as false in prior versions)
- 1 - original prescreener (same as true in prior versions)
- 2 - new prescreener level 0
- 3 - new prescreener level 1
- 4 - new prescreener level 2
- Higher levels for the new prescreener result in cubic interpolation being used on fewer pixels (so are slower, but incur less error). However, the difference is pretty much unnoticeable.
- Level 2 is closest to the original prescreener in terms of incurred error, but is much faster.
- string cshift =
- Sets the resizer used for correcting the image center shift that nnedi3_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.
- string cshift =
- 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).
- int fwidth =
- float ep0 =
- float 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.
- float ep0 =
- int threads = 0
- Controls how many threads will be used for processing. If set to 0, threads will be set equal to the number of detected processors.
- int threads = 0
- int opt = 0
- Sets which CPU optimizations to use. Possible settings:
- int opt = 0
- 0 = auto detect
- 1 = use C
- 2 = use SSE2
- 3 = use SSE4.1
- 4 = use AVX
- 5 = use AVX2
- 6 = use FMA3
- 7 = use FMA4
- int fapprox = 15
- Bitmask which enables or disables certain speed-ups. Value range is [0 to 15].
- Mainly for debugging.
- int fapprox = 15
- 0 = nothing
- &1 = use int16 dot products in first layer of prescreener nn
- &2 = use int16 dot products in predictor nn
- &12 = 4 = use exp function approximation in predictor nn
- &12 = 8|12 = use faster (and more inaccurate) exp function approximation in predictor nn
Examples
- Enlarge image by 4x with default settings (does not correct for center shift):
AviSource("Blah.avi") nnedi3_rpow2(rfactor=4, nsize=0, nns=3, qual=1, etype=0, pscrn=2, threads=0, opt=0, fapprox=15)
# identical to: # nnedi3_rpow2(rfactor=4)
- Enlarge image by 2x and correct for center shift using Spline36Resize.
AviSource("Blah.avi") nnedi3_rpow2(rfactor=2,cshift="Spline36Resize")
# identical to: # nnedi3_rpow2(rfactor=2) # Spline36Resize(Width(), Height(), src_left=-0.5, src_top=-0.5)
- Enlarge image by 8x, correct for center shift and downsample from 8x to 7x using LanczosResize with 5 taps.
AviSource("Blah.avi") nnedi3_rpow2(rfactor=8,cshift="LanczosResize",fwidth=Width()*7,fheight=Height()*7,ep0=5)
# identical to: # nnedi3_rpow2(rfactor=8) # LanczosResize(Width()/8*7, Height()/8*7, src_left=-0.5, src_top=-0.5, taps=5)
Back to nnedi3 ←