View Full Version : SSXSharpen in realtime....
Soulhunter
2nd January 2005, 00:44
Well, its not really SSXSharpen...
But this combo looks imo 90% the same!
# The plugins (http://www.sendspace.com/file/hoid6r)
aSharp(0.4,0,0).aWarpsharp(3,1,bm=3,cm=0,thresh=0.99)
Source:
http://img153.exs.cx/img153/4954/source9lf.png
SSXSharpen:
http://img153.exs.cx/img153/6114/ssxs9dj.png
The combo:
http://img111.exs.cx/img111/526/asw7ag.png
Thanks n' Bye
ObiKenobi
2nd January 2005, 00:51
Very nice indeed. At the same time, it looks like in some areas that the combo gives even more detail enhancement then SSXSharpen.
Soulhunter
2nd January 2005, 01:04
If you dont like this effect, just lower the tresh of aSharp!
Btw, if you "hack" this combo into LimitedSharpen...
# LimitedSharpen
#
# A multi-purpose sharpener by Didée, hacked by Akirasuto n' Soulhunter... ^^
#
function LimitedSharpen2( clip clp,
\ float "ss_x", float "ss_y",
\ int "dest_x", int "dest_y",
\ int "Smode" , int "strength", int "radius",
\ int "Lmode", bool "wide", int "overshoot",
\ bool "soft", int "edgemode", bool "special",
\ int "exborder" )
{
ox = clp.width
oy = clp.height
ss_x = default( ss_x, 1.5 )
ss_y = default( ss_y, 1.5 )
dest_x = default( dest_x, ox )
dest_y = default( dest_y, oy )
Smode = default( Smode, 4 )
strength = Smode==1
\ ? default( strength, 160 )
\ : default( strength, 100 )
strength = Smode==2&&strength>100 ? 100 : strength
radius = default( radius, 2 )
Lmode = default( Lmode, 1 )
wide = default( wide, false )
overshoot= default( overshoot, 1)
overshoot= overshoot<0 ? 0 : overshoot
soft = default( soft, false )
edgemode = default( edgemode, 0 )
special = default( special, false )
exborder = default( exborder, 0)
xxs=round(ox*ss_x/8)*8
yys=round(oy*ss_y/8)*8
smx=exborder==0?dest_x:round(dest_x/Exborder/4)*4
smy=exborder==0?dest_y:round(dest_y/Exborder/4)*4
clp.isYV12() ? clp : clp.converttoyv12()
ss_x != 1.0 || ss_y != 1.0 ? last.lanczosresize(xxs,yys) : last
tmp = last
edge = logic( tmp.DEdgeMask(0,255,0,255,"5 10 5 0 0 0 -5 -10 -5", divisor=2)
\ ,tmp.DEdgeMask(0,255,0,255,"5 0 -5 10 0 -10 5 0 -5", divisor=2)
\ ,"max").levels(0,0.86,128,0,255,false)
bright_limit = (soft == true) ? tmp.blur(1.0) : tmp
dark_limit = bright_limit.inpand()
bright_limit = bright_limit.expand()
dark_limit = (wide==false) ? dark_limit : dark_limit .inflate.deflate.inpand()
bright_limit = (wide==false) ? bright_limit : bright_limit.deflate.inflate.expand()
minmaxavg = special==false
\ ? yv12lutxy(bright_limit,dark_limit,yexpr="x y + 2 /")
\ : maskedmerge(dark_limit,bright_limit,tmp,Y=3,U=-128,V=-128)
Str=string(float(strength)/100.0)
normsharp = Smode==1 ? unsharpmask(strength,radius,0)
\ : Smode==2 ? sharpen(float(strength)/100.0)
\ : Smode==3 ? yv12lutxy(tmp,minmaxavg,yexpr="x x y - "+Str+" * +")
\ : asharp(2,0,0).awarpsharp(3,1,bm=3,cm=0,thresh=0.99)
OS = string(overshoot)
Lmode == 1 ? yv12lutxy( bright_limit, normsharp, yexpr="y x "+OS+" + < y x "+OS+" + ?")
\ : yv12lutxy( bright_limit, normsharp, yexpr="y x "+OS+" + < y x y x - "+OS+" - 1 2 / ^ + "+OS+" + ?")
Lmode == 1 ? yv12lutxy( dark_limit, last, yexpr="y x "+OS+" - > y x "+OS+" - ?")
\ : yv12lutxy( dark_limit, last, yexpr="y x "+OS+" - > y x x y - "+OS+" - 1 2 / ^ - "+OS+" - ?")
edgemode==0 ? NOP
\ : edgemode==1
\ ? MaskedMerge(tmp,last,edge.inflate.inflate.blur(1.0),Y=3,U=1,V=1)
\ : MaskedMerge(last,tmp,edge.inflate.inflate.blur(1.0),Y=3,U=1,V=1)
(ss_x != 1.0 || ss_y != 1.0)
\ || (dest_x != ox || dest_y != oy) ? lanczosresize(dest_x,dest_y) : last
ex=blankclip(last,width=smx,height=smy,color=$FFFFFF).addborders(2,2,2,2).coloryuv(levels="TV->PC")
\.blur(1.3).inpand().blur(1.3).bicubicresize(dest_x,dest_y,1.0,.0)
tmp=clp.lanczosresize(dest_x,dest_y)
clp.isYV12() ? ( exborder==0 ? tmp.mergeluma(last)
\ : maskedmerge(tmp,last,ex,Y=3,U=1,V=1) )
\ : ( exborder==0 ? tmp.mergeluma(last.converttoyuy2())
\ : tmp.mergeluma( maskedmerge(tmp.converttoyv12(),last,ex,Y=3,U=1,V=1)
\ .converttoyuy2()) )
return last
}
#
It produces something like this...
http://img40.exs.cx/img40/5130/aswls7ex.png
Bye
ObiKenobi
2nd January 2005, 01:06
Even better looking. I will definitely be doing some testing with that.
Dreassica
2nd January 2005, 01:36
hmm, vdub doesnt even load when i use this hack.
Soulhunter
2nd January 2005, 02:04
Originally posted by Dreassica
hmm, vdub doesnt even load when i use this hack.
Does the "non hacked" version of LimitedSharpen work for you?
Bye
Socio
2nd January 2005, 02:12
Going to test this LimitedSharpen hack my self the pic looks pretty damn nice.
BTW Soulhunter what does the call script for the hacked LimitedSharpen look like?
Dreassica
2nd January 2005, 02:12
Looks like textpad (which i used to edit this into) i steh culprit, with its whining about unicode/ansi crap. resaved it properly and now it does load. Let the mfps rendering begin ;0
Soulhunter
2nd January 2005, 02:17
Originally posted by Dreassica
Let the mfps rendering begin ;0
Nah, not at all... ;)
The combo itself should run @ "above realtime" speed!
Bye
Dreassica
2nd January 2005, 02:26
Not in the script I'll be using this in :P
Soulhunter
2nd January 2005, 02:32
Originally posted by Socio
BTW Soulhunter what does the call script for the hacked LimitedSharpen look like?
The default is...
LimitedSharpen2(Smode=4)
But you can disable super-sampling...
LimitedSharpen2(ss_x=1,ss_y=1,Smode=4)
Bye
Socio
2nd January 2005, 02:39
Thanks!
Looks like the only real change is Smode to 4 so one could still use the full LimitedSharpen call like the following correct?
LimitedSharpen2( ss_x=1.0, ss_y=1.0,
\ Smode=4, strength=40, radius=2,
\ Lmode=1, wide=false, overshoot=1,
\ soft=false, edgemode=0, special=false,
\ exborder=0 )
Soulhunter
2nd January 2005, 02:47
Yeah, you should be able to use it with all the other stuff!
Update:
# aSaWLimitedSharpen
#
# A multi-purpose sharpener by Didée, midified by Akirasuto n' Soulhunter
#
function aSaWLimitedSharpen( clip clp,
\ float "ss_x", float "ss_y",
\ int "dest_x", int "dest_y",
\ int "Smode" , int "strength", int "radius",
\ int "Lmode", bool "wide", int "overshoot",
\ bool "soft", int "edgemode", bool "special",
\ float "aSharpS", float "aWThresh", int "exborder" )
{
ox = clp.width
oy = clp.height
ss_x = default( ss_x, 1 )
ss_y = default( ss_y, 1 )
dest_x = default( dest_x, ox )
dest_y = default( dest_y, oy )
Smode = default( Smode, 4 )
strength = Smode==1
\ ? default( strength, 160 )
\ : default( strength, 100 )
strength = Smode==2&&strength>100 ? 100 : strength
radius = default( radius, 2 )
Lmode = default( Lmode, 1 )
aSharpS = default(aSharpS, 0.5)
aWThresh = default(aWThresh,0.75)
wide = default( wide, false )
overshoot= default( overshoot, 1)
overshoot= overshoot<0 ? 0 : overshoot
soft = default( soft, false )
edgemode = default( edgemode, 0 )
special = default( special, false )
exborder = default( exborder, 0)
xxs=round(ox*ss_x/8)*8
yys=round(oy*ss_y/8)*8
smx=exborder==0?dest_x:round(dest_x/Exborder/4)*4
smy=exborder==0?dest_y:round(dest_y/Exborder/4)*4
clp.isYV12() ? clp : clp.converttoyv12()
ss_x != 1.0 || ss_y != 1.0 ? last.lanczosresize(xxs,yys) : last
tmp = last
edge = logic( tmp.DEdgeMask(0,255,0,255,"5 10 5 0 0 0 -5 -10 -5", divisor=2)
\ ,tmp.DEdgeMask(0,255,0,255,"5 0 -5 10 0 -10 5 0 -5", divisor=2)
\ ,"max").levels(0,0.86,128,0,255,false)
bright_limit = (soft == true) ? tmp.blur(1.0) : tmp
dark_limit = bright_limit.inpand()
bright_limit = bright_limit.expand()
dark_limit = (wide==false) ? dark_limit : dark_limit .inflate.deflate.inpand()
bright_limit = (wide==false) ? bright_limit : bright_limit.deflate.inflate.expand()
minmaxavg = special==false
\ ? yv12lutxy(bright_limit,dark_limit,yexpr="x y + 2 /")
\ : maskedmerge(dark_limit,bright_limit,tmp,Y=3,U=-128,V=-128)
Str=string(float(strength)/100.0)
normsharp = Smode==1 ? unsharpmask(strength,radius,0)
\ : Smode==2 ? sharpen(float(strength)/100.0)
\ : Smode==3 ? yv12lutxy(tmp,minmaxavg,yexpr="x x y - "+Str+" * +")
\ : asharp(aSharpS,0,0).awarpsharp(3,1,bm=3,cm=0,aWThresh)
OS = string(overshoot)
Lmode == 1 ? yv12lutxy( bright_limit, normsharp, yexpr="y x "+OS+" + < y x "+OS+" + ?")
\ : yv12lutxy( bright_limit, normsharp, yexpr="y x "+OS+" + < y x y x - "+OS+" - 1 2 / ^ + "+OS+" + ?")
Lmode == 1 ? yv12lutxy( dark_limit, last, yexpr="y x "+OS+" - > y x "+OS+" - ?")
\ : yv12lutxy( dark_limit, last, yexpr="y x "+OS+" - > y x x y - "+OS+" - 1 2 / ^ - "+OS+" - ?")
edgemode==0 ? NOP
\ : edgemode==1
\ ? MaskedMerge(tmp,last,edge.inflate.inflate.blur(1.0),Y=3,U=1,V=1)
\ : MaskedMerge(last,tmp,edge.inflate.inflate.blur(1.0),Y=3,U=1,V=1)
(ss_x != 1.0 || ss_y != 1.0)
\ || (dest_x != ox || dest_y != oy) ? lanczosresize(dest_x,dest_y) : last
ex=blankclip(last,width=smx,height=smy,color=$FFFFFF).addborders(2,2,2,2).coloryuv(levels="TV->PC")
\.blur(1.3).inpand().blur(1.3).bicubicresize(dest_x,dest_y,1.0,.0)
tmp=clp.lanczosresize(dest_x,dest_y)
clp.isYV12() ? ( exborder==0 ? tmp.mergeluma(last)
\ : maskedmerge(tmp,last,ex,Y=3,U=1,V=1) )
\ : ( exborder==0 ? tmp.mergeluma(last.converttoyuy2())
\ : tmp.mergeluma( maskedmerge(tmp.converttoyv12(),last,ex,Y=3,U=1,V=1)
\ .converttoyuy2()) )
return last
}
#
Bye
Didée
2nd January 2005, 03:13
Under investigation. Looks promising, but I have some doubts ;) about speed advantage in LS (the currently used sharpeners by themselves aren't slow, as well ... it's the complete bunch of operations together that suck the CPU time).
And let me ask here, too: in *what* way have the used DLLs of aSharp and aWarpSharp been modified? To know what's actually going on would help on further improvement ... after all, LimitedSharpenEX gets closer to completion - but perhaps a few days more would be beneficial ;)
ObiKenobi
2nd January 2005, 03:16
Originally posted by Didée
And let me ask here, too: in *what* way have the used DLLs of aSharp and aWarpSharp been modified?
Changed from what? They haven't been changed for quite some time since MarcFD stopped coding.
Didée
2nd January 2005, 03:29
I heard a rumour those DLLs were "slightly modified". But looking at the file dates, and remembering that MarcFD wasn't the busyiest with releasing sources ...
Soulhunter?
Soulhunter
2nd January 2005, 03:37
Originally posted by Didée
Under investigation. Looks promising, but I have some doubts about speed advantage in LS (the currently used sharpeners by themselves aren't slow, as well ... it's the complete bunch of operations together that suck the CPU time).
Well, at least you dont need super-sampling anymore... ;)
And getting SSXS a'like results in realtime is enough for me!
Originally posted by Didée
And let me ask here, too: in *what* way have the used DLLs of aSharp and aWarpSharp been modified? To know what's actually going on would help on further improvement ... after all, LimitedSharpenEX gets closer to completion - but perhaps a few days more would be beneficial
Have to ask pruned for the exact changes...
IIRC it was about "finer precision" or something like this!?
Bye
Leak
2nd January 2005, 12:33
Originally posted by Soulhunter
Have to ask pruned for the exact changes...
IIRC it was about "finer precision" or something like this !?!
Well, since it looks like he reverse engineered it (adding an extra tweak parameter (what's it do? :D) and more chroma modes doesn't really work with mere patching) - could you ask him if he'd release the source? The aWarpSharp used in ffdshow never really worked right for me, and this would be a great opportunity to get it working... ;)
One can dream, right? ;)
np: Autechre - Lowride (Incunabula)
AS
2nd January 2005, 14:54
He didn't reversed engineered awarpsharp since he made awarpsharp to begin with ^_~
The modified awarpsharp does a shock filtering and the asharp to do real sharpening, iirc. I could be wrong, though ^^;
Edit: Oops, I was corrected... wrong person.
Wilbert
2nd January 2005, 15:09
I thought aWarpSharp was made by marcFD?
btw, the source of asharp should be available (at least I have the "old" source) since it's GPL.
Socio
2nd January 2005, 15:37
Well what ever pruned did it works well!
Soulhunter,
The hacked LimitedSharpen script works great!
I tried it out using Zoomplayer+ffdshow-avisynth in real time and got noticeable image improvement with only about an average 5% increase in CPU usage.
Here are some pic's ( I know not the exact same frame but you can get the idea):
Normal
http://img147.exs.cx/img147/3656/nosharpen6xy.jpg
LimitedSharpen @ LimitedSharpen(ss_x=1.0,ss_y=1.0,Smode=3,strength=40
http://img147.exs.cx/img147/6754/limitedsharpen0co.jpg
LimitedSharpen2 @ LimitedSharpen2(ss_x=1.0,ss_y=1.0,Smode=4,strength=40,aSharpS=1)
http://img147.exs.cx/img147/5638/linitedsharp25bi.jpg
LimitedSharpen @ aSharp(0.4,0,0.LimitedSharpen(ss_x=1.0,ss_y=1.0,Smode=3,strength=40
http://img28.exs.cx/img28/8233/lswithasharp6vl.jpg
LimitedSharpen2 with hacked version of IIP
http://img48.exs.cx/img48/1732/ls2iip7mr.jpg
Soulhunter
2nd January 2005, 16:47
Ok, I asked pruned for the exact changes...
- Chroma to luma warper
- Improved stability
- Improved precision
- Other small fixes
@ Leak
Seems he wont release the source!
Bye
Didée
2nd January 2005, 18:10
Shall I calm down the hype a little?
Regarding usage within LimitedSharpen:
LimitedSharpen(strength=150) gives practically the same result than LimitedSharpen2(), except for some of the minor warping effects (obviously) - only that the original function runs 2%~3% faster, at least on the machine I tested it on (Celeron2600). Honestly, I see hardly an improvement.
Regarding the plain combo:
Generally, aSharp oversharps just like any other sharpener does. The genious trick here is that it's only used with such low settings that no visible oversharpening occurs with usual input. So it could have been any other sharpener as well, it's not like this was the "magic combo" :) ... except perhaps for some aSharp specific things like the block adaptive stuff - but I think those are disabled anyways with the suggested settings (are they? I don't know aSharp that good :o )
Socio
2nd January 2005, 18:17
Problem;
After watching a DVD a bit using the new LimitedSharpen2 I noticed that some edges are askew and develop a life of their own. Vertical edges tend to have strange spiraling lines that move along those edges from bottom to top. Horizontal edges have jagged lines that move as well.
The lower I set "aSharpS=" the less predominant the anomalies become however this also reduces the aSharp sharpening enhancement to the point of a no gain for no anomalies.
I have no such problems with the Original LimitedSharpen so it must have something to do with either the new script or the dll's themselves.
Soulhunter
2nd January 2005, 18:29
@ Socio
Do you get this effect also with the original combo?
aSharp(0.5,0,0).aWarpsharp(3,1,bm=3,cm=0,thresh=0.99)
Bye
Socio
2nd January 2005, 19:14
Here is a pic of the strange edges (they move or are animated during playback) I get using LimitedSharpen2, the image has been re-sized to easier to see the anomalies. (just look at the back of the chair)
Normal
http://img28.exs.cx/img28/8336/normaledge3ev.jpg
LimitedSharpen2
http://img28.exs.cx/img28/120/edges3ex.jpg
Socio
2nd January 2005, 19:56
Originally posted by Soulhunter
@ Socio
Do you get this effect also with the original combo ???
aSharp(0.5,0,0).aWarpsharp(3,1,bm=3,cm=0,thresh=0.99)
Maybe its possible to replace aSharp with something else (maybe even with LS) !?!
Bye
I have not tried just the combo yet but have found just the opposite of replacing aSharp with LS. I tried using the new aSharp before LS and get excellent results no anomalies, looks like this;
aSharp(0.4,0,0)
LimitedSharpen(ss_x=1.0,ss_y=1.0,Smode=3,strength=40
If I tried the same thing with aWarpsharp and I get the edge anomalies so it appears it is aWarpsharp that is causing my problems not aSharp. So perhaps pruned needs to turn something down a bit in that aWarpsharp.dll.
I am going to post a fourth pick with the above settings in my previous post with the other three pic's
Leak
2nd January 2005, 21:17
Originally posted by Soulhunter
@ Leak
Seems he wont release the source !!!
Well, I at least had to try... :D
np: Gescom - Megamix (ISS:SA)
Soulhunter
2nd January 2005, 21:30
Originally posted by Socio
If I tried the same thing with aWarpsharp and I get the edge anomalies so it appears it is aWarpsharp that is causing my problems not aSharp.
Have you used aWarpSharp before or after LimitedSharpen?
And, are this artefacts already in the source?
Maybe aWarpSharp just amplified them...
Bye
Socio
2nd January 2005, 22:38
Originally posted by Soulhunter
Have you used aWarpSharp before or after LimitedSharpen ???
Both
And, are this artefacts already in the source ???
No
Maybe aWarpSharp just amplified them...
No, it is for sure the aWarpSharp.dll though;
I tried the combo with the same results I will mess with the settings some more maybe turn them down some to see if it effects it.
Bye
Soulhunter
2nd January 2005, 23:14
@ Socio
Could you maybe post the source frame of the pic above?
Bye
Socio
2nd January 2005, 23:37
Originally posted by Soulhunter
@ Socio
Could you maybe post the source frame of the pic above ???
Bye
Done, I put it in the post with the other pic for easier comparison.
Soulhunter
3rd January 2005, 03:36
Originally posted by Socio
Done, I put it in the post with the other pic for easier comparison.
Hmm, for some reason Im not able to reproduce your result... :confused:
Here (http://img22.exs.cx/img22/3951/ssx1ssy1asahrps21km.png) is the source frame + Limitedsharpen2(ss_x=1,ss_y=1,aSharpS=2)
Bye
Socio
3rd January 2005, 15:57
Wow!
Your pic looks real good, yet when I try the exact same settings I get the bad edges I even get them using aWarpsharp by it self.
Obviously something is interfering with aWarpsharp do not know if it is my video drivers, perhaps another dll in my plugin folder is causing a conflict I will have to do some more investigating.
Thanks
Socio
3rd January 2005, 22:33
I figured it out;
I changed the thresh to 0.5 and BM to 2 and no more edges problems. I edited the Limitedsharpen2 script to refelect those changes and it works great.
Socio
4th January 2005, 16:26
I added another Yoda pic using LimitedSharpen2 and my hacked version of IIP\LimitedSharpen combo which I removed the LimitedSharpen part.
Didée
4th January 2005, 17:09
Originally posted by Socio
my hacked version of IIP\LimitedSharpen combo which I removed the LimitedSharpen part. Well, congratulations for "hacking" the script, where you simply could have called iiP with "Xstren=0" ...
(In future, I will make all my scripts sans parameters, and say "if you wanna adjust anything, please hack the script yourself." - Fine with me: that's less work. *much* less ...) :D
BTW, your latest picture reminds me a little of LS-EX, which (hopefully) should run faster than iiP, once it's fully finished. Currently, both are roughly on par.
Soulhunter
4th January 2005, 18:04
Added (http://forum.doom9.org/showthread.php?s=&postid=587763#post587763) a parameter to change aWarpSharp's treshold... ^^
Bye
Socio
4th January 2005, 23:33
Originally posted by Didée
Well, congratulations for "hacking" the script, where you simply could have called iiP with "Xstren=0" ...
:eek: I spent half a day doing trial and error trying to remove LimitedSharpen from IIP and all I had to do was change one parameter to 0 to turn it off. Talk about not seeing the forest for the trees!
Didée
5th January 2005, 08:59
Hah, I found an even faster method than this aSharp().aWarpsharp() combo !!!
Try the following:
sharpen(0.2)
W00T! ;)
***
But seriously. A method to *really* do a minimal version of LS was pointed out by kassandro, uses his RemoveGrain filter set (http://www.removegrain.de.tf/), and was named ModerateSharpen():
# a function by kassandro.
# (just made "repmode" a parameter / Didée)
function ModerateSharpen(clip input, float amount, int "repmode")
{
repmode = default(repmode,1)
sharpened = Sharpen(input, amount)
return Repair(sharpened, input, mode=repmode)
}
This one should run above realtime without any problems. Practicable "repmode"s are 1 & 2. Maximal "amount" is 1.0, but one should use less, because of the aliasing problem.
Ark
5th January 2005, 20:40
Originally posted by Didée
Hah, I found an even faster method than this aSharp().aWarpsharp() combo !!!
Try the following:
sharpen(0.2)
W00T! ;)
***
But seriously. A method to *really* do a minimal version of LS was pointed out by kassandro, uses his RemoveGrain filter set (http://www.removegrain.de.tf/), and was named ModerateSharpen():
# a function by kassandro.
# (just made "repmode" a parameter / Didée)
function ModerateSharpen(clip input, float amount, int "repmode")
{
repmode = default(repmode,1)
sharpened = Sharpen(input, amount)
return Repair(sharpened, input, mode=repmode)
}
This one should run above realtime without any problems. Practicable "repmode"s are 1 & 2. Maximal "amount" is 1.0, but one should use less, because of the aliasing problem.
I tried it some time ago and for me it's veeeery like an XSharpen without those "dancing" pixels seen in XSharpen used at high values, so it can be a nice candidate for "supersampled" use, from the simplest
Lanczosresize(x*2,y*2).Moderatesharpen(1.0).Lanczosresize(x,y)
to more the complicted ways *you* can think of :D .....
Socio
6th January 2005, 00:40
Originally posted by Didée
But seriously. A method to *really* do a minimal version of LS was pointed out by kassandro, uses his RemoveGrain filter set (http://www.removegrain.de.tf/), and was named ModerateSharpen():
# a function by kassandro.
# (just made "repmode" a parameter / Didée)
function ModerateSharpen(clip input, float amount, int "repmode")
{
repmode = default(repmode,1)
sharpened = Sharpen(input, amount)
return Repair(sharpened, input, mode=repmode)
}
This one should run above realtime without any problems. Practicable "repmode"s are 1 & 2. Maximal "amount" is 1.0, but one should use less, because of the aliasing problem.
I tried it out and it is no LS-LS2 but does do a nice job and very light on resources.
BTW: If I go past 0.2 I will get similar edge jaggies that I get with LS2-Thresh above 0.5, very strange.
dvwannab
19th January 2005, 02:19
some help please. I am getting a VDmod error : "there is no function asharp" line 63.
script:
LoadPlugin("C:\PROGRA~1\GORDIA~1\AviSynthPlugins\dgdecode.dll")
LoadPlugin("C:\PROGRA~1\GORDIA~1\AviSynthPlugins\plugins\MaskTools.dll")
Import("C:\PROGRA~1\GORDIA~1\AviSynthPlugins\plugins\limitedsharpen2.avs")
mpeg2source("D:\ReplayTV\Local_Guide\FraCro.d2v")
Limitedsharpen2(ss_x=1,ss_y=1,Smode=4,aSharpS=0.4,aWThresh=0.99)
__________________________________________
code:
# LimitedSharpen2()
#
# A multi-purpose sharpener by Didée, hacked by Akirasuto n' Soulhunter... ^^
#
function LimitedSharpen2( clip clp,
\ float "ss_x", float "ss_y",
\ int "dest_x", int "dest_y",
\ int "Smode" , int "strength", int "radius",
\ int "Lmode", bool "wide", int "overshoot",
\ bool "soft", int "edgemode", bool "special",
\ float "aSharpS", float "aWThresh", int "exborder" )
{
ox = clp.width
oy = clp.height
ss_x = default( ss_x, 1 )
ss_y = default( ss_y, 1 )
dest_x = default( dest_x, ox )
dest_y = default( dest_y, oy )
Smode = default( Smode, 4 )
strength = Smode==1
\ ? default( strength, 160 )
\ : default( strength, 100 )
strength = Smode==2&&strength>100 ? 100 : strength
radius = default( radius, 2 )
Lmode = default( Lmode, 1 )
aSharpS = default(aSharpS, 0.5)
aWThresh = default(aWThresh,0.75)
wide = default( wide, false )
overshoot= default( overshoot, 1)
overshoot= overshoot<0 ? 0 : overshoot
soft = default( soft, false )
edgemode = default( edgemode, 0 )
special = default( special, false )
exborder = default( exborder, 0)
xxs=round(ox*ss_x/8)*8
yys=round(oy*ss_y/8)*8
smx=exborder==0?dest_x:round(dest_x/Exborder/4)*4
smy=exborder==0?dest_y:round(dest_y/Exborder/4)*4
clp.isYV12() ? clp : clp.converttoyv12()
ss_x != 1.0 || ss_y != 1.0 ? last.lanczosresize(xxs,yys) : last
tmp = last
edge = logic( tmp.DEdgeMask(0,255,0,255,"5 10 5 0 0 0 -5 -10 -5", divisor=2)
\ ,tmp.DEdgeMask(0,255,0,255,"5 0 -5 10 0 -10 5 0 -5", divisor=2)
\ ,"max").levels(0,0.86,128,0,255,false)
bright_limit = (soft == true) ? tmp.blur(1.0) : tmp
dark_limit = bright_limit.inpand()
bright_limit = bright_limit.expand()
dark_limit = (wide==false) ? dark_limit : dark_limit .inflate.deflate.inpand()
bright_limit = (wide==false) ? bright_limit : bright_limit.deflate.inflate.expand()
minmaxavg = special==false
\ ? yv12lutxy(bright_limit,dark_limit,yexpr="x y + 2 /")
\ : maskedmerge(dark_limit,bright_limit,tmp,Y=3,U=-128,V=-128)
Str=string(float(strength)/100.0)
normsharp = Smode==1 ? unsharpmask(strength,radius,0)
\ : Smode==2 ? sharpen(float(strength)/100.0)
\ : Smode==3 ? yv12lutxy(tmp,minmaxavg,yexpr="x x y - "+Str+" * +")
\ : asharp(aSharpS,0,0).awarpsharp(3,1,bm=3,cm=0,aWThresh)
OS = string(overshoot)
Lmode == 1 ? yv12lutxy( bright_limit, normsharp, yexpr="y x "+OS+" + < y x "+OS+" + ?")
\ : yv12lutxy( bright_limit, normsharp, yexpr="y x "+OS+" + < y x y x - "+OS+" - 1 2 / ^ + "+OS+" + ?")
Lmode == 1 ? yv12lutxy( dark_limit, last, yexpr="y x "+OS+" - > y x "+OS+" - ?")
\ : yv12lutxy( dark_limit, last, yexpr="y x "+OS+" - > y x x y - "+OS+" - 1 2 / ^ - "+OS+" - ?")
edgemode==0 ? NOP
\ : edgemode==1
\ ? MaskedMerge(tmp,last,edge.inflate.inflate.blur(1.0),Y=3,U=1,V=1)
\ : MaskedMerge(last,tmp,edge.inflate.inflate.blur(1.0),Y=3,U=1,V=1)
(ss_x != 1.0 || ss_y != 1.0)
\ || (dest_x != ox || dest_y != oy) ? lanczosresize(dest_x,dest_y) : last
ex=blankclip(last,width=smx,height=smy,color=$FFFFFF).addborders(2,2,2,2).coloryuv(levels="TV->PC")
\.blur(1.3).inpand().blur(1.3).bicubicresize(dest_x,dest_y,1.0,.0)
tmp=clp.lanczosresize(dest_x,dest_y)
clp.isYV12() ? ( exborder==0 ? tmp.mergeluma(last)
\ : maskedmerge(tmp,last,ex,Y=3,U=1,V=1) )
\ : ( exborder==0 ? tmp.mergeluma(last.converttoyuy2())
\ : tmp.mergeluma( maskedmerge(tmp.converttoyv12(),last,ex,Y=3,U=1,V=1)
\ .converttoyuy2()) )
return last
}
#
Socio
19th January 2005, 02:33
You need to download aWarpsharp and aSharp plugins and load them as well.
Should look like this:
SetMemoryMax(96)
Import("C:\Program Files\AviSynth 2.5\plugins\LimitedSharpen2.avs")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\MaskTools.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\WarpSharp.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\asharp.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\aWarpSharp.dll")
LimitedSharpen2( ss_x=1.0, ss_y=1.0,
\ Smode=4, strength=40, radius=2,aSharpS=1,
\ Lmode=1, wide=false, overshoot=1,
\ soft=false, edgemode=0, special=false,
\ exborder=0 )
Boulder
19th January 2005, 08:00
Trust me, you don't want to put any warpsharp.dll in the autoloading plugins folder. Just to be safe you know;)
dvwannab
20th January 2005, 18:19
thanks guys, it worked. Looks good ;)
dvwannab
20th January 2005, 20:52
what does SetMemoryMax() do and what is the purpose?
DeepDVD
20th January 2005, 22:38
Originally posted by dvwannab
what does SetMemoryMax() do and what is the purpose?
It's a limitation of memory usage. Some buggy filters don't work without a limitation as i read in some threads before. Also you can handle the usage by yourself for whatever reason :D
Leak
21st January 2005, 08:09
Originally posted by Boulder
Trust me, you don't want to put any warpsharp.dll in the autoloading plugins folder. Just to be safe you know;)
I agree - but we're talking about aWarpSharp here, which I never had a problem with when it's autoloaded; it's the non-"a" warpsharp DLLs that cause trouble. :)
Boulder
21st January 2005, 08:16
Yep, I should have been a bit more clear..I meant any of the warpsharp.dlls that are out there. I think there are several of which some seem to work and some don't:D
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.