Log in

View Full Version : KNLMeansCL: OpenCL NLMeans de-noising algorithm [2018-01-29]


Pages : 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 [19] 20 21 22 23 24 25 26 27 28 29 30 31 32

Groucho2004
20th September 2016, 13:46
OK. What had you in mind ? We know it fails at the KNLMeansCL line, thus inside KNLMeansCL, would you reckon that avisynth+ and AVSMeter show some more ?

AVSMeter has pretty advanced error reporting so it won't hurt giving it a go. Install Avisynth or Avisynth+ and run a simple script containing a call to KNLMeansCL() with AVSMeter. Report what happens.

Khanattila
20th September 2016, 17:23
http://www.guru3d.com/news-story/amd-vega-10-vega-20-and-vega-11-gpus-mentioned-by-cto.html
> It will offer up to 24 TFLOP/s 16-bit (half-precision) floating point performance. You read it right, half-precision.

Who will have an RX 490 will be a lucky guy.

Magik Mark
23rd September 2016, 03:57
Khanattila

What's a good setting for TWD? Its kinda grainy

Atak_Snajpera
23rd September 2016, 10:41
http://www.guru3d.com/news-story/amd-vega-10-vega-20-and-vega-11-gpus-mentioned-by-cto.html
> It will offer up to 24 TFLOP/s 16-bit (half-precision) floating point performance. You read it right, half-precision.

Who will have an RX 490 will be a lucky guy.

is fp16 enough for knlmeans?

Khanattila
26th September 2016, 15:16
is fp16 enough for knlmeans?

Yes of course, but it requires a dedicated programming.

Khanattila
26th September 2016, 15:17
Khanattila

What's a good setting for TWD? Its kinda grainy

I do not know specifically, but if the film effect is very strong, you can use wmode=2, d>=2, a>=3 and h>=10.

hydra3333
3rd October 2016, 08:03
AVSMeter has pretty advanced error reporting so it won't hurt giving it a go. Install Avisynth or Avisynth+ and run a simple script containing a call to KNLMeansCL() with AVSMeter. Report what happens.
Well, that was exciting.

I found an old x64 Win10Home PC with an Nividia 8600 gpu, to run it on ... making a third PC it's been tried on with vapoursynth.
So I downloaded "Avisynth version switcher" and "avsmeter" and whatnot from Groucho's Avisynth stuff http://forum.doom9.org/showthread.php?t=173259.
Then downloaded and used knlmeanscl legacy version 0.6.11 since the nvidia 8600 is only openCL v1.1 but at least its a valid comparison attempt.
Also copied across by vapoursynth x64 (portable) folders and replaced knlmeanscl with legacy version 0.6.11 so comparisons were "equal".
Using "Avisynth version switcher", installed the x64 version of avisynth+ and copied plugins to the correct auto-load folder.
Then installed Virtualdub x64 as another means to open the .avs script just for fun.

So, using Virtualdub x64, then opened and successfully played this frame-based script which had 100 frames :
DirectShowSource("C:\TEMP\AvisynthRepository\AVSPLUS_x64\xx\test.mpg", fps=25)
#AssumeTFF()
AssumeFrameBased()
TRIM(2000,-100)
ConvertToYV12(interlaced=False)
#SeparateFields()
KNLMeansCL(last,device_type="gpu",Info=True)
#Weave()
#AssumeTFF()
https://drive.google.com/open?id=0B5RV2aJ2vdhSZ2NVZ1gzamM3YzQ
Good-oh, it works I thought. Then I tried to play this field-based script
DirectShowSource("C:\TEMP\AvisynthRepository\AVSPLUS_x64\xx\test.mpg", fps=25)
AssumeTFF()
#AssumeFrameBased()
TRIM(2000,-100)
ConvertToYV12(interlaced=True)
SeparateFields()
KNLMeansCL(last,device_type="gpu",Info=True)
Weave()
AssumeTFF()
... unsuccessfully ... whereupon it got to frame 67 and then spat a vdub error dialogbox saying "Avisynth read error KNLMeansCL AnisynthGetFrame Error!".
Hmm, closed vdub and opened the framebased script and it played OK.
Closed that and re-opened the field based script and played that ... and this time it got to frame 23 before spitting with the same error. Tried again and it completed OK. Then tried again a few times and it crashed on a random frame number.
Tried the framebased script and it started to yield the same symptoms - crashing on a random frame number.

Anyway, knlmeanscl did something in avisynth+ x64.

Tried this vapoursynth script
import vapoursynth as vs
import havsfuncTS as haf # this version uses vanilla TemporalSoften instead of TemporalSoften2, as it will be "better" over time
import mvsfunc as mvs # http://forum.doom9.org/showthread.php?t=172564
import finesharp as finesharp # http://forum.doom9.org/showthread.php?p=1777815#post1777815 http://avisynth.nl/index.php/FineSharp
import Plum # http://forum.doom9.org/showthread.php?t=173775 https://github.com/IFeelBloated/Plum
import Vine # http://forum.doom9.org/showthread.php?t=173703 https://github.com/IFeelBloated/Vine
import Oyster # http://forum.doom9.org/showthread.php?t=173470 https://github.com/IFeelBloated/Oyster
import mvmulti # http://forum.doom9.org/showthread.php?p=1777891#post1777891
core = vs.get_core(accept_lowercase=True) # leave off threads=8 so it auto-detects threads
core.std.LoadPlugin(r'C:\SOFTWARE\Vapoursynth-x64\vapoursynth64\plugins\dll-to-choose-from\d2vsource.dll') # the r'' indicates do not treat special characters and accept backslashes
core.std.LoadPlugin(r'C:\SOFTWARE\Vapoursynth-x64\vapoursynth64\plugins\dll-to-choose-from\KNLMeansCL.dll') # the r'' indicates do not treat special characters and accept backslashes
def main():
video = core.d2v.Source(r'C:\TEMP\AvisynthRepository\AVSPLUS_x64\xx\test.d2v')
video = core.std.Trim(video,first=2000,length=100)
video = core.std.SeparateFields(video, tff=True)
video = core.knlm.KNLMeansCL(video,device_type="cpu",info=True)
video = haf.Weave(video, tff=True)
video = mvs.AssumeTFF(video)
video.set_output()
return True
main()


but it always crashes vspipe and vsedit.
In vsedit, doesn't matter if it's "check script" or "preview", it still crashes immediately.

At one point (when using vdub) it did create a logfile, thus:
---------------------------------
*** Error in OpenCL compiler ***
---------------------------------

# Build Options

Tried to run avsmeter64.exe (2.4.2) and this is all I got ...
C:\TEMP\AvisynthRepository\AVSPLUS_x64\xx>"C:\TEMP\extract\AVSMeter242\AVSMeter64.exe" -info -avsinfo -gpu test-frame.avs

AVSMeter 2.4.2 (x64) - Copyright (c) 2012-2016, Groucho2004

VersionString: AviSynth+ 0.1 (r2172, MT, x86_64)
VersionNumber: 2.60
File version: 0.1.0.0
Interface Version: 6
Multi-threading support: Yes
Linker/compiler version: 14.0
Avisynth.dll location: C:\Windows\System32\AviSynth.dll
Avisynth.dll time stamp: 2016-08-20, 00:22:08
PluginDir2_5 (HKLM, x64): C:\TEMP\AvisynthRepository\\AVSPLUS_x64\plugins


[CPP 2.6 plugins]
C:\TEMP\AvisynthRepository\\AVSPLUS_x64\plugins\ConvertStacked.dll [n/a]
C:\TEMP\AvisynthRepository\\AVSPLUS_x64\plugins\DirectShowSource.dll [n/a]
C:\TEMP\AvisynthRepository\\AVSPLUS_x64\plugins\ImageSeq.dll [n/a]
C:\TEMP\AvisynthRepository\\AVSPLUS_x64\plugins\KNLMeansCL.dll [n/a]
C:\TEMP\AvisynthRepository\\AVSPLUS_x64\plugins\Shibatch.dll [n/a]
C:\TEMP\AvisynthRepository\\AVSPLUS_x64\plugins\TimeStretch.dll [n/a]
C:\TEMP\AvisynthRepository\\AVSPLUS_x64\plugins\VDubFilter.dll [n/a]

C:\TEMP\AvisynthRepository\AVSPLUS_x64\xx>pause
Press any key to continue . . .

edit: Oh, when I remove switches -info -avsinfo I get this:
C:\TEMP\AvisynthRepository\AVSPLUS_x64\xx>"C:\TEMP\extract\AVSMeter242\AVSMeter64.exe" test-frame.avs -gpu

AVSMeter 2.4.2 (x64) - Copyright (c) 2012-2016, Groucho2004
AviSynth+ 0.1 (r2172, MT, x86_64) (0.1.0.0)

Number of frames: 100
Length (hh:mm:ss.ms): 00:00:04.000
Frame width: 720
Frame height: 576
Framerate: 25.000 (25/1)
Colorspace: YV12

Frame (current | last): 41 | 99
FPS (cur | min | max | avg): 12.53 | 7.865 | 12.85 | 11.86
Memory usage (phys | virt): 67 | 89 MiB
Thread count: 27
CPU usage (current | average): 25% | 25%

GPU core clock | memory clock: 576 | 400
GPU usage (current | average): 92% | 67%
VPU usage (current | average): 0% | 0%
GPU memory usage: 176 MiB

Time (elapsed | estimated): 00:00:03.542 | 00:00:08.433

KNLMeansCL: AviSynthGetFrame error!

C:\TEMP\AvisynthRepository\AVSPLUS_x64\xx>pause
Press any key to continue . . .


Finally, I commented out the knlmeanscl line in every avs and vpy script and tried them all again ... and then they work flawlessly.

Suggestions welcomed.

