View Full Version : New Sharpening Function from Didée -'SeeSaw'
Pages :
1
2
[
3]
4
5
6
7
8
9
10
11
12
13
unskinnyboy
23rd July 2006, 17:05
I stumbled upon something and thought it was worth mentioning, in case Didée was interested.
There seems to be a conflict between Soothe() and SeeSaw(). In a script using LS+Soothe, if I import SeeSaw (just import, it is not being called), I get artifacts. Mostly discoloration or green screens like these:
http://img153.imageshack.us/img153/2281/seesawissue01ow2.th.jpg (http://img153.imageshack.us/my.php?image=seesawissue01ow2.jpg) http://img97.imageshack.us/img97/3555/seesawissue02qc0.th.jpg (http://img97.imageshack.us/my.php?image=seesawissue02qc0.jpg)
LS alone is OK, but LS+Soothe isn't.
Here, I was using
dull = last
sharp = LimitedSharpen(ss_x=1.0,ss_y=1.0,overshoot=1,special=true,smode=4,strength=40)
Soothe(sharp,dull,20)
Hope this wasn't already reported before.
Didée
23rd July 2006, 19:22
Yes, there's a conflict. Did I never mention? :o
SeeSaw comes along with its own Soothe-Function, extended for 2-frame-distance soothing, and not caring about chroma at all, because chroma is restored at another place within SeeSaw.
Best would be, open SeeSaw in your editor, and call a "replace all:" "Soothe" by "SootheX", or something like that.
Sloppy scripting here, eh? My perfect excuse: It wasn't me who brought a half-finished experiment into public, it wasn't me ... :p ;)
unskinnyboy
23rd July 2006, 20:14
Got it. The wrong function was getting called. Should have checked & fixed it myself. Thanks Didée.
Pookie
23rd July 2006, 21:51
Soothe or No Soothe (sootheless?), it's still a cool function. :D
foxyshadis
23rd July 2006, 22:48
The version on the wiki already has a renamed Soothe, I called it SootheSS, as soon as I noticed it had the same name but different functionality while sorting the script out. ;)
3ngel
25th July 2006, 21:57
Hi,
i've tested a little SeeSaw, and i find one limitation that has a consequence:
the function accept only YV12 and there is an evident color reduction in the grandients after the function.
Example in YUY2 mode there are 60 state of gradients, after the function the grandient are reduced to 30 with the kind of "16 color grandient" effect.
There is a way to modify SeeSaw in order to make it YUY2 tolerating?
Pookie
25th July 2006, 22:29
Read the thread, in particular page 4. It's been discussed.
foxyshadis
25th July 2006, 22:35
It's possible. It would involve a lot of conversions and substituting subtract & overlay for mt_makediff & mt_merge, so performance would drop dramatically, but it'd work. (Or convert/apply/convertback/mergechroma... hey, wasn't it you who asked the same question and got that answer before?)
You'd probably be better off reinterpolating the gradient after application.
What format are you saving to that uses yuy2/yv16 instead of yv12?
3ngel
25th July 2006, 22:54
wasn't it you who asked the same question and got that answer before?
Mmm... you say so? It's possible if i used it long time ago :)
Ohhhh i remember pheraps! You posted if i'm not wrong a script to refix the chroma losted, interpolating the Yv12 with the original YUY2 (i'll search for it), but i don't know if it would be able to properly recreate the gradients. Anyway I'll try it.
Obviously it would be easier to operate directly in YUY2 :p
I do all the operations possibly in RGB, YUY2 mode, so it's a considerably loss of quality when i came to downgrade to Yv12.
EDIT: I found it. Woa i had totally forgot about my early post :) The script is by Didee. Thanks Didee!
shaolin95
1st August 2006, 08:09
Is there a way to use MT (dualcore) to speeds things up?
Awesome work btw!
Boulder
1st August 2006, 08:21
Possibly with SetMTMode, I'm not sure if MT would work correctly.
foxyshadis
1st August 2006, 08:43
Both work fine. SetMTMode 1 may even work, can't recall.
fjhdavid
1st August 2006, 11:20
After LS, I went to seesaw, but here comes the denoiser problem. For the moment I use Blur&NR (with HQ) from ffdshow.
My source are films recorded on a DVD recorder from Sat (with some blocks sometimes (I would like to drop)! the quality is average)
Is there a better denoiser function to use with seesaw or LS?
Is there a way to de-block my source?
thanks for your help
shaolin95
1st August 2006, 15:13
Both work fine. SetMTMode 1 may even work, can't recall.
Will this work?
SetMode(1)
a = last
b=a.degrainmedian(mode=2).VagueDenoiser(threshold=0.8, method=1, nsteps=6, chromaT=0.8)
SeeSaw(a,b, NRlimit=6, NRlimit2=7, Sstr=1.5, Slimit=5, Spower=5, Sdamplo=6, Szp=16)
I am ultra dumb with scripts...bascially I copy and try to modify.
Pookie
1st August 2006, 15:24
Try it with DegrainMedian(mode=1) and remove the VagueDenoiser part, unless your source is really bad.
Boulder
1st August 2006, 15:33
You must place the SetMTMode line before the line where you load the source (MPEG2Source, AVISource etc.)
shaolin95
1st August 2006, 16:29
I am not loading any source just playing a dvd thru TheaterTek and using ffdshow+avisynth. I like how it looks although I sure dont know if I am doing thins right :-) I know it is sharpening and I like it more than my regular sharpening thru ffdshow but I need to figure a way to use my dual core. My opteron 165 runs at 3ghz so its very fast.
Boulder, so since I am just playing DVDs where do I put the setMTmode...before the SeeSaw line?
Boulder
1st August 2006, 16:51
The SetMTMode line needs to be before the source is loaded so it probably won't work the way you are trying do make it work. As foxyshadis said MT will work, you should use it.
shaolin95
1st August 2006, 17:03
Well I will give it a try again with SetMTmode since I had a typo yesterday as you can read I entered SetMode.
Also if using MT mode will this be the script?
a = last
b=a.degrainmedian(mode=1)
MT("SeeSaw(a,b, NRlimit=6, NRlimit2=7, Sstr=1.5, Slimit=5, Spower=5, Sdamplo=6, Szp=16)")
I think I tried it yesterday and got some error saying the vertical heigh has change and telling me to try verticalsplize=enable or something like that.
foxyshadis
1st August 2006, 17:51
I ususally use:
MT("
#entire script inside here
")
which works fine, doesn't have to be all on one line. I had trouble getting setmtmode to give good results during playback, presumably because the source couldn't be loaded after the mode was set.
Pookie
1st August 2006, 19:13
shaolin95 - Do you have the modded AviSynth.dll for MT loaded?
http://www.avisynth.org/tsp/
shaolin95
1st August 2006, 19:50
Great..Ill give it a try tonight. Thanks!
PS Yes I do have the modified one but thanks for telling me :-)
UPDATE:!
It worked perfectly! The difference between using dual core and single is great and makes it possible for real time dvd playback unlike before.
The image I am getting is awesome as I get really great detail without the usual artifacts that my pushing sharpeness levels cause. I am completely stunned by the my new and improved PQ. My infocus 4805 (8' wide screen) has never looked better. If you have the power to make it run smoothly its simply amazing for real time dvd playback.
Thanks for this masterpiece.
flood555
9th August 2006, 11:26
I have a source from DV camera,interlaced.Trying next:
LoadPlugin("D:\Capture\dll\TomsMoComp.dll")
LoadPlugin("D:\Capture\dll\FFT3dGPU.dll")
LoadPlugin("D:\Capture\dll\depan.dll")
LoadPlugin("D:\Capture\dll\RemoveGrain.dll")
LoadPlugin("D:\Capture\dll\MaskTools.dll")
LoadPlugin("D:\Capture\dll\Repair.dll")
Import("D:\Capture\SeeSaw.avsi")
AVISource("D:\Capture\da.avi")
ConvertToyv12()
TomsMoComp(1,5,1)
Motion=DePanEstimate(trust=2.5,fftw=true)
DePanInterleave(data=Motion)
MergeChroma( FFT3Dgpu(sigma=2, plane=0, bt=3, bw=32, bh=32, sharpen=1),
\ FFT3Dgpu(sigma=2, plane=3, bt=3, bw=32, bh=32, sharpen=1))
SelectEvery(3,1)
DePanInterleave(data=Motion)
MergeChroma( FFT3Dgpu(sigma=2, plane=0, bt=3, bw=4, bh=4, sharpen=1),
\ FFT3Dgpu(sigma=2, plane=3, bt=3, bw=4, bh=4, sharpen=1))
SelectEvery(3,1)
a=last
b=a.RemoveGrain(mode=25)
SeeSaw(a,b, NRlimit=3, NRlimit2=4, Sstr=1.5, Slimit=5, Spower=5, Sdamplo=6, Szp=16)
BilinearResize(512,384)
SeeSaw.avsi contains:
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 : yv12lutxy(clp,clp.removegrain(4,-1),"x "+NRL+" + y < x "+NRL+" + x "+NRL+" - y > x "+NRL+" - y ? ?",U=2,V=2)
NRdiff = yv12lutxy(clp,denoised,"x y - 128 +","x y - 128 +","x y - 128 +",U=3,V=3)
tame = yv12lutxy(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.maskedmerge(tame,tame.prewitt(multiplier=1.0).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)
Soothe(last,tame,sootheT,sootheS)
sharpdiff= yv12lutxy(tame,last,"x y - 128 +",U=1,V=1)
(NRlimit==0) ? clp : \
yv12lutxy(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)
Slimit>=0 ? yv12lutxy(last,sharpdiff,"y 128 "+SLIM+" + > x "+SLIM+" - y 128 "+SLIM+" - < x "+SLIM+" + x y 128 - - ? ?",U=2,V=2)
\ : yv12lutxy(last,sharpdiff,"y 128 = x x y 128 - abs 1 "+SlIM+" / ^ y 128 - y 128 - abs / * - ?",U=2,V=2)
return( last )
}
When try open script in VD,getting an error:
http://img127.imageshack.us/my.php?image=1jk6.png
How to resolve that problem?Any advice...
Boulder
9th August 2006, 12:07
You miss this from your SeeSaw.avsi:
function m4(float x) {x<16?16:int(round(x/4.0)*4)}
flood555
9th August 2006, 13:36
Thanx for quick replay!Now SeeSaw looks:
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 )
function m4(float x) {x<16?16:int(round(x/4.0)*4)}
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 : yv12lutxy(clp,clp.removegrain(4,-1),"x "+NRL+" + y < x "+NRL+" + x "+NRL+" - y > x "+NRL+" - y ? ?",U=2,V=2)
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 ^ +"
yv12lutxy( 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+" / + ?",U=2,V=2)
return( last )
}
NRdiff = yv12lutxy(clp,denoised,"x y - 128 +","x y - 128 +","x y - 128 +",U=3,V=3)
tame = yv12lutxy(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.maskedmerge(tame,tame.prewitt(multiplier=1.0).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)
function Soothe(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))
yv12lutxy(orig,sharp,"x y - 128 +","x y - 128 +","x y - 128 +", U=1,V=1)
(sootheS==0) ? last
\ : yv12lutxy( 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)
(sootheT==0) ? last
\ : yv12lutxy( 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
\ : yv12lutxy( 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)
yv12lutxy(orig,last,"x y 128 - -","x y 128 - -","x y 128 - -",U=1,V=1)
# mergechroma(sharp) # not needed in SeeSaw
return( last )
}
Soothe(last,tame,sootheT,sootheS)
sharpdiff= yv12lutxy(tame,last,"x y - 128 +",U=1,V=1)
(NRlimit==0) ? clp : \
yv12lutxy(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)
Slimit>=0 ? yv12lutxy(last,sharpdiff,"y 128 "+SLIM+" + > x "+SLIM+" - y 128 "+SLIM+" - < x "+SLIM+" + x y 128 - - ? ?",U=2,V=2)
\ : yv12lutxy(last,sharpdiff,"y 128 = x x y 128 - abs 1 "+SlIM+" / ^ y 128 - y 128 - abs / * - ?",U=2,V=2)
return( last )
}
Again VD error:
http://img116.imageshack.us/my.php?image=afud6.png
What's wrong?
Boulder
9th August 2006, 16:17
Like the error message says, you ran out of video memory. You have four FFT3DGPU calls so it's no wonder.
flood555
9th August 2006, 19:58
Like the error message says, you ran out of video memory. You have four FFT3DGPU calls so it's no wonder.
So,seems 2GB of RAM isn't enough:( .I've excluded two FFT3DGPU calls and now script's working fine.Thanx a lot!;)
foxyshadis
9th August 2006, 21:07
You might have 2GB of ram, but likely only 256MB or less of video ram. ;)
Boulder
9th August 2006, 21:10
I actually thought that a recent version of FFT3DGPU is supposed to use the system ram if you run out of video ram. Looks like it isn't so.
Anyway, the filter would probably get dead slow if it used the system ram in flood555's case.
flood555
9th August 2006, 22:19
I actually thought that a recent version of FFT3DGPU is supposed to use the system ram if you run out of video ram. Looks like it isn't so.
Me too...
序列人
10th August 2006, 04:29
This is my avs file as follow,why this always clues to wrong,it worries me so much.and i really can not find a better way to solve.pls help me as soon as possible.Deadly Thanks.
# PLUGINS
LoadPlugin("C:\PROGRA~1\GORDIA~1\DGMPGDec\DGDecode.dll")
LoadPlugin("C:\PROGRA~1\GORDIA~1\AviSynthPlugins\decomb.dll")
LoadPlugin("C:\PROGRA~1\GORDIA~1\AviSynthPlugins\UnDot.dll")
LoadPlugin("C:\PROGRA~1\GORDIA~1\AviSynthPlugins\MaskTools.dll")
LoadPlugin("C:\PROGRA~1\GORDIA~1\AviSynthPlugins\removegrain.dll")
LoadPlugin("C:\PROGRA~1\GORDIA~1\AviSynthPlugins\warpsharp.dll")
LoadPlugin("C:\PROGRA~1\GORDIA~1\AviSynthPlugins\Repair.dll")
LoadPlugin("C:\PROGRA~1\GORDIA~1\AviSynthPlugins\degrainmedian.dll")
LoadPlugin("C:\PROGRA~1\GORDIA~1\AviSynthPlugins\cnr2.dll")
Import("c:\PROGRA~1\AviSynth 2.5\plugins\seesaw.avs")
DGDecode_mpeg2source("I:\08.05.06.Capote.2005.NTSC.R3.DVDR-iCETEA\VTS_02_1.d2v",info=3)
ColorMatrix(hints=true)
edeintted = AssumeTFF().SeparateFields().SelectEven().EEDI2(field=-1)
tdeintted = TDeint(edeint=edeintted,order=1)
tfm(clip2=tdeintted).tdecimate(hybrid=1)
crop(2,64,716,352)
AddBorders(2,0,2,0)
a = last
b=a.degrainmedian(mode=1).cnr2()
SeeSaw(a,b, NRlimit=6, NRlimit2=7, Sstr=1.5, Slimit=6, Spower=8, Sdamp=5, Szp=16)
http://img161.imageshack.us/img161/8753/snap2at6.jpg
Didée
10th August 2006, 05:58
Older versions of SeeSaw had only one "Sdamp" parameter. Probably you're importing a newer version, where "Sdamp" was was replaced by "SdampLo", along with adding "SdampHi".
序列人
10th August 2006, 06:24
# 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閑, 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 : yv12lutxy(clp,clp.removegrain(4,-1),"x "+NRL+" + y < x "+NRL+" + x "+NRL+" - y > x "+NRL+" - y ? ?",U=2,V=2)
NRdiff = yv12lutxy(clp,denoised,"x y - 128 +","x y - 128 +","x y - 128 +",U=3,V=3)
tame = yv12lutxy(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.maskedmerge(tame,tame.prewitt(multiplier=1.0).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)
Soothe(last,tame,sootheT,sootheS)
sharpdiff= yv12lutxy(tame,last,"x y - 128 +",U=1,V=1)
(NRlimit==0) ? clp : \
yv12lutxy(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)
Slimit>=0 ? yv12lutxy(last,sharpdiff,"y 128 "+SLIM+" + > x "+SLIM+" - y 128 "+SLIM+" - < x "+SLIM+" + x y 128 - - ? ?",U=2,V=2)
\ : yv12lutxy(last,sharpdiff,"y 128 = x x y 128 - abs 1 "+SlIM+" / ^ y 128 - y 128 - abs / * - ?",U=2,V=2)
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 ^ +"
yv12lutxy( 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+" / + ?",U=2,V=2)
return( last )
}
# ======= Soothe() function to stabilze sharpening =======
function Soothe(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))
yv12lutxy(orig,sharp,"x y - 128 +","x y - 128 +","x y - 128 +", U=1,V=1)
(sootheS==0) ? last
\ : yv12lutxy( 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)
(sootheT==0) ? last
\ : yv12lutxy( 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
\ : yv12lutxy( 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)
yv12lutxy(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)}
this my seesaw.avs!
Pookie
10th August 2006, 07:37
OK, you have a version that supports SdampLo and SdampHi
Change you script to:
a = last
b=a.degrainmedian(mode=1).cnr2()
SeeSaw(a,b, NRlimit=6, NRlimit2=7, Sstr=1.5, Slimit=6, Spower=8, Sdamplo=5, Szp=16)
-----------------------------------------------------------
The plugin DegrainMedian(mode=1) looks very nice with SeeSaw and is fast, but try a lower noise reduction setting like NRlimit=4, NRLimit2=5 or lower for newer movies.
序列人
10th August 2006, 08:43
This is my avs file as follow,why this always clues to wrong,it worries me so much.and i really can not find a better way to solve.pls help me as soon as possible.Deadly Thanks.
# PLUGINS
LoadPlugin("C:\PROGRA~1\GORDIA~1\AviSynthPlugins\SSETools.dll")
LoadPlugin("C:\PROGRA~1\GORDIA~1\AviSynthPlugins\asharp.dll")
LoadPlugin("C:\PROGRA~1\GORDIA~1\AviSynthPlugins\aWarpSharp.dll")
LoadPlugin("C:\PROGRA~1\GORDIA~1\AviSynthPlugins\mt_MaskTools.dll")
LoadPlugin("C:\PROGRA~1\GORDIA~1\DGMPGDec\DGDecode.dll")
LoadPlugin("C:\PROGRA~1\GORDIA~1\AviSynthPlugins\decomb.dll")
LoadPlugin("C:\PROGRA~1\GORDIA~1\AviSynthPlugins\UnDot.dll")
LoadPlugin("C:\PROGRA~1\GORDIA~1\AviSynthPlugins\MaskTools.dll")
LoadPlugin("C:\PROGRA~1\GORDIA~1\AviSynthPlugins\removegrain.dll")
LoadPlugin("C:\PROGRA~1\GORDIA~1\AviSynthPlugins\warpsharp.dll")
LoadPlugin("C:\PROGRA~1\GORDIA~1\AviSynthPlugins\Repair.dll")
LoadPlugin("C:\PROGRA~1\GORDIA~1\AviSynthPlugins\degrainmedian.dll")
LoadPlugin("C:\PROGRA~1\GORDIA~1\AviSynthPlugins\cnr2.dll")
LoadPlugin("C:\PROGRA~1\GORDIA~1\AviSynthPlugins\fft3dfilter.dll")
LoadPlugin("C:\PROGRA~1\GORDIA~1\AviSynthPlugins\VagueDenoiser.dll")
#Import("c:\PROGRA~1\AviSynth 2.5\LimitedSharpenFaster.avsi")
#Import("c:\PROGRA~1\AviSynth 2.5\plugins\seesaw.avs")
#Import("c:\PROGRA~1\GORDIA~1\AviSynthPlugins\limitedsharpen.avs")
Import("c:\PROGRA~1\GORDIA~1\AviSynthPlugins\MCNR_simple2.avs")
#converttoyv12()
DGDecode_mpeg2source("I:\08.05.06.Capote.2005.NTSC.R3.DVDR-iCETEA\VTS_02_1.d2v",info=3)
ColorMatrix(hints=true)
edeintted = AssumeTFF().SeparateFields().SelectEven().EEDI2(field=-1)
tdeintted = TDeint(edeint=edeintted,order=1)
tfm(clip2=tdeintted).tdecimate(hybrid=1)
crop(2,64,716,352)
AddBorders(2,0,2,0)
trim(25000,26000)
a = last
b=mcnr_simple2(frames=3,thY=24,thC=20,thY2=-1,thC2=-1,removdirt=true,LPrad=2.0,LPlosens=1,LPhisens=5).LimitedSharpenFaster(ss_x=2.5,ss_y=2.5,strength=100,smode=4)
SeeSaw(a,b,NRlimit=17,bias=18,Smode=11,Szp=18,SdampLo=20)
http://img301.imageshack.us/img301/461/snap2je6.jpg
thx very much!
Blue_MiSfit
10th August 2006, 08:55
a bit OT, but I know for a fact that the NTSC version of Capote is 24p with pulldown, why not just use force film and not deinterlace??
Sorry to be OT :)
~MiSfit
Didée
10th August 2006, 14:10
1) To use MCNR_simple, you have to import MVTools.dll & RemoveDirt.dll
2) In the last script, you've commented out (#) the imports for SeeSaw and LimitedSharpenFaster, although you're still using both these functions in the script. Remove the according # signs.
Facct
13th August 2006, 20:10
First thing I want to say is Didee, even though you're not particularly interested in that area, your functions take HTPC to a whole nother level and without them i would consider the £1300 i spent on mine a complete waste. So thanks for all your hard work.
Up until recently I was using LSF which is great, but now with the multithreaded ffdshow builds i'm finally able to run SeeSaw and resize DVD's to 1920x1080 (and even throw in a LSF call in there too on some DVD's) and DAMN, it raises the bar even higher, it looks freakin amazing.
However, I can't seem to get SeeSaw to play nice with any film-source NTSC (PAL and 29.97 NTSC are fine), each second it seems to skip the 23rd frame and then duplicate the 24th from what I can tell. I'm using NVIDIA PureVideo Decoder for the 3:2 pulldown. Here's the call:
MT("a=last
b=a.mergeluma(removegrain(4,-1),0.28)
SeeSaw(a,b, NRlimit=2, NRlimit2=8, bias=49,Smode=11,Szp=16,SdampLo=18,SdampHi=28)
converttoyv12()")
Any ideas?
shaolin95
13th August 2006, 20:35
So facct, do you consider Seesaw to be better than LSF? I have been trying both and I still like LSF more. Do you mind sharing your call scripts so that I can try them.
I am currently testing many different ones and for some reason I like this one which seem kind of extreme:
Import("C:\Program Files\AviSynth 2.5\plugins\LimitedSharpenFaster.avs")
SetMTMode(2)
MT("LimitedSharpenFaster(ss_x=2,ss_y=2,Smode=3,strength=400, overshoot=1,wide=true)")
MT("Colormatrix()")
I am gonna give the one you posted a try as well.
Facct
13th August 2006, 23:03
Well I was never really able to use LSF with supersampling on DVD's, but now with the ffdshow multithreading I'm able to resize to 1920x1080 first and then sharpen at the target size (unfortunately no denoising before LSF or Soothe, which might well change things), and yes imo SeeSaw and then resize is better - especially because on some DVD's I can call LSF either within or after SeeSaw (sometimes I have to use Lanczos2, though).
shaolin95
14th August 2006, 00:14
The supersampling and wide option makes the image "smoother" and cleaner when sharpening in my case. How does that lsf and seesaw call looks like? I tried it once (briefly) and it was all weird artifacts.
Jeremy Duncan
14th August 2006, 18:29
a= last
b=a.hqdn3d(0.0, 2.0, 0.0, 4.0)
SeeSaw(a,b, NRlimit=3, NRlimit2=4, Sstr=1.5, Slimit=16, Spower=10, Sdamplo=6, Szp=16)
If I remove the a,b from the seesaw script the picture looks clean.
With it included in the script it looks quite grainy.
Notice I've changed the slimit and spower settings.
Maybe, Dideé.
You can fix it so I can use the a,b in the seesaw script I posted.
I use this when I use seesaw;
a= last
b=a.hqdn3d(0.0, 2.0, 0.0, 4.0)
SeeSaw(NRlimit=3, NRlimit2=4, Sstr=1.5, Slimit=16, Spower=10, Sdamplo=6, Szp=16)
Jeremy Duncan
14th August 2006, 18:30
What's the bare minimum cpu that can run this seesaw script ?
a= last
b=a.hqdn3d(0.0, 2.0, 0.0, 4.0)
SeeSaw(NRlimit=3, NRlimit2=4, Sstr=1.5, Slimit=16, Spower=10, Sdamplo=6, Szp=16)
Pookie
14th August 2006, 18:35
Jeremy -
That isn't going to work without adding "a,b" in the SeeSaw line. Add it back.
I would use DegrainMedian(mode=1) instead of HQ3d... - It looks especially nice with SeeSaw
If you want it to run faster, use RemoveGrain(mode=25)
Jeremy Duncan
14th August 2006, 18:42
I like this script the best.
a= last
b=a.SPresso(2, 20, 4)
SeeSaw(NRlimit=3, NRlimit2=4, Sstr=1.5, Slimit=16, Spower=10, Sdamplo=6, Szp=16)
I know the a,b in the seesaw was intended to be there.
Try the seesaw script I just posted.
Seeing is believing.
It (seesaw), still works without putting the a,b in the seesaw script.
I want the seesaw improved so I can put the a,b back into the script I just posted without it being all grainy.
Try this script with and without the a,b
Seeing is believing.
If it shouldn't work, I don't know why it is.
:helpful:
Boulder
14th August 2006, 18:48
With that script, you are actually feeding the a-clip twice and you don't use the denoised clip anywhere at all. SeeSaw does a simple cleanup if you don't define a b-clip.
So if you like the results, you can ditch the b-portion completely.
Jeremy Duncan
14th August 2006, 19:03
The top picture used this;
SPresso(2, 20, 4)
LimitedSharpenFaster(ss_x=1.0,ss_y=1.0,Smode=3,strength=100,overshoot=1)
The bottom picture used this;
a= last
b=a.SPresso(2, 20, 4)
SeeSaw(NRlimit=3, NRlimit2=4, Sstr=1.5, Slimit=16, Spower=10, Sdamplo=6, Szp=16)
Both were resized by a multiple of 2.0, Lanczos, 2 taps.
http://upload.enetation.co.uk/uploads/7e17bd3316.png
Boulder
14th August 2006, 19:10
What are you trying to show with those screenshots?
a= last
b=a.SPresso(2, 20, 4)
SeeSaw(NRlimit=3, NRlimit2=4, Sstr=1.5, Slimit=16, Spower=10, Sdamplo=6, Szp=16)is the same as
SeeSaw(NRlimit=3, NRlimit2=4, Sstr=1.5, Slimit=16, Spower=10, Sdamplo=6, Szp=16)but slower.
Jeremy Duncan
14th August 2006, 19:47
http://upload.enetation.co.uk/uploads/1cc9a8b816.png
http://upload.enetation.co.uk/uploads/ac04c98765.png
Top picture settings.
a= last
b=a.SPresso(2, 20, 4)
SeeSaw(a,b, NRlimit=3, NRlimit2=4, Sstr=1.5, Slimit=16, Spower=10, Sdamplo=6, Szp=16)
Bottom picture settings.
a= last
SeeSaw(NRlimit=3, NRlimit2=4, Sstr=1.5, Slimit=16, Spower=10, Sdamplo=6, Szp=16)
Same resizing as before.
When I use the a, b in the seesaw script, and the denoiser. I get a lot more grain in the picture.
I'm not sure if you can see it, but the top picture shows the grain.
Jeremy Duncan
14th August 2006, 19:53
What are you trying to show with those screenshots?
I was trying to show that seesaw improves the picture better than limitedsharpenfaster, even without using the denoiser and a,b in the seesaw script.
The picture with the guy with the hat.
The top picture has grain disfiguring his face, the walls too.
I wanted to show Dideé this so it might help somehow.
In some way, I dunno.
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.