#!/bin/sh # run_camera_tests.sh - the camera half of docs/camera-capture-measurements.md: # streaming per format and link limit, streaming while encoding, the # auto-exposure step test and white balance on raw. ~25 min. Run in ~/fgc-bench # with the tower program stopped and `bench` built (README), then # `camera_bench.py restore ` and restart the program: # # nohup sh run_camera_tests.sh results > camera.log 2>&1 & # # The frame rate for each run is the camera's own maximum, read first. set -u R=${1:-results} mkdir -p "$R" PY="$HOME/.venvs/vmbpy/bin/python camera_bench.py" step() { echo "$(date +%T) $*"; } maxfps() { $PY maxfps "$1" "$2" 2>/dev/null | python3 -c 'import json,sys; print(json.load(sys.stdin)["max_fps"])'; } for lim in 200000000 250000000 450000000; do for fmt in BayerRG8 BayerRG12p RGB8; do fps=$(maxfps $fmt $lim) step "stream $fmt $lim at $fps fps" $PY stream $fmt $lim "$fps" 60 2>/dev/null >> "$R/stream.jsonl" done done step "save frames" for fmt in BayerRG8 BayerRG12p RGB8; do $PY save $fmt 250000000 1 frames 2>/dev/null >> "$R/save.jsonl" done for cfg in "BayerRG8 450000000" "BayerRG8 250000000" "RGB8 250000000"; do set -- $cfg fps=$(maxfps "$1" "$2") step "stream $1 $2 at $fps fps while encoding" (sleep 2; ./bench load frames /tmp/bench-load 62 > /tmp/bench-load.out 2>/dev/null) & $PY stream "$1" "$2" "$fps" 60 2>/dev/null >> "$R/stream_under_load.jsonl" wait cat /tmp/bench-load.out >> "$R/stream_under_load.jsonl" done fast=$(maxfps BayerRG8 450000000) mid=$(maxfps BayerRG8 250000000) slow=$(maxfps RGB8 250000000) for rep in 1 2; do for a in "450000000 $fast" "250000000 $mid" "250000000 $slow"; do for d in dark bright; do step "ae BayerRG8 $a $d" $PY ae BayerRG8 $a $d 100 2>/dev/null >> "$R/ae.jsonl" done done done for d in dark bright; do step "ae BayerRG8 rate 50 $d" $PY ae BayerRG8 250000000 "$mid" $d 50 2>/dev/null >> "$R/ae.jsonl" done for fmt in BayerRG8 RGB8; do step "wb $fmt" $PY wb $fmt 250000000 2>/dev/null >> "$R/wb.jsonl" done step done