Skip to content

placebo

Classes:

EwaBicubic

EwaBicubic(
    b: float = 0.0, c: float = 0.5, radius: int | None = None, **kwargs: Any
)

Bases: Placebo

Methods:

Attributes:

Source code
105
106
107
108
109
110
111
112
113
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)

antiring instance-attribute

antiring: float = antiring

b instance-attribute

b: float | None = b

blur instance-attribute

blur: float = blur

c instance-attribute

c: float | None = c

clamp instance-attribute

clamp: float = clamp

kwargs instance-attribute

kwargs: KwargsT = kwargs

Arguments passed to the internal scale function

scale_function class-attribute instance-attribute

scale_function = Resample

taper instance-attribute

taper: float = taper

taps instance-attribute

taps: float | None = taps

ensure_obj classmethod

ensure_obj(
    scaler: str | type[BaseScalerT] | BaseScalerT | None = None,
    /,
    func_except: FuncExceptT | None = None,
) -> BaseScalerT
Source code
201
202
203
204
205
206
207
208
@classmethod
def ensure_obj(
    cls: type[BaseScalerT], scaler: str | type[BaseScalerT] | BaseScalerT | None = None, /,
    func_except: FuncExceptT | None = None
) -> BaseScalerT:
    return _base_ensure_obj(
        cls, (mro := cls.mro())[mro.index(BaseScaler) - 1], scaler, cls._err_class, [], func_except
    )

from_param classmethod

from_param(
    scaler: str | type[BaseScalerT] | BaseScalerT | None = None,
    /,
    func_except: FuncExceptT | None = None,
) -> type[BaseScalerT]
Source code
192
193
194
195
196
197
198
199
@classmethod
def from_param(
    cls: type[BaseScalerT], scaler: str | type[BaseScalerT] | BaseScalerT | None = None, /,
    func_except: FuncExceptT | None = None
) -> type[BaseScalerT]:
    return _base_from_param(
        cls, (mro := cls.mro())[mro.index(BaseScaler) - 1], scaler, cls._err_class, [], func_except
    )

get_clean_kwargs

get_clean_kwargs(*funcs: Callable[..., Any] | None) -> KwargsT
Source code
216
217
def get_clean_kwargs(self, *funcs: Callable[..., Any] | None) -> KwargsT:
    return _clean_self_kwargs(funcs, self)

get_implemented_funcs

get_implemented_funcs() -> tuple[Callable[..., Any], ...]
Source code
299
300
def get_implemented_funcs(self) -> tuple[Callable[..., Any], ...]:
    return (self.scale, self.supersample)

get_params_args

get_params_args(
    is_descale: bool,
    clip: VideoNode,
    width: int | None = None,
    height: int | None = None,
    **kwargs: Any
) -> dict[str, Any]
Source code
79
80
81
82
83
84
85
86
87
def get_params_args(
    self, is_descale: bool, clip: vs.VideoNode, width: int | None = None, height: int | None = None, **kwargs: Any
) -> dict[str, Any]:
    return dict(
        width=width, height=height, filter=self._kernel,
        radius=self.taps, param1=self.b, param2=self.c,
        clamp=self.clamp, taper=self.taper, blur=self.blur,
        antiring=self.antiring,
    ) | kwargs

get_scale_args

get_scale_args(
    clip: VideoNode,
    shift: tuple[TopShift, LeftShift] = (0, 0),
    width: int | None = None,
    height: int | None = None,
    *funcs: Callable[..., Any],
    **kwargs: Any
) -> dict[str, Any]
Source code
67
68
69
70
71
72
73
74
75
76
77
@inject_kwargs_params
def get_scale_args(
    self, clip: vs.VideoNode, shift: tuple[TopShift, LeftShift] = (0, 0),
    width: int | None = None, height: int | None = None,
    *funcs: Callable[..., Any], **kwargs: Any
) -> dict[str, Any]:
    return (
        dict(sx=shift[1], sy=shift[0])
        | self.get_clean_kwargs(*funcs)
        | self.get_params_args(False, clip, width, height, **kwargs)
    )

kernel_radius

kernel_radius() -> int
Source code
89
90
91
92
93
94
95
96
97
98
99
@inject_self.cached.property
def kernel_radius(self) -> int:
    from .bicubic import Bicubic

    if self.taps:
        return ceil(self.taps)

    if self.b or self.c:
        return Bicubic(fallback(self.b, 0), fallback(self.c, 0.5)).kernel_radius

    return 2

multi

multi(
    clip: VideoNode,
    multi: float = 2.0,
    shift: tuple[TopShift, LeftShift] = (0, 0),
    **kwargs: Any
) -> VideoNode
Source code
272
273
274
275
276
277
278
279
280
281
@inject_self.cached
def multi(
    self, clip: vs.VideoNode, multi: float = 2.0, shift: tuple[TopShift, LeftShift] = (0, 0), **kwargs: Any
) -> vs.VideoNode:

    import warnings

    warnings.warn('The "multi" method is deprecated. Use "supersample" instead.', DeprecationWarning)

    return self.supersample(clip, multi, shift, **kwargs)

pretty_string

pretty_string() -> str
Source code
225
226
227
@inject_self.cached.property
def pretty_string(self) -> str:
    return self._pretty_string()

scale

scale(
    clip: VideoNode,
    width: int | None = None,
    height: int | None = None,
    shift: tuple[TopShift, LeftShift] = (0, 0),
    *,
    border_handling: BorderHandling = MIRROR,
    sample_grid_model: SampleGridModel = MATCH_EDGES,
    sar: Sar | float | bool | None = None,
    dar: Dar | float | bool | None = None,
    dar_in: Dar | bool | float | None = None,
    keep_ar: bool | None = None,
    linear: bool = False,
    sigmoid: bool | tuple[Slope, Center] = False,
    **kwargs: Any
) -> VideoNode
Source code
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
@inject_self.cached
@inject_kwargs_params
def scale(
    self, clip: vs.VideoNode, width: int | None = None, height: int | None = None,
    shift: tuple[TopShift, LeftShift] = (0, 0),
    *,
    # `border_handling`, `sample_grid_model`, `sar`, `dar`, `dar_in` and `keep_ar` from KeepArScaler
    border_handling: BorderHandling = BorderHandling.MIRROR,
    sample_grid_model: SampleGridModel = SampleGridModel.MATCH_EDGES,
    sar: Sar | float | bool | None = None, dar: Dar | float | bool | None = None,
    dar_in: Dar | bool | float | None = None, keep_ar: bool | None = None,
    # `linear` and `sigmoid` from LinearScaler
    linear: bool = False, sigmoid: bool | tuple[Slope, Center] = False,
    **kwargs: Any
) -> vs.VideoNode:
    width, height = Scaler._wh_norm(clip, width, height)
    return super().scale(
        clip, width, height, shift,
        border_handling=border_handling, sample_grid_model=sample_grid_model,
        sar=sar, dar=dar, dar_in=dar_in, keep_ar=keep_ar,
        linear=linear, sigmoid=sigmoid,
        **kwargs
    )

supersample

supersample(
    clip: VideoNode,
    rfactor: float = 2.0,
    shift: tuple[TopShift, LeftShift] = (0, 0),
    **kwargs: Any
) -> VideoNode
Source code
257
258
259
260
261
262
263
264
265
266
267
268
269
270
@inject_self.cached
def supersample(
    self, clip: vs.VideoNode, rfactor: float = 2.0, shift: tuple[TopShift, LeftShift] = (0, 0), **kwargs: Any
) -> vs.VideoNode:
    assert check_variable_resolution(clip, self.multi)

    dst_width, dst_height = ceil(clip.width * rfactor), ceil(clip.height * rfactor)

    if max(dst_width, dst_height) <= 0.0:
        raise CustomValueError(
            'Multiplying the resolution by "rfactor" must result in a positive resolution!', self.supersample, rfactor
        )

    return self.scale(clip, dst_width, dst_height, shift, **kwargs)

EwaGinseng

EwaGinseng(taps: float = 3.238315484166236, **kwargs: Any)

