DGDenoise
Re: About DGDenoise
Hybrid must be moving things to dynamic on the fly. Can we get it working without hybrid first? The DGDenoise DLL is definitely being executed from dynamic and I query that, not the location of the viewer. I don't know how hybrid works to tell you what it is doing. It sounds like it copies the DLL to dynamic and runs it from there (makes sense given the name 'dynamic'). If so, it would also have to copy the other files. Maybe you can put all the files there yourself.
For example, I run my scripts in VirtualDub and its executable location is irrelevant, the location of the executed DGDenoise.dll is used. Maybe you can try with VirtualDub and after that we try to figure out hybrid and Vapoursynth.
Thank you for your debugging assistance, Selur!
For example, I run my scripts in VirtualDub and its executable location is irrelevant, the location of the executed DGDenoise.dll is used. Maybe you can try with VirtualDub and after that we try to figure out hybrid and Vapoursynth.
Thank you for your debugging assistance, Selur!
Re: About DGDenoise
*gig* got it normally Hybrid changes the working directory of the environment to restrict malicious programs.
Running the script inside a normal command prompt works.
-> seems like a problem with Hybrid calling the tools (just removing the work directory adjustments I normally to, doesn't help, but I'll figure out a workaround)
Running the script inside a normal command prompt works.
-> seems like a problem with Hybrid calling the tools (just removing the work directory adjustments I normally to, doesn't help, but I'll figure out a workaround)
Re: About DGDenoise
Sweet! Che figata.
You should be able to get hybrid and Vapoursynth working with appropriate engineering. Please advise what you find necessary so I can advise other users. Also, feedback on the actual filtering would be helpful (e.g., versus KNLMeansCL). There are a lot of cool things I can do with this framework, not just denoising. So I'm really grateful for you taking the time to make sure I am shipping what is needed to allow things to work on users' systems. This is my first foray into OpenGL/CUDA runtime stuff (DGIndexNV uses very basic CUDA driver API calls without textures or picture buffer objects). The server framework can allow other filters/applications to invoke the functionality as well. I would have to publish the interface of course. It's pretty simple: start the server, open some shared memory and events, and away you go! I'll release source code at some point. Right now I am focused on surpassing KNLMeansCL for denoising. If that is not possible, why bother?
Technically, I implemented the nVidia imageDenoising sample code (with my tweaks) and enhanced it with Sobel edge protection. It appears to be qualitatively similar to KNLMeansCL (with appropriate parameter settings), but it runs much faster. If I can fully eliminate branching in my kernel, I may be able to squeeze out another 10% in performance, but it's already very fast. To be honest, KNLMeansCL source code is opaque to me. Some better commenting in the code might be helpful.
No need to add, my executables are never malicious. I have ony the users' best interests at heart. You know it.
Thank you again for your testing and may your projects achieve brilliant success!
You should be able to get hybrid and Vapoursynth working with appropriate engineering. Please advise what you find necessary so I can advise other users. Also, feedback on the actual filtering would be helpful (e.g., versus KNLMeansCL). There are a lot of cool things I can do with this framework, not just denoising. So I'm really grateful for you taking the time to make sure I am shipping what is needed to allow things to work on users' systems. This is my first foray into OpenGL/CUDA runtime stuff (DGIndexNV uses very basic CUDA driver API calls without textures or picture buffer objects). The server framework can allow other filters/applications to invoke the functionality as well. I would have to publish the interface of course. It's pretty simple: start the server, open some shared memory and events, and away you go! I'll release source code at some point. Right now I am focused on surpassing KNLMeansCL for denoising. If that is not possible, why bother?
Technically, I implemented the nVidia imageDenoising sample code (with my tweaks) and enhanced it with Sobel edge protection. It appears to be qualitatively similar to KNLMeansCL (with appropriate parameter settings), but it runs much faster. If I can fully eliminate branching in my kernel, I may be able to squeeze out another 10% in performance, but it's already very fast. To be honest, KNLMeansCL source code is opaque to me. Some better commenting in the code might be helpful.
No need to add, my executables are never malicious. I have ony the users' best interests at heart. You know it.
Thank you again for your testing and may your projects achieve brilliant success!
Re: About DGDenoise
btw. there is still something 'fishy' with your code.
using:
gives me
not using 8.3 filenames:
the preview works,...
-> seems like your filter can't handle 8.3 file names
using:
Code: Select all
LoadCPlugin("G:\Hybrid\AVISYN~1\ffms2.dll")
LoadPlugin("G:\Hybrid\AVISYN~1\DGDENO~1.DLL")
# loading source: F:\TestClips&Co\test.avi
FFVideoSource("F:\TESTCL~1\test.avi",cachefile="H:\Temp\avi_0197468a3716844ade54f3f30f60eeda_4827_1_0.ffindex",fpsnum=25)
# denoising using DGDenoise
ConvertToRGB32(interlaced=false)
DGDenoise()
Code: Select all
Avisynth open failure:
DGDenoise: could not start the denoise server C:\Program Files (x86)\VirtualDub\DenoiseServer.exe, error 2!
(H:\Temp\test.avs, line 7)
Code: Select all
LoadCPlugin("G:\Hybrid\avisynthPlugins\ffms2.dll")
LoadPlugin("G:\Hybrid\avisynthPlugins\DGDenoise.dll")
# loading source: F:\TestClips&Co\test.avi
FFVideoSource("F:\TestClips&Co\test.avi",cachefile="H:\Temp\avi_0197468a3716844ade54f3f30f60eeda_4827_1_0.ffindex",fpsnum=25)
# denoising using DGDenoise
ConvertToRGB32(interlaced=false)
DGDenoise()
-> seems like your filter can't handle 8.3 file names
Re: About DGDenoise
Oh, I hate making fishy stuff.
I've been drinking too much Scotch to look into that right now (hey, it's Saturday, give me a break), but I will. Enlighten me, why do you need 8.3 file names?
Any feedback on results versus KNLMeansCL? That's what I'm really interested in.
Ciao, my good friend Selur.
I've been drinking too much Scotch to look into that right now (hey, it's Saturday, give me a break), but I will. Enlighten me, why do you need 8.3 file names?
Any feedback on results versus KNLMeansCL? That's what I'm really interested in.
Ciao, my good friend Selur.
Re: About DGDenoise
I need 8.3 file names because a bunch of Avisynth filters (especially source and subtitle filters) have problems handling for example Chinese, Russian, Korean, Greek,.. characters inside file or folder names.
(btw. DGDecNV and DGindex both can't handle such files, but have no problem with 8.3 file names; mplayer, mencoder and a lot of other older tools have that problem too )
-> no hurry, for you to look into it, just wanted to note that there is something not quite right
(btw. DGDecNV and DGindex both can't handle such files, but have no problem with 8.3 file names; mplayer, mencoder and a lot of other older tools have that problem too )
-> no hurry, for you to look into it, just wanted to note that there is something not quite right
Re: About DGDenoise
No problem, Selur, I'll take care of it for you [it's probably a wart on ShellExecute()]. Rock on and thanks for the great thread!
Re: About DGDenoise
Thanks! Will do some testing with the filter in comparison to KNLMeansCL tomorrow. (9pm here on Saturday -> family&friends time )
Cu Selur
Cu Selur
Re: About DGDenoise
Family and friends time, what a blessing.
Don't ignore kernel=1 if you like things to be as fast as possible. I don't see big image quality gains with NLM over KNN. Most video is well-localized. Prove me wrong.
Don't ignore kernel=1 if you like things to be as fast as possible. I don't see big image quality gains with NLM over KNN. Most video is well-localized. Prove me wrong.
Re: About DGDenoise
Playing around with the filter atm. and the first real downer is that it requires to turn off the MT support.
simply is stuck and
works fine.
On the other hand:
works fine, sure as long as one only uses DGDenoise or KNLMeansCL it doesn't really matter since instead of using MT with mode 5 it's faster to disable MT, but when using a script with multiple filters, MT compatibility would be nice.
----
using:
to compare the effect at the default values of DGDenoise and KNLMeansCL one clearly sees that using the default values DGDenoise is WAY more aggressive.
Settings strength=0.2 seems to produce more similar effects.
Running a small benchmark using AVSMeter:
gives:
with kernel=2 (same strength) I get:
and with kernel = 1 (same strength) I get:
For KNLMeansCL on the other hand:
produces:
so unless kernel=2 is used DGDenoise seems to be faster. From a few samples I looked at so far there wasn't much of a difference between kernel=3 and kernel=1.
(btw. using an i7-4770k with an Intel® HD Graphics 4600 and a GeForce GTX 980 Ti on a HP Z27q 5k display under Windows 10 64bit)
Looking for some nice noisy source to do some more testing.
Cu Selur
Code: Select all
SetMemoryMax(768)
SetMTMode(5,8) # change MT mode
LoadPlugin("G:\Hybrid\avisynthPlugins\LSMASHSource.dll")
LoadPlugin("G:\Hybrid\avisynthPlugins\DGDenoise.dll")
LWLibavVideoSource("F:\TestClips&Co\Transformers - 1080p Sample.mkv",cache=false)
SetMTMode(6) # change MT mode
ConvertToRGB32(interlaced=false)
DGDenoise()
return last
Code: Select all
LoadPlugin("G:\Hybrid\avisynthPlugins\LSMASHSource.dll")
LoadPlugin("G:\Hybrid\avisynthPlugins\DGDenoise.dll")
LWLibavVideoSource("F:\TestClips&Co\Transformers - 1080p Sample.mkv",cache=false)
ConvertToRGB32(interlaced=false)
DGDenoise()
return last
On the other hand:
Code: Select all
SetMTMode(5,8) # change MT mode
LoadPlugin("G:\Hybrid\avisynthPlugins\LSMASHSource.dll")
LoadPlugin("G:\Hybrid\avisynthPlugins\KNLMeansCL.dll")
LWLibavVideoSource("F:\TestClips&Co\Transformers - 1080p Sample.mkv",cache=false)
SetMTMode(5) # change MT mode
KNLMeansCL(device_type = "GPU", device_id = 1)
return last
----
using:
Code: Select all
LoadPlugin("G:\Hybrid\avisynthPlugins\LSMASHSource.dll")
LoadPlugin("G:\Hybrid\avisynthPlugins\KNLMeansCL.dll")
LoadPlugin("G:\Hybrid\avisynthPlugins\DGDenoise.dll")
src = LWLibavVideoSource("F:\TestClips&Co\Transformers - 1080p Sample.mkv",cache=false)
src = src.Crop(0,140,0,-140)
knl = src.KNLMeansCL(device_type="GPU")
knl = knl.ConvertToRGB32(interlaced=false)
src = src.ConvertToRGB32(interlaced=false)
dg = src.DGDenoise()
StackVertical(StackHorizontal(knl, dg), StackHorizontal(src, src))
return last
Settings strength=0.2 seems to produce more similar effects.
Running a small benchmark using AVSMeter:
Code: Select all
LoadPlugin("G:\Hybrid\avisynthPlugins\LSMASHSource.dll")
LoadPlugin("G:\Hybrid\avisynthPlugins\DGDenoise.dll")
LWLibavVideoSource("F:\TestClips&Co\Transformers - 1080p Sample.mkv",cache=false)
ConvertToRGB32(interlaced=true)
DGDenoise(strength=0.2)
return last
Code: Select all
AviSynth 2.60, build:Feb 20 2015 [03:16:45] (2.6.0.5)
Number of frames: 1081
Length (hh:mm:ss.ms): 00:00:45.087
Frame width: 1920
Frame height: 1080
Framerate: 23.976 (24000/1001)
Colorspace: RGB32
Active MT Mode: 0
Frames processed: 1081 (0 - 1080)
FPS (min | max | average): 46.97 | 66.71 | 65.38
Memory usage (phys | virt): 333 | 327 MiB
Thread count: 18
CPU usage (average): 22%
GPU core clock / memory clock: 1025 / 1652
GPU usage (average): 24%
VPU usage (average): 0%
GPU memory usage: 1536 MiB
Time (elapsed): 00:00:16.535
Code: Select all
AviSynth 2.60, build:Feb 20 2015 [03:16:45] (2.6.0.5)
Number of frames: 1081
Length (hh:mm:ss.ms): 00:00:45.087
Frame width: 1920
Frame height: 1080
Framerate: 23.976 (24000/1001)
Colorspace: RGB32
Active MT Mode: 0
Frames processed: 1081 (0 - 1080)
FPS (min | max | average): 8.363 | 16.19 | 15.87
Memory usage (phys | virt): 333 | 328 MiB
Thread count: 15
CPU usage (average): 5%
GPU core clock / memory clock: 1215 / 1753
GPU usage (average): 82%
VPU usage (average): 0%
GPU memory usage: 1536 MiB
Time (elapsed): 00:01:08.105
Code: Select all
AviSynth 2.60, build:Feb 20 2015 [03:16:45] (2.6.0.5)
Number of frames: 1081
Length (hh:mm:ss.ms): 00:00:45.087
Frame width: 1920
Frame height: 1080
Framerate: 23.976 (24000/1001)
Colorspace: RGB32
Active MT Mode: 0
Frames processed: 1081 (0 - 1080)
FPS (min | max | average): 49.52 | 73.35 | 70.73
Memory usage (phys | virt): 333 | 327 MiB
Thread count: 18
CPU usage (average): 23%
GPU core clock / memory clock: 1025 / 1652
GPU usage (average): 19%
VPU usage (average): 0%
GPU memory usage: 1536 MiB
Time (elapsed): 00:00:15.284
Code: Select all
LoadPlugin("G:\Hybrid\avisynthPlugins\LSMASHSource.dll")
LoadPlugin("G:\Hybrid\avisynthPlugins\KNLMeansCL.dll")
LWLibavVideoSource("F:\TestClips&Co\Transformers - 1080p Sample.mkv",cache=false)
KNLMeansCL(device_type = "GPU", device_id = 1)
return last
Code: Select all
AviSynth 2.60, build:Feb 20 2015 [03:16:45] (2.6.0.5)
Number of frames: 1081
Length (hh:mm:ss.ms): 00:00:45.087
Frame width: 1920
Frame height: 1080
Framerate: 23.976 (24000/1001)
Colorspace: i420
Active MT Mode: 0
Frames processed: 1081 (0 - 1080)
FPS (min | max | average): 13.57 | 38.80 | 37.10
Memory usage (phys | virt): 366 | 392 MiB
Thread count: 25
CPU usage (average): 19%
GPU core clock / memory clock: 1215 / 1652
GPU usage (average): 88%
VPU usage (average): 0%
GPU memory usage: 1558 MiB
Time (elapsed): 00:00:29.135
(btw. using an i7-4770k with an Intel® HD Graphics 4600 and a GeForce GTX 980 Ti on a HP Z27q 5k display under Windows 10 64bit)
Looking for some nice noisy source to do some more testing.
Cu Selur
Re: About DGDenoise
Some annoying things:
a. When opening a script with DGDenoise in it in Virtual Dub, then changeing the script and reopeing it with File->Reopen video file.
Virtual Dub crashes. Closing the video and reopening it works.
b. On can't use multiple instances of DGDenoise inside a script: causes Virtual Dub to simply freeze :/
using:
I see some unwanted artifacts:
uploaded the sample denoise test source 1.mkv to my GoogleDrive
Cu Selur
a. When opening a script with DGDenoise in it in Virtual Dub, then changeing the script and reopeing it with File->Reopen video file.
Virtual Dub crashes. Closing the video and reopening it works.
b. On can't use multiple instances of DGDenoise inside a script:
Code: Select all
LoadPlugin("G:\Hybrid\avisynthPlugins\DGDecodeNV.dll")
LoadPlugin("G:\Hybrid\avisynthPlugins\DGDenoise.dll")
# loading&deinterlace h:\Output\denoise test source 1.mkv using DGDECNV
source = DGSource(dgi="H:\Temp\mkv_85a16ff1ce25028b388bb8c47890a490_11840.dgi",deinterlace=1)
# cropping the source
source = source.Crop(0,80,-2,-80)
# denoising using DGDenoise
dg = source.ConvertToRGB32(interlaced=false)
dg04 = dg.DGDenoise(strength=0.4).Subtitle("DGDenoise(strength=0.4)", align=9)
dg08 = dg.DGDenoise(strength=0.8).Subtitle("DGDenoise(strength=0.8)", align=9)
StackHorizontal(dg04,dg08)
return last
using:
Code: Select all
LoadPlugin("G:\Hybrid\avisynthPlugins\DGDecodeNV.dll")
LoadPlugin("G:\Hybrid\avisynthPlugins\DGDenoise.dll")
# loading&deinterlace h:\Output\denoise test source 1.mkv using DGDECNV
source = DGSource(dgi="H:\Temp\mkv_85a16ff1ce25028b388bb8c47890a490_11840.dgi",deinterlace=1)
# cropping the source
source = source.Crop(0,80,-2,-80)
# denoising using DGDenoise
dg = source.ConvertToRGB32(interlaced=false)
dg04 = dg.DGDenoise(strength=0.4).Subtitle("DGDenoise(strength=0.4)", align=9)
#dg08 = dg.DGDenoise(strength=0.8).Subtitle("DGDenoise(strength=0.8)", align=9)
source = source.ConvertToRGB32(interlaced=false).Subtitle("Source", align=9)
StackHorizontal(source,dg04)
return last
uploaded the sample denoise test source 1.mkv to my GoogleDrive
Cu Selur
Re: About DGDenoise
Good morning, Selur. Thanks for your extensive testing. Here are the things you found so far:
1. Short filenames not handled. [FIXED]
2. MT mode problem.
3. Re-open in VirtualDub fails.
4. Cannot have multiple instances per script.
5. Artifacting. [FIXED]
6. Default strength is too high for NLM. [FIXED]
Meanwhile, DGDenoise appears to be about twice as fast as KNLMeansCL, so it seems worthwhile to continue.
1. Short filenames not handled. [FIXED]
2. MT mode problem.
3. Re-open in VirtualDub fails.
4. Cannot have multiple instances per script.
5. Artifacting. [FIXED]
6. Default strength is too high for NLM. [FIXED]
Meanwhile, DGDenoise appears to be about twice as fast as KNLMeansCL, so it seems worthwhile to continue.
Re: About DGDenoise
Maybe mod16 or something similar is needed.
With the crop output resolution is 702x416, so width is only mod2.
With the crop output resolution is 702x416, so width is only mod2.
I know, it's a remainder of a script where I wanted to compare multiple DGDenoise instances with using StackHorizontal/-Vertical calls.BTW, you are converting to RGB32 twice.
Re: About DGDenoise
Interesting. The cropping is causing the artifacts. If you remove the cropping they go away. Should be fixable. Probably some size assumptions in the kernel code.
Re: About DGDenoise
OK, width must be mod 8 because the kernel blocksize is 8. I may be able to remove this limitation. Investigating...
Re: About DGDenoise
I fixed the crop issue by padding out and running the kernel at mod 8, even if the real size is not. No big deal.
I'll look into the other issues before uploading this fix.
I'll look into the other issues before uploading this fix.
Re: About DGDenoise
Selur, I'm not able to reproduce your shortname issue. Here is my script:
loadplugin("d:\don\Programming\C++\dgdecnv\DGDecodeNV\x64\Release\dgdecodenv.dll")
loadplugin("D:\Don\Programming\C++\Avisyn~1\DGDenoise\x64\Release\dgdenoise.dll")
dgsource("D:\Don\Programming\C++\Avisyn~1\DGDenoise\Test\denoise test source 1.dgi",deinterlace=1)
ConvertToRGB32(interlaced=false)
DGDenoise(kernel=1)
There's actually no reason why it shouldn't work, so I think you must have had something else going on. Can you check it again please?
loadplugin("d:\don\Programming\C++\dgdecnv\DGDecodeNV\x64\Release\dgdecodenv.dll")
loadplugin("D:\Don\Programming\C++\Avisyn~1\DGDenoise\x64\Release\dgdenoise.dll")
dgsource("D:\Don\Programming\C++\Avisyn~1\DGDenoise\Test\denoise test source 1.dgi",deinterlace=1)
ConvertToRGB32(interlaced=false)
DGDenoise(kernel=1)
There's actually no reason why it shouldn't work, so I think you must have had something else going on. Can you check it again please?
Re: About DGDenoise
Tried different files to make sure it's not just related to the source.
using:
---------------------------
VirtualDub Error
---------------------------
Avisynth open failure:
DGDenoise: could not start the denoise server C:\Program Files (x86)\VirtualDub\DenoiseServer.exe, error 2!
(C:\Users\Selur\Desktop\test1.avs, line 7)
---------------------------
OK
---------------------------
changing the script to:
script get's opened without a problem.
Not sure it this is related, but I don't have any globally installed Avisynth on my system.
(got an avisynth.dll next to each player which I want to open avisynth scripts)
Cu Selur
using:
Code: Select all
LoadCPlugin("G:\Hybrid\AVISYN~1\ffms2.dll")
LoadPlugin("G:\Hybrid\AVISYN~1\DGDENO~1.DLL")
# loading source: F:\TestClips&Co\test.avi
FFVideoSource("F:\TESTCL~1\test.avi",cachefile="H:\Temp\avi_0197468a3716844ade54f3f30f60eeda_4827_1_0.ffindex",fpsnum=25)
# denoising using DGDenoise
ConvertToRGB32(interlaced=false)
DGDenoise()
return last
VirtualDub Error
---------------------------
Avisynth open failure:
DGDenoise: could not start the denoise server C:\Program Files (x86)\VirtualDub\DenoiseServer.exe, error 2!
(C:\Users\Selur\Desktop\test1.avs, line 7)
---------------------------
OK
---------------------------
changing the script to:
Code: Select all
LoadCPlugin("G:\Hybrid\avisynthPlugins\ffms2.dll")
LoadPlugin("G:\Hybrid\avisynthPlugins\DGDenoise.dll")
# loading source: F:\TestClips&Co\test.avi
FFVideoSource("F:\TestClips&Co\test.avi",cachefile="H:\Temp\avi_0197468a3716844ade54f3f30f60eeda_4827_1_0.ffindex",fpsnum=25)
# denoising using DGDenoise
ConvertToRGB32(interlaced=false)
DGDenoise()
return last
Not sure it this is related, but I don't have any globally installed Avisynth on my system.
(got an avisynth.dll next to each player which I want to open avisynth scripts)
Cu Selur
Re: About DGDenoise
OK, duplicated. I did not have a short name for the filename, just the path. Investigating...
Re: About DGDenoise
I've fixed the short name problem by trying long first and if it fails trying short. I'll upload a new version and then look at the other issues.
Re: About DGDenoise
Nice! Thanks for looking into it.
Re: About DGDenoise
OK, new version uploaded. Fixes:
* Shortnames
* Cropping artifacts
* Default strength for NLM lowered.
The remaining issues are all a result of the current server design. I am looking into moving everything into the filter DLL. Remember when I first started DGDecNV with a server? The old CUVID server!
The nVidia bilateral filter looks nice. I'll probably add it as a kernel.
* Shortnames
* Cropping artifacts
* Default strength for NLM lowered.
The remaining issues are all a result of the current server design. I am looking into moving everything into the filter DLL. Remember when I first started DGDecNV with a server? The old CUVID server!
The nVidia bilateral filter looks nice. I'll probably add it as a kernel.
Re: About DGDenoise
I can confirm that short file names work fine now and that the artifacts are gone
Looking forward to it.I am looking into moving everything into the filter DLL.
Re: About DGDenoise
There's a regression with the cropping stuff. I am going to remove the upload until it is fixed. I may have to enforce mod8 and require you to crop after DGDenoise. No big deal.
Re: About DGDenoise
I re-uploaded it with the regression fixed.
I am going to focus on integrating things into the filter and ditching the server. Still, I'll be happy to receive feedback on the denoising implementation.
I am going to focus on integrating things into the filter and ditching the server. Still, I'll be happy to receive feedback on the denoising implementation.