Log in

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


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

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.