shaders ¶
Classes:
-
PlaceboShader–Placebo shader class.
PlaceboShader ¶
PlaceboShader(
shader: str | SPathLike,
*,
kernel: KernelLike = Catrom,
scaler: ScalerLike | None = None,
shifter: KernelLike | None = None,
**kwargs: Any
)
Bases: BaseGenericScaler
Placebo shader class.
Initializes the BaseGenericScaler.
Parameters:
-
(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.
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.
-
implemented_funcs–Returns a set of function names that are implemented in the current class and the parent classes.
-
kernel_radius–Return the effective kernel radius for the scaler.
-
scale–Scale a clip to a specified resolution.
-
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.
-
pretty_string(str) –Cached property returning a user-friendly string representation.
-
scale_function(Callable[..., VideoNode]) –Scale function called internally when performing scaling operations.
-
scaler– -
shader– -
shifter–
Source code in vsscale/shaders.py
25 26 27 28 29 30 31 32 33 34 35 36 | |
kwargs instance-attribute ¶
Arguments passed to the implemented funcs or internal scale function.
pretty_string property ¶
pretty_string: str
Cached property returning a user-friendly string representation.
Returns:
-
str–Pretty-printed string with arguments.
scale_function instance-attribute ¶
scale_function: Callable[..., VideoNode]
Scale function called internally when performing scaling operations.
ensure_obj classmethod ¶
ensure_obj(
scaler: str | type[Self] | Self | None = None,
/,
func_except: FuncExcept | 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¶FuncExcept | None, default:None) –Function returned for custom error handling.
Returns:
-
Self–Scaler instance.
Source code in vskernels/abstract/base.py
396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 | |
from_param classmethod ¶
from_param(
scaler: str | type[Self] | Self | None = None,
/,
func_except: FuncExcept | 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¶FuncExcept | None, default:None) –Function returned for custom error handling.
Returns:
Source code in vskernels/abstract/base.py
377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 | |
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 in vskernels/abstract/base.py
546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 | |
implemented_funcs classmethod ¶
Returns a set of function names that are implemented in the current class and the parent classes.
These functions determine which keyword arguments will be extracted from the __init__ method.
Returns:
Source code in vskernels/abstract/base.py
454 455 456 457 458 459 460 461 462 463 464 465 | |
kernel_radius ¶
kernel_radius() -> int
Return the effective kernel radius for the scaler.
Raises:
-
CustomNotImplementedError–If no kernel radius is defined.
Returns:
-
int–Kernel radius.
Source code in vskernels/abstract/base.py
417 418 419 420 421 422 423 424 425 426 427 428 | |
scale ¶
scale(
clip: VideoNode,
width: int | None = None,
height: int | None = None,
shift: tuple[float, float] = (0, 0),
**kwargs: Any
) -> VideoNode
Scale a clip to a specified resolution.
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.
-
(**kwargs¶Any, default:{}) –Additional arguments forwarded to the scale function.
Returns:
-
VideoNode–The scaled clip.
Source code in vsscale/shaders.py
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 | |
supersample ¶
supersample(
clip: VideoNode,
rfactor: float = 2.0,
shift: tuple[TopShift, LeftShift] = (0, 0),
**kwargs: Any
) -> VideoNode
Supersample a clip by a given scaling factor.
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.
-
(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.
Raises:
-
CustomValueError–If resulting resolution is non-positive.
Returns:
-
VideoNode–The supersampled clip.
Source code in vskernels/abstract/base.py
511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 | |