exprop ¶
Classes:
-
ExprList
–A list-based representation of a RPN expression.
-
ExprOp
–Represents operators used in RPN expressions.
-
ExprToken
–Enumeration for symbolic constants used in norm_expr.
-
TupleExprList
–A tuple of multiple
ExprList
expressions, applied sequentially to the clip(s).
ExprList ¶
Bases: StrList
A list-based representation of a RPN expression.
Methods:
-
__call__
–Apply the expression to one or more input clips.
__call__ ¶
__call__(
*clips: VideoNodeIterableT[VideoNode],
planes: PlanesT = None,
format: HoldsVideoFormatT | VideoFormatT | None = None,
opt: bool = False,
boundary: bool = True,
func: FuncExceptT | None = None,
split_planes: bool = False,
**kwargs: Any
) -> ConstantFormatVideoNode
Apply the expression to one or more input clips.
Parameters:
-
clips
¶VideoNodeIterableT[VideoNode]
, default:()
) –Input clip(s).
-
planes
¶PlanesT
, default:None
) –Plane to process, defaults to all.
-
format
¶HoldsVideoFormatT | VideoFormatT | None
, default:None
) –Output format, defaults to the first clip format.
-
opt
¶bool
, default:False
) –Forces integer evaluation as much as possible.
-
boundary
¶bool
, default:True
) –Specifies the default boundary condition for relative pixel accesses:
- True (default): Mirrored edges.
- False: Clamped edges.
-
func
¶FuncExceptT | None
, default:None
) –Function returned for custom error handling. This should only be set by VS package developers.
-
split_planes
¶bool
, default:False
) –Splits the VideoNodes into their individual planes.
-
kwargs
¶Any
, default:{}
) –Additional keyword arguments passed to norm_expr.
Returns:
-
ConstantFormatVideoNode
–Evaluated clip.
Source code
206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 |
|
ExprOp ¶
Bases: ExprOpBase
Represents operators used in RPN expressions.
Each class attribute corresponds to a specific expression operator with its associated symbol and arity (number of required operands).
Note: format strings can include placeholders for dynamic substitution (e.g., {N:d}
, {name:s}
).
Methods:
-
__call__
–Combines multiple video clips using the selected expression operator
-
acos
–Build an expression to approximate arccosine using an identity:
-
asin
–Build an expression to approximate arcsine using an identity:
-
atan
–Build an expression to compute arctangent (atan) using domain reduction.
-
atanf
–Approximate atan(x) using a Taylor series centered at 0.
-
clamp
–Create an expression to clamp a value between
min
andmax
. -
combine
–Combines multiple video clips using the selected expression operator.
-
convert_extra
–Converts an 'extra' operator into a valid
akarin.Expr
expression string. -
convolution
–Builds an expression that performs a weighted convolution-like operation.
-
is_extra
–Check if the operator is an 'extra' operator.
-
mae
–Build an expression to compute the Mean Absolute Error (MAE) between two plane sets.
-
masked_merge
–Build a masked merge expression from two inputs and a mask.
-
matrix
–Generate a matrix expression layout for convolution-like operations.
-
polyval
–Build an expression to evaluate a polynomial at a given value using Horner's method.
-
rmse
–Build an expression to compute the Root Mean Squared Error (RMSE) between two plane sets.
Attributes:
-
ABS
–Absolute value.
-
ABS_PIX
–Get value of absolute pixel at coordinates ({x},{y}) on clip
{char}
. -
ACOS
–Arccosine (inverse cosine).
-
ADD
–Addition.
-
AND
–Logical AND.
-
ASIN
–Arcsine (inverse sine).
-
ATAN
–Arctangent.
-
BITAND
–Bitwise AND.
-
BITNOT
–Bitwise NOT.
-
BITOR
–Bitwise OR.
-
BITXOR
–Bitwise XOR.
-
CEIL
–Round up to nearest integer.
-
CLAMP
–Clamp a value between min and max.
-
COS
–Cosine (radians).
-
DIV
–Division.
-
DROP
–Remove top value from the stack.
-
DROPN
–Remove top N values from the stack.
-
DUP
–Duplicate the top of the stack.
-
DUPN
–Duplicate the top N items on the stack.
-
EQ
–Equality (x == y).
-
EXP
–Exponential function (e^x).
-
FLOOR
–Round down to nearest integer.
-
GT
–Greater than (x > y).
-
GTE
–Greater than or equal.
-
HEIGHT
–Frame height.
-
LERP
–Linear interpolation of a value between two border values.
-
LOG
–Natural logarithm.
-
LT
–Less than (x < y).
-
LTE
–Less than or equal.
-
MAX
–Maximum of two values.
-
MIN
–Minimum of two values.
-
MMG
–MaskedMerge implementation from std lib.
-
MOD
–Modulo operation (remainder).
-
MUL
–Multiplication.
-
N
–Current frame number.
-
NEG
–Negation (multiply by -1).
-
NOT
–Logical NOT.
-
OR
–Logical OR.
-
PI
–Mathematical constant π (pi).
-
POLYVAL
–Evaluate a degree-N polynomial at the top value on the stack.
-
POW
–Exponentiation (x^y).
-
REL_PIX
–Get value of relative pixel at offset ({x},{y}) on clip
{char}
. -
ROUND
–Round to nearest integer.
-
SGN
–Sign function: -1, 0, or 1 depending on value.
-
SIN
–Sine (radians).
-
SORTN
–Sort top N values on the stack.
-
SQRT
–Square root.
-
SUB
–Subtraction.
-
SWAP
–Swap top two values on the stack.
-
SWAPN
–Swap the top N values (custom depth).
-
TAN
–Tangent (radians).
-
TERN
–Ternary operation: cond ? if_true : if_false.
-
TRUNC
–Truncate to integer (toward zero).
-
VAR_PUSH
–Push value of variable
{name}
to the stack. -
VAR_STORE
–Store value in variable named
{name}
. -
WIDTH
–Frame width.
-
X
–Current pixel X-coordinate.
-
XOR
–Logical XOR.
-
Y
–Current pixel Y-coordinate.
-
n_op
(int
) –The number of operands the operator requires.
ABS_PIX class-attribute
instance-attribute
¶
ABS_PIX = ('{x:d} {y:d} {char:s}[]', 3)
Get value of absolute pixel at coordinates ({x},{y}) on clip {char}
.
DROPN class-attribute
instance-attribute
¶
DROPN = ('drop{N:d}', 1)
Remove top N values from the stack.
DUPN class-attribute
instance-attribute
¶
DUPN = ('dup{N:d}', 1)
Duplicate the top N items on the stack.
LERP class-attribute
instance-attribute
¶
LERP = ('lerp', 3)
Linear interpolation of a value between two border values.
POLYVAL class-attribute
instance-attribute
¶
Evaluate a degree-N polynomial at the top value on the stack.
Uses N coefficients below the top value (x), ordered from highest to lowest degree.
REL_PIX class-attribute
instance-attribute
¶
REL_PIX = ('{char:s}[{x:d},{y:d}]', 3)
Get value of relative pixel at offset ({x},{y}) on clip {char}
.
SGN class-attribute
instance-attribute
¶
SGN = ('sgn', 1)
Sign function: -1, 0, or 1 depending on value.
SWAPN class-attribute
instance-attribute
¶
SWAPN = ('swap{N:d}', 2)
Swap the top N values (custom depth).
TERN class-attribute
instance-attribute
¶
TERN = ('?', 3)
Ternary operation: cond ? if_true : if_false.
VAR_PUSH class-attribute
instance-attribute
¶
VAR_PUSH = ('{name:s}@', 1)
Push value of variable {name}
to the stack.
VAR_STORE class-attribute
instance-attribute
¶
VAR_STORE = ('{name:s}!', 1)
Store value in variable named {name}
.
__call__ ¶
__call__(
*clips: VideoNodeIterableT[VideoNodeT],
suffix: SupportsString | Iterable[SupportsString] | None = None,
prefix: SupportsString | Iterable[SupportsString] | None = None,
expr_suffix: SupportsString | Iterable[SupportsString] | None = None,
expr_prefix: SupportsString | Iterable[SupportsString] | None = None,
planes: PlanesT = None,
**kwargs: Any
) -> VideoNodeT
Combines multiple video clips using the selected expression operator or returns a formatted version of the ExprOp, using substitutions from pos_args and kwargs.
Parameters:
-
*pos_args
¶Any
, default:()
) –Positional arguments.
-
**kwargs
¶Any
, default:{}
) –Keywords arguments.
Returns:
-
VideoNode | str
–A clip representing the combined result of applying the expression or formatted version of this ExprOp.
Source code
363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 |
|
acos classmethod
¶
Build an expression to approximate arccosine using an identity
acos(x) = π/2 - asin(x)
Parameters:
-
c
¶SupportsString
, default:''
) –The input expression variable.
-
n
¶int
, default:10
) –Number of terms to use in the internal asin approximation.
Returns:
-
ExprList
–An
ExprList
representing the acos(x) expression.
Source code
1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 |
|
asin classmethod
¶
Build an expression to approximate arcsine using an identity
asin(x) = atan(x / sqrt(1 - x²))
Parameters:
-
c
¶SupportsString
, default:''
) –The input expression variable.
-
n
¶int
, default:10
) –Number of terms to use in the internal atan approximation.
Returns:
-
ExprList
–An
ExprList
representing the asin(x) expression.
Source code
1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 |
|
atan classmethod
¶
Build an expression to compute arctangent (atan) using domain reduction.
Parameters:
-
c
¶SupportsString
, default:''
) –The expression variable or string input.
-
n
¶int
, default:10
) –The number of terms to use in the Taylor series approximation.
Returns:
-
ExprList
–An
ExprList
representing the arctangent expression.
Source code
957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 |
|
atanf classmethod
¶
Approximate atan(x) using a Taylor series centered at 0.
This is accurate for inputs in [-1, 1]. Use atan
for full-range values.
Parameters:
-
c
¶SupportsString
, default:''
) –The expression variable or string input.
-
n
¶int
, default:10
) –The number of terms in the Taylor series (min 2).
Returns:
-
ExprList
–An
ExprList
approximating atan(x).
Source code
995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 |
|
clamp classmethod
¶
clamp(
min: float | ExprToken = RangeMin,
max: float | ExprToken = RangeMax,
c: str = "",
) -> ExprList
Create an expression to clamp a value between min
and max
.
Parameters:
-
min
¶float | ExprToken
, default:RangeMin
) –The minimum value.
-
max
¶float | ExprToken
, default:RangeMax
) –The maximum value.
-
c
¶str
, default:''
) –Optional expression variable or prefix to clamp.
Returns:
-
ExprList
–An
ExprList
containing the clamping expression.
Source code
716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 |
|
combine ¶
combine(
*clips: VideoNode | Iterable[VideoNode | Iterable[VideoNode]],
suffix: SupportsString | Iterable[SupportsString] | None = None,
prefix: SupportsString | Iterable[SupportsString] | None = None,
expr_suffix: SupportsString | Iterable[SupportsString] | None = None,
expr_prefix: SupportsString | Iterable[SupportsString] | None = None,
planes: PlanesT = None,
**kwargs: Any
) -> ConstantFormatVideoNode
Combines multiple video clips using the selected expression operator.
Parameters:
-
clips
¶VideoNode | Iterable[VideoNode | Iterable[VideoNode]]
, default:()
) –Input clip(s).
-
suffix
¶SupportsString | Iterable[SupportsString] | None
, default:None
) –Optional suffix string(s) to append to each input variable in the expression.
-
prefix
¶SupportsString | Iterable[SupportsString] | None
, default:None
) –Optional prefix string(s) to prepend to each input variable in the expression.
-
expr_suffix
¶SupportsString | Iterable[SupportsString] | None
, default:None
) –Optional expression to append after the combined input expression.
-
expr_prefix
¶SupportsString | Iterable[SupportsString] | None
, default:None
) –Optional expression to prepend before the combined input expression.
-
planes
¶PlanesT
, default:None
) –Which planes to process. Defaults to all.
-
**kwargs
¶Any
, default:{}
) –Additional keyword arguments forwarded to combine.
Returns:
-
ConstantFormatVideoNode
–A clip representing the combined result of applying the expression.
Source code
397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 |
|
convert_extra ¶
Converts an 'extra' operator into a valid akarin.Expr
expression string.
Parameters:
Returns:
-
str
–A string representation of the equivalent expression.
Raises:
-
ValueError
–If the operator is not marked as extra.
-
NotImplementedError
–If the extra operator has no defined conversion.
Source code
658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 |
|
convolution classmethod
¶
convolution(
var: SupportsString | Collection[SupportsString],
matrix: (
Iterable[SupportsSumNoDefaultT]
| Iterable[Iterable[SupportsSumNoDefaultT]]
),
bias: SupportsString | None = None,
divisor: SupportsString | bool = True,
saturate: bool = True,
mode: ConvMode = SQUARE,
premultiply: SupportsString | None = None,
multiply: SupportsString | None = None,
clamp: bool = False,
) -> TupleExprList
Builds an expression that performs a weighted convolution-like operation.
Parameters:
-
var
¶SupportsString | Collection[SupportsString]
) –The variable used as the central value or elements proportional to the radius if mode is
Literal[ConvMode.TEMPORAL]
. -
matrix
¶Iterable[SupportsSumNoDefaultT] | Iterable[Iterable[SupportsSumNoDefaultT]]
) –A flat or 2D iterable representing the convolution weights.
-
bias
¶SupportsString | None
, default:None
) –A constant value to add to the result after convolution (default: None).
-
divisor
¶SupportsString | bool
, default:True
) –If True, normalizes by the sum of weights; if False, skips division; Otherwise, divides by this value.
-
saturate
¶bool
, default:True
) –If False, applies
abs()
to avoid negatives. -
mode
¶ConvMode
, default:SQUARE
) –The convolution shape.
-
premultiply
¶SupportsString | None
, default:None
) –Optional scalar to multiply the result before normalization.
-
multiply
¶SupportsString | None
, default:None
) –Optional scalar to multiply the result at the end.
-
clamp
¶bool
, default:False
) –If True, clamps the final result to [RangeMin, RangeMax].
Returns:
-
TupleExprList
–A
TupleExprList
representing the expression-based convolution.
Raises:
-
CustomValueError
–If matrix length is invalid or doesn't match the mode.
Source code
800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 |
|
is_extra cached
¶
is_extra() -> bool
Check if the operator is an 'extra' operator.
Extra operators are not natively supported by VapourSynth's std.Expr
or akarin.Expr
and require conversion to a valid equivalent expression.
Returns:
-
bool
–True if the operator is considered extra and requires conversion.
Source code
645 646 647 648 649 650 651 652 653 654 655 656 |
|
mae classmethod
¶
mae(
planesa: ExprVars | HoldsVideoFormatT | VideoFormatT | SupportsIndex,
planesb: (
ExprVars | HoldsVideoFormatT | VideoFormatT | SupportsIndex | None
) = None,
) -> ExprList
Build an expression to compute the Mean Absolute Error (MAE) between two plane sets.
Parameters:
-
planesa
¶ExprVars | HoldsVideoFormatT | VideoFormatT | SupportsIndex
) –The first plane set or clip.
-
planesb
¶ExprVars | HoldsVideoFormatT | VideoFormatT | SupportsIndex | None
, default:None
) –The second plane set or clip. If None, uses same as
planesa
.
Returns:
-
ExprList
–An
ExprList
representing the MAE expression across all planes.
Source code
931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 |
|
masked_merge classmethod
¶
masked_merge(
c_a: SupportsString = "",
c_b: SupportsString = "",
mask: SupportsString = "",
) -> ExprList
Build a masked merge expression from two inputs and a mask.
Parameters:
-
c_a
¶SupportsString
, default:''
) –The first input expression variable.
-
c_b
¶SupportsString
, default:''
) –The second input expression variable.
-
mask
¶SupportsString
, default:''
) –The mask expression that determines how
c_a
andc_b
are combined.
Returns:
-
ExprList
–An
ExprList
representing the MaskedMerge expression.
Source code
1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 |
|
matrix classmethod
¶
matrix(
var: SupportsString | Collection[SupportsString],
radius: int,
mode: ConvMode,
exclude: Iterable[tuple[int, int]] | None = None,
) -> TupleExprList
Generate a matrix expression layout for convolution-like operations.
Parameters:
-
var
¶SupportsString | Collection[SupportsString]
) –The variable representing the central pixel or elements proportional to the radius if mode is
Literal[ConvMode.TEMPORAL]
. -
radius
¶int
) –The radius of the kernel in pixels (e.g., 1 for 3x3).
-
mode
¶ConvMode
) –The convolution mode.
-
exclude
¶Iterable[tuple[int, int]] | None
, default:None
) –Optional set of (x, y) coordinates to exclude from the matrix.
Returns:
-
TupleExprList
–A TupleExprList representing the matrix of expressions.
Raises:
-
CustomValueError
–If the input variable is not sized correctly for temporal mode.
-
NotImplementedError
–If the convolution mode is unsupported.
Source code
733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 |
|
polyval classmethod
¶
Build an expression to evaluate a polynomial at a given value using Horner's method.
Parameters:
-
c
¶SupportsString
) –The input expression variable at which the polynomial is evaluated (the 'x' value).
-
*coeffs
¶SupportsString
, default:()
) –Coefficients of the polynomial. Must provide at least one coefficient.
Returns:
-
ExprList
–An
ExprList
representing the polyval expression.
Raises:
-
CustomValueError
–If fewer than one coefficient is provided.
Source code
1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 |
|
rmse classmethod
¶
rmse(
planesa: ExprVars | HoldsVideoFormatT | VideoFormatT | SupportsIndex,
planesb: (
ExprVars | HoldsVideoFormatT | VideoFormatT | SupportsIndex | None
) = None,
) -> ExprList
Build an expression to compute the Root Mean Squared Error (RMSE) between two plane sets.
Parameters:
-
planesa
¶ExprVars | HoldsVideoFormatT | VideoFormatT | SupportsIndex
) –The first plane set or clip.
-
planesb
¶ExprVars | HoldsVideoFormatT | VideoFormatT | SupportsIndex | None
, default:None
) –The second plane set or clip. If None, uses same as
planesa
.
Returns:
-
ExprList
–An
ExprList
representing the RMSE expression across all planes.
Source code
904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 |
|
ExprOpBase ¶
Bases: CustomStrEnum
Base class for expression operators used in RPN expressions.
Methods:
-
__call__
–Combines multiple video clips using the selected expression operator
-
combine
–Combines multiple video clips using the selected expression operator.
Attributes:
__call__ ¶
__call__(
*clips: VideoNodeIterableT[VideoNodeT],
suffix: SupportsString | Iterable[SupportsString] | None = None,
prefix: SupportsString | Iterable[SupportsString] | None = None,
expr_suffix: SupportsString | Iterable[SupportsString] | None = None,
expr_prefix: SupportsString | Iterable[SupportsString] | None = None,
planes: PlanesT = None,
**kwargs: Any
) -> VideoNodeT
Combines multiple video clips using the selected expression operator or returns a formatted version of the ExprOp, using substitutions from pos_args and kwargs.
Parameters:
-
*pos_args
¶Any
, default:()
) –Positional arguments.
-
**kwargs
¶Any
, default:{}
) –Keywords arguments.
Returns:
-
VideoNode | str
–A clip representing the combined result of applying the expression or formatted version of this ExprOp.
Source code
363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 |
|
combine ¶
combine(
*clips: VideoNode | Iterable[VideoNode | Iterable[VideoNode]],
suffix: SupportsString | Iterable[SupportsString] | None = None,
prefix: SupportsString | Iterable[SupportsString] | None = None,
expr_suffix: SupportsString | Iterable[SupportsString] | None = None,
expr_prefix: SupportsString | Iterable[SupportsString] | None = None,
planes: PlanesT = None,
**kwargs: Any
) -> ConstantFormatVideoNode
Combines multiple video clips using the selected expression operator.
Parameters:
-
clips
¶VideoNode | Iterable[VideoNode | Iterable[VideoNode]]
, default:()
) –Input clip(s).
-
suffix
¶SupportsString | Iterable[SupportsString] | None
, default:None
) –Optional suffix string(s) to append to each input variable in the expression.
-
prefix
¶SupportsString | Iterable[SupportsString] | None
, default:None
) –Optional prefix string(s) to prepend to each input variable in the expression.
-
expr_suffix
¶SupportsString | Iterable[SupportsString] | None
, default:None
) –Optional expression to append after the combined input expression.
-
expr_prefix
¶SupportsString | Iterable[SupportsString] | None
, default:None
) –Optional expression to prepend before the combined input expression.
-
planes
¶PlanesT
, default:None
) –Which planes to process. Defaults to all.
-
**kwargs
¶Any
, default:{}
) –Additional keyword arguments forwarded to combine.
Returns:
-
ConstantFormatVideoNode
–A clip representing the combined result of applying the expression.
Source code
397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 |
|
ExprOpExtraMeta ¶
Bases: EnumMeta
ExprToken ¶
Bases: CustomStrEnum
Enumeration for symbolic constants used in norm_expr.
Methods:
-
get_value
–Resolves the numeric value represented by this token based on the input clip and range.
Attributes:
-
ChromaMax
–The maximum chroma value in limited range.
-
ChromaMin
–The minimum chroma value in limited range.
-
ChromaRangeInMax
–Like
ChromaRangeMax
, but adapts to inputrange_in
. -
ChromaRangeInMin
–Like
ChromaRangeMin
, but adapts to inputrange_in
. -
ChromaRangeMax
–Maximum chroma value based on input clip's color range.
-
ChromaRangeMin
–Minimum chroma value based on input clip's color range.
-
LumaMax
–The maximum luma value in limited range.
-
LumaMin
–The minimum luma value in limited range.
-
LumaRangeInMax
–Like
LumaRangeMax
, but adapts to inputrange_in
. -
LumaRangeInMin
–Like
LumaRangeMin
, but adapts to inputrange_in
. -
LumaRangeMax
–Maximum luma value based on input clip's color range.
-
LumaRangeMin
–Minimum luma value based on input clip's color range.
-
Neutral
–The neutral value (e.g. 128 for 8-bit limited, 0 for float).
-
RangeHalf
–Half of the full range (e.g. 128.0 for 8-bit full range).
-
RangeInMax
–Like
RangeMax
, but adapts to inputrange_in
. -
RangeInMin
–Like
RangeMin
, but adapts to inputrange_in
parameter. -
RangeMax
–Maximum value in full range (chroma-aware).
-
RangeMin
–Minimum value in full range (chroma-aware).
-
RangeSize
–The size of the full range (e.g. 256 for 8-bit, 65536 for 16-bit).
-
is_chroma
(bool
) –Indicates whether the token refers to a chroma-related value.
ChromaMax class-attribute
instance-attribute
¶
ChromaMax = 'cmax'
The maximum chroma value in limited range.
ChromaMin class-attribute
instance-attribute
¶
ChromaMin = 'cmin'
The minimum chroma value in limited range.
ChromaRangeInMax class-attribute
instance-attribute
¶
ChromaRangeInMax = 'crange_in_max'
Like ChromaRangeMax
, but adapts to input range_in
.
ChromaRangeInMin class-attribute
instance-attribute
¶
ChromaRangeInMin = 'crange_in_min'
Like ChromaRangeMin
, but adapts to input range_in
.
ChromaRangeMax class-attribute
instance-attribute
¶
ChromaRangeMax = 'crange_max'
Maximum chroma value based on input clip's color range.
ChromaRangeMin class-attribute
instance-attribute
¶
ChromaRangeMin = 'crange_min'
Minimum chroma value based on input clip's color range.
LumaMax class-attribute
instance-attribute
¶
LumaMax = 'ymax'
The maximum luma value in limited range.
LumaMin class-attribute
instance-attribute
¶
LumaMin = 'ymin'
The minimum luma value in limited range.
LumaRangeInMax class-attribute
instance-attribute
¶
LumaRangeInMax = 'yrange_in_max'
Like LumaRangeMax
, but adapts to input range_in
.
LumaRangeInMin class-attribute
instance-attribute
¶
LumaRangeInMin = 'yrange_in_min'
Like LumaRangeMin
, but adapts to input range_in
.
LumaRangeMax class-attribute
instance-attribute
¶
LumaRangeMax = 'yrange_max'
Maximum luma value based on input clip's color range.
LumaRangeMin class-attribute
instance-attribute
¶
LumaRangeMin = 'yrange_min'
Minimum luma value based on input clip's color range.
Neutral class-attribute
instance-attribute
¶
Neutral = 'neutral'
The neutral value (e.g. 128 for 8-bit limited, 0 for float).
RangeHalf class-attribute
instance-attribute
¶
RangeHalf = 'range_half'
Half of the full range (e.g. 128.0 for 8-bit full range).
RangeInMax class-attribute
instance-attribute
¶
RangeInMax = 'range_in_max'
Like RangeMax
, but adapts to input range_in
.
RangeInMin class-attribute
instance-attribute
¶
RangeInMin = 'range_in_min'
Like RangeMin
, but adapts to input range_in
parameter.
RangeMax class-attribute
instance-attribute
¶
RangeMax = 'range_max'
Maximum value in full range (chroma-aware).
RangeMin class-attribute
instance-attribute
¶
RangeMin = 'range_min'
Minimum value in full range (chroma-aware).
RangeSize class-attribute
instance-attribute
¶
RangeSize = 'range_size'
The size of the full range (e.g. 256 for 8-bit, 65536 for 16-bit).
is_chroma property
¶
is_chroma: bool
Indicates whether the token refers to a chroma-related value.
Returns:
-
bool
–True if the token refers to chroma (e.g. ChromaMin), False otherwise.
get_value ¶
get_value(
clip: VideoNode,
chroma: bool | None = None,
range_in: ColorRange | None = None,
) -> float
Resolves the numeric value represented by this token based on the input clip and range.
Parameters:
-
clip
¶VideoNode
) –A clip used to determine bit depth and format.
-
chroma
¶bool | None
, default:None
) –Optional override for whether to treat the token as chroma-related.
-
range_in
¶ColorRange | None
, default:None
) –Optional override for the color range.
Returns:
-
float
–The value corresponding to the symbolic token.
Source code
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 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 |
|
TupleExprList ¶
A tuple of multiple ExprList
expressions, applied sequentially to the clip(s).
Methods:
-
__call__
–Apply a sequence of expressions to the input clip(s), one after another.
__call__ ¶
__call__(
*clips: VideoNodeIterableT[VideoNode],
planes: PlanesT = None,
format: HoldsVideoFormatT | VideoFormatT | None = None,
opt: bool = False,
boundary: bool = True,
func: FuncExceptT | None = None,
split_planes: bool = False,
**kwargs: Any
) -> ConstantFormatVideoNode
Apply a sequence of expressions to the input clip(s), one after another.
Each ExprList
in the tuple is applied to the result of the previous one.
Parameters:
-
clips
¶VideoNodeIterableT[VideoNode]
, default:()
) –Input clip(s).
-
planes
¶PlanesT
, default:None
) –Plane to process, defaults to all.
-
format
¶HoldsVideoFormatT | VideoFormatT | None
, default:None
) –Output format, defaults to the first clip format.
-
opt
¶bool
, default:False
) –Forces integer evaluation as much as possible.
-
boundary
¶bool
, default:True
) –Specifies the default boundary condition for relative pixel accesses:
- True (default): Mirrored edges.
- False: Clamped edges.
-
func
¶FuncExceptT | None
, default:None
) –Function returned for custom error handling. This should only be set by VS package developers.
-
split_planes
¶bool
, default:False
) –Splits the VideoNodes into their individual planes.
-
kwargs
¶Any
, default:{}
) –Extra keyword arguments passed to each
ExprList
.
Returns:
-
ConstantFormatVideoNode
–Evaluated clip.
Raises:
-
CustomRuntimeError
–If the
TupleExprList
is empty.
Source code
246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 |
|