Log in

View Full Version : NLMeansCL: GPU based Non Local Means Denoising


Pages : 1 2 3 [4]

Mounir
15th May 2012, 05:13
I have a problem with the az parameter
i quote (from the 1st page):
Parameter Az: Sets the temporal radius. At the moment only 1 and 2 are supported. (default = 0)

When i use AVSp it return an error Nlmeans does not have an argument named az

I wanna try az=1 at least

Bloax
15th May 2012, 13:59
The temporal part of it is also messed up, as it makes random solid green (perhaps also black if memory serves) blocks all over the video.

Mounir
15th May 2012, 23:52
I guess i will have to stick with the v 0.3.2 then, thanks for the info

ben13
30th May 2012, 06:27
nvm got the error fixed.
Thanks for the plugin. works great!

mastrboy
7th October 2012, 16:20
Malcolm: have you given up on making the temporal (0.4.0) release stable?

bcn_246
11th October 2012, 22:54
Looks nice. When I get my 670 back (being RMA'd) I will do some tests against an i7@4.2GHz.

Edit:
I am using a GTX 630 (a very low-end card!) while the RMA is going on, decided to try it out with that.
Had no problems loading with the newest WHQL GeForce drivers (v306.97).

Due to not being able to get MT("*",threads=*,overlap=*) with AviSynth v2.6 I still use v2.58. I had no problems running it using MT("NLMeansCL",threads=8,overlap=8).

Screenshots:

Original - NTSC DVD -> 848x456p24 YV12 -> AVISource("rip.avi")
Renders @ ~900-1100fps
http://i.imgur.com/3MhRS.png

CPU - (above+)MT("TNLMeans",threads=8,overlap=8):
Renders @ ~5-6FPS
http://i.imgur.com/quVnq.png

GPU - (above+)MT("NLMeansCL",threads=8,overlap=8):
Renders @ ~30-35fps
http://i.imgur.com/JELYn.png

Really quite impressed. Got a significant speed-up against a pretty powerful CPU using crappy GPU.
Compared a few screen-grabs and found the output image is pretty close to TNLMeans.

Farfie
26th December 2012, 08:05
Getting some weird artifacts using it with Avisynth 2.5.8, Cloo 0.9.0, AvsFilter r62988, Win7 x64. They're like either black dots, or they form (usually horizontal) black lines together.
And by dots I don't mean pixels, they're like groups of pixels that form a square. They appear randomly it seems, for like 1 frame. They're not THAT often, but I caught them pretty quickly. And sometimes they do happen frequently, but I can't find a pattern for it.
Using NLMeansCL with default settings.

Any ideas? I'm no Avisynth pro, but I don't think I'm doing anything wrong.

yup
27th December 2012, 06:59
Getting some weird artifacts using it with Avisynth 2.5.8, Cloo 0.9.0, AvsFilter r62988, Win7 x64. They're like either black dots, or they form (usually horizontal) black lines together.
And by dots I don't mean pixels, they're like groups of pixels that form a square. They appear randomly it seems, for like 1 frame. They're not THAT often, but I caught them pretty quickly. And sometimes they do happen frequently, but I can't find a pattern for it.
Using NLMeansCL with default settings.

Any ideas? I'm no Avisynth pro, but I don't think I'm doing anything wrong.
Try switch to last Avisynth 2.6. I do not have problem with official and Set build Avisynth 2.6 under Win7 x64.
yup.

Farfie
27th December 2012, 14:19
Try switch to last Avisynth 2.6. I do not have problem with official and Set build Avisynth 2.6 under Win7 x64.
yup.

Okay, so I installed 2.6.0 a3 (official build), but to no avail. Whenever I use this filter, alone or with others, I get the random black dots/bars. It's very hard to believe no one else has this problem. I would LOVE to just look at my dll's again (Cloo and whatnot) and see that one of them is the wrong version or something, but they're not.

Could it be that I'm using a 10 bit encoder? Does it even work like that? I've been using this exact enc for months now with no problems.
The only thing I can say is that when I load NLMeansCL to preview the output in MeGui, there are no black dots anywhere. Only after it's encoded do they miraculously get there. Also, I can encode over the same thing many many times, and there's no pattern. They could be anywhere, or not show up at all sometimes. These are the only clues I have to go on. :(

yup
27th December 2012, 15:43
Farfie!
:script:
Avisynth without hack support only 8-bit.
Try open your script in Virtualdub and save loseless codec Ut recomended and after encode in MeGUI. May be power supply problem not enough for CPU and GPU simultaneously during encoding in MeGUI?
yup.

Farfie
29th December 2012, 17:08
Farfie!
:script:
Avisynth without hack support only 8-bit.
Try open your script in Virtualdub and save loseless codec Ut recomended and after encode in MeGUI. May be power supply problem not enough for CPU and GPU simultaneously during encoding in MeGUI?
yup.

First of all yup, I wan to thank you for helping me :thanks:

The script I use is simple, it just runs ffvideosource on an 8bit mkv, and then calls NLMeansCL on it with default settings. No other filters are used, nothing fancy.

As far as the hack goes, I believe that only affects 10bit video input, I don't think what the encoder does to whatever avisynth feeds it matters, which is why I didn't think the 10bit encoder mattered, but I could always be wrong.

In any case, I successfully loaded the script into virtualdub to save as lossless avi. I actually thought this would work, but it did not. I ended up finding black squares. :(

Even if I could blame the encoder or something else, I have been using the 10bit encoder without any problems for at least a year now, throwing all kinds of filters at it with all sorts of different sources (10bit or not), and have never had any problems before this filter. It's very difficult to think that the problem is on my end, when I can fire up any filter on this source, like dfttest, or even the original TNLMeans on it, and have no problems with my output. But as I said, I'm no pro.. and I'm not here to tell you guys you are wrong.

I really love this filter. The output it produces is excellent when there are no artifacts. I don't want to give up on it :)

Farfie
2nd January 2013, 17:59
Hey all. I believe I have found the cause of my problem, or more like, I have found the catalyst. It seems as though whenever I have GPU activity while encoding (playing back an mkv, playing a video game, maybe even just having hardware acceleration on in my browser and using the internet), these black squares can appear at any time. How I stumbled upon this was just very lucky: I was encoding a test file and about 1/3 the way through, I played it back, and saw no problems by the time it stopped on its own (out of frames.) However, I for some reason didn't close the mkv this time around, and after some more had finished, I had unpaused to continue looking for squares, and noticed that the very next frame after the pause point had quite a few black squares in it. I kept watching, and black squares were pretty much everywhere (equal to the duration of me watching the mkv up until the pause point). Pretty interesting.

I then decided to see if the amount of black squares was proportional to the amount of GPU load (more work for gpu = more artifacts?): but that, even more interestingly, came up negative. Across 3 games while simultaneously encoding, I couldn't see an increase in amount of black squares from the games, or just playing an mkv. I also tried different renderers (I usually use madVR), like EVR-CP with a PS 2.0 resizer, bilinear, and then tried regular EVR. Everything gave very similar results, so I pretty much called it at that point. As you can imagine though, as soon as I figured this out, I turned off everything that could be using the GPU, and started a ton of test encodes to see if I could find any squares. As expected, I couldn't find any.

Unfortunately though, due to the nature of this problem, I don't think I can particularly trust the filter to not put a random black square somewhere because of some spike. Also, I suppose the problem could be some kind of CPU thing instead of GPU. I could run prime95 while encoding to see about that really quick. Anyway, my hardware is a 3930k and GTX 680, using latest 310.70 drivers. If anyone has any other questions, I'd be more than happy to oblige; this is easily one of the best denoisers, especially when factoring in speed. Thanks for reading!

dadix
4th January 2013, 10:14
My processor is i5 2410m (hd 3000 graphic processor included -Sandy Bridge 2) and GeForce GT 520MX graphic card - laptop with Nvidia Optimus. I have 4 fps with NLMeanscl and 7 fps with FFT3dGPU. Is this speed normal ? I read about 20 fps or more on this post. NLMeanscl is spatial or temporal denoiser? My scripts:

1DirectShowSource("C:\Users\tetris\Downloads\end_of_the_world_shootout_-_part_2_1280x720.mp4")

#ConvertTorgb32()
#RGBAdjust(1.0, 1.0, 1.0, 1.0, 0.0, 0.0, -8.0, 0.0, 1, 1, 1, 1,analyze=false)

ConvertToYV12(matrix="Rec709")
Loadplugin("C:\Program Files (x86)\AviSynth 2.5\plugins\mvtools\mvtools.dll")
Loadplugin("C:\Program Files (x86)\AviSynth 2.5\plugins\fft3dgpu\FFT3dGPU.dll")
Loadplugin("C:\Program Files (x86)\AviSynth 2.5\plugins\dither-1.21.0\dither.dll")
Loadplugin("C:\Program Files (x86)\AviSynth 2.5\plugins\RemoveGrain\RSharpen.dll")
Loadplugin("C:\Program Files (x86)\AviSynth 2.5\plugins\RemoveGrain\RemoveGrain.dll")
Import("C:\Program Files (x86)\AviSynth 2.5\plugins\dither-1.21.0\dither.avsi")
Loadplugin("C:\Program Files (x86)\AviSynth 2.5\plugins\gradfun2db\gradfun2db.dll")

Dither_convert_8_to_16 ()
FFT3dGPU(bt=1,plane=4,bw=48,bh=48,ow=16,oh=16,sigma=2.0,interlaced=false)
gradfun2db(1.2)
Dither_Resize16(1280,720)
ditherpost()

#HistoGram("luma")


bt=1 --> only spatial

2.DirectShowSource("C:\Users\tetris\Downloads\end_of_the_world_shootout_-_part_2_1280x720.mp4")
ConvertToYV12(matrix="Rec709")

Loadplugin("C:\Program Files (x86)\AviSynth 2.5\plugins\mvtools\mvtools.dll")
Loadplugin("C:\Program Files (x86)\AviSynth 2.5\plugins\fft3dgpu\FFT3dGPU.dll")
Loadplugin("C:\Program Files (x86)\AviSynth 2.5\plugins\dither-1.21.0\dither.dll")
Loadplugin("C:\Program Files (x86)\AviSynth 2.5\plugins\RemoveGrain\RSharpen.dll")
Loadplugin("C:\Program Files (x86)\AviSynth 2.5\plugins\RemoveGrain\RemoveGrain.dll")
Import("C:\Program Files (x86)\AviSynth 2.5\plugins\dither-1.21.0\dither.avsi")
Loadplugin("C:\Program Files (x86)\AviSynth 2.5\plugins\gradfun2db\gradfun2db.dll")

Dither_convert_8_to_16 ()
NLMeanscl(A=4, S=2, B=1, aa=1.0, h=1.8, plane=4)
gradfun2db(1.2)
Dither_Resize16(1280,720)
ditherpost()

#HistoGram("luma")

x265
30th January 2013, 18:42
Avspmod crashes when i set the value of B(NLMeansCL) to 0.

yup
1st February 2013, 11:08
Avspmod crashes when i set the value of B(NLMeansCL) to 0.

x265 Avspmod problem.
I try B=0 and load to Virtualdub work without problem.
yup.

x265
1st February 2013, 12:31
It crashes even when i load the script for encoding in MeGUI.

Mounir
9th February 2013, 18:26
NLMeansCL(A=4, S=2, B=1, aa=1.0, h=2.0,HC=3.5, plane=4,cpu=false,buffer=false,sse=true) #

The only two parameters you should change in my experience are h and HC (strength for luma and chroma planes respectively) but feel free to experiment

you have to load this dll in you script:
LoadPlugin("AvsFilterNet.dll")

You need all these dll (i made a .rar for you), put everything in the plugins folder
http://www.mediafire.com/?5prcoh3a9ost3al

This version does a spatial filtering (intra frame) only there is another with temporal denoising but it's buggy i've read, thus best to avoid for now i guess.

Farfie
2nd March 2013, 20:28
Some time has passed, and I still get strange artifacts with this filter, though they have changed a bit I guess... I just don't know what to blame anymore. I used to get little black boxes, but after trying it again recently (after not using it for awhile) I got this, long green bars, which is even worse I suppose. I just wish I had some kind of a lead. Is it possible that it could be something to do with GTX 6 series and up GPUs? Has anyone used this filter with their GTX 6xx cards?

http://puu.sh/2aRYo

Bloax
3rd March 2013, 06:49
What version of the filter are you using, because I'm too lazy to check?
Because you should be using 0.3.2.

yup
3rd March 2013, 09:51
Farfie!
I see the same artifacts at big value A and S.
I remember Your post.
I do not see one at A=2 or 3.
I do not have time testing with cpu=true and buffer=true, but when I install Intel OpenCL SDK 1.1 it is work but slow comparing to GPU.
If I have time I make testing.
yup.

Farfie
4th March 2013, 06:17
What version of the filter are you using, because I'm too lazy to check?
Because you should be using 0.3.2.
Yeah, it's 0.3.2.

Farfie!
I see the same artifacts at big value A and S.
I remember Your post.
I do not see one at A=2 or 3.
I do not have time testing with cpu=true and buffer=true, but when I install Intel OpenCL SDK 1.1 it is work but slow comparing to GPU.
If I have time I make testing.
yup.

You know yup, I was getting really excited. I lowered the A to 2 and it was doing great. Put it at 3, and got through a few episodes without seeing any, but eventually I did find one of the old artifacts I talked about in the past (little black boxes or rectangles).
I'm going to try A=2 again, but I feel like it's just going to have less artifacts rather than fix the problem, which is just a no go unfortunately.

yup
4th March 2013, 11:12
Farfie!
Your source is HD, my source is SD with A up to 3 and even B=0 I do not have problem.
I think problem with frame memory between CPU and GPU.
Try Intel OpenCL SDK (for my computer it is slower with factor near 30) if will be O'k, may be problem Nvidia OpenCL implementation, Nvidia prefer proprietary CUDA for application.
It is only suggestion.
Interest link http://www.ipol.im/pub/art/2011/bcm_nlm/
For small noise level recomend A=1 and S=10 and h=0.4*sigma may be work with HD source without bug.
yup.

LigH
21st March 2013, 14:20
Interesting project.

Brief test on a Phenom-II X4 945 (3 GHz) and a GeForce 9600 GT with a 1080p FullHD AVC video via FFMS2:

• NLMeansCL 0.3.2: ~3 fps, clean
• NLMeansCL 0.4a(Az=2): ~2 fps, many artefacts

Will check again with a GeForce GTS 450 during the weekend.

LigH
23rd March 2013, 08:54
Phenom-II X6 1045T and a GeForce GTS 450 (GF116) with a 1080p FullHD AVC video via FFMS2:

• NLMeansCL 0.3.2: ~10.8 fps, clean
• NLMeansCL 0.4a(Az=2): ~2.6 fps, some artefacts: Occasional green blocks; ghosts of the second-next frame before scene changes
__

P.S.: Had a wrong speed for 0.3.2 due to surprising technical issues.

BTW:

Parameter Az: Sets the temporal radius. At the moment only 1 and 2 are supported. (default = 0)

Strictly, this is nonsense, somehow... ;)

x265
25th April 2013, 07:45
When is it useful to use a spatial denoiser instead of a temporal denoiser?

olcifaraga
17th September 2013, 14:59
I can't use the plugin.

Specs;
Win8x64
Nvidia GT750M with latest driver. (Nvidia Optimus)
NLMeansCL 0.3.2
Cloo 0.9.2
AvsFilterNet r62998 (.NET 4)

Error Message
NLMeansCL initialization error: System.Reflection.TargetInvocationException: ... ---> Cloo.InvalidCommandQueueFlagsComputeException: OpenCL error code detected: InvalidCommandQueueFlags.
konum: Cloo.ComputeException.ThrowOnError(ComputeErrorCode errorCode)
konum: Cloo.ComputeCommandQueue..ctor(ComputeContext context, ComputeDevice device, ComputeCommandQueueFlags properties)
konum: NLMeansCL.NLMeansCL.initOpenCL(ScriptEnvironment env)
konum: NLMeansCL.NLMeansCL..ctor(AVSValue args, ScriptEnvironment env)
--- İç özel durum yığını izlemesinin sonu ---
konum: System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
konum: System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
konum: System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, StackCrawlMark& stackMark)
konum: System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes)
konum: System.Activator.CreateInstance(Type type, Object[] args)
konum: CreateNetPluginImpl(AVSValue* , AVSValue* args, Void* user_data, IScriptEnvironment* env)

