View Full Version : Hi Quality Sharpening Filters
Garda
17th June 2007, 22:37
Hi,
I want to find a good sharpening filter :)
I tested :
-SeeSaw
-LSF
What else should i try ?
ficofico
17th June 2007, 22:53
Lsf+soothe
TheRyuu
19th June 2007, 07:23
http://avisynth.org/mediawiki/External_plugins#Sharpeners
While not all are HQ, the ones that stand out are the ones you've said you've already tried.
I personally, like LSF.
chros
19th June 2007, 09:09
Try asharp !
asharp(1,6,-1,true) for xvid, x264 content (-1 means: no deblocking)
DarkT
20th June 2007, 04:55
BTW, FFT3D also has a sharpener in it...
Hironimo
20th June 2007, 13:23
LimitedSharpen might also be worth a try, if processing speed is not that important.
fight2win
20th June 2007, 14:28
pls can some1 tell how to use lsf+soothe?
foxyshadis
20th June 2007, 14:35
Fight2win,
AviSource(...)
a=last
LimitedSharpenFaster()
Soothe(a,last)
If you have questions or trouble beyond that, please, look at their respective pages on the wiki and look at the threads dedicated to them where questions have been answered repeatedly.
(Hironimo, LSF is just the common abbreviation for LimitedSharpen.)
Hironimo
20th June 2007, 15:05
>>(Hironimo, LSF is just the common abbreviation for LimitedSharpen.)
I use LSF myself. But I understand that LSF is just a special version of the basic LS that was changed to be faster.
Btw - Its a bit tricky to get all the dlls required. For details see here (http://avisynth.org/LimitedSharpen).
I use it like this:
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\mt_masktools.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\LimitedSupport_09Jan06B.dll")
LimitedSharpenFaster()
If you use more parameters for the call you might need additional libraries. Since the LimitedSupport download link doesnt work, here another: LimitedSupport_09Jan06B.dll (http://www.morkeleb.net/data/LimitedSupport_09Jan06B.dll)
foxyshadis
20th June 2007, 15:39
Updated LS and LSF should be pixel-to-pixel identical. (Barring some rare older masktools 1.x bugs.) The original LS was different, although you can ignore newer modes to emulate the original LS in LSF if you wish, still getting the optimized speed.
It's probably best to use the newer Mediawiki (http://avisynth.org/mediawiki/LimitedSharpen) for docs, since the original has been officially abandoned for a while now; for instance, LimitedSupport is long-since unnecessary. The old may go offline soon, according to Richard Berg.
Hironimo
20th June 2007, 17:19
Updated LS and LSF should be pixel-to-pixel identical. (Barring some rare older masktools 1.x bugs.) The original LS was different, although you can ignore newer modes to emulate the original LS in LSF if you wish, still getting the optimized speed.
It's probably best to use the newer Mediawiki (http://avisynth.org/mediawiki/LimitedSharpen) for docs, since the original has been officially abandoned for a while now; for instance, LimitedSupport is long-since unnecessary. The old may go offline soon, according to Richard Berg.
Ok, I'd use this new version, but when i try to download it it tells "There is currently no text in this page, you can search for this page title in other pages or edit this page".
Why does it need to version of the MaskTools?
ethereel
20th June 2007, 21:06
Combining LSF + SeeSaw is nice.
foxyshadis
21st June 2007, 04:56
Ah, another victim of the outage last year; it's reuploaded now.
LS requires masktools 1 and LSF requires 2, for simplicity I just listed both. *shrug* Not like having too many filters is a problem since 2.5.7.
Hironimo
21st June 2007, 14:14
Ah, another victim of the outage last year; it's reuploaded now.
Thanx. I got the same problem on other mediawiki pages too, and also on the same page on the bottom where three different versions are listed.
Which one do you suggest using?
TheRyuu
21st June 2007, 19:36
Thanx. I got the same problem on other mediawiki pages too, and also on the same page on the bottom where three different versions are listed.
Which one do you suggest using?
I'd use LimitedSharpenFaster. Not only is it faster but it also has the smode=4 which uses some "deep magic" to sharpen it. (thats really what it says on the wiki). And an undershoot parameter as well (line darkening). I've always like LSF because of it's easy of use compared to more complicated ones like SeeSaw. But there are limitations to LSF as the name implies. But for the speed and quality it's hard to beat.
Requires mt_masktools v2. Why use a slower one when this faster one does the same thing with the same quality with additional filters?
For clarification I mean this one (copy and paste and save as "LimitedSharpenFaster.avsi"):
# LimitedSharpen() ( a modded version, 29 Oct 2005 )
#
# A multi-purpose sharpener by Didée
#
#
# Changes in this mod:
#
# - RemoveGrain >= v0.9 IS REQUIRED!!
# ==================================
#
# - Smode=4 / sometimes does the magic ;-)
# - a separate "undershoot" parameter, to allow for some line darkening in comic or Anime
# - Lmode=3 / on edges, limited sharpening with zero OS & US. On not-edges, limited sharpening with specified OS + LS
# - "soft" acts different now: no more boolean true/false, but instead integer 0 - 100 (or -1 -> automatic)
# instead of blurring before finding minima/maxima, it now softens the "effect-of-sharpening"
# - edgemode=-1 now shows the edgemask. (scaling still not implemented :p )
#
## - MODIFIED version using MaskTools 2.0
function LimitedSharpenFaster( 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", int "undershoot",
\ int "soft", int "edgemode", bool "special",
\ int "exborder" )
{
ox = clp.width
oy = clp.height
Smode = default( Smode, 3 )
ss_x = (Smode==4)
\ ? default( ss_x, 1.25)
\ : default( ss_x, 1.5 )
ss_y = (Smode==4)
\ ? default( ss_y, 1.25)
\ : default( ss_y, 1.5 )
dest_x = default( dest_x, ox )
dest_y = default( dest_y, oy )
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)
undershoot= default( undershoot, overshoot)
softdec = default( soft, 0 )
soft = softdec!=-1 ? softdec : sqrt( (((ss_x+ss_y)/2.0-1.0)*100.0) ) * 10
soft = soft>100 ? 100 : soft
edgemode = default( edgemode, 0 )
special = default( special, false )
exborder = default( exborder, 0)
#radius = round( radius*(ss_x+ss_y)/2) # If it's you, Mug Funky - feel free to activate it again
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 = mt_logic( tmp.mt_edge(thY1=0,thY2=255,"8 16 8 0 0 0 -8 -16 -8 4")
\ ,tmp.mt_edge(thY1=0,thY2=255,"8 0 -8 16 0 -16 8 0 -8 4")
\ ,"max") .mt_lut("x 128 / 0.86 ^ 255 *") #.levels(0,0.86,128,0,255,false)
tmpsoft = tmp.removegrain(11,-1)
dark_limit1 = tmp.mt_inpand()
bright_limit1 = tmp.mt_expand()
dark_limit = (wide==false) ? dark_limit1 : dark_limit1 .removegrain(20,-1).mt_inpand()
bright_limit = (wide==false) ? bright_limit1 : bright_limit1.removegrain(20,-1).mt_expand()
minmaxavg = special==false
\ ? mt_average(dark_limit1, bright_limit1)
\ : mt_merge(dark_limit,bright_limit,tmp.removegrain(11,-1),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 ? mt_lutxy(tmp,minmaxavg,yexpr="x x y - "+Str+" * +")
\ : mt_lutxy(tmp,tmpsoft,"x y == x x x y - abs 16 / 1 2 / ^ 16 * "+Str+
\ " * x y - 2 ^ x y - 2 ^ "+Str+" 100 * 25 / + / * x y - x y - abs / * + ?")
OS = string(overshoot)
US = string(undershoot)
mt_lutxy( bright_limit, normsharp, yexpr="y x "+OS+" + < y x y x - "+OS+" - 1 2 / ^ + "+OS+" + ?")
mt_lutxy( dark_limit, last, yexpr="y x "+US+" - > y x x y - "+US+" - 1 2 / ^ - "+US+" - ?")
Lmode==1 ? mt_clamp(normsharp, bright_limit, dark_limit, overshoot, undershoot) : last
normal = last
zero = mt_clamp(normsharp, bright_limit, dark_limit, 0,0)
Lmode==3 ? mt_merge(normal,zero,edge.mt_inflate()) : normal
edgemode==0 ? last
\ : edgemode==1 ? mt_merge(tmp,last,edge.mt_inflate().mt_inflate().removegrain(11,-1),Y=3,U=1,V=1)
\ : mt_merge(last,tmp,edge.mt_inflate().mt_inflate().removegrain(11,-1),Y=3,U=1,V=1)
AMNT = string(soft)
AMNT2 = string(100-soft)
sharpdiff=mt_makediff(tmp,last)
sharpdiff2=mt_lutxy(sharpdiff,sharpdiff.removegrain(19,-1),
\ "x 128 - abs y 128 - abs > y "+AMNT+" * x "+AMNT2+" * + 100 / x ?")
soft==0 ? last : mt_makediff(tmp,sharpdiff2)
(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).mt_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)
\ : mt_merge(tmp,last,ex,Y=3,U=1,V=1) )
\ : ( exborder==0 ? tmp.mergeluma(last.converttoyuy2())
\ : tmp.mergeluma( mt_merge(tmp.converttoyv12(),last,ex,Y=3,U=1,V=1)
\ .converttoyuy2()) )
(edgemode!= -1) ? last : edge.lanczosresize(dest_x,dest_y).greyscale
return last
}
Hironimo
22nd June 2007, 12:20
It's a bit strange that so many requirements are listed when not a single one seemes needed:
For me this suffices, without any imported dlls:
Import("C:\Program Files\AviSynth 2.5\plugins\LimitedSharpenFaster.avsi")
LimitedSharpenFaster(Smode=4)
Am I doing something wrong or does it do the imports automatically now?
foxyshadis
22nd June 2007, 14:19
You don't even need the Import line. Anything in .../plugins will be autoloaded, if it's a .dll or .avsi (not .avs), except for the few C-api plugins, which means you already have removegrain and masktools.
Garda
23rd June 2007, 19:32
My output file is green ...
directshowsource("C:\graph.grf",audio=false,fps=23.976,framecount=166242)
Converttoyv12()
Crop(0,144,0,-144)
dull = last
sharp = dull.LimitedSharpen( ss_x=1.25, ss_y=1.25, strength=150, overshoot=1 )
Soothe( sharp, dull, 20 )
foxyshadis
24th June 2007, 08:00
Maybe you have a broken LS or Soothe? That would happen if masktools was getting applied incorrectly, but soothe is supposed to merge the chroma of the original into the final.
Alternately, it's always possible that it's the input stream, have you checked?
Didée
24th June 2007, 09:11
Conflict with the vanilla SeeSaw script. SeeSaw includes it's own Soothe() that doesn't care about chroma, which is tricky when it gets used outside.
Obviously, Garda is not using your cleaned-up version of SeeSaw, foxy. ;)
The easiest solution is to merge chroma back manually:
Soothe(dum,didi,bum) .MergeChroma(original)
Not quite elegant, however that's exactly what the standalone Soothe would do, anyway.
fight2win
24th June 2007, 18:52
thank you
vBulletin® v3.8.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.