Last active
March 13, 2024 02:01
-
-
Save wiwaz/625da3044e89ed359f84c228babfb35d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def vinverse( | |
clip: vs.VideoNode, | |
blur: GenericVSFunction = partial(core.std.Convolution, matrix=[1, 2, 1], mode=ConvMode.VERTICAL), | |
blur2: GenericVSFunction = partial(core.std.Convolution, matrix=[1, 4, 6, 4, 1], mode=ConvMode.VERTICAL), | |
csstr: float = 2.7, scale: float = 0.25, threshold: int = 255, planes: PlanesT = None | |
) -> vs.VideoNode: | |
""" | |
A simple but effective plugin to remove residual combing. Based on an AviSynth script by Didée. | |
:param clip: Clip to process. | |
:param blur: Filter used to remove combing. | |
:param blur2: Filter used to calculate contra sharpening. | |
:param csstr: Strength of contra sharpening. | |
:param threshold: Change no pixel by more than this (default=255: unrestricted). | |
:param scale: Scale factor for vshrpD*vblurD < 0. | |
""" | |
blur = blur(clip, planes=planes) | |
blur2 = blur2(blur, planes=planes) | |
decomb = norm_expr( | |
[clip, blur, blur2], | |
'y z - {csstr} * D1! x y - D2! D1@ abs D1A! D2@ abs D2A! ' | |
'D1@ D2@ xor D1A@ D2A@ < D1@ D2@ ? {scale} * D1A@ D2A@ < D1@ D2@ ? ? y + ' | |
'LIM! x {thr} + LIM@ < x {thr} + x {thr} - LIM@ > x {thr} - LIM@ ? ?', | |
planes, csstr=csstr, scale=scale, thr=scale_8bit(clip, threshold), | |
) | |
return decomb |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment