NNEDI3CL
From Avisynth wiki
Abstract | |
---|---|
Author | Asd-g |
Version | 1.0.5 |
Download | NNEDI3CL-1.0.5.7z |
Category | Deinterlacing |
License | GPLv2 |
Discussion |
Contents |
Description
NNEDI3CL is an OpenCL implementation of nnedi3. It is an intra-field only deinterlacer. It takes a frame, throws away one field, and then interpolates the missing pixels using only information from the remaining field. It has same rate and double rate modes. NNEDI3 is also very good for enlarging images by powers of 2.
This is a port of the VapourSynth plugin NNEDI3CL.
Requirements
- [x64]: AviSynth+
- Supported color formats: all planar formats (8/10/12/14/16/32bit, Y/YUV/RGB with or without alpha) are supported.
- The file
nnedi3_weights.bin
is required. It must be located in the same folder as NNEDI3CL.
Download it from NNEDI3CL 1.0.3 or directly from here: nnedi3_weights.bin
Syntax and Parameters
- NNEDI3CL (clip input, int "field", bool "dh", bool "dw", int_array "planes", int "nsize", int "nns", int "qual", int "etype", int "pscrn", int "device", bool "list_device", bool "info", bool "st")
- clip input =
- Input clip; it must be in 8..32-bit planar format.
- clip input =
- int field =
- Controls the mode of operation (double vs same rate) and which field is kept.
- -2: = Double rate (alternates each frame),
_FieldBased
frame property order or if_FieldBased
is 0, or missing - AviSynth internal order. - -1: Same rate,
_FieldBased
frame property order or if_FieldBased
is 0, or missing - AviSynth internal order. - 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
- -2: = Double rate (alternates each frame),
- Default: -1
- Controls the mode of operation (double vs same rate) and which field is kept.
- int field =
- 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 0 or 1 when using dh=true.
- Default: False
- bool dh = false
- bool dw = false
- Doubles the width of the input.
- field must be set to either 0 or 1 when using dh=true.
- Default: False
- bool dw = false
- int_array planes = [0,1,2,3]
- Sets which planes will be processed.
- Planes that are not processed will contain uninitialized memory.
- Default: [0,1,2,3]
- int_array planes = [0,1,2,3]
- int nsize = 6
- Sets the size of the local neighborhood around each pixel that is used by the predictor neural network.
- 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.
- Possible settings (x_diameter x y_diameter):
- 0 - 8x6
- 1 - 16x6
- 2 - 32x6
- 3 - 48x6
- 4 - 8x4
- 5 - 16x4
- 6 - 32x4
- Default: 6
- int nsize = 6
- int nns = 1
- Sets the number of neurons in the predictor neural network.
- 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
- Default: 1
- int nns = 1
- 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.
- Default: 1
- int qual = 1
- int etype = 0
- Controls which set of weights to use in the predictor nn.
- 0 - weights trained to minimize absolute error
- 1 - weights trained to minimize squared error
- Default: 0
- Controls which set of weights to use in the predictor nn.
- int etype = 0
- 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.
- The new prescreener is faster than the old one, and it also causes more pixels to be handled by cubic interpolation.
- 1 - old prescreener
- 2 - new prescreener (unavailable with float input)
- Default: 2
- int pscrn = 2
- int device =
- Sets target OpenCL device.
- Use list_device to get the index of the available devices.
- By default the default device is selected
- int device =
- bool list_device = false
- Whether to draw the devices list on the frame.
- bool list_device = false
- bool info = false
- Whether to draw the OpenCL-related info on the frame.
- bool info = false
- bool st = false
- Whether to run always in single thread even if Prefetch() is used.
- In some cases using
NNEDI3CL
andprefetch()
could cause very high cpu usage. In these casesst=true
could help without forcingMT_SERIALIZED
mode. - Default: Auto determined by device properties.
- bool st = false
Examples
Deinterlace:
AviSource("Blah.avi") NNEDI3CL(1) # single rate TFF #NNEDI3CL(3) # double rate TFF
Enlarge by 2x and correct for center shift using Spline36Resize:
AviSource("Blah.avi") NNEDI3CL(1, dh=true, dw=true) Spline36Resize(Width(), Height(), src_left=-0.5, src_top=-0.5)
Changelog
Version Date Changes
v1.0.5 2022/11/18 - Changed the check of field parity. - Add support for alpha plane. - Updated OpenCL - v2022.09.30. v1.0.4 2022/09/16 - Changed the behavior of st. - Changed the behavior of field. - Fixed undefined behavior when upstream throw runtime error. - Added additional information for info=true. - Update boost 1.80.0. v1.0.3 2022/08/15 - Added parameter st. v1.0.2 2022/07/13 - Fixed memory leak when list_device=true/info=true. v1.0.1 2022/06/26 - Properly handle the clips with one plane only. v1.0.0 2022/06/26 - Initial release.
External Links
- GitHub - Source code repository.
Back to External Filters ←