Skip to content
dnjulek edited this page Oct 30, 2026 · 2 revisions

Block-matching and 3D filtering (BM3D) denoiser on the CPU, ported from the CUDA BM3D in vszipcu (itself a port of BM3DCUDA). It takes the same arguments as their BM3D, minus the GPU ones. The output is close to the GPU's but isn't guaranteed bit-identical (see Differences).

Usage

Signature (argument order and defaults):

vszip.BM3D(vnode clip[, vnode 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, int chroma=0, string[] bm_error_s="ssd", string[] transform_2d_s="dct", string[] transform_1d_s="dct"])
src = clip.resize.Bicubic(format=vs.YUV444PS)
basic = src.vszip.BM3D(sigma=3.0, radius=1)
final = src.vszip.BM3D(ref=basic, sigma=3.0, radius=1)

Parameters

  • clip:
    Input clip: constant-format Gray, YUV or RGB, 32-bit float. Each processed plane must be at least 8x8.

  • ref (clip):
    Basic estimate for the final (Wiener) step, usually the output of a first BM3D call. Matching runs on it. Must match clip's format, size and length.

  • sigma (float[], default: 3.0, range: >= 0):
    Denoising strength per plane; missing values repeat the last one. A plane with sigma 0 is copied, and with every sigma 0 the clip is returned unchanged.

  • block_step (int[], default: 8, range: 1..8):
    Step between reference blocks. Smaller is better and slower.

  • bm_range (int[], default: 9, range: >= 1):
    Search radius for similar blocks in the current frame. Larger is slower.

  • radius (int, default: 0, range: 0..16):
    Temporal radius: frames n - radius to n + radius are searched. 0 is spatial only. The temporal result is aggregated inside the filter, so the returned clip is already the denoised one.

  • ps_num (int[], default: 2, range: 1..8):
    With radius > 0: how many of the best matches seed the search in the neighbouring frames.

  • ps_range (int[], default: 4, range: >= 1):
    With radius > 0: search radius around each seed in the neighbouring frames.

  • chroma (int, default: 0):
    1 is CBM3D: U and V reuse the block matching of Y. Needs YUV 4:4:4.

  • bm_error_s (string[], default: "ssd"):
    Block distance: "ssd", "sad", "zssd", "zsad" or "ssd/norm".

  • transform_2d_s, transform_1d_s (string[], default: "dct"):
    Transforms of the blocks and of the group: "dct", "haar", "wht" or "bior1.5".

Differences from vszipcu / BM3DCUDA

  • One function: radius > 0 returns the final clip directly, so there is no stacked clip, no BM3Dv2, no VAggregate and no zero_init.
  • No extractor_exp: on the GPU it only makes the output repeatable, and the CPU output always is.
  • Not bit-identical with the GPU: its fast-math reciprocal and divide aren't reproduced. The mean difference is about 4e-8.

Clone this wiki locally