Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
audiowmark
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Stefan Westerfeld
audiowmark
Commits
8e0cec5b
Commit
8e0cec5b
authored
Jan 12, 2019
by
Stefan Westerfeld
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix audiowmark cmp: report matching patterns.
Signed-off-by:
Stefan Westerfeld
<
stefan@space.twc.de
>
parent
4516957b
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
22 deletions
+20
-22
audiowmark.cc
src/audiowmark.cc
+15
-15
ber-test.sh
src/ber-test.sh
+4
-6
gen-test.sh
src/gen-test.sh
+1
-1
No files found.
src/audiowmark.cc
View file @
8e0cec5b
...
...
@@ -981,6 +981,8 @@ public:
int
decode_and_report
(
const
WavData
&
wav_data
,
const
string
&
orig_pattern
)
{
int
match_count
=
0
,
total_count
=
0
;
SyncFinder
sync_finder
;
for
(
auto
pos
:
sync_finder
.
search
(
wav_data
))
...
...
@@ -1014,26 +1016,24 @@ decode_and_report (const WavData& wav_data, const string& orig_pattern)
vector
<
int
>
bit_vec
=
conv_decode_soft
(
randomize_bit_order
(
soft_bit_vec
,
/* encode */
false
));
const
int
seconds
=
lrint
(
pos
/
wav_data
.
mix_freq
());
printf
(
"pattern %2d:%02d %s
\n
"
,
seconds
/
60
,
seconds
%
60
,
bit_vec_to_str
(
bit_vec
).
c_str
());
}
#if 0 /* TODO */
if
(
!
orig_pattern
.
empty
())
{
int bits = 0, bit_errors = 0;
bool
match
=
true
;
vector
<
int
>
orig_vec
=
bit_str_to_vec
(
orig_pattern
);
for
(
size_t
i
=
0
;
i
<
bit_vec
.
size
();
i
++
)
{
bits++;
if (
bit_vec[i] != orig_vec[i % orig_vec.size()]
)
bit_errors
++;
match
=
match
&&
(
bit_vec
[
i
]
==
orig_vec
[
i
%
orig_vec
.
size
()]);
if
(
match
)
match_count
++
;
}
printf ("bit_error_raw %d %d\n", bit_errors, bits);
printf ("bit_error_rate %.5f %%\n", double (100.0 * bit_errors) / bits);
total_count
++
;
}
#endif
if
(
!
orig_pattern
.
empty
())
printf
(
"match_count %d %d
\n
"
,
match_count
,
total_count
);
return
0
;
}
...
...
src/ber-test.sh
View file @
8e0cec5b
...
...
@@ -8,7 +8,7 @@ if [ "x$AWM_SEEDS" == "x" ]; then
AWM_SEEDS
=
0
fi
if
[
"x
$AWM_REPORT
"
==
"x"
]
;
then
AWM_REPORT
=
b
er
AWM_REPORT
=
f
er
fi
if
[
"x
$AWM_FILE
"
==
"x"
]
;
then
AWM_FILE
=
t
...
...
@@ -97,11 +97,9 @@ do
# decoding with original
# audiowmark cmp-delta "$i" t.wav $PATTERN $AWM_PARAMS --test-key $SEED
done
done
|
grep
bit_error_rate |
{
if
[
"x
$AWM_REPORT
"
==
"xber"
]
;
then
awk
'BEGIN { max_er = er = n = 0 } { er += $2; n++; if ($2 > max_er) max_er = $2;} END { print er / n, max_er; }'
elif
[
"x
$AWM_REPORT
"
==
"xfer"
]
;
then
awk
'BEGIN { bad = n = 0 } { if ($2 > 0) bad++; n++; } END { print bad, n, bad * 100.0 / n; }'
done
|
grep
match_count |
{
if
[
"x
$AWM_REPORT
"
==
"xfer"
]
;
then
awk
'BEGIN { bad = n = 0 } { if ($2 == 0) bad++; n++; } END { print bad, n, bad * 100.0 / n; }'
else
echo
"unknown report
$AWM_REPORT
"
>
&2
exit
1
...
...
src/gen-test.sh
View file @
8e0cec5b
...
...
@@ -5,6 +5,6 @@ mkdir -p test
seq
=
1
cat
test_list |
while
read
f
do
audiowmark gentest
"
$f
"
test
/T
$(
printf
"%02d__%s"
$seq
$(
echo
$f
|
sed
's, ,_,g;s,.*/,,g'
))
.wav
audiowmark gentest
"
$f
"
test
/T
$(
printf
"%02d__%s"
$seq
$(
echo
$f
|
sed
's, ,_,g;s,.*/,,g'
))
.wav
||
exit
1
((
seq
++
))
done
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment