DGDenoise

These CUDA filters are packaged into DGDecodeNV, which is part of DGDecNV.
User avatar
hydra3333
Moose Approved
Posts: 214
Joined: Wed Oct 06, 2010 3:34 am
Contact:

Re: About DGDenoise

Post by hydra3333 »

If you feel in the mood, would it be possible to make a gpu deblocker ?

Our local OTA stations almost always broadcast our footy games at very blocky mpeg2 576i or infrequently blocky mpeg4 1080i, where the feed has been sourced from a cable provider and horribly mangled for (free TV) re-broadcast at pitifully small bitrates. The OTA stations are finding it hard to survive nowadays, and they wonder why.

In the interregnum (hoping for a new gpu qtgmc) deblocking and denoising and a quick sharpen before re-interlacing, are a must for those sources. I'm hoping for maybe better than 5 fps end-to-end :)

I wonder if maybe it could/should be rolled into the denoiser with say a flag deblock=true and some parameters so that it does a deblock before the denoise whilst the frame(s) are already in the gpu ? Just a thought.
DAE avatar
Sharc
Moose Approved
Posts: 231
Joined: Thu Sep 23, 2010 1:53 pm

Re: About DGDenoise

Post by Sharc »

Colorspace must be YV12 for DGDenoise() and DGSharpen(), right?
User avatar
hydra3333
Moose Approved
Posts: 214
Joined: Wed Oct 06, 2010 3:34 am
Contact:

Re: About DGDenoise

Post by hydra3333 »

I'm not quite sure how to report this or, since it involves vapoursynth whether it means anything useful nor whether you'd consider it, but here goes anyway.

This vs script

Code: Select all

import vapoursynth as vs 
##import havsfunc as haf # http://forum.doom9.org/showthread.php?t=166582 
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 
#---------------------------------------------------------------------------------------------------- 
# INITIALIZE - load the core and then DLLs 
core = vs.get_core(accept_lowercase=True) # leave off threads=8 so it auto-detects threads 
#---------------------------------------------------------------------------------------------------- 
# LOAD NATIVE plugins which aren't already autoloaded (we don't autoload any) 
# 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 
#---------------------------------------------------------------------------------------------------- 
# LOAD 64 bit AVISYNTH  plugins  into the avs namespace 
core.avs.LoadPlugin(r'C:\SOFTWARE\Vapoursynth-x64\DGIndex\DGDecodeNV.dll')  
#---------------------------------------------------------------------------------------------------- 
# NOTE:: INDENTING IS CRITICAL AND MUST BE PRECISELY THE SAME WITHIN EACH FUNCTION  
def main(): 
    #---------------------------------------------------------------------------------------------------- 
    # LOAD VIDEO 1080i
    video = core.avs.DGSource(r'.\z.dgi',deinterlace=1,resize_w=720,resize_h=576) # deinterlace=1 means single rate deinterlacing 
    #video = core.avs.DGDenoise(video,strength=0.25) #  
    #video = core.avs.DGSharpen(video,strength=1.0) # 
    video.set_output() 
    return True 
main() 
with this .bat file

Code: Select all

@echo on
@setlocal ENABLEDELAYEDEXPANSION
@setlocal enableextensions
call :z2 > "%~0.vslog.log" 2>&1
pause
exit
:z2
CALL ".\000-setup-exe-paths.bat"
"C:\SOFTWARE\Vapoursynth-x64\VSPipe.exe" --y4m ".\z.vpy" - | "C:\SOFTWARE\ffmpeg\0-homebuilt-x64\ffmpeg.exe" -threads 0 -i pipe: -threads 0 -an -threads 0 -map_metadata -1 -sws_flags lanczos+accurate_rnd+full_chroma_int+full_chroma_inp -filter:v setdar=dar=16/9 -c:v h264_nvenc -preset hq -bf 2 -g 50 -refs 3 -rc:v constqp -global_quality 22 -profile:v high -level 4.1 -pixel_format yuv420p  -threads 0 -movflags +faststart -y ".\z-temp-h264.MP4"  
goto :eof
works just fine with no odd console messages arising as long as both of the DGDenoise/DGSharpen lines are commented out.

However, if we uncomment either or both then the resulting log (below) shows some strange things,
(i) the prefetch messages alway for the first 199 frames only (other filters don't appear to yield them)
(ii) the "Core freed but 645120 bytes still allocated in framebuffers"
The final .mp4 file still gets created ok as far as I can tell.

Code: Select all

Input #0, yuv4mpegpipe, from 'pipe:':
  Duration: N/A, start: 0.000000, bitrate: N/A
    Stream #0:0: Video: rawvideo (I420 / 0x30323449), yuv420p(progressive), 720x576, 25 fps, 25 tbr, 25 tbn, 25 tbc
Stream mapping:
  Stream #0:0 -> #0:0 (rawvideo (native) -> h264 (h264_nvenc))
Output #0, mp4, to 'D:\TEMP\SCRATCH\Sample0.HD.mpg-temp.MP4':
  Metadata:
    encoder         : Lavf57.66.103
    Stream #0:0: Video: h264 (h264_nvenc) (High) ([33][0][0][0] / 0x0021), yuv420p, 720x576 [SAR 64:45 DAR 16:9], q=-1--1, 2000 kb/s, 25 fps, 12800 tbn, 25 tbc
    Metadata:
      encoder         : Lavc57.82.100 h264_nvenc
    Side data:
      cpb: bitrate max/min/avg: 0/0/2000000 buffer size: 4000000 vbv_delay: -1
frame=    2 fps=0.0 q=0.0 size=       0kB time=00:00:00.00 bitrate=N/A speed=   0x    
Avisynth Compat: requested frame 0 not prefetched, using slow method
Avisynth Compat: requested frame 1 not prefetched, using slow method
Avisynth Compat: requested frame 2 not prefetched, using slow method
Avisynth Compat: requested frame 3 not prefetched, using slow method
Avisynth Compat: requested frame 4 not prefetched, using slow method
Avisynth Compat: requested frame 5 not prefetched, using slow method
Avisynth Compat: requested frame 6 not prefetched, using slow method
Avisynth Compat: requested frame 7 not prefetched, using slow method
Avisynth Compat: requested frame 8 not prefetched, using slow method
Avisynth Compat: requested frame 9 not prefetched, using slow method
Avisynth Compat: requested frame 10 not prefetched, using slow method
Avisynth Compat: requested frame 11 not prefetched, using slow method
Avisynth Compat: requested frame 12 not prefetched, using slow method
Avisynth Compat: requested frame 13 not prefetched, using slow method
Avisynth Compat: requested frame 14 not prefetched, using slow method
Avisynth Compat: requested frame 15 not prefetched, using slow method
Avisynth Compat: requested frame 16 not prefetched, using slow method
Avisynth Compat: requested frame 17 not prefetched, using slow method
Avisynth Compat: requested frame 18 not prefetched, using slow method
Avisynth Compat: requested frame 19 not prefetched, using slow method
Avisynth Compat: requested frame 20 not prefetched, using slow method
Avisynth Compat: requested frame 21 not prefetched, using slow method
Avisynth Compat: requested frame 22 not prefetched, using slow method
Avisynth Compat: requested frame 23 not prefetched, using slow method
Avisynth Compat: requested frame 24 not prefetched, using slow method
Avisynth Compat: requested frame 25 not prefetched, using slow method
Avisynth Compat: requested frame 26 not prefetched, using slow method
Avisynth Compat: requested frame 27 not prefetched, using slow method
Avisynth Compat: requested frame 28 not prefetched, using slow method
Avisynth Compat: requested frame 29 not prefetched, using slow method
Avisynth Compat: requested frame 30 not prefetched, using slow method
Avisynth Compat: requested frame 31 not prefetched, using slow method
Avisynth Compat: requested frame 32 not prefetched, using slow method
Avisynth Compat: requested frame 33 not prefetched, using slow method
Avisynth Compat: requested frame 34 not prefetched, using slow method
Avisynth Compat: requested frame 35 not prefetched, using slow method
Avisynth Compat: requested frame 36 not prefetched, using slow method
Avisynth Compat: requested frame 37 not prefetched, using slow method
Avisynth Compat: requested frame 38 not prefetched, using slow method
Avisynth Compat: requested frame 39 not prefetched, using slow method
Avisynth Compat: requested frame 40 not prefetched, using slow method
Avisynth Compat: requested frame 41 not prefetched, using slow method
Avisynth Compat: requested frame 42 not prefetched, using slow method
Avisynth Compat: requested frame 43 not prefetched, using slow method
Avisynth Compat: requested frame 44 not prefetched, using slow method
Avisynth Compat: requested frame 45 not prefetched, using slow method
Avisynth Compat: requested frame 46 not prefetched, using slow method
Avisynth Compat: requested frame 47 not prefetched, using slow method
Avisynth Compat: requested frame 48 not prefetched, using slow method
Avisynth Compat: requested frame 49 not prefetched, using slow method
Avisynth Compat: requested frame 50 not prefetched, using slow method
Avisynth Compat: requested frame 51 not prefetched, using slow method
Avisynth Compat: requested frame 52 not prefetched, using slow method
Avisynth Compat: requested frame 53 not prefetched, using slow method
Avisynth Compat: requested frame 54 not prefetched, using slow method
Avisynth Compat: requested frame 55 not prefetched, using slow method
Avisynth Compat: requested frame 56 not prefetched, using slow method
Avisynth Compat: requested frame 57 not prefetched, using slow method
Avisynth Compat: requested frame 58 not prefetched, using slow method
Avisynth Compat: requested frame 59 not prefetched, using slow method
Avisynth Compat: requested frame 60 not prefetched, using slow method
Avisynth Compat: requested frame 61 not prefetched, using slow method
Avisynth Compat: requested frame 62 not prefetched, using slow method
Avisynth Compat: requested frame 63 not prefetched, using slow method
Avisynth Compat: requested frame 64 not prefetched, using slow method
Avisynth Compat: requested frame 65 not prefetched, using slow method
Avisynth Compat: requested frame 66 not prefetched, using slow method
Avisynth Compat: requested frame 67 not prefetched, using slow method
Avisynth Compat: requested frame 68 not prefetched, using slow method
Avisynth Compat: requested frame 69 not prefetched, using slow method
Avisynth Compat: requested frame 70 not prefetched, using slow method
Avisynth Compat: requested frame 71 not prefetched, using slow method
Avisynth Compat: requested frame 72 not prefetched, using slow method
Avisynth Compat: requested frame 73 not prefetched, using slow method
Avisynth Compat: requested frame 74 not prefetched, using slow method
Avisynth Compat: requested frame 75 not prefetched, using slow method
Avisynth Compat: requested frame 76 not prefetched, using slow method
Avisynth Compat: requested frame 77 not prefetched, using slow method
Avisynth Compat: requested frame 78 not prefetched, using slow method
Avisynth Compat: requested frame 79 not prefetched, using slow method
Avisynth Compat: requested frame 80 not prefetched, using slow method
Avisynth Compat: requested frame 81 not prefetched, using slow method
Avisynth Compat: requested frame 82 not prefetched, using slow method
Avisynth Compat: requested frame 83 not prefetched, using slow method
Avisynth Compat: requested frame 84 not prefetched, using slow method
Avisynth Compat: requested frame 85 not prefetched, using slow method
Avisynth Compat: requested frame 86 not prefetched, using slow method
Avisynth Compat: requested frame 87 not prefetched, using slow method
Avisynth Compat: requested frame 88 not prefetched, using slow method
Avisynth Compat: requested frame 89 not prefetched, using slow method
Avisynth Compat: requested frame 90 not prefetched, using slow method
Avisynth Compat: requested frame 91 not prefetched, using slow method
Avisynth Compat: requested frame 92 not prefetched, using slow method
Avisynth Compat: requested frame 93 not prefetched, using slow method
Avisynth Compat: requested frame 94 not prefetched, using slow method
Avisynth Compat: requested frame 95 not prefetched, using slow method
Avisynth Compat: requested frame 96 not prefetched, using slow method
Avisynth Compat: requested frame 97 not prefetched, using slow method
Avisynth Compat: requested frame 98 not prefetched, using slow method
Avisynth Compat: requested frame 99 not prefetched, using slow method
Avisynth Compat: requested frame 100 not prefetched, using slow method
Avisynth Compat: requested frame 101 not prefetched, using slow method
Avisynth Compat: requested frame 102 not prefetched, using slow method
Avisynth Compat: requested frame 103 not prefetched, using slow method
Avisynth Compat: requested frame 104 not prefetched, using slow method
Avisynth Compat: requested frame 105 not prefetched, using slow method
Avisynth Compat: requested frame 106 not prefetched, using slow method
Avisynth Compat: requested frame 107 not prefetched, using slow method
Avisynth Compat: requested frame 108 not prefetched, using slow method
Avisynth Compat: requested frame 109 not prefetched, using slow method
Avisynth Compat: requested frame 110 not prefetched, using slow method
Avisynth Compat: requested frame 111 not prefetched, using slow method
Avisynth Compat: requested frame 112 not prefetched, using slow method
Avisynth Compat: requested frame 113 not prefetched, using slow method
Avisynth Compat: requested frame 114 not prefetched, using slow method
Avisynth Compat: requested frame 115 not prefetched, using slow method
Avisynth Compat: requested frame 116 not prefetched, using slow meframe=  125 fps=117 q=21.0 size=    2446kB time=00:00:03.72 bitrate=5385.3kbits/s speed=3.49x    
thod
Avisynth Compat: requested frame 117 not prefetched, using slow method
Avisynth Compat: requested frame 118 not prefetched, using slow method
Avisynth Compat: requested frame 119 not prefetched, using slow method
Avisynth Compat: requested frame 120 not prefetched, using slow method
Avisynth Compat: requested frame 121 not prefetched, using slow method
Avisynth Compat: requested frame 122 not prefetched, using slow method
Avisynth Compat: requested frame 123 not prefetched, using slow method
Avisynth Compat: requested frame 124 not prefetched, using slow method
Avisynth Compat: requested frame 125 not prefetched, using slow method
Avisynth Compat: requested frame 126 not prefetched, using slow method
Avisynth Compat: requested frame 127 not prefetched, using slow method
Avisynth Compat: requested frame 128 not prefetched, using slow method
Avisynth Compat: requested frame 129 not prefetched, using slow method
Avisynth Compat: requested frame 130 not prefetched, using slow method
Avisynth Compat: requested frame 131 not prefetched, using slow method
Avisynth Compat: requested frame 132 not prefetched, using slow method
Avisynth Compat: requested frame 133 not prefetched, using slow method
Avisynth Compat: requested frame 134 not prefetched, using slow method
Avisynth Compat: requested frame 135 not prefetched, using slow method
Avisynth Compat: requested frame 136 not prefetched, using slow method
Avisynth Compat: requested frame 137 not prefetched, using slow method
Avisynth Compat: requested frame 138 not prefetched, using slow method
Avisynth Compat: requested frame 139 not prefetched, using slow method
Avisynth Compat: requested frame 140 not prefetched, using slow method
Avisynth Compat: requested frame 141 not prefetched, using slow method
Avisynth Compat: requested frame 142 not prefetched, using slow method
Avisynth Compat: requested frame 143 not prefetched, using slow method
Avisynth Compat: requested frame 144 not prefetched, using slow method
Avisynth Compat: requested frame 145 not prefetched, using slow method
Avisynth Compat: requested frame 146 not prefetched, using slow method
Avisynth Compat: requested frame 147 not prefetched, using slow method
Avisynth Compat: requested frame 148 not prefetched, using slow method
Avisynth Compat: requested frame 149 not prefetched, using slow method
Avisynth Compat: requested frame 150 not prefetched, using slow method
Avisynth Compat: requested frame 151 not prefetched, using slow method
Avisynth Compat: requested frame 152 not prefetched, using slow method
Avisynth Compat: requested frame 153 not prefetched, using slow method
Avisynth Compat: requested frame 154 not prefetched, using slow method
Avisynth Compat: requested frame 155 not prefetched, using slow method
Avisynth Compat: requested frame 156 not prefetched, using slow method
Avisynth Compat: requested frame 157 not prefetched, using slow method
Avisynth Compat: requested frame 158 not prefetched, using slow method
Avisynth Compat: requested frame 159 not prefetched, using slow method
Avisynth Compat: requested frame 160 not prefetched, using slow method
Avisynth Compat: requested frame 161 not prefetched, using slow method
Avisynth Compat: requested frame 162 not prefetched, using slow method
Avisynth Compat: requested frame 163 not prefetched, using slow method
Avisynth Compat: requested frame 164 not prefetched, using slow method
Avisynth Compat: requested frame 165 not prefetched, using slow method
Avisynth Compat: requested frame 166 not prefetched, using slow method
Avisynth Compat: requested frame 167 not prefetched, using slow method
Avisynth Compat: requested frame 168 not prefetched, using slow method
Avisynth Compat: requested frame 169 not prefetched, using slow method
Avisynth Compat: requested frame 170 not prefetched, using slow method
Avisynth Compat: requested frame 171 not prefetched, using slow method
Avisynth Compat: requested frame 172 not prefetched, using slow method
Avisynth Compat: requested frame 173 not prefetched, using slow method
Avisynth Compat: requested frame 174 not preframe=  251 fps=160 q=21.0 size=    4540kB time=00:00:08.76 bitrate=4245.5kbits/s speed= 5.6x    
frame=  399 fps=193 q=21.0 size=    5847kB time=00:00:14.68 bitrate=3262.8kbits/s speed=7.11x    
frame=  547 fps=213 q=21.0 size=    9643kB time=00:00:20.60 bitrate=3834.7kbits/s speed=8.03x    
frame=  694 fps=226 q=21.0 size=   13581kB time=00:00:26.48 bitrate=4201.4kbits/s speed=8.64x    
frame=  843 fps=236 q=21.0 size=   15008kB time=00:00:32.44 bitrate=3789.9kbits/s speed= 9.1x    
frame=  991 fps=244 q=21.0 size=   16192kB time=00:00:38.36 bitrate=3457.9kbits/s speed=9.44x    
frame= 1137 fps=249 q=21.0 size=   20104kB time=00:00:44.20 bitrate=3726.0kbits/s speed=9.68x    
frame= 1287 fps=254 q=21.0 size=   21961kB time=00:00:50.20 bitrate=3583.8kbits/s speed=9.91x    
frame= 1433 fps=257 q=21.0 size=   25088kB time=00:00:56.04 bitrate=3667.4kbits/s speed=10.1x    
frame= 1577 fps=260 q=21.0 size=   29066kB time=00:01:01.80 bitrate=3852.9kbits/s speed=10.2x    
frame= 1724 fps=263 q=21.0 size=   31617kB time=00:01:07.68 bitrate=3826.9kbits/s speed=10.3x    
frame= 1873 fps=265 q=21.0 size=   34277kB time=00:01:13.64 bitrate=3813.1kbits/s speed=10.4x    
frame= 2021 fps=267 q=21.0 size=   35776kB time=00:01:19.56 bitrate=3683.7kbits/s speed=10.5x    
fetched, using slow method
Avisynth Compat: requested frame 175 not prefetched, using slow method
Avisynth Compat: requested frame 176 not prefetched, using slow method
Avisynth Compat: requested frame 177 not prefetched, using slow method
Avisynth Compat: requested frame 178 not prefetched, using slow method
Avisynth Compat: requested frame 179 not prefetched, using slow method
Avisynth Compat: requested frame 180 not prefetched, using slow method
Avisynth Compat: requested frame 181 not prefetched, using slow method
Avisynth Compat: requested frame 182 not prefetched, using slow method
Avisynth Compat: requested frame 183 not prefetched, using slow method
Avisynth Compat: requested frame 184 not prefetched, using slow method
Avisynth Compat: requested frame 185 not prefetched, using slow method
Avisynth Compat: requested frame 186 not prefetched, using slow method
Avisynth Compat: requested frame 187 not prefetched, using slow method
Avisynth Compat: requested frame 188 not prefetched, using slow method
Avisynth Compat: requested frame 189 not prefetched, using slow method
Avisynth Compat: requested frame 190 not prefetched, using slow method
Avisynth Compat: requested frame 191 not prefetched, using slow method
Avisynth Compat: requested frame 192 not prefetched, using slow method
Avisynth Compat: requested frame 193 not prefetched, using slow method
Avisynth Compat: requested frame 194 not prefetched, using slow method
Avisynth Compat: requested frame 195 not prefetched, using slow method
Avisynth Compat: requested frame 196 not prefetched, using slow method
Avisynth Compat: requested frame 197 not prefetched, using slow method
Avisynth Compat: requested frame 198 not prefetched, using slow method
Avisynth Compat: requested frame 199 not prefetched, using slow method
Output 2052 frames in 8.20 seconds (250.30 fps)
Core freed but 645120 bytes still allocated in framebuffers
Any advice ?
User avatar
admin
Site Admin
Posts: 4449
Joined: Thu Sep 09, 2010 3:08 pm

Re: About DGDenoise

Post by admin »

Good morning hydra3333.

I don't do Vapoursynth. It's obviously related to its support of Avisynth, so my advice is to ask the Vapoursynth author about it and if he says anything that suggests I could do anything (other than make Vapoursynth native versions) that could be helpful for your issue, please let me know.

Regarding your other posts, I will update the document to show the clip parameter and to say that YV12 is expected. Thank you for pointing those out.
User avatar
hydra3333
Moose Approved
Posts: 214
Joined: Wed Oct 06, 2010 3:34 am
Contact:

Re: About DGDenoise

Post by hydra3333 »

Mmm, some googling: am I correct in suggesting it looks as if vapoursynth code needs updating for DGDenoise and DGsharpen ?

edit: good morning and OK I'll post over there. PS thank you.

edit 2: from the looks of this code, Fredrick may possibly ask how many frames before and after that the filters use. What should I reply ?

Code: Select all

#define WARNING(fname, warning) if (name == #fname) vsapi->logMessage(mtWarning, std::string("Avisynth Compat: ") + #fname + " - " + #warning).c_str());
#define BROKEN(fname) if (name == #fname) vsapi->logMessage(mtWarning, ("Avisynth Compat: Invoking known broken function " + name).c_str());
#define OTHER(fname) if (name == #fname) return PrefetchInfo(1, 1, 0, 0);
#define SOURCE(fname) if (name == #fname) return PrefetchInfo(1, 1, 0, 0);
#define PREFETCHR0(fname) if (name == #fname) return PrefetchInfo(1, 1, 0, 0);
#define PREFETCHR1(fname) if (name == #fname) return PrefetchInfo(1, 1, -1, 1);
#define PREFETCHR2(fname) if (name == #fname) return PrefetchInfo(1, 1, -2, 2);
#define PREFETCHR3(fname) if (name == #fname) return PrefetchInfo(1, 1, -3, 3);
#define PREFETCH(fname, div, mul, from, to) if (name == #fname) return PrefetchInfo(div, mul, from, to);

PREFETCHR1(MDegrain1)
PREFETCHR2(MDegrain2)
PREFETCHR3(MDegrain3)

// AutoAdjust
temp = int64ToIntS(vsapi->propGetInt(in, "temporal_radius", 0, &err));
if (err || temp < 0)
    temp = 20;
PREFETCH(AutoAdjust, 1, 1, -temp, temp)
[/size]
User avatar
admin
Site Admin
Posts: 4449
Joined: Thu Sep 09, 2010 3:08 pm

Re: About DGDenoise

Post by admin »

The names are DGDenoise and DGSharpen and they both use only the current frame.

I'm not impressed by an Avisynth import design that requires such hard coding. E.g., I can't ever change my filter name or design? Goofy. :?

If it has to be done that way, any thinking person would make it a text config file that users can alter. But hard-coding it into Vapoursynth? It's some kind of joke.

Why do you think I don't hard code gpus.txt into DGDecNV? Ding, ding, correct! New GPUs can be added without needing a new code release.
User avatar
hydra3333
Moose Approved
Posts: 214
Joined: Wed Oct 06, 2010 3:34 am
Contact:

Re: About DGDenoise

Post by hydra3333 »

:) life is messy, isn't it. My work is like that, many more compromises and workarounds than I'd ever thought possible before working there, however in an operational role "whatever it takes" applies ... figuratively speaking, fiddling with systems and keep them up and going using bits of fencing wire and a pair of pliers http://collections.slsa.sa.gov.au/resource/B+8387

