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.

 

Go Back   Doom9's Forum > Capturing and Editing Video > Avisynth Usage

Reply
 
Thread Tools Search this Thread Display Modes
Old 16th January 2011, 16:48   #321  |  Link
SilaSurfer
Registered User
 
SilaSurfer's Avatar
 
Join Date: Oct 2009
Posts: 212
Quote:
Originally Posted by Didée View Post
The Question is - what are the apples, and what are the oranges?
It's a form of expression.

Quote:
Originally Posted by Didée View Post
In which way should it be stronger? Is it that FluxSmooth isn't strong enough (is there still residual flicker of low spatial frequencies)? Or is it that too much grain is in the output? If it's the latter - the whole purpose of this script is to not touch grain at all, and to calm down only the low spatial frequencies.
I'm fully aware this script is meant for removing LF flicker effect and not grain. So Fluxsmooth should be tweaked to get stronger effect if so are those sideaffects of shading going to be more amplified if I do so? Thank you for your patience.
SilaSurfer is offline   Reply With Quote
Old 16th January 2011, 17:28   #322  |  Link
Didée
Registered User
 
Join Date: Apr 2002
Location: Germany
Posts: 5,394
Quote:
Originally Posted by SilaSurfer View Post
So Fluxsmooth should be tweaked to get stronger effect
Maybe yes, maybe no. Read on.

Quote:
if so are those sideaffects of shading going to be more amplified if I do so?
Definetly yes. If FluxSmooth is set up more aggressively (i.e. bigger threshold), then it'll do more good where Flux is doing right, and will do more bad where Flux is doing wrong.

Remember FluxSmooth is a simple temporal smoother with median-like decision where to filter and where not.

Examples:

a) a pixel sequence: ... 80 81 85 79 80 ...

Flux will filter the "85" and the "79", because these two pixels are overshooting both of their neighbors.

b) pixel sequence: ... 80 81 85 85 81 80

Flux will filter *nothing*, because no pixel satisfies the "overshooting both neighbors" criteria.

For case b), this means:

- IF those two "85" are due to motion, then Flux has done correct.

- But IF those two "85" in fact are related to "flicker" in a "flat" a/o "static" area, then Flux has not filtered something that you would like to have filtered.


Truth is, this kind of "flickering of low spatial frequencies" is one of the ultimate foes, because right here it is where the nebula-of-uncertainty becomes thick:

a) without mocomp, you can't know if it's flicker or motion

b) with mocomp, you can't know if the mocomp has been misleaded by the flicker

c) With prefiltering before mosearch, you can't know if the prefilter has mangled moving areas (because of a)) and conseqquentially has misleaded the mosearch

Chicken-and-egg problem, without any definite solution.
__________________
- 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!)
Didée is offline   Reply With Quote
Old 16th January 2011, 17:45   #323  |  Link
SilaSurfer
Registered User
 
SilaSurfer's Avatar
 
Join Date: Oct 2009
Posts: 212
Flickering. Thank you Didée for your explenation. I'm goint to go in a way of using your original script which was used with Zep's source by modifying it for my needs. Testing, testing and more testing.
SilaSurfer is offline   Reply With Quote
Old 16th January 2011, 18:25   #324  |  Link
Didée
Registered User
 
Join Date: Apr 2002
Location: Germany
Posts: 5,394
Related - I've though several times if and how the "FluxSmooth principle" could be extended from the current 3-frame temporal window to a 5-frame temporal window.

A reasonable approach would be this:
- calculate temporal median with radius=2
- calculate temporal soften with radius=2
- for each pixel, use that result that caused the smaller difference


Radius=2 temporal median can be done via MedianBlurT, but this implementation is tooooo slow.

Instead, get the nice median2 script by g-force!

For convenience and simple usage, create a "TMedian2" wrapper function:

Code:
function TMedian2(clip c) {
Median2( c.selectevery(1,-2), c.selectevery(1,-1), c, c.selectevery(1,1), c.selectevery(1,2) ) }
Armed with these helpers, a 5-frame-variant of FluxSmoothT could look like this:

Code:
function Flux5framesT(clip c, int "th", int "thC") {
th  = default(th,7)
thC = default(thC,th)
med  = c.TMedian2()
avg  = c.temporalsoften(2,th,thC,24,2)
medD = mt_makediff(c,med,U=3,V=3)
avgD = mt_makediff(c,avg,U=3,V=3)
DD   = mt_lutxy(medD,avgD,"x 128 - y 128 - * 0 < 128 x 128 - abs y 128 - abs < x y ? ?",U=3,V=3)
c.mt_makediff(DD,U=3,V=3)
}
__________________
- 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!)

