Skip to content

Commit

Permalink
Simplify SSIM code
Browse files Browse the repository at this point in the history
  • Loading branch information
Setsugennoao committed Nov 5, 2023
1 parent 263216e commit 196041a
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions vsscale/scale.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from vsrgtools import box_blur, gauss_blur
from vstools import (
DependencyNotFoundError, KwargsT, Matrix, MatrixT, PlanesT, VSFunction, check_ref_clip, check_variable, core, depth,
expect_bits, fallback, get_nvidia_version, inject_self, padder, vs
fallback, get_nvidia_version, inject_self, padder, vs
)

from .helpers import GenericScaler
Expand Down Expand Up @@ -124,8 +124,6 @@ def _linear_scale(
) -> vs.VideoNode:
assert check_variable(clip, self.scale)

clip, bits = expect_bits(clip, 32)

l1 = self.scaler.scale(clip, width, height, shift, **(kwargs | self.kwargs))

l1_sq, c_sq = [expr_func(x, 'x dup *') for x in (l1, clip)]
Expand All @@ -143,9 +141,7 @@ def _linear_scale(

t = expr_func([r, m], 'x y *')

merge = expr_func([self.filter_func(m), self.filter_func(r), l1, self.filter_func(t)], 'x y z * + a -')

return depth(merge, bits)
return expr_func([self.filter_func(m), self.filter_func(r), l1, self.filter_func(t)], 'x y z * + a -')


@dataclass
Expand Down

0 comments on commit 196041a

Please sign in to comment.