| 1 | |
| 2 | |
| 3 | |
| 4 | set -euo pipefail |
| 5 | d=${TMPDIR:-/tmp}/h264bd.$$; mkdir -p "$d" |
| 6 | EC_REQUIRE_FIXTURES=1 EC_H264_X264_PRESET=veryfast \ |
| 7 | EC_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 |
| 9 | python3 -I - "$d" <<'PY' |
| 10 | import re,sys |
| 11 | d=sys.argv[1] |
| 12 | o=open(d+"/ours.tsv","w"); x=open(d+"/x264.tsv","w") |
| 13 | for 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") |
| 17 | PY |
| 18 | python3 -I scripts/bdrate.py --metric yuv "$d/x264.tsv" "$d/ours.tsv" |