vapours

Crates.iovapours
lib.rsvapours
version
sourcesrc
created_at2024-12-31 16:58:35.83115+00
updated_at2025-03-31 18:12:08.409902+00
descriptionA collection of utilities surrounding vapoursynth4-rs.
homepagehttps://sgt0.github.io/vapours
repositoryhttps://github.com/sgt0/vapours
max_upload_size
id1500187
Cargo.toml error:TOML parse error at line 22, column 1 | 22 | autolib = false | ^^^^^^^ unknown field `autolib`, expected one of `name`, `version`, `edition`, `authors`, `description`, `readme`, `license`, `repository`, `homepage`, `documentation`, `build`, `resolver`, `links`, `default-run`, `default_dash_run`, `rust-version`, `rust_dash_version`, `rust_version`, `license-file`, `license_dash_file`, `license_file`, `licenseFile`, `license_capital_file`, `forced-target`, `forced_dash_target`, `autobins`, `autotests`, `autoexamples`, `autobenches`, `publish`, `metadata`, `keywords`, `categories`, `exclude`, `include`
size0
sgt (sgt0)

documentation

README

vapours

vapours is a collection of utilities surrounding vapoursynth4-rs. Generally these aid in VapourSynth plugin development. vapours can also be seen as a Rust equivalent to vs-tools to some extent.

For example, the classic invert filter goes from this:

for plane in 0..fi.num_planes {
    let mut src_p = src.plane(plane);
    let src_stride = src.stride(plane);
    let mut dst_p = dst.plane_mut(plane);
    let dst_stride = dst.stride(plane);

    let h = src.frame_height(plane);
    let w = src.frame_width(plane);

    for _ in 0..h {
        for x in 0..w as usize {
            unsafe { *dst_p.wrapping_add(x) = !*src_p.wrapping_add(x) };
        }

        src_p = src_p.wrapping_offset(src_stride);
        dst_p = dst_p.wrapping_offset(dst_stride);
    }
}

To this:

// Bring in extensions on `VideoFrame` like `as_slice()` and `as_mut_slice()`.
use vapours::frame::VapoursVideoFrame;

// ...

for plane in 0..fi.num_planes {
    let src_slice = src.as_slice::<u8>(plane);
    let dst_slice = dst.as_mut_slice::<u8>(plane);

    for (src_pixel, dst_pixel) in zip(src_slice, dst_slice) {
        *dst_pixel = !*src_pixel;
    }
}
Commit count: 36

cargo fmt