Skip to main content

A CPU-optimized version of nnedi3 for VapourSynth

Project description

Description

znedi3 is a CPU-optimized version of nnedi.

nnedi3 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 is also good for enlarging images by powers of two.

This plugin no longer provides the nnedi3_rpow2 filter. A replacement can be found here: http://forum.doom9.org/showthread.php?t=172652

This is a port of tritical’s nnedi3 filter.

Usage

The file nnedi3_weights.bin is required. It must be in the same directory as nnedi3.

nnedi3.nnedi3(clip clip, int field[, bint dh=False, int[] planes=[0, 1, 2], int nsize=6, int nns=1, int qual=1, int etype=0, int pscrn=2, bint opt=True, bint int16_prescreener=True, bint int16_predictor=True, int exp=0, bint show_mask=False])
Parameters:
clip

Clip to process. It must have constant format and dimensions, and integer samples with 8..16 bits or float samples with 32 bits.

field

Selects the mode of operation. Possible values:

  • 0: Same rate, keep bottom field.

  • 1: Same rate, keep top field.

  • 2: Double rate, start with bottom field.

  • 3: Double rate, start with top field.

If dh is True, the _Field frame property is used to determine each frame’s field dominance. The field parameter is only a fallback for frames that don’t have the _Field property.

If dh is False, the _FieldBased frame property is used to determine each frame’s field dominance. The field parameter is only a fallback for frames that don’t have the _FieldBased property, or where said property indicates that the frame is progressive.

dh

Doubles the height, keeping both fields. If field is 0, the input is copied to the odd lines of the output (the bottom field). If field is 1, the input is copied to the even lines of the output (the top field).

If dh is True, field must be 0 or 1.

Default: False.

planes

Planes to process. Planes that are not processed will contain uninitialised memory.

Default: all.

nsize

Size of the local neighbourhood around each pixel used by the predictor neural network. Possible settings:

  • 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. A taller neighbourhood will result in sharper output.

For deinterlacing a wider neighbourhood will allow connecting lines of smaller slope. However, the setting to use 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 wide neighbourhood won’t be needed, and vice-versa.

Default: 6.

nns

Number of neurons in the predictor neural network. Possible values:

  • 0: 16

  • 1: 32

  • 2: 64

  • 3: 128

  • 4: 256

Higher values are slower, but provide better quality. However, quality differences are usually small. The difference in speed will become larger if qual is increased.

Default: 1.

qual

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 generalisation to unseen data. Possible values are 1 and 2.

A value of 2 is recommended for image enlargement.

Default: 1.

etype

The set of weights used in the predictor neural network. Possible values:

  • 0: Weights trained to minimise absolute error.

  • 1: Weights trained to minimise squared error.

Default: 0.

pscrn

The prescreener used to decide which pixels should be processed by the predictor neural network, and which can be handled by simple cubic interpolation. Since most pixels can be handled by cubic interpolation, using the prescreener generally results in much faster processing. Possible values:

  • 0: No prescreening. No pixels will be processed with cubic interpolation. This is really slow.

  • 1: Old prescreener.

  • 2: New prescreener level 0.

  • 3: New prescreener level 1.

  • 4: New prescreener level 2.

The new prescreener works faster than the old one, and it also causes more pixels to be processed with cubic interpolation. The higher levels cause a bit more pixels to be processed with the predictor neural network, therefore they are slower than the lowest level.

The new prescreener is not available with float input.

Default: 2 for integer input, 1 for float input.

opt

If True, the best optimised functions supported by the CPU will be used. If False, only scalar functions will be used.

Default: True.

int16_prescreener

If True, the prescreener will perform the dot product calculations using 16 bit integers. Otherwise, it will use single precision floats.

This parameter is ignored when the input has float samples.

Default: True.

int16_predictor

If True, the predictor will perform the dot product calculations using 16 bit integers. Otherwise, it will use single precision floats.

This parameter is ignored when the input has more than 15 bits per sample.

Default: True.

exp

The exp function approximation to use in the predictor. 0 is the fastest and least accurate. 2 is the slowest and most accurate.

Default: 0.

show_mask

If True, the pixels that would be processed with the predictor neural network are instead set to white.

Default: False.

Compilation (Linux)

Clone the repository (using the --recursive argument to also dowload the required vsxx library as a submodule):

git clone --recursive https://github.com/sekrit-twc/znedi3

Compile the library:

cd znedi3
make X86=1

To install, copy vsznedi3.so and nnedi3_weights.bin to the vapoursynth plugin folder (usually /usr/lib/x86_64-linux-gnu/vapoursynth/):

sudo cp nnedi3_weights.bin vsznedi3.so /usr/lib/x86_64-linux-gnu/vapoursynth/

There is also a test application which can be built to check the efficiency of the plugin kernels optimized for different SIMD instructions:

make X86=1 testapp/testapp

License

GPLv2.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

vapoursynth_znedi3-3.2.tar.gz (13.8 MB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

vapoursynth_znedi3-3.2-py3-none-win_amd64.whl (13.2 MB view details)

Uploaded Python 3Windows x86-64

vapoursynth_znedi3-3.2-py3-none-musllinux_1_2_x86_64.whl (13.8 MB view details)

Uploaded Python 3musllinux: musl 1.2+ x86-64

vapoursynth_znedi3-3.2-py3-none-musllinux_1_2_aarch64.whl (13.7 MB view details)

Uploaded Python 3musllinux: musl 1.2+ ARM64

vapoursynth_znedi3-3.2-py3-none-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (12.9 MB view details)

Uploaded Python 3manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

vapoursynth_znedi3-3.2-py3-none-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl (12.9 MB view details)

Uploaded Python 3manylinux: glibc 2.27+ ARM64manylinux: glibc 2.28+ ARM64

vapoursynth_znedi3-3.2-py3-none-macosx_15_0_x86_64.whl (12.8 MB view details)

Uploaded Python 3macOS 15.0+ x86-64

vapoursynth_znedi3-3.2-py3-none-macosx_15_0_arm64.whl (12.7 MB view details)

Uploaded Python 3macOS 15.0+ ARM64

File details

Details for the file vapoursynth_znedi3-3.2.tar.gz.

File metadata

  • Download URL: vapoursynth_znedi3-3.2.tar.gz
  • Upload date:
  • Size: 13.8 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for vapoursynth_znedi3-3.2.tar.gz
Algorithm Hash digest
SHA256 06126b84932afa819a0079c916cbe8d70b9532c540669f73571d2e4b255b9dbe
MD5 0e30308b5490565a41dcd0e69674b210
BLAKE2b-256 82780cf96c790c3f417f28816cda0573b612a1750bb50b1aee24fd73b9dba46b

See more details on using hashes here.

Provenance

The following attestation bundles were made for vapoursynth_znedi3-3.2.tar.gz:

Publisher: build.yml on vapoursynth/znedi3-pypi

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file vapoursynth_znedi3-3.2-py3-none-win_amd64.whl.

File metadata

File hashes

Hashes for vapoursynth_znedi3-3.2-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 50fec170e9881bc2e3243738e619db7fb8ff761fc8a4a86fdd5f73ca31477df7
MD5 f9dfbf432c9cebef54c4b7ea3bdf1967
BLAKE2b-256 bf4f97aae05e2c9192783ff2b90fd9ce9334217867a02412eb5d4f41a2fa0bf9

See more details on using hashes here.

Provenance

The following attestation bundles were made for vapoursynth_znedi3-3.2-py3-none-win_amd64.whl:

Publisher: build.yml on vapoursynth/znedi3-pypi

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file vapoursynth_znedi3-3.2-py3-none-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for vapoursynth_znedi3-3.2-py3-none-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 a6e36e6c7647f1f83d1629c2f5cb9cad82564ddffad7beb417a3e5d383879514
MD5 bb461870a8260006f68a0742bc0e2732
BLAKE2b-256 fdee37ff2ad8e29fe8d617b1b711eab769338f790ee29b039fb5a2200ca8f19b

See more details on using hashes here.

Provenance

The following attestation bundles were made for vapoursynth_znedi3-3.2-py3-none-musllinux_1_2_x86_64.whl:

Publisher: build.yml on vapoursynth/znedi3-pypi

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file vapoursynth_znedi3-3.2-py3-none-musllinux_1_2_aarch64.whl.

File metadata

File hashes

Hashes for vapoursynth_znedi3-3.2-py3-none-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 4cb71aba10a0ce5e392800101908ed75a24de20538e958f091fc6c2d76e790c9
MD5 b3002081f19423d8cecea4066646d360
BLAKE2b-256 b2ea998ffb4487991af5e4388e8556115afb8c36a67e553ee5ba7db3d42316eb

See more details on using hashes here.

Provenance

The following attestation bundles were made for vapoursynth_znedi3-3.2-py3-none-musllinux_1_2_aarch64.whl:

Publisher: build.yml on vapoursynth/znedi3-pypi

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file vapoursynth_znedi3-3.2-py3-none-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for vapoursynth_znedi3-3.2-py3-none-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 06a5bfe6758028d0ef2ea03f70d85eaebad39c64d3444cc37eb6b4186261745f
MD5 c6be428b25edcacf8c5108074439f3c5
BLAKE2b-256 6deea1cd716be31f32e87e161e86ce67d645a63bfc6604ae51451bc7ed6bf1e5

See more details on using hashes here.

Provenance

The following attestation bundles were made for vapoursynth_znedi3-3.2-py3-none-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl:

Publisher: build.yml on vapoursynth/znedi3-pypi

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file vapoursynth_znedi3-3.2-py3-none-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for vapoursynth_znedi3-3.2-py3-none-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 52218ea351d560cc7fa3d8d43af2cca26b3c4012f70767e8a5d6cdc0d02310d1
MD5 a395c2d97fba6a2d269c818ff0fcbe94
BLAKE2b-256 ca0f81c2c5477fcbb1bf9aa4c7ff7514af2e0be905eed440448b222cb4f1a9c4

See more details on using hashes here.

Provenance

The following attestation bundles were made for vapoursynth_znedi3-3.2-py3-none-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl:

Publisher: build.yml on vapoursynth/znedi3-pypi

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file vapoursynth_znedi3-3.2-py3-none-macosx_15_0_x86_64.whl.

File metadata

File hashes

Hashes for vapoursynth_znedi3-3.2-py3-none-macosx_15_0_x86_64.whl
Algorithm Hash digest
SHA256 feb3fbae50d3a81d17833c539633d067b299989fda63ebf3a70cb8e84d6d9b12
MD5 0921ede664617bf58ea2e4d4c720009f
BLAKE2b-256 b28ec312afc01cd68db5c473c36f22351e6b6f8e06fb1bf1ee2b18b5ece42f4e

See more details on using hashes here.

Provenance

The following attestation bundles were made for vapoursynth_znedi3-3.2-py3-none-macosx_15_0_x86_64.whl:

Publisher: build.yml on vapoursynth/znedi3-pypi

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file vapoursynth_znedi3-3.2-py3-none-macosx_15_0_arm64.whl.

File metadata

File hashes

Hashes for vapoursynth_znedi3-3.2-py3-none-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 8d5e9c7f1fcf8607d11e468a65dbeb8068a873c18b5b683c19cd88805fa5abce
MD5 3fb5d0f1765f33d54e0d89a50a128e37
BLAKE2b-256 20b4c3189b8a8cb191c94462e6b193bf52a559cf60257b095124e9be490ce143

See more details on using hashes here.

Provenance

The following attestation bundles were made for vapoursynth_znedi3-3.2-py3-none-macosx_15_0_arm64.whl:

Publisher: build.yml on vapoursynth/znedi3-pypi

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page