vmaf-head-sys 0.1.0

FFI bindings to Netflix VMAF (vendored)
Documentation
  • Coverage
  • 18.35%
    20 out of 109 items documented0 out of 0 items with examples
  • Size
  • Source code size: 8.67 MB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 1.39 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 3s Average build duration of successful builds.
  • all releases: 3s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • xnorpx/rust-vmaf
    0 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • xnorpx

vmaf-head-sys

Rust FFI bindings to Netflix VMAF with vendored source code.

Overview

This crate provides low-level bindings to libvmaf, built from vendored source. It tracks VMAF master as closely as possible with frequent updates.

Features

  • Vendored source - libvmaf is compiled from source rather than discovered through pkg-config
  • Public CPU C API - bindings cover features, models, pictures, and scoring
  • Static linking - libvmaf is linked into the final binary
  • Built-in models - standard VMAF models are available by default

Requirements

Building requires:

  • Meson and Ninja
  • A C and C++ compiler
  • xxd when built-in-models is enabled
  • NASM on x86 and x86_64 platforms

CUDA is intentionally disabled. This crate binds the portable CPU API and does not expose libvmaf_cuda.h.

Cargo features

  • built-in-models - compile standard VMAF models into libvmaf (default)
  • asm - enable optional architecture-specific optimizations (default)
  • float - compile floating-point feature extractors

On x86 and x86_64, NASM support and AVX2 kernels are always built, including with --no-default-features. VMAF still uses CPUID runtime dispatch, so AVX2 instructions execute only when both the CPU and operating system support them. This avoids illegal-instruction crashes on older x86 systems.

Usage

[dependencies]
vmaf-head-sys = "0.1"

All libvmaf calls are unsafe raw FFI calls. Applications will usually want a safe wrapper around this crate.

Cross-compilation

iOS device/simulator and Android cross files are generated automatically from Cargo's target and the active SDK/NDK. Set IPHONEOS_DEPLOYMENT_TARGET to override the default iOS 12.0 deployment target. For Android, set ANDROID_NDK_HOME and optionally ANDROID_PLATFORM (default API 21), or build through cargo-ndk.

Set VMAF_MESON_CROSS_FILE to override the generated file for a custom toolchain. Set MESON or NINJA to override either build-tool executable.

CI compiles and links these mobile targets:

  • aarch64-apple-ios
  • aarch64-apple-ios-sim
  • x86_64-apple-ios
  • aarch64-linux-android (arm64-v8a)
  • armv7-linux-androideabi (armeabi-v7a)
  • x86_64-linux-android
  • i686-linux-android (x86)

For Android final binaries, c++_shared must be packaged with the application. With cargo-ndk and NDK r29, use:

cargo ndk --platform 24 --target arm64-v8a \
	--link-builtins --link-libcxx-shared build

Vendored Version

The vendored VMAF source is tracked in vendored/VMAF_VERSION. Run the update script to sync with upstream:

python vendor_vmaf.py

Regenerate bindings without downloading VMAF:

python vendor_vmaf.py --bindings-only

License

The Rust bindings are licensed under either MIT or Apache-2.0, at your option.

The vendored VMAF source is licensed under BSD-2-Clause-Patent. See NOTICE and vendored/vmaf/LICENSE.