View Full Version : New Sharpening Function from Didée -'SeeSaw'
Pages :
1
2
3
4
5
6
[
7]
8
9
10
11
12
13
Pookie
17th December 2006, 13:32
put the weave() statement at the end of your script
Didée
17th December 2006, 18:27
I never actually tried, but most definetly you'll have no fun when applying SeeSaw to a interlaced source.
Sharpening of interlaced sources generally is problematic, and even more so for a "dancing-on-the-edge" script like SeeSaw.
- Applying to interlaced full-frames totally messes up everything.
- Applying to separated fields messes up the temporal aspects.
- Applying to (quickly) bobbed frames weakens the response of the used medianfilter, and temporal aspects still are not good.
And that's only the bad news from the "enhancement" side. But moreover, even any denoising will either be less efficient than it could be, or will do more harm than necessary.
For the theoretical maximum of quality, the source first would need to be smartbobbed (with "smart" being as smart as only possible). Only then there is a reasonable base for denoising and sharpening.
Applying to even/odd separately could be tried, too. Though filters then work on halved temporal resolution, at least they see static parts as being static, that way.
***
Interlaced footage simply is not well suited to perform "image processing" tasks on ...
... and it was never meant to be: Interlacing was invented to spare bandwidth when delivering meant-for-viewing-only sources to the recipients. Doing lots of substantial processing never was the plan.
jeremyofmany
18th December 2006, 01:32
When I import the SeeSaw script into mine, it then says:
Avisynth open failure:
Script error: there is no function named "yv12lutxy"
(D:\Video Tools\AviSynth Filters\SeeSaw.avs, line 72)
(D:\Video Tools\AviSynth Script.avs, line 12)
Line 72 is as follows:
NRdiff = yv12lutxy(clp,denoised,"x y - 128 +","x y - 128 +","x y - 128 +",U=3,V=3)
Any ideas?
Didee, I intend on de-interlacing my footage for both DVD and AVI. Everyone seems to have a different definition of what is the best method of deinterlacing. Didee, what do you suggest?
Didée
18th December 2006, 02:27
[hurdy-gurdy]
SeeSaw needs to have loaded: MaskTools v158 or v2a30 (for the old or the corrected new script), and RemoveGrain + Repair.
[/hurdy-gurdy]
Links to: MaskTools (http://forum.doom9.org/member.php?u=4630) ;)
Link: RemoveGrain (http://home.arcor.de/kassandro/RemoveGrain/RemoveGrain.rar)
Everyone seems to have a different definition of what is the best method of deinterlacing
That's true ... there's no natural law defining a rating scale that "best" is referring to. Only human preferences, of which there are plenty. That's why this' forum rules include a certain aspect about the word "best". :)
what do you suggest?
Find out the kind of your scale. :)
jeremyofmany
18th December 2006, 09:17
SeeSaw needs to have loaded: MaskTools v158 or v2a30 (for the old or the corrected new script), and RemoveGrain + Repair.
Import("D:\Video Tools\AviSynth Filters\SeeSaw.avs")
AviSource("D:\Hamsters(DV).avi")
LoadPlugin("D:\Video Tools\AviSynth Filters\MVTools.dll")
LoadPlugin("D:\Video Tools\AviSynth Filters\mt_masktools.dll")
LoadPlugin("D:\Video Tools\AviSynth Filters\RemoveGrain\RemoveGrain.dll")
LoadPlugin("D:\Video Tools\AviSynth Filters\RemoveGrain\Repair.dll")
fields=AviSource("D:\Hamsters(DV).avi").AssumeTFF().SeparateFields() # or AssumeBFF
backward_vec2 = fields.MVAnalyse(isb = true, delta = 2, pel = 2, overlap=4, sharp=2, idx = 1)
forward_vec2 = fields.MVAnalyse(isb = false, delta = 2, pel = 2, overlap=4, sharp=2, idx = 1)
fields.MVDegrain1(backward_vec2,forward_vec2,thSAD=400,idx=1)
a = last
b = a.AssumeTFF().AssumeFrameBased().SeparateFields()
SeeSaw(a,b, NRlimit=3, NRlimit2=4, Sstr=1.5, Slimit=5, Spower=5, Sdamplo=6, Szp=16)
Weave()
Same error message. :(
Didée
18th December 2006, 09:21
"There is no function named ..."
- "yv12lutxy":
=> LoadPlugin("path\to\MaskTools.dll")
- "mt_lutxy":
=> LoadPlugin("path\to\mt_masktools.dll")
foxyshadis
18th December 2006, 09:44
Hey, this seesaw thing actually looks really nice in realtime. Now that it, y'know, works... >.> Sorry about that mixed up conversion before, again.
Guess I'm going to have to start looking for something better than Degrainmedian to feed it.
jeremyofmany
18th December 2006, 16:18
Didee, am I annoying yet? lol
Ok, so I have the plugins loaded but now it says:
YV12LUTxy : Clip's size must be the same
I read several things on the MaskTools page, but can't figure it out. Mind giving me a hand on this one?
krieger2005
18th December 2006, 16:23
Maybe the two clips you passed to SeeSaw have different dimensions?
Pookie
18th December 2006, 16:49
a = last
b = a.AssumeTFF().SeparateFields()
SeeSaw(a,b, NRlimit=3, NRlimit2=4, Sstr=1.5, Slimit=5, Spower=5, Sdamplo=6, Szp=16)
Nope. Not gonna work that way.
a= 1080
b= 540
That's what happens when you SeparateFields()
foxyshadis
18th December 2006, 17:26
q4u, Didée. Would SeeSaw make sense in place of LSF for upsized video at all? Here there aren't really many pixel-size details and I mainly want it to crispen edges without banding the gradients. However, I have no idea what sort of denoiser or parameters one would use to get the effect. (Whereas with LSF it's easy; just up the strength until it's sharp enough, then raise the soft until it looks decent. :p)
krieger2005
18th December 2006, 19:15
I tune just two parameters: SdampLo and NRLimit. The First one defines the threshold for noise and NRLimit the amount of the sharpening... I have relativly fast results by tuning this two values, but maybe someone have better tuning-alternatives.
Boulder
18th December 2006, 22:48
Regarding usage with MT: should I use
MT("
a=last
b=whateverdenoiser()
SeeSaw(a,b)
",2)or just put SeeSaw inside MT? The question is, does SeeSaw get the correct a- and b-clips (=the correct half of the frame) if they are not inside MT.
jeremyofmany
19th December 2006, 02:27
SeeSaw now works but it makes the source extremely noisy, to the point where a lot of detail is lots of specks/spots everywhere.
SeeSaw Screenshot (http://jeremy.zxian.org/Screenshots/SeeSaw.jpg)
But I understand that I should deinterlace it first and try to filter out the natural noise first, then maybe use SeeSaw at a lower threshold. I don't really need it sharpened too much. Another thing I am interested in is color balance. I'd like to adjust the contrast to make it look better. What do you guys think?
Pookie
19th December 2006, 03:47
Jeremy -
Do this
SeparateFields()
A=last
B=A.RemoveGrain(mode=24)
SeeSaw(a,b, NRlimit=7, NRlimit2=8, Sstr=1.5, Slimit=5, Spower=5, Sdamplo=6, Szp=16)
Weave()
BTW, your link wasn't quite right - http://jeremy.zxian.org/Screenshots/SeeSaw.jpg
SeeSaw looks great on progressive material. It might not be what you want, since your screenshot looks like DV.
Hey, at least you learned a few things about scripts :D
-------------------
Boulder -
http://forum.doom9.org/showthread.php?p=857865#post857865 Dunno. Perhaps that's a question for TSP.
jeremyofmany
19th December 2006, 05:47
Pookie, thanks. I fixed the link. Too many ()'s makes /'s and \'s strange. /()\... wait a minute.. oh geez... ;)
Anyway, lmao
The script sample you provided stretches my video horizontally, seen here (http://jeremy.zxian.org/Screenshots/SeperateFields().jpg).
My source is DV. I actually started this topic (http://forum.doom9.org/showthread.php?t=119452).
And yes, I love learning through more experienced people. :D
Boulder
19th December 2006, 10:25
The script sample you provided stretches my video horizontally, seen here (http://jeremy.zxian.org/Screenshots/SeperateFields().jpg).
Weave() should return the video to full height. I wonder why it isn't doing that.
Didée
19th December 2006, 13:29
@ jeremyofmany:
Instead of just "Weave()", try "AssumeFieldbased().Weave()" at the end. When the source fed into SeeSaw actually is fieldbased, it's quite possible that the clip is losing that property somewhere along the transformations.
@ krieger:
SdampLo and NRLimit. The First one defines the threshold for noise and NRLimit the amount of the sharpening
Doesn't hit the point. NRlimit is an absolute limit (sharpening won't sharpen any pixel more than this, no matter what). The general amount of sharpening is controled by Szp and Spower.
It helps to realize that SeeSaw first builds a "normal" sharpening transformation, then takes the result of that (i.e. the difference before/after sharpening), and transforms the difference map by a sort-of gamma function.
A quick drawing:
http://img147.imageshack.us/img147/2669/fourcurvesbf8.png
Red is the resulting curve of a normal linear kernel sharpener: x=y, i.e. when the kernel sharpening calculated a pixelchange of "8", then a change of "8" is applied.
Light blue shows "Szp=16, Spower=4, SdampLo=0.01, SdampHi=255".
Dark blue shows "Szp=16, Spower=2, SdampLo=3, SdampHi=255"
Dark green shows "Szp=16, Spower=4, SdampLo=4, SdampHi=24"
After some breeding, it becomes clear:
In relation to the pixelchange resulting from the linear kernel sharpener,
- differences below Szp are amplified
- differences above Szp are reduced
- SdampLo damps down the too steepy amplification of gamma's power for very small values
- SdampHi damps down any big differences, because big differences would result in oversharpening anyway
One may note that the "neutral point" (Szp = Sharpening Zero Point) isn't always located exactly at Szp, since it gets shifted alittle by the damping parameters ... I was too lazy to make a long complicated formula to compensate for that ... doesn't matter, since absolute exactness of Szp is not really important. ;)
@ foxyshadis:
Heh, out of time, can't really elaborate on that now ...
Generally, on upsized images the benefits of SeeSaw fade away rather quickly, and results become closer to just LimitedSharpen+Soothe. Better would be to use SeeSaw's supersampling routine, just without the re-downsampling at the end.
For producing upsized images, the whole thing needs a good amount of adaptions. Most of my fiddling with temporal-superresolution-for-the-average-source is based on the SeeSaw principle, but with several more twists.
jeremyofmany
19th December 2006, 15:56
@ jeremyofmany:
Instead of just "Weave()", try "AssumeFieldbased().Weave()" at the end. When the source fed into SeeSaw actually is fieldbased, it's quite possible that the clip is losing that property somewhere along the transformations.
Avisynth open failure:
SeparateFields: SeparateFields should be applied on frame-based material: use AssumeFrameBased() beforehand
When I do that, it stretches. This is my script:
Import("D:\Video Tools\AviSynth Filters\SeeSaw.avs")
AviSource("D:\Hamsters(DV).avi")
LoadPlugin("D:\Video Tools\AviSynth Filters\MVTools.dll")
LoadPlugin("D:\Video Tools\AviSynth Filters\mt_masktools.dll")
LoadPlugin("D:\Video Tools\AviSynth Filters\Masktools.dll")
LoadPlugin("D:\Video Tools\AviSynth Filters\RemoveGrain\RemoveGrain.dll")
LoadPlugin("D:\Video Tools\AviSynth Filters\RemoveGrain\Repair.dll")
fields=AviSource("D:\Hamsters(DV).avi").AssumeTFF().SeparateFields() # or AssumeBFF
backward_vec2 = fields.MVAnalyse(isb = true, delta = 2, pel = 2, overlap=4, sharp=2, idx = 1)
forward_vec2 = fields.MVAnalyse(isb = false, delta = 2, pel = 2, overlap=4, sharp=2, idx = 1)
fields.MVDegrain1(backward_vec2,forward_vec2,thSAD=400,idx=1)
A=last
B=A.RemoveGrain(mode=24)
SeeSaw(a,b, NRlimit=7, NRlimit2=8, Sstr=1.5, Slimit=5, Spower=5, Sdamplo=6, Szp=16)
AssumeFrameBased().SeparateFields().Weave()
Boulder
19th December 2006, 15:58
A small correction: if you have DV video, it's BFF.
jeremyofmany
19th December 2006, 20:31
I had SeperateFields() in there twice and I made the correction, thank you Boulder. It works, but I was doing it remotely as I am at work. I'll check it out once I'm home. Thanks again! :D
Jeremy Duncan
19th December 2006, 20:55
q4u, Didée. Would SeeSaw make sense in place of LSF for upsized video at all? Here there aren't really many pixel-size details and I mainly want it to crispen edges without banding the gradients. However, I have no idea what sort of denoiser or parameters one would use to get the effect. (Whereas with LSF it's easy; just up the strength until it's sharp enough, then raise the soft until it looks decent. :p)
Try this:
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\FluxSmooth.dll")
a = last
b = a.FluxSmoothT(3)
SeeSaw(a, b, NRlimit=2, NRlimit2=1, Sstr=1.4, Slimit=7, Spower=2, Sdamplo=8, SdampHi=10, Szp=10, bias=1, sootheT=30)
SPresso(limit=2, limitC=0, bias=15, biasC=0, RGmode=17, RGmodeC=0)
Didée,
Can Seesaw be made faster ?
If both the old and new masktools is in the plugins folder seesaw uses, which will seesaw use ?
Boulder
19th December 2006, 21:36
If the SeeSaw code includes MaskTools v2 functions, it will naturally be used. The functions don't have the exact same names in MaskTools v1 and v2 for compatibility reasons.
Pookie
20th December 2006, 04:21
Didée,
Can Seesaw be made faster ?
Computers can....:D
Maybe that's the solution. Why have Didée do it when you can ?
Software methods are going to be more limited.
1) Make sure you're using the flavor of RemoveGrain that is optimized for your CPU (removegrainsse2.dll, etc)
2) Seek out the MT_Masktools version of the script
3) Test out other fast denoisers.
4) Use SeeSaw without a denoiser at all
5) On Dual/Trial/Quadrical/Pentacle Cores, you can try something like http://www.mlin.net/SMPSeesaw.shtml (don't get too excited by the name), or http://www.ice-graphics.com/ICEAffinity/IndexE.html
Adub
20th December 2006, 04:55
Is the MT Masktools version the one dated on January 2nd? Or is there a separate one entirely?
Pookie
20th December 2006, 05:07
Somewhere around here...
http://forum.doom9.org/showthread.php?t=104701&page=15
Adub
20th December 2006, 05:33
Found it! Thanks! I thought they were all the same script. After further analysis, I see other wise.
jeremyofmany
20th December 2006, 09:33
So I've been working on my script a little bit, also trying some deinterlacers. I've tried KernelDeint(0) and have a serious issue.
http://jeremy.zxian.org/Screenshots/Hamster.jpg
Is that what "combing" is? Does anyone know how I might avoid/remove that? I'm off to bed, thanks for your help with all of my scripting so far. I'm using that HDRACG filter to increase the lighting, excellent plugin!
foxyshadis
20th December 2006, 12:00
I think LeakKernelDeint might just not be cut out for something as noisy as that, and you'd get better results from TDeint instead. That one includes comb-processing routines even if there's too much noise for a good match. Anyway, this probably isn't the thread for it.
jeremyofmany
20th December 2006, 21:18
Thanks.
Adub
21st December 2006, 02:22
So what is the difference between using the Masktools 1.5.8 or less version of the script versus the Masktools 2.0 version? Is 2.0 faster? Higher quality?
Jeremy Duncan
21st December 2006, 05:08
So what is the difference between using the Masktools 1.5.8 or less version of the script versus the Masktools 2.0 version? Is 2.0 faster? Higher quality?
It's faster and it takes care of a problem with Spots.
Adub
21st December 2006, 05:48
Righteous. Thanks Jeremy.
nicksteel
23rd December 2006, 00:52
What is latest version of seesaw, which masktools does it use?
Adub
23rd December 2006, 00:59
look at post #326.
Or skip to page 15, and look for FoxyShadis' post.
Masktools 2.0 is used.
Edit: Read the forum next time!
Pookie
23rd December 2006, 01:01
The one released by the author, Didée can be downloaded on page 1 of this thread. It uses Masktools v1.58
There's a hacked version which uses Masktools v2 (MT_Masktools). I believe it is on page 15 somewhere. Read the threads, however, as the hack needed to be modified to actually work properly.
Jeremy Duncan
23rd December 2006, 05:52
From Foxyshadis post
# SeeSaw v0.3e (02 Jan 2006)
#
# (Full Name: "Denoiser-and-Sharpener-are-riding-the-SeeSaw" )
#
# This function provides a (simple) implementation of the "crystality sharpen" principle.
# In conjunction with a user-specified denoised clip, the aim is to enhance
# weak detail, hopefully without oversharpening or creating jaggies on strong
# detail, and produce a result that is temporally stable without detail shimmering,
# while keeping everything within reasonable bitrate requirements.
# This is done by intermixing source, denoised source and a modified sharpening process,
# in a seesaw-like manner.
#
# This version is considered alpha.
#
# Usage:
#
# a = TheNoisySource
# b = a.YourPreferredDenoising()
# SeeSaw( a, b, [parameters] )
#
# You're very much encouraged to feed your own custom denoised clip into SeeSaw.
# If the "denoised" clip parameter is omitted, a simple "spatial pressdown" filter is used.
#
#
# Fiddled together by Didée, for your pleasure.
#
# ======= Main function =======
function SeeSaw( clip clp, clip "denoised",
\ int "NRlimit",int "NRlimit2",
\ float "Sstr", int "Slimit", float "Spower", float "SdampLo", float "SdampHi", float "Szp",
\ float "bias", int "Smode", int "sootheT", int "sootheS", float "ssx", float "ssy")
{
ssx = default( ssx, 1.0 ) # supersampling factor x / SeeSaw doesn't require supersampling urgently.
ssy = default( ssy, ssx ) # supersampling factor y / if at all, small values ~1.25 seem to be enough.
NRlimit = default( NRlimit, 2 ) # absolute limit for pixel change by denoising
NRlimit2 = default( NRlimit2, NRlimit+1) # limit for intermediate denoising
Sstr = default( Sstr, 1.5 ) # Sharpening strength (don't touch this too much)
Slimit = default( Slimit, NRlimit+2 ) # positive: absolute limit for pixel change by sharpening
# negative: pixel's sharpening difference is reduced to diff=pow(diff,1/abs(limit))
Spower = default( Spower, 4 ) # exponent for modified sharpener
Szp = default( Szp, 16+2 ) # zero point - below: overdrive sharpening - above: reduced sharpening
SdampLo = default( SdampLo, Spower+1 ) # reduces overdrive sharpening for very small changes
SdampHi = default( SdampHi, 24 ) # further reduces sharpening for big sharpening changes. Try 15~30. "0" disables.
bias = default( bias, 49 ) # bias towards detail ( >= 50 ) , or towards calm result ( < 50 )
Smode = default( Smode, ssx<1.35 ? 11 : ssx<1.51 ? 20 : 19 )
sootheT = default( sootheT, 49 ) # 0=minimum, 100=maximum soothing of sharpener's temporal instableness.
# (-100 .. -1 : will chain 2 instances of temporal soothing.)
sootheS = default( sootheS, 0 ) # 0=minimum, 100=maximum smoothing of sharpener's spatial effect.
Szp = Szp / pow(Sstr, 1.0/4.0) / pow( (ssx+ssy)/2.0, 1.0/2.0 )
SdampLo = SdampLo / pow(Sstr, 1.0/4.0) / pow( (ssx+ssy)/2.0, 1.0/2.0 )
ox=clp.width
oy=clp.height
xss = m4(ox*ssx)
yss = m4(oy*ssy)
NRL = string( NRlimit )
NRL2 = string( NRlimit2 )
NRLL = string( int(round( NRlimit2 * 100.0/bias - 1.0 )) )
SLIM = string( abs(Slimit) )
BIAS1 = string( bias )
BIAS2 = string( 100-bias )
#ZRP = string( abs(Szp) )
#PWR = string( abs(Spower) )
#DMP = string( SdampLo )
denoised = defined(denoised) ? denoised : mt_lutxy(clp,clp.removegrain(4,-1),"x "+NRL+" + y < x "+NRL+" + x "+NRL+" - y > x "+NRL+" - y ? ?",chroma="copy first")
NRdiff = mt_makediff(clp,denoised,chroma="process")
tame = mt_lutxy(clp,denoised,"x "+NRLL+" + y < x "+NRL2+" + x "+NRLL+" - y > x "+NRL2+" - x "+BIAS1+" * y "+BIAS2+" * + 100 / ? ?")
head = tame.sharpen2(Sstr,Spower,Szp,SdampLo,SdampHi,4)
# head = head.mt_merge(tame,tame.prewitt(multiplier=1.0).mt_expand().removegrain(20))
(ssx==1.0 && ssy==1.0) ? repair(tame.sharpen2(Sstr,Spower,Szp,SdampLo,SdampHi,Smode),head,1,-1,-1)
\ : repair(tame.lanczosresize(xss,yss).sharpen2(Sstr,Spower,Szp,SdampLo,SdampHi,Smode),head.bicubicresize(xss,yss,-.2,.6),1,-1,-1).lanczosresize(ox,oy)
SootheSS(last,tame,sootheT,sootheS)
sharpdiff= mt_makediff(tame,last)
(NRlimit==0) ? clp : \
mt_lutxy(clp,NRdiff, "y 128 "+NRL+" + > x "+NRL+" - y 128 "+NRL+" - < x "+NRL+" + x y 128 - - ? ?",chroma="process")
Slimit>=0 ? mt_lutxy(last,sharpdiff,"y 128 "+SLIM+" + > x "+SLIM+" - y 128 "+SLIM+" - < x "+SLIM+" + x y 128 - - ? ?",chroma="copy first")
\ : mt_lutxy(last,sharpdiff,"y 128 == x x y 128 - abs 1 "+SlIM+" / ^ y 128 - y 128 - abs / * - ?",chroma="copy first")
return( last )
}
# ======= Modified sharpening function =======
function sharpen2(clip clp, float strength, int power, float zp, float lodmp, float hidmp, int rgmode)
{
STR = string( strength )
PWR = string( 1.0/float(power) )
ZRP = string( ZP )
DMP = string( lodmp )
HDMP = (hidmp==0) ? "1" : "1 x y - abs "+string(hidmp)+" / 4 ^ +"
mt_lutxy( clp, clp.RemoveGrain(rgmode,-1,-1), \
"x y == x x x y - abs "+ZRP+" / "+PWR+" ^ "+ZRP+" * "+STR+" * x y - 2 ^ x y - 2 ^ "+DMP+" + / * x y - x y - abs / * "+HDMP+" / + ?",chroma="copy first")
return( last )
}
# ======= Soothe() function to stabilze sharpening =======
function SootheSS(clip sharp, clip orig, int "sootheT", int "sootheS")
{
sootheT = default(sootheT, 25 )
sootheS = default(sootheS, 0 )
sootheT = (sootheT > 100) ? 100 : (sootheT < -100) ? -100 : sootheT
sootheS = (sootheS > 100) ? 100 : (sootheS < 0) ? 0 : sootheS
ST = string( 100 - abs(sootheT))
SSPT = string( 100 - abs(sootheS))
mt_makediff(orig,sharp)
(sootheS==0) ? last
\ : mt_lutxy( last, last.removegrain(20,-1,-1),
\ "x 128 - y 128 - * 0 < x 128 - 100 / "+SSPT+" * 128 + x 128 - abs y 128 - abs > x "+SSPT+" * y 100 "+SSPT+" - * + 100 / x ? ?", chroma="ignore")
(sootheT==0) ? last
\ : mt_lutxy( last, last.temporalsoften(1,255,0,32,2),
\ "x 128 - y 128 - * 0 < x 128 - 100 / "+ST+" * 128 + x 128 - abs y 128 - abs > x "+ST+" * y 100 "+ST+" - * + 100 / x ? ?", chroma="ignore")
(sootheT > -1) ? last
\ : mt_lutxy( last, last.temporalsoften(1,255,0,32,2),
\ "x 128 - y 128 - * 0 < x 128 - 100 / "+ST+" * 128 + x 128 - abs y 128 - abs > x "+ST+" * y 100 "+ST+" - * + 100 / x ? ?",chroma="ignore")
mt_makediff(orig,last)
# mergechroma(sharp) # not needed in SeeSaw
return( last )
}
# ======= MOD4-and-atleast-16 helper function =======
function m4(float x) {x<16?16:int(round(x/4.0)*4)}
From Boulders post, including Didée's tweak suggestions.
function SeeSaw( clip clp, clip "denoised",
\ int "NRlimit",int "NRlimit2",
\ float "Sstr", int "Slimit", float "Spower", float "Sdamp", float "Szp",
\ float "bias", int "Smode", int "sootheT", int "sootheS", float "ssx", float "ssy")
{
ssx = default( ssx, 1.0 ) # supersampling factor x / SeeSaw doesn't require supersampling urgently.
ssy = default( ssy, ssx ) # supersampling factor y / if at all, small values ~1.25 seem to be enough.
NRlimit = default( NRlimit, 2 ) # absolute limit for pixel change by denoising
NRlimit2 = default( NRlimit2, NRlimit+1) # limit for intermediate denoising
Sstr = default( Sstr, 1.5 ) # Sharpening strength (don't touch this too much)
Slimit = default( Slimit, NRlimit+2 ) # positive: absolute limit for pixel change by sharpening
# negative: pixel's sharpening difference is reduced to diff=pow(diff,1/abs(limit))
Spower = default( Spower, 4 ) # exponent for modified sharpener
Szp = default( Szp, 16+2 ) # zero point - below: overdrive sharpening - above: reduced sharpening
Sdamp = default( Sdamp, Spower+1 ) # reduces overdrive sharpening for very small changes
bias = default( bias, 49 ) # bias towards detail ( >= 50 ) , or towards calm result ( < 50 )
Smode = default( Smode, ssx<1.35 ? 11 : ssx<1.51 ? 20 : 19 )
sootheT = default( sootheT, 49 ) # 0=minimum, 100=maximum soothing of sharpener's temporal instableness.
# (-100 .. -1 : will chain 2 instances of temporal soothing.)
sootheS = default( sootheS, 0 ) # 0=minimum, 100=maximum smoothing of sharpener's spatial effect.
Szp = Szp / pow(Sstr, 1.0/4.0) / pow( (ssx+ssy)/2.0, 1.0/2.0 )
Sdamp = Sdamp / pow(Sstr, 1.0/4.0) / pow( (ssx+ssy)/2.0, 1.0/2.0 )
ox=clp.width
oy=clp.height
xss = m4(ox*ssx)
yss = m4(oy*ssy)
NRL = string( NRlimit )
NRL2 = string( NRlimit2 )
NRLL = string( int(round( NRlimit2 * 100.0/bias - 1.0 )) )
SLIM = string( abs(Slimit) )
BIAS1 = string( bias )
BIAS2 = string( 100-bias )
ZRP = string( abs(Szp) )
PWR = string( abs(Spower) )
DMP = string( Sdamp )
denoised = defined(denoised) ? denoised : mt_lutxy(clp,clp.removegrain(4),"x "+NRL+" + y < x "+NRL+" + x "+NRL+" - y > x "+NRL+" - y ? ?",U=2,V=2)
NRdiff = mt_lutxy(clp,denoised,"x y - 128 +","x y - 128 +","x y - 128 +",U=3,V=3)
tame = mt_lutxy(clp,denoised,"x "+NRLL+" + y < x "+NRL2+" + x "+NRLL+" - y > x "+NRL2+" - x "+BIAS1+" * y "+BIAS2+" * + 100 / ? ?")
head = tame.sharpen2(Sstr,Spower,Szp,Sdamp,4)
# head = mt_merge(head,tame,tame.prewitt(multiplier=1.0).mt_expand().removegrain(20))
(ssx==1.0 && ssy==1.0) ? repair(tame.sharpen2(Sstr,Spower,Szp,Sdamp,Smode),head,1,-1,-1)
\ : repair(tame.lanczosresize(xss,yss).sharpen2(Sstr,Spower,Szp,Sdamp,Smode),head.bicubicresize(xss,yss,-.2,.6),1,-1,-1).lanczosresize(ox,oy)
# shrp=last
Soothess(last,tame,sootheT,sootheS)
sharpdiff= mt_lutxy(tame,last,"x y - 128 +",U=1,V=1)
mt_lutxy(clp,NRdiff,"y 128 "+NRL+" + > x "+NRL+" - y 128 "+NRL+" - < x "+NRL+" + x y 128 - - ? ?",
\ "y 128 "+NRL+" + > x "+NRL+" - y 128 "+NRL+" - < x "+NRL+" + x y 128 - - ? ?",
\ "y 128 "+NRL+" + > x "+NRL+" - y 128 "+NRL+" - < x "+NRL+" + x y 128 - - ? ?",U=3,V=3)
# NRR=last
Slimit>=0 ? mt_lutxy(last,sharpdiff,"y 128 "+SLIM+" + > x "+SLIM+" - y 128 "+SLIM+" - < x "+SLIM+" + x y 128 - - ? ?",U=2,V=2)
\ : mt_lutxy(last,sharpdiff,"y 128 == x x y 128 - abs 1 "+SlIM+" / ^ y 128 - y 128 - abs / * - ?",U=2,V=2)
# NRR .mergechroma(clp)
# sharpdiff.greyscale
# subtitle(SLIM)
return( last )
}
# ======= Modified sharpening function =======
function sharpen2(clip clp, float strength, int power, float zp, float ldmp, int rgmode)
{
STR = string( strength )
PWR = string( 1.0/float(power) )
ZRP = string( ZP )
DMP = string( ldmp )
mt_lutxy( clp, clp.RemoveGrain(rgmode,-1,-1), \
"x y == x x x y - abs "+ZRP+" / "+PWR+" ^ "+ZRP+" * "+STR+" * x y - 2 ^ x y - 2 ^ "+DMP+" + / * x y - x y - abs / * + ?",U=2,V=2)
return( last )
}
# ======= Soothess() function to stabilze sharpening =======
function Soothess(clip sharp, clip orig, int "sootheT", int "sootheS")
{
sootheT = default(sootheT, 25 )
sootheS = default(sootheS, 0 )
sootheT = (sootheT > 100) ? 100 : (sootheT < -100) ? -100 : sootheT
sootheS = (sootheS > 100) ? 100 : (sootheS < 0) ? 0 : sootheS
ST = string( 100 - abs(sootheT))
SSPT = string( 100 - abs(sootheS))
mt_lutxy(orig,sharp,"x y - 128 +","x y - 128 +","x y - 128 +", U=1,V=1)
(sootheS==0) ? last
\ : mt_lutxy( last, last.removegrain(20,-1,-1),
\ "x 128 - y 128 - * 0 < x 128 - 100 / "+SSPT+" * 128 + x 128 - abs y 128 - abs > x "+SSPT+" * y 100 "+SSPT+" - * + 100 / x ? ?", U=1,V=1)
mt_lutxy( last, last.temporalsoften(1,255,0,32,2),
\ "x 128 - y 128 - * 0 < x 128 - 100 / "+ST+" * 128 + x 128 - abs y 128 - abs > x "+ST+" * y 100 "+ST+" - * + 100 / x ? ?", U=1,V=1)
(sootheT > -1) ? last
\ : mt_lutxy( last, last.temporalsoften(1,255,0,32,2),
\ "x 128 - y 128 - * 0 < x 128 - 100 / "+ST+" * 128 + x 128 - abs y 128 - abs > x "+ST+" * y 100 "+ST+" - * + 100 / x ? ?", U=1,V=1)
mt_lutxy(orig,last,"x y 128 - -","x y 128 - -","x y 128 - -",U=1,V=1)
# mergechroma(sharp) # not needed in SeeSaw
return( last )
}
# ======= MOD4-and-atleast-16 helper function =======
function m4(float x) {x<16?16:int(round(x/4.0)*4)}
The one from Foxyshadis post uses these settings:
LoadPlugin("F:\Program Files\AviSynth 2.5\plugins\FluxSmooth.dll")
a = last
b = a.FluxSmoothT(3)
SeeSaw(a, b, NRlimit=2, NRlimit2=1, Sstr=1.4, Slimit=7, Spower=2, Sdamplo=8, SdampHi=10, Szp=10, bias=1, sootheT=30)
SPresso(limit=2, limitC=0, bias=15, biasC=0, RGmode=17, RGmodeC=0)
The one from Boulders post uses these settings:
LoadPlugin("F:\Program Files\AviSynth 2.5\plugins\FluxSmooth.dll")
a = last
b = a.FluxSmoothT(3)
SeeSaw(a, b, NRlimit=2, NRlimit2=1, Sstr=1.4, Slimit=7, Spower=2, Szp=10, bias=1, sootheT=30)
SPresso(limit=2, limitC=0, bias=15, biasC=0, RGmode=17, RGmodeC=0)
There is NO quality different using these settings between either version of Seesaw.
However, Boulders version is Much faster, and at times played without lag on my Pentium M 725.
So there you have it.
foxyshadis
23rd December 2006, 08:37
All you have there is an older version of seesaw, without sdamphi and a couple micro-optimizations. But in the interests of science one must measure. The script is just:
avisource("funkynew.avi")
LoadPlugin(avsplugins+"avstimer.dll")
LoadPlugin(avsplugins+"fluxsmooth.dll")
trim(0,500)
avstimer(quiet=true)
a = last
b = FluxSmoothT(3)
false
\ ? SeeSaw(a, b, NRlimit=2, NRlimit2=1, Sstr=1.4, Slimit=7, Spower=2, Sdamplo=8, SdampHi=10, Szp=10, bias=1, sootheT=30).avstimer(name="avstimer new",frames=50)
\ : SeeSaw2(a, b, NRlimit=2, NRlimit2=1, Sstr=1.4, Slimit=7, Spower=2, Sdamplo=8, SdampHi=10, Szp=10, bias=1, sootheT=30).avstimer(name="avstimer old",frames=50)
New results:
[5172] [49] avstimer new = 21.8 fps
[5172] [99] avstimer new = 21.3 fps
[5172] [149] avstimer new = 21.2 fps
[5172] [199] avstimer new = 21.8 fps
[5172] [249] avstimer new = 21.1 fps
[5172] [299] avstimer new = 21.6 fps
[5172] [349] avstimer new = 22.2 fps
[5172] [399] avstimer new = 21.6 fps
[5172] [449] avstimer new = 21.6 fps
[5172] [499] avstimer new = 21.2 fps
[5172] [49] avstimer old = 21.5 fps
[5172] [99] avstimer old = 21.1 fps
[5172] [149] avstimer old = 20.9 fps
[5172] [199] avstimer old = 21.2 fps
[5172] [249] avstimer old = 21.1 fps
[5172] [299] avstimer old = 21.8 fps
[5172] [349] avstimer old = 21.2 fps
[5172] [399] avstimer old = 20.4 fps
[5172] [449] avstimer old = 20.8 fps
[5172] [499] avstimer old = 20.4 fps
No difference on average. The takeaway may be that it's dependant on your system (mine is core2 merom), although the extra sdamphi in the lut shouldn't really affect it. And I thought you had a celeron M, did you upgrade to enjoy a little more cache and speedstep? :p I suppose later I could test on the P-M, AXP, and Opterons.
Either way, if you're going to be posting a script, pleeeease make it compatible with the current version. Creating pointless versioning conflicts is not fun. In this case, that means adding sdamplo and hi back to old seesaw, and changing this line:
Sdamp = default( Sdamp, default(Sdamplo, Spower+1) ) # reduces overdrive sharpening for very small changes
At the bare minimum. Or just rename Sdamp to Sdamplo and ignore Sdamphi but please don't break api and cause spurious errors. I would say that's even a good idea for the original, except the original is so rarely used (compared to something that was around a while, like LimitedSharpen).
nicksteel
23rd December 2006, 12:01
I wish I remembered where I got the script from..we really need that sticky thread with all useful functions up-to-date :)
This would eliminate a lot of apparent confusion.:confused:
Jeremy Duncan
23rd December 2006, 19:39
All you have there is an older version of seesaw, without sdamphi and a couple micro-optimizations. But in the interests of science one must measure. The script is just:
avisource("funkynew.avi")
LoadPlugin(avsplugins+"avstimer.dll")
LoadPlugin(avsplugins+"fluxsmooth.dll")
trim(0,500)
avstimer(quiet=true)
a = last
b = FluxSmoothT(3)
false
\ ? SeeSaw(a, b, NRlimit=2, NRlimit2=1, Sstr=1.4, Slimit=7, Spower=2, Sdamplo=8, SdampHi=10, Szp=10, bias=1, sootheT=30).avstimer(name="avstimer new",frames=50)
\ : SeeSaw2(a, b, NRlimit=2, NRlimit2=1, Sstr=1.4, Slimit=7, Spower=2, Sdamplo=8, SdampHi=10, Szp=10, bias=1, sootheT=30).avstimer(name="avstimer old",frames=50)
New results:
[5172] [49] avstimer new = 21.8 fps
[5172] [99] avstimer new = 21.3 fps
[5172] [149] avstimer new = 21.2 fps
[5172] [199] avstimer new = 21.8 fps
[5172] [249] avstimer new = 21.1 fps
[5172] [299] avstimer new = 21.6 fps
[5172] [349] avstimer new = 22.2 fps
[5172] [399] avstimer new = 21.6 fps
[5172] [449] avstimer new = 21.6 fps
[5172] [499] avstimer new = 21.2 fps
[5172] [49] avstimer old = 21.5 fps
[5172] [99] avstimer old = 21.1 fps
[5172] [149] avstimer old = 20.9 fps
[5172] [199] avstimer old = 21.2 fps
[5172] [249] avstimer old = 21.1 fps
[5172] [299] avstimer old = 21.8 fps
[5172] [349] avstimer old = 21.2 fps
[5172] [399] avstimer old = 20.4 fps
[5172] [449] avstimer old = 20.8 fps
[5172] [499] avstimer old = 20.4 fps
No difference on average. The takeaway may be that it's dependant on your system (mine is core2 merom), although the extra sdamphi in the lut shouldn't really affect it. And I thought you had a celeron M, did you upgrade to enjoy a little more cache and speedstep? :p I suppose later I could test on the P-M, AXP, and Opterons.
Either way, if you're going to be posting a script, pleeeease make it compatible with the current version. Creating pointless versioning conflicts is not fun. In this case, that means adding sdamplo and hi back to old seesaw, and changing this line:
Sdamp = default( Sdamp, default(Sdamplo, Spower+1) ) # reduces overdrive sharpening for very small changes
At the bare minimum. Or just rename Sdamp to Sdamplo and ignore Sdamphi but please don't break api and cause spurious errors. I would say that's even a good idea for the original, except the original is so rarely used (compared to something that was around a while, like LimitedSharpen).
I did update the cpu from a celeron.
That test you ran using funkynew.avi, the old Seesaw script can't use Sdamplo and Sdamphi. So maybe run a test with the old Seesaw note using these.
And are you talking to Boulder about posting a script without sdamplo and sdamphi, because I don't know how to make a Seesaw script script without Didée's help.
Boulder
23rd December 2006, 20:21
I didn't create any SeeSaw script, the one I posted was a copy-paste from some old thread. That's why the two options are missing - they simply were not available when I copied the function.
Didée
14th January 2007, 15:50
Oh my Lord.
For anyone who's reading the "parameter explanation" for SeeSaw in the above post:
Disregard it. Please.
It's plain nonsense for the most parts.
***
BTW, Jeremy: Simply deleting a multi-multi-page thread (your "Walkthrough Guide") is not a good practice. Not at all.
I'll probably try to never post in any of your threads again - - if the answer might disappear the other day (like mine of yesterday did), then why bother...
Guest
14th January 2007, 15:54
deleting a multi-multi-page thread (your "Walkthrough Guide") is not a good practice. That's right. It's an unfortunate loophole in the new forum software. I have restored the thread. Jeremy, you can remove your own posts if you like.
AGKnotUser
15th January 2007, 20:48
Hello,
I am looking for general detail enhancement for DVD transcoding from Double Layer to Single Layer but i am confused as to which script for SeeSaw to use for that. Can someone suggest which of the many scripts seen here would be the best for my use? The DVDs would be clean sources. Thanks.
Pookie
15th January 2007, 22:16
Your perception is your own....
AGKnotUser
16th January 2007, 04:51
@Pookie: I understand what you mean, that what looks good to me is what I should use. At this point I lack the knowledge and tools to do a side by side comparison of frames. That's on my todo list.
@Jeremy Duncan: Thank you for your script. I'll give it a try. Also, I ran both versions of SeeSaw.avs that you posted on page 17 and found that foxyshadis' version ran faster than Boulders. Can you point me to the original post by Boulder so I can see his comments about the tweaks? Normally I wouldn't ask, but I gave up after an hour of hunting through this thread.
spanky123
16th January 2007, 06:51
Cheers Jeremy
What's that
SPresso(___) do ?
Jeremy Duncan
16th January 2007, 07:18
AGKnotUser,
Look at post # 285
spanky123,
Spresso is a denoiser.
I wrote a guide. Here's the link
Link (http://forum.doom9.org/showthread.php?t=115727)
You can find all the plugins you need and all the info for setting it up.
Boulder
16th January 2007, 07:19
Can you point me to the original post by Boulder so I can see his comments about the tweaks? Normally I wouldn't ask, but I gave up after an hour of hunting through this thread.I don't think I made any comments. Like I said, I just copy-pasted something that I had copy-pasted from the forum earlier. The function I posted was EDIT:broken as was pointed out a bit later.
spanky123
16th January 2007, 07:22
Cheers Duncs
:)
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.