RgTools/RemoveGrain

From Avisynth wiki
Jump to: navigation, search

Back to RgTools

Contents

Description

Purely spatial denoising function that includes 24 different modes. mode 13 through 16 are meant for deinterlacing only, they required interlaced content.
Results should be identical to the original RemoveGrain for all modes other than 21 (the original has incorrect rounding) and the convolution modes (modes 11/12/19/20)[1]. These minor rounding differences will not affect your output in any significant way (it might make it better)[2].

Requirements


Syntax and Parameters

RemoveGrain (clip, int "mode", int "modeU", int "modeV", bool "planar")


clip   =
Input clip must be planar


int  mode = 2
int  modeU = mode
int  modeV = modeU
Independently control the processing mode for each plane.
Each mode applies a different kind of smoothing to the input clip by combining each pixel with 8 of its neighbours.
Just like original RemoveGrain, the borders rows and columns (1-pixel thick) are not processed.
  • -1 : Bypass - input plane is trashed thus faster than mode 1
  • 0 : Copy - input plane is left intact
  • 1 : Clips the pixel with the minimum and maximum of the 8 neighbour pixels.
  • 2 : Clips the pixel with the second minimum and maximum of the 8 neighbour pixels. [Default]
  • 3 : Clips the pixel with the third minimum and maximum of the 8 neighbour pixels.
  • 4 : Clips the pixel with the fourth minimum and maximum of the 8 neighbour pixels, which is equivalent to a median filter.
  • 5 : Line-sensitive clipping giving the minimal change.
  • 6 : Line-sensitive clipping, intermediate.
  • 7 : Line-sensitive clipping, intermediate.
  • 8 : Line-sensitive clipping, intermediate.
  • 9 : Line-sensitive clipping on a line where the neighbours pixels are the closest.
  • 10 : Replaces the target pixel with the closest neighbour.
  • 11 : [1 2 1] horizontal and vertical kernel blur. Similar to Blur(1).
  • 12 : Same as mode 11.
  • 13 : Bob mode, interpolates top field from the line where the neighbour pixels are the closest.
  • 14 : Bob mode, interpolates bottom field from the line where the neighbour pixels are the closest.
  • 15 : Bob mode, interpolates top field. Same as 13 but with a more complicated interpolation formula.
  • 16 : Bob mode, interpolates bottom field. Same as 14 but with a more complicated interpolation formula.
  • 17 : Clips the pixel with the minimum and maximum of respectively the maximum and minimum of each pair of opposite neighbor pixels.
  • 18 : Line-sensitive clipping using opposite neighbours whose greatest distance from the current pixel is minimal.
  • 19 : Replaces the pixel with the average of its 8 neighbours.
  • 20 : Averages the 9 pixels ([1 1 1] horizontal and vertical blur). Similar to Blur(1.58).
  • 21 : Clips pixels using the averages of opposite neighbour.
  • 22 : Same as mode 21 but simpler and faster.
  • 23 : Small edge and halo removal, but reputed useless.
  • 24 : Small edge and halo removal, but reputed useless.
By default if modeU is not set it defaults to the value of mode. If modeV is not set it defaults to the value of modeU


bool  planar = false
Parameter to keep compatibility with the original plugin; it's use is not recommended.
This allows to skip any colorspace checks whatsoever, making the filter always assume that planar input is passed.


Examples

RemoveGrain with default values:

AviSource("Blah.avi")
RemoveGrain(mode=2, modeU=2, modeV=2, planar=false)




Back to RgTools

Personal tools