Last edited by Didée; 19th January 2011 at 14:46. Reason: typo: makedif -> makediff
Didée is offline   Reply With Quote
Old 17th January 2011, 19:24   #325  |  Link
tormento
Acid fr0g
 
tormento's Avatar
 
Join Date: May 2002
Location: Italy
Posts: 1,644
Please port that AVS to x64 aware version
__________________
@turment on Telegram
tormento is offline   Reply With Quote
Old 17th January 2011, 19:47   #326  |  Link
Didée
Registered User
 
Join Date: Apr 2002
Location: Germany
Posts: 5,394
No, I'm bored of it. Wait for the x256-version of Avisynth 7.0.
__________________
- 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!)
Didée is offline   Reply With Quote
Old 19th January 2011, 13:20   #327  |  Link
SilaSurfer
Registered User
 
SilaSurfer's Avatar
 
Join Date: Oct 2009
Posts: 212
Quote:
Originally Posted by Didée View Post
Armed with these helpers, a 5-frame-variant of FluxSmoothT could look like this:

Code:
function Flux5framesT(clip c, int "th", int "thC") {
th  = default(th,7)
thC = default(thC,th)
med  = c.TMedian2()
avg  = c.temporalsoften(2,th,thC,24,2)
medD = mt_makediff(c,med,U=3,V=3)
avgD = mt_makedif(c,avg,U=3,V=3)
DD   = mt_lutxy(medD,avgD,"x 128 - y 128 - * 0 < 128 x 128 - abs y 128 - abs < x y ? ?",U=3,V=3)
c.mt_makediff(DD,U=3,V=3)
}
Didée I now you get this a lot but you are a genius. Tried the script on the same source and the result is fantastic. Really calms down grain when LF flicker is removed. Now I can use this filtering on a clip for ME analysis. I only have to tweak th setting, right? Thanks again.
SilaSurfer is offline   Reply With Quote
Old 19th January 2011, 14:01   #328  |  Link
Didée
Registered User
 
Join Date: Apr 2002
Location: Germany
Posts: 5,394
For this one, 'th' and 'thC' are the only knobs to tweak, yes.

Somewhere earlier in this thread I had posted a pre-calm script (with MinBlur() and FluxSmooth) - in essence the same as I suggested at the end of this post to TheProfileth.

Depending on the source characteristics, using Flux5 instead of simple Flux within such a pre-calmer can make sense.
__________________
- 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!)
Didée is offline   Reply With Quote
Old 19th January 2011, 14:17   #329  |  Link
SilaSurfer
Registered User
 
SilaSurfer's Avatar
 
Join Date: Oct 2009
Posts: 212
Another one for the recipe book. Those sideaffect of shading do not happen with Flux5fremesT script? Thanks Didée.

BTW There is a typo in your Flux5framesT script

avgD = mt_makedif(c,avg,U=3,V=3) --> avgD = mt_makediff(c,avg,U=3,V=3)

Last edited by SilaSurfer; 19th January 2011 at 14:27.
SilaSurfer is offline   Reply With Quote
Old 19th January 2011, 14:46   #330  |  Link
Didée
Registered User
 
Join Date: Apr 2002
Location: Germany
Posts: 5,394
Yeah, a few minutes ago I discovered that typo, too.

Of course, Flux5 is *not* safe in regards to weak shadings in moving areas. Vanilla Flux is not safe, and Flux5 is even less. Well, you can't expect anything else from a simple, thresholded temporal smoother. It's a compromise the user needs to balance out.
__________________
- 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!)
Didée is offline   Reply With Quote
Old 19th January 2011, 15:03   #331  |  Link
SilaSurfer
Registered User
 
SilaSurfer's Avatar
 
Join Date: Oct 2009
Posts: 212
Thanks again Didée for your patience and interest for helping out.
SilaSurfer is offline   Reply With Quote
Old 23rd January 2011, 17:37   #332  |  Link
SilaSurfer
Registered User
 
SilaSurfer's Avatar
 
Join Date: Oct 2009
Posts: 212
Didée from your post #70


Quote:
Originally Posted by Didée View Post
The biggest difference to Zep's denoising is - most probably, since we didn't see his script up to now - the usage of fft3dfilter. It seems that he used to much of it, or at to strong settings. All the ringing and texture echoing is a typical side-effect fft3dfilter, when not used with enough caution. Judging from the overall look, I'd guess that Zep first did an initial filtering with fft3dfilter, and then continued to further process the result with MV-denoising. (Some places look like fft3d-banding that has been temporally averaged, but it's hard to judge after x264-compression.)

