RgTools/RemoveGrain

From Avisynth wiki
Jump to: navigation, search

Back to RgTools

Contents

Description

Purely spatial denoising function that includes 28 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

  • Progressive input only (except for mode 13 through 16)
  • Supported color formats: Y8, YV12, YV16, YV24, YV411, all 8-32 bit YUV(A) and Planar RGB(A) formats under Avisynth+


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. Sames as mode 2 but rounded up to third minimum value (but artifact risky). (3pixel-clusters)
  • 4 : Clips the pixel with the fourth minimum and maximum of the 8 neighbour pixels, which is equivalent to a median filter. Sames as mode 2 but rounded up to fourth minimum value (but artifact risky). (up to 2x2-pixel-clusters)
  • 5 : Line-sensitive clipping giving the minimal change. Edge sensitive. Only line pairs are used. Strong edge protection.
  • 6 : Line-sensitive clipping, intermediate. Edge sensitive. Only line pairs are used. Fairly edge protection.
  • 7 : Line-sensitive clipping, intermediate. Edge sensitive. Only line pairs are used. Mild edge protection.
  • 8 : Line-sensitive clipping, intermediate. Edge sensitive. Only line pairs are used. Faint edge protection.
  • 9 : Line-sensitive clipping on a line where the neighbours pixels are the closest.
  • 10 : Replaces the target pixel with the closest neighbour. Minimal sharpening. "Very poor denoise sharpener"
  • 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. Same as mode 4 but better edge protection (similar to near artifact free mode 2).
  • 18 : Line-sensitive clipping using opposite neighbours whose greatest distance from the current pixel is minimal. Same as mode 9 but better edge protection (Same as what mode 17 was to mode 4, but in this case to mode 9, and far less denoising than mode 17)
  • 19 : Blur. Replaces the pixel with the average of its 8 neighbours.
  • 20 : Blur. 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. Clipping is done with respect to averages of neighbours. Best for cartoons.
  • 22 : Same as mode 21 but simpler and faster.
  • 23 : Small edge and halo removal, but reputed useless. Fixes small (as one pixel wide) haloes.
  • 24 : Small edge and halo removal, but reputed useless. Same as 23 but considerably more conservative and slightly slower.
  • 25 : Minimal sharpening ("nondestructivesharpen")
  • 26 : Clips the pixel with the minimum and maximum of respectively the maximum and minimum of pixel pairs. Based off mode 17, but preserves corners, but not thin lines. ("SmartRGC")
  • 27 : Clips the pixel with the minimum and maximum of respectively the maximum and minimum of pixel pairs. Similar to 26 but with 12 pixel pairs instead of 8. ("SmartRGCL")
  • 28 : Clips the pixel with the minimum and maximum of respectively the maximum and minimum of pixel pairs. Similar to 27 but with a bit different pixel pairs. Usually no visual difference from mode 27 ("SmartRGCL2")
  • 29 : (not ported yet, SmartRG18)
  • 30 : (not ported yet, SoftRG18)


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)


External Links




Back to RgTools

Personal tools