forge
Explore
Log in

Don't you dare go Hollow

edith_codecs

Clone
★ 0

0 watching0 forksRust370.3 MiB552edc4Tahinli2 months ago2048 commits

build-aom-affine-oracle.sh48 lines, 1.8 KiBHistoryRawDownload
1#!/usr/bin/env bash
2# Provision an aomenc that can emit AFFINE global motion.
3#
4# Stock libaom NEVER writes a 6-parameter (AFFINE) global-motion model: its
5# encoder-side model search is pinned to ROTZOOM,
6#
7# av1/encoder/global_motion_facade.c:24
8# #define FIRST_GLOBAL_TRANS_TYPE ROTZOOM
9# #define LAST_GLOBAL_TRANS_TYPE ROTZOOM
10#
11# so no `--enable-global-motion=1` recipe over any content can produce the
12# AFFINE case the decoder must still handle (the *bitstream* allows it, the
13# spec's `global_motion_params` reads 6 params, and ffmpeg decodes it). This
14# builds a side copy of the oracle source with that search range widened to
15# AFFINE -- decode-normative output, still ordinary libaom, still verified
16# against ffmpeg -- into its own prefix so the shared oracle at
17# ~/.cache/aom-oracle (used by every other gate) is untouched.
18#
19# Used by the `a_real_affine_global_motion_stream_decodes_pixel_exact` gate in
20# crates/ec-av1/src/stream.rs.
21set -euo pipefail
22
23ROOT="${AOM_AFFINE_ROOT:-$HOME/.cache/aom-affine}"
24ORACLE_SRC="${AOM_ORACLE_ROOT:-$HOME/.cache/aom-oracle}/src"
25SRC="$ROOT/src"
26BUILD="$ROOT/build"
27
28if [ ! -d "$ORACLE_SRC/.git" ]; then
29 echo "no oracle source at $ORACLE_SRC -- run scripts/build-aom-oracle.sh first" >&2
30 exit 1
31fi
32
33if [ ! -d "$SRC" ]; then
34 mkdir -p "$ROOT"
35 cp -a "$ORACLE_SRC" "$SRC"
36fi
37
38facade="$SRC/av1/encoder/global_motion_facade.c"
39sed -i 's/^#define LAST_GLOBAL_TRANS_TYPE ROTZOOM$/#define LAST_GLOBAL_TRANS_TYPE AFFINE/' "$facade"
40grep -q '^#define LAST_GLOBAL_TRANS_TYPE AFFINE$' "$facade" ||
41 { echo "patch did not apply to $facade" >&2; exit 1; }
42
43cmake -S "$SRC" -B "$BUILD" -G Ninja \
44 -DCMAKE_BUILD_TYPE=Release \
45 -DENABLE_TESTS=0 -DENABLE_DOCS=0 -DENABLE_EXAMPLES=1
46ninja -C "$BUILD" aomenc
47
48echo "affine-capable encoder ready: $BUILD/aomenc"