Skip to content

Commit

Permalink
Add kernel_size to FmtConv
Browse files Browse the repository at this point in the history
  • Loading branch information
Setsugennoao committed Nov 11, 2023
1 parent 863706e commit 02a278d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
12 changes: 11 additions & 1 deletion vskernels/kernels/fmtconv.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
from __future__ import annotations

from math import ceil
from typing import Any, Callable, overload

from vstools import VideoFormatT, VSFunction, core, inject_self, vs

from .abstract import Resampler
from .complex import ComplexScaler
from .bicubic import Bicubic
from .complex import ComplexScaler

__all__ = [
'FmtConv'
Expand Down Expand Up @@ -167,3 +168,12 @@ def _shift(shift_top: float | list[float] = 0.0, shift_left: float | list[float]
shifts_left = shifts_left[:n_planes]

return _shift(shifts_top, shifts_left)

@inject_self.property
def kernel_size(self) -> int:
taps_hv = self.kwargs.get('taps_h', self.kwargs.get('taps_v', None))

if taps_hv is None:
taps_hv = self.taps

return ceil(self.taps)
5 changes: 0 additions & 5 deletions vskernels/kernels/spline.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from __future__ import annotations

from math import ceil
from typing import Any

from vstools import core, inject_self
Expand All @@ -24,10 +23,6 @@ class Spline(FmtConv):
def __init__(self, taps: float = 2, **kwargs: Any) -> None:
super().__init__(taps=taps, **kwargs)

@inject_self.property
def kernel_size(self) -> int:
return ceil(self.taps)


class Spline16(ZimgComplexKernel):
"""
Expand Down

0 comments on commit 02a278d

Please sign in to comment.