Skip to main content

KNLMeansVk

KNLMeansVk is a Non-local means de-noising filter for VapourSynth, running on the core's Vulkan device. It is a port of Khanattila's OpenCL implementation, KNLMeansCL, and keeps its algorithm exactly: the GPU-friendly NL-means decomposition proposed by Goossens et al. with per-offset patch distances, a separable box filter and symmetric pair accumulation.

The NLMeans filter, originally proposed by Buades et al., is a very popular filter for the removal of white Gaussian noise, due to its simplicity and excellent performance. The strength of this algorithm is to exploit the repetitive character of the image in order to de-noise the image, unlike conventional de-noising algorithms which typically operate in a local neighbourhood.

Frames stay in video memory for the whole chain: the filter takes and produces GPU resident clips, composes with every other GPU filter without crossing the PCIe bus, and a CPU clip passed to it is uploaded automatically.

Requirements

  • VapourSynth R80 or later, with a GPU and driver that support Vulkan 1.4. Check with core.vulkan_devices from Python.
  • Works on Linux, Windows and macOS (the latter through MoltenVK).

Installation

pip install vapoursynth-knlmeansvk

The wheel installs the plugin into VapourSynth's Python package plugin directory, where it autoloads. Wheels exist for Windows (x64), Linux (x86_64 and aarch64) and macOS (Intel and Apple silicon).

Usage

knlmvk.KNLMeans(clip clip[, int d=1, int a=2, int s=4, float h=1.2, string channels="AUTO", int wmode=0, float wref=1.0, clip rclip=None])
  • clip: the input clip. Gray, YUV or RGB; 8-16 bit integer, half or single precision float. Frame properties are copied from it.
  • d: temporal radius, in [0, 64]; frames [n-d, n+d] take part in the search. d=0 is purely spatial.
  • a: spatial search radius, in [1, 128]; the search window is (2a+1)x(2a+1)x(2d+1).
  • s: similarity neighbourhood (patch) radius, in [0, 8]; patches are (2s+1)x(2s+1).
  • h: filtering strength, on a 0-255 scale regardless of bit depth. Larger values smooth more.
  • channels: which channels drive the similarity and are filtered.
    • "AUTO": "RGB" for RGB clips, "Y" otherwise.
    • "Y": luma only; chroma planes pass through untouched.
    • "UV": chroma jointly, at chroma resolution; luma passes through.
    • "YUV": all three jointly; requires 4:4:4.
    • "RGB": all three jointly, with brightness-adaptive red/blue weighting.
  • wmode: weighting kernel. 0 Welsch (smooth, never zero), 1/2/3 bisquare variants that cut off hard and therefore need a considerably larger h.
  • wref: weight of the pixel being filtered, as a multiple of the largest neighbour weight.
  • rclip: a reference clip driving the block matching (weights are computed on it, the average is taken over clip). Must match clip in format, dimensions and length.

See the upstream Wiki for parameter guidance; everything about d, a, s, h, channels, wmode, wref and rclip carries over.

Differences from KNLMeansCL

  • device_type, device_id, ocl_x, ocl_y and ocl_r are gone: the core owns the Vulkan device (core.set_vulkan_device() selects one) and the port sizes its own dispatches. info is gone with the OpenCL platform text it printed, and mode_9_to_15bits is gone because the OpenCL image-format modes it toggled between do not exist here; there is one normalize-by-maximum path for every integer depth.
  • The plugin namespace is knlmvk and the function KNLMeans, replacing knlm.KNLMeansCL.
  • The filter runs fmParallel with per-frame GPU scratch instead of serializing frames through one command queue, so concurrent frames actually overlap. The price is that every frame in flight holds its own scratch: (2d+1) float planes per filtered channel (twice that with rclip) plus about a dozen more, roughly 1 GB per frame at 4K RGB with d=3. The core runs up to one frame per thread, so on a card that runs out of memory lower core.num_threads or d rather than expecting the filter to slow down.
  • At the last d frames of a clip the OpenCL implementation read stale stack layers for the future temporal side. Here the temporal window shrinks symmetrically at both clip ends instead, mirroring its start-of-clip behaviour; every interior frame is numerically equivalent to the original.
  • No 8192x8192 resolution limit (it came from OpenCL image dimensions).
  • AviSynth support was removed together with OpenCL: the port is built on VapourSynth's GPU API.
  • The ocl_x/ocl_y/ocl_r tuning knobs are gone. The three kernels the OpenCL implementation used per search offset — pixel distance, horizontal box, vertical box — are one fused kernel here whose intermediates stay in shared memory, each thread emits several output rows, and several search offsets share a dispatch. KNLMVK_BATCH (1-8, offsets per round) and KNLMVK_ROWS (1-8, output rows per thread) retune the last two on hardware unlike the one they were measured on.

Compilation

Requires a C++20 compiler, meson, ninja, the VapourSynth headers (R80+, provided by the vapoursynth Python package) and the Vulkan headers. Only the headers are needed — the plugin does not link the Vulkan loader, because the core hands it every entry point already resolved.

meson setup build
meson compile -C build
meson install -C build

If the headers are not found automatically, pass -Dvapoursynth_include=/path/to/vapoursynth/include and/or -Dvulkan_include=/path/to/vulkan/include.

meson install puts the plugin in the vapoursynth Python package's plugin directory; -Dplugindir=/path sends it somewhere else, such as lib/vapoursynth of a system VapourSynth. The compiled plugin (libknlmvulkan.so, knlmvulkan.dll or libknlmvulkan.dylib) also sits in the build directory for copying by hand. The compute kernel is embedded with C23 #embed where the compiler supports it (clang 19+, gcc 15+) and through a meson-generated header otherwise, so MSVC builds without a separate step.

