Skip to main content

BM3D denoising filter for VapourSynth, implemented in CUDA

Project description

VapourSynth-BM3DCUDA

This package contains the CUDA implementation of the VapourSynth-BM3DCUDA filter.

Installation

pip install vapoursynth-bm3dcuda

Building from source

Requirements

  • CUDA Toolkit: 12.8 or newer.

  • C++ Compiler: A C++20 compatible compiler.

    • Windows: Visual Studio 2022 or newer.
    • Linux: GCC
  • Windows

    $env:CUDA_PATH = "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v13.0"
    uv build --package vapoursynth-bm3dcuda
    
  • Linux

    export CUDA_PATH=/usr/local/cuda-12.8
    uv build --package vapoursynth-bm3dcuda
    

Detailed parameter information from the parent project follows.


VapourSynth-BM3DCUDA

Copyright© 2021 WolframRhodium

BM3D denoising filter for VapourSynth, implemented in CUDA.

Description

  • Please check VapourSynth-BM3D.

  • The _rtc version compiles GPU code at runtime, which might runs faster than standard version at the cost of a slight overhead.

  • The cpu version is implemented in AVX and AVX2 intrinsics, serves as a reference implementation on CPU. However, bitwise identical outputs are not guaranteed across CPU and CUDA implementations.

Requirements

  • CPU with AVX support.

  • CUDA-enabled GPU(s) of compute capability 5.0 or higher (Maxwell+).

  • GPU driver 450 or newer.

The minimum requirement on compute capability is 3.5, which requires manual compilation (specifying nvcc flag -gencode arch=compute_35,code=sm_35).

The cpu version does not require any external libraries but requires AVX2 support on CPU in addition.

Parameters

{bm3dcuda, bm3dcuda_rtc, bm3dcpu}.BM3D(clip clip[, clip ref=None, float[] sigma=3.0, int[] block_step=8, int[] bm_range=9, int radius=0, int[] ps_num=2, int[] ps_range=4, bint chroma=False, int device_id=0, bool fast=True, int extractor_exp=0])
  • clip:

    The input clip. Must be of 32 bit float format. Each plane is denoised separately if chroma is set to False. Data of unprocessed planes is undefined. Frame properties of the output clip are copied from it.

  • ref:

    The reference clip. Must be of the same format, width, height, number of frames as clip.

    Used in block-matching and as the reference in empirical Wiener filtering, i.e. bm3d.Final / bm3d.VFinal:

    basic = core.{bm3dcpu, bm3dcuda, bm3dcuda_rtc}.BM3D(src, radius=0)
    final = core.{bm3d...}.BM3D(src, ref=basic, radius=0)
    
    vbasic = core.{bm3d...}.BM3D(src, radius=radius_nonzero).bm3d.VAggregate(radius=radius_nonzero)
    vfinal = core.{bm3d...}.BM3D(src, ref=vbasic, radius=r).bm3d.VAggregate(radius=r)
    
    # alternatively, using the v2 interface
    basic_or_vbasic = core.{bm3dcpu, bm3dcuda, bm3dcuda_rtc}.BM3Dv2(src, radius=r)
    final_or_vfinal = core.{bm3d...}.BM3Dv2(src, ref=basic_or_vbasic, radius=r)
    

    corresponds to the followings (ignoring color space handling and other differences in implementation), respectively

    basic = core.bm3d.Basic(clip)
    final = core.bm3d.Final(basic, ref=basic)
    
    vbasic = core.bm3d.VBasic(src, radius=r).bm3d.VAggregate(radius=r, sample=1)
    vfinal = core.bm3d.VFinal(src, ref=vbasic, radius=r).bm3d.VAggregate(radius=r)
    
  • sigma: The strength of denoising for each plane.

    The strength is similar (but not strictly equal) as VapourSynth-BM3D due to differences in implementation. (coefficient normalization is not implemented, for example)

    Default [3,3,3].

  • block_step, bm_range, radius, ps_num, ps_range:

    Same as those in VapourSynth-BM3D.

    If chroma is set to True, only the first value is in effect.

    Otherwise an array of values may be specified for each plane (except radius).

    Note: It is generally not recommended to take a large value of ps_num as current implementations do not take duplicate block-matching candidates into account during temporary searching, which may leads to regression in denoising quality. This issue is not present in VapourSynth-BM3D.

    Note2: Lowering the value of "block_step" will be useful in reducing blocking artifacts at the cost of slower processing.

  • chroma:

    CBM3D algorithm. clip must be of YUV444PS format.

    Y channel is used in block-matching of chroma channels.

    Default False.

  • device_id:

    Set GPU to be used.

    Default 0.

  • fast:

    Multi-threaded copy between CPU and GPU at the expense of 4x memory consumption.

    Default True.

  • extractor_exp:

    Used for deterministic (bitwise) output. This parameter is not present in the cpu version since the implementation always produces deterministic output.

    Pre-rounding is employed for associative floating-point summation.

    The value should be a positive integer not less than 3, and may need to be higher depending on the source video and filter parameters.

    Default 0. (non-determinism)