In comparison, my script never applies fft3dfilter in the chain that produces the output clip. Instead, it is only used as a "brake" to keep the 1st temporal filter within reasonable bounds. (Which is essential in the bigger scripts where the 1st stage is done with median filtering.)
Does this mean that whatever is used in prefiltering step in this case Fft3dfilter, is like you never used it, but still got results from it? If so for example I could apply two stages of Flux5FramesT for prefiltering to MDegrain2?

Flux5FramesT().Flux5FramesT() to really make the clip calm.

Last edited by SilaSurfer; 23rd January 2011 at 17:50. Reason: Forgot to write something
SilaSurfer is offline   Reply With Quote
Old 24th January 2011, 21:42   #333  |  Link
SilaSurfer
Registered User
 
SilaSurfer's Avatar
 
Join Date: Oct 2009
Posts: 212
Didée nevermind my previous post. I wanted to ask you what do you think about this. Would need some suggestions if you have any.

SetMTMode(5,2)
SetMemoryMax(1000)




MPEG2Source("C:\System\fotr1.d2v", info=3)
Colormatrix(hints=true)

crop(8,78,704,420)
source=last
a=source.Fft3dgpu(sigma=16, sigma2=10, Sigma3=6, sigma4=8, bt=4) # Deblocking and some sigma4 help to Flux5framesT() which comes next
b = a.RemoveGrain(11)
f = b.Flux5FramesT().merge(b,0.49)

Nr1=a.mt_makediff(mt_makediff(b,f,U=3,V=3),U=3,V=3) # Prefiltering clip for MAnalyze

SetMTMode(2)


NR1_super=NR1.Msuper(pel=2, sharp=2)
source_super = source.MSuper(pel=2,sharp=2, levels=1)
bv2=MAnalyse(NR1_super,isb=true, delta=2, overlap=4, truemotion=false)
bv1=MAnalyse(NR1_super,isb=true, delta=1, overlap=4, truemotion=false)
fv1=MAnalyse(NR1_super,isb=false,delta=1, overlap=4, truemotion=false)
fv2=MAnalyse(NR1_super,isb=false,delta=2, overlap=4, truemotion=false)
NR2=source.MDegrain2(source_super, bv1,fv1,bv2,fv2, thsad=300, thscd1=300, thscd2=90).contra(source) # Denoising and Your Contrasharpening. Function (see below)

SetMTmode(5)
sharp0 = NR2.Seesaw(nrlimit=0, nrlimit2=99, bias=49, sstr=1.24, Spower=3, Szp=12, Sdamplo=4, SdampHi=19, Slimit=99, sootheT=0, sootheS=0)
SetMTMode(2)
sharpD = mt_makediff(NR2,sharp0)
zeroD = sharpD.mt_lut("x",Y=-128)

sup1 = NR2.MSuper(pel=2,sharp=2)
sup2 = sharpD.MSuper(pel=2,sharp=2,levels=1)

zeroD.MDegrain2(sup2,bv1,fv1,bv2,fv2) # Motion Compensated Sharpening. Your 2a variant which doesn't denoise. I split the denoising and sharpening to avoid artefacts.

NR2.mt_makediff(last,U=2,V=2)


GradFun2DBmod(thr=1.4, str=1.2, mode=2,adapt=64, temp=50) #Some dihtering and adding grain to prevent blocking and banding
SetMTMode(5)


Spline64resize(704,288)

function contra (clip denoised, clip original)
{
s = denoised.minblur(1,1) # Damp down remaining spots of the denoised clip.
allD = mt_makediff(original,denoised) # 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.

denoised.mt_adddiff(ssDD,U=2,V=2) # Apply the limited difference. (Sharpening is just inverse blurring.)

return( last )
}


This was tested on not so good Dvd source. It contains a lot of dark areas where blocking is present. Areas with grain inherit those nice charming LF errors aka Flicker. So what do you think of my first "cough" advanced script? (Also having a flu overhere)

Last edited by SilaSurfer; 24th January 2011 at 22:12.
SilaSurfer is offline   Reply With Quote
Old 24th January 2011, 22:09   #334  |  Link
Didée
Registered User
 
Join Date: Apr 2002
Location: Germany
Posts: 5,394
Well, what to say. Technically, the flow of processing is all valid. On some sources this will look great, on some sources it will look desastrous.

