05-19-2006, 04:45 AM
|
Free Member
|
|
Join Date: Mar 2004
Location: Sussex / England
Posts: 175
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Hello,
I am trying to configure a new script, just trying a few things differently etc. Been looking into using these functions in my script :
LRemoveDust_YV12(17,1)
LimitedSharpen()
i thought LRemoveDust was a function of the new RemoveGrain filter package which is installed in my filter folder in avisynth, Dont know about LimitedSharpen though?
When i run my script Avisynth states it doesnt recognize the functions.
My question is where do i get the filters that provide the functions in the above script. I have read many posts about these functions but they all kind of seem a bit bewildering. Wanted to try them because a lot of members state they are so good.
Any help appreciated.
Thanks,
Blubear
|
Someday, 12:01 PM
|
|
Site Staff / Ad Manager
|
|
Join Date: Dec 2002
Posts: 42
Thanks: ∞
Thanked 42 Times in 42 Posts
|
|
|
05-19-2006, 05:03 AM
|
Free Member
|
|
Join Date: May 2003
Posts: 10,463
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Actually, these are "functions of functions".
You have to save the following with the extension ".avsi" into the plugin directory of Avisynth :
Code:
function LRemoveDust_YV12(clip input, int clmode, int "limit")
{
input=Crop(input,0,0,-0,-0,true)
limit=default(limit,2)
clmode=default(clmode,17)
repmode = 2
clensed = Clense(input)
rep = Repair(clensed, input, mode=repmode)
rg = RemoveGrain(rep, mode=clmode)
return LimitChange(rg, input, limit, limitU=255)
}
# 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 )
#
function LimitedSharpen( 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 = logic( tmp.DEdgeMask(0,255,0,255,"8 16 8 0 0 0 -8 -16 -8", divisor=4)
\ ,tmp.DEdgeMask(0,255,0,255,"8 0 -8 16 0 -16 8 0 -8", divisor=4)
\ ,"max") .yv12lut("x 128 / 0.86 ^ 255 *") #.levels(0,0.86,128,0,255,false)
tmpsoft = tmp.removegrain(11,-1)
dark_limit1 = tmp.inpand()
bright_limit1 = tmp.expand()
dark_limit = (wide==false) ? dark_limit1 : dark_limit1 .removegrain(20,-1).inpand()
bright_limit = (wide==false) ? bright_limit1 : bright_limit1.removegrain(20,-1).expand()
minmaxavg = special==false
\ ? yv12lutxy(dark_limit1,bright_limit1,yexpr="x y + 2 /")
\ : maskedmerge(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 ? yv12lutxy(tmp,minmaxavg,yexpr="x x y - "+Str+" * +")
\ : yv12lutxy(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)
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 "+US+" - > y x "+US+" - ?")
\ : yv12lutxy( dark_limit, last, yexpr="y x "+US+" - > y x x y - "+US+" - 1 2 / ^ - "+US+" - ?")
normal=last
OS2 = "0"
US2 = "0"
yv12lutxy( bright_limit, normsharp, yexpr="y x "+OS2+" + < y x "+OS2+" + ?")
yv12lutxy( dark_limit, last, yexpr="y x "+US2+" - > y x "+US2+" - ?")
zero=last
Lmode==3 ? maskedmerge(normal,zero,edge.inflate()) : normal
edgemode==0 ? last
\ : edgemode==1 ? MaskedMerge(tmp,last,edge.inflate().inflate().removegrain(11,-1),Y=3,U=1,V=1)
\ : MaskedMerge(last,tmp,edge.inflate().inflate().removegrain(11,-1),Y=3,U=1,V=1)
AMNT = string(soft)
AMNT2 = string(100-soft)
sharpdiff=yv12lutxy(tmp,last,"x y - 128 +")
sharpdiff2=yv12lutxy(sharpdiff,sharpdiff.removegrain(19,-1),"x 128 - abs y 128 - abs > y "+AMNT+" * x "+AMNT2+" * + 100 / x ?")
soft==0 ? last : yv12lutxy(tmp,sharpdiff2,"x y 128 - -")
(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()) )
(edgemode!= -1) ? last : edge.lanczosresize(dest_x,dest_y).greyscale
return last
}
Note : instead of LimitedSharpen, I suggest you to use LimitedSharpenFaster, that is a lot faster, but needs the last masktool package.
Code:
# 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
}
|
05-20-2006, 10:25 PM
|
Free Member
|
|
Join Date: Mar 2004
Location: Sussex / England
Posts: 175
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Thanks Phil,
Done as stated in your post and saved the functions as "Functions.avsi" is that OK? or should it be named as something else?
When running this script as a test:
dgdecode_mpeg2source("C:\We Were Soldiers.d2v",cpu=4)
LanczosResize(352,320,4,72,712,432)
LRemoveDust_YV12(17,1)
LimitedSharpen()
Addborders(0,128,0,12
i get the following script error:
Avisynth open failure
Script error: There is no function named "DedgeMask"(8 'v,line 79)
(C:\Documents and Settings\ Desktop\test Functions.avs,line 4)
Q. what does this error mean and how do i correct it?
Q. Do i have to alter any values in the .avsi file in relation to this:
edge = logic( tmp.DEdgeMask(0,255,0,255,"8 16 8 0 0 0 -8 -16 -8", divisor=4)
\ ,tmp.DEdgeMask(0,255,0,255,"8 0 -8 16 0 -16 8 0 -8", divisor=4)
\ ,"max") .yv12lut("x 128 / 0.86 ^ 255 *") #.levels(0,0.86,128,0,255,false)
Lastly where can i get the latest MASKTOOL package to accomodate the function LimitedSharpenFaster() and from that where do i install the package too?
Thanks,
Blubear.
|
05-21-2006, 07:37 AM
|
Free Member
|
|
Join Date: May 2003
Posts: 10,463
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Quote:
Originally Posted by Blubear
Done as stated in your post and saved the functions as "Functions.avsi" is that OK? or should it be named as something else?
|
Function.avsi is also the name I used
Quote:
Avisynth open failure
Script error: There is no function named "DedgeMask"(8 'v,line 79)
(C:\Documents and Settings\ Desktop\test Functions.avs,line 4)
Q. what does this error mean and how do i correct it?
|
That means that'ss you don't have the masktool plugin (ou you forgot to add the "loadplugin("masktool.dll") line if you did not put it in the defalut plugin directory.
Quote:
Lastly where can i get the latest MASKTOOL package to
|
http://manao4.free.fr/
Quote:
accomodate the function LimitedSharpenFaster() and from that where do i install the package too?
|
As always you can install the plugin where you want and use a loadplugin line, except if you put it into the default plugin directory.
|
05-21-2006, 11:47 AM
|
Free Member
|
|
Join Date: Mar 2004
Location: Sussex / England
Posts: 175
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Thanks phil,
I have installed the latest version of MaskTools which i think was MT_Masktools, but from reading the log inside the zip file i states it may not be compatible with AVS 2.5.5 and states 2.5.6. i have 2.5.5. installed, which version of masktools do i need to run LimitedSharpenFaster() ?
I installed an older version previously but i received an error in my script in relation to Remove Grain. Is this perhaps because i dont have 0.9 installed. I thought i had the latest version. Could you perhaps please provide a link for 0.9?
Lastly in relation to 0.9 which .dll do i need to install from the zip file for a P4 system setup?
Many Thanks,
Blubear
|
05-21-2006, 12:15 PM
|
Free Member
|
|
Join Date: May 2003
Posts: 10,463
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Quote:
Originally Posted by Blubear
which version of masktools do i need to run LimitedSharpenFaster() ?
|
I dunno. Why don't you upgrade your avisynth version ???
2.5.6 is official since several monthes and 2.5.7 betas are already released too.
Quote:
Lastly in relation to 0.9 which .dll do i need to install from the zip file for a P4 system setup?
|
Only those with SSE2 in the name when they are several versions, and all the other dll that appear in only one version in the zip.
|
05-21-2006, 04:16 PM
|
Free Member
|
|
Join Date: Mar 2004
Location: Sussex / England
Posts: 175
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Hello again,
Thanks for that. I have AVS 2.5.6 installed all .avsi file in plugin folder, Mask tools version 1 installed (aug2005) and Grain 0.9. I am receiving this script error now.
[/code][/quote]There is no function named "limitchange" (,line10)
Code:
Any ideas. I can get the LremoveDust() function to work on its own in the script but not the LimitedSharpen() or LSFaster(). I have tried both version 0.9 and 1.0 Beta of Grain and V2 Mask tools(latest).
All plugins are in the plugin folder in Avisynth.
Any ideas whats wrong here?
Blubear :roll:
|
05-21-2006, 04:18 PM
|
Free Member
|
|
Join Date: Mar 2004
Location: Sussex / England
Posts: 175
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Ooops sorry about that... Seems i cant use these fuctions now either LOL
|
05-21-2006, 04:24 PM
|
Free Member
|
|
Join Date: May 2003
Posts: 10,463
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
LimitChange is part of SSE2tool.dll, do you have it in your plugin directory ?
If it does not work, remove SSE2Tool and use SSETool that you can found in an older RemoveGrain package.
|
05-21-2006, 04:59 PM
|
Free Member
|
|
Join Date: Mar 2004
Location: Sussex / England
Posts: 175
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Hi Phil,
Yeah i have Grain SSE2.dll in my plugin folder along with repair.dll etc. I tried to put back the old ones from 0.9 Grain again SSE2 but now receive this message:
RemoveGrain:Invalid mode 19 (,line 120)
I cant use any other versions of the 0.9 Grain pack because i have found i no longer have it for some reason and the previous link given to it is dead.
All these versions of both Grain and Mask tools is confusing as hell. I am in a right old muddle now. dont know presently which version to use with what etc.
Help!
thanks,
Blubear
|
05-21-2006, 08:10 PM
|
Free Member
|
|
Join Date: May 2003
Posts: 10,463
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
I had put all the content of my plugin dir there :
http://perso.wanadoo.fr/dialhot/Avis...ll_Plugins.rar
As I have a P4 like you, you can pick all the dll you want in this archive.
|
05-22-2006, 07:50 AM
|
Free Member
|
|
Join Date: Mar 2004
Location: Sussex / England
Posts: 175
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Thanks Phil,
Sorry for all the questions and a mighty long thread.
I am much obliged to you
Blubear.
|
06-08-2006, 11:57 AM
|
Free Member
|
|
Join Date: Apr 2006
Location: Borneo Island
Posts: 20
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
I have the same problem using removegrain also. it cause me a removegrain phobia. Twice already i used this filter, paranoia 0.31b, avsedit plus avisynth will show error and close down immediatly. So i need to restore back my system before this error haapen
by the way,i'm using amd xp barton 2500++
|
06-08-2006, 05:41 PM
|
Free Member
|
|
Join Date: May 2003
Posts: 10,463
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
what error ? We can't help you without that !
|
06-10-2006, 06:20 AM
|
Free Member
|
|
Join Date: Apr 2003
Location: Chinese Democracy starts now!
Posts: 2,563
Thanks: 1
Thanked 0 Times in 0 Posts
|
|
Yeah, what error??
Unless the window just says error  .
__________________
Rui
|
All times are GMT -5. The time now is 12:03 PM — vBulletin © Jelsoft Enterprises Ltd
|