KNLMeansCL

From Avisynth wiki
(Difference between revisions)
Jump to: navigation, search
m (Requirements)
(v1.1.1e documentation update)
 
(One intermediate revision by one user not shown)
Line 1: Line 1:
 
{{FilterCat6|External_filters|Plugins|Plugins_x64|Denoisers|Spatial-Temporal Denoisers|Deep_color_tools}}
 
{{FilterCat6|External_filters|Plugins|Plugins_x64|Denoisers|Spatial-Temporal Denoisers|Deep_color_tools}}
 
{{Filter3
 
{{Filter3
|[https://github.com/Khanattila Khanattila]
+
|[https://github.com/Khanattila Khanattila], {{Author/pinterf}}
|v1.1.1
+
|v1.1.1e
|
+
|3=[https://github.com/pinterf/KNLMeansCL/releases KNLMeansCL_1.1.1e_v20201112-pfmod.7z]
3=[https://github.com/Khanattila/KNLMeansCL/releases KNLMeansCL-v1.1.1.zip]
+
---------
+
<span style="color:red">'''AviSynth+ 3.5.2 or greater'''</span>
+
[https://github.com/pinterf/KNLMeansCL/releases KNLMeansCL_1.1.1_test_for_avs3.5.2.7z]
+
 
|4=Spatial-Temporal Denoisers
 
|4=Spatial-Temporal Denoisers
 
|5=[http://www.gnu.org/licenses/gpl-3.0.txt GPLv3]
 
|5=[http://www.gnu.org/licenses/gpl-3.0.txt GPLv3]
Line 16: Line 12:
 
== Description ==
 
== Description ==
 
KNLMeansCL is an optimized OpenCL implementation of the Non-local means de-noising algorithm. The NLMeans filter, originally proposed by Buades et al., is a very popular filter for the removal of white Gaussian noise, due to its simplicity and excellent performance. The strength of this algorithm is to exploit the repetitive character of the image in order to de-noise the image unlike conventional de-noising algorithms, which typically operate in a local neighbourhood.
 
KNLMeansCL is an optimized OpenCL implementation of the Non-local means de-noising algorithm. The NLMeans filter, originally proposed by Buades et al., is a very popular filter for the removal of white Gaussian noise, due to its simplicity and excellent performance. The strength of this algorithm is to exploit the repetitive character of the image in order to de-noise the image unlike conventional de-noising algorithms, which typically operate in a local neighbourhood.
 
<span style="color:red">NOTE: for AviSynth+ 3.5.2 or greater, use this test version here:</span> https://github.com/pinterf/KNLMeansCL/releases
 
 
<br>
 
<br>
 
<br>
 
<br>
Line 24: Line 18:
 
* [x64]: [[AviSynth+]]
 
* [x64]: [[AviSynth+]]
 
* Supported color formats: [[RGB32]], [[Y8]], [[YV12]], [[YV16]], [[YV24]], [[YV411]]
 
* Supported color formats: [[RGB32]], [[Y8]], [[YV12]], [[YV16]], [[YV24]], [[YV411]]
** AviSynth+: all [[planar]] YUV formats 8/10/12/16-bit and float are supported. Also [[RGB64]] is supported
+
** AviSynth+: all [[planar]] formats (8/10/12/14/16/32bit, Y/YUV/RGB with or without alpha) are supported. [[RGB64]] is also supported.
 
<br>
 
<br>
* [https://support.microsoft.com/en-us/help/2977003/the-latest-supported-visual-c-downloads Microsoft Visual C++ 2015 Redistributable Package (x86 / x64)]
+
* [https://support.microsoft.com/en-us/help/2977003/the-latest-supported-visual-c-downloads Microsoft Visual C++ 2019 Redistributable Package (x86 / x64)]
 
:<span style="color:red">***</span> <tt>vc_redist.x86.exe</tt> is required for <tt>KNLMeansCL-x86</tt>
 
:<span style="color:red">***</span> <tt>vc_redist.x86.exe</tt> is required for <tt>KNLMeansCL-x86</tt>
 
:<span style="color:red">***</span> <tt>vc_redist.x64.exe</tt> is required for <tt>KNLMeansCL-x64</tt>
 
:<span style="color:red">***</span> <tt>vc_redist.x64.exe</tt> is required for <tt>KNLMeansCL-x64</tt>
Line 34: Line 28:
  
 
== [[Script variables|Syntax and Parameters]] ==
 
== [[Script variables|Syntax and Parameters]] ==
:{{Template:FuncDef|KNLMeansCL (clip, int "d", int "a", int "s", float "h", string "channels", int "wmode", float "wref", clip "rclip", string "device_type", int "device_id", int "ocl_x", int "ocl_y", int "ocl_r", bool "stacked", bool "info")}}
+
:{{Template:FuncDef|KNLMeansCL (clip, int "d", int "a", int "s", float "h", string "channels", int "wmode", float "wref", clip "rclip", string "device_type", int "device_id", int "ocl_x", int "ocl_y", int "ocl_r", bool "stacked", bool "info", int "mode_9_to_15bits")}}
 
<br>
 
<br>
 
::{{Par2| |clip| }}
 
::{{Par2| |clip| }}
Line 55: Line 49:
 
::{{Par2|channels|string|"auto"}}
 
::{{Par2|channels|string|"auto"}}
 
:::Set the colour channels to be denoised. Possible values are <code>"YUV", "Y", "UV" or "RGB"</code>, depending on the source colour format. By default, "Y" is denoised if colour space is YUV, otherwise "RGB".
 
:::Set the colour channels to be denoised. Possible values are <code>"YUV", "Y", "UV" or "RGB"</code>, depending on the source colour format. By default, "Y" is denoised if colour space is YUV, otherwise "RGB".
 +
:::Note: <code>channels="YUV"</code> requires a 4:4:4 pixel format (YV24 or YUV444Px).
 
<br>
 
<br>
 
====Advanced====
 
====Advanced====
Line 93: Line 88:
 
::{{Par2|info|bool|false}}
 
::{{Par2|info|bool|false}}
 
:::Display info on the screen. It requires YUV colour space.
 
:::Display info on the screen. It requires YUV colour space.
 +
<br>
 +
::{{Par2|mode_9_to_15bits|int|1}}
 +
:::Affects how less-than-16-bit formats are handled internally. Result is the same, speed may vary.
 +
:::Range: 0 to 2, 1 is the default
 
<br>
 
<br>
 
== Examples ==
 
== Examples ==
Line 101: Line 100:
 
<br>
 
<br>
 
== Changelog ==
 
== Changelog ==
See https://github.com/Khanattila/KNLMeansCL/blob/master/CHANGELOG
+
<pre>
 +
v1.1.1e [20201112 (pinterf)]
 +
 
 +
    Update internal VERSION with 'e' shown in 'info' pages
 +
    New: Add (debug) parameter: 'mode_9_to_15bits' (integer). Values 0, 1 (default), 2
 +
    Affects how less-than-16-bit formats are handled internally.
 +
    Result is the same, speed may vary
 +
    New: VapourSynth: support for all bit depth between 8 and 16
 +
    Fix: VapourSynth: check if format is 4:4:4 for parameter channels="YUV" (was: crash)
 +
    New: VapourSynth: If OpenCL driver does not support special 10-10-10 bit internal processing mode,
 +
    silently fallbacks to the new high bit depth normal mode instead of
 +
    "format not supported"
 +
 
 +
v1.1.1d [20201102 (pinterf)]
 +
 
 +
    Fix: Avisynth: channels="UV" gives error on greyscale clips with bit depth > 8
 +
    Fix: Avisynth: YV24 text in a parameter checking error replaced to bit depth independent 4:4:4
 +
    Fix: Avisynth: channels="UV" was working only for 8 bit subsampled formats
 +
    Fix: Avisynth: channels="UV" to properly support 4:1:1 subsampling
 +
    New: Avisynth: add planar RGB support
 +
    New: Avisynth: add general support for 9-15 bit input formats (avs: 10, 12, 14)
 +
    New: Avisynth: 10 bit input processing is no longer restricted to channels="YUV"
 +
    New: Avisynth: If OpenCL driver does not support special 10-10-10 bit internal processing mode,
 +
    silently fallbacks to the new high bit depth normal mode instead of
 +
    "format not supported"
 +
 
 +
v1.1.1c [20201028 (pinterf)]
 +
 
 +
    Avisynth: fixes invalid frame content / ghost frames / hangup in multithreaded environment
 +
 
 +
v1.1.1test [20200429 (pinterf)]
 +
 
 +
    Khanattila's KNLMeansCL unofficial test build for AviSynth+ 3.5.2
 +
</pre>
 +
 
 +
For older changelog see https://github.com/Khanattila/KNLMeansCL/blob/master/CHANGELOG
  
 
<br>
 
<br>

Latest revision as of 07:05, 22 February 2021

Abstract
Author Khanattila, pinterf
Version v1.1.1e
Download KNLMeansCL_1.1.1e_v20201112-pfmod.7z
Category Spatial-Temporal Denoisers
License GPLv3
Discussion Doom9 Thread


Contents

[edit] Description

KNLMeansCL is an optimized OpenCL implementation of the Non-local means de-noising algorithm. The NLMeans filter, originally proposed by Buades et al., is a very popular filter for the removal of white Gaussian noise, due to its simplicity and excellent performance. The strength of this algorithm is to exploit the repetitive character of the image in order to de-noise the image unlike conventional de-noising algorithms, which typically operate in a local neighbourhood.

[edit] Requirements


*** vc_redist.x86.exe is required for KNLMeansCL-x86
*** vc_redist.x64.exe is required for KNLMeansCL-x64


[edit] Syntax and Parameters

KNLMeansCL (clip, int "d", int "a", int "s", float "h", string "channels", int "wmode", float "wref", clip "rclip", string "device_type", int "device_id", int "ocl_x", int "ocl_y", int "ocl_r", bool "stacked", bool "info", int "mode_9_to_15bits")


clip   =
Input clip; 8192x8192 is the highest resolution supported.


int  d = 1
Set the number of past and future frame that the filter uses for denoising the current frame. d=0 uses 1 frame, while d=1 uses 3 frames and so on. Usually, larger it the better the result of the denoising. Temporal size = (2 * d + 1).


int  a = 2
Set the radius of the search window. a=0 uses 1 pixel, while a=1 uses 9 pixels and so on. Usually, larger it the better the result of the denoising. Spatial size = (2 * a + 1)^2.
Tip: total search window size = temporal size * spatial size.


int  s = 4
Set the radius of the similarity neighbourhood window. The impact on performance is low, therefore it depends on the nature of the noise. Similarity neighborhood size = (2 * s + 1)^2.


float  h = 1.2
Controls the strength of the filtering. Larger values will remove more noise.


string  channels = "auto"
Set the colour channels to be denoised. Possible values are "YUV", "Y", "UV" or "RGB", depending on the source colour format. By default, "Y" is denoised if colour space is YUV, otherwise "RGB".
Note: channels="YUV" requires a 4:4:4 pixel format (YV24 or YUV444Px).


[edit] Advanced

int  wmode = 0
  • 0 : Welsch weighting function has a faster decay, but still assigns positive weights to dissimilar blocks. Original Non-local means denoising weighting function.
  • 1 : Modified Bisquare weighting function to be less robust.
  • 2 : Bisquare weighting function use a soft threshold to compare neighbourhoods (the weight is 0 as soon as a given threshold is exceeded).
  • 3 : Modified Bisquare weighting function to be even more robust.


float  wref = 1.0
Amount of original pixel to contribute to the filter output, relative to the weight of the most similar pixel found.


clip  rclip =
Extra reference clip option to do weighting calculation.


[edit] OpenCL

string  device_type = "auto"
  • "accelerator" : Dedicated OpenCL accelerators.
  • "cpu" : An OpenCL device that is the host processor.
  • "gpu" : An OpenCL device that is a GPU.
  • "auto" : "accelerator" -> "gpu" -> "cpu".


int  device_id = 0
The 'device_id'+1º device of type 'device_type' in the system. Example: [device_type = "GPU", device_id = 1] return the second GPU in the system.


int  ocl_x = 0
int  ocl_y = 0
int  ocl_r = 0
They should not be changed, unless you know what you are doing.
  • 'ocl_x' and 'olc_y' are the local work group size of the separable convolution kernel.
  • 'olc_r' is the number of processed pixel for work-item.


[edit] Miscellaneous

bool  stacked = false
AviSynth hack. Set 16-bit stacked input and output clip. See Stack16 for more info.
AviSynth+ supports native high bit depth; this hack is only for AviSynth 2.6.


bool  info = false
Display info on the screen. It requires YUV colour space.


int  mode_9_to_15bits = 1
Affects how less-than-16-bit formats are handled internally. Result is the same, speed may vary.
Range: 0 to 2, 1 is the default


[edit] Examples

KNLMeansCL with all default settings:

AviSource("Blah.avi")
KNLMeansCL()


[edit] Changelog

v1.1.1e [20201112 (pinterf)]

    Update internal VERSION with 'e' shown in 'info' pages
    New: Add (debug) parameter: 'mode_9_to_15bits' (integer). Values 0, 1 (default), 2
    Affects how less-than-16-bit formats are handled internally.
    Result is the same, speed may vary
    New: VapourSynth: support for all bit depth between 8 and 16
    Fix: VapourSynth: check if format is 4:4:4 for parameter channels="YUV" (was: crash)
    New: VapourSynth: If OpenCL driver does not support special 10-10-10 bit internal processing mode,
    silently fallbacks to the new high bit depth normal mode instead of
    "format not supported"

v1.1.1d [20201102 (pinterf)]

    Fix: Avisynth: channels="UV" gives error on greyscale clips with bit depth > 8
    Fix: Avisynth: YV24 text in a parameter checking error replaced to bit depth independent 4:4:4
    Fix: Avisynth: channels="UV" was working only for 8 bit subsampled formats
    Fix: Avisynth: channels="UV" to properly support 4:1:1 subsampling
    New: Avisynth: add planar RGB support
    New: Avisynth: add general support for 9-15 bit input formats (avs: 10, 12, 14)
    New: Avisynth: 10 bit input processing is no longer restricted to channels="YUV"
    New: Avisynth: If OpenCL driver does not support special 10-10-10 bit internal processing mode,
    silently fallbacks to the new high bit depth normal mode instead of
    "format not supported"

v1.1.1c [20201028 (pinterf)]

    Avisynth: fixes invalid frame content / ghost frames / hangup in multithreaded environment

v1.1.1test [20200429 (pinterf)]

    Khanattila's KNLMeansCL unofficial test build for AviSynth+ 3.5.2

For older changelog see https://github.com/Khanattila/KNLMeansCL/blob/master/CHANGELOG


[edit] External Links

  • GitHub - Source code repository.




Back to External Filters

Personal tools