View Full Version : KNLMeansCL: OpenCL NLMeans de-noising algorithm [2018-01-29]
YAFU
19th September 2015, 14:30
ok, then a problem with PasteAll. I will investigate how it should be
Are_
19th September 2015, 14:34
@YAFU https://paste.kde.org/pvfyjgdbm/ed4te4/raw
YAFU
19th September 2015, 14:54
@Are_, this line:
clip = core.fmtc.resample (src, w left right, h top bottom, -left, -top, w left right, h top bottom, kernel="point", fulls=True, fulld=True)
I should add the "+" sign as the line in the feisty2 code?
Edit:
Sorry, I had not seen that you had edited your previous message #455. Apparently it has with the "+" sign.
Now I get this error:
Failed to evaluate the script:
Python exception: 'int' object is not callable
Traceback (most recent call last):
File "vapoursynth.pyx", line 1469, in vapoursynth.vpy_evaluateScript (src/cython/vapoursynth.c:23703)
File "/media/script.vpy", line 22, in <module>
ret = padding(ret, padding, padding, padding, padding)
TypeError: 'int' object is not callable
~ VEGETA ~
19th September 2015, 15:32
1) With the same arguments it is ~6/7 time faster. But I have a quad core and original TNLMeans is single thread.
KNLMeansCL(device_type="CPU") - 1.910 fps
TNLMeans(2, 2, 4, 4, 0, 0) - 0.305 fps
The main advantage is the ability to use the GPU.
2) If Intel Core 2 is not more supported by intel you can use the AMD APP SDK v2.9 http://developer.amd.com/tools-and-sdks/opencl-zone/amd-accelerated-parallel-processing-app-sdk/
So you affirm KNLMeansCL to be faster than both dfttest and tnlmeans? that is great... I have core2due laptop, but I encode on a powerful server.
I've downloaded the AMD APP SDK v3.0 (not 2.9) but avs returned "open cl device not available".
Khanattila
19th September 2015, 18:02
Thanks feisty2, Khanattila.
So, This padding thing could be implemented within KNLMeans as an option?
@feisty2, I get the following error message with the script:
Failed to evaluate the script:
Python exception: expected an indented block (script.vpy, line 32)
Traceback (most recent call last):
File "vapoursynth.pyx", line 1468, in vapoursynth.vpy_evaluateScript (src/cython/vapoursynth.c:23689)
File "/media/script.vpy", line 32
core = vs.get_core ()
^
IndentationError: expected an indented block
Oh hell no. :cool:
It is much easier than it looks like. I have already fixed it.
If you do not want to wait for the next release, you can clone github repository.
git clone https://github.com/Khanattila/KNLMeansCL.git
git reset --hard 7e2ea1c
cd KNLMeansCL
./configure
make
sudo make install
Khanattila
19th September 2015, 18:08
So you affirm KNLMeansCL to be faster than both dfttest and tnlmeans? that is great... I have core2due laptop, but I encode on a powerful server.
I've downloaded the AMD APP SDK v3.0 (not 2.9) but avs returned "open cl device not available".
Dfttest really depends by hardware. But KNLMeansCL >> TNLMeansCL.
I have not tested APP SDK v3.0, but v2.9 I can confirm that it also works with Intel cpu.
Have you tried device_type="ALL" and device_id=0, 1, ecc?
Groucho2004
19th September 2015, 18:30
I have not tested APP SDK v3.0, but v2.9 I can confirm that it also works with Intel cpu.
I have uploaded the last AMD runtime that is supported by WinXP32 here (https://www.sendspace.com/folder/10dsem) ("AMD_OpenCL_25_XP32.7z"). Works fine with my i5 2500K, should be fine with a C2D too.
YAFU
19th September 2015, 19:06
Oh hell no. :cool:
It is much easier than it looks like. I have already fixed it.
If you do not want to wait for the next release, you can clone github repository.
git clone https://github.com/Khanattila/KNLMeansCL.git
git reset --hard 7e2ea1c
cd KNLMeansCL
./configure
make
sudo make install
So, it is not necessary anymore extra code in the script to avoid distortions on edges? Seems it's working!
Two things regarding compiling, I don't know it's because I use Linux. Since some versions from git, "configure" file is not marked as executable (I do the file executable manually). And I have not understood this part: "cd KNLMeansCL". "configure" is out of that folder.
Anyway, I seem to have successfully compiled
Thanks!
EDIT:
You forget what I said about "cd KNLMeansCL". It's because I just did "git pull" inside the KNLMeansCL folder I already had.
Khanattila
19th September 2015, 20:19
So, it is not necessary anymore extra code in the script to avoid distortions on edges? Seems it's working!
Two things regarding compiling, I don't know it's because I use Linux. Since some versions from git, "configure" file is not marked as executable (I do the file executable manually). And I have not understood this part: "cd KNLMeansCL". "configure" is out of that folder.
Anyway, I seem to have successfully compiled
Thanks!
EDIT:
You forget what I said about "cd KNLMeansCL". It's because I just did "git pull" inside the KNLMeansCL folder I already had.
I development under Windows, sometimes I have problems with the files-permission.
Groucho2004
19th September 2015, 21:15
TNLMeans(2, 2, 4, 4, 0, 0)
I wanted to replicate your benchmark, I get this error:
TNLMeans: Sy must be greater than or equal to By!
Khanattila
19th September 2015, 21:54
I wanted to replicate your benchmark, I get this error:
TNLMeans: Sy must be greater than or equal to By!
TNLMeans(2, 2, 0, 4, 4, 0, 0), just a typo.
Or TNLMeans(ax=2, ay=2, sx=4, sy=4, bx=0, by=0) if you prefer.
Groucho2004
19th September 2015, 22:20
Here's my test with the AMD OpenCL runtime 2.5 on XP (i5 2500K SB @ 4GHz):
Script:
colorbars(width = 640, height = 480, pixel_type = "yv12").killaudio().assumefps(25, 1).trim(0, 399)
KNLMeansCL(device_type = "CPU")
Result:
FPS (min | max | average): 3.118 | 4.248 | 4.160
Memory usage (phys | virt): 41 | 38 MB
Thread count: 2
CPU usage (average): 95%
For TNLMeans I used SEt's AVS MT so the CPU is also maxed out.
Script:
SetMTMode(2)
colorbars(width = 640, height = 480, pixel_type = "yv12").killaudio().assumefps(25, 1).trim(0, 399)
TNLMeans(ax=2, ay=2, sx=4, sy=4, bx=0, by=0)
Result:
FPS (min | max | average): 0.859 | 898.0 | 3.474
Memory usage (phys | virt): 128 | 127 MB
Thread count: 5
CPU usage (average): 99%
I also tested the TNLMeans DLL I built with ICL 10:
FPS (min | max | average): 1.460 | 3317 | 5.859
Memory usage (phys | virt): 128 | 128 MB
Thread count: 5
CPU usage (average): 98%
Just for kicks, here is the result with the same script and my GTX750:
colorbars(width = 640, height = 480, pixel_type = "yv12").killaudio().assumefps(25, 1).trim(0, 399)
KNLMeansCL(device_type = "GPU")
FPS (min | max | average): 242.3 | 285.2 | 283.4
Memory usage (phys | virt): 59 | 77 MB
Thread count: 8
CPU usage (average): 25%
GPU usage (average): 91%
Video engine load (average): 0%
GPU memory usage: 56 MB
~ VEGETA ~
19th September 2015, 23:08
I used device_type=cpu and it works! but in my core2due it is slow (maybe like tnlmeans)... gonna try it using a better device.
foxyshadis
20th September 2015, 12:55
Now I get this error:
Failed to evaluate the script:
Python exception: 'int' object is not callable
Traceback (most recent call last):
File "vapoursynth.pyx", line 1469, in vapoursynth.vpy_evaluateScript (src/cython/vapoursynth.c:23703)
File "/media/script.vpy", line 22, in <module>
ret = padding(ret, padding, padding, padding, padding)
TypeError: 'int' object is not callable
You can't very well say "padding = 10" and then expect it to remember that you actually meant the other padding() from before. ;) Make sure you keep track of what names are used where, avisynth would barf the same way. Instead of just padding(), maybe name the function pad_clip().
hydra3333
21st September 2015, 15:06
"CheckVersion(6)" is in the constructor and the plugin should therefore throw an error "Plugin was designed for a later version of Avisynth (6)" which it does in my test with r1576 and KNLMeansCL 0.5.
Just checking because I'm unsure - will it run under avisynth 2.57 ? Fingers crossed and hoping for a yes.
Reel.Deel
21st September 2015, 15:13
Just checking because I'm unsure - will it run under avisynth 2.57 ? Fingers crossed and hoping for a yes.
Will KNLMeans work with AviSynth 2.57? Absolutely not :D.
Khanattila
21st September 2015, 17:13
Just checking because I'm unsure - will it run under avisynth 2.57 ? Fingers crossed and hoping for a yes.
No way!
Groucho2004
21st September 2015, 17:24
Just checking because I'm unsure - will it run under avisynth 2.57 ? Fingers crossed and hoping for a yes.
No No No! It will explode!
Khanattila
22nd September 2015, 12:18
Here's my test with the AMD OpenCL runtime 2.5 on XP (i5 2500K SB @ 4GHz):
Script:
colorbars(width = 640, height = 480, pixel_type = "yv12").killaudio().assumefps(25, 1).trim(0, 399)
KNLMeansCL(device_type = "CPU")
Result:
FPS (min | max | average): 3.118 | 4.248 | 4.160
Memory usage (phys | virt): 41 | 38 MB
Thread count: 2
CPU usage (average): 95%
For TNLMeans I used SEt's AVS MT so the CPU is also maxed out.
Script:
SetMTMode(2)
colorbars(width = 640, height = 480, pixel_type = "yv12").killaudio().assumefps(25, 1).trim(0, 399)
TNLMeans(ax=2, ay=2, sx=4, sy=4, bx=0, by=0)
Result:
FPS (min | max | average): 0.859 | 898.0 | 3.474
Memory usage (phys | virt): 128 | 127 MB
Thread count: 5
CPU usage (average): 99%
I also tested the TNLMeans DLL I built with ICL 10:
FPS (min | max | average): 1.460 | 3317 | 5.859
Memory usage (phys | virt): 128 | 128 MB
Thread count: 5
CPU usage (average): 98%
Just for kicks, here is the result with the same script and my GTX750:
colorbars(width = 640, height = 480, pixel_type = "yv12").killaudio().assumefps(25, 1).trim(0, 399)
KNLMeansCL(device_type = "GPU")
FPS (min | max | average): 242.3 | 285.2 | 283.4
Memory usage (phys | virt): 59 | 77 MB
Thread count: 8
CPU usage (average): 25%
GPU usage (average): 91%
Video engine load (average): 0%
GPU memory usage: 56 MB
CPU's output is slightly different from GPU's output.
Sooner or later to fix.
MysteryX
22nd September 2015, 17:00
CPU's output is slightly different from GPU's output.
Sooner or later to fix.
Which output looks better?
Khanattila
23rd September 2015, 16:58
Which output looks better?
Perhaps the AMD compiler, but changes marginally.
Khanattila
23rd September 2015, 16:59
https://github.com/Khanattila/KNLMeansCL/releases/tag/v0.6.11
- Performance increase: up to 50% faster.
- AviSynth: OpenMP no more needed.
- Fixed bad processing borders.
- VapourSynth: fixed bad support of P9/P10 rclip.
Khanattila
24th September 2015, 16:31
A fast benchmark: https://github.com/Khanattila/KNLMeansCL/blob/master/BENCHMARK.md
tObber166
24th September 2015, 18:30
:thanks: :D
poisondeathray
24th September 2015, 18:42
Thanks
"- Performance increase: up to 50% faster."
Wow - I'm curious under what conditions would you see something that on the new version?
Khanattila
24th September 2015, 20:05
Thanks
"- Performance increase: up to 50% faster."
Wow - I'm curious under what conditions would you see something that on the new version?
AviSynth YV24, cmode, 16bits for example.
Pack and unpack operation are now done by the opencl device (GPU), it has much more bandwidth.
There are also a few minor optimizations to reduce the bandwidth used and to exploit the textures lookups.
tormento
25th September 2015, 11:19
Just found that AVSMeter64 and x264_x64 works with 64 bit versions of both DGDecNV and KNLMeansCL:
LoadPlugin("D:\eseguibili\media\DGDecNV\x64\DGDecodeNV.dll")
DGSource("E:\in\2_01 favoloso mondo di Amelie, Il\amelie.dgi")
KNLMeansCL(D=1, A=1, h=7.0,device_type="GPU")
CompTest(1)
AVSMeter 2.1.2 (x64)
AviSynth+ 0.1 (r1825, MT, x86_64) (0.1.0.0)
Number of frames: 1764
Length (hh:mm:ss.ms): 00:01:13.500
Frame width: 1920
Frame height: 816
Framerate: 24.000 (24/1)
Colorspace: YV12
Frames processed: 1764 (0 - 1763)
FPS (min | max | average): 2.087 | 41.93 | 22.76
Memory usage (phys | virt): 101 | 389 MB
Thread count: 23
CPU usage (average): 10%
Time (elapsed): 00:01:17.497
There must be something wrong with NVIDIA drivers or something else with 32 bit.
Khanattila
28th September 2015, 20:34
Maybe I add a built-in benchmark for auto-select the fastest OpenCL device available. It could increase load times, however.
Sparktank
28th September 2015, 21:06
Maybe I add a built-in benchmark for auto-select the fastest OpenCL device available. It could increase load times, however.
A separate tool would be more appropriate.
I know my Intel CPU is older than my NVidia card.
I'm not rich enough upgrade my MB to upgrade my CPU, so I always set NVidia as I've tested between the two on my system.
Something like that would be more useful for people who don't know their own system and rely on automated processing.
It's more useful as a one-time feature for existing hardware (repeat if upgraded any components).
Groucho2004
28th September 2015, 21:14
Maybe I add a built-in benchmark for auto-select the fastest OpenCL device available. It could increase load times, however.
If you really want to do that I'd suggest to add a parameter to the plugin for a benchmark like "benchmark = true". The benchmark could cycle through all available OpenCL devices, test the speed and then write a log file with the results. That way the user only has to test it once.
Khanattila
28th September 2015, 21:42
It depends on how fast is the benchmark... If it takes ~1/2 seconds it does not need an external tool.
Sparktank
28th September 2015, 21:45
If you really want to do that I'd suggest to add a parameter to the plugin for a benchmark like "benchmark = true". The benchmark could cycle through all available OpenCL devices, test the speed and then write a log file with the results. That way the user only has to test it once.
Much more efficient.
=false as default.
Khanattila
4th October 2015, 11:37
New v0.7.0 will have a OpenCL 1.2 kernel, so it will be slightly faster in temporal (~25%), but it will not be supported by older devices. Might work or might not.
AMD Radeon HD 7350 or greater.
NVIDIA is a bit problematic:
GeForce GTX 660 Rev. 2 or greater.
GeForce GTX 760 or greater.
GeForce GTX 950 or greater.
GeForce GTX TITAN X.
qwerty1983
4th October 2015, 17:38
Sorry to interrupt.
Can i use KNLMeans on my laptop with intel core i3-370M / Intel HD Graphics ??
MysteryX
4th October 2015, 17:40
Then it might not be wise to make it a requirement. How about using both versions, and using OpenCL 1.2 only if it is supported?
New v0.7.0 will have a OpenCL 1.2 kernel, so it will be slightly faster in temporal (~25%), but it will not be supported by older devices. Might work or might not.
AMD Radeon HD 7350 or greater.
NVIDIA is a bit problematic:
GeForce GTX 660 Rev. 2 or greater.
GeForce GTX 760 or greater.
GeForce GTX 950 or greater.
GeForce GTX TITAN X.
Khanattila
4th October 2015, 22:57
Sorry to interrupt.
Can i use KNLMeans on my laptop with intel core i3-370M / Intel HD Graphics ??
http://www.intel.com/support/graphics/sb/CS-033757.htm Only CPU.
Khanattila
4th October 2015, 22:57
Then it might not be wise to make it a requirement. How about using both versions, and using OpenCL 1.2 only if it is supported?
One thing will be done.
Reel.Deel
5th October 2015, 21:28
@Khanattila
Any thoughts on making KNLMeans compatible with AviSynth+ r1576? AviSynth+ builds that use the latest header are unstable (http://forum.doom9.org/showthread.php?p=1736551#post1736551). Not sure about ultim's whereabouts so it's uncertain when this will get fixed.
Khanattila
6th October 2015, 09:10
@Khanattila
Any thoughts on making KNLMeans compatible with AviSynth+ r1576? AviSynth+ builds that use the latest header are unstable (http://forum.doom9.org/showthread.php?p=1736551#post1736551). Not sure about ultim's whereabouts so it's uncertain when this will get fixed.
I read about the problems they have had. I had decided not to support Version 5 (Avisynth 2.6.0a1-a5) to force users to upgrade. Not for other reasons.
However, if avisynth+ is still not stable, I will add support for the previous version.
Khanattila
14th October 2015, 17:12
http://github.com/Khanattila/KNLMeansCL/releases/tag/v0.7.0
- Performance increase: temporal up to 35% faster.
- New 'auto' device_type.
- Changed default 'd' value from '0' to '1'.
- Changed min 'a' value from '0' to '1'.
- OpenCL 1.2 support now required.
- AviSynth 2.6.0a1-a5 backward compatibility.
- Fixed Mac OS X version.
This is the last major release. Update and enjoy.
Groucho2004
14th October 2015, 18:08
http://github.com/Khanattila/KNLMeansCL/releases/tag/v0.7.0
- Performance increase: temporal up to 35% faster.
- New 'auto' device_type.
- Changed default 'd' value from '0' to '1'.
- Changed min 'a' value from '0' to '1'.
- OpenCL 1.2 support now required.
- AviSynth 2.6.0a1-a5 backward compatibility.
- Fixed Mac OS X version.
This is the last major release. Update and enjoy.
Any idea what this is about:
http://s27.postimg.org/4fnxaatwj/Image1.png
Card (GTX750) and driver (350.12) support OpenCL 1.2. OS is XP32.
Khanattila
14th October 2015, 18:14
Any idea what this is about:
http://s27.postimg.org/4fnxaatwj/Image1.png
Card (GTX750) and driver (350.12) support OpenCL 1.2. OS is XP32.
Sooner or later someone will make an attack on the NVIDIA-headquarters. Can you try with 'd' = 0?
Anyway Khronos report GTX 750 with Microsoft Windows 7, Microsoft Windows 10 and Linux Kernel Version 2.6+
Possible NVIDIA driver problem?
Groucho2004
14th October 2015, 18:17
Can you try with 'd' = 0?
That error message appears already when just loading the filter.
Groucho2004
14th October 2015, 18:18
Sooner or later someone will make an attack on the NVIDIA-headquarters. Can you try with 'd' = 0?
Anyway Khronos report GTX 750 with Microsoft Windows 7, Microsoft Windows 10 and Linux Kernel Version 2.6+
Possible NVIDIA driver problem?
I'll try a newer driver.
Reel.Deel
14th October 2015, 18:22
@Khanattila
Thanks for the update! I don't see an x64 build anymore?
Khanattila
14th October 2015, 18:30
@Khanattila
Thanks for the update! I don't see an x64 build anymore?
Mad PeaZip. Updated.
Khanattila
14th October 2015, 18:31
That error message appears already when just loading the filter.
// Inside constructor
if (d) do something
else do other
Try it.
Groucho2004
14th October 2015, 18:35
I'll try a newer driver.
Same thing with the latest driver. Here is what Dep Walker has to say:
http://s21.postimg.org/wy7zauiiv/Image1.png
Groucho2004
14th October 2015, 18:37
// Inside constructor
if (d) do something
else do other
Try it.
Could you elaborate a bit? Try what exactly?
Khanattila
14th October 2015, 18:46
Could you elaborate a bit? Try what exactly?
Simply use KNLMeansCL(d=0) instead default KNLMeansCL(d=1).
Very definitely it does not work the same but is an attempt.
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.