头像
-o-o-304-o-o-
超级版主
帖子: 640
注册时间: 2010-10-10 20:00
来自: US
联系: 网站

Re: 各位前辈,在下真心求教

Yuricon 写了: 我这1.2不能用,就算加载的全是Leinad4Mind给的插件包...
所以一直在用1.1,估计问题在MVTools或MaskTools
对了。有个问题,一直困扰
看到各种插件和脚本很多都调用了masktools和mvtools,但是,这2个tools到底是什么方面的用途至今头脑空白无概念,喂狗了的结果也没理出头绪,弱弱的求解了(先拜谢
► 显示剧情透露 En Taro 06!Taro Pie NC Fanclub project始动!聊天用Q群开放中
► 显示剧情透露 胸中有万言,退敌无一策,是谓书生误国"
► 显示剧情透露 前辈们的信念
► 显示剧情透露 妇联招新广告,走过路过可以看看撒
► 显示剧情透露 香芋派,后期菊苣们的一致选择
► 显示剧情透露 众菊苣喜评香芋派
► 显示剧情透露 聊天用工具
264768502
核心会员
核心会员
帖子: 402
注册时间: 2010-09-23 17:38

Re: 各位前辈,在下真心求教

能看懂这两个...你修行也差不多到家了...(以RIPPER来说...
头像
xiao7
帖子: 138
注册时间: 2010-09-25 16:16

Re: 各位前辈,在下真心求教

回管理员
我就是碰到了神灵狩的蓝光1080i 不知道如何下手 最后直接用了yadif 全部给反交错了 囧 有同帧对比图 地址如下: http://www.verycd.com/topics/2862229/[/quote]
这个不是已经从I被转成了P了么
头像
Yuricon
帖子: 141
注册时间: 2010-09-20 0:19

Re: 各位前辈,在下真心求教

场匹配和插补是不同的吧
头像
06_taro
核心会员
核心会员
帖子: 998
注册时间: 2010-09-22 18:32
来自: United Kingdom
联系: 网站

Re: 各位前辈,在下真心求教

Yuricon 写了: AA我现在都不用SharpAAMCMod了,用的LSharpAAF
AnimeIVTC太重量级了。。。
LSharpAAF確實很好用……只不過反正可以寫個avsi直接加載,所以一直懶得換……反正我的腳本沒啥其他EP內容……
つまんねー事聞くなよ!

I, personally, for me, believe (obviously sometimes) that my OS choice is right. That's me. I'm not telling you that you should believe it. Learn the facts, and the origins behind the facts, and make up your own damn mind. That's why you have one. (source)

Follow me: @06_taro

304——
为纪念伟大的宇宙史上最强压制304先生,联合国教科文组织决定,将每年的第304天,即平年的10月31日或者闰年的10月30日,定为世界304日。
头像
Holy
核心会员
核心会员
帖子: 235
注册时间: 2010-09-24 9:28

Re: 各位前輩,在下真心求教

Yuricon 写了:我这1.2不能用,就算加载的全是Leinad4Mind给的插件包...
所以一直在用1.1,估计问题在MVTools或MaskTools
我把 1.2 的 bug 修了,注意 stabilize 預設是 false,而 1.1 是 stabilize=true 的行為。

代码: 全选

# LSharpAAF() by Leinad4Mind
# v1.20 updated in 2010-06-08; Removed unnecessary MVTools1 and MVToolsMulti code to only use MVTools2 by Holy in 2011-01-15
# Requirements: aWarpSharp2; EEDI2.dll; FastLineDarkenMOD.avsi; LSFmod.v1.9.avsi; MaskTools.dll; mt_masktools-26.dll(or mt_masktools-25.dll if using AviSynth 2.5.8); mvtools2.dll;
# nnedi*.dll; RemoveGrain*.dll; Repair*.dll; SangNom.dll; UnFilter.dll
# * HD; HDS; S; SSE2; SSE3; T; TSSE2; TSSE3
# 
# All AA Scripts are in this script, so there are no need to download them separately; Except some of them that you can find in AnimeIVTC, as maa, daa.
#
# This is an Anti-Aliasing Combo with some Extras like FastLineDarkenMOD, Presharpening, Postsharpening and Postsmoothing
# 
# Thanks to @ Didée, thetoof, Mystery Keeper, Soulhunter, MisterHatt, martino, mf, Akirasuto, SpikeSpiegel, ScharfisBrain & Sagekilla
#
# Example: LSharpAAF(StrDrk=18, ShPre=100, ShPost=280, SmPost=80, aatype="ediaa")
# OR: LSharpAAF(18,100,280,80,"ediaa")

function LSharpAAF(clip a, int "StrDrk", int "ShPre", int "ShPost", int "SmPost", bool "stabilize", int "tradius", int "aapel", int "aaov", int "aablk", string "aatype") {
StrDrk = default(StrDrk,38) #FastLineDarkenMOD
ShPre = default(ShPre,18) #Presharpening
ShPost = default(ShPost,300) #Postsharpening
SmPost = default(SmPost,100) #Postsmoothing
stabilize = default(stabilize,false) # Use post stabilization with Motion Compensation
tradius = default(tradius,2) # 2 = MDegrain2 / 3 = MDegrain3 
aapel = default(aapel,1) # accuracy of the motion estimation (Value can only be 1, 2 or 4. 1 means a precision to the pixel. 2 means a precision to half a pixel, 4 means a precision to quarter a pixel, produced by spatial interpolation (better but slower).)
aaov = default(aaov,(a.width>1100) ? 8 : 4) # block overlap value (horizontal). Must be even and less than block size. (Higher = more precise & slower)
aablk = default(aablk,(a.width>1100) ? 16 : 8) # Size of a block (horizontal). It's either 4, 8 or 16 ( default is 8 ). Larger blocks are less sensitive to noise, are faster, but also less accurate.
aatype = default(aatype,"EEDI2") # Use EEDI2() or EEDI3() or Sangnom() or maa() or daa() or ediaa() or AAA() or saa() or splinaa() or supaa() or naa() or shaarp() or aaf() or nnedi() or nnedi2() or nnedi3() or antialiasing() for anti-aliasing.

a = a.AssumeTFF()
w = width(a)
h = height(a)
m = mt_logic(a.DEdgeMask(0,255,0,255,"5 10 5 0 0 0 -5 -10 -5",divisor=4,Y=3,U=3,V=3),
\            a.DEdgeMask(0,255,0,255,"5 0 -5 10 0 -10 5 0 -5",divisor=4,Y=3,U=3,V=3),
\            "max").mt_lut("x 128 / 0.86 ^ 255 *")

preaa = (ShPre==0 && StrDrk==0) ? a
\ : (ShPre==0) ? a.FastLineDarkenMOD(thinning=0,strength=StrDrk)
\ : (StrDrk==0) ? a.aWarpSharp2(depth=ShPre)
\ : a.FastLineDarkenMOD(thinning=0,strength=StrDrk).aWarpSharp2(depth=ShPre)

aa = (aatype=="EEDI2") ? preaa.TurnLeft().EEDI2().TurnRight().EEDI2().Spline36Resize(w,h,0.5,-0.5,2*w+.001,2*h+.001)
\ : (aatype=="EEDI3") ? preaa.TurnLeft().EEDI3().TurnRight().EEDI3().Spline36Resize(w,h)
\ : (aatype=="Sangnom") ? preaa.Spline64Resize(w*2,h*2).TurnLeft().SangNom(aa=255).TurnRight().SangNom(aa=255).Spline36Resize(w,h)
\ : (aatype=="maa") ? preaa.maa() : (aatype=="daa") ? preaa.daa() : (aatype=="ediaa") ? preaa.ediaa() : (aatype=="AAA") ? preaa.AAA()
\ : (aatype=="saa") ? preaa.saa() : (aatype=="splinaa") ? preaa.splinaa() : (aatype=="supaa") ? preaa.supaa() : (aatype=="naa") ? preaa.naa()
\ : (aatype=="shaarp") ? preaa.shaarp() : (aatype=="aaf") ? preaa.aaf(aam=-0.7,rep=true)
\ : (aatype=="nnedi") ? preaa.nnedi(dh=true,field=1).TurnRight().nnedi(dh=true,field=1).TurnLeft().Spline36Resize(w,h)
\ : (aatype=="nnedi2") ? preaa.nnedi2(dh=true,field=1,nsize=2,qual=2).TurnRight().nnedi2(dh=true,field=1,nsize=2,qual=2).TurnLeft().Spline36Resize(w,h,0.5,-0.5,2*w+.001,2*h+.001)
\ : (aatype=="nnedi3") ? preaa.nnedi3(dh=true,field=1,nsize=2,qual=2).TurnRight().nnedi3(dh=true,field=1,nsize=2,qual=2).TurnLeft().Spline36Resize(w, h)
\ : (aatype=="antialiasing") ? preaa.antialiasing()
\ : BlankClip(pixel_type="YV12").Subtitle("Please use Sangnom, EEDI2, EEDI3, maa, daa, ediaa, AAA, ssa, splinaa, supaa, naa, shaarp, aaf, nnedi, nnedi2, nnedi3, or antialiasing for aatype")

postsh = (ShPost==0 && SmPost==0) ? aa : aa.LSFmod(edgemode=1,strength=ShPost,overshoot=1,soft=SmPost)
merged = mt_merge(a,postsh,m,Y=3,U=3,V=3)

sD = mt_makediff(a,merged)

asuper = a.MSuper(pel=aapel)
sDsuper = sD.MSuper(pel=aapel,levels=1)

fv1 = tradius>=1 ? asuper.MAnalyse(isb=false,delta=1,overlap=aaov,blksize=aablk) : nop()
bv1 = tradius>=1 ? asuper.MAnalyse(isb=true, delta=1,overlap=aaov,blksize=aablk) : nop()
fv2 = tradius>=2 ? asuper.MAnalyse(isb=false,delta=2,overlap=aaov,blksize=aablk) : nop()
bv2 = tradius>=2 ? asuper.MAnalyse(isb=true, delta=2,overlap=aaov,blksize=aablk) : nop()
fv3 = tradius==3 ? asuper.MAnalyse(isb=false,delta=3,overlap=aaov,blksize=aablk) : nop()
bv3 = tradius==3 ? asuper.MAnalyse(isb=true, delta=3,overlap=aaov,blksize=aablk) : nop()

_thSAD = 600
sDD = tradius==1 ? sD.MDegrain1(sDsuper,bv1,fv1,thSAD=_thSAD) : tradius==2 ? sD.MDegrain2(sDsuper,bv1,fv1,bv2,fv2,thSAD=_thSAD) : sD.MDegrain3(sDsuper,bv1,fv1,bv2,fv2,bv3,fv3,thSAD=_thSAD)

reduc = 0.4
sDD = mt_lutxy(sD,sDD,"x 128 - abs y 128 - abs < x y ?").MergeLuma(sDD,1.0-reduc)

return stabilize ? a.mt_makediff(sDD,U=2,V=2) : merged }

#Suggested by Mystery Keeper in "Denoise of tv-anime" thread
function ediaa(clip a) {
return a.EEDI2(field=1).TurnRight().EEDI2(field=1).TurnLeft().Spline36Resize(a.width,a.height,-0.5,-0.5) }

#Anti-aliasing with contra-sharpening by Didée
function daa(clip c) {
nn	= c.nnedi2(field=-2)
dbl   	= mt_average(selecteven(nn),selectodd(nn),U=3,V=3)
dblD 	= mt_makediff(c,dbl,U=3,V=3)
shrpD 	= mt_makediff(dbl,dbl.removegrain((width(c)>1100) ? 20 : 11),U=3,V=3)
DD 	= shrpD.repair(dblD,13)
return dbl.mt_adddiff(DD,U=3,V=3) }

#Simple Anti-aliasing by Soulhunter
function saa(Clip Clp,Int"SS",Bool"CP") {
OX = Clp.Width
OY = Clp.Height
SS = Default(SS,2)
CP = Default(CP,True)
Clp = Clp.IsYV12() ? Clp : Clp.ConvertToYV12()
Clp.PointResize(OX*SS,OY*SS).SangNom().TurnRight().SangNom().TurnLeft().BilinearResize(OX,OY)
CP ? Last : MergeChroma(Clp)
Return(Last) }

#Anti-aliasing with edge masking by martino, mask using "sobel" taken from Kintaro's useless filterscripts and modded by thetoof for spline36
function maa(clip input, int "mask") {
mask = input.mt_edge("sobel",7,7,5,5).mt_inflate()
aa_clip=input.Spline36Resize(width(input)*2,height(input)*2).TurnLeft().SangNom().TurnRight().SangNom().Spline36Resize(width(input),height(input)).MergeChroma(input) 
return mt_merge(input,aa_clip,mask) }

#AnimeAntiAliasing - Thanks to @ Didée, mf, Akirasuto, SpikeSpiegel & ScharfisBrain
function AAA(clip clp, int "Xres", int "Yres", int "Xshrp", int "Yshrp", int "US", int "DS", bool "chroma") {
clp = clp.isYV12() ? clp : clp.ConvertToYV12()
ox = clp.width
oy = clp.height
Xres  = default(Xres,  ox)
Yres  = default(Yres,  oy)
us  = default(us, 1)
ds = default(ds, 2)
Xshrp = default(Xshrp, 15)
Yshrp = default(Yshrp, 15)
chroma = default(chroma, false)

us==0 ? clp.PointResize(ox*2,oy*2) : clp.LanczosResize(ox*2,oy*2)

TurnLeft()
SangNom()

TurnRight()
SangNom()

ds==0 ? BilinearResize(Xres,Yres) : ds==1 ? BicubicResize(Xres,Yres) : LanczosResize(Xres,Yres)

Unfilter(Xshrp,Yshrp)

chroma ? MergeChroma(clp.Lanczosresize(Xres,Yres)) : last }

#Normal Anti-aliasing by Didée
function antialiasing(clip orig,int "th_luma",int "th_croma",string "type",int "aath") {

# "th_luma" & "th_croma" are the edge detection thres.: lower values=more edges filtered
# "type" is the matrix used for edge detection: with "sobel" (default) only the 
# hi-contrast edges, where artefacts are more noticeable, are filtered. If you want
# to test other matrices, read the MaskTools Guide for more info.
# "aath" = anti-aliasing strenght (default should be fine)

th_luma = Default(th_luma, 20)
th_croma = Default(th_croma, 20)
type = Default(type, "sobel")
aath = Default(aath, 48)
ox = orig.width
oy = orig.height
dx = orig.width * 2
dy = orig.height * 2
clp = orig.IsYV12() ? orig : orig.ConvertToYV12()

a=clp
b=clp.Lanczos4Resize(dx,dy).TurnLeft().SangNom(aa=aath).TurnRight().SangNom(aa=aath).LanczosResize(ox,oy)
c=clp.EdgeMask(th_luma,th_luma,th_croma,th_croma,type)
MaskedMerge(a,b,c) }

# Written by MisterHatt, based off of Soulhunter's SAA() and martino's excellent MAA(), and is slightly
# faster at times for some reason or another. These functions work by generally supersampling, usually with
# nnedi2, and then running a deinterlacer (sangnom and nnedi2 respectively) to get rid of most jaggies.
# I have no idea how destructive these are on whatever random thing people care to throw them at.
# For large supersamples, avs2yuv bitches for no real reason and requires assumeframebased() in your script.
# Requires nnedi2, sangnom, o9k hours of your life.
function splinaa(Clip Clp,Int"SS",Bool"CP") {
OX = Clp.Width
OY = Clp.Height
SS = Default(SS,2)
CP = Default(CP,True)
Clp = Clp.IsYV12() ? Clp : Clp.ConvertToYV12()
Clp.PointResize(OX*SS,OY*SS).SangNom().TurnRight().SangNom().TurnLeft().Spline36Resize(OX,OY)
CP ? Last : MergeChroma(Clp)

Return(Last) }

function supaa(Clip Clp,Int"SS",Bool"CP") {
OX = Clp.Width
OY = Clp.Height
SS = Default(SS,2)
CP = Default(CP,True)
Clp = Clp.IsYV12() ? Clp : Clp.ConvertToYV12()
Clp.nnedi2_rpow2(rfactor=SS,cshift="Spline36Resize",qual=3).SangNom().TurnRight().SangNom().TurnLeft().Spline36Resize(OX,OY)
CP ? Last : MergeChroma(Clp)

Return(Last) }

function naa(Clip Clp,Int"SS",Bool"CP") {
OX = Clp.Width
OY = Clp.Height
SS = Default(SS,2)
CP = Default(CP,True)
Clp = Clp.IsYV12() ? Clp : Clp.ConvertToYV12()
Clp.nnedi2_rpow2(rfactor=SS,cshift="Spline36Resize",qual=3).nnedi2(qual=3).TurnRight().nnedi2(qual=3).TurnLeft().Spline36Resize(OX,OY)
CP ? Last : MergeChroma(Clp)

Return(Last) }

function shaarp(clip input, int "mask", int "type") {
mask = Default(mask,1)
type = Default(type,1)
Assert(mask == 1 || mask == 2, "Please use mask = 1 or 2")
Assert(type == 1 || type == 2, "Please use type = 1 or 2")
aa_clip = (type == 1) ? input.Spline36Resize(width(input)*2,height(input)*2) : input.nnedi2_rpow2(rfactor=2,qual=3)
aa_clip = aa_clip.TurnLeft().nnedi2().TurnRight().nnedi2().Spline36Resize(width(input),height(input)).MergeChroma(input)
mask = (mask==1) ? input.mt_edge("sobel",7,7,5,5).mt_inflate() : input.mt_edge("roberts",0,4,0,4).mt_inflate()

return mt_merge(input,aa_clip,mask) }

function aaf(clip input, float "aam", int "aay", "aax", bool "rep") {
input =	input.isYV12() ? input : input.converttoyv12()

aam	= default(aam, -0.6)
aar	= aam<0 ? (aam-1)*0.25 : (aam+1)*0.25
aay	= default(aay, 28)
aax	= default(aax, aay)
rep	= default(rep, true)

sx	= width(input)
sy	= height(input)

aa	= aar<0 ? input.LanczosResize(sx,int(sy*abs(aar))*4) :
	\	aar==0.5 ? input.Pointresize(sx*2, sy*2) :
	\	input.LanczosResize(int(sx*abs(aar)*4),int(sy*abs(aar))*4)
aa	= aay>0 ? aa.SangNom(aa=aax) : input
aa	= aar<0 && aax>0 ? aa.LanczosResize(int(sx*abs(aar))*4,sy) : aa
aa	= aax>0 ? aa.turnright().SangNom(aa=aax).Turnleft() : aa
aa	= aa.LanczosResize(sx,sy)

return rep==true ? aa.repair(input,18) : aa }
图片
头像
Yuricon
帖子: 141
注册时间: 2010-09-20 0:19

Re: 各位前辈,在下真心求教

把MVTools1和MT的地方换成MVTools2了啊,果然是MVTools那部分的问题...
头像
Holy
核心会员
核心会员
帖子: 235
注册时间: 2010-09-24 9:28

Re: 各位前辈,在下真心求教

2011-11-17
1. 替換 edgemask 為 MCTemporalDenoise 裡 AA 的 edgemask。
2. 現在 HighQualitySharpen 使用 supersampling。
3. 移除 LSFmod 的 edgemode=1,速度些微提高。

2011-08-15
把 LSharpAAF 再修改了下,主要是覺得用來 post-sharpening 的 LSFmod 太拖速度了。所以參考 Taro 菊苣的做法,加入了 Didée 菊苣的 HighQualitySharpen,效果其實還不差…

修改的部分為 ShPost 參數,介於 0~1 的值使用 HighQualitySharpen,否則使用 LSFmod。大約 0.2 左右的值即可接近源的銳利度,0.3 以上就會有明顯的銳化感。

為了與原版區別故函數名改為 LSharpAAFmod。

代码: 全选

# LSharpAAF() by Leinad4Mind; modded by Holy
# v1.20 updated in 2010-06-08
# Updated in 2011-01-15. Removed unnecessary MVTools1 and MVToolsMulti code to only use MVTools2.
# Updated in 2011-08-15. Added HighQualitySharpen to Postsharpening. Values between 0~1 will use HighQualitySharpen, otherwise use LSFmod.
# Updated in 2011-11-17. Replaced edgemask with MCTemporalDenoise's AA edgemask. HighQualitySharpen uses supersampling now. Removed edgemode=1 in LSFmod, speed slightly increased.
# Requirements: aWarpSharp2; EEDI2, eedi3; FastLineDarkenMOD; LSFmod; MaskTools2; MVTools2, nnedi; nnedi2, nnedi3; RemoveGrain; Repair; SangNom; UnFilter
#
# All AA Scripts are in this script, so there are no need to download them separately; Except some of them that you can find in AnimeIVTC, as maa, daa.
#
# This is an Anti-Aliasing Combo with some Extras like FastLineDarkenMOD, Presharpening, Postsharpening and Postsmoothing
#
# Thanks to @ Didée, thetoof, Mystery Keeper, Soulhunter, MisterHatt, martino, mf, Akirasuto, SpikeSpiegel, ScharfisBrain & Sagekilla
#
# Example: LSharpAAF(StrDrk=18, ShPre=100, ShPost=280, SmPost=80, aatype="ediaa")
# OR: LSharpAAF(18,100,280,80,"ediaa")

function LSharpAAFmod(clip a, int "StrDrk", int "ShPre", float "ShPost", int "SmPost", bool "stabilize", int "tradius", int "aapel", int "aaov", int "aablk", string "aatype") {
StrDrk = default(StrDrk,38) #FastLineDarkenMOD
ShPre = default(ShPre,18) #Presharpening
ShPost = default(ShPost,300) #Postsharpening
SmPost = default(SmPost,100) #Postsmoothing
stabilize = default(stabilize,false) # Use post stabilization with Motion Compensation
tradius = default(tradius,2) # 2 = MDegrain2 / 3 = MDegrain3 
aapel = default(aapel,1) # Accuracy of the motion estimation (Value can only be 1, 2 or 4. 1 means a precision to the pixel. 2 means a precision to half a pixel, 4 means a precision to quarter a pixel, produced by spatial interpolation (better but slower).)
aaov = default(aaov,(a.width>1100) ? 8 : 4) # Block overlap value (horizontal). Must be even and less than block size. (Higher = more precise & slower)
aablk = default(aablk,(a.width>1100) ? 16 : 8) # Size of a block (horizontal). It's either 4, 8 or 16 ( default is 8 ). Larger blocks are less sensitive to noise, are faster, but also less accurate.
aatype = default(aatype,"EEDI2") # Use EEDI2() or eedi3() or SangNom() or maa() or daa() or ediaa() or AAA() or saa() or splinaa() or supaa() or naa() or shaarp() or aaf() or nnedi() or nnedi2() or nnedi3() or antialiasing() for anti-aliasing.

a = a.AssumeTFF()
w = Width(a)
h = Height(a)
m = a.mt_edge("prewitt",0,255,0,0).mt_lut("x 32 <= 0 x 1.4 ^ ?").RemoveGrain(4,-1).mt_inflate()

preaa = (ShPre==0 && StrDrk==0) ? a : (ShPre==0) ? a.FastLineDarkenMOD(thinning=0,strength=StrDrk) : (StrDrk==0) ? a.aWarpSharp2(depth=ShPre) : a.FastLineDarkenMOD(thinning=0,strength=StrDrk).aWarpSharp2(depth=ShPre)

aa = (aatype=="EEDI2") ? preaa.TurnLeft().EEDI2().TurnRight().EEDI2().Spline36Resize(w,h,0.5,-0.5,2*w+.001,2*h+.001)
\ : (aatype=="eedi3") ? preaa.TurnLeft().eedi3().TurnRight().eedi3().Spline36Resize(w,h)
\ : (aatype=="SangNom") ? preaa.Spline36Resize(w*2,h*2).TurnLeft().SangNom(aa=255).TurnRight().SangNom(aa=255).Spline36Resize(w,h)
\ : (aatype=="maa") ? preaa.maa() : (aatype=="daa") ? preaa.daa() : (aatype=="ediaa") ? preaa.ediaa() : (aatype=="AAA") ? preaa.AAA()
\ : (aatype=="saa") ? preaa.saa() : (aatype=="splinaa") ? preaa.splinaa() : (aatype=="supaa") ? preaa.supaa() : (aatype=="naa") ? preaa.naa()
\ : (aatype=="shaarp") ? preaa.shaarp() : (aatype=="aaf") ? preaa.aaf(aam=-0.7,rep=true)
\ : (aatype=="nnedi") ? preaa.nnedi(dh=true,field=1).TurnRight().nnedi(dh=true,field=1).TurnLeft().Spline36Resize(w,h)
\ : (aatype=="nnedi2") ? preaa.nnedi2(dh=true,field=1,nsize=2,qual=2).TurnRight().nnedi2(dh=true,field=1,nsize=2,qual=2).TurnLeft().Spline36Resize(w,h,0.5,-0.5,2*w+.001,2*h+.001)
\ : (aatype=="nnedi3") ? preaa.nnedi3(dh=true,field=1,nsize=2,qual=2).TurnRight().nnedi3(dh=true,field=1,nsize=2,qual=2).TurnLeft().Spline36Resize(w,h)
\ : (aatype=="antialiasing") ? preaa.antialiasing()
\ : BlankClip(pixel_type="YV12").Subtitle("Please use Sangnom, EEDI2, eedi3, maa, daa, ediaa, AAA, ssa, splinaa, supaa, naa, shaarp, aaf, nnedi, nnedi2, nnedi3, or antialiasing for aatype")

postsh = (ShPost==0) ? aa : (ShPost<=1) ? aa.Spline36Resize(Int(w*1.25),Int(h*1.25)).Sharpen(ShPost).Spline36Resize(w,h).MergeChroma(aa) : aa.LSFmod(strength=Int(ShPost),overshoot=1,soft=SmPost)

merged = mt_merge(a,postsh,m)

sD = mt_makediff(a,merged)

asuper = a.MSuper(pel=aapel)
sDsuper = sD.MSuper(pel=aapel,levels=1)

fv1 = (tradius>=1) ? asuper.MAnalyse(isb=false,delta=1,overlap=aaov,blksize=aablk) : NOP()
bv1 = (tradius>=1) ? asuper.MAnalyse(isb=true, delta=1,overlap=aaov,blksize=aablk) : NOP()
fv2 = (tradius>=2) ? asuper.MAnalyse(isb=false,delta=2,overlap=aaov,blksize=aablk) : NOP()
bv2 = (tradius>=2) ? asuper.MAnalyse(isb=true, delta=2,overlap=aaov,blksize=aablk) : NOP()
fv3 = (tradius==3) ? asuper.MAnalyse(isb=false,delta=3,overlap=aaov,blksize=aablk) : NOP()
bv3 = (tradius==3) ? asuper.MAnalyse(isb=true, delta=3,overlap=aaov,blksize=aablk) : NOP()

_thSAD = 600
sDD = (tradius==1) ? sD.MDegrain1(sDsuper,bv1,fv1,thSAD=_thSAD) : (tradius==2) ? sD.MDegrain2(sDsuper,bv1,fv1,bv2,fv2,thSAD=_thSAD) : sD.MDegrain3(sDsuper,bv1,fv1,bv2,fv2,bv3,fv3,thSAD=_thSAD)

reduc = 0.4
sDD = mt_lutxy(sD,sDD,"x 128 - abs y 128 - abs < x y ?").MergeLuma(sDD,1.0-reduc)

return (stabilize) ? a.mt_makediff(sDD,U=2,V=2) : merged }

#Suggested by Mystery Keeper in "Denoise of tv-anime" thread
function ediaa(clip a) {
return a.EEDI2(field=1).TurnRight().EEDI2(field=1).TurnLeft().Spline36Resize(a.width,a.height,-0.5,-0.5) }

#Anti-aliasing with contra-sharpening by Didée
function daa(clip c) {
nn	= c.nnedi2(field=-2)
dbl   	= mt_average(SelectEven(nn),SelectOdd(nn),U=3,V=3)
dblD 	= mt_makediff(c,dbl,U=3,V=3)
shrpD 	= mt_makediff(dbl,dbl.RemoveGrain((width(c)>1100) ? 20 : 11),U=3,V=3)
DD 	= shrpD.Repair(dblD,13)
return dbl.mt_adddiff(DD,U=3,V=3) }

#Simple Anti-aliasing by Soulhunter
function saa(Clip Clp,Int"SS",Bool"CP") {
OX = Clp.Width
OY = Clp.Height
SS = Default(SS,2)
CP = Default(CP,True)
Clp = Clp.IsYV12() ? Clp : Clp.ConvertToYV12()
Clp.PointResize(OX*SS,OY*SS).SangNom().TurnRight().SangNom().TurnLeft().BilinearResize(OX,OY)
CP ? Last : MergeChroma(Clp)
Return(Last) }

#Anti-aliasing with edge masking by martino, mask using "sobel" taken from Kintaro's useless filterscripts and modded by thetoof for spline36
function maa(clip input, int "mask") {
mask = input.mt_edge("sobel",7,7,5,5).mt_inflate()
aa_clip = input.Spline36Resize(width(input)*2,height(input)*2).TurnLeft().SangNom().TurnRight().SangNom().Spline36Resize(width(input),height(input)).MergeChroma(input)
return mt_merge(input,aa_clip,mask) }

#AnimeAntiAliasing - Thanks to @ Didée, mf, Akirasuto, SpikeSpiegel & ScharfisBrain
function AAA(clip clp, int "Xres", int "Yres", int "Xshrp", int "Yshrp", int "US", int "DS", bool "chroma") {
clp = clp.isYV12() ? clp : clp.ConvertToYV12()
ox = clp.width
oy = clp.height
Xres = default(Xres,ox)
Yres = default(Yres,oy)
us = default(us,1)
ds = default(ds,2)
Xshrp = default(Xshrp,15)
Yshrp = default(Yshrp,15)
chroma = default(chroma,false)

us==0 ? clp.PointResize(ox*2,oy*2) : clp.LanczosResize(ox*2,oy*2)

TurnLeft()
SangNom()

TurnRight()
SangNom()

ds==0 ? BilinearResize(Xres,Yres) : ds==1 ? BicubicResize(Xres,Yres) : LanczosResize(Xres,Yres)

UnFilter(Xshrp,Yshrp)

chroma ? MergeChroma(clp.Lanczosresize(Xres,Yres)) : last }

#Normal Anti-aliasing by Didée
function antialiasing(clip orig, int "th_luma", int "th_croma", string "type", int "aath") {

# "th_luma" & "th_croma" are the edge detection thres.: lower values=more edges filtered
# "type" is the matrix used for edge detection: with "sobel" (default) only the 
# hi-contrast edges, where artefacts are more noticeable, are filtered. If you want
# to test other matrices, read the MaskTools Guide for more info.
# "aath" = anti-aliasing strenght (default should be fine)

th_luma = Default(th_luma,20)
th_croma = Default(th_croma,20)
type = Default(type,"sobel")
aath = Default(aath,48)
ox = orig.width
oy = orig.height
dx = orig.width * 2
dy = orig.height * 2
clp = orig.IsYV12() ? orig : orig.ConvertToYV12()

a=clp
b=clp.Lanczos4Resize(dx,dy).TurnLeft().SangNom(aa=aath).TurnRight().SangNom(aa=aath).LanczosResize(ox,oy)
c=clp.EdgeMask(th_luma,th_luma,th_croma,th_croma,type)
MaskedMerge(a,b,c) }

# Written by MisterHatt, based off of Soulhunter's SAA() and martino's excellent MAA(), and is slightly
# faster at times for some reason or another. These functions work by generally supersampling, usually with
# nnedi2, and then running a deinterlacer (sangnom and nnedi2 respectively) to get rid of most jaggies.
# I have no idea how destructive these are on whatever random thing people care to throw them at.
# For large supersamples, avs2yuv bitches for no real reason and requires assumeframebased() in your script.
# Requires nnedi2, sangnom, o9k hours of your life.
function splinaa(Clip Clp,Int"SS",Bool"CP") {
OX = Clp.Width
OY = Clp.Height
SS = Default(SS,2)
CP = Default(CP,True)
Clp = Clp.IsYV12() ? Clp : Clp.ConvertToYV12()
Clp.PointResize(OX*SS,OY*SS).SangNom().TurnRight().SangNom().TurnLeft().Spline36Resize(OX,OY)
CP ? Last : MergeChroma(Clp)

Return(Last) }

function supaa(Clip Clp,Int"SS",Bool"CP") {
OX = Clp.Width
OY = Clp.Height
SS = Default(SS,2)
CP = Default(CP,True)
Clp = Clp.IsYV12() ? Clp : Clp.ConvertToYV12()
Clp.nnedi2_rpow2(rfactor=SS,cshift="Spline36Resize",qual=3).SangNom().TurnRight().SangNom().TurnLeft().Spline36Resize(OX,OY)
CP ? Last : MergeChroma(Clp)

Return(Last) }

function naa(Clip Clp,Int"SS",Bool"CP") {
OX = Clp.Width
OY = Clp.Height
SS = Default(SS,2)
CP = Default(CP,True)
Clp = Clp.IsYV12() ? Clp : Clp.ConvertToYV12()
Clp.nnedi2_rpow2(rfactor=SS,cshift="Spline36Resize",qual=3).nnedi2(qual=3).TurnRight().nnedi2(qual=3).TurnLeft().Spline36Resize(OX,OY)
CP ? Last : MergeChroma(Clp)

Return(Last) }

function shaarp(clip input, int "mask", int "type") {
mask = Default(mask,1)
type = Default(type,1)
Assert(mask==1 || mask==2, "Please use mask = 1 or 2")
Assert(type==1 || type==2, "Please use type = 1 or 2")
aa_clip = (type==1) ? input.Spline36Resize(width(input)*2,height(input)*2) : input.nnedi2_rpow2(rfactor=2,qual=3)
aa_clip = aa_clip.TurnLeft().nnedi2().TurnRight().nnedi2().Spline36Resize(width(input),height(input)).MergeChroma(input)
mask = (mask==1) ? input.mt_edge("sobel",7,7,5,5).mt_inflate() : input.mt_edge("roberts",0,4,0,4).mt_inflate()

return mt_merge(input,aa_clip,mask) }

function aaf(clip input, float "aam", int "aay", "aax", bool "rep") {
input =	input.isYV12() ? input : input.converttoyv12()

aam	= default(aam,-0.6)
aar	= aam<0 ? (aam-1)*0.25 : (aam+1)*0.25
aay	= default(aay,28)
aax	= default(aax,aay)
rep	= default(rep,true)

sx	= width(input)
sy	= height(input)

aa	= aar<0 ? input.Spline36Resize(sx,int(sy*abs(aar))*4) :
	\	aar==0.5 ? input.PointResize(sx*2, sy*2) :
	\	input.Spline36Resize(int(sx*abs(aar)*4),int(sy*abs(aar))*4)
aa	= aay>0 ? aa.SangNom(aa=aax) : input
aa	= aar<0 && aax>0 ? aa.Spline36Resize(int(sx*abs(aar))*4,sy) : aa
aa	= aax>0 ? aa.TurnRight().SangNom(aa=aax).TurnLeft() : aa
aa	= aa.Spline36Resize(sx,sy)

return rep==true ? aa.Repair(input,18) : aa }
附件
LSharpAAFmod.7z
2011-11-17 更新
(3.95 KiB) 下载 471 次
图片

回到 “理论讨论 / Theoratical discussion”