Seeing the source is LOTR, I'd say the prefiltering is MUCH too strong. LOTR is rather clean with only little noise, no need to break a fly on a wheel. The current prefiltering will nuke-out enough content to make the motionsearch worse than it could be. Sometimes less is simply more.

Also, you're producing a little stamp of 704x288. So much filtering for only so few pixels in the result?
__________________
- 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!)
Didée is offline   Reply With Quote
Old 24th January 2011, 22:17   #335  |  Link
SilaSurfer
Registered User
 
SilaSurfer's Avatar
 
Join Date: Oct 2009
Posts: 212
True. Lord of the Rings: Fellowship of the ring SEE first part. Yeah Fft3dgpu is really on steroids. Will try it with lowered settings. Thanks
SilaSurfer is offline   Reply With Quote
Old 25th January 2011, 14:55   #336  |  Link
SilaSurfer
Registered User
 
SilaSurfer's Avatar
 
Join Date: Oct 2009
Posts: 212
Yeah that is too much filtering. I lowered Fft3dgpu to sigma=2, bt=1, used Mdegrain1 instead of Mdegrain2, and for sharpening with SeeSaw I used SootheS=25. What is the max value for FluxsmoothT(Temporal)?
SilaSurfer is offline   Reply With Quote
Old 25th January 2011, 15:49   #337  |  Link
Didée
Registered User
 
Join Date: Apr 2002
Location: Germany
Posts: 5,394
Maximum is 255. Perhaps more, but in 8-bit-sources pixel differences can not be larger than 255, anyway.
Of course, with such big threshold there will appear motion artifacts.

Out of the sleeve,

MinBlur(1)
FluxSmoothT().merge(last,0.251)
sbr()

should be a "simple" but effective searchclip-pre-processing for such rather clean sources.


If you don't have them in the toolbox - - -
Code:
# Highpass of spatial r=1  Gaussian
function sbr(clip c) 
{
rg11=c.removegrain(11,-1)
rg11D=mt_makediff(c,rg11)
rg11DD=mt_makediff(rg11D,rg11D.removegrain(11,-1)).mt_lutxy(rg11D,"x 128 - y 128 - * 0 < 128 x 128 - abs y 128 - abs < x y ? ?")
c.mt_makediff(rg11DD,U=2,V=2)
}


# Nifty Gauss/Median combination
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 : -333

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)
}
__________________
- 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!)

Last edited by Didée; 25th January 2011 at 15:57.
Didée is offline   Reply With Quote
Old 25th January 2011, 20:15   #338  |  Link
SilaSurfer
Registered User
 
SilaSurfer's Avatar
 
Join Date: Oct 2009
Posts: 212
I meant SootheS=75. How come every time I ask you something you hit me with another function? Thanks Didée I like it a lot!

BTW this doesn't really belong in this thread but since it is connected to my script: MY script crawls on my system even with SetMTMode it doesn't get any faster and I was meaning to ask you what do you think about MVToolsMulti version which has multithreading built in. I know it is somewhat unstable but I could gain a couple fps?

Last edited by SilaSurfer; 25th January 2011 at 20:47. Reason: Fixed some typos
SilaSurfer is offline   Reply With Quote
Old 26th January 2011, 19:56   #339  |  Link
Boulder
Pig on the wing
 
Boulder's Avatar
 
Join Date: Mar 2002
Location: Hollola, Finland
Posts: 4,996
Quote:
Originally Posted by Didée View Post
Maximum is 255. Perhaps more, but in 8-bit-sources pixel differences can not be larger than 255, anyway.
Of course, with such big threshold there will appear motion artifacts.

Out of the sleeve,

MinBlur(1)
FluxSmoothT().merge(last,0.251)
sbr()

should be a "simple" but effective searchclip-pre-processing for such rather clean sources.
It seems to blur the image quite a bit even with clean sources. Is that intentional?
__________________
And if the band you're in starts playing different tunes
I'll see you on the dark side of the Moon...
Boulder is offline   Reply With Quote
Old 26th January 2011, 20:25   #340  |  Link
Didée
Registered User
 
Join Date: Apr 2002
Location: Germany
Posts: 5,394
Yes, sure, that's intentional. Preprocessing for the searchclip. Did you see that?

If you have a nicely sharp & high-contrast clip, with "default operation as per documentation" you'll end up with pretty big SADs wherever there's an edge. Means, little to nothing will happen on edges. Which is quite counterproductive when the goal is to calm (the effect of) a sharpener.
__________________
- 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!)
Didée is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 03:38.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2021, vBulletin Solutions Inc.