soifunc 0.9.2__py3-none-any.whl → 0.10.0__py3-none-any.whl

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.
soifunc/resize.py CHANGED
@@ -4,6 +4,7 @@ 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
9
  Catrom,
9
10
  EwaLanczos,
@@ -13,8 +14,8 @@ from vskernels import (
13
14
  ScalerT,
14
15
  Spline36,
15
16
  )
16
- from vsscale import SSIM, GenericScaler, Waifu2x
17
- from vstools import check_variable_format, join, vs
17
+ from vsscale import SSIM, ArtCNN, GenericScaler, Waifu2x
18
+ from vstools import check_variable_format, is_gpu_available, join, vs
18
19
 
19
20
  __all__ = [
20
21
  "good_resize",
@@ -22,43 +23,6 @@ __all__ = [
22
23
  ]
23
24
 
24
25
 
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
26
  def good_resize(
63
27
  clip: vs.VideoNode,
64
28
  width: int,
@@ -66,7 +30,6 @@ def good_resize(
66
30
  shift: tuple[float, float] = (0, 0),
67
31
  gpu: bool | None = None,
68
32
  anime: bool = False,
69
- use_waifu2x: bool = False,
70
33
  ) -> vs.VideoNode:
71
34
  """High quality resizing filter
72
35
 
@@ -81,34 +44,33 @@ def good_resize(
81
44
  shift: tuple[float, float], optional
82
45
  Horizontal and vertical amount of shift to apply.
83
46
  gpu: bool, optional
84
- Whether to allow usage of GPU for Waifu2x.
47
+ Whether to allow usage of GPU for ArtCNN.
85
48
  Defaults to None, which will auto-select based on available mlrt and hardware.
86
49
  anime: bool, optional
87
50
  Enables scalers that are better tuned toward anime.
88
51
  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
52
  """
93
53
 
54
+ if gpu is None:
55
+ gpu = is_gpu_available()
56
+
94
57
  is_upscale = clip.width < width or clip.height < height
58
+ chroma_scaler = Spline36()
95
59
  if anime:
96
- if is_upscale and not use_waifu2x:
97
- luma_scaler = EwaLanczos()
98
- chroma_scaler = Spline36()
60
+ if is_upscale:
61
+ if gpu:
62
+ luma_scaler = ArtCNN()
63
+ else:
64
+ luma_scaler = Nnedi3SS(scaler=Hermite(sigmoid=True))
99
65
  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)
66
+ luma_scaler = Hermite(sigmoid=True)
103
67
  elif is_upscale:
104
68
  luma_scaler = EwaLanczos()
105
- chroma_scaler = Spline36()
106
69
  else:
107
70
  luma_scaler = SSIM()
108
- chroma_scaler = Spline36()
109
71
 
110
- return GoodScaler(luma_scaler, chroma_scaler).scale(
111
- clip, width, height, shift=shift, gpu=gpu, anime=anime, use_waifu2x=use_waifu2x
72
+ return HybridScaler(luma_scaler, chroma_scaler).scale(
73
+ clip, width, height, shift=shift
112
74
  )
113
75
 
114
76
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: soifunc
3
- Version: 0.9.2
3
+ Version: 0.10.0
4
4
  Summary: Soichiro's VapourSynth Functions Collection
5
5
  License: MIT
6
6
  Author: Josh Holmer
@@ -0,0 +1,9 @@
1
+ soifunc/__init__.py,sha256=o8id_imdLYtSpVNfB-G4Pru9GtEPqdkcpyyW3yQt-6U,127
2
+ soifunc/deband.py,sha256=GB9ksv-G1EOkro7mEN44p1vxLCnY2x4d4SqKhHxQ6Z8,1176
3
+ soifunc/denoise.py,sha256=OaNZVEtuaVTy_onD0zMareexUvHuda0pIgcIJollFFc,6841
4
+ soifunc/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
5
+ soifunc/resize.py,sha256=E7tiiqvfvt_PMsJFSlZrr9heuYVuySQiZXEbQ7Kjacs,3045
6
+ soifunc-0.10.0.dist-info/LICENSE,sha256=vgEDSMEV1J2nMiCgXE5_sjNtw2VT7_lP7rkAnrFKOWI,1068
7
+ soifunc-0.10.0.dist-info/METADATA,sha256=_C-g7OvcdJNIBTbrc5NDFqznt2-Wnjp_7IKYUNZu8x0,3364
8
+ soifunc-0.10.0.dist-info/WHEEL,sha256=fGIA9gx4Qxk2KDKeNJCbOEwSrmLtjWCwzBz351GyrPQ,88
9
+ soifunc-0.10.0.dist-info/RECORD,,
@@ -1,9 +0,0 @@
1
- soifunc/__init__.py,sha256=o8id_imdLYtSpVNfB-G4Pru9GtEPqdkcpyyW3yQt-6U,127
2
- soifunc/deband.py,sha256=GB9ksv-G1EOkro7mEN44p1vxLCnY2x4d4SqKhHxQ6Z8,1176
3
- soifunc/denoise.py,sha256=OaNZVEtuaVTy_onD0zMareexUvHuda0pIgcIJollFFc,6841
4
- soifunc/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
5
- soifunc/resize.py,sha256=irh4Mo8OidoYYXkwjvekMCtgb4Fp0YVszTQLfONJcNU,4344
6
- soifunc-0.9.2.dist-info/LICENSE,sha256=vgEDSMEV1J2nMiCgXE5_sjNtw2VT7_lP7rkAnrFKOWI,1068
7
- soifunc-0.9.2.dist-info/METADATA,sha256=OnsFFyK0wvfHWN0B97l__pLt898TO9t-O413_w66E54,3363
8
- soifunc-0.9.2.dist-info/WHEEL,sha256=fGIA9gx4Qxk2KDKeNJCbOEwSrmLtjWCwzBz351GyrPQ,88
9
- soifunc-0.9.2.dist-info/RECORD,,