Optimization: rav1d decoder performance
Close the decode-performance gap between the memory-safe Rust AV1 decoder and its hand-optimized C original.
The task
The agent gets the rav1d checkout at the bounty's baseline version with a release build, the dav1d reference, the four official benchmark inputs, and profiling tools. It may change Rust source, Cargo configuration, compiler flags, or the toolchain itself.
The bounty's rules carry over as hard constraints. No new assembly, C, or native code (the kernels stay frozen). No calling into the C reference. No benchmark-specific fast paths or hard-coded outputs. And the total number of unsafe tokens in the Rust source may not increase.
Background
dav1d is the fastest AV1 video decoder in the world, built from a decade of hand-written assembly. rav1d is its memory-safe Rust port, and in 2025 its maintainers ran a public performance bounty because the port decoded a few percent slower than the C original. The gap was pure Rust-side overhead: both decoders share the same assembly kernels, so whatever separated them lived in the code around the kernels, the build, and the toolchain.
That is what makes the problem a clean optimization task. The ceiling is known to be reachable, the constraint set is principled (the whole point of rav1d is memory safety), and progress is measured the way decoder performance is actually measured: wall time on real video.
Evaluation
Correctness is a gate: every timed run decodes a verifier-private range of each input and the MD5 of the decoded pixels must match both trusted implementations. A failing executable scores zero.
Passing submissions are timed against a freshly built pristine rav1d and dav1d on the same host: four inputs (Chimera 1080p in 8-bit and 10-bit, Summer Nature in 1080p and 4K), each single-threaded and eight-threaded, eight equally weighted cases with warmed, order-shuffled paired runs. The score is a sigmoid of the candidate-to-dav1d wall-time ratio: dav1d parity scores 0.5, decoding in 5% less wall time scores 0.75, and 5% more scores 0.25.
Results
The graded runs converged on treating the build as part of the program. They ran instrumented decoders to generate profile-guided-optimization data across bit depths, resolutions, and thread counts. They targeted codegen at the host. Most checked a profile in so that a plain release build reproduces the shipped binary.
The strongest run pushed past the build into the decoder itself. It pooled motion-vector and segmentation-map buffers the way dav1d does and cut atomic traffic in the task scheduler. It decoded close to seven percent faster than dav1d, from a port that starts about three percent behind. Every run that cleared the source audit finished ahead of the C decoder, though the more conservative ones led by only a percent or two.
The unsafe budget held everywhere. The one run the audit zeroed did not ship a slow decoder. It committed a rule violation: a profiling-corpus script that defaulted to the reference decoder's location on disk. The audit zeroes any submission that adds a reference to it.