OK, I'd thought DGDenoise was temporal too, sorry, I'll re-read the thread.

Cheers !

PS link to the request: http://www.vapoursynth.com/discussion/#comment-14282 and [link removed]
User avatar
admin
Site Admin
Posts: 4449
Joined: Thu Sep 09, 2010 3:08 pm

Re: About DGDenoise

Post by admin »

DGDenoise is currently spatial but I was considering adding temporal processing. Too bad, I'm locked in now. :facepalm:

I love Aussies. Are you one? If so, we may need a "Super Distinguished Member" category. :D

BTW, I just noticed your blocking filter request. It's already on my list but thank you for the suggestion.
User avatar
hydra3333
Moose Approved
Posts: 214
Joined: Wed Oct 06, 2010 3:34 am
Contact:

Re: About DGDenoise

Post by hydra3333 »

admin wrote:I love Aussies. Are you one? If so, we may need a "Super Distinguished Member" category. :D
So do I, although I married a 10 pound Pom's daughter. A super dummies category is more where I fit :)
Yes, a city bloke ... as a kid raised with every weekend up at an old old shack up the River Murray (we only have one big one river in the South Aus) where you could see the outside from the inside, pinging bunnies with a .22 for dinner, and a one-boy rowboat fishing for fish as tucker for the grandparents. No horse, but an old bike which used to get punctures every 500m from the 3 cornered jacks on the dirt road. You can actually learn to levitate, I did, when about to tread on a brown or tiger joe blake (snake).
This wasn't me (it hung on the shack wall for 30 years) but it may as well have been https://drive.google.com/open?id=0B5RV2 ... WhpcjZnY3M
Oh why not, a relative of mine is in this one https://drive.google.com/open?id=0B5RV2 ... HRZYWtFbDQ
User avatar
admin
Site Admin
Posts: 4449
Joined: Thu Sep 09, 2010 3:08 pm