I tried older versions of Cloo but not worked. I put the GPU Caps Viewer log report at attachments.

Found a solution:
In SysWow64 folder, rename the "IntelOpenCL32.dll" file to something else.
Now able to use plugin.

l33tmeatwad
9th June 2014, 00:00
Not sure what I'm missing here, but I can't get it to autoload and when I try to manually load I get "Unable to load plugin, make sure it is a valid .Net assembly"...

LigH
9th June 2014, 00:16
In general (may or may not be important here): Have your 7-zip up to date if you have to unpack a *.7z; an older 7-zip (up to ~9.20) may unpack an archive made with a newer 7-zip (from ~9.22) incorrectly without complaining.

Read the instructions in the starting post of this thread carefully. There is a specific combination of Cloo and AvsFilterNet matching a specific version of NLMeansCL. Don't mix different versions in the same directory. Don't unpack into the AviSynth 2.5+ plugins folder if it isn't expected there, prefer own (sub-) directories instead where possible.

l33tmeatwad
9th June 2014, 02:33
In general (may or may not be important here): Have your 7-zip up to date if you have to unpack a *.7z; an older 7-zip (up to ~9.20) may unpack an archive made with a newer 7-zip (from ~9.22) incorrectly without complaining.

Read the instructions in the starting post of this thread carefully. There is a specific combination of Cloo and AvsFilterNet matching a specific version of NLMeansCL. Don't mix different versions in the same directory. Don't unpack into the AviSynth 2.5+ plugins folder if it isn't expected there, prefer own (sub-) directories instead where possible.
Well I got version 4 alpha loading (although I was never able to get version 3.2 to work...). That said...now I'm getting "Error reading source frame 0: Avisynth read error: NLMeansCL: Cloo.InvalidHostPointerComputeException: OpenCL error code detected: Invalid HostPointer. at Cloo.ComputerException.ThrowOnError(ComputeErrorCode errorCode)..."

