The fastest and safest AV1 encoder.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Josh Holmer c8ca08c77c
Bump dependencies (#1563)
17 hours ago
.travis Travis cleanup (#1556) 1 day ago
benches Improve formatting in a couple of places 3 days ago
crates Format code 3 days ago
data Preparation for encode-decode tests 1 year ago
doc Add the debug symbols on release and document how to profile (#1512) 2 weeks ago
examples Format code 3 days ago
ivf Format code 3 days ago
src Wrap ParseIntError for quantizer 21 hours ago
tools Search 16×16 full-res MVs in lookahead 3 days ago
.editorconfig Add max_line_length into .editorconfig 1 month ago
.gitignore Add extra CLI opts in AWCY script 6 months ago
.gitlab-ci.yml Add check_asm feature 2 weeks ago
.mailmap Add .mailmap 8 months ago
.travis.yml Travis cleanup (#1556) 1 day ago
Cargo.toml Bump dependencies (#1563) 17 hours ago
LICENSE Update license date to 2019 2 months ago
PATENTS Initial commit 1 year ago
README.md Update code formatting part in the README 3 days ago
appveyor.yml CI: Update AppVeyor to Visual Studio 2019 2 months ago
build.rs Format code 3 days ago
build.sh Fix associativity in build.sh desync check 5 months ago
cbindgen.toml Make rav1e CAPI cargo-c buildable 1 month ago
clippy.toml Implement quick and dirty simd intrinsics for sgr 2 weeks ago
license_template.txt Enable code formatting. 1 year ago
rustfmt.toml Update rustfmt.toml 2 weeks ago

README.md

rav1e Travis Build Status AppVeyor Build Status Coverage Status

The fastest and safest AV1 encoder.

Overview

rav1e is an experimental AV1 video encoder. It is designed to eventually cover all use cases, though in its current form it is most suitable for cases where libaom (the reference encoder) is too slow.

Features

  • Intra and inter frames
  • 64x64 superblocks
  • 4x4 to 64x64 RDO-selected square and 2:1/1:2 rectangular blocks
  • DC, H, V, Paeth, smooth, and a subset of directional prediction modes
  • DCT, ADST and identity transforms (up to 64x64, 16x16 and 32x32 respectively)
  • 8-, 10- and 12-bit depth color
  • 4:2:0 (full support), 4:2:2 and 4:4:4 (limited) chroma sampling
  • Variable speed settings
  • Near real-time encoding at high speed levels

Releases

For the foreseeable future, a weekly pre-release of rav1e will be published every Tuesday.

Windows builds

Automated AppVeyor builds can be found here. Click on a build (it is recommended you select a build based on “master”), then click ARTIFACTS to reveal the rav1e.exe download link.

Building

rav1e can optionally use either libaom (default) or a dav1d installation to run some extended tests. Some x86_64-specific optimizations require a recent version of NASM.

In order to build, test and link to the codec on UNIX, you need Perl, NASM, CMake, Clang and pkg-config. To install this on Ubuntu or Linux Mint, run:

sudo apt install perl nasm cmake clang pkg-config

On Windows, pkg-config is not required. A Perl distribution such as Strawberry Perl, CMake, and a NASM binary in your system PATH are required.

To build release binary in target/release/rav1e run:

cargo build --release

Building the C-API

rav1e provides a C-compatible set of library, header and pkg-config file.

To build and install it you can use cargo-c:

cargo install cargo-c
cargo cinstall --release

Compressing video

Input videos must be in y4m format and have 4:2:0 chroma subsampling.

cargo run --release --bin rav1e -- input.y4m -o output.ivf

Decompressing video

Encoder output should be compatible with any AV1 decoder compliant with the v1.0.0 specification. You can build compatible aomdec using the following:

mkdir aom_test
cd aom_test
cmake /path/to/aom -DAOM_TARGET_CPU=generic -DCONFIG_AV1_ENCODER=0 -DENABLE_TESTS=0 -DENABLE_DOCS=0 -DCONFIG_LOWBITDEPTH=1
make -j8
./aomdec ../output.ivf -o output.y4m

Configuring

rav1e has several optional features that can be enabled by passing --features to cargo test. Passing --all-features is discouraged.

  • nasm - enabled by default. When enabled, assembly is built for x86_64.

Using the AOMAnalyzer

Local Analyzer

  1. Download the AOM Analyzer.
  2. Download inspect.js and inspect.wasm and save them in the same directory.
  3. Run the analyzer: AOMAnalyzer path_to_inspect.js output.ivf

Online Analyzer

If your .ivf file is hosted somewhere (and CORS is enabled on your web server) you can use:

https://arewecompressedyet.com/analyzer/?d=https://people.xiph.org/~mbebenita/analyzer/inspect.js&f=path_to_output.ivf

Design

  • src/context.rs - High-level functions that write symbols to the bitstream, and maintain context.
  • src/ec.rs - Low-level implementation of the entropy coder, which directly writes the bitstream.
  • src/lib.rs - The top level library, contains code to write headers, manage buffers, and iterate through each superblock.
  • src/partition.rs - Functions and enums to manage partitions (subdivisions of a superblock).
  • src/predict.rs - Intra prediction implementations.
  • src/quantize.rs - Quantization and dequantization functions for coefficients.
  • src/rdo.rs - RDO-related structures and distortion computation functions.
  • src/transform/*.rs - Implementations of DCT and ADST transforms.
  • src/util.rs - Misc utility code.
  • src/bin/rav1e.rs - rav1e command line tool.
  • src/bin/rav1erepl.rs - Command line tool for debugging.

Contributing

Toolchain

rav1e uses the stable version of Rust (the stable toolchain).

To install the toolchain:

rustup install stable

Coding style

Format code with rustfmt 1.3.0 and above (distributed with Rust 1.37.0 and above) before submitting a PR.

To install rustfmt:

rustup component add rustfmt

then

cargo fmt

Code Analysis

The clippy will help catch common mistakes and improve your Rust code.

We recommend you use it before submitting a PR.

To install clippy:

rustup component add clippy

then you can search “cargo clippy” in .travis.yml for detailed command and run it.

Testing

Run unit tests with:

cargo test

Encode-decode integration tests require libaom and libdav1d.

Installation on Ubuntu:

sudo apt install libaom-dev libdav1d-dev

Installation on Fedora:

sudo dnf install libaom-devel libdav1d-devel

Run encode-decode integration tests against libaom with:

cargo test --release --features=decode_test

Run the encode-decode tests against dav1d with:

cargo test --release --features=decode_test_dav1d

Run regular benchmarks with:

cargo bench --features=bench

Getting in Touch

Come chat with us on the IRC channel #daala on Freenode! If you don’t have IRC set up you can easily connect from your web browser.