pinterf
3rd October 2016, 09:31
Previously I had "KNLMeans Fatal error (AvisynthGetFrame)" with avs+ and 0.7.6 but the error disappeared in 0.7.7. Earlier I spent some days with debugging avs+ because I was not sure that it was a hidden bug in avs+ core or a side-effect a buggy filter in SMDegrain (did not want spam here with false alarms), but luckily the new 0.7.7 version solved my problem. Your older version may present this pre-0.7.7 behaviour.

lsmashvideosource("test.mp4", format="YUV420P8")

NL_in = Dither_convert_8_to_16()
U8 = UToY8(NL_in)
V8 = VToY8(NL_in)
Y8 = ConvertToY8(NL_in)
U16 = U8.KNLMeansCL(D=1, A=1, h=7.0,lsb_inout=true,device_type="GPU")
V16 = V8.KNLMeansCL(D=1, A=1, h=7.0,lsb_inout=true,device_type="GPU")
Y16 = ConvertToY8(NL_in).KNLMeansCL(D=1, A=1, h=7.0,lsb_inout=true,device_type="GPU")
prefilter4 = YToUV(u16,v16,Y16)
SMDegrain (tr=4,PreFilter=prefilter4,TV_range=false,thSAD=400,contrasharp=false,refinemotion=false,plane=4,chroma=true,lsb=true,mode=6)

hydra3333
3rd October 2016, 10:47
Your older version may present this pre-0.7.7 behaviour.
Seems likely. Unfortunately on my old test rig it's only an nvidia 8600 which means I'm stuck with the old plugin version on it.
I suppose I'll have to see what I can do with another PC.

Groucho2004
3rd October 2016, 16:23
Tried to run avsmeter64.exe (2.4.2) and this is all I got ...
C:\TEMP\AvisynthRepository\AVSPLUS_x64\xx>"C:\TEMP\extract\AVSMeter242\AVSMeter64.exe" -info -avsinfo -gpu test-frame.avs
"-info" and "-avsinfo" are mutually exclusive. Specifying a script file together with "-avsinfo" makes no sense. I guess I have to add command line sanity checks for pointless switch combinations in AVSMeter. :D

Motenai Yoda
3rd October 2016, 20:40
@Khanattila is possible to port this nlmeans denoise algorithm to audio stuff too?

hydra3333
4th October 2016, 13:17
"-info" and "-avsinfo" are mutually exclusive. Specifying a script file together with "-avsinfo" makes no sense. I guess I have to add command line sanity checks for pointless switch combinations in AVSMeter. :D

That's what happens with most users - fiddle then fiddle more, then ask someone else since rtfm is not on anyone's to-do list :)

yup
4th October 2016, 16:07
Hi all!

After Windows update to Version 1607 and Geforce Expirience (current version driver 372.90) KNLMeansCL do not work (nnedi3ocl also).
I think problem with system dll.
Please advice.
yup.

Khanattila
4th October 2016, 16:53
@Khanattila is possible to port this nlmeans denoise algorithm to audio stuff too?

O.o

It's a problem that you have to ask a mathematician.
But I highly doubt it.

Khanattila
4th October 2016, 16:55
Hi all!

After Windows update to Version 1607 and Geforce Expirience (current version driver 372.90) KNLMeansCL do not work (nnedi3ocl also).
I think problem with system dll.
Please advice.
yup.

Check your opencl.dll version.

Khanattila
4th October 2016, 16:59
Well, that was exciting.

I found an old x64 Win10Home PC with an Nividia 8600 gpu, to run it on ... making a third PC it's been tried on with vapoursynth.
So I downloaded "Avisynth version switcher" and "avsmeter" and whatnot from Groucho's Avisynth stuff http://forum.doom9.org/showthread.php?t=173259.
Then downloaded and used knlmeanscl legacy version 0.6.11 since the nvidia 8600 is only openCL v1.1 but at least its a valid comparison attempt.
Also copied across by vapoursynth x64 (portable) folders and replaced knlmeanscl with legacy version 0.6.11 so comparisons were "equal".
Using "Avisynth version switcher", installed the x64 version of avisynth+ and copied plugins to the correct auto-load folder.
Then installed Virtualdub x64 as another means to open the .avs script just for fun.