LigH
9th June 2014, 08:28
Well, that sounds like you don't have compatible OpenCL drivers for your graphic card installed. Reporting your exact graphic chipset and driver version may tell us if your graphic hardware is at all suitable to use NLMeansCL.

Keiyakusha
9th June 2014, 23:00
Hey guys, its being a long time since I played with this plugin. But since I see a lot of people are still trying it, I thought I'll post a few things I do remember.
- v0.4.0 alpha should not be used. It is broken and sometimes produces incorrect results. Also regardless of what the version number says v0.3.2 is actually newer. 0.4.0 is a kind of experimental branch of the earlier version.
- v0.3.2 (as well as other versions) require additional dlls and their versions are very important. They shouldn't be even a single revision higher or lower. If you managed to load 0.4.0, then there is a high chance that additional dlls you use are not good for 0.3.2 and need to be updated. in other words, v0.3.2 and v0.4.0 wont work with the same set of additional dlls.

Also these plugins require different .NET framework versions. This may be important too.

Still it looks to me that l33tmeatwad's problem might be related to something else.

HOB
15th August 2014, 22:14
Can NLmeansCL be used in MeGUI?

LigH
16th August 2014, 07:32
MeGUI is only a user interface generating an AviSynth script and calling an encoder with it. It allows you to manually add plugins it does not yet offer on its own. So: Yes, you can. Just probably not with "one click only".

HOB
16th August 2014, 16:50
Hello LigH
Your quick response is most appreciated along with being encouraging.

Before I posted I had copied the NLMeansCL_netaoutoload.dll to the same folder I have copied other .dll plugins, in my case…Desktop\Desktop Folders and Files\MeGUI_2507_x86 BU\tools\avisynth_plugin. When the time came to load the .dll in "AviSynth script creator" in MeGUI the procedure seemed to proceed in proper fashion but when I added arguments to the MeGUI avs script and clicked the "Preview AVS Script" button I got the following error message.

AviSynth script error:
'C:/Users/XXXX/Desktop/MeGUI_2507_86/tools/avisynth_plugin/NLMeansCL_netautoload.dll' cannot be used as a plugin for AviSynth

It seems to me the failure to run may have something to do with the netautoload phrase in the NLMeansCL_netautoload.dll, it looks as if this kind of .dll loads in a different way than say the autoadjust.dll from LaTo, and if that's the case I'm a bit lost on how to go about loading this .dll correctly to get it to run in MeGUI.

I read a post from Mounir which suggested adding more .dll's to get NLMeansCL to run so I added those to my plugin folder and added "AvsFilterNet.dll" to my MeGUI avs script, that got me PAST the error message above - PROGRESS! - but when I tried to encode the movie MeGUI changed the pointer icon to a circle, indicating it was working, but it STAYED that way as if it was in a loop, after ten minutes of waiting I had to shut down MeGUI through Task Manager. Any ideas you could suggest that might get NLMeansCL working in MeGUI would be as appreciated as your quick response…

