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
b7cf973c
Commit
b7cf973c
authored
Dec 09, 2018
by
Stefan Westerfeld
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Support --block argument to set the reorder block size.
Signed-off-by:
Stefan Westerfeld
<
stefan@space.twc.de
>
parent
52496a92
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
3 deletions
+20
-3
audiowmark.cc
src/audiowmark.cc
+20
-3
No files found.
src/audiowmark.cc
View file @
b7cf973c
...
...
@@ -15,11 +15,13 @@ using std::string;
using
std
::
vector
;
using
std
::
complex
;
using
std
::
min
;
using
std
::
max
;
namespace
Params
{
static
size_t
frame_size
=
1024
;
static
int
frames_per_bit
=
4
;
static
int
block
=
1
;
static
int
bands_per_frame
=
30
;
static
int
max_band
=
100
;
static
int
min_band
=
20
;
...
...
@@ -51,6 +53,7 @@ print_usage()
printf
(
"Global options:
\n
"
);
printf
(
" --frame-size frame size (must be power of 2) [%zd]
\n
"
,
Params
::
frame_size
);
printf
(
" --frames-per-bit number of frames per bit [%d]
\n
"
,
Params
::
frames_per_bit
);
printf
(
" --block set bit reordering block size [%d]
\n
"
,
Params
::
block
);
printf
(
" --water-delta set watermarking delta [%.4f]
\n
"
,
Params
::
water_delta
);
printf
(
" --pre-scale set scaling used for normalization [%.3f]
\n
"
,
Params
::
pre_scale
);
}
...
...
@@ -133,6 +136,10 @@ parse_options (int *argc_p,
{
Params
::
frames_per_bit
=
atoi
(
opt_arg
);
}
else
if
(
check_arg
(
argc
,
argv
,
&
i
,
"--block"
,
&
opt_arg
))
{
Params
::
block
=
atoi
(
opt_arg
);
}
else
if
(
check_arg
(
argc
,
argv
,
&
i
,
"--water-delta"
,
&
opt_arg
))
{
Params
::
water_delta
=
atof
(
opt_arg
);
...
...
@@ -378,12 +385,22 @@ add_watermark (const string& infile, const string& outfile, const string& bits)
printf
(
"loading %s
\n
"
,
infile
.
c_str
());
WavData
wav_data
;
if
(
!
wav_data
.
load
(
infile
))
WavData
x
wav_data
;
if
(
!
x
wav_data
.
load
(
infile
))
{
fprintf
(
stderr
,
"audiowmark: error loading %s: %s
\n
"
,
infile
.
c_str
(),
wav_data
.
error_blurb
());
fprintf
(
stderr
,
"audiowmark: error loading %s: %s
\n
"
,
infile
.
c_str
(),
x
wav_data
.
error_blurb
());
return
1
;
}
size_t
block_size
=
Params
::
block
*
Params
::
frames_per_bit
*
Params
::
frame_size
*
xwav_data
.
n_channels
();
/* we truncate the audio down to a multiple of the reorder block size - for a production quality
* implemenation this is not good enough, but it is ok for comparing error rates
*/
vector
<
float
>
in_signal
(
xwav_data
.
samples
().
begin
(),
xwav_data
.
samples
().
end
()
-
xwav_data
.
n_values
()
%
block_size
);
WavData
wav_data
(
in_signal
,
xwav_data
.
n_channels
(),
xwav_data
.
mix_freq
(),
xwav_data
.
bit_depth
());
printf
(
"input signal frames: before = %f
\n
"
,
double
(
xwav_data
.
n_values
())
/
block_size
);
printf
(
"input signal frames: after = %f
\n
"
,
double
(
wav_data
.
n_values
())
/
block_size
);
vector
<
float
>
out_signal
(
wav_data
.
n_values
());
printf
(
"channels: %d, samples: %zd, mix_freq: %f
\n
"
,
wav_data
.
n_channels
(),
wav_data
.
n_values
(),
wav_data
.
mix_freq
());
...
...
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