Commit 8f45c4a8 authored by Stefan Westerfeld's avatar Stefan Westerfeld

Report number of sync matches (against known locations) during cmp.

Signed-off-by: Stefan Westerfeld's avatarStefan Westerfeld <stefan@space.twc.de>
parent fc3cc19e
......@@ -980,7 +980,7 @@ public:
int
decode_and_report (const WavData& wav_data, const string& orig_pattern)
{
int match_count = 0, total_count = 0;
int match_count = 0, total_count = 0, sync_match = 0;
SyncFinder sync_finder;
......@@ -1023,13 +1023,25 @@ decode_and_report (const WavData& wav_data, const string& orig_pattern)
if (match)
match_count++;
int expect_index = Params::frames_pad_start * Params::frame_size;
while (sync_score.index + Params::frame_size > expect_index)
{
if (abs (int (sync_score.index) - expect_index) < Params::frame_size)
sync_match++;
expect_index += (mark_sync_frame_count() + mark_data_frame_count()) * Params::frame_size;
}
}
total_count++;
}
}
if (!orig_pattern.empty())
printf ("match_count %d %d\n", match_count, total_count);
{
printf ("match_count %d %d\n", match_count, total_count);
printf ("sync_match %d\n", sync_match);
}
return 0;
}
......
......@@ -97,9 +97,11 @@ do
# decoding with original
# audiowmark cmp-delta "$i" t.wav $PATTERN $AWM_PARAMS --test-key $SEED
done
done | grep match_count | {
done | {
if [ "x$AWM_REPORT" == "xfer" ]; then
awk 'BEGIN { bad = n = 0 } { if ($2 == 0) bad++; n++; } END { print bad, n, bad * 100.0 / n; }'
awk 'BEGIN { bad = n = 0 } $1 == "match_count" { if ($2 == 0) bad++; n++; } END { print bad, n, bad * 100.0 / n; }'
elif [ "x$AWM_REPORT" == "xsync" ]; then
awk 'BEGIN { bad = n = 0 } $1 == "sync_match" { bad += (3 - $2) / 3.0; n++; } END { print bad, n, bad * 100.0 / n; }'
else
echo "unknown report $AWM_REPORT" >&2
exit 1
......
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