Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > Capturing and Editing Video > Avisynth Development
Register FAQ Calendar Today's Posts Search

Reply
 
Thread Tools Search this Thread Display Modes
Old 23rd July 2015, 09:11   #221  |  Link
LouieChuckyMerry
Registered User
 
LouieChuckyMerry's Avatar
 
Join Date: Feb 2014
Posts: 356
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:

Code:
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:

Quote:
: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 .
LouieChuckyMerry is offline   Reply With Quote
Old 23rd July 2015, 09:23   #222  |  Link
Groucho2004
 
Join Date: Mar 2006
Location: Barcelona
Posts: 5,034
Try adding device_type = "GPU" to KNLMeansCL.
Groucho2004 is offline   Reply With Quote
Old 23rd July 2015, 13:37   #223  |  Link
LouieChuckyMerry
Registered User
 
LouieChuckyMerry's Avatar
 
Join Date: Feb 2014
Posts: 356
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...
LouieChuckyMerry is offline   Reply With Quote
Old 23rd July 2015, 13:38   #224  |  Link
Khanattila
Registered User
 
Khanattila's Avatar
 
Join Date: Nov 2014
Posts: 440
Quote:
Originally Posted by LouieChuckyMerry View Post
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:

Code:
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.

Last edited by Khanattila; 23rd July 2015 at 14:13.
Khanattila is offline   Reply With Quote
Old 23rd July 2015, 14:45   #225  |  Link
LouieChuckyMerry
Registered User
 
LouieChuckyMerry's Avatar
 
Join Date: Feb 2014
Posts: 356
Quote:
Originally Posted by Khanattila View Post
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 is offline   Reply With Quote
Old 26th July 2015, 07:23   #226  |  Link
LouieChuckyMerry
Registered User
 
LouieChuckyMerry's Avatar
 
Join Date: Feb 2014
Posts: 356
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) the call

Code:
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:

Code:
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).

Any suggestion would be much appreciated.
LouieChuckyMerry is offline   Reply With Quote
Old 26th July 2015, 07:39   #227  |  Link
foxyshadis
Angel of Night
 
foxyshadis's Avatar
 
Join Date: Nov 2004
Location: Tangled in the silks
Posts: 9,559
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_bi..._with_Avisynth has more details on how to work with stacked 16-bit video.

Last edited by foxyshadis; 26th July 2015 at 07:42.
foxyshadis is offline   Reply With Quote
Old 26th July 2015, 09:17   #228  |  Link
LouieChuckyMerry
Registered User
 
LouieChuckyMerry's Avatar
 
Join Date: Feb 2014
Posts: 356
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, 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:

Code:
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:

Code:
KNLMeansCL(Lsb_InOut=True,Device_Type="GPU")
was causing problems. However, with the information from your reply:

Code:
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 . 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")?

Last edited by LouieChuckyMerry; 26th July 2015 at 10:23.
LouieChuckyMerry is offline   Reply With Quote
Old 26th July 2015, 09:40   #229  |  Link
Groucho2004
 
Join Date: Mar 2006
Location: Barcelona
Posts: 5,034
Quote:
Originally Posted by LouieChuckyMerry View Post
Does this means that SMDegrain has been spoiling me the entire time I've been using it?
Spoiling?
Groucho2004 is offline   Reply With Quote
Old 26th July 2015, 10:27   #230  |  Link
LouieChuckyMerry
Registered User
 
LouieChuckyMerry's Avatar
 
Join Date: Feb 2014
Posts: 356
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")?
LouieChuckyMerry is offline   Reply With Quote
Old 26th July 2015, 10:53   #231  |  Link
Groucho2004
 
Join Date: Mar 2006
Location: Barcelona
Posts: 5,034
Quote:
Originally Posted by LouieChuckyMerry View Post
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:

Code:
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.
Groucho2004 is offline   Reply With Quote
Old 26th July 2015, 11:45   #232  |  Link
LouieChuckyMerry
Registered User
 
LouieChuckyMerry's Avatar
 
Join Date: Feb 2014
Posts: 356
Quote:
Originally Posted by Groucho2004 View Post
DGSource can only provide 8 bit format so you have to convert it to stacked first:

Code:
DGSource()
Dither_convert_8_to_16()
Thank you. It seems really obvious once I see it.


Quote:
Originally Posted by Groucho2004 View Post
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 is offline   Reply With Quote
Old 27th July 2015, 06:15   #233  |  Link
LouieChuckyMerry
Registered User
 
LouieChuckyMerry's Avatar
 
Join Date: Feb 2014
Posts: 356
Hello . The following script runs without issue:

Code:
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:

Code:
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 .

Last edited by LouieChuckyMerry; 27th July 2015 at 07:01.
LouieChuckyMerry is offline   Reply With Quote
Old 27th July 2015, 10:03   #234  |  Link
foxyshadis
Angel of Night
 
foxyshadis's Avatar
 
Join Date: Nov 2004
Location: Tangled in the silks
Posts: 9,559
Quote:
Originally Posted by LouieChuckyMerry View Post
Does this means that SMDegrain has been spoiling me the entire time I've been using it?
Yup. 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.
foxyshadis is offline   Reply With Quote
Old 28th July 2015, 11:06   #235  |  Link
Groucho2004
 
Join Date: Mar 2006
Location: Barcelona
Posts: 5,034
Quote:
Originally Posted by LouieChuckyMerry View Post
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:
Code:
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

Last edited by Groucho2004; 28th July 2015 at 14:05.
Groucho2004 is offline   Reply With Quote
Old 28th July 2015, 15:20   #236  |  Link
feisty2
I'm Siri
 
feisty2's Avatar
 
Join Date: Oct 2012
Location: void
Posts: 2,633
Quote:
Originally Posted by Groucho2004 View Post
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
feisty2 is offline   Reply With Quote
Old 28th July 2015, 15:32   #237  |  Link
Reel.Deel
Registered User
 
Join Date: Mar 2012
Location: Texas
Posts: 1,666
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.
Reel.Deel is offline   Reply With Quote
Old 28th July 2015, 15:49   #238  |  Link
Groucho2004
 
Join Date: Mar 2006
Location: Barcelona
Posts: 5,034
Quote:
Originally Posted by Reel.Deel View Post
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.

Last edited by Groucho2004; 28th July 2015 at 16:02.
Groucho2004 is offline   Reply With Quote
Old 28th July 2015, 15:56   #239  |  Link
cretindesalpes
͡҉҉ ̵̡̢̛̗̘̙̜̝̞̟̠͇̊̋̌̍̎̏̿̿
 
cretindesalpes's Avatar
 
Join Date: Feb 2009
Location: No support in PM
Posts: 712
Quote:
Originally Posted by Reel.Deel View Post
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
__________________
dither 1.28.1 for AviSynth | avstp 1.0.4 for AviSynth development | fmtconv r30 for Vapoursynth & Avs+ | trimx264opt segmented encoding
cretindesalpes is offline   Reply With Quote
Old 28th July 2015, 15:57   #240  |  Link
Groucho2004
 
Join Date: Mar 2006
Location: Barcelona
Posts: 5,034
Quote:
Originally Posted by HolyWu View Post
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.
Groucho2004 is offline   Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 20:07.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.