So, using Virtualdub x64, then opened and successfully played this frame-based script which had 100 frames :
DirectShowSource("C:\TEMP\AvisynthRepository\AVSPLUS_x64\xx\test.mpg", fps=25)
#AssumeTFF()
AssumeFrameBased()
TRIM(2000,-100)
ConvertToYV12(interlaced=False)
#SeparateFields()
KNLMeansCL(last,device_type="gpu",Info=True)
#Weave()
#AssumeTFF()
https://drive.google.com/open?id=0B5RV2aJ2vdhSZ2NVZ1gzamM3YzQ
Good-oh, it works I thought. Then I tried to play this field-based script
DirectShowSource("C:\TEMP\AvisynthRepository\AVSPLUS_x64\xx\test.mpg", fps=25)
AssumeTFF()
#AssumeFrameBased()
TRIM(2000,-100)
ConvertToYV12(interlaced=True)
SeparateFields()
KNLMeansCL(last,device_type="gpu",Info=True)
Weave()
AssumeTFF()
... unsuccessfully ... whereupon it got to frame 67 and then spat a vdub error dialogbox saying "Avisynth read error KNLMeansCL AnisynthGetFrame Error!".
Hmm, closed vdub and opened the framebased script and it played OK.
Closed that and re-opened the field based script and played that ... and this time it got to frame 23 before spitting with the same error. Tried again and it completed OK. Then tried again a few times and it crashed on a random frame number.
Tried the framebased script and it started to yield the same symptoms - crashing on a random frame number.

Anyway, knlmeanscl did something in avisynth+ x64.

Tried this vapoursynth script
import vapoursynth as vs
import havsfuncTS as haf # this version uses vanilla TemporalSoften instead of TemporalSoften2, as it will be "better" over time
import mvsfunc as mvs # http://forum.doom9.org/showthread.php?t=172564
import finesharp as finesharp # http://forum.doom9.org/showthread.php?p=1777815#post1777815 http://avisynth.nl/index.php/FineSharp
import Plum # http://forum.doom9.org/showthread.php?t=173775 https://github.com/IFeelBloated/Plum
import Vine # http://forum.doom9.org/showthread.php?t=173703 https://github.com/IFeelBloated/Vine
import Oyster # http://forum.doom9.org/showthread.php?t=173470 https://github.com/IFeelBloated/Oyster
import mvmulti # http://forum.doom9.org/showthread.php?p=1777891#post1777891
core = vs.get_core(accept_lowercase=True) # leave off threads=8 so it auto-detects threads
core.std.LoadPlugin(r'C:\SOFTWARE\Vapoursynth-x64\vapoursynth64\plugins\dll-to-choose-from\d2vsource.dll') # the r'' indicates do not treat special characters and accept backslashes
core.std.LoadPlugin(r'C:\SOFTWARE\Vapoursynth-x64\vapoursynth64\plugins\dll-to-choose-from\KNLMeansCL.dll') # the r'' indicates do not treat special characters and accept backslashes
def main():
video = core.d2v.Source(r'C:\TEMP\AvisynthRepository\AVSPLUS_x64\xx\test.d2v')
video = core.std.Trim(video,first=2000,length=100)
video = core.std.SeparateFields(video, tff=True)
video = core.knlm.KNLMeansCL(video,device_type="cpu",info=True)
video = haf.Weave(video, tff=True)
video = mvs.AssumeTFF(video)
video.set_output()
return True
main()


but it always crashes vspipe and vsedit.
In vsedit, doesn't matter if it's "check script" or "preview", it still crashes immediately.

At one point (when using vdub) it did create a logfile, thus:
---------------------------------
*** Error in OpenCL compiler ***
---------------------------------

# Build Options

Tried to run avsmeter64.exe (2.4.2) and this is all I got ...
C:\TEMP\AvisynthRepository\AVSPLUS_x64\xx>"C:\TEMP\extract\AVSMeter242\AVSMeter64.exe" -info -avsinfo -gpu test-frame.avs

AVSMeter 2.4.2 (x64) - Copyright (c) 2012-2016, Groucho2004

VersionString: AviSynth+ 0.1 (r2172, MT, x86_64)
VersionNumber: 2.60
File version: 0.1.0.0
Interface Version: 6
Multi-threading support: Yes
Linker/compiler version: 14.0
Avisynth.dll location: C:\Windows\System32\AviSynth.dll
Avisynth.dll time stamp: 2016-08-20, 00:22:08
PluginDir2_5 (HKLM, x64): C:\TEMP\AvisynthRepository\\AVSPLUS_x64\plugins


[CPP 2.6 plugins]
C:\TEMP\AvisynthRepository\\AVSPLUS_x64\plugins\ConvertStacked.dll [n/a]
C:\TEMP\AvisynthRepository\\AVSPLUS_x64\plugins\DirectShowSource.dll [n/a]
C:\TEMP\AvisynthRepository\\AVSPLUS_x64\plugins\ImageSeq.dll [n/a]
C:\TEMP\AvisynthRepository\\AVSPLUS_x64\plugins\KNLMeansCL.dll [n/a]
C:\TEMP\AvisynthRepository\\AVSPLUS_x64\plugins\Shibatch.dll [n/a]
C:\TEMP\AvisynthRepository\\AVSPLUS_x64\plugins\TimeStretch.dll [n/a]
C:\TEMP\AvisynthRepository\\AVSPLUS_x64\plugins\VDubFilter.dll [n/a]

C:\TEMP\AvisynthRepository\AVSPLUS_x64\xx>pause
Press any key to continue . . .

