Log in

View Full Version : QTGMC+TemporalDegrain2


ErazorTT
4th February 2021, 01:34
Dear all,

there have been requests in include TemopralDegrain2 into QTGMC. And since TD2 is indeed is build around a QTGMC-core this is in fact a feasable task.

More information about TemporalDegrain2:here (https://forum.doom9.org/showthread.php?t=175798)

Obviously the idea is now to bring the degraining capabilities of TD2 into the deinterlacing capabilities of QTGMC.

I have not contacted the author of QTGMC and thus don't have his approval for doing thus but here is a very first version of this merge: here (https://drive.google.com/file/d/17izVhFhStI65X4e-l48RG1057QS661Ou/view?usp=sharing)

This thing is basically in early alpha stage. Also I appear to not have even a single interlaced test clip in my home, so perhaps someone could point me to a good clip. That clip should be also somehow grainy or noisy.

ErazorTT
4th February 2021, 02:33
Notes on QTGMC mainly to myself, or to very knowlage people:
- the TV-range conversion of the search clip is done at a slightly different place in the code in QTGMC as compared to TD2: after spatial bluring vs before spatial blurring, does is matter at all, if yes which is better, if no why?
- increasing TR0 seems very slightly detrimental to the degraining, but stabilizes the image when grain is very bad
- searchParam for search algorithms is most probably just plain wrong in QTGMC for search=4 and 5
- the gauss parameter might be slightly too strong, might be hiding some subtile movements which would lead to washed out regions, thats why in TD2 its 3 instead of 2
- it is not possible to degrain just only chroma in QTGMC
- the autotuning might be extended
- in case of high bit input, the srch clip does not need to be high bits as well, converting it early to 8 bits would improve speed
- for low bit input it is not possible to switch the fft functions to high bits, which would prevent banding
- check usage of thSAD2 in denoising

a typical call for the degraining in this QTGMC release would be:
QTGMC(InputType=1, NoisePreset="Fast", DenoiseMC=true, DegrainTR=2, EZDenoise=2, ChromaNoise=true, SrchClipPP=3, TR0=0, TR1=0, TR2=0, SearchParam=16)
this should match this call to TD2 exactly:
TemporalDegrain2(degrainTR=2,postFFT=1,postSigma=2,postDither=0,grainLevel=true,DCT=0,gaussParam=2)
- EZDenoise plays the role of what sigma was for TD2
- SrchClipPP is basically grainLevel
- SearchParam must be 16 or 24
- TR0 must be 0

real.finder
4th February 2021, 03:34
- the TV-range conversion of the search clip is done at a slightly different place in the code in QTGMC as compared to TD2: after spatial bluring vs before spatial blurring, does is matter at all, if yes which is better, if no why?


it should be after the prefiltering, since maybe not all blurring filters can work with TV range properly, at least this is how it was done in SMDegrain

kedautinh12
4th February 2021, 05:34
I think you need pull requests to real.finder here:
https://github.com/realfinder/AVS-Stuff/pulls

ErazorTT
5th February 2021, 21:33
it should be after the prefiltering, since maybe not all blurring filters can work with TV range properly, at least this is how it was done in SMDegrain

I don't understand that argumentation, since the conversion I'm talking about does TV->PC for the vector search clip. So you argument would mean that it should indeed be before prefiltering.

real.finder
11th June 2021, 17:08
I did try to look at it, I think it's not ok, since it do denoise in interlaced clip

anyway I did try to add this to last update of qtgmc https://pastebin.com/dSd1MZTb (didn't do something about denoise interlaced clip though)

lollo2
23rd September 2021, 13:44
I used QTGMC with TD2 denoise on my interlaced video. The result is bad:
https://mega.nz/file/NJVzXQQa#RyAFCbjrpSHpFmAAdUJEYBPOICh1E1bnuhp2nWu60dw

This is the original s-vhs capture:
https://mega.nz/file/YFEHAQJB#DWKtZJkG_YIx9q-FQZNDQZBHtpe9mkoRIB3sTyKWTFI

This is my (very simple) AviSynth script:

# interlaced fields TFF
# QTGMC: Deinterlacer

video_org=AviSource("C:\Users\giuse\Videos\Acquisizioni\rai3_amtv_v2.avi")

# trimming
# trim_start=0
# trim_end=1189
#video_org_trim=video_org.trim(trim_start,trim_end)
video_org_trim=video_org #.ConvertToYV16(interlaced=true).Histogram("levels")

# cropping
crop_left=8 # | rimozione esatta delle bande nere sinistra, sopra, destra e del disturbo sotto
crop_top=4 # | 720-(8+22)x576-(4+10)=690x562
crop_right=22
crop_bottom=10
video_org_trim_crop=video_org_trim.crop(crop_left,crop_top,-crop_right,-crop_bottom)

# plugins directory
plugins_dir="C:\Users\giuse\Documents\VideoSoft\MPEG\AviSynth\extFilters\"

# QTGMC
# https://forum.doom9.org/showthread.php?p=1935157#post1935157
# Import("C:\Users\giuse\Documents\VideoSoft\MPEG\AviSynth\extFilters_update\QTGMC+TemporalDegrain2\QTGMC-4.001.avsi")
# https://forum.doom9.org/showthread.php?p=1944772#post1944772
Import("C:\Users\giuse\Documents\VideoSoft\MPEG\AviSynth\extFilters_update\QTGMC+TemporalDegrain2\QTGMC e.avsi")
# Zs_RF_Shared
Import(plugins_dir + "Zs_RF_Shared.avsi")
Import("C:\Users\giuse\Documents\VideoSoft\MPEG\AviSynth\extFilters_update\QTGMC+TemporalDegrain2\Zs_RF_Shared.avsi")
# MaskTools2
loadPlugin(plugins_dir + "masktools2-v2.2.23\x86\masktools2.dll")
# RgTools
loadPlugin(plugins_dir + "RgTools-v1.0\x86\RgTools.dll")
# MVTools
loadPlugin(plugins_dir + "mvtools-2.7.41-with-depans20200430\x86\mvtools2.dll")
# FFT3DFilter
loadPlugin(plugins_dir + "FFT3dFilter-v2.6\x86\fft3dfilter.dll")
# FFTW
loadPlugin(plugins_dir + "LoadDll\LoadDll.dll")
loadDll(plugins_dir + "fftw-3.3.5-dll32\libfftw3f-3.dll")
# Nnedi3
loadPlugin(plugins_dir + "NNEDI3_v0_9_4_55\x86\Release_W7\nnedi3.dll")

### de-interlacing and denoising
# https://forum.doom9.org/showthread.php?p=1935165#post1935165
# a typical call for the degraining in this QTGMC release would be:
# QTGMC(InputType=1, NoisePreset="Fast", DenoiseMC=true, DegrainTR=2, EZDenoise=2, ChromaNoise=true, SrchClipPP=3, TR0=0, TR1=0, TR2=0, SearchParam=16)
# this should match this call to TD2 exactly:
# TemporalDegrain2(degrainTR=2,postFFT=1,postSigma=2,postDither=0,grainLevel=true,DCT=0,gaussParam=2)
# - EZDenoise plays the role of what sigma was for TD2
# - SrchClipPP is basically grainLevel
# - SearchParam must be 16 or 24
# - TR0 must be 0
deinterlaced=video_org_trim_crop.AssumeTFF().ConvertToYV16()\
.QTGMC(NoisePreset="Fast",DenoiseMC=true,DegrainTR=2,EZDenoise=2,ChromaNoise=true,SrchClipPP=3,TR0=0,TR1=0,TR2=0,SearchParam=16)\
.ConvertToYUY2()
### add borders
deinterlaced_borders=deinterlaced.addborders(crop_left,crop_top,crop_right,crop_bottom)

return(deinterlaced_borders)


When I apply QTGMC and TD2 separatley I obtain this, but it looks "over-processed" to me, so I hoped that the TD2 integration inside QTGMC could look better because it avoids the double denoising:
https://www.youtube.com/watch?v=m1J6exEWMi4

I noticed that the function "ContraSharpeningHD" has changed in latest (V1.154) Zs_RF_Shared.avsi, so I had to also load my old version (V1.121). Not sure if it can be an issue...

real.finder
23rd September 2021, 14:52
I noticed that the function "ContraSharpeningHD" has changed in latest (V1.154) Zs_RF_Shared.avsi, so I had to also load my old version (V1.121). Not sure if it can be an issue...
just replace ContraSharpeningHD with ContraSharpening, and it's not an issue, the issue as I said https://forum.doom9.org/showpost.php?p=1944772&postcount=6 it's the idea itself since it do denoise in interlaced clip

lollo2
23rd September 2021, 15:15
Ok, I see.

The last time I read your post it was:
"I did try to look at it, I think it's not ok, since it do denoise in deinterlaced clip"
so I did not understand;
now it has been edited to:
"do denoise in interlaced clip"
so it's clear.

Will wait for a future release then ;)

real.finder
23rd September 2021, 15:31
Ok, I see.

The last time I read your post it was:
"I did try to look at it, I think it's not ok, since it do denoise in deinterlaced clip"
so I did not understand;
now it has been edited to:
"do denoise in interlaced clip"
so it's clear.

Will wait for a future release then ;)

yes, I don't know how I write it that way :eek: thanks to you I did note it, also the idea of ErazorTT can be corrected but don't rely on me about it, at least for now

the best scenario will be ErazorTT back and fix it himself :)