From 2c068f02026780df290d62722b944d64b61eb18c Mon Sep 17 00:00:00 2001 From: Setsugennoao <41454651+Setsugennoao@users.noreply.github.com> Date: Thu, 14 Dec 2023 20:04:33 +0100 Subject: [PATCH] Adapt to new vskernels api --- vsaa/abstract.py | 2 +- vsaa/antialiasers/eedi2.py | 2 ++ vsaa/antialiasers/eedi3.py | 6 +++++- vsaa/antialiasers/nnedi3.py | 14 +++++++++++++- vsaa/antialiasers/sangnom.py | 2 ++ 5 files changed, 23 insertions(+), 3 deletions(-) diff --git a/vsaa/abstract.py b/vsaa/abstract.py index c5672aa..5482dde 100644 --- a/vsaa/abstract.py +++ b/vsaa/abstract.py @@ -13,7 +13,7 @@ from .enums import AADirection -__all__ = [ +__all__ = __abstract__ = [ 'SuperSampler', 'SingleRater', 'DoubleRater', 'Antialiaser' diff --git a/vsaa/antialiasers/eedi2.py b/vsaa/antialiasers/eedi2.py index 8f347a2..aab43fe 100644 --- a/vsaa/antialiasers/eedi2.py +++ b/vsaa/antialiasers/eedi2.py @@ -62,6 +62,8 @@ def full_interpolate(self, clip: vs.VideoNode, double_y: bool, double_x: bool, * _shift = -0.5 + _static_kernel_radius = 2 + class Eedi2SS(EEDI2, SuperSampler): ... diff --git a/vsaa/antialiasers/eedi3.py b/vsaa/antialiasers/eedi3.py index bdc86c0..d4139d7 100644 --- a/vsaa/antialiasers/eedi3.py +++ b/vsaa/antialiasers/eedi3.py @@ -4,7 +4,7 @@ from dataclasses import field as dc_field from typing import Any, Literal -from vstools import CustomValueError, core, vs +from vstools import CustomValueError, core, inject_self, vs from ..abstract import Antialiaser, DoubleRater, SingleRater, SuperSampler, _Antialiaser from . import nnedi3 @@ -91,6 +91,10 @@ def interpolate(self, clip: vs.VideoNode, double_y: bool, **kwargs: Any) -> vs.V _shift = 0.5 + @inject_self.property + def kernel_radius(self) -> int: + return self.nrad + class Eedi3SS(EEDI3, SuperSampler): ... diff --git a/vsaa/antialiasers/nnedi3.py b/vsaa/antialiasers/nnedi3.py index 9fc3099..162dc33 100644 --- a/vsaa/antialiasers/nnedi3.py +++ b/vsaa/antialiasers/nnedi3.py @@ -3,7 +3,7 @@ from dataclasses import dataclass from typing import Any -from vstools import core, vs +from vstools import core, inject_self, vs from ..abstract import Antialiaser, DoubleRater, SingleRater, SuperSampler, _Antialiaser, _FullInterpolate @@ -63,6 +63,18 @@ def full_interpolate(self, clip: vs.VideoNode, double_y: bool, double_x: bool, * _shift = 0.5 + @inject_self.property + def kernel_radius(self) -> int: + match self.nsize: + case 1 | 5: + return 16 + case 2 | 6: + return 32 + case 3: + return 48 + case _: + return 8 + class Nnedi3SS(NNEDI3, SuperSampler): ... diff --git a/vsaa/antialiasers/sangnom.py b/vsaa/antialiasers/sangnom.py index d58189a..65404b7 100644 --- a/vsaa/antialiasers/sangnom.py +++ b/vsaa/antialiasers/sangnom.py @@ -34,6 +34,8 @@ def interpolate(self, clip: vs.VideoNode, double_y: bool, **kwargs: Any) -> vs.V _shift = -0.5 + _static_kernel_radius = 2 + class SangNomSS(SANGNOM, SuperSampler): ...