Adaptive Grain Mask.
Generally, the lower a frame's average luma, the more grain is applied even to the brighter areas. This abuses the fact that our eyes are instinctively drawn to the brighter part of any image, making the grain less necessary in images with an overall very high luma.
This is a port of the VapourSynth adaptive_grain mask.
-
AviSynth 2.60 / AviSynth+ 3.4 or later
-
Microsoft VisualC++ Redistributable Package 2022 (can be downloaded from here) (Windows only)
AGM (clip input, float "luma_scaling", bool "fade", int "opt")
-
input
A clip to process.
Must be in YUV planar format. -
luma_scaling
Grain opacity curve.
Lower values will generate more grain even in brighter scenes while higher values will generate less even in dark scenes.
Default: 10.0. -
fade
If the clip has bit depth less than 32-bit, the range must be tv.
True: If the clip has bit depth less than 32-bit - pure white and pure black pixels are copied (16/235 8-bit); pixels with value of 18/17 (8-bit) fades out.
If the clip has bit depth 32-bit - pixels with value 0.0 and 1.0 are copied.
Default: True. -
opt
Sets which cpu optimizations to use.
-1: Auto-detect.
0: Use C++ code.
1: Use SSE2 code.
2: Use AVX2 code.
3: Use AVX512 code.
Default: -1.
-
Windows
Use solution files. -
Linux
Requirements: - Git - C++17 compiler - CMake >= 3.16
git clone https://github.com/Asd-g/AviSynth-AGM && \ cd AviSynth-AGM && \ mkdir build && \ cd build && \ cmake .. make -j$(nproc) sudo make install