Notes

  • bm3d.VAggregate should be called after temporal filtering, as in VapourSynth-BM3D. Alternatively, you may use the BM3Dv2() interface for both spatial and temporal denoising in one step.

  • The _rtc version has three additional experimental parameters:

    • bm_error_s: (string)

      Specify cost for block similarity measurement.

      Currently implemented costs: SSD (Sum of Squared Differences), SAD (Sum of Absolute Differences), ZSSD (Zero-mean SSD), ZSAD (Zero-mean SAD), SSD/NORM.

      Default SSD.

    • transform_2d_s/transform_1d_s: (string)

      Specify type of transform.

      Currently implemented transforms: DCT (Discrete Cosine Transform), Haar (Haar Transform), WHT (Walsh–Hadamard Transform), Bior1.5 (transform based on a bi-orthogonal spline wavelet).

      Default DCT.

    These features are not implemented in the standard version due to performance and binary size concerns.

Statistics

GPU memory consumptions:

(ref ? 4 : 3) * (chroma ? 3 : 1) * (fast ? 4 : 1) * (2 * radius + 1) * size_of_a_single_frame

Compilation

  • The CMake configuration of BM3DCUDA_RTC links to NVRTC static library by default, which requires CUDA 11.5 or later.
cmake -S . -B build -D CMAKE_BUILD_TYPE=Release -D CMAKE_CUDA_FLAGS="--threads 0 --use_fast_math -Wno-deprecated-gpu-targets" -D CMAKE_CUDA_ARCHITECTURES="50;61-real;75-real;86"

cmake --build build --config Release

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_bm3dcuda-2.16.1.tar.gz (625.2 kB view details)

Uploaded Source

Built Distributions

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

vapoursynth_bm3dcuda-2.16.1-py3-none-win_amd64.whl (43.8 MB view details)

Uploaded Python 3Windows x86-64

vapoursynth_bm3dcuda-2.16.1-py3-none-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (57.1 MB view details)

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

vapoursynth_bm3dcuda-2.16.1-py3-none-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl (53.7 MB view details)

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

File details

Details for the file vapoursynth_bm3dcuda-2.16.1.tar.gz.

File metadata

  • Download URL: vapoursynth_bm3dcuda-2.16.1.tar.gz
  • Upload date:
  • Size: 625.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.13

File hashes

Hashes for vapoursynth_bm3dcuda-2.16.1.tar.gz
Algorithm Hash digest
SHA256 bcbc01abbdcf079a11527a3b5b86226794702576754d8ac618892f1c86007702
MD5 8bc1c02178f29eaa153af6e23184d968
BLAKE2b-256 de18d929aed1fb97dd0df03387f5d892299226cc08c945e800375a0cd3857138

See more details on using hashes here.

Provenance

The following attestation bundles were made for vapoursynth_bm3dcuda-2.16.1.tar.gz:

Publisher: cd-publish.yml on Jaded-Encoding-Thaumaturgy/vs-wheels

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_bm3dcuda-2.16.1-py3-none-win_amd64.whl.

File metadata

File hashes

Hashes for vapoursynth_bm3dcuda-2.16.1-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 a398076beeb0d2ae4fbd23f2f4072406a9cebef3e4c27eecebce85d688c84530
MD5 d4afcb2e660d571491e65652902c07a5
BLAKE2b-256 d733cf7ffa82901fdc1b1daad20f3062ba0f7b0a7bc3b6f9ba7cc66533996ae8

See more details on using hashes here.

Provenance

The following attestation bundles were made for vapoursynth_bm3dcuda-2.16.1-py3-none-win_amd64.whl:

Publisher: cd-publish.yml on Jaded-Encoding-Thaumaturgy/vs-wheels

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_bm3dcuda-2.16.1-py3-none-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for vapoursynth_bm3dcuda-2.16.1-py3-none-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 0f4d07526cde38072b5c3ab7e3ec27259ffe6245683906b573e7dd3df3834c25
MD5 ed12e5323dfb7a07d362aaa59170e7aa
BLAKE2b-256 8d2ea4b4c80d4459ceec4b7ee57612c36e8105168d3175bd269d0db2ded16b0d

See more details on using hashes here.

Provenance

The following attestation bundles were made for vapoursynth_bm3dcuda-2.16.1-py3-none-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl:

Publisher: cd-publish.yml on Jaded-Encoding-Thaumaturgy/vs-wheels

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_bm3dcuda-2.16.1-py3-none-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for vapoursynth_bm3dcuda-2.16.1-py3-none-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 9b5972821bc6fe453cbe8affd44c73ef041a68bbdcafa3ca9531624c1a3e82dc
MD5 5dd2570a5a02e0910aa22dc7f05a194f
BLAKE2b-256 d7aa5e5deb9463354f43cc31dc528777f7948d7824f7d8cc8a4e1370e8030b9a

See more details on using hashes here.

Provenance

The following attestation bundles were made for vapoursynth_bm3dcuda-2.16.1-py3-none-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl:

Publisher: cd-publish.yml on Jaded-Encoding-Thaumaturgy/vs-wheels

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