Re: About DGDenoise

Post by admin »

Ha ha, I love it. Had to google "10 pound pom" because I couldn't believe your wife weighs only 10 pounds.

Rank updated.
DAE avatar
Sharc
Moose Approved
Posts: 231
Joined: Thu Sep 23, 2010 1:53 pm

Re: About DGDenoise

Post by Sharc »

Is the YV12 a CUDA/Nvidia restriction? I am asking because I try to avoid colorspace conversion to YV12 because of the Chroma upsampling and Chroma Interlace Problem.
User avatar
admin
Site Admin
Posts: 4449
Joined: Thu Sep 09, 2010 3:08 pm

Re: About DGDenoise

Post by admin »

What color space are you interested in support for? Typical script?

These filters are designed to be used with DGSource() so obviously I implemented only YV12. That could change, however.
DAE avatar
Sharc
Moose Approved
Posts: 231
Joined: Thu Sep 23, 2010 1:53 pm

Re: About DGDenoise

Post by Sharc »

My tape captures are normally YUV or YUY2, 4:2:0 or 4:2:2. Hmm, now I think to remember that lossless 4:2:2 is not supported by Nvidia .....

Script like:
AviSource(xxxx.avi) #typically interlaced YUY2 4:2:2
bob() #optional
Crop(....)
Resize(....) #optional
addborders(...) #optional
ConverttoYV12() #for DGfilters
DGDenoise().DGSharpen()
separatefields().selectevery(4,0,3).weave() #optional re-interlace - when bobbed before

