PDA

View Full Version : Sharp only when needed


egrimisu
7th March 2010, 11:59
Hi,
Is there a sharpning function that si specialy made to sharp only need frames? i have this source that has 2-3 sharp frames and then 2-3 smouth(ok, the smooth frames also contain rainbows but that can be fixed).those sharp/smooth frames don't have a constant patern, are random, is there something to do this nicely?
thanks in advace

sample:
http://www.megaupload.com/?d=9OVUV973

Didée
7th March 2010, 13:42
Figuring a script that actually does watch out for changing "sharpness" / "softness" would be possible, but a bit elaborative.

However, this is a case where "spatial sharpen with mocomp'ed temporal limiting" (http://forum.doom9.org/showthread.php?p=1380002#post1380002) works quite nicely.

Script "variant#1" with minor modification:

mpeg2source("Vts_01_1_cut_(egrimisu).d2v")
TFM().TDecimate()
source=last

sup = source.MSuper(pel=2,sharp=2)
bv1 = sup.MAnalyse(isb=true, delta=1 )
fv1 = sup.MAnalyse(isb=false,delta=1 )
bc1 = source.MCompensate(sup,bv1,thSAD=500)
fc1 = source.MCompensate(sup,fv1,thSAD=500)
max = mt_logic(bc1,fc1,"max").mt_logic(source,"max")
min = mt_logic(bc1,fc1,"min").mt_logic(source,"min")
sharp1 = source.sharpen(1).awarpsharp() # .mergechroma(last) # chroma sharpen usually is unadvantageous

sharp1.mt_clamp(max,min,0,0,U=3,V=3)

stackhorizontal(source,last)
return(last)

Try that, it seems to work reasonably well on your sample. The aWarpSharp was added to care for the "broadened" blurry lines, since those probably benefit from aWarpSharp's thinning. Its settings could be tweaked better, though. ;)

egrimisu
7th March 2010, 17:07
just checkout meanwhile the next thread http://forum.doom9.org/showthread.php?t=153170 and found out that that was exacly what i needed. i have a few question though, my script look like this:

DGDecode_mpeg2source("d:\Misu\Anne01\VTS_01_001.d2v")
checkmate()
smartssiq(280)
animeivtc(mode=1,ifade=true,aa=1)
super = MSuper()
backward_vec2 = MAnalyse(super, isb = true, delta = 2, overlap=4)
backward_vec1 = MAnalyse(super, isb = true, delta = 1, overlap=4)
forward_vec1 = MAnalyse(super, isb = false, delta = 1, overlap=4)
forward_vec2 = MAnalyse(super, isb = false, delta = 2, overlap=4)
MDegrain2(super, backward_vec1,forward_vec1,backward_vec2,forward_vec2,thSAD=400)
source=last
sup = source.MSuper(pel=2,sharp=2)
bv1 = sup.MAnalyse(isb=true, delta=1 )
fv1 = sup.MAnalyse(isb=false,delta=1 )
bc1 = source.MCompensate(sup,bv1,thSAD=500)
fc1 = source.MCompensate(sup,fv1,thSAD=500)
max = mt_logic(bc1,fc1,"max").mt_logic(source,"max")
min = mt_logic(bc1,fc1,"min").mt_logic(source,"min")
sharp1 = source.sharpen(1).awarpsharp() # .mergechroma(last) # chroma sharpen usually is unadvantageous
sharp1.mt_clamp(max,min,0,0,U=3,V=3)
crop( 8, 2, -8, 0)
#return(last) Not sure if i need this because i don't realy know what it does.

Shall i apply the degrain before or after the sharpner
Can i apply antialiasing when ivtcing or it is recomended after the sharpning, in case the aa will alter the lines.

Didée
7th March 2010, 17:38
Note that I've only little clue what AnimeIVTC does with which parameters under which circumstances. I usually don't care much for animation, and AnimeIVTC is a bit complicated when you've no need for it. I prefer to use the basic tools directly.

From the workflow of processing, the most obvious order is IVTC->SharpCorrection->Degrain/AA.
The sharp-correction might give some artifacts here and there (can't spot anything serious in that sample, but there's generally some danger of artifacts), therefore it seems more safe to do Degrain and AA afterwards. As a little bonus, it would be possible to re-use already calculated motion vectors.

DGDecode_mpeg2source("d:\Misu\Anne01\VTS_01_001.d2v")
checkmate()
smartssiq(280)

# animeivtc(mode=1,ifade=true,aa=1) # I don't know this good enough :|

TFM().TDecimate() # this I know better ;-)


source=last
sup = source.MSuper(pel=2,sharp=2)
bv1 = sup.MAnalyse(isb=true, delta=1, overlap=4 )
fv1 = sup.MAnalyse(isb=false,delta=1, overlap=4 )
bc1 = source.MCompensate(sup,bv1,thSAD=500)
fc1 = source.MCompensate(sup,fv1,thSAD=500)
max = mt_logic(bc1,fc1,"max").mt_logic(source,"max")
min = mt_logic(bc1,fc1,"min").mt_logic(source,"min")
sharp1 = source.sharpen(1).awarpsharp() # .mergechroma(last) # chroma sharpen usually is unadvantageous
sharp1.mt_clamp(max,min,0,0,U=3,V=3)

super = MSuper(pel=2,sharp=2)
backward_vec2 = MAnalyse(super, isb = true, delta = 2, overlap=4)
#backward_vec1 = MAnalyse(super, isb = true, delta = 1, overlap=4)
#forward_vec1 = MAnalyse(super, isb = false, delta = 1, overlap=4)
forward_vec2 = MAnalyse(super, isb = false, delta = 2, overlap=4)

MDegrain2(super, bv1,fv1,backward_vec2,forward_vec2,thSAD=400)

EEDI2AA()

crop( 8, 2, -8, 0)

return(last) # Not sure if i need this because i don't realy know what it does.


#-----------------------
# quickly made from http://forum.doom9.org/showthread.php?p=916871#post916871
function EEDI2AA(clip c)
{
c.SeparateFields()
dbl = EEDI2(field=-2,maxd=4)
dbl = Merge(dbl.SelectEven,dbl.SelectOdd,0.5)
dblD = mt_MakeDiff(c,dbl,U=3,V=3)
shrpD = mt_MakeDiff(dbl,dbl.RemoveGrain(11),U=3,V=3)
DD = shrpD.Repair(dblD,13)

dbl.mt_AddDiff(DD,U=3,V=3)
}

egrimisu
8th March 2010, 07:32
this does the same thing:
source=last
sup = source.MSuper(pel=2,sharp=2)
bv1 = sup.MAnalyse(isb=true, delta=1, overlap=4 )

as this one:
super = MSuper(pel=2,sharp=2)
backward_vec1 = MAnalyse(super, isb = true, delta = 1, overlap=4)

only the call is diferent?

Can this motion compensated sharpner be replaced with lsf? it is a more secure sharpner? how exacly does it work?what it do it analyse and how the decision of sharpning is taken.?

where can i find a manual to dig in in the terms like ISB,delta,MCompensate,mt_logic. it seems that this tool is flexible enough to do much anything :).
thanks again.

Didée
8th March 2010, 09:13
where can i find a manual to dig in in the terms like ISB,delta,MCompensate,mt_logic.
MVTools comes with an extensive documentation. Reading that is a good start. After that, it's a matter of toying around, examining what's happening, and learning from other scripts.


Can this motion compensated sharpner be replaced with lsf?
No.


it is a more secure sharpner?
No.

It's (a little bit) like spatial-denoising vs. temporal-denoising. Spatial denoising is more safe, but less effective. Temporal denoising is way more powerful, but also more risky.


how exacly does it work?
- have some raw mince, want to make a hamburger. But don't know yet how big the half-breads really are?
- beat the mince until it's definetly too big { sharpen(1) }
- make visual judgement how to place the half-breads { MAnalyse() }
- place the half-breads under and ontop the beaten mince { MCompensate() }
- cut the mince along the edge of the half-breads { mt_clamp() }

= enjoy your hamburger with exactly-fitting mince

egrimisu
25th April 2010, 12:37
Thanks for everything, till now everithing went great in my encodes. But i think i will restart the all my project from the begining as i don't like how things are sharpen in motion. the scene with motion (strafe left or right images) are porely sharpened. is there a way to mod the upper script or do i need something else?



MVTools comes with an extensive documentation. Reading that is a good start. After that, it's a matter of toying around, examining what's happening, and learning from other scripts.



No.



No.

It's (a little bit) like spatial-denoising vs. temporal-denoising. Spatial denoising is more safe, but less effective. Temporal denoising is way more powerful, but also more risky.



- have some raw mince, want to make a hamburger. But don't know yet how big the half-breads really are?
- beat the mince until it's definetly too big { sharpen(1) }
- make visual judgement how to place the half-breads { MAnalyse() }
- place the half-breads under and ontop the beaten mince { MCompensate() }
- cut the mince along the edge of the half-breads { mt_clamp() }

= enjoy your hamburger with exactly-fitting mince