ref: dbb0bf9dcf1f302fd8b8788585994e09a89235a6
parent: 268575766d838498e36e33ae27f35abf34f0215a
author: Jean-Marc Valin <jeanmarcv@google.com>
date: Wed Jul 16 10:33:59 EDT 2025
Script to run DRED testvectors
--- /dev/null
+++ b/tests/dred_vectors.sh
@@ -1,0 +1,62 @@
+#!/bin/sh
+
+if [ "$#" -ne "2" ]; then
+ echo "usage: dred_vectors.sh <exec path> <vector path>"
+ exit 1
+fi
+
+CMD_PATH=$1
+VECTOR_PATH=$2
+
+: ${FARGAN_DEMO:=$CMD_PATH/fargan_demo}
+: ${DRED_COMPARE:=$CMD_PATH/dred_compare}
+
+if [ -d "$VECTOR_PATH" ]; then
+ echo "Test vectors found in $VECTOR_PATH"
+else
+ echo "No test vectors found"
+ #Don't make the test fail here because the test vectors
+ #will be distributed separately
+ exit 0
+fi
+
+if [ ! -x "$DRED_COMPARE" ]; then
+ echo "ERROR: Compare program not found: $DRED_COMPARE"
+ exit 1
+fi
+
+if [ -x "$FARGAN_DEMO" ]; then
+ echo "Decoding with $FARGAN_DEMO"
+else
+ echo "ERROR: Decoder not found: $FARGAN_DEMO"
+ exit 1
+fi
+
+echo "=============="
+echo "Testing DRED decoding"
+echo "=============="
+echo
+
+for i in 1 2 3 4 5 6 7 8
+do
+ if [ -e "$VECTOR_PATH/vector${i}_dred.bit" ]; then
+ echo "Testing vector${i}_dred.bit"
+ else
+ echo "Bitstream file not found: vector${i}_dred.bit"
+ fi
+ if "$FARGAN_DEMO" -dred-decoding "$VECTOR_PATH/vector${i}_dred.bit" tmp.f32 >> logs_dred_decode.txt 2>&1; then
+ echo "successfully decoded"
+ else
+ echo "ERROR: decoding failed"
+ exit 1
+ fi
+ "$DRED_COMPARE" -features -thresholds .5 .15 .02 "$VECTOR_PATH/vector${i}_dred_dec.f32" tmp.f32 >> logs_dred_decode.txt 2>&1
+ float_ret=$?
+ if [ "$float_ret" -eq "0" ] || [ "$float_ret2" -eq "0" ]; then
+ echo "output matches reference"
+ else
+ echo "ERROR: output does not match reference"
+ exit 1
+ fi
+ echo
+done
--
⑨