Bases: Placebo

Methods:

Attributes:

Source code
133
134
def __init__(self, taps: float = 3.2383154841662362076499, **kwargs: Any) -> None:
    super().__init__(taps, None, None, **kwargs)

antiring instance-attribute

antiring: float = antiring

b instance-attribute

b: float | None = b

blur instance-attribute

blur: float = blur

c instance-attribute

c: float | None = c

clamp instance-attribute

clamp: float = clamp

kwargs instance-attribute

kwargs: KwargsT = kwargs

Arguments passed to the internal scale function

scale_function class-attribute instance-attribute

scale_function = Resample

taper instance-attribute

taper: float = taper

taps instance-attribute

taps: float | None = taps

ensure_obj classmethod

ensure_obj(
    scaler: str | type[BaseScalerT] | BaseScalerT | None = None,
    /,
    func_except: FuncExceptT | None = None,
) -> BaseScalerT
Source code
201
202
203
204
205
206
207
208
@classmethod
def ensure_obj(
    cls: type[BaseScalerT], scaler: str | type[BaseScalerT] | BaseScalerT | None = None, /,
    func_except: FuncExceptT | None = None
) -> BaseScalerT:
    return _base_ensure_obj(
        cls, (mro := cls.mro())[mro.index(BaseScaler) - 1], scaler, cls._err_class, [], func_except
    )

from_param classmethod

from_param(
    scaler: str | type[BaseScalerT] | BaseScalerT | None = None,
    /,
    func_except: FuncExceptT | None = None,
) -> type[BaseScalerT]
Source code
192
193
194
195
196
197
198
199
@classmethod
def from_param(
    cls: type[BaseScalerT], scaler: str | type[BaseScalerT] | BaseScalerT | None = None, /,
    func_except: FuncExceptT | None = None
) -> type[BaseScalerT]:
    return _base_from_param(
        cls, (mro := cls.mro())[mro.index(BaseScaler) - 1], scaler, cls._err_class, [], func_except
    )

get_clean_kwargs

get_clean_kwargs(*funcs: Callable[..., Any] | None) -> KwargsT
Source code
216
217
def get_clean_kwargs(self, *funcs: Callable[..., Any] | None) -> KwargsT:
    return _clean_self_kwargs(funcs, self)

get_implemented_funcs

get_implemented_funcs() -> tuple[Callable[..., Any], ...]
Source code
299
300
def get_implemented_funcs(self) -> tuple[Callable[..., Any], ...]:
    return (self.scale, self.supersample)

get_params_args

get_params_args(
    is_descale: bool,
    clip: VideoNode,
    width: int | None = None,
    height: int | None = None,
    **kwargs: Any
) -> dict[str, Any]
Source code
79
80
81
82
83
84
85
86
87
def get_params_args(
    self, is_descale: bool, clip: vs.VideoNode, width: int | None = None, height: int | None = None, **kwargs: Any
) -> dict[str, Any]:
    return dict(
        width=width, height=height, filter=self._kernel,
        radius=self.taps, param1=self.b, param2=self.c,
        clamp=self.clamp, taper=self.taper, blur=self.blur,
        antiring=self.antiring,
    ) | kwargs

get_scale_args

get_scale_args(
    clip: VideoNode,
    shift: tuple[TopShift, LeftShift] = (0, 0),
    width: int | None = None,
    height: int | None = None,
    *funcs: Callable[..., Any],
    **kwargs: Any
) -> dict[str, Any]
Source code
67
68
69
70
71
72
73
74
75
76
77
@inject_kwargs_params
def get_scale_args(
    self, clip: vs.VideoNode, shift: tuple[TopShift, LeftShift] = (0, 0),
    width: int | None = None, height: int | None = None,
    *funcs: Callable[..., Any], **kwargs: Any
) -> dict[str, Any]:
    return (
        dict(sx=shift[1], sy=shift[0])
        | self.get_clean_kwargs(*funcs)
        | self.get_params_args(False, clip, width, height, **kwargs)
    )

kernel_radius

kernel_radius() -> int
Source code
89
90
91
92
93
94
95
96
97
98
99
@inject_self.cached.property
def kernel_radius(self) -> int:
    from .bicubic import Bicubic

    if self.taps:
        return ceil(self.taps)

    if self.b or self.c:
        return Bicubic(fallback(self.b, 0), fallback(self.c, 0.5)).kernel_radius

    return 2

multi

multi(
    clip: VideoNode,
    multi: float = 2.0,
    shift: tuple[TopShift, LeftShift] = (0, 0),
    **kwargs: Any
) -> VideoNode
Source code
272
273
274
275
276
277
278
279
280
281
@inject_self.cached
def multi(
    self, clip: vs.VideoNode, multi: float = 2.0, shift: tuple[TopShift, LeftShift] = (0, 0), **kwargs: Any
) -> vs.VideoNode:

    import warnings

    warnings.warn('The "multi" method is deprecated. Use "supersample" instead.', DeprecationWarning)

    return self.supersample(clip, multi, shift, **kwargs)

pretty_string

pretty_string() -> str
Source code
225
226
227
@inject_self.cached.property
def pretty_string(self) -> str:
    return self._pretty_string()

scale

scale(
    clip: VideoNode,
    width: int | None = None,
    height: int | None = None,
    shift: tuple[TopShift, LeftShift] = (0, 0),
    *,
    border_handling: BorderHandling = MIRROR,
    sample_grid_model: SampleGridModel = MATCH_EDGES,
    sar: Sar | float | bool | None = None,
    dar: Dar | float | bool | None = None,
    dar_in: Dar | bool | float | None = None,
    keep_ar: bool | None = None,
    linear: bool = False,
    sigmoid: bool | tuple[Slope, Center] = False,
    **kwargs: Any
) -> VideoNode
Source code
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
@inject_self.cached
@inject_kwargs_params
def scale(
    self, clip: vs.VideoNode, width: int | None = None, height: int | None = None,
    shift: tuple[TopShift, LeftShift] = (0, 0),
    *,
    # `border_handling`, `sample_grid_model`, `sar`, `dar`, `dar_in` and `keep_ar` from KeepArScaler
    border_handling: BorderHandling = BorderHandling.MIRROR,
    sample_grid_model: SampleGridModel = SampleGridModel.MATCH_EDGES,
    sar: Sar | float | bool | None = None, dar: Dar | float | bool | None = None,
    dar_in: Dar | bool | float | None = None, keep_ar: bool | None = None,
    # `linear` and `sigmoid` from LinearScaler
    linear: bool = False, sigmoid: bool | tuple[Slope, Center] = False,
    **kwargs: Any
) -> vs.VideoNode:
    width, height = Scaler._wh_norm(clip, width, height)
    return super().scale(
        clip, width, height, shift,
        border_handling=border_handling, sample_grid_model=sample_grid_model,
        sar=sar, dar=dar, dar_in=dar_in, keep_ar=keep_ar,
        linear=linear, sigmoid=sigmoid,
        **kwargs
    )

supersample

supersample(
    clip: VideoNode,
    rfactor: float = 2.0,
    shift: tuple[TopShift, LeftShift] = (0, 0),
    **kwargs: Any
) -> VideoNode
Source code
257
258
259
260
261
262
263
264
265
266
267
268
269
270
@inject_self.cached
def supersample(
    self, clip: vs.VideoNode, rfactor: float = 2.0, shift: tuple[TopShift, LeftShift] = (0, 0), **kwargs: Any
) -> vs.VideoNode:
    assert check_variable_resolution(clip, self.multi)

    dst_width, dst_height = ceil(clip.width * rfactor), ceil(clip.height * rfactor)

    if max(dst_width, dst_height) <= 0.0:
        raise CustomValueError(
            'Multiplying the resolution by "rfactor" must result in a positive resolution!', self.supersample, rfactor
        )

    return self.scale(clip, dst_width, dst_height, shift, **kwargs)

EwaHann

EwaHann(taps: float = 3.238315484166236, **kwargs: Any)

Bases: Placebo

Methods:

Attributes:

Source code
140
141
def __init__(self, taps: float = 3.2383154841662362076499, **kwargs: Any) -> None:
    super().__init__(taps, None, None, **kwargs)

antiring instance-attribute

antiring: float = antiring

b instance-attribute

b: float | None = b

blur instance-attribute

blur: float = blur

c instance-attribute

c: float | None = c

clamp instance-attribute

clamp: float = clamp

kwargs instance-attribute

kwargs: KwargsT = kwargs

Arguments passed to the internal scale function

scale_function class-attribute instance-attribute

scale_function = Resample

taper instance-attribute

taper: float = taper

taps instance-attribute

taps: float | None = taps

ensure_obj classmethod

ensure_obj(
    scaler: str | type[BaseScalerT] | BaseScalerT | None = None,
    /,
    func_except: FuncExceptT | None = None,
) -> BaseScalerT
Source code
201
202
203
204
205
206
207
208
@classmethod
def ensure_obj(
    cls: type[BaseScalerT], scaler: str | type[BaseScalerT] | BaseScalerT | None = None, /,
    func_except: FuncExceptT | None = None
) -> BaseScalerT:
    return _base_ensure_obj(
        cls, (mro := cls.mro())[mro.index(BaseScaler) - 1], scaler, cls._err_class, [], func_except
    )

from_param classmethod

from_param(
    scaler: str | type[BaseScalerT] | BaseScalerT | None = None,
    /,
    func_except: FuncExceptT | None = None,
) -> type[BaseScalerT]
Source code
192
193
194
195
196
197
198
199
@classmethod
def from_param(
    cls: type[BaseScalerT], scaler: str | type[BaseScalerT] | BaseScalerT | None = None, /,
    func_except: FuncExceptT | None = None
) -> type[BaseScalerT]:
    return _base_from_param(
        cls, (mro := cls.mro())[mro.index(BaseScaler) - 1], scaler, cls._err_class, [], func_except
    )

get_clean_kwargs

get_clean_kwargs(*funcs: Callable[..., Any] | None) -> KwargsT
Source code
216
217
def get_clean_kwargs(self, *funcs: Callable[..., Any] | None) -> KwargsT:
    return _clean_self_kwargs(funcs, self)

get_implemented_funcs

get_implemented_funcs() -> tuple[Callable[..., Any], ...]
Source code
299
300
def get_implemented_funcs(self) -> tuple[Callable[..., Any], ...]:
    return (self.scale, self.supersample)

get_params_args

get_params_args(
    is_descale: bool,
    clip: VideoNode,
    width: int | None = None,
    height: int | None = None,
    **kwargs: Any
) -> dict[str, Any]
Source code
79
80
81
82
83
84
85
86
87
def get_params_args(
    self, is_descale: bool, clip: vs.VideoNode, width: int | None = None, height: int | None = None, **kwargs: Any
) -> dict[str, Any]:
    return dict(
        width=width, height=height, filter=self._kernel,
        radius=self.taps, param1=self.b, param2=self.c,
        clamp=self.clamp, taper=self.taper, blur=self.blur,
        antiring=self.antiring,
    ) | kwargs

get_scale_args

get_scale_args(
    clip: VideoNode,
    shift: tuple[TopShift, LeftShift] = (0, 0),
    width: int | None = None,
    height: int | None = None,
    *funcs: Callable[..., Any],
    **kwargs: Any
) -> dict[str, Any]
Source code
67
68
69
70
71
72
73
74
75
76
77
@inject_kwargs_params
def get_scale_args(
    self, clip: vs.VideoNode, shift: tuple[TopShift, LeftShift] = (0, 0),
    width: int | None = None, height: int | None = None,
    *funcs: Callable[..., Any], **kwargs: Any
) -> dict[str, Any]:
    return (
        dict(sx=shift[1], sy=shift[0])
        | self.get_clean_kwargs(*funcs)
        | self.get_params_args(False, clip, width, height, **kwargs)
    )

kernel_radius

kernel_radius() -> int
Source code
89
90
91
92
93
94
95
96
97
98
99
@inject_self.cached.property
def kernel_radius(self) -> int:
    from .bicubic import Bicubic

    if self.taps:
        return ceil(self.taps)

    if self.b or self.c:
        return Bicubic(fallback(self.b, 0), fallback(self.c, 0.5)).kernel_radius

    return 2

multi

multi(
    clip: VideoNode,
    multi: float = 2.0,
    shift: tuple[TopShift, LeftShift] = (0, 0),
    **kwargs: Any
) -> VideoNode
Source code
272
273
274
275
276
277
278
279
280
281
@inject_self.cached
def multi(
    self, clip: vs.VideoNode, multi: float = 2.0, shift: tuple[TopShift, LeftShift] = (0, 0), **kwargs: Any
) -> vs.VideoNode:

    import warnings

    warnings.warn('The "multi" method is deprecated. Use "supersample" instead.', DeprecationWarning)

    return self.supersample(clip, multi, shift, **kwargs)

pretty_string

pretty_string() -> str
Source code
225
226
227
@inject_self.cached.property
def pretty_string(self) -> str:
    return self._pretty_string()

scale

scale(
    clip: VideoNode,
    width: int | None = None,
    height: int | None = None,
    shift: tuple[TopShift, LeftShift] = (0, 0),
    *,
    border_handling: BorderHandling = MIRROR,
    sample_grid_model: SampleGridModel = MATCH_EDGES,
    sar: Sar | float | bool | None = None,
    dar: Dar | float | bool | None = None,
    dar_in: Dar | bool | float | None = None,
    keep_ar: bool | None = None,
    linear: bool = False,
    sigmoid: bool | tuple[Slope, Center] = False,
    **kwargs: Any
) -> VideoNode
Source code
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
@inject_self.cached
@inject_kwargs_params
def scale(
    self, clip: vs.VideoNode, width: int | None = None, height: int | None = None,
    shift: tuple[TopShift, LeftShift] = (0, 0),
    *,
    # `border_handling`, `sample_grid_model`, `sar`, `dar`, `dar_in` and `keep_ar` from KeepArScaler
    border_handling: BorderHandling = BorderHandling.MIRROR,
    sample_grid_model: SampleGridModel = SampleGridModel.MATCH_EDGES,
    sar: Sar | float | bool | None = None, dar: Dar | float | bool | None = None,
    dar_in: Dar | bool | float | None = None, keep_ar: bool | None = None,
    # `linear` and `sigmoid` from LinearScaler
    linear: bool = False, sigmoid: bool | tuple[Slope, Center] = False,
    **kwargs: Any
) -> vs.VideoNode:
    width, height = Scaler._wh_norm(clip, width, height)
    return super().scale(
        clip, width, height, shift,
        border_handling=border_handling, sample_grid_model=sample_grid_model,
        sar=sar, dar=dar, dar_in=dar_in, keep_ar=keep_ar,
        linear=linear, sigmoid=sigmoid,
        **kwargs
    )

supersample

supersample(
    clip: VideoNode,
    rfactor: float = 2.0,
    shift: tuple[TopShift, LeftShift] = (0, 0),
    **kwargs: Any
) -> VideoNode
Source code
257
258
259
260
261
262
263
264
265
266
267
268
269
270
@inject_self.cached
def supersample(
    self, clip: vs.VideoNode, rfactor: float = 2.0, shift: tuple[TopShift, LeftShift] = (0, 0), **kwargs: Any
) -> vs.VideoNode:
    assert check_variable_resolution(clip, self.multi)

    dst_width, dst_height = ceil(clip.width * rfactor), ceil(clip.height * rfactor)

    if max(dst_width, dst_height) <= 0.0:
        raise CustomValueError(
            'Multiplying the resolution by "rfactor" must result in a positive resolution!', self.supersample, rfactor
        )

    return self.scale(clip, dst_width, dst_height, shift, **kwargs)

EwaJinc

EwaJinc(taps: float = 3.238315484166236, **kwargs: Any)

Bases: Placebo

Methods:

Attributes:

Source code
126
127
def __init__(self, taps: float = 3.2383154841662362076499, **kwargs: Any) -> None:
    super().__init__(taps, None, None, **kwargs)

antiring instance-attribute

antiring: float = antiring

b instance-attribute

b: float | None = b

blur instance-attribute

blur: float = blur

c instance-attribute

c: float | None = c

clamp instance-attribute

clamp: float = clamp

kwargs instance-attribute

kwargs: KwargsT = kwargs

Arguments passed to the internal scale function

scale_function class-attribute instance-attribute

scale_function = Resample

taper instance-attribute

taper: float = taper

taps instance-attribute

taps: float | None = taps

ensure_obj classmethod

ensure_obj(
    scaler: str | type[BaseScalerT] | BaseScalerT | None = None,
    /,
    func_except: FuncExceptT | None = None,
) -> BaseScalerT
Source code
201
202
203
204
205
206
207
208
@classmethod
def ensure_obj(
    cls: type[BaseScalerT], scaler: str | type[BaseScalerT] | BaseScalerT | None = None, /,
    func_except: FuncExceptT | None = None
) -> BaseScalerT:
    return _base_ensure_obj(
        cls, (mro := cls.mro())[mro.index(BaseScaler) - 1], scaler, cls._err_class, [], func_except
    )

from_param classmethod

from_param(
    scaler: str | type[BaseScalerT] | BaseScalerT | None = None,
    /,
    func_except: FuncExceptT | None = None,
) -> type[BaseScalerT]
Source code
192
193
194
195
196
197
198
199
@classmethod
def from_param(
    cls: type[BaseScalerT], scaler: str | type[BaseScalerT] | BaseScalerT | None = None, /,
    func_except: FuncExceptT | None = None
) -> type[BaseScalerT]:
    return _base_from_param(
        cls, (mro := cls.mro())[mro.index(BaseScaler) - 1], scaler, cls._err_class, [], func_except
    )

get_clean_kwargs

get_clean_kwargs(*funcs: Callable[..., Any] | None) -> KwargsT
Source code
216
217
def get_clean_kwargs(self, *funcs: Callable[..., Any] | None) -> KwargsT:
    return _clean_self_kwargs(funcs, self)

get_implemented_funcs

get_implemented_funcs() -> tuple[Callable[..., Any], ...]
Source code
299
300
def get_implemented_funcs(self) -> tuple[Callable[..., Any], ...]:
    return (self.scale, self.supersample)

get_params_args

get_params_args(
    is_descale: bool,
    clip: VideoNode,
    width: int | None = None,
    height: int | None = None,
    **kwargs: Any
) -> dict[str, Any]
Source code
79
80
81
82
83
84
85
86
87
def get_params_args(
    self, is_descale: bool, clip: vs.VideoNode, width: int | None = None, height: int | None = None, **kwargs: Any
) -> dict[str, Any]:
    return dict(
        width=width, height=height, filter=self._kernel,
        radius=self.taps, param1=self.b, param2=self.c,
        clamp=self.clamp, taper=self.taper, blur=self.blur,
        antiring=self.antiring,
    ) | kwargs

get_scale_args

get_scale_args(
    clip: VideoNode,
    shift: tuple[TopShift, LeftShift] = (0, 0),
    width: int | None = None,
    height: int | None = None,
    *funcs: Callable[..., Any],
    **kwargs: Any
) -> dict[str, Any]
Source code
67
68
69
70
71
72
73
74
75
76
77
@inject_kwargs_params
def get_scale_args(
    self, clip: vs.VideoNode, shift: tuple[TopShift, LeftShift] = (0, 0),
    width: int | None = None, height: int | None = None,
    *funcs: Callable[..., Any], **kwargs: Any
) -> dict[str, Any]:
    return (
        dict(sx=shift[1], sy=shift[0])
        | self.get_clean_kwargs(*funcs)
        | self.get_params_args(False, clip, width, height, **kwargs)
    )

kernel_radius

kernel_radius() -> int
Source code
89
90
91
92
93
94
95
96
97
98
99
@inject_self.cached.property
def kernel_radius(self) -> int:
    from .bicubic import Bicubic

    if self.taps:
        return ceil(self.taps)

    if self.b or self.c:
        return Bicubic(fallback(self.b, 0), fallback(self.c, 0.5)).kernel_radius

    return 2

multi

multi(
    clip: VideoNode,
    multi: float = 2.0,
    shift: tuple[TopShift, LeftShift] = (0, 0),
    **kwargs: Any
) -> VideoNode
Source code
272
273
274
275
276
277
278
279
280
281
@inject_self.cached
def multi(
    self, clip: vs.VideoNode, multi: float = 2.0, shift: tuple[TopShift, LeftShift] = (0, 0), **kwargs: Any
) -> vs.VideoNode:

    import warnings

    warnings.warn('The "multi" method is deprecated. Use "supersample" instead.', DeprecationWarning)

    return self.supersample(clip, multi, shift, **kwargs)

pretty_string

pretty_string() -> str
Source code
225
226
227
@inject_self.cached.property
def pretty_string(self) -> str:
    return self._pretty_string()

scale

scale(
    clip: VideoNode,
    width: int | None = None,
    height: int | None = None,
    shift: tuple[TopShift, LeftShift] = (0, 0),
    *,
    border_handling: BorderHandling = MIRROR,
    sample_grid_model: SampleGridModel = MATCH_EDGES,
    sar: Sar | float | bool | None = None,
    dar: Dar | float | bool | None = None,
    dar_in: Dar | bool | float | None = None,
    keep_ar: bool | None = None,
    linear: bool = False,
    sigmoid: bool | tuple[Slope, Center] = False,
    **kwargs: Any
) -> VideoNode
Source code
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
@inject_self.cached
@inject_kwargs_params
def scale(
    self, clip: vs.VideoNode, width: int | None = None, height: int | None = None,
    shift: tuple[TopShift, LeftShift] = (0, 0),
    *,
    # `border_handling`, `sample_grid_model`, `sar`, `dar`, `dar_in` and `keep_ar` from KeepArScaler
    border_handling: BorderHandling = BorderHandling.MIRROR,
    sample_grid_model: SampleGridModel = SampleGridModel.MATCH_EDGES,
    sar: Sar | float | bool | None = None, dar: Dar | float | bool | None = None,
    dar_in: Dar | bool | float | None = None, keep_ar: bool | None = None,
    # `linear` and `sigmoid` from LinearScaler
    linear: bool = False, sigmoid: bool | tuple[Slope, Center] = False,
    **kwargs: Any
) -> vs.VideoNode:
    width, height = Scaler._wh_norm(clip, width, height)
    return super().scale(
        clip, width, height, shift,
        border_handling=border_handling, sample_grid_model=sample_grid_model,
        sar=sar, dar=dar, dar_in=dar_in, keep_ar=keep_ar,
        linear=linear, sigmoid=sigmoid,
        **kwargs
    )

supersample

supersample(
    clip: VideoNode,
    rfactor: float = 2.0,
    shift: tuple[TopShift, LeftShift] = (0, 0),
    **kwargs: Any
) -> VideoNode
Source code
257
258
259
260
261
262
263
264
265
266
267
268
269
270
@inject_self.cached
def supersample(
    self, clip: vs.VideoNode, rfactor: float = 2.0, shift: tuple[TopShift, LeftShift] = (0, 0), **kwargs: Any
) -> vs.VideoNode:
    assert check_variable_resolution(clip, self.multi)

    dst_width, dst_height = ceil(clip.width * rfactor), ceil(clip.height * rfactor)

    if max(dst_width, dst_height) <= 0.0:
        raise CustomValueError(
            'Multiplying the resolution by "rfactor" must result in a positive resolution!', self.supersample, rfactor
        )

    return self.scale(clip, dst_width, dst_height, shift, **kwargs)

EwaLanczos

EwaLanczos(taps: float = 3.238315484166236, **kwargs: Any)

Bases: Placebo

Methods:

Attributes:

Source code
119
120
def __init__(self, taps: float = 3.2383154841662362076499, **kwargs: Any) -> None:
    super().__init__(taps, None, None, **kwargs)

antiring instance-attribute

antiring: float = antiring

b instance-attribute

b: float | None = b

blur instance-attribute

blur: float = blur

c instance-attribute

c: float | None = c

clamp instance-attribute

clamp: float = clamp

kwargs instance-attribute

kwargs: KwargsT = kwargs

Arguments passed to the internal scale function

scale_function class-attribute instance-attribute

scale_function = Resample

taper instance-attribute

taper: float = taper

taps instance-attribute

taps: float | None = taps

ensure_obj classmethod

ensure_obj(
    scaler: str | type[BaseScalerT] | BaseScalerT | None = None,
    /,
    func_except: FuncExceptT | None = None,
) -> BaseScalerT
Source code
201
202
203
204
205
206
207
208
@classmethod
def ensure_obj(
    cls: type[BaseScalerT], scaler: str | type[BaseScalerT] | BaseScalerT | None = None, /,
    func_except: FuncExceptT | None = None
) -> BaseScalerT:
    return _base_ensure_obj(
        cls, (mro := cls.mro())[mro.index(BaseScaler) - 1], scaler, cls._err_class, [], func_except
    )

from_param classmethod

from_param(
    scaler: str | type[BaseScalerT] | BaseScalerT | None = None,
    /,
    func_except: FuncExceptT | None = None,
) -> type[BaseScalerT]
Source code
192
193
194
195
196
197
198
199
@classmethod
def from_param(
    cls: type[BaseScalerT], scaler: str | type[BaseScalerT] | BaseScalerT | None = None, /,
    func_except: FuncExceptT | None = None
) -> type[BaseScalerT]:
    return _base_from_param(
        cls, (mro := cls.mro())[mro.index(BaseScaler) - 1], scaler, cls._err_class, [], func_except
    )

get_clean_kwargs

get_clean_kwargs(*funcs: Callable[..., Any] | None) -> KwargsT
Source code
216
217
def get_clean_kwargs(self, *funcs: Callable[..., Any] | None) -> KwargsT:
    return _clean_self_kwargs(funcs, self)

get_implemented_funcs

get_implemented_funcs() -> tuple[Callable[..., Any], ...]
Source code
299
300
def get_implemented_funcs(self) -> tuple[Callable[..., Any], ...]:
    return (self.scale, self.supersample)

get_params_args

get_params_args(
    is_descale: bool,
    clip: VideoNode,
    width: int | None = None,
    height: int | None = None,
    **kwargs: Any
) -> dict[str, Any]
Source code
79
80
81
82
83
84
85
86
87
def get_params_args(
    self, is_descale: bool, clip: vs.VideoNode, width: int | None = None, height: int | None = None, **kwargs: Any
) -> dict[str, Any]:
    return dict(
        width=width, height=height, filter=self._kernel,
        radius=self.taps, param1=self.b, param2=self.c,
        clamp=self.clamp, taper=self.taper, blur=self.blur,
        antiring=self.antiring,
    ) | kwargs

get_scale_args

get_scale_args(
    clip: VideoNode,
    shift: tuple[TopShift, LeftShift] = (0, 0),
    width: int | None = None,
    height: int | None = None,
    *funcs: Callable[..., Any],
    **kwargs: Any
) -> dict[str, Any]
Source code
67
68
69
70
71
72
73
74
75
76
77
@inject_kwargs_params
def get_scale_args(
    self, clip: vs.VideoNode, shift: tuple[TopShift, LeftShift] = (0, 0),
    width: int | None = None, height: int | None = None,
    *funcs: Callable[..., Any], **kwargs: Any
) -> dict[str, Any]:
    return (
        dict(sx=shift[1], sy=shift[0])
        | self.get_clean_kwargs(*funcs)
        | self.get_params_args(False, clip, width, height, **kwargs)
    )

kernel_radius

kernel_radius() -> int
Source code
89
90
91
92
93
94
95
96
97
98
99
@inject_self.cached.property
def kernel_radius(self) -> int:
    from .bicubic import Bicubic

    if self.taps:
        return ceil(self.taps)

    if self.b or self.c:
        return Bicubic(fallback(self.b, 0), fallback(self.c, 0.5)).kernel_radius

    return 2

multi

multi(
    clip: VideoNode,
    multi: float = 2.0,
    shift: tuple[TopShift, LeftShift] = (0, 0),
    **kwargs: Any
) -> VideoNode
Source code
272
273
274
275
276
277
278
279
280
281
@inject_self.cached
def multi(
    self, clip: vs.VideoNode, multi: float = 2.0, shift: tuple[TopShift, LeftShift] = (0, 0), **kwargs: Any
) -> vs.VideoNode:

    import warnings

    warnings.warn('The "multi" method is deprecated. Use "supersample" instead.', DeprecationWarning)

    return self.supersample(clip, multi, shift, **kwargs)

pretty_string

pretty_string() -> str
Source code
225
226
227
@inject_self.cached.property
def pretty_string(self) -> str:
    return self._pretty_string()

scale

scale(
    clip: VideoNode,
    width: int | None = None,
    height: int | None = None,
    shift: tuple[TopShift, LeftShift] = (0, 0),
    *,
    border_handling: BorderHandling = MIRROR,
    sample_grid_model: SampleGridModel = MATCH_EDGES,
    sar: Sar | float | bool | None = None,
    dar: Dar | float | bool | None = None,
    dar_in: Dar | bool | float | None = None,
    keep_ar: bool | None = None,
    linear: bool = False,
    sigmoid: bool | tuple[Slope, Center] = False,
    **kwargs: Any
) -> VideoNode
Source code
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
@inject_self.cached
@inject_kwargs_params
def scale(
    self, clip: vs.VideoNode, width: int | None = None, height: int | None = None,
    shift: tuple[TopShift, LeftShift] = (0, 0),
    *,
    # `border_handling`, `sample_grid_model`, `sar`, `dar`, `dar_in` and `keep_ar` from KeepArScaler
    border_handling: BorderHandling = BorderHandling.MIRROR,
    sample_grid_model: SampleGridModel = SampleGridModel.MATCH_EDGES,
    sar: Sar | float | bool | None = None, dar: Dar | float | bool | None = None,
    dar_in: Dar | bool | float | None = None, keep_ar: bool | None = None,
    # `linear` and `sigmoid` from LinearScaler
    linear: bool = False, sigmoid: bool | tuple[Slope, Center] = False,
    **kwargs: Any
) -> vs.VideoNode:
    width, height = Scaler._wh_norm(clip, width, height)
    return super().scale(
        clip, width, height, shift,
        border_handling=border_handling, sample_grid_model=sample_grid_model,
        sar=sar, dar=dar, dar_in=dar_in, keep_ar=keep_ar,
        linear=linear, sigmoid=sigmoid,
        **kwargs
    )

supersample

supersample(
    clip: VideoNode,
    rfactor: float = 2.0,
    shift: tuple[TopShift, LeftShift] = (0, 0),
    **kwargs: Any
) -> VideoNode
Source code
257
258
259
260
261
262
263
264
265
266
267
268
269
270
@inject_self.cached
def supersample(
    self, clip: vs.VideoNode, rfactor: float = 2.0, shift: tuple[TopShift, LeftShift] = (0, 0), **kwargs: Any
) -> vs.VideoNode:
    assert check_variable_resolution(clip, self.multi)

    dst_width, dst_height = ceil(clip.width * rfactor), ceil(clip.height * rfactor)

    if max(dst_width, dst_height) <= 0.0:
        raise CustomValueError(
            'Multiplying the resolution by "rfactor" must result in a positive resolution!', self.supersample, rfactor
        )

    return self.scale(clip, dst_width, dst_height, shift, **kwargs)

EwaRobidoux

EwaRobidoux(**kwargs: Any)

Bases: Placebo

Methods:

Attributes:

Source code
147
148
def __init__(self, **kwargs: Any) -> None:
    super().__init__(None, None, None, **kwargs)

antiring instance-attribute

antiring: float = antiring

b instance-attribute

b: float | None = b

blur instance-attribute

blur: float = blur

c instance-attribute

c: float | None = c

clamp instance-attribute

clamp: float = clamp

kwargs instance-attribute

kwargs: KwargsT = kwargs

Arguments passed to the internal scale function

scale_function class-attribute instance-attribute

scale_function = Resample

taper instance-attribute

taper: float = taper

taps instance-attribute

taps: float | None = taps

ensure_obj classmethod

ensure_obj(
    scaler: str | type[BaseScalerT] | BaseScalerT | None = None,
    /,
    func_except: FuncExceptT | None = None,
) -> BaseScalerT
Source code
201
202
203
204
205
206
207
208
@classmethod
def ensure_obj(
    cls: type[BaseScalerT], scaler: str | type[BaseScalerT] | BaseScalerT | None = None, /,
    func_except: FuncExceptT | None = None
) -> BaseScalerT:
    return _base_ensure_obj(
        cls, (mro := cls.mro())[mro.index(BaseScaler) - 1], scaler, cls._err_class, [], func_except
    )

from_param classmethod

from_param(
    scaler: str | type[BaseScalerT] | BaseScalerT | None = None,
    /,
    func_except: FuncExceptT | None = None,
) -> type[BaseScalerT]
Source code
192
193
194
195
196
197
198
199
@classmethod
def from_param(
    cls: type[BaseScalerT], scaler: str | type[BaseScalerT] | BaseScalerT | None = None, /,
    func_except: FuncExceptT | None = None
) -> type[BaseScalerT]:
    return _base_from_param(
        cls, (mro := cls.mro())[mro.index(BaseScaler) - 1], scaler, cls._err_class, [], func_except
    )

get_clean_kwargs

get_clean_kwargs(*funcs: Callable[..., Any] | None) -> KwargsT
Source code
216
217
def get_clean_kwargs(self, *funcs: Callable[..., Any] | None) -> KwargsT:
    return _clean_self_kwargs(funcs, self)

get_implemented_funcs

get_implemented_funcs() -> tuple[Callable[..., Any], ...]
Source code
299
300
def get_implemented_funcs(self) -> tuple[Callable[..., Any], ...]:
    return (self.scale, self.supersample)

get_params_args

get_params_args(
    is_descale: bool,
    clip: VideoNode,
    width: int | None = None,
    height: int | None = None,
    **kwargs: Any
) -> dict[str, Any]
Source code
79
80
81
82
83
84
85
86
87
def get_params_args(
    self, is_descale: bool, clip: vs.VideoNode, width: int | None = None, height: int | None = None, **kwargs: Any
) -> dict[str, Any]:
    return dict(
        width=width, height=height, filter=self._kernel,
        radius=self.taps, param1=self.b, param2=self.c,
        clamp=self.clamp, taper=self.taper, blur=self.blur,
        antiring=self.antiring,
    ) | kwargs

get_scale_args

get_scale_args(
    clip: VideoNode,
    shift: tuple[TopShift, LeftShift] = (0, 0),
    width: int | None = None,
    height: int | None = None,
    *funcs: Callable[..., Any],
    **kwargs: Any
) -> dict[str, Any]
Source code
67
68
69
70
71
72
73
74
75
76
77
@inject_kwargs_params
def get_scale_args(
    self, clip: vs.VideoNode, shift: tuple[TopShift, LeftShift] = (0, 0),
    width: int | None = None, height: int | None = None,
    *funcs: Callable[..., Any], **kwargs: Any
) -> dict[str, Any]:
    return (
        dict(sx=shift[1], sy=shift[0])
        | self.get_clean_kwargs(*funcs)
        | self.get_params_args(False, clip, width, height, **kwargs)
    )

kernel_radius

kernel_radius() -> int
Source code
89
90
91
92
93
94
95
96
97
98
99
@inject_self.cached.property
def kernel_radius(self) -> int:
    from .bicubic import Bicubic

    if self.taps:
        return ceil(self.taps)

    if self.b or self.c:
        return Bicubic(fallback(self.b, 0), fallback(self.c, 0.5)).kernel_radius

    return 2

multi

multi(
    clip: VideoNode,
    multi: float = 2.0,
    shift: tuple[TopShift, LeftShift] = (0, 0),
    **kwargs: Any
) -> VideoNode
Source code
272
273
274
275
276
277
278
279
280
281
@inject_self.cached
def multi(
    self, clip: vs.VideoNode, multi: float = 2.0, shift: tuple[TopShift, LeftShift] = (0, 0), **kwargs: Any
) -> vs.VideoNode:

    import warnings

    warnings.warn('The "multi" method is deprecated. Use "supersample" instead.', DeprecationWarning)

    return self.supersample(clip, multi, shift, **kwargs)

pretty_string

pretty_string() -> str
Source code
225
226
227
@inject_self.cached.property
def pretty_string(self) -> str:
    return self._pretty_string()

scale

scale(
    clip: VideoNode,
    width: int | None = None,
    height: int | None = None,
    shift: tuple[TopShift, LeftShift] = (0, 0),
    *,
    border_handling: BorderHandling = MIRROR,
    sample_grid_model: SampleGridModel = MATCH_EDGES,
    sar: Sar | float | bool | None = None,
    dar: Dar | float | bool | None = None,
    dar_in: Dar | bool | float | None = None,
    keep_ar: bool | None = None,
    linear: bool = False,
    sigmoid: bool | tuple[Slope, Center] = False,
    **kwargs: Any
) -> VideoNode
Source code
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
@inject_self.cached
@inject_kwargs_params
def scale(
    self, clip: vs.VideoNode, width: int | None = None, height: int | None = None,
    shift: tuple[TopShift, LeftShift] = (0, 0),
    *,
    # `border_handling`, `sample_grid_model`, `sar`, `dar`, `dar_in` and `keep_ar` from KeepArScaler
    border_handling: BorderHandling = BorderHandling.MIRROR,
    sample_grid_model: SampleGridModel = SampleGridModel.MATCH_EDGES,
    sar: Sar | float | bool | None = None, dar: Dar | float | bool | None = None,
    dar_in: Dar | bool | float | None = None, keep_ar: bool | None = None,
    # `linear` and `sigmoid` from LinearScaler
    linear: bool = False, sigmoid: bool | tuple[Slope, Center] = False,
    **kwargs: Any
) -> vs.VideoNode:
    width, height = Scaler._wh_norm(clip, width, height)
    return super().scale(
        clip, width, height, shift,
        border_handling=border_handling, sample_grid_model=sample_grid_model,
        sar=sar, dar=dar, dar_in=dar_in, keep_ar=keep_ar,
        linear=linear, sigmoid=sigmoid,
        **kwargs
    )

supersample

supersample(
    clip: VideoNode,
    rfactor: float = 2.0,
    shift: tuple[TopShift, LeftShift] = (0, 0),
    **kwargs: Any
) -> VideoNode
Source code
257
258
259
260
261
262
263
264
265
266
267
268
269
270
@inject_self.cached
def supersample(
    self, clip: vs.VideoNode, rfactor: float = 2.0, shift: tuple[TopShift, LeftShift] = (0, 0), **kwargs: Any
) -> vs.VideoNode:
    assert check_variable_resolution(clip, self.multi)

    dst_width, dst_height = ceil(clip.width * rfactor), ceil(clip.height * rfactor)

    if max(dst_width, dst_height) <= 0.0:
        raise CustomValueError(
            'Multiplying the resolution by "rfactor" must result in a positive resolution!', self.supersample, rfactor
        )

    return self.scale(clip, dst_width, dst_height, shift, **kwargs)

EwaRobidouxSharp

EwaRobidouxSharp(**kwargs: Any)

Bases: Placebo

Methods:

Attributes:

Source code
154
155
def __init__(self, **kwargs: Any) -> None:
    super().__init__(None, None, None, **kwargs)

antiring instance-attribute

antiring: float = antiring

b instance-attribute

b: float | None = b

blur instance-attribute

blur: float = blur

c instance-attribute

c: float | None = c

clamp instance-attribute

clamp: float = clamp

kwargs instance-attribute

kwargs: KwargsT = kwargs

Arguments passed to the internal scale function

scale_function class-attribute instance-attribute

scale_function = Resample

taper instance-attribute

taper: float = taper

taps instance-attribute

taps: float | None = taps

ensure_obj classmethod

ensure_obj(
    scaler: str | type[BaseScalerT] | BaseScalerT | None = None,
    /,
    func_except: FuncExceptT | None = None,
) -> BaseScalerT
Source code
201
202
203
204
205
206
207
208
@classmethod
def ensure_obj(
    cls: type[BaseScalerT], scaler: str | type[BaseScalerT] | BaseScalerT | None = None, /,
    func_except: FuncExceptT | None = None
) -> BaseScalerT:
    return _base_ensure_obj(
        cls, (mro := cls.mro())[mro.index(BaseScaler) - 1], scaler, cls._err_class, [], func_except
    )

from_param classmethod

from_param(
    scaler: str | type[BaseScalerT] | BaseScalerT | None = None,
    /,
    func_except: FuncExceptT | None = None,
) -> type[BaseScalerT]
Source code
192
193
194
195
196
197
198
199
@classmethod
def from_param(
    cls: type[BaseScalerT], scaler: str | type[BaseScalerT] | BaseScalerT | None = None, /,
    func_except: FuncExceptT | None = None
) -> type[BaseScalerT]:
    return _base_from_param(
        cls, (mro := cls.mro())[mro.index(BaseScaler) - 1], scaler, cls._err_class, [], func_except
    )

get_clean_kwargs

get_clean_kwargs(*funcs: Callable[..., Any] | None) -> KwargsT
Source code
216
217
def get_clean_kwargs(self, *funcs: Callable[..., Any] | None) -> KwargsT:
    return _clean_self_kwargs(funcs, self)

get_implemented_funcs

get_implemented_funcs() -> tuple[Callable[..., Any], ...]
Source code
299
300
def get_implemented_funcs(self) -> tuple[Callable[..., Any], ...]:
    return (self.scale, self.supersample)

get_params_args

get_params_args(
    is_descale: bool,
    clip: VideoNode,
    width: int | None = None,
    height: int | None = None,
    **kwargs: Any
) -> dict[str, Any]
Source code
79
80
81
82
83
84
85
86
87
def get_params_args(
    self, is_descale: bool, clip: vs.VideoNode, width: int | None = None, height: int | None = None, **kwargs: Any
) -> dict[str, Any]:
    return dict(
        width=width, height=height, filter=self._kernel,
        radius=self.taps, param1=self.b, param2=self.c,
        clamp=self.clamp, taper=self.taper, blur=self.blur,
        antiring=self.antiring,
    ) | kwargs

get_scale_args

get_scale_args(
    clip: VideoNode,
    shift: tuple[TopShift, LeftShift] = (0, 0),
    width: int | None = None,
    height: int | None = None,
    *funcs: Callable[..., Any],
    **kwargs: Any
) -> dict[str, Any]
Source code
67
68
69
70
71
72
73
74
75
76
77
@inject_kwargs_params
def get_scale_args(
    self, clip: vs.VideoNode, shift: tuple[TopShift, LeftShift] = (0, 0),
    width: int | None = None, height: int | None = None,
    *funcs: Callable[..., Any], **kwargs: Any
) -> dict[str, Any]:
    return (
        dict(sx=shift[1], sy=shift[0])
        | self.get_clean_kwargs(*funcs)
        | self.get_params_args(False, clip, width, height, **kwargs)
    )

kernel_radius

kernel_radius() -> int
Source code
89
90
91
92
93
94
95
96
97
98
99
@inject_self.cached.property
def kernel_radius(self) -> int:
    from .bicubic import Bicubic

    if self.taps:
        return ceil(self.taps)

    if self.b or self.c:
        return Bicubic(fallback(self.b, 0), fallback(self.c, 0.5)).kernel_radius

    return 2

multi

multi(
    clip: VideoNode,
    multi: float = 2.0,
    shift: tuple[TopShift, LeftShift] = (0, 0),
    **kwargs: Any
) -> VideoNode
Source code
272
273
274
275
276
277
278
279
280
281
@inject_self.cached
def multi(
    self, clip: vs.VideoNode, multi: float = 2.0, shift: tuple[TopShift, LeftShift] = (0, 0), **kwargs: Any
) -> vs.VideoNode:

    import warnings

    warnings.warn('The "multi" method is deprecated. Use "supersample" instead.', DeprecationWarning)

    return self.supersample(clip, multi, shift, **kwargs)

pretty_string

pretty_string() -> str
Source code
225
226
227
@inject_self.cached.property
def pretty_string(self) -> str:
    return self._pretty_string()

scale

scale(
    clip: VideoNode,
    width: int | None = None,
    height: int | None = None,
    shift: tuple[TopShift, LeftShift] = (0, 0),
    *,
    border_handling: BorderHandling = MIRROR,
    sample_grid_model: SampleGridModel = MATCH_EDGES,
    sar: Sar | float | bool | None = None,
    dar: Dar | float | bool | None = None,
    dar_in: Dar | bool | float | None = None,
    keep_ar: bool | None = None,
    linear: bool = False,
    sigmoid: bool | tuple[Slope, Center] = False,
    **kwargs: Any
) -> VideoNode
Source code
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
@inject_self.cached
@inject_kwargs_params
def scale(
    self, clip: vs.VideoNode, width: int | None = None, height: int | None = None,
    shift: tuple[TopShift, LeftShift] = (0, 0),
    *,
    # `border_handling`, `sample_grid_model`, `sar`, `dar`, `dar_in` and `keep_ar` from KeepArScaler
    border_handling: BorderHandling = BorderHandling.MIRROR,
    sample_grid_model: SampleGridModel = SampleGridModel.MATCH_EDGES,
    sar: Sar | float | bool | None = None, dar: Dar | float | bool | None = None,
    dar_in: Dar | bool | float | None = None, keep_ar: bool | None = None,
    # `linear` and `sigmoid` from LinearScaler
    linear: bool = False, sigmoid: bool | tuple[Slope, Center] = False,
    **kwargs: Any
) -> vs.VideoNode:
    width, height = Scaler._wh_norm(clip, width, height)
    return super().scale(
        clip, width, height, shift,
        border_handling=border_handling, sample_grid_model=sample_grid_model,
        sar=sar, dar=dar, dar_in=dar_in, keep_ar=keep_ar,
        linear=linear, sigmoid=sigmoid,
        **kwargs
    )

supersample

supersample(
    clip: VideoNode,
    rfactor: float = 2.0,
    shift: tuple[TopShift, LeftShift] = (0, 0),
    **kwargs: Any
) -> VideoNode
Source code
257
258
259
260
261
262
263
264
265
266
267
268
269
270
@inject_self.cached
def supersample(
    self, clip: vs.VideoNode, rfactor: float = 2.0, shift: tuple[TopShift, LeftShift] = (0, 0), **kwargs: Any
) -> vs.VideoNode:
    assert check_variable_resolution(clip, self.multi)

    dst_width, dst_height = ceil(clip.width * rfactor), ceil(clip.height * rfactor)

    if max(dst_width, dst_height) <= 0.0:
        raise CustomValueError(
            'Multiplying the resolution by "rfactor" must result in a positive resolution!', self.supersample, rfactor
        )

    return self.scale(clip, dst_width, dst_height, shift, **kwargs)

Placebo

Placebo(
    taps: float | None = None,
    b: float | None = None,
    c: float | None = None,
    clamp: float = 0.0,
    blur: float = 0.0,
    taper: float = 0.0,
    antiring: float = 0.0,
    **kwargs: Any
)

Bases: ComplexScaler

Abstract Placebo scaler.

Dependencies:

Methods:

Attributes:

Source code
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
def __init__(
    self,
    taps: float | None = None, b: float | None = None, c: float | None = None,
    clamp: float = 0.0, blur: float = 0.0, taper: float = 0.0,
    antiring: float = 0.0,
    **kwargs: Any
) -> None:
    self.taps = taps
    self.b = b
    self.c = c
    self.clamp = clamp
    self.blur = blur
    self.taper = taper
    self.antiring = antiring
    super().__init__(**kwargs)

antiring instance-attribute

antiring: float = antiring

b instance-attribute

b: float | None = b

blur instance-attribute

blur: float = blur

c instance-attribute

c: float | None = c

clamp instance-attribute

clamp: float = clamp

kwargs instance-attribute

kwargs: KwargsT = kwargs

Arguments passed to the internal scale function

scale_function class-attribute instance-attribute

scale_function = Resample

taper instance-attribute

taper: float = taper

taps instance-attribute

taps: float | None = taps

ensure_obj classmethod

ensure_obj(
    scaler: str | type[BaseScalerT] | BaseScalerT | None = None,
    /,
    func_except: FuncExceptT | None = None,
) -> BaseScalerT
Source code
201
202
203
204
205
206
207
208
@classmethod
def ensure_obj(
    cls: type[BaseScalerT], scaler: str | type[BaseScalerT] | BaseScalerT | None = None, /,
    func_except: FuncExceptT | None = None
) -> BaseScalerT:
    return _base_ensure_obj(
        cls, (mro := cls.mro())[mro.index(BaseScaler) - 1], scaler, cls._err_class, [], func_except
    )

from_param classmethod

from_param(
    scaler: str | type[BaseScalerT] | BaseScalerT | None = None,
    /,
    func_except: FuncExceptT | None = None,
) -> type[BaseScalerT]
Source code
192
193
194
195
196
197
198
199
@classmethod
def from_param(
    cls: type[BaseScalerT], scaler: str | type[BaseScalerT] | BaseScalerT | None = None, /,
    func_except: FuncExceptT | None = None
) -> type[BaseScalerT]:
    return _base_from_param(
        cls, (mro := cls.mro())[mro.index(BaseScaler) - 1], scaler, cls._err_class, [], func_except
    )

get_clean_kwargs

get_clean_kwargs(*funcs: Callable[..., Any] | None) -> KwargsT
Source code
216
217
def get_clean_kwargs(self, *funcs: Callable[..., Any] | None) -> KwargsT:
    return _clean_self_kwargs(funcs, self)

get_implemented_funcs

get_implemented_funcs() -> tuple[Callable[..., Any], ...]
Source code
299
300
def get_implemented_funcs(self) -> tuple[Callable[..., Any], ...]:
    return (self.scale, self.supersample)

get_params_args

get_params_args(
    is_descale: bool,
    clip: VideoNode,
    width: int | None = None,
    height: int | None = None,
    **kwargs: Any
) -> dict[str, Any]
Source code
79
80
81
82
83
84
85
86
87
def get_params_args(
    self, is_descale: bool, clip: vs.VideoNode, width: int | None = None, height: int | None = None, **kwargs: Any
) -> dict[str, Any]:
    return dict(
        width=width, height=height, filter=self._kernel,
        radius=self.taps, param1=self.b, param2=self.c,
        clamp=self.clamp, taper=self.taper, blur=self.blur,
        antiring=self.antiring,
    ) | kwargs

get_scale_args

get_scale_args(
    clip: VideoNode,
    shift: tuple[TopShift, LeftShift] = (0, 0),
    width: int | None = None,
    height: int | None = None,
    *funcs: Callable[..., Any],
    **kwargs: Any
) -> dict[str, Any]
Source code
67
68
69
70
71
72
73
74
75
76
77
@inject_kwargs_params
def get_scale_args(
    self, clip: vs.VideoNode, shift: tuple[TopShift, LeftShift] = (0, 0),
    width: int | None = None, height: int | None = None,
    *funcs: Callable[..., Any], **kwargs: Any
) -> dict[str, Any]:
    return (
        dict(sx=shift[1], sy=shift[0])
        | self.get_clean_kwargs(*funcs)
        | self.get_params_args(False, clip, width, height, **kwargs)
    )

kernel_radius

kernel_radius() -> int
Source code
89
90
91
92
93
94
95
96
97
98
99
@inject_self.cached.property
def kernel_radius(self) -> int:
    from .bicubic import Bicubic

    if self.taps:
        return ceil(self.taps)

    if self.b or self.c:
        return Bicubic(fallback(self.b, 0), fallback(self.c, 0.5)).kernel_radius

    return 2

multi

multi(
    clip: VideoNode,
    multi: float = 2.0,
    shift: tuple[TopShift, LeftShift] = (0, 0),
    **kwargs: Any
) -> VideoNode
Source code
272
273
274
275
276
277
278
279
280
281
@inject_self.cached
def multi(
    self, clip: vs.VideoNode, multi: float = 2.0, shift: tuple[TopShift, LeftShift] = (0, 0), **kwargs: Any
) -> vs.VideoNode:

    import warnings

    warnings.warn('The "multi" method is deprecated. Use "supersample" instead.', DeprecationWarning)

    return self.supersample(clip, multi, shift, **kwargs)

pretty_string

pretty_string() -> str
Source code
225
226
227
@inject_self.cached.property
def pretty_string(self) -> str:
    return self._pretty_string()

scale

scale(
    clip: VideoNode,
    width: int | None = None,
    height: int | None = None,
    shift: tuple[TopShift, LeftShift] = (0, 0),
    *,
    border_handling: BorderHandling = MIRROR,
    sample_grid_model: SampleGridModel = MATCH_EDGES,
    sar: Sar | float | bool | None = None,
    dar: Dar | float | bool | None = None,
    dar_in: Dar | bool | float | None = None,
    keep_ar: bool | None = None,
    linear: bool = False,
    sigmoid: bool | tuple[Slope, Center] = False,
    **kwargs: Any
) -> VideoNode
Source code
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
@inject_self.cached
@inject_kwargs_params
def scale(
    self, clip: vs.VideoNode, width: int | None = None, height: int | None = None,
    shift: tuple[TopShift, LeftShift] = (0, 0),
    *,
    # `border_handling`, `sample_grid_model`, `sar`, `dar`, `dar_in` and `keep_ar` from KeepArScaler
    border_handling: BorderHandling = BorderHandling.MIRROR,
    sample_grid_model: SampleGridModel = SampleGridModel.MATCH_EDGES,
    sar: Sar | float | bool | None = None, dar: Dar | float | bool | None = None,
    dar_in: Dar | bool | float | None = None, keep_ar: bool | None = None,
    # `linear` and `sigmoid` from LinearScaler
    linear: bool = False, sigmoid: bool | tuple[Slope, Center] = False,
    **kwargs: Any
) -> vs.VideoNode:
    width, height = Scaler._wh_norm(clip, width, height)
    return super().scale(
        clip, width, height, shift,
        border_handling=border_handling, sample_grid_model=sample_grid_model,
        sar=sar, dar=dar, dar_in=dar_in, keep_ar=keep_ar,
        linear=linear, sigmoid=sigmoid,
        **kwargs
    )

supersample

supersample(
    clip: VideoNode,
    rfactor: float = 2.0,
    shift: tuple[TopShift, LeftShift] = (0, 0),
    **kwargs: Any
) -> VideoNode
Source code
257
258
259
260
261
262
263
264
265
266
267
268
269
270
@inject_self.cached
def supersample(
    self, clip: vs.VideoNode, rfactor: float = 2.0, shift: tuple[TopShift, LeftShift] = (0, 0), **kwargs: Any
) -> vs.VideoNode:
    assert check_variable_resolution(clip, self.multi)

    dst_width, dst_height = ceil(clip.width * rfactor), ceil(clip.height * rfactor)

    if max(dst_width, dst_height) <= 0.0:
        raise CustomValueError(
            'Multiplying the resolution by "rfactor" must result in a positive resolution!', self.supersample, rfactor
        )

    return self.scale(clip, dst_width, dst_height, shift, **kwargs)