-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4e918ac
commit 8574da3
Showing
16 changed files
with
468 additions
and
752 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,9 @@ | ||
from .abstract import * # noqa: F401, F403 | ||
from .bicubic import * # noqa: F401, F403 | ||
from .complex import * # noqa: F401, F403 | ||
from .fmtconv import * # noqa: F401, F403 | ||
from .impulse import * # noqa: F401, F403 | ||
from .custom import * # noqa: F401, F403 | ||
from .ewa import * # noqa: F401, F403 | ||
from .placebo import * # noqa: F401, F403 | ||
from .resize import * # noqa: F401, F403 | ||
from .spline import * # noqa: F401, F403 | ||
from .various import * # noqa: F401, F403 | ||
from .zimg import * # noqa: F401, F403 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
from __future__ import annotations | ||
from stgpytools import inject_self | ||
|
||
from vstools import vs, core | ||
from typing import Any | ||
from .abstract import Kernel | ||
|
||
from typing import TypeVar | ||
|
||
|
||
__all__ = [ | ||
'CustomKernel' | ||
] | ||
|
||
|
||
class CustomKernel(Kernel): | ||
@inject_self | ||
def kernel(self: CustomKernelT, *, x: float) -> float: | ||
raise NotImplementedError | ||
|
||
def scale_function(self, clip: vs.VideoNode, width: int, height: int, *args: Any, blur: float = 1.0, **kwargs: Any) -> vs.VideoNode: | ||
return core.resize.Custom(clip, self.kernel, self.kernel_radius, width, height, *args, **kwargs) | ||
|
||
resample_function = scale_function | ||
|
||
def descale_function(self, clip: vs.VideoNode, width: int, height: int, *args: Any, **kwargs: Any) -> vs.VideoNode: | ||
return core.descale.Decustom(clip, width, height, self.kernel, self.kernel_radius, *args, **kwargs) | ||
|
||
def get_params_args( | ||
self, is_descale: bool, clip: vs.VideoNode, width: int | None = None, height: int | None = None, **kwargs: Any | ||
) -> dict[str, Any]: | ||
args = super().get_params_args(is_descale, clip, width, height, **kwargs) | ||
|
||
if not is_descale: | ||
for key in ('border_handling', 'ignore_mask', 'force', 'force_h', 'force_v'): | ||
args.pop(key, None) | ||
|
||
return args | ||
|
||
|
||
CustomKernelT = TypeVar('CustomKernelT', bound=CustomKernel) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
from __future__ import annotations | ||
|
||
from typing import Any | ||
|
||
from .placebo import Placebo | ||
|
||
__all__ = [ | ||
'EwaBicubic', | ||
'EwaJinc', | ||
'EwaLanczos', | ||
'EwaGinseng', | ||
'EwaHann', | ||
'EwaHannSoft', | ||
'EwaRobidoux', | ||
'EwaRobidouxSharp', | ||
] | ||
|
||
|
||
class EwaBicubic(Placebo): | ||
_kernel = 'ewa_robidoux' | ||
|
||
def __init__(self, b: float = 0.0, c: float = 0.5, radius: int | None = None, **kwargs: Any) -> None: | ||
radius = kwargs.pop('taps', radius) | ||
|
||
if radius is None: | ||
from .bicubic import Bicubic | ||
|
||
radius = Bicubic(b, c).kernel_radius | ||
|
||
super().__init__(radius, b, c, **kwargs) | ||
|
||
|
||
class EwaLanczos(Placebo): | ||
_kernel = 'ewa_lanczos' | ||
|
||
def __init__(self, taps: float = 3.2383154841662362076499, **kwargs: Any) -> None: | ||
super().__init__(taps, None, None, **kwargs) | ||
|
||
|
||
class EwaJinc(Placebo): | ||
_kernel = 'ewa_jinc' | ||
|
||
def __init__(self, taps: float = 3.2383154841662362076499, **kwargs: Any) -> None: | ||
super().__init__(taps, None, None, **kwargs) | ||
|
||
|
||
class EwaGinseng(Placebo): | ||
_kernel = 'ewa_ginseng' | ||
|
||
def __init__(self, taps: float = 3.2383154841662362076499, **kwargs: Any) -> None: | ||
super().__init__(taps, None, None, **kwargs) | ||
|
||
|
||
class EwaHann(Placebo): | ||
_kernel = 'ewa_hann' | ||
|
||
def __init__(self, taps: float = 3.2383154841662362076499, **kwargs: Any) -> None: | ||
super().__init__(taps, None, None, **kwargs) | ||
|
||
|
||
class EwaHannSoft(Placebo): | ||
_kernel = 'haasnsoft' | ||
|
||
def __init__(self, taps: float = 3.2383154841662362076499, **kwargs: Any) -> None: | ||
super().__init__(taps, None, None, **kwargs) | ||
|
||
|
||
class EwaRobidoux(Placebo): | ||
_kernel = 'ewa_robidoux' | ||
|
||
def __init__(self, **kwargs: Any) -> None: | ||
super().__init__(None, None, None, **kwargs) | ||
|
||
|
||
class EwaRobidouxSharp(Placebo): | ||
_kernel = 'ewa_robidouxsharp' | ||
|
||
def __init__(self, **kwargs: Any) -> None: | ||
super().__init__(None, None, None, **kwargs) |
Oops, something went wrong.