changeset 21:12a0c2e493c4

Two-stage decimate for factors not supported in a single stage
author Chris Cannam
date Fri, 18 Oct 2013 17:40:07 +0100
parents 7d4165ded830
children 83e285b97c01
files run-tests.sh
diffstat 1 files changed, 16 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/run-tests.sh	Fri Oct 18 17:15:54 2013 +0100
+++ b/run-tests.sh	Fri Oct 18 17:40:07 2013 +0100
@@ -46,11 +46,26 @@
     "$mydir/garage-resampler/resample" --snr 50 --bandwidth 0.05 --to "$(($original/$factor))" "$infile" "$outfile"
 }
 
+decimate_twice() {
+    first="$1"
+    second="$2"
+    infile="$3"
+    outfile="$4"
+    "$mydir/qm-dsp-decimate/decimate" --by "$first" "$infile" "$outfile".tmp
+    "$mydir/qm-dsp-decimate/decimate" --by "$second" "$outfile".tmp "$outfile"
+    rm "$outfile".tmp
+}    
+
 do_decimate() {
     factor="$1"
     infile="$2"
     outfile="$3"
-    "$mydir/qm-dsp-decimate/decimate" --by "$factor" "$infile" "$outfile"
+    case "$factor" in
+	16) decimate_twice 4 4 "$infile" "$outfile";;
+	32) decimate_twice 8 4 "$infile" "$outfile";;
+	64) decimate_twice 8 8 "$infile" "$outfile";;
+	*) "$mydir/qm-dsp-decimate/decimate" --by "$factor" "$infile" "$outfile";;
+    esac
 }
 
 mkdir -p "$mydir"/out