Page 1 of 17

Re: About DGDenoise

Posted: Sun Aug 21, 2016 6:17 am
by Selur
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:

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
causes Virtual Dub to simply freeze :/

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
I see some unwanted artifacts:
Image
uploaded the sample denoise test source 1.mkv to my GoogleDrive

Cu Selur

Re: About DGDenoise

Posted: Sun Aug 21, 2016 6:33 am
by admin
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.

Re: About DGDenoise

Posted: Sun Aug 21, 2016 7:06 am
by Selur
Maybe mod16 or something similar is needed.
With the crop output resolution is 702x416, so width is only mod2.
BTW, you are converting to RGB32 twice.
I know, it's a remainder of a script where I wanted to compare multiple DGDenoise instances with using StackHorizontal/-Vertical calls. ;)

Re: About DGDenoise

Posted: Sun Aug 21, 2016 7:08 am
by admin
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

Posted: Sun Aug 21, 2016 7:20 am
by admin
OK, width must be mod 8 because the kernel blocksize is 8. I may be able to remove this limitation. Investigating...

Re: About DGDenoise

Posted: Sun Aug 21, 2016 7:47 am
by admin
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.

Re: About DGDenoise

Posted: Sun Aug 21, 2016 8:49 am
by admin
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?

Re: About DGDenoise

Posted: Sun Aug 21, 2016 9:02 am
by Selur
Tried different files to make sure it's not just related to the source.
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
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

Re: About DGDenoise

Posted: Sun Aug 21, 2016 10:08 am
by admin
OK, duplicated. I did not have a short name for the filename, just the path. Investigating...

Re: About DGDenoise

Posted: Sun Aug 21, 2016 10:18 am
by admin
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

Posted: Sun Aug 21, 2016 10:23 am
by Selur
Nice! Thanks for looking into it. :)

Re: About DGDenoise

Posted: Sun Aug 21, 2016 10:28 am
by admin
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.

Re: About DGDenoise

Posted: Sun Aug 21, 2016 10:38 am
by Selur
I can confirm that short file names work fine now and that the artifacts are gone :) :bravo:
I am looking into moving everything into the filter DLL.
Looking forward to it. :D

Re: About DGDenoise

Posted: Sun Aug 21, 2016 10:47 am
by admin
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

Posted: Mon Aug 22, 2016 10:36 am
by admin
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.

Re: About DGDenoise

Posted: Mon Aug 22, 2016 11:04 am
by Selur
Totally groggy from work today, but will do some testing the next few days. :)

Re: About DGDenoise

Posted: Mon Aug 22, 2016 11:57 am
by admin
Take a break, my friend, you've already done a lot for me.

Re: About DGDenoise

Posted: Tue Aug 23, 2016 2:51 pm
by Selur
btw. did some encodes using DGDenoise on different sources with different strength levels, haven't looked at the results yet, but uploaded the files to my GoogleDrive in the 'denoising' folder if you or someone else wants to look at them.
(will probably encode a few other sources too in the next few days)

Cu Selur

Re: About DGDenoise

Posted: Tue Aug 23, 2016 5:23 pm
by admin
Sweet, thank you, I will have a look.

I made good progress today on ditching the server and integrating everything into the Avisynth filter. I eliminated the use of freeglut/glew (that is, all vestiges of OpenGL), and did everything with a raw CUDA texture. Right now it is still an executable using the CUDA runtime API, but I can move the code right into the filter DLL. That wasn't possible before due to the OpenGL dependency. I haven't decided whether to stick with the CUDA runtime API or switch to the CUDA driver API. It would be simpler to keep the runtime API, but I never tried making a filter using the runtime API. There shouldn't be a problem but we'll see. The only downside is I have to ship cuda*_60.dll, but no big deal.

Re: About DGDenoise

Posted: Tue Aug 23, 2016 5:43 pm
by Guest
Re first two sources
Strength 01
Looks good

Strength 04-05
A little too soft, some loss of detail

Bear in mind my eyes aren't what they used to be and I'm not a whiz at this like you two are
Good work D G, as always

Re: About DGDenoise

Posted: Tue Aug 23, 2016 8:09 pm
by admin
Hi gonca, great to hear from you! And thank you for your testing.

I made the defaults based on the AddGrain(100) call I was using to simulate noise. That's strong grain. I think we can tweak the defaults later based on more real-world stuff. That's why I asked for samples. ;) For now just set the parameters as you need and let me know what you like.

I got the integrated filter working. I just have to make a 32-bit build and then I will release it. We'll say adios to the server and OpenGL. Buh-bye! :lol:

The tradeoff for CUDA runtime versus driver API is that I avoid having to ship a .cubin but have to ship a cudart*.dll. So that's a wash and the easier coding for the runtime API rules.

This infrastructure I have developed opens up a lot of possibilities for GPU filters. If you have any great ideas for GPU-accelerated filters beyond denoising, please speak up. What filters run so slow you want to pull your hair out? You get -10 points if you say QTGMC(); that's a script. Maybe some of the filters it invokes can be accelerated, however.

The whole integrated filter is only ~500 lines of code total (including the Avisynth code and KNN and NLM kernel codes). It's ridiculous how powerful CUDA is. Here's what I have to say to nVidia...
:bravo:

Re: About DGDenoise

Posted: Tue Aug 23, 2016 9:16 pm
by Guest
In terms of filters I would say that you should look first at what filters you use.
They don't have to be "slow" to be improved, and you do have a knack for improving things by making them run on video cards, as your other software.
As far as defaults, I leave that to your judgement, with help from Selur, I am sure the final will be good, and the end user can always tweak a little, if so desired
QTMC is slow, but like you stated, it is a script and not a plugin

If you are willing to help I can set up some avisynth scripts and test the old Clint spaghetti westerns and the Godfather trilogy, all very noisy movies,

Re: About DGDenoise

Posted: Tue Aug 23, 2016 9:46 pm
by admin
@gonca

Thank you for your thoughts and I will help you. Just ask!

@all

I have uploaded the integrated filter version, so re-download DGDenoise.rar and read the instructions carefully. The kernel and sobel parameters are different. Kernel is now 1 or 2 for KNN or NLM. Sobel is now in the range 0 to 1000.

Get rid of the old DenoiseServer.exe, freeglut.dll, glew*.dll, and cudart*_60.dll. You have to put cudart*_75.dll in your DLL search path. I hope you know what that means. :geek:

Re: About DGDenoise

Posted: Tue Aug 23, 2016 10:41 pm
by admin
Don't be shy to play with the sobel parameter. If you reduce it below default you retain more detail, as you can verify with the map option. Try sobel=100 together with a moderate strength (0.5). It works well on a noisy Stones BD. We would like to retain detail on faces but not on backgrounds, but things like that require artificial intelligence beyond the available APIs.

Re: About DGDenoise

Posted: Wed Aug 24, 2016 9:30 am
by Guest 2
Please notice I had to manually download msvcr120d.dll to make it work.

Windows 10 x64 build 14905

I'd like to use DGDenoise as a pre filter to SMDegrain but I get a wrong space color error from it.

How can I convert it back to a format SMDegrain reads?