edit: Oh, when I remove switches -info -avsinfo I get this:
C:\TEMP\AvisynthRepository\AVSPLUS_x64\xx>"C:\TEMP\extract\AVSMeter242\AVSMeter64.exe" test-frame.avs -gpu

AVSMeter 2.4.2 (x64) - Copyright (c) 2012-2016, Groucho2004
AviSynth+ 0.1 (r2172, MT, x86_64) (0.1.0.0)

Number of frames: 100
Length (hh:mm:ss.ms): 00:00:04.000
Frame width: 720
Frame height: 576
Framerate: 25.000 (25/1)
Colorspace: YV12

Frame (current | last): 41 | 99
FPS (cur | min | max | avg): 12.53 | 7.865 | 12.85 | 11.86
Memory usage (phys | virt): 67 | 89 MiB
Thread count: 27
CPU usage (current | average): 25% | 25%

GPU core clock | memory clock: 576 | 400
GPU usage (current | average): 92% | 67%
VPU usage (current | average): 0% | 0%
GPU memory usage: 176 MiB

Time (elapsed | estimated): 00:00:03.542 | 00:00:08.433

KNLMeansCL: AviSynthGetFrame error!

C:\TEMP\AvisynthRepository\AVSPLUS_x64\xx>pause
Press any key to continue . . .


Finally, I commented out the knlmeanscl line in every avs and vpy script and tried them all again ... and then they work flawlessly.

Suggestions welcomed.

I think you've found a possible bug on KNLMeansCL.
"ConvertToYV12(interlaced=True)" + "SeparateFields()" fuck the plugin.

EDIT. But the problem is really hard to find.

yup
4th October 2016, 17:16
Khanattila!
GPU Caps viewer do not show OpenCL on my GPU 1: NVIDIA GeForce GTX 960.
I think problem related with last update Geforce Expirience 3.06.48.
I am download only driver and reinstall (back to Geforce Expirience 2) an now all work.
yup.

Motenai Yoda
4th October 2016, 18:02
O.o

It's a problem that you have to ask a mathematician.
But I highly doubt it.

coz I found those links that suggest it can works
ftp://ftp.math.ucla.edu/pub/camreport/cam08-56.pdf
https://it.mathworks.com/matlabcentral/fileexchange/27395-fast-non-local-means-1d--2d-color-and-3d?requestedDomain=www.mathworks.com
https://github.com/s-k/nlmeans

feisty2
5th October 2016, 00:53
coz I found those links that suggest it can works
ftp://ftp.math.ucla.edu/pub/camreport/cam08-56.pdf
https://it.mathworks.com/matlabcentral/fileexchange/27395-fast-non-local-means-1d--2d-color-and-3d?requestedDomain=www.mathworks.com
https://github.com/s-k/nlmeans

Taking the neighborhood of certain sampling point to approximate the features and status of the local signal is a universal concept, and that's also how mathematical limit works, so yeah, nlmeans for audio is possible theoretically
Edit: typo

Khanattila
5th October 2016, 11:13
coz I found those links that suggest it can works
ftp://ftp.math.ucla.edu/pub/camreport/cam08-56.pdf
https://it.mathworks.com/matlabcentral/fileexchange/27395-fast-non-local-means-1d--2d-color-and-3d?requestedDomain=www.mathworks.com
https://github.com/s-k/nlmeans

I doubt that will give the desired results. However in the future I might work on it.

Khanattila
11th November 2016, 19:23
I finally bought an RX 480. Exciting times ahead :D:D:D:D

Groucho2004
11th November 2016, 21:28
I finally bought an RX 480. Exciting times ahead :D:D:D:D
Nice. Don't forget to post your results here (http://forum.doom9.org/showthread.php?t=173603).

Khanattila
16th November 2016, 18:55
Nice. Don't forget to post your results here (http://forum.doom9.org/showthread.php?t=173603).

I have work to do...

v0.7.7

[Runtime info]
Frames processed: 560 (0 - 559)
FPS (min | max | average): 8.539 | 12.78 | 9.298
Memory usage (phys | virt): 101 | 86 MiB
Thread count: 5
CPU usage (average): 13%

GPU core clock | memory clock: 1327 | 2000
GPU usage (average): 51%
GPU memory usage (Dedicated): 503 MiB
GPU memory usage (Dynamic): 72 MiB


v0.8.0-a1

[Runtime info]
Frames processed: 860 (0 - 859)
FPS (min | max | average): 13.34 | 15.47 | 14.24
Memory usage (phys | virt): 100 | 85 MiB
Thread count: 6
CPU usage (average): 3%

GPU core clock | memory clock: 1330 | 2000
GPU usage (average): 86%
GPU memory usage (Dedicated): 548 MiB
GPU memory usage (Dynamic): 89 MiB

Atak_Snajpera
17th November 2016, 16:20
Khanattila
What happens if you run two instances of benchmark? Does it increase combined FPS on your RX480?
BTW. You have a nice beast there (6,1 TFLOPS!). With right GPU usage you should beat 1060 easily.

