From 95db30586f9307b232e27fb83b99de60d06184c5 Mon Sep 17 00:00:00 2001 From: HolyWu Date: Thu, 29 Mar 2018 22:18:21 +0800 Subject: [PATCH] Toon: Remove unnecessary workaround for AWarpSharp2 It was added when AWarpSharp2 supported only 8 bit depth years ago. --- havsfunc.py | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/havsfunc.py b/havsfunc.py index a90a67c..cbd7951 100644 --- a/havsfunc.py +++ b/havsfunc.py @@ -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])) @@ -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)