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:
...
@@ -981,6 +981,8 @@ public:
int
int
decode_and_report
(
const
WavData
&
wav_data
,
const
string
&
orig_pattern
)
decode_and_report
(
const
WavData
&
wav_data
,
const
string
&
orig_pattern
)
{
{
int
match_count
=
0
,
total_count
=
0
;
SyncFinder
sync_finder
;
SyncFinder
sync_finder
;
for
(
auto
pos
:
sync_finder
.
search
(
wav_data
))
for
(
auto
pos
:
sync_finder
.
search
(
wav_data
))
...
@@ -1014,26 +1016,24 @@ decode_and_report (const WavData& wav_data, const string& orig_pattern)
...
@@ -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
));
vector
<
int
>
bit_vec
=
conv_decode_soft
(
randomize_bit_order
(
soft_bit_vec
,
/* encode */
false
));
const
int
seconds
=
lrint
(
pos
/
wav_data
.
mix_freq
());
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
());
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
())
if
(
!
orig_pattern
.
empty
())
{
{
int bits = 0, bit_errors = 0;
bool
match
=
true
;
vector
<
int
>
orig_vec
=
bit_str_to_vec
(
orig_pattern
);
vector
<
int
>
orig_vec
=
bit_str_to_vec
(
orig_pattern
);
for
(
size_t
i
=
0
;
i
<
bit_vec
.
size
();
i
++
)
for
(
size_t
i
=
0
;
i
<
bit_vec
.
size
();
i
++
)
{
match
=
match
&&
(
bit_vec
[
i
]
==
orig_vec
[
i
%
orig_vec
.
size
()]);
bits++;
if (
bit_vec[i] != orig_vec[i % orig_vec.size()]
)
if
(
match
)
bit_errors
++;
match_count
++
;
}
}
printf ("bit_error_raw %d %d\n", bit_errors, bits);
total_count
++
;
printf ("bit_error_rate %.5f %%\n", double (100.0 * bit_errors) / bits);
}
}
#endif
if
(
!
orig_pattern
.
empty
())
printf
(
"match_count %d %d
\n
"
,
match_count
,
total_count
);
return
0
;
return
0
;
}
}
...
...
src/ber-test.sh
View file @
8e0cec5b
...
@@ -8,7 +8,7 @@ if [ "x$AWM_SEEDS" == "x" ]; then
...
@@ -8,7 +8,7 @@ if [ "x$AWM_SEEDS" == "x" ]; then
AWM_SEEDS
=
0
AWM_SEEDS
=
0
fi
fi
if
[
"x
$AWM_REPORT
"
==
"x"
]
;
then
if
[
"x
$AWM_REPORT
"
==
"x"
]
;
then
AWM_REPORT
=
b
er
AWM_REPORT
=
f
er
fi
fi
if
[
"x
$AWM_FILE
"
==
"x"
]
;
then
if
[
"x
$AWM_FILE
"
==
"x"
]
;
then
AWM_FILE
=
t
AWM_FILE
=
t
...
@@ -97,11 +97,9 @@ do
...
@@ -97,11 +97,9 @@ do
# decoding with original
# decoding with original
# audiowmark cmp-delta "$i" t.wav $PATTERN $AWM_PARAMS --test-key $SEED
# audiowmark cmp-delta "$i" t.wav $PATTERN $AWM_PARAMS --test-key $SEED
done
done
done
|
grep
bit_error_rate |
{
done
|
grep
match_count |
{
if
[
"x
$AWM_REPORT
"
==
"xber"
]
;
then
if
[
"x
$AWM_REPORT
"
==
"xfer"
]
;
then
awk
'BEGIN { max_er = er = n = 0 } { er += $2; n++; if ($2 > max_er) max_er = $2;} END { print er / n, max_er; }'
awk
'BEGIN { bad = n = 0 } { if ($2 == 0) bad++; n++; } END { print bad, n, bad * 100.0 / n; }'
elif
[
"x
$AWM_REPORT
"
==
"xfer"
]
;
then
awk
'BEGIN { bad = n = 0 } { if ($2 > 0) bad++; n++; } END { print bad, n, bad * 100.0 / n; }'
else
else
echo
"unknown report
$AWM_REPORT
"
>
&2
echo
"unknown report
$AWM_REPORT
"
>
&2
exit
1
exit
1
...
...
src/gen-test.sh
View file @
8e0cec5b
...
@@ -5,6 +5,6 @@ mkdir -p test
...
@@ -5,6 +5,6 @@ mkdir -p test
seq
=
1
seq
=
1
cat
test_list |
while
read
f
cat
test_list |
while
read
f
do
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
++
))
((
seq
++
))
done
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