various ¶
Classes:
-
ClampScaler
–Clamp a reference Scaler.
-
DPID
–Rapid, Detail-Preserving Image Downscaler for VapourSynth
-
SSIM
–SSIM downsampler is an image downscaling technique that aims to optimize
ClampScaler ¶
ClampScaler(
base_scaler: ScalerLike,
reference: ScalerLike | VideoNode,
strength: int = 80,
overshoot: float | None = None,
undershoot: float | None = None,
limit: Mode | bool = True,
operator: Literal[MAX, MIN] | None = MIN,
masked: bool = True,
*,
kernel: KernelLike = Catrom,
scaler: ScalerLike | None = None,
shifter: KernelLike | None = None,
**kwargs: Any
)
Bases: GenericScaler
Clamp a reference Scaler.
Parameters:
-
base_scaler
¶ScalerLike
) –Scaler to clamp.
-
reference
¶ScalerLike | VideoNode
) –Reference Scaler used to clamp base_scaler
-
strength
¶int
, default:80
) –Strength of clamping. Default to 80. Must be between 0 and 100 (exclusive)
-
overshoot
¶float | None
, default:None
) –Overshoot threshold within the 0.0 - 1.0 range.
-
undershoot
¶float | None
, default:None
) –Undershoot threshold within the 0.0 - 1.0 range.
-
limit
¶Mode | bool
, default:True
) –Whether to use under/overshoot limit (True) or a reference repaired clip for limiting.
-
operator
¶Literal[MAX, MIN] | None
, default:MIN
) –Whether to take the brightest or darkest pixels in the merge. Defaults to ExprOp.MIN.
-
masked
¶bool
, default:True
) –Whether to mask with a ringing mask or not. Defaults to True
-
kernel
¶KernelLike
, default:Catrom
) –Base kernel to be used for certain scaling/shifting/resampling operations. Defaults to Catrom.
-
scaler
¶ScalerLike | None
, default:None
) –Scaler used for scaling operations. Defaults to kernel.
-
shifter
¶KernelLike | None
, default:None
) –Kernel used for shifting operations. Defaults to kernel.
Classes:
-
cached_property
–Read only version of functools.cached_property.
Methods:
-
ensure_obj
–Ensure that the input is a scaler instance, resolving it if necessary.
-
from_param
–Resolve and return a scaler type from a given input (string, type, or instance).
-
get_scale_args
–Generate the keyword arguments used for scaling.
-
kernel_radius
– -
multi
–Deprecated alias for
supersample
. -
pretty_string
–Cached property returning a user-friendly string representation.
-
scale
– -
supersample
–Supersample a clip by a given scaling factor.
Attributes:
-
base_scaler
– -
func
– -
kernel
– -
kwargs
(dict[str, Any]
) –Arguments passed to the implemented funcs or internal scale function.
-
limit
– -
masked
– -
operator
– -
overshoot
– -
reference
(Scaler | VideoNode
) – -
scale_function
(Callable[..., VideoNode]
) –Scale function called internally when performing scaling operations.
-
scaler
– -
shifter
– -
strength
– -
undershoot
–
Source code
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 |
|
kwargs instance-attribute
¶
Arguments passed to the implemented funcs or internal scale function.
scale_function instance-attribute
¶
scale_function: Callable[..., VideoNode]
Scale function called internally when performing scaling operations.
cached_property ¶
cached_property(func: Callable[Concatenate[_BaseScalerT, P], T_co])
Bases: cached_property[T_co]
Read only version of functools.cached_property.
Source code
265 |
|
ensure_obj classmethod
¶
ensure_obj(
scaler: str | type[Self] | Self | None = None,
/,
func_except: FuncExceptT | None = None,
) -> Self
Ensure that the input is a scaler instance, resolving it if necessary.
Parameters:
-
scaler
¶str | type[Self] | Self | None
, default:None
) –Scaler identifier (string, class, or instance).
-
func_except
¶FuncExceptT | None
, default:None
) –Function returned for custom error handling.
Returns:
-
Self
–Scaler instance.
Source code
330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 |
|
from_param classmethod
¶
from_param(
scaler: str | type[Self] | Self | None = None,
/,
func_except: FuncExceptT | None = None,
) -> type[Self]
Resolve and return a scaler type from a given input (string, type, or instance).
Parameters:
-
scaler
¶str | type[Self] | Self | None
, default:None
) –Scaler identifier (string, class, or instance).
-
func_except
¶FuncExceptT | None
, default:None
) –Function returned for custom error handling.
Returns:
-
type[Self]
–Resolved scaler type.
Source code
314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 |
|
get_scale_args ¶
get_scale_args(
clip: VideoNode,
shift: tuple[TopShift, LeftShift] = (0, 0),
width: int | None = None,
height: int | None = None,
**kwargs: Any
) -> dict[str, Any]
Generate the keyword arguments used for scaling.
Parameters:
-
clip
¶VideoNode
) –The source clip.
-
shift
¶tuple[TopShift, LeftShift]
, default:(0, 0)
) –Subpixel shift (top, left).
-
width
¶int | None
, default:None
) –Target width.
-
height
¶int | None
, default:None
) –Target height.
-
kwargs
¶Any
, default:{}
) –Extra parameters to merge.
Returns:
Source code
466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 |
|
kernel_radius ¶
kernel_radius() -> int
Source code
148 149 150 151 152 |
|
multi ¶
multi(
clip: VideoNodeT,
multi: float = 2.0,
shift: tuple[TopShift, LeftShift] = (0, 0),
**kwargs: Any
) -> VideoNodeT
Deprecated alias for supersample
.
Parameters:
-
clip
¶VideoNodeT
) –The source clip.
-
multi
¶float
, default:2.0
) –Supersampling factor.
-
shift
¶tuple[TopShift, LeftShift]
, default:(0, 0)
) –Subpixel shift (top, left) applied during scaling.
-
kwargs
¶Any
, default:{}
) –Additional arguments forwarded to the scale function.
Returns:
-
VideoNodeT
–The supersampled clip.
Source code
451 452 453 454 455 456 457 458 459 460 461 462 463 464 |
|
pretty_string ¶
pretty_string() -> str
Cached property returning a user-friendly string representation.
Returns:
-
str
–Pretty-printed string with arguments.
Source code
368 369 370 371 372 373 374 375 |
|
scale ¶
scale(
clip: VideoNode,
width: int | None = None,
height: int | None = None,
shift: tuple[float, float] = (0, 0),
**kwargs: Any
) -> ConstantFormatVideoNode
Source code
88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 |
|
supersample ¶
supersample(
clip: VideoNodeT,
rfactor: float = 2.0,
shift: tuple[TopShift, LeftShift] = (0, 0),
**kwargs: Any
) -> VideoNodeT
Supersample a clip by a given scaling factor.
Parameters:
-
clip
¶VideoNodeT
) –The source clip.
-
rfactor
¶float
, default:2.0
) –Scaling factor for supersampling.
-
shift
¶tuple[TopShift, LeftShift]
, default:(0, 0)
) –Subpixel shift (top, left) applied during scaling.
-
kwargs
¶Any
, default:{}
) –Additional arguments forwarded to the scale function.
Returns:
-
VideoNodeT
–The supersampled clip.
Raises:
-
CustomValueError
–If resulting resolution is non-positive.
Source code
425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 |
|
DPID ¶
DPID(
sigma: float = 0.1,
ref: VideoNode | ScalerLike = Catrom,
planes: PlanesT = None,
**kwargs: Any
)
Bases: BaseGenericScaler
Rapid, Detail-Preserving Image Downscaler for VapourSynth
Parameters:
-
sigma
¶float
, default:0.1
) –The power factor of range kernel. It can be used to tune the amplification of the weights of pixels that represent detail—from a box filter over an emphasis of distinct pixels towards a selection of only the most distinct pixels.
-
ref
¶VideoNode | ScalerLike
, default:Catrom
) –VideoNode or Scaler to obtain the downscaled reference for DPID.
-
planes
¶PlanesT
, default:None
) –Sets which planes will be processed. Any unprocessed planes will be simply copied from ref.
Classes:
-
cached_property
–Read only version of functools.cached_property.
Methods:
-
ensure_obj
–Ensure that the input is a scaler instance, resolving it if necessary.
-
from_param
–Resolve and return a scaler type from a given input (string, type, or instance).
-
get_scale_args
–Generate the keyword arguments used for scaling.
-
kernel_radius
– -
multi
–Deprecated alias for
supersample
. -
pretty_string
–Cached property returning a user-friendly string representation.
-
scale
– -
supersample
–Supersample a clip by a given scaling factor.
Attributes:
-
kernel
– -
kwargs
(dict[str, Any]
) –Arguments passed to the implemented funcs or internal scale function.
-
planes
– -
ref
– -
scale_function
(Callable[..., VideoNode]
) –Scale function called internally when performing scaling operations.
-
scaler
– -
shifter
– -
sigma
–
Source code
158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 |
|
kwargs instance-attribute
¶
Arguments passed to the implemented funcs or internal scale function.
scale_function instance-attribute
¶
scale_function: Callable[..., VideoNode]
Scale function called internally when performing scaling operations.
cached_property ¶
cached_property(func: Callable[Concatenate[_BaseScalerT, P], T_co])
Bases: cached_property[T_co]
Read only version of functools.cached_property.
Source code
265 |
|
ensure_obj classmethod
¶
ensure_obj(
scaler: str | type[Self] | Self | None = None,
/,
func_except: FuncExceptT | None = None,
) -> Self
Ensure that the input is a scaler instance, resolving it if necessary.
Parameters:
-
scaler
¶str | type[Self] | Self | None
, default:None
) –Scaler identifier (string, class, or instance).
-
func_except
¶FuncExceptT | None
, default:None
) –Function returned for custom error handling.
Returns:
-
Self
–Scaler instance.
Source code
330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 |
|
from_param classmethod
¶
from_param(
scaler: str | type[Self] | Self | None = None,
/,
func_except: FuncExceptT | None = None,
) -> type[Self]
Resolve and return a scaler type from a given input (string, type, or instance).
Parameters:
-
scaler
¶str | type[Self] | Self | None
, default:None
) –Scaler identifier (string, class, or instance).
-
func_except
¶FuncExceptT | None
, default:None
) –Function returned for custom error handling.
Returns:
-
type[Self]
–Resolved scaler type.
Source code
314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 |
|
get_scale_args ¶
get_scale_args(
clip: VideoNode,
shift: tuple[TopShift, LeftShift] = (0, 0),
width: int | None = None,
height: int | None = None,
**kwargs: Any
) -> dict[str, Any]
Generate the keyword arguments used for scaling.
Parameters:
-
clip
¶VideoNode
) –The source clip.
-
shift
¶tuple[TopShift, LeftShift]
, default:(0, 0)
) –Subpixel shift (top, left).
-
width
¶int | None
, default:None
) –Target width.
-
height
¶int | None
, default:None
) –Target height.
-
kwargs
¶Any
, default:{}
) –Extra parameters to merge.
Returns:
Source code
466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 |
|
kernel_radius ¶
kernel_radius() -> int
Source code
215 216 217 |
|
multi ¶
multi(
clip: VideoNodeT,
multi: float = 2.0,
shift: tuple[TopShift, LeftShift] = (0, 0),
**kwargs: Any
) -> VideoNodeT
Deprecated alias for supersample
.
Parameters:
-
clip
¶VideoNodeT
) –The source clip.
-
multi
¶float
, default:2.0
) –Supersampling factor.
-
shift
¶tuple[TopShift, LeftShift]
, default:(0, 0)
) –Subpixel shift (top, left) applied during scaling.
-
kwargs
¶Any
, default:{}
) –Additional arguments forwarded to the scale function.
Returns:
-
VideoNodeT
–The supersampled clip.
Source code
451 452 453 454 455 456 457 458 459 460 461 462 463 464 |
|
pretty_string ¶
pretty_string() -> str
Cached property returning a user-friendly string representation.
Returns:
-
str
–Pretty-printed string with arguments.
Source code
368 369 370 371 372 373 374 375 |
|
scale ¶
scale(
clip: VideoNode,
width: int | None = None,
height: int | None = None,
shift: tuple[float, float] = (0, 0),
**kwargs: Any
) -> ConstantFormatVideoNode
Source code
183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 |
|
supersample ¶
supersample(
clip: VideoNodeT,
rfactor: float = 2.0,
shift: tuple[TopShift, LeftShift] = (0, 0),
**kwargs: Any
) -> VideoNodeT
Supersample a clip by a given scaling factor.
Parameters:
-
clip
¶VideoNodeT
) –The source clip.
-
rfactor
¶float
, default:2.0
) –Scaling factor for supersampling.
-
shift
¶tuple[TopShift, LeftShift]
, default:(0, 0)
) –Subpixel shift (top, left) applied during scaling.
-
kwargs
¶Any
, default:{}
) –Additional arguments forwarded to the scale function.
Returns:
-
VideoNodeT
–The supersampled clip.
Raises:
-
CustomValueError
–If resulting resolution is non-positive.
Source code
425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 |
|
SSIM ¶
SSIM(
scaler: ScalerLike = Hermite,
smooth: (
int
| float
| VSFunctionNoArgs[VideoNode, ConstantFormatVideoNode]
| None
) = None,
**kwargs: Any
)
Bases: LinearScaler
SSIM downsampler is an image downscaling technique that aims to optimize for the perceptual quality of the downscaled results.
Image downscaling is considered as an optimization problem where the difference between the input and output images is measured using famous Structural SIMilarity (SSIM) index.
The solution is derived in closed-form, which leads to the simple, efficient implementation. The downscaled images retain perceptually important features and details, resulting in an accurate and spatio-temporally consistent representation of the high resolution input.
Parameters:
-
scaler
¶ScalerLike
, default:Hermite
) –Scaler to be used for downscaling, defaults to Hermite.
-
smooth
¶int | float | VSFunctionNoArgs[VideoNode, ConstantFormatVideoNode] | None
, default:None
) –Image smoothening method. If you pass an int, it specifies the "radius" of the internally-used boxfilter, i.e. the window has a size of (2smooth+1)x(2smooth+1). If you pass a float, it specifies the "sigma" of gauss_blur, i.e. the standard deviation of gaussian blur. If you pass a function, it acts as a general smoother. Default uses a gaussian blur based on the scaler's kernel radius.
Classes:
-
cached_property
–Read only version of functools.cached_property.
Methods:
-
ensure_obj
–Ensure that the input is a scaler instance, resolving it if necessary.
-
from_param
–Resolve and return a scaler type from a given input (string, type, or instance).
-
get_scale_args
–Generate the keyword arguments used for scaling.
-
kernel_radius
– -
multi
–Deprecated alias for
supersample
. -
pretty_string
–Cached property returning a user-friendly string representation.
-
scale
–Scale a clip to the given resolution with optional linearization.
-
supersample
–Supersample a clip by a given scaling factor.
Attributes:
-
filter_func
– -
kwargs
(dict[str, Any]
) –Arguments passed to the implemented funcs or internal scale function.
-
scale_function
(Callable[..., VideoNode]
) –Scale function called internally when performing scaling operations.
-
scaler
–
Source code
234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 |
|
kwargs instance-attribute
¶
Arguments passed to the implemented funcs or internal scale function.
scale_function instance-attribute
¶
scale_function: Callable[..., VideoNode]
Scale function called internally when performing scaling operations.
cached_property ¶
cached_property(func: Callable[Concatenate[_BaseScalerT, P], T_co])
Bases: cached_property[T_co]
Read only version of functools.cached_property.
Source code
265 |
|
ensure_obj classmethod
¶
ensure_obj(
scaler: str | type[Self] | Self | None = None,
/,
func_except: FuncExceptT | None = None,
) -> Self
Ensure that the input is a scaler instance, resolving it if necessary.
Parameters:
-
scaler
¶str | type[Self] | Self | None
, default:None
) –Scaler identifier (string, class, or instance).
-
func_except
¶FuncExceptT | None
, default:None
) –Function returned for custom error handling.
Returns:
-
Self
–Scaler instance.
Source code
330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 |
|
from_param classmethod
¶
from_param(
scaler: str | type[Self] | Self | None = None,
/,
func_except: FuncExceptT | None = None,
) -> type[Self]
Resolve and return a scaler type from a given input (string, type, or instance).
Parameters:
-
scaler
¶str | type[Self] | Self | None
, default:None
) –Scaler identifier (string, class, or instance).
-
func_except
¶FuncExceptT | None
, default:None
) –Function returned for custom error handling.
Returns:
-
type[Self]
–Resolved scaler type.
Source code
314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 |
|
get_scale_args ¶
get_scale_args(
clip: VideoNode,
shift: tuple[TopShift, LeftShift] = (0, 0),
width: int | None = None,
height: int | None = None,
**kwargs: Any
) -> dict[str, Any]
Generate the keyword arguments used for scaling.
Parameters:
-
clip
¶VideoNode
) –The source clip.
-
shift
¶tuple[TopShift, LeftShift]
, default:(0, 0)
) –Subpixel shift (top, left).
-
width
¶int | None
, default:None
) –Target width.
-
height
¶int | None
, default:None
) –Target height.
-
kwargs
¶Any
, default:{}
) –Extra parameters to merge.
Returns:
Source code
466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 |
|
kernel_radius ¶
kernel_radius() -> int
Source code
293 294 295 |
|
multi ¶
multi(
clip: VideoNodeT,
multi: float = 2.0,
shift: tuple[TopShift, LeftShift] = (0, 0),
**kwargs: Any
) -> VideoNodeT
Deprecated alias for supersample
.
Parameters:
-
clip
¶VideoNodeT
) –The source clip.
-
multi
¶float
, default:2.0
) –Supersampling factor.
-
shift
¶tuple[TopShift, LeftShift]
, default:(0, 0)
) –Subpixel shift (top, left) applied during scaling.
-
kwargs
¶Any
, default:{}
) –Additional arguments forwarded to the scale function.
Returns:
-
VideoNodeT
–The supersampled clip.
Source code
451 452 453 454 455 456 457 458 459 460 461 462 463 464 |
|
pretty_string ¶
pretty_string() -> str
Cached property returning a user-friendly string representation.
Returns:
-
str
–Pretty-printed string with arguments.
Source code
368 369 370 371 372 373 374 375 |
|
scale ¶
scale(
clip: VideoNode,
width: int | None = None,
height: int | None = None,
shift: tuple[TopShift, LeftShift] = (0, 0),
*,
linear: bool | None = None,
sigmoid: bool | tuple[Slope, Center] = False,
**kwargs: Any
) -> VideoNode | ConstantFormatVideoNode
Scale a clip to the given resolution with optional linearization.
This method behaves like the base Scaler.descale()
but adds support for linear or sigmoid-based preprocessing and postprocessing. When enabled, the clip is linearized before the scaling operation and de-linearized afterward.
Keyword arguments passed during initialization are automatically injected here, unless explicitly overridden by the arguments provided at call time. Only arguments that match named parameters in this method are injected.
Parameters:
-
clip
¶VideoNode
) –The source clip.
-
width
¶int | None
, default:None
) –Target width (defaults to clip width if None).
-
height
¶int | None
, default:None
) –Target height (defaults to clip height if None).
-
shift
¶tuple[TopShift, LeftShift]
, default:(0, 0)
) –Subpixel shift (top, left) applied during scaling.
-
linear
¶bool | None
, default:None
) –Whether to linearize the input before scaling. If None, inferred from sigmoid.
-
sigmoid
¶bool | tuple[Slope, Center]
, default:False
) –Whether to use sigmoid transfer curve. Can be True, False, or a tuple of (slope, center).
True
applies the defaults values (6.5, 0.75). Keep in mind sigmoid slope has to be in range 1.0-20.0 (inclusive) and sigmoid center has to be in range 0.0-1.0 (inclusive). -
kwargs
¶Any
, default:{}
) –Additional arguments forwarded to the scale function.
Returns:
-
VideoNode | ConstantFormatVideoNode
–Scaled video clip.
Source code
171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 |
|
supersample ¶
supersample(
clip: VideoNodeT,
rfactor: float = 2.0,
shift: tuple[TopShift, LeftShift] = (0, 0),
**kwargs: Any
) -> VideoNodeT
Supersample a clip by a given scaling factor.
Parameters:
-
clip
¶VideoNodeT
) –The source clip.
-
rfactor
¶float
, default:2.0
) –Scaling factor for supersampling.
-
shift
¶tuple[TopShift, LeftShift]
, default:(0, 0)
) –Subpixel shift (top, left) applied during scaling.
-
kwargs
¶Any
, default:{}
) –Additional arguments forwarded to the scale function.
Returns:
-
VideoNodeT
–The supersampled clip.
Raises:
-
CustomValueError
–If resulting resolution is non-positive.
Source code
425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 |
|