#!/bin/sh # run_raw12_camera.sh - camera half of docs/raw12-pipeline-measurements.md: # frame rate and streaming per format at 250 MB/s, BayerRG12p streaming while # the 12-bit pipeline runs, auto-exposure and auto white balance steps at each # format's frame rate, white balance on 12-bit raw, and frames for the # processing tests. ~25 min. Run in the working directory holding # camera_bench.py and raw12_bench, with the tower program stopped: # # nohup sh run_raw12_camera.sh results > camera.log 2>&1 & set -u R=${1:-results} L=250000000 mkdir -p "$R" PY="$HOME/.venvs/vmbpy/bin/python camera_bench.py" step() { echo "$(date +%T) $*"; } maxfps() { $PY maxfps "$1" $L 2>/dev/null | python3 -c 'import json,sys; print(json.load(sys.stdin)["max_fps"])'; } for fmt in BayerRG12p BayerRG12 BayerRG10p BayerRG8 RGB8; do $PY maxfps $fmt $L 2>/dev/null >> "$R/maxfps.jsonl" fps=$(maxfps $fmt) step "stream $fmt at $fps fps" $PY stream $fmt $L "$fps" 60 2>/dev/null >> "$R/stream.jsonl" done step "save frames" rm -rf frames for fmt in BayerRG12p BayerRG8 RGB8; do $PY save $fmt $L 1 frames 2>/dev/null >> "$R/save.jsonl" done fps=$(maxfps BayerRG12p) step "stream BayerRG12p at $fps fps while the 12-bit pipeline runs" (sleep 2; ./raw12_bench pipeline frames /tmp/r12-load c12_ea 1 4 62 0 3 1.0 > /tmp/r12-load.out 2>/dev/null) & $PY stream BayerRG12p $L "$fps" 60 2>/dev/null >> "$R/stream_under_load.jsonl" wait grep summary /tmp/r12-load.out >> "$R/stream_under_load.jsonl" rm -rf /tmp/r12-load /tmp/r12-load.out for rep in 1 2; do for fmt in BayerRG12p RGB8 BayerRG8; do fps=$(maxfps $fmt) for d in dark bright; do step "ae $fmt $fps $d (rep $rep)" $PY ae $fmt $L "$fps" $d 100 2>/dev/null >> "$R/ae.jsonl" done for k in 0.5 2; do step "awb $fmt $fps x$k (rep $rep)" $PY awb $fmt $L "$fps" $k 100 2>/dev/null >> "$R/awb.jsonl" done done done step "wb BayerRG12p" $PY wb BayerRG12p $L 2>/dev/null >> "$R/wb.jsonl" step done