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
6b2b2fd1
Commit
6b2b2fd1
authored
Nov 17, 2019
by
Stefan Westerfeld
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Performance: avoid std::vector overhead in up/down band generation.
Signed-off-by:
Stefan Westerfeld
<
stefan@space.twc.de
>
parent
05613217
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
10 deletions
+10
-10
audiowmark.cc
src/audiowmark.cc
+10
-10
No files found.
src/audiowmark.cc
View file @
6b2b2fd1
...
...
@@ -243,6 +243,7 @@ frame_count (const WavData& wav_data)
return
wav_data
.
n_values
()
/
wav_data
.
n_channels
()
/
Params
::
frame_size
;
}
typedef
std
::
array
<
int
,
30
>
UpDownArray
;
class
UpDownGen
{
Random
::
Stream
random_stream
;
...
...
@@ -255,9 +256,11 @@ public:
random
(
0
,
random_stream
),
bands_reorder
(
Params
::
max_band
-
Params
::
min_band
+
1
)
{
UpDownArray
x
;
assert
(
x
.
size
()
==
Params
::
bands_per_frame
);
}
void
get
(
int
f
,
vector
<
int
>&
up
,
vector
<
int
>
&
down
)
get
(
int
f
,
UpDownArray
&
up
,
UpDownArray
&
down
)
{
for
(
size_t
i
=
0
;
i
<
bands_reorder
.
size
();
i
++
)
bands_reorder
[
i
]
=
Params
::
min_band
+
i
;
...
...
@@ -268,8 +271,8 @@ public:
assert
(
2
*
Params
::
bands_per_frame
<
bands_reorder
.
size
());
for
(
size_t
i
=
0
;
i
<
Params
::
bands_per_frame
;
i
++
)
{
up
.
push_back
(
bands_reorder
[
i
])
;
down
.
push_back
(
bands_reorder
[
Params
::
bands_per_frame
+
i
])
;
up
[
i
]
=
bands_reorder
[
i
]
;
down
[
i
]
=
bands_reorder
[
Params
::
bands_per_frame
+
i
]
;
}
}
};
...
...
@@ -430,8 +433,7 @@ gen_mix_entries()
UpDownGen
up_down_gen
(
Random
::
Stream
::
data_up_down
);
for
(
int
f
=
0
;
f
<
int
(
mark_data_frame_count
());
f
++
)
{
vector
<
int
>
up
;
vector
<
int
>
down
;
UpDownArray
up
,
down
;
up_down_gen
.
get
(
f
,
up
,
down
);
assert
(
up
.
size
()
==
down
.
size
());
...
...
@@ -453,8 +455,7 @@ enum class FrameDelta : uint8_t {
void
prepare_frame_delta
(
UpDownGen
&
up_down_gen
,
int
f
,
vector
<
FrameDelta
>&
frame_delta
,
int
data_bit
)
{
vector
<
int
>
up
;
vector
<
int
>
down
;
UpDownArray
up
,
down
;
up_down_gen
.
get
(
f
,
up
,
down
);
for
(
auto
u
:
up
)
frame_delta
[
u
]
=
data_bit
?
FrameDelta
::
UP
:
FrameDelta
::
DOWN
;
...
...
@@ -1041,8 +1042,7 @@ linear_decode (vector<vector<complex<float>>>& fft_out, int n_channels)
for
(
int
ch
=
0
;
ch
<
n_channels
;
ch
++
)
{
const
size_t
index
=
data_frame_pos
(
f
)
*
n_channels
+
ch
;
vector
<
int
>
up
;
vector
<
int
>
down
;
UpDownArray
up
,
down
;
up_down_gen
.
get
(
f
,
up
,
down
);
const
double
min_db
=
-
96
;
...
...
@@ -1095,7 +1095,7 @@ class SyncFinder
{
for
(
int
f
=
0
;
f
<
Params
::
sync_frames_per_bit
;
f
++
)
{
vector
<
int
>
frame_up
,
frame_down
;
UpDownArray
frame_up
,
frame_down
;
up_down_gen
.
get
(
f
+
bit
*
Params
::
sync_frames_per_bit
,
frame_up
,
frame_down
);
for
(
auto
u
:
frame_up
)
...
...
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