Skip to content

Commit

Permalink
Toon: Remove unnecessary workaround for AWarpSharp2
Browse files Browse the repository at this point in the history
It was added when AWarpSharp2 supported only 8 bit depth years ago.
  • Loading branch information
HolyWu committed Mar 29, 2018
1 parent ed57b1f commit 95db305
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions havsfunc.py
Original file line number Diff line number Diff line change
Expand Up @@ -3964,12 +3964,7 @@ def Toon(input, str=1., l_thr=2, u_thr=12, blur=2, depth=32):
ludiff = u_thr - l_thr

last = core.std.MakeDiff(core.std.Maximum(input).std.Minimum(), input)
if bits != 8:
s16 = last
warp = Padding(core.fmtc.bitdepth(last, bits=8, dmode=1), 6, 6, 6, 6).warp.AWarpSharp2(blur=blur, depth=depth).std.Crop(6, 6, 6, 6)
warp = mvf.LimitFilter(s16, core.fmtc.bitdepth(warp, bits=bits), thr=1, elast=2)
else:
warp = Padding(last, 6, 6, 6, 6).warp.AWarpSharp2(blur=blur, depth=depth).std.Crop(6, 6, 6, 6)
warp = Padding(last, 6, 6, 6, 6).warp.AWarpSharp2(blur=blur, depth=depth).std.Crop(6, 6, 6, 6)
last = core.std.Expr([last, warp], ['x y min'])
expr = 'y {lthr} <= {neutral} y {uthr} >= x {uthr8} y {multiple} / - 128 * x {multiple} / y {multiple} / {lthr8} - * + {ludiff} / {multiple} * ? {neutral} - {str} * {neutral} + ?'.format(lthr=lthr, neutral=neutral, uthr=uthr, uthr8=uthr8, multiple=multiple, lthr8=lthr8, ludiff=ludiff, str=str)
last = core.std.MakeDiff(input, core.std.Expr([last, core.std.Maximum(last)], [expr]))
Expand Down Expand Up @@ -5131,8 +5126,8 @@ def MinBlur(clp, r=1, planes=[0, 1, 2]):
RG11 = core.std.Convolution(clp, matrix=matrix1, planes=planes).std.Convolution(matrix=matrix2, planes=planes).std.Convolution(matrix=matrix2, planes=planes)
if bits == 16:
s16 = clp
RG4 = core.fmtc.bitdepth(clp, bits=12, planes=planes, dmode=1).ctmf.CTMF(radius=3, planes=planes)
RG4 = mvf.LimitFilter(s16, core.fmtc.bitdepth(RG4, bits=16, planes=planes), thr=0.0625, elast=2, planes=planes)
RG4 = core.fmtc.bitdepth(clp, bits=12, planes=planes, dmode=1).ctmf.CTMF(radius=3, planes=planes).fmtc.bitdepth(bits=16, planes=planes)
RG4 = mvf.LimitFilter(s16, RG4, thr=0.0625, elast=2, planes=planes)
else:
RG4 = core.ctmf.CTMF(clp, radius=3, planes=planes)

Expand Down

0 comments on commit 95db305

Please sign in to comment.