summaryrefslogtreecommitdiffstats
path: root/contrib
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2014-05-08 19:18:01 +0200
committerHarald Welte <laforge@gnumonks.org>2014-05-08 19:18:01 +0200
commit7a04624563ac72b7237e39d6fcee5dab96f4d948 (patch)
treee97aa7567abe2c3f205c327ff3ef5d5d160fbd2e /contrib
parent8b5e0c7b81cba9f064bed97dc743e5a9a13818f1 (diff)
Add cycle benchmarking support
This enables benchmarking of the codec. It will print the amount of CPU cycles needed for encoding/decoding a single 20ms frame on average.
Diffstat (limited to 'contrib')
-rwxr-xr-xcontrib/benchmark.sh17
-rwxr-xr-xcontrib/gen_testdata.sh12
2 files changed, 29 insertions, 0 deletions
diff --git a/contrib/benchmark.sh b/contrib/benchmark.sh
new file mode 100755
index 0000000..0148667
--- /dev/null
+++ b/contrib/benchmark.sh
@@ -0,0 +1,17 @@
+#!/bin/sh
+
+GAPK=./src/gapk
+PCMFILE=$1
+BASE=`basename $PCMFILE`
+
+echo
+echo Encoder Benchmark:
+$GAPK -i "$PCMFILE" -f rawpcm-s16le -o "$BASE.fr" -g gsm
+$GAPK -i "$PCMFILE" -f rawpcm-s16le -o "$BASE.efr" -g amr-efr
+$GAPK -i "$PCMFILE" -f rawpcm-s16le -o "$BASE.hr" -g ti-hr
+
+echo
+echo Decoder Benchmark:
+$GAPK -i "$BASE.fr" -g rawpcm-s16le -o /dev/null -f gsm
+$GAPK -i "$BASE.efr" -g rawpcm-s16le -o /dev/null -f amr-efr
+$GAPK -i "$BASE.hr" -g rawpcm-s16le -o /dev/null -f ti-hr
diff --git a/contrib/gen_testdata.sh b/contrib/gen_testdata.sh
new file mode 100755
index 0000000..a8bb8c9
--- /dev/null
+++ b/contrib/gen_testdata.sh
@@ -0,0 +1,12 @@
+#!/bin/sh
+
+# script to generate a .s16 file (s16le with 8kHz) from an arbitrary MP3
+# usage: gen_testdata.sh foo.mp3 foo.s16
+
+WAV=`mktemp`
+MP3=$1
+S16=$1
+
+mpg123 -w "$WAV" "$MP3"
+sox "$WAV" -b 16 -c 1 -r 8000 "$S16"
+rm "$WAV"