diff --git a/vsscale/scale.py b/vsscale/scale.py index 7d51428..cd306bc 100644 --- a/vsscale/scale.py +++ b/vsscale/scale.py @@ -9,7 +9,7 @@ from vskernels import Bicubic, Hermite, LinearScaler, ScalerT, SetsuCubic, ZewiaCubic from vsrgtools import box_blur, gauss_blur from vstools import ( - DependencyNotFoundError, KwargsT, Matrix, MatrixT, PlanesT, VSFunction, check_ref_clip, check_variable, core, depth, + DependencyNotFoundError, KwargsT, Matrix, MatrixT, PlanesT, VSFunction, check_ref_clip, check_variable, core, depth, expect_bits, fallback, get_nvidia_version, inject_self, padder, vs ) @@ -102,7 +102,6 @@ def __init__( self.scaler = Hermite.from_param(scaler) if smooth is None: - kernel_radius = 1 if isinstance(self.scaler, Bicubic): @@ -125,6 +124,8 @@ 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)] @@ -142,7 +143,9 @@ def _linear_scale( t = expr_func([r, m], 'x y *') - return expr_func([self.filter_func(m), self.filter_func(r), l1, self.filter_func(t)], 'x y z * + a -') + merge = expr_func([self.filter_func(m), self.filter_func(r), l1, self.filter_func(t)], 'x y z * + a -') + + return depth(merge, bits) @dataclass