Commit 0bf3f82d authored by Stefan Westerfeld's avatar Stefan Westerfeld

TESTS: check snr in wav pipe test to catch conversion errors

Signed-off-by: Stefan Westerfeld's avatarStefan Westerfeld <stefan@space.twc.de>
parent 1b69d744
......@@ -44,9 +44,18 @@ audiowmark_cmp()
check_length()
{
local in1=$(audiowmark test-info $1 frames) || die "error detecting length of $1"
local in2=$(audiowmark test-info $2 frames) || die "error detecting length of $2"
local in1="$($AUDIOWMARK test-info $1 frames)"
local in2="$($AUDIOWMARK test-info $2 frames)"
[ "x$in1" != "x" ] || die "length of '$1' could not be detected"
[ "x$in1" == "x$in2" ] || die "length of '$1' ($in1) and '$2' ($in2) differs"
}
check_snr()
{
local snr="$($AUDIOWMARK test-snr $1 $2)"
echo >&2 "==== snr of $1 and $2 is $snr (expected $3) ===="
[ "x$snr" != "x" ] || die "snr of '$1' and '$2' could not be detected"
[ "x$3" != "x" ] || die "need snr bound"
awk "BEGIN {exit !($snr >= $3)}" || die "snr of '$1' and '$2' is worse than $3"
}
......@@ -13,13 +13,16 @@ do
[ "x$BITS" == "x$(audiowmark test-info $IN_WAV bit_depth)" ] || die "generated input bit depth is not correct"
cat $IN_WAV | audiowmark_add --test-key 1 --format wav-pipe - - $TEST_MSG > $OUT1_WAV || die "watermark from pipe failed"
cat $OUT1_WAV | audiowmark_add --test-key 2 --format wav-pipe - - $TEST_MSG > $OUT2_WAV || die "watermark from pipe failed"
cat $OUT2_WAV | audiowmark_add --test-key 3 --format wav-pipe - - $TEST_MSG > $OUT3_WAV || die "watermark from pipe failed"
cat $IN_WAV | audiowmark_add --test-key 1 --test-no-limiter --format wav-pipe - - $TEST_MSG > $OUT1_WAV || die "watermark from pipe failed"
cat $OUT1_WAV | audiowmark_add --test-key 2 --test-no-limiter --format wav-pipe - - $TEST_MSG > $OUT2_WAV || die "watermark from pipe failed"
cat $OUT2_WAV | audiowmark_add --test-key 3 --test-no-limiter --format wav-pipe - - $TEST_MSG > $OUT3_WAV || die "watermark from pipe failed"
check_length $IN_WAV $OUT1_WAV
check_length $IN_WAV $OUT2_WAV
check_length $IN_WAV $OUT3_WAV
check_snr $IN_WAV $OUT1_WAV 32
check_snr $IN_WAV $OUT2_WAV 29
check_snr $IN_WAV $OUT3_WAV 27
audiowmark_cmp --expect-matches 0 $OUT3_WAV $TEST_MSG
audiowmark_cmp --expect-matches 5 --test-key 1 $OUT3_WAV $TEST_MSG
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment