Skip to content

Commit

Permalink
More code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
Setsugennoao committed Nov 11, 2023
1 parent 84d80be commit 4e2c230
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
4 changes: 3 additions & 1 deletion vskernels/kernels/bicubic.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,9 @@ def get_params_args(

@inject_self.property
def kernel_size(self) -> int:
return 1 + ((self.b, self.c) != (0, 0))
if (self.b, self.c) == (0, 0):
return 1
return 2


class BSpline(Bicubic):
Expand Down
17 changes: 8 additions & 9 deletions vskernels/kernels/placebo.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,15 +84,14 @@ def get_params_args(
lut_entries=self.lut_entries, trc=curve.value_libplacebo
)

def _kernel_size(self, taps: float | None = None, b: float | None = None, c: float | None = None) -> int:
if taps:
return ceil(taps)
@inject_self.property
def kernel_size(self) -> int:
from .bicubic import Bicubic

if b or c:
return 1 + ((fallback(b, 0), fallback(c, 0.5)) != (0, 0))
if self.taps:
return ceil(self.taps)

return 1
if self.b or self.c:
return Bicubic(self.b, self.c).kernel_size

@inject_self.property
def kernel_size(self) -> int:
return self._kernel_size(self.taps, self.b, self.c)
return 1

0 comments on commit 4e2c230

Please sign in to comment.