diff --git a/vskernels/kernels/abstract.py b/vskernels/kernels/abstract.py index 09eb9c3..4f62e9b 100644 --- a/vskernels/kernels/abstract.py +++ b/vskernels/kernels/abstract.py @@ -19,12 +19,12 @@ ] -def _default_kernel_size(cls, self) -> int: - if hasattr(self, '_static_kernel_size'): - return ceil(self._static_kernel_size) +def _default_kernel_radius(cls, self) -> int: + if hasattr(self, '_static_kernel_radius'): + return ceil(self._static_kernel_radius) try: - return super(cls, self).kernel_size + return super(cls, self).kernel_radius except AttributeError: ... @@ -133,8 +133,8 @@ def multi( return self.scale(clip, dst_width, dst_height, shift, **kwargs) @inject_self.property - def kernel_size(self) -> int: - return _default_kernel_size(__class__, self) + def kernel_radius(self) -> int: + return _default_kernel_radius(__class__, self) class Descaler(vs_object): @@ -182,8 +182,8 @@ def ensure_obj( return BaseScaler.ensure_obj(cls, Descaler, descaler, UnknownDescalerError, [], func_except) # type: ignore @inject_self.property - def kernel_size(self) -> int: - return _default_kernel_size(__class__, self) + def kernel_radius(self) -> int: + return _default_kernel_radius(__class__, self) class Resampler(vs_object): @@ -207,8 +207,8 @@ def ensure_obj( return BaseScaler.ensure_obj(cls, Resampler, resampler, UnknownDescalerError, [], func_except) # type: ignore @inject_self.property - def kernel_size(self) -> int: - return _default_kernel_size(__class__, self) + def kernel_radius(self) -> int: + return _default_kernel_radius(__class__, self) class Kernel(Scaler, Descaler, Resampler): diff --git a/vskernels/kernels/bicubic.py b/vskernels/kernels/bicubic.py index d26798b..1508c78 100644 --- a/vskernels/kernels/bicubic.py +++ b/vskernels/kernels/bicubic.py @@ -69,7 +69,7 @@ def get_params_args( return args | dict(filter_param_a=self.b, filter_param_b=self.c) @inject_self.property - def kernel_size(self) -> int: + def kernel_radius(self) -> int: if (self.b, self.c) == (0, 0): return 1 return 2 @@ -273,5 +273,5 @@ def _get_bc_args(self) -> tuple[float, float]: return autob, autoc @inject_self.property - def kernel_size(self) -> int: - return Bicubic(*self._get_bc_args()).kernel_size + def kernel_radius(self) -> int: + return Bicubic(*self._get_bc_args()).kernel_radius diff --git a/vskernels/kernels/fmtconv.py b/vskernels/kernels/fmtconv.py index 1236ced..1dca4b0 100644 --- a/vskernels/kernels/fmtconv.py +++ b/vskernels/kernels/fmtconv.py @@ -170,7 +170,7 @@ def _shift(shift_top: float | list[float] = 0.0, shift_left: float | list[float] return _shift(shifts_top, shifts_left) @inject_self.property - def kernel_size(self) -> int: + def kernel_radius(self) -> int: taps_hv = self.kwargs.get('taps_h', self.kwargs.get('taps_v', None)) if taps_hv is None: diff --git a/vskernels/kernels/placebo.py b/vskernels/kernels/placebo.py index 1f92977..67dcfc1 100644 --- a/vskernels/kernels/placebo.py +++ b/vskernels/kernels/placebo.py @@ -85,13 +85,13 @@ def get_params_args( ) @inject_self.property - def kernel_size(self) -> int: + def kernel_radius(self) -> int: from .bicubic import Bicubic if self.taps: return ceil(self.taps) if self.b or self.c: - return Bicubic(self.b, self.c).kernel_size + return Bicubic(self.b, self.c).kernel_radius return 2 diff --git a/vskernels/kernels/resize.py b/vskernels/kernels/resize.py index b446b1b..cb40a49 100644 --- a/vskernels/kernels/resize.py +++ b/vskernels/kernels/resize.py @@ -18,7 +18,7 @@ class Point(ZimgComplexKernel): """Built-in point resizer.""" scale_function = resample_function = descale_function = core.lazy.resize.Point - _static_kernel_size = 1 + _static_kernel_radius = 1 class Bilinear(ZimgComplexKernel): @@ -26,7 +26,7 @@ class Bilinear(ZimgComplexKernel): scale_function = resample_function = core.lazy.resize.Bilinear descale_function = core.lazy.descale.Debilinear - _static_kernel_size = 1 + _static_kernel_radius = 1 class Lanczos(ZimgComplexKernel): @@ -56,5 +56,5 @@ def get_params_args( return args | dict(filter_param_a=self.taps) @inject_self.property - def kernel_size(self) -> int: + def kernel_radius(self) -> int: return ceil(self.taps) diff --git a/vskernels/kernels/spline.py b/vskernels/kernels/spline.py index f768922..280edb8 100644 --- a/vskernels/kernels/spline.py +++ b/vskernels/kernels/spline.py @@ -35,7 +35,7 @@ class Spline16(ZimgComplexKernel): scale_function = resample_function = core.lazy.resize.Spline16 descale_function = core.lazy.descale.Despline16 - _static_kernel_size = 2 + _static_kernel_radius = 2 class Spline36(ZimgComplexKernel): @@ -49,7 +49,7 @@ class Spline36(ZimgComplexKernel): scale_function = resample_function = core.lazy.resize.Spline36 descale_function = core.lazy.descale.Despline36 - _static_kernel_size = 3 + _static_kernel_radius = 3 class Spline64(ZimgComplexKernel): @@ -63,4 +63,4 @@ class Spline64(ZimgComplexKernel): scale_function = resample_function = core.lazy.resize.Spline64 descale_function = core.lazy.descale.Despline64 - _static_kernel_size = 4 + _static_kernel_radius = 4 diff --git a/vskernels/kernels/various.py b/vskernels/kernels/various.py index 285c679..d64064c 100644 --- a/vskernels/kernels/various.py +++ b/vskernels/kernels/various.py @@ -109,7 +109,7 @@ def __init__(self, b: float = 0.0, c: float = 0.5, radius: int | None = None, ** if radius is None: from .bicubic import Bicubic - radius = Bicubic(b, c).kernel_size + radius = Bicubic(b, c).kernel_radius super().__init__(radius, b, c, **kwargs)