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
5d1aa2c1
Commit
5d1aa2c1
authored
Jan 05, 2019
by
Stefan Westerfeld
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Avoid reroll for up- and down band generation (use Random::shuffle).
Signed-off-by:
Stefan Westerfeld
<
stefan@space.twc.de
>
parent
e10b3b31
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
18 deletions
+11
-18
TODO
src/TODO
+0
-3
audiowmark.cc
src/audiowmark.cc
+11
-15
No files found.
src/TODO
View file @
5d1aa2c1
key:
- avoid reroll in up_down generation
possible improvements:
- dynamic bit strength
- mp3 support with libmad
src/audiowmark.cc
View file @
5d1aa2c1
...
...
@@ -255,23 +255,19 @@ get_frame (const WavData& wav_data, int f, int ch)
void
get_up_down
(
int
f
,
vector
<
int
>&
up
,
vector
<
int
>&
down
)
{
vector
<
int
>
used
(
Params
::
frame_size
/
2
);
vector
<
int
>
bands_reorder
;
for
(
int
i
=
Params
::
min_band
;
i
<=
Params
::
max_band
;
i
++
)
bands_reorder
.
push_back
(
i
);
Random
rng
(
f
,
Random
::
Stream
::
up_down
);
// use per frame random seed
Random
random
(
f
,
Random
::
Stream
::
up_down
);
// use per frame random seed
random
.
shuffle
(
bands_reorder
);
auto
choose_bands
=
[
&
used
,
&
rng
]
(
vector
<
int
>&
bands
)
{
while
(
bands
.
size
()
<
Params
::
bands_per_frame
)
{
int
p
=
rng
()
%
(
Params
::
max_band
-
Params
::
min_band
)
+
Params
::
min_band
;
if
(
!
used
[
p
])
{
bands
.
push_back
(
p
);
used
[
p
]
=
1
;
}
}
};
choose_bands
(
up
);
choose_bands
(
down
);
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
]);
}
}
template
<
class
T
>
vector
<
T
>
...
...
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