Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion. Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules. Domains: forum.doom9.org / forum.doom9.net / forum.doom9.se |
|
|
#1 | Link |
|
Confused
Join Date: Apr 2003
Location: Euroland
Posts: 2,820
|
Advanced Denoising [Two new functions from mf]
Ok, here are two new functions from mf:
Code:
# MotionThresh by mf
# Simple scenechange-proof motion threshold
# Tile outputs 16x16 clip for speed
# Use tile=true for conditional filtering, tile=false for masking
function MotionThresh(clip input, float thresh, bool "tile") {
tile = Default(tile, false)
black = BlankClip(input, width=16, height=16)
white = BlankClip(input, width=16, height=16, color=$FFFFFF)
cond1 = ConditionalFilter(input, white, black, "YDifferenceFromPrevious()", "greaterthan", String(thresh))
cond2 = ConditionalFilter(input, white, black, "YDifferenceToNext()", "greaterthan", String(thresh))
Overlay(cond1, cond2, mode="darken")
tile ? last : PointResize(input.width, input.height)
}
Code:
# MotionRamp by mf
# Average motion soft-thresholding based on 5 thresholds
# Dependancies: MotionThresh, BlendMulti
function MotionRamp(clip input, int thresh1, int thresh2, int thresh3, int thresh4, int thresh5, int "min", int "max", int "floor", int "ceil", int "radius", bool "tile") {
min = Default(min, 0)
max = Default(max, 255)
floor = Default(floor, 0)
ceil = Default(ceil, 255)
radius = Default(radius, 2)
tile = Default(tile, false)
input
BlendMulti(MotionThresh(thresh1, tile=true), MotionThresh(thresh2, tile=true), MotionThresh(thresh3, tile=true), MotionThresh(thresh4, tile=true), MotionThresh(thresh5, tile=true))
TemporalSoften(radius,255,0,255,2)
Levels(floor, 1, ceil, min, max)
ColorYUV(levels="TV->PC")
tile ? last : PointResize(input.width, input.height)
}
Code:
# Example:
# More Motion -> More Denoising via FFT3DFilter
Input=Last
Input
MotionRamp(5,10,15,20,25,Max=255,Tile=True)
MotionRamp=Last
Input
ScriptClip("Overlay(Last,Input,Opacity=AverageLuma(MotionRamp)/100)")
ScriptClip("FFT3DFilter(Sigma=(AverageLuma(MotionRamp)/2/2/2/2))")
Code:
# Example:
# More Noise -> More Denoising via FFT3DFilter
Input=Last
Deen("a2d",3,10,10)
Subtract(Last,Input)
Levels(120,1,137,0,255)
MotionRamp(5,10,15,20,25,Max=255,Tile=True)
MotionRamp=Last
Input
#ScriptClip("Subtitle(String(Round(AverageLuma(ramp))))")
ScriptClip("Overlay(Last,Input,Opacity=AverageLuma(MotionRamp)/100)")
ScriptClip("FFT3DFilter(Sigma=(AverageLuma(MotionRamp)/2/2/2/2))")
Btw, the BlendMulti plugin can be found here... Have fun ~Bye Last edited by Soulhunter; 26th February 2007 at 15:58. |
|
|
|
|
|
#4 | Link |
|
Registered User
Join Date: Jun 2006
Posts: 260
|
Wow, sounds great! Now the n00b question to understand this better. In your first example, what would be the minimum and maximum possible values for Sigma?
Code:
FFT3DFilter(Sigma=(AverageLuma(motionramp)/2/2/2/2)) |
|
|
|
|
|
#5 | Link |
|
Angel of Night
![]() Join Date: Nov 2004
Location: Tangled in the silks
Posts: 9,549
|
0 to 16, by the math, but in practice it would probably never get that high.
One error I notice in that line is that while sigma is a float, the division will give you an integer, losing a lot of precision... it should be something like sigma=(AverageLuma(motionramp)/16.0) |
|
|
|
|
|
#6 | Link |
|
Confused
Join Date: Apr 2003
Location: Euroland
Posts: 2,820
|
It was just a example to demonstrate how to make use of mfs scripts... of coz you can use whatever you like! Btw, you see a way to make a nice fast dll out of MotionThresh/MotionRamp? Maybe we can speed stuff up a little bit by using optimized code and/or using a different method to generate the values for the denoiser... :]
Bye Last edited by Soulhunter; 26th February 2007 at 15:55. |
|
|
|
|
|
#9 | Link |
|
Registered User
Join Date: Apr 2002
Location: Germany
Posts: 5,407
|
*cough* FMF & QMF by HomieFR *cough*
__________________
- We´re at the beginning of the end of mankind´s childhood - My little flickr gallery. (Yes indeed, I do have hobbies other than digital video!) |
|
|
|
|
|
#10 | Link |
|
Confused
Join Date: Apr 2003
Location: Euroland
Posts: 2,820
|
Links plz! :P
Can only find posts on some french board... >.> Actualy the board MarcFD used to hang around, lol! Tia n' Bye Last edited by Soulhunter; 6th April 2007 at 01:18. |
|
|
|
|
|
#11 | Link |
|
Confused
Join Date: Apr 2003
Location: Euroland
Posts: 2,820
|
Ok, found a link to a zip with a HomieFR.dll plus a french readme...
What does the DLL? Spitting out motion values? Is it faster than mf's script? Tia n' Bye |
|
|
|
|
|
#12 | Link |
|
Registered User
Join Date: Sep 2005
Location: 100011110010001000001 10000011111111000001
Posts: 221
|
I think Didée refers to the script contained inside the "Advanced conditional filtering: part III" section of the ConditionalFilter 's Avisynth docs page.
__________________
AVSLib, a free extension library for Avisynth. Current version: 1.1.0 (beta), 14/05/2007. [ Home page | Download page ] |
|
|
|
|
|
#13 | Link | ||
|
Super Moderator
![]() Join Date: Nov 2001
Location: Netherlands
Posts: 6,390
|
@gzarkadas,
It looks like someone converted the idea of QMF into a plugin. It's the first time i see that plugin though. @all, Did anyone try this plugin and compared it to the script? Does anyone know who the author is of the plugin? @soulhunter, Quote:
Quote:
|
||
|
|
|
|
|
#14 | Link |
|
Confused
Join Date: Apr 2003
Location: Euroland
Posts: 2,820
|
Oh, I see... Thanks for the hint! :] Seems its similar to the "More Motion -> More Denoising" example I posted... Just that it works with just 3 motion levels [low, mid, high] instead of 256, and it picks one of 3 filter methods based on this instead of adjusting a filters strength, right?
EDIT: Missed Wilberts reply... ^^ Thx n' Bye |
|
|
|
|
|
#16 | Link |
|
Registered User
Join Date: Apr 2002
Location: Germany
Posts: 5,407
|
Indeed I was thinking of this thread, dating back in 2003, so the idea in itself is not exactly new.
Generally, I'm not too convinced by the method. It's the old game of making a basic temporal evaluation of a basic spatial measurement. This leaves, generally, the old problem of making a reliable distinction between "noise", "detail", and "motion". Did a few (very quick) tests several weeks ago. It seems that for the idea of "more motion -> more filtering" it works out for the most part. Still, I see a problem when parts of the frame a low motion, and parts of the frame have high or changing motion: if, e.g., the left part of a frame changes from low to high motion, then the whole frame will be treated as being of higher motion, where only the left half should. That's the point I also mentioned to HomiE in the early stages of QFM. The idea of "adapt filter strength to changing noise levels" I could not find practical at all. With methods similar to Soulhunter's suggestion, the whole thing is way more sensible to changing motion than it is to changing noise. In effect, if I tried to raise filter strength with increasing noise, the whole frame changed from sharp to overfiltered as soon as a static scene started to move by even very slight slight camera pan. A no-go. My attitude stays the same: "measuring" and distincting-between noise/detail or detail/motion is not that easy. Trying to to that measurement by "simple" means is not reliable. For more reliable results, the usage of slow motion vector search is hardly to avoid. Of course ... if you want to use a weak FFT3D(sigma=0.9) for low motion/low noise, and a strong sledgehammer like FFT3D(sigma=1.1) for high motion/high noise, then it works perfectly. ![]() Edit: BTW, the functions could be simplified & sped up quite a bit. A pity that mf still doesn't like masktools too much, as it seems.
__________________
- We´re at the beginning of the end of mankind´s childhood - My little flickr gallery. (Yes indeed, I do have hobbies other than digital video!) |
|
|
|
|
|
#17 | Link |
|
Angel of Night
![]() Join Date: Nov 2004
Location: Tangled in the silks
Posts: 9,549
|
So basically, put the output of mvmask(kind=0) through a few different luts to create masks for the weights each filter should have on the output? Sounds simple enough, the trick mainly being determining the cutoffs. Two maskedmerges in a row shouldn't cause much roundoff error. It shouldn't be any slower than motionramp, might be faster. Masking probably doesn't need to be extremely accurate, unless you happen to be Didée or Chainmax, so you could get away with a rather faster mvanalyse.
|
|
|
|
![]() |
|
|