The latest VidCoder v1.5.24.0 Beta (x64) has a version of NLMeansCL incorporated in to it and I've used it on some very old black and white movies I have on DVD that are more noise than movie, the results were very impressive and as a consequence I'd like to be able to use this filter in MeGUI which of course allows endless manipulations over and above those available in VidCoder, which I think is a MOST excellent program for encoding movies that do not require "adjustment".

HOB
20th August 2014, 01:45
To borrow a phrase from Dr Hans Zarkov…I did some "exhaustive experimentations" with NLMeansCL in MeGUI…and they paid off - I was able to get NLMeansCL to work, after a fashion. It would be an understatement to say they don't work well together.

Khanattila
19th November 2014, 17:54
Continuation of this project: http://forum.doom9.org/showthread.php?t=171379.

Mounir
28th January 2021, 13:45
All links to download the DLL are now DEAD; where can i get NLMeans i need it for old scripts i use

Groucho2004
28th January 2021, 16:47
All links to download the DLL are now DEAD; where can i get NLMeans i need it for old scripts i use
Any reason you can't use KNLMeansCL? It's still being supported and probably more flexible and better than that old version.
What version of Avisynth and what graphics card are you using ?

Selur
31st January 2021, 11:42
All links to download the DLL are now DEAD; where can i get NLMeans i need it for old scripts i use
got a 32bit NLMeansCL2.dll I use in Hybird, uploaded to my GoogleDrive (https://drive.google.com/drive/folders/1ZWVbj8hFP0eyX6dW2z2xexwwj1inEKl0?usp=sharing)

Cu Selur