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


Pages : [1] 2

Khanattila
13th November 2014, 15:39
--> pinterf's fork (https://github.com/pinterf/KNLMeansCL/release)

--> https://github.com/Khanattila/KNLMeansCL/releases/tag/v1.1.1

KNLMeansCL v1.1.1
* Added more check of rclip.
* Fixed build programm error in some circumstances.
* Fixed Avisynth YUV444P10 video format.
* Fixed Vapoursynth RGB30 video format.
* Fixed clip processing with higher resolution than 4K.


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.

For end user KNLMeansCL is a plugin for AviSynth, AviSynth+ and for VapourSynth. Windows, OS X and Linux are supported. Read more on the Wiki (https://github.com/Khanattila/KNLMeansCL/wiki).

KNLMeansCL is available under the GNU GPL v3 license.

FAQ
Q) I can't make DGNV and KNLmeansCL work together in avs script.
A) Post #664 (http://forum.doom9.org/showpost.php?p=1766150&postcount=664).

Groucho2004
13th November 2014, 16:19
Works right out of the box (well, apart from the obligatory MS*120.dlls) unlike the original NLMeansCL which I never got to work properly. Seems very fast as well, even on my lowly GT240 card.

Awesome!

Groucho2004
13th November 2014, 16:31
NLMeansCL(clip src, int A, int Ay, int S, int Sy, int B, int By, float aa, float h, bool sse, string device_type, int y, int u, int v, bool info)
That should read "NLMeansCL2".

Khanattila
13th November 2014, 16:34
That should read "NLMeansCL2".
thanks

Khanattila
15th November 2014, 22:52
Edit.

Reel.Deel
15th November 2014, 23:12
Thanks Khanattila, very nice indeed. Briefly tested it on my GTX780 and it's pretty fast. What source filter did you use for the benchmark? Also, any interest in showing some love to Y8?

Mounir
15th November 2014, 23:14
Still no support of YUY2 ? What about temporal denoising ??

Reel.Deel
15th November 2014, 23:17
Still no support of YUY2?

Use the planar equivalent YV16 instead.

TheFluff
15th November 2014, 23:56
why would you ever want yuy2 support

Khanattila
16th November 2014, 00:20
Thanks Khanattila, very nice indeed. Briefly tested it on my GTX780 and it's pretty fast. What source filter did you use for the benchmark? Also, any interest in showing some love to Y8?

Y8 support? It's easy, I will add in the next release.
For benchmark... I use AVSMeter.
To get a clean result, you should subtract the time of ffms2 & co.

Example:
ffms2 + Dither_convert_8_to_16() -> 326.4 FPS -> 3.0637 ms for frame.
ffms2 + Dither + NLMeansCL2() -> 60.46 FPS -> 16.5399 ms for frame

So NLMeansCL2() take 13.4762 ms for frame -> 74.2 FPS

feisty2
16th November 2014, 03:10
gorgeous
add temporal mode maybe?

Bloax
16th November 2014, 06:03
Testing on an ancient 9800 GT I didn't expect much, but it turns out that it still works! (https://dl.dropboxusercontent.com/u/63152810/Screenies/dumb/DefaultsYV24.png)
Unless you set U=3,V=3 (https://dl.dropboxusercontent.com/u/63152810/Screenies/dumb/DefaultsYV24%2BU3%2BV3.png) or the input isn't YV24 (https://dl.dropboxusercontent.com/u/63152810/Screenies/dumb/DefaultsYV12%2BU3%2BV3.png). (although it works fine with YV12 if the UV channels aren't set to be processed) :v
or if you set the A value too high (a >= 10)

Khanattila
16th November 2014, 12:42
Edit.

Bloax
16th November 2014, 15:19
I can confirm that A >= 10 (output isn't buggy garbage even at a=21) works now, as does chroma processing.

Keiyakusha
16th November 2014, 16:27
Wow, one of my favorite filters reborn without these annoying dependencies! Haven't tried it but still nice!

As for temporal, I remember Malcolm gave up on it cause it didn't produced decent results and his recommendation was something like "Just use MVTools". That's why temporal thingy in his plugin is buggy, was never completed and v0.4 branch abandoned.

feisty2
16th November 2014, 16:51
az works nicely on tritical's original version, is it very hard to port it from cpp to opencl? sorry, i got little programming knowledge, dunno much about it

Khanattila
16th November 2014, 17:01
Still no support of YUY2 ?

YUY2 is packed.
NLMeansCL2() with YUY2 support have the same performance of YUY2Clip.ConvertToYV16().NLMeansCL2()

Reel.Deel
16th November 2014, 17:09
Y8 support? It's easy, I will add in the next release.

Y8 support would be great :)

YUY2 is packed.
NLMeansCL2() with YUY2 support have the same performance of ConvertToYUY2().NLMeansCL2()

Shouldn't it be ConvertToYV16().NLMeansCL2()?

Edit:
Might be worth mentioning that NLMeansCL2 already supports YV16/YV24.

Khanattila
16th November 2014, 18:36
Y8 support would be great :)



Shouldn't it be ConvertToYV16().NLMeansCL2()?

Edit:
Might be worth mentioning that NLMeansCL2 already supports YV16/YV24.
yes in both cases

Khanattila
16th November 2014, 21:20
Edit.

Asmodian
17th November 2014, 02:58
>>>> NLMeans2_v0.3.0.zip <<<< (http://www.mediafire.com/download/1dpyf1ueusm575h/NLMeansCL2_v0.3.0.zip)

ChangeLog

v0.3.0 (2014-11-16)
* Works with Y8.
* Prevent possible memory leak.
* More selective resource load.


Hate these weekends without football!

It turns out we like them. ;)

:thanks:

Khanattila
19th November 2014, 17:47
Edit.

yup
20th November 2014, 15:03
Khanattila!
:thanks:
for update.
I test Your plugin on different PC.
It is work fine for Windows XP 32 with NVIDIA GeForce 8800 GTS 512 and Windows 7 64 with Intel HD, but have problem with Windows 7 64 with GTX 560
Script
AVISource("chapter13.avi")
AssumeTFF()
ConvertToYV12(interlaced=true)
SeparateFields()
NLMeansCL2(device_type="GPU")
Weave()
I get error
Avisynth open failure:
NLMeansCL2: Houston, we've had a problem!
[clCreateContext (CL_INVALID_DEVICE)]
(C:\Video\Source\stenyaev\tesnlmcl.avs, line 5)

Data for GPU
OpenCL 1.1 CUDA 6.5.12 FULL_PROFILE
1: GeForce GTX 560
If change device type to CPU, I get error
Avisynth open failure:
NLMeansCL2: Houston, we've had a problem!
[create_image2d (CL_GENERIC_ERROR)]
(C:\Video\Source\stenyaev\tesnlmcl.avs, line 5)
Malcolm version work without problem, also work cl version nnedi3 written by SEt. MSVC 2013 installed.
Also when I try on other computer with avisynth+ and open avs in Virtualdub I get error about insert disk for installation, after cancel avs opened. When I replace to Avisynth 2.6 MT all became fine.
yup.

Khanattila
20th November 2014, 18:52
Ok, let me explain.
This plugin use the default OpenCL context of your system because I have not yet implemented a system scan.
If for example the system uses NVIDIA CUDA as default OpenCL context is not possible to set device_type = "CPU".
Because NVIDIA CUDA do not support any CPU.

It is possible that the system default is wrong.

yup
20th November 2014, 19:28
Khanattila!
I am also try device_type="GPU" and get error.
May be try change Nvidia driver?
And why work previous Malcolm version?
Tomorrow I try some recreation my system and report.
yup.

Khanattila
20th November 2014, 20:43
Khanattila!
I am also try device_type="GPU" and get error.
May be try change Nvidia driver?
And why work previous Malcolm version?
Tomorrow I try some recreation my system and report.
yup.

Please, use GPU Caps Viewer :)
(validation link)

yup
21st November 2014, 09:27
Khanattila!
Report from GPU Caps Viewer
===================================[ OpenCL Capabilities ]
- Num OpenCL platforms: 2
- CL_PLATFORM_NAME: Intel(R) OpenCL
- CL_PLATFORM_VENDOR: Intel(R) Corporation
- CL_PLATFORM_VERSION: OpenCL 1.1
- CL_PLATFORM_PROFILE: FULL_PROFILE
- Num devices: 1

- CL_DEVICE_NAME: Intel(R) Core(TM) i7-2600 CPU @ 3.40GHz
- CL_DEVICE_VENDOR: Intel(R) Corporation
- CL_DRIVER_VERSION: 1.1
- CL_DEVICE_PROFILE: FULL_PROFILE
- CL_DEVICE_VERSION: OpenCL 1.1 (Build 31360.31441)
- CL_DEVICE_TYPE: CPU
- CL_DEVICE_VENDOR_ID: 0x8086
- CL_DEVICE_MAX_COMPUTE_UNITS: 8
- CL_DEVICE_MAX_CLOCK_FREQUENCY: 3400MHz
- CL_DEVICE_ADDRESS_BITS: 32
- CL_DEVICE_MAX_MEM_ALLOC_SIZE: 524256KB
- CL_DEVICE_GLOBAL_MEM_SIZE: 2047MB
- CL_DEVICE_MAX_PARAMETER_SIZE: 3840
- CL_DEVICE_GLOBAL_MEM_CACHELINE_SIZE: 64 Bytes
- CL_DEVICE_GLOBAL_MEM_CACHE_SIZE: 256KB
- CL_DEVICE_ERROR_CORRECTION_SUPPORT: NO
- CL_DEVICE_LOCAL_MEM_TYPE: Global
- CL_DEVICE_LOCAL_MEM_SIZE: 32KB
- CL_DEVICE_MAX_CONSTANT_BUFFER_SIZE: 128KB
- CL_DEVICE_MAX_WORK_ITEM_DIMENSIONS: 3
- CL_DEVICE_MAX_WORK_ITEM_SIZES: [1024 ; 1024 ; 1024]
- CL_DEVICE_MAX_WORK_GROUP_SIZE: 1024
- CL_EXEC_NATIVE_KERNEL: 14404036
- CL_DEVICE_IMAGE_SUPPORT: YES
- CL_DEVICE_MAX_READ_IMAGE_ARGS: 480
- CL_DEVICE_MAX_WRITE_IMAGE_ARGS: 480
- CL_DEVICE_IMAGE2D_MAX_WIDTH: 8192
- CL_DEVICE_IMAGE2D_MAX_HEIGHT: 8192
- CL_DEVICE_IMAGE3D_MAX_WIDTH: 2048
- CL_DEVICE_IMAGE3D_MAX_HEIGHT: 2048
- CL_DEVICE_IMAGE3D_MAX_DEPTH: 2048
- CL_DEVICE_MAX_SAMPLERS: 480
- CL_DEVICE_PREFERRED_VECTOR_WIDTH_CHAR: 16
- CL_DEVICE_PREFERRED_VECTOR_WIDTH_SHORT: 8
- CL_DEVICE_PREFERRED_VECTOR_WIDTH_INT: 4
- CL_DEVICE_PREFERRED_VECTOR_WIDTH_LONG: 2
- CL_DEVICE_PREFERRED_VECTOR_WIDTH_FLOAT: 4
- CL_DEVICE_PREFERRED_VECTOR_WIDTH_DOUBLE: 2
- CL_DEVICE_EXTENSIONS: 11
- Extensions:
- cl_khr_fp64
- cl_khr_icd
- cl_khr_global_int32_base_atomics
- cl_khr_global_int32_extended_atomics
- cl_khr_local_int32_base_atomics
- cl_khr_local_int32_extended_atomics
- cl_khr_byte_addressable_store
- cl_intel_printf
- cl_ext_device_fission
- cl_intel_exec_by_local_thread
- cl_khr_gl_sharing
- CL_PLATFORM_NAME: NVIDIA CUDA
- CL_PLATFORM_VENDOR: NVIDIA Corporation
- CL_PLATFORM_VERSION: OpenCL 1.1 CUDA 6.5.12
- CL_PLATFORM_PROFILE: FULL_PROFILE
- Num devices: 1

- CL_DEVICE_NAME: GeForce GTX 560
- CL_DEVICE_VENDOR: NVIDIA Corporation
- CL_DRIVER_VERSION: 340.52
- CL_DEVICE_PROFILE: FULL_PROFILE
- CL_DEVICE_VERSION: OpenCL 1.1 CUDA
- CL_DEVICE_TYPE: GPU
- CL_DEVICE_VENDOR_ID: 0x10DE
- CL_DEVICE_MAX_COMPUTE_UNITS: 7
- CL_DEVICE_MAX_CLOCK_FREQUENCY: 1620MHz
- CL_NV_DEVICE_COMPUTE_CAPABILITY_MAJOR: 2
- CL_NV_DEVICE_COMPUTE_CAPABILITY_MINOR: 1
- CL_NV_DEVICE_REGISTERS_PER_BLOCK: 32768
- CL_NV_DEVICE_WARP_SIZE: 32
- CL_NV_DEVICE_GPU_OVERLAP: 1
- CL_NV_DEVICE_KERNEL_EXEC_TIMEOUT: 1
- CL_NV_DEVICE_INTEGRATED_MEMORY: 0
- CL_DEVICE_ADDRESS_BITS: 32
- CL_DEVICE_MAX_MEM_ALLOC_SIZE: 262144KB
- CL_DEVICE_GLOBAL_MEM_SIZE: 1024MB
- CL_DEVICE_MAX_PARAMETER_SIZE: 4352
- CL_DEVICE_GLOBAL_MEM_CACHELINE_SIZE: 128 Bytes
- CL_DEVICE_GLOBAL_MEM_CACHE_SIZE: 112KB
- CL_DEVICE_ERROR_CORRECTION_SUPPORT: NO
- CL_DEVICE_LOCAL_MEM_TYPE: Local (scratchpad)
- CL_DEVICE_LOCAL_MEM_SIZE: 47KB
- CL_DEVICE_MAX_CONSTANT_BUFFER_SIZE: 64KB
- CL_DEVICE_MAX_WORK_ITEM_DIMENSIONS: 3
- CL_DEVICE_MAX_WORK_ITEM_SIZES: [1024 ; 1024 ; 64]
- CL_DEVICE_MAX_WORK_GROUP_SIZE: 1024
- CL_EXEC_NATIVE_KERNEL: 14404032
- CL_DEVICE_IMAGE_SUPPORT: YES
- CL_DEVICE_MAX_READ_IMAGE_ARGS: 128
- CL_DEVICE_MAX_WRITE_IMAGE_ARGS: 8
- CL_DEVICE_IMAGE2D_MAX_WIDTH: 32768
- CL_DEVICE_IMAGE2D_MAX_HEIGHT: 32768
- CL_DEVICE_IMAGE3D_MAX_WIDTH: 2048
- CL_DEVICE_IMAGE3D_MAX_HEIGHT: 2048
- CL_DEVICE_IMAGE3D_MAX_DEPTH: 2048
- CL_DEVICE_MAX_SAMPLERS: 16
- CL_DEVICE_PREFERRED_VECTOR_WIDTH_CHAR: 1
- CL_DEVICE_PREFERRED_VECTOR_WIDTH_SHORT: 1
- CL_DEVICE_PREFERRED_VECTOR_WIDTH_INT: 1
- CL_DEVICE_PREFERRED_VECTOR_WIDTH_LONG: 1
- CL_DEVICE_PREFERRED_VECTOR_WIDTH_FLOAT: 1
- CL_DEVICE_PREFERRED_VECTOR_WIDTH_DOUBLE: 1
- CL_DEVICE_EXTENSIONS: 15
- Extensions:
- cl_khr_byte_addressable_store
- cl_khr_icd
- cl_khr_gl_sharing
- cl_nv_d3d9_sharing
- cl_nv_d3d10_sharing
- cl_khr_d3d10_sharing
- cl_nv_d3d11_sharing
- cl_nv_compiler_options
- cl_nv_device_attribute_query
- cl_nv_pragma_unroll
- cl_khr_global_int32_base_atomics
- cl_khr_global_int32_extended_atomics
- cl_khr_local_int32_base_atomics
- cl_khr_local_int32_extended_atomics
- cl_khr_fp64

I have last driver availible from Nvidia.
yup.

Khanattila
21st November 2014, 09:43
That's what I tried to explain.

- Num OpenCL platforms: 2
- CL_PLATFORM_NAME: Intel(R) OpenCL
- CL_PLATFORM_VENDOR: Intel(R) Corporation
- CL_PLATFORM_VERSION: OpenCL 1.1
- CL_PLATFORM_PROFILE: FULL_PROFILE

You have two OpenCL platforms, and default is Intel.
Because NLMeansCL2 is still in development, it use only the default context.
If you remove the intel OpenCL driver it should work.

yup
21st November 2014, 12:32
Khanattila!
I remove Intel OpenCL SDK and now all work.
yup.

Khanattila
21st November 2014, 12:58
Khanattila!
I remove Intel OpenCL SDK and now all work.
yup.

Glad you managed to solve it.

HOB
22nd November 2014, 03:25
Hello
I wonder if this plugin will work in MeGUI? I was able to get NLMeansCL to work in MeGUI the minor problems I encountered I was able to overcome. I downloaded this plugin and copied it to the standard MeGUI folder for this kind of plugin but MeGUI doesn't seem to recognize it properly...OR...perhaps I didn't install it correctly? Will it work or shall I just continue to check in here to see if you've made it compatible with MeGUI?
Thanks

Reel.Deel
22nd November 2014, 03:33
I downloaded this plugin and copied it to the standard MeGUI folder for this kind of plugin but MeGUI doesn't seem to recognize it properly...

Do you have the appropriate requirements?

AviSynth 2.6 Alpha 5
Visual C++ Redistributable Package for Visual Studio 2013 (x86) (http://www.microsoft.com/en-us/download/details.aspx?id=40784)

I don't use MeGUI so I can't check.

StainlessS
22nd November 2014, 04:06
RD, can I ask then, what do you use for h264, just curious.

Reel.Deel
22nd November 2014, 04:17
x264.exe (I use tMod), I sometimes load the .avs directly, or use Avs2YUV to pipe to x264 (mainly for 10-bit video). Anyways this it OT so I'll stop.

----

@Khanattila
When this filter becomes stable do you mind if I add to the AviSynth wiki?

HOB
22nd November 2014, 04:37
Hello Reel.Deel
Yes I do have AviSynth 2.6 Alpha 5 installed.

Reel.Deel
22nd November 2014, 04:48
@HOB
How about the 2013 runtime? Also, any error message?

HOB
22nd November 2014, 05:53
Reel.Deel
Yes and here is the message:

http://i62.tinypic.com/2dbplqo.jpg

Khanattila
22nd November 2014, 10:59
Hello
I wonder if this plugin will work in MeGUI? I was able to get NLMeansCL to work in MeGUI the minor problems I encountered I was able to overcome. I downloaded this plugin and copied it to the standard MeGUI folder for this kind of plugin but MeGUI doesn't seem to recognize it properly...OR...perhaps I didn't install it correctly? Will it work or shall I just continue to check in here to see if you've made it compatible with MeGUI?
Thanks
A safe way is to install AviSynth and do not use the included AviSynth.
Just copy the plugin in "C:\Program Files (x86)\AviSynth 2.5\plugins" (example).
MeGui can call all of them.

HOB
22nd November 2014, 18:58
Khanattila
Sorry to be a dunce but I'm not having any luck and I don't want to waste anymore or your time, I'll just tune into this site every once in a while to see if any one has gotten this plugin working with MeGUI and hope they post instructions on HOW EXACTLY they managed it.
Thanks

Reel.Deel
22nd November 2014, 19:03
@HOB

error=0x7e? Hmm doesn't this error mean that a component is missing? Are you sure you have the 32-bit (x86) 2013 Redistributable Package?

Edit: try loading NLMeansCL2.dll with Dependency Walker (http://www.dependencywalker.com/) to be sure that nothing is missing.

HOB
22nd November 2014, 20:39
Reel.Deel
I think you may be on to something, I may be missing a component for THIS plugin. I have quite a large number of third party plugins installed in MeGUI and I've not come across this problem with any of them. I'll double check to make sure I have the package you refer to installed and if not I'll get it installed...

Thanks for the suggestions....I'll be back.

Khanattila
23rd November 2014, 01:36
Khanattila
Sorry to be a dunce but I'm not having any luck and I don't want to waste anymore or your time, I'll just tune into this site every once in a while to see if any one has gotten this plugin working with MeGUI and hope they post instructions on HOW EXACTLY they managed it.
Thanks

It's probably my fault but MeGUI is just a gui for AviSynth, x264 and other software.

AviSynth have two ways to load plugin. Using this code in a script
LoadPlugin ("filename" [, ...])
or copy plugin in this folder.
D:\Program Files (x86)\AviSynth 2.5\plugins
The plugins from 'plugins' folder are auto-loaded at AviSynth startup, and this is the safest way. So just copy "NLMeansCL2.dll" in "plugins" and all will go in the right way :)

http://s2.postimg.org/3ypdeb1ft/Me_GUI.jpg

HOB
23rd November 2014, 18:05
Hello Khanattila and Reel.Deel
I think Reel.Deel has the solution I AM missing a component...I copied the NLMeansCL2.dll to the indicated directory and got the following error message:

http://i58.tinypic.com/dqrigy.jpg

Any suggestions as to which component I need to download and install?
Thanks

Sparktank
23rd November 2014, 18:20
http://i58.tinypic.com/dqrigy.jpg

Visual C++ Redistributable Package for Visual Studio 2013 (x86) (http://www.microsoft.com/en-us/download/details.aspx?id=40784)

Did you at all install that?
Install it anway. If you did, re-install it.
If you don't know, install it.

HOB
23rd November 2014, 20:09
Of course Isaac was right about that standing on the shoulders of giants business…with your help it WORKED.

Thanks Khanattila, Reel.Deel and Sparktank.

Khanattila
28th November 2014, 13:01
Edit.

dbart
5th December 2014, 10:49
one technical HW question:

i dont play games, im happy with passive GT430 for video decoding and fft3dgpu filtering. Now playing with this filter i start thinking about GTX 750.

Is it better to have 2 GB memory version of this card, or 1 GB model is enough for using NLMeansCL2 ?

Groucho2004
5th December 2014, 11:18
one technical HW question:

i dont play games, im happy with passive GT430 for video decoding and fft3dgpu filtering. Now playing with this filter i start thinking about GTX 750.

Is it better to have 2 GB memory version of this card, or 1 GB model is enough for using NLMeansCL2 ?
The maximum graphics memory I have seen it use is about 160MB with 1080p, checked with GPU-Z. I run it on a GT240 with 512MB.

If you don't play games I think 1 GB would be plenty. However, you'll have to consider that other filters may be using the graphics memory (now or in the future). If the price difference is not too big, go for 2 GB.

Khanattila
5th December 2014, 22:40
In video memory are loaded the source and the target frame.
Each frame weighs 8-bit / 16-bit for pixel.
So in the worst case: 1920x1080, YV24, y=3, u=3, v=3, 16-bits.

1920*1080*16*2*3 = 190 MB.

Khanattila
3rd January 2015, 23:49
Edit.

Groucho2004
4th January 2015, 00:04
New: about 10% faster.
Hm, 0.3.3 is slower than 0.3.2 on my box (XP32Sp3, i5-2500K).

0.3.2:
Frames processed: 500 (0 - 499)
FPS (min | max | average): 13.46 | 14.19 | 13.80
CPU usage (average): 25%
GPU usage (average): 95%
Thread count: 8
Memory usage (phys | virt): 70 | 69 MB
Time (elapsed): 00:00:36.220

0.3.3:
Frames processed: 500 (0 - 499)
FPS (min | max | average): 11.24 | 11.84 | 11.58
CPU usage (average): 25%
GPU usage (average): 96%
Thread count: 8
Memory usage (phys | virt): 70 | 69 MB
Time (elapsed): 00:00:43.194


Script:
w = 1920
h = 1080
colorbars(width = w, height = h, pixel_type = "yv12").killaudio().assumefps(24000, 1001)
trim(0,499)
fadeio(248)
trim(0,499)
NLMeansCL2()

Khanattila
4th January 2015, 00:35
This is interesting.
(8.1, i5-2500k, GTX760)

0.3.3

Frames processed: 500 (0 - 499)
FPS (min | max | average): 65.31 | 73.17 | 69.65
CPU usage (average): 25%
GPU usage (average): 83%
Thread count: 8
Memory usage (phys | virt): 102 | 102 MB
Time (elapsed): 00:00:07.179


0.3.2

Frames processed: 500 (0 - 499)
FPS (min | max | average): 58.67 | 64.88 | 62.17
CPU usage (average): 25%
GPU usage (average): 85%
Thread count: 8
Memory usage (phys | virt): 102 | 102 MB
Time (elapsed): 00:00:08.043

Groucho2004
4th January 2015, 00:37
Did you use the same script? Also, which Avisynth version?

Khanattila
4th January 2015, 00:52
Did you use the same script? Also, which Avisynth version?

All the same.

Another test, with more GPU load.

0.3.3

Frames processed: 500 (0 - 499)
FPS (min | max | average): 22.21 | 27.08 | 25.67
CPU usage (average): 25%
GPU usage (average): 90%
Thread count: 8
Memory usage (phys | virt): 105 | 96 MB
Time (elapsed): 00:00:19.475


0.3.2

Frames processed: 500 (0 - 499)
FPS (min | max | average): 19.60 | 23.73 | 22.60
CPU usage (average): 25%
GPU usage (average): 93%
Thread count: 8
Memory usage (phys | virt): 105 | 97 MB
Time (elapsed): 00:00:22.129


script

ColorBars(1920, 1080, "YV12").killaudio().assumefps(24000, 1001)
trim(0,499)
fadeio(248)
trim(0,499)
NLMeansCL2(A=8)


The new code should reduce GPU load, and increase the overall performance.

Groucho2004
4th January 2015, 01:03
I have a GT240, obviously much slower than your card. Maybe the newer card has some optimizations that the GT240 does not have. Could also be a driver issue...

Note to self: Add GPU info to AVSMeter log.

Khanattila
4th January 2015, 12:42
I have a GT240, obviously much slower than your card. Maybe the newer card has some optimizations that the GT240 does not have. Could also be a driver issue...

Note to self: Add GPU info to AVSMeter log.

Can you repeat the test and share the complete log?

AMD C-60, HD6290, W8.1. I have no other platform.

0.3.3

Frames processed: 100 (0 - 99)
FPS (min | max | average): 1.613 | 1.747 | 1.687
CPU usage (average): 5%
GPU usage (average): 82%
Thread count: 1
Memory usage (phys | virt): 81 | 75 MB
Time (elapsed): 00:00:59.283


0.3.2

Frames processed: 100 (0 - 99)
FPS (min | max | average): 1.133 | 1.589 | 1.481
CPU usage (average): 4%
GPU usage (average): 75%
Thread count: 1
Memory usage (phys | virt): 80 | 75 MB
Time (elapsed): 00:01:07.511


script

w = 1920
h = 1080
colorbars(width = w, height = h, pixel_type = "yv12").killaudio().assumefps(24000, 1001)
trim(0,99)
fadeio(49)
trim(0,99)
NLMeansCL2()



http://pastebin.com/wtQfVknS
http://pastebin.com/euQqAXiQ

Groucho2004
4th January 2015, 13:04
Can you repeat the test and share the complete log?

0.3.2: http://pastebin.com/tzqZZP35
Frames processed: 100 (0 - 99)
FPS (min | max | average): 13.32 | 14.15 | 13.79
CPU usage (average): 25%
GPU usage (average): 96%
Thread count: 8
Memory usage (phys | virt): 67 | 66 MB
Time (elapsed): 00:00:07.250

0.3.3: http://pastebin.com/xYwGcK7k
Frames processed: 100 (0 - 99)
FPS (min | max | average): 11.24 | 11.80 | 11.57
CPU usage (average): 25%
GPU usage (average): 91%
Thread count: 8
Memory usage (phys | virt): 67 | 66 MB
Time (elapsed): 00:00:08.646


WinXPSP3, i5-2500K @ 4GHz, GT240, Driver: 310.90

Khanattila
4th January 2015, 14:38
Maybe it is a problem due to the driver. There are some problems reported with 310.90.

Groucho2004
4th January 2015, 16:27
Maybe it is a problem due to the driver. There are some problems reported with 310.90.
I tried with the latest driver, same thing.
Could it be the OpenCL version (see below Aida64 report)?

OpenCL Properties:
Platform Name NVIDIA CUDA
Platform Vendor NVIDIA Corporation
Platform Version OpenCL 1.1 CUDA 6.5.12
Platform Profile Full

Device Properties:
Device Name GeForce GT 240
GPU Code Name GT215
Device Type GPU
Device Vendor NVIDIA Corporation
Device Version OpenCL 1.0 CUDA
Device Profile Full
Driver Version 340.52
OpenCL C Version OpenCL C 1.1

Khanattila
4th January 2015, 19:19
Device Version OpenCL 1.0 CUDA
According to khronos API:
If the -cl-std build option is not specified, the CL_DEVICE_OPENCL_C_VERSION is used to select the version of OpenCL C to be used when building the program executable for each device.
Possible the same source code generate different machine code. In this case slower.

(-cl-std=CL1.0 is not allowed)

Groucho2004
4th January 2015, 20:05
Device Version OpenCL 1.0 CUDA
According to khronos API:
If the -cl-std build option is not specified, the CL_DEVICE_OPENCL_C_VERSION is used to select the version of OpenCL C to be used when building the program executable for each device.
Possible the same source code generate different machine code. In this case slower.

(-cl-std=CL1.0 is not allowed)
I believe that "CL_DEVICE_OPENCL_C_VERSION" refers to "OpenCL C Version" which in my case is "OpenCL C 1.1".

Khanattila
4th January 2015, 23:15
I believe that "CL_DEVICE_OPENCL_C_VERSION" refers to "OpenCL C Version" which in my case is "OpenCL C 1.1".

But your device only support OpenCL 1.0, so I guess some instructions are downgrade for backward compatibility.

In a OpenCL program the kernel (the problem to be solved) is compiled just before running.

Probably I used some instruction OpenCL 1.1.

Khanattila
5th January 2015, 00:21
Edit.

Groucho2004
5th January 2015, 00:45
032:
Frames processed: 500 (0 - 499)
FPS (min | max | average): 13.51 | 14.27 | 13.86
CPU usage (average): 25%
GPU usage (average): 95%
Thread count: 8
Memory usage (phys | virt): 74 | 73 MB
Time (elapsed): 00:00:36.062

034 (legacy = true):
Frames processed: 500 (0 - 499)
FPS (min | max | average): 13.52 | 14.26 | 13.86
CPU usage (average): 25%
GPU usage (average): 95%
Thread count: 8
Memory usage (phys | virt): 90 | 88 MB
Time (elapsed): 00:00:36.063


So, performance is identical to 0.3.2 but the memory usage is a tiny bit higher.

Khanattila
8th January 2015, 16:15
Edit.

Groucho2004
8th January 2015, 17:10
0.4.0 does not work with my card (GT240) any more, whether I specify "legacy = true" or not:
[clBuildProgram (CL_BUILD_PROGRAM_FAILURE)]

I guess that's by design? :(

Khanattila
8th January 2015, 18:03
0.4.0 does not work with my card (GT240) any more, whether I specify "legacy = true" or not:
[clBuildProgram (CL_BUILD_PROGRAM_FAILURE)]

I guess that's by design? :(

OpenCL, NVIDIA and portability, can not be together :mad:
Please use this plugin that generates a debug file, link.

EDIT.

Groucho2004
8th January 2015, 18:23
Please use this plugin that generates a debug file, link (http://www.mediafire.com/download/j241ytqleqjv8id/NLMeansCL2.dll).

Log file:
"Language version specified by -cl-std is greater than the language version supported by the device!"

Khanattila
8th January 2015, 18:59
Log file:
"Language version specified by -cl-std is greater than the language version supported by the device!"

Fixed, just re-download.

If the -cl-std build option is not specified, the CL_DEVICE_OPENCL_C_VERSION is used to select the version of OpenCL C to be used when building the program executable for each device.

Thanks Nvidia.

In this version (0.4.0) I have specified -cl-std 1.1 because AMD support OpenCL >1.2 and could create problems. With legacy = true this check is now disabled.

Groucho2004
8th January 2015, 19:06
Fixed, just re-download.
Works, thanks!

Just to confirm - Memory consumption is lower than with the last version (0.3.4)

Groucho2004
9th January 2015, 23:33
This has been asked before in this thread a couple of times - any plans to implement temporal mode?

Khanattila
10th January 2015, 12:59
This has been asked before in this thread a couple of times - any plans to implement temporal mode?

First I have to solve a performance problem with B > 1 or 2.
Problem size is := [-Ax, ..., Ax] x [-Ay, ..., Ay] x [-Dpast, ..., Dfuture].

So Az=1 (three frame processing) is three times slower.

EDIT.
B = 0, 13.48 FPS //correct
B = 1, 41.38 FPS //correct
B = 2, 47.82 FPS //wrong, expected ~67 FPS
B = 3, 24.01 FPS //wtf???

Pulp Catalyst
28th February 2015, 15:59
could anyone recommend a default that will give be a ultralight kind of setting, i only want the bare minimum, my aim is so the original source will be affected so lightly that it will not be detected by the naked eye, i've been using the ultralight setting on Handbrake (vidcoder i use), but i don 't know the config parameters of course they use. (the strength value is very low though, and surprisingly still give very pleasing results as a generic profile)

if anyone can suggest recommended values and possible an example NLMeansCL2(????), that would be great.

Thanks,

p.s i really hope that a gpu version of this gets ported over to handbrake though one day.... the cpu version is so SLOWWWWW lol

Khanattila
10th March 2015, 16:33
could anyone recommend a default that will give be a ultralight kind of setting, i only want the bare minimum, my aim is so the original source will be affected so lightly that it will not be detected by the naked eye, i've been using the ultralight setting on Handbrake (vidcoder i use), but i don 't know the config parameters of course they use. (the strength value is very low though, and surprisingly still give very pleasing results as a generic profile)

if anyone can suggest recommended values and possible an example NLMeansCL2(????), that would be great.

Thanks,

p.s i really hope that a gpu version of this gets ported over to handbrake though one day.... the cpu version is so SLOWWWWW lol
Handbrake's nlmeans it's very different:
1) use a temporal search;
2) use a median filter (3x3 / 5x5);
3) use a edge mask;
4) other.

Normally, NLMeans2CL(A=4, S=2, B=1, h=1.3) is light enough.

Pulp Catalyst
11th March 2015, 04:39
NLMeansCL2(A=4, S=2, B=1, h=1.3, device_type="GPU")

I'm giving it a try, thanks for the feedback.

I did not realize the handbrake NLMeans was so different, is there version more mature than this one (has more features)?
I also hope for the day when i can insert this version into QTGMC .... Wink Wink.

feisty2
11th March 2015, 08:59
I'm giving it a try, thanks for the feedback.

I did not realize the handbrake NLMeans was so different, is there version more mature than this one (has more features)?
I also hope for the day when i can insert this version into QTGMC .... Wink Wink.

TNLMeans got a temporal mode but it's sloooooooow like hell and no support for high bitdepth

Stereodude
21st March 2015, 16:57
What is the expected behavior if the arguments passed to NLmeanCL2 require more resources (VRAM?) than the OpenCL device has?

I was trying to run this script suggested in this thread (http://forum.doom9.org/showthread.php?t=171942) on a FHD source.

nlmeanscl2(a=10,b=0,s=4,lsb_inout=true,h=4.8,aa=3.2, device_type="GPU", info=true)

With both the Intel HD 4600 (i7-4770k) and Nvidia GT440 (1gB) the graphics driver crashes (momentary black screen followed by a message in the system tray about it).

This message is returned to the application by AVIsynth

NLMeansCL2: Houston, we've had a problem!
[clCreateContext (CL_OUT_OF_RESOURCES)]

If I just use a NLMeansCL2 call of
nlmeanscl2(device_type="GPU", info=true)
it works fine.

I'm running Windows 7 x64 w/ 16gB of RAM and have the latest drivers on both the GT440 and the HD4600.

Khanattila
1st April 2015, 09:32
What is the expected behavior if the arguments passed to NLmeanCL2 require more resources (VRAM?) than the OpenCL device has?

I was trying to run this script suggested in this thread (http://forum.doom9.org/showthread.php?t=171942) on a FHD source.

nlmeanscl2(a=10,b=0,s=4,lsb_inout=true,h=4.8,aa=3.2, device_type="GPU", info=true)

With both the Intel HD 4600 (i7-4770k) and Nvidia GT440 (1gB) the graphics driver crashes (momentary black screen followed by a message in the system tray about it).

This message is returned to the application by AVIsynth

NLMeansCL2: Houston, we've had a problem!
[clCreateContext (CL_OUT_OF_RESOURCES)]

If I just use a NLMeansCL2 call of
nlmeanscl2(device_type="GPU", info=true)
it works fine.

I'm running Windows 7 x64 w/ 16gB of RAM and have the latest drivers on both the GT440 and the HD4600.
Please, use GPU Caps Viewer: http://www.geeks3d.com/20150127/gpu-caps-viewer-1-23-0-released/
I need some more info. Most likely your system does not have enough video memory.


Validation => Submit. Get a link like that: http://www.ozone3d.net/gpudb/gpu.php?which=49098&v=2

Stereodude
4th April 2015, 14:11
Please, use GPU Caps Viewer: http://www.geeks3d.com/20150127/gpu-caps-viewer-1-23-0-released/
I need some more info. Most likely your system does not have enough video memory.


Validation => Submit. Get a link like that: http://www.ozone3d.net/gpudb/gpu.php?which=49098&v=2
Here you go. http://www.ozone3d.net/gpudb/gpu.php?which=49162&v=2

Mangix
7th April 2015, 18:31
Latest Nvidia drivers support OpenCL 1.2. Any performance benefits?

Khanattila
12th April 2015, 19:06
Latest Nvidia drivers support OpenCL 1.2. Any performance benefits?

Nvidia seems to don't like OpenCL, maybe because of CUDA.
OpenCL 1.2 / 1.1 API are different. The plugin should be rewritten to exploit all.

EDIT. OpenCL 1.2 was presented on November 15, 2011.

Atak_Snajpera
14th April 2015, 11:51
What are your thoughts about opencl 2.0? AMD has just added support in latest drivers.

Khanattila
17th April 2015, 18:17
What are your thoughts about opencl 2.0? AMD has just added support in latest drivers.


Is a compatibility issue. I'd like to use OpenCL 2.0, but I can't.

To achieve the maximum diffusion I have to use OpenCL 1.1.
NVIDIA CUDA Toolkit v7.0 can't stand even OpenCL 1.2. (http://developer.download.nvidia.com/compute/cuda/7_0/Prod/doc/CUDA_Toolkit_Release_Notes.pdf) (http://developer.download.nvidia.com/compute/cuda/7_0/Prod/doc/CUDA_Toolkit_Release_Notes.pdf)

I don't want to build two different versions. I hope so.

Khanattila
17th April 2015, 18:24
Here you go. http://www.ozone3d.net/gpudb/gpu.php?which=49162&v=2

Sorry for the late response.
Probably a big "A" use too much private/local memory for yor GPU.

(GPU have 3 three different memories: private memory, local memory, global memory. Where private is the faster and global is the bigger.)

Please reduce the value of A.

Khanattila
17th April 2015, 18:28
Probably this week I will release a new version of NLMeansCL2.
Since it will be a major change, for now I'll call it NLMeansCL2b().
So you can keep both versions.

Khanattila
21st April 2015, 10:56
NLMeansCL2b (
clip src,
int D (0), // Temporal windows, disabled in Beta 1
int A (4), // Search window
int S (2), // Similarity neighborhood window
int B (0), // Base window
int wmode (1), // Weighting function
float h (1.8), // Strength of the filtering
string device_type ("default"),
int y (3),
int u (2),
int v (2),
bool lsb_inout (false),
bool info (false)
)

Little explanation:

[wmode = 0] Cauchy weighting function has a very slow decay.
It assign larger weights to dissimilar blocks than the Leclerc
robust function, which will eventually lead to oversmoothing.

[wmode = 1] Leclerc weighting function has a faster decay,
but still assigns positive weights to dissimilar blocks. Original
NLMeans weighting function.

[wmode = 2] Bisquare weighting function use a soft threshold.

Download: removed.

################

New:

Temporal windows search (disabled in Beta1).
Cauchy weighting function.
Bisquare weighting function.

Removed:

Ay, Sy and By arguments.
aa argument (simple Euclidean distance).
sse argument (replaced by wmode).
legacy kernel.

Changed:

Patchwise Implementation
Euclidean distance

Updated:

NVIDIA CUDA Toolkit v7.0.
AVS 2.6.0 RC 2 [150331].

Reel.Deel
21st April 2015, 18:52
Hi Khanattila, thanks for the update! I tried using NLMeansCL2b with AviSynth+ r1576 on my work computer but I got this error message: "Plugin was designed for a later version of Avisynth (6)"
I updated to r1779 and it works with that version. Was that intentional or is there something else going on? If so will this also be true for anyone using an older version before AviSynth 2.6 R2?

Khanattila
21st April 2015, 19:56
Hi Khanattila, thanks for the update! I tried using NLMeansCL2b with AviSynth+ r1576 on my work computer but I got this error message: "Plugin was designed for a later version of Avisynth (6)"
I updated to r1779 and it works with that version. Was that intentional or is there something else going on? If so will this also be true for anyone using an older version before AviSynth 2.6 R2?

Hi! Avisynth 2.6.0 has many bug fixes and improvements. It is a good idea to upgrade. For this I forced users to use an updated version. However, I do not know how Avisynth+ works.

Version 6 is 2.6.0.
Version 5 is 2.6.0a1-a5.
Version 4 is reserved.
Version 3 is 2.5.6.

StainlessS
21st April 2015, 21:38
I think there were multiple versions of Avisynth Header VERSION 5, a change was made to the header at some point which made plugins compiled with it
require Avisynth versionv2.6 Alpha 4+. The previous to current version of ClipClop plugin crashed on Avisynth v2.6a3 and previous
(as with other plugins, immediately at startup).

Groucho2004
21st April 2015, 22:41
I think there were multiple versions of Avisynth Header VERSION 5, a change was made to the header at some point which made plugins compiled with it
require Avisynth versionv2.6 Alpha 4+.
I think you're getting this mixed up with the introduction of "AVS_linkage" in 2.6 Alpha4.

As for the "AVISYNTH_INTERFACE_VERSION":
"3" : 2.5.x
"5" : 2.6.0 < RC1
"6" : 2.6.0 >= RC1

As for AVS+, the lastest builds (r17xx) have the header updated to v6.

StainlessS
22nd April 2015, 03:18
Guilty as charged M'lud :)

Khanattila
27th April 2015, 18:39
KNLMeansCL (
clip src,
int D (0), // Temporal window
int A (4), // Search window
int S (2), // Similarity neighborhood window
int wmode (1), // Weighting function
float h (1.8), // Strength of the filtering
string device_type ("default"),
bool lsb_inout (false),
bool info (false)
)


Changelog

v0.5.0 Beta2 (2015-04-27)
- New: Temporal windows search.
- New: Cauchy weighting function.
- New: Bisquare weighting function.
- Changed: plugin name!
- Changed: now process always luminace (y).
- Changed: simple Euclidean distance.
- Changed: sse argument, replaced by wmode.
- Removed: u and v arguments.
- Removed: Ay and Sy.
- Removed: patchwise Implementation.
- Removed: aa argument.
- Removed: legacy kernel.
- Updated: NVIDIA CUDA Toolkit v7.0.
- Updated: AVS 2.6.0 RC 2 [150331].

Groucho2004
27th April 2015, 22:14
KNLMeansCL (
clip src,
int D (0), // Temporal window
int A (4), // Search window
int S (2), // Similarity neighborhood window
int wmode (1), // Weighting function
float h (1.8), // Strength of the filtering
string device_type ("default"),
bool lsb_inout (false),
bool info (false)
)


Changelog

v0.5.0 Beta2 (2015-04-27)
- New: Temporal windows search.
- New: Cauchy weighting function.
- New: Bisquare weighting function.
- Changed: plugin name!
- Changed: now process always luminace (y).
- Changed: simple Euclidean distance.
- Changed: sse argument, replaced by wmode.
- Removed: u and v arguments.
- Removed: Ay and Sy.
- Removed: patchwise Implementation.
- Removed: aa argument.
- Removed: legacy kernel.
- Updated: NVIDIA CUDA Toolkit v7.0.
- Updated: AVS 2.6.0 RC 2 [150331].


Download: KNLMeansCL_v0.5_Beta2 (http://www.mediafire.com/download/7iubuq00u1vl2qj/KNLMeansCL_v.0.5_Beta2.dll).
Thanks for this new version. I suppose the default for "D" (0) disables temporal operation? I get a huge performance hit when I set it to "1" which I guess is normal.
I really like this filter and I think I have to consider upgrading from my old GT240.
So, how about running a simple benchmark to see how various video cards fare? I'm thinking something like this:
colorbars(width = 1280, height = 720, pixel_type = "yv12").killaudio().assumefps(24000, 1001)
trim(0,99)
fadeio(48)
trim(0,99)
KNLMeansCL(D = 1)

Running this script through AVSMeter (-log -gpu), I get these results:

[Runtime info]
Frames processed: 100 (0 - 99)
FPS (min | max | average): 1.421 | 1.452 | 1.448
Memory usage (phys | virt): 44 | 43 MB
Thread count: 8
CPU usage (average): 25%
GPU usage (average): 99%
Video engine load (average): 0%
GPU memory usage: 67 MB
Time (elapsed): 00:01:09.051

[Graphics card info]
Card name: NVIDIA GeForce GT 240
GPU name: GT215
Memory size: 512
OpenCL version: OpenCL 1.0 CUDA
Driver version: 6.14.13.4052 (ForceWare 340.52) / XP

Khanattila
28th April 2015, 00:31
D is the number of past and future frame that the filter uses for denoising the current frame.

D = 0, only current frame (n).
D = 1, use n - 1, n, n + 1.
D = 2, use n - 2, n - 1, n, n + 1, n + 2.
etc.

D = 0 also exploit the symmetry property of the weights, i.e. w(p, p + q) = w(p + q, p). But this requires an accumulation buffer, probably in an old GPU makes performance down.

(Symmetry is also possible in temporal but requires too many check).


KNLMeansCL(D = 0)

[Runtime info]
Frames processed: 100 (0 - 99)
FPS (min | max | average): 27.89 | 45.95 | 43.44
CPU usage (average): 24%
GPU usage (average): 73%
Thread count: 8
Memory usage (phys | virt): 60 | 75 MB
Time (elapsed): 00:00:02.302



KNLMeansCL(D = 1)

[Runtime info]
Frames processed: 100 (0 - 99)
FPS (min | max | average): 6.984 | 7.730 | 7.598
CPU usage (average): 25%
GPU usage (average): 94%
Thread count: 8
Memory usage (phys | virt): 63 | 77 MB
Time (elapsed): 00:00:13.161



KNLMeansCL(D = 2)

[Runtime info]
Frames processed: 100 (0 - 99)
FPS (min | max | average): 4.368 | 4.653 | 4.587
CPU usage (average): 25%
GPU usage (average): 95%
Thread count: 8
Memory usage (phys | virt): 64 | 79 MB
Time (elapsed): 00:00:21.799


EDIT.
Computational complexity: ((2 * A + 1) * (2 * A +1) * (2 * D + 1) - 1) / (D ? 1 : 2)

Groucho2004
28th April 2015, 01:25
I suppose you used the GTX760 for these measurements?

Khanattila
28th April 2015, 11:53
I suppose you used the GTX760 for these measurements?

[Graphics card info]
Card name: NVIDIA GeForce GTX 760
GPU name: GK104
Memory size: 2048
OpenCL version: OpenCL 1.2 CUDA
Driver version: 9.18.13.5012 WHQL (ForceWare 350.12) / Win8.1 64


EDIT.
Would you try this?
- 720x480. KNLMeansCL(0, 2, 1)
- 720x480. KNLMeansCL(0, 3, 1)
- 720x480. KNLMeansCL(0, 5, 1)

Original 9600 GT take: 100.00 FPS / 52.46 FPS / 18.46 FPS.

(B. Goossens, H.Q. Luong, J. Aelterman, A. Pizurica, and W. Philips,
"A GPU-Accelerated Real-Time NLMeans Algorithm for Denoising Color Video Sequences",
in Proc. ACIVS (2), 2010, pp.46-57. )

Groucho2004
28th April 2015, 12:19
Would you try this?
- 720x480. KNLMeansCL(0, 2, 1)
- 720x480. KNLMeansCL(0, 3, 1)
- 720x480. KNLMeansCL(0, 5, 1)

Original 9600 GT take: 100.00 FPS / 52.46 FPS / 18.46 FPS.

colorbars(width = 720, height = 480, pixel_type = "yv12").killaudio().assumefps(24000, 1001)
trim(0,99)
fadeio(48)
trim(0,99)

KNLMeansCL(0, x, 1) #x = 2, 3, 5
GT 240: 77 FPS / 40 FPS / 16.5 FPS.

How can this be? The 9600 is ancient.

Khanattila
28th April 2015, 14:15
colorbars(width = 720, height = 480, pixel_type = "yv12").killaudio().assumefps(24000, 1001)
trim(0,99)
fadeio(48)
trim(0,99)

KNLMeansCL(0, x, 1) #x = 2, 3, 5
GT 240: 77 FPS / 40 FPS / 16.5 FPS.

How can this be? The 9600 is ancient.

Code is not fully optimized... but about is the same card: http://www.tomshardware.com/reviews/geforce-gt-240,2475-5.html

Khanattila
30th April 2015, 10:35
Beta2 Beta3
S=0 59.05 FPS 52.44 FPS -11%
S=1 47.35 FPS 51.82 FPS + 9%
S=2 43.99 FPS 51.43 FPS +17%
S=3 38.88 FPS 50.39 FPS +30%
S=4 36.89 FPS 49.20 FPS +33%

Ready for the final release.

Groucho2004
30th April 2015, 21:18
KNLMeansCL_v.0.5_Beta3.dll (http://www.mediafire.com/download/yi78j1ad21nhrxq/KNLMeansCL_v.0.5_Beta3.dll)
I'm getting an error with this version:
[build_programm (CL_BUILD_PROGRAM_FAILURE)]
Also, a text file ("KNLMeansCL.txt") is created with this content:
"error: macro 'V_BLOCK_Y' contains embedded newline, text after the newline is ignored."

Khanattila
30th April 2015, 22:13
I'm getting an error with this version:
[build_programm (CL_BUILD_PROGRAM_FAILURE)]
Also, a text file ("KNLMeansCL.txt") is created with this content:
"error: macro 'V_BLOCK_Y' contains embedded newline, text after the newline is ignored."


thanks

Khanattila
1st May 2015, 17:19
Microsoft... sprintf_s... pfff.

Groucho2004
1st May 2015, 18:27
Microsoft... sprintf_s... pfff.

KNLMeansCL_v.0.5_Beta4.dll (http://www.mediafire.com/download/6ex3mkibc97xnai/KNLMeansCL_v.0.5_Beta4.dll)
Thanks, this one works.

Khanattila
1st May 2015, 21:08
Thanks, this one works.

Some performance increment?

Groucho2004
1st May 2015, 21:33
Some performance increment?
Yes, it's about 20-25% faster.

jones1913
2nd May 2015, 12:54
An AMD Result:
[Graphics card info]
Card name: AMD Radeon R9 200 Series
GPU name: Pitcairn
Memory size: 2048
OpenCL version: OpenCL 1.2 AMD-APP (1642.5)
Driver version: atiumdag 14.501.1003.1001 (Catalyst 14.12 AMD Catalyst Omega Software) / Win7 64

colorbars(width = 720, height = 480, pixel_type = "yv12").killaudio().assumefps(24000, 1001)
trim(0,99)
fadeio(48)
trim(0,99)
KNLMeansCL(0, x, 1) #x = 2, 3, 5
R9 270X: 52.45 / 44.02 / 35.65

Log with x=5:
Frames processed: 100 (0 - 99)
FPS (min | max | average): 29.55 | 39.07 | 35.65
Memory usage (phys | virt): 51 | 60 MB
Thread count: 16
CPU usage (average): 10%
GPU usage (average): 28%
GPU memory usage: 2008087026 MB
Time (elapsed): 00:00:02.805


the other script:
colorbars(width = 1280, height = 720, pixel_type = "yv12").killaudio().assumefps(24000, 1001)
trim(0,99)
fadeio(48)
trim(0,99)
KNLMeansCL(D = 1)

Frames processed: 100 (0 - 99)
FPS (min | max | average): 5.578 | 7.770 | 6.694
Memory usage (phys | virt): 56 | 64 MB
Thread count: 16
CPU usage (average): 4%
GPU usage (average): 61%
GPU memory usage: 2008087026 MB
Time (elapsed): 00:00:14.939

Khanattila
2nd May 2015, 15:03
Frames processed: 100 (0 - 99)
FPS (min | max | average): 29.55 | 39.07 | 35.65
Memory usage (phys | virt): 51 | 60 MB
Thread count: 16
CPU usage (average): 10%
GPU usage (average): 28%
GPU memory usage: 2008087026 MB
Time (elapsed): 00:00:02.805


2008087026 MB! Possible gpu-z bug?

Groucho2004
2nd May 2015, 16:53
2008087026 MB! Possible gpu-z bug?
I'm pretty sure it's an AVSMeter bug. I only have NVIDIA cards for testing. AMD cards apparently provide 2 different memory readings (Dedicated/Dynamic) which are not captured by AVSMeter.
I'll make a debug build that logs all readings from GPU-Z so I can fix that.

@jones1913
I sent you a PM.

Khanattila
4th May 2015, 15:43
May the 4th Be With You

>>>> KNLMeansCL_v0.5.0.zip <<<< (http://www.mediafire.com/download/frid3w9xpsvxg2q/KNLMeansCL_v0.5.0.zip)

ChangeLog

v0.5.0 (2015-05-04)
- New: Temporal windows search.
- New: Cauchy weighting function.
- New: Bisquare weighting function.
- Changed: now process always luminace (y).
- Changed: Euclidean distance.
- Changed: sse argument, replaced by wmode.
- Removed: u and v arguments.
- Removed: Ay and Sy.
- Removed: patchwise implementation.
- Removed: aa argument.
- Removed: legacy kernel.
- Updated: NVIDIA CUDA Toolkit v7.0.
- Updated: AVS 2.6.0 RC 3 [150419].

yup
5th May 2015, 09:22
Khanattila :thanks: for update!

My source is VHS capture and I need filtering also chroma planes.
Please check code:
SetMemoryMax(3072)
SetmtMode(3,4)
AVISource("samplevhs.avi")
SetmtMode(2,4)
AssumeTFF()
ConvertToYV16(interlaced=true)
SeparateFields()
#NLMeansCL2(y=3, u=3, v=3,device_type="GPU")
u=UToY8()
v=VToY8()
Yf=KNLMeansCL(device_type="GPU")
uf=u.KNLMeansCL(device_type="GPU")
vf=v.KNLMeansCL(device_type="GPU")
YToUV (uf, vf, Yf)
Weave()
If code O'k I see 100% speed up for Intel HD built Graphics.
yup.

Groucho2004
5th May 2015, 10:20
2008087026 MB! Possible gpu-z bug?
@jones1913
Could you please run your tests again with the latest (2.0.1) version of AVSMeter?

Khanattila
5th May 2015, 10:46
Khanattila :thanks: for update!

My source is VHS capture and I need filtering also chroma planes.
Please check code:
SetMemoryMax(3072)
SetmtMode(3,4)
AVISource("samplevhs.avi")
SetmtMode(2,4)
AssumeTFF()
ConvertToYV16(interlaced=true)
SeparateFields()
#NLMeansCL2(y=3, u=3, v=3,device_type="GPU")
u=UToY8()
v=VToY8()
Yf=KNLMeansCL(device_type="GPU")
uf=u.KNLMeansCL(device_type="GPU")
vf=v.KNLMeansCL(device_type="GPU")
YToUV (uf, vf, Yf)
Weave()
If code O'k I see 100% speed up for Intel HD built Graphics.
yup.
OpenCL provides parallel computing using task-based and data-based parallelism (cit.). So, not real benefit of use MT...

Anyway, the code is correct. Set A and h according to the noise.
More compact...

Y=KNLMeansCL(device_type="GPU")
U=UToY8().KNLMeansCL(device_type="GPU")
V=VToY8().KNLMeansCL(device_type="GPU")
YToUV (U, V, Y)

Mounir
5th May 2015, 11:05
I got syntax error using this: KNLMeansCL (D(0),A(2),S(4),wmode(1), h(1.2,))
These are default values,strange

using this i get "plugin was designed for a later v. of avisynth" (i got the 2.6MT)

Y=KNLMeansCL(device_type="GPU")
U=UToY8().KNLMeansCL(device_type="GPU")
V=VToY8().KNLMeansCL(device_type="GPU")
YToUV (U, V, Y)

Groucho2004
5th May 2015, 11:11
ChangeLog

v0.5.0 (2015-05-04)
- New: Temporal windows search.
- New: Cauchy weighting function.
- New: Bisquare weighting function.
- Changed: now process always luminace (y).
- Changed: Euclidean distance.
- Changed: sse argument, replaced by wmode.
- Removed: u and v arguments.
- Removed: Ay and Sy.
- Removed: patchwise implementation.
- Removed: aa argument.
- Removed: legacy kernel.
- Updated: NVIDIA CUDA Toolkit v7.0.
- Updated: AVS 2.6.0 RC 3 [150419].

Thanks for the new version. I made a short script for testing that actually has some noise (you'll need AddGrainC (http://ldesoras.free.fr/src/avs/AddGrainC-1.7.0.7z)):
colorbars(width = 1920, height = 1080, pixel_type = "yv12").killaudio().assumefps(24000, 1001).trim(0,499)
AddGrainC(var = 100.0)
KNLMeansCL(D = 2, A = 1, h = 5.0)


My results:
[Graphics card info]
Card name: NVIDIA GeForce GT 240
GPU name: GT215
Memory size: 512
OpenCL version: OpenCL 1.0 CUDA
Driver version: 6.14.13.4052 (ForceWare 340.52) / XP

[Runtime info]
Frames processed: 500 (0 - 499)
FPS (min | max | average): 4.068 | 4.243 | 4.223
Memory usage (phys | virt): 141 | 139 MB
Thread count: 8
CPU usage (average): 25%
GPU usage (average): 97%
Video engine load (average): 0%
GPU memory usage: 92 MB
Time (elapsed): 00:01:58.399


Could you run this with your GTX760?

Khanattila
5th May 2015, 14:13
[Graphics card info]
Card name: NVIDIA GeForce GTX 760
GPU name: GK104
Memory size: 2048
OpenCL version: OpenCL 1.2 CUDA
Driver version: 9.18.13.5012 WHQL (ForceWare 350.12) / Win8.1 64

[Runtime info]
Frames processed: 500 (0 - 499)
FPS (min | max | average): 13.99 | 19.48 | 19.22
Memory usage (phys | virt): 165 | 180 MB
Thread count: 8
CPU usage (average): 25%
GPU usage (average): 90%
Video engine load (average): 0%
GPU memory usage: 307 MB
Time (elapsed): 00:00:26.013


Quite normal...
Iterations:= ((2*A+1)^2*(2*D+1)-1 / (D ? 1 : 2) = 44.

Khanattila
5th May 2015, 14:14
I got syntax error using this: KNLMeansCL (D(0),A(2),S(4),wmode(1), h(1.2,))
These are default values,strange

using this i get "plugin was designed for a later v. of avisynth" (i got the 2.6MT)

Y=KNLMeansCL(device_type="GPU")
U=UToY8().KNLMeansCL(device_type="GPU")
V=VToY8().KNLMeansCL(device_type="GPU")
YToUV (U, V, Y)
Probably the MT interface is out of date...
Correct syntax: KNLMeansCL(D=0,A=2,S=4,wmode=1, h=1.2).

Rumbah
5th May 2015, 14:58
Here the result with my GTX 970:

[General info]
Log file created with: AVSMeter 2.0.1 (x86)
Avisynth version: AviSynth 2.60, build:Mar 31 2015 [16:38:54] (2.6.0.6)
Avisynth DLL location: C:\Windows\SysWOW64\avisynth.dll
Plugin directory: C:\Program Files (x86)\AviSynth 2.5\plugins


[Clip info]
Number of frames: 500
Length (hh:mm:ss.ms): 00:00:20.854
Frame width: 1920
Frame height: 1080
Framerate: 23.976 (24000/1001)
Colorspace: YV12
Audio channels: n/a
Audio bits/sample: n/a
Audio sample rate: n/a
Audio samples: n/a


[Runtime info]
Frames processed: 500 (0 - 499)
FPS (min | max | average): 22.71 | 26.87 | 26.34
Memory usage (phys | virt): 191 | 196 MB
Thread count: 8
CPU usage (average): 12%
GPU usage (average): 89%
Video engine load (average): 0%
GPU memory usage: 568 MB
Time (elapsed): 00:00:18.984


[Script]
colorbars(width = 1920, height = 1080, pixel_type = "yv12").killaudio().assumefps(24000, 1001).trim(0,499)
AddGrainC(var = 100.0)
KNLMeansCL(D = 2, A = 1, h = 5.0)



[Graphics card info]
Card name: NVIDIA GeForce GTX 970
GPU name: GM204
Memory size: 4096
OpenCL version: OpenCL 1.2 CUDA
Driver version: 9.18.13.5012 WHQL (ForceWare 350.12) / Win8.1 64

Sparktank
6th May 2015, 01:33
Thanks for the update!

So I decided to give this a test.
I did not think to check the "info" argument to ensure it's using NVidia over Intel.
Alas after some sleep, I remembered to enable info argument.
Intel was being used and slowed the process significantly.

I should uninstall the Intel OpenCL as I don't believe anything really uses it or could benefit from using it when I have Nvidia.
The odd thing, however, is that I haven't installed any Intel OpenCL for a long time.
The very last/recent OpenCL driver I installed was the Nvidia driver update.
And I ensured it was a "clean install" for everything.

Just because I actually did a whole test run with the Intel OpenCL... (please print, laminate and enjoy this deprecated data)

[General info]
Log file created with: AVSMeter 2.0.1 (x86)
Avisynth version: AviSynth 2.60, build:Mar 31 2015 [16:38:54] (2.6.0.6)
Avisynth DLL location: C:\Windows\SysWOW64\avisynth.dll
Plugin directory: C:\Program Files (x86)\AviSynth\plugins

[Graphics card info]
# kind of useless as it doesn't stipulate the Intel info.
## Avsmeter only reported Nvidia while the script was actually using Intel.
### Taken from CPU-Z
Processor 1 ID = 0
Number of cores 4 (max 8)
Number of threads 4 (max 16)
Name Intel Core i5 2320
Codename Sandy Bridge
Specification Intel(R) Core(TM) i5-2320 CPU @ 3.00GHz
Package (platform ID) Socket 1155 LGA (0x1)

[Runtime info]
Frames processed: 500 (0 - 499)
FPS (min | max | average): 1.002 | 1.053 | 1.049
Memory usage (phys | virt): 231 | 214 MB
Thread count: 4
CPU usage (average): 99%
GPU usage (average): 0%
Video engine load (average): 0%
GPU memory usage: 58 MB
Time (elapsed): 00:07:56.864

in Internet Time, that's like a whole day gone...

Now with device_type="GPU":

[General info]
Log file created with: AVSMeter 2.0.1 (x86)
Avisynth version: AviSynth 2.60, build:Mar 31 2015 [16:38:54] (2.6.0.6)
Avisynth DLL location: C:\Windows\SysWOW64\avisynth.dll
Plugin directory: C:\Program Files (x86)\AviSynth\plugins

[Graphics card info]
Card name: NVIDIA GeForce GTX 750 Ti
GPU name: GM107
Memory size: 2048
OpenCL version: OpenCL 1.2 CUDA
Driver version: 9.18.13.5012 (ForceWare 350.12) / Win7 64

[Runtime info]
Frames processed: 500 (0 - 499)
FPS (min | max | average): 11.79 | 13.00 | 12.75
Memory usage (phys | virt): 188 | 194 MB
Thread count: 8
CPU usage (average): 25%
GPU usage (average): 92%
Video engine load (average): 0%
GPU memory usage: 131 MB
Time (elapsed): 00:00:39.203


FTR, when I didn't know I was using Intel, I tried 2605_MT, 2606_ICL, and then 2606_(vanilla).
All Intel runs would have been similar in runtime (~8min). I aborted after 100 frames as I knew something was wrong.
The printed results above for Intel was the 4th run and I decided to let it finish for posterity.

Next time I'll be quicker on the coffee. :cool:

Khanattila
6th May 2015, 11:59
Each platform is independent each-other. Intel does not affect Nvidia etc.
I worked thinking about how the GPU memory work.
Cpu side will be as fast as TNLMeans, maybe.

Anacletus
9th May 2015, 15:21
Hi Khanatilla,

maybe i'm doing something wrong but i cannot load the plugin in avisynth+.

Do i need to use classic avisynth?

tks
anac

Groucho2004
9th May 2015, 16:06
i cannot load the plugin in avisynth+
You'll have to elaborate on that a bit in order to get help.
- Post the full script.
- What do you use to load the script?
- Any error message?

BTW, the plugin works fine with AVS+.

Reel.Deel
9th May 2015, 17:51
i cannot load the plugin in avisynth+.

Are you using AviSynth r1576? if so update to r1825 (manual install (http://forum.doom9.org/showpost.php?p=1719768&postcount=1082) /// installer (http://forum.doom9.org/showpost.php?p=1719796&postcount=86)).

Khanattila
11th May 2015, 15:12
VapourSynth version...
http://www.mediafire.com/download/elci6dh5n8yyj2h/VS_KNLMeansCL.7z

feisty2
11th May 2015, 15:44
how about bringing "aa" parameter back to KNLMeansCL, I need it for artifacts removing

Khanattila
11th May 2015, 20:28
how about bringing "aa" parameter back to KNLMeansCL, I need it for artifacts removing

Removed. You may think that it is a big number.
Why removed? Useless.

Anacletus
11th May 2015, 20:57
You'll have to elaborate on that a bit in order to get help.
- Post the full script.
- What do you use to load the script?
- Any error message?

BTW, the plugin works fine with AVS+.
Sorry for the late reply, anyway this is my avisynth env:

[General Info - Avisynth.dll]
Version String: AviSynth+ 0.1 (r1576, x86)
File Version: 2.6.0.5
Directory: C:\Windows\system32
Timestamp: January 02, 2014, 19:14:26
MT Support: No

The script was really basic, just the source filter and this one. I simply receive this error:

Script error: There is no function named 'KNLMeansCL'.

I tried autoloading the plugin (as i usually do) and esplicitely invoking it by LoadPlugin("C:\Program Files (x86)\AviSynth+\plugins\KNLMeansCL.dll"). With the latter i get this exit code:

Cannot load file'C:/Program Files (x86)/AviSynth+/plugins/KNLMeansCL.dll'

Anyway:
Are you using AviSynth r1576? if so update to r1825 (manual install (http://forum.doom9.org/showpost.php?p=1719768&postcount=1082) /// installer (http://forum.doom9.org/showpost.php?p=1719796&postcount=86)).
That fixed everything, thanks both :)

Groucho2004
11th May 2015, 22:08
Sorry for the late reply, anyway this is my avisynth env:

[General Info - Avisynth.dll]
Version String: AviSynth+ 0.1 (r1576, x86)
File Version: 2.6.0.5
Directory: C:\Windows\system32
Timestamp: January 02, 2014, 19:14:26
MT Support: No

The script was really basic, just the source filter and this one. I simply receive this error:
Script error: There is no function named 'KNLMeansCL'.

This is odd. "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.

Wilbert
11th May 2015, 22:24
This is odd. "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.
He gets the message "There is no function named 'KNLMeansCL'.", so i think the process didn't get that far ...

Groucho2004
11th May 2015, 23:17
He gets the message "There is no function named 'KNLMeansCL'.", so i think the process didn't get that far ...
But why does it throw the expected error in my test?

feisty2
12th May 2015, 04:59
Removed. You may think that it is a big number.
Why removed? Useless.

Okay, then, if I'm understanding this correctly, with the same "h" you got the same overall denoise strength, and "aa" is some parameter about weighting, under the same "h", greater "aa" would give larger weights to dissimilar blocks and that's exactly what I need, cuz artifacts are obviously "dissimilar blocks", I need to keep "h" reasonable so it won't over denoise that much and a large "aa" to kick artifacts out from the image

yup
12th May 2015, 15:21
Hi Khanattila!
See my info
https://www.dropbox.com/s/6rve2jah62d4ye4/report.png?dl=0
Why my device do not support OpenCL 1.2?
Platform support 1.2.
At first post link for Nvidia driver do not work.
yup.

Khanattila
12th May 2015, 18:14
Okay, then, if I'm understanding this correctly, with the same "h" you got the same overall denoise strength, and "aa" is some parameter about weighting, under the same "h", greater "aa" would give larger weights to dissimilar blocks and that's exactly what I need, cuz artifacts are obviously "dissimilar blocks", I need to keep "h" reasonable so it won't over denoise that much and a large "aa" to kick artifacts out from the image
The similarity between two pixels i and j depends on the similarity between the neighbourhoods "S" centered at positions i and j.

This similarity is measured as a decreasing function of the weighted Euclidean distance: |v(Ni) - v(Nj)|^2, 2aa,
where "aa" > 0 is the standard deviation of the Gaussian kernel.

In the latest version I replaced it with a simple Euclidean distance because it not give real benefits... so "aa" is not more needed.

EDIT.
"h" controls the decay of the exponential function and therefore the decay of the weights as a function of the Euclidean distances.

Khanattila
12th May 2015, 18:18
Hi Khanattila!
See my info
https://www.dropbox.com/s/6rve2jah62d4ye4/report.png?dl=0
Why my device do not support OpenCL 1.2?
Platform support 1.2.
At first post link for Nvidia driver do not work.
yup.

It is correct. OpenCL has specific hardware requirements.
GPU code is compiled each time you start the plugin so the platform can be made compatible with older devices.

Wilbert
12th May 2015, 20:38
He gets the message "There is no function named 'KNLMeansCL'.", so i think the process didn't get that far ...
But why does it throw the expected error in my test?
In your case the plugin is loaded and in his case apparently not.

@Anacletus, in which autoloading plugin folder did you put this plugin (when you got the error above)? When happing if you call a different plugin from the same folder?

Groucho2004
12th May 2015, 21:19
In your case the plugin is loaded and in his case apparently not.
One scenario I can think of is that the newly installed version of AVS+ also installed the up to date version of the MS runtime DLLs which are also needed by KNLMeansCL.

Anacletus
21st May 2015, 09:36
@Anacletus, in which autoloading plugin folder did you put this plugin (when you got the error above)? When happing if you call a different plugin from the same folder?

The plugin is stored in this folder: C:\Program Files (x86)\AviSynth+\plugins, as evry other standard (non avs+) plugin. Of course all the other plugins autoload correctly.

As i said in my previous post, seems like the stable version of avisynth+ was the problem, intslling the version suggested by Reel.Deel solved this weird issue. :cool:

Khanattila
24th May 2015, 16:53
>>>> KNLMeansCL_v0.5.1.zip <<<< (http://www.mediafire.com/download/ndsl4x6zphb119f/KNLMeansCL_v0.5.1.zip)

ChangeLog

v0.5.1 (2015-05-24)
- Changed: merged VapourSynth branch.
- Updated: Boost 1.58.0


Finished.

Reel.Deel
25th May 2015, 12:55
Thank you for the 64-bit version! Just tried it with AviSynth+ :cool:

I noticed that the u/v parameters are no more and only the luma channel gets processed :(. Why is that? I sometimes process the chroma channels with different settings depending on the noise on that particular channel and the u/v parameters came in handy for that. No worries though, I'll write my own little function to accomplish just that.

Khanattila
25th May 2015, 15:05
Thank you for the 64-bit version! Just tried it with AviSynth+ :cool:

I noticed that the u/v parameters are no more and only the luma channel gets processed :(. Why is that? I sometimes process the chroma channels with different settings depending on the noise on that particular channel and the u/v parameters came in handy for that. No worries though, I'll write my own little function to accomplish just that.

YUV do not exist for OpenCL. Only LUMINACE/INTENSITY or RGBA.
So YUV was treated as three different LUMINANCE/INTENSITY.
Call three times KNLMeansCL give you the same performance.

However, you have problems with AVS + 64bit?

Reel.Deel
25th May 2015, 15:16
YUV do not exist for OpenCL. Only LUMINACE/INTENSITY or RGBA.
So YUV was treated as three different LUMINANCE/INTENSITY.
Call three times KNLMeansCL give you the same performance.

However, you have problems with AVS + 64bit?

Thanks for the info, I'll probably make a little function and post it here since it might be useful for other people also.
Regarding 64-bit avs+, it's working fine but I haven't test it thoroughly yet but if I encounter any problems I'll report back.

Khanattila
25th May 2015, 15:26
Thanks for the info, I'll probably make a little function and post it here since it might be useful for other people also.
Regarding 64-bit avs+, it's working fine but I haven't test it thoroughly yet but if I encounter any problems I'll report back.


function KNLMeansCLYUV(clip c, int "Dy", int "Ay", int "Sy", int "wmodey", float "hy", int "Dc", int "Ac", int "Sc", int "wmodec", float "hc", string "device_type", bool "lsb_inout", bool "info") {
Dc = Default(Dc, 0)
Ac = Default(Ac, 2)
Sc = Default(Sc, 4)
wmodec = Default(wmodec, 1)
hc = Default(hc, 1.2)
y = KNLMeansCL(c, Dy, Ay, Sy, wmodey, hy, device_type, lsb_inout, info)
u = UtoY8(c).KNLMeansCL(Dc, Ac, Sc, wmodec, hc, device_type, lsb_inout)
v = VToY8(c).KNLMeansCL(Dc, Ac, Sc, wmodec, hc, device_type, lsb_inout)
YToUV(u, v, y)
}

Horrible.

Reel.Deel
25th May 2015, 15:32
Yeah, with all those parameters is not very elegant but it's usable and serves a purpose, thanks Khanattila.

Khanattila
26th May 2015, 15:33
>>>> KNLMeansCL_v0.5.2.zip <<<< (http://www.mediafire.com/download/ce8c5zcime9plzo/KNLMeansCL_v0.5.2.zip)

ChangeLog

v0.5.2 (2015-05-24)
- Changed: AVS+ header
- Changed: Removed Boost Library
- Fixed: VapourSynth memory leak.

feisty2
30th May 2015, 12:40
vaporsynth branch looks very wrong...

xxsource("whatever")
converttoy8 ()
KNLMeansCL (a=2,s=0,h=24)

http://i.imgur.com/ua5c8yg.png

import vapoursynth as vs
core = vs.get_core()
clp = whatever
clp = core.std.ShufflePlanes(clp, planes=0, colorfamily=vs.GRAY)
clp = core.fmtc.bitdepth(clp, fulls=False, fulld=True, bits=32, flt=True)
nlm = core.knlm.KNLMeansCL (clp,a=2,s=0,h=24)
nlm.set_output ()

http://i.imgur.com/0cpqLCI.png

feisty2
31st May 2015, 14:01
did some tests, guess "d" "a" and "s" don't work in vaporsynth branch, you set them to any value, you always get the same result, only "h" and "wmode" work

Khanattila
31st May 2015, 14:47
did some tests, guess "d" "a" and "s" don't work in vaporsynth branch, you set them to any value, you always get the same result, only "h" and "wmode" work
Hi feisty2, thanks for your report. This is only a regression, settled quickly.

Try this for better accuracy with 32-bits, despite some hardware limitations...

>>>> KNLMeansCL_v0.5.3.zip <<<< (http://www.mediafire.com/download/7qj250uva3i99da/KNLMeansCL_v0.5.3.zip)

ChangeLog

v0.5.3 (2015-05-31)
- Changed: Better accuracy with 32-bits
- Fixed: VapourSynth regression (v0.5.2)

feisty2
31st May 2015, 15:19
vaporsynth branch works now, thx 4 ur work :)

noisyfart
4th June 2015, 10:58
Hi there, noob here.
How can I combine this nice filter with DitherTools? I want to resize and denoise 1080p (from BD) like this:
Dither_convert_8_to_16()
Dither_resize16nr(1280, 720)
KNLMeansCL(D = 2, A = 1, n = 1.5, lsb_inout = true)
DitherPost()

Or, alternatively, denoise before resizing:
Dither_convert_8_to_16()
KNLMeansCL(D = 2, A = 1, n = 1.5, lsb_inout = true)
Dither_resize16nr(1280, 720)
DitherPost()

I'm getting weird artifacts with these scripts. I'm sure i'm doing something fundamentally wrong. :o

noisyfart
5th June 2015, 11:26
The artefacts only appear when KNLMeansCL works in temporal mode (D > 0).
This script:
Dither_convert_8_to_16()
KNLMeansCL(D = 0, A = 3, h = 2.4, lsb_inout = true)
f3kdb(sample_mode = 2, keep_tv_range = true, input_mode = 1, output_mode = 1)
DitherPost(mode = 6)

looks fine:
http://s15.postimg.org/nq917w3ln/spatial.png

With these KNLMeansCL parameters:
D = 2, A = 1, h = 3.4
it looks like this:
http://s28.postimg.org/jy2nrcxa5/temporal.png

Khanattila
6th June 2015, 14:30
Hi there, noob here.
How can I combine this nice filter with DitherTools? I want to resize and denoise 1080p (from BD) like this:
Dither_convert_8_to_16()
Dither_resize16nr(1280, 720)
KNLMeansCL(D = 2, A = 1, n = 1.5, lsb_inout = true)
DitherPost()

Or, alternatively, denoise before resizing:
Dither_convert_8_to_16()
KNLMeansCL(D = 2, A = 1, n = 1.5, lsb_inout = true)
Dither_resize16nr(1280, 720)
DitherPost()

I'm getting weird artifacts with these scripts. I'm sure i'm doing something fundamentally wrong. :o

Both solutions work. It really depends on the content.

Khanattila
6th June 2015, 14:46
However this is a bug. Thanks for the tip.

>>>> KNLMeansCL_v0.5.4.zip <<<< (http://www.mediafire.com/download/qoop11de7u95na3/KNLMeansCL_v0.5.4.zip)

ChangeLog

v0.5.4 (2015-06-06)
- Fixed: AviSynth temporal support with 16-bits clip.

noisyfart
6th June 2015, 15:10
Thanks for the fix!

Pulp Catalyst
10th June 2015, 13:10
Hi, version 0.5.0 is fine,

but version 0.5.x is always giving me same error.

opencl device not found,

if i go back to version 0.5.0, all is good.

the script is as follows

KNLMeansCL (D=2, A=1, h=1.2, device_type="GPU")

was the format changed or something, i have read the read me....but it's unfortunate that there are no included examples inside the text document.

it's strange that 0.5.0 everything is good, but all other versions the openCL device never gets found???

Regards,

p.s going back to 0.5.0

Khanattila
12th June 2015, 11:26
1) What graphics card do you have?
2) Have you tried device_type="default"?
2a) If it works, share a screen with info=true?
Thanks!

Pulp Catalyst
15th June 2015, 19:50
hi, i have a gtx 760, the default gpu is the internal intel hd4000, the GPU is the gtx....

i till wait until further versions come out, i have tried different situations, all versions after 0.5.0 all do the same.

i use MeGUI and my default script is as follows,

global MeGUI_darx = 40
global MeGUI_dary = 17
SetMemoryMax(1024)
SetMTMode(5,2)
LoadPlugin("D:\Program Files (x86)\MeGUInew\tools\dgindexnv\DGDecodeNV.dll")
DGSource("E:\MeGUI\rsxyxu0x.yip\05 You only live twice (1967).dgi",fieldop=0)
SetMTMode(5,0)
KNLMeansCL(D=2, A=1, h=1.2, device_type="GPU")
SetMTMode(2)
#deinterlace
#crop
#resize
#denoise


when i replace KNLMeansCL with newer versions i get errors.

i do also use DGDecodeNV.... not sure if have any bearings???

thanks,

Khanattila
16th June 2015, 09:31
Imo this gives you problems: SetMTMode(5,0).
* Mode 5 is slowest (slower than not using SetMTMode) but should work with all filters that don't require linear frameserving (that is, the frames come in order (frame 0,1,2 ... last)).
* Threads. Set to 0 to set it to the number of processors available.

So you're calling four or eight times KNLMeansCL. Set threads=1.
Really, you do not need to use MT for OpenCL / CUDA plugin.

Groucho2004
16th June 2015, 09:43
Imo this gives you problems: SetMTMode(5,0).
* Mode 5 is slowest (slower than not using SetMTMode) but should work with all filters that don't require linear frameserving (that is, the frames come in order (frame 0,1,2 ... last)).
* Threads. Set to 0 to set it to the number of processors available.

So you're calling four or eight times KNLMeansCL. Set threads=1.
Really, you do not need to use MT for OpenCL / CUDA plugin.
Nope. The first call of SetMTMode(x, n) sets the number of threads (n). Any subsequent change of "n" will be ignored.

He should try a simple script without MT calls, post the "info" screen as you requested and be more verbose than "with newer versions i get errors".

Khanattila
16th June 2015, 21:02
Nope. The first call of SetMTMode(x, n) sets the number of threads (n). Any subsequent change of "n" will be ignored.

He should try a simple script without MT calls, post the "info" screen as you requested and be more verbose than "with newer versions i get errors".

Ah! It's even worse than I thought! Really.... why use MT?

Groucho2004
16th June 2015, 23:01
Really.... why use MT?
Beats me.

Pulp Catalyst
17th June 2015, 11:34
the script was created very carefully a long time ago now using the amazing tool "AVSMeter" (currently using 1.98)

in the learning process, i found some things to follow.

1. to use as little of the CPU as possible so to maximize available resources to the encoder
2. to stabilize the CPU usage of 1 or 2 cores so the pipeline going to the encoder is constant and consistent (i don't want flucutations of the CPU)
3. to use as little threads as possible, this helps with (1) and (2)
4. to make sure the GPU is feeding enough data (decoding video) quick enough to maximize the encoder FPS (this was a little tricky now i'm using x265, but fortunately my GPU can just about decode enough video for x265 to use max CPU 9accept for the 1core that needs to be given up for nvidia).

if i don't use MT, i get an avereage FPS in AVSMeter 16.76
with MT i get 18.92

now if i use
global MeGUI_darx = 40
global MeGUI_dary = 17
SetMemoryMax(1024)
SetMTMode(5,2)
LoadPlugin("D:\Program Files (x86)\MeGUInew\tools\dgindexnv\DGDecodeNV.dll")
DGSource("E:\MeGUI\rsxyxu0x.yip\05 You only live twice (1967).dgi",fieldop=0)
SetMTMode(5,1)
KNLMeansCL(D=2, A=1, h=1.2, device_type="GPU")
SetMTMode(2)
#deinterlace
#crop
#resize
#denoise

my FPS goes to 20.82 (faster),
however what i found a long time ago is the thread count goes from 13 to 19, and AVSMeter shows the CPU usage of the 1st core becomes erratic, bouncing from 8% to 17% which is strange because i don't ever get over 13% when using the script i have above (with hyper-threading i have 8 cores)

my real live results showed that the x264 or now x265 encoder gives much inferior results when this behaviour is exhibited, however when using the script that utilizes only 13 threads and the CPU usage remains nice and steady at 13%.... the encoder gives far better performance.

i remember spending a very long time finding a really good balance between CPU/GPU (my specific hardware) and getting this to work smoothly with the encoder (this was a tricky part).

AVSMeter helped me stabilize the efficiency of the flow chain, x264/x265 FPS showed me actual performance gains (sometimes getting more speed from AVSMeter actually hurt performance from the encoder, i believe this is because of the erratic behaviour that happens when i take the thread count from 13 to 19)

i won't pretend to understand what is going on behind the scenes with AVISynth MT, because i don't at all. However real live results and analysis of performance told me when i found the "SWEET SPOT", the script may look odd, and to some not make any sense...clearly, but it gives me the best performance and balance on my RIG... and this is much more important to me then things making sense...

anyway.... moving forward, i'm still at a lost why

Version 0.5.1
Version 0.5.2
Version 0.5.3
Version 0.5.4

all gives me the same error, OpenCL device not found, however Version 0.5.0 works perfectly???

But i'm sure time will answer this dilemma...

anyway thank you all for your feed back, i always appreciate feedback off all kind.

Groucho2004
17th June 2015, 12:04
global MeGUI_darx = 40
global MeGUI_dary = 17
SetMemoryMax(1024)
SetMTMode(5,2)
LoadPlugin("D:\Program Files (x86)\MeGUInew\tools\dgindexnv\DGDecodeNV.dll")
DGSource("E:\MeGUI\rsxyxu0x.yip\05 You only live twice (1967).dgi",fieldop=0)
SetMTMode(5,1)
KNLMeansCL(D=2, A=1, h=1.2, device_type="GPU")
SetMTMode(2)
#deinterlace
#crop
#resize
#denoise
That script doesn't even work, it does not return a clip because "SetMTMode(2)" is the last statement.

The "SetMTMode(5,1)" is completely pointless (since you can't change the number of threads after the first call) as is "SetMTMode(2)" at the end.

I tried your script with and without MT (adding "return last" at the end to get it to work), the speed difference in AVSMeter is virtually zero. If you understood how AVS MT works or read the documentation you would know that this is the expected result.

Khanattila
17th June 2015, 17:34
anyway.... moving forward, i'm still at a lost why

Version 0.5.1
Version 0.5.2
Version 0.5.3
Version 0.5.4

all gives me the same error, OpenCL device not found, however Version 0.5.0 works perfectly???

But i'm sure time will answer this dilemma...

anyway thank you all for your feed back, i always appreciate feedback off all kind.

Because Version 0.5.* != 0.5.0. In Version 0.5.1 I rewrote a lot of things...
Anyway I have a GTX 760, then it should work.

Khanattila
25th June 2015, 18:08
>>>> KNLMeansCL_v0.5.5.zip <<<< (http://www.mediafire.com/download/0h0cuii38ecoyh4/KNLMeansCL_v0.5.5.zip)

ChangeLog

v0.5.5 (2015-06-25)
- New: AviSynth RGB32 support.


VS takes longer.

Khanattila
25th June 2015, 18:31
#RGB32
Colorbars(1920, 1080, "RGB32").KillAudio().KNLMeansCL()

#YV24
Colorbars(1920, 1080, "YV24").KillAudio()
y = KNLMeansCL()
u = UToY8().KNLMeansCL()
v = VToY8().KNLMeansCL()
YToUV(u, v, y)

#YV12
Colorbars(1920, 1080, "YV12").KillAudio()
y = KNLMeansCL()
u = UToY8().KNLMeansCL()
v = VToY8().KNLMeansCL()
YToUV(u, v, y)

#Y8
Colorbars(1920, 1080, "YV12").KillAudio()


RGB32 ----- 46.36 FPS
YV24 ------ 22.49 FPS
YV12 ------ 43.58 FPS
Y8--------- 68.98 FPS

GPU architecture. Lovable.

RazorBurn
26th June 2015, 09:24
Does KNLMeansCL support Temporal in Vapoursynth?

Got Error on this

clip = core.knlm.KNLMeansCL (clip = clip, d=1, a=0, h=5.4, device_type="GPU") ##KNLMeans Temporal Medium


clip = core.knlm.KNLMeansCL (clip = clip, d=1, a=1, h=4.5, device_type="GPU") ##KNLMeans Spatio-Temporal Medium


Yet no Error on this

clip = core.knlm.KNLMeansCL (clip = clip, d=0, a=4, h=3.6, device_type="GPU") ##KNLMeans Spatial Medium

Khanattila
26th June 2015, 09:54
Does KNLMeansCL support Temporal in Vapoursynth?

Got Error on this

clip = core.knlm.KNLMeansCL (clip = clip, d=1, a=0, h=5.4, device_type="GPU") ##KNLMeans Temporal Medium


clip = core.knlm.KNLMeansCL (clip = clip, d=1, a=1, h=4.5, device_type="GPU") ##KNLMeans Spatio-Temporal Medium


Yet no Error on this

clip = core.knlm.KNLMeansCL (clip = clip, d=0, a=4, h=3.6, device_type="GPU") ##KNLMeans Spatial Medium



I have to investigate, some more details?

tormento
26th June 2015, 11:07
Latest version finding OpenCL device (Nvidia GTX 760) is 0.5.0, latest driver version on Win 8.1_x64.

RazorBurn
26th June 2015, 11:33
I have to investigate, some more details?

Script ==>
import vapoursynth as vs
core = vs.get_core()
core.std.LoadPlugin(r'C:\Apps\Encoders\StaxRip\Apps\Plugins\both\ffms2\ffms2.dll')
clip = core.ffms2.Source(source = r'C:\Temp\Media\SampleClip.mpg', cachefile = r'C:\Temp\Media\SampleClip temp files\SampleClip.ffindex')
clip = core.knlm.KNLMeansCL (clip = clip, d=1, a=1, h=4.5, device_type="GPU")
clip.set_output()


CMD Line ==

vspipe.exe" "C:\Temp\Media\SampleClip temp files\SampleClip.vpy" - --y4m | x264.exe --crf 22 --demuxer y4m --frames 59 --output "C:\Temp\Media\SampleClip temp files\SampleClip_out.h264" "-"

Error Log ==

Negative frame request by: Cache1
x264 [error]: could not open input file `-'

SampleClip (From NeatVideo) ==

https://www.neatvideo.com/files4/testkit.zip

Khanattila
26th June 2015, 16:09
It should fix everything.

>>>> KNLMeansCL_v0.5.6.zip <<<< (http://www.mediafire.com/download/plzsx3i46yp3d0g/KNLMeansCL_v0.5.6.zip)

ChangeLog

v0.5.6 (2015-06-26)
- Fixed: VapourSynth temporal support (regression v0.5.2)
- Fixed: VapourSynth device_type ignored.
- Fixed: Possible opencl device not available.

Monarc
26th June 2015, 18:18
Hi,

i tried to use your filter 0.5.6 with vapoursynth under linux.

It compiles after some small changes, but vapoursynth stops with errors.

vs script:


import vapoursynth as vs
core = vs.get_core()

file="/home/monarc/Downloads/test.mp4"
clip = core.ffms2.Source(source=file)

clip = core.knlm.KNLMeansCL (clip = clip, d=0, a=4, h=3.6, info=True)
clip.set_output()


vapoursynth error:


Failed to evaluate the script:
Python exception: knlm.KNLMeansCL: VapourSynthCreate error (1)!
Traceback (most recent call last):
File "vapoursynth.pyx", line 1469, in vapoursynth.vpy_evaluateScript (src/cython/vapoursynth.c:23703)
File "/home/monarc/filters/filters.vpy", line 50, in <module>
clip = core.knlm.KNLMeansCL (clip = clip, d=0, a=4, h=3.6, info=True)
File "vapoursynth.pyx", line 1368, in vapoursynth.Function.__call__ (src/cython/vapoursynth.c:22272)
vapoursynth.Error: knlm.KNLMeansCL: VapourSynthCreate error (1)!


KNLMeansCL.txt

<kernel>:90:40: error: invalid digit 'f' in decimal constant
(NLMK_WMODE == 2) ? fmax(1.0f -sum * NLMK_H2_INV_NORM, 0.0f) * fmax(1.0f -sum * NLMK_H2_INV_NORM, 0.0f) :
^
<built-in>:31:35: note: expanded from here
#define NLMK_H2_INV_NORM 61,942730f
^
<kernel>:90:83: error: invalid digit 'f' in decimal constant
(NLMK_WMODE == 2) ? fmax(1.0f -sum * NLMK_H2_INV_NORM, 0.0f) * fmax(1.0f -sum * NLMK_H2_INV_NORM, 0.0f) :
^
<built-in>:31:35: note: expanded from here
#define NLMK_H2_INV_NORM 61,942730f
^
<kernel>:91:41: error: invalid digit 'f' in decimal constant
(NLMK_WMODE == 1) ? native_exp(-sum * NLMK_H2_INV_NORM) :
^
<built-in>:31:35: note: expanded from here
#define NLMK_H2_INV_NORM 61,942730f
^
<kernel>:92:29: error: invalid digit 'f' in decimal constant
native_recip(1.0f + sum * NLMK_H2_INV_NORM);
^
<built-in>:31:35: note: expanded from here
#define NLMK_H2_INV_NORM 61,942730f
^
^@^@


I am not sure, if this is even possible with my card:


clinfo --help
Number of platforms: 1
Platform Profile: FULL_PROFILE
Platform Version: OpenCL 1.2 CUDA 7.5.9
Platform Name: NVIDIA CUDA
Platform Vendor: NVIDIA Corporation
Platform Extensions: cl_khr_byte_addressable_store cl_khr_icd cl_khr_gl_sharing cl_nv_compiler_options cl_nv_device_attribute_query cl_nv_pragma_unroll cl_nv_copy_opts


Platform Name: NVIDIA CUDA
Number of devices: 1
Device Type: CL_DEVICE_TYPE_GPU
Device ID: 4318
Max compute units: 8
Max work items dimensions: 3
Max work items[0]: 1024
Max work items[1]: 1024
Max work items[2]: 64
Max work group size: 1024
Preferred vector width char: 1
Preferred vector width short: 1
Preferred vector width int: 1
Preferred vector width long: 1
Preferred vector width float: 1
Preferred vector width double: 1
Native vector width char: 1
Native vector width short: 1
Native vector width int: 1
Native vector width long: 1
Native vector width float: 1
Native vector width double: 1
Max clock frequency: 1760Mhz
Address bits: 64
Max memory allocation: 268222464
Image support: Yes
Max number of images read arguments: 128
Max number of images write arguments: 8
Max image 2D width: 16384
Max image 2D height: 16384
Max image 3D width: 2048
Max image 3D height: 2048
Max image 3D depth: 2048
Max samplers within kernel: 16
Max size of kernel argument: 4352
Alignment (bits) of base address: 4096
Minimum alignment (bytes) for any datatype: 128
Single precision floating point capability
Denorms: Yes
Quiet NaNs: Yes
Round to nearest even: Yes
Round to zero: Yes
Round to +ve and infinity: Yes
IEEE754-2008 fused multiply-add: Yes
Cache type: Read/Write
Cache line size: 128
Cache size: 131072
Global memory size: 1072889856
Constant buffer size: 65536
Max number of constant args: 9
Local memory type: Local
Local memory size: 49152
Error correction support: 0
Unified memory for Host and Device: 0
Profiling timer resolution: 1000
Device endianess: Little
Available: Yes
Compiler available: Yes
Execution capabilities:
Execute OpenCL kernels: Yes
Execute native function: No
Queue properties:
Out-of-Order: Yes
Profiling : Yes
Platform ID: 0x234f7f0
Name: GeForce GTX 560 Ti
Vendor: NVIDIA Corporation
Device OpenCL C version: OpenCL C 1.1
Driver version: 352.21
Profile: FULL_PROFILE
Version: OpenCL 1.1 CUDA
Extensions: cl_khr_byte_addressable_store cl_khr_icd cl_khr_gl_sharing cl_nv_compiler_options cl_nv_device_attribute_query cl_nv_pragma_unroll cl_nv_copy_opts cl_khr_global_int32_base_atomics cl_khr_global_int32_extended_atomics cl_khr_local_int32_base_atomics cl_khr_local_int32_extended_atomics cl_khr_fp64

Khanattila
26th June 2015, 19:46
Can you tell me what you had to change? So I implement them.
However, it is a stupid mistake. Just do not use TAB with snprintf. Or just do not break line ("\").

if (channel == CL_FLOAT) {
snprintf(options, 2048, "-Werror -D H_BLOCK_X=%i -D H_BLOCK_Y=%i -D V_BLOCK_X=%i -D V_BLOCK_Y=%i -D NLMK_RGB=%i -D NLMK_S=%i -D NLMK_WMODE=%i -D NLMK_TEMPORAL=%i -D NLMK_H2_INV_NORM=%ff",
H_BLOCK_X, H_BLOCK_Y, V_BLOCK_X, V_BLOCK_Y, 0, d.s, d.wmode, d.d, 65025.0 / (d.h*d.h*(2 * d.s + 1) * (2 * d.s + 1)));
} else {
snprintf(options, 2048, "-cl-denorms-are-zero -cl-fast-relaxed-math -Werror -D H_BLOCK_X=%i -D H_BLOCK_Y=%i -D V_BLOCK_X=%i -D V_BLOCK_Y=%i -D NLMK_RGB=%i -D NLMK_S=%i -D NLMK_WMODE=%i -D NLMK_TEMPORAL=%i -D NLMK_H2_INV_NORM=%ff",
H_BLOCK_X, H_BLOCK_Y, V_BLOCK_X, V_BLOCK_Y, 0, d.s, d.wmode, d.d, 65025.0 / (d.h*d.h*(2 * d.s + 1) * (2 * d.s + 1)));
}

Monarc
26th June 2015, 21:18
Does not change much ... maybe i do something wrong.

Even with all changes, vapoursynth error remains the same.

KNLMeansCL.txt:

<kernel>:90:40: error: invalid digit 'f' in decimal constant
(NLMK_WMODE == 2) ? fmax(1.0f -sum * NLMK_H2_INV_NORM, 0.0f) * fmax(1.0f -sum * NLMK_H2_INV_NORM, 0.0f) :
^
<built-in>:31:35: note: expanded from here
#define NLMK_H2_INV_NORM 61,942730f
^
<kernel>:90:83: error: invalid digit 'f' in decimal constant
(NLMK_WMODE == 2) ? fmax(1.0f -sum * NLMK_H2_INV_NORM, 0.0f) * fmax(1.0f -sum * NLMK_H2_INV_NORM, 0.0f) :
^
<built-in>:31:35: note: expanded from here
#define NLMK_H2_INV_NORM 61,942730f
^
<kernel>:91:41: error: invalid digit 'f' in decimal constant
(NLMK_WMODE == 1) ? native_exp(-sum * NLMK_H2_INV_NORM) :
^
<built-in>:31:35: note: expanded from here
#define NLMK_H2_INV_NORM 61,942730f
^
<kernel>:92:29: error: invalid digit 'f' in decimal constant
native_recip(1.0f + sum * NLMK_H2_INV_NORM);
^
<built-in>:31:35: note: expanded from here
#define NLMK_H2_INV_NORM 61,942730f



to compile under linux, i tried this line:


clang++-3.7 -o ../KNLMeansCL.so -std=c++11 -O3 -march=native -mtune=native -I/usr/local/include/vapoursynth -shared -fPIC -lOpenCL KNLMeansCL.cpp


in KNLMeansCL.h:

i wrapped #include "avisynth.h" with #ifdef _WIN32
and added #include "math.h" for ceil

in KNLMeansCL.cpp:
added a space between " Version " VERSION in line 454


diff -r -u3 KNLMeansCL/src/KNLMeansCL.cpp KNLMeansCL.patch/src/KNLMeansCL.cpp
--- KNLMeansCL/src/KNLMeansCL.cpp 2015-06-26 16:31:48.000000000 +0200
+++ KNLMeansCL.patch/src/KNLMeansCL.cpp 2015-06-26 21:37:16.362359041 +0200
@@ -324,7 +324,7 @@
int pitch = dst->GetPitch(PLANAR_Y);
char buffer[2048], str[2048], str1[2048];
DrawString(frm, pitch, 0, y++, "KNLMeansCL");
- DrawString(frm, pitch, 0, y++, " Version "VERSION);
+ DrawString(frm, pitch, 0, y++, " Version " VERSION);
DrawString(frm, pitch, 0, y++, " Copyright(C) Khanattila");
snprintf(buffer, 2048, " D:%i A:%ix%i S:%ix%i", 2 * D + 1, 2 * A + 1, 2 * A + 1, 2 * S + 1, 2 * S + 1);
DrawString(frm, pitch, 0, y++, buffer);
@@ -451,7 +451,7 @@
int pitch = vsapi->getStride(dst, 0);
char buffer[2048], str[2048], str1[2048];
DrawString(frm, pitch, 0, y++, "KNLMeansCL");
- DrawString(frm, pitch, 0, y++, " Version "VERSION);
+ DrawString(frm, pitch, 0, y++, " Version " VERSION);
DrawString(frm, pitch, 0, y++, " Copyright(C) Khanattila");
snprintf(buffer, 2048, " D:%i A:%ix%i S:%ix%i", 2 * d->d + 1, 2 * d->a + 1, 2 * d->a + 1, 2 * d->s + 1, 2 * d->s + 1);
DrawString(frm, pitch, 0, y++, buffer);
@@ -703,15 +703,9 @@
d.program = clCreateProgramWithSource(d.context, 1, &source_code, NULL, NULL);
char options[2048];
if (channel == CL_FLOAT) {
- snprintf(options, 2048, "-Werror \
- -D H_BLOCK_X=%i -D H_BLOCK_Y=%i -D V_BLOCK_X=%i -D V_BLOCK_Y=%i \
- -D NLMK_RGB=%i -D NLMK_S=%i -D NLMK_WMODE=%i -D NLMK_TEMPORAL=%i -D NLMK_H2_INV_NORM=%ff",
- H_BLOCK_X, H_BLOCK_Y, V_BLOCK_X, V_BLOCK_Y, 0, d.s, d.wmode, d.d, 65025.0 / (d.h*d.h*(2 * d.s + 1) * (2 * d.s + 1)));
+ snprintf(options, 2048, "-Werror -D H_BLOCK_X=%i -D H_BLOCK_Y=%i -D V_BLOCK_X=%i -D V_BLOCK_Y=%i -D NLMK_RGB=%i -D NLMK_S=%li -D NLMK_WMODE=%li -D NLMK_TEMPORAL=%li -D NLMK_H2_INV_NORM=%ff",H_BLOCK_X, H_BLOCK_Y, V_BLOCK_X, V_BLOCK_Y, 0, d.s, d.wmode, d.d, 65025.0 / (d.h*d.h*(2 * d.s + 1) * (2 * d.s + 1)));
} else {
- snprintf(options, 2048, "-cl-denorms-are-zero -cl-fast-relaxed-math -Werror \
- -D H_BLOCK_X=%i -D H_BLOCK_Y=%i -D V_BLOCK_X=%i -D V_BLOCK_Y=%i \
- -D NLMK_RGB=%i -D NLMK_S=%i -D NLMK_WMODE=%i -D NLMK_TEMPORAL=%i -D NLMK_H2_INV_NORM=%ff",
- H_BLOCK_X, H_BLOCK_Y, V_BLOCK_X, V_BLOCK_Y, 0, d.s, d.wmode, d.d, 65025.0 / (d.h*d.h*(2 * d.s + 1) * (2 * d.s + 1)));
+ snprintf(options, 2048, "-cl-denorms-are-zero -cl-fast-relaxed-math -Werror -D H_BLOCK_X=%i -D H_BLOCK_Y=%i -D V_BLOCK_X=%i -D V_BLOCK_Y=%i -D NLMK_RGB=%i -D NLMK_S=%li -D NLMK_WMODE=%li -D NLMK_TEMPORAL=%li -D NLMK_H2_INV_NORM=%ff",H_BLOCK_X, H_BLOCK_Y, V_BLOCK_X, V_BLOCK_Y, 0, d.s, d.wmode, d.d, 65025.0 / (d.h*d.h*(2 * d.s + 1) * (2 * d.s + 1)));
}
ret = clBuildProgram(d.program, 1, &d.deviceID, options, NULL, NULL);
if (ret != CL_SUCCESS) {

diff -r -u3 KNLMeansCL/src/KNLMeansCL.h KNLMeansCL.patch/src/KNLMeansCL.h
--- KNLMeansCL/src/KNLMeansCL.h 2015-06-26 16:32:42.000000000 +0200
+++ KNLMeansCL.patch/src/KNLMeansCL.h 2015-06-26 18:52:07.686612969 +0200
@@ -31,7 +31,10 @@
#include <CL/cl.h>
#include "kernel.h"
#include "startchar.h"
+#ifdef _WIN32
#include "avisynth.h"
+#endif
+#include "math.h"
#include "VapourSynth.h"
#include "VSHelper.h"



then it compiles (with warnings):


clang++-3.7 -ferror-limit=0 -o ../KNLMeansCL.so -std=c++11 -O3 -march=native -mtune=native -I/usr/local/include/vapoursynth -shared -fPIC -lOpenCL KNLMeansCL.cpp
KNLMeansCL.cpp:397:60: warning: implicit conversion of NULL constant to 'cl_uint' (aka 'unsigned int') [-Wnull-conversion]
vsapi->getStride(src, 0), 0, vsapi->getReadPtr(src, 0), NULL, NULL, NULL);
^~~~
0
KNLMeansCL.cpp:405:36: warning: implicit conversion of NULL constant to 'cl_uint' (aka 'unsigned int') [-Wnull-conversion]
0, vsapi->getReadPtr(src, 0), NULL, NULL, NULL);
^~~~
0
KNLMeansCL.cpp:439:35: warning: implicit conversion of NULL constant to 'cl_uint' (aka 'unsigned int') [-Wnull-conversion]
0, vsapi->getWritePtr(dst, 0), NULL, NULL, NULL);
^~~~
0
KNLMeansCL.cpp:456:54: warning: format specifies type 'int' but the argument has type 'long' [-Wformat]
snprintf(buffer, 2048, " D:%i A:%ix%i S:%ix%i", 2 * d->d + 1, 2 * d->a + 1, 2 * d->a + 1, 2 * d->s + 1, 2 * d->s + 1);
~~ ^~~~~~~~~~~~
%li
KNLMeansCL.cpp:456:68: warning: format specifies type 'int' but the argument has type 'long' [-Wformat]
snprintf(buffer, 2048, " D:%i A:%ix%i S:%ix%i", 2 * d->d + 1, 2 * d->a + 1, 2 * d->a + 1, 2 * d->s + 1, 2 * d->s + 1);
~~ ^~~~~~~~~~~~
%li
KNLMeansCL.cpp:456:82: warning: format specifies type 'int' but the argument has type 'long' [-Wformat]
snprintf(buffer, 2048, " D:%i A:%ix%i S:%ix%i", 2 * d->d + 1, 2 * d->a + 1, 2 * d->a + 1, 2 * d->s + 1, 2 * d->s + 1);
~~ ^~~~~~~~~~~~
%li
KNLMeansCL.cpp:456:96: warning: format specifies type 'int' but the argument has type 'long' [-Wformat]
snprintf(buffer, 2048, " D:%i A:%ix%i S:%ix%i", 2 * d->d + 1, 2 * d->a + 1, 2 * d->a + 1, 2 * d->s + 1, 2 * d->s + 1);
~~ ^~~~~~~~~~~~
%li
KNLMeansCL.cpp:456:110: warning: format specifies type 'int' but the argument has type 'long' [-Wformat]
snprintf(buffer, 2048, " D:%i A:%ix%i S:%ix%i", 2 * d->d + 1, 2 * d->a + 1, 2 * d->a + 1, 2 * d->s + 1, 2 * d->s + 1);
~~ ^~~~~~~~~~~~
%li
KNLMeansCL.cpp:458:46: warning: format specifies type 'int' but the argument has type 'long' [-Wformat]
snprintf(buffer, 2048, " Iterations: %i", ((2 * d->d + 1)*(2 * d->a + 1)*(2 * d->a + 1) - 1) / (d->d ? 1 : 2));
~~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
%li
KNLMeansCL.cpp:460:55: warning: format specifies type 'int' but the argument has type 'size_t' (aka 'unsigned long') [-Wformat]
snprintf(buffer, 2048, " Global work size: %ix%i", global_work[0], global_work[1]);
~~ ^~~~~~~~~~~~~~
%zu
KNLMeansCL.cpp:460:71: warning: format specifies type 'int' but the argument has type 'size_t' (aka 'unsigned long') [-Wformat]
snprintf(buffer, 2048, " Global work size: %ix%i", global_work[0], global_work[1]);
~~ ^~~~~~~~~~~~~~
%zu
KNLMeansCL.cpp:664:52: warning: implicit conversion of NULL constant to 'cl_uint' (aka 'unsigned int') [-Wnull-conversion]
ret |= clGetDeviceIDs(temp_platforms[i], device, NULL, NULL, &num_devices);
~~~~~~~~~~~~~~ ^~~~
0
KNLMeansCL.cpp:694:16: warning: 'clCreateImage2D' is deprecated [-Wdeprecated-declarations]
d.mem_in[0] = clCreateImage2D(d.context, CL_MEM_READ_ONLY, &image_format, d.image_dimensions[0], d.image_dimensions[1], 0, NULL, NULL);
^
/usr/include/CL/cl.h:1170:1: note: 'clCreateImage2D' has been explicitly marked deprecated here
clCreateImage2D(cl_context /* context */,
^
KNLMeansCL.cpp:695:25: warning: 'clCreateImage2D' is deprecated [-Wdeprecated-declarations]
if (d.d) d.mem_in[1] = clCreateImage2D(d.context, CL_MEM_READ_ONLY, &image_format, d.image_dimensions[0], d.image_dimensions[1], 0, NULL, NULL);
^
/usr/include/CL/cl.h:1170:1: note: 'clCreateImage2D' has been explicitly marked deprecated here
clCreateImage2D(cl_context /* context */,
^
KNLMeansCL.cpp:696:14: warning: 'clCreateImage2D' is deprecated [-Wdeprecated-declarations]
d.mem_out = clCreateImage2D(d.context, CL_MEM_WRITE_ONLY, &image_format, d.image_dimensions[0], d.image_dimensions[1], 0, NULL, NULL);
^
/usr/include/CL/cl.h:1170:1: note: 'clCreateImage2D' has been explicitly marked deprecated here
clCreateImage2D(cl_context /* context */,
^
15 warnings generated.

Khanattila
26th June 2015, 22:11
Try to add "-cl-single-precision-constant" in clBuildProgram options.
And / Or change "-D NLMK_H2_INV_NORM=%ff" to "-D NLMK_H2_INV_NORM=%f".

feisty2
27th June 2015, 06:15
fast yv24
y=converttoy8 ()
u=utoy8 ()
v=vtoy8 ()
fakergb=mergergb (y,u,v).converttorgb32 ()
nlm=fakergb.knlmeanscl (xxx)
y=nlm.showred ("y8")
u=nlm.showgreen ("y8")
v=nlm.showblue ("y8")
ytouv (u,v,y)

Khanattila
27th June 2015, 10:08
fast yv24
y=converttoy8 ()
u=utoy8 ()
v=vtoy8 ()
fakergb=mergergb (y,u,v).converttorgb32 ()
nlm=fakergb.knlmeanscl (xxx)
y=nlm.showred ("y8")
u=nlm.showgreen ("y8")
v=nlm.showblue ("y8")
ytouv (u,v,y)

This however is not gamma-correct. (Even if colour perception is not exactly orthogonal...)

Example:
Red RGB(255, 0, 0) YUV(76, 84, 255)
Violet RGB(127, 0, 255) YUV(67, 234, 170)

Squared Euclidean distance between two points p(r, g, b) and q(r, g, b).

d^2(p, q) = (p.r -q.r)^2 + (p.g - q.g)^2 + (p.b - q.b)^2
d^2(p, q) = (255 - 127)^2 + (0 - 0)^2 + (0 - 255)^2
d^2(p, q) = 81409

Squared Euclidean distance between two points p(y, u, v) and q(y, u, v).

d^2(p, q) = (p.y - q.y)^2 + (p.u - q.u) ^2 + (p.v - q.u)^2
d^2(p, q) = (76 - 64)^2 + (84 - 234)^2 + (255 - 170)^2
d^2(p, q) = 29869

EDIT.
Some people suggested a weighted Euclidean distance in RGB, example:
d^2(p, q) = 3*(p.r -q.r)^2 + 4*(p.g - q.g)^2 + 2*(p.b - q.b)^2 = 179202
d^2(p, q) = 2*(p.r -q.r)^2 + 4*(p.g - q.g)^2 + 3*(p.b - q.b)^2 = 227843
Future investigations are needed.

Monarc
27th June 2015, 12:58
#define NLMK_H2_INV_NORM 61,942730f


its snprintf and my local language settings (german)

In german floats are written in plain text with a comma : e.g. 3,14
In english with point: 3.14

if i start vapoursynth with LC_ALL=C, the error is gone.

Khanattila
27th June 2015, 13:23
#define NLMK_H2_INV_NORM 61,942730f


its snprintf and my local language settings (german)

In german floats are written in plain text with a comma : e.g. 3,14
In english with point: 3.14

if i start vapoursynth with LC_ALL=C, the error is gone.

Easier than expected

Groucho2004
27th June 2015, 15:24
I want to try Dithertools to denoise with 16 bit precision. Would the following code be correct?

Dither_convert_8_to_16()

y = KNLMeansCL(D = 1, A = 1, h = 1.5, lsb_inout = true)
u = UToY8().KNLMeansCL(D = 1, A = 1, h = 1.5, lsb_inout = true)
v = VToY8().KNLMeansCL(D = 1, A = 1, h = 1.5, lsb_inout = true)
YToUV(u, v, y)

f3kdb(sample_mode = 2, keep_tv_range = true, input_mode = 1, output_mode = 1)

DitherPost()

Khanattila
27th June 2015, 15:58
Yes of course.

feisty2
27th June 2015, 16:09
This however is not gamma-correct. (Even if colour perception is not exactly orthogonal...)

Example:
Red RGB(255, 0, 0) YUV(76, 84, 255)
Violet RGB(127, 0, 255) YUV(67, 234, 170)

Squared Euclidean distance between two points p(r, g, b) and q(r, g, b).

d^2(p, q) = (p.r -q.r)^2 + (p.g - q.g)^2 + (p.b - q.b)^2
d^2(p, q) = (255 - 127)^2 + (0 - 0)^2 + (0 - 255)^2
d^2(p, q) = 81409

Squared Euclidean distance between two points p(y, u, v) and q(y, u, v).

d^2(p, q) = (p.y - q.y)^2 + (p.u - q.u) ^2 + (p.v - q.u)^2
d^2(p, q) = (76 - 64)^2 + (84 - 234)^2 + (255 - 170)^2
d^2(p, q) = 29869

EDIT.
Some people suggested a weighted Euclidean distance in RGB, example:
d^2(p, q) = 3*(p.r -q.r)^2 + 4*(p.g - q.g)^2 + 2*(p.b - q.b)^2 = 179202
d^2(p, q) = 2*(p.r -q.r)^2 + 4*(p.g - q.g)^2 + 3*(p.b - q.b)^2 = 227843
Future investigations are needed.

guess b should have the least weight, so 3r+4g+2b kinda stuff, if the image comes from an actually camera, not CGI, blue channel will be VERY NOISY (compared to R,G), so not good to make that as a reference of the noise estimation at all

Khanattila
27th June 2015, 17:34
Another possibility is to use mahalanobis distance but noise covariance matrix is required.

feisty2
28th June 2015, 08:58
I'd just get green channel to do the weighting stuff, cuz green channel is generally the channel got the highest quality in real life images, least noisy, and got more details than RB.

feisty2
28th June 2015, 13:35
request: can you add an extra reference clip option (default = input clip) to do the weighting calculation?
like "prefilter" for mvtools, you can use it to do a lot of things, like, use a blunt and aggressive filter to remove nasty artifacts like dot crawl, then get the dif between the filtered clean clip and the original noisy clip, then filter the dif with delicate filters like nlmeans, weights calculated from the clean clip, then add the dif back to the clean clip and you can remove the artifacts and save a lot of details from this

Khanattila
29th June 2015, 16:01
request: can you add an extra reference clip option (default = input clip) to do the weighting calculation?
like "prefilter" for mvtools, you can use it to do a lot of things, like, use a blunt and aggressive filter to remove nasty artifacts like dot crawl, then get the dif between the filtered clean clip and the original noisy clip, then filter the dif with delicate filters like nlmeans, weights calculated from the clean clip, then add the dif back to the clean clip and you can remove the artifacts and save a lot of details from this

I don't know if you can get good results, but I will add this feature.

feisty2
29th June 2015, 16:06
I don't know if you can get good results, but I will add this feature.

amazing! :)
well, we'll have to test it first to get the answers :p

sl1pkn07
30th June 2015, 00:03
Hi

EDIT3: I've open a git repo with the code and a small configure/makefile. with the patches applied and some more things

https://github.com/sl1pkn07/KNLmeansCL

greetings

GMJCZP
4th July 2015, 16:07
Hello friends:

He wanted to know if there is a possibility to use this filter without a video card. I have a PC Foxconn G41MX-F 2.0 with an Intel Core 2 Duo E4400 processor with Windows XP SP3 installed, so the only way to have OpenCL was installed here:

http://www.wings3d.com/forum/showthread.php?tid=174

I installed the a) package (ATI Stream SDK v2) but get the following error message:

"opencl device not available!"

And I tried all the alternatives (DEFAULT, CPU, GPU, ACCELERATOR) and nothing.

Does the SDK package are not drivers or the correct version? What am I doing wrong? Do you simply can not use this plugin without video card? Thanks.

feisty2
4th July 2015, 16:12
remove winxp and get win10 :)

sl1pkn07
4th July 2015, 22:46
I tried to install 2 OpenCL vendors, one for Nvidia GPU and Intel only for CPU

http://sl1pkn07.wtf/paste/view/696b9533

when set 'device_type="CPU"', the "decoding" is slowwwwwwwww like ass ("spected", in dual Xeon X5650 (24Threads))

but when set 'device_type="GPU"', the VSpipe get segfault

[967221.403446] vspipe[8062]: segfault at 7f949359cb88 ip 00007f949359cb88 sp 00007ffd9162c448 error 15 in libc-2.21.so[7f949359c000+2000]

but when no set 'device_type=', knlmeans use the GPU.

how to debug this?

knlmeans is builded with

CXXFLAGS = -O2 -std=c++11 -Wall -Wno-unused-local-typedefs -I. -I./include -march=native -O2 -pipe -fstack-protector-strong --param=ssp-buffer-size=4 -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/vapoursynth
LDFLAGS = -shared -fPIC -Wl,-O1,--sort-common,--as-needed,-z,relro

in linux with
gcc 5.1.0
ocl-icd 2.2.7 (OpenCL loader)
nvidia 352.21 beta drivers
Cuda 7.0.28
Intel OpenCL for CPU 15.1 (5.0.0.57)

Khanattila
5th July 2015, 15:25
Hello friends:

He wanted to know if there is a possibility to use this filter without a video card. I have a PC Foxconn G41MX-F 2.0 with an Intel Core 2 Duo E4400 processor with Windows XP SP3 installed, so the only way to have OpenCL was installed here:

http://www.wings3d.com/forum/showthread.php?tid=174

I installed the a) package (ATI Stream SDK v2) but get the following error message:

"opencl device not available!"

And I tried all the alternatives (DEFAULT, CPU, GPU, ACCELERATOR) and nothing.

Does the SDK package are not drivers or the correct version? What am I doing wrong? Do you simply can not use this plugin without video card? Thanks.

1) Sure. You can use it without a graphics card.
2) You should install the Intel driver: https://software.intel.com/en-us/articles/opencl-drivers

Khanattila
5th July 2015, 15:30
I tried to install 2 OpenCL vendors, one for Nvidia GPU and Intel only for CPU

http://sl1pkn07.wtf/paste/view/696b9533

when set 'device_type="CPU"', the "decoding" is slowwwwwwwww like ass ("spected", in dual Xeon X5650 (24Threads))

but when set 'device_type="GPU"', the VSpipe get segfault

[967221.403446] vspipe[8062]: segfault at 7f949359cb88 ip 00007f949359cb88 sp 00007ffd9162c448 error 15 in libc-2.21.so[7f949359c000+2000]

but when no set 'device_type=', knlmeans use the GPU.

how to debug this?

knlmeans is builded with

CXXFLAGS = -O2 -std=c++11 -Wall -Wno-unused-local-typedefs -I. -I./include -march=native -O2 -pipe -fstack-protector-strong --param=ssp-buffer-size=4 -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/vapoursynth
LDFLAGS = -shared -fPIC -Wl,-O1,--sort-common,--as-needed,-z,relro

in linux with
gcc 5.1.0
ocl-icd 2.2.7 (OpenCL loader)
nvidia 352.21 beta drivers
Cuda 7.0.28
Intel OpenCL for CPU 15.1 (5.0.0.57)

1) Floating Point Performance: 57 Gflops (Xeon X5650) vs 2258 (GTX 760) :)
2) VSpipe get segfault... Maybe it's a problem in the code, I need to check.

Khanattila
5th July 2015, 15:39
Hi

EDIT3: I've open a git repo with the code and a small configure/makefile. with the patches applied and some more things

https://github.com/sl1pkn07/KNLmeansCL

greetings

EDIT2. Taken. https://github.com/Khanattila/KNLMeansCL

GMJCZP
6th July 2015, 01:44
1) Sure. You can use it without a graphics card.
2) You should install the Intel driver: https://software.intel.com/en-us/articles/opencl-drivers

Those drivers are for W7 SP1 and later, why did I mention all my PC settings and ATI package, which is supposedly the only one compatible with XP and Intel.

There will be a solution?

Bloax
6th July 2015, 02:25
You might want to just use the original TNLMeans instead of trying to make your CPU operate through OpenCL so that you can run an OpenCL remake of TNLMeans.

Groucho2004
6th July 2015, 08:07
You might want to just use the original TNLMeans instead of trying to make your CPU operate through OpenCL
Indeed. On a C2D 4400 alone, KNLMeansCL and TNLMeans would probably perform about the same. TNLMeans may even have the edge.
However, all this is rather pointless because NLMeans on this CPU will be too slow for any practical use.

Khanattila
6th July 2015, 14:36
Those drivers are for W7 SP1 and later, why did I mention all my PC settings and ATI package, which is supposedly the only one compatible with XP and Intel.

There will be a solution?

As suggested, you should try using the CPU. It's slow, but it should work.

GMJCZP
7th July 2015, 13:58
The problems that should be happening is that the ATI package is incompatible with the plugin or too old, that is why the KNLMeans does not work for me (CPU or another mode). Thanks anyway.

feisty2
7th July 2015, 15:41
any news about "reference clip" feature?
:)

Khanattila
9th July 2015, 17:34
any news about "reference clip" feature?
:)

It's almost ready.

sl1pkn07
9th July 2015, 17:40
please send me your github user

oh, you forked it. then i can remove from my repository?

Khanattila
9th July 2015, 19:16
please send me your github user

oh, you forked it. then i can remove from my repository?


Yes, and thanks. I took configure and GNUmakefile.

MysteryX
9th July 2015, 19:27
Has anyone done comparison between KNLMeans and FF3DFilter denoising quality? What's the difference?

feisty2
10th July 2015, 13:55
Has anyone done comparison between KNLMeans and FF3DFilter denoising quality? What's the difference?

NLMeans slays

MysteryX
10th July 2015, 21:39
Yes, it does beat FF3DFilter! It also alters x264.exe encoding results as it gave me 41.8mb instead of 53.2mb without changing anything else, but it lost too much details in encoding. I'm trying again with higher encoding settings to compensate.

Question. For dual-graphics computer, to make sure it runs on the Radeon, if I'm running AVSMeter in a CMD shell, which application do I have to configure as "high performance", CMD or AVSMeter?

Groucho2004
10th July 2015, 23:33
Yes, it does beat FF3DFilter! It also alters x264.exe encoding results as it gave me 41.8mb instead of 53.2mb without changing anything else, but it lost too much details in encoding. I'm trying again with higher encoding settings to compensate.
Oh my, this is so wrong on so many levels...
First of all, you did not tell us what settings you used for the de-noisers. Secondly, you're comparing apples and oranges, the algorithms of these 2 are very different. The difference in size of your encodes just means that KNLMeans (with the settings you used which we don't know) removed more noise and therefore details.
Using "higher encoding settings" will not bring back details lost with excessive de-noising.

Question. For dual-graphics computer, to make sure it runs on the Radeon, if I'm running AVSMeter in a CMD shell, which application do I have to configure as "high performance", CMD or AVSMeter?
No idea what "configure as high performance" means. You select the device with the KNLMeans "device_type" parameter. You can test it by using the "info = true" parameter.

MysteryX
11th July 2015, 03:25
Oh my, this is so wrong on so many levels... First of all, you did not tell us what settings you used for the de-noisers.
I did a very simple test. Replaced
fft3dfilter(sigma=3, bt=5, bw=48, bh=48, ow=24, oh=24, sharpen=.15)
with
KNLMeansCL(D=2, A=1, h=3)

Spatial has more impact on performance than Temporal, and I haven't seen much difference at all between D=2, A=1 and D=2, A=2

Secondly, you're comparing apples and oranges, the algorithms of these 2 are very different. The difference in size of your encodes just means that KNLMeans (with the settings you used which we don't know) removed more noise and therefore details.
Using "higher encoding settings" will not bring back details lost with excessive de-noising.
Thees two commands seem to give a similar level of noise-removal. With KNLMeansCL, however, the details are sharper and there is a bit less noise. The biggest difference is in zones with lots of artifacts, where it makes those look much better.

Which means that when I preview the script, KNLMeansCL definitely has more details. By encoding with x264.exe (preset veryslow), however, there's something about KNLMeansCL's patterns that makes x264 discard much more data. So the preview has more detail while the final file has less details.

I just have to play around to adapt the encoding quality setting to compensate for this. It's not an issue, but this is curious.

feisty2
11th July 2015, 06:43
removed more noise and therefore details.

not true, denoisers got their own ways to distinguish noise and actual image, and some does it better, so you can kill a lot of noise and lose not that many details, some does it, well, not that good, you lose huge amount of actual image along with noise, extreme case, blurring filter, the origin of all modern denoise filters, will sacrifice the whole image to remove noise :)

I wouldn't use frequency domain denoisers (FFT3D and its superior DFTTest ) to do regular kind of denoise stuff, they make ringings like all frequency filters, and very destructive to high frequencies unless you don't filter high frequencies at all

Groucho2004
11th July 2015, 08:03
not true, denoisers got their own ways to distinguish noise and actual image, and some does it better, so you can kill a lot of noise and lose not that many details, some does it, well, not that good, you lose huge amount of actual image along with noise, extreme case, blurring filter, the origin of all modern denoise filters, will sacrifice the whole image to remove noise
Yes, but my point was simply that one de-noiser removed more of the actual image which resulted in a lower encoding size. Even noise can be considered "detail", for example when it is used as an artistic tool ("300", "Black Swan").

MysteryX
11th July 2015, 17:33
Yes, but my point was simply that one de-noiser removed more of the actual image which resulted in a lower encoding size. Even noise can be considered "detail", for example when it is used as an artistic tool ("300", "Black Swan").
and my point is that this isn't the case as it left MORE details :)

Khanattila
13th July 2015, 18:35
Version 0.5.7: https://github.com/Khanattila/KNLMeansCL/releases/tag/v0.5.7

feisty2
14th July 2015, 04:25
G8! testing it right now

MysteryX
15th July 2015, 08:11
I did an encoding test on another video. This time the output file was slightly larger than when using FF3DFilter. So, it alters the way x264.exe decides what to keep, and sometimes it gives a small output, sometimes a larger output, depending on the source.

The biggest difference I'm seeing between FF3DFilter and KNLMeans is that with this, the image almost appears 3D. Even with a very low quality source, the shapes somehow take a 3D life. Whereas the source itself is just flat; and with any blurring denoiser it still lo9oks flat.

Khanattila
15th July 2015, 14:08
I did an encoding test on another video. This time the output file was slightly larger than when using FF3DFilter. So, it alters the way x264.exe decides what to keep, and sometimes it gives a small output, sometimes a larger output, depending on the source.

The biggest difference I'm seeing between FF3DFilter and KNLMeans is that with this, the image almost appears 3D. Even with a very low quality source, the shapes somehow take a 3D life. Whereas the source itself is just flat; and with any blurring denoiser it still lo9oks flat.

I only changed the way it calculates the distance between two colors in a RGB color space. With YUV color space it is equal to the previous version.

MysteryX
15th July 2015, 19:25
I only changed the way it calculates the distance between two colors in a RGB color space. With YUV color space it is equal to the previous version.
I wasn't comparing with your previous release, but with the other algorithm I was using before :) Great job. Definite improvement in my script.

And because this gets run first, all other operations afterwards start from better quality source and the difference gets amplified with NNEDI3 frame quadrupling. Another difference is that FF3DFilter needs sharpening afterwards, while this doesn't lose the sharpening to begin with.

Khanattila
17th July 2015, 18:12
I read the release notes of NVIDIA CUDA Toolkit v7.5 and OpenCL 1.2 is still missing. Really embarrassing.
I'll have to use the AMD APP SDK v2.9.1.

Groucho2004
17th July 2015, 18:26
I read the release notes of NVIDIA CUDA Toolkit v7.5 and OpenCL 1.2 is still missing.
Not sure if we're talking about the same thing but OpenCL 1.2 has been supported by NVIDIA for a few months now (since driver version 350.xx I think). See also here (https://www.khronos.org/news/permalink/nvidia-releases-350.12-game-ready-whql-drivers-with-opencl-1.2-support)

Khanattila
17th July 2015, 19:51
Not sure if we're talking about the same thing but OpenCL 1.2 has been supported by NVIDIA for a few months now (since driver version 350.xx I think). See also here (https://www.khronos.org/news/permalink/nvidia-releases-350.12-game-ready-whql-drivers-with-opencl-1.2-support)

I'm talking about OpenCL headers and library.
To write a OpenCL program, a SDK in required, like CUDA Toolkit (Nvidia), APP SDK (AMD), INDE (Intel (https://software.intel.com/en-us/intel-opencl)).

For execute a OpenCL program is only required a device drivers.

Groucho2004
17th July 2015, 21:03
I'm talking about OpenCL headers and library.
I see. Odd though that they have not provided a 1.2 SDK yet.

foxyshadis
18th July 2015, 03:14
I read the release notes of NVIDIA CUDA Toolkit v7.5 and OpenCL 1.2 is still missing. Really embarrassing.
I'll have to use the AMD APP SDK v2.9.1.

The OpenCL headers should be identical between APP, nVidia, and the official Khronos downloads (https://www.khronos.org/registry/cl/) anyway. nVidia's samples all use the official ones.

Khanattila
18th July 2015, 08:46
The OpenCL headers should be identical between APP, nVidia, and the official Khronos downloads (https://www.khronos.org/registry/cl/) anyway. nVidia's samples all use the official ones.

Yes sure. Nvidia software is more... practical, like https://developer.nvidia.com/nvidia-nsight-visual-studio-edition

LouieChuckyMerry
23rd July 2015, 09:11
Hello. I've installed Visual C++ Redistributable Package for Visual Studio 2013 and the latest nVidia CUDA 7.0.28 on my Win 7, Intel HD Graphics 4000-nVidia NVS 5400M, i5 3320M machine and I'm trying to test drive KNLMeans CL, but the call:

LoadPlugin("F:\[0]StandAloneApps\MeGUI-2500(core)2443(data)0.3.5(libs)[Portable]\tools\lsmash\LSMASHSource.dll")
LWLibavVideoSource("SourcePath")
KNLMeansCL()

with the latest KNLMeansCL from Post #210 and SEt's latest MT AviSynth 2.6 leads to the error message "KNLMeansCL: AviSynthCreate error (1)!" and a handy little .txt file stating:

:142:22: error: call to 'mad' is ambiguous
const float4 num = mad(M[gidx], u1, U2c[gidx]);
^~~
<stdin>:833:37: note: candidate function
float __attribute__((overloadable)) mad(float a, float b, float c);
^
<stdin>:836:38: note: candidate function
float4 __attribute__((overloadable)) mad(float4 a, float4 b, float4 c);
^
:144:16: error: call to 'native_divide' is ambiguous
float4 val = native_divide(num, den); val.w = u1.w;
^~~~~~~~~~~~~
<stdin>:1295:37: note: candidate function
float __attribute__((overloadable)) native_divide(float x, float y);
^
<stdin>:1298:38: note: candidate function
float4 __attribute__((overloadable)) native_divide(float4 x, float4 y);
^
6 diagnostics generated.

error: front end compiler failed build.

Please, any help is much appeciated :) .

Groucho2004
23rd July 2015, 09:23
Try adding device_type = "GPU" to KNLMeansCL.

LouieChuckyMerry
23rd July 2015, 13:37
Thanks for the idea, Groucho2004. I tried that while I was reading the thread, but I forgot by the time I made it to the last page so I failed to mention it. Seems 10 pages is my limit...

Khanattila
23rd July 2015, 13:38
Hello. I've installed Visual C++ Redistributable Package for Visual Studio 2013 and the latest nVidia CUDA 7.0.28 on my Win 7, Intel HD Graphics 4000-nVidia NVS 5400M, i5 3320M machine and I'm trying to test drive KNLMeans CL, but the call:

LoadPlugin("F:\[0]StandAloneApps\MeGUI-2500(core)2443(data)0.3.5(libs)[Portable]\tools\lsmash\LSMASHSource.dll")
LWLibavVideoSource("SourcePath")
KNLMeansCL()

with the latest KNLMeansCL from Post #210 and SEt's latest MT AviSynth 2.6 leads to the error message "KNLMeansCL: AviSynthCreate error (1)!" and a handy little .txt file stating:



Please, any help is much appeciated :) .

This is a problem with the opencl compiler.... It should not happen, but I'll probably release a new version to fix it.
EDIT. It's only required a OpenCL driver, not all SDK.

LouieChuckyMerry
23rd July 2015, 14:45
It's only required a OpenCL driver, not all SDK.

I wondered about that but wasn't sure because my knowledge is limited, so I figured I'd update everything just to be sure that it wasn't the problem. By the time I'm 2112 years old I'll know everything ;) .

LouieChuckyMerry
26th July 2015, 07:23
It seems my other laptop (Win 7, Intel HD Graphics 4000-nVidia NVS 5400M, i7 3840QM) can run KNLMeansCL (not sure why the other one, with the same graphics combo, can't), but the output 8-bit x264 video is a bit odd with Lsb_InOut=True. With any source (here's a sample, TestClipShawshank2 (http://www.mediafire.com/download/mz6r8ema5ck12zd/TestClipShawshank2.7z)) the call

LoadPlugin("F:\[0]StandAloneApps\MeGUI-2500(core)2443(data)0.3.5(libs)[Portable]\tools\lsmash\LSMASHSource.dll")
LWLibavVideoSource("D:\Temp\zzzTestClipShawshankTemp\TestClipShawshank.mkv")
KNLMeansCL()

outputs video that looks normal. However, the call:

LoadPlugin("F:\[0]StandAloneApps\MeGUI-2500(core)2443(data)0.3.5(libs)[Portable]\tools\lsmash\LSMASHSource.dll")
LWLibavVideoSource("D:\Temp\zzzTestClipShawshankTemp\TestClipShawshank.mkv")
KNLMeansCL(Lsb_InOut=True)

outputs video where the top half of the frame looks normal and the bottom half of the frame is, I'm not sure if this is correct, in a different color space. Here's a screenshot: KNLMeansCL(Lsb_InOut=True) (https://www.mediafire.com/?8a2j9gjo966wvrr).

Any suggestion would be much appreciated.

foxyshadis
26th July 2015, 07:39
You're encoding to 8-bit x264? Then you should use DitherPost to convert it back to 8-bit before feeding it to x264, it doesn't understand stacked video. It's kind of pointless to bother with that parameter for one filter; if you're using a full 16-bit chain, start with LWLibavVideoSource(...,stacked=true,format="YUV420P16") and continue from there. Your screenshot shows up broken because you didn't provide stacked video (that's what the In in LsbInOut means) but asked it to process as if it was; the filter won't convert from 8-bit to 16-bit for you.

http://avisynth.nl/index.php/High_bit-depth_Support_with_Avisynth has more details on how to work with stacked 16-bit video.

LouieChuckyMerry
26th July 2015, 09:17
Thanks for your help, foxyshadis :) . I get the gist (if not all the details) of your reply, as I'm still a relative noob. I'm actually trying to take your kind advice from here (http://forum.doom9.org/showthread.php?p=1731025#post1731025), but am having trouble because it seems that SMDegrain and KNLMeansCL handle the Lsb parameter differently. I was trying to sort it out with 8-bit x264 because I thought it would be simpler (guess not ;) ), but my normal script is:

SetMemoryMax(2048)
SetMTMode(3,7)
LoadPlugin("F:\[0]StandAloneApps\MeGUI-2500(core)2443(data)0.3.5(libs)[Portable]\tools\lsmash\LSMASHSource.dll")
LWLibavVideoSource("SourcePath")
SetMTMode(2)
SMDegrain(TR=3,ThSAD=400,RefineMotion=True,Plane=0,Chroma=False,Lsb=True,Lsb_Out=True)
F=DitherPost(Mode=-1)
S=F.FastLineDarkenMod()
D=MT_MakeDiff(S,F).Dither_Convert_8_To_16()
Dither_Add16(Last,D,Dif=True,U=2,V=2)
GradFun3(Radius=16,Lsb_In=True,Lsb=True)
Dither_Out()


Simply swapping out the SMDegrain line for:

KNLMeansCL(Lsb_InOut=True,Device_Type="GPU")

was causing problems. However, with the information from your reply:

LoadPlugin("F:\[0]StandAloneApps\MeGUI-2500(core)2443(data)0.3.5(libs)[Portable]\tools\lsmash\LSMASHSource.dll")
LWLibavVideoSource("SourcePath",Stacked=True,Format=YUV420P16)
KNLMeansCL(Lsb_InOut=True,Device_Type="GPU")
F=DitherPost(Mode=-1)
S=F.FastLineDarkenMod()
D=MT_MakeDiff(S,F).Dither_Convert_8_To_16()
Dither_Add16(Last,D,Dif=True,U=2,V=2)
GradFun3(Radius=16,Lsb_In=True,Lsb=True)
Dither_Out()


works perfectly. Awesome, thank you so much :thanks: . Does this means that SMDegrain has been spoiling me the entire time I've been using it?

Edit: do you know if there's a way to use KNLMeansCL(Lsb_InOut=True) with DGSource("SourcePath")?

Groucho2004
26th July 2015, 09:40
Does this means that SMDegrain has been spoiling me the entire time I've been using it?
Spoiling?

LouieChuckyMerry
26th July 2015, 10:27
I've never had to manually add ",Stacked=True,Format='YUV420P16'" to my script before. Ahhh, perhaps you know: is there a way to use KNLMeansCL(Lsb_InOut=True) with DGSource("SourcePath")?

Groucho2004
26th July 2015, 10:53
I've never had to manually add ",Stacked=True,Format='YUV420P16'" to my script before. Ahhh, perhaps you know: is there a way to use KNLMeansCL(Lsb_InOut=True) with DGSource("SourcePath")?
DGSource can only provide 8 bit format so you have to convert it to stacked first:

DGSource()
Dither_convert_8_to_16()

You might consider reading the Dither manual (at least the introduction and some of the examples), it helps understanding the basics of 16 bit processing. Cretindesalpes put a lot of effort into that manual.

LouieChuckyMerry
26th July 2015, 11:45
DGSource can only provide 8 bit format so you have to convert it to stacked first:

DGSource()
Dither_convert_8_to_16()


Thank you. It seems really obvious once I see it.


You might consider reading the Dither manual (at least the introduction and some of the examples), it helps understanding the basics of 16 bit processing. Cretindesalpes put a lot of effort into that manual.

That's an excellent idea. I've read sections of it in pursuit of an answer (and promptly forgotten what I read, ha ha), but I've never actually read the introduction. The wiki is even open in this tab stack so I've no excuse.

Thank you again for all your help :) .

LouieChuckyMerry
27th July 2015, 06:15
Hello :) . The following script runs without issue:

LoadPlugin("F:\[0]StandAloneApps\MeGUI-2500(core)2443(data)0.3.5(libs)[Portable]\tools\DGIndexNV\DGDecodeNV.dll")
DGSource("SourcePath")
Dither_Convert_8_To_16()
### Deinterlace-Match Fields-Decimate ###
LoadPlugin("F:\[0]StandAloneApps\MeGUI-2500(core)2443(data)0.3.5(libs)[Portable]\tools\avisynth_plugin\TIVTC.dll")
Function FieldMatch(Clip C) {
Global PP = C.DuplicateFrame(0)
Global CC = C
Global NN = C.DeleteFrame(0)
P2 = PP.SeparateFields()
C2 = CC.SeparateFields()
N2 = NN.SeparateFields()
Global PC = Interleave(P2.SelectEven(),C2.SelectOdd()).Weave()
Global CP = Interleave(C2.SelectEven(),P2.SelectOdd()).Weave()
Global CN = Interleave(C2.SelectEven(),N2.SelectOdd()).Weave()
Global NC = Interleave(N2.SelectEven(),C2.SelectOdd()).Weave()
Global Deint = QTGMC(CC).SelectEven()
Return ScriptClip(CC, \
"!CC.IsCombedTIVTC(CThresh=12,Chroma=True,BlockX=16,BlockY=32) ? CC : " + \
"!NN.IsCombedTIVTC(CThresh=12,Chroma=True,BlockX=16,BlockY=32) ? NN : " + \
"!CN.IsCombedTIVTC(CThresh=12,Chroma=True,BlockX=16,BlockY=32) ? CN : " + \
"!NC.IsCombedTIVTC(CThresh=12,Chroma=True,BlockX=16,BlockY=32) ? NC : " + \
"!PP.IsCombedTIVTC(CThresh=12,Chroma=True,BlockX=16,BlockY=32) ? PP : " + \
"!CP.IsCombedTIVTC(CThresh=12,Chroma=True,BlockX=16,BlockY=32) ? CP : " + \
"!PC.IsCombedTIVTC(CThresh=12,Chroma=True,BlockX=16,BlockY=32) ? PC : Deint")
}
TFM(Order=-1,Mode=5,PP=2,Clip2=FieldMatch(),Slow=2,MChroma=False,Ubsco=False,CThresh=12,Chroma=True)
TDecimate(Mode=1)
### Fix Line-Doubled Fields ###
NNEDI3(Field=-2)
Merge(SelectEven(),SelectOdd())
### Crop ###
# Dither_Crop16(8,0,-8,0)
### Overall Spatio-Temporal Denoise (Plus Gibbs Noise) ###
# KNLMeansCL(D=1,A=1,h=5.0,Lsb_InOut=True,Device_Type="GPU")
### Resize ###
LinearResize(640,480,Lsb_In=True,Lsb_Out=True)
### Darken-Thin Lines ###
F=DitherPost(Mode=-1)
S=F.FastLineDarkenMod(Strength=20,Prot=6).aWarpSharp2(Blur=4,Type=1,Depth=3,Chroma=2)
D=MT_MakeDiff(S,F).Dither_Convert_8_To_16()
Dither_Add16(Last,D,Dif=True,U=2,V=2)
### Deband ###
GradFun3(thR=0.55,SMode=2,Lsb_In=True,Lsb=True,StaticNoise=True)
# Trim()
# DitherPost()
Dither_Out()

It also runs successfully if I enable either the KNLMeansCL line or the Dither_Crop16 line. However, it fails with an unknown exception (according to AVSMeter) when the KNLMeansCL line and the Dither_Crop16 line are both enabled. Thanks for any help.

Edit: a little rearranging, cropping before converting to 16-bit, sorted it out (although the above might be a problem somehow?). This works:

LoadPlugin("F:\[0]StandAloneApps\MeGUI-2500(core)2443(data)0.3.5(libs)[Portable]\tools\DGIndexNV\DGDecodeNV.dll")
DGSource("SourcePath")
### Deinterlace-Match Fields-Decimate ###
LoadPlugin("F:\[0]StandAloneApps\MeGUI-2500(core)2443(data)0.3.5(libs)[Portable]\tools\avisynth_plugin\TIVTC.dll")
Function FieldMatch(Clip C) {
Global PP = C.DuplicateFrame(0)
Global CC = C
Global NN = C.DeleteFrame(0)
P2 = PP.SeparateFields()
C2 = CC.SeparateFields()
N2 = NN.SeparateFields()
Global PC = Interleave(P2.SelectEven(),C2.SelectOdd()).Weave()
Global CP = Interleave(C2.SelectEven(),P2.SelectOdd()).Weave()
Global CN = Interleave(C2.SelectEven(),N2.SelectOdd()).Weave()
Global NC = Interleave(N2.SelectEven(),C2.SelectOdd()).Weave()
Global Deint = QTGMC(CC).SelectEven()
Return ScriptClip(CC, \
"!CC.IsCombedTIVTC(CThresh=12,Chroma=True,BlockX=16,BlockY=32) ? CC : " + \
"!NN.IsCombedTIVTC(CThresh=12,Chroma=True,BlockX=16,BlockY=32) ? NN : " + \
"!CN.IsCombedTIVTC(CThresh=12,Chroma=True,BlockX=16,BlockY=32) ? CN : " + \
"!NC.IsCombedTIVTC(CThresh=12,Chroma=True,BlockX=16,BlockY=32) ? NC : " + \
"!PP.IsCombedTIVTC(CThresh=12,Chroma=True,BlockX=16,BlockY=32) ? PP : " + \
"!CP.IsCombedTIVTC(CThresh=12,Chroma=True,BlockX=16,BlockY=32) ? CP : " + \
"!PC.IsCombedTIVTC(CThresh=12,Chroma=True,BlockX=16,BlockY=32) ? PC : Deint")
}
TFM(Order=-1,Mode=5,PP=2,Clip2=FieldMatch(),Slow=2,MChroma=False,Ubsco=False,CThresh=12,Chroma=True)
TDecimate(Mode=1)
### Fix Line-Doubled Fields ###
NNEDI3(Field=-2)
Merge(SelectEven(),SelectOdd())
### Crop ###
Crop(8,0,-8,0)
Dither_Convert_8_To_16()
### Overall Spatio-Temporal Denoise (Plus Gibbs Noise) ###
KNLMeansCL(D=1,A=1,h=5.0,Lsb_InOut=True,Device_Type="GPU")
### Resize ###
LinearResize(640,480,Lsb_In=True,Lsb_Out=True)
### Darken-Thin Lines ###
F=DitherPost(Mode=-1)
S=F.FastLineDarkenMod(Strength=20,Prot=6).aWarpSharp2(Blur=4,Type=1,Depth=3,Chroma=2)
D=MT_MakeDiff(S,F).Dither_Convert_8_To_16()
Dither_Add16(Last,D,Dif=True,U=2,V=2)
### Deband ###
GradFun3(thR=0.55,SMode=2,Lsb_In=True,Lsb=True,StaticNoise=True)
# Trim()
# DitherPost()
Dither_Out()

Thanks for the telepathic help ;) .

foxyshadis
27th July 2015, 10:03
Does this means that SMDegrain has been spoiling me the entire time I've been using it?

Yup. :D You didn't specify lsb_in so it assumes you're passing in 8-bit and takes care of the conversion. In this case, lsb is actually implied by lsb_out.

Groucho2004
28th July 2015, 11:06
However, it fails with an unknown exception (according to AVSMeter) when the KNLMeansCL line and the Dither_Crop16 line are both enabled.
I looked into this issue and I'm not sure if it is a bug in Dither or KNLMeansCL.

Test script:
colorbars(width = 1280, height = 720, pixel_type = "yv12").killaudio()
Dither_Convert_8_To_16()
Dither_Crop16(8,0,-8,0)
KNLMeansCL(Lsb_InOut = True)
DitherPost()


I tried mpc-hc and VirtualDub but both just throw "Access violation at...".

Debugging this with AVSMeter and checking "GetLastError()":

With the lastest Dither.dll (1.27.1), AVSMeter throws an error but GetLastError() returns "0" (ERROR_SUCCESS). :(

However, with the previous dither.dll (1.26.5), GetLastError() returns "0x0000007f" (ERROR_PROC_NOT_FOUND, "The specified procedure could not be found").

It works without error under these conditions:

As already reported by LCM, commenting out Dither_Crop16 and/or KNLMeansCL()
Using different values for Dither_Crop16, for example (4, 0, 352, 240)
Substituting KNLMeansCL with another 16 bit capable filter, for example dfttest

feisty2
28th July 2015, 15:20
a bug in Dither or KNLMeansCL.


actually a bug in avisynth or knlmeanscl
dither_crop16 is a... simple little function script in Dither.avsi, not a plugin in Dither.dll, it crops MSB and LSB separately and stacks them back together after that, and.. that's about it

Reel.Deel
28th July 2015, 15:32
Have you guys tried Dither_crop16 with align=true? In AviSynth align defaults to false but in AviSynth+ it defaults to true. Not sure if it'll help with anything but it's worth a try, I guess.

Groucho2004
28th July 2015, 15:49
Have you guys tried Dither_crop16 with align=true? In AviSynth align defaults to false but in AviSynth+ it defaults to true. Not sure if it'll help with anything but it's worth a try, I guess.
Crashes just the same.

FYI:
Dither_Crop16(8, 0, -8, 0) - crash
Dither_Crop16(16, 0, -8, 0) - no crash
Dither_Crop16(8, 0, -16, 0) - crash
Dither_Crop16(16, 0, -16, 0) - no crash

Edit:
AVS+ r1825 does not crash whatever I try

Edit2:
HolyWu's correction below does fix the problem.

cretindesalpes
28th July 2015, 15:56
align
Speaking of this… there’s a little bug in Dither_crop16: it doesn’t pass the align parameter if the crop is only horizontal. It’s the case here but I’m not sure if this is related with the present issue.

EDIT: HolyWu got it first

Groucho2004
28th July 2015, 15:57
Actually align=true does fix this issue, but you have to modify dither.avsi first. At line 1078, change src.Crop (left, 0, width, 0) to src.Crop (left, 0, width, 0, align).
Well spotted. Yes, that works.

Khanattila
28th July 2015, 17:12
Crashes just the same.

FYI:
Dither_Crop16(8, 0, -8, 0) - crash
Dither_Crop16(16, 0, -8, 0) - no crash
Dither_Crop16(8, 0, -16, 0) - crash
Dither_Crop16(16, 0, -16, 0) - no crash

Edit:
AVS+ r1825 does not crash whatever I try

Edit2:
HolyWu's correction below does fix the problem.

_mm_load_si128 => _mm_lddqu_si128, easier.
EDIT. https://github.com/Khanattila/KNLMeansCL/releases

LouieChuckyMerry
1st August 2015, 12:48
Happy Saturday :) . Trying the newest version of KNLMeansCL with the call:

LoadPlugin("F:\[0]StandAloneApps\MeGUI-2500(core)2443(data)0.3.5(libs)[Portable]\tools\lsmash\LSMASHSource.dll")
LWLibavVideoSource("SourcePath")
KNLMeansCL()

results in the error message "KNLMeansCL: AviSynthCreate error (2)!". The accompanying .txt file reads:

:144:16: error: call to 'native_divide' is ambiguous
float4 val = native_divide(num, den); val.w = u1.w;
^~~~~~~~~~~~~
<stdin>:1295:37: note: candidate function
float __attribute__((overloadable)) native_divide(float x, float y);
^
<stdin>:1298:38: note: candidate function
float4 __attribute__((overloadable)) native_divide(float4 x, float4 y);
^
3 diagnostics generated.

error: front end compiler failed build.

It seems that I've graduated from "1" to "2" ;) . I also tried:

LoadPlugin("F:\[0]StandAloneApps\MeGUI-2500(core)2443(data)0.3.5(libs)[Portable]\tools\lsmash\LSMASHSource.dll")
LWLibavVideoSource("SourcePath")
KNLMeansCL(Device_Type="GPU")

but received the same error code with the same .txt message. Certainly this could be a problem with my laptop; I don't know enough to know. Strangely, KNLMeansCL works just fine on my newer laptop with the same Intel HD Graphics 4000-nVidia NVS 5400M graphics combo (but a quad-core CPU instead of a dual-core CPU).

poisondeathray
1st August 2015, 18:06
Can you load the source filter alone without KNLMeansCL on that laptop ? (ie. comment out KNLMeansCL)

Did you check your GPU drivers ? Are they up to date ?

You can also try disabling the iGPU in device manager or vice versa with the nvidia GPU and try again, in case one or the other has a problem

foxyshadis
1st August 2015, 23:12
That's an actual bug; the return type and arguments must all be the same according to the OpenCL docs. The line above it is "const float den = U2c[gidx].w + M[gidx];" instead of "const float4 den = (float4)(U2c[gidx].w + M[gidx]);"

The compiler must be getting pickier about that.

Khanattila
1st August 2015, 23:14
Happy Saturday :) . Trying the newest version of KNLMeansCL with the call:

LoadPlugin("F:\[0]StandAloneApps\MeGUI-2500(core)2443(data)0.3.5(libs)[Portable]\tools\lsmash\LSMASHSource.dll")
LWLibavVideoSource("SourcePath")
KNLMeansCL()

results in the error message "KNLMeansCL: AviSynthCreate error (2)!". The accompanying .txt file reads:



It seems that I've graduated from "1" to "2" ;) . I also tried:

LoadPlugin("F:\[0]StandAloneApps\MeGUI-2500(core)2443(data)0.3.5(libs)[Portable]\tools\lsmash\LSMASHSource.dll")
LWLibavVideoSource("SourcePath")
KNLMeansCL(Device_Type="GPU")

but received the same error code with the same .txt message. Certainly this could be a problem with my laptop; I don't know enough to know. Strangely, KNLMeansCL works just fine on my newer laptop with the same Intel HD Graphics 4000-nVidia NVS 5400M graphics combo (but a quad-core CPU instead of a dual-core CPU).
It's a minor problem, but annoying.
Typically a float is converted to float4 automatically if necessary. Strange that your compiler does not.
I'll have to do it explicitly.

LouieChuckyMerry
2nd August 2015, 12:54
It's a minor problem, but annoying.
Typically a float is converted to float4 automatically if necessary. Strange that your compiler does not.
I'll have to do it explicitly.

Please don't go out of your way to fix this for me specifically; I'm sure you're busy and have better things to do. Is there's some way I can update-reinstall my compiler?. If not, then I can wait until an update is at your convenience. Thanks :) .

Khanattila
2nd August 2015, 16:26
Please don't go out of your way to fix this for me specifically; I'm sure you're busy and have better things to do. Is there's some way I can update-reinstall my compiler?. If not, then I can wait until an update is at your convenience. Thanks :) .
In each case, it's better to correct.
https://github.com/Khanattila/KNLMeansCL/releases

LouieChuckyMerry
3rd August 2015, 06:16
Thanks, Khanattila. With version 0.5.9 the calls KNLMeansCL() and KNLMeansCL(Device_Type="GPU") result in the error message "KNLMeansCL: AviSynthCreate error (3)!" and no .txt file is generated. Is there anything I can do to help, any information you need about my laptop?

Khanattila
3rd August 2015, 10:20
Thanks, Khanattila. With version 0.5.9 the calls KNLMeansCL() and KNLMeansCL(Device_Type="GPU") result in the error message "KNLMeansCL: AviSynthCreate error (3)!" and no .txt file is generated. Is there anything I can do to help, any information you need about my laptop?
http://www.ozone3d.net/gpu_caps_viewer/

OpenCL -> More OpenCL Information, copy it to pastebin or similar.

LouieChuckyMerry
3rd August 2015, 13:40
I couldn't highlight the text from OpenCL/More OpenCL Information, so I couldn't copy it. Instead I went to Tools/Export data and copied the OpenCL Capabilities (http://pastebin.com/Nf5Ayv1N) section. I hope that's OK.

Khanattila
3rd August 2015, 23:01
I couldn't highlight the text from OpenCL/More OpenCL Information, so I couldn't copy it. Instead I went to Tools/Export data and copied the OpenCL Capabilities (http://pastebin.com/Nf5Ayv1N) section. I hope that's OK.

You might try to update the nvidia driver.

LouieChuckyMerry
4th August 2015, 06:51
Having updated to nVidia version 353.62, the newest as far as I can figure, I still receive the "KNLMeansCL: AviSynthCreate error (3)!" with either call. I'm basically clueless anyway, but I really don't understand why only one of two laptops with the same graphics combo and the same drivers can successfully run KNLMeansCL? Anyway, thanks again for your help Khanattila, I appreciate it :) .

MysteryX
5th August 2015, 18:41
I took a look at my GPU utilization with MSI Afterburner and this doesn't seem normal.

http://s3.postimg.org/xyntph6fj/Gpu_Usage.jpg (http://postimg.org/image/xyntph6fj/)

Running KNLMeans does have a considerable performance impact, but it shows almost no GPU usage. Why?

I'm using a dual-graphics. GPU1 is Radeon HD 7670M, GPU2 is Intel HD 4000


(btw, about which does better between KNLMeans and FF3DFilter, in most cases KNLMeans does much better, but I did find some cases where it leaves ugly noise and where FF3DFilter does a better job)

Khanattila
5th August 2015, 21:57
I took a look at my GPU utilization with MSI Afterburner and this doesn't seem normal.

http://s3.postimg.org/xyntph6fj/Gpu_Usage.jpg (http://postimg.org/image/xyntph6fj/)

Running KNLMeans does have a considerable performance impact, but it shows almost no GPU usage. Why?

I'm using a dual-graphics. GPU1 is Radeon HD 7670M, GPU2 is Intel HD 4000


(btw, about which does better between KNLMeans and FF3DFilter, in most cases KNLMeans does much better, but I did find some cases where it leaves ugly noise and where FF3DFilter does a better job)
Are you sure you are using 7670M? Check it with info = true.
However, if you look at the use of the GPU with x264 and other filters may be normal.
Because it might you are CPU-limited.

MysteryX
6th August 2015, 03:16
Are you sure you are using 7670M? Check it with info = true.
However, if you look at the use of the GPU with x264 and other filters may be normal.
Because it might you are CPU-limited.
I'm not sure whether it is using the Intel or Radeon. Either way, both are displayed in that graph.

Does KNLMeans use considerable CPU on top of the GPU? What kind of GPU usage should I be expecting?

Groucho2004
6th August 2015, 08:33
I'm not sure whether it is using the Intel or Radeon.
Which part of "check it with "info = true" don't you understand?


Does KNLMeans use considerable CPU on top of the GPU?
No.

What kind of GPU usage should I be expecting?
Since you don't understand what Khanattila wrote, let's have another go:

Filters that are very heavy on the CPU (eedi3 for example) and/or x264 with a slow(ish) preset largely determine the processing speed of your encoding chain. At such slow speeds, a fast filter is basically "bored" and if you single out its CPU (or GPU in case of KNLMeansCL) usage, it will be very low.

Imagine Donald Trump and Usain Bolt going for a run together. Who do you think will sweat less?

RazorBurn
6th August 2015, 09:15
Sorry for being too noob on Python and VS but whats the Vapoursynth version on this?


Y=KNLMeansCL(device_type="GPU")
U=UToY8().KNLMeansCL(device_type="GPU")
V=VToY8().KNLMeansCL(device_type="GPU")
YToUV (U, V, Y)

Thanks..

Are_
6th August 2015, 22:09
Something like:

y = core.std.ShufflePlanes(clip, planes=[0], colorfamily=vs.GRAY).knlm.KNLMeansCL(device_type="GPU")
u = core.std.ShufflePlanes(clip, planes=[1], colorfamily=vs.GRAY).knlm.KNLMeansCL(device_type="GPU")
v = core.std.ShufflePlanes(clip, planes=[2], colorfamily=vs.GRAY).knlm.KNLMeansCL(device_type="GPU")
clip = core.std.ShufflePlanes([y, u, v], planes=[0, 0, 0], colorfamily=vs.YUV)

MysteryX
7th August 2015, 01:35
Huh... it was using the CPU device by default! That explains.

http://s21.postimg.org/s2f9yyudv/Info.jpg (http://postimg.org/image/s2f9yyudv/)

By adding device_type="GPU", it performs MUCH faster. But even with a script that doesn't do any heavy operation besides KNLMeansCL with D=3, A=3, I still barely see any GPU usage in Afterburner while the video plays slowly.

Groucho2004
7th August 2015, 08:38
But even with a script that doesn't do any heavy operation besides KNLMeansCL with D=3, A=3, I still barely see any GPU usage in Afterburner while the video plays slowly.
By "playing slowly", I can only assume that you mean playing the script in a media player or some preview window.
That's how it should be, the player software requests frames according to the specified frame rate (and possibly some buffering in the background), not as fast as Avisynth could serve them.
If you want to test how fast Avisynth can serve the frames you'll have to use AVSMeter. It will also show you CPU/GPU usage under these conditions.

MysteryX
7th August 2015, 17:18
OK. Testing with AVSMeter.

With device_type="GPU" I get 32fps with a simple script @ 50% CPU usage, and without it, I get 11fps @ 100% CPU usage.

Yet, MSI Afterburner still doesn't show any GPU usage. Perhaps it doesn't detect and report it properly, is there a better software to use to measure GPU usage?

detmek
7th August 2015, 17:27
Try with GPU-Z (http://www.softpedia.com/get/System/System-Info/GPU-Z.shtml).

MysteryX
7th August 2015, 17:45
GPU-Z reports a 2% load on the Intel HD 4000... AVSMeter is rendering at 36fps

Increasing MT mode from 8 threads to 16 threads increases CPU usage and lowers performance to 22fps, with same 2% GPU usage.

Disabling MT results in 32fps with only 7% CPU usage, still 2% GPU usage.

It seems MT mode doesn't work well with KNLMeans, and that it's not making efficient use of the GPU.

Since MT provides no performance improvement whatsoever with KNLMeans, is there a way to disable MT only for that command? I'm using both AviSynth 2.6 and AviSynth+ so I'd need both syntaxes.

Khanattila
7th August 2015, 18:37
GPU-Z reports a 2% load on the Intel HD 4000... AVSMeter is rendering at 36fps

Increasing MT mode from 8 threads to 16 threads increases CPU usage and lowers performance to 22fps, with same 2% GPU usage.

Disabling MT results in 32fps with only 7% CPU usage, still 2% GPU usage.

It seems MT mode doesn't work well with KNLMeans, and that it's not making efficient use of the GPU.

Since MT provides no performance improvement whatsoever with KNLMeans, is there a way to disable MT only for that command? I'm using both AviSynth 2.6 and AviSynth+ so I'd need both syntaxes.
1) MT is not good program in general. Best avoided.
2) Are you sure you are using the AMD discrete and not the integrated GPU?

EDIT. If you want a technical explain, OpenCL provides parallel computing using task-based and data-based parallelism.
MT only creates unnecessary queues.

Khanattila
7th August 2015, 18:40
Huh... it was using the CPU device by default! That explains.

http://s21.postimg.org/s2f9yyudv/Info.jpg (http://postimg.org/image/s2f9yyudv/)

By adding device_type="GPU", it performs MUCH faster. But even with a script that doesn't do any heavy operation besides KNLMeansCL with D=3, A=3, I still barely see any GPU usage in Afterburner while the video plays slowly.
By default uses your default device OpenCL. More default so.

MysteryX
7th August 2015, 18:55
It is currently using the Intel integrated chipset (HD 4000), and perhaps there's no point in using the Radeon if it's under-utilizing it in such a way? I'll try with the Radeon and see if results are different.

Khanattila
7th August 2015, 19:04
It is currently using the Intel integrated chipset (HD 4000), and perhaps there's no point in using the Radeon if it's under-utilizing it in such a way? I'll try with the Radeon and see if results are different.

The fastest solution is to uninstall the Intel OpenCL driver.

EDIT. Or edit HKEY_LOCAL_MACHINE \ SOFTWARE \ Khronos \ OpenCL \ Vendors. More or less.

Groucho2004
7th August 2015, 21:25
OK. Testing with AVSMeter.

With device_type="GPU" I get 32fps with a simple script @ 50% CPU usage, and without it, I get 11fps @ 100% CPU usage.
What source? Post the full script. Apart from that, the result with device_type="GPU" looks pretty good compared to the other one. It's not only 3 times faster, it also reduces the CPU load significantly.

Yet, you somehow seem dissatisfied.

MysteryX
7th August 2015, 22:14
I tried running it on the Radeon, and can't get it to run on the Radeon. On a dual-graphics system, I set the application as "High Performance" for the Radeon or "Power Saving" for the Intel HD.

This time I'm getting 7-10% usage on the Intel HD 4000.

If I set AVSMeter.exe to run on High Performance, or on Power Saving, it's still running on the Intel HD 4000 either way with exactly the same performance. I tried changing it for cmd.exe, and that still doesn't switch it to the Radeon. With that low usage, it's not really an issue.

What makes more of a difference is the very high CPU usage when running in MT mode. I don't have any issues with MT so far; only this performance issue here. The output looks good, but is this plugin compatible with MT, or is there side-effects in terms of quality?

Here's the script, when running in MT mode. It gives 30-32fps no matter if it's High Performance or Power Saving, and with or without MT. The only difference is that without MT CPU usage is 7%, with MT it goes up to 50%. The rest of the script is very CPU intensive and requires MT.

Cores=8
SetMTMode(3,Cores)
AviSource("Preview.avi", audio=false, pixel_type="YV12")
SetMTMode(2)
ColorMatrix(mode="Rec.601->Rec.709")
Crop(0, 0, -10, -0)
KNLMeansCL(D=2, A=1, h=3, device_type="GPU")
Distributor()

Khanattila
7th August 2015, 23:29
I tried running it on the Radeon, and can't get it to run on the Radeon. On a dual-graphics system, I set the application as "High Performance" for the Radeon or "Power Saving" for the Intel HD.

This time I'm getting 7-10% usage on the Intel HD 4000.

If I set AVSMeter.exe to run on High Performance, or on Power Saving, it's still running on the Intel HD 4000 either way with exactly the same performance. I tried changing it for cmd.exe, and that still doesn't switch it to the Radeon. With that low usage, it's not really an issue.

What makes more of a difference is the very high CPU usage when running in MT mode. I don't have any issues with MT so far; only this performance issue here. The output looks good, but is this plugin compatible with MT, or is there side-effects in terms of quality?

Here's the script, when running in MT mode. It gives 30-32fps no matter if it's High Performance or Power Saving, and with or without MT. The only difference is that without MT CPU usage is 7%, with MT it goes up to 50%. The rest of the script is very CPU intensive and requires MT.

Cores=8
SetMTMode(3,Cores)
AviSource("Preview.avi", audio=false, pixel_type="YV12")
SetMTMode(2)
ColorMatrix(mode="Rec.601->Rec.709")
Crop(0, 0, -10, -0)
KNLMeansCL(D=2, A=1, h=3, device_type="GPU")
Distributor()
KNLMeansCL is not compatible with MT.
Why? Because it's written in OpenCL, as if it were already multithreaded.
In addition, the GPU works in a different way, it is not that simple.

Try uninstalling "OpenCL™ Driver for Intel® Iris™ and Intel® HD".
So it is forced to use only the AMD.

amayra
8th August 2015, 00:59
is this work with madVR ? :scared:

Reel.Deel
8th August 2015, 01:10
KNLMeansCL is not compatible with MT.
Why? Because it's written in OpenCL, as if it were already multithreaded.
In addition, the GPU works in a different way, it is not that simple.


SEt said this about nnedi3ocl:

...
MTMode to use: 2.
....
Major speed note 2.
The OpenCL code is quite optimized, but memory transfers are not. So, much time is lost there. Using high number of threads with MTMode 2 (even more than physical threads your CPU has) is the best workaround for now.

I guess the same does not apply to KNLMeans? Then again using a high number of threads would probably only be beneficial if you're just using strictly OpenCL (or GPU) plugins, I doubt it would work efficiently when you start mixing CPU and GPU filters in complex scripts.

---

Groucho2004: Imagine Donald Trump and Usain Bolt going for a run together. Who do you think will sweat less?

LOL, good one :D

MysteryX
8th August 2015, 03:30
SEt said this about nnedi3ocl:


I guess the same does not apply to KNLMeans? Then again using a high number of threads would probably only be beneficial if you're just using strictly OpenCL (or GPU) plugins, I doubt it would work efficiently when you start mixing CPU and GPU filters in complex scripts.
It's not the case here. Increasing the threads greatly increase CPU usage while providing no performance benefit whatsoever.

Yet I can't throw away MT for what I'm doing.

I'm developing this for a redistributable application; starting to play with drivers and registry is a bad idea. Not something I'd do on other machines.

foxyshadis
8th August 2015, 07:07
Just use SetMTMode(5) or 6 before KNLMeans. That's a necessary step for any filter that doesn't support external multithreading.

Or use VapourSynth, KNLMeans works correctly with its automatic multithreading.

Khanattila
8th August 2015, 10:17
SEt said this about nnedi3ocl:


I guess the same does not apply to KNLMeans? Then again using a high number of threads would probably only be beneficial if you're just using strictly OpenCL (or GPU) plugins, I doubt it would work efficiently when you start mixing CPU and GPU filters in complex scripts.

---

Groucho2004: Imagine Donald Trump and Usain Bolt going for a run together. Who do you think will sweat less?

LOL, good one :D
Copy the data host-to-device and device-to-host does not take long. Of course you can do it in multiple threads, but the difference is minimal. :rolleyes:

Xebika
25th August 2015, 22:18
I got a problem when i open a script with KNLMeans.

The loading is taking long time and when i click on VirtualDub and MeGUI it just crashes with message "Not Responsing"

I have tried with different version of KNLMeans and Geforce drivers.

And i also tried a clean installation of Windows 10 x64

Khanattila
26th August 2015, 11:57
v0.6.0 release: https://github.com/Khanattila/KNLMeansCL/releases.

Khanattila
26th August 2015, 11:59
I got a problem when i open a script with KNLMeans.

The loading is taking long time and when i click on VirtualDub and MeGUI it just crashes with message "Not Responsing"

I have tried with different version of KNLMeans and Geforce drivers.

And i also tried a clean installation of Windows 10 x64

Post the script.

Xebika
26th August 2015, 12:47
LoadPlugin("C:\Video\MeGUI\tools\dgindexnv\DGDecodeNV.dll")
DGSource("C:\Video\Video.dgi",fieldop=0, deinterlace=1)
crop(24, 0, -8, -6)
Spline36Resize(768,576)
Levels(5, 1, 255, 0, 255)
SmoothContrast(contrast=0.2, sat=0.1)
LSFmod(defaults="slow")
KNLMeansCL(D=1, A=1, h=4.5)

Khanattila
26th August 2015, 13:33
LoadPlugin("C:\Video\MeGUI\tools\dgindexnv\DGDecodeNV.dll")
DGSource("C:\Video\Video.dgi",fieldop=0, deinterlace=1)
crop(24, 0, -8, -6)
Spline36Resize(768,576)
Levels(5, 1, 255, 0, 255)
SmoothContrast(contrast=0.2, sat=0.1)
LSFmod(defaults="slow")
KNLMeansCL(D=1, A=1, h=4.5)
It seems correct. Version of AviSynth?
It is possible that MeGUI uses its version included.

Xebika
26th August 2015, 13:49
I use Groucho2004's ICL 10 build.

Khanattila
26th August 2015, 17:42
I use Groucho2004's ICL 10 build.

Have you tried different opencl device?

Xebika
26th August 2015, 17:53
Graphic Card or Plugin??

Groucho2004
26th August 2015, 18:19
v0.6.0 release: https://github.com/Khanattila/KNLMeansCL/releases.
This one is quite a bit slower than 0.5.9. Also, no documentation included. I assume that means that there are no changes to the previous version?

Here's the comparison.
Script used:
colorbars(width = 1280, height = 720, pixel_type = "yv12").killaudio().assumefps(24000, 1001).trim(0, 499)
KNLMeansCL(D = 2, A = 1, h = 1.0)


Result 0.5.9:
[Runtime info]
Frames processed: 500 (0 - 499)
FPS (min | max | average): 21.23 | 26.16 | 25.91
Memory usage (phys | virt): 31 | 30 MB
Thread count: 8
CPU usage (average): 25%
GPU usage (average): 94%
Video engine load (average): 0%
GPU memory usage: 78 MB
Time (elapsed): 00:00:19.295

Result 0.6.0:
[Runtime info]
Frames processed: 500 (0 - 499)
FPS (min | max | average): 19.66 | 23.58 | 23.40
Memory usage (phys | virt): 31 | 30 MB
Thread count: 8
CPU usage (average): 25%
GPU usage (average): 95%
Video engine load (average): 0%
GPU memory usage: 78 MB
Time (elapsed): 00:00:21.369

Groucho2004
26th August 2015, 18:37
Graphic Card or Plugin??
KNLMeansCL has a parameter "device_type":
string device_type (device_type)
CPU := An OpenCL device that is the host processor.
GPU := An OpenCL device that is a GPU.
ACCELERATOR := Dedicated OpenCL accelerators (for example the IBM CELL Blade).
DEFAULT := The default OpenCL device in the system.

Default: DEFAULT.

Try "GPU".

Xebika
26th August 2015, 18:44
Still same problem.

Groucho2004
26th August 2015, 18:47
Still same problem.
Have you tried a script with just the source filter and KNLMeansCL?

Xebika
26th August 2015, 18:52
I just tried and it did Unfortunately no difference

Groucho2004
26th August 2015, 19:05
I just tried and it did Unfortunately no difference
Try running a simple script like this:
colorbars(width = 1280, height = 720, pixel_type = "yv12").killaudio()
KNLMeansCL()

with AVSMeter (http://forum.doom9.org/showthread.php?t=165528). Report what happens.

Xebika
26th August 2015, 19:53
It works fine with your script and here is the log:
[General info]
Log file created with: AVSMeter 2.1.0 (x86)
Script file: C:\Video\KNLMeansCL Test.avs
Avisynth version: AviSynth 2.60 (ICL10) (2.6.0.6)
Avisynth Interface Version: 6
Avisynth.dll linker/compiler version: 6.0 (ICL 10.1)
Avisynth DLL location: C:\Windows\SysWOW64\avisynth.dll
PluginDir2_5 (HKLM, x86): C:\Program Files (x86)\AviSynth\plugins


[Clip info]
Number of frames: 107892
Length (hh:mm:ss.ms): 00:59:59.996
Frame width: 1280
Frame height: 720
Framerate: 29.970 (30000/1001)
Colorspace: YV12
Audio channels: n/a
Audio bits/sample: n/a
Audio sample rate: n/a
Audio samples: n/a


[Runtime info]
Frames processed: 107892 (0 - 107891)
FPS (min | max | average): 31.84 | 126.2 | 122.7
TPF (max | min | avg): 31.41 | 7.925 | 8.147 ms
Memory usage (phys | virt): 93 | 90 MB
Thread count: 8
CPU usage (average): 25%
Time (elapsed): 00:14:39.022


[Script]
colorbars(width = 1280, height = 720, pixel_type = "yv12").killaudio()
KNLMeansCL()

And i got my script working with L-SMASH-Works but not with DGIndexNV.

But had no problems with both KNLMeansCL and DGIndexNV in same script, when i had Windows 8.1 x64

Khanattila
26th August 2015, 20:26
It works fine with your script and here is the log:


And i got my script working with L-SMASH-Works but not with DGIndexNV.

But had no problems with both KNLMeansCL and DGIndexNV in same script, when i had Windows 8.1 x64
I have not DGIndexNV, but from what you say could be a problem of the nvidia driver.

Khanattila
26th August 2015, 20:27
This one is quite a bit slower than 0.5.9. Also, no documentation included. I assume that means that there are no changes to the previous version?

Here's the comparison.
Script used:
colorbars(width = 1280, height = 720, pixel_type = "yv12").killaudio().assumefps(24000, 1001).trim(0, 499)
KNLMeansCL(D = 2, A = 1, h = 1.0)


Result 0.5.9:
[Runtime info]
Frames processed: 500 (0 - 499)
FPS (min | max | average): 21.23 | 26.16 | 25.91
Memory usage (phys | virt): 31 | 30 MB
Thread count: 8
CPU usage (average): 25%
GPU usage (average): 94%
Video engine load (average): 0%
GPU memory usage: 78 MB
Time (elapsed): 00:00:19.295

Result 0.6.0:
[Runtime info]
Frames processed: 500 (0 - 499)
FPS (min | max | average): 19.66 | 23.58 | 23.40
Memory usage (phys | virt): 31 | 30 MB
Thread count: 8
CPU usage (average): 25%
GPU usage (average): 95%
Video engine load (average): 0%
GPU memory usage: 78 MB
Time (elapsed): 00:00:21.369

I really have to attach the changelog.

* Added color distance (cmode).
* VapourSynth: added support for missing color format.
* Changed weighted RGB distance.
* No more SSE2 / SSE3 required.
* Minor changes and bug fixes.

Sparktank
26th August 2015, 21:15
LoadPlugin("C:\Video\MeGUI\tools\dgindexnv\DGDecodeNV.dll")
DGSource("C:\Video\Video.dgi",fieldop=0, deinterlace=1)
crop(24, 0, -8, -6)
Spline36Resize(768,576)
Levels(5, 1, 255, 0, 255)
SmoothContrast(contrast=0.2, sat=0.1)
LSFmod(defaults="slow")
KNLMeansCL(D=1, A=1, h=4.5)

Using bluray remux, I copied your script.
only changed crop and resize.
also, source was progressive so I didn't need to use other arguments in DGSource.

Windows 7 (x64) SP1 (although I use x86 AVS)
ForceWare 355.60
GeForce GTX 750 ti
Intel Core i5-2320@3.00GHz (old)
SEt's last known MT build (though I don't really use it, mostly for SVP)

I use AvsPmod instead of VirtualDub.

[General info]
Log file created with: AVSMeter 2.0.9 (x86)
Script file: H:\BD Demux\Godzilla\Godzilla-test.avs
Avisynth version: AviSynth 2.60, build:Feb 20 2015 [03:16:45] (2.6.0.5)
Avisynth Interface Version: 6
Avisynth.dll linker/compiler version: 12.0 (VC 2013)
Avisynth DLL location: C:\Windows\SysWOW64\avisynth.dll
PluginDir2_5 (HKLM, x86): C:\Program Files (x86)\AviSynth\plugins
Active MT Mode: 0


[Script]
SetMemoryMax(512)
LoadPlugin("C:\AVS\dgdecnv2049\DGDecodeNV.dll")
DGSource("H:\BD Demux\Godzilla\Godzilla.dgi", crop_b=148, crop_t=140)
Spline64Resize(1280, 528)
Levels(5, 1, 255, 0, 255)
SmoothContrast(contrast=0.2, sat=0.1)
LSFmod(defaults="slow")
KNLMeansCL(D=1, A=1, h=4.5, info=true, device_type="GPU")

Intel:
KNLMeansCL(D=1, A=1, h=4.5, info=true)
Automatically used Intel as device_type
http://i.imgur.com/ANk2EsW.png (http://imgur.com/ANk2EsW)

NVidia:
KNLMeansCL(D=1, A=1, h=4.5, info=true, device_type="GPU")
Invoked NVidia manually
http://i.imgur.com/oxnYA4L.png (http://imgur.com/oxnYA4L)

It also works when I use just KNLMeansCL.

Khanattila
26th August 2015, 21:26
For unknown reason intel use a lot of spaces.

Groucho2004
26th August 2015, 22:09
I really have to attach the changelog.

* Added color distance (cmode).
* VapourSynth: added support for missing color format.
* Changed weighted RGB distance.
* No more SSE2 / SSE3 required.
* Minor changes and bug fixes.

I looked at the source code and "cmode" is indeed a new parameter. Maybe I'm just dumb but "Added color distance" seems like a really brief documentation for it.

Since you didn't comment, I suppose the slower operation compared to earlier versions is by design?

Khanattila
26th August 2015, 22:33
I looked at the source code and "cmode" is indeed a new parameter. Maybe I'm just dumb but "Added color distance" seems like a really brief documentation for it.

Since you didn't comment, I suppose the slower operation compared to earlier versions is by design?

Because it's really simple.
Normally distance between two pixels use only Luma:

distance = (p0.Y - p1.Y)^2

With cmode, KNLMeansCL use Luma and Chorma:

distance = (p0.Y - p1.Y)^2 + (p0.U - p1.U)^2 + (p0.V - p1.V)^2


With RGB color space cmode is always true:

distance = weightR * (p0.R - p1.R)^2 + weightG * (p0.G - p1.G)^2 + weightB * (p0.B - p1.B)^2


Anyway v0.6.1 will be released before OpenCL 1.2 conversion. I used some instructions that are slower than I thought.

Groucho2004
27th August 2015, 09:14
Anyway v0.6.1 will be released before OpenCL 1.2 conversion. I used some instructions that are slower than I thought.
The test above was with the 340.xx driver which does not support OpenCL 1.2. Using the latest driver (355.xx) with OpenCL 1.2 support, the difference in speed is neglible.

DarkSpace
27th August 2015, 10:28
Because it's really simple.
Normally distance between two pixels use only Luma:

distance = (p0.Y - p1.Y)^2

With cmode, KNLMeansCL use Luma and Chorma:

distance = (p0.Y - p1.Y)^2 + (p0.U - p1.U)^2 + (p0.V - p1.V)^2


With RGB color space cmode is always true:

distance = weightR * (p0.R - p1.R)^2 + weightG * (p0.G - p1.G)^2 + weightB * (p0.B - p1.B)^2



That looks weird. Isn't usually a Euclidean Distance used (i.e. you forgot to take the square root of your results)?
I'll concede that it isn't necessary as long as you just compare distances, but if you know that, you can simplify e.g. Y-only distance to abs(p0.Y - p1.Y). Also, it helps keep my confusion level low :p

Xebika
27th August 2015, 14:26
I have not DGIndexNV, but from what you say could be a problem of the nvidia driver.

I got it working now, because a new driver is released today but just a beta driver.

Khanattila
27th August 2015, 15:46
That looks weird. Isn't usually a Euclidean Distance used (i.e. you forgot to take the square root of your results)?
I'll concede that it isn't necessary as long as you just compare distances, but if you know that, you can simplify e.g. Y-only distance to abs(p0.Y - p1.Y). Also, it helps keep my confusion level low :p

Every pixel is restored by the weighted average of all pixels in its search window.
And the weight is inversely proportional to the square of distance. It gives better result, usually. ;)

In any case the distance between two vectors is: sqrt((p0.x-p1.x)^2 + (p0.y-p1.y)^2 + ....).
You can simplify to abs(p0-p1) only if p is a number.

DarkSpace
27th August 2015, 21:15
Every pixel is restored by the weighted average of all pixels in its search window.
And the weight is inversely proportional to the square of distance. It gives better result, usually. ;)
Ahh, so that omission was on purpose. I see.

In any case the distance between two vectors is: sqrt((p0.x-p1.x)^2 + (p0.y-p1.y)^2 + ....).
You can simplify to abs(p0-p1) only if p is a number.
I only said that Y-only distance could be simplified that way. And Y-only distance only uses one number of each p (the Y value).

tormento
28th August 2015, 23:50
Is somebody using KNLMeans under Windows10_x64?

It worked perfectly under Windows8.1_x64 but in Windows10_x64 the preview of MeGUI stays frozen on a "grey" screen.

SetMTMode(5)
SetMemoryMax(2048)
LoadPlugin("D:\eseguibili\media\DGDecNV\DGDecodeNV.dll")
DGSource("E:\in\2_01 favoloso mondo di Amelie, Il\favoloso.dgi")
CompTest(1)
ChangeFPS(last,last,true)
SetMTMode(2)
SMDegrain (tr=4,PreFilter=4,thSAD=400,contrasharp=false,refinemotion=false,plane=4,chroma=true,lsb=true,mode=6)

PreFilter=4 means KNL, with Prefilter=2 (software) everything is ok.

Xebika
29th August 2015, 00:25
Is somebody using KNLMeans under Windows10_x64?

It worked perfectly under Windows8.1_x64 but in Windows10_x64 the preview of MeGUI stays frozen on a "grey" screen.

SetMTMode(5)
SetMemoryMax(2048)
LoadPlugin("D:\eseguibili\media\DGDecNV\DGDecodeNV.dll")
DGSource("E:\in\2_01 favoloso mondo di Amelie, Il\favoloso.dgi")
CompTest(1)
ChangeFPS(last,last,true)
SetMTMode(2)
SMDegrain (tr=4,PreFilter=4,thSAD=400,contrasharp=false,refinemotion=false,plane=4,chroma=true,lsb=true,mode=6)

PreFilter=4 means KNL, with Prefilter=2 (software) everything is ok.
Install this version of NVIDIA driver:

http://developer.download.nvidia.com/assets/gameworks/downloads/regular/oculus07driver/355.83/355.83_geforce_win10_64bit_international.exe

tormento
29th August 2015, 01:08
Install this version of NVIDIA driver

Thanks but no change at all.

In GPU-Z I can see a little bump in Video Engine and then nothing. :(

Xebika
29th August 2015, 01:20
Do you use desktop or notebook??

tormento
29th August 2015, 01:36
Do you use desktop or notebook??

I use the same hardware I had before, a desktop with 17-2600K and a GTX760. On Windows8.1_x64 ok, on Windows10_x64, ko.

Have you done a successful encode with Win10_x64?

Xebika
29th August 2015, 01:54
Yes i have some successful test clips, but can only get it to working with the version of the driver i posted.

tormento
29th August 2015, 02:07
Yes i have some successful test clips, but can only get it to working with the version of the driver i posted.

I have tried to run some OpenCL benchmarks to see if the 760 is correctly working, such as LuxMark.

It identifies the card as OpenCL 1.2 CUDA 7.5.0 device and runs benchmarks smootly.

No idea.

Neither simple KNLMeans() works.

Xebika
29th August 2015, 02:23
Ok I have no more ideas right now.

Khanattila
29th August 2015, 09:22
I use the same hardware I had before, a desktop with 17-2600K and a GTX760. On Windows8.1_x64 ok, on Windows10_x64, ko.

Have you done a successful encode with Win10_x64?

Same configuration here: http://www.techpowerup.com/gpuz/details.php?id=5p569.

Anyway, MT is NOT recommended with KNLMeansCL. Try mode=5 or mode=6.

tormento
29th August 2015, 14:48
I have disabled MT and now gives me a green screen with CUDA ERROR! in the upper left corner.

tormento
30th August 2015, 13:36
Are you sure your DGDecNV works fine in your Windows 10? How about just use the following simple script and see what you get?

Yes, a simple encoding with software filter works perfectly.

Update: the following script works, it must be a incompatibility between DGDecNV and KNLMeans together

LoadPlugin("D:\eseguibili\media\MeGUI\tools\lsmash\LSMASHSource.dll")
LWLibavVideoSource("F:\raw\favoloso mondo di Amelie, Il.mkv")
#deinterlace
crop(0, 128, 0, -134)
#resize
#denoise
CompTest(1)
ChangeFPS(last,last,true)
SetMTMode(2)
SMDegrain (tr=4,PreFilter=4,thSAD=400,contrasharp=false,refinemotion=false,plane=4,chroma=true,lsb=true,mode=6)

videoh
30th August 2015, 15:06
How much memory do you have on your video card?

tormento
30th August 2015, 15:10
How much memory do you have on your video card?

Look here (http://www.techpowerup.com/gpuz/details.php?id=vu7kg)

tormento
30th August 2015, 16:04
Even

SetMTMode(5)
SetMemoryMax(2048)
LoadPlugin("D:\eseguibili\media\DGDecIM\DGDecodeIM.dll")
dgsourceim("E:\in\2_01 favoloso mondo di Amelie, Il\favoloso.dgi",engine=1)
crop(0, 128, 0, -134)
CompTest(1)
ChangeFPS(last,last,true)
SetMTMode(2)
SMDegrain (tr=6,PreFilter=4,thSAD=400,contrasharp=false,refinemotion=false,plane=4,chroma=true,lsb=true,mode=6)

Works perfectly.

Khanattila
30th August 2015, 20:24
Yes, a simple encoding with software filter works perfectly.

Update: the following script works, it must be a incompatibility between DGDecNV and KNLMeans together

LoadPlugin("D:\eseguibili\media\MeGUI\tools\lsmash\LSMASHSource.dll")
LWLibavVideoSource("F:\raw\favoloso mondo di Amelie, Il.mkv")
#deinterlace
crop(0, 128, 0, -134)
#resize
#denoise
CompTest(1)
ChangeFPS(last,last,true)
SetMTMode(2)
SMDegrain (tr=4,PreFilter=4,thSAD=400,contrasharp=false,refinemotion=false,plane=4,chroma=true,lsb=true,mode=6)

I got it working now, because a new driver is released today but just a beta driver.

As another user reported, could be a problem of the nvidia driver.

tormento
31st August 2015, 00:08
As another user reported, could be a problem of the nvidia driver.

Xebika gave me the nvidia driver link. No fix.

tormento
31st August 2015, 00:09
Ok I have no more ideas right now.
Can you please post your avs script?

Xebika
31st August 2015, 00:11
Here:
LoadPlugin("C:\Video\MeGUI\tools\dgindexnv\DGDecodeNV.dll")
DGSource("C:\Video\Video.dgi",fieldop=0, deinterlace=1)
crop(24, 0, -8, -6)
Spline36Resize(768,576)
Levels(5, 1, 255, 0, 255)
SmoothContrast(contrast=0.2, sat=0.1)
LSFmod(defaults="slow")
KNLMeansCL(D=1, A=1, h=4.5)

tormento
31st August 2015, 13:21
Here:

Would you please try with a 1080p source?

Xebika
31st August 2015, 14:10
It worked fine.

Khanattila
1st September 2015, 11:28
v0.6.1 release: https://github.com/Khanattila/KNLMeansCL/releases.

It corrects an error that I had introduced in the previous version.

tormento
2nd September 2015, 15:03
v0.6.1 release
Even this version doesn't work for me with DGDecNV. It works for every other SW/HW decoder plugin.

Same green screen in preview with message "CUDA ERROR!".

MysteryX
2nd September 2015, 19:06
This version gives me this error:
KNLMeansCL: AviSynthCreate Error (clBuildProgram!)

detmek
2nd September 2015, 20:16
This version gives me this error:
KNLMeansCL: AviSynthCreate Error (clBuildProgram!)

Same here. I use it with StaxRip x64 and Avisynth+. Same error with 0.6.0. Builds up to 0.5.9 work just fine.

MysteryX
2nd September 2015, 20:24
I'm using AviSynth 2.6

Also, KNLMeans is giving me better results than FF3DFilter on most videos, but why is it giving me such bad output on this video? The lines in the background end up being very jerky (I know, the source video is bad quality), but FF3DFilter is doing a MUCH better job in this particular case. In most other videos with similarly bad quality, however, KNLMeans gives a better output.

Here's the video
https://mega.nz/#!CNICBS5S!56wGjk8gtKzc9HMrPfc8ZZuCCxdGgk4ms8mPXFr0nkY

KNLMeansCL(D=2, A=1, h=3, device_type="GPU")

Sparktank
3rd September 2015, 00:41
Win7 (x64) SP1
GTX 750 ti
GeForce 355.82 (newest; although I don't think much changed as far as video processing goes, mostly just new games)

KNLMeansCL v0.6.1
SetMemoryMax(512)
LoadPlugin("C:\AVS\dgdecnv2049\DGDecodeNV.dll")
DGSource("E:\Demux\Scream\Scream.dgi", crop_b=140, crop_t=132)
#KNLMeansCL(D=2, A=1, h=3, device_type="GPU", info=true)

"jerky lines in the background"

I don't see "jerky lines" in the sample video.
I grabbed a demux of the poorly mastered BD for Scream, since it's noisy and messy.
(Canadian BD Region A, identical to USA BD)

(all images are "large thumbnail", click to follow to original size (1920x816)
Here's original Frame #7282:
Focus: the white door frame behind Drew
http://i.imgur.com/wlbax1el.png (http://imgur.com/wlbax1e)

Here's with the settings used by MysteryX:
KNLMeansCL(D=2, A=1, h=3, device_type="GPU", info=true)
Focus: the white door frame behind Drew
http://i.imgur.com/0sRssNzl.png (http://imgur.com/0sRssNz)

Looks it denoises a lot of the main flat areas, but any edges are nearly the same.
When you scan forward, you can see this jerkiness it produces to due to unfiltered edges.
Some frames, the edges are cleaned out right.
And a large portion of (proceeding) frames, the noise varies, giving it a jerky look when played back.
At those setings.

Here's same settings, an earlier frame where the door frame is entirely denoised and clean edges.
Frame #7275:
http://i.imgur.com/yEf8hPml.png (http://imgur.com/yEf8hPm)

Frame #7276 is pretty clean too.
From there, it starts to degrade back to a noisy edge.

BUT
I changed parameters and found this:

Frame #7313
KNLMeansCL(D=3, A=0, h=3, device_type="GPU", info=true)
http://i.imgur.com/hHkWFFwl.png (http://imgur.com/hHkWFFw)
Jerky-ish lines.

Are those the kind of jerky lines you got?
I couldn't get those lines on the sample video with previous settings.
I haven't checked with new settings to see if jerky lines appear.

feisty2
3rd September 2015, 04:46
Win7 (x64) SP1
GTX 750 ti
GeForce 355.82 (newest; although I don't think much changed as far as video processing goes, mostly just new games)

KNLMeansCL v0.6.1
SetMemoryMax(512)
LoadPlugin("C:\AVS\dgdecnv2049\DGDecodeNV.dll")
DGSource("E:\Demux\Scream\Scream.dgi", crop_b=140, crop_t=132)
#KNLMeansCL(D=2, A=1, h=3, device_type="GPU", info=true)

"jerky lines in the background"

I don't see "jerky lines" in the sample video.
I grabbed a demux of the poorly mastered BD for Scream, since it's noisy and messy.
(Canadian BD Region A, identical to USA BD)

(all images are "large thumbnail", click to follow to original size (1920x816)
Here's original Frame #7282:
Focus: the white door frame behind Drew
http://i.imgur.com/wlbax1el.png (http://imgur.com/wlbax1e)

Here's with the settings used by MysteryX:
KNLMeansCL(D=2, A=1, h=3, device_type="GPU", info=true)
Focus: the white door frame behind Drew
http://i.imgur.com/0sRssNzl.png (http://imgur.com/0sRssNz)

Looks it denoises a lot of the main flat areas, but any edges are nearly the same.
When you scan forward, you can see this jerkiness it produces to due to unfiltered edges.
Some frames, the edges are cleaned out right.
And a large portion of (proceeding) frames, the noise varies, giving it a jerky look when played back.
At those setings.

Here's same settings, an earlier frame where the door frame is entirely denoised and clean edges.
Frame #7275:
http://i.imgur.com/yEf8hPml.png (http://imgur.com/yEf8hPm)

Frame #7276 is pretty clean too.
From there, it starts to degrade back to a noisy edge.

BUT
I changed parameters and found this:

Frame #7313
KNLMeansCL(D=3, A=0, h=3, device_type="GPU", info=true)
http://i.imgur.com/hHkWFFwl.png (http://imgur.com/hHkWFFw)
Jerky-ish lines.

Are those the kind of jerky lines you got?
I couldn't get those lines on the sample video with previous settings.
I haven't checked with new settings to see if jerky lines appear.

NLMeans degrades to something like "Motion Flow" (pixel wise motion compensation) by setting A=0 (spatial processing disabled)
and the jerky lines are just common motion flow artifacts
solution: enable spatial processing, pick an A value greater than 0

MysteryX
3rd September 2015, 04:49
I might as well post images of the video having bad results.

Original
http://s4.postimg.org/j7n92sj4p/Original.jpg (http://postimg.org/image/j7n92sj4p/)

KNLMeansCL(D=2, A=2, h=3, device_type="GPU")
http://s4.postimg.org/6ez52v7ix/KNLMeans.jpg (http://postimg.org/image/6ez52v7ix/)

fft3dfilter(sigma=3, bt=5, bw=48, bh=48, ow=24, oh=24, sharpen=0.15)
http://s4.postimg.org/8m3dqsct5/FF3_DFilter.jpg (http://postimg.org/image/8m3dqsct5/)

Khanattila
3rd September 2015, 09:44
This version gives me this error:
KNLMeansCL: AviSynthCreate Error (clBuildProgram!)

Same here. I use it with StaxRip x64 and Avisynth+. Same error with 0.6.0. Builds up to 0.5.9 work just fine.

Please report KNLMeansCL.txt.

Each driver has its own OpenCL compiler. I can not test all possible cases. :p

Khanattila
3rd September 2015, 10:11
NLMeans degrades to something like "Motion Flow" (pixel wise motion compensation) by setting A=0 (spatial processing disabled)
and the jerky lines are just common motion flow artifacts
solution: enable spatial processing, pick an A value greater than 0

:thanks:

Khanattila
3rd September 2015, 13:04
I'm using AviSynth 2.6

Also, KNLMeans is giving me better results than FF3DFilter on most videos, but why is it giving me such bad output on this video? The lines in the background end up being very jerky (I know, the source video is bad quality), but FF3DFilter is doing a MUCH better job in this particular case. In most other videos with similarly bad quality, however, KNLMeans gives a better output.

Here's the video
https://mega.nz/#!CNICBS5S!56wGjk8gtKzc9HMrPfc8ZZuCCxdGgk4ms8mPXFr0nkY

KNLMeansCL(D=2, A=1, h=3, device_type="GPU")

I might as well post images of the video having bad results.

Original
http://s4.postimg.org/j7n92sj4p/Original.jpg (http://postimg.org/image/j7n92sj4p/)

KNLMeansCL(D=2, A=2, h=3, device_type="GPU")
http://s4.postimg.org/6ez52v7ix/KNLMeans.jpg (http://postimg.org/image/6ez52v7ix/)

fft3dfilter(sigma=3, bt=5, bw=48, bh=48, ow=24, oh=24, sharpen=0.15)
http://s4.postimg.org/8m3dqsct5/FF3_DFilter.jpg (http://postimg.org/image/8m3dqsct5/)
KNLMeansCL works with similar patches. If similar patches are noise, output will have more noise.

YAFU
3rd September 2015, 22:07
Hello.
With this script by feisty2:
http://forum.doom9.org/showpost.php?p=1736920&postcount=234

vsedit shows me the following message:
Failed to evaluate the script:
Python exception: knlm.KNLMeansCL: VapourSynthCreate error (clBuildProgram)!
Traceback (most recent call last):
File "vapoursynth.pyx", line 1469, in vapoursynth.vpy_evaluateScript (src/cython/vapoursynth.c:23703)
File "/media/TEMPORAL/scrypt.vpy", line 60, in <module>
spt = core.std.CropRel (core.knlm.KNLMeansCL(padding(clp,24,24,24,24), 0, 24, 4, h=3.2),24,24,24,24)
File "vapoursynth.pyx", line 1368, in vapoursynth.Function.__call__ (src/cython/vapoursynth.c:22272)
vapoursynth.Error: knlm.KNLMeansCL: VapourSynthCreate error (clBuildProgram)!

I use Kubuntu 64 bits. I installed KNLMeansCL from github. I needed to install the "opencl-headres" package to compile in Kubuntu.
My graphics card is a GTX 960, using NVIDIA 355.11 driver. "nvidia_uvm" seems loaded into the kernel. nVidia OpenCL in Blender 3D seems to be working properly.

What could be causing the problem?

EDIT:
I have found that a file "KNLMeansCL.txt" is generated in the same folder as the script:
http://pastebin.com/4Cvep6w8

Another question. I have two devices that can use OpenCL, Nvidia and Intel. How to indicate in the script which device KNLMeansCL should use?

Khanattila
4th September 2015, 00:03
Hello.
With this script by feisty2:
http://forum.doom9.org/showpost.php?p=1736920&postcount=234

vsedit shows me the following message:
Failed to evaluate the script:
Python exception: knlm.KNLMeansCL: VapourSynthCreate error (clBuildProgram)!
Traceback (most recent call last):
File "vapoursynth.pyx", line 1469, in vapoursynth.vpy_evaluateScript (src/cython/vapoursynth.c:23703)
File "/media/TEMPORAL/scrypt.vpy", line 60, in <module>
spt = core.std.CropRel (core.knlm.KNLMeansCL(padding(clp,24,24,24,24), 0, 24, 4, h=3.2),24,24,24,24)
File "vapoursynth.pyx", line 1368, in vapoursynth.Function.__call__ (src/cython/vapoursynth.c:22272)
vapoursynth.Error: knlm.KNLMeansCL: VapourSynthCreate error (clBuildProgram)!

I use Kubuntu 64 bits. I installed KNLMeansCL from github. I needed to install the "opencl-headres" package to compile in Kubuntu.
My graphics card is a GTX 960, using NVIDIA 355.11 driver. "nvidia_uvm" seems loaded into the kernel. nVidia OpenCL in Blender 3D seems to be working properly.

What could be causing the problem?

EDIT:
I have found that a file "KNLMeansCL.txt" is generated in the same folder as the script:
http://pastebin.com/4Cvep6w8

Another question. I have two devices that can use OpenCL, Nvidia and Intel. How to indicate in the script which device KNLMeansCL should use?

The plugin use the first device available of type device_type. You can check it with info = true.
Or you can manually set the default opencl device in your system environment.

EDIT. v0.6.2 is required.
Tomorrow I correct everything. Others have had problems. :p

YAFU
4th September 2015, 00:31
Ok, I'll be tuned waiting to v0.6.2
Thank you.

Khanattila
4th September 2015, 18:24
https://github.com/Khanattila/KNLMeansCL/releases/tag/v0.6.2

This release should fix all problems.

YAFU
4th September 2015, 19:16
Hi.
I updated from git (git pull), compiled and installed (Kubuntu Linux 64 bits, nvidia 355.11 driver)

Still having similar error in vsedit, and this is the log:
http://pastebin.com/eiWtS3ws

I uninstalled intel OpenCL driver, so nvidia is the only OpenCL device.

sl1pkn07
4th September 2015, 19:26
i think is problem by vsedit (have a similar problem (http://sl1pkn07.wtf/paste/view/dff3ef19))

try:

vspipe -y script.vpy -i -

or

vspipe -y script.vpy - | mpv -

YAFU
4th September 2015, 19:37
Hey, with these commands my graphics card started making small weird treble sounds (they were no sounds of the fan). I stopped with Ctrl + C. What does that mean? Are there risks to break my card?

sl1pkn07
4th September 2015, 19:49
should not. i think

http://wstaw.org/m/2015/09/04/Screenshot_20150904_204833.png


maybe is a Coil Whine (https://www.youtube.com/watch?v=834oj3d7_jo) (?)

Are_
4th September 2015, 20:15
Depending on your locale you may need to change it to use this filter with vsedit:

LANG=C vsedit scritp.py

sl1pkn07
4th September 2015, 20:17
Depending on your locale you may need to change it to use this filter with vsedit:

LANG=C vsedit scritp.py

yep. this fix the(my) problem with vsedit

YAFU
4th September 2015, 20:25
@sl1pkn07
Yes, quite similar to that sound in this video. The strange thing is that it is the first time I hear that sound. I had my graphics card in long sessions rendering with Blender 3D/CUDA and this sound does not appear at all (it's a pretty quiet card). Perhaps bad optimized for OpenCL?

I'm testing this script with a set of PNG (script in message #234 and png images in message #241):
http://forum.doom9.org/showthread.php?t=171207&page=12

I run:
vspipe --y4m script.vpy - | ffmpeg -i pipe: -vcodec libx264 -crf 10 encoded.mkv

My nvidia card starts making these weird sounds, but I do not get messages in the terminal indicating that the script is working and the file "encoded.mkv" is never written to disk (I cancel at 15 seconds, I do not like that sound at all).

Edit:
Ok, I tried again and in Blender (CUDA or OpenCL) also makes some of that sound, but much less (I had to open the Case cover and close to it to hear the sound). Perhaps this plugin in vapoursynth is entering some kind of loop with OpenCL and my card?

sl1pkn07
4th September 2015, 21:07
the script is TOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOoooooooooooooooooooooooooooooooooooooooooo........... slow

http://wstaw.org/m/2015/09/04/Screenshot_20150904_220515.png

/me pats feisty2 XD

Are_
4th September 2015, 21:13
Also something is wrong somewhere with that script because... pink output, but yeah, what you experienced was your computer trying to die.

And now that we are at it, Khanattila, do you know if the problems with the locales in Linux is within your plug-in or with vsedit?
It's strange, because I only experienced this with knlmeanscl + vsedit, everything else is fine.

YAFU
4th September 2015, 21:45
So any of you could recommend me some script with which I can reduce noise in these 16 bits png images?

The story start here:
http://forum.doom9.org/showpost.php?p=1736889&postcount=227

With that script noise reduction is very good, but color banding appear. So there they recommended me to work with 16-bit color depth images, but Fft3d does not support 16 bits.

the idea is to save some time rendering in Blender 3D with low quality, and then reducing noise with vapoursynth.

detmek
4th September 2015, 22:05
Please report KNLMeansCL.txt.

Each driver has its own OpenCL compiler. I can not test all possible cases. :p

With 0.6.2 (same as with 0.6.0 and .1.

:133:34: error: use of logical '||' with constant operand
:133:34: note: use '|' for a bitwise operation
:161:34: error: use of logical '||' with constant operand
:161:34: note: use '|' for a bitwise operation

error: front end compiler failed build.

I only have Intel iGPU. No dedicated GPU. Latest Intel drivers for Windows 8.1 x64.

Up to 0.5.9 everything works just fine.

Khanattila
4th September 2015, 22:29
With 0.6.2 (same as with 0.6.0 and .1.



I only have Intel iGPU. No dedicated GPU. Latest Intel drivers for Windows 8.1 x64.

Up to 0.5.9 everything works just fine.

It is not possible. Try to re-download the file.

Khanattila
4th September 2015, 22:39
Also something is wrong somewhere with that script because... pink output, but yeah, what you experienced was your computer trying to die.

And now that we are at it, Khanattila, do you know if the problems with the locales in Linux is within your plug-in or with vsedit?
It's strange, because I only experienced this with knlmeanscl + vsedit, everything else is fine.

Maybe is my problem.

EDIT. Is my problem.
123.456 float example in my locate.
123,456 float example in your locate.

Khanattila
4th September 2015, 22:43
So any of you could recommend me some script with which I can reduce noise in these 16 bits png images?

The story start here:
http://forum.doom9.org/showpost.php?p=1736889&postcount=227

With that script noise reduction is very good, but color banding appear. So there they recommended me to work with 16-bit color depth images, but Fft3d does not support 16 bits.

the idea is to save some time rendering in Blender 3D with low quality, and then reducing noise with vapoursynth.

If you are in this thread, you probably want to try KNLMeansCL.

Khanattila
4th September 2015, 22:46
@sl1pkn07
Yes, quite similar to that sound in this video. The strange thing is that it is the first time I hear that sound. I had my graphics card in long sessions rendering with Blender 3D/CUDA and this sound does not appear at all (it's a pretty quiet card). Perhaps bad optimized for OpenCL?

I'm testing this script with a set of PNG (script in message #234 and png images in message #241):
http://forum.doom9.org/showthread.php?t=171207&page=12

I run:
vspipe --y4m script.vpy - | ffmpeg -i pipe: -vcodec libx264 -crf 10 encoded.mkv

My nvidia card starts making these weird sounds, but I do not get messages in the terminal indicating that the script is working and the file "encoded.mkv" is never written to disk (I cancel at 15 seconds, I do not like that sound at all).

Edit:
Ok, I tried again and in Blender (CUDA or OpenCL) also makes some of that sound, but much less (I had to open the Case cover and close to it to hear the sound). Perhaps this plugin in vapoursynth is entering some kind of loop with OpenCL and my card?

I do not know your system, but KNLMeansCL is well optimized.
It is not perfect, but it is well optimized.

YAFU
5th September 2015, 00:05
If you are in this thread, you probably want to try KNLMeansCL.

Yeah, the script we were talking used KNLMeansCL (I guess, I do not know much about these things). What happens is that I have no idea on how to create these scripts. What I was wondering if you could recommend me other script that uses KNLMeansCL with which to reduce that kind of noise generated by Blender 3D.

I searched through this thread, and the truth is that I understand almost nothing about the technical things that are mentioned here.

feisty2
5th September 2015, 03:54
the script is TOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOoooooooooooooooooooooooooooooooooooooooooo........... slow

http://wstaw.org/m/2015/09/04/Screenshot_20150904_220515.png

/me pats feisty2 XD

now that dct=5-10 works, it could be even slower, and yet I ain't gotten dfttest to join the game to do the low frequency denoising

Also something is wrong somewhere with that script because... pink output, but yeah, what you experienced was your computer trying to die.
I had tested that script before I posted it out, so it should work, tho I only did my test on a GRAYS clip

Yeah, the script we were talking used KNLMeansCL (I guess, I do not know much about these things). What happens is that I have no idea on how to create these scripts. What I was wondering if you could recommend me other script that uses KNLMeansCL with which to reduce that kind of noise generated by Blender 3D.

I searched through this thread, and the truth is that I understand almost nothing about the technical things that are mentioned here.

then forget about mvtools
this simple little script is still kind of high quality


import vapoursynth as vs
core = vs.get_core()
clp = core.imwri.Read('png-50/%04d.png', firstnum=1, alpha=False)
clp = core.fmtc.bitdepth (clp, bits=32, fulls=True, fulld=True, flt=True)
clp = core.knlm.KNLMeansCL(clp, d=3, a=12, s=4, h=3.2)
clp.set_output ()

kalehrl
5th September 2015, 08:12
How to install this KNLMeansCL?
Where the put the files from the archive?
I put KNLMeansCL.dll in avisynth plugins folder and the script gives me this error:
"There is no function named KNLMeansCL"

Groucho2004
5th September 2015, 08:41
How to install this KNLMeansCL?
Where the put the files from the archive?
I put KNLMeansCL.dll in avisynth plugins folder and the script gives me this error:
"There is no function named KNLMeansCL"
You have to install the "Visual C++ Redistributable Package for Visual Studio 2013 (http://www.microsoft.com/en-us/download/details.aspx?id=40784)".

feisty2
5th September 2015, 08:48
Heard vs2015 gonna support ELF binaries, good news to Linux guys, don't need to install it manually no more

tormento
5th September 2015, 12:22
Yet no good for me with 0.6.2 and DGDecNV :mad:

With this script:
SetMTMode(5)
SetMemoryMax(2048)
LoadPlugin("D:\eseguibili\media\DGDecIM\DGDecodeIM.dll")
DGSourceIM("E:\in\1_46 Don Camillo\camillo01.dgi",engine=1)
ChangeFPS(last,last,true)
crop(244, 0, -244, -8)
SetMTMode(2)
SMDegrain (tr=6,PreFilter=4,thSAD=400,contrasharp=false,refinemotion=false,plane=4,chroma=true,lsb=true,mode=6)

I get this

http://i.imgur.com/bNYMGZOm.jpg (http://imgur.com/bNYMGZO)

With this even simpler one:
LoadPlugin("D:\eseguibili\media\DGDecNV\DGDecodeNV.dll")
DGSource("E:\in\1_46 Don Camillo\camillo01.dgi")
crop(244, 0, -244, -8)
KNLMeansCL(device_type="GPU", info=true)
I get green preview with CUDA ERROR! text in upper left corner.

YAFU
5th September 2015, 13:28
@feisty2, I tried this little script. vsedit does not show any problem when I choose "Check script". But when I choose "Preview" vsedit closes and I get this error in linux terminal:

QWidget::insertAction: Attempt to insert null action
vsedit: symbol lookup error: /usr/local/lib/vapoursynth/libknlmeanscl.so: undefined symbol: GOMP_parallel_start

I get the same error with vspipe:
vspipe: symbol lookup error: /usr/local/lib/vapoursynth/libknlmeanscl.so: undefined symbol: GOMP_parallel_start

Khanattila
5th September 2015, 14:26
@feisty2, I tried this little script. vsedit does not show any problem when I choose "Check script". But when I choose "Preview" vsedit closes and I get this error in linux terminal:

QWidget::insertAction: Attempt to insert null action
vsedit: symbol lookup error: /usr/local/lib/vapoursynth/libknlmeanscl.so: undefined symbol: GOMP_parallel_start

I get the same error with vspipe:
vspipe: symbol lookup error: /usr/local/lib/vapoursynth/libknlmeanscl.so: undefined symbol: GOMP_parallel_start

You have to set the -fopenmp as a link option.
Or use the configure attachment.

Khanattila
5th September 2015, 14:28
Yet no good for me with 0.6.2 and DGDecNV :mad:

With this script:
SetMTMode(5)
SetMemoryMax(2048)
LoadPlugin("D:\eseguibili\media\DGDecIM\DGDecodeIM.dll")
DGSourceIM("E:\in\1_46 Don Camillo\camillo01.dgi",engine=1)
ChangeFPS(last,last,true)
crop(244, 0, -244, -8)
SetMTMode(2)
SMDegrain (tr=6,PreFilter=4,thSAD=400,contrasharp=false,refinemotion=false,plane=4,chroma=true,lsb=true,mode=6)

I get this

http://i.imgur.com/bNYMGZOm.jpg (http://imgur.com/bNYMGZO)

With this even simpler one:
LoadPlugin("D:\eseguibili\media\DGDecNV\DGDecodeNV.dll")
DGSource("E:\in\1_46 Don Camillo\camillo01.dgi")
crop(244, 0, -244, -8)
KNLMeansCL(device_type="GPU", info=true)
I get green preview with CUDA ERROR! text in upper left corner.
http://mirror.srobarka.sk/pub/Software/English/Audio%20and%20video/MeGUI/MeGUI_2507_x86/tools/dgindexnv/DGDecodeNVManual.html
use_D3D: true/false (default: false)

Use D3D operation. This should be set only if you receive a decoder creation error when it is not set. Some versions of the Nvidia driver require D3D operation.
Always first try with use_D3D set to false and set it to true only if a decoder creation error is encountered.

Try it.

YAFU
5th September 2015, 15:27
You have to set the -fopenmp as a link option.
Or use the configure attachment.

Sorry, I searched on google about that and I'm a little lost here.
Is that when I compile?

I compiled KNLMeansCL with:
./configure
make
sudo make install

Khanattila
5th September 2015, 15:43
Sorry, I searched on google about that and I'm a little lost here.
Is that when I compile?

I compiled KNLMeansCL with:
./configure
make
sudo make install


It's correct. Your operating system?

YAFU
5th September 2015, 15:59
Kubuntu Linux 14.04 64 bits.
I do not know if this is related, but I have installed a package called "libgomp1" v4.8.4 containing "/usr/lib/x86_64-linux-gnu/libgomp.so.1" and "/usr/lib/x86_64-linux-gnu/libgomp.so.1.0.0"

Khanattila
5th September 2015, 16:43
Kubuntu Linux 14.04 64 bits.
I do not know if this is related, but I have installed a package called "libgomp1" v4.8.4 containing "/usr/lib/x86_64-linux-gnu/libgomp.so.1" and "/usr/lib/x86_64-linux-gnu/libgomp.so.1.0.0"

llibgomp1 provide OpenMP, it's correct.

I have read the log of the terminal to figure out what went wrong.

YAFU
5th September 2015, 19:13
This is what I get with ./configure and make
http://pastebin.com/tn4zzUx4

MysteryX
5th September 2015, 19:30
I'm currently running KNLMeans on a very noisy 1080p video and it's running very slowly with the GPU topping at 100%. I have a dual-graphics with Intel HD 4000 and Radeon 7670M, and you're using the Intel HD by default.

You say I have to change the default OpenCL device for my system? How do I do that?

MysteryX
5th September 2015, 20:24
Actually, right now KNLMeans is running on the Intel HD 4000 while InterFrame is running on the Radeon 7670M, and both are capped at 100%, so perhaps it's best this way.

tormento
5th September 2015, 21:43
Always first try with use_D3D set to false and set it to true only if a decoder creation error is encountered.

Tried. Error: Failed to find CUDA D3D device.

P.S: If you prefer I'm italian too. I can't PM you but you can PM me with some email address to continue thread

MysteryX
5th September 2015, 23:41
0.6.2 works for me.

Sparktank
6th September 2015, 00:57
Tried. Error: Failed to find CUDA D3D device.

Tried re-install?
Advanced -> "clean" install.

Sparktank
6th September 2015, 01:01
NLMeans degrades to something like "Motion Flow" (pixel wise motion compensation) by setting A=0 (spatial processing disabled)
and the jerky lines are just common motion flow artifacts
solution: enable spatial processing, pick an A value greater than 0

:cool:Noted!
I don't play with much parameters for this, aside from "h".
But since all the updates, I decided to play a little more with different settings.

tormento
6th September 2015, 01:08
Tried re-install?
Advanced -> "clean" install.
Windows 10 enterprise x64 clean install, one week life.

kalehrl
6th September 2015, 09:58
You have to install the "Visual C++ Redistributable Package for Visual Studio 2013 (http://www.microsoft.com/en-us/download/details.aspx?id=40784)".
Thanks.
I installed those packages and it works now, sort of.
I get preview in avspmod and when I load the script in megui I also get the preview and no error.
However, when I start encoding, this is the error I get:
---[Error] [6.9.2015. 10.54.46] avs [error]: Script error: there is no function named "KNLMeansCL"
---[Information] [6.9.2015. 10.54.46] (C:\Users\kaleh\Desktop\20131112_-_TOP_GEAR_cut_out-muxed.mkv.avs, line 7)
--[Error] [6.9.2015. 10.54.46] Process exits with error: 0xFFFFFFFF (-1)
--[Warning] [6.9.2015. 10.54.46] The 64 bit mode of x264 is enabled. Depending on the error it may help to disable it in the MeGUI settings.
--[Information] [6.9.2015. 10.54.46] Job completed
I tried disabling 64 bit mode of x264 in megui but it still doesn't work.
EDIT: x264 encoding gives me this error but xvid works fine.

Khanattila
6th September 2015, 11:11
This is what I get with ./configure and make
http://pastebin.com/tn4zzUx4

warning: pkg-config or pc files not found, lib detection may be inaccurate.


sudo apt-get install pkg-config ocl-icd-*
./configure
make
sudo make install

Khanattila
6th September 2015, 11:31
I'm currently running KNLMeans on a very noisy 1080p video and it's running very slowly with the GPU topping at 100%. I have a dual-graphics with Intel HD 4000 and Radeon 7670M, and you're using the Intel HD by default.

You say I have to change the default OpenCL device for my system? How do I do that?

Actually, right now KNLMeans is running on the Intel HD 4000 while InterFrame is running on the Radeon 7670M, and both are capped at 100%, so perhaps it's best this way.

For "unknown" reasons, Intel driver set itself as default device.
Now I not find the publication but I will change the system of the plugin soon.

Khanattila
6th September 2015, 11:34
Tried. Error: Failed to find CUDA D3D device.

P.S: If you prefer I'm italian too. I can't PM you but you can PM me with some email address to continue thread

Ok, PM.

Khanattila
6th September 2015, 11:38
Thanks.
I installed those packages and it works now, sort of.
I get preview in avspmod and when I load the script in megui I also get the preview and no error.
However, when I start encoding, this is the error I get:
---[Error] [6.9.2015. 10.54.46] avs [error]: Script error: there is no function named "KNLMeansCL"
---[Information] [6.9.2015. 10.54.46] (C:\Users\kaleh\Desktop\20131112_-_TOP_GEAR_cut_out-muxed.mkv.avs, line 7)
--[Error] [6.9.2015. 10.54.46] Process exits with error: 0xFFFFFFFF (-1)
--[Warning] [6.9.2015. 10.54.46] The 64 bit mode of x264 is enabled. Depending on the error it may help to disable it in the MeGUI settings.
--[Information] [6.9.2015. 10.54.46] Job completed
I tried disabling 64 bit mode of x264 in megui but it still doesn't work.
EDIT: x264 encoding gives me this error but xvid works fine.

I tried MeGUI and it works. What version of AviSynth?
However it should MeGUI problem, not my.

YAFU
6th September 2015, 14:42
@Khanattila, Thanks for your time.
I have these packages installed.

I've done more tests, I reinstalled Intel OpenCL. I am using this script:
import vapoursynth as vs
core = vs.get_core()

clp = core.imwri.Read('/media/TEMPORAL/images_16/%04d.png', firstnum=1, alpha=False)
clp = core.fmtc.bitdepth (clp, bits=32, fulls=True, fulld=True, flt=True)
clp = core.knlm.KNLMeansCL(clp, d=3, a=12, s=4, h=6.4, device_type="CPU")
clp.set_output ()


With "GPU" I keep getting the same error I had told you in message #360. With "CPU" Check Script is ok and shows no errors (like GPU), but with "Preview" sometimes vsedit is closed with the same error that shows "GPU" and sometimes shows the next message:
Failed to evaluate the script:
Python exception: No attribute with the name imwri exists. Did you mistype a plugin namespace?
Traceback (most recent call last):
File "vapoursynth.pyx", line 1469, in vapoursynth.vpy_evaluateScript (src/cython/vapoursynth.c:23703)
File "/media/TEMPORAL/script.vpy", line 9, in <module>
clp = core.imwri.Read('/media/TEMPORAL/images_16/%04d.png', firstnum=1, alpha=False)
File "vapoursynth.pyx", line 1090, in vapoursynth.Core.__getattr__ (src/cython/vapoursynth.c:18137)
AttributeError: No attribute with the name imwri exists. Did you mistype a plugin namespace?


That's weird, because I have "imwri" installed and it works well with the other script I mentioned in mv tools thread.
Have you tried this script with images? Are this script working on your computer?

Then I tried with videos using this script:
import vapoursynth as vs
core = vs.get_core()

##ffmpeg with ffms2
core.std.LoadPlugin('/usr/lib/x86_64-linux-gnu/libffms2.so.3')
clp = core.ffms2.Source(source='/media/TEMPORAL/test.mp4')

clp = core.knlm.KNLMeansCL(clp, d=3, a=12, s=4, h=6.4, device_type="GPU")
clp.set_output ()

This is somewhat slow (0.6 fps in GPU), but KNLMeansCL is working well with videos both, CPU and GPU.


So, do you have any idea why it does not work with images and "imwri"?

sl1pkn07
6th September 2015, 17:16
I get


vspipe: symbol lookup error: /usr/lib/vapoursynth/libknlmeanscl.so: undefined symbol: GOMP_parallel


when use script above with this http://forum.doom9.org/showthread.php?p=1736990#post1736990 files

YAFU
6th September 2015, 18:30
Same error then.

With these 16 bit png, How could I create some kind of lossless video keeping the 16-bit color depth? Perhaps with ffmpeg, but how?
This I say for apply to the obtained video the KNLMeansCL script for videos.

poisondeathray
6th September 2015, 20:07
With these 16 bit png, How could I create some kind of lossless video keeping the 16-bit color depth? Perhaps with ffmpeg, but how?
This I say for apply to the obtained video the KNLMeansCL script for videos.

you can use ffv1 in ffmpeg, which supports many configurations including 16bits/channel

eg it might look something like this



ffmpeg -r 24 -i "media/TEMPORAL/images_16/%04d.png" -start_number 0 -c:v ffv1 -an ffv1_output.avi

sl1pkn07
6th September 2015, 20:21
if add

clp = core.fmtc.matrix(clp, mat="709", col_fam=vs.YUV)

works ok (if use info=False)

----

i have a little trouble

i have installed generic OpenCL from ocl-icd, cuda 7 (for nvidia OpenCL) and Intel OpenCL 15.1 (for CPU OpenCL)

when use device_type="DEFAULT" works Ok (use GPU), when use device_type="CPU" works Ok (use CPU). but when use device_type="GPU" get segfault in libOpenCL.so

segfault at abacadc3 ip 00007fa5958511f8 sp 00007fff93d4d648 error 4 in libOpenCL.so[7fa59584f000+5000]

I'm not sure what libOpencl.so fails


/opt/cuda/lib64/libOpenCL.so
/opt/cuda/lib64/libOpenCL.so.1
/opt/intel/opencl-1.2-5.0.0.57/lib64/libOpenCL.so
/opt/intel/opencl-1.2-5.0.0.57/lib64/libOpenCL.so.1
/opt/intel/opencl-1.2-5.0.0.57/lib64/libOpenCL.so.1.2
/usr/lib/libOpenCL.so
/usr/lib/libOpenCL.so.1
/usr/lib/libOpenCL.so.1.0.0


any help?

greetings

foxyshadis
7th September 2015, 01:18
@Khanattila, Thanks for your time.
I have these packages installed.

I've done more tests, I reinstalled Intel OpenCL. I am using this script:
import vapoursynth as vs
core = vs.get_core()

clp = core.imwri.Read('/media/TEMPORAL/images_16/%04d.png', firstnum=1, alpha=False)
clp = core.fmtc.bitdepth (clp, bits=32, fulls=True, fulld=True, flt=True)
clp = core.knlm.KNLMeansCL(clp, d=3, a=12, s=4, h=6.4, device_type="CPU")
clp.set_output ()


With "GPU" I keep getting the same error I had told you in message #360. With "CPU" Check Script is ok and shows no errors (like GPU), but with "Preview" sometimes vsedit is closed with the same error that shows "GPU" and sometimes shows the next message:
Failed to evaluate the script:
Python exception: No attribute with the name imwri exists. Did you mistype a plugin namespace?
Traceback (most recent call last):
File "vapoursynth.pyx", line 1469, in vapoursynth.vpy_evaluateScript (src/cython/vapoursynth.c:23703)
File "/media/TEMPORAL/script.vpy", line 9, in <module>
clp = core.imwri.Read('/media/TEMPORAL/images_16/%04d.png', firstnum=1, alpha=False)
File "vapoursynth.pyx", line 1090, in vapoursynth.Core.__getattr__ (src/cython/vapoursynth.c:18137)
AttributeError: No attribute with the name imwri exists. Did you mistype a plugin namespace?


That's weird, because I have "imwri" installed and it works well with the other script I mentioned in mv tools thread.
Have you tried this script with images? Are this script working on your computer?

Might be worth running under valgrind and/or gdb to see if anything strange pops out, especially if you can rebuild everything as debug. There's no good reason imwri should fail to load unless something weird is going on.

Khanattila
7th September 2015, 18:27
https://github.com/Khanattila/KNLMeansCL/releases/tag/v0.6.3

Another day of bug-fixes.

Khanattila
7th September 2015, 18:38
I get random crash when using 64-bit vspipe with the following script. When either cmode=False or using 32-bit vspipe, crash doesn't happen.


import vapoursynth as vs
core = vs.get_core()

clip = core.std.BlankClip(format=vs.YUV444P16)
clip = core.knlm.KNLMeansCL(clip, cmode=True)
clip.set_output()


Simply use the following command and repeat it a few times.
vspipe -p foo.vpy NUL

OS: Win10 Pro x64
GPU: GeForce GTX 660
Driver: 355.82

Confirmed.

Khanattila
7th September 2015, 21:34
if add

clp = core.fmtc.matrix(clp, mat="709", col_fam=vs.YUV)

works ok (if use info=False)

----

i have a little trouble

i have installed generic OpenCL from ocl-icd, cuda 7 (for nvidia OpenCL) and Intel OpenCL 15.1 (for CPU OpenCL)

when use device_type="DEFAULT" works Ok (use GPU), when use device_type="CPU" works Ok (use CPU). but when use device_type="GPU" get segfault in libOpenCL.so

segfault at abacadc3 ip 00007fa5958511f8 sp 00007fff93d4d648 error 4 in libOpenCL.so[7fa59584f000+5000]

I'm not sure what libOpencl.so fails


/opt/cuda/lib64/libOpenCL.so
/opt/cuda/lib64/libOpenCL.so.1
/opt/intel/opencl-1.2-5.0.0.57/lib64/libOpenCL.so
/opt/intel/opencl-1.2-5.0.0.57/lib64/libOpenCL.so.1
/opt/intel/opencl-1.2-5.0.0.57/lib64/libOpenCL.so.1.2
/usr/lib/libOpenCL.so
/usr/lib/libOpenCL.so.1
/usr/lib/libOpenCL.so.1.0.0


any help?

greetings

Use device_id in the v0.6.3 :sly:

sl1pkn07
7th September 2015, 21:54
yep, but have another little trouble with 0.6.3

when try to use with vsedit, when run in a first time, the preview window (F5) works ok, but when close the preview window, and change anything in the the script (or just reload the preview without changes), vsedit it hangs/freezes.

only happens when try to load the preview in a second time,

tested with CPU, GPU, ALL, DEFAULT (including setting the device_id)

YAFU
7th September 2015, 23:32
@poisondeathray, thanks for that command.
@foxyshadis, if I comment the line containing "core.fmtc.bitdepth" and add the line suggested by sl1pkn07, the script works. Thanks sl1pkn07.
@Khanattila, Nice speed improvement on my system with 0.6.3. With the value "a=12" in the script, before 0.6 fps. Now 6 fps! Now I can do some testings with more comfort.
The only problem that remains, if I use a greater than 4 value in "s", it does not work and I get the message "pipe:: Invalid data found when processing input". Is 4 the maximum value that can take "s"?

Khanattila
7th September 2015, 23:54
@poisondeathray, thanks for that command.
@foxyshadis, if I comment the line containing "core.fmtc.bitdepth" and add the line suggested by sl1pkn07, the script works. Thanks sl1pkn07.
@Khanattila, Nice speed improvement on my system with 0.6.3. With the value "a=12" in the script, before 0.6 fps. Now 6 fps! Now I can do some testings with more comfort.
The only problem that remains, if I use a greater than 4 value in "s", it does not work and I get the message "pipe:: Invalid data found when processing input". Is 4 the maximum value that can take "s"?

Yes, for hardware performance limitations.
For bigger s I need to implement a transpose kernel.
But original Non-local means use s=3, it is not a great limitation.

You have 0.6 fps when using the CPU instead of the GPU.

Khanattila
7th September 2015, 23:59
yep, but have another little trouble with 0.6.3

when try to use with vsedit, when run in a first time, the preview window (F5) works ok, but when close the preview window, and change anything in the the script (or just reload the preview without changes), vsedit it hangs/freezes.

only happens when try to load the preview in a second time,

tested with CPU, GPU, ALL, DEFAULT (including setting the device_id)

:script: :logfile:

I have to first be able to replicate it.

YAFU
8th September 2015, 01:04
You have 0.6 fps when using the CPU instead of the GPU.

No no, I was getting 0.6 with GPU. With CPU even less. Now CPU=0.5 fps and GPU=6 fps. But for that there is no doubt I just compile and install 0.6.2 again:
(GPU: GTX 960; CPU: i7 3770)
0.6.2:
CPU= wait a minute and it does not even start...
GPU= 0.6 fps

0.6.3:
CPU= 0.5 fps
GPU= 6 fps

I do not know what has changed in the code of the new version.

sl1pkn07
8th September 2015, 05:37
:script: :logfile:

I have to first be able to replicate it.

any script who uses knlmeanscl? XD

feisty2
8th September 2015, 05:52
I do, but it works just fine on windows

tormento
8th September 2015, 11:04
I put my previous Win8.1_x64 booting disk in my PC. Same HW configuration, same encoding plugins, etc. Everything works as it should.

So, I have done some research with Google and I have found the following in the Blender forum:

Blender uses CUDA 6.5, but it does not support win10 officially.
CUDA Toolkit 6.5
win10 should be supported by CUDA7.5RC.
nVidia Developer Zone

It does not think it's strange even if an error occurs in my opinion.

If any has ideas on how to solve this problem, please give hint.

Khanattila
8th September 2015, 11:12
Apparently the parameter "d" loses its functionality with 0.6.3 in VapourSynth. Check it with info=True. No matter what value you set, "D" is always displaying 1. That's the reason why YAFU got false speed improvement.

Here's what happens to have little experience with vapoursynth. :rolleyes:

https://github.com/Khanattila/KNLMeansCL/releases/tag/v0.6.3-1

Khanattila
8th September 2015, 16:50
I get random crash when using 64-bit vspipe with the following script. When either cmode=False or using 32-bit vspipe, crash doesn't happen.


import vapoursynth as vs
core = vs.get_core()

clip = core.std.BlankClip(format=vs.YUV444P16)
clip = core.knlm.KNLMeansCL(clip, cmode=True)
clip.set_output()


Simply use the following command and repeat it a few times.
vspipe -p foo.vpy NUL

OS: Win10 Pro x64
GPU: GeForce GTX 660
Driver: 355.82

Confirmed.

Seems like vspipe does not like openmp.

sl1pkn07
8th September 2015, 19:40
I put my previous Win8.1_x64 booting disk in my PC. Same HW configuration, same encoding plugins, etc. Everything works as it should.

So, I have done some research with Google and I have found the following in the Blender forum:



If any has ideas on how to solve this problem, please give hint.

try with the new cuda released today https://developer.nvidia.com/cuda-toolkit

videoh
8th September 2015, 22:12
DGDecNV has to be rebuilt with CUDA 7.5, but even then there is no guarantee. It's just something to try. Sadly I can't say when I would have time to do this. Also, CUDA 7.5 will lose the compute sm_1x cards, such as the GT 220. nVidia does not have a solution for this problem, and I'm not keen to maintain multiple versions. I could go back to SW for the DGIndexNV display code and ditch CUDA (not CUVID!) but I'm not keen on that either. :(

Myrsloik
8th September 2015, 22:17
Seems like vspipe does not like openmp.

Try it again with r28 test 2. It may work. Or maybe not...

Khanattila
8th September 2015, 22:53
Try it again with r28 test 2. It may work. Or maybe not...

I'll try, alternatively I could use some SIMD instructions but I do not have much experience.

Myrsloik
8th September 2015, 23:06
I'll try, alternatively I could use some SIMD instructions but I do not have much experience.

Are you certain the openmp stuff makes it significantly faster? It's only used on trivial loops so if it's run in a multithreaded way with other filters you'll run out of memory bandwidth anyway.

Khanattila
8th September 2015, 23:39
Are you certain the openmp stuff makes it significantly faster? It's only used on trivial loops so if it's run in a multithreaded way with other filters you'll run out of memory bandwidth anyway.

EDIT.

AviSynth. (720p, d=0, a=2, "GPU")

RGB (no buffer) ==> 95.57 fps
YUV (buffer - 1 thread) ==> 69.64 fps
YUV (buffer - 4 thread) ==> 82.02 fps

Khanattila
9th September 2015, 01:12
Libswscale? It could be faster.

Myrsloik
9th September 2015, 09:09
Why not do the packing and unpacking in the opencl code?

Khanattila
9th September 2015, 11:07
Why not do the packing and unpacking in the opencl code?

So, it's like that.

__kernel
void NLM_pack(__read_only image2d_t R, __read_only image2d_t G, __read_only image2d_t B, __write_only image2d out) {

sample_t smp = ...;
int2 coord2 = (int2) (get_global_id(0), get_global_id(1));
float r = read_imagef(R, smp, coord2).x;
float g = read_imagef(G, smp, coord2).x;
float b = read_imagef(B, smp, coord2).x;
float4 val = (float4) (b, g, r, 1.0f);
write_imagef(out, coord2, val);

}

I'll try.

Khanattila
10th September 2015, 10:35
720p.

AviSynth YUV420P8 (no buffer): 148 fps
AviSynth YUV420P16 (OpenMP buffer): 111 fps
AviSynth RGB32 (no buffer): 96 fps
AviSynth YUV444P8 (OpenMP buffer): 81 fps
AviSynth YUV444P16 (OpenMP buffer): 57 fps

VapourSynth YUV420P8 (no buffer): 121 fps
VapourSynth YUV420P16 (no buffer): 112 fps
VapourSynth RGB24 (OpenCL buffer): 84 fps
VapourSynth YUV444P8 (OpenCL buffer): 85 fps
VapourSynth YUV444P16 (OpenCL buffer): 70 fps


It seems to work well.

videoh
10th September 2015, 14:12
@tormento

Here is a 64-bit test version of DGDecNV built with CUDA 7.5. Please advise your results.

http://rationalqm.us/misc/tormento_64.zip

Note that sm_1x support is dropped by CUDA 7.5.

YAFU
10th September 2015, 14:34
@Khanattila, With what parameters in KNLMeansCL you get those fps?
Which is your graphics card?

Khanattila
10th September 2015, 15:18
@Khanattila, With what parameters in KNLMeansCL you get those fps?
Which is your graphics card?

vs r27, avs 2.6.0
default... d=0, a=2, with a GTX 760

https://github.com/Khanattila/KNLMeansCL/releases/tag/v0.6.4

YAFU
10th September 2015, 17:31
I get about 24-28 fps with "imwri" and also with "ffms2" in movies, 720p. GTX 960. Same version of VS. Using vspipe from terminal.
Supposedly these two graphics cards are similar. Could this be because some component in Linux?

Khanattila
10th September 2015, 19:57
I get about 24-28 fps with "imwri" and also with "ffms2" in movies, 720p. GTX 960. Same version of VS. Using vspipe from terminal.
Supposedly these two graphics cards are similar. Could this be because some component in Linux?

I have test with BlankClip.
You must try to reduce the impact of other plugins.

core.std.BlankClip(width=1280, height=720, format=vs.YUV420P8)

YAFU
11th September 2015, 01:52
Ok, now I am using this script:
import vapoursynth as vs
core = vs.get_core()
clp = core.std.BlankClip(width=1280, height=720, format=vs.YUV420P8, length=1000)
clp = core.knlm.KNLMeansCL(clp, d=0, a=2, device_type="GPU")
clp.set_output ()


and "vspipe --y4m script.vpy - | ffmpeg -i pipe: -vcodec libx264 -crf 5 encoded.mkv"

That way I get 123 fps. I do not know if that result is with or without that "buffer" you wrote. I guess "no buffer"

Khanattila
11th September 2015, 08:19
Ok, now I am using this script:
import vapoursynth as vs
core = vs.get_core()
clp = core.std.BlankClip(width=1280, height=720, format=vs.YUV420P8, length=1000)
clp = core.knlm.KNLMeansCL(clp, d=0, a=2, device_type="GPU")
clp.set_output ()


and "vspipe --y4m script.vpy - | ffmpeg -i pipe: -vcodec libx264 -crf 5 encoded.mkv"

That way I get 123 fps. I do not know if that result is with or without that "buffer" you wrote. I guess "no buffer"

OpenCL support only packed format.

not supported: | BBBBBBBB | GGGGGGGG | RRRRRRRR | AAAAAAAA |
supported: | BGRA | BGRA | BGRA | BGRA | BGRA | BGRA | BGRA | BGRA |

So, a pre-filter is required.

loneboyz
13th September 2015, 13:31
KNLMeansCL, this plugin was very wonderful, thank author!

I've tested it with source PAL DVD, that's very noise and result was nice

But I've having a problem while encoding, please give me advice

My source have all 139.512 frames, when run x264 can only encode about below 32.700 frames then appear error

Avisynth error at frame 32792
KNLMeansCL: AvisynthGetFrame error!

If I use Trim in script cut about 32.500 frame then encode, this error don't appear

This is my script I used:
DGDecode_mpeg2source("F:\Setup\Encode\Work\nk.d2v")

y = ConvertToY8().Crop(0,1,0,-1).Padding(0,1,0,1)
u = UToY8().Crop(0,1,0,-1).Padding(0,1,0,1)
v = VToY8().Crop(0,1,0,-1).Padding(0,1,0,1)

YToUV(u,v,y)

#deinterlace
#~ AssumeTFF()
interp = nnedi3(field=1)
tdeint(mode=0,order=1,field=1,edeint=interp,slow=2,emask=TMM(mode=0,order=1,field=1)).Vinverse()

BlindDeHalo3(3,3,125,PPmode=-1) #,PPmode=-3,PPlimit=4
#DeHalo_alpha(ss=2,rx=2.5,ry=2.5,darkstr=0,highsens=100)

KNLMeansCL(D=1, A=1, h=4.5)
#~ f3kdb(dither_algo=3, Y=68, range=15, grainY=0, grainC=0, dynamic_grain=true)

GradFun3 (thr=0.42, smode=2)

FineSharp()

Some info my PC:
- Windows 7 Ultimate 64bit
- Chip intel core i5-4210U @1.7GHz (4CPUs)
- Graphic onboard Intel HD 4400, memory 1696 MB
- Ram 4G
- x264 64b + avs2yuv
- Avisynth 2.6.0.6 32b
- OpenGL 4.0 v9.18.10.3234

Thanks!

Groucho2004
13th September 2015, 13:53
But I've having a problem while encoding, please give me advice

My source have all 139.512 frames, when run x264 can only encode about below 32.700 frames then appear error
Run the script through AVSMeter (http://forum.doom9.org/showthread.php?t=165528) with the "-log" switch. Post the log (on pastebin or similar).

loneboyz
13th September 2015, 17:53
Result after run AVSMeter

http://8.t.imgbox.com/6AzMLKnF.jpg (http://imgbox.com/6AzMLKnF)

Log file: nk5.log (http://www.mediafire.com/download/5modv8akfa62n5u/nk5.log)

I can't use pasebin because file sỉze larger 2.8 MB. Tks!

Groucho2004
13th September 2015, 18:01
Result after run AVSMeter
OK, I just wanted to see if the same happens without the encoder in the chain.
Since it seems to stop at exactly the same frame every time I would say it's related to the source. Remove all filters except the source filter and let it run.
If the problem remains, try another source filter, like LWLibavVideoSource.

Myrsloik
13th September 2015, 18:27
Another code question...

Why not use opencl for packing and unpacking in avisynth too?

loneboyz
13th September 2015, 18:41
I've tried to split source, use Trim func, 32.000 frames per one and encode many times, everything's fine so reason not related to the source

I've also replaced KNLMeansCL with another denoise plugin (zzz_denoise), it's seem working well when encode whole source's frames

I'll try again as you guide. Tks!

Khanattila
13th September 2015, 20:46
Another code question...

Why not use opencl for packing and unpacking in avisynth too?

Version 0.7.0, it should not be urgent.

Khanattila
13th September 2015, 20:51
I've tried to split source, use Trim func, 32.000 frames per one and encode many times, everything's fine so reason not related to the source

I've also replaced KNLMeansCL with another denoise plugin (zzz_denoise), it's seem working well when encode whole source's frames

I'll try again as you guide. Tks!

It is certainly a problem of OpenCL.
Somewhere sometime somehow, something went wrong.

loneboyz
14th September 2015, 07:18
Thanks to Groucho2004, Khanattila!

I'd changed para device_type, value set GPU and processing of encode reached over 60.000 frames but not appear error

Although I only have the onboard video card, I don't know the quality will be changed how

Khanattila
14th September 2015, 10:10
Thanks to Groucho2004, Khanattila!

I'd changed para device_type, value set GPU and processing of encode reached over 60.000 frames but not appear error

Although I only have the onboard video card, I don't know the quality will be changed how
The quality is the same. Change only the speed.

tormento
14th September 2015, 10:23
@tormento
Here is a 64-bit test version of DGDecNV built with CUDA 7.5. Please advise your results.

Thanks for your work! However a 32bit version is what I need. :thanks:

videoh
14th September 2015, 13:51
http://rationalqm.us/misc/tormento_32.zip

tormento
14th September 2015, 19:25
http://rationalqm.us/misc/tormento_32.zip (http://rationalqm.us/tormento_32.zip)
Wrong address if clicked, correct one
http://rationalqm.us/misc/tormento_32.zip works

tormento
14th September 2015, 19:35
Here is a 64-bit test version of DGDecNV built with CUDA 7.5. Please advise your results.
Tried 32bit version. No way.

I suppose there must be something wrong between the combination of the two plugin together.

Any other OpenCL filter I can apply to test?

Groucho2004
14th September 2015, 20:58
Tried 32bit version. No way.

I suppose there must be something wrong between the combination of the two plugin together.

Any other OpenCL filter I can apply to test?
Having had a quick look at the Nvidia Geforce forum, the feedback on the Win10 drivers seems to indicate that they are an utter mess. Maybe that's the problem.

tormento
16th September 2015, 12:22
nnedi3ocl (http://forum.doom9.org/showthread.php?t=169766)
Thanks, however it's so old I can't set OpenCL GPU priority.

If I remove Intel GPU from bios and leave Nvidia only, it simply doesn't work.

http://i.imgur.com/MhdGfRNm.jpg (http://imgur.com/MhdGfRN)

Now I'm going to install Nvidia developer drivers (https://developer.nvidia.com/opengl-driver) with Windows 10 and OpenCL extension support.

Edit: neither developer 355.97 does the magic. KNLMeansCL works perfectly without DGDecNV.

Khanattila
18th September 2015, 09:26
720p.

AviSynth YUV420P8 (no buffer): 148 fps
AviSynth YUV420P16 (OpenMP buffer): 111 fps
AviSynth RGB32 (no buffer): 96 fps
AviSynth YUV444P8 (OpenMP buffer): 81 fps
AviSynth YUV444P16 (OpenMP buffer): 57 fps

VapourSynth YUV420P8 (no buffer): 121 fps
VapourSynth YUV420P16 (no buffer): 112 fps
VapourSynth RGB24 (OpenCL buffer): 84 fps
VapourSynth YUV444P8 (OpenCL buffer): 85 fps
VapourSynth YUV444P16 (OpenCL buffer): 70 fps


It seems to work well.

Another code question...

Why not use opencl for packing and unpacking in avisynth too?

v0.6.4 -> v0.7.0-beta

AviSynth YUV420P8: 148 fps -> 153 fps. (+3%)
AviSynth YUV420P16: 111 fps -> 132 fps. (+19%)
AviSynth RGB32: 96 fps -> 97 fps. (+1%)
AviSynth YUV444P8: 81 fps -> 96 fps. (+19%)
AviSynth YUV444P16: 57 fps -> 77 fps. (+35%)

VapourSynth YUV420P8: 121 fps -> 146 fps. (+21%)
VapourSynth YUV420P16: 112 fps -> 133 fps. (+19%)
VapourSynth RGB24: 84 fps -> 96 fps. (+14%)
VapourSynth YUV444P8: 85 fps -> 95 fps. (+12%)
VapourSynth YUV444P16: 70 fps -> 78 fps. (+11%)


Maybe there was still something to be exploited.

YAFU
18th September 2015, 15:51
@Khanattila, Is it a known issue that imperfections appear when fast movements at the video edges when you use d=0?

You see here which is within the yellow line:
http://www.image-share.com/upload/3056/274.jpg

This is the original video:
https://www.dropbox.com/s/xcz9u11ifk7cvmy/test.mp4?dl=0

This is the script I use:
import vapoursynth as vs
core = vs.get_core()

##
##ffmpeg with ffms2
clp = core.ffms2.Source(source='/media/test.mp4')
##

clp = core.knlm.KNLMeansCL(clp, d=0, a=12, s=4, h=3.2, device_type="GPU")
clp.set_output ()

from terminal:
vspipe --y4m script.vpy - | ffmpeg -i pipe: -vcodec libx264 -crf 10 encoded.mkv

feisty2
18th September 2015, 16:19
do some small pads first

YAFU
18th September 2015, 18:31
I searched on google and KNLMeansCL manual to try to know what you refer with "small pads". You mean "a" or "s" value? It seems that if d=0 the problem disappears with very low values of "a", but is very little noise reduction. But, what do you mean with "first"? Some kind of two passes? I really do not know how to do that.

Groucho2004
18th September 2015, 18:45
I searched on google and KNLMeansCL manual to try to know what you refer with "small pads".
Possibly something like this:
padding = 16
AddBorders(padding, padding, padding, padding)
KNLMeansCL()
Crop(padding, padding, -padding, -padding)

YAFU
18th September 2015, 19:31
Thanks, but sorry. I can't find nothing in Google about that in VapourSynth, is this for avisinth?. I only found something "core.std.AddBorders", but I have no idea how to implement it.
Anyway, what does Crop or AddBorders? The problem will be solved this way, or it just means cutting or hide the problematic part of the video where the imperfections occur?

Khanattila
18th September 2015, 20:09
do some small pads first

Possibly something like this:
padding = 16
AddBorders(padding, padding, padding, padding)
KNLMeansCL()
Crop(padding, padding, -padding, -padding)


Out-of-range image coordinates will return a border color, if it works I add it.

Are_
18th September 2015, 20:10
Hi YAFU, give it a try: knlm.py (https://gist.github.com/4re/4788aa29cee72ac78361)

import knlm
...
clip = knlm.knlm_yuv(clip)


This works the same regular knlmeanscl with some small differences: d, a, s and h arguments now accept arrays, one value for each plane, and there is an extra option planes, it behaves the same as regular vapoursynth filters. It also adds correct padding duplicating last line and crops it afterwards.

Beware it by default filters all three planes, so if you only want to filter luma you should call it with "planes=0"

Khanattila
18th September 2015, 20:12
Thanks, but sorry. I can't find nothing in Google about that in VapourSynth, is this for avisinth?. I only found something "core.std.AddBorders", but I have no idea how to implement it.
Anyway, what does Crop or AddBorders? The problem will be solved this way, or it just means cutting or hide the problematic part of the video where the imperfections occur?

padding = 4 #It should be equal to 'a'
clip = core.std.AddBorders(clip, padding, padding, padding, padding)
clip = core.knlm.KNLMeansCL(clip)
clip = core.std.CropRel(clip, padding, padding, padding, padding)

Groucho2004
18th September 2015, 21:25
padding = 4 #It should be equal to 'a'
What about this:
int a Set the radius of the search window. A=0 uses 1 pixel, while D=1
use 9 pixels and son on. Usually, larger it the better the result
of the denoising. Spatial size = (2 * A + 1)^2.
Total search window size = temporal size * spatial size.

Khanattila
18th September 2015, 22:35
What about this:
A=0 uses 1 pixel, while A=1 use 9 pixels and son on, my typo.

To clarify padding should be 'a' + 's'. But use only 'a' should be enough.

Take pixel p0(x, y). If 'a'=2 pixel p0 uses for example pixel p1(x+2, y+2).
There are two similarity windows: first centered in p0(x, y) and second centered in p1(x+2, y+2).
If 's'=4 first similarity windows uses p(x-4, y-4), ..., p(x+4, y+4).
Second similarity uses p(x+2-4, y+2-4), ..., p(x+2+4, y+2+4).

EDIT. Good examples here (http://www.3dgep.com/texturing-lighting-directx-11/#Address_Mode).

YAFU
19th September 2015, 02:43
Thank you very much to all!

@Are_, I have no idea about programming/scripting, you give me a time to try to learn about this script and then experiment a little. Thanks.

@Khanattila, Ok, if I work with this script all is working fine now:
import vapoursynth as vs
core = vs.get_core()

##
##ffmpeg with ffms2
clp = core.ffms2.Source(source='/media/test.mp4')
##
padding = 24
clp = core.std.AddBorders(clp, padding, padding, padding, padding)
clp = core.knlm.KNLMeansCL(clp, d=0, a=24, s=4, h=3.2, device_type="GPU")
clp = core.std.CropRel(clp, padding, padding, padding, padding)
clp.set_output ()

Now, I need to implement that you say in this script I have taken from blenderartists forum:
https://dl.dropboxusercontent.com/u/34973756/distfiles/1-hard-denoise.vpy

I tried:
http://www.pasteall.org/61211

but I think I'm doing wrong because the resulting video is bigger, 1328 x 768. That does not happen with the first script above applied directly to video with ffms2 (it remains in 1280x720). Surely I am confused with "ret" and "double"

I would appreciate if someone can check where the error is.

feisty2
19th September 2015, 03:26
@Khanattila
it works, I been doing it for a long time
@Groucho2004 and YAFU
don't "addborders", do some "padding"

def padding (src, left=0, right=0, top=0, bottom=0):
core = vs.get_core ()
w = src.width
h = src.height
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)
return clip

clp = padding (clp,a,a,a,a)
clp = core.knlm.KNLMeansCL (clp, xxx)
clp = core.std.CropRel (clp, a, a, a, a)

feisty2
19th September 2015, 03:50
@YAFU
http://www.pasteall.org/61212

feisty2
19th September 2015, 04:24
Hi YAFU, give it a try: knlm.py (https://gist.github.com/4re/4788aa29cee72ac78361)

import knlm
...
clip = knlm.knlm_yuv(clip)


This works the same regular knlmeanscl with some small differences: d, a, s and h arguments now accept arrays, one value for each plane, and there is an extra option planes, it behaves the same as regular vapoursynth filters. It also adds correct padding duplicating last line and crops it afterwards.

Beware it by default filters all three planes, so if you only want to filter luma you should call it with "planes=0"

Expr ("x 0.5 +") is required when u shift chroma planes to Y, filters might clamp pixels to [0.0, 1.0] somewhere and the <0 part of the chroma will be lost
yeah, I'm talking about float formats...

Khanattila
19th September 2015, 10:00
Thank you very much to all!

@Are_, I have no idea about programming/scripting, you give me a time to try to learn about this script and then experiment a little. Thanks.

@Khanattila, Ok, if I work with this script all is working fine now:
import vapoursynth as vs
core = vs.get_core()

##
##ffmpeg with ffms2
clp = core.ffms2.Source(source='/media/test.mp4')
##
padding = 24
clp = core.std.AddBorders(clp, padding, padding, padding, padding)
clp = core.knlm.KNLMeansCL(clp, d=0, a=24, s=4, h=3.2, device_type="GPU")
clp = core.std.CropRel(clp, padding, padding, padding, padding)
clp.set_output ()

Now, I need to implement that you say in this script I have taken from blenderartists forum:
https://dl.dropboxusercontent.com/u/34973756/distfiles/1-hard-denoise.vpy

I tried:
http://www.pasteall.org/61211

but I think I'm doing wrong because the resulting video is bigger, 1328 x 768. That does not happen with the first script above applied directly to video with ffms2 (it remains in 1280x720). Surely I am confused with "ret" and "double"

I would appreciate if someone can check where the error is.

ret = core.knlm.KNLMeansCL(ret, d=0, a=24, s=4, h=3.2 , device_type="GPU")

Or use feisty2 code.

Khanattila
19th September 2015, 10:06
@Khanattila
it works, I been doing it for a long time
@Groucho2004 and YAFU
don't "addborders", do some "padding"

def padding (src, left=0, right=0, top=0, bottom=0):
core = vs.get_core ()
w = src.width
h = src.height
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)
return clip

clp = padding (clp,a,a,a,a)
clp = core.knlm.KNLMeansCL (clp, xxx)
clp = core.std.CropRel (clp, a, a, a, a)

I thought that edge of the image was better than using the border color. I was wrong.

However, it is very simple things to code.

~ VEGETA ~
19th September 2015, 10:57
I would like to ask the following:

1- Is it faster than TNLMeans? Dfttest? because the normal tnlmeans is slow as hell!

2- I have a core2due laptop (and a more powerful server)... Is it supported? I don't see a suitable driver.

Khanattila
19th September 2015, 13:53
I would like to ask the following:

1- Is it faster than TNLMeans? Dfttest? because the normal tnlmeans is slow as hell!

2- I have a core2due laptop (and a more powerful server)... Is it supported? I don't see a suitable driver.

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/

YAFU
19th September 2015, 14:20
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

Are_
19th September 2015, 14:28
Because messages in the forum don't respect white spaces, except when you use "code" tags, and python relies on them to format the code, add them as needed in that function.

def padding (src, left=0, right=0, top=0, bottom=0):
core = vs.get_core ()
w = src.width
h = src.height
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)
return clip

a = 32
clp = padding (clp,a,a,a,a)
clp = core.knlm.KNLMeansCL (clp, a=a)
clp = core.std.CropRel (clp, a, a, a, a)

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.

Khanattila
14th October 2015, 18:53
Same thing with the latest driver. Here is what Dep Walker has to say:
http://s21.postimg.org/wy7zauiiv/Image1.png

OpenCL 1.2 function is missing... great.

Groucho2004
14th October 2015, 18:53
Simply use KNLMeansCL(d=0) instead default KNLMeansCL(d=1).
Very definitely it does not work the same but is an attempt.
I can't try it because the mere presence of KNLMeansCL.dll in the autoload directory produces the error mesage. Using KNLMeans in a script produces the usual "There is no function named KNLMeansCL()".

Groucho2004
14th October 2015, 18:54
OpenCL 1.2 function is missing... great.
Do you think this is specific to the XP driver? I also have XP64, I might give that a try later.

Reel.Deel
14th October 2015, 19:27
I also get the same error as Groucho2004, when I put KNLMeansCL in the autoload folder. I'm on 64-bit Windows 7 using AviSynth+ r1576.

http://gpuz.techpowerup.com/15/10/14/x3m.png

Sparktank
14th October 2015, 20:08
Win7 (x64)
x86: AviSynth 2.60, build:Feb 20 2015 [03:16:45] (2.6.0.5)
http://i.imgur.com/CCgKDIg.gif

The new autoload picked NVidia by default.
Even though my old Intel supports OpenCL 1.2 FULL_PROFILE. (GPU Caps Viewer).

CPU: Intel(R) Core(TM) i5-2320 CPU @ 3.00GHz
OpenCL 1.2 FULL_PROFILE.
ver: OpenCL 1.2 (Build 57)
driver: 5.0.0.57

GPU: NVIDIA CUDA
OpenCL 1.2 CUDA 7.5.0 FULL_PROFILE
ver: OpenCL 1.2 CUDA
Driver: 355.82

Same messy remux of Scream (Canada/Alliance)
Click pics to follow to original size (resized for forum).

KNLMeansCL (info=true)
http://i.imgur.com/4jmi0s2l.png (http://imgur.com/4jmi0s2)

KNLMeansCL ()
http://i.imgur.com/4ac12zyl.png (http://imgur.com/4ac12zy)

DGSource("E:\Work\Clips\Scream\Scream.dgi", crop_t=132, crop_b=140, debug=true)
http://i.imgur.com/HW3afhLl.png (http://imgur.com/HW3afhL)

DGSource("E:\Work\Clips\Scream\Scream.dgi", crop_t=132, crop_b=140, debug=false)
http://i.imgur.com/fAIDsWel.png (http://imgur.com/fAIDsWe)

Remuxed just opening scene with Barrymore for testing.
I hit cancel when it reached 10K frames.

[General info]
Log file created with: AVSMeter 2.1.1 (x86)
Script file: E:\Work\Clips\Scream\Scream.avs
Avisynth version: AviSynth 2.60, build:Feb 20 2015 [03:16:45] (2.6.0.5)
Avisynth Interface Version: 6
Avisynth.dll linker/compiler version: 12.0 (VC 2013)
Avisynth DLL location: C:\Windows\SysWOW64\avisynth.dll
PluginDir2_5 (HKLM, x86): C:\AVS\AVS_Ver\AVS260_MT\plugins

[Clip info]
Number of frames: 18672
Length (hh:mm:ss.ms): 00:12:58.779
Frame width: 1920
Frame height: 816
Framerate: 23.976 (239760/10000)
Colorspace: YV12
Active MT Mode: 0

[Runtime info]
Frames processed: 10010 (0 - 10009)
FPS (min | max | average): 5.470 | 14.18 | 13.71
TPF (max | min | avg): 182.8 | 70.54 | 72.96 ms
Memory usage (phys | virt): 471 | 582 MB
Thread count: 13
CPU usage (average): 25%
GPU usage (average): 92%
Video engine load (average): 3%
GPU memory usage: 356 MB
Time (elapsed | estimated): 00:12:10.305 | 00:22:42.263


[Script]
SetMemoryMax(512)
LoadPlugin("E:\Downloads\AviSynth\KNLMeansCL-v0.7.0\KNLMeansCL.dll")
DGSource("E:\Work\Clips\Scream\Scream.dgi", crop_t=132, crop_b=140, debug=false)
#KNLMeansCL (info=true)
KNLMeansCL ()



[Graphics card info]
Card name: NVIDIA GeForce GTX 750 Ti
GPU name: GM107
Memory size: 2048
OpenCL version: OpenCL 1.2 CUDA
Driver version: 10.18.13.5582 WHQL (ForceWare 355.82) / Win7 64
Info collected with: GPU-Z 0.8.5

Khanattila
14th October 2015, 21:09
Do you think this is specific to the XP driver? I also have XP64, I might give that a try later.

I also get the same error as Groucho2004, when I put KNLMeansCL in the autoload folder. I'm on 64-bit Windows 7 using AviSynth+ r1576.

http://gpuz.techpowerup.com/15/10/14/x3m.png

Please use GPU Caps Viewer v1.25.0.0.

Example: http://pastebin.com/ZkFeSBTQ

Groucho2004
14th October 2015, 21:19
Please use GPU Caps Viewer v1.25.0.0.
Here's mine (http://pastebin.com/F22M74q0).

Khanattila
14th October 2015, 22:30
Here's mine (http://pastebin.com/F22M74q0).

It looks fine. A crazy idea. Try replacing OpenCL.dll? It is provided by Khronos.

C:\Windows\System32\
C:\Windows\SysWOW64\


EDIT. This is the version I got from AMD / Intel.
http://www.mediafire.com/download/oanw1yptvnu9x08/OpenCL-v2.0.0.zip

EDIT2. If it works, I hope NVIDIA fails.

Groucho2004
14th October 2015, 22:56
It looks fine. A crazy idea. Try replacing OpenCL.dll? It is provided by Khronos.

C:\Windows\System32\
C:\Windows\SysWOW64\


EDIT. This is the version I got from AMD / Intel.
http://www.mediafire.com/download/oanw1yptvnu9x08/OpenCL-v2.0.0.zip

EDIT2. If it works, I hope NVIDIA fails.
I got it working. I used the OpenCL.dll that is copied by the NVidia driver install to "Program Files\NVIDIA Corporation\OpenCL".

Khanattila
14th October 2015, 22:58
I got it working. I used the OpenCL.dll that is copied by the NVidia driver install to "Program Files\NVIDIA Corporation\OpenCL".

You can make a new test? Try to copy the OpenCL.dll into the AviSynth folder. If it works, I add it to the package.

Groucho2004
14th October 2015, 23:07
You can make a new test? Try to copy the OpenCL.dll into the AviSynth folder. If it works, I add it to the package.
Doesn't work. The DLL has to be in a directory to which the "PATH" variable points. Most importantly, KNLMeans will go through the standard Windows search hierarchy which means that the one from System32/SysWOW64 is loaded first (which is the one the driver installs).

Khanattila
14th October 2015, 23:14
Doesn't work. The DLL has to be in a directory to which the "PATH" variable points. Most importantly, KNLMeans will go through the standard Windows search hierarchy which means that the one from System32/SysWOW64 is loaded first (which is the one the driver installs).

It seems that NVIDIA does not update the loader (OpenCL.dll).
The loader is vendor-independent. AMD, Intel and NVIDIA redistribute it only.

Groucho2004
14th October 2015, 23:33
It seems that NVIDIA does not update the loader (OpenCL.dll).
If there's no opencl.dll in the system32 directory, the NVIDIA installer will copy the correct DLL.
I experimented with driver versions recently so that may be the reason why the last install did not update the file.

Reel.Deel
15th October 2015, 00:21
Please use GPU Caps Viewer v1.25.0.0.

Example: http://pastebin.com/ZkFeSBTQ

Ok, here it is: http://pastebin.com/QdeuLtyQ

This is my work computer, when I get home I'll try it on my personal computer...


Edit: it works on my home computer, the one at work mush have outdated drivers. Will update drivers tomorrow, sorry for any inconvenience.

Khanattila
15th October 2015, 09:26
Ok, here it is: http://pastebin.com/QdeuLtyQ

This is my work computer, when I get home I'll try it on my personal computer...


Edit: it works on my home computer, the one at work mush have outdated drivers. Will update drivers tomorrow, sorry for any inconvenience.

Updated drive here.

Groucho2004
15th October 2015, 11:42
Nice speedup of the temporal mode:
colorbars(width = 1024, height = 512, pixel_type = "yv12").killaudio().assumefps(25, 1).trim(0, 499)
KNLMeansCL(d = 2, a = 2)

0.6.4: 17.68 fps
0.7.0: 22.27 fps

Khanattila
15th October 2015, 16:12
I added 'OpenCL.dll' in release for those who have trouble.

luigizaninoni
15th October 2015, 20:17
What should I do in Vapoursynth64 ?

Error:
Failed to evaluate the script:
Python exception: knlm.KNLMeansCL: VapourSynthCreate error (clSetKernelArg)!
Traceback (most recent call last):
File "src\cython\vapoursynth.pyx", line 1484, in vapoursynth.vpy_evaluateScript (src\cython\vapoursynth.c:26808)
File "E:/Temp/prova temp files/prova.vpy", line 5, in <module>
core.std.LoadPlugin(r'C:\Users\admin\Desktop\Stax64\Apps\Plugins\vs\fmtconv\fmtconv.dll')
File "src\cython\vapoursynth.pyx", line 1376, in vapoursynth.Function.__call__ (src\cython\vapoursynth.c:25123)
vapoursynth.Error: knlm.KNLMeansCL: VapourSynthCreate error (clSetKernelArg)!

Script:
import vapoursynth as vs
core = vs.get_core()
core.std.LoadPlugin(r'C:\Users\admin\Desktop\Stax64\Apps\Plugins\vs\vslsmashsource\vslsmashsource.dll')
clip = core.lsmas.LWLibavSource(source = r'E:\Temp\prova temp files\prova.m2v')
clip = core.knlm.KNLMeansCL(clip = clip, d=2, a=2)
clip.set_output()

Intel Hd4600 Windows 8.1 64 bit

Is it the same issue with opencl.dll as above ? What should I do ? I tried putting the new dll (the one in x64 folder) in system32 but it doesn't solve the issue.

Khanattila
15th October 2015, 20:50
What should I do in Vapoursynth64 ?

Error:
Failed to evaluate the script:
Python exception: knlm.KNLMeansCL: VapourSynthCreate error (clSetKernelArg)!
Traceback (most recent call last):
File "src\cython\vapoursynth.pyx", line 1484, in vapoursynth.vpy_evaluateScript (src\cython\vapoursynth.c:26808)
File "E:/Temp/prova temp files/prova.vpy", line 5, in <module>
core.std.LoadPlugin(r'C:\Users\admin\Desktop\Stax64\Apps\Plugins\vs\fmtconv\fmtconv.dll')
File "src\cython\vapoursynth.pyx", line 1376, in vapoursynth.Function.__call__ (src\cython\vapoursynth.c:25123)
vapoursynth.Error: knlm.KNLMeansCL: VapourSynthCreate error (clSetKernelArg)!

Script:
import vapoursynth as vs
core = vs.get_core()
core.std.LoadPlugin(r'C:\Users\admin\Desktop\Stax64\Apps\Plugins\vs\vslsmashsource\vslsmashsource.dll')
clip = core.lsmas.LWLibavSource(source = r'E:\Temp\prova temp files\prova.m2v')
clip = core.knlm.KNLMeansCL(clip = clip, d=2, a=2)
clip.set_output()

Intel Hd4600 Windows 8.1 64 bit

Is it the same issue with opencl.dll as above ? What should I do ? I tried putting the new dll (the one in x64 folder) in system32 but it doesn't solve the issue.

This is another type of error. It does not have anything to do with it. For now uses the old version. I have to check the source code.

evilr00t
15th October 2015, 21:01
Intel Hd4600 Windows 8.1 64 bit

Is it the same issue with opencl.dll as above ? What should I do ? I tried putting the new dll (the one in x64 folder) in system32 but it doesn't solve the issue.

I have the same issue on Win7 64 bit / Avisynth 32 bit / Intel HD 4000 / 10.18.10.4226 driver.

const cl_image_desc image_desc = { (cl_mem_object_type) (d ? CL_MEM_OBJECT_IMAGE2D_ARRAY : CL_MEM_OBJECT_IMAGE2D),
(size_t) idmn[0], (size_t) idmn[1], 1, 2 * (size_t) d + 1, 0, 0, 0, 0, NULL };

The varying type of image_desc causes issues with the opencl types:
image2d_array_t
image2d_t

if d is non-zero, clSetKernelArg fails on:
nlmSpatialDistance[arg0, arg1]
nlmSpatialHorizontal[arg0, arg1]
nlmSpatialVertical[arg0, arg1]
nlmSpatialAccumulation[arg0, arg2]
nlmSpatialFinish[arg0]
and if d is zero, clSetKernelArg fails on:
nlmDistanceLeft[arg0, arg1]
nlmDistanceRight[arg0, arg1]
nlmHorizontal[arg0, arg1]
nlmVertical[arg0, arg1]
nlmAccumulation[arg0, arg2]
nlmFinish[arg0]

Looks like Intel's driver is pretty strict and won't convert between the two? I didn't see this issue on nVidia or AMD.
For those platforms I generally see a 14-24% speed improvement on 1080p between 6.11 and 7.0 with D=1, A=2, S=4. Nice work!

Khanattila
15th October 2015, 21:14
I have the same issue on Win7 64 bit / Avisynth 32 bit / Intel HD 4000 / 10.18.10.4226 driver.

const cl_image_desc image_desc = { (cl_mem_object_type) (d ? CL_MEM_OBJECT_IMAGE2D_ARRAY : CL_MEM_OBJECT_IMAGE2D),
(size_t) idmn[0], (size_t) idmn[1], 1, 2 * (size_t) d + 1, 0, 0, 0, 0, NULL };

The varying type of image_desc causes issues with the opencl types:
image2d_array_t
image2d_t

if d is non-zero, clSetKernelArg fails on:
nlmSpatialDistance[arg0, arg1]
nlmSpatialHorizontal[arg0, arg1]
nlmSpatialVertical[arg0, arg1]
nlmSpatialAccumulation[arg0, arg2]
nlmSpatialFinish[arg0]
and if d is zero, clSetKernelArg fails on:
nlmDistanceLeft[arg0, arg1]
nlmDistanceRight[arg0, arg1]
nlmHorizontal[arg0, arg1]
nlmVertical[arg0, arg1]
nlmAccumulation[arg0, arg2]
nlmFinish[arg0]

Looks like Intel's driver is pretty strict and won't convert between the two? I didn't see this issue on nVidia or AMD.
For those platforms I generally see a 14-24% speed improvement on 1080p between 6.11 and 7.0 with D=1, A=2, S=4. Nice work!
Yes, just add an 'if' and go on. Tomorrow v0.7.1 LTS is coming.

Khanattila
15th October 2015, 21:49
Nice speedup of the temporal mode:
colorbars(width = 1024, height = 512, pixel_type = "yv12").killaudio().assumefps(25, 1).trim(0, 499)
KNLMeansCL(d = 2, a = 2)

0.6.4: 17.68 fps
0.7.0: 22.27 fps


For those platforms I generally see a 14-24% speed improvement on 1080p between 6.11 and 7.0 with D=1, A=2, S=4. Nice work!

That's what I've worked on.

Khanattila
16th October 2015, 08:39
I do not have a compatible intel gpu, but this should fix it.
https://github.com/Khanattila/KNLMeansCL/releases

littlepox
16th October 2015, 15:26
There is a issue of memory leak after v7.0; it often consumes ~10GB of memory, regardless of the vs.max_cache_size.

Suspected to be related with cmode=True.

Khanattila
16th October 2015, 16:03
There is a issue of memory leak after v7.0; it often consumes ~10GB of memory, regardless of the vs.max_cache_size.

Suspected to be related with cmode=True.

Careful not to give some useful information :rolleyes:

Khanattila
16th October 2015, 16:55
Somehow I found and fixed the problem.
https://github.com/Khanattila/KNLMeansCL/releases

luigizaninoni
16th October 2015, 17:18
I do not have a compatible intel gpu, but this should fix it.
https://github.com/Khanattila/KNLMeansCL/releases

Works fine now with Intel HD4600, thanks

yup
19th October 2015, 14:06
Hi Khanattila!
:thanks: for update.

Advice minimum requirement for Geforce, my 560 GTX do not work.
My card do not support OpenCL 1.2 and new version work only with 1.2?

yup.

Reel.Deel
19th October 2015, 18:44
Advice minimum requirement for Geforce, my 560 GTX do not work.
My card do not support OpenCL 1.2 and new version work only with 1.2?

The minimum requirements are listed in the GitHub page.
NVIDIA GeForce GT 640 or greater. At least NVIDIA driver 350.12 WHQL.

Since your card is not supported you're stuck using v0.6.11.

Khanattila
19th October 2015, 23:55
Hi Khanattila!
:thanks: for update.

Advice minimum requirement for Geforce, my 560 GTX do not work.
My card do not support OpenCL 1.2 and new version work only with 1.2?

yup.

It is not really necessary that the device is OpenCL 1.2, just the platform is required.
NVIDIA simply has no suitable drivers for GT/GTX 500 series.
Can you tell me that it is a stupid, because GT 640 is much slower than GTX 560, but it was released in 2012 as opposed to 2011.
NVIDIA seems to support the cards of the last three years.

yup
20th October 2015, 10:18
Reel.Deel and Khanattila!
Thanks for explanation.
Nvidia prefer CUDA not OpenCL because CUDA closed project.

yup.

CruNcher
20th October 2015, 18:41
Cuda is engineered specifically for their Hardware they have total control this way Software should support both a optimized OpenCL Kernel for AMD/Intel and a Optimized Cuda Kernel for Nvidia.

The OpenCL part in their Driver is not Native it's just a Wrapper to Cuda and costs efficiency

~ VEGETA ~
7th November 2015, 14:25
I get this: "there is no function named knlmeanscl" in my server (windows 7 x64bit). I installed vc++redis 2013, but I don't know which opencl driver should I install... I tried intel and it didn't work, so I installed AMD. it is an intel atom cpu.

I wanted to use this because dfttest is very slow even on my server.

foxyshadis
8th November 2015, 17:36
I get this: "there is no function named knlmeanscl" in my server (windows 7 x64bit). I installed vc++redis 2013, but I don't know which opencl driver should I install... I tried intel and it didn't work, so I installed AMD. it is an intel atom cpu.

I wanted to use this because dfttest is very slow even on my server.

Intel only supports OpenCL on Bay Trail and Cherry Trail Atoms, which are normally found in tablets, laptops, and mini-PCs. Older Atoms are all DX9 parts with no OpenCL. If yours is an actual server Atom, then it has no GPU at all and you have to figure out what the chipset contains. What's the part number?

~ VEGETA ~
8th November 2015, 17:41
Intel only supports OpenCL on Bay Trail and Cherry Trail Atoms, which are normally found in tablets, laptops, and mini-PCs. Older Atoms are all DX9 parts with no OpenCL. If yours is an actual server Atom, then it has no GPU at all and you have to figure out what the chipset contains. What's the part number?

https://www.online.net/en/dedicated-server/dedibox-xc

foxyshadis
8th November 2015, 18:37
https://www.online.net/en/dedicated-server/dedibox-xc

Yup, no GPU in a C2750. Even the chassis of the blade server it's housed in probably only has a minimal VGA GPU.

~ VEGETA ~
8th November 2015, 19:31
Yup, no GPU in a C2750. Even the chassis of the blade server it's housed in probably only has a minimal VGA GPU.

So? what to do now? is there any KNLMeans without OpenCL to use? TNLMeans is VERY slow and I don't trust other denoisers very much.

Khanattila
9th November 2015, 10:00
So? what to do now? is there any KNLMeans without OpenCL to use? TNLMeans is VERY slow and I don't trust other denoisers very much.

Use TNLMeans compiled by Groucho2004 (http://forum.doom9.org/showthread.php?t=168090).
Non-local means denoising algorithm is slow. You can not do otherwise.

~ VEGETA ~
9th November 2015, 13:22
Use TNLMeans compiled by Groucho2004 (http://forum.doom9.org/showthread.php?t=168090).
Non-local means denoising algorithm is slow. You can not do otherwise.

is it faster than knl or close? i hope it is faster than original tnl by noticeable amount.

i didn't find a better denoiser overall than knlmeanscl.

Groucho2004
9th November 2015, 22:55
is it faster than knl or close? i hope it is faster than original tnl by noticeable amount.
It's faster than the original but still very slow compared to KNLMeansCL.
I did some tests here (http://forum.doom9.org/showthread.php?p=1739321#post1739321).

Khanattila
11th November 2015, 12:34
A few more slight adjustment.

https://github.com/Khanattila/KNLMeansCL/releases/tag/v0.7.3

KNLMeansCL v0.7.3
* Removed 'default' and 'all' device_type.
* More controls of the OpenCL platform.
* Better error handling.
* VapourSynth: fixed frame properties.

Reel.Deel
11th November 2015, 14:22
Hi Khanattila,

KNLMeansCL works fine with AviSynth+ r1576 but with x64 I get this error message:
Avisynth read error: KNLMeansCL: fatal error! (AviSynthGetFrame)

Khanattila
11th November 2015, 14:42
Hi Khanattila,

KNLMeansCL works fine with AviSynth+ r1576 but with x64 I get this error message:
Script?

Reel.Deel
11th November 2015, 14:43
Script?

ColorBars(pixel_type="YV12")
KNLMeansCL()

~ VEGETA ~
11th November 2015, 14:52
It's faster than the original but still very slow compared to KNLMeansCL.
I did some tests here (http://forum.doom9.org/showthread.php?p=1739321#post1739321).

I used dfttest rather than tnlmeans and it was extremely slow! is it at least faster than this?

Groucho2004
11th November 2015, 15:50
I used dfttest rather than tnlmeans and it was extremely slow! is it at least faster than this?
It mostly depends on your CPU. Also, it takes less time to try it out than to write all these posts.

Groucho2004
11th November 2015, 16:13
KNLMeansCL works fine with AviSynth+ r1576 but with x64 I get this error message:
Avisynth read error: KNLMeansCL: fatal error! (AviSynthGetFrame)
Works for me (WinXP64SP2):
[General info]
Log file created with: AVSMeter 2.1.5 (x64)
Script file: F:\test.avs
Command line switches: -log -gpu
Avisynth version string: AviSynth+ 0.1 (r1576, x64)
Avisynth file version: 2.6.0.5
Avisynth Interface Version: 5
Avisynth MT support: No
Avisynth.dll linker/compiler version: 11.0
Avisynth.dll location: D:\WINNT\system32\AviSynth.dll
Avisynth.dll time stamp: 2014-01-03, 17:11:18
PluginDir2_5 (HKLM, x64): E:\Apps\VideoTools\AvisynthRepository\AVSPLUS_x64\plugins


[Clip info]
Number of frames: 107892
Length (hh:mm:ss.ms): 00:59:59.996
Frame width: 640
Frame height: 480
Framerate: 29.970 (30000/1001)
Colorspace: YV12
Audio channels: 2
Audio bits/sample: 16
Audio sample rate: 48000
Audio samples: 172799827


[Runtime info]
Frames processed: 320 (0 - 319)
FPS (min | max | average): 64.64 | 65.75 | 65.49
Memory usage (phys | virt): 34 | 73 MB
Thread count: 8
CPU usage (average): 25%
GPU usage (average): 95%
Video engine load (average): 0%
GPU memory usage: 61 MB
Time (elapsed): 00:00:04.887


[Script]
ColorBars(pixel_type="YV12")
KNLMeansCL()



[Graphics card info]
Card name: NVIDIA GeForce GTX 750
GPU name: GM107
Memory size: 1024
OpenCL version: OpenCL 1.2 CUDA
Driver version: 6.14.13.5012 (ForceWare 350.12) / XP64
Info collected with: GPU-Z 0.8.6

Reel.Deel
11th November 2015, 19:12
Works for me (WinXP64SP2)

That's odd, it also works on my work computer. Last time I had problems with KNLMeansCL (http://forum.doom9.org/showthread.php?t=171379&page=26#post1742841) my home computer worked but not my work computer :confused:. If it's a driver issues, it's kinda weird that it works in 32-bit but not 64-bit. Anyways when I get home I'll update drivers and report back.

Edit: It turned out out to be a drive issue. Sorry for another false alarm :o. The drivers were not that outdated but I guess it requires the latest and greatest.

kalehrl
11th November 2015, 20:08
Hi Khanattila,
I complained some time ago that knlmeanscl didn't work when using x264 encoder with MeGUI.
I just tested the latest version and it works now.
In the meantime, I updated my AMD driver to the latest beta instead of the latest release which I used before.
Also, there were some MeGUI updates as well.
Not really sure what fixed it but the important thing is, it works now!

Khanattila
12th November 2015, 16:15
Happy that everything seems to be working.

Xebika
12th November 2015, 17:18
I can't get it to work with both the newest Nvidia driver for my GeForce GTX 960 in Win 10 x64 because it crashes, i also tried replace with the included DLL from the v0.7.3 release.

And tried with an older version of the driver but the same result.

Khanattila
12th November 2015, 19:04
I can't get it to work with both the newest Nvidia driver for my GeForce GTX 960 in Win 10 x64 because it crashes, i also tried replace with the included DLL from the v0.7.3 release.

And tried with an older version of the driver but the same result.

Some more details? I tried a GTX 760 in Win 10 x64 and seems to work.

Xebika
13th November 2015, 06:10
Which details do you need??

Khanattila
13th November 2015, 10:13
Which details do you need??

VapourSynth or AviSynth? Which version? Script used? Crashes without giving some error code?

I also need a report by GPU Caps Viewer 1.25.0: http://www.geeks3d.com/20150821/gpu-caps-viewer-1-25-0-gpu-information-utility-opengl-opencl-cuda/
(tool -> export data -> http://pastebin.com/hF6F59Ks)

Can be any type of error.
Have you tried to do a clean installation of the drivers?

PS. Previous versions of KNLMeansCL will work? Probably I forgot something. :D

Khanattila
13th November 2015, 17:11
That's odd, it also works on my work computer. Last time I had problems with KNLMeansCL (http://forum.doom9.org/showthread.php?t=171379&page=26#post1742841) my home computer worked but not my work computer :confused:. If it's a driver issues, it's kinda weird that it works in 32-bit but not 64-bit. Anyways when I get home I'll update drivers and report back.

Edit: It turned out out to be a drive issue. Sorry for another false alarm :o. The drivers were not that outdated but I guess it requires the latest and greatest.

Only NVIDIA requires a recent driver and the last ones are only for marketing.

Xebika
13th November 2015, 19:54
VapourSynth or AviSynth? Which version? Script used? Crashes without giving some error code?

I also need a report by GPU Caps Viewer 1.25.0: http://www.geeks3d.com/20150821/gpu-caps-viewer-1-25-0-gpu-information-utility-opengl-opencl-cuda/
(tool -> export data -> http://pastebin.com/hF6F59Ks)

Can be any type of error.
Have you tried to do a clean installation of the drivers?

PS. Previous versions of KNLMeansCL will work? Probably I forgot something. :D

AviSynth 2.6 x86

I think maybe it approaches freezes then crash, and didn't have any choices then close it

Script:
DGSource("C:\Video\Video.dgi",fieldop=0, deinterlace=1)
crop(18, 36, -10, -8)
Spline36Resize(768,576) # Spline36 (Neutral)
Levels(5, 1, 255, 0, 255)
SmoothContrast(contrast=0.1, sat=0.2)
LSFmod(defaults="slow")
KNLMeansCL(D=1, A=1, h=4.5)

GPU Caps Viewer Report: http://pastebin.com/5DPK2Wqt

I have tried both clean installation of windows and drivers

Last working release is v0.6.11

Khanattila
13th November 2015, 22:20
AviSynth 2.6 x86

I think maybe it approaches freezes then crash, and didn't have any choices then close it

Script:
DGSource("C:\Video\Video.dgi",fieldop=0, deinterlace=1)
crop(18, 36, -10, -8)
Spline36Resize(768,576) # Spline36 (Neutral)
Levels(5, 1, 255, 0, 255)
SmoothContrast(contrast=0.1, sat=0.2)
LSFmod(defaults="slow")
KNLMeansCL(D=1, A=1, h=4.5)

GPU Caps Viewer Report: http://pastebin.com/5DPK2Wqt

I have tried both clean installation of windows and drivers

Last working release is v0.6.11

Since I updated OpenCL APIs from 1.1 to 1.2 you have these problems... Thank you NVIDIA. I have to investigate a bit.

Khanattila
19th November 2015, 17:46
AviSynth 2.6 x86

I think maybe it approaches freezes then crash, and didn't have any choices then close it

Script:
DGSource("C:\Video\Video.dgi",fieldop=0, deinterlace=1)
crop(18, 36, -10, -8)
Spline36Resize(768,576) # Spline36 (Neutral)
Levels(5, 1, 255, 0, 255)
SmoothContrast(contrast=0.1, sat=0.2)
LSFmod(defaults="slow")
KNLMeansCL(D=1, A=1, h=4.5)

GPU Caps Viewer Report: http://pastebin.com/5DPK2Wqt

I have tried both clean installation of windows and drivers

Last working release is v0.6.11

Since I updated OpenCL APIs from 1.1 to 1.2 you have these problems... Thank you NVIDIA. I have to investigate a bit.

I do not see anything strange (https://www.diffchecker.com/npvultsy)...
You could try running "OpenCL Device Query (https://developer.nvidia.com/opencl)" and post the results.

Xebika
19th November 2015, 18:06
I do not see anything strange (https://www.diffchecker.com/npvultsy)...
You could try running "OpenCL Device Query (https://developer.nvidia.com/opencl)" and post the results.


Here: http://pastebin.com/6Ey7bPuA

Khanattila
19th November 2015, 23:12
Here: http://pastebin.com/6Ey7bPuA

It really is a problem that I do not understand.

You can try this last attempt: replace "C:\Windows\System32\OpenCL.dll" with "C:\Program Files\NVIDIA Corporation\OpenCL\OpenCL.dll".

Also you can this program (http://www.dependencywalker.com/) to see if there are all dependencies files.

In some configurations is not used OpenCL.dll in the System32 folder.

(File ==> Open ==> KNLMeansCL.dll)

Razinal
20th November 2015, 09:43
Hi,

First of all thanks for all your hard work.

I use a Acer Aspire E5-573G-79EK which means 5500U cpu and 940M gpu with 8GB of ram.

I also have Win 10 Th2 10586.11 and latest 390.00 nvidia drivers.
before upgrading to TH2 I had no problem using Avisynth+ r1779,KNLMeansCL v0.6.11, latest K-lite codec and your plugin in Avisynth part of 'ffdshow raw video filter' to denoise my videos in real-time.

however after upgrading I get a 'KNLMeansCL: Fatal Error! (clSetKernelArg)' OSDed on my video in top left corner even when using KNLMeansCL v0.7.3.

I've tried using OpenCL.dll provided in latest version of your plugin and backuping/replacing my original 'OpenCL.dll's in System32/SysWOW64 and "C:\Program Files\NVIDIA Corporation\OpenCL" but same error persists.

any other info I can give to help you?

Khanattila
20th November 2015, 12:11
Hi,

First of all thanks for all your hard work.

I use a Acer Aspire E5-573G-79EK which means 5500U cpu and 940M gpu with 8GB of ram.

I also have Win 10 Th2 10586.11 and latest 390.00 nvidia drivers.
before upgrading to TH2 I had no problem using Avisynth+ r1779,KNLMeansCL v0.6.11, latest K-lite codec and your plugin in Avisynth part of 'ffdshow raw video filter' to denoise my videos in real-time.

however after upgrading I get a 'KNLMeansCL: Fatal Error! (clSetKernelArg)' OSDed on my video in top left corner even when using KNLMeansCL v0.7.3.

I've tried using OpenCL.dll provided in latest version of your plugin and backuping/replacing my original 'OpenCL.dll's in System32/SysWOW64 and "C:\Program Files\NVIDIA Corporation\OpenCL" but same error persists.

any other info I can give to help you?
That's something I can work about.
Try this (http://www.mediafire.com/download/fm97um9eppm91tc/KNLMeansCL-v0.7.3-1.zip). It will give you a more specific error.

Razinal
20th November 2015, 13:29
That's something I can work about.
Try this (http://www.mediafire.com/download/fm97um9eppm91tc/KNLMeansCL-v0.7.3-1.zip). It will give you a more specific error.

the error this time for just 'KNLMeansCL()' is as follows:
KNLMeansCL: fatal error! (clSetKernelArg(nlmunpack): CL_INVALID_ARG_VALUE) (ffdshow_filter_avisynth_script, line2)

EDIT: here's OpenCL Device Query if you need it: PasteBin (http://pastebin.com/yw99ksLe)
EDIT2: just wanted to say I AM using win 10 TH2 and OCL Device Query shouldn't give my as Windows Ver as 6.2 but whatever...

Xebika
20th November 2015, 13:58
I get same error now.

Khanattila
20th November 2015, 17:21
the error this time for just 'KNLMeansCL()' is as follows:
KNLMeansCL: fatal error! (clSetKernelArg(nlmunpack): CL_INVALID_ARG_VALUE) (ffdshow_filter_avisynth_script, line2)

EDIT: here's OpenCL Device Query if you need it: PasteBin (http://pastebin.com/yw99ksLe)
EDIT2: just wanted to say I AM using win 10 TH2 and OCL Device Query shouldn't give my as Windows Ver as 6.2 but whatever...

I get same error now.
I think it's a problem of NVIDIA, but let's try a workaround.
Second attempt (http://www.mediafire.com/download/rdar2t7144y2tmt/KNLMeansCL-v0.7.3-2.zip).

Xebika
20th November 2015, 17:34
New error: KNLMeansCL: fatal error! (clSetKernelArg(nlmUnpack-mem-out): CL_INVALID_ARG_VALUE)

Khanattila
20th November 2015, 17:52
New error: KNLMeansCL: fatal error! (clSetKernelArg(nlmUnpack-mem-out): CL_INVALID_ARG_VALUE)

Could you tell me if with 'd = 0' or 'd = 1' the error is the same?

Xebika
20th November 2015, 17:55
Yes i got the same error with 'd = 0'

Khanattila
20th November 2015, 18:52
KNLMeansCL-v0.7.3-3.zip (http://www.mediafire.com/download/cg63hppal0wbuiq/KNLMeansCL-v0.7.3-3.zip)

Xebika
20th November 2015, 19:20
v0.7.3-3 + DGIndexIM = Works Again

v0.7.3-3 + DGIndexNV = Freezes Again

Razinal
21st November 2015, 16:13
KNLMeansCL-v0.7.3-3.zip (http://www.mediafire.com/download/cg63hppal0wbuiq/KNLMeansCL-v0.7.3-3.zip)

this one solved the problem for me, :thanks: :)

Khanattila
23rd November 2015, 16:36
v0.7.3-3 + DGIndexIM = Works Again

v0.7.3-3 + DGIndexNV = Freezes Again

I could roll the dice until you get the winning combination ... but the cases are too many.

The thing is postponed until I have (perhaps) a NVIDIA GTX 900.

Khanattila
23rd November 2015, 17:23
this one solved the problem for me, :thanks: :)

Very good. I make it public.

https://github.com/Khanattila/KNLMeansCL/releases/tag/v0.7.4

KNLMeansCL v0.7.4
* Workaround for GeForce 900 Series.

feisty2
16th December 2015, 16:33
Can you add "vcomp" and "center" parameters from xnlmeans?
They are pretty useful to remove compression artifacts

feisty2
31st December 2015, 16:42
any news about "vcomp" and "center"?

Khanattila
1st January 2016, 14:33
any news about "vcomp" and "center"?

I just started working on it

feisty2
1st January 2016, 16:04
good to know! :)
KNLMeansCL has definitely become one of my must have filters

MysteryX
1st January 2016, 17:38
good to know! :)
KNLMeansCL has definitely become one of my must have filters
Agree.

Are_
1st January 2016, 19:03
I just want to say too that this filter is really wonderful, and that I'm really grateful you ported it to vapoursynth. :)

sl1pkn07
2nd January 2016, 00:04
I just want to say too that this filter is really wonderful, and that I'm really grateful you ported it to vapoursynth. :)

and linux!!

edcrfv94
2nd January 2016, 04:45
When s set more then 4 will stopped working
Like:core.knlm.KNLMeansCL(src, d=2, a=2, s=6, h=0.4,device_type="GPU")

[Window Title]
VapourSynth Editor

[Main Instruction]
VapourSynth Editor has stopped working

[Content]
A problem caused the program to stop working correctly. Windows will close the program and notify you if a solution is available.

[Close program]

Test
v0.7.4
v0.7.3
v0.7.2
v0.7.0
v0.6.11
All same

gtx670 359.06

feisty2
2nd January 2016, 07:15
When s set more then 4 will stopped working


"s" gotta be an integer in [0, 4]

Khanattila
11th January 2016, 17:47
When s set more then 4 will stopped working
Like:core.knlm.KNLMeansCL(src, d=2, a=2, s=6, h=0.4,device_type="GPU")

[Window Title]
VapourSynth Editor

[Main Instruction]
VapourSynth Editor has stopped working

[Content]
A problem caused the program to stop working correctly. Windows will close the program and notify you if a solution is available.

[Close program]

Test
v0.7.4
v0.7.3
v0.7.2
v0.7.0
v0.6.11
All same

gtx670 359.06

"s" gotta be an integer in [0, 4]

yep, a missing arg-check in vapoursynth version.

MaxitoHP
11th January 2016, 23:26
I am new here so sorry if I do easy questions.
I have been told that KNLMeansCL is probably today the best denoiser, so I want to start using it.
I have downloaded v0.7.4 and I see there are two KNLMeansCL.dll files on the .rar file, one on the main and one into x64 folder.
1) Which one should I use?
2) Where should I place this .dll? Into MeGUI/tools/avysynth_plugin?

My card is a NVIDIA GeForce GT 545 with controller 347.25. I see on the requirements about a GT 640 or higher, so my one is lower...
3) Do you think it can work on my system?
I have downloaded a more updated controller (361.43 WHQL), but I prefer not to change anything if KNLMeansCL will not work on my system.

On the README file it is written "For maximum performance the plugin should run on the GPU"...
4) does this mean I have to install somthing on the NVIDIA folder?

Finally, for a 10-15 years old film, with medium grain:
5) what is the recommended configuration for a 1080p encoding?

Thanks,
MaxitoHP

MysteryX
12th January 2016, 01:32
I am new here so sorry if I do easy questions.
I have been told that KNLMeansCL is probably today the best denoiser, so I want to start using it.
I have downloaded v0.7.4 and I see there are two KNLMeansCL.dll files on the .rar file, one on the main and one into x64 folder.
1) Which one should I use?
2) Where should I place this .dll? Into MeGUI/tools/avysynth_plugin?
These are basic AviSynth questions that are not about KnlMeans. I'd suggest reading about the basics of AviSynth and first running simple demonstration scripts. The x64 file is when using a 64-bit version of AviSynth, which you probably aren't otherwise you'd know what that is, so just use the regular DLL.

My card is a NVIDIA GeForce GT 545 with controller 347.25. I see on the requirements about a GT 640 or higher, so my one is lower...
3) Do you think it can work on my system?

The latest version requires OpenCL v1.2 which is not supported by all graphic cards. If your card doesn't support it, use an older version (6.11 I believe) that works with OpenCL v1.1

kalehrl
12th January 2016, 14:36
I am new here so sorry if I do easy questions.
I have been told that KNLMeansCL is probably today the best denoiser, so I want to start using it.
I have downloaded v0.7.4 and I see there are two KNLMeansCL.dll files on the .rar file, one on the main and one into x64 folder.
1) Which one should I use?
2) Where should I place this .dll? Into MeGUI/tools/avysynth_plugin?

My card is a NVIDIA GeForce GT 545 with controller 347.25. I see on the requirements about a GT 640 or higher, so my one is lower...
3) Do you think it can work on my system?
I have downloaded a more updated controller (361.43 WHQL), but I prefer not to change anything if KNLMeansCL will not work on my system.

On the README file it is written "For maximum performance the plugin should run on the GPU"...
4) does this mean I have to install somthing on the NVIDIA folder?

Finally, for a 10-15 years old film, with medium grain:
5) what is the recommended configuration for a 1080p encoding?

Thanks,
MaxitoHP
1) You probably have x86 avisynth so use the file in the main directory which is x86 one.
2) Put it in C:\Program Files (x86)\AviSynth\plugins
3) Try it. I dunno.
4) No.
5) According to taste. Try with the default settings: KNLMeansCL () If you want stronger denosing, try changing the 'h' value. The default is 1.2 so try something like KNLMeansCL (h=2)

Khanattila
12th January 2016, 16:14
NVIDIA GeForce 500 series is dead, try v0.6.11 version.

MaxitoHP
12th January 2016, 23:25
Thank you very much for the three of you that has responded. I have downloaded v0.6.11 and will try to check it without updating the controller of my GeForce.

Atak_Snajpera
30th January 2016, 15:41
Small suggestion regarding device_type="AUTO".
This option should also check whether GPU supports OpenCL 1.2 or not.
My Radeon 4850 is too old for gpu acceleration even with v0.6.11 due to CL_DEVICE_IMAGE_SUPPORT = 0. In this case plugin should automatically switch to CPU mode.

C:\Users\Dave\Desktop\NVIDIA GPU Computing SDK\OpenCL\bin\Win32\Release\oclDeviceQuery.exe Starting...

OpenCL SW Info:

WARNING: NVIDIA OpenCL platform not found - defaulting to first platform!

CL_PLATFORM_NAME: AMD Accelerated Parallel Processing
CL_PLATFORM_VERSION: OpenCL 1.2 AMD-APP (937.2)
OpenCL SDK Revision: 7027912


OpenCL Device Info:

2 devices found supporting OpenCL:

---------------------------------
Device ATI RV770
---------------------------------
CL_DEVICE_NAME: ATI RV770
CL_DEVICE_VENDOR: Advanced Micro Devices, Inc.
CL_DRIVER_VERSION: CAL 1.4.1734
CL_DEVICE_VERSION: OpenCL 1.0 AMD-APP (937.2)
CL_DEVICE_TYPE: CL_DEVICE_TYPE_GPU
CL_DEVICE_MAX_COMPUTE_UNITS: 10
CL_DEVICE_MAX_WORK_ITEM_DIMENSIONS: 3
CL_DEVICE_MAX_WORK_ITEM_SIZES: 256 / 256 / 256
CL_DEVICE_MAX_WORK_GROUP_SIZE: 256
CL_DEVICE_MAX_CLOCK_FREQUENCY: 625 MHz
CL_DEVICE_ADDRESS_BITS: 32
CL_DEVICE_MAX_MEM_ALLOC_SIZE: 128 MByte
CL_DEVICE_GLOBAL_MEM_SIZE: 256 MByte
CL_DEVICE_ERROR_CORRECTION_SUPPORT: no
CL_DEVICE_LOCAL_MEM_TYPE: global
CL_DEVICE_LOCAL_MEM_SIZE: 16 KByte
CL_DEVICE_MAX_CONSTANT_BUFFER_SIZE: 64 KByte
CL_DEVICE_QUEUE_PROPERTIES: CL_QUEUE_PROFILING_ENABLE
CL_DEVICE_IMAGE_SUPPORT: 0
CL_DEVICE_MAX_READ_IMAGE_ARGS: 0
CL_DEVICE_MAX_WRITE_IMAGE_ARGS: 0
CL_DEVICE_SINGLE_FP_CONFIG: INF-quietNaNs round-to-nearest round-to-zero round-to-inf fma

CL_DEVICE_IMAGE <dim> 2D_MAX_WIDTH 0
2D_MAX_HEIGHT 0
3D_MAX_WIDTH 0
3D_MAX_HEIGHT 0
3D_MAX_DEPTH 0

CL_DEVICE_EXTENSIONS: cl_khr_fp64
cl_amd_fp64
cl_khr_gl_sharing
cl_amd_device_attribute_query
cl_khr_d3d10_sharing

CL_DEVICE_PREFERRED_VECTOR_WIDTH_<t> CHAR 16, SHORT 8, INT 4, LONG 2, FLOAT 4, DOUBLE 2


---------------------------------
Device Intel(R) Xeon(R) CPU E5-2690 0 @ 2.90GHz
---------------------------------
CL_DEVICE_NAME: Intel(R) Xeon(R) CPU E5-2690 0 @ 2.90GHz
CL_DEVICE_VENDOR: GenuineIntel
CL_DRIVER_VERSION: 2.0 (sse2,avx)
CL_DEVICE_VERSION: OpenCL 1.2 AMD-APP (937.2)
CL_DEVICE_OPENCL_C_VERSION: OpenCL C 1.2
CL_DEVICE_TYPE: CL_DEVICE_TYPE_CPU
CL_DEVICE_MAX_COMPUTE_UNITS: 16
CL_DEVICE_MAX_WORK_ITEM_DIMENSIONS: 3
CL_DEVICE_MAX_WORK_ITEM_SIZES: 1024 / 1024 / 1024
CL_DEVICE_MAX_WORK_GROUP_SIZE: 1024
CL_DEVICE_MAX_CLOCK_FREQUENCY: 2901 MHz
CL_DEVICE_ADDRESS_BITS: 32
CL_DEVICE_MAX_MEM_ALLOC_SIZE: 1024 MByte
CL_DEVICE_GLOBAL_MEM_SIZE: 2048 MByte
CL_DEVICE_ERROR_CORRECTION_SUPPORT: no
CL_DEVICE_LOCAL_MEM_TYPE: global
CL_DEVICE_LOCAL_MEM_SIZE: 32 KByte
CL_DEVICE_MAX_CONSTANT_BUFFER_SIZE: 64 KByte
CL_DEVICE_QUEUE_PROPERTIES: CL_QUEUE_PROFILING_ENABLE
CL_DEVICE_IMAGE_SUPPORT: 1
CL_DEVICE_MAX_READ_IMAGE_ARGS: 128
CL_DEVICE_MAX_WRITE_IMAGE_ARGS: 8
CL_DEVICE_SINGLE_FP_CONFIG: denorms INF-quietNaNs round-to-nearest round-to-zero round-to-inf fma

CL_DEVICE_IMAGE <dim> 2D_MAX_WIDTH 8192
2D_MAX_HEIGHT 8192
3D_MAX_WIDTH 2048
3D_MAX_HEIGHT 2048
3D_MAX_DEPTH 2048

CL_DEVICE_EXTENSIONS: cl_khr_fp64
cl_amd_fp64
cl_khr_global_int32_base_atomics
cl_khr_global_int32_extended_atomics
cl_khr_local_int32_base_atomics
cl_khr_local_int32_extended_atomics
cl_khr_byte_addressable_store
cl_khr_gl_sharing
cl_ext_device_fission
cl_amd_device_attribute_query
cl_amd_vec3
cl_amd_printf
cl_amd_media_ops
cl_amd_popcnt
cl_khr_d3d10_sharing

CL_DEVICE_PREFERRED_VECTOR_WIDTH_<t> CHAR 16, SHORT 8, INT 4, LONG 2, FLOAT 4, DOUBLE 0


---------------------------------
2D Image Formats Supported (80)
---------------------------------
# Channel Order Channel Type

1 CL_R CL_SNORM_INT8
2 CL_R CL_SNORM_INT16
3 CL_R CL_UNORM_INT8
4 CL_R CL_UNORM_INT16
5 CL_R CL_SIGNED_INT8
6 CL_R CL_SIGNED_INT16
7 CL_R CL_SIGNED_INT32
8 CL_R CL_UNSIGNED_INT8
9 CL_R CL_UNSIGNED_INT16
10 CL_R CL_UNSIGNED_INT32
11 CL_R CL_HALF_FLOAT
12 CL_R CL_FLOAT
13 CL_A CL_SNORM_INT8
14 CL_A CL_SNORM_INT16
15 CL_A CL_UNORM_INT8
16 CL_A CL_UNORM_INT16
17 CL_A CL_SIGNED_INT8
18 CL_A CL_SIGNED_INT16
19 CL_A CL_SIGNED_INT32
20 CL_A CL_UNSIGNED_INT8
21 CL_A CL_UNSIGNED_INT16
22 CL_A CL_UNSIGNED_INT32
23 CL_A CL_HALF_FLOAT
24 CL_A CL_FLOAT
25 CL_RG CL_SNORM_INT8
26 CL_RG CL_SNORM_INT16
27 CL_RG CL_UNORM_INT8
28 CL_RG CL_UNORM_INT16
29 CL_RG CL_SIGNED_INT8
30 CL_RG CL_SIGNED_INT16
31 CL_RG CL_SIGNED_INT32
32 CL_RG CL_UNSIGNED_INT8
33 CL_RG CL_UNSIGNED_INT16
34 CL_RG CL_UNSIGNED_INT32
35 CL_RG CL_HALF_FLOAT
36 CL_RG CL_FLOAT
37 CL_RGBA CL_SNORM_INT8
38 CL_RGBA CL_SNORM_INT16
39 CL_RGBA CL_UNORM_INT8
40 CL_RGBA CL_UNORM_INT16
41 CL_RGBA CL_SIGNED_INT8
42 CL_RGBA CL_SIGNED_INT16
43 CL_RGBA CL_SIGNED_INT32
44 CL_RGBA CL_UNSIGNED_INT8
45 CL_RGBA CL_UNSIGNED_INT16
46 CL_RGBA CL_UNSIGNED_INT32
47 CL_RGBA CL_HALF_FLOAT
48 CL_RGBA CL_FLOAT
49 CL_ARGB CL_SNORM_INT8
50 CL_ARGB CL_UNORM_INT8
51 CL_ARGB CL_SIGNED_INT8
52 CL_ARGB CL_UNSIGNED_INT8
53 CL_BGRA CL_SNORM_INT8
54 CL_BGRA CL_UNORM_INT8
55 CL_BGRA CL_SIGNED_INT8
56 CL_BGRA CL_UNSIGNED_INT8
57 CL_LUMINANCE CL_SNORM_INT8
58 CL_LUMINANCE CL_SNORM_INT16
59 CL_LUMINANCE CL_UNORM_INT8
60 CL_LUMINANCE CL_UNORM_INT16
61 CL_LUMINANCE CL_HALF_FLOAT
62 CL_LUMINANCE CL_FLOAT
63 CL_INTENSITY CL_SNORM_INT8
64 CL_INTENSITY CL_SNORM_INT16
65 CL_INTENSITY CL_UNORM_INT8
66 CL_INTENSITY CL_UNORM_INT16
67 CL_INTENSITY CL_HALF_FLOAT
68 CL_INTENSITY CL_FLOAT
69 CL_RA CL_SNORM_INT8
70 CL_RA CL_SNORM_INT16
71 CL_RA CL_UNORM_INT8
72 CL_RA CL_UNORM_INT16
73 CL_RA CL_SIGNED_INT8
74 CL_RA CL_SIGNED_INT16
75 CL_RA CL_SIGNED_INT32
76 CL_RA CL_UNSIGNED_INT8
77 CL_RA CL_UNSIGNED_INT16
78 CL_RA CL_UNSIGNED_INT32
79 CL_RA CL_HALF_FLOAT
80 CL_RA CL_FLOAT

---------------------------------
3D Image Formats Supported (80)
---------------------------------
# Channel Order Channel Type

1 CL_R CL_SNORM_INT8
2 CL_R CL_SNORM_INT16
3 CL_R CL_UNORM_INT8
4 CL_R CL_UNORM_INT16
5 CL_R CL_SIGNED_INT8
6 CL_R CL_SIGNED_INT16
7 CL_R CL_SIGNED_INT32
8 CL_R CL_UNSIGNED_INT8
9 CL_R CL_UNSIGNED_INT16
10 CL_R CL_UNSIGNED_INT32
11 CL_R CL_HALF_FLOAT
12 CL_R CL_FLOAT
13 CL_A CL_SNORM_INT8
14 CL_A CL_SNORM_INT16
15 CL_A CL_UNORM_INT8
16 CL_A CL_UNORM_INT16
17 CL_A CL_SIGNED_INT8
18 CL_A CL_SIGNED_INT16
19 CL_A CL_SIGNED_INT32
20 CL_A CL_UNSIGNED_INT8
21 CL_A CL_UNSIGNED_INT16
22 CL_A CL_UNSIGNED_INT32
23 CL_A CL_HALF_FLOAT
24 CL_A CL_FLOAT
25 CL_RG CL_SNORM_INT8
26 CL_RG CL_SNORM_INT16
27 CL_RG CL_UNORM_INT8
28 CL_RG CL_UNORM_INT16
29 CL_RG CL_SIGNED_INT8
30 CL_RG CL_SIGNED_INT16
31 CL_RG CL_SIGNED_INT32
32 CL_RG CL_UNSIGNED_INT8
33 CL_RG CL_UNSIGNED_INT16
34 CL_RG CL_UNSIGNED_INT32
35 CL_RG CL_HALF_FLOAT
36 CL_RG CL_FLOAT
37 CL_RGBA CL_SNORM_INT8
38 CL_RGBA CL_SNORM_INT16
39 CL_RGBA CL_UNORM_INT8
40 CL_RGBA CL_UNORM_INT16
41 CL_RGBA CL_SIGNED_INT8
42 CL_RGBA CL_SIGNED_INT16
43 CL_RGBA CL_SIGNED_INT32
44 CL_RGBA CL_UNSIGNED_INT8
45 CL_RGBA CL_UNSIGNED_INT16
46 CL_RGBA CL_UNSIGNED_INT32
47 CL_RGBA CL_HALF_FLOAT
48 CL_RGBA CL_FLOAT
49 CL_ARGB CL_SNORM_INT8
50 CL_ARGB CL_UNORM_INT8
51 CL_ARGB CL_SIGNED_INT8
52 CL_ARGB CL_UNSIGNED_INT8
53 CL_BGRA CL_SNORM_INT8
54 CL_BGRA CL_UNORM_INT8
55 CL_BGRA CL_SIGNED_INT8
56 CL_BGRA CL_UNSIGNED_INT8
57 CL_LUMINANCE CL_SNORM_INT8
58 CL_LUMINANCE CL_SNORM_INT16
59 CL_LUMINANCE CL_UNORM_INT8
60 CL_LUMINANCE CL_UNORM_INT16
61 CL_LUMINANCE CL_HALF_FLOAT
62 CL_LUMINANCE CL_FLOAT
63 CL_INTENSITY CL_SNORM_INT8
64 CL_INTENSITY CL_SNORM_INT16
65 CL_INTENSITY CL_UNORM_INT8
66 CL_INTENSITY CL_UNORM_INT16
67 CL_INTENSITY CL_HALF_FLOAT
68 CL_INTENSITY CL_FLOAT
69 CL_RA CL_SNORM_INT8
70 CL_RA CL_SNORM_INT16
71 CL_RA CL_UNORM_INT8
72 CL_RA CL_UNORM_INT16
73 CL_RA CL_SIGNED_INT8
74 CL_RA CL_SIGNED_INT16
75 CL_RA CL_SIGNED_INT32
76 CL_RA CL_UNSIGNED_INT8
77 CL_RA CL_UNSIGNED_INT16
78 CL_RA CL_UNSIGNED_INT32
79 CL_RA CL_HALF_FLOAT
80 CL_RA CL_FLOAT

oclDeviceQuery, Platform Name = AMD Accelerated Parallel Processing, Platform Version = OpenCL 1.2 AMD-APP (937.2), SDK Revision = 7027912, NumDevs = 2, Device = ATI RV770, Device = Intel(R) Xeon(R) CPU E5-2690 0 @ 2.90GHz

System Info:

Local Time/Date = 15:33:14, 1/30/2016
CPU Arch: 0
CPU Level: 6
# of CPU processors: 16
Windows Build: 7601
Windows Ver: 6.1 (Windows Vista / Windows 7)




Also Would be possible to have different filtering strength for Chroma like in HQDN3D?

Khanattila
5th February 2016, 13:07
Small suggestion regarding device_type="AUTO".
This option should also check whether GPU supports OpenCL 1.2 or not.
My Radeon 4850 is too old for gpu acceleration even with v0.6.11 due to CL_DEVICE_IMAGE_SUPPORT = 0. In this case plugin should automatically switch to CPU mode.

C:\Users\Dave\Desktop\NVIDIA GPU Computing SDK\OpenCL\bin\Win32\Release\oclDeviceQuery.exe Starting...

OpenCL SW Info:

WARNING: NVIDIA OpenCL platform not found - defaulting to first platform!

CL_PLATFORM_NAME: AMD Accelerated Parallel Processing
CL_PLATFORM_VERSION: OpenCL 1.2 AMD-APP (937.2)
OpenCL SDK Revision: 7027912


OpenCL Device Info:

2 devices found supporting OpenCL:

---------------------------------
Device ATI RV770
---------------------------------
CL_DEVICE_NAME: ATI RV770
CL_DEVICE_VENDOR: Advanced Micro Devices, Inc.
CL_DRIVER_VERSION: CAL 1.4.1734
CL_DEVICE_VERSION: OpenCL 1.0 AMD-APP (937.2)
CL_DEVICE_TYPE: CL_DEVICE_TYPE_GPU
CL_DEVICE_MAX_COMPUTE_UNITS: 10
CL_DEVICE_MAX_WORK_ITEM_DIMENSIONS: 3
CL_DEVICE_MAX_WORK_ITEM_SIZES: 256 / 256 / 256
CL_DEVICE_MAX_WORK_GROUP_SIZE: 256
CL_DEVICE_MAX_CLOCK_FREQUENCY: 625 MHz
CL_DEVICE_ADDRESS_BITS: 32
CL_DEVICE_MAX_MEM_ALLOC_SIZE: 128 MByte
CL_DEVICE_GLOBAL_MEM_SIZE: 256 MByte
CL_DEVICE_ERROR_CORRECTION_SUPPORT: no
CL_DEVICE_LOCAL_MEM_TYPE: global
CL_DEVICE_LOCAL_MEM_SIZE: 16 KByte
CL_DEVICE_MAX_CONSTANT_BUFFER_SIZE: 64 KByte
CL_DEVICE_QUEUE_PROPERTIES: CL_QUEUE_PROFILING_ENABLE
CL_DEVICE_IMAGE_SUPPORT: 0
CL_DEVICE_MAX_READ_IMAGE_ARGS: 0
CL_DEVICE_MAX_WRITE_IMAGE_ARGS: 0
CL_DEVICE_SINGLE_FP_CONFIG: INF-quietNaNs round-to-nearest round-to-zero round-to-inf fma

CL_DEVICE_IMAGE <dim> 2D_MAX_WIDTH 0
2D_MAX_HEIGHT 0
3D_MAX_WIDTH 0
3D_MAX_HEIGHT 0
3D_MAX_DEPTH 0

CL_DEVICE_EXTENSIONS: cl_khr_fp64
cl_amd_fp64
cl_khr_gl_sharing
cl_amd_device_attribute_query
cl_khr_d3d10_sharing

CL_DEVICE_PREFERRED_VECTOR_WIDTH_<t> CHAR 16, SHORT 8, INT 4, LONG 2, FLOAT 4, DOUBLE 2


---------------------------------
Device Intel(R) Xeon(R) CPU E5-2690 0 @ 2.90GHz
---------------------------------
CL_DEVICE_NAME: Intel(R) Xeon(R) CPU E5-2690 0 @ 2.90GHz
CL_DEVICE_VENDOR: GenuineIntel
CL_DRIVER_VERSION: 2.0 (sse2,avx)
CL_DEVICE_VERSION: OpenCL 1.2 AMD-APP (937.2)
CL_DEVICE_OPENCL_C_VERSION: OpenCL C 1.2
CL_DEVICE_TYPE: CL_DEVICE_TYPE_CPU
CL_DEVICE_MAX_COMPUTE_UNITS: 16
CL_DEVICE_MAX_WORK_ITEM_DIMENSIONS: 3
CL_DEVICE_MAX_WORK_ITEM_SIZES: 1024 / 1024 / 1024
CL_DEVICE_MAX_WORK_GROUP_SIZE: 1024
CL_DEVICE_MAX_CLOCK_FREQUENCY: 2901 MHz
CL_DEVICE_ADDRESS_BITS: 32
CL_DEVICE_MAX_MEM_ALLOC_SIZE: 1024 MByte
CL_DEVICE_GLOBAL_MEM_SIZE: 2048 MByte
CL_DEVICE_ERROR_CORRECTION_SUPPORT: no
CL_DEVICE_LOCAL_MEM_TYPE: global
CL_DEVICE_LOCAL_MEM_SIZE: 32 KByte
CL_DEVICE_MAX_CONSTANT_BUFFER_SIZE: 64 KByte
CL_DEVICE_QUEUE_PROPERTIES: CL_QUEUE_PROFILING_ENABLE
CL_DEVICE_IMAGE_SUPPORT: 1
CL_DEVICE_MAX_READ_IMAGE_ARGS: 128
CL_DEVICE_MAX_WRITE_IMAGE_ARGS: 8
CL_DEVICE_SINGLE_FP_CONFIG: denorms INF-quietNaNs round-to-nearest round-to-zero round-to-inf fma

CL_DEVICE_IMAGE <dim> 2D_MAX_WIDTH 8192
2D_MAX_HEIGHT 8192
3D_MAX_WIDTH 2048
3D_MAX_HEIGHT 2048
3D_MAX_DEPTH 2048

CL_DEVICE_EXTENSIONS: cl_khr_fp64
cl_amd_fp64
cl_khr_global_int32_base_atomics
cl_khr_global_int32_extended_atomics
cl_khr_local_int32_base_atomics
cl_khr_local_int32_extended_atomics
cl_khr_byte_addressable_store
cl_khr_gl_sharing
cl_ext_device_fission
cl_amd_device_attribute_query
cl_amd_vec3
cl_amd_printf
cl_amd_media_ops
cl_amd_popcnt
cl_khr_d3d10_sharing

CL_DEVICE_PREFERRED_VECTOR_WIDTH_<t> CHAR 16, SHORT 8, INT 4, LONG 2, FLOAT 4, DOUBLE 0


---------------------------------
2D Image Formats Supported (80)
---------------------------------
# Channel Order Channel Type

1 CL_R CL_SNORM_INT8
2 CL_R CL_SNORM_INT16
3 CL_R CL_UNORM_INT8
4 CL_R CL_UNORM_INT16
5 CL_R CL_SIGNED_INT8
6 CL_R CL_SIGNED_INT16
7 CL_R CL_SIGNED_INT32
8 CL_R CL_UNSIGNED_INT8
9 CL_R CL_UNSIGNED_INT16
10 CL_R CL_UNSIGNED_INT32
11 CL_R CL_HALF_FLOAT
12 CL_R CL_FLOAT
13 CL_A CL_SNORM_INT8
14 CL_A CL_SNORM_INT16
15 CL_A CL_UNORM_INT8
16 CL_A CL_UNORM_INT16
17 CL_A CL_SIGNED_INT8
18 CL_A CL_SIGNED_INT16
19 CL_A CL_SIGNED_INT32
20 CL_A CL_UNSIGNED_INT8
21 CL_A CL_UNSIGNED_INT16
22 CL_A CL_UNSIGNED_INT32
23 CL_A CL_HALF_FLOAT
24 CL_A CL_FLOAT
25 CL_RG CL_SNORM_INT8
26 CL_RG CL_SNORM_INT16
27 CL_RG CL_UNORM_INT8
28 CL_RG CL_UNORM_INT16
29 CL_RG CL_SIGNED_INT8
30 CL_RG CL_SIGNED_INT16
31 CL_RG CL_SIGNED_INT32
32 CL_RG CL_UNSIGNED_INT8
33 CL_RG CL_UNSIGNED_INT16
34 CL_RG CL_UNSIGNED_INT32
35 CL_RG CL_HALF_FLOAT
36 CL_RG CL_FLOAT
37 CL_RGBA CL_SNORM_INT8
38 CL_RGBA CL_SNORM_INT16
39 CL_RGBA CL_UNORM_INT8
40 CL_RGBA CL_UNORM_INT16
41 CL_RGBA CL_SIGNED_INT8
42 CL_RGBA CL_SIGNED_INT16
43 CL_RGBA CL_SIGNED_INT32
44 CL_RGBA CL_UNSIGNED_INT8
45 CL_RGBA CL_UNSIGNED_INT16
46 CL_RGBA CL_UNSIGNED_INT32
47 CL_RGBA CL_HALF_FLOAT
48 CL_RGBA CL_FLOAT
49 CL_ARGB CL_SNORM_INT8
50 CL_ARGB CL_UNORM_INT8
51 CL_ARGB CL_SIGNED_INT8
52 CL_ARGB CL_UNSIGNED_INT8
53 CL_BGRA CL_SNORM_INT8
54 CL_BGRA CL_UNORM_INT8
55 CL_BGRA CL_SIGNED_INT8
56 CL_BGRA CL_UNSIGNED_INT8
57 CL_LUMINANCE CL_SNORM_INT8
58 CL_LUMINANCE CL_SNORM_INT16
59 CL_LUMINANCE CL_UNORM_INT8
60 CL_LUMINANCE CL_UNORM_INT16
61 CL_LUMINANCE CL_HALF_FLOAT
62 CL_LUMINANCE CL_FLOAT
63 CL_INTENSITY CL_SNORM_INT8
64 CL_INTENSITY CL_SNORM_INT16
65 CL_INTENSITY CL_UNORM_INT8
66 CL_INTENSITY CL_UNORM_INT16
67 CL_INTENSITY CL_HALF_FLOAT
68 CL_INTENSITY CL_FLOAT
69 CL_RA CL_SNORM_INT8
70 CL_RA CL_SNORM_INT16
71 CL_RA CL_UNORM_INT8
72 CL_RA CL_UNORM_INT16
73 CL_RA CL_SIGNED_INT8
74 CL_RA CL_SIGNED_INT16
75 CL_RA CL_SIGNED_INT32
76 CL_RA CL_UNSIGNED_INT8
77 CL_RA CL_UNSIGNED_INT16
78 CL_RA CL_UNSIGNED_INT32
79 CL_RA CL_HALF_FLOAT
80 CL_RA CL_FLOAT

---------------------------------
3D Image Formats Supported (80)
---------------------------------
# Channel Order Channel Type

1 CL_R CL_SNORM_INT8
2 CL_R CL_SNORM_INT16
3 CL_R CL_UNORM_INT8
4 CL_R CL_UNORM_INT16
5 CL_R CL_SIGNED_INT8
6 CL_R CL_SIGNED_INT16
7 CL_R CL_SIGNED_INT32
8 CL_R CL_UNSIGNED_INT8
9 CL_R CL_UNSIGNED_INT16
10 CL_R CL_UNSIGNED_INT32
11 CL_R CL_HALF_FLOAT
12 CL_R CL_FLOAT
13 CL_A CL_SNORM_INT8
14 CL_A CL_SNORM_INT16
15 CL_A CL_UNORM_INT8
16 CL_A CL_UNORM_INT16
17 CL_A CL_SIGNED_INT8
18 CL_A CL_SIGNED_INT16
19 CL_A CL_SIGNED_INT32
20 CL_A CL_UNSIGNED_INT8
21 CL_A CL_UNSIGNED_INT16
22 CL_A CL_UNSIGNED_INT32
23 CL_A CL_HALF_FLOAT
24 CL_A CL_FLOAT
25 CL_RG CL_SNORM_INT8
26 CL_RG CL_SNORM_INT16
27 CL_RG CL_UNORM_INT8
28 CL_RG CL_UNORM_INT16
29 CL_RG CL_SIGNED_INT8
30 CL_RG CL_SIGNED_INT16
31 CL_RG CL_SIGNED_INT32
32 CL_RG CL_UNSIGNED_INT8
33 CL_RG CL_UNSIGNED_INT16
34 CL_RG CL_UNSIGNED_INT32
35 CL_RG CL_HALF_FLOAT
36 CL_RG CL_FLOAT
37 CL_RGBA CL_SNORM_INT8
38 CL_RGBA CL_SNORM_INT16
39 CL_RGBA CL_UNORM_INT8
40 CL_RGBA CL_UNORM_INT16
41 CL_RGBA CL_SIGNED_INT8
42 CL_RGBA CL_SIGNED_INT16
43 CL_RGBA CL_SIGNED_INT32
44 CL_RGBA CL_UNSIGNED_INT8
45 CL_RGBA CL_UNSIGNED_INT16
46 CL_RGBA CL_UNSIGNED_INT32
47 CL_RGBA CL_HALF_FLOAT
48 CL_RGBA CL_FLOAT
49 CL_ARGB CL_SNORM_INT8
50 CL_ARGB CL_UNORM_INT8
51 CL_ARGB CL_SIGNED_INT8
52 CL_ARGB CL_UNSIGNED_INT8
53 CL_BGRA CL_SNORM_INT8
54 CL_BGRA CL_UNORM_INT8
55 CL_BGRA CL_SIGNED_INT8
56 CL_BGRA CL_UNSIGNED_INT8
57 CL_LUMINANCE CL_SNORM_INT8
58 CL_LUMINANCE CL_SNORM_INT16
59 CL_LUMINANCE CL_UNORM_INT8
60 CL_LUMINANCE CL_UNORM_INT16
61 CL_LUMINANCE CL_HALF_FLOAT
62 CL_LUMINANCE CL_FLOAT
63 CL_INTENSITY CL_SNORM_INT8
64 CL_INTENSITY CL_SNORM_INT16
65 CL_INTENSITY CL_UNORM_INT8
66 CL_INTENSITY CL_UNORM_INT16
67 CL_INTENSITY CL_HALF_FLOAT
68 CL_INTENSITY CL_FLOAT
69 CL_RA CL_SNORM_INT8
70 CL_RA CL_SNORM_INT16
71 CL_RA CL_UNORM_INT8
72 CL_RA CL_UNORM_INT16
73 CL_RA CL_SIGNED_INT8
74 CL_RA CL_SIGNED_INT16
75 CL_RA CL_SIGNED_INT32
76 CL_RA CL_UNSIGNED_INT8
77 CL_RA CL_UNSIGNED_INT16
78 CL_RA CL_UNSIGNED_INT32
79 CL_RA CL_HALF_FLOAT
80 CL_RA CL_FLOAT

oclDeviceQuery, Platform Name = AMD Accelerated Parallel Processing, Platform Version = OpenCL 1.2 AMD-APP (937.2), SDK Revision = 7027912, NumDevs = 2, Device = ATI RV770, Device = Intel(R) Xeon(R) CPU E5-2690 0 @ 2.90GHz

System Info:

Local Time/Date = 15:33:14, 1/30/2016
CPU Arch: 0
CPU Level: 6
# of CPU processors: 16
Windows Build: 7601
Windows Ver: 6.1 (Windows Vista / Windows 7)




Also Would be possible to have different filtering strength for Chroma like in HQDN3D?

For performance reasons KNLMeansCL calculates the distance between two colors rather than between two gray levels three times.

If you want to have three different jobs you have to invoke it three times.


Y = KNLMeansCL(h=1)
U = UToY8().KNLMeansCL(h=2)
V = VToY8().KNLMeansCL(h=3)
YToUV(U, V, Y)


Regarding the other question you're right. I should check the CL_DEVICE_IMAGE_SUPPORT.

Atak_Snajpera
8th February 2016, 14:07
What do you think about creating version for OpenCL 2.0 or even 2.1. Yes I know that currently only AMD gpus are compatible with latest version. However It would be cool if we could combine AMD APU+AMD GPU power :)

littleD
8th February 2016, 22:57
Is that really AMD has support for Ocl 2.1? That would be a news.

Atak_Snajpera
9th February 2016, 11:15
My glass ball shows me that drivers for opencl 2.1 will be released together with vulkan 1.0. Why? Because both use the same intermediate spir-v language.

Khanattila
12th February 2016, 00:20
What do you think about creating version for OpenCL 2.0 or even 2.1. Yes I know that currently only AMD gpus are compatible with latest version. However It would be cool if we could combine AMD APU+AMD GPU power :)

Not really. What updates will give more performance?
Shared virtual memory? Useful only in AMD APU.
Nested parallelism? KNLMeansCL is data-parallel. Each pixel is independent of the others.
Generic address space? Just another level of abstraction.
Image enhancements? This is interesting, and may give better performance.

OpenCL 2.1 replaces the OpenCL C kernel language with OpenCL C++. Just another level of abstraction.
More abstraction usually means less performance.

Atak_Snajpera
14th February 2016, 12:36
check first post in this thread. He posted there requirments.

Atak_Snajpera
14th February 2016, 12:50
Older version also does not work with r4xxx due to hardware limitations. No idea about your gtx580...

Khanattila
14th February 2016, 16:06
I wrote "NVIDIA GeForce GT 640 or greater". NVIDIA no longer supports the GeForce 500 series...

Khanattila
15th February 2016, 01:52
Come on boy! I wrote it every way, both here and on github. There are a lot of post and tickets. Google is free.

GT 640 is supported by NVIDIA, GTX 590 Ultra Power Limited Edition not. :D

guest
15th February 2016, 02:50
Come on boy! I wrote it every way, both here and on github. There are a lot of post and tickets. Google is free.

GT 640 is supported by NVIDIA, GTX 590 Ultra Power Limited Edition not. :D

Don't appreciate the "Come on boy!" comment.

Someone needs to write a version of this that DOES support older, lower spec'd cards, 'cause there's a LOT of them out there.

tebasuna51
15th February 2016, 10:03
I wrote "NVIDIA GeForce GT 640 or greater". NVIDIA no longer supports the GeForce 500 series...

My NVIDIA GeForce GT 630 is also supported.
Just to clarify the "greater".

Groucho2004
15th February 2016, 10:53
Someone needs to write a version of this that DOES support older, lower spec'd cards, 'cause there's a LOT of them out there.
First of all, stop deleting posts to which others already replied. Secondly, if you want to use KNLMeansCL with a GTX5xx card, just use version 0.6.11.

Khanattila
15th February 2016, 11:10
My NVIDIA GeForce GT 630 is also supported.
Just to clarify the "greater".

The GF108 (GT 420/430/440/520/530/620/630) is not reported as conformant product by Khronos.

I think you have a GT 630 OEM, using a GK107 (630/ 640 / 650 / 730 OEM / 740).

EDIT. Another possibility is the GeForce GT 630 Rev. 2, using a GK208 (630, 640, 710, 720, 730). There are four different graphics cards with the same name.

guest
15th February 2016, 12:59
Secondly, if you want to use KNLMeansCL with a GTX5xx card, just use version 0.6.11.

Too many conflicting suggestions here, one person says NO, and others say YES......I haven't had any success.

I am trying to get this to work with Ripbot264.

What other methods/processes can I used KNLMeansCL ??

Does this work with either CPU or GPU support ??

Sparktank
15th February 2016, 14:07
......

Have you even tried the older version suggested?

version 0.6.11.
https://github.com/Khanattila/KNLMeansCL/releases/tag/v0.6.11

guest
15th February 2016, 15:08
Have you even tried the older version suggested?


https://github.com/Khanattila/KNLMeansCL/releases/tag/v0.6.11

Well, the only way I know how to try the older version is to "install", copy v0.6.11 files into the default folder (after having removed the files from v0.7.4) that is part of the Ripbot264 "group".

From memory, it's just causes a different error, but still does not recognise the GTX580. Similar to cannot load, or open library.

Atak_Snajpera
15th February 2016, 15:19
burt123
Blame glorious nvidia for not supporting older gpus. KNLmeanscl author can't do anything to help you. My next gpu will be polaris with opencl 2.1 support than silly nvidia limited to 1.2

soneca
15th February 2016, 15:35
I wrote "NVIDIA GeForce GT 640 or greater". NVIDIA no longer supports the GeForce 500 series...

So my GTX 650 should work...:p

Groucho2004
15th February 2016, 16:30
From memory, it's just causes a different error, but still does not recognise the GTX580. Similar to cannot load, or open library.
That's very vague and doesn't help at all. Create a simple script and try loading it in VirtualDub. Post the exact error message (if any).
It might also be helpful if you posted your OS version, driver version, etc.

guest
16th February 2016, 01:59
That's very vague and doesn't help at all. Create a simple script and try loading it in VirtualDub. Post the exact error message (if any).
It might also be helpful if you posted your OS version, driver version, etc.

Sorry Groucho, I'm not going to pursue this ANY further. !!!

Atak_Snajpera
18th February 2016, 13:17
Khanattila are you sure that HD 4600 series have support for CL_DEVICE_IMAGE_SUPPORT ? My 4850 reports CL_DEVICE_IMAGE_SUPPORT = 0.
Legacy

Version 0.6.11
ATI HD 4600 Series GPU or greater.
NVIDIA GeForce 8400 GS or greater.
Visual C++ Redistributable Package for Visual Studio 2013.

Khanattila
18th February 2016, 13:33
Khanattila are you sure that HD 4600 series have support for CL_DEVICE_IMAGE_SUPPORT ? My 4850 reports CL_DEVICE_IMAGE_SUPPORT = 0.

My fault. Unfortunately, the database is not very accurate.
ATI Radeon HD 5400 Series GPU, should support OpenCL 1.1.
Maybe it's better.

Khanattila
19th February 2016, 19:28
https://github.com/Khanattila/KNLMeansCL/releases/tag/v0.7.5

KNLMeansCL v0.7.5
* New 'wref' (default 1.0) parameter.
* Improved automatic selection of OpenCL device.
* Changed parameters order.
* VapourSynth: fixed missing 's' value check.

Dreamland
20th February 2016, 13:42
Help me!
KNLMeansCL v0.7.4 with Visual C++ Redistributable Package for Visual Studio 2013 works very well
KNLMeansCL v0.7.5 with Visual C++ Redistributable Package for Visual Studio 2013 i have an issue :

http://t7.pixhost.org/thumbs/67/31540561_2016-02-20_133359k.jpg (http://www.pixhost.org/show/67/31540561_2016-02-20_133359k.jpg)
http://t7.pixhost.org/thumbs/67/31540546_2016-02-20_133359.jpg (http://www.pixhost.org/show/67/31540546_2016-02-20_133359.jpg)

win 8.1 64bit AMD R9 380 last Crimson driver

why?

thanks a lot,

Khanattila
20th February 2016, 13:49
Help me!
KNLMeansCL v0.7.4 with Visual C++ Redistributable Package for Visual Studio 2013 works very well
KNLMeansCL v0.7.5 with Visual C++ Redistributable Package for Visual Studio 2013 i have an issue :

http://t7.pixhost.org/thumbs/67/31540561_2016-02-20_133359k.jpg (http://www.pixhost.org/show/67/31540561_2016-02-20_133359k.jpg)
http://t7.pixhost.org/thumbs/67/31540546_2016-02-20_133359.jpg (http://www.pixhost.org/show/67/31540546_2016-02-20_133359.jpg)

win 8.1 64bit AMD R9 380 last Crimson driver

why?

thanks a lot,
Because I'm stupid.

Visual C++ Redistributable for Visual Studio 2015 (https://www.microsoft.com/en-us/download/details.aspx?id=48145)

Dreamland
20th February 2016, 14:10
you are not stupid..you are number one!

now perfect..works 100%

thx a lot

feisty2
21st February 2016, 07:42
you are not stupid..you are number one!


Don't be Siri-ous Haha!

RazorBurn
11th March 2016, 08:43
is it OK to do this to force to process the chroma?

clip = mvsfunc.ToRGB(input = clip)
clip = core.knlm.KNLMeansCL(clip = clip, d = 1, a = 2, h = 2)
clip = mvsfunc.ToYUV(input = clip, css="420", depth = 8)
clip.set_output()

Are_
11th March 2016, 11:21
clip = core.knlm.KNLMeansCL(clip=clip, d=1, a=2, h=2, cmode=True)
clip.set_output()


But I'm not sure if you need to be in 444 to do this.

RazorBurn
11th March 2016, 16:35
clip = core.knlm.KNLMeansCL(clip=clip, d=1, a=2, h=2, cmode=True)
clip.set_output()


But I'm not sure if you need to be in 444 to do this.

The source is YV12, the doc says when source is converted to RGB, all planes will be process.. So i converted it to RGB, process, then back to YV12..

Khanattila
11th March 2016, 17:21
The source is YV12, the doc says when source is converted to RGB, all planes will be process.. So i converted it to RGB, process, then back to YV12..

Three alternatives:
1) Invoke three times the program. Each plane will be processed independently.
2) Convert to YV24.
3) Convert to RGB.

- Mode 1 is slowest.
- Mode 2 and Mode 3 look for the difference between two colors rather than between two gray levels.

Atak_Snajpera
13th March 2016, 16:13
I think you forgot to change version number ;) Latest version still reports 0.7.4
http://i.cubeupload.com/gbLjt3.png

Khanattila
14th March 2016, 16:53
I think you forgot to change version number ;) Latest version still reports 0.7.4
http://i.cubeupload.com/gbLjt3.png

Damn!

Magik Mark
16th March 2016, 01:02
Can somebody confirm if the opencl.dll found in the latest driver of Nvidia (364.51) still causes crashes in GTX 900 series GPUs?

Magik Mark
21st March 2016, 02:46
Khanatilla,

Is the new opencl 2.1 compatible with knlmeans? Will it change how it works ?

Khanattila
22nd March 2016, 01:31
Khanatilla,

Is the new opencl 2.1 compatible with knlmeans? Will it change how it works ?
OpenCL offers backward compatibility. For final user change nothing. ;)

martin53
24th March 2016, 15:02
Specifically image 026_73_k.png of these example images (http://forum.doom9.org/showthread.php?p=1761855#post1761855) indicates that kNLMeansCL might have an accuracy issue next to the image borders.
With substantial noise in test images, I frequently observed this behavior at various borders (024_51_k.png shows it at left, bottom and right, 008_99_k.png at top and right).

Khanattila
25th March 2016, 17:26
Specifically image 026_73_k.png of these example images (http://forum.doom9.org/showthread.php?p=1761855#post1761855) indicates that kNLMeansCL might have an accuracy issue next to the image borders.
With substantial noise in test images, I frequently observed this behavior at various borders (024_51_k.png shows it at left, bottom and right, 008_99_k.png at top and right).

Thanks for reporting this, but it is absolutely normal.

Magik Mark
10th April 2016, 04:26
Khanattila,

I posted this in madvr forum. Maybe you can assist:


While watching video in conjunction of video trancoding in the background using knlmeans filter, I get FSE (full screen exclusive mode) failure right after it finishes encoding

KNLmean uses Opencl and so do some feature of madvr, i think. Or maybe some rendering options found in madvr may be in conflict


Thanks

Khanattila
11th April 2016, 18:21
https://github.com/Khanattila/KNLMeansCL/releases/tag/v0.7.6

KNLMeansCL v0.7.6
* Fixed wrong version displaying.
* VapourSynth: fixed wrong API usage.

Khanattila
11th April 2016, 18:21
Khanattila,

I posted this in madvr forum. Maybe you can assist:


While watching video in conjunction of video trancoding in the background using knlmeans filter, I get FSE (full screen exclusive mode) failure right after it finishes encoding

KNLmean uses Opencl and so do some feature of madvr, i think. Or maybe some rendering options found in madvr may be in conflict


Thanks

Thanks for reporting this, but first I have to be able to replicate the problem.
AMD, Nvidia or Intel?

Magik Mark
11th April 2016, 20:39
Nvidia gtx 960


Sent from my iPhone using Tapatalk

asarian
12th April 2016, 10:07
I'm really starting to like KNLMeansCL. ;) On a 5min vid test, with a GTX 980, I got the following result:

with: 4.95 fps
without: 4.11 fps

Not a super huge difference, but still. :)

asarian
12th April 2016, 10:09
Khanattila,

I posted this in madvr forum. Maybe you can assist:


While watching video in conjunction of video trancoding in the background using knlmeans filter, I get FSE (full screen exclusive mode) failure right after it finishes encoding

KNLmean uses Opencl and so do some feature of madvr, i think. Or maybe some rendering options found in madvr may be in conflict

Thanks


I was actually just thinking along the same line: that gaming is probably out of the question while using KNLMeansCL. :)

Groucho2004
12th April 2016, 10:57
I'm really starting to like KNLMeansCL. ;) On a 5min vid test, with a GTX 980, I got the following result:

with: 4.95 fps
without: 4.11 fps

Not a super huge difference, but still. :)
More speed with a noise filter than without? You must have some weird-ass computer. :D

Nobody knows what you measured there and it clearly makes no sense, at least not with the given context (which is zero).

asarian
12th April 2016, 11:05
More speed with a noise filter than without? You must have some weird-ass computer. :D

Nobody knows what you measured there and it clearly makes no sense, at least not with the given context (which is zero).

Obviously (but apparently not so obvious), 'with' and 'without' referred to either using KNLMeansCL or not, like in:

vid = haf.QTGMC (vid, InputType=0, Preset="Very Slow", TR2=3, TFF=True, Denoiser="KNLMeansCL")

Or removing the Denoiser parameter.

Groucho2004
12th April 2016, 11:11
Obviously (but apparently not so obvious), 'with' and 'without' referred to either using KNLMeansCL or not, like in:

vid = haf.QTGMC (vid, InputType=0, Preset="Very Slow", TR2=3, TFF=True, Denoiser="KNLMeansCL")

Or removing the Denoiser parameter.
Sorry, didn't use my crystal ball so I didn't know that you were talking about QTGMC() in the KNLMeansCL thread. :rolleyes:

shinjico
12th April 2016, 14:33
https://github.com/Khanattila/KNLMeansCL/releases/tag/v0.7.6

KNLMeansCL v0.7.6
* Fixed wrong version displaying.
* VapourSynth: fixed wrong API usage.


I can't make DGNV and KNLmeans work together in avs script.
x264 codec or virtualdub will freeze when I import a script like

DGSource("test.dgi")
KNLMeansCL()

but other sourcefilters will be ok, like

ffms2("test.mkv")
KNLMeansCL()

may be there is some violation bettween DGNV and KNLMeansCL ?

My platform 1 : GTX960 Nv_driver 364.51 win10_1151 avs 2.6.0 DGDecodeNV 2051
My platform 2 : GTX970 Nv_driver 364.72 win10_1151 avs 2.6.0 DGDecodeNV 2051

both of them have the same problem

asarian
12th April 2016, 15:23
Results are even better than I thought. :) (QTGMC was still using FFT3DFilter). Now I did this:

vid = haf.QTGMC (vid, InputType=0, Preset="Very Slow", TR2=3, TFF=True, Denoiser="KNLMeansCL")
vid = core.knlm.KNLMeansCL (vid, d=5, a=5, s=4, h=1.2)

Cut my entire coding time in half even! (As opposed to things I did with FFT3DFilter) :thanks:

PSU load is now wicked too, btw, having both my CPU and GPU burning in tandem!

Seriously, OP, this is a fantastic filter! Wish I had discovered it earlier.

Groucho2004
12th April 2016, 15:43
vid = haf.QTGMC (vid, InputType=0, Preset="Very Slow", TR2=3, TFF=True, Denoiser="KNLMeansCL")
vid = core.knlm.KNLMeansCL (vid, d=5, a=5, s=4, h=1.2)
I must be missing something here. What's the point in using KNLMeansCL() in QTGMC() and denoising again after that?

Khanattila
12th April 2016, 17:38
I can't make DGNV and KNLmeans work together in avs script.
x264 codec or virtualdub will freeze when I import a script like

DGSource("test.dgi")
KNLMeansCL()

but other sourcefilters will be ok, like

ffms2("test.mkv")
KNLMeansCL()

may be there is some violation bettween DGNV and KNLMeansCL ?

My platform 1 : GTX960 Nv_driver 364.51 win10_1151 avs 2.6.0 DGDecodeNV 2051
My platform 2 : GTX970 Nv_driver 364.72 win10_1151 avs 2.6.0 DGDecodeNV 2051

both of them have the same problem

I fear that none of us has done strange things. But it's a problem of NVIDIA.

asarian
12th April 2016, 23:30
I must be missing something here. What's the point in using KNLMeansCL() in QTGMC() and denoising again after that?

The point would be that you can run KNLMeansCL with your own parameters this time.

asarian
13th April 2016, 02:28
So, how do I get SMDegrain to use KNLMeansCL in AviSynth then? Looking thru the code (VapourSynth), it seems 'prefilter=4' might do it there. But 'KNLMeansCL' name doesn't even appear in SMDegrain v.2.2d.avsi script.

Groucho2004
13th April 2016, 08:21
So, how do I get SMDegrain to use KNLMeansCL in AviSynth then? Looking thru the code (VapourSynth), it seems 'prefilter=4' might do it there. But 'KNLMeansCL' name doesn't even appear in SMDegrain v.2.2d.avsi script.
SMDegrain (http://avisynth.nl/index.php/SMDegrain) 2.2d is 3 years old. KNLMeansCL was added a year ago (3.1d). You might think about updating.

Edit: Just realized that you're talking about HAvsfunc. I don't know what version of SMDegrain is used there.
Edit1: It's also the latest (3.1.2d)

tormento
13th April 2016, 08:50
I can't make DGNV and KNLmeans work together in avs script.

Are you on Win10 x64?

The only way to make it work is to use a completely x64 environment, i.e. AviSynth+_x64+DGNV_x64+etc

Tested lot of times and mixed x86+x64 environment doesn't work (yet)

On win8_x64 everything is ok.

asarian
13th April 2016, 14:41
SMDegrain (http://avisynth.nl/index.php/SMDegrain) 2.2d is 3 years old. KNLMeansCL was added a year ago (3.1d). You might think about updating.

Edit: Just realized that you're talking about HAvsfunc. I don't know what version of SMDegrain is used there.
Edit1: It's also the latest (3.1.2d)

Yeah, maybe I just need to leave SMDegrain behind altogether.

asarian
13th April 2016, 15:24
https://github.com/Khanattila/KNLMeansCL/releases/tag/v0.7.5

Isn't it at 0.7.6 now?!

Khanattila
13th April 2016, 15:40
Isn't it at 0.7.6 now?!

Yes, I had not updated the first post.

HOB
15th April 2016, 15:29
Shinjico
I had a similar problem using DGindexNV in MeGUI, I used DGindexNV and KNLmeans together often with excellent results then after DGindexNV updated to 2050 it would just FAIL to even begin the encode, when DGindexNV updated to 2051 it too failed my solution was to revert back to DGindexNV 2049 which worked well for me in the past and was very stable. In MeGUI you can select not to update a plugin which is what I've done with DGindexNV…I don't allow it to update. I don't know if reverting back to 2049 is acceptable to you but it worked for me…give it a try.

Artofeel
29th April 2016, 10:24
I'm a little confused
I have GF 550M, so I guess it's not supported on versions later 0.6.11
But when I run it on v0.7.6, I get error not about compatibility
Python exception: knlm.KNLMeansCL: fatal error!
(clBuildProgram: please report Log-KNLMeansCL.txt.)
Log-KNLMeansCL.txt (http://paste2.org/PIOVKvGI)
on v0.6.11 it's works fine
Win7 64bit

AIDA64 show this (http://paste2.org/jPaU4exV)
OpenCL Compliancy:
OpenCL 1.1 Yes (100%)
OpenCL 1.2 Yes (100%)
OpenCL 2.0 No (62%)

so... %)

Magik Mark
29th April 2016, 10:57
I'm getting this error:

"Display driver stopped responding and has recovered Display driver NVIDIA Windows Kernal Mode Driver, Version 364.96 stopped responding and has successfully recovered"

This happens when I'm running madvr and at the same time running this filter during encoding via staxrip

Is there something we could do about this?

Khanattila
29th April 2016, 11:46
I'm a little confused
I have GF 550M, so I guess it's not supported on versions later 0.6.11
But when I run it on v0.7.6, I get error not about compatibility
Python exception: knlm.KNLMeansCL: fatal error!
(clBuildProgram: please report Log-KNLMeansCL.txt.)
Log-KNLMeansCL.txt (http://paste2.org/PIOVKvGI)
on v0.6.11 it's works fine
Win7 64bit

AIDA64 show this (http://paste2.org/jPaU4exV)
OpenCL Compliancy:
OpenCL 1.1 Yes (100%)
OpenCL 1.2 Yes (100%)
OpenCL 2.0 No (62%)

so... %)

NVDIA has never released an OpenCL 1.2 drivers for the 500 Series. Platform Version must be wrong.
Or it provided only some features and not everything you need.

Khanattila
29th April 2016, 11:49
I'm getting this error:

"Display driver stopped responding and has recovered Display driver NVIDIA Windows Kernal Mode Driver, Version 364.96 stopped responding and has successfully recovered"

This happens when I'm running madvr and at the same time running this filter during encoding via staxrip

Is there something we could do about this?


You have this error in exclusive mode?

Magik Mark
29th April 2016, 12:43
No. In window mode using mpc be. Video hasn't played at all. Video player shuts down on its own. I have to restart 2 or 3 times before it starts playing again


Sent from my iPhone using Tapatalk

asarian
29th April 2016, 19:31
Is DGSource (from the DG NV Tools) incompatible with KNLMeansCL or something?! DGSource suddenly gives me an error about not being able to create a video instance of sorts.

This is a real pain, and DGSource is the really frame-safe processor I know (which actually *is* frame safe, and not just claims so).

Sparktank
30th April 2016, 02:40
Is DGSource (from the DG NV Tools) incompatible with KNLMeansCL or something?! DGSource suddenly gives me an error about not being able to create a video instance of sorts.

It should be compatible.

Win7 (x64), GeForce GTX 750t TI, 364.72.
Using the latest slipstream of DGdecNV 2051:
DGDecodeNV 2051 [Mar 17, 2016]
I haven't received any email notifications of a new slipstream or update from a subscribed thread.

Still using AVS_260_MT, however.

avsinfo:
Avisynth version string: AviSynth 2.60, build:Feb 20 2015 [03:16:45]
File version: 2.6.0.5
Avisynth Interface Version: 6
Muli-threading support: Yes
Linker/compiler version: 12.0
Avisynth DLL location: C:\Windows\SysWOW64\avisynth.dll
Avisynth DLL time stamp: 2015-02-19, 17:18:42
PluginDir2_5 (HKCU, x86): D:\AVS_Ver\AVS260_MT\plugins
PluginDir2_5 (HKLM, x86): D:\AVS_Ver\AVS260_MT\plugins

test on a bluray remux:
SetMemoryMax(512)
DGSource("E:\Temp\remux\ThePrestige\Prestige.dgi")
Crop(0, 130, -0, -132)
# v0.7.6 ## autoloaded from PluginDir
KNLMeansCL(info=true)
https://i.imgur.com/PSV4dbil.png (https://imgur.com/PSV4dbil)

Magik Mark
30th April 2016, 05:01
Is it possible to use CPU processing instead the GPU utilizing all of my 14 Cores - 28 Threads? Tried installing intel OpenCL driver. It could only go as high as 2-3 fps. I wish it could go as high as 25fps

Bloax
30th April 2016, 05:11
For that you'd probably want to use http://forum.doom9.org/showthread.php?p=1746705#post1746705 the existing non-GPU implementations of NLMeans.

Khanattila
30th April 2016, 09:07
Is it possible to use CPU processing instead the GPU utilizing all of my 14 Cores - 28 Threads? Tried installing intel OpenCL driver. It could only go as high as 2-3 fps. I wish it could go as high as 25fps

Non-local means de-noising algorithm is slow. If you want an example: http://forum.doom9.org/showpost.php?p=1739321&postcount=467

asarian
30th April 2016, 16:57
From my experience, DGSource is incompatible with KNLMeansCL only on Win10 when using the 32-bit plugins. The program (like AvsPmod, vspipe or whatever) just hangs and doesn't output anything at all. But it still works fine when using the 64-bit plugins. The issue seems to not exist on Win8 and all previous Windows version.

Thanks for your reply. Yes, I'm on Windows 10, and sadly my AviSynth is still 32-bit (need it for MCTemporalDenoise). With KNLMeansCL, though, I may just have to go to 64-bit AS, and just forget about MCTemporalDenoise altogether, as KNLMeansCL makes things go so much faster!

asarian
30th April 2016, 17:09
Is it possible to use CPU processing instead the GPU utilizing all of my 14 Cores - 28 Threads? Tried installing intel OpenCL driver. It could only go as high as 2-3 fps. I wish it could go as high as 25fps

I suppose you could set

device_type="CPU"

But what would be the point of using KNLMeansCL then?! Haven't tested it (running a major job right now), but I bet simply using something based on dfttest will be equally fast, if not faster, without the use of a GPU.

feisty2
30th April 2016, 18:06
I suppose you could set

device_type="CPU"

But what would be the point of using KNLMeansCL then?! Haven't tested it (running a major job right now), but I bet simply using something based on dfttest will be equally fast, if not faster, without the use of a GPU.

Except simple frequency denoiser without any additional block matching is not even on the same quality level of NLMeans..
Do remember that NLMeans is one of the highest quality denoisers, it's just not something that DFTTest could replace.

mastrboy
30th April 2016, 20:21
What would the KNLMeansCL equivalent of NLMeansCL(A=9,H=0.9) be?
I tried to compare the manuals, but the information regarding what all the parameters for NLMeansCL (http://forum.doom9.org/showthread.php?t=158925) do, is not that well documented. For example, parameter S and B are only described by what their default value is.

asarian
30th April 2016, 22:51
Except simple frequency denoiser without any additional block matching is not even on the same quality level of NLMeans...

Which is why I said based on dfttest (like inside MCTemporalDenoise or something).

MCTD, running entirely on CPU, is actually quite slow (can't seem to benefit much from multi-threading), so KNLMeansCL, running on CPU only, could probably give it a run for its money too, but part of its charm, for me, is the offloading to GPU, of course.

Do remember that NLMeans is one of the highest quality denoisers, it's just not something that DFTTest could replace.

Only found out about it recently, but KNLMeansCL really is unusually crisp, I must admit. I'm trying to make it my main denoiser now, for everything.

Magik Mark
2nd May 2016, 00:00
Guys,

Can you share your parameters for light, moderate & strong settings?

Thanks

Magik Mark
2nd May 2016, 09:29
I'm getting this error:

"Display driver stopped responding and has recovered Display driver NVIDIA Windows Kernal Mode Driver, Version 364.96 stopped responding and has successfully recovered"

This happens when I'm running madvr and at the same time running this filter during encoding via staxrip

Is there something we could do about this?

This error is also happening in Hybrid. You don't get an error message. Hybrids will just stop the encoding. You have to do it allover again. In staxrip, it is able to recover

Khanattila
2nd May 2016, 11:42
What would the KNLMeansCL equivalent of NLMeansCL(A=9,H=0.9) be?
I tried to compare the manuals, but the information regarding what all the parameters for NLMeansCL (http://forum.doom9.org/showthread.php?t=158925) do, is not that well documented. For example, parameter S and B are only described by what their default value is.
Test KNLMeansCL(a=9, h=0.9).

KNLMeansCL don't have B, and on default s=4.

Az ==> d
Ax and Ay ==> a
Sx and Sy ==> s
Bx and By ==> removed (equivalent to Bx=By=0)

tormento
2nd May 2016, 13:16
I was playing with x64 again and got same error I had previously.

AVS:
SetMemoryMax(8000)
SetFilterMTMode("DEFAULT_MT_MODE", 2)
SetFilterMTMode("DGSource", 3)
LoadPlugin("D:\eseguibili\media\DGDecNV\x64\DGDecodeNV.dll")
LoadPlugin("D:\Programmi\media\AviSynth+\plugins64\KNLMeansCL-0.7.6.dll")
DGSource("E:\in\1_42 John Wick\johnnv.dgi")
CompTest(1)
ChangeFPS(last,last,true)
KNLMeansCL(device_type="GPU")

Command line:
avs4x26x-x64.exe --x264-binary "x264_64.exe" --level 4.1 --crf 20 --keyint 240 --vbv-bufsize 78125 --vbv-maxrate 62500 --aq-mode 2 --sar 1:1 "E:\in\1_42 John Wick\johnnv.mkv" "E:\in\1_42 John Wick\johnnv.avs"

Error:
avs [error]: Cannot load file 'D:/Programmi/media/AviSynth+/plugins64/KNLMeansCL-0.7.6.dll'. Platform returned code 126:
Impossibile trovare il modulo specificato.

(E:\in\1_42 John Wick\johnnv.avs, line 5)

Any idea? It works removing KNL line.

Zetti
2nd May 2016, 14:03
I was playing with x64 again and got same error I had previously.

AVS:
SetMemoryMax(8000)
SetFilterMTMode("DEFAULT_MT_MODE", 2)
SetFilterMTMode("DGSource", 3)
LoadPlugin("D:\eseguibili\media\DGDecNV\x64\DGDecodeNV.dll")
LoadPlugin("D:\Programmi\media\AviSynth+\plugins64\KNLMeansCL-0.7.6.dll")
DGSource("E:\in\1_42 John Wick\johnnv.dgi")
CompTest(1)
ChangeFPS(last,last,true)
KNLMeansCL(device_type="GPU")

Command line:
avs4x26x-x64.exe --x264-binary "x264_64.exe" --level 4.1 --crf 20 --keyint 240 --vbv-bufsize 78125 --vbv-maxrate 62500 --aq-mode 2 --sar 1:1 "E:\in\1_42 John Wick\johnnv.mkv" "E:\in\1_42 John Wick\johnnv.avs"

Error:
avs [error]: Cannot load file 'D:/Programmi/media/AviSynth+/plugins64/KNLMeansCL-0.7.6.dll'. Platform returned code 126:
Impossibile trovare il modulo specificato.

(E:\in\1_42 John Wick\johnnv.avs, line 5)

Any idea? It works removing KNL line.

I think you need to add device_id

int device_id 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.

Default: 0.

asarian
2nd May 2016, 15:03
Why, my Italian sucks, but I think 'Impossibile trovare il modulo specificato' just means 'Cannot find the specified dll.' Adding device_id, at least, is not necessary at all. Check the path of said dll!

tormento
2nd May 2016, 16:29
Why, my Italian sucks, but I think 'Impossibile trovare il modulo specificato' just means 'Cannot find the specified dll.' Adding device_id, at least, is not necessary at all. Check the path of said dll!
Path checked.

Similar command line / configuration win32 it works (obviously with DGDecIM).

tormento
2nd May 2016, 16:29
Did you check the requirements in the first post of this thread? This error usually comes up when a MS redist package is missing.
Yep. As I said on win32 it works (with necessary modifications)

tormento
2nd May 2016, 16:30
I think you need to add device_id
Same behaviour

asarian
2nd May 2016, 16:35
Path checked.

Are you entirely sure?! My dll is just called KNLMeansCL.dll, as opposed to your:

D:\Programmi\media\AviSynth+\plugins64\KNLMeansCL-0.7.6.dll")

asarian
2nd May 2016, 16:47
I also don't understand why he's using Loadplugin at all.

Yeah, that's another thing. :) If it's in the plugins64 folder, it should get autoloaded.

But the name worries me the most. Both 32- and 64-bit dll's, extracted from the official KNLMeansCL-0.7.6 package, are just called KNLMeansCL.dll; can't see any good reason why anyone would rename them (as newer version are *supposed* to overwrite the old, and shouldn't be kept in the same plugins64 dir, unless you went for willful breakage).

tormento
2nd May 2016, 17:08
Can't see that mentioned in your post.
Months ago XD

tormento
2nd May 2016, 17:09
Are you entirely sure?! My dll is just called KNLMeansCL.dll, as opposed to your:

D:\Programmi\media\AviSynth+\plugins64\KNLMeansCL-0.7.6.dll")

Yes I checked more than twice

tormento
2nd May 2016, 17:10
Yeah, that's another thing. :) If it's in the plugins64 folder, it should get autoloaded.

But the name worries me the most. Both 32- and 64-bit dll's, extracted from the official KNLMeansCL-0.7.6 package, are just called KNLMeansCL.dll; can't see any good reason why anyone would rename them (as newer version are *supposed* to overwrite the old, and shouldn't be kept in the same plugins64 dir, unless you went for willful breakage).

I knows it's autoloaded. I forced to try to get rid of error.

I rename dll as I can check and remember every version of plugins I own. Not everyone has version inside dll.

Sparktank
2nd May 2016, 19:11
I knows it's autoloaded. I forced to try to get rid of error.

I rename dll as I can check and remember every version of plugins I own. Not everyone has version inside dll.

Have you opened the .dgi file in a notepad and verified the filepaths are correct?
If you moved any of the asset files at all, the paths need to be updated in the .dgi index then in the .avs script.

mastrboy
2nd May 2016, 20:38
Test KNLMeansCL(a=9, h=0.9).

KNLMeansCL don't have B, and on default s=4.

Az ==> d
Ax and Ay ==> a
Sx and Sy ==> s
Bx and By ==> removed (equivalent to Bx=By=0)

I tried that, and the fps went from ~80 with NLmeanscl to ~25 fps with KNLmeansCL (3,2x decrease in speed), also the histogram(luma) show quite a difference in output between the two.
That's why I posted since I assumed A for NLmeansCL is not the same as A for KNLmeansCL.

The performance and output difference where big enough to need further information about the difference between the two.

Khanattila
2nd May 2016, 22:16
I tried that, and the fps went from ~80 with NLmeanscl to ~25 fps with KNLmeansCL (3,2x decrease in speed), also the histogram(luma) show quite a difference in output between the two.
That's why I posted since I assumed A for NLmeansCL is not the same as A for KNLmeansCL.

The performance and output difference where big enough to need further information about the difference between the two.

Bx and By (NLMeansCL) are trade-off performance/quality. KNLMeansCL don't have it.
That's why the results are different.

At equal quality, KNLMeansCL is faster than NLMeansCL.
However, each argument is documented. Read the doc (https://github.com/Khanattila/KNLMeansCL/blob/master/DOC.md).

Magik Mark
2nd May 2016, 22:53
Khanattila,

I'm having problem converting these to NLmeans. Can you help? Thanks


KNLMeansCL(D = 1, A = 1, h = 2)
KNLMeansCL(D = 1, A = 1, h = 4)
KNLMeansCL(D = 1, A = 1, h = 8)

tormento
3rd May 2016, 16:59
Run "avsmeter64 -avsinfo -log" and post the log file.

Avisynth version string: AviSynth+ 0.1 (r1849, MT-pfmod, x86_64)
File version: 0.1.0.0
Avisynth Interface Version: 6
Muli-threading support: Yes
Linker/compiler version: 14.0
Avisynth DLL location: C:\Windows\System32\AviSynth.dll
Avisynth DLL time stamp: 2016-04-22, 14:40:06
PluginDir+ (HKLM, x64): D:\Programmi\media\AviSynth+\plugins64+
PluginDir2_5 (HKLM, x64): D:\Programmi\media\AviSynth+\plugins64

Avisynth CPP 2.6 plugins:
D:\Programmi\media\AviSynth+\plugins64+\DirectShowSource.dll (n/a)
D:\Programmi\media\AviSynth+\plugins64+\ImageSeq.dll (n/a)
D:\Programmi\media\AviSynth+\plugins64+\Shibatch.dll (n/a)
D:\Programmi\media\AviSynth+\plugins64+\TimeStretch.dll (n/a)
D:\Programmi\media\AviSynth+\plugins64+\VDubFilter.dll (n/a)
D:\Programmi\media\AviSynth+\plugins64\AutoAdjust-2.00.dll (2.0.0.0)
D:\Programmi\media\AviSynth+\plugins64\KNLMeansCL-0.7.6.dll (n/a)
D:\Programmi\media\AviSynth+\plugins64\MVTools-2.7.0.22—pfmod.dll (2.7.0.22)
D:\Programmi\media\AviSynth+\plugins64\NNEDI3-0.9.4.20_AVX2.dll (0.9.4.20)
D:\Programmi\media\AviSynth+\plugins64\NNEDI3-0.9.4.20_AVX512.dll (0.9.4.20)
D:\Programmi\media\AviSynth+\plugins64\NNEDI3-0.9.4.20_SSE42.dll (0.9.4.20)
D:\Programmi\media\AviSynth+\plugins64\RgTools-0.92.1.dll (n/a)
D:\Programmi\media\AviSynth+\plugins64\SmoothAdjust-3.00.dll (3.0.0.0)

Avisynth CPP 2.5 plugins:
D:\Programmi\media\AviSynth+\plugins64\AddGrainC-1.7.1—cretindesalpes.dll (1.7.1.0)
D:\Programmi\media\AviSynth+\plugins64\AvsTP-1.0.3.dll (1.0.3.0)
D:\Programmi\media\AviSynth+\plugins64\DFTTest-1.9.4.dll (1.9.4.0)
D:\Programmi\media\AviSynth+\plugins64\Dither-1.27.2.dll (n/a)
D:\Programmi\media\AviSynth+\plugins64\FFT3DFilter-2.1.1_ICL11—Groucho2004.dll (2.1.1.0)
D:\Programmi\media\AviSynth+\plugins64\MaskTools-2.0a48.dll (2.0.48.0)
D:\Programmi\media\AviSynth+\plugins64\RemoveGrainHD-0.5.dll (0.5.0.0)

To clarify to everybody: a simple script, with no KNLMeans, works perfectly.

For example:

SetMemoryMax(8000)
SetFilterMTMode("DEFAULT_MT_MODE", 2)
SetFilterMTMode("DGSource", 3)
LoadPlugin("D:\eseguibili\media\DGDecNV\x64\DGDecodeNV.dll")
LoadPlugin("D:\Programmi\media\AviSynth+\plugins64\KNLMeansCL-0.7.6.dll")
DGSource("E:\in\1_42 John Wick\johnnv.dgi")
CompTest(1)
ChangeFPS(last,last,true)
SMDegrain (tr=4,PreFilter=2,thSAD=400,contrasharp=false,refinemotion=false,plane=4,chroma=true,lsb=true,mode=6)
Prefetch(8)

[E:\in\1_42 John Wick]"D:\eseguibili\media\MeGUI\tools\x264\avs4x26x-x64.exe" --x264-binary "D:\eseguibili\media\MeGUI\tools\x264\x264_64.exe"
--level 4.1 --crf 20 --keyint 240 --vbv-bufsize 78125 --vbv-maxrate 62500 --aq-mode 3 --sar 1:1 --output "E:\in\1_42 John Wick\johnnv.mkv"
"E:\in\1_42 John Wick\johnnv.avs"
avs [info]: AviSynth+ 0.1 (r1849, MT-pfmod, x86_64)
avs [info]: Video colorspace: YV12
avs [info]: Video resolution: 1920x800
avs [info]: Video framerate: 239999/10000
avs [info]: Video framecount: 1470
avs4x26x [info]: "D:\eseguibili\media\MeGUI\tools\x264\x264_64.exe" - --level 4.1 --crf 20 --keyint 240 --vbv-bufsize 78125 --vbv-maxrate 62500
--aq-mode 3 --sar 1:1 --output "E:\in\1_42 John Wick\johnnv.mkv" --frames 1470 --fps 239999/10000 --input-res 1920x800 --input-csp i420
raw [info]: 1920x800p 1:1 @ 239999/10000 fps (cfr)
x264 [info]: using SAR=1/1
x264 [info]: using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX
x264 [info]: profile High, level 4.1
x264 [info]: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 fade_compensate=0.00 psy_rd=1.00:0.00 mixed_ref=1
me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=12 lookahead_threads=2
sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 fgo=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0
direct=1 weightb=1 open_gop=0 weightp=2 keyint=240 keyint_min=23 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=20.0000
qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 vbv_maxrate=62500 vbv_bufsize=78125 crf_max=0.0 nal_hrd=none filler=0 ip_ratio=1.40 aq=3:1.00
frames fps kb/s elapsed remain size est.size
[100.0%] 1470/1470 11.42 3113.58 0:02:08 0:00:00 22.73 MB 22.73 MB
x264 [info]: frame I:111 Avg QP:14.29 size: 76019
x264 [info]: frame P:455 Avg QP:18.11 size: 17635
x264 [info]: frame B:904 Avg QP:19.20 size: 8159
x264 [info]: consecutive B-frames: 16.4% 3.5% 3.9% 76.2%
x264 [info]: mb I I16..4: 22.3% 59.0% 18.7%
x264 [info]: mb P I16..4: 7.8% 12.1% 1.2% P16..4: 28.4% 7.3% 5.6% 0.0% 0.0% skip:37.7%
x264 [info]: mb B I16..4: 0.7% 1.5% 0.2% B16..8: 35.2% 2.9% 0.4% direct: 1.9% skip:57.1% L0:43.3% L1:53.1% BI: 3.6%
x264 [info]: 8x8 transform intra:58.4% inter:91.0%
x264 [info]: coded y,uvDC,uvAC intra: 45.6% 55.0% 28.6% inter: 10.8% 10.4% 0.5%
x264 [info]: i16 v,h,dc,p: 49% 20% 6% 26%
x264 [info]: i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 27% 17% 24% 4% 6% 6% 5% 5% 5%
x264 [info]: i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 39% 19% 15% 4% 7% 5% 5% 4% 3%
x264 [info]: i8c dc,h,v,p: 55% 18% 21% 7%
x264 [info]: Weighted P-Frames: Y:3.3% UV:3.1%
x264 [info]: ref P L0: 72.7% 7.6% 13.1% 6.1% 0.5%
x264 [info]: ref B L0: 89.9% 8.4% 1.7%
x264 [info]: ref B L1: 94.7% 5.3%
x264 [info]: kb/s:3113.47

encoded 1470 frames, 11.42 fps, 3113.58 kb/s, duration 0:02:08.69

Khanattila
3rd May 2016, 18:07
I was playing with x64 again and got same error I had previously.

AVS:
SetMemoryMax(8000)
SetFilterMTMode("DEFAULT_MT_MODE", 2)
SetFilterMTMode("DGSource", 3)
LoadPlugin("D:\eseguibili\media\DGDecNV\x64\DGDecodeNV.dll")
LoadPlugin("D:\Programmi\media\AviSynth+\plugins64\KNLMeansCL-0.7.6.dll")
DGSource("E:\in\1_42 John Wick\johnnv.dgi")
CompTest(1)
ChangeFPS(last,last,true)
KNLMeansCL(device_type="GPU")

Command line:
avs4x26x-x64.exe --x264-binary "x264_64.exe" --level 4.1 --crf 20 --keyint 240 --vbv-bufsize 78125 --vbv-maxrate 62500 --aq-mode 2 --sar 1:1 "E:\in\1_42 John Wick\johnnv.mkv" "E:\in\1_42 John Wick\johnnv.avs"

Error:
avs [error]: Cannot load file 'D:/Programmi/media/AviSynth+/plugins64/KNLMeansCL-0.7.6.dll'. Platform returned code 126:
Impossibile trovare il modulo specificato.

(E:\in\1_42 John Wick\johnnv.avs, line 5)

Any idea? It works removing KNL line.
Please check it with Dependency Walker.
Imho OpenCL.dll is broken.

Khanattila
3rd May 2016, 18:08
Khanattila,

I'm having problem converting these to NLmeans. Can you help? Thanks


KNLMeansCL(D = 1, A = 1, h = 2)
KNLMeansCL(D = 1, A = 1, h = 4)
KNLMeansCL(D = 1, A = 1, h = 8)

Really, I do not understand what is so difficult.

Sparktank
3rd May 2016, 21:48
:confused:

My mistake. Running on 4 hours of sleep lately.

tormento
4th May 2016, 12:49
Doesn't SMDegrain use KNLMeansCL as well? Also what's up with all these nnedi3 DLLs? You should only have one.
Yes... I leaved them as archive only. I will rename.

tormento
4th May 2016, 13:03
Please check it with Dependency Walker.
Imho OpenCL.dll is broken.
Tried and a enormous quantity of yellow question marks appeared.

How can I get a sense about that?

Do you think it is wise to replace opencl.dll found on Windows 10 system with yours? I have a Nvidia 760 card and that OpenCL.dll is the Nvidia version of Khronos 1.2.11.0

tormento
4th May 2016, 19:21
Save the Dep Walker analysis as .dwi and post it somewhere.

Here (https://www.solidfiles.com/v/Az6nzGVPdLNGr)it is. Thanks!

tormento
5th May 2016, 09:01
It's pretty clear that you did not install the VC2015 redistributable even though you claimed you did.
I reinstalled
18/03/2016 08:59 13.969.576 Visual C++ 2015 Redistributable Update 2.exe
18/03/2016 08:58 14.749.128 Visual C++ 2015 Redistributable Update 2_x64.exe

Result (https://www.solidfiles.com/v/3GKdDqe2dV455)

Notice any difference? Not to my eyes :)

Anyway reinstall worked. I think last time I installed x64 package only. Is possible that x64 KNL needs x86?

Groucho2004
5th May 2016, 09:36
Result (https://www.solidfiles.com/v/3GKdDqe2dV455)

Notice any difference? Not to my eyes :)
I'm not downloading from that site again. Pure popup hell.

Anyway reinstall worked. I think last time I installed x64 package only. Is possible that x64 KNL needs x86?
If the re-install worked then something was wrong with the redistributables, wouldn't you agree? I don't even know which version (x86/x64) of DepWalker you used.

I'm going to delete all my posts relating to this issue, I suggest you do the same.

asarian
9th May 2016, 13:04
I reinstalled
18/03/2016 08:59 13.969.576 Visual C++ 2015 Redistributable Update 2.exe
18/03/2016 08:58 14.749.128 Visual C++ 2015 Redistributable Update 2_x64.exe

Result (https://www.solidfiles.com/v/3GKdDqe2dV455)

Notice any difference? Not to my eyes :)?


The Redistributables (that sounds like a good title for a movie :P) also say you need to reboot your system after install. Maybe you hadn't?!

Groucho2004
9th May 2016, 13:24
The Redistributables (that sounds like a good title for a movie :P)
Agreed. :cool:


you need to reboot your system after install. Maybe you hadn't?!
That should not be necessary. However, I use the redist pack from ricktendo, much smaller and no Microsoft installer bullshit included. I never had to reboot, even when installing all versions from 2003 - 2015 in one go.

tormento
10th May 2016, 10:58
However, I use the redist pack from ricktendo, much smaller and no Microsoft installer bullshit included.
Where to download them?

Zetti
10th May 2016, 11:04
Where to download them?

http://my.repacks.space/VBCRedist_AIO_x86_x64.exe

MysteryX
10th May 2016, 11:07
To test whether the latest version of KNLMeans can be used on a computer, I run this script.


P="Encoder\"
LoadPlugin(P+"KNLMeansCL.dll")
colorbars(pixel_type = "yv12").killaudio().trim(1, 1)
Result = true
try {
KNLMeansCL()
} catch(error_msg) {
Result = false
}
WriteFileStart("Temp.txt", string(Result))


If it returns false, I'll use version 6.11 instead. If the graphic card doesn't support GPU processing and v6.11 also fails, then what's my best option? Will CPU processing still work with either version?

Groucho2004
10th May 2016, 11:16
http://my.repacks.space/VBCRedist_AIO_x86_x64.exe
Direct linking doesn't seem to work. Here (http://repacks.net/forum/viewtopic.php?f=6&t=125) is the page.

burfadel
10th May 2016, 11:57
There's also the one I do, it's packaged and installs a little differently. It also removes any existing runtimes of that particular version (2015 etc) before installing the new version. This is beneficial so you don't have multiple redundant versions, and possibly resolves issues with existing installations. V42 is currently the latest version: https://onedrive.live.com/redir?resid=C1FACEB7B51DAE61!376011&authkey=!ANXnlaivqizeKUM&ithint=file%2cexe

The latest version can always be found here:
https://onedrive.live.com/redir?resid=C1FACEB7B51DAE61%21376011

I should point out that Ricktendo64 and I aren't competing for usership, it's just about providing options and choice.

Khanattila
10th May 2016, 14:45
To test whether the latest version of KNLMeans can be used on a computer, I run this script.


P="Encoder\"
LoadPlugin(P+"KNLMeansCL.dll")
colorbars(pixel_type = "yv12").killaudio().trim(1, 1)
Result = true
try {
KNLMeansCL()
} catch(error_msg) {
Result = false
}
WriteFileStart("Temp.txt", string(Result))


If it returns false, I'll use version 6.11 instead. If the graphic card doesn't support GPU processing and v6.11 also fails, then what's my best option? Will CPU processing still work with either version?
Of course. CPU processing should work in any version.
Just install the OpenCL driver for CPU. Intel specific or AMD generic.

Magik Mark
10th May 2016, 14:52
May I ask the best settings for removing film grain?

Thanks


Sent from my iPhone using Tapatalk

tormento
12th May 2016, 16:01
Just upgraded Win10_x64 to build 14342.

Pay attention that OpenCL.dll goes to heaven, dunno why. After having reinstalled, deinstalled, installed VC2015 redistributables, I found that small problem.

Reinstalling Nvidia drivers made things work again.

Just a reminder to everybody on fast build channel ;)

Khanattila
12th May 2016, 18:46
May I ask the best settings for removing film grain?

Thanks


Sent from my iPhone using Tapatalk

No best settings ever.

The main parameters are three:
-'d' and 'a', which control the quality of de-noising;
-'h', which controls the strength of de-noising.

Default 'd' and 'a' are good compromise between performance and quality.
Set 'h' accordingly.

Magik Mark
30th May 2016, 00:44
For multiple GPUs, is there a way to direct knlmeans to use GPU 1 or GPU 2?

poisondeathray
30th May 2016, 00:50
For multiple GPUs, is there a way to direct knlmeans to use GPU 1 or GPU 2?

Read doc
https://github.com/Khanattila/KNLMeansCL/blob/master/DOC.md

device_id=0
device_id=1
.
.
.

Khanattila
2nd June 2016, 00:17
The procedure is also valid for multiple CPUs.

Bloax
2nd June 2016, 01:52
Hmm, would that mean that to fully utilize both GPUs you'd do
a = SelectEven()
b = SelectOdd()
Interleave(a.KNLMeansCL(blahblah,device_id=0),b.KNLMeansCL(blahblah,device_id=1))
? ;)

MysteryX
2nd June 2016, 04:10
Hmm, would that mean that to fully utilize both GPUs you'd do
a = SelectEven()
b = SelectOdd()
Interleave(a.KNLMeansCL(blahblah,device_id=0),b.KNLMeansCL(blahblah,device_id=1))
? ;)
In this case, temporal denoising might not give the expected result.

I just did a test. Using a single device, I get 24.03fps. With both devices, I get 23.68fps. It degrades performance. The bottleneck is memory transfers from the GPU, and it appears the memory bottleneck is shared between both devices.

asarian
2nd June 2016, 11:16
KNLMeansCL seems to hang my QTGMC process. I installed Intel OpenCL drivers for Core processors (this is a for a Vmware box; without them, KNLMeansCL just fails to load). QTGMC keeps burning my CPU at 99%, but never outputs anything any more to x264.

What am I missing here?!

asarian
2nd June 2016, 11:54
In this case, temporal denoising might not give the expected result.

I just did a test. Using a single device, I get 24.03fps. With both devices, I get 23.68fps. It degrades performance. The bottleneck is memory transfers from the GPU, and it appears the memory bottleneck is shared between both devices.

Might be interesting for x264, though (as in letting VS use your GTX 980, or whatever, and then let x264 use --OpenCL with the 'onboard' CPU Haswell OpenCL engine).

asarian
2nd June 2016, 12:17
KNLMeansCL seems to hang my QTGMC process. I installed Intel OpenCL drivers for Core processors (this is a for a Vmware box; without them, KNLMeansCL just fails to load). QTGMC keeps burning my CPU at 99%, but never outputs anything any more to x264.

What am I missing here?!

^^ Actually, it doesn't hang, it's just 10,000x slower than GPU:

[0.0%] 1/154656 frames, 0.00 fps, 34471.19 kb/s, eta 22792:09:06

That can't be right.

asarian
2nd June 2016, 13:13
^^ Please, someone?! No way my i7 980X is 10,000x slower than my GPU! Has anyone else tried KNLMeansCL on 'CPU' only? (via QTGMC)

Magik Mark
2nd June 2016, 13:40
Knlmeans is extremely slow when used through CPU. It is however a very good denoiser. If you regularly encode videos, you might as well invest in Pascal GPU


Sent from my iPhone using Tapatalk

Groucho2004
2nd June 2016, 13:48
^^ Please, someone?! No way my i7 980X is 10,000x slower than my GPU! Has anyone else tried KNLMeansCL on 'CPU' only? (via QTGMC)
I did some speed comparisons (http://forum.doom9.org/showthread.php?p=1739321#post1739321) a while ago.

asarian
2nd June 2016, 20:44
I did some speed comparisons (http://forum.doom9.org/showthread.php?p=1739321#post1739321) a while ago.

Yikes! Your tests show GPU is about 83 times faster! So, a job which would normally cost me ~24 hours, now will take 1,992 hours! (Aka, 83 days)

That means, for all purposes and intent, I won't be able to use KNLMeansCL any more on my VM. :( Sigh. And the whole idea was to offload the rendering a bit to my server.

Thanks for the reply, though.

asarian
2nd June 2016, 20:47
Knlmeans is extremely slow when used through CPU. It is however a very good denoiser. If you regularly encode videos, you might as well invest in Pascal GPU

This is for my server. Not going to put a GTX 1080 in it. :)

Groucho2004
2nd June 2016, 21:31
This is for my server. Not going to put a GTX 1080 in it. :)I'm pretty sure that nowadays you'll get about the same speed as the GTX750 with a cheap(ish) Nvidia or AMD card for ~70-100 bucks. Or, if you go cheaper, half that speed which is still 40 times faster than the CPU.

asarian
2nd June 2016, 21:37
I'm pretty sure that nowadays you'll get about the same speed with a cheap(ish) Nvidia or AMD card for ~70-100 bucks. Or, if you go cheaper, half that speed which is still 40 times faster than the CPU.


Then that is really what I may have to do. :) Thx. An 80 days rendering job is simply undoable; and I've really come to love KNLMeansCL.

I'll check for a card that can reasonably do it *and* can be made to be pass-thru to ESXi 6.

MysteryX
3rd June 2016, 02:47
I'm pretty sure that nowadays you'll get about the same speed as the GTX750 with a cheap(ish) Nvidia or AMD card for ~70-100 bucks. Or, if you go cheaper, half that speed which is still 40 times faster than the CPU.
I'm wondering something about GPU memory transfers. According to my tests, on my dual-graphics system, I'm getting the same performance, and perhaps even very slightly faster performance with Intel HD 4000 than with the Radeon 7670M.

Since the bottleneck is memory transfers back from the GPU, do you get better performance from a GTX750 than with a regular card? Do dedicated graphic cards have higher transfer bandwidth than in a dual-graphics laptop?

Groucho2004
3rd June 2016, 08:42
Since the bottleneck is memory transfers back from the GPU
Do you have data to back that up that statement? How did you test it?

asarian
3rd June 2016, 09:08
Do you have data to back that up that statement? How did you test it?


Why would 'memory transfers back from the GPU' play into this at all, I wonder?! Way I figure this, is that 99% (made-up internet number) of the whole operation consists of the GPU actually doing the OpenCL computations, and that the remaining 1% is used to send back some numbers as a result, no?

Even under 'regular' SLI conditions, with real memory transfers, during gaming and such, running at 8 lanes hardly makes any difference. So, unless I completely misunderstood the process, I have a hard time grasping how OpenCL computations, done on the GPU, could cause such wicked memory transfers as to slow things down with 2 GPU's. But I'd love to learn. :)

Groucho2004
3rd June 2016, 09:31
Way I figure this, is that 99% (made-up internet number) of the whole operation consists of the GPU actually doing the OpenCL computations, and that the remaining 1% is used to send back some numbers as a result, no?
That's what I'm thinking. I'm sure the author can enlighten us.

MysteryX
3rd June 2016, 11:54
Script:
colorbars(width = 640, height = 480, pixel_type = "yv12").killaudio().assumefps(25, 1).trim(0, 399)
KNLMeansCL(device_type = "CPU")


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


Here are my results on a dual-graphics Intel HD 4000 and Radeon 7670M

device_id=0

Frames processed: 400 (0 - 399)
FPS (min | max | average): 9.251 | 17.47 | 13.19
Memory usage (phys | virt): 58 | 97 MiB
Thread count: 12
CPU usage (average): 11%

GPU usage (average): 75%


device_id=1

Frames processed: 400 (0 - 399)
FPS (min | max | average): 8.078 | 14.27 | 11.13
Memory usage (phys | virt): 47 | 99 MiB
Thread count: 12
CPU usage (average): 5%

GPU usage (average): 0% (GPU-Z fails to detect)
GPU memory usage (Dedicated): 9 MiB
GPU memory usage (Dynamic): 6 MiB


It appears that a dedicated card is MUCH better than a dual-graphics system in terms of memory transfer bandwidth!!

It appears that it first transfers to the Intel and then forwards to the Radeon; and the bandwidth is limited to the Intel card's bandwidth.

Groucho2004
3rd June 2016, 12:06
It's still a Mystery(X) to me how you derive your memory bottleneck conclusion from these numbers. You're comparing apples and hamster droppings. The GTX750 is at least 20 times faster using OpenCL than the cards you tested. Tip: Google OpenCL benchmark comparisons.

asarian
3rd June 2016, 12:29
It appears that it first transfers to the Intel and then forwards to the Radeon; and the bandwidth is limited to the Intel card's bandwidth.

Or OpenCL calls simply aren't parallel enough to process responses from multiple GPU's at the same time.

Not exactly sure how KNLMeansCL implemented calls to multiple GPU's (or that you could even process the results asynchroneously in a meaningful fashion), but I suspect the results wind up more serialized than we'd hoped for. :)

I'd be curious to hear what the author has to say about this.

MysteryX
3rd June 2016, 15:35
I know for a fact that with AviSynthShader, the performance almost doubles when returning 8-bit data instead of 16-bit data after all the processing is done.

As for benchmarks
http://www.videocardbenchmark.net/gpu_list.php
Intel HD 4000: 451
Radeon 7670M: 817
GeoForce GTX 950: 3240

OK your card is about 4x stronger. Still, the Radeon 7670M is much stronger than the Intel HD 4000, but apparently I get no benefit here.

Groucho2004
3rd June 2016, 15:47
I know for a fact that with AviSynthShader, the performance almost doubles when returning 8-bit data instead of 16-bit data after all the processing is done.
I don't know how this is relevant. Do you use OpenCL in your plugin?

As for benchmarks
http://www.videocardbenchmark.net/gpu_list.php
Intel HD 4000: 451
Radeon 7670M: 817
GeoForce GTX 950: 3240

Again, completely irrelevant. That benchmark does not measure OpenCL performance. Try AIDA64 GPGPU, Luxmark, etc.

MysteryX
3rd June 2016, 17:34
I'd be curious to see other people's performance for the same script.

Khanattila
3rd June 2016, 21:09
Hmm, would that mean that to fully utilize both GPUs you'd do
a = SelectEven()
b = SelectOdd()
Interleave(a.KNLMeansCL(blahblah,device_id=0),b.KNLMeansCL(blahblah,device_id=1))
? ;)
:rolleyes:

Really I do not know.

Khanattila
3rd June 2016, 21:10
I know for a fact that with AviSynthShader, the performance almost doubles when returning 8-bit data instead of 16-bit data after all the processing is done.

As for benchmarks
http://www.videocardbenchmark.net/gpu_list.php
Intel HD 4000: 451
Radeon 7670M: 817
GeoForce GTX 950: 3240

OK your card is about 4x stronger. Still, the Radeon 7670M is much stronger than the Intel HD 4000, but apparently I get no benefit here.

Radeon 7670M... GDDR5 or DDR3?

Khanattila
3rd June 2016, 21:11
Yikes! Your tests show GPU is about 83 times faster! So, a job which would normally cost me ~24 hours, now will take 1,992 hours! (Aka, 83 days)

That means, for all purposes and intent, I won't be able to use KNLMeansCL any more on my VM. :( Sigh. And the whole idea was to offload the rendering a bit to my server.

Thanks for the reply, though.
Hey, Non-local means is really complex.

Khanattila
3rd June 2016, 23:11
Or OpenCL calls simply aren't parallel enough to process responses from multiple GPU's at the same time.

Not exactly sure how KNLMeansCL implemented calls to multiple GPU's (or that you could even process the results asynchroneously in a meaningful fashion), but I suspect the results wind up more serialized than we'd hoped for. :)

I'd be curious to hear what the author has to say about this.

I can do what you're saying, but it takes time. I wrote this plugin in my spare time. :)
The next step is to switch to v1.0.

Groucho2004
4th June 2016, 10:20
I'd be curious to see other people's performance for the same script.
How about a benchmark with this simple script:
colorbars(width = 1920, height = 1080, pixel_type = "yv12").killaudio().assumefps(25, 1)
KNLMeansCL(d = 2, a = 2)

I ran this with my GTX750 using this command line:
avsmeter testgpu.avs -timelimit=30 -gpu -log
Result:
[Runtime info]
Frames processed: 170 (0 - 169)
FPS (min | max | average): 5.243 | 5.655 | 5.606
Memory usage (phys | virt): 558 | 566 MiB
Thread count: 8
CPU usage (average): 25%
GPU usage (average): 98%
Video engine load (average): 0%
GPU memory usage: 122 MiB
Time (elapsed): 00:00:30.327

[Graphics card info]
Card name: NVIDIA GeForce GTX 750
GPU name: GM107
Memory size: 1024
OpenCL version: OpenCL 1.2 CUDA
Driver version: 6.14.13.5012 (ForceWare 350.12) / XP
Info collected with: GPU-Z 0.8.8

MysteryX
4th June 2016, 13:51
This time the performance difference isn't so extreme


[Runtime info]
Frames processed: 40 (0 - 39)
FPS (min | max | average): 1.275 | 1.383 | 1.304
Memory usage (phys | virt): 135 | 196 MiB
Thread count: 13
CPU usage (average): 11%
GPU usage (average): 94%
Time (elapsed): 00:00:30.667

[Graphics card info]
Card name: Intel(R) HD Graphics 4000
GPU name: GT2
Memory size: 0
OpenCL version: OpenCL 1.2
Driver version: 11.18.10.4276 Beta / Win10 64
Info collected with: GPU-Z 0.8.8


Updating the driver gave me a good performance boost! And, considerably lower memory usage.


[Runtime info]
Frames processed: 41 (0 - 40)
FPS (min | max | average): 1.308 | 1.398 | 1.360
Memory usage (phys | virt): 125 | 123 MiB
Thread count: 14
CPU usage (average): 11%
GPU usage (average): 97%
Time (elapsed): 00:00:30.154

[Graphics card info]
Card name: Intel(R) HD Graphics 4000
GPU name: GT2
Memory size: 0
OpenCL version: OpenCL 1.2
Driver version: 11.18.10.4358 Beta / Win10 64
Info collected with: GPU-Z 0.8.8

Bloax
4th June 2016, 16:32
Nvidia cards aren't exactly known for their stellar OpenCL performance, and AMD is getting a 200-buck Polaris card out pretty soon that should be much more power efficient than these last couple of generations, so you would probably be best off waiting for that.

[General info]
Log file created with: AVSMeter 2.2.8 (x86)
Script file: H:\testgpu.avs
Command line switches: -timelimit=30 -gpu -log
OS version: Windows 7 (x64) Service Pack 1 (Build 7601)

Avisynth version string: AviSynth 2.60RC3 (ICL10)
Avisynth file version: 2.6.0.6
Avisynth Interface Version: 6
Avisynth MT support: No
Avisynth.dll linker/compiler version: 6.0
Avisynth.dll location: C:\Windows\SysWOW64\AviSynth.dll
Avisynth.dll time stamp: 2015-04-29, 15:50:30
PluginDir+ (HKLM, x86): C:\Program Files (x86)\AviSynth+\plugins+
PluginDir2_5 (HKLM, x86): F:\C\Program Files (x86)\AviSynth 2.5\plugins

[Runtime info]
Frames processed: 172 (0 - 171)
FPS (min | max | average): 5.594 | 5.993 | 5.706
Memory usage (phys | virt): 621 | 620 MiB
Thread count: 16
CPU usage (average): 25%
GPU usage (average): 93%
Video engine load (average): 0%
GPU memory usage: 298 MiB
Time (elapsed): 00:00:30.146


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

As you can see, a gtx960 isn't exactly that much better than a gtx750.

Groucho2004
4th June 2016, 16:48
Nvidia cards aren't exactly known for their stellar OpenCL performance, and AMD is getting a 200-buck Polaris card out pretty soon that should be much more power efficient than these last couple of generations, so you would probably be best off waiting for that.
I think KNLMeansCL presents a special case. The GTX750 scores very well with single precision FLOPS but sucks at double precision. I'm simply assuming that KNLMeans uses mainly (or exclusively) single precision operations. Hard to say how AMD cards would perform. I hope users with AMD cards will post their scores.

[Runtime info]
Frames processed: 172 (0 - 171)
FPS (min | max | average): 5.594 | 5.993 | 5.706
Memory usage (phys | virt): 621 | 620 MiB
Thread count: 16
CPU usage (average): 25%
GPU usage (average): 93%
Video engine load (average): 0%
GPU memory usage: 298 MiB
Time (elapsed): 00:00:30.146
As you can see, a gtx960 isn't exactly that much better than a gtx750.
Wow, I did not expect that. I thought the 960 would be a lot faster.

Avisynth version string: AviSynth 2.60RC3 (ICL10)
You should update your Avisynth version.

MysteryX
4th June 2016, 16:51
So you do use the full GPU capacity and the bottleneck isn't the memory transfers in this case.

It is odd that I get lower performance with the Radeon HD 7670M as SVP also uses OpenCL. I get MUCH better performance when it is running OpenCL on the Radeon than on the Intel!

Groucho2004
4th June 2016, 18:08
It is odd that I get lower performance with the Radeon HD 7670M as SVP also uses OpenCL. I get MUCH better performance when it is running OpenCL on the Radeon than on the Intel!
I'm completely lost.
What does KNLMeansCL have to do with SVP?
What does "when it is running OpenCL" mean?
What are you comparing?

MysteryX
5th June 2016, 05:14
Both KNLMeansCL and SVP (InterFrame) use the same OpenCL API for processing.

MysteryX
5th June 2016, 05:58
Interesting development. With the latest AMD driver update, the OpenCL device was missing for the Radeon. It appears both devices are now combined as one as even though SVP can't see the Radeon OpenCL device anymore, it kept its performance.

For some reason, however, running KNLMeans in "Power Saving (Intel)" mode instead of "High Performance (Radeon)" mode gives slightly better performance.

Groucho2004
5th June 2016, 09:51
Both KNLMeansCL and SVP (InterFrame) use the same OpenCL API for processing.
Which means nothing.
A chimpanzee can probably operate a typewriter but this doesn't mean that it can produce the same result as John Steinbeck.

asarian
5th June 2016, 10:12
For my ESXi server, I was thinking maybe this card?

https://azerty.nl/producten/product_detail/5644/732356/asus-geforce-gt730-sl-2gd3-brk.html

It's not a 750, but should still be considerably faster than OpenCL on CPU; and it's fully passive. :)

Groucho2004
5th June 2016, 10:33
For my ESXi server, I was thinking maybe this card?

https://azerty.nl/producten/product_detail/5644/732356/asus-geforce-gt730-sl-2gd3-brk.html

It's not a 750, but should still be considerably faster than OpenCL on CPU; and it's fully passive. :)
Probably a good choice. I found a Aida64 GPGPU benchmark of the GT730 (http://www.quickpconline.com/pc/reviews/zotac-geforce-gt-730-2gb-gddr5-review/) which measures raw OpenCL perfomance. The site is Thai language (I think) but you can just scroll down to the "AIDA64 GPGPU Benchmark" results.

For comparison, here are the results of my GTX750:
http://s33.postimg.org/5lrid18lb/GTX750.png

If it doesn't work in the virtual machine and/or the performance is not what you expect you can always return it.

asarian
5th June 2016, 10:59
Probably a good choice. I found a Aida64 GPGPU benchmark of the GT730 (http://www.quickpconline.com/pc/reviews/zotac-geforce-gt-730-2gb-gddr5-review/) which measures raw OpenCL perfomance. The site is Thai language (I think) but you can just scroll down to the "AIDA64 GPGPU Benchmark" results.

^^ Hey, thanks for the benchmark info and feedback. :)

If it doesn't work in the virtual machine and/or the performance is not what you expect you can always return it.

Nothing is ever truly on the ESXi HCL, lol, but you can always find the PCIe device id yourself, and config it to become pass-thru. So, I have high hopes that will simply work.

Here are my GTX 980 result of your test, btw:

[Runtime info]
Frames processed: 398 (0 - 397)
FPS (min | max | average): 7.228 | 16.74 | 13.21
Memory usage (phys | virt): 597 | 630 MiB
Thread count: 16
CPU usage (average): 11%
GPU usage (average): 78%
Video engine load (average): 4%
GPU memory usage: 692 MiB
Time (elapsed): 00:00:30.130

[Graphics card info]
Card name: NVIDIA GeForce GTX 980
GPU name: GM204
Memory size: 4096
OpenCL version: OpenCL 1.2 CUDA
Driver version: 10.18.13.6822 WHQL (ForceWare 368.22) / Win10 64
Info collected with: GPU-Z 0.8.8

Groucho2004
5th June 2016, 11:19
Here are my GTX 980 result of your test, btw:

FPS (min | max | average): 7.228 | 16.74 | 13.21
That's more like it.

Groucho2004
5th June 2016, 11:23
As you can see, a gtx960 isn't exactly that much better than a gtx750.
I should have mentioned that the results can only be compared if we all use the same version of KNLMeansCL, i.e. the latest (0.7.6). Maybe you used an old version? That would explain your bizarre result.

MysteryX
11th June 2016, 06:29
Something appears wrong with the OpenCL implementation.

It performs *faster* on my Intel HD 4000 than on my Radeon 7670M... in *most* cases.

Let's take this script


ColorBarsHD().KillAudio()
KNLMeansCL(D=1, A=1, h=2.1, cmode=true, device_type="GPU", device_id=0)


Intel HD 4000

FPS (min | max | average): 8.134 | 11.09 | 9.477
Memory usage (phys | virt): 104 | 92 MiB
Thread count: 12
CPU usage (average): 10%


Radeon 7670M

FPS (min | max | average): 7.119 | 10.08 | 8.329
Memory usage (phys | virt): 51 | 47 MiB
Thread count: 12
CPU usage (average): 4%


but if I take this script

ColorBarsHD().KillAudio()
KNLMeansCL(D=2, A=3, h=2.1, cmode=true, device_type="GPU", device_id=0)


Intel HD 4000

FPS (min | max | average): 1.142 | 1.216 | 1.176
Memory usage (phys | virt): 118 | 113 MiB
Thread count: 12
CPU usage (average): 12%

Radeon 7670M

FPS (min | max | average): 1.361 | 1.436 | 1.381
Memory usage (phys | virt): 51 | 46 MiB
Thread count: 12
CPU usage (average): 8%

With AviSynthShader, I was also having issues that it ran faster on the Intel than on the Radeon, and it was an implementation bug on my part. I had to replace the flag D3DPRESENT_INTERVAL_DEFAULT with D3DPRESENT_INTERVAL_IMMEDIATE !!

Then, in terms of memory transfers, the issue isn't with the speed of the memory itself. Graphic cards are designed to display to the screen. Thus, they have a large bandwidth to send data out into the card and to the display, and memory transfers within the GPU is very quick. Transferring data back from the GPU, however, isn't the purpose of the card and is rarely necessary, and thus the bandwidth back is much smaller. I've got a noticeable performance improvement with AviSynthShader by returning planar data which reduced the data transfers by 25%. This has nothing to do with DX9 or OpenCL, these are physical limitations.

asarian
11th June 2016, 17:07
Something appears wrong with the OpenCL implementation.

It performs *faster* on my Intel HD 4000 than on my Radeon 7670M... in *most* cases.

The Intel HD 4000 doesn't have dedicated memory (so kinda sucks for gaming). But, if anything, this shows memory doesn't really play into it here (as it's all mostly onboard computational stuffz).

Then, in terms of memory transfers, the issue isn't with the speed of the memory itself. Graphic cards are designed to display to the screen. Thus, they have a large bandwidth to send data out into the card and to the display, and memory transfers within the GPU is very quick. Transferring data back from the GPU, however, isn't the purpose of the card and is rarely necessary, and thus the bandwidth back is much smaller. I've got a noticeable performance improvement with AviSynthShader by returning planar data which reduced the data transfers by 25%. This has nothing to do with DX9 or OpenCL, these are physical limitations.

I still have a hard time grasping how memory transfers come into play here at all (except to send some OpenCL results back). What alleged huge CPU<->GPU memory transfers would be involved with OpenCL?!

MysteryX
11th June 2016, 18:52
Not sure what you read back from the GPU. In my case, I have to return the full frames data back, either with 8-bit or 16-bit precision. Perhaps you're just returning small calculations details.

Either way, how do you explain the lower performance with the Radeon based on the way you use OpenCL?

Khanattila
14th June 2016, 16:16
Non-local means de-noising algorithm requires lots of memory accesses, as well as a large number of calculations.
Different architectures give different results varying the parameters.

tormento
23rd June 2016, 12:56
Non-local means de-noising algorithm requires lots of memory accesses, as well as a large number of calculations.
Different architectures give different results varying the parameters.

Quoted only to get notification :)

Please take a look here (http://forum.doom9.org/showthread.php?p=1771397#post1771397)

WolframRhodium
27th June 2016, 01:51
Can anybody explain how the parameter "rclip" works?

Through my test, it seems that the weighting calculation is done not only on reference clip, but also on the source clip, if "rclip" is specified as a clip which is different to the source clip.

Besides, if the "rclip" is specified the same as the source clip, the result is also different to not specifity any clip in "rclip". Why there exists difference?

I tried to find more details in the source code, but failed, because of my poor ability in programming.

Magik Mark
29th June 2016, 23:36
For CPU use, Is there a way to use multiple threads? I have a 16C/28T Xeon. Will this speed it up? Faster than the GPU?

Khanattila
29th June 2016, 23:51
Can anybody explain how the parameter "rclip" works?

Through my test, it seems that the weighting calculation is done not only on reference clip, but also on the source clip, if "rclip" is specified as a clip which is different to the source clip.

Besides, if the "rclip" is specified the same as the source clip, the result is also different to not specifity any clip in "rclip". Why there exists difference?

I tried to find more details in the source code, but failed, because of my poor ability in programming.
This is something that should not happen. And I should check.

Khanattila
29th June 2016, 23:52
For CPU use, Is there a way to use multiple threads? I have a 16C/28T Xeon. Will this speed it up? Faster than the GPU?

The plugin uses all available resources.
However, a graphics card is faster I think.

MysteryX
30th June 2016, 05:07
I've seen several people mentioning that they would rather use xNLMeans to do their computation on a server where the GPU isn't available.

I just had an idea and did a quick search...

It *IS* possible to have GPU Cloud Computing! (http://www.nvidia.com/object/gpu-cloud-computing-services.html)

asarian
1st July 2016, 07:01
The plugin uses all available resources.
However, a graphics card is faster I think.

Earlier, Groucho2004 and I loosely established that OpenCL via CPU-only (not with onboard graphics, of course), is roughly 80x slower than using a modern GPU. Aka, completely unusable for all daily purposes and intent. :)

Speaking of which, stll planning to buy this for my ESXi server:

https://www.asus.com/Graphics-Cards/GTX750TIPH2GD5/overview/

Peculiarly enough, ASUS itself doesn't list its OpenCL support. A German site said OpenCL 1.1 (that's no good); others say 1.2 (which is good, of course). It's a GTX 750, though, so, can I safely assume it will work with KNLMeansCL?

Groucho2004
1st July 2016, 07:57
Peculiarly enough, ASUS itself doesn't list its OpenCL support. A German site said OpenCL 1.1 (that's no good); others say 1.2 (which is good, of course). It's a GTX 750, though, so, can I safely assume it will work with KNLMeansCL?The GTX-750 supports OpenCL 1.2. The minimum driver version for OCL1.2 is as far as I recall 347.xx (350.xx for sure). If you're not interested in games and stuff, the plain GTX-750 (non-Ti) is just as fast.

asarian
1st July 2016, 08:15
Thanks, Groucho2004. :)

asarian
1st July 2016, 10:22
The GTX-750 supports OpenCL 1.2. The minimum driver version for OCL1.2 is as far as I recall 347.xx (350.xx for sure). If you're not interested in games and stuff, the plain GTX-750 (non-Ti) is just as fast.


Yeah, btw, this is pure for KNLMeansCL OpenCL rendering on my ESXi VM. Gonna set the card pass-thru, and Bob's your uncle. :)

MysteryX
1st July 2016, 10:45
I have a feature request if a new version gets developed.

You recommended not to use MT with KNLMeans. One problem with single-thread GPU usage is that the CPU and GPU can't work fully at the same time. AviSynth waits for KNLMeans to finish its GPU work before continuing and asking other filters to do their CPU work, and only request another frame from the GPU once the CPU work is done.

A way to work around this is to implement it as MT_NICE_FILTER. Still a single instance gets created but you can get several calls at once. Then, you can prevent parallel execution by using a unique_lock. This creates a very simple form of work queue. 4 or 8 threads can be working fully and you'll serve them when the OpenCL engine is free.

From my implementation of AviSynthShader, I also found that I got best performance (full GPU usage) by creating 2 engines and alternating between them; but that's something to test.

tormento
1st July 2016, 12:13
You recommended not to use MT with KNLMeans.

On AviSynth 2.6 and pinterf mod of AVS+, I can get it to work with 6/8 threads, rock solid ;)

(yeah... image corruption is another topic)

MysteryX
1st July 2016, 12:48
On AviSynth 2.6 and pinterf mod of AVS+, I can get it to work with 6/8 threads, rock solid ;)

(yeah... image corruption is another topic)
It "works" but he still recommended not to do it. I'm not exactly sure of the details why.

asarian
1st July 2016, 13:00
I have a feature request if a new version gets developed.

You recommended not to use MT with KNLMeans. One problem with single-thread GPU usage is that the CPU and GPU can't work fully at the same time.

In VapourSynth, I always find my CPU fully saturated (because x264 fills up the 'idle' spots, primarily). So, even if I could run multiple GPU-threads, and have my GPU run at full load too (which it isn't now), then yes, vspipe would likely take near 100% CPU too, but leave less for x264, is my point. So, I'm not even sure you'd win much on the deal, overall.

Khanattila
3rd July 2016, 13:32
It "works" but he still recommended not to do it. I'm not exactly sure of the details why.

I do not recommend it because it creates CPU overhead.
In addition, each thread creates a new OpenCL environment.

MysteryX
3rd July 2016, 14:44
OK then it works but it's the same situation as I had.

Here are some tests


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


FPS (min | max | average): 1.286 | 1.391 | 1.308
Memory usage (phys | virt): 134 | 183 MiB
Thread count: 9
CPU usage (average): 11%
OK


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


FPS (min | max | average): 0.477 | 10.41 | 1.356
Memory usage (phys | virt): 317 | 399 MiB
Thread count: 11
CPU usage (average): 13%
3.7% performance boost


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


FPS (min | max | average): 0.855 | 1.030 | 0.923
Memory usage (phys | virt): 400 | 557 MiB
Thread count: 105
CPU usage (average): 24%
CPU and GPU are waiting for each other.


SetFilterMtMode("KNLMeansCl", 3, true)
colorbars(width = 1920, height = 1080, pixel_type = "yv12").killaudio().assumefps(25, 1)
KNLMeansCL(d = 2, a = 2)
nnedi3_rpow2(4, nns=4)
Prefetch(2)


FPS (min | max | average): 0.426 | 1.324 | 1.207
Memory usage (phys | virt): 705 | 862 MiB
Thread count: 107
CPU usage (average): 34%

30.8% better


SetFilterMtMode("KNLMeansCl", 2, true)
colorbars(width = 1920, height = 1080, pixel_type = "yv12").killaudio().assumefps(25, 1)
KNLMeansCL(d = 2, a = 2)
nnedi3_rpow2(4, nns=4)
Prefetch(2)


FPS (min | max | average): 0.625 | 1.339 | 1.204
Memory usage (phys | virt): 861 | 1051 MiB
Thread count: 107
CPU usage (average): 36%
Same, but higher memory usage.

You're having the same situation that I faced with AviSynthShader. The main issue being the CPU and GPU waiting for each other instead of both working at the same time. The second issue is 3.7% underutilisation of the GPU due to memory transfers and overheads.

Here we get 30% performance improvements when using NNEDI3, and with more CPU-intensive scripts, the difference will be even greater.

You might want to take a look at how I implemented alternating between 2 engines running in MT_NICE_FILTER. (https://github.com/mysteryx93/AviSynthShader/blob/master/Src/ExecuteShader.cpp#L36) That way, 8 threads can be working with the CPU and the GPU work waits until either of the 2 engines is ready to process the next frame. This gave a serious performance boost.

Only thing to keep in mind is that the calls come from various threads and the engine must be multithreading-safe, yet called by only one thread at a time. The GPU work itself must be queued and protected by a unique_lock, but the memory transfers back and forth may not need to be locked. I tried to minimize the area that was locked. While I'm transferring back from the GPU to the CPU and into AviSynth, the next frame is already being pushed into the engine.

Groucho2004
3rd July 2016, 15:05
The second issue is 3.7% underutilisation of the GPU due to memory transfers and overheads.
I don't know where your obsession with memory bottlenecks comes from. Here (http://www.bealto.com/gpu-benchmarks_mem.html) is a good article about device/device and host/device memory performance. At a worst case scenario of 5GB/second, how many frames/sec. do you think can be copied from the video card to the main memory?

Groucho2004
3rd July 2016, 15:53
MysteryX:
Your tests and conclusions are utterly flawed. A few pointers:
1. The Avisynth filter chain cannot be faster than its slowest filter.
2. Multi-threading KNLMeansCL doesn't give better performance, no matter what
3. Don't multi-thread internally multi-threaded filters like nnedi3, the performance will be worse

Re. (2):
Maybe you realize the truth of that statement when you run 2 separate instances of a simple script containing KNLMeansCL with AVSMeter simultaneously - The speed of each script will be exactly half.

Re. (3):
Compare the speed of these two scripts:
colorbars(width = 1920, height = 540, pixel_type = "yv12").killaudio().assumefps(25, 1)
NNEDI3(dh = true, nsize = 0, nns = 4, qual = 2)

SetFilterMTMode("DEFAULT_MT_MODE", 2)
colorbars(width = 1920, height = 540, pixel_type = "yv12").killaudio().assumefps(25, 1)
NNEDI3(dh = true, nsize = 0, nns = 4, qual = 2, threads = 1)
Prefetch(4) #set to the number of logical cores of your CPU

MysteryX
3rd July 2016, 16:35
The issue is very simple. In single-threaded mode, each filter receive a call to GetFrame. Every other filter has to wait until it returns from that GetFrame function.

When calling CPU-intensive functions like NNEDI3, that's fine. If it is a regular filter, the only limitations is that it can only use 1 core (out of 8 cores means 12.5% of CPU). NNEDI3 handling multi-threading makes it work well.

The problem is when calling functions that don't use the CPU but instead wait for the GPU, such as AviSynthShader, KNLMeans or any other GPU-bound plugin.

The plugin then receives a call from GetFrame, and instead of using the CPU, it *waits* for the GPU to finish, and all other plugins that could use the CPU also have to wait.

Then we get the data back from the GPU, the processing moves on to the next plugin and it does CPU work. While the CPU is working, the GPU is iddle; KNLMeans won't receive the next request until the other filters are done and AviSynth is ready to process the next frame.

Thus, you'll get something along the lines of 50% GPU usage and 50% CPU usage.

Unless I'm missing something? I've done plenty of testing and coding around that.



2. Multi-threading KNLMeansCL doesn't give better performance, no matter what

I got 3.7% improvement by running 2 instances. Not a big improvement, but it's an improvement. I suspect the difference will be bigger if running with lower settings and processing more frames per second.


3. Don't multi-thread internally multi-threaded filters like nnedi3, the performance will be worse

In my test results, threads overhead is irrelevant because CPU usage never went above 36%

Here's another test

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


FPS (min | max | average): 9.324 | 29.33 | 22.42
Memory usage (phys | virt): 102 | 148 MiB
Thread count: 12
CPU usage (average): 10%


SetFilterMtMode("KNLMeansCl", 2, true)
colorbars(width = 1920, height = 1080, pixel_type = "yv12").killaudio().assumefps(25, 1)
KNLMeansCL(d = 0, a = 1)
Prefetch(2)


FPS (min | max | average): 10.12 | 55677 | 29.24
Memory usage (phys | virt): 203 | 265 MiB
Thread count: 14
CPU usage (average): 14%
Just as expected, this time I got 30.4% higher performance with 2 threads! (actually it's more than I expected)

4 threads should yield no further benefits

SetFilterMtMode("KNLMeansCl", 2, true)
colorbars(width = 1920, height = 1080, pixel_type = "yv12").killaudio().assumefps(25, 1)
KNLMeansCL(d = 0, a = 1)
Prefetch(4)


FPS (min | max | average): 5.187 | 155896 | 30.05
Memory usage (phys | virt): 303 | 382 MiB
Thread count: 16
CPU usage (average): 13%
Yet it still gives another 2.8% increase. To me that's an indication that the implementation isn't optimal. This should not give any more benefit than 2 threads.

On a side-note, my Radeon 7670M gets slain here on that last script. 47% slower than my Intel HD 4000 !??

FPS (min | max | average): 2.680 | 167032 | 18.88
Memory usage (phys | virt): 128 | 197 MiB
Thread count: 16
CPU usage (average): 29%

asarian
3rd July 2016, 18:03
While the CPU is working, the GPU is iddle; KNLMeans won't receive the next request until the other filters are done and AviSynth is ready to process the next frame.

Thus, you'll get something along the lines of 50% GPU usage and 50% CPU usage.

Unless I'm missing something? I've done plenty of testing and coding around that.


I'd say the part you're missing, is that you keep considering only 2 concurrent processes: CPU on AVS/VPS, vs. KNLMeansCL on GPU. Whilst, in fact, there's a third process: x264 (unless you're doing just a synthetic test, and are discarding the output).

So, to re-iterate, what idle time you 'lose' on your CPU isn't really lost at all, but being usurped by your x264 process (greatly speeding up your general encode, of course).

Only if throughput would be so dismal that your x264 process would effectively become starved, would you ever experience hinder from the lack of full CPU utilization from AVS/VPS. That has, with HD material, never been the case for me.

Groucho2004
3rd July 2016, 19:00
Just as expected, this time I got 30.4% higher performance with 2 threads!
I can't reproduce these results, maybe it depends on the graphics chip, driver, etc. It just shows how complex the whole thing is.

I'll stick to the authors recommendation to not multi-thread this filter, not only because there's no benefit in my case.

MysteryX
3rd July 2016, 19:42
Only if throughput would be so dismal that your x264 process would effectively become starved, would you ever experience hinder from the lack of full CPU utilization from AVS/VPS. That has, with HD material, never been the case for me.
Encoding with x265 Medium preset gives smaller file, better results and better performance than x264 with veryslow preset. The AVS script is generally much heavier than that.

In my case, the CPU very rarely goes above 80%. When running SMDegrain(prefilter=4), I've been stuck with a ~35% CPU usage, but now I see part of it is because of running KNLMeans with MT mode 3 that is a performance killer. Just switching it to MT mode 2 will probably help.

That being said, I'm running it on an Intel HD 4000 (because it doesn't like my Radeon 7670M) while my CPU is just as powerful as brand new laptops you buy now 4 years later. The CPUs now are kind of catching up, but a year or two ago the CPU went down into much lower performance than the one I got back then. If you have a slower CPU with 4 cores, then you might saturate it more easily than my i7 with 8 cores.

My CPU is a Intel Core i7-3630QM @ 2.40GHz. It ranks 7,618 here. (https://www.cpubenchmark.net/laptop.html) 4 years later, it's still hard to find laptops with better CPUs, but now I just saw Intel Core i7-6700HQ @ 2.60GHz is becoming popular. Slightly better: 8,044. Still lots of laptops come with Intel Core i5-6200U; nearly twice slower.

Perhaps that's why I'm putting more attention on MT than others.

MysteryX
4th July 2016, 07:24
Here's another test with SMDegrain. prefilter=4 is KNLMeans


colorbars(width = 1920, height = 1080, pixel_type = "yv12").killaudio().assumefps(25, 1)
SMDegrain(prefilter=4)

FPS (min | max | average): 0.887 | 2.063 | 1.782
Memory usage (phys | virt): 477 | 532 MiB
Thread count: 9
CPU usage (average): 11%



SetFilterMtMode("KNLMeansCl", 3, true)
colorbars(width = 1920, height = 1080, pixel_type = "yv12").killaudio().assumefps(25, 1)
SMDegrain(prefilter=4)
Prefetch(4)

Frames processed: 105 (0 - 104)
FPS (min | max | average): 0.467 | 4.370 | 2.954
Memory usage (phys | virt): 748 | 804 MiB
Thread count: 16
CPU usage (average): 31%


SetFilterMtMode("KNLMeansCl", 2, true)
colorbars(width = 1920, height = 1080, pixel_type = "yv12").killaudio().assumefps(25, 1)
SMDegrain(prefilter=4)
Prefetch(4)

FPS (min | max | average): 0.456 | 4.358 | 3.052
Memory usage (phys | virt): 1191 | 1319 MiB
Thread count: 16
CPU usage (average): 31%


We're dealing with 2 issues.
1. CPU and GPU waiting for each other.
2. GPU not being fully utilized due to overheads

Here we see that problem #1 is already handled quite well with MT mode 3.

As for problem #2, it is only making a 3.3% difference here.

One thing that stands out is that MT is a must when working with the GPU. If MT is a must, then better as well develop such plugins with support for MT mode 1 and handle the multi-threading optimally.

I can't reproduce these results, maybe it depends on the graphics chip, driver, etc. It just shows how complex the whole thing is.

I'll stick to the authors recommendation to not multi-thread this filter, not only because there's no benefit in my case.
If you run these scripts, I'm sure you'll get the same difference between test #1 and #2. It's technically impossible that you don't.


Test #1 is close to CPU limit of 1 core which can distort the result. Here's another way to look at it where the CPU still has legal room. Here's the difference between 2 and 4 threads with MT mode 3. With 4 threads, the CPU vs GPU waiting time is reduced. With 2 threads, the CPU is well below 25%.

SetFilterMtMode("KNLMeansCl", 3, true)
colorbars(width = 1920, height = 1080, pixel_type = "yv12").killaudio().assumefps(25, 1)
SMDegrain(prefilter=4)
Prefetch(2)

FPS (min | max | average): 0.631 | 3.491 | 2.812
Memory usage (phys | virt): 617 | 672 MiB
Thread count: 14
CPU usage (average): 19%


SetFilterMtMode("KNLMeansCl", 3, true)
colorbars(width = 1920, height = 1080, pixel_type = "yv12").killaudio().assumefps(25, 1)
SMDegrain(prefilter=4)
Prefetch(4)

FPS (min | max | average): 0.477 | 5.034 | 3.171
Memory usage (phys | virt): 769 | 825 MiB
Thread count: 16
CPU usage (average): 28%
That's a 12.8% difference between 2 and 4 threads.

Groucho2004
4th July 2016, 08:23
If you run these scripts, I'm sure you'll get the same difference between test #1 and #2. It's technically impossible that you don't.
I suggest you think about that last statement while taking into consideration the complexity of the processes involved and the differences between our setups (HW & SW).

MysteryX
4th July 2016, 08:44
I suggest you think about that last statement while taking into consideration the complexity of the processes involved and the differences between our setups (HW & SW).
Just run the scripts. It takes 2 minutes.

Your setup might change the outcome of problem #2, but problem #1 will remain just the same.

asarian
4th July 2016, 08:54
Encoding with x265 Medium preset gives smaller file, better results and better performance than x264 with veryslow preset. The AVS script is generally much heavier than that.

In my case, the CPU very rarely goes above 80%. When running SMDegrain(prefilter=4), I've been stuck with a ~35% CPU usage, but now I see part of it is because of running KNLMeans with MT mode 3 that is a performance killer. Just switching it to MT mode 2 will probably help.

(...)

Perhaps that's why I'm putting more attention on MT than others.


I see. Thanks for the clarification. I am not using x265 yet, so I'll take your word for it. :)

Groucho2004
4th July 2016, 09:08
Just run the scripts. It takes 2 minutes.
I already ran a whole bunch of tests with KNLMeansCL.
Remember, we're discussing multi-threading of a single fiilter (KNLMeansCL). You're testing SMDegrain which introduces a gigantic shitload of complexity and will certainly mask any meaningful results related to KNLMeansCL. I'll stand by my previous statement - your tests are flawed and your conclusions logical fallacies.

MysteryX
4th July 2016, 09:49
If you want to stand by beliefs instead of by results, then there's no point in discussing any of this. Beliefs=fiction. Results=reality. I'm only interested in reality.

The principle here is very simple. There's no "complex stuff". With a single thread, calls to GetFrame area linear. The next filter won't receive the call until the previous filter returns. This causes the CPU and the whole chain to *wait* while the GPU is working even through the CPU is still available and both could be working at the same time. You will not see this if you're not doing any CPU work besides KNLMeans.

Please don't post that "what I'm saying is crap" until you've done your basic homeworks and made this simple test yourself. Otherwise you're wasting everybody's time. THANKS!

Groucho2004
4th July 2016, 10:20
Beliefs=fiction. Results=reality. I'm only interested in reality.I fully agree.

MysteryX
4th July 2016, 13:05
If someone else wants to take 2 minutes to run the 3 test scripts to confirm what I shared, you can post your results.

Khanattila
4th July 2016, 14:33
I have a feature request if a new version gets developed.

You recommended not to use MT with KNLMeans. One problem with single-thread GPU usage is that the CPU and GPU can't work fully at the same time. AviSynth waits for KNLMeans to finish its GPU work before continuing and asking other filters to do their CPU work, and only request another frame from the GPU once the CPU work is done.

A way to work around this is to implement it as MT_NICE_FILTER. Still a single instance gets created but you can get several calls at once. Then, you can prevent parallel execution by using a unique_lock. This creates a very simple form of work queue. 4 or 8 threads can be working fully and you'll serve them when the OpenCL engine is free.

From my implementation of AviSynthShader, I also found that I got best performance (full GPU usage) by creating 2 engines and alternating between them; but that's something to test.

Or let AviSynth die.

Khanattila
4th July 2016, 14:35
If you want to stand by beliefs instead of by results, then there's no point in discussing any of this. Beliefs=fiction. Results=reality. I'm only interested in reality.

The principle here is very simple. There's no "complex stuff". With a single thread, calls to GetFrame area linear. The next filter won't receive the call until the previous filter returns. This causes the CPU and the whole chain to *wait* while the GPU is working even through the CPU is still available and both could be working at the same time. You will not see this if you're not doing any CPU work besides KNLMeans.

Please don't post that "what I'm saying is crap" until you've done your basic homeworks and made this simple test yourself. Otherwise you're wasting everybody's time. THANKS!

The only thing I notice is the filter can not saturate the GPU. And that's why you get the best results by invoking it multiple times.

MysteryX
4th July 2016, 14:40
The only thing I notice is the filter can not saturate the GPU. And that's why you get the best results by invoking it multiple times.
That's problem #2. Problem #1 has more impact.

The VapourSynth version probably behaves the same way.

Khanattila
4th July 2016, 14:55
That's problem #2. Problem #1 has more impact.

The VapourSynth version probably behaves the same way.

VapourSynth version is fmParallelRequests:
For filters that are serial in nature but can request in advance one or more frames they need. A filter’s “getframe” function will be called from multiple threads at a time with activation reason arInitial, but only one thread will call it with activation reason arAllFramesReady at a time.

And I should make a mess to make it work even for AviSynth?

Khanattila
4th July 2016, 15:00
The talk of freeing the CPU for other plugin is simply nonsense in any case.
KNLMeansCL can not release a frame that has not yet finished processing.
While the plugin works the other plugins wait. And that's how it should be.

MysteryX
4th July 2016, 15:09
So you did optimize it for VapourSynth's multi-threading.

If the OpenCL engine is well encapsulated into its own class, it's not difficult to handle the muti-threading in AviSynth.

1. Simply adding a unique_lock within GetFrame is generally enough to convert it from a MT_SERIALIZED to a MT_NICE_FILTER

2. Ensure the OpenCL engine can manage calls from various threads (serialized)

3. Reduce the area covered by the unique_lock; only the core processing needs to be locked

4. Once 1 engine runs optimally, you can create a 2nd engine and alternate between both for full GPU usage (view my code as reference)

At the end of the day, these 4 simple points made a big difference with my implementation of AviSynthShader ... except that I had to refactor large parts of the application for proper encapsulation.

Then we can run 8 threads and only 2 instances of KNLMeans get created. If efforts have already been made to support VapourSynth's MT structure, the benefit might not be as big there but still both versions would benefit.

The talk of freeing the CPU for other plugin is simply nonsense in any case.
KNLMeansCL can not release a frame that has not yet finished processing.
While the plugin works the other plugins wait. And that's how it should be.
You cannot release frame 1 while it is still processing, but frames 2, 3, 4, 5, 6, 7 and 8 can be processed during that time.

Khanattila
4th July 2016, 15:32
So you did optimize it for VapourSynth's multi-threading.

If the OpenCL engine is well encapsulated into its own class, it's not difficult to handle the muti-threading in AviSynth.

1. Simply adding a unique_lock within GetFrame is generally enough to convert it from a MT_SERIALIZED to a MT_NICE_FILTER

2. Ensure the OpenCL engine can manage calls from various threads (serialized)

3. Reduce the area covered by the unique_lock; only the core processing needs to be locked

4. Once 1 engine runs optimally, you can create a 2nd engine and alternate between both for full GPU usage (view my code as reference)

At the end of the day, these 4 simple points made a big difference with my implementation of AviSynthShader ... except that I had to refactor large parts of the application for proper encapsulation.

Then we can run 8 threads and only 2 instances of KNLMeans get created. If efforts have already been made to support VapourSynth's MT structure, the benefit might not be as big there but still both versions would benefit.



You are wrong. I have not optimized for VapourSynth, the versions are identical. Simply VapourSynth is of this century.

MysteryX
4th July 2016, 15:33
I have not optimized for VapourSynth, the versions are identical. Simply VapourSynth is of this century.
Then both versions would benefit from this, if you decide to release another version.

Since I've already coded those optimizations, it would make it a lot easier to duplicate.

Khanattila
4th July 2016, 15:58
You cannot release frame 1 while it is still processing, but frames 2, 3, 4, 5, 6, 7 and 8 can be processed during that time.

This is what is currently happening in the various versions.

#AviSynth
[Thread0] -> GetFrame(0) -> KNLMeansCL(0) -> GetFrame(1) -> KNLMeansCL(1) -> GetFrame(2) -> KNLMeansCL(2)

#AviSynth MT
[Thread0] -> GetFrame(0) -> KNLMeansCL:Work(0) -> KNLMeansCL:Work(0) -> KNLMeansCL:Work(0) -> KNLMeansCL:Work(0) -> GetFrame(4)
[Thread1] -> GetFrame(1) -> KNLMeansCL:Work(1) -> KNLMeansCL:Work(1) -> KNLMeansCL:Work(1) -> KNLMeansCL:Work(1) -> GetFrame(5)
[Thread2] -> GetFrame(2) -> KNLMeansCL:Work(2) -> KNLMeansCL:Work(2) -> KNLMeansCL:Work(2) -> KNLMeansCL:Work(2) -> GetFrame(6)
[Thread3] -> GetFrame(3) -> KNLMeansCL:Work(3) -> KNLMeansCL:Work(3) -> KNLMeansCL:Work(3) -> KNLMeansCL:Work(3) -> GetFrame(7)

#VapourSynth
[Thread0] -> GetFrame(0) -> KNLMeansCL(0) -> GetFrame(4) -> KNLMeansCL(4) -> Wait(5) -> Wait(5)
[Thread1] -> GetFrame(1) -> Wait(1) -> KNLMeansCL(1) -> GetFrame(5) -> KNLMeansCL(5) -> Wait(5)
[Thread2] -> GetFrame(2) -> Wait(2) -> Wait(2) -> KNLMeansCL(2) -> GetFrame(6) -> KNLMeansCL(6)
[Thread3] -> GetFrame(3) -> Wait(3) -> Wait(3) -> Wait(3) -> KNLMeansCL(3) -> GetFrame(7)

Khanattila
4th July 2016, 16:02
Then both versions would benefit from this, if you decide to release another version.

Since I've already coded those optimizations, it would make it a lot easier to duplicate.

No, because KNLMeansCL is already divided into many small kernel. What I can do is to write the individual kernels better, and some other small correction.
And it is among the best ways to saturate the GPU.

MysteryX
4th July 2016, 16:12
VapourSynth really confuses me... either it is not developer-friendly, or I just don't understand its logic.

Aren't all of the small kernels encapsulated into 1 core engine? If not, then that would need to be done to implement what I said. It can mean a lot of refactoring, but also leads to much better structured and cleaner code.

Khanattila
4th July 2016, 16:24
VapourSynth really confuses me... either it is not developer-friendly, or I just don't understand its logic.
Rewritten a little, maybe now it is more clear.

Aren't all of the small kernels encapsulated into 1 core engine? If not, then that would need to be done to implement what I said. It can mean a lot of refactoring, but also leads to much better structured and cleaner code.
But you understand that if a single instance of KNLMeansCL saturates the GPU, create more of it give you only more overhead?

MysteryX
4th July 2016, 16:42
Rewritten a little, maybe now it is more clear.

But you understand that if a single instance of KNLMeansCL saturates the GPU, create more of it give you only more overhead?
According to my tests, 1 instance doesn't saturate. 2 instances give between 2.5% and 30% increased performance depending on settings.

OK now I see what you're doing with VapourSynth. While waiting for the GPU, you call the processing of another frame. However that call won't return until that frame is done and may delay the liberation of the GPU. Unless you're just informing VapourSynth to process it and it does so in a different thread without locking your code.

I prefer my code chain better.

Groucho2004
4th July 2016, 16:47
But you understand that if a single instance of KNLMeansCL saturates the GPU, create more of it give you only more overhead?
If you look at some of his posts/scripts, this is clearly something that does not register. I pointed out several times in various topics that every additional thread creates overhead in the Windows thread scheduler but he keeps multi-threading the crap out of everything, even internally multi-threaded filters like nnedi3/eedi3 without realizing that efficiency goes down the drain.

MysteryX
4th July 2016, 16:56
Groucho2004, with 8 cores, MT is a must. Especially when working with the GPU on top of that. But that's off-topic. Let's keep the discussion technical to this situation with KNLMeans.

asarian
4th July 2016, 18:39
In my case, the CPU very rarely goes above 80%. When running SMDegrain(prefilter=4), I've been stuck with a ~35% CPU usage, but now I see part of it is because of running KNLMeans with MT mode 3 that is a performance killer. Just switching it to MT mode 2 will probably help.

Btw, I forgot to mention, I use VapourSynth nowadays (almost exclusively). Maybe that makes a difference too?

AviSynth MT() calls, while I was fortunate to have it work more-or-less stable on my machine, remains a very ugle hack, IMHO. I avoid it as the plague. :) It's also very crude. Better, as Khanattila said, to take a 1 process, and divide it up yourself, as the author of the code, into several mini-threads on the CPU, than MT()-ing (can you use that as a verb?) the cr*p out of the entire process.

While I have no proof, in my experience, the native threading model of VapourSynth is far superior than that of the MT() hack in AviSynth. I made the transition to VapourSynth a while back already, and haven't looked back.

I see you have an octa-core. Yeah, that may be harder to fully saturate (on either).

P.S. This was not to slam Sett, whose AS's MTMode stuff I have used gratefully over the years. But VapourSynth simply started from scratch, and got the threading right from the get-go this time.

MysteryX
4th July 2016, 18:45
Threading is actually working pretty well in Avisynth+. With v2.6, we couldn't configure per filter so it's pretty much all running on MT mode 2 which means all filters get recreated for each thread (high memory usage). With AviSynth+, many filters support MT mode 1 which means a single instance is being created and it handles simultaneous requests. It's actually working very well (except bugs in a few plugins).

feisty2
4th July 2016, 19:41
Wanna heat some bread with laptop?
Fine, 2 scripts, one runs knlmeanscl on gpu and another on cpu
Now you execute these 2 scripts simultaneously, and there you go

MysteryX
5th July 2016, 03:46
Wanna heat some bread with laptop?
Fine, 2 scripts, one runs knlmeanscl on gpu and another on cpu
Now you execute these 2 scripts simultaneously, and there you go
Bad idea. The CPU is busy doing more important work.

I did try running 2 instances on the 2 devices and for some reason I saw no performance improvement. mmmmm... perhaps that needs to be tested again.

feisty2
5th July 2016, 04:41
I know, microwave does the heating work much better
It's just you're so obsessed with 100% cpu usage so...

MysteryX
5th July 2016, 04:57
I know, microwave does the heating work much better
It's just you're so obsessed with 100% cpu usage so...
I almost forgot you couldn't care less about performance :)

feisty2
5th July 2016, 13:59
I almost forgot you couldn't care less about performance :)

well, I simply failed to understand what kind of "multi-threading" do you want, like Khanattila said, you don't really wanna multi-threaded knlmeanscl since one is heavy enough to bottleneck your cheesy laptop gpu, and you want more threads to what? make a gpu time bomb?
and cpu will have no other option but waiting, post-knlmeanscl filters do their calculations based on the knlmeanscl processed clip and they simply can't time travel and get to work before the required data reaches them

Magik Mark
5th July 2016, 14:31
Mystery x

What does "true" do in (KNLMeansCl, 2, true)?

I could confirm its faster. I get 25fps in conjunction with Deband, auto adjust, and knlmeans filters


Sent from my iPhone using Tapatalk

MysteryX
5th July 2016, 14:54
What does "true" do in (KNLMeansCl, 2, true)?
"true" overrides the definition already set in my AviSynthMT.avsi file :)

In your case, how much faster do you get?

From a single-threaded script, it seems you'll generally get ~30% improvement by running it in MT mode 3, and a further ~3% improvement by instead running it in MT mode 2. Of course these improvements will vary based on the script and computer setup, but it shouldn't be far from these numbers.

Magik Mark
6th July 2016, 00:45
"true" overrides the definition already set in my AviSynthMT.avsi file :)

In your case, how much faster do you get?

From a single-threaded script, it seems you'll generally get ~30% improvement by running it in MT mode 3, and a further ~3% improvement by instead running it in MT mode 2. Of course these improvements will vary based on the script and computer setup, but it shouldn't be far from these numbers.



I usually run 4 scripts. FFvideoSource, Flash3kyuudeband, AutoAdjust & KnlMeans. I get around 18fps for the first pass. With the above settings I get around 25fps. This is running in staxrip with prefetch 2. Can you advise further on the optimum MT mode for my other filters?


Sent from my iPhone using Tapatalk

MysteryX
6th July 2016, 02:10
In your case you get 38% improvement. Close to the 30%+3% I was talking about.

Someone compiled a list of compatible MT modes for all filters; not sure exactly where it is but you can find it by looking through the AviSynth+ thread. I chose to save that file as AviSynthMT.avsi and tweaked it.

MysteryX
6th July 2016, 07:03
I gave another try at running KNLMeans with both devices. The last time, I saw no benefit because I wasn't using MT, and thus the GPUs were working only one at a time and thus there was no benefit whatsoever.

First, regular KNLMeans. MT won't help here because there is nothing else using the CPU. In fact, MT appears to make it "clog" and work in chunks, although that doesn't affect much the overall performance.

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

FPS (min | max | average): 1.311 | 1.389 | 1.323
Memory usage (phys | virt): 142 | 183 MiB
Thread count: 12
CPU usage (average): 11%


1 instance of each device.

SetFilterMtMode("KNLMeansCl", 3)
colorbars(width = 1920, height = 1080, pixel_type = "yv12").killaudio().assumefps(25, 1)
c1 = SelectEvery(2, 0).KNLMeansCL(d = 2, a = 2, device_id=0)
c2 = SelectEvery(2, 1).KNLMeansCL(d = 2, a = 2, device_id=1)
Interleave(c1,c2)
Prefetch(4)

FPS (min | max | average): 0.234 | 48718 | 1.531
Memory usage (phys | virt): 197 | 246 MiB
Thread count: 13
CPU usage (average): 15%


2 instances of each device

SetFilterMtMode("KNLMeansCl", 3, true)
colorbars(width = 1920, height = 1080, pixel_type = "yv12").killaudio().assumefps(25, 1)
c1 = SelectEvery(4, 0).KNLMeansCL(d = 2, a = 2, device_id=0)
c2 = SelectEvery(4, 1).KNLMeansCL(d = 2, a = 2, device_id=0)
c3 = SelectEvery(4, 2).KNLMeansCL(d = 2, a = 2, device_id=1)
c4 = SelectEvery(4, 3).KNLMeansCL(d = 2, a = 2, device_id=1)
Interleave(c1,c2,c3,c4)
Prefetch(4)

FPS (min | max | average): 0.286 | 93538 | 1.563
Memory usage (phys | virt): 282 | 352 MiB
Thread count: 14
CPU usage (average): 18%

Note: I had results go up to 2.2 on that last test. There is a "clogging" effect that becomes more serious with Prefetch(8).

Or let's try it this way. MT mode 2 doesn't have the same clogging as MT mode 3

SetFilterMtMode("KNLMeansCl", 2)
colorbars(width = 1920, height = 1080, pixel_type = "yv12").killaudio().assumefps(25, 1)
c1 = SelectEvery(2, 0).KNLMeansCL(d = 2, a = 2, device_id=0)
c2 = SelectEvery(2, 1).KNLMeansCL(d = 2, a = 2, device_id=1)
Interleave(c1,c2)
Prefetch(2)

FPS (min | max | average): 0.368 | 26.44 | 1.963
Memory usage (phys | virt): 336 | 419 MiB
Thread count: 12
CPU usage (average): 15%


Same but 4 threads.

SetFilterMtMode("KNLMeansCl", 2)
colorbars(width = 1920, height = 1080, pixel_type = "yv12").killaudio().assumefps(25, 1)
c1 = SelectEvery(2, 0).KNLMeansCL(d = 2, a = 2, device_id=0)
c2 = SelectEvery(2, 1).KNLMeansCL(d = 2, a = 2, device_id=1)
Interleave(c1,c2)
Prefetch(4)

FPS (min | max | average): 0.357 | 97435 | 2.164
Memory usage (phys | virt): 521 | 641 MiB
Thread count: 17
CPU usage (average): 21%

Now that's what I'm talking about! That's a 40% improvement on top of the 30% improvement for using MT. This can result in a 70% improvement when running a full script.

** Note: the last test sometimes gives 2.2fps, sometimes 1.6fps, I really don't know why.

There might be a thread synchronization issue because one device works faster than the other device. It the device splitting was handled internally by sending the frame to the next available device, it would most likely work a lot smoother.

On a side note, KNLMeans with CPU gives 0.081fps

Magik Mark
6th July 2016, 11:05
What does selectevery do?


Sent from my iPhone using Tapatalk

Magik Mark
6th July 2016, 11:12
I'm getting selected device not available? How do I correct this?


Sent from my iPhone using Tapatalk

MysteryX
6th July 2016, 11:37
This script is for dual-graphics computers. I have a Intel HD 4000 and a Radeon 7670M.

SelectEvery is to send frames 0, 2, 4, 6, 8 to the Intel GPU and frames 1,3,5,7,9 to the AMD GPU.

This won't work if you have a single graphic card.

Some people might even have 2 graphic cards + a dedicated GPU device and all 3 could be working together.

Magik Mark
6th July 2016, 11:43
Is it possible to use CPU and GPU in parallel?

feisty2
6th July 2016, 14:58
@Khanattila
If you ever thought about writing a new GPU filter or maybe going to do that someday.
could you please consider BM3D (http://forum.doom9.org/showthread.php?t=172172)?
I'm all fucked up by its abysmal performance..

MysteryX
6th July 2016, 15:17
On a side note, KNLMeans with CPU gives 0.081fps
Is it possible to use CPU and GPU in parallel?
Sure, but why would you want to do that?

Besides being ridiculously low performance while the CPU could be doing more useful work, doing it the way I said would cause threading synchronization issues because one worker is 20 times faster than the other so the frames can't be split evenly between both.

I'm all fucked up by its abysmal performance..
So you do care for performance :)

Khanattila
6th July 2016, 15:20
@Khanattila
If you ever thought about writing a new GPU filter or maybe going to do that someday.
could you please consider BM3D (http://forum.doom9.org/showthread.php?t=172172)?
I'm all fucked up by its abysmal performance..

Hope is the last to die.

Khanattila
6th July 2016, 15:21
This script is for dual-graphics computers. I have a Intel HD 4000 and a Radeon 7670M.

SelectEvery is to send frames 0, 2, 4, 6, 8 to the Intel GPU and frames 1,3,5,7,9 to the AMD GPU.

This won't work if you have a single graphic card.

Some people might even have 2 graphic cards + a dedicated GPU device and all 3 could be working together.
Aka alternate frame rendering.

Khanattila
6th July 2016, 15:23
A system that allows the use of multiple graphics cards is possible. It takes time.

feisty2
6th July 2016, 15:24
So you do care for performance :)

I didn't, till Oyster hit 0.00fps last night, and that's my bottom line

MysteryX
6th July 2016, 15:28
A system that allows the use of multiple graphics cards is possible. It takes time.
Doing it the way I said wouldn't be difficult if the code is properly encapsulated.

Just look at the way I have done it here. (https://github.com/mysteryx93/AviSynthShader/blob/master/Src/ExecuteShader.cpp)

My engine is contained within a class. I initialize Engine1, and if running in AviSynth+ MT, initialize Engine2.

GetFrame starts like this

D3D9RenderImpl* render;
mutex_IterateDevice.lock();
if (!isMT || m_IterateDevice == 0) {
m_IterateDevice = 1;
render = render1;
}
else {
m_IterateDevice = 0;
render = render2;
}
mutex_IterateDevice.unlock();


Then I just use 'render' normally.

With the same logic, Engine1 can be initialized on device_id=0 while Engine2 can be initialized on device_id=1; and you can even have 2 of each devices and iterate between all 4. In this case, however, a flag will be required for each engine to report when they are available as the various devices may not work at the same speed.

It's really not difficult, but the key is encapsulation. The entire computation engine must be self-contained so that you can initialize it with a single call.

Here's the code that will split the workload across the various devices.

PVideoFrame __stdcall KNLMeans::GetFrame(int n, IScriptEnvironment* env) {
EngineCl* render = nullptr;
if (!isMT)
render = m_engines[0];
else {
mutex_DeviceSelection.lock();
for (int i=0; i<m_engineCount; i++) {
if (m_engines[i]->IsAvailable) {
render = m_engines[i];
break;
}
}
// If all engines are busy, rotate between devices and the thread will wait on the unique_lock
if (!render) {
render = m_engines[m_IterateDevice++];
if (m_IterateDevice >= m_engineCount)
m_IterateDevice = 0;
}
render->Available = false; // there might be an issue with Available when using rotation, should be easy to fix with testing
mutex_DeviceSelection.unlock();
}

render->DoYourJob();

if (isMT) {
mutex_DeviceSelection.lock();
render.Available = true;
mutex_DeviceSelection.unlock();
}
}

poisondeathray
6th July 2016, 17:08
Interesting test results using AFR -

But you wouldn't use that in practice with temporal filters (d=2) , as temporally adjacent frames wouldn't be processed together. Even/odd are processed separately so you are prone to "fluttering"

MysteryX
6th July 2016, 17:32
Interesting test results using AFR -

But you wouldn't use that in practice with temporal filters (d=2) , as temporally adjacent frames wouldn't be processed together. Even/odd are processed separately so you are prone to "fluttering"
Engine0 receives GetFrame for frames 0, 4, 8, 12. Engine1 receives GetFrame for frames 1, 5, 9, 13. It can still get the previous and future frames. As for the rest, AviSynth's frame buffer handles it.

In the case of 2 engines running at different speed like I did, I think I get choppy performance because the frame buffer's optimization gets confused.

poisondeathray
6th July 2016, 18:06
Engine0 receives GetFrame for frames 0, 4, 8, 12. Engine1 receives GetFrame for frames 1, 5, 9, 13. It can still get the previous and future frames. As for the rest, AviSynth's frame buffer handles it.



So that's a "bad" thing ( quality wise ) when using temporal filters. I'm referring only to quality issues, not performance or programming wise

MysteryX
6th July 2016, 18:56
When processing frame 4, it will request frames 3, 4 and 5. No problem there. It doesn't matter which engine or even which thread processes what frame.

With the SelectEvery script I wrote, I'm not exactly sure, but if it's handled within the plugin, then everything is fine for sure.

Edit: SelectEvery won't work because it returns a clip with less frames. It needs to be implemented within KNLMeans to work properly.

Khanattila
6th July 2016, 23:51
Doing it the way I said wouldn't be difficult if the code is properly encapsulated.

Just look at the way I have done it here. (https://github.com/mysteryx93/AviSynthShader/blob/master/Src/ExecuteShader.cpp)

My engine is contained within a class. I initialize Engine1, and if running in AviSynth+ MT, initialize Engine2.

GetFrame starts like this

D3D9RenderImpl* render;
mutex_IterateDevice.lock();
if (!isMT || m_IterateDevice == 0) {
m_IterateDevice = 1;
render = render1;
}
else {
m_IterateDevice = 0;
render = render2;
}
mutex_IterateDevice.unlock();


Then I just use 'render' normally.

With the same logic, Engine1 can be initialized on device_id=0 while Engine2 can be initialized on device_id=1; and you can even have 2 of each devices and iterate between all 4. In this case, however, a flag will be required for each engine to report when they are available as the various devices may not work at the same speed.

It's really not difficult, but the key is encapsulation. The entire computation engine must be self-contained so that you can initialize it with a single call.

Here's the code that will split the workload across the various devices.

PVideoFrame __stdcall KNLMeans::GetFrame(int n, IScriptEnvironment* env) {
EngineCl* render = nullptr;
if (!isMT)
render = m_engines[0];
else {
mutex_DeviceSelection.lock();
for (int i=0; i<m_engineCount; i++) {
if (m_engines[i]->IsAvailable) {
render = m_engines[i];
break;
}
}
// If all engines are busy, rotate between devices and the thread will wait on the unique_lock
if (!render) {
render = m_engines[m_IterateDevice++];
if (m_IterateDevice >= m_engineCount)
m_IterateDevice = 0;
}
render->Available = false; // there might be an issue with Available when using rotation, should be easy to fix with testing
mutex_DeviceSelection.unlock();
}

render->DoYourJob();

if (isMT) {
mutex_DeviceSelection.lock();
render.Available = true;
mutex_DeviceSelection.unlock();
}
}

I thank you of the pseudo-code you wrote but I think of a different solution.

MysteryX
8th July 2016, 03:37
The code I wrote would require a "QueueLength" counter instead of a "Available" flag as 8 threads might be working with 2 engines and they will never be "available".

I'm wondering whether there's a way to make it work nicely in single-threaded mode, as I have the exact same issues with my own code.

The only way would be for GetFrame to not lock the thread, and the only way for that would be for GetFrame to already have processed the next frame ahead of time, possibly from a different internal thread. There might be a way to get that to work but it would be hacky.

MysteryX
15th July 2016, 16:53
Regarding what we discussed here, I've done benchmark tests between MT_SERIALIZED and implementing MT_NICE_FILTER the way I described.

http://forum.doom9.org/showthread.php?p=1773672#post1773672

According to the benchmarks, the penalty of using MT_SERIALIZED is huge.

Magik Mark
17th July 2016, 09:21
MysteryX,

Have have these setting in my staxrip. Im geting 21fps. Do you think we can still tweak this?

http://i.imgur.com/H8XYKfJ.png

MysteryX
17th July 2016, 11:43
What MT mode is KNLMeans running on? You'll probably get better performance with 4 threads than 2 threads; but then you have to test it on your own system. Test MT mode 2 and 3, with 2, 4, 6 or 8 threads. Results will tell you what works best for you.

Magik Mark
17th July 2016, 13:38
Using this sequence, if I input Mt mode in knlmeans, Avisynth crashes


Sent from my iPhone using Tapatalk

MysteryX
17th July 2016, 15:11
MT modes are being set AFTER the command is executed! Of course it complains.

Magik Mark
17th July 2016, 23:25
MT modes are being set AFTER the command is executed! Of course it complains.

I'm kinda confuse. Can you advise on the sequence of my script? I'm not well verse in avisynth

MysteryX
18th July 2016, 00:21
It's kind of off-topic for this thread, but it's easier if you view and edit the full script itself, but it probably appends all the sections one after the other. First you have to define MT modes BEFORE the filters are being called. You need to move that up to the beginning of the script.

tormento
20th July 2016, 12:49
Is KNLMeans comparable with V-BM3D?

Magik Mark
24th July 2016, 23:28
I have noticed that using vapoursynth, this filter runs a lot faster to the point I could not use opencl for other application like madvr. Is there a way to slow it down a little bit? Can tweaking this helps:

core = vs.get_core(threads=XX)

aymanalz
26th July 2016, 12:32
At this point, what is the difference between NLmeansCL2 and KNLmeans? When I use KNLmeans with hybrid, and set the device to GPU, my GPU works at a 100% load, but processor works at 25%, and the encode takes a long time. When I use NLmeansCL2 and set the device to GPU, the CPU runs at 100%, GPU at about 25%, and the encode is much faster.

(I'm encoding a video to x265, with just this denoising filter added.)

What is the possible explanation for this?

Groucho2004
26th July 2016, 17:47
At this point, what is the difference between NLmeansCL2 and KNLmeans?
NLmeansCL2 is ancient, doesn't have a temporal mode and uses different default values.

You're comparing apples and oranges.

Khanattila
26th July 2016, 18:32
Is KNLMeans comparable with V-BM3D?
You can think about of something like that.
Bilateral --> NLMeans --> V-BM3D

tormento
26th July 2016, 18:40
You can think about of something like that.

Bilateral --> NLMeans --> V-BM3D


Is there any chance you compile the VapourSynth version for AVS+OpenCL?

aymanalz
26th July 2016, 22:06
NLmeansCL2 is ancient, doesn't have a temporal mode and uses different default values.

You're comparing apples and oranges.

I see, thanks for the info.

So is there a valid reason why KNLmeans is bottlenecking the encode? x265 in extremely CPU intensive, but as I said, the GPU is running full throttle, and the CPU is only running at 25%, when encoding to x265 with KNLmeans filter turned on. Clearly, the x265 encode is being held up by the KNLmeans denoiser.

Is this to be expected? Could the denoising be slower than the x265, even if the former is performed on GPU?

(CPU: Intel quad core 1i7 Haswell
GPU: Nvidia GTX 950M)

Groucho2004
26th July 2016, 22:16
So is there a valid reason why KNLmeans is bottlenecking the encode? x265 in extremely CPU intensive, but as I said, the GPU is running full throttle, and the CPU is only running at 25%, when encoding to x265 with KNLmeans filter turned on. Clearly, the x265 encode is being held up by the KNLmeans denoiser.

Is this to be expected? Could the denoising be slower than the x265, even if the former is performed on GPU?
Impossible to tell without knowing a bit about your source and, of course, seeing your script.

aymanalz
26th July 2016, 22:33
Impossible to tell without knowing a bit about your source and, of course, seeing your script.

I haven't edited the script, I am just using the default options in Hybrid, except that I've changed the device to GPU. The video is a 2 minute clip from a grainy "Sound of Music" bluray. (It is too big for me to upload.)

So the script is simply:

LoadPlugin("C:\Program Files\Hybrid\avisynthPlugins\LoadDll.dll")
LoadPlugin("C:\Program Files\Hybrid\avisynthPlugins\KNLMeansCL.dll")
LoadDll("C:\Program Files\Hybrid\avisynthPlugins\OpenCL.dll")
LoadCPlugin("C:\Program Files\Hybrid\avisynthPlugins\ffms2.dll")
# loading source: D:\Downloads\Sound of Music clip.mkv
FFVideoSource("D:\DOWNLO~1\SOUNDO~1.MKV",cachefile="D:\Hybrid temp\mkv_42d328cb0f2104fbd18d4e4a004f0124_14604_1_0.ffindex")
# denoising
KNLMeansCL(h=1.80,device_type="gpu")
return last

Groucho2004
26th July 2016, 22:43
Please run the script with AVSMeter (http://forum.doom9.org/showthread.php?t=165528) and tell us what speed you get.

Edit: Actually, since you're using Hybrid, the AVSMeter benchmark should be built in.

Magik Mark
27th July 2016, 00:50
At this point, what is the difference between NLmeansCL2 and KNLmeans? When I use KNLmeans with hybrid, and set the device to GPU, my GPU works at a 100% load, but processor works at 25%, and the encode takes a long time. When I use NLmeansCL2 and set the device to GPU, the CPU runs at 100%, GPU at about 25%, and the encode is much faster.

(I'm encoding a video to x265, with just this denoising filter added.)

What is the possible explanation for this?

You may want to try staxrip.

MysteryX
27th July 2016, 02:31
KNLMeansCL is very intensive and can easily be the bottleneck. If GPU is working at 100%, it *definitely* is the bottleneck and the CPU can't work any faster.

If it is too slow for you, then you have to lower KNLMeans settings.

Groucho2004
27th July 2016, 08:10
You may want to try staxrip.He might try mixed vegetables. How would changing the front end that essentially runs the same set of tools improve performance?

Magik Mark
8th August 2016, 00:02
Khanattila,

Which settings are good for luma plane only? Is this even possible?

feisty2
8th August 2016, 09:38
converttoy8()
knlmeanscl()

asarian
9th August 2016, 10:31
This is weird. After yesterday's Windows 10 Anniversary Update, it seems KNLMeansCL no longer registers:


Script evaluation failed:
Python exception: No attribute with the name knlm exists. Did you mistype a plugin namespace?
Traceback (most recent call last):
File "src\cython\vapoursynth.pyx", line 1491, in vapoursynth.vpy_evaluateScript (src\cython\vapoursynth.c:26897)
File "f:\jobs\thief.vpy", line 10, in <module>
vid = haf.QTGMC (vid, InputType=2, Preset="Very Slow", TR2=3, EdiQual=2, EZDenoise=1.5, NoisePreset="Slower", TFF=True, Denoiser="KNLMeansCL")
File "C:\Program Files\Python35\lib\site-packages\havsfunc.py", line 1072, in QTGMC
dnWindow = core.knlm.KNLMeansCL(noiseWindow, d=NoiseTR, h=Sigma)
File "src\cython\vapoursynth.pyx", line 1105, in vapoursynth.Core.__getattr__ (src\cython\vapoursynth.c:20791)
AttributeError: No attribute with the name knlm exists. Did you mistype a plugin namespace?

feisty2
9th August 2016, 10:45
check if OpenCL.dll went missing

asarian
9th August 2016, 13:48
check if OpenCL.dll went missing

Sigh. Yes, that was it. Thx. Leave it to MS to do something as insane as to uninstall OpenCL.

Seems the entire old Windows dir (plus subs) got moved to Windows.old; so, now I wonder what else might be missing.

tormento
9th August 2016, 16:18
Sigh. Yes, that was it. Thx. Leave it to MS to do something as insane as to uninstall OpenCL.

Seems the entire old Windows dir (plus subs) got moved to Windows.old; so, now I wonder what else might be missing.

I am a "insider". Every build, I had to reinstall video drivers.

Groucho2004
9th August 2016, 16:43
I am a "insider". Every build, I had to reinstall video drivers.Insider? Are you privy to information unavailable to us? :D
Maybe "expert" is the word you meant to use?

feisty2
9th August 2016, 16:49
Insider? Are you privy to information unavailable to us? :D
Maybe "expert" is the word you meant to use?
insider.windows.com

Groucho2004
9th August 2016, 16:57
insider.windows.com
Uhhh, very clever. W10 Insider, that must make people feel really special. :rolleyes:

feisty2
9th August 2016, 17:00
Uhhh, very clever. W10 Insider, that must make people feel really special. :rolleyes:

never took part in this program, I knew they would just ignore my feedback and kill aero glass anyways...

Groucho2004
9th August 2016, 17:01
never took part in this program, I knew they would just ignore my feedback and kill aero glass anyways...
Windows 8/10:
https://s6.postimg.org/q21iua7b5/photo_287775.png

asarian
9th August 2016, 17:05
Windows 8/10:
https://s6.postimg.org/q21iua7b5/photo_287775.png

That made me LOL. :)

Anyways, once feisty told me what the likely cause was, I just copied the needed dll's from the windows.old folder again (no 'insider' info was used in the reaching of said solution).

DJATOM
9th August 2016, 19:14
Windows 8/10:
https://s6.postimg.org/q21iua7b5/photo_287775.png

Agreed.

Magik Mark
10th August 2016, 12:58
What is a good setting for temporal filtering alone? Is this even doable?

Motenai Yoda
10th August 2016, 14:54
Agreed.
Disagreed

Every SO Upgrade you have to reinstall a lot of drivers
I suggest you to do a clean install, and update video drivers with opencl.

Groucho2004
10th August 2016, 14:55
Is this even doable?
No. From the documentation:
Spatial size = (2 * a + 1)^2
The min. value for "a" is 1.

Groucho2004
10th August 2016, 16:08
Disagreed
How about this one:

Windows 8/10:

https://s6.postimg.org/funkvmagx/Golden_Turd_Award.jpg

Tiles belong in a bathroom, not a desktop operating system.

Motenai Yoda
10th August 2016, 20:43
How about this one:
I hope you'll be fine with all w7 bsod, as I can say, migrating from w7 sp1 to w8 developer preview to rtm, 8.1, 8.1 update1, w10 technical preview, w10 rtm, 10.586 and now redstone, I have never experienced a bsod.
Tiles belong in a bathroom, not a desktop operating system.
as someone who never really tried w10 and don't know titles can be removed at all will say.

Groucho2004
10th August 2016, 21:08
I hope you'll be fine with all w7 bsodThe vast majority of BSODs are caused by crappy drivers, not the fault of the OS. Besides, first time I hear of "all w7 bsod".
as someone who never really tried w10 and don't know titles can be removed at all will say.
I have used 8.1, my wife's laptop came with it unfortunately. There are some system settings in 8.1 where you have to go through this awful Metro interface (at least I couldn't find a way around it). So, you're saying that in Win10 you can completely get rid of this tile crap?

Anyway, getting way off topic...

Magik Mark
12th August 2016, 11:04
Guys,

Do you know where to get the old nlmeans? The one that is being used in handbrake. I believe it uses the CPU. I'm looking for a 64bit version that I could use in staxrip. I'm trying to make a comparison with different denoisers

Thanks a lot

Khanattila
12th August 2016, 16:17
Khanattila,

Which settings are good for luma plane only? Is this even possible?

By default the program processes only the luma.

Khanattila
12th August 2016, 16:19
What is a good setting for temporal filtering alone? Is this even doable?

No, otherwise you would have motion blur.

Khanattila
12th August 2016, 16:20
I can now go back to the holiday.

Khanattila
13th August 2016, 00:42
Guys,

Do you know where to get the old nlmeans? The one that is being used in handbrake. I believe it uses the CPU. I'm looking for a 64bit version that I could use in staxrip. I'm trying to make a comparison with different denoisers

Thanks a lot
Handbrake uses a custom non-local means denoising algorithm

feisty2
13th August 2016, 10:13
Guys,

Do you know where to get the old nlmeans? The one that is being used in handbrake. I believe it uses the CPU. I'm looking for a 64bit version that I could use in staxrip. I'm trying to make a comparison with different denoisers

Thanks a lot

https://github.com/HandBrake/HandBrake/blob/master/libhb/nlmeans.c

Magik Mark
13th August 2016, 14:57
https://github.com/HandBrake/HandBrake/blob/master/libhb/nlmeans.c



Thanks for the info. Do you happen to know if it Will work in avisynth+ 64bit? If so, how do we get the dll?


Sent from my iPhone using Tapatalk

Khanattila
16th August 2016, 14:43
Thanks for the info. Do you happen to know if it Will work in avisynth+ 64bit? If so, how do we get the dll?


Sent from my iPhone using Tapatalk

You have to work at it, and I do not think anyone is interested in doing so.

WolframRhodium
30th August 2016, 01:56
could you add a new "wmode" named "Modified Bisquare" whose weight is equal to the fourth power of current wmode=2?

"Modified Bisquare" was presented in An Improved Non-local Denoising Algorithm.

Khanattila
31st August 2016, 17:12
could you add a new "wmode" named "Modified Bisquare" whose weight is equal to the fourth power of current wmode=2?

"Modified Bisquare" was presented in An Improved Non-local Denoising Algorithm.

AN IMPROVED NON-LOCAL DENOISING ALGORITHM, Bart Goossens, Hięp Luong, Aleksandra Pižurica and Wilfried Philips. I have the paper.

(1-r^2/h^2)^4, right?

EDIT. Future v0.7.8.

Khanattila
31st August 2016, 19:06
https://github.com/Khanattila/KNLMeansCL/releases/tag/v0.7.7

KNLMeansCL v0.7.7
* Improved debugging information.
* Improved the overall stability.
* Minor changes.

WolframRhodium
1st September 2016, 00:18
AN IMPROVED NON-LOCAL DENOISING ALGORITHM, Bart Goossens, Hięp Luong, Aleksandra Pižurica and Wilfried Philips. I have the paper.

(1-r^2/h^2)^4, right?

EDIT. Future v0.7.8.

it's (1-r^2/h^2)^8 in that paper, on page 7, table 1

thanks:)

luigizaninoni
1st September 2016, 11:47
edit: disregard. I am still on opencl 1.1, so it did not work

Khanattila
1st September 2016, 21:48
edit: disregard. I am still on opencl 1.1, so it did not work

https://s22.postimg.org/uj61prlxd/Fast_Test_KNLMeans_CL000500.jpg
Update your driver.

Khanattila
2nd September 2016, 16:28
It is possible that I can give you the support to some older devices. The platform needs to be updated anyway.



OpenCL
1.2
FULL_PROFILE
CL_DEVICE_IMAGE
CL_TRUE
CL_DEVICE_MAX_WRITE_IMAGE_ARGS >= 8
CL_DEVICE_IMAGE2D_MAX_WIDTH >= 8192
CL_DEVICE_IMAGE2D_MAX_HEIGHT >= 8192
CL_DEVICE_IMAGE_MAX_ARRAY_SIZE >= 2048
READ_IMAGE2D_ARRAY_IMAGE TRUE
WRITE_IMAGE2D_ARRAY_IMAGE TRUE
-> COMPATIBLE
CL_FALSE
-> NOT_COMPATIBLE
EMBEDDED_PROFILE
CL_DEVICE_IMAGE
CL_TRUE
CL_DEVICE_MAX_WRITE_IMAGE_ARGS >= 1
CL_DEVICE_IMAGE2D_MAX_WIDTH >= 2048
CL_DEVICE_IMAGE2D_MAX_HEIGHT >= 2048
CL_DEVICE_IMAGE_MAX_ARRAY_SIZE >= 256
READ_IMAGE2D_ARRAY_IMAGE TRUE
WRITE_IMAGE2D_ARRAY_IMAGE OPTIONAL
-> MAYBE_COMPATIBLE
CL_FALSE
-> NOT_COMPATIBLE
1.1
FULL_PROFILE
CL_DEVICE_IMAGE
CL_TRUE
CL_DEVICE_MAX_WRITE_IMAGE_ARGS >= 8
CL_DEVICE_IMAGE2D_MAX_WIDTH >= 8192
CL_DEVICE_IMAGE2D_MAX_HEIGHT >= 8192
CL_DEVICE_IMAGE_MAX_ARRAY_SIZE FALSE
READ_IMAGE2D_ARRAY_IMAGE FALSE
WRITE_IMAGE2D_ARRAY_IMAGE FALSE
-> COMPATIBLE
CL_FALSE
-> NOT_COMPATIBLE
EMBEDDED_PROFILE
CL_DEVICE_IMAGE
CL_TRUE
CL_DEVICE_MAX_WRITE_IMAGE_ARGS >= 1
CL_DEVICE_IMAGE2D_MAX_WIDTH >= 2048
CL_DEVICE_IMAGE2D_MAX_HEIGHT >= 2048
CL_DEVICE_IMAGE_MAX_ARRAY_SIZE FALSE
READ_IMAGE2D_ARRAY_IMAGE FALSE
WRITE_IMAGE2D_ARRAY_IMAGE FALSE
-> MAYBE_COMPATIBLE
CL_FALSE
-> NOT_COMPATIBLE
1.0
FULL_PROFILE
CL_DEVICE_IMAGE
CL_TRUE
CL_DEVICE_MAX_WRITE_IMAGE_ARGS >= 8
CL_DEVICE_IMAGE2D_MAX_WIDTH >= 8192
CL_DEVICE_IMAGE2D_MAX_HEIGHT >= 8192
CL_DEVICE_IMAGE_MAX_ARRAY_SIZE FALSE
READ_IMAGE2D_ARRAY_IMAGE FALSE
WRITE_IMAGE2D_ARRAY_IMAGE FALSE
-> COMPATIBLE
CL_FALSE
-> NOT_COMPATIBLE
EMBEDDED_PROFILE
CL_DEVICE_IMAGE
CL_TRUE
-> NOT_COMPATIBLE
CL_FALSE
-> NOT_COMPATIBLE

asarian
2nd September 2016, 18:49
Thanks for the new version, Khanattila! :thanks:

Is v.0.7.7 still compatible with VS v32? (Haven't migrated to r33 yet, for various reasons).

Khanattila
2nd September 2016, 21:34
Thanks for the new version, Khanattila! :thanks:

Is v.0.7.7 still compatible with VS v32? (Haven't migrated to r33 yet, for various reasons).

Until Myrsloik changes nothing is compatible with many versions.

Khanattila
6th September 2016, 18:20
I am working on the next release and I found a bug in rclip implementation with luma-only processing.
But nobody has ever noticed, moreover, is not a very popular features.

EDIT. Misprint.

feisty2
6th September 2016, 23:46
Rclip?
I been using it throughout all my stuff!

Khanattila
7th September 2016, 08:43
Rclip?
I been using it throughout all my stuff!

NLM_CLIP_UNORM --> AviSynth 8-bit clip and VapourSynth 8-bit or 16-bit clip.
NLM_CLIP_STACKED --> AviSynth 16-bit clip.
NLM_CLIP_UNSIGNED --> VapourSynth 9-bit or 10-bit clip.


AviSynth code:
(NLM_CLIP_UNORM | NLM_COLOR_GRAY) --> Ok
(NLM_CLIP_STACKED | NLM_COLOR_GRAY) --> Suspected
(NLM_CLIP_UNORM | NLM_COLOR_YUV) --> Ok
(NLM_CLIP_STACKED | NLM_COLOR_YUV) --> Ok
(NLM_CLIP_UNORM | NLM_COLOR_RGB) --> Ok
(NLM_CLIP_STACKED | NLM_COLOR_RGB) --> Not supported

VapourSynth code:
(NLM_CLIP_UNORM | NLM_COLOR_GRAY) --> Ok
(NLM_CLIP_UNSIGNED | NLM_COLOR_GRAY) --> Suspected
(NLM_CLIP_UNORM | NLM_COLOR_YUV) --> Ok
(NLM_CLIP_UNSIGNED | NLM_COLOR_YUV) --> Ok
(NLM_CLIP_UNORM | NLM_COLOR_RGB) --> Ok
(NLM_CLIP_UNSIGNED | NLM_COLOR_RGB) --> Ok

feisty2
7th September 2016, 10:30
Well, single precision is the only thing on my radar

Khanattila
11th September 2016, 17:39
I had intended to go directly to version 1.0.0, but an intermediate version 0.8.0 is more preferable.
I'm working on how to allow to use of cmode=True also with content in 420 and 422.

hydra3333
14th September 2016, 13:19
Unfortunately this crashes for me every time, popping up with a Windows dialogue box saying VSpipe has stopped working, with no python traceback.
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\AddGrain.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\BM3D.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\CTMF.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\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\Deblock.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\DFTTest.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\fmtconv.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
core.std.LoadPlugin(r'C:\SOFTWARE\Vapoursynth-x64\vapoursynth64\plugins\dll-to-choose-from\libawarpsharp2.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\libmvtools.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\libmvtools_sf_emt64.dll') # for Plum, 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\libnnedi3.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\scenechange.dll') # http://forum.doom9.org/showthread.php?t=166769
core.std.LoadPlugin(r'C:\SOFTWARE\Vapoursynth-x64\vapoursynth64\plugins\dll-to-choose-from\TCanny_AVX.dll') # http://forum.doom9.org/showthread.php?t=166769
core.std.LoadPlugin(r'C:\SOFTWARE\Vapoursynth-x64\vapoursynth64\plugins\dll-to-choose-from\vcfreq.dll') # http://forum.doom9.org/showthread.php?t=171413 http://www.avisynth.nl/users/vcmohan/index.html ... for Plum
core.std.LoadPlugin(r'C:\SOFTWARE\Vapoursynth-x64\vapoursynth64\plugins\dll-to-choose-from\vsdctfilter.dll') # http://vfrmaniac.fushizen.eu/works
core.std.LoadPlugin(r'C:\SOFTWARE\Vapoursynth-x64\vapoursynth64\plugins\dll-to-choose-from\vsfft3dfilter.dll') # http://vfrmaniac.fushizen.eu/works
core.std.LoadPlugin(r'C:\SOFTWARE\Vapoursynth-x64\vapoursynth64\plugins\dll-to-choose-from\Yadifmod.dll') # the r'' indicates do not treat special characters and accept backslashes
core.avs.LoadPlugin(r'C:\SOFTWARE\Vapoursynth-x64\DGIndex\DGDecodeNV.dll')
def main():
video = core.d2v.Source(r'T:\HDTV\WDTVlive\MP4-VS\x64-1\test.d2v')
video = core.std.Trim(video,first=0,length=1000)
video = core.std.SeparateFields(video, tff=True)
video = core.knlm.KNLMeansCL(video,device_type="auto",info=True)
video = haf.Weave(video, tff=True)
video = mvs.AssumeTFF(video)
video.set_output()
return True
main()



"C:\SOFTWARE\Vapoursynth-x64\VSPipe.exe" "T:\HDTV\WDTVlive\MP4-VS\x64-1\test.mpg.2016.09.14.21.35.44.95.vpy" - --y4m | "C:\SOFTWARE\ffmpeg\0-homebuilt-x64\x264-mp4.exe" - --stdin y4m --thread-input --profile high --level 4.1 --preset slow --interlaced --tff --no-cabac --crf 16 --sar 64:45 --colormatrix bt470bg -o "s:\HDTV\WDTVlive\MP4-VS\x64-1\test-temp.2016.09.14.21.35.44.95.h264"
y4m [info]: 720x576i 64:45 @ 25/1 fps (cfr)
x264 [warning]: interlace + weightp is not implemented
x264 [info]: using SAR=64/45
x264 [info]: using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX
x264 [info]: profile High, level 4.1
.. then it crashes ...

Using x64 vapoursynth, latest plugin versions, PC is an i3820 4-core, with 16Gb mem, Nvidia 750Ti with latest nvidia driver.
Windows event logs says
Faulting application name: VSPipe.exe, version: 0.0.0.0, time stamp: 0x57bd7828
Faulting module name: ucrtbase.dll, version: 10.0.14393.0, time stamp: 0x578997b5
Exception code: 0xc0000409
Fault offset: 0x000000000006d5b8
Faulting process ID: 0x1164
Faulting application start time: 0x01d20e805b5fa000
Faulting application path: C:\SOFTWARE\Vapoursynth-x64\VSPipe.exe
Faulting module path: C:\WINDOWS\System32\ucrtbase.dll
Report ID: 2d71a55b-f42e-4579-baca-c0d88ef54790
Faulting package full name:
Faulting package-relative application ID:

I wonder what I'm doing wrong ?


edit:
Ah, if I change the device_type to "cpu" I then see
"C:\SOFTWARE\Vapoursynth-x64\VSPipe.exe" "T:\HDTV\WDTVlive\MP4-VS\x64-1\test.mpg.2016.09.14.21.45.27.49.vpy" - --y4m | "C:\SOFTWARE\ffmpeg\0-homebuilt-x64\x264-mp4.exe" - --stdin y4m --thread-input --profile high --level 4.1 --preset slow --interlaced --tff --no-cabac --crf 16 --sar 64:45 --colormatrix bt470bg -o "s:\HDTV\WDTVlive\MP4-VS\x64-1\test-temp.2016.09.14.21.45.27.49.h264"
Script evaluation failed:
Python exception: knlm.KNLMeansCL: no compatible opencl platforms available!
Traceback (most recent call last):
File "src\cython\vapoursynth.pyx", line 1491, in vapoursynth.vpy_evaluateScript (src\cython\vapoursynth.c:26905)
File "T:\HDTV\WDTVlive\MP4-VS\x64-1\test.mpg.2016.09.14.21.45.27.49.vpy", line 574, in <module>
main()
File "T:\HDTV\WDTVlive\MP4-VS\x64-1\test.mpg.2016.09.14.21.45.27.49.vpy", line 141, in main
video = core.knlm.KNLMeansCL(video,device_type="cpu",info=True)
File "src\cython\vapoursynth.pyx", line 1383, in vapoursynth.Function.__call__ (src\cython\vapoursynth.c:25212)
vapoursynth.Error: knlm.KNLMeansCL: no compatible opencl platforms available!
and "gpu" crashes vspipe.

I suppose I should work backward through the thread to see if anyone has solved this before.

edit2:
https://developer.nvidia.com/opencl says "OpenCL support is included in the latest NVIDIA GPU drivers, available at www.nvidia.com/drivers"

Khanattila
15th September 2016, 16:54
Are you sure you have the latest version installed vapoursynth?
In addition, the 0.7.6 version works without any problems?

"no compatible opencl platforms available!" is correct if you select the CPU, because you have to install the intel driver.

hydra3333
15th September 2016, 17:42
yes 33.1.
I'll try 0.7.6 tomorrow in a fresh portable install.
Thanks.

hydra3333
16th September 2016, 12:46
OK, fresh "portable" installs of everything including 0.7.7, but it still crashes immediately.

I have seen the opencl.dll in c:\windows\system32 (209kb) and in "C:\Windows\SysWOW64\ (27kb) and nvopencl.dll in the same folders.

Properties of the nvopencl.dll's says "opecl 1.1 driver" which doesn't seem right. The latest Nvidia driver is installed (nvidia 750 Ti card).

Now off to try 0.7.6 ...

edit:
no, same result - it crashes immediately.
Is there a conflict eg with libfftw3's or something I wonder ?
10/06/2015 01:24 AM 168,448 AddGrain.dll
01/11/2014 10:54 AM 39,424 Bilateral.dll
16/08/2016 02:54 PM 192,512 BM3D.dll
30/11/2014 04:21 PM 135,168 CTMF.dll
29/04/2016 11:37 PM 1,912,832 d2vsource.dll
09/06/2015 02:09 AM 138,752 Deblock.dll
09/06/2015 06:07 PM 316,928 DFTTest.dll
19/07/2016 10:26 PM 1,235,456 fmtconv.dll
12/04/2016 02:47 AM 162,304 KNLMeansCL.dll
29/08/2016 05:09 AM 54,272 libawarpsharp2.dll
16/05/2014 06:30 PM 121,100 libbifrost.dll
03/07/2016 04:05 AM 22,016 libcnr2.dll
30/07/2016 05:38 PM 2,712,765 libfftw3-3.dll
30/07/2016 05:42 PM 2,772,692 libfftw3f-3.dll
30/07/2016 05:44 PM 1,247,967 libfftw3l-3.dll
10/07/2016 02:44 AM 3,607,040 libmvtools.dll
04/08/2016 12:31 AM 1,172,480 libmvtools_sf_emt64.dll
27/08/2016 10:34 PM 823,808 libnnedi3.dll
22/08/2016 11:07 PM 13,574,928 nnedi3_weights.bin
25/09/2014 06:56 PM 119,138 scenechange.dll
10/09/2016 12:57 AM 84,480 TCanny.dll
12/05/2016 10:20 PM 127,488 vcfreq.dll
10/05/2016 08:58 PM 40,960 vsavsreader.dll
28/02/2015 10:32 PM 45,056 vsdctfilter.dll
27/02/2015 09:34 PM 666,624 vsfft3dfilter.dll
06/03/2016 12:13 AM 47,616 Yadifmod.dll

Also tried 0.6.11 with the same result.

hydra3333
16th September 2016, 12:55
Is there some tool nvidia or other available to check that opencl x64 works ?

trip_let
16th September 2016, 18:17
There are a number of OpenCL-using programs, including free benchmarks like LuxMark.

Did you try installing Intel OpenCL support? I think I did that and somewhere along the way it magically worked. I won't begrudge anyone who calls this BS as it doesn't even make sense to me and it might have been something else. I was looking to sanity check by running it on my Intel integrated (HD 530) but then it started working on my GTX 960 again so I shrugged and moved on. It may be different because if you're on i7-3820 (Sandy Bridge-E), that doesn't have integrated graphics.

Motenai Yoda
17th September 2016, 02:52
gpucapsviewer

hydra3333
17th September 2016, 04:18
Thank you.
I thought I'd try GPU Caps Viewer and then the Nvidia code samples first before installing the Intel stuff.

GPU Caps Viewer:
http://www.geeks3d.com/softwares/
the 750Ti gpu is detected and all of the the openCL (the gpu variety) and openGL demos in this tool work just fine :)
(edit: see below, this works after installing the intel cpu driver) the cpu tests result in "not supported on this platform" :)

Also tried the NVidia openCL sdk code samples:https://developer.nvidia.com/opencl[/url]
OpenCL Device Query - detects the gpu and works fine
OpenCL Bandwidth Test - detects the gpu and works fine and transfers stuff and shows numbers without crashing
other nvidia demo programs from this web page crash with "unknown error" and no other explanation
:( :( :( :( :( :( :( :( :( :(
What the heck ?

Since GPU Caps Viewer runs OK with all of its openCL demos, I tend to suspect that the gpu is OK and whatever is needed to make openCL run is in place, and instead that there's something not quite right with KNLMeansCL ? The nvidia sdk code samples (those which try to do something) crashing baffles me a bit though.

edit 1:
downloaded and installed the Intel CPU driver
https://software.intel.com/en-us/articles/opencl-drivers#core_xeon
and now GPU Caps Viewer lets me set one of 2 sources before running the demos, choosing gpu and then running the demos works and choosing the cpu and then running the demos works.
NVidia openCL sdk code samples still crash though, apart from the Device Query and the Bandwidth Test samples :(
KNLMeansCL with device type set to gpu also still crashes though :(
KNLMeansCL with device type set to cpu also still crashes though :(

edit 2:
Replicated exactly the same results independently on an i4670/win10-x64 pro, with an nvidia 650
- with intel gpu disabled and no intel not microsoft driver software installed
- with intel gpu enabled and microsoft hd4600 gpu driver installed automatically by device manager "update software" button

edit 3:
Downloaded the Intel hd4600 driver and installed it
https://downloadcenter.intel.com/download/26229/Intel-Graphics-Driver-for-Windows-10-15-40-4th-Gen-
i.e. with intel gpu enabled and intel gpu driver installed
then re-tested - same results.

There we are, tested on 2 win10x64 PCs with both nvidia and intel and "cpu" GPUs with latest windows patches as of last night, including a variation with an Intel hd4600 enabled and Intel software installed, and it doesn't work.

Advice welcomed.

trip_let
17th September 2016, 08:52
Just checking, but you have Visual C++ redistributables, right?

As listed in docs:
https://github.com/Khanattila/KNLMeansCL/wiki/Requirements

MS download link:
http://www.microsoft.com/en-us/download/details.aspx?id=48145

hydra3333
17th September 2016, 15:43
Thanks for checking, which is always a good thing to do.

Yes I have all the years' Redistributables installed, both x32 and x64.

Khanattila
19th September 2016, 00:16
Check "C:\Windows\System32\OpenCL.dll" and/or "C:\Windows\SysWOW64\opencl.dll" version.
Must be at least version 1.2.*; is a problem with some nvidia drivers that do not update this component.

hydra3333
19th September 2016, 13:39
Check "C:\Windows\System32\OpenCL.dll" and/or "C:\Windows\SysWOW64\opencl.dll" version.
Must be at least version 1.2.*; is a problem with some nvidia drivers that do not update this component.

OK !

"C:\Windows\System32\OpenCL.dll" is v1.2.11.0
"C:\Windows\SysWOW64\opencl.dll" is v1.2.11.0

Khanattila
19th September 2016, 14:54
OK !

"C:\Windows\System32\OpenCL.dll" is v1.2.11.0
"C:\Windows\SysWOW64\opencl.dll" is v1.2.11.0


I really can not understand what's wrong in your configuration.

Groucho2004
19th September 2016, 15:15
Advice welcomed.
Did you just try VS or also Avisynth?

hydra3333
20th September 2016, 12:46
I really can not understand what's wrong in your configuration.
Neither can I ... given it occurs on 2 separate PCs with distinct hardware and separately installed/configured Windows etc. I do have only a very few programs installed - VideoReDo installed and Nero2015 Platinum and Itunes and VMware Player and Winzip (and that's about it!) - but wouldn't have thought they'd interfere. Otherwise, stock standard Win10 Pro x64.
Did you just try VS or also Avisynth?Groucho, just VS; I don't intend to use Avisynth+ into the future.

Groucho2004
20th September 2016, 13:02
Groucho, just VS; I don't intend to use Avisynth+ into the future.
Just a thought. It may have been another path to troubleshoot your problem with the help of AVSMeter.

hydra3333
20th September 2016, 13:12
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 ?

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

dipje
21st November 2016, 17:49
Not that much different to mine: https://snag.gy/9pi31Z.jpg

CruNcher
21st November 2016, 18:00
hmm except 1 extension less that seems not the be in your driver available

But yeah 1060 and 970 are very similar in Performance 1060 is more a improved version of it with less latency issues and some updated toolset gimicks and the fewer compute units are compensated mostly by the clock it seems most was pushed into improving the overall efficiency since 2014 :)

And the RX480 is what would have destroyed it in 2014 ;)

tormento
21st November 2016, 18:12
just replace cmode=true
In script cmode=chroma is present, not cmode=true

Groucho2004
21st November 2016, 18:14
Mine:
https://s6.postimg.org/v6k37mbup/Image1.png

tormento
21st November 2016, 18:17
Someone who has a nvidia gpu could post this screen? Thank you.
http://i.imgur.com/Bf1Tw9Rm.jpg (http://imgur.com/Bf1Tw9R)

dipje
22nd November 2016, 09:39
Hey you actually got a rise? You got the newest driver I see. Let me test with that as well.

Something else (and not relevant I guess, but still) why is your 'thread count' 24 and mine 17, while we both have 4 cores + HT ? Or is it a multisocket system or something?

edit:
oh wait, gtx660, that's old-skool Kepler instead of Maxwell-based. Might be a reason.

edit2:
I got no different results with the latest drivers. The same +/- 6.5% drop in speed.
I did notice that adding prefetch(2) at the end of the benchscript gave me an AVSMeter thread count of 33, more cpu usage but also a slight increase in speed.
(0.7.7 normal: 14.4 fps, 0.8.0-a3: 13.5 fps, 0.8.0-a3 with prefetch(2): 14.2 fps)

Ofcourse, 0.7.7 also gives me a slight speed boost (15.24 fps) with prefetch(2) so in the end 0.8.0 is still a bit slower :)

Groucho2004
22nd November 2016, 12:12
I ran this with newer drivers, now I get a slight increase in speed:
[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): 3951 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: 10.18.13.6881 (ForceWare 368.81) / XP

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


0.7.7:
Frames processed: 338 (0 - 337)
FPS (min | max | average): 5.382 | 5.643 | 5.616
Memory usage (phys | virt): 66 | 90 MiB
Thread count: 16
CPU usage (average): 25%

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

0.8.0-a3:
Frames processed: 348 (0 - 347)
FPS (min | max | average): 5.593 | 38.12 | 5.788
Memory usage (phys | virt): 66 | 90 MiB
Thread count: 16
CPU usage (average): 25%

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

dipje
22nd November 2016, 12:36
368.x still isn't the latest right? Or is it for XP?

Anyway, you have a GM107 GTX750, the older one. So I guess the speed drop is in more recent maxwell 2.x / pascal cards... or just on my system :).

Like I said before, I'm not sweating too much about a 6% drop. If I would worry about stuff like that I'm in need of something else to do :).

I'm hoping Vapoursynth gets fixed though.

Groucho2004
22nd November 2016, 13:21
368.x still isn't the latest right? Or is it for XP?It's the latest available driver for XP.

Khanattila
24th November 2016, 13:28
In all your nvidia gpu the local mem size is 48 KB and work group size is 1024, good to know.

tormento
27th November 2016, 10:55
Tried to adapt SMDegrain script to alpha version but it is beyond my capabilities. :(

real.finder
27th November 2016, 15:10
Tried to adapt SMDegrain script to alpha version but it is beyond my capabilities. :(

just replace
cmode=chroma && fullchr
with
channels=chroma && fullchr ? "YUV" : "Y"

tormento
27th November 2016, 20:56
just replace
cmode=chroma && fullchr
with
channels=chroma && fullchr ? "YUV" : "Y"
Simple x264 Launcher (Build #1060), built 2016-10-21

Job started at 2016-11-27, 20:56:21.

Source file : E:\in\2_03 Jason Bourne\jason_44.avs
Output file : E:\in\2_03 Jason Bourne\jason_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\2_03 Jason Bourne\jason_44.avs" NUL

error: Script error: expected a , or )
((null), line 21, column 190)
(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\2_03 Jason Bourne\jason_44.avs, line 19)

PROCESS EXITED WITH ERROR CODE: 1

real.finder
27th November 2016, 22:54
why don't just use avspmod?

anyway


nlc = Eval("nlc.KNLMeansCL(D=d, A=a, h=h,lsb_inout=lsb_in || lsb,device_type=devicetype,device_id=deviceid,cmode=chroma && fullchr" + knlm_params + ")")



cnl = chroma && fullchr ? "YUV" : "Y"
nlc = Eval("nlc.KNLMeansCL(D=d, A=a, h=h,lsb_inout=lsb_in || lsb,device_type=devicetype,device_id=deviceid,channels=cnl" + knlm_params + ")")


I don't have gpu for test

tormento
28th November 2016, 08:44
Ok, tested encoding two movies from BD to SMDegrain (tr=4,PreFilter=4,thSAD=400,contrasharp=false,refinemotion=false,truemotion=true,plane=4,chroma=true,lsb=true,mode=6,TV_range=false)

Tested with Prefetch(8).

No noticeable difference in speed or visual quality. Will test better next hours.

Khanattila
5th December 2016, 15:26
https://github.com/Khanattila/KNLMeansCL/releases/tag/v1.0.0-beta.1

KNLMeansCL v1.0.0-beta.1
* Improved performance with CPU.
* Improved performance with AMD GCN Architecture.
* Reduced CPU overload in some system.
* Improved de-noising quality around image edge.
* Replaced 'cmode' with 'channels' and added the options to only process the chroma.
* Two new modified bisquare weighting functions.
* Increased the maximum 's' value to 8.
* Removed Cauchy weighting function.
* Updated to VapourSynth R35.
* Fixed second clip 'rclip' in some circumstances.

tormento
5th December 2016, 15:55
https://github.com/Khanattila/KNLMeansCL/releases/tag/v1.0.0-beta.1
Please release x64 version too.

Khanattila
5th December 2016, 16:13
Please release x64 version too.

Thanks for your report, fixed.

real.finder
5th December 2016, 17:01
https://github.com/Khanattila/KNLMeansCL/releases/tag/v1.0.0-beta.1

KNLMeansCL v1.0.0-beta.1
* Improved performance with CPU.
* Improved performance with AMD GCN Architecture.
* Reduced CPU overload in some system.
* Improved de-noising quality around image edge.
* Replaced 'cmode' with 'channels' and added the options to only process the chroma.
* Two new modified bisquare weighting functions.
* Increased the maximum 's' value to 8.
* Removed Cauchy weighting function.
* Updated to VapourSynth R35.
* Fixed second clip 'rclip' in some circumstances.


I can't use this filter, but I did some edit in SMDegrain so with channels there is no need to Stack chroma Horizontal trick in SMDegrain prefilter?

Khanattila
5th December 2016, 18:13
I can't use this filter, but I did some edit in SMDegrain so with channels there is no need to Stack chroma Horizontal trick in SMDegrain prefilter?

If I remember correctly this trick is used only if video is not planar.
However, what problems do you have?

real.finder
5th December 2016, 19:38
If I remember correctly this trick is used only if video is not planar.
However, what problems do you have?

the trick for yv12 too, to process chroma because back then it's just copy, irc

I don't have good opencl device, and trid OpenCL™ Runtime with device_type="cpu" and then I get a crash!

Groucho2004
5th December 2016, 21:51
https://github.com/Khanattila/KNLMeansCL/releases/tag/v1.0.0-beta.1

0.7.7 and 1.0.0b1 comparison:

[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: 10.18.13.6881 (ForceWare 368.81) / XP

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

0.7.7:
[Runtime info]
Frames processed: 338 (0 - 337)
FPS (min | max | average): 5.349 | 5.644 | 5.616
Memory usage (phys | virt): 57 | 78 MiB
Thread count: 9
CPU usage (average): 25%

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

1.0.0b1:
[Runtime info]
Frames processed: 309 (0 - 308)
FPS (min | max | average): 4.928 | 36.20 | 5.143
Memory usage (phys | virt): 64 | 78 MiB
Thread count: 9
CPU usage (average): 25%

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

tormento
6th December 2016, 05:33
Has video memory usage changed?

Pee Wee's big adventure.264 (http://www40.zippyshare.com/v/hpuIEgAG/file.html) (Pee Wee's big adventure.dgi (http://www77.zippyshare.com/v/xrWrucVu/file.html)) and the script

SetMemoryMax(8000)
SetFilterMTMode("DEFAULT_MT_MODE", 2)
SetFilterMTMode("ChangeFPS", 3)

SetFilterMTMode("DGSource", 3)
LoadPlugin("D:\eseguibili\media\DGDecNV\x64\DGDecodeNV.dll")
DGSource("F:\raw\Pee Wee's big adventure.dgi")

ChangeFPS(last,last,true)

SMDegrain (tr=4,PreFilter=4,thSAD=400,contrasharp=false,refinemotion=false,truemotion=true,plane=4,chroma=true,lsb=true,mode=6,TV_range=false)

Prefetch(8)

crashes with latest beta of KNLMeansCL, while works with 0.7.7.

To make it work with latest beta, I have to use Prefetch(7).

Khanattila
6th December 2016, 09:49
0.7.7 and 1.0.0b1 comparison:

[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: 10.18.13.6881 (ForceWare 368.81) / XP

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

0.7.7:
[Runtime info]
Frames processed: 338 (0 - 337)
FPS (min | max | average): 5.349 | 5.644 | 5.616
Memory usage (phys | virt): 57 | 78 MiB
Thread count: 9
CPU usage (average): 25%

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

1.0.0b1:
[Runtime info]
Frames processed: 309 (0 - 308)
FPS (min | max | average): 4.928 | 36.20 | 5.143
Memory usage (phys | virt): 64 | 78 MiB
Thread count: 9
CPU usage (average): 25%

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



At this point it seems clear that I have to add some fine tuning options.

dipje
6th December 2016, 11:03
The regular bench-script, ran for a minute or so on my Core i7-2670QM with HD6990M

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

v0.7.6: 4.282 fps, cpu usage 6%
v0.7.7: 3.984, cpu usage 6%
v1.0.0: 5.034 fps, cpu usage 4%

CPU frequency was scaling between +/- 1.3ghz and at max 1.6 - 1.7 ghz. Mostly sitting in between. In heavy multi-core load this CPU clocks at 2.2 while in heavy single-core load this CPU clocks easily to around 2.8ghz, so this means that KNLMeansCL isn't saturating my cpu power at all. Nice.
edit: Even tested v1.0.0 with device_type = 'cpu'. My CPU usage went to 100% (of course) and my clocks stay at 2.69ghz. I'm getting like 2 to 3 frames _per minute_ in speed though :P.


Vapoursynth x64 works again! v1.0.0 showed the same speed for the sort of same bench script. So it's working fine :).

What's even weirder: I said before that nothing ever shows any kind of GPU usage on this laptop? The sensors in AMD Overdrive and gpu-z are always 0%?
v0.7.6 and v0.7.7 keep the GPU usage at 0% for the entire minute, but 1.0.0 beta suddenly jumps from 0% to 95% GPU usage after 10 seconds into the benchmark.

Running games, SVP, Madvr, OpenCL demos.. nothing ever showed anything but 0% GPU usage but your 1.0.0 suddenly shows full GPU usage. Very weird :).

Anyway, can test the real question (for me at least), my i7 / GTX 1060 tonight back at home.

Khanattila
6th December 2016, 22:59
KNLMeansCL-benchmark-only.zip (http://www.mediafire.com/file/j378p8yj2eajznk/KNLMeansCL-benchmark-only.zip)

If you like to have fun, 3 more args: ocl_x, ocl_y and ocl_r.

Rules:
- (ocl_x * ocl_y) <= Device work group size
- min(ocl_x, ocl_y) >= 4.
- ocl_z >= 1.

In the next post some results.

Khanattila
7th December 2016, 13:48
Optimize for AMD was pretty simple. Max work group size is 256.

// ocl_x * ocl_y = 256
ocl_x = 64, ocl_y = 4, ocl_r = 1, 40.50 FPS
ocl_x = 32, ocl_y = 8, ocl_r = 1, 46.53 FPS <----
ocl_x = 16, ocl_y = 16, ocl_r = 1, 45.95 FPS
ocl_x = 8, ocl_y = 32, ocl_r = 1, // redundant
ocl_x = 4, ocl_y = 64, ocl_r = 1, // redundant

// Increment ocl_r
ocl_x = 32, ocl_y = 8, ocl_r = 1, 46.53 FPS
ocl_x = 32, ocl_y = 8, ocl_r = 2, 45.65 FPS
ocl_x = 32, ocl_y = 8, ocl_r = 3, 45.40 FPS
ocl_x = 32, ocl_y = 8, ocl_r = 4, 44.94 FPS


Also for Intel GPU. Max work group size is 512. (d=1, a=1)

// ocl_x * ocl_y = 512
ocl_x = 128, ocl_y = 4, ocl_r = 1, 6.01 FPS
ocl_x = 64, ocl_y = 8, ocl_r = 1, 6.11 FPS
ocl_x = 32, ocl_y = 16, ocl_r = 1, 5.63 FPS

// ocl_x * ocl_y = 512
ocl_x = 128, ocl_y = 4, ocl_r = 2, 6.50 FPS
ocl_x = 64, ocl_y = 8, ocl_r = 2, 6.61 FPS
ocl_x = 32, ocl_y = 16, ocl_r = 2, 6.86 FPS

// ocl_x * ocl_y = 512
ocl_x = 128, ocl_y = 4, ocl_r = 3, 7.85 FPS
ocl_x = 64, ocl_y = 8, ocl_r = 3, 7.94 FPS <----
ocl_x = 32, ocl_y = 16, ocl_r = 3, 7.29 FPS

// ocl_x * ocl_y = 512
ocl_x = 128, ocl_y = 4, ocl_r = 4, 7.98 FPS
ocl_x = 64, ocl_y = 8, ocl_r = 4, 7.52 FPS
ocl_x = 32, ocl_y = 16, ocl_r = 4, 7.58 FPS

// ocl_x * ocl_y = 512
ocl_x = 128, ocl_y = 4, ocl_r = 5, 7.95 FPS
ocl_x = 64, ocl_y = 8, ocl_r = 5, 8.01 FPS
ocl_x = 32, ocl_y = 16, ocl_r = 5, 7.45 FPS

Atak_Snajpera
7th December 2016, 14:11
Khanattila but this is faster for INTEL ocl_x = 64, ocl_y = 8, ocl_r = 5, 8.01 FPS instead of this ocl_x = 64, ocl_y = 8, ocl_r = 3, 7.94 FPS <----

PS. What does ocl_r mean exactly?

ShogoXT
7th December 2016, 14:31
New version of amd performance drivers coming in a day or so with new features including hevc encoding support on amd amf 1.4 . Since I have the rx 480 which versions do you want me to try to test and compare?

Also should I be using avisynth+ or Mt instead?

Khanattila
7th December 2016, 14:48
Khanattila but this is faster for INTEL ocl_x = 64, ocl_y = 8, ocl_r = 5, 8.01 FPS instead of this ocl_x = 64, ocl_y = 8, ocl_r = 3, 7.94 FPS <----

PS. What does ocl_r mean exactly?

Yes, but it's more or less the same thing.

olc_r is result for work-item. So if ocl_r = 1, each work-item calculates a pixel.

However, all work-item perform (2 + olc_r) memory accesses:
ocl_r = 1 ---> 3 memory access for 1 pixel
ocl_r = 2 ---> 4 memory access for 2 pixel
ocl_r = 3 ---> 5 memory access for 3 pixel
ocl_r = 4 ---> 6 memory access for 4 pixel
ocl_r = 5 ---> 7 memory access for 5 pixel

It is a way to make better use of the bandwidth.
However if ocl_r is too large it requires more registers, for example, of those available.

Khanattila
7th December 2016, 14:51
New version of amd performance drivers coming in a day or so with new features including hevc encoding support on amd amf 1.4 . Since I have the rx 480 which versions do you want me to try to test and compare?

Also should I be using avisynth+ or Mt instead?

v1.0.0-beta.1 is stable enough if you want to try it.
If you have problems back to v0.7.7.

Using AviSynth MT is useless. Instead AviSynth+ is supported but not required.

Atak_Snajpera
7th December 2016, 15:08
I wonder why ocl_y = 8 appears to be a "magic numer" ? (at least for AMD/INTEL)

Khanattila
7th December 2016, 16:48
I wonder why ocl_y = 8 appears to be a "magic numer" ? (at least for AMD/INTEL)

Global memory access by threads can be coalesced to one transaction.

Should be the alignment of the memory.

Khanattila
7th December 2016, 17:50
Intel i5-4690



// (ocl_x * ocl_y) = 2048
ocl_x = 512, ocl_y = 4, ocl_r = 1, 1.798 FPS
ocl_x = 256, ocl_y = 8, ocl_r = 1, 1.761 FPS
ocl_x = 128, ocl_y = 16, ocl_r = 1, 1.805 FPS
ocl_x = 64, ocl_y = 32, ocl_r = 1, 1.738 FPS

// (ocl_x * ocl_y) = 1024
ocl_x = 256, ocl_y = 4, ocl_r = 2, 2.358 FPS
ocl_x = 128, ocl_y = 8, ocl_r = 2, 2.290 FPS
ocl_x = 64, ocl_y = 16, ocl_r = 2, 2.259 FPS
ocl_x = 32, ocl_y = 32, ocl_r = 2, 2.225 FPS

// (ocl_x * ocl_y) = 1024
ocl_x = 256, ocl_y = 4, ocl_r = 3, 2.555 FPS
ocl_x = 128, ocl_y = 8, ocl_r = 3, 2.672 FPS
ocl_x = 64, ocl_y = 16, ocl_r = 3, 2.573 FPS
ocl_x = 32, ocl_y = 32, ocl_r = 3, 2.485 FPS

// (ocl_x * ocl_y) = 1024
ocl_x = 256, ocl_y = 4, ocl_r = 4 2.796 FPS
ocl_x = 128, ocl_y = 8, ocl_r = 4, 2.792 FPS
ocl_x = 64, ocl_y = 16, ocl_r = 4, 2.705 FPS
ocl_x = 32, ocl_y = 32, ocl_r = 4, 2.641 FPS

dipje
7th December 2016, 22:19
My speed seems to be fastest with ocl_y = 8 as well.
But maxing my workgroup size means ocl_x = 128, ocl_y = 8 (which is the fastest of all the combinations with ocl_x * ocl_y = 1024)

But any combination with ocl_y = 8 is faster except ocl_x = 4. So my fastest ended up being ocl_x = 16, ocl_y = 8.

Then, increasing ocl_r skyrockets performance some more. It tops out eventually.. but.. completely different to the combinations posted before.

Will post all my benches in some mintues.

----------------------------------
Core i7 860 @ 3.36 ghz, GTX 1060 6GB

First off, 0.7.6 / 0.7.7 / 1.0b1. Avisynth x64, d = 2, a = 2:
0.7.6 = 14.52
0.7.7 = 14.45
1.0b1 = 12.95

Sort of the same speed decrease as the 0.8 test/alpha thing

----------------------------------

The 'benchmark only' thing, 32bit (took me a while to figure out the DLL wasn't x64 :P), d = 1, a = 1

Nvidia max work size = 1024, So I started with this:
ocl_x = 256 ocl_y = 4 ocl_r = 1 123.6
ocl_x = 128 ocl_y = 8 ocl_r = 1 126.2
ocl_x = 64 ocl_y = 16 ocl_r = 1 119.4
ocl_x = 32 ocl_y = 32 ocl_r = 1 121.1
ocl_x = 16 ocl_y = 64 ocl_r = 1 106.7
ocl_x = 8 ocl_y = 128 ocl_r = 1 102.7
ocl_x = 4 ocl_y = 256 ocl_r = 1 97.25

ocl_y = 8 is supreme again apparently.

Then, just for curiousity I tried the other ocl_x parameters but kept ocl_y at 8:
ocl_x = 4 ocl_y = 8 ocl_r = 1 91.12
ocl_x = 8 ocl_y = 8 ocl_r = 1 140.5
ocl_x = 16 ocl_y = 8 ocl_r = 1 141.3
ocl_x = 32 ocl_y = 8 ocl_r = 1 134.3
ocl_x = 64 ocl_y = 8 ocl_r = 1 134.5
ocl_x = 128 ocl_y = 8 ocl_r = 1 126.2

Most of them are much faster! So I started testing ocl_r with the x = 16, y = 8 combination:
ocl_x = 16 ocl_y = 8 ocl_r = 1 141.5
ocl_x = 16 ocl_y = 8 ocl_r = 2 162.5
ocl_x = 16 ocl_y = 8 ocl_r = 3 169.7
ocl_x = 16 ocl_y = 8 ocl_r = 4 171.4
ocl_x = 16 ocl_y = 8 ocl_r = 5 173.5
ocl_x = 16 ocl_y = 8 ocl_r = 6 172.7
ocl_x = 16 ocl_y = 8 ocl_r = 7 173.4
ocl_x = 16 ocl_y = 8 ocl_r = 8 172.1
ocl_x = 16 ocl_y = 8 ocl_r = 9 172.7
ocl_x = 16 ocl_y = 8 ocl_r = 10 170.9
Huge speed increase with the first few ocl_r increases, from around ocl_r = 5 and up it seems to be 'generally the same' and probably in the margin of benchmark-error / variation.

I wanted to see the effect of ocl_r when using all the complete work-size my OpenCL info reports. So testing some more with ocl_x = 128, ocl_y = 8:
ocl_x = 128 ocl_y = 8 ocl_r = 1 126.2
ocl_x = 128 ocl_y = 8 ocl_r = 2 151.2
ocl_x = 128 ocl_y = 8 ocl_r = 3 160.9
ocl_x = 128 ocl_y = 8 ocl_r = 4 165.5
ocl_x = 128 ocl_y = 8 ocl_r = 5 168.4
ocl_x = 128 ocl_y = 8 ocl_r = 6 167.2
ocl_x = 128 ocl_y = 8 ocl_r = 7 167.6
ocl_x = 128 ocl_y = 8 ocl_r = 8 168.8
ocl_x = 128 ocl_y = 8 ocl_r = 9 168.6

ocl_r = 10 gave an error. Probably asking too much or out of memory or something.
I see the same speed increase in the first few ocl_r increases, and again from ocl_r = 5 it seems to reach a good 'max' leaving the rest in 'pretty much the same'-ballpark.
The speed comes very close to ocl_x = 16, ocl_y = 8, ocl_r = 5, but never quite matches it.

Are you looking to find an x/y/r combination sweet spot for all cards, or looking to pick different parameters on different generations + brands of cards? of max memory, or whatever?

For what's it worth, not specifying the parameters gives me 166.2 fps

dipje
7th December 2016, 23:08
Btw, Khanattila, if you say 'Intel i5-4690', do you mean with the gpu on that i5? because If I try to do CPU only (device_type = "CPU") with the benchmark-only version it says "no compatible opencl platforms available"

Atak_Snajpera
7th December 2016, 23:53
install intel opencl runtime and drivers

ShogoXT
8th December 2016, 00:54
He might have the IGPU disabled in his BIOS. Usually its default disabled on custom mobos. You have to go through hoops to enable it along side a normal GPU on Windows 7, but you can have them both enabled fine on Windows 10.

Can use quicksync that way.

dipje
8th December 2016, 08:49
I don't have a iGPU. But cpu type is working with the previous versions. Maybe a x86 / x64 thing.

Anyway , I was asking if he said ' core i5' if that was the CPU or iGPU.

Khanattila
8th December 2016, 12:03
I don't have a iGPU. But cpu type is working with the previous versions. Maybe a x86 / x64 thing.

Anyway , I was asking if he said ' core i5' if that was the CPU or iGPU.

CPU, otherwise I would write HD Graphics 4600 or Haswell(GT2).

Khanattila
8th December 2016, 12:21
@ dipje

Thanks for the informations, they explain why the new version is slower.

ocl_x, ocl_y and olc_r will be set internally by the program. I can read some information from the device such as local memory (L2 cache) and local work size.

dipje
8th December 2016, 20:52
CPU, otherwise I would write HD Graphics 4600 or Haswell(GT2).

So any reason why the 'benchmark only' build will not run CPU mode on my i7-860 but previous versions worked fine?

Or am I confused between my i7-860 and my ui7-2670qm and is it another case of AVX support or something like that.

ShogoXT
9th December 2016, 10:03
Trying to use 1.0.0b1 in regular use in staxrip to see if it can help with some rainbow and dot crawl issues.
How do you use the new channels setting? Wiki only mentions cmode.

Khanattila
9th December 2016, 16:56
Trying to use 1.0.0b1 in regular use in staxrip to see if it can help with some rainbow and dot crawl issues.
How do you use the new channels setting? Wiki only mentions cmode.

channels = {"YUV", "Y", "UV", "RGB", "auto"}.

"auto" is "Y" for YUV colour space and "RGB" for RGB color space.

ShogoXT
10th December 2016, 07:29
Fiddling around with it in Staxrip I found a few things.

With default settings and with d=0 (Temp on or off made no difference), there was significant blurring compared to the older 7.7 version.

See here:
http://screenshotcomparison.com/comparison/193278/picture:0
Its two sets, first is with 1.0b1 vs 7.7, and second with 1.0b1 vs OFF.

Keep in mind this is after it was upsampled and sharpened (awarpsharp2 and LSFMod) a good bit, so the blurring is actually a bit worse before probably (I cant take a pic without LSFMod because id have to redo how havfunc is loaded to make NNedi3 work)

Also with channels = "YUV", although Staxrip doesnt complain, it makes the preview window only show this:
http://imgur.com/mmjCT8e

EDIT: Tried setting all the basic values to 1, but no effect on reducing blur (a,s, and h. Did d as well to play with it)

tormento
12th December 2016, 11:34
I have tested SMDegrain with newer KNLMeansCL on lot of movies during these days.

The final result is an average 3-7% less noise reduction, measured very roughly on bitrate output and visual comparison frame by frame.

Any idea of why? What has changed in newer version that could have so much impact?

Plus: with stable version I can use 8 threads, with beta only 7.

WolframRhodium
12th December 2016, 15:42
I have tested SMDegrain with newer KNLMeansCL on lot of movies during these days.

The final result is an average 3-7% less noise reduction, measured very roughly on bitrate output and visual comparison frame by frame.

Any idea of why? What has changed in newer version that could have so much impact?

Plus: with stable version I can use 8 threads, with beta only 7.

Maybe because "wmode" has changed? For v1.0.0-beta.1, you should set it to 0 (Welsch weighting function), which is used in v0.7.7 by default.

tormento
12th December 2016, 16:20
Maybe because "wmode" has changed? For v1.0.0-beta.1, you should set it to 0 (Welsch weighting function), which is used in v0.7.7 by default.

Uh... is there any doc for newer version? I found nothing in the release zip file, only a changelog on github.

Khanattila
12th December 2016, 17:37
Uh... is there any doc for newer version? I found nothing in the release zip file, only a changelog on github.

v1.0.0-beta.2 will be well documented.

WolframRhodium
12th December 2016, 17:39
Uh... is there any doc for newer version? I found nothing in the release zip file, only a changelog on github.

I'm also looking for official document for new version...

Update: oh the next version will be documented, that's great!