blob: 997c06781c52ea860b58fd1907b165d71c6e350b [file] [log] [blame]
#!/bin/sh
#
# Runs all encoding tests that have not been run, or are missing data.
#
# Argument: Filenames.
set -e
for sourcefile in $@; do
# filename format: <path>/<clip_name>_<width>_<height>_<frame_rate>.yuv
pathless=$(basename ${sourcefile})
clip_stem=${pathless%.*}
part=($(echo $clip_stem | tr "_" "\n"))
width=${part[1]}
height=${part[2]}
frame_rate=${part[3]}
echo "Clip $clip_stem"
# Detecting test dirs by looking for the file name "measurer". Somewhat
# fragile.
for measurer in */*/measurer; do
dir=$(dirname $measurer)
echo "Settings $dir"
encoded=0
results=0
for result in $(ls $dir/$clip_stem.* 2>/dev/null); do
case $result in
*.results)
results=1
;;
*.webm)
encoded=1
;;
*.mkv)
encoded=1
;;
*)
echo "What is $result doing here?"
esac
done
if [ $encoded == 0 ]; then
(cd $dir; ./encoder ../../$sourcefile $frame_rate $width $height)
else
echo "Already encoded $clip_stem"
fi
if [ $results == 0 ]; then
(cd $dir; ./measurer ../../$sourcefile $frame_rate $width $height)
else
echo "Known results for $clip_stem"
fi
done
done