View Full Version : Alternatives to FFT3DFilter for luma denoising on pictures?
Chainmax
22nd March 2008, 21:09
As amazing as FFT3DFilter is for chroma denoising on pictures, I find the luma denoising to be lacking as it seems to cause artifacting. Can you recommend me something that works as nicely on luma only?
moviefan
22nd March 2008, 21:40
I don't know, if this denoises only luma, but I have made very good experience with "Temporal Degrain" (http://avisynth.org/mediawiki/Temporal_Degrain). It gave me very pleasing results on semi-noisy sources. So give it a try, if you like.
Dark Shikari
22nd March 2008, 21:43
dfttest?
TheRyuu
23rd March 2008, 03:31
dfttest?
that would be my first though.
Chainmax
23rd March 2008, 17:33
It works better than FFT3DFilter, but not by that much. Noise Ninja still does better in that regard.
cestfait
24th March 2008, 17:46
did you try frfun7? frfun3d?
*.mp4 guy
24th March 2008, 21:54
tnlmeans(ax=8, ay=8, sx=16, sy=16, bx=1, by=1, sse=true, a=1, h=12)
h is the strength of denoising, 12 is very high, set it to the lowest levels that removes enough noise. It's a very very slow filter, but the results are better then anything else, given slow enough processing setings (the settings given are quite slow). its one of Triticals plugins.
Didée
24th March 2008, 23:15
It's a very very slow filter, but the results are better then anything else, given slow enough processing setings (the settings given are quite slow).
Oh yeah, TNLMeans ... one of the best unusable filters. Results after tweaking can be very good, but when using "good enough" settings, tweaking takes long, and encoding takes ages.
Feeding PAL 720x576: with the settings you posted, one frame takes me ~2 minutes to render (2.6 GHz singlecore). For a two hours movie, that would be ~250 days to encode. I'm tolerant against slow filtering, but too much is too much.
And when reducing the settings enough to get "competitive" speeds, the results are no more same.
@ Chainmax - didn't you forget to specify what material you're dealing with, what kind of noise there is, etc.? "Something that works as nice as FFT3DFilter" is a highly vague and nebulous question ...
Chainmax
24th March 2008, 23:44
cestfait: I will try those.
*.mp4 guy: I'll try that one as well. Since I'm only processing pictures, filter speed is not an issue at all.
Didée: you're right, my bad. I'll post comparative screenshots with all options mentioned so far as soon as I can.
Thanks for the suggestions so far, if you have more please keep them coming.
*.mp4 guy
25th March 2008, 00:39
Oh yeah, TNLMeans ... one of the best unusable filters. Results after tweaking can be very good, but when using "good enough" settings, tweaking takes long, and encoding takes ages.
Feeding PAL 720x576: with the settings you posted, one frame takes me ~2 minutes to render (2.6 GHz singlecore). For a two hours movie, that would be ~250 days to encode. I'm tolerant against slow filtering, but too much is too much.
And when reducing the settings enough to get "competitive" speeds, the results are no more same.
@ Chainmax - didn't you forget to specify what material you're dealing with, what kind of noise there is, etc.? "Something that works as nice as FFT3DFilter" is a highly vague and nebulous question ...
doesn;t anyone read the thread title.
"Alternatives to FFT3DFilter for luma denoising on pictures?"
That means 1-speed is not important, and 2-no temporal processing; combined that means tnlmeans is the most optimal (can't say best) performing filter for removing uncorrelated noise irregardless of other factors.
R3Z
25th March 2008, 10:37
doesn;t anyone read the thread title.
"Alternatives to FFT3DFilter for luma denoising on pictures?"
That means 1-speed is not important, and 2-no temporal processing; combined that means tnlmeans is the most optimal (can't say best) performing filter for removing uncorrelated noise irregardless of other factors.
If 720x576 takes 2 minutes for one frame, then god help anyone trying a normal digital camera resolution :p
*.mp4 guy
25th March 2008, 13:22
A 1024*768 picture only takes ~1 minute on my computer, and I don't have the fastest machine around by any stretch o the imagination, iirc Didée said he has a prertty dated machine in another thread.
thetoof
25th March 2008, 16:26
For very bad sources with a LOT of luma noise, I use fft3dfilter with specified noise pattern (sigma2/3/4) and plane=0 to create a reference clip for Temporal Degrain and it gives better results than fft3d alone and even dfttest for some sources.
I'll post some screenshots when I get back home.
Terranigma
25th March 2008, 18:06
and even dfttest for some sources.
I'll post some screenshots when I get back home.
And when you compare dfttest, please use tbsize=5 and not 1, along with sbsize 16, and sosize to 8 with U and V set to false. That will make things about even. :)
Socio
26th March 2008, 00:44
tnlmeans(ax=8, ay=8, sx=16, sy=16, bx=1, by=1, sse=true, a=1, h=12)
h is the strength of denoising, 12 is very high, set it to the lowest levels that removes enough noise. It's a very very slow filter, but the results are better then anything else, given slow enough processing setings (the settings given are quite slow). its one of Triticals plugins.
Just for fun I tried it with a dual 3.06 processor rig using MT at a setting h=2 for light denoising and it took about 60 seconds to render a single frame. Granted the results are phenomenal but slow is a understatement.
cestfait
26th March 2008, 01:20
Just for fun I tried it with a dual 3.06 processor rig using MT at a setting h=2 for light denoising and it took about 60 seconds to render a single frame. Granted the results are phenomenal but slow is a understatement.
What was the resolution of the image?
Socio
26th March 2008, 02:19
What was the resolution of the image?
720X480
cestfait
27th March 2008, 05:02
wow. that's a long time.
i just read the paper that tritical links to on his website about this method of denoising, however, and TNL Means looks pretty unbeatable as of now. It makes fourier-weiner (a la fft3d) look pretty weak disregarding time.... ;)
thetoof
29th March 2008, 17:50
I said before that I would post screenshots... here they are!
Original (http://img329.imageshack.us/img329/4344/origiy7.jpg)
For all the filters (except TemporalDegrain), I added FFT3DFilter(sigma=10, plane=3, bw=32, bh=32, bt=5, ow=16, oh=16) before luma denoise to ensure that all the chroma noise was removed.
The settings that Terranigma suggested gave me blocking artifacts and, even after increasing the overlap to 12, my settings below gave better results. Stronger sigma screwed up the image.
dfttest(sigma=7,smode=0,sbsize=5,tbsize=5,u=false,v=false) (http://img255.imageshack.us/img255/5448/dfttestol3.jpg)
I'd never used tnlmeans before, so I tried tweaking all the settings and everything I changed (except a and h) only made it a LOT longer with no visual difference.
tnlmeans(h=8)
(http://img296.imageshack.us/img296/9173/tnlmeanspj5.jpg)
Now, my solution. It's slow, but it's good. What makes it so is that it uses a noise pattern (specified with sigma2/3/4 on luma denoising that must be tweaked to match the pattern of the source; my settings for sigma2/3/4 only work on this source), so the motion vectors are calculated without any noise = optimal quality. Yes, it has some haloing... but that's 'cause I had to use very aggressive settings with fft3d since my source was very crappy. On sources with less noise that match sigma3&4, there is almost none. I tried to create a reference clip with other denoisers, but the advantage of fft3d (noise pattern) beats them all.
source = avisource("source.avi")
pred = FFT3DFilter(source,sigma=40, plane=3, bw=32, bh=32, bt=5, ow=16, oh=16)
denoised = FFT3DFilter(pred,sigma2=6, sigma3=7, sigma4=11, plane=0, bw=32, bh=32, bt=5, ow=16, oh=16)
Temporaldegrain(source, denoised, search=3, pel=2) (http://img442.imageshack.us/img442/6885/temporaldegrainfft3dfilrx4.jpg)
To make it look like the other ones regarding chroma noise, I added this after Temporaldegrain.
FFT3DFilter(sigma=10,sigma2=0, sigma3=4, sigma4=0, plane=3, bw=32, bh=32, bt=5, ow=16, oh=16) (http://img100.imageshack.us/img100/9665/temporaldegrainfft3dfilqi9.jpg)
Using TNLmeans for the reference clip (http://img144.imageshack.us/img144/5736/temporaldegraintnlmeanske9.jpg) also gives nice results, but it's way too slow to be usable. (about 1fpm)
I recommend splitting the script before the extra chroma denoise (i.e. right after Temporal Degrain) with nothing before it (i.e. source+reference+TD) and writing a lossless YV12 pass before adding any other filters and then reload the lossless denoised clip to add more filters (like a sharpener) to decrease total processing time.
Chainmax
29th March 2008, 19:32
Here's what I tried so far:
Noise Ninja:
http://img220.imageshack.us/img220/6474/noiseninjalw4.png
FFT3DFilter @ sigma 15 for chroma + dfttest (sigma=3):
http://img220.imageshack.us/img220/2685/fft15dft3yz8.png (http://imageshack.us)
FFT3DFilter @ sigma 15 for chroma + TNLMeans @ h=4:
http://img220.imageshack.us/img220/2130/fft15tnlmh4sq1.png (http://imageshack.us)
I'll try frfun7 and frfun3d soon.
[edit]I found frfun7_rev6, frfun3b_rev3 and frfun3d_rev1, which ones are you talking about, cestfait?
Archimedes
31st March 2008, 18:51
A quick attempt with FFT3DFilter only (Fritz Photo script).
LoadPlugin("plugins\FFT3DFilter\FFT3DFilter.dll")
LoadPlugin("plugins\MaskTools 1.5.8\MaskTools.dll")
Import("lib\FritzPhoto\FritzPhoto.avs")
# -------------
sigma_y = 5.4
sigma_u = 15.0
sigma_v = 15.0
bw = 24
bh = 24
limit = 0
# -------------
isYV12() ? last : RGBtoYV12()
fft3df(sigma_y, sigma_u, sigma_v, bw, bh, limit)
function fft3df(clip input, float sigma_y, float sigma_u, float sigma_v, int bw, int bh, int limit) {
sigma_y == 0 ? input : input.PointResize(input.Width / 2, input.Height / 2).\
FFT3DFilter(
\ sigma = sigma_y,
\ sigma2 = sigma_y,
\ sigma3 = sigma_y,
\ sigma4 = sigma_y,
\ beta = 1.0,
\ plane = 0,
\ bw = bw,
\ bh = bh,
\ bt = 1,
\ ow = bw/2,
\ oh = bh/2,
\ kratio = 2.0,
\ sharpen = 0.0,
\ scutoff = 0.3,
\ svr = 1.0,
\ smin = 4.0,
\ smax = 20.0,
\ measure = true,
\ interlaced = false,
\ wintype = 0,
\ pframe = 0,
\ px = 0,
\ py = 0,
\ pshow = false,
\ pcutoff = 0.1,
\ pfactor = 0.0,
\ degrid = 1.0,
\ dehalo = 0.0,
\ hr = 2.0,
\ ht = 50.0,
\ ncpu = 1
\ ).\
PointResize(input.Width, input.Height).MergeChroma(input, 1)
LL = string(limit)
STR = "x "+LL+" + y < y "+LL+" - x "+LL+" - y > y "+LL+" + x ? ?"
limit == 0 ? last : yv12lutxy(last, input, yexpr=STR, U=2, V=2)
sigma_u == 0 ? last : last.\
FFT3DFilter(
\ sigma = sigma_u,
\ sigma2 = sigma_u,
\ sigma3 = sigma_u,
\ sigma4 = sigma_u,
\ beta = 1.0,
\ plane = 1,
\ bw = bw,
\ bh = bh,
\ bt = 1,
\ ow = bw/2,
\ oh = bh/2,
\ kratio = 2.0,
\ sharpen = 0.0,
\ scutoff = 0.3,
\ svr = 1.0,
\ smin = 4.0,
\ smax = 20.0,
\ measure = true,
\ interlaced = false,
\ wintype = 0,
\ pframe = 0,
\ px = 0,
\ py = 0,
\ pshow = false,
\ pcutoff = 0.1,
\ pfactor = 0.0,
\ degrid = 1.0,
\ dehalo = 0.0,
\ hr = 2.0,
\ ht = 50.0,
\ ncpu = 1
\ )
sigma_v == 0 ? last : last.\
FFT3DFilter(
\ sigma = sigma_v,
\ sigma2 = sigma_v,
\ sigma3 = sigma_v,
\ sigma4 = sigma_v,
\ beta = 1.0,
\ plane = 2,
\ bw = bw,
\ bh = bh,
\ bt = 1,
\ ow = bw/2,
\ oh = bh/2,
\ kratio = 2.0,
\ sharpen = 0.0,
\ scutoff = 0.3,
\ svr = 1.0,
\ smin = 4.0,
\ smax = 20.0,
\ measure = true,
\ interlaced = false,
\ wintype = 0,
\ pframe = 0,
\ px = 0,
\ py = 0,
\ pshow = false,
\ pcutoff = 0.1,
\ pfactor = 0.0,
\ degrid = 1.0,
\ dehalo = 0.0,
\ hr = 2.0,
\ ht = 50.0,
\ ncpu = 1
\ )
}
FFT3DFilter >> (http://img359.imageshack.us/img359/2382/origiy70640x0480fft3dficq6.png)
Terka
1st April 2008, 10:12
thetoof, how are you tweaking the sigma2,3,4 settings? any hints?
thetoof
3rd April 2008, 21:39
1 - Open several Virtualdubmod windows (I use about 10)
2 - Load your video withFFT3DFilter(sigma=40, plane=3, bw=32, bh=32, bt=5, ow=16, oh=16)
FFT3DFilter(sigma2=0, sigma3=50, sigma4=50, plane=0, bw=32, bh=32, bt=5, ow=16, oh=16) to have only the sigma2 noise.
3 - Create multiple scripts with different values of sigma2 (1,2,3,4,5,etc.)
4 - Choose 3 frames to ensure that the settings you use are good for all your video: Very high (and I mean VERY HIGH) motion/a lot of small detail/still with nice gradients
5 - Compare and choose the one that has absolutely no noise.
6 - Repeat for sigma3 and 4, in that order. When you check for sigma3, use the sigma2 value you found earlier and when you check sigma4, use the values of sigma2/3 you found earlier.
Be careful about:
- Overdenoising sigma3/4... it'll completely screw up your gradients and you'll have ugly stripes of color instead. Values too high by 2-4 for sigma2 are no big deal (it's better if you can find the most appropriate, but it won't be as bad as too high 3/4)
- Using some values you're not sure about (you may need a bit of practice in order to see what the best value for your source is, so if it's too hard with FFT3D alone, use the same method but with TemporalDegrain (that way you'll see the final effect of your denoising)
If it's still to hard to find the good values, you can add a very strong sharpener right after denoising, so if you left some noise, it'll be enhanced and you'll know that you still have to tweak your filters... but that's a "last resort" option imo.
As a reference, my reference clip for the source I posted looks like this (http://img440.imageshack.us/img440/7739/referenceclipai1.jpg).
For the gradients, this is the frame I chose for my source. (light brown to dark brown on the wall) Original (http://img201.imageshack.us/img201/5790/3colorcorrectionvt9.jpg)/Denoised (http://img247.imageshack.us/img247/4993/5chromadenoiseoj2.jpg)
45tripp
4th April 2008, 01:06
1 - Open several Virtualdubmod windows (I use about 10)
you should start using avsp
thetoof
4th April 2008, 03:55
I'm already using it... but I'm so used to vdubmod for previewing that I work faster than with avsp. So yeah, if the latter's better for you, have fun with it!
Terka
5th April 2008, 11:42
thank you. its not an short task. avsp should be useful for this-using sliders
cobo
5th April 2008, 18:45
Now, my solution. It's slow, but it's good. What makes it so is that it uses a noise pattern (specified with sigma2/3/4 on luma denoising that must be tweaked to match the pattern of the source; my settings for sigma2/3/4 only work on this source), so the motion vectors are calculated without any noise = optimal quality. Yes, it has some haloing... but that's cause I had to use very aggressive settings with fft3d since my source was very crappy. On sources with less noise that match sigma3&4, there is almost none. I tried to create a reference clip with other denoisers, but the advantage of fft3d (noise pattern) beats them all.
source = avisource("source.avi")
pred = FFT3DFilter(source,sigma=40, plane=3, bw=32, bh=32, bt=5, ow=16, oh=16)
denoised = FFT3DFilter(pred,sigma2=6, sigma3=7, sigma4=11, plane=0, bw=32, bh=32, bt=5, ow=16, oh=16)
Temporaldegrain(source, denoised, search=3, pel=2) (http://img442.imageshack.us/img442/6885/temporaldegrainfft3dfilrx4.jpg)
When I try this script Avisynth returns the Script error: Temporaldegrain does not have a named argument "search".
thetoof
5th April 2008, 20:12
Oh, right, forgot to mention; TemporalDegrain originally didn't have that function and, after running some tests, search=3 gave me better results than search=2 (default) for my source. So, I added some new functions to the script (nothing has changed in the way it filters, you simply have more options that you can tweak) and I removed everything related to the internal reference clip because I prefer to use my own external denoiser.
search : search decides the type of search at every level,
* search = 0 : 'OneTimeSearch'. searchparam is the step between each vectors tried ( if searchparam is superior to 1, step will be progressively refined ).
* search = 1 : 'NStepSearch'. N is set by searchparam. It's the most well known of the MV search algorithm.
* search = 2 : Logarithmic search, also named Diamond Search. searchparam is the initial step search, there again, it is refined progressively. It's the default search type ( with default searchparam = 2 and default pelsearch = pel )
* search = 3 : Exhaustive search, searchparam is the radius (square side is 2*radius+1). It is slow, but it gives the best results, SAD-wise.
dct: using of block DCT (frequency spectrum) for blocks difference (SAD) calculation. In particular it can improve motion vector estimation at luma flicker and fades.
0 - usual spatial blocks, do not use DCT;
1 - use block DCT instead of spatial data (slow for block size 8x8 and very slow for other sizes);
2 - mixed spatial and DCT data; weight is dependent on mean frame luma difference;
3 - adaptive per-block switching from spatial to equal-weighted mixed mode (experimental, a little faster).
4 - adaptive per-block switching from spatial to mixed mode with more weight of DCT (experimental, a little faster).
Default = 0.
pel : it is the accuracy of the motion estimation. Value can only be 1, 2 or 4. 1 means a precision to the pixel. 2 means a precision to half a pixel, 4 means a precision to quarter a pixel, produced by spatial interpolation (better but slower).
pel was already there, but I'm mentioning it because I use pel=2 for speed issues, but, if it doesn't matter for you, pel=4 often gives better results.
I also changed the default of degrain to 3 and... be careful with dct.
You just have to place the attached .avsi in the "plugins" folder of avisynth, make sure that you use the latest version of the necessary plugins and you're good to go!
If, like me, you prefer using your own reference clip, simply replace your TemporalDegrain with the one attached to this post, but if you think you'll use the original internal reference clip at some point, keep your version of TemporalDegrain and use the attached TemporalDegrainExternal script (with the function TemporalDegrainExternal instead of TemporalDegrain in your script).
@ Terka True, it's not a short task and it took me a long time to figure out what were the appropriate settings for this source (the very first one on which I tried that filter chain), but you can get used to it pretty fast and it can take less than a few minutes to figure out what they are after a while.
Didée
5th April 2008, 20:33
Is your mod based on the Temporaldegrain script that's linked in the Avisynth Wiki? I just noted that that script is broken ... not that it caused artifacts, but it gives only ~50% denoising efficiency, since the 2nd MVDegrain uses wrong idx. That's not what I showed in the original script ... :rolleyes:
thetoof
5th April 2008, 20:57
This is my mod... the idx changes at every step, so I guess it's the good version.
#############################################################################
# Temporal Degrain V1.18b (April 5th, 2008) #
# Function by Sagekilla, original script created by Didée, mod by thetoof #
# #
# Works as a simple temporal degraining function that'll remove MOST grain #
# from video sources, including dancing grain, like the grain found on 300. #
# Is currently capable of utilizing MVDegrain 1, 2, or 3 for degraining #
# Also note, the parameters don't need to be tweaked much. #
# #
# Required plugins: FFT3DFilter.dll / mt_masktools / MVtools.dll #
# HQdn3D.dll / RemoveGrain.dll / Repair.dll #
# #
# FFT3DFilter: http://bag.hotmail.ru/fft3dfilter/fft3dfilter.dhtml #
# mt_masktools: http://manao4.free.fr/mt_masktools.html #
# MVtools: http://avisynth.org.ru/mvtools/mvtools.html #
# RemoveGrain: http://www.removegrain.de.tf/ #
# Repair: See above #
# HQdn3D: http://akuvian.org/src/avisynth/hqdn3d/ #
#############################################################################
########################################################
# Description of functions #
# denoise = Denoised clip for detecting motion vectors #
# pel = MVAnalyse Subpixel accuracy #
# blksize = MVAnalyse block size #
# ov = MVAnalyse block overlap #
# search = MVAnalyse search effort #
# dct = use of DCT for motion vector calculation #
# SAD1 = MVDegrain thSAD #
# SAD2 = MVDegrain thSAD #
# degrain = MVDegrain with 1, 2, or 3 vectors #
# HQ = Additional filtering after MVDegrain #
########################################################
function TemporalDegrain ( clip input, clip "denoise", int "pel", int "blksize", int "ov", int "degrain", int "limit", int "SAD1", int "SAD2", int "HQ", int "search", int "dct" )
{
o = input
pel = default( pel, 2 ) # Higher values increase motion vector quality at the cost of speed
blksize = default( blksize, 8 ) # Higher values are faster, less accurate, and degrain less
ov = default( ov, 4 ) # Increase for better motion vectors but slower speed
degrain = default( degrain, 3 ) # MVDegrain 1, 2 or 3
limit = default( limit, 255 ) # Limits maximum change of a pixel. Default means no limit
SAD1 = default( SAD1, 400 ) # Threshold for degraining. Decrease if you suffer from ghosting
SAD2 = default( SAD2, 300 ) # See above
HQ = default( HQ, 0 ) # Additional filtering after MVDegrain
search = default( search, 2 ) # MVAnalyse search effort
dct = default( dct, 0 ) # Use of DCT for motion vector calculation
# "srch" is a prefiltered clip on which the motion search is done.
srch = denoise
# "spat" is a prefiltered clip which is used to limit the effect of the 1st MV-denoise stage.
spat = denoise
spatD = mt_makediff(o,spat)
# Motion vector search (With very basic parameters. Add your own parameters as needed.)
b3vec = (degrain==3) ?
\ srch.MVAnalyse(isb=true, delta=3, pel=pel, overlap=ov, idx=1, blksize=blksize, dct=dct, search=search) : BlankClip
b2vec = (degrain>=2) ?
\ srch.MVAnalyse(isb=true, delta=2, pel=pel, overlap=ov, idx=1, blksize=blksize, dct=dct, search=search) : BlankClip
b1vec = srch.MVAnalyse(isb=true, delta=1, pel=pel, overlap=ov, idx=1, blksize=blksize, dct=dct, search=search)
f1vec = srch.MVAnalyse(isb=false, delta=1, pel=pel, overlap=ov, idx=1, blksize=blksize, dct=dct, search=search)
f2vec = (degrain>=2) ?
\ srch.MVAnalyse(isb=false, delta=2, pel=pel, overlap=ov, idx=1, blksize=blksize, dct=dct, search=search) : BlankClip
f3vec = (degrain==3) ?
\ srch.MVAnalyse(isb=false, delta=3, pel=pel, overlap=ov, idx=1, blksize=blksize, dct=dct, search=search) : BlankClip
# First MV-denoising stage. Usually here's some temporal-medianfiltering going on.
# For simplicity, we just use MVDegrain.
NR1 = (degrain==3) ? o.MVDegrain3(b1vec,f1vec,b2vec,f2vec,b3vec,f3vec,thSAD=SAD1,idx=2,limit=limit) :
\ (degrain==2) ? o.MVDegrain2(b1vec,f1vec,b2vec,f2vec,thSAD=SAD1,idx=2,limit=limit) :
\ o.MVDegrain1(b1vec,f1vec,thSAD=SAD1,idx=2,limit=limit)
NR1D = mt_makediff(o,NR1)
# Limit NR1 to not do more than what "spat" would do.
DD = mt_lutxy(spatD,NR1D,"x 128 - abs y 128 - abs < x y ?")
NR1x = o.mt_makediff(DD,U=2,V=2)
# Second MV-denoising stage. We use MVDegrain2.
NR2 = (degrain==3) ? NR1x.MVDegrain3(b1vec,f1vec,b2vec,f2vec,b3vec,f3vec,thSAD=SAD2,idx=3,limit=limit) :
\ (degrain==2) ? NR1x.MVDegrain2(b1vec,f1vec,b2vec,f2vec,thSAD=SAD1,idx=3,limit=limit) :
\ NR1x.MVDegrain1(b1vec,f1vec,thSAD=SAD1,idx=3,limit=limit)
NR2 = (HQ==1) ? NR2.HQDn3D(1,1,4,1) : NR2 # Temporal filter to remove last bits of dancing pixels
NR2 = (HQ>=1) ? NR2.HQDn3D(2,1,6,1) : NR2 # A stronger version if the default isn't strong enough.
# Contra-sharpening: sharpen the denoised clip, but don't add more than what was removed previously.
# Here: A simple area-based version with relaxed restriction. The full version is more complicated.
s = NR2.minblur(1,1) # Damp down remaining spots of the denoised clip.
allD = mt_makediff(o,NR2) # The difference achieved by the denoising.
ssD = mt_makediff(s,s.removegrain(11,-1)) # The difference of a simple kernel blur.
ssDD = ssD.repair(allD,1) # Limit the difference to the max of what the denoising removed locally.
ssDD = SSDD.mt_lutxy(ssD,"x 128 - abs y 128 - abs < x y ?") # abs(diff) after limiting may not be bigger than before.
NR2.mt_adddiff(ssDD,U=2,V=2) # Apply the limited difference. (Sharpening is just inverse blurring.)
output = last
return(output)
}
# From Didee's MCBob script
function MinBlur(clip clp, int r, int "uv")
{
uv = default(uv,3)
uv2 = (uv==2) ? 1 : uv
rg4 = (uv==3) ? 4 : -1
rg11 = (uv==3) ? 11 : -1
rg20 = (uv==3) ? 20 : -1
medf = (uv==3) ? 1 : -200
RG11D = (r==1) ? mt_makediff(clp,clp.removegrain(11,rg11),U=uv2,V=uv2)
\ : (r==2) ? mt_makediff(clp,clp.removegrain(11,rg11).removegrain(20,rg20),U=uv2,V=uv2)
\ : mt_makediff(clp,clp.removegrain(11,rg11).removegrain(20,rg20).removegrain(20,rg20),U=uv2,V=uv2)
RG4D = (r==1) ? mt_makediff(clp,clp.removegrain(4,rg4),U=uv2,V=uv2)
\ : (r==2) ? mt_makediff(clp,clp.medianblur(2,2*medf,2*medf),U=uv2,V=uv2)
\ : mt_makediff(clp,clp.medianblur(3,3*medf,3*medf),U=uv2,V=uv2)
DD = mt_lutxy(RG11D,RG4D,"x 128 - y 128 - * 0 < 128 x 128 - abs y 128 - abs < x y ? ?",U=uv2,V=uv2)
clp.mt_makediff(DD,U=uv,V=uv)
return(last)
}
Didée
5th April 2008, 21:28
Yes, that one seems okay.
My concern is just that by now, there are malformed versions out there in the wild, and who knows since how long back ... without a central home for such scripts, that's a problem.
Edit: uploaded fixed versions of TemporalDegrain and TemporalDegrain_beta to the Wiki.
thetoof
5th April 2008, 21:57
Yeah, it'd be nice to have such a place, but I think the wiki does the job... my only question is how the hell did that bad version got there??
Maybe the problem lies in how the scripts are chosen when it's time to put them in the wiki (dunno... there could be some "original author approval" or something like that), but heh, getting off topic.
Archimedes
7th April 2008, 09:53
Let’s do some examples. Here are my attempts with FFT3DFilter, TNLMeans and dfttest.
Original >> (http://img411.imageshack.us/img411/6623/2007072700012th2.jpg)
FFT3DFilter >> (http://img405.imageshack.us/img405/889/20070727000120800x0600fce3.png)
# FFT3DFilter
sigma_y = 8.0
sigma_uv = 14.0
bw = 16
bh = 16
TNLMeans (luma) and FFT3DFilter (chroma) >> (http://img367.imageshack.us/img367/7829/20070727000120800x0600tnj2.png)
# TNLMeans (luma denoising)
Ax = 8
Ay = 8
Sx = 16
Sy = 16
Bx = 1
By = 1
a = 1.0
h = 8
sse = true
# FFT3DFilter (chroma denoising)
sigma_uv = 14.0
bw = 16
bh = 16
dfttest >> (http://img206.imageshack.us/img206/2048/20070727000120800x0600dvp3.png)
# dfttest
sigma_y = 3.9
sigma_uv = 3.9
sbsize = 12
smode = 1
sosize = 9
swin = 0
sbeta = 2.5
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.