13 printf "Usage: %s [-d dav1d] [-a argondir] [-g \$filmgrain] [-c \$cpumask] [-t threads] [-j jobs] [DIRECTORY]...\n" "$NAME"
14 printf "Example: %s -d /path/to/dav1d -a /path/to/argon/ -g 0 -c avx2 profile0_core\n" "$NAME"
15 printf "Used to verify that dav1d can decode the Argon AV1 test vectors correctly.\n\n"
16 printf " DIRECTORY one or more dirs in the argon folder to check against\n"
17 printf " (default: everything except large scale tiles and stress files)\n"
18 printf " -d dav1d path to dav1d executable (default: tools/dav1d)\n"
19 printf " -a dir path to argon dir (default: 'tests/argon' if found; '.' otherwise)\n"
20 printf " -g \$num enable filmgrain (default: 1)\n"
21 printf " -c \$mask use restricted cpumask (default: -1)\n"
22 printf " -t \$num number of threads per dav1d (default: 0)\n"
23 printf " -j \$num number of parallel dav1d processes (default: 1)\n\n"
29 printf "\033[1;91m%s\033[0m\n" "$*" >&2
34 printf "\033[1K\rMismatch in %s\n" "$1"
41 for p
in "${pids[@]}"; do
42 if kill -0 "$p" 2>/dev
/null
; then
48 pids
=("${new_pids[@]}")
53 for p
in "${pid_list[@]}"; do
55 local file_varname
="file$p"
56 fail
"${!file_varname}"
62 while [ ${#pids[@]} -ge "$JOBS" ]; do
64 if [ ${#done_pids} -eq 0 ]; then
67 wait_pids
"${done_pids[@]}"
73 wait_pids
"${pids[@]}"
77 tests_dir
=$
(dirname "$(readlink -f "$0")")
78 if [ -d "$tests_dir/argon" ]; then
79 ARGON_DIR
="$tests_dir/argon"
82 while getopts ":d:a:g:c:t:j:" opt
; do
103 printf "Error! Invalid option: -%s\n" "$OPTARG" >&2
113 if [ "$#" -eq 0 ]; then
114 # Everything except large scale tiles and stress files.
115 dirs=("$ARGON_DIR/profile0_core" "$ARGON_DIR/profile0_core_special"
116 "$ARGON_DIR/profile0_not_annexb" "$ARGON_DIR/profile0_not_annexb_special"
117 "$ARGON_DIR/profile1_core" "$ARGON_DIR/profile1_core_special"
118 "$ARGON_DIR/profile1_not_annexb" "$ARGON_DIR/profile1_not_annexb_special"
119 "$ARGON_DIR/profile2_core" "$ARGON_DIR/profile2_core_special"
120 "$ARGON_DIR/profile2_not_annexb" "$ARGON_DIR/profile2_not_annexb_special"
121 "$ARGON_DIR/profile_switching")
123 mapfile
-t dirs < <(printf "${ARGON_DIR}/%s\n" "$@" |
sort -u)
126 ver_info
="dav1d $("$DAV1D" -v 2>&1) filmgrain=$FILMGRAIN cpumask=$CPUMASK" || error
"Error! Can't run $DAV1D"
129 for d
in "${dirs[@]}"; do
130 if [ -d "$d/streams" ]; then
131 files
+=("${d/%\//}"/streams
/*.obu
)
135 if [ ${#files[@]} -eq 0 ]; then
136 error
"Error! No files found at ${dirs[*]}"
141 for i
in "${!files[@]}"; do
143 if [ "$FILMGRAIN" -eq 0 ]; then
144 md5
=${f/\/streams\//\/md5_no_film_grain\/}
146 md5
=${f/\/streams\//\/md5_ref\/}
148 md5
=$
(<"${md5/%obu/md5}") || error "Error! Can't read md5 ${md5} for file ${f}"
151 printf "\033[1K\r[%3d%% %d/%d] Verifying %s" "$(((i+1)*100/${#files[@]}))" "$((i+1))" "${#files[@]}" "$f"
152 cmd
=("$DAV1D" -i "$f" --filmgrain "$FILMGRAIN" --verify "$md5" --cpumask "$CPUMASK" --threads "$THREADS" -q)
153 if [ "$JOBS" -gt 1 ]; then
154 "${cmd[@]}" 2>/dev
/null
&
160 if ! "${cmd[@]}" 2>/dev
/null
; then
168 if [ "$failed" -ne 0 ]; then
169 printf "\033[1K\r%d/%d files \033[1;91mfailed\033[0m to verify" "$failed" "${#files[@]}"
171 printf "\033[1K\r%d files \033[1;92msuccessfully\033[0m verified" "${#files[@]}"
173 printf " in %dm%ds (%s)\n" "$((SECONDS/60))" "$((SECONDS%60))" "$ver_info"