Khanattila
17th November 2016, 17:00
Khanattila
What happens if you run two instances of benchmark? Does it increase combined FPS on your RX480?
BTW. You have a nice beast there (6,1 TFLOPS!). With right GPU usage you should beat 1060 easily.

No, the FPS are the same. Result I expected anyway.

Take 1920x1088 picture size, 2088960 pixels.
Each pixels is a work-item, so there are 2088960 work-item.
256 work-item are 1 work-group, so 2088960 work-item are 8160 work-group.
A work-group executes on a single compute unit, RX 480 has 36 compute unite.
So each compute unit has more than 200 work-group to execute :)

Rather I could try to reduce them.

Atak_Snajpera
17th November 2016, 17:57
What did you do that GPU usage went up in v0.8.0 ?

Khanattila
17th November 2016, 18:22
What did you do that GPU usage went up in v0.8.0 ?

Mainly two things:
1) command queue moved to class variables, Avisynth MT users... If it does not work for you it is not my problem.
2) optimized the use of the GPU cache and removed some blocking read and write.

Khanattila
17th November 2016, 19:05
I'm using AMD CodeXL, little left to do.

v0.8.0-a2

[Runtime info]
Frames processed: 880 (0 - 879)
FPS (min | max | average): 13.74 | 15.73 | 14.65
Memory usage (phys | virt): 100 | 86 MiB
Thread count: 6
CPU usage (average): 3%

GPU core clock | memory clock: 1330 | 2000
GPU usage (average): 87%
GPU memory usage (Dedicated): 547 MiB
GPU memory usage (Dynamic): 71 MiB

Khanattila
20th November 2016, 20:46
This improvement (+5.5%) depends on the architecture of the GPU, however, it seems to work well. If you want to try it, there are the script and the plugin.

v0.8.0-a3
[Runtime info]
Frames processed: 930 (0 - 929)
FPS (min | max | average): 14.46 | 17.98 | 15.46
Memory usage (phys | virt): 100 | 86 MiB
Thread count: 6
CPU usage (average): 3%

GPU core clock | memory clock: 1329 | 2000
GPU usage (average): 86%
GPU memory usage (Dedicated): 559 MiB
GPU memory usage (Dynamic): 75 MiB

Script
colorbars(width = 1920, height = 1080, pixel_type = "yv12").killaudio().assumefps(25, 1)
KNLMeansCL(d = 2, a = 2)

Run the script with the following command:
"avsmeter testknlm.avs -timelimit=60 -log"
- or, if you're using a 64 bit chain -
"avsmeter64 testknlm.avs -timelimit=60 -log"


Link removed.

Groucho2004
20th November 2016, 21:57
If you want to try it, there are the script and the plugin.
The attachment is still not approved. Can you upload it somewhere else?

Khanattila
20th November 2016, 22:13
The attachment is still not approved. Can you upload it somewhere else?

Done.

