Avisynth AddGrain

From wiki.selur.net
Jump to navigation Jump to search

AddGrain adds random noise that looks like film grain. The AddGrainC plugin provides it.

Filtering → Avisynth → Add Grain

AddGrain controls in Hybrid
AddGrain controls in Hybrid

What it does

AddGrain adds noise with a given standard deviation. Flat areas then no longer band and an encode keeps some texture. Horizontal and vertical correlation smooth the noise, which makes the grain coarser or streaky. A seed makes the grain repeatable.

Typical uses:

  • Mask banding in flat areas after denoising or debanding.
  • Give a very clean source a film look.
  • Raise Strength together with Correlation, because smoothed grain is less visible.

The filter works on progressive material.

Settings

Control Parameter Range Hybrid default Meaning
Strength (luma/chroma) var / uvar 0–500 1.0 / 0 Noise strength (standard deviation) for luma and for chroma. 0 turns the noise off. The chroma box is only available with Color on and does nothing for RGB.
Correlation (h/v) hcorr / vcorr 0.00–1.00 0 / 0 Horizontal and vertical smoothing of the noise. Higher values give coarser, clumpier grain.
Seed seed −1–100 −1 0 or higher gives repeatable grain; −1 gives different grain on every run.
Color – on/off off Off: noise on luma only. On: chroma gets its own noise too.

Example

Default settings on a 10-bit YUV 4:2:0 source (no conversion is needed):

AddGrain()

How Hybrid calls it

  • With Color off, AddGrain is called; with Color on, AddGrainC is called and uvar is written as well.
  • Only parameters that differ from the defaults are written. The values are passed to the plugin as they are.
  • AddGrain works on RGB24, RGB32, YUY2 and planar YUV clips, so Hybrid inserts no conversion in the usual cases.
  • AddGrain also offers the common options and can be added to the filter queue several times.

Background

  • AddGrain was written by Tom Barry (2003); version 1.4 is by Foxyshadis (2006). AddGrainC is the later fork by pinterf with high bit depth support (GPL-2.0).
  • The plugin has a constant option, which repeats the same pattern in every frame. Hybrid does not offer it.
  • For grain that depends on brightness see GrainFactory3. The VapourSynth version is Vapoursynth AddGrain.

Sources