Then encode with x264 interlaced

Edit:
I am aware that x264 will convert to YV12 anyway, however I thought it would be better - if possible - to keep YUY2 for all the editing and filtering until the last step.
User avatar
admin
Site Admin
Posts: 4449
Joined: Thu Sep 09, 2010 3:08 pm

Re: About DGDenoise

Post by admin »

If your source is interlaced then you have to tell all the following filters for proper handling. So telling DGDenoise() the same via either ConvertToYV12() or directly if I added a parameter would be necessary.

And I would of course have to convert internally if I were to support YUY2 input, and that's why I would need a parameter to tell if the source is interlaced.

So I don't really follow your thinking. You can't get away from telling filters if the source is interlaced/progressive, unless of course you rely on the defaults. But in that case won't ConvertToYV12 default too?

Finally, you have to deinterlace first anyway unless you want trash as output.

Please help me to understand what you ask for here and why, in light of the above. I don't always grok things straightaway.
DAE avatar
Sharc
Moose Approved
Posts: 231
Joined: Thu Sep 23, 2010 1:53 pm

Re: About DGDenoise

Post by Sharc »

I thought leaving the YUY2 4:2:2 colorspace untouched would a priori eliminate certain chroma problems. For example YV12 interlaced needs to be cropped mod4 vertically, whereas YUY2 would accept mod2 cropping without chroma damage, if I am not mistaken.
Maybe it's just a fart as I have to deinterlace or separate the fields anyway for applying most of the filters, and putting converttoYV12(interlaced=true) early in the script is the way to go.
User avatar
admin
Site Admin
Posts: 4449
Joined: Thu Sep 09, 2010 3:08 pm

Re: About DGDenoise

Post by admin »

Sharc wrote:I have to deinterlace or separate the fields anyway for applying most of the filters, and putting converttoYV12(interlaced=true) early in the script is the way to go.
Yes, Sharc, I agree. Let's keep things as is for now. You're right that 4:2:2 support would be useful and I'd certainly want to support it when CUVID does. People are hopeful for nVidia Video SDK 8.0, but it is still awaited. On the other hand, it is only a limitation of CUVID decoding. I could make CUDA 4:2:2 filters. Let's see what nVidia Video SDK 8.0 brings us.
User avatar
admin
Site Admin
Posts: 4449
Joined: Thu Sep 09, 2010 3:08 pm

Re: About DGDenoise

Post by admin »

hydra3333 wrote: This wasn't me (it hung on the shack wall for 30 years) but it may as well have been https://drive.google.com/open?id=0B5RV2 ... WhpcjZnY3M
Oh why not, a relative of mine is in this one https://drive.google.com/open?id=0B5RV2 ... HRZYWtFbDQ
The spirit of adventure and discovery shines. So blessed you are to know such people. I wish they were forum members. :)
DAE avatar
Aleron Ives
Posts: 113
Joined: Fri May 31, 2013 8:36 pm

Re: About DGDenoise

Post by Aleron Ives »

