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
a499a6a0
Commit
a499a6a0
authored
Feb 28, 2020
by
Stefan Westerfeld
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make long block sync search work again.
Signed-off-by:
Stefan Westerfeld
<
stefan@space.twc.de
>
parent
161617c1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
36 additions
and
22 deletions
+36
-22
wmget.cc
src/wmget.cc
+36
-22
No files found.
src/wmget.cc
View file @
a499a6a0
...
@@ -217,31 +217,45 @@ private:
...
@@ -217,31 +217,45 @@ private:
// "long" blocks consist of two "normal" blocks, which means
// "long" blocks consist of two "normal" blocks, which means
// the sync bits pattern is repeated after the end of the first block
// the sync bits pattern is repeated after the end of the first block
const
int
first_block_end
=
mark_sync_frame_count
()
+
mark_data_frame_count
();
const
int
first_block_end
=
mark_sync_frame_count
()
+
mark_data_frame_count
();
UpDownGen
up_down_gen
(
Random
::
Stream
::
sync_up_down
)
;
const
int
block_count
=
block_length
==
BlockLength
::
LONG
?
2
:
1
;
size_t
n_bands
=
Params
::
max_band
-
Params
::
min_band
+
1
;
size_t
n_bands
=
Params
::
max_band
-
Params
::
min_band
+
1
;
for
(
int
b
it
=
0
;
bit
<
Params
::
sync_bits
;
bit
++
)
for
(
int
b
lock
=
0
;
block
<
block_count
;
block
++
)
{
{
vector
<
FrameBit
>
frame_bits
;
UpDownGen
up_down_gen
(
Random
::
Stream
::
sync_up_down
)
;
for
(
int
f
=
0
;
f
<
Params
::
sync_frames_per_bit
;
f
++
)
for
(
int
bit
=
0
;
bit
<
Params
::
sync_bits
;
bit
++
)
{
{
UpDownArray
frame_up
,
frame_down
;
vector
<
FrameBit
>
frame_bits
;
up_down_gen
.
get
(
f
+
bit
*
Params
::
sync_frames_per_bit
,
frame_up
,
frame_down
);
for
(
int
f
=
0
;
f
<
Params
::
sync_frames_per_bit
;
f
++
)
FrameBit
frame_bit
;
frame_bit
.
frame
=
sync_frame_pos
(
f
+
bit
*
Params
::
sync_frames_per_bit
);
for
(
int
ch
=
0
;
ch
<
wav_data
.
n_channels
();
ch
++
)
{
{
for
(
auto
u
:
frame_up
)
UpDownArray
frame_up
,
frame_down
;
frame_bit
.
up
.
push_back
(
u
-
Params
::
min_band
+
n_bands
*
ch
);
up_down_gen
.
get
(
f
+
bit
*
Params
::
sync_frames_per_bit
,
frame_up
,
frame_down
);
for
(
auto
d
:
frame_down
)
frame_bit
.
down
.
push_back
(
d
-
Params
::
min_band
+
n_bands
*
ch
);
FrameBit
frame_bit
;
frame_bit
.
frame
=
sync_frame_pos
(
f
+
bit
*
Params
::
sync_frames_per_bit
)
+
block
*
first_block_end
;
for
(
int
ch
=
0
;
ch
<
wav_data
.
n_channels
();
ch
++
)
{
if
(
block
==
0
)
{
for
(
auto
u
:
frame_up
)
frame_bit
.
up
.
push_back
(
u
-
Params
::
min_band
+
n_bands
*
ch
);
for
(
auto
d
:
frame_down
)
frame_bit
.
down
.
push_back
(
d
-
Params
::
min_band
+
n_bands
*
ch
);
}
else
{
for
(
auto
u
:
frame_up
)
frame_bit
.
down
.
push_back
(
u
-
Params
::
min_band
+
n_bands
*
ch
);
for
(
auto
d
:
frame_down
)
frame_bit
.
up
.
push_back
(
d
-
Params
::
min_band
+
n_bands
*
ch
);
}
}
std
::
sort
(
frame_bit
.
up
.
begin
(),
frame_bit
.
up
.
end
());
std
::
sort
(
frame_bit
.
down
.
begin
(),
frame_bit
.
down
.
end
());
frame_bits
.
push_back
(
frame_bit
);
}
}
std
::
sort
(
frame_bit
.
up
.
begin
(),
frame_bit
.
up
.
end
());
std
::
sort
(
frame_bits
.
begin
(),
frame_bits
.
end
(),
[]
(
FrameBit
&
f1
,
FrameBit
&
f2
)
{
return
f1
.
frame
<
f2
.
frame
;
});
std
::
sort
(
frame_bit
.
down
.
begin
(),
frame_bit
.
down
.
end
());
sync_bits
.
push_back
(
frame_bits
);
frame_bits
.
push_back
(
frame_bit
);
}
}
std
::
sort
(
frame_bits
.
begin
(),
frame_bits
.
end
(),
[]
(
FrameBit
&
f1
,
FrameBit
&
f2
)
{
return
f1
.
frame
<
f2
.
frame
;
});
sync_bits
.
push_back
(
frame_bits
);
}
}
}
}
double
double
...
@@ -251,7 +265,7 @@ private:
...
@@ -251,7 +265,7 @@ private:
size_t
n_bands
=
Params
::
max_band
-
Params
::
min_band
+
1
;
size_t
n_bands
=
Params
::
max_band
-
Params
::
min_band
+
1
;
int
lbits
=
0
;
int
lbits
=
0
;
for
(
int
bit
=
0
;
bit
<
Params
::
sync_bits
;
bit
++
)
for
(
size_t
bit
=
0
;
bit
<
sync_bits
.
size
()
;
bit
++
)
{
{
const
vector
<
FrameBit
>&
frame_bits
=
sync_bits
[
bit
];
const
vector
<
FrameBit
>&
frame_bits
=
sync_bits
[
bit
];
float
umag
=
0
,
dmag
=
0
;
float
umag
=
0
,
dmag
=
0
;
...
@@ -284,7 +298,7 @@ private:
...
@@ -284,7 +298,7 @@ private:
const
double
q
=
expect_data_bit
?
raw_bit
:
-
raw_bit
;
const
double
q
=
expect_data_bit
?
raw_bit
:
-
raw_bit
;
sync_quality
+=
q
;
sync_quality
+=
q
;
}
}
sync_quality
/=
Params
::
sync_bits
;
sync_quality
/=
sync_bits
.
size
()
;
sync_quality
=
normalize_sync_quality
(
sync_quality
);
sync_quality
=
normalize_sync_quality
(
sync_quality
);
*
len
=
lbits
;
*
len
=
lbits
;
...
@@ -639,7 +653,7 @@ decode_and_report (const WavData& wav_data, const string& orig_pattern)
...
@@ -639,7 +653,7 @@ decode_and_report (const WavData& wav_data, const string& orig_pattern)
}
}
// L-blocks
// L-blocks
SyncFinder
sync_finder_l
;
SyncFinder
sync_finder_l
;
vector
<
SyncFinder
::
Score
>
sync_scores_l
;
// FIXME
= sync_finder.search (wav_data, SyncFinder::BlockLength::LONG);
vector
<
SyncFinder
::
Score
>
sync_scores_l
=
sync_finder
.
search
(
wav_data
,
SyncFinder
::
BlockLength
::
LONG
);
for
(
auto
sync_score
:
sync_scores_l
)
for
(
auto
sync_score
:
sync_scores_l
)
{
{
...
...
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