Nnedi3/nnedi3

From Avisynth wiki
Revision as of 19:20, 21 September 2014 by Reel.Deal (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Back to nnedi3



Contents

Description

nnedi3 is an intra-field only deinterlacer. It takes in a frame, throws away one field, and then interpolates the missing pixels using only information from the kept field. It has same rate and double rate modes.

Requirements


Syntax and Parameters

nnedi3 (clip, int "field", bool "dh", bool "Y", bool "U", bool "V", int "nsize", int "nns", int "qual", int "etype", int "pscrn", int "threads", int "opt", int "fapprox")


clip   =
Input clip.


int  field = -1
Controls the mode of operation (double vs same rate) and which field is kept. Possible settings:
  • -2 = double rate (alternates each frame), uses avisynth's internal parity value to start
  • -1 = same rate, uses avisynth's internal parity value
  • 0 = same rate, keep bottom field
  • 1 = same rate, keep top field
  • 2 = double rate (alternates each frame), starts with bottom
  • 3 = double rate (alternates each frame), starts with top
If field is set to -1, then nnedi3 calls child->GetParity(0) during initialization. If it returns true, then field is set to 1. If it returns false, then field is set to 0.
If field is set to -2, then the same thing happens, but instead of setting field to 1 or 0 it is set to 3 or 2.


bool  dh = false
Doubles the height of the input. Each line of the input is copied to every other line of the output and the missing lines are interpolated.
If field=0, the input is copied to the odd lines of the output. If field=1, the input is copied to the even lines of the output.
field must be set to either -1, 0, or 1 when using dh=true.


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.
For RGB24 input Y=B, U=G, V=R.



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):
  • 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.
  • 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 = 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.
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.


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  opt = 0
Sets which CPU optimizations to use. Possible settings:
  • 0 = auto detect
  • 1 = use C
  • 2 = use SSE2


int  fapprox = 15
Bitmask which enables or disables certain speed-ups. Value range is [0,15]. Mainly for debugging.
  • 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

nnedi3 with default settings:

AviSource("Blah.avi")
nnedi3(field=-1, dh=false, Y=true, U=true, V=true, nsize=6, nns=1, qual=1, etype=0, pscrn=2, threads=0, opt=0, fapprox=15)



Back to nnedi3

Personal tools