This might be a dumb question, but since you're working on adding new filters, are there any prospects for replicating the functionality of Decomb this way? That's my most-used filter, and getting a CUDA speedup for it would be welcome. I'm not sure how closely related this would be to your recent work on DGBobIM or whether CUDA is even appropriate for this purpose... :?
User avatar
admin
Site Admin
Posts: 4449
Joined: Thu Sep 09, 2010 3:08 pm

Re: About DGDenoise

Post by admin »

Great idea, Aleron! Sure, we could speed up field matching and decimation. Why didn't I think of these obvious things? :scratch: Thank you for the valuable suggestion.

DGBobIM was mostly a proof-of-concept for how screwed up the IMSDK API is. Not exciting to work on that stuff.

BTW, Aussies swim real good. We may have to keep an eye on them.
DAE avatar
Sharc
Moose Approved
Posts: 231
Joined: Thu Sep 23, 2010 1:53 pm

Re: About DGDenoise

Post by Sharc »

Aleron Ives wrote:This might be a dumb question, but since you're working on adding new filters, are there any prospects for replicating the functionality of Decomb this way? That's my most-used filter, and getting a CUDA speedup for it would be welcome. I'm not sure how closely related this would be to your recent work on DGBobIM or whether CUDA is even appropriate for this purpose... :?
+1 for implementing Decomb (especially the FieldMatching/IVTC functionality of telecide() )

P.S.
I also like the show= and debug= options of FieldDeinterlace(), however speed is not critical for visual analysis.
User avatar
gonca
Curly Approved/Moose Approved
Posts: 956
Joined: Sun Apr 08, 2012 6:12 pm

Re: About DGDenoise

Post by gonca »

+1 as well
User avatar
hydra3333
Moose Approved
Posts: 214
Joined: Wed Oct 06, 2010 3:34 am
Contact:

Re: About DGDenoise

Post by hydra3333 »

Thank you, the new gpu based filters work nice.

