View Full Version : TemporalDegrainV2
poisondeathray
26th August 2020, 18:40
The problem with only separating fields, then applying a filter is the even/odd field offset (Even/odd scanlines). Temporal filtering is not ideal when each subsequent field goes up/down
The problem with separating fields then grouping even/odd to be filtered separately is you don't get temporal filtering across fields. This can introduce temporal inconsistency
The other approach is to double rate deinterlace then filter, and possibly reinterlace - but then you have to deinterlace
Each approach has pros/cons
Cary Knoop
26th August 2020, 20:05
The other approach is to double rate deinterlace then filter, and possibly reinterlace - but then you have to deinterlace
You are right that is the better, way.
Personally I would use the following in case of "interlaced" processing of a filter:
c = core.yadifmod.Yadifmod(c, order=1 if tff else 0, mode=1, edeint=core.nnedi3.nnedi3(c, field=3 if tff else 2, nns=0))
c = Filter(c)
c = core.std.DoubleWeave(c, tff=tff)[::2]
Tima
30th August 2020, 21:23
Thanks!
Looking at the QTGMC code, the best way would be to incorporate TemporalDegrain2 denoising as one of the methods into QTGMC pipeline.
I wonder, how hard would it be.
Cary Knoop
30th August 2020, 21:34
Thanks!
Looking at the QTGMC code, the best way would be to incorporate TemporalDegrain2 denoising as one of the methods into QTGMC pipeline.
I wonder, how hard would it be.
It's a bit of a catch-22, because in order to do a good temporal denoising you would want to deinterlace first. :)
I usually denoise first, and then call QTGMC with a very low sigma as I do not like a deinterlace filter deliver a denoised clip.
Tima
30th August 2020, 23:05
QTGMC does a very good job on extracting MV from the interlaced clip.
It's much better than you can achieve with TD2, because it uses QTGMC MV extraction simplified for the progressive input case (and pre-deinterlacing with stuff like Yadif seems suboptimal).
As for denoising, QTGMC seem to use just the last (postFFT) part from the TD2 pipeline, without 2-stage MDegrain part.
My point is that TD2 borrows MV part from QTGMC -- maybe it's time to contribute the denoising from TD2 to QTGMC :)
VoodooFX
31st August 2020, 00:49
There is few deal breaking visual bugs with TD2. Some kind of ugly artifacts before scene change, and some "special effects" introduced around "flicker" frame. Every time I tried it I noticed one or another, that's why I never used it for actual encode.
kedautinh12
19th September 2020, 06:44
I moded temporaldegrain2 replaced fft3dfilter, dfttest, to neo-fft3d, neo-dfttest. Let's waiting for him comback
https://github.com/kedaitinh12/AVSPlus-Plugins/blob/master/TemporalDegrain-v2.2.1MOD.avsi
kedautinh12
19th September 2020, 10:58
Forgot, use mod ver with neo-fft3d and neo-dfttest here:
https://forum.doom9.org/showpost.php?p=1923091&postcount=153
magnetite
25th September 2020, 19:46
Something I noticed while using this plugin was there was no staggered denoising. You can denoise all planes, but I don't think there's a way to denoise luma a little bit, and chroma a lot, and vice versa.
ErazorTT
2nd February 2021, 03:46
QTGMC does a very good job on extracting MV from the interlaced clip.
It's much better than you can achieve with TD2, because it uses QTGMC MV extraction simplified for the progressive input case (and pre-deinterlacing with stuff like Yadif seems suboptimal).
As for denoising, QTGMC seem to use just the last (postFFT) part from the TD2 pipeline, without 2-stage MDegrain part.
My point is that TD2 borrows MV part from QTGMC -- maybe it's time to contribute the denoising from TD2 to QTGMC :)
Yeah, TD2 was only thought for progressive clips. And yes, probably all this should actually be integrated into QTGMC. Will probably need to contact QTGMCs author for that. BTW: just push a new update. Cheers.
ErazorTT
2nd February 2021, 03:48
Forgot, use mod ver with neo-fft3d and neo-dfttest here:
https://forum.doom9.org/showpost.php?p=1923091&postcount=153
Ok will look at it. Have too yet see what neo improved over the originals.
kedautinh12
2nd February 2021, 08:57
Ok will look at it. Have too yet see what neo improved over the originals.
It's old. New ver neo here:
https://github.com/HomeOfAviSynthPlusEvolution
And here:
https://forum.doom9.org/showthread.php?t=181294
kedautinh12
2nd February 2021, 09:01
FFT3dGPU now support > 8 bit
https://github.com/pinterf/FFT3dGPU
ErazorTT
2nd February 2021, 12:18
FFT3dGPU now support > 8 bit
https://github.com/pinterf/FFT3dGPU
ok, done
ErazorTT
2nd February 2021, 13:39
It's ole. New ver neo here:
https://github.com/HomeOfAviSynthPlusEvolution
And here:
https://forum.doom9.org/showthread.php?t=181294
yeah ok, so the advantage is the support of AVX2? I am asking because I see that the "old" versions are also still maintained.
Anyhow, I just added them in v2.2.5.
ErazorTT
2nd February 2021, 15:07
There is few deal breaking visual bugs with TD2. Some kind of ugly artifacts before scene change, and some "special effects" introduced around "flicker" frame. Every time I tried it I noticed one or another, that's why I never used it for actual encode.
Perhaps you will find time to be more specific?
kedautinh12
2nd February 2021, 17:53
Thanks for your update
VoodooFX
4th February 2021, 12:46
Perhaps you will find time to be more specific?
First bug: Glitch on frames before some scene changes. I think parts of a scene change frame appears in the previous frames (bigger tr - more previous frames affected). This one I noticed many times.
Second bug: Around a "flicker" frame. I think like when one(few?) frame has sudden change in brightness then result is kinda slowmo "flicker" effect. This one I noticed only the few times.
ErazorTT
4th February 2021, 23:51
Well I just checked again with degrainTR up to 5 (which is way too much for any 24fps clip, you never should need more than 3) and neither at flicker frames nor at scene chnages have I experianced that. :confused:
joearmstrong
5th February 2021, 11:33
Maybe the same issue I noticed:
It's a general problem using any temporal filter: There are inaccuracies in fast scene changes - they are a bit noisier than the other frames. With radius 1 there is 1 frame before/after noisier, with radius 3 there are 3 frames before/after noisier, etc. Using a spatial filter instead of a temporal one solves the issue, but that's not a solution for me.
I know it's a natural effect specific to the end and beginning of a scene. Probably many people don't notice it - but I notice it when watching the encoded video on my screen - is there any possibility to fix or reduce this temporal related issue?
The described "flicker" effect I cannot confirm.
tormento
5th February 2021, 13:02
Maybe the same issue I noticed
With temporal denoise, on scene change, you can't define a "before" frame span. Thus the denoising is strongly affected. I don't even know if there could be a possile fix.
joearmstrong
5th February 2021, 13:15
I thought so. Then I shoud probably deal with spatial denoising because of the disturbing noisier scene changes. Or is there a better alternative?
VoodooFX
5th February 2021, 20:28
Well I just checked again with degrainTR up to 5 (which is way too much for any 24fps clip, you never should need more than 3) and neither at flicker frames nor at scene chnages have I experianced that. :confused:
My bad that I didn't made screens and samples, I thought that you are not active on it anymore, I'll try to do some tests.
When I tested the issue it appeared with any TR, it was not like joearmstrong described.
Now that I think about it, maybe it's coincidence, both issues appeared on the "black-and-white" clips.
real.finder
5th February 2021, 20:37
Maybe the same issue I noticed:
It's a general problem using any temporal filter: There are inaccuracies in fast scene changes - they are a bit noisier than the other frames. With radius 1 there is 1 frame before/after noisier, with radius 3 there are 3 frames before/after noisier, etc. Using a spatial filter instead of a temporal one solves the issue, but that's not a solution for me.
I know it's a natural effect specific to the end and beginning of a scene. Probably many people don't notice it - but I notice it when watching the encoded video on my screen - is there any possibility to fix or reduce this temporal related issue?
The described "flicker" effect I cannot confirm.
SMDegrain has mfilter parameter for these cases
joearmstrong
6th February 2021, 13:49
SMDegrain has mfilter parameter for these cases
I tested SMDegrain with mfilter parameter but I didn't notice an improvement - during some fast scene changes I tested the problem remains the same.
Maybe I am doing something wrong? What would be a recommended setting for the mfilter parameter to improve scene changes?
tormento
6th February 2021, 13:58
SMDegrain has mfilter parameter for these cases
One though just blinked in my mind... and if on scene change we could apply temporal filter on reverse stream? Such as a Tenet movie, if you watched it... Lot of decoders are capable of frame accurate rendering, could you think about the feasibility of it?
real.finder
6th February 2021, 16:14
What would be a recommended setting for the mfilter parameter to improve scene changes?
don't know how you use it but just feed it with spatial filter clip you talk about
Using a spatial filter instead of a temporal one solves the issue, but that's not a solution for me.
I know it's a natural effect specific to the end and beginning of a scene.
so it will be like Spatio-Temporal Denoiser, it will give you the best of the 2
joearmstrong
6th February 2021, 19:16
don't know how you use it but just feed it with spatial filter clip you talk about
so it will be like Spatio-Temporal Denoiser, it will give you the best of the 2
Not working for me. I'm using this script:
pre=neo_vd ()
SMDegrain(RefineMotion=true, lsb=true, Contrasharp=false, prefilter=2, mfilter=pre, blksize=16,truemotion=false, plane=0, chroma=false)
Using spatial filter neo_vd (Neo Vague Denoiser) only results in correct scene changes. Using it in SMDegrain with mfilter introduces the noisier scene changes issue.
real.finder
6th February 2021, 21:28
Not working for me. I'm using this script:
pre=neo_vd ()
SMDegrain(RefineMotion=true, lsb=true, Contrasharp=false, prefilter=2, mfilter=pre, blksize=16,truemotion=false, plane=0, chroma=false)
Using spatial filter neo_vd (Neo Vague Denoiser) only results in correct scene changes. Using it in SMDegrain with mfilter introduces the noisier scene changes issue.
then try use http://avisynth.nl/index.php/RemoveDirt#SCSelect with it
org=last
pre=neo_vd ()
SMDegrain(RefineMotion=true, lsb=true, Contrasharp=false, prefilter=2, mfilter=pre, blksize=16,truemotion=false, plane=0, chroma=false)
org.SCSelect(pre, pre, last)
joearmstrong
6th February 2021, 22:00
then try use http://avisynth.nl/index.php/RemoveDirt#SCSelect with it
org=last
pre=neo_vd ()
SMDegrain(RefineMotion=true, lsb=true, Contrasharp=false, prefilter=2, mfilter=pre, blksize=16,truemotion=false, plane=0, chroma=false)
org.SCSelect(pre, pre, last)
Unfortunately that didn't work either. The frames concerned are now even noisier than before.
My Knowledge so far: Using just a spatial denoiser doesn't worsen the quality of scene changes. Using a temporal denoiser results in some noisier frames during scene changes.
ErazorTT
7th February 2021, 11:58
If I may enter the discussion here. I have checked the worst of all grainy film (300) and there at scene changes I must say that, yeah perhaps there is a very slight increase of remaining grain but I doubt this will be seen when not at 400% zoom.
So please also just try this:
TemporalDegrain2(degrainTR=2)
or even
TemporalDegrain2(degrainTR=3)
With increasing TR the degraining capability increases but the impact of scene changes decreases. So 3 cleans more than 2 which cleans more than 1 but the impact of a scene change is pretty strong for 1 less so for 2 and only minor for 3.
So to be very much independent of scene changes you could use 3. Then perhaps there might be too much cleaning for your taste, but in this case you could then mix some of the original back into the resulting clip, like that:
TemporalDegrain2(degrainTR=3, postMix=25) [postMix was broken before release 2.3.0 so you'd need to grab this newest one]
Meaning that 25% of the original will be mixed with 75% of the filtered result.
I am just looking at scene changes here and not at what VoodooFX discribed as "flicker" frames. These singular flicker frames basically represent 2 scene changes, one just before and one just after that fliker frame. These will be always very hard to deal with. There is simply not enough information to figure out if the things shown are grain, noise, or actually part of the image. Only way there would be a neuronal network which was trained on the noise during the movie and which is then applied to these singular frames. I have no idea but this sounds a lot like what I just described: http://www.avisynth.nl/users/vcmohan/NeuralNet/NeuralNet.html
StainlessS
7th February 2021, 19:44
I saw people using ScSelect in this thread, and it prompted me to make and post this mod.
(I was never a big fan of ScSelect, it makes too many false detect mistakes)
EDIT: Script removed.
Moved to thread here:- https://forum.doom9.org/showthread.php?t=182392
Tenkei
19th February 2021, 13:54
I wanted to point that FFT3DGPU requires mode to be 1 to utilize ow and oh. Also precision should be set to 2 to match the CPU version. According to the author, ow must be even but that won't be the case when grainLevel is set to 1.
One more thing, I don't think multiplying ppSAD1 and ppSAD2 when DCT=5 is a good idea. With default setting I noticed a huge banding and artifacts on scene change. The colors are also inaccurate. Using different grainLevels didn't help.
It got better when I removed the multiplication code. See:
https://i.postimg.cc/F7fLrXT8/Source.pngSource (https://postimg.cc/F7fLrXT8)
https://i.postimg.cc/XrdB5cSg/Default.pngDefault settings (https://postimg.cc/XrdB5cSg)
https://i.postimg.cc/3dPDWf6R/No-Multiplier.pngDefault settings with no multiplier (https://postimg.cc/3dPDWf6R)
VoodooFX
22nd February 2021, 02:06
With default setting I noticed a huge banding and artifacts on scene change.
Does those artifacts propagate into frames before scene change?
Roemer
12th March 2021, 16:07
First of all: Many thanks for your script!
I am although running in an issue:
I need to use TemporalDegrain2 multiple times and it throws an exception about "Multiple QTGMC Calls". I found out that QTGMC provides an option to pass the name of the variables it should us or that it should reuse the existing variables. Is there anyway to pass that to your script as your script internally uses TemporalDegrain2?
Thanks for help.
lollo2
12th March 2021, 18:19
I did the following in TemporalDegrain-v2.2.1.avsi:
# changed
# from ReplaceGlobals = false
# to ReplaceGlobals = true
# to solve QTGMC error "Multiple calls to QTGMC, set PrevGlobals="Replace" or read documentation on 'Multiple QTGMC Calls'"
kedautinh12
12th April 2021, 01:32
new ver of hqdn3d support HBD: https://github.com/Asd-g/hqdn3d
kedautinh12
5th July 2021, 06:28
ExTools now can replace MaskTools2 for improve speed in HBD
https://github.com/Dogway/Avisynth-Scripts/blob/master/ExTools.avsi
kedautinh12
3rd August 2021, 05:01
New port filter from Vapoursynth BM3D CPU and GPU ver
https://github.com/WolframRhodium/VapourSynth-BM3DCUDA/issues/7#issuecomment-886173346
StainlessS
3rd August 2021, 14:13
kedautinh12,
You seem to have missed hqdn3d update [v1.0.1] 3 days after [15 April 21] your post #187,
link in kedautinh12 post #187.
kedautinh12
3rd August 2021, 14:35
kedautinh12,
You seem to have missed hqdn3d update [v1.0.1] 3 days after [15 April 21] your post #187,
link in kedautinh12 post #187.
I only share link for ErazorTT when he online he will catch it. I got last ver when Asd-g released it
kedautinh12
9th August 2021, 03:15
As I could observe BM3D is better at motion estimation and probably also at denoising.
kedautinh12
17th August 2021, 11:32
fmtconv available avs+ now, maybe replace dither
https://forum.doom9.org/showthread.php?t=183139
kedautinh12
2nd September 2021, 18:35
I moded TemporalDegrain2 use BM3D, details in description
https://github.com/kedaitinh12/AVSPlus-Plugins/blob/master/TemporalDegrain-v2.3.1MOD.avsi
Still waiting for ErazorTT :D
coolgit
11th September 2021, 02:23
TemporalDegrain2(degrainTR=1, postFFT=4, postSigma=2, fftThreads=8) produce a slight shift in colour and weird frame blending during 1st and last frame of scene changes.
The orange/brown colour not suppose to be there.
VoodooFX
11th September 2021, 02:57
Upload those images to imgur or you'll wait forever for approval. :)
Sangen
12th September 2021, 16:42
I wonder why it takes so long for approval here
Boulder
13th September 2021, 18:02
Sometimes the best way to get them approved is to report the post and ask for the approval :)
coolgit
13th October 2021, 13:49
Changed the links as post 195 is still pending approval.
https://i.ibb.co/NFc0VbY/001029.jpg
https://i.ibb.co/ZhBmqwP/001030.jpg
baka1
24th October 2021, 08:35
Impressed with the denoiser!
https://slow.pics/c/Q4culaDS
Raw BD vs TR1 vs TR2
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.