forge
Explore
Log in

Don't you dare go Hollow

edith_codecs

Clone
★ 0

0 watching0 forksRust370.3 MiBcbbd6e2Tahinli2 months ago2369 commits

build-aom-oracle.sh56 lines, 2.3 KiBHistoryRawDownload
1#!/usr/bin/env bash
2# Provision the libaom oracle the ec-av1 gates and every decode-verification
3# claim depend on: the C source (read as ground truth) plus aomenc/aomdec.
4#
5# It lives under ~/.cache, NOT /tmp: on 2026-08-30 a tmpfs reclaim wiped
6# /tmp/libaom-src and all 20 aomenc gates in crates/ec-av1/src/stream.rs
7# started SKIPping, leaving a green-but-vacuous suite. Re-run this whenever
8# `cargo test -p ec-av1` prints "SKIP ...: no aomenc at ...".
9#
10# Needs an assembler (nasm or yasm) for the SIMD build. Without one it falls
11# back to AOM_TARGET_CPU=generic (C only) automatically -- decode is normative
12# so aomdec stays bit-exact either way, but encode is slower, which matters
13# because every gate shells out to aomenc 40 times. Install nasm for speed.
14set -euo pipefail
15
16VERSION="${AOM_VERSION:-v3.13.3}"
17ROOT="${AOM_ORACLE_ROOT:-$HOME/.cache/aom-oracle}"
18SRC="$ROOT/src"
19BUILD="$ROOT/build"
20
21if [ ! -d "$SRC/.git" ]; then
22 git clone --depth 1 --branch "$VERSION" https://aomedia.googlesource.com/aom "$SRC"
23fi
24
25# A cmake build tree bakes in its own absolute path and its source's, so a
26# build dir that was produced elsewhere and then moved cannot regenerate
27# (`ninja: error: rebuilding build.ninja`) -- which silently costs you the
28# ability to re-instrument aomdec later. Never stage a build under one name
29# and rename it; configure it where it will live. If the cache disagrees with
30# where we are now, drop it and reconfigure in place.
31if [ -f "$BUILD/CMakeCache.txt" ] &&
32 ! grep -q "^CMAKE_HOME_DIRECTORY:INTERNAL=$SRC$" "$BUILD/CMakeCache.txt"; then
33 echo "build tree was configured for a different path -- reconfiguring in place" >&2
34 rm -f "$BUILD/CMakeCache.txt"
35 rm -rf "$BUILD/CMakeFiles"
36fi
37
38CPU_ARGS=()
39if [ -n "${AOM_TARGET_CPU:-}" ]; then
40 CPU_ARGS=(-DAOM_TARGET_CPU="$AOM_TARGET_CPU")
41elif ! command -v nasm >/dev/null && ! command -v yasm >/dev/null; then
42 echo "no nasm/yasm found -- falling back to the C-only (generic) build" >&2
43 CPU_ARGS=(-DAOM_TARGET_CPU=generic)
44fi
45
46cmake -S "$SRC" -B "$BUILD" -G Ninja \
47 -DCMAKE_BUILD_TYPE=Release \
48 -DENABLE_TESTS=0 -DENABLE_DOCS=0 -DENABLE_EXAMPLES=1 \
49 -DCONFIG_INSPECTION=1 \
50 "${CPU_ARGS[@]}"
51ninja -C "$BUILD" aomenc aomdec
52
53echo "oracle ready:"
54echo " source $SRC"
55echo " aomenc $BUILD/aomenc"
56echo " aomdec $BUILD/aomdec"