OK, I did a test or two displaying an interleaved (source,result1,result2) clip in vsedit.
Reasonably clean, if blocky, 15Mb Source: https://drive.google.com/open?id=0B5RV2 ... Hk1UlA5c2c
Card: 750Ti, CPU: i3820 (due for replacement next year; likely a cheapie ryzen 1800X and 1050Ti, not a 1070 though given touted v2's of 1060 and 1080)

Confirming per some other posts eg viewtopic.php?f=8&t=506&start=170#p6074 that the default setting (strength=0.15) for DGDenoise seem to yield a more"softened" visual result compared to KNLMeansCL at defaults (d=1 temporal) at least on my test source. So, easy, use .06 or something.

Sometimes a really old movie can be a bit of a shocker with grain and whatnot and the best thing I've found to date has been the old MDegrain1/2/3 eg
video=MDegrain3i2(video,blksize=8,overlap=4,dct=0)
which I suppose does OK due to temporal processing ?
I haven't such a source to hand to try, so what would be your thoughts re DGDenoise / KNLMeansCL(d=3) / MDegrain for those types of sources ?

I see with interest you considered the possibility of temporal option viewtopic.php?f=8&t=506&start=210#p6137 and then some hesitation viewtopic.php?f=8&t=506&start=220#p6153 and then a possible position of sticking with spatial viewtopic.php?f=8&t=506&start=260#p6253
... I'm hoping the DG density matrix is flagging that gpu temporal denoising still has a significant possibility of a state of existance :) ... no plans for temporal ?
(google gives the words but unfortunately not the intellect to comprehend it).

Just came across the tips from this crowd, although I don't really know what their credentials are
http://www.cineticstudios.com/blog/2015 ... ction.html

vapoursynth x64 shouldn't make any difference, eg

Code: Select all

import vapoursynth as vs 
##import havsfunc as haf # http://forum.doom9.org/showthread.php?t=166582 
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 
core = vs.get_core(accept_lowercase=True) # leave off threads=8 so it auto-detects threads 
# 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 
# LOAD 64 bit AVISYNTH  plugins  into the avs namespace 
core.avs.LoadPlugin(r'C:\SOFTWARE\Vapoursynth-x64\DGIndex\DGDecodeNV.dll')  
def main(): 
    video = core.avs.DGSource(r'.\z.dgi',deinterlace=1,resize_w=720,resize_h=576) # deinterlace=1 means single rate deinterlacing 
    videooriginal = video 
    video1 = core.knlm.KNLMeansCL(video, device_type="gpu", d=1, a=2) 
    video2 = core.avs.DGDenoise(video,strength=0.06)
    #video = core.avs.DGSharpen(video,strength=0.40) # 
    video = core.std.Interleave([core.text.Text(videooriginal, 'Source clip'), core.text.Text(video1, 'LNKMeansCL clip'), core.text.Text(video2, 'DGDenoise clip')])
    video.set_output() 
    return True 
main() 
[/size]
User avatar
admin
Site Admin
Posts: 4449
Joined: Thu Sep 09, 2010 3:08 pm

Re: About DGDenoise

Post by admin »

hydra3333 wrote:Sometimes a really old movie can be a bit of a shocker with grain and whatnot and the best thing I've found to date has been the old MDegrain1/2/3 eg
video=MDegrain3i2(video,blksize=8,overlap=4,dct=0)
which I suppose does OK due to temporal processing ?
I haven't such a source to hand to try, so what would be your thoughts re DGDenoise / KNLMeansCL(d=3) / MDegrain for those types of sources ?
It's not worth speculating about it in the absence of a clip. When you have one to share I would be happy to discuss comparative results.
I see with interest you considered the possibility of temporal option viewtopic.php?f=8&t=506&start=210#p6137 and then some hesitation viewtopic.php?f=8&t=506&start=220#p6153 and then a possible position of sticking with spatial viewtopic.php?f=8&t=506&start=260#p6253
... I'm hoping the DG density matrix is flagging that gpu temporal denoising still has a significant possibility of a state of existance :) ... no plans for temporal ?
I've asked several times for a clip that clearly shows the benefits of temporal processing, either alone or in conjunction with spatial processing. Do you have one? That is what I would need to find the motivation to do something temporally. Meanwhile, there is always TemporalSoften(). My personal perspective (which can be altered by evidence) is that ghosting is anathema that I would avoid like the plague in the absence of palpable overriding considerations. Yeah, yeah, scene change detection. But not every frame is a scene change while it can still be full of motion, and hence ghosting. Please refute my view with some evidence, i.e., a clip.

If you want to consider motion compensation to combat ghosting, that's perfectly valid. But that has to wait for my CUDA motion estimation stuff.

DG density matrix. That's clever. Not everyone will grok it, though, especially with negative off-diagonal terms.
Just came across the tips from this crowd, although I don't really know what their credentials are
http://www.cineticstudios.com/blog/2015 ... ction.html
It's just warmed-over wives' tales, aka, conventional "wisdom", justifying some commercial product recommendations. I can't take seriously an article that provides a tip on noise reduction that advises to add noise. :facepalm:

Monty Python video enhancement algorithm:

1. Remove noise.
2. Add noise.

That tip is there only to push some commercial tools. The tip to prefer temporal processing is also just a push for a commercial denoiser. They conveniently neglect to mention ghosting. And it's strange that not a single image is given to support anything they say.
DAE avatar
Sharc
Moose Approved
Posts: 231
Joined: Thu Sep 23, 2010 1:53 pm

Re: DGDenoise

Post by Sharc »

I am getting ugly artefacts (broad diagonal color stripes) with chroma=true in DGDenoise.
My source is interlaced video. I separate the fields before applying the filter. Unless I am missing something you should be able to duplicate the issue with any source clip.
User avatar
admin
Site Admin
Posts: 4449
Joined: Thu Sep 09, 2010 3:08 pm

Re: DGDenoise

Post by admin »

Yikes! I'll get on it this morning. Thanks for the report.
Post Reply