Skip to content

Commit

Permalink
vinverse: don't unconditionally apply change clipping
Browse files Browse the repository at this point in the history
  • Loading branch information
emotion3459 committed Jan 26, 2025
1 parent 9c05f31 commit 176b6e8
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions vsdeinterlace/funcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ def vinverse(
clip: vs.VideoNode,
comb_blur: GenericVSFunction | vs.VideoNode = partial(sbr, mode=ConvMode.VERTICAL),
contra_blur: GenericVSFunction | vs.VideoNode = BlurMatrix.BINOMIAL(mode=ConvMode.VERTICAL),
contra_str: float = 2.7, amnt: int = 255, scl: float = 0.25,
contra_str: float = 2.7, amnt: int | None = None, scl: float = 0.25,
thr: int = 0, planes: PlanesT = None,
**kwargs: Any
) -> vs.VideoNode:
Expand Down Expand Up @@ -250,10 +250,14 @@ def vinverse(

FormatsMismatchError.check(func.func, func.work_clip, blurred, blurred2)

combed = norm_expr(
[func.work_clip, blurred, blurred2], # type:ignore
expr = (
'x y - D1! D1@ abs D1A! D1A@ {thr} < x y z - {sstr} * D2! D1A@ D2@ abs < D1@ D2@ ? D3! '
'D1@ D2@ xor D3@ {scl} * D3@ ? y + x {amnt} - x {amnt} + clip ?',
'D1@ D2@ xor D3@ {scl} * D3@ ? y + '
)

combed = norm_expr(
[func.work_clip, blurred, blurred2],
expr + 'x {amnt} - x {amnt} + clip ?' if amnt is not None else '?',
planes, sstr=contra_str, amnt=scale_delta(amnt, 8, func.work_clip),
scl=scl, thr=scale_delta(thr, 8, func.work_clip),
)
Expand Down

0 comments on commit 176b6e8

Please sign in to comment.