forge
Explore
Log in

Don't you dare go Hollow

aac-tables: drop make-heaac-fixtures.sh (FATE media replace it); he/ps scripts use EC_FFMPEG pinned bundle

Browse files at this commit

0e512e68375fb24651e885f631aae0ad5577537eAhmet Kaan GümüşParent: ae25726
scripts/aac-tables/make-he-fixtures.shmodified+1 -1
@@ -12,7 +12,7 @@ LIBDIR=${1:-}; OUT=$2; mkdir -p "$OUT"
12 if [ -n "$LIBDIR" ]; then12 if [ -n "$LIBDIR" ]; then
13 export LD_LIBRARY_PATH="$LIBDIR${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"13 export LD_LIBRARY_PATH="$LIBDIR${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"
14 fi14 fi
15-FF="ffmpeg -v error -y -hide_banner"15+FF="${EC_FFMPEG:-$HOME/.cache/ec-ffmpeg/ffmpeg} -v error -y -hide_banner"
16 RATE=2205016 RATE=22050
17 17
18 # Mono: a tone plus a chirp (the chirp exercises the SBR patch range), with pink noise above it.18 # Mono: a tone plus a chirp (the chirp exercises the SBR patch range), with pink noise above it.
scripts/aac-tables/make-heaac-fixtures.shdeleted+0 -67
@@ -1,67 +0,0 @@
1-#!/usr/bin/env bash
2-# Deterministic HE-AAC v1 fixture matrix for tests/sbr_real_library.rs's
3-# `synthetic_heaac_matrix`: two sample-rate families (48000, 44100) x four
4-# bitrates (32k/48k/64k/96k) x two profiles (aac_he, aac_low control) = 16
5-# .m4a files, sweeping the SBR crossover (kx/k2) that bitrate controls
6-# without depending on any one real file's content.
7-#
8-# `ffmpeg`'s system libfdk_aac (the `fdk-aac-free` package) has SBR/PS
9-# encoding compiled out (patent-restricted tools) -- `-profile:a aac_he`
10-# fails with "Unable to set the AOT 5: Invalid config" against it. RPM
11-# Fusion's full `fdk-aac` package carries the SBR-capable encoder but
12-# installs to its OWN /usr/lib64/fdk-aac dir specifically so it doesn't
13-# clobber the system one; this script fetches (no root) and extracts just
14-# that .so into a local cache and points ffmpeg at it via
15-# LD_LIBRARY_PATH for the encode step only, never touching the system
16-# library.
17-set -euo pipefail
18-
19-SCRATCH="${EC_AAC_HEAAC_FIXTURES:-$(cd "$(dirname "$0")/../.." && pwd)/.cache/heaac-fixtures}"
20-mkdir -p "$SCRATCH"
21-CACHE="$SCRATCH/.fdk-aac-full"
22-mkdir -p "$CACHE"
23-
24-fdk_libdir="$CACHE/usr/lib64/fdk-aac"
25-if [ ! -f "$fdk_libdir/libfdk-aac.so.2" ]; then
26- echo "fetching SBR-capable libfdk-aac (no root, local cache only)..."
27- ( cd "$CACHE" && dnf download fdk-aac.x86_64 )
28- rpm_file=$(find "$CACHE" -maxdepth 1 -name 'fdk-aac-*.rpm' | head -1)
29- ( cd "$CACHE" && rpm2cpio "$rpm_file" | cpio -idm --quiet )
30-fi
31-export LD_LIBRARY_PATH="$fdk_libdir${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"
32-
33-# Three summed sweeps 100 Hz -> 18 kHz over the full 30 s (phase(t) =
34-# 2*pi*(f0*t + (f1-f0)/(2T)*t^2), f0=100 f1=18000 T=30 ->
35-# (f1-f0)/(2T)=298.333), offset in phase per partial and per channel so
36-# left/right are correlated but not identical -- plus low-level pink noise
37-# (seeded, so every run of this script reproduces bit-identical fixtures).
38-sweep() { echo "0.15*sin(2*PI*(100*t+298.333*t*t)+$1)+0.15*sin(2*PI*(100*t+298.333*t*t)+$2)+0.15*sin(2*PI*(100*t+298.333*t*t)+$3)"; }
39-L=$(sweep 0 1.047 2.094)
40-R=$(sweep 0.5 1.571 2.618)
41-
42-synth_source() {
43- local rate=$1 out=$2
44- ffmpeg -y -hide_banner -loglevel error -filter_complex "
45- aevalsrc=exprs='${L}|${R}':channel_layout=stereo:sample_rate=${rate}:duration=30 [tone];
46- anoisesrc=color=pink:amplitude=0.05:seed=42:sample_rate=${rate}:duration=30 [n0];
47- anoisesrc=color=pink:amplitude=0.05:seed=43:sample_rate=${rate}:duration=30 [n1];
48- [n0][n1] amerge=inputs=2 [noise];
49- [tone][noise] amix=inputs=2:normalize=0 [out]
50- " -map "[out]" -ar "$rate" -sample_fmt s16 -f wav "$out"
51-}
52-
53-for rate in 48000 44100; do
54- src="$SCRATCH/src_${rate}.wav"
55- [ -f "$src" ] || synth_source "$rate" "$src"
56- for br in 32k 48k 64k 96k; do
57- he="$SCRATCH/heaac_${rate}_${br}.m4a"
58- lc="$SCRATCH/lc_${rate}_${br}.m4a"
59- [ -f "$he" ] || ffmpeg -y -hide_banner -loglevel error -i "$src" \
60- -c:a libfdk_aac -profile:a aac_he -b:a "$br" "$he"
61- [ -f "$lc" ] || ffmpeg -y -hide_banner -loglevel error -i "$src" \
62- -c:a libfdk_aac -profile:a aac_low -b:a "$br" "$lc"
63- done
64-done
65-
66-echo "fixtures in $SCRATCH:"
67-ls "$SCRATCH"/*.m4a
scripts/aac-tables/make-ps-fixtures.shmodified+1 -1
@@ -8,7 +8,7 @@
8 set -euo pipefail8 set -euo pipefail
9 LIBDIR=$1; OUT=$2; mkdir -p "$OUT"9 LIBDIR=$1; OUT=$2; mkdir -p "$OUT"
10 export LD_LIBRARY_PATH="$LIBDIR${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"10 export LD_LIBRARY_PATH="$LIBDIR${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"
11-FF="ffmpeg -v error -y -hide_banner"11+FF="${EC_FFMPEG:-$HOME/.cache/ec-ffmpeg/ffmpeg} -v error -y -hide_banner"
12 for rate in 44100 48000; do12 for rate in 44100 48000; do
13 # Sine pair: distinct tones per channel (strong, simple PS content).13 # Sine pair: distinct tones per channel (strong, simple PS content).
14 $FF -f lavfi -i "sine=440:d=2:r=$rate" -f lavfi -i "sine=660:d=2:r=$rate" \14 $FF -f lavfi -i "sine=440:d=2:r=$rate" -f lavfi -i "sine=660:d=2:r=$rate" \