diff --git a/vskernels/kernels/bicubic.py b/vskernels/kernels/bicubic.py index d2d8850..555a9c5 100644 --- a/vskernels/kernels/bicubic.py +++ b/vskernels/kernels/bicubic.py @@ -3,6 +3,7 @@ from math import acos, asinh, cos, sqrt from typing import TYPE_CHECKING, Any +from stgpytools import classproperty from vstools import CustomValueError, core, vs from .complex import ComplexKernel @@ -68,7 +69,7 @@ def get_params_args( return args | dict(b=self.b, c=self.c) return args | dict(filter_param_a=self.b, filter_param_b=self.c) - @property + @classproperty def kernel_size(self) -> int: return 1 + ((self.b, self.c) != (0, 0)) diff --git a/vskernels/kernels/placebo.py b/vskernels/kernels/placebo.py index b505014..0afe2c6 100644 --- a/vskernels/kernels/placebo.py +++ b/vskernels/kernels/placebo.py @@ -3,6 +3,7 @@ from math import ceil from typing import TYPE_CHECKING, Any +from stgpytools import classproperty from vstools import Transfer, TransferT, core, fallback, inject_self, vs from .complex import LinearScaler @@ -93,6 +94,6 @@ def _kernel_size(self, taps: float | None = None, b: float | None = None, c: flo return 1 - @property + @classproperty def kernel_size(self) -> int: return self._kernel_size(self.taps, self.b, self.c) diff --git a/vskernels/kernels/resize.py b/vskernels/kernels/resize.py index f36b97d..4bddc59 100644 --- a/vskernels/kernels/resize.py +++ b/vskernels/kernels/resize.py @@ -3,6 +3,7 @@ from math import ceil from typing import Any +from stgpytools import classproperty from vstools import core, vs from .zimg import ZimgComplexKernel @@ -26,7 +27,7 @@ class Bilinear(ZimgComplexKernel): scale_function = resample_function = core.lazy.resize.Bilinear descale_function = core.lazy.descale.Debilinear - @property + @classproperty def kernel_size(self) -> int: return 1 @@ -57,6 +58,6 @@ def get_params_args( return args | dict(taps=self.taps) return args | dict(filter_param_a=self.taps) - @property + @classproperty def kernel_size(self) -> int: return ceil(self.taps) diff --git a/vskernels/kernels/spline.py b/vskernels/kernels/spline.py index 52b6ea9..bff41d4 100644 --- a/vskernels/kernels/spline.py +++ b/vskernels/kernels/spline.py @@ -4,6 +4,7 @@ from math import ceil, isqrt from typing import Any +from stgpytools import classproperty from vstools import core from .zimg import ZimgComplexKernel @@ -20,7 +21,7 @@ class _SplineKernelSize: """Spline kernel size sub-class.""" - @property + @classproperty def kernel_size(self) -> int: radius = re.search(r'\d+$', self.__class__.__name__) @@ -38,7 +39,7 @@ class Spline(FmtConv): def __init__(self, taps: int = 2, **kwargs: Any) -> None: super().__init__(taps=taps, **kwargs) - @property + @classproperty def kernel_size(self) -> int: return ceil(self.taps)