Skip to content

Repository files navigation

Vvpx - CMake Build Wrapper for libvpx

build

AI slop CMake build wrapper for libvpx, the WebM VP8/VP9 SDK.

Uses ShiftMediaProject's libvpx fork as a submodule, providing pre-configured source lists and RTCD headers.

WARNING: AI slop head. Don't use this. It's a mess. May be really buggy.

Why This Exists

libvpx's official build system uses a custom configure script and Makefiles. This project wraps it in CMake for easy integration into CMake-based projects.

Supported Platforms

Platform Architecture Compiler SIMD Optimisations
Windows x64 MSVC SSE2/SSE3/SSSE3/SSE4.1/AVX/AVX2 via NASM
Linux x64 GCC/Clang SSE2/SSE3/SSSE3/SSE4.1/AVX/AVX2 via NASM
macOS ARM64 (Apple Silicon) Clang ARM NEON intrinsics
macOS x64 (Intel, incl. cross-compiled from Apple Silicon) Clang SSE2/SSE3/SSSE3/SSE4.1/AVX/AVX2 via NASM

Cross-compiling macOS x64 from an Apple Silicon host works via -DCMAKE_OSX_ARCHITECTURES=x86_64 (NASM required, see Prerequisites). Fat/universal binaries are not supported directly - build each arch separately and lipo them together.

Not Supported

  • 32-bit x86 - 64-bit only
  • Fat/universal macOS binaries - build one arch at a time and lipo together
  • ARM Linux/Windows - Untested, may work with generic C path

Features

All VP8/VP9 codec features enabled:

  • VP8 & VP9 encoder/decoder
  • VP9 high bit depth (10/12-bit)
  • Multithreading
  • Postprocessing

Quick Start

Windows

NASM is bundled - just build:

git clone --recursive https://github.com/hypernewbie/vvpx
cd vvpx
cmake -B build
cmake --build build --config Release

Linux / macOS

Ninja is recommended for faster builds:

# Install NASM (Linux and macOS Intel; not needed on macOS Apple Silicon)
sudo apt install nasm  # Debian/Ubuntu
# or: sudo dnf install nasm  # Fedora
# or: brew install nasm  # macOS

git clone --recursive https://github.com/hypernewbie/vvpx
cd vvpx
cmake -B build -G Ninja
ninja -C build

Make also works: cmake -B build && make -C build -j$(nproc)

Cross-compiling macOS x64 from Apple Silicon

brew install nasm
cmake -B build_x64 -G Ninja -DCMAKE_OSX_ARCHITECTURES=x86_64
ninja -C build_x64
lipo -info build_x64/libvpx.a  # -> x86_64

The resulting decode_test/ivf_format_test binaries are x86_64 and run transparently under Rosetta on Apple Silicon hosts. A plain cmake -B build (no CMAKE_OSX_ARCHITECTURES) continues to target the host arch natively, including NEON on Apple Silicon.

CMake Options

Option Default Description
BUILD_SHARED_LIBS OFF Build shared library instead of static

Prerequisites

  • CMake 3.21+
  • Windows: NASM included in tools/ (no install needed)
  • Linux: apt install nasm or dnf install nasm (optional - falls back to generic C with a warning if missing)
  • macOS ARM64 (Apple Silicon): No NASM needed (uses NEON intrinsics)
  • macOS x64 (Intel, native or cross-compiled): NASM required (brew install nasm) - the generic-C fallback is unsupported on this platform and the configure step fails without it

Build Modes

NASM Available Sources SIMD Performance
✅ Yes (x86_64) 234 C + 49 ASM Full SSE2/AVX/AVX2 Fast
❌ No (x86_64, Linux only) 166 C (generic) None Slower
N/A (ARM64) 166 C + 95 SIMD ARM NEON Fast

On macOS x86_64, missing NASM is a hard configure-time error rather than a fallback (see Caveats below) - Linux x86_64 is the only x86_64 platform where the no-NASM path is supported.

Caveats (No NASM)

When building without NASM on Linux x86_64:

  • The library uses generic C fallbacks (same as ARM)
  • version_test works (confirms library builds correctly)
  • decode_test is not built (libvpx RTCD has internal SIMD dependencies)
  • For full decode functionality, install NASM

On macOS x86_64, this fallback is not offered: cmake fails at configure time with a message to brew install nasm, since the generic-C RTCD init issue above is unresolved and would silently ship a build that can't decode.

Usage

As a Subdirectory

add_subdirectory(vvpx)
target_link_libraries(your_app PRIVATE vpx)

Include Paths

#include "vpx/vpx_decoder.h"
#include "vpx/vp8dx.h"  // VP8 decoder interface
#include "vpx/vpx_encoder.h"
#include "vpx/vp8cx.h"  // VP8/VP9 encoder interface

Testing

Tests use the IVF container format:

  • Simple header + raw VP8/VP9 frames
  • ffmpeg can output IVF: ffmpeg -i input.mp4 -c:v libvpx-vp9 output.ivf
  • No WebM IO dependency required for tests

Project Structure

vvpx/
├── CMakeLists.txt           # Main build file
├── cmake/
│   ├── VpxSources.cmake     # x86_64 source list
│   ├── VpxSourcesArm.cmake  # ARM64 source list (generic C)
│   ├── VpxConfig.cmake      # Platform detection
│   └── VpxAssembly.cmake    # NASM/YASM setup
├── config/
│   ├── win_x64/             # Windows x64 headers
│   ├── linux_x64/           # Linux x64 headers
│   ├── macos_arm64/         # macOS ARM64 headers (generic C, no NEON)
│   ├── macos_arm64_neon/    # macOS ARM64 headers (NEON intrinsics)
│   └── macos_x64/           # macOS x64 headers (Intel, native or cross-compiled)
├── tools/
│   └── nasm-3.01/           # Bundled NASM for Windows
├── scripts/
│   ├── extract_sources.py   # Extract sources from SMP
│   └── gen_rtcd_arm.py      # Generate ARM RTCD headers
├── test/
│   └── version_test.c       # Basic link test
└── libvpx/                  # Submodule (ShiftMediaProject)

Future Work

32-bit Support

Credits

Licence

libvpx is BSD-licensed. See libvpx/LICENSE for details.

Contributors

Languages