From Avisynth wiki
Jump to: navigation, search
Author Asd-g
Version v1.0.0
Download vsDeGrainMedian-
Category Spatial-Temporal Denoisers
License GPLv2



vsDeGrainMedian is a spatio-temporal limited median denoiser. It uses various methods to replace every pixel with one selected from its 3x3 neighbourhood, from either the current, previous, or next frame.

The first column and the last column are simply copied from the source frame. The first row and the last row are also copied from the source frame. If interlaced=True, then the second row and the second-to-last row are also copied from the source frame.


Syntax and Parameters

vsDeGrainMedian (clip input, int "limitY", int "limitU", int "limitV", int "modeY", int "modeU", int "modeV", bool "interlaced", bool "norow", int "opt")

clip   =
A clip to process.
It must be in 8..16-bit planar format.

int  limitY = 4
int  limitU = limitY
int  limitV = limitU
Limits how much a pixel is changed. Each new pixel will be in the range [old pixel - limit, old pixel + limit].
limitX = 0: plane will be copied from the input frame.
Must be between 0..255.

int  modeY = 1
int  modeU = modeY
int  modeV = modeU
Processing mode.
Mode 0 is the strongest.
Mode 5 is the weakest.

bool  interlaced = false
If True, the top line and the bottom line of the 3x3 neighbourhood will come from the same field as the middle line. In other words, one line will be skipped between the top line and the middle line, and between the middle line and the bottom line.
This parameter should only be used when the input clip contains interlaced video.

bool  norow = false
If True, the two pixels to the left and right of the original pixel will not be used in the calculations. The corresponding pixels from the previous and next frames are still used.

int  opt = -1
Sets which cpu optimizations to use.
  • -1: Auto-detect.
  • 0: Use C++ code.
  • 1: Use SSE2 code.


vsDeGrainMedian with all default values:

vsDeGrainMedian(limitY=4, limitU=4, limitV=4, mode=1, modeU=1, modeV=1, interlaced=false, norow=false, opt=-1)


Version      Date            Changes
v1.0.0 2021/04/14 - Initial release; port of the VapourSynth plugin

External Links

  • GitHub - Source code repository.

Back to External Filters

Personal tools