VapourSynth expr plugin built on top of Cranelift.
Project description
cranexpr
cranexpr is like std.Expr
but built on top of Cranelift. It's a VapourSynth
plugin that allows one to evaluate an expression per pixel.
Examples
Median of 3 clips:
core.cranexpr.Expr([x, y, z], "x y min x y max z min max")
Flip a clip horizontally:
core.cranexpr.Expr([x], "width X - 1 - Y x[]")
3x3 box blur:
core.cranexpr.Expr([x], "x[-1,-1] x[0,-1] x[1,-1] x[-1,0] x x[1,0] x[-1,1] x[0,1] x[1,1] + + + + + + + + 9 /")
Features
- Arithmetic:
+,-,*,/,%,pow,exp,log,sqrt. - Trigonometry:
sin,cos,tan,atan2. - Comparison:
>,<,=,>=,<=. - Logical:
and,or,xor,not. - Bitwise:
bitand,bitor,bitxor,bitnot. - Clamping:
min,max,clip(alias:clamp). - Rounding:
floor,round,trunc. - Ternary (if/else):
?. sgn: Returns the sign of a value (-1 if negative, 1 if positive, 0 if zero).- Constants:
width: Width of the plane.height: Height of the plane.N: Current frame number.pi: π.
- Stack manipulation:
dropN,drop: drops the top N values from the stack.dropis equivalent todrop1.dupN,dup: allows a value N steps up in the stack to be duplicated. The top value of the stack has index 0 meaning thatdupis equivalent todup0.swapN,swap: allows a value N steps up in the stack to be swapped. The top value of the stack has index 0 meaning thatswapis equivalent toswap1. This is becauseswapNalways swaps with the topmost value at index 0.
- Variables:
var!: Pops the top value from the stack and stores it in a variable namedvar.var@: Pushes the value of the variablevaronto the stack.
- Frame property access:
clip.PropertyName.- Accesses a numeric frame property from the given clip.
- If the property is missing, its value will be
NaN. - If the property is not a numeric frame property, its value will be the first byte.
- Relative pixel access:
clip[relX, relY]:[mode].- Accesses a pixel relative to the current coordinate (
X,Y).relXandrelYmust be integer constants. - If no suffix is provided, the edge behavior is determined by the filter's
boundaryparameter.:c: Forces clamped boundary.:m: Forces mirrored boundary.
- Accesses a pixel relative to the current coordinate (
- Absolute pixel access:
absX absY clip[]:[mode].- Accesses a pixel at an absolute coordinate. It pops
absYthenabsXfrom the stack. These coordinates can be computed by expressions. - If the coordinates are not integers, they will be rounded half to even.
- Example:
X 2 / Y x[]reads the pixel at half the current X coordinate from the first clip, using the default clamp mode. - Boundary Suffixes:
:c: Forces clamped boundary.:m: Forces mirrored boundary.
- Accesses a pixel at an absolute coordinate. It pops
- Supports any number of input clips.
srcNmay be used to access theN-th input clip. Shorthand aliasesx,y,z,a,b,c, etc. map tosrc0,src1,src2,src3,src4,src5, etc., up towbeingsrc25. Beyond that, usesrcN.
API
cranexpr.Expr(
clips: vs.VideoNode | Sequence[vs.VideoNode],
expr: str | list[str],
format: int | None = None,
boundary: Literal[0, 1] = 0,
) -> vs.VideoNode
clips— Input video nodes.expr— Reverse Polish Notation (RPN) expression(s) for each plane. The expression given for the previous plane is used if the list contains fewer expressions than the input clip has planes. This means that a single expression will be applied to all planes by default.format— By default the output format is the same as the first input clip's format. This can be overridden by setting this parameter.boundary— Boundary mode.0for clamping,1for mirroring.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file vapoursynth_cranexpr-0.5.0.tar.gz.
File metadata
- Download URL: vapoursynth_cranexpr-0.5.0.tar.gz
- Upload date:
- Size: 79.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0736a7fc2e7e9512a8bc741974fa6385e814ed7e6862c077de94da56a7395a38
|
|
| MD5 |
c714e3f162d62ddad587e21b5dfd47cf
|
|
| BLAKE2b-256 |
1a34580a4619bf1141adc0acc5d433583fef27488ee576fc95f2cac01e7a0e4a
|
Provenance
The following attestation bundles were made for vapoursynth_cranexpr-0.5.0.tar.gz:
Publisher:
publish.yml on sgt0/cranexpr
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
vapoursynth_cranexpr-0.5.0.tar.gz -
Subject digest:
0736a7fc2e7e9512a8bc741974fa6385e814ed7e6862c077de94da56a7395a38 - Sigstore transparency entry: 1407145411
- Sigstore integration time:
-
Permalink:
sgt0/cranexpr@89d45388090a78b993d6d099f2d33bf83962a559 -
Branch / Tag:
refs/tags/v0.5.0 - Owner: https://github.com/sgt0
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@89d45388090a78b993d6d099f2d33bf83962a559 -
Trigger Event:
release
-
Statement type:
File details
Details for the file vapoursynth_cranexpr-0.5.0-py3-none-win_amd64.whl.
File metadata
- Download URL: vapoursynth_cranexpr-0.5.0-py3-none-win_amd64.whl
- Upload date:
- Size: 4.6 MB
- Tags: Python 3, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d89b4e406fcfeb1b3a9077b76e3014563c5934f3ffd543f3600f60864e5c96a9
|
|
| MD5 |
75f589dc41cc8cb033f3fd973af032d9
|
|
| BLAKE2b-256 |
ae20be4cd6eb92d7068db21ff09008e5c28ea6ff3d059f3a929de0cdd1784562
|
Provenance
The following attestation bundles were made for vapoursynth_cranexpr-0.5.0-py3-none-win_amd64.whl:
Publisher:
publish.yml on sgt0/cranexpr
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
vapoursynth_cranexpr-0.5.0-py3-none-win_amd64.whl -
Subject digest:
d89b4e406fcfeb1b3a9077b76e3014563c5934f3ffd543f3600f60864e5c96a9 - Sigstore transparency entry: 1407145487
- Sigstore integration time:
-
Permalink:
sgt0/cranexpr@89d45388090a78b993d6d099f2d33bf83962a559 -
Branch / Tag:
refs/tags/v0.5.0 - Owner: https://github.com/sgt0
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@89d45388090a78b993d6d099f2d33bf83962a559 -
Trigger Event:
release
-
Statement type:
File details
Details for the file vapoursynth_cranexpr-0.5.0-py3-none-manylinux_2_28_x86_64.whl.
File metadata
- Download URL: vapoursynth_cranexpr-0.5.0-py3-none-manylinux_2_28_x86_64.whl
- Upload date:
- Size: 5.0 MB
- Tags: Python 3, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fe8a8d882ef09d54d83e97373e9994c8c44297ccf28b24fdb8d551e2797a4d21
|
|
| MD5 |
5f7d5bd20e6629e2dbc78bb8ef8a8b1f
|
|
| BLAKE2b-256 |
da8fd83a4db48fbdc184f4b13a11b655e4b348d6ada1d36280040acf41c5e598
|
Provenance
The following attestation bundles were made for vapoursynth_cranexpr-0.5.0-py3-none-manylinux_2_28_x86_64.whl:
Publisher:
publish.yml on sgt0/cranexpr
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
vapoursynth_cranexpr-0.5.0-py3-none-manylinux_2_28_x86_64.whl -
Subject digest:
fe8a8d882ef09d54d83e97373e9994c8c44297ccf28b24fdb8d551e2797a4d21 - Sigstore transparency entry: 1407145539
- Sigstore integration time:
-
Permalink:
sgt0/cranexpr@89d45388090a78b993d6d099f2d33bf83962a559 -
Branch / Tag:
refs/tags/v0.5.0 - Owner: https://github.com/sgt0
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@89d45388090a78b993d6d099f2d33bf83962a559 -
Trigger Event:
release
-
Statement type:
File details
Details for the file vapoursynth_cranexpr-0.5.0-py3-none-manylinux_2_28_aarch64.whl.
File metadata
- Download URL: vapoursynth_cranexpr-0.5.0-py3-none-manylinux_2_28_aarch64.whl
- Upload date:
- Size: 1.1 MB
- Tags: Python 3, manylinux: glibc 2.28+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7bda9966f7b1fd77c3199b56ecd56d2889695881c5ea36877d8988d190b19fc5
|
|
| MD5 |
74cdf221cdbaf1e5f1147b3c1bf9b24b
|
|
| BLAKE2b-256 |
5dc1fc19a7ba2434e2d893c14b16eb004da5b7899dc770e4721415317baac197
|
Provenance
The following attestation bundles were made for vapoursynth_cranexpr-0.5.0-py3-none-manylinux_2_28_aarch64.whl:
Publisher:
publish.yml on sgt0/cranexpr
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
vapoursynth_cranexpr-0.5.0-py3-none-manylinux_2_28_aarch64.whl -
Subject digest:
7bda9966f7b1fd77c3199b56ecd56d2889695881c5ea36877d8988d190b19fc5 - Sigstore transparency entry: 1407145603
- Sigstore integration time:
-
Permalink:
sgt0/cranexpr@89d45388090a78b993d6d099f2d33bf83962a559 -
Branch / Tag:
refs/tags/v0.5.0 - Owner: https://github.com/sgt0
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@89d45388090a78b993d6d099f2d33bf83962a559 -
Trigger Event:
release
-
Statement type:
File details
Details for the file vapoursynth_cranexpr-0.5.0-py3-none-macosx_11_0_arm64.whl.
File metadata
- Download URL: vapoursynth_cranexpr-0.5.0-py3-none-macosx_11_0_arm64.whl
- Upload date:
- Size: 1.0 MB
- Tags: Python 3, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
59f9c707e6e3b646b938e0902db0c199195925a651258f060081313aca9fb375
|
|
| MD5 |
fff3624ee77626133fd34ce2721e690f
|
|
| BLAKE2b-256 |
fdcd386fb06d141d4feed62af3383cddc4ae0b04416fa2b5791364374ceda6a2
|
Provenance
The following attestation bundles were made for vapoursynth_cranexpr-0.5.0-py3-none-macosx_11_0_arm64.whl:
Publisher:
publish.yml on sgt0/cranexpr
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
vapoursynth_cranexpr-0.5.0-py3-none-macosx_11_0_arm64.whl -
Subject digest:
59f9c707e6e3b646b938e0902db0c199195925a651258f060081313aca9fb375 - Sigstore transparency entry: 1407145662
- Sigstore integration time:
-
Permalink:
sgt0/cranexpr@89d45388090a78b993d6d099f2d33bf83962a559 -
Branch / Tag:
refs/tags/v0.5.0 - Owner: https://github.com/sgt0
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@89d45388090a78b993d6d099f2d33bf83962a559 -
Trigger Event:
release
-
Statement type: