soifunc 0.9.2__tar.gz → 0.10.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: soifunc
3
- Version: 0.9.2
3
+ Version: 0.10.1
4
4
  Summary: Soichiro's VapourSynth Functions Collection
5
5
  License: MIT
6
6
  Author: Josh Holmer
@@ -11,7 +11,7 @@ Classifier: Programming Language :: Python :: 3
11
11
  Classifier: Programming Language :: Python :: 3.12
12
12
  Classifier: Programming Language :: Python :: 3.13
13
13
  Requires-Dist: vapoursynth (>=68)
14
- Requires-Dist: vsjetpack (>=0.3.4,<0.4.0)
14
+ Requires-Dist: vsjetpack (>=0.4.0,<0.5.0)
15
15
  Description-Content-Type: text/markdown
16
16
 
17
17
  ## soifunc
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "soifunc"
3
- version = "0.9.2"
3
+ version = "0.10.1"
4
4
  description = "Soichiro's VapourSynth Functions Collection"
5
5
  authors = ["Josh Holmer <jholmer.in@gmail.com>"]
6
6
  license = "MIT"
@@ -9,12 +9,12 @@ readme = "README.md"
9
9
  [tool.poetry.dependencies]
10
10
  python = ">=3.12,<4.0"
11
11
  vapoursynth = ">=68"
12
- vsjetpack = "^0.3.4"
12
+ vsjetpack = "^0.4.0"
13
13
 
14
14
  [tool.poetry.group.dev.dependencies]
15
- black = "^24.4.2"
16
- isort = "^5.13.2"
17
- pre-commit = "^2.21.0"
15
+ black = "^25.1.0"
16
+ isort = "^6.0.1"
17
+ pre-commit = "^4.2.0"
18
18
 
19
19
  [build-system]
20
20
  requires = ["poetry-core"]
@@ -4,17 +4,15 @@ from dataclasses import dataclass
4
4
  from inspect import getfullargspec
5
5
  from typing import Any
6
6
 
7
+ from vsaa.antialiasers.nnedi3 import Nnedi3SS
7
8
  from vskernels import (
8
- Catrom,
9
- EwaLanczos,
10
9
  Hermite,
11
- KeepArScaler,
12
10
  Scaler,
13
11
  ScalerT,
14
12
  Spline36,
15
13
  )
16
- from vsscale import SSIM, GenericScaler, Waifu2x
17
- from vstools import check_variable_format, join, vs
14
+ from vsscale import SSIM, ArtCNN, GenericScaler
15
+ from vstools import check_variable_format, inject_self, is_gpu_available, join, vs
18
16
 
19
17
  __all__ = [
20
18
  "good_resize",
@@ -22,43 +20,6 @@ __all__ = [
22
20
  ]
23
21
 
24
22
 
25
- @dataclass
26
- class GoodScaler(KeepArScaler):
27
- """High quality resizing filter based on opinionated defaults"""
28
-
29
- def __init__(
30
- self,
31
- luma_scaler: ScalerT,
32
- chroma_scaler: ScalerT,
33
- **kwargs: Any,
34
- ) -> None:
35
- self.scaler = HybridScaler(luma_scaler, chroma_scaler)
36
- super().__init__(**kwargs)
37
-
38
- @property
39
- def kernel_radius(self) -> int:
40
- return self.scaler.kernel_radius
41
-
42
- def scale_function( # type:ignore
43
- self,
44
- clip: vs.VideoNode,
45
- width: int,
46
- height: int,
47
- shift: tuple[float, float] = (0, 0),
48
- **kwargs: Any,
49
- ) -> vs.VideoNode:
50
- if (width, height) == (clip.width, clip.height):
51
- return clip
52
-
53
- anime = kwargs.get("anime", False)
54
- gpu = kwargs.get("gpu", None)
55
- use_waifu2x = kwargs.get("use_waifu2x", None)
56
-
57
- if anime and use_waifu2x:
58
- return Waifu2x(cuda=gpu).scale(clip, width, height, shift)
59
- return self.scaler.scale(clip, width, height, shift)
60
-
61
-
62
23
  def good_resize(
63
24
  clip: vs.VideoNode,
64
25
  width: int,
@@ -66,7 +27,6 @@ def good_resize(
66
27
  shift: tuple[float, float] = (0, 0),
67
28
  gpu: bool | None = None,
68
29
  anime: bool = False,
69
- use_waifu2x: bool = False,
70
30
  ) -> vs.VideoNode:
71
31
  """High quality resizing filter
72
32
 
@@ -81,34 +41,33 @@ def good_resize(
81
41
  shift: tuple[float, float], optional
82
42
  Horizontal and vertical amount of shift to apply.
83
43
  gpu: bool, optional
84
- Whether to allow usage of GPU for Waifu2x.
44
+ Whether to allow usage of GPU for ArtCNN.
85
45
  Defaults to None, which will auto-select based on available mlrt and hardware.
86
46
  anime: bool, optional
87
47
  Enables scalers that are better tuned toward anime.
88
48
  Defaults to False.
89
- use_waifu2x: bool, optional
90
- Enables Waifu2x. Will fall back to EwaLanczos if this is False.
91
- Defaults to False, since Waifu2x can be a pain to set up.
92
49
  """
93
50
 
51
+ if gpu is None:
52
+ gpu = is_gpu_available()
53
+
94
54
  is_upscale = clip.width < width or clip.height < height
55
+ chroma_scaler = Spline36()
95
56
  if anime:
96
- if is_upscale and not use_waifu2x:
97
- luma_scaler = EwaLanczos()
98
- chroma_scaler = Spline36()
57
+ if is_upscale:
58
+ if gpu:
59
+ luma_scaler = ArtCNN()
60
+ else:
61
+ luma_scaler = Nnedi3SS(scaler=Hermite(sigmoid=True))
99
62
  else:
100
- # w2x handles upscaling differently, so we only need to specify the downscale kernel for it
101
- luma_scaler = Catrom(sigmoid=True)
102
- chroma_scaler = Catrom(sigmoid=True)
63
+ luma_scaler = Hermite(sigmoid=True)
103
64
  elif is_upscale:
104
- luma_scaler = EwaLanczos()
105
- chroma_scaler = Spline36()
65
+ luma_scaler = Nnedi3SS(scaler=SSIM())
106
66
  else:
107
67
  luma_scaler = SSIM()
108
- chroma_scaler = Spline36()
109
68
 
110
- return GoodScaler(luma_scaler, chroma_scaler).scale(
111
- clip, width, height, shift=shift, gpu=gpu, anime=anime, use_waifu2x=use_waifu2x
69
+ return HybridScaler(luma_scaler, chroma_scaler).scale(
70
+ clip, width, height, shift=shift
112
71
  )
113
72
 
114
73
 
@@ -123,7 +82,7 @@ class HybridScaler(GenericScaler):
123
82
  self._luma = Scaler.ensure_obj(self.luma_scaler)
124
83
  self._chroma = Scaler.ensure_obj(self.chroma_scaler)
125
84
 
126
- @property
85
+ @inject_self.cached.property
127
86
  def kernel_radius(self) -> int:
128
87
  return self._luma.kernel_radius
129
88
 
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes