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
f210665a
Commit
f210665a
authored
Jan 13, 2019
by
Stefan Westerfeld
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix problem (double match) in sync match algorithm.
Signed-off-by:
Stefan Westerfeld
<
stefan@space.twc.de
>
parent
8f45c4a8
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
10 deletions
+20
-10
audiowmark.cc
src/audiowmark.cc
+20
-10
No files found.
src/audiowmark.cc
View file @
f210665a
...
...
@@ -982,9 +982,10 @@ decode_and_report (const WavData& wav_data, const string& orig_pattern)
{
int
match_count
=
0
,
total_count
=
0
,
sync_match
=
0
;
SyncFinder
sync_finder
;
SyncFinder
sync_finder
;
vector
<
SyncFinder
::
Score
>
sync_scores
=
sync_finder
.
search
(
wav_data
);
for
(
auto
sync_score
:
sync_
finder
.
search
(
wav_data
)
)
for
(
auto
sync_score
:
sync_
scores
)
{
const
size_t
count
=
mark_data_frame_count
();
const
size_t
index
=
sync_score
.
index
+
(
mark_sync_frame_count
()
*
Params
::
frame_size
);
...
...
@@ -1024,14 +1025,6 @@ 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
++
;
}
...
...
@@ -1040,6 +1033,23 @@ decode_and_report (const WavData& wav_data, const string& orig_pattern)
if
(
!
orig_pattern
.
empty
())
{
printf
(
"match_count %d %d
\n
"
,
match_count
,
total_count
);
/* search sync markers at typical positions */
const
int
expect0
=
Params
::
frames_pad_start
*
Params
::
frame_size
;
const
int
expect_step
=
(
mark_sync_frame_count
()
+
mark_data_frame_count
())
*
Params
::
frame_size
;
const
int
expect_end
=
frame_count
(
wav_data
)
*
Params
::
frame_size
;
for
(
int
expect_index
=
expect0
;
expect_index
+
expect_step
<
expect_end
;
expect_index
+=
expect_step
)
{
for
(
auto
sync_score
:
sync_scores
)
{
if
(
abs
(
int
(
sync_score
.
index
)
-
expect_index
)
<
Params
::
frame_size
)
{
sync_match
++
;
break
;
}
}
}
printf
(
"sync_match %d
\n
"
,
sync_match
);
}
return
0
;
...
...
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