Commit 84f231ce authored by Stefan Westerfeld's avatar Stefan Westerfeld

Add script for computing average bit error rate on test music.

Signed-off-by: Stefan Westerfeld's avatarStefan Westerfeld <stefan@space.twc.de>
parent 2a138a00
- bit error rate evaluation
- use both channels for decoding
- non-blind decoder
- standard tests (-> mp3, ->ogg, ...)
......
......@@ -389,14 +389,14 @@ get_watermark (const string& origfile, const string& infile, const string& orig_
}
}
}
int bits = 0, bit_errors = 0;
for (int ch = 0; ch < wav_data.n_channels(); ch++)
{
printf ("ch[%d]=%s\n", ch, bit_vec_to_str (bit_vec[ch]).c_str());
if (!orig_pattern.empty())
{
int bits = 0, bit_errors = 0;
vector<int> orig_vec = bit_str_to_vec (orig_pattern);
for (int i = 0; i < bit_vec[ch].size(); i++)
{
......@@ -404,10 +404,9 @@ get_watermark (const string& origfile, const string& infile, const string& orig_
if (bit_vec[ch][i] != orig_vec[i % orig_vec.size()])
bit_errors++;
}
printf ("bit_error_rate %.3f %%\n", double (100.0 * bit_errors) / bits);
}
}
printf ("bit_error_rate %.3f %%\n", double (100.0 * bit_errors) / bits);
return 0;
}
......
# pseudo random pattern
PATTERN=4e1243bd22c66e76c2ba9eddc1f91394e57f9f83
for i in test/T*
do
echo $i
audiowmark add $i t.wav $PATTERN >/dev/null
audiowmark cmp $i t.wav $PATTERN
done | grep bit_error_rate | awk '{ er += $2; n++; if ($2 > max_er) max_er = $2;} END { print er / n, max_er; }'
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