Wheels come from the same meson build through meson-python: uv build or python -m build, with meson options passed as -Csetup-args=-Doption=value.

License

This project is licensed under the GNU General Public License v3.0 or later (GPLv3+), like the KNLMeansCL implementation it is ported from, Copyright© 2015-2020 Edoardo Brunetti.

The fused weight kernel follows the structure of the CUDA NLMeans in vapoursynth-zipcu by dnjulek (MIT).

Metadata

Release files for vapoursynth-knlmeansvk 2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for vapoursynth-knlmeansvk 2.0
File Size Uploaded Provenance
vapoursynth_knlmeansvk-2.0.tar.gz 66.2 kB With provenance Details

Built distributions (wheels)

Table of built distributions (wheels) for vapoursynth-knlmeansvk 2.0
File
vapoursynth_knlmeansvk-2.0-py3-none-win_amd64.whl Python 3 none Windows x86-64 Details
vapoursynth_knlmeansvk-2.0-py3-none-manylinux_2_26_x86_64.manylinux_2_28_x86_64.whl Python 3 none Linux glibc 2.28+ x86-64, Linux glibc 2.26+ x86-64 Details
vapoursynth_knlmeansvk-2.0-py3-none-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl Python 3 none Linux glibc 2.26+ ARM64, Linux glibc 2.28+ ARM64 Details
vapoursynth_knlmeansvk-2.0-py3-none-macosx_15_0_x86_64.whl Python 3 none macOS 15.0+ x86-64 Details
vapoursynth_knlmeansvk-2.0-py3-none-macosx_15_0_arm64.whl Python 3 none macOS 15.0+ ARM64 Details

Total release size: 699.1 kB

Release files / vapoursynth_knlmeansvk-2.0.tar.gz

Download URL vapoursynth_knlmeansvk-2.0.tar.gz
Size 66.2 kB
Tags Source
SHA-256 checksum
How to use checksums
31da0d0ace0fc799faba7a1b9ad667242296ea58d495341f3b46976089a3bb61
BLAKE2b-256 checksum
How to use checksums
43fce23fab0e7ff53ee0a9c9dac78d941abef9a061b3ff08279e461e88f826f7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 18, 2026.

Transparency log

Release files / vapoursynth_knlmeansvk-2.0-py3-none-win_amd64.whl

Download URL vapoursynth_knlmeansvk-2.0-py3-none-win_amd64.whl
Size 124.6 kB
Tags Python 3 Windows x86-64
SHA-256 checksum
How to use checksums
b2e22310e511bb844949282f9d53ae101f0280e84b69c7bfa4a2635a66c11270
BLAKE2b-256 checksum
How to use checksums
d5e2ce99b53babb2b53d23d3648204f22c9a7050162e67c9f705f1a61bb70f15
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 18, 2026.

Transparency log

Release files / vapoursynth_knlmeansvk-2.0-py3-none-manylinux_2_26_x86_64.manylinux_2_28_x86_64.whl

Download URL vapoursynth_knlmeansvk-2.0-py3-none-manylinux_2_26_x86_64.manylinux_2_28_x86_64.whl
Size 193.2 kB
Tags Linux glibc 2.26+ x86-64 Linux glibc 2.28+ x86-64 Python 3
SHA-256 checksum
How to use checksums
194371da64e1c4eab41ebf43f0e838b1e3d589cd7398afb018818476c7c63bee
BLAKE2b-256 checksum
How to use checksums
350466f82eb7f6d22bf5cf6ae89d97b97670fae42b92e53f44afdb24e94f2d6e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 18, 2026.

Transparency log

Release files / vapoursynth_knlmeansvk-2.0-py3-none-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl

Download URL vapoursynth_knlmeansvk-2.0-py3-none-manylinux_2_26_aarch64.manylinux_2_28_aarch64.whl
Size 188.3 kB
Tags Linux glibc 2.26+ ARM64 Linux glibc 2.28+ ARM64 Python 3
SHA-256 checksum
How to use checksums
0144a79c388bba3102217927b4bca4c68723a3986118ecc59995e4ed9d8ff1ec
BLAKE2b-256 checksum
How to use checksums
5378724e2b5e2bd1a5052409db0f973b2f07642ee4cea1da401f69d076c88c41
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 18, 2026.

Transparency log

Release files / vapoursynth_knlmeansvk-2.0-py3-none-macosx_15_0_x86_64.whl

Download URL vapoursynth_knlmeansvk-2.0-py3-none-macosx_15_0_x86_64.whl
Size 63.9 kB
Tags Python 3 macOS 15.0+ x86-64
SHA-256 checksum
How to use checksums
88b351d13515535a6e501ac76a42b87cde8e5aef4798da3354d633cdc06b7a15
BLAKE2b-256 checksum
How to use checksums
977aa28b38420036215a9e4f33a1c175d85fd9a2df4699530ad8bd795a8e622b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 18, 2026.

Transparency log

Release files / vapoursynth_knlmeansvk-2.0-py3-none-macosx_15_0_arm64.whl

Download URL vapoursynth_knlmeansvk-2.0-py3-none-macosx_15_0_arm64.whl
Size 63.0 kB
Tags Python 3 macOS 15.0+ ARM64
SHA-256 checksum
How to use checksums
f63dcdc5ef33b782c857839084120becfa909da73e9cd817ad275397d6181af9
BLAKE2b-256 checksum
How to use checksums
127edaa4866a9b3eb38f0a5871c72f6ee2c9787e181e8268a87cc514c46ef378
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 18, 2026.

Transparency log

Security for vapoursynth-knlmeansvk 2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 6 files in this release have been uploaded with provenance metadata.

Select from 6 files

Attestation for vapoursynth_knlmeansvk-2.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 18, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

2.0 This release

6 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page