forge
Explore
Log in

Don't you dare go Hollow

edith_codecs

Clone
★ 0

0 watching0 forksRust370.3 MiBba75450Tahinli5 days ago3985 commits

h264-bd.sh18 lines, 948 bytesHistoryRawDownload
1#!/usr/bin/env bash
2# h264-bd.sh: BD-rate of the Fast preset vs x264 veryfast on the 1080p library clip
3# (the h264encbd method). Run through scripts/remote-run.sh. Prints bd_rate_pct and bd_psnr_db.
4set -euo pipefail
5d=${TMPDIR:-/tmp}/h264bd.$$; mkdir -p "$d"
6EC_REQUIRE_FIXTURES=1 EC_H264_X264_PRESET=veryfast \
7EC_H264_CLIP=$HOME/fixtures/video/h264-1080p-23.976-8bit.mp4 \
8 cargo test --release -p ec-h264 --test it encode::bd_psnr_vs_x264 -- --nocapture 2>&1 | tee "$d/log" | grep -E "^(test |BD-)" || true
9python3 -I - "$d" <<'PY'
10import re,sys
11d=sys.argv[1]
12o=open(d+"/ours.tsv","w"); x=open(d+"/x264.tsv","w")
13for l in open(d+"/log"):
14 m=re.match(r"qp \d+: ours (\d+) bits ([\d.]+) dB \(([\d.]+) yuv\) \| x264 (\d+) bits ([\d.]+) dB \(([\d.]+) yuv\)",l)
15 if m:
16 o.write(f"{int(m[1])//8}\t{m[2]}\t{m[3]}\n"); x.write(f"{int(m[4])//8}\t{m[5]}\t{m[6]}\n")
17PY
18python3 -I scripts/bdrate.py --metric yuv "$d/x264.tsv" "$d/ours.tsv"