Log in

View Full Version : LSharpAAF - AntiAliasing Combo


Pages : 1 [2]

Bloax
1st January 2012, 17:49
The big blurring I'd guess comes from NNEDI3, since it's rather soft.
As for subtitles, it'd be nice with a picture to mess around with. ;)

Edge343
1st January 2012, 17:57
The big blurring I'd guess comes from NNEDI3, since it's rather soft.
As for subtitles, it'd be nice with a picture to mess around with. ;)
Here's an example (http://i361.photobucket.com/albums/oo53/Radik2/PanzerDragoonOrta_2.png). There's also one in the video I linked to.

Bloax
1st January 2012, 18:21
This script really is only "usable" for this. Which is aliased and upscaled stuff.
Anything else, and it wrecks it. No exaggeration.


I think it's a bit overkill by now. (Way, way overkill - to be exact.) ;P
Edit: Updated to look cool now.
orig = last
msk=RAverageW(last,32,last.RemoveGrain(19,-1),-32,u=0,v=0,sse=8,bias=-255).RemoveGrain(4,-1).Mt_Deflate()
PointResize(Width/2,Height/2)
NNEDI3(0,true,true,true,true,0,0,1).PointResize(Width,Height)
TurnLeft()
Merge(SangNom(1,30),SangNom(0,30),0.5)
TurnRight()
NNEDI3_rpow2(2,0,0,1)
TurnRight().SangNom(0,64).TurnLeft()
RMerge(last,orig,msk)
RemoveGrain(2) # Fixing up stuff

In my little opinion, I think it'd be best just to do this:
PointResize(Width/2,Height/2)
TurnLeft()
Merge(SangNom(1,30),SangNom(0,30),0.5)
TurnRight()
And call it a day.
Hm, actually. Let me see if I can fix it up. (Seems like parameter overkill.)

Edit: Woop! Be careful with them SangNom settings kids, they're daaangerous.
Anyways, fixed to look like a cool inflation-antialias instead of the uncool holey mess it was.

Edge343
1st January 2012, 19:22
Thanks Bloax, I have no idea what the first script does but the results seem to look good :) I'll try and compare it to the second one to see if the difference is worth it. I'd probably be better off capturing in 480P to begin with which I think would avoid the upscaling, but unfortunately my capture card can't capture the 480P output from the XBox360 (which I believe is 640x480).

kentafilo
1st February 2012, 13:43
Here is all the require dll or extra functions: http://www.megaupload.com/?d=HQ7NLMW0



Help me:magaupload is down :(

librarian
1st February 2012, 14:29
See here (http://www.2shared.com/file/hWF929wD/LSharpAAF_v12Requirements.html). Archive downloaded on December 23rd 2011.

x265
8th February 2013, 08:26
Which aatype should i use for anime?

GodRealm
10th February 2013, 21:14
See here (http://www.2shared.com/file/hWF929wD/LSharpAAF_v12Requirements.html). Archive downloaded on December 23rd 2011.

Link is off.

Overdrive80
4th April 2015, 18:28
Hi, using mod by Dogway I have updated this filter: https://dl.dropboxusercontent.com/u/19135067/LSharpAAF2.00.zip

Updates:


Remove LimitedSharpenFaster dependency
Remove Sangnom and Turn dependency
Added Sangnom2 and FTurn
Added maa2, Santiag and Sangnom2AA


Dependencies:


awarpsharp2 - http://avisynth.nl/index.php/AWarpSharp2 (Modded by Set)
FastLineDarkenMOD.avsi - http://www.mediafire.com/?gpil7zkz24lq4 ( Modded by Dogway (http://forum.videohelp.com/threads/369142-Simple-MDegrain-Mod-v3-0d-A-Quality-Denoising-Solution?p=2364030&viewfull=1#post2364030))
LSFmod.v1.9.avsi - http://avisynth.nl/index.php/LSFmod (Didée/LaTo)
MaskTools.dll - http://avisynth.nl/index.php/MaskTools (Manao)
mt_masktools-2x.dll - http://forum.doom9.org/showthread.php?t=169832 (TP7)
EEDI2.dll - http://avisynth.nl/index.php/EEDI2 (Tritical)
nnedi2.dll, nnedi3.dll - http://forum.doom9.org/showthread.php?p=1343668 - http://avisynth.nl/index.php/Eedi3 (Tritical)
RemoveGrain.dll, Repair.dll from RGTools - http://forum.doom9.org/showthread.php?t=169832 (TP7)
Sangnom2.dll - http://forum.doom9.org/showthread.php?t=169832 (TP7)
UnFilter.dll - http://avisynth.nl/index.php/UnFilter (Tom Barry)

Great Dragon
8th April 2015, 21:43
@Overdrive80
LSharpAAF(aatype="maa2") - it doesn't work.

I get "Only YV12 colorspace is supported" and errors in 490, 439, 132 lines
Sure my source is in YV12 colorspace.

I'm using my own modification of LSharpAAF to use maa2 and it work as it should.
I've used official 1.50 version to modify.


# LSharpAAF() by Leinad4Mind
# v1.60 updated in 2015-03-23 by Great Dragon
# Requirements: awarpsharp2; EEDI2.dll; FastLineDarkenMOD.avsi; LSFmod.v1.9.avsi; MaskTools.dll; mt_masktools-26.dll; mvtools.dll;
# nnedi2.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, LaTo & 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", bool "MT", 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
MT=default(MT,false) # Use josey_wells' branch of MVTools
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() ; EEDI3() ; Sangnom() ; maa() ; daa() ; ediaa() ; aaa() ; saa() ; splinaa() ; supaa() ; naa() ; shaarp() ; aaf() ; laa() ; nnedi() ; nnedi2() ; nnedi3() ; antialiasing() ; nediaa() ; naa3mod(); 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.lsfmod(defaults="slow",preblur="ON",strength=ShPre)
\ : a.fastlinedarkenmod(thinning=0, strength=StrDrk).lsfmod(defaults="slow",preblur="ON",strength=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=="laa") ? preaa.laa(96, 10, true, 2.0)
\ : (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()
\ : (aatype=="maa2") ? preaa.maa2()
\ : blankclip(pixel_type="YV12").subtitle("Please use Sangnom, EEDI2, EEDI3, maa, daa, ediaa, aaa, ssa, splinaa, supaa, naa, shaarp, aaf, laa,
nnedi, nnedi2, nnedi3, or antialiasing for aatype")

postsh=(ShPost==0 && SmPost==0) ? aa : aa.LimitedSharpenFaster(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
_idx = 13

mbv1 = a.MVAnalyse(isb=true, delta=1,idx=_idx)
mbv2 = a.MVAnalyse(isb=true, delta=2,idx=_idx)
mfv2 = a.MVAnalyse(isb=false,delta=2,idx=_idx)
mfv1 = a.MVAnalyse(isb=false,delta=1,idx=_idx)
allv = (MT==false) ? a : a.MVAnalyseMulti(refframes=tradius,idx=_idx)

sDD = (MT) ? sD.MVDegrainMulti(allv,idx=14) : sD.MVDegrain2(mbv1,mfv1,mbv2,mfv2,idx=14)
sDD2 = tradius==1 ? sDD.MDegrain1(sDsuper,bv1,fv1,thSAD=_thSAD) : tradius==2 ? sDD.MDegrain2(sDsuper,bv1,fv1,bv2,fv2,thSAD=_thSAD)
\ : sDD.MDegrain3(sDsuper,bv1,fv1,bv2,fv2,bv3,fv3,thSAD=_thSAD)

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

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

#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) }

#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.nnedi3_rpow2(rfactor=SS,cshift="spline36resize",qual=2).nnedi3(nns=2).TurnRight().nnedi3(nns=2).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
}

### LaTo Antialiasing Script v2
### Need: asharp.dll & sangnom.dll
function LAA(clip input, int "strength", int "threshold", bool "sharp", float "ss") {

strength = default(strength, 96)
threshold = default(threshold, 10)
sharp = default(sharp, true)
ss = default(ss, 2.0)
aastr = int(strength) /2
asthr = float(strength) /100
ox = input.width
oy = input.height
ox2 = round(ox*ss/8)*8
oy2 = round(oy*ss/8)*8

process = input.spline36resize(ox2,oy2).turnleft().sangnom(aastr).turnright().sangnom(aastr)
process = ( sharp == true ) ? process.asharp(asthr,0,0).spline36resize(ox,oy) : process.spline36resize(ox,oy)
mask = mt_average(input,process,u=1,v=1).mt_edge(thy1=threshold,thy2=threshold,u=1,v=1)
output = mt_merge(input,process,mask,u=2,v=2)

return ( output )
}

function NediAA(clip c)
{ c.nnedi3(field=-2)
merge(selecteven(),selectodd()) }

FUNCTION naa3mod(Clip Clp,Bool "CP")
{
OX = Clp.Width()
OY = Clp.Height()
CP = Default(CP,True)
Clp = Clp.IsYV12() ? Clp : Clp.ConvertToYV12()
Clpnn1 = Clp.nnedi3(1, dh=true,nsize=2,qual=2,U=CP,V=CP).nnedi3(0,nsize=2,qual=2,U=CP,V=CP)
Clpy1 = Clpnn1.Spline36Resize(OX,OY,0,-0.5,OX,OY*2)
Clps1 = CP ? Clpy1.MergeChroma(Clpnn1.Spline36Resize(OX,OY,0,-1,OX,OY*2)) : Clpy1.MergeChroma(Clp)
Clpnn2 = Clps1.turnright().nnedi3(1, dh=true,nsize=2,qual=2,U=CP,V=CP).nnedi3(0,nsize=2,qual=2,U=CP,V=CP)
Clpy2 = Clpnn2.Spline36Resize(OY,OX,0,-0.5,OY,OX*2)
CP ? Clpy2.MergeChroma(Clpnn2.Spline36Resize(OY,OX,0,-1,OY,OX*2)).turnleft() : Clpy2.turnleft().MergeChroma(Clp)
Return(Last)
}

function maa2(clip c, int "mask", bool "chroma", float "ss", int "aa", int "aac", int "threads", int "show", int "maskt")
{
chroma = Default(chroma, false)
mask = Default(mask, 1)
maskt = Default(maskt, 1)
mtresh = (mask < 0) ? -mask : 7
show = Default(show, 0)
uv = (chroma) ? 3 : 1

Assert(c.IsY8 || c.IsYV12 || c.IsYV24 || c.IsYV16, "MAA2: Input must be Y8, YV12, YV16 or YV24")
Assert(0 <= show <= 2, "MAA2: Parameter 'show' must be between 0 and 2")

# create mask
if (mask != 0) {
m = (maskt != 1) ? c.mt_edge("min/max", 0, mtresh, 0, mtresh-6, u=uv, v=uv).mt_inflate(u=uv, v=uv) : c.mt_edge("sobel", mtresh, mtresh, mtresh-6, mtresh-6, u=uv, v=uv).mt_inflate(u=uv, v=uv)
}

# run sangnom2-based aa
if (!chroma || show > 0) {
c_aa = c.ConvertToY8().Sangnom2AA(ss, aa, threads=threads)
}
else if (c.IsYV16) {
c_aa_u = c.UtoY8().Sangnom2AA(ss, aac, threads=threads)
c_aa_v = c.VtoY8().Sangnom2AA(ss, aac, threads=threads)
c_aa = YToUV(c_aa_u, c_aa_v, c.ConvertToY8().Sangnom2AA(ss, aa, threads=threads))
}
else { c_aa = c.Sangnom2AA(ss, aa, aac, threads) }

# prepare chroma planes for mask overlay
if (show == 1) {
c_aa = (c.IsY8) ? c.ConvertToYV12().mt_lut(y=2, u=0, v=0)
\ : c.mt_lut("x 2 /", y=2, u=3, v=3)
}
else if (show == 2) {
c_aa = (c.IsY8) ? c_aa.ConvertToYV12().mt_lut(y=2, u=0, v=0)
\ : YtoUV(c.UtoY8(), c.VtoY8(), c_aa).mt_lut("x 2 /", y=2, u=3, v=3)
}

# merge aa'ed lines into source
if (mask == 0) {
return mt_logic(c_aa, "and", y=4, u=2, v=2)
}
else if (show > 0) {
if (c.IsYV16) {
m_uv = BilinearResize(m, m.width/2, m.height)
return mt_merge(c, c_aa, YtoUV(m_uv, m_uv, m), u=3, v=3)
}
else {
return (c.IsYV24) ? mt_merge(c, c_aa, m.YtoUV(m,m), u=3, v=3)
\ : mt_merge(c.ConvertToYV12(), c_aa, m, u=3, v=3, luma=true)
}
}
else {
return (chroma) ? mt_merge(c, c_aa, m, u=3, v=3)
\ : mt_merge(c, c_aa, m, u=2, v=2)
}
}

function Sangnom2AA(clip c, float "ss", int "aa", int "aac", int "threads")
{
threads = Default(threads, 4)
aa = Default(aa, 48)
aac = Default(aac, aa-8)
aac = (aac < 0) ? 0 : aac
ss = Default(ss, 2.0)
ss_w = int(round(c.width*ss/4.0)*4)
ss_h = int(round(c.height*ss/4.0)*4)

Assert(ss > 0, "MAA2: Supersampling factor must be > 0")

return c.Spline36Resize(ss_w, ss_h).TurnLeft() \
.SangNom2(threads=threads, aa=aa, aac=aac).TurnRight().SangNom2(threads=threads, aa=aa, aac=aac).Spline36Resize(c.width, c.height)
}

Great Dragon
8th April 2015, 22:01
v2.00 even doesn't work as it should with default settings

http://t1.someimage.com/r17lo5G.jpg (http://someimage.com/r17lo5G) http://t1.someimage.com/3PSwtZd.jpg (http://someimage.com/3PSwtZd)

Overdrive80
9th April 2015, 00:08
I can not reproduce it.


function maa2(clip c, int "mask", bool "chroma", float "ss", int "aa", int "aac", int "threads", int "show", int "maskt")
{
chroma = Default(chroma, false)
mask = Default(mask, 1)
maskt = Default(maskt, 1)
mtresh = (mask < 0) ? -mask : 7
show = Default(show, 0)
uv = (chroma) ? 3 : 1

Assert(c.IsY8 || c.IsYV12 || c.IsYV24 || c.IsYV16, "MAA2: Input must be Y8, YV12, YV16 or YV24")
Assert(0 <= show <= 2, "MAA2: Parameter 'show' must be between 0 and 2")

# create mask
if (mask != 0) {
m = (maskt != 1) ? c.mt_edge("min/max", 0, mtresh, 0, mtresh-6, u=uv, v=uv).mt_inflate(u=uv, v=uv) : c.mt_edge("sobel", mtresh, mtresh, mtresh-6, mtresh-6, u=uv, v=uv).mt_inflate(u=uv, v=uv)
}

# run sangnom2-based aa
if (!chroma || show > 0) {
c_aa = c.ConvertToY8().Sangnom2AA(ss, aa, threads=threads)
}
else if (c.IsYV16) {
c_aa_u = c.UtoY8().Sangnom2AA(ss, aac, threads=threads)
c_aa_v = c.VtoY8().Sangnom2AA(ss, aac, threads=threads)
c_aa = YToUV(c_aa_u, c_aa_v, c.ConvertToY8().Sangnom2AA(ss, aa, threads=threads))
}
else { c_aa = c.Sangnom2AA(ss, aa, aac, threads) }

# prepare chroma planes for mask overlay
if (show == 1) {
c_aa = (c.IsY8) ? c.ConvertToYV12().mt_lut(y=2, u=0, v=0)
\ : c.mt_lut("x 2 /", y=2, u=3, v=3)
}
else if (show == 2) {
c_aa = (c.IsY8) ? c_aa.ConvertToYV12().mt_lut(y=2, u=0, v=0)
\ : YtoUV(c.UtoY8(), c.VtoY8(), c_aa).mt_lut("x 2 /", y=2, u=3, v=3)
}

# merge aa'ed lines into source
if (mask == 0) {
return mt_logic(c_aa, "and", y=4, u=2, v=2)
}
else if (show > 0) {
if (c.IsYV16) {
m_uv = BilinearResize(m, m.width/2, m.height)
return mt_merge(c, c_aa, YtoUV(m_uv, m_uv, m), u=3, v=3)
}
else {
return (c.IsYV24) ? mt_merge(c, c_aa, m.YtoUV(m,m), u=3, v=3)
\ : mt_merge(c.ConvertToYV12(), c_aa, m, u=3, v=3, luma=true)
}
}
else {
return (chroma) ? mt_merge(c, c_aa, m, u=3, v=3)
\ : mt_merge(c, c_aa, m, u=2, v=2)
}
}

This function not use avisynth language, I think.

EDIT: I am using avisynth 2.6 and I dont get error with my source that is yv12 (if use converttoyv24 or converttoy8 get error because lsfmod is limited yv12 colourspaces but not for maa2).

Is possible that you didn't remove dll of removegrain, repair, etc... from pack of kassandro?? Please, use plugins listed in dependencies http://forum.doom9.org/showthread.php?p=1716077#post1716077 and remove old plugins.

I use maa2 http://avisynth.nl/index.php/MAA2

Great Dragon
9th April 2015, 05:57
I'm using Avisynth+ but I'll check plugins version. However I'm pretty sure they're up to date.

UPDATE:
I'm using 0.41mod version of maa2 http://pastebin.com/fqR4CMbV
There is also 0.42+ mod http://pastebin.com/F0GLtrx5 I guess it's made specially for Avisynth+ however 0.41mod work fine for me too.

UPDATE2:
@Overdrive80 can you please check if those mods works for you with Avisynth 2.6 ?

Overdrive80
9th April 2015, 18:39
@Overdrive80 can you please check if those mods works for you with Avisynth 2.6 ?

Ok, but I have convert sintaxis for maa2 on avisynth from your avisynth+ mod.

Overdrive80
9th April 2015, 19:54
Ok, with code below of maa2 0.42+ runs fine on avisynth 2.6:

/*
MAA2MOD v0.42
=========

Updated version of the MAA antialising script from AnimeIVTC.
MAA2 uses tp7's SangNom2, which provide a nice speedup for SangNom-based antialiasing,
especially when only processing the luma plane.
The defaults of MAA2 match up with MAA, so you'll get identical output (save for the more accurate border region processing of SangNom2)
when using this script as a drop-in replacement.

MAA2 supports Y8, YV12, YV16 and YV24 input.

Requirements:

* AviSynth
* SangNom2 0.3+
* Masktools 2.0b1

Parameters:

+ [int] mask (1)
* 0: Disable masking
* 1: Enable masking
* -i: Enable masking with custom treshold
+ [bool] chroma (false)
* false: Don't process chroma channels (copy UV from the source clip if present)
* true: Process chroma channels
+ [float] ss (2.0)
* Supersampling factor (sensible values are between 2.0 and 4.0 for HD content)
+ [int] aa (48)
* Sangnom2 luma antialiasing strength
+ [int] aac (aa-8)
* Sangnom2 chroma antialiasing strength
+ [int] threads (4)
* Number of threads used by every Sangnom2 instance
+ [int] show (0)
* 0: Don't overlay mask
* 1: Overlay mask only
* 2: Overlay mask and run antialiasing on the luma plane
+ [int] maskt (1)
* 1: sobel
* 2: min/max

*/

function maa2mod(clip c, int "mask", bool "chroma", float "ss", int "aa", int "aac", int "threads", int "show", int "maskt")
{
chroma = Default(chroma, false)
mask = Default(mask, 1)
maskt = Default(maskt, 1)
mtresh = (mask < 0) ? -mask : 7
show = Default(show, 0)
uv = (chroma) ? 3 : 1

Assert(c.IsY8 || c.IsYV12 || c.IsYV24 || c.IsYV16, "MAA2: Input must be Y8, YV12, YV16 or YV24")
Assert(0 <= show <= 2, "MAA2: Parameter 'show' must be between 0 and 2")

# create mask
m = mask != 0 ? c.mt_edge("sobel", mtresh, mtresh, mtresh-6, mtresh-6, u=uv, v=uv).mt_inflate(u=uv, v=uv) : \
maskt != 1 ? c.mt_edge("min/max", 0, mtresh, 0, mtresh-6, u=uv, v=uv).mt_inflate(u=uv, v=uv) : nop

# run sangnom2-based aa
c_aa_u = (c.IsYV16) ? c.UtoY8().Sangnom2AA(ss, aac, threads=threads) : nop
c_aa_v = (c.IsYV16) ? c.VtoY8().Sangnom2AA(ss, aac, threads=threads) : nop

c_aa = (!chroma || show > 0) ? c.ConvertToY8().Sangnom2AA(ss, aa, threads=threads) : \
(c.IsYV16) ? YToUV(c_aa_u, c_aa_v, c.ConvertToY8().Sangnom2AA(ss, aa, threads=threads)) : c.Sangnom2AA(ss, aa, aac, threads)

# prepare chroma planes for mask overlay
c_aa = (Show == 1 && !c.IsY8) ? c.mt_lut("x 2 /", y=2, u=3, v=3) : \
(Show == 1 && c.IsY8) ? c.ConvertToYV12().mt_lut(y=2, u=0, v=0) : \
(show == 2 && !c.IsY8) ? YtoUV(c.UtoY8(), c.VtoY8(), c_aa).mt_lut("x 2 /", y=2, u=3, v=3) : \
(show == 2 && c.IsY8) ? c.ConvertToYV12().mt_lut(y=2, u=0, v=0) : c_aa

# merge aa'ed lines into source
m_uv = (c.IsYV16) ? BilinearResize(m, m.width/2, m.height) : nop

last = (mask == 0) ? mt_logic(c_aa, "and", y=4, u=2, v=2) : \
(mask != 0 && show > 0 && c.isYV16) ? mt_merge(c, c_aa, YtoUV(m_uv, m_uv, m), u=3, v=3) : \
(mask != 0 && show > 0 && c.IsYV24) ? mt_merge(c, c_aa, m.YtoUV(m,m), u=3, v=3) : \
(mask != 0 && show > 0) ? mt_merge(c.ConvertToYV12(), c_aa, m, u=3, v=3, luma=true) : \
(mask != 0 && show == 0 && chroma) ? mt_merge(c, c_aa, m, u=3, v=3) : mt_merge(c, c_aa, m, u=2, v=2)

return last
}




function Sangnom2AA(clip c, float "ss", int "aa", int "aac", int "threads")
{
threads = Default(threads, 4)
aa = Default(aa, 48)
aac = Default(aac, aa-8)
aac = (aac < 0) ? 0 : aac
ss = Default(ss, 2.0)
ss_w = int(round(c.width*ss/4.0)*4)
ss_h = int(round(c.height*ss/4.0)*4)

Assert(ss > 0, "MAA2: Supersampling factor must be > 0")

return c.Spline36Resize(ss_w, ss_h).TurnLeft() \
.SangNom2(threads=threads, aa=aa, aac=aac).TurnRight().SangNom2(threads=threads, aa=aa, aac=aac).Spline36Resize(c.width, c.height)
}

Please, check if all code is fine for you, I am not tested too much.

Note: I rename function to maa2mod

Great Dragon
10th April 2015, 13:59
It works for me and produces identical result compare to original maa2+ 0.42 mod

Overdrive80
10th April 2015, 15:29
Ok, I have incluided in LSharpAAF and runs fine on avisynth 2.6 (maybe problem with avisynth+??), I dont get error for yv12 input.

https://dl.dropboxusercontent.com/u/19135067/LSharpAAF2.01.zip

Great Dragon
10th April 2015, 18:35
No errors this time but the script still does nothing. Picture remains the same no matter what aatype I choose.
So maybe it has some Avisynth+ compatibility issue.

real.finder
5th June 2015, 17:59
No errors this time but the script still does nothing. Picture remains the same no matter what aatype I choose.
So maybe it has some Avisynth+ compatibility issue.

this will work in both avs and avs+

MAA2 v0.432 mod https://pastebin.com/8qz1kUbM

try it with maa2(mask=-100, maskt=2, ss=3)

ss=3 is good for noisy source

kuchikirukia
9th August 2015, 02:24
If I rewrite my Santiag v1.6 to use Resize8 for the frame shift instead of the internal Spline36Resize, will it avoid the chroma shift bug in the internal resizers? Or is that already taken care of in the frame shift?

cretindesalpes
9th August 2015, 17:42
If I rewrite my Santiag v1.6 to use Resize8 for the frame shift instead of the internal Spline36Resize, will it avoid the chroma shift bug in the internal resizers? Or is that already taken care of in the frame shift?

Santiag doesn’t take any chroma shift bug into account. But you don’t need to rewrite it to use your own scaler. Just provide it as scaler_post argument in the call (it should have the same prototype as the standard avisynth scalers), or change the default value.

I’ll check how chroma location issues affect the final resizing and will publish a fix if required.

killerteengohan
12th November 2015, 10:03
Hey cretindesalpes, why is it when I try to use the Santiag v1.6 you posted "aa=24" parameter I get this error every time.

(The named argument "aa" was passed more than once to santiag_dir)
santiagv1.6.avsi, line 30

cretindesalpes
17th November 2015, 10:15
Thanks, typo fixed.