tormento
20th November 2016, 22:33
[QUOTE=Khanattila;1786612KNLMeansCL-v0.8.0-a3.zip (http://www.mediafire.com/file/jphoh7pcp65uemh/KNLMeansCL-v0.8.0-a3.zip)[/QUOTE]

Simple x264 Launcher (Build #1060), built 2016-10-21

Job started at 2016-11-20, 22:33:00.

Source file : E:\in\1_42 drago invisibile, Il\drago_44.avs
Output file : E:\in\1_42 drago invisibile, Il\drago_44.mkv

--- SYSTEMINFO ---

Binary Path : D:\eseguibili\media\x264 launcher
Avisynth : Yes
VapourSynth : No

--- SETTINGS ---

Encoder : x264 (AVC/H.264), 64-Bit (x64), 8-Bit
Source : Avisynth (avs)
RC Mode : CRF
Preset : slow
Tuning : <None>
Profile : High
Custom : --level 4.1 --keyint 240 --vbv-bufsize 78125 --vbv-maxrate 62500 --aq-mode 2 --sar 1:1

--- CHECK VERSION ---

Detect video encoder version:

Creating process:
"D:\eseguibili\media\x264 launcher\toolset\x64\x264_8bit_x64.exe" --version

x264 0.148.2721kMod 72d53ab
(libswscale 4.1.100)
(libavformat 57.50.100)
(ffmpegsource 2.22.1.0)
built by Komisar on Sep 23 2016, gcc: 4.9.2 (multilib.generic.Komisar)
x264 configuration: --bit-depth=8 --chroma-format=all
libx264 configuration: --bit-depth=8 --chroma-format=all
x264 license: GPL version 2 or later
libswscale/libavformat/ffmpegsource license: GPL version 2 or later

Detect video source version:

Creating process:
"D:\eseguibili\media\x264 launcher\toolset\x64\avs2yuv_x64.exe"

Avs2YUV 0.24bm3

> x264 revision: 2721 (core #148) - with custom patches!
> Avs2YUV version: 0.24.3

--- GET SOURCE INFO ---

Creating process:
"D:\eseguibili\media\x264 launcher\toolset\x64\avs2yuv_x64.exe" -frames 1 "E:\in\1_42 drago invisibile, Il\drago_44.avs" NUL

error: Script error: KNLMeansCL does not have a named argument "cmode"
(D:/Programmi/media/AviSynth+/plugins64/SMDegrain-2016_1114�realfinder.avsi, line 743)
(D:/Programmi/media/AviSynth+/plugins64/SMDegrain-2016_1114�realfinder.avsi, line 172)
(E:\in\1_42 drago invisibile, Il\drago_44.avs, line 19)

PROCESS EXITED WITH ERROR CODE: 1

Khanattila
20th November 2016, 22:36
Because I replaced 'cmode' with 'channels'.
Channels = { y, uv, yuv, rgb }

tormento
20th November 2016, 22:37
Because I replaced 'cmode' with 'channels'.
Channels = { y, uv, yuv, rgb }

simple search and replace in script?

Khanattila
20th November 2016, 22:41
simple search and replace in script?

This version is only for testing, you should not use it for other things.

Reel.Deel
20th November 2016, 22:42
@Khanattila

Thank you for the continued development on this excellent plugin. Any plans on adding native high bit-depth support for AVS+?

Groucho2004
20th November 2016, 22:42
Done.Thanks!

Groucho2004
20th November 2016, 22:48
Hm, this version is a bit slower (~2%) than 0.7.7 on my GTX750.

Khanattila
20th November 2016, 22:51
Hm, this version is a bit slower (~2%) than 0.7.7 on my GTX750.

The first GPU architectural differences I see.
I will have to begin to check the GPU vendor.

Khanattila
20th November 2016, 23:09
@Khanattila

Thank you for the continued development on this excellent plugin. Any plans on adding native high bit-depth support for AVS+?


Yes, it requires no extra work for me.

Groucho2004
20th November 2016, 23:13
The first GPU architectural differences I see.
I will have to begin to check the GPU vendor.
In case you're interested:

[OS/Hardware info]
Operating system: Windows XP (x86) Service Pack 3 (Build 2600)
CPU (brand string): Intel(R) Core(TM) i5-2500K CPU @ 3.30GHz
CPU (code name): Sandy Bridge (Core i5)
CPU clock (measured): 3952 MHz
CPU cores / Logical cores: 4 / 4
Video card: NVIDIA GeForce GTX 750
GPU name: GM107
NVIDIA VPU version: VP6
Video memory size: 1024
OpenCL version: OpenCL 1.2 CUDA
Graphics driver version: 6.14.13.5012 (ForceWare 350.12) / XP


v0.7.7:
Frames processed: 170 (0 - 169)
FPS (min | max | average): 5.559 | 5.641 | 5.619
Memory usage (phys | virt): 62 | 77 MiB
Thread count: 15
CPU usage (average): 25%

GPU core clock | memory clock: 1215 | 1253
GPU usage (average): 98%
VPU usage (average): 0%
GPU memory usage: 123 MiB

v0.8.0-a3:
Frames processed: 166 (0 - 165)
FPS (min | max | average): 5.441 | 36.12 | 5.530
Memory usage (phys | virt): 62 | 77 MiB
Thread count: 15
CPU usage (average): 25%

GPU core clock | memory clock: 1215 | 1253
GPU usage (average): 97%
VPU usage (average): 0%
GPU memory usage: 174 MiB

Khanattila
20th November 2016, 23:20
In case you're interested:

[OS/Hardware info]
Operating system: Windows XP (x86) Service Pack 3 (Build 2600)
CPU (brand string): Intel(R) Core(TM) i5-2500K CPU @ 3.30GHz
CPU (code name): Sandy Bridge (Core i5)
CPU clock (measured): 3952 MHz
CPU cores / Logical cores: 4 / 4
Video card: NVIDIA GeForce GTX 750
GPU name: GM107
NVIDIA VPU version: VP6
Video memory size: 1024
OpenCL version: OpenCL 1.2 CUDA
Graphics driver version: 6.14.13.5012 (ForceWare 350.12) / XP


v0.7.7:
Frames processed: 170 (0 - 169)
FPS (min | max | average): 5.559 | 5.641 | 5.619
Memory usage (phys | virt): 62 | 77 MiB
Thread count: 15
CPU usage (average): 25%

GPU core clock | memory clock: 1215 | 1253
GPU usage (average): 98%
VPU usage (average): 0%
GPU memory usage: 123 MiB

v0.8.0-a3:
Frames processed: 166 (0 - 165)
FPS (min | max | average): 5.441 | 36.12 | 5.530
Memory usage (phys | virt): 62 | 77 MiB
Thread count: 15
CPU usage (average): 25%

GPU core clock | memory clock: 1215 | 1253
GPU usage (average): 97%
VPU usage (average): 0%
GPU memory usage: 174 MiB



I'm surprised more of the CPU usage.
It would be interesting to see how NVIDIA has implemented some things.

Groucho2004
20th November 2016, 23:26
I'm surprised more of the CPU usage.
It would be interesting to see how NVIDIA has implemented some things.
CPU usage goes down with higher settings (to be expected, I suppose), for example:
colorbars(width = 1920, height = 1080, pixel_type = "yv12").killaudio().assumefps(25, 1)
KNLMeansCL(d = 2, a = 8)

Frames processed: 15 (0 - 14)
FPS (min | max | average): 0.473 | 0.494 | 0.491
Memory usage (phys | virt): 62 | 77 MiB
Thread count: 15
CPU usage (average): 5%

GPU core clock | memory clock: 1215 | 1253
GPU usage (average): 99%
VPU usage (average): 0%
GPU memory usage: 123 MiB

Khanattila
20th November 2016, 23:33
CPU usage goes down with higher settings (to be expected, I suppose), for example:
colorbars(width = 1920, height = 1080, pixel_type = "yv12").killaudio().assumefps(25, 1)
KNLMeansCL(d = 2, a = 8)

Frames processed: 15 (0 - 14)
FPS (min | max | average): 0.473 | 0.494 | 0.491
Memory usage (phys | virt): 62 | 77 MiB
Thread count: 15
CPU usage (average): 5%

GPU core clock | memory clock: 1215 | 1253
GPU usage (average): 99%
VPU usage (average): 0%
GPU memory usage: 123 MiB


The CPU usage is "fake", it does nothing, it is just waiting.

If blocking_read / blocking_write is CL_TRUE [...] does not return until the buffer data has been read and copied into memory.

If blocking_read / blocking_write is CL_FALSE [...] queues a non-blocking read command and returns.

It is possible that Nvidia has not implemented the non-blocking read and write.

tormento
21st November 2016, 08:23
This version is only for testing, you should not use it for other things.



How can we test if we cannot test it in various environments?

Khanattila
21st November 2016, 10:04
How can we test if we cannot test it in various environments?

I shared this version to see if there were performance issues with common testing script.

If you want to do an in-depth testing, just replace cmode=true with channels="YUV".

dipje
21st November 2016, 10:07
Core i7-860 @ 3.3 ghz, GTX1060
Testing / comparing the 0.8-a3 against 0.7.7 with the regular 'benchmark' colorbars / a = 2, d = 2:

0.7.7:
Frames processed: 440 (0 - 439)
FPS (min | max | average): 13.43 | 14.56 | 14.45
Memory usage (phys | virt): 129 | 304 MiB
Thread count: 17
CPU usage (average): 12%
GPU usage (average): 93%
GPU memory usage: 609 MiB

0.8-a3:
Frames processed: 410 (0 - 409)
FPS (min | max | average): 13.31 | 14.72 | 13.53
Memory usage (phys | virt): 137 | 424 MiB
Thread count: 17
CPU usage (average): 12%
GPU usage (average): 94%
GPU memory usage: 664 MiB


Testing with d = 2, a = 5, 0.7.7:
Frames processed: 190 (0 - 189)
FPS (min | max | average): 3.115 | 3.173 | 3.155
Memory usage (phys | virt): 148 | 245 MiB
Thread count: 17
CPU usage (average): 7%
GPU usage (average): 97%
GPU memory usage: 609 MiB

0.8-a3:
Frames processed: 180 (0 - 179)
FPS (min | max | average): 2.922 | 3.332 | 2.948
Memory usage (phys | virt): 117 | 297 MiB
Thread count: 17
CPU usage (average): 7%
GPU usage (average): 97%
GPU memory usage: 660 MiB

6.56% drop with a = 5
6.37% drop with a = 2, seems about the same. Not really that shocking on my system, although clearly repeatable.

Left my laptop at work, so can't test my HD6990m to compare it with AMD stuff.

dipje
21st November 2016, 10:15
NOTE Khanattila: I don't know if this is because it's a test compile, but I tried to bench with Vapoursynth (x64) as well, but the Vapoursynth script seems to cause a crash with the 0.8-a3 DLL! +/- 6% drop I don't really care about, Vapoursynth support is kinda crucial :S :)

Khanattila
21st November 2016, 16:57
Someone who has a nvidia gpu could post this screen? Thank you.

https://s15.postimg.org/y9lvnsw7b/Screenshot_2016_11_21_16_55_52.png (https://postimg.org/image/y9lvnsw7b/)

https://s15.postimg.org/u1r3f1urr/Screenshot_2016_11_21_16_56_14.png (https://postimg.org/image/u1r3f1urr/)

CruNcher
21st November 2016, 17:29
Not the latest Driver though most probably not much updated for Maxwell at least ;)

You should be also careful with memory assumptions here the Driver is doing tricky mangement and swapping on the GTX 970 which can have some latency impact ;)

http://i1.sendpic.org/i/wL/wLwzZLtlVZJ5c7rKWBzDiU0KTvL.png