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
1edb27ae
Commit
1edb27ae
authored
May 29, 2022
by
Stefan Westerfeld
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'warn-on-short-input'
parents
c7e2aa41
58e0be12
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
20 additions
and
7 deletions
+20
-7
audiowmark.cc
src/audiowmark.cc
+5
-0
wmadd.cc
src/wmadd.cc
+13
-7
wmcommon.cc
src/wmcommon.cc
+1
-0
wmcommon.hh
src/wmcommon.hh
+1
-0
No files found.
src/audiowmark.cc
View file @
1edb27ae
...
...
@@ -65,6 +65,7 @@ print_usage()
printf
(
" --short <bits> enable short payload mode
\n
"
);
printf
(
" --strength <s> set watermark strength [%.6g]
\n
"
,
Params
::
water_delta
*
1000
);
printf
(
" -q, --quiet disable information messages
\n
"
);
printf
(
" --strict treat (minor) problems as errors
\n
"
);
printf
(
"
\n
"
);
printf
(
" --input-format raw use raw stream as input
\n
"
);
printf
(
" --output-format raw use raw stream as output
\n
"
);
...
...
@@ -487,6 +488,10 @@ parse_shared_options (ArgParser& ap)
{
Params
::
mix
=
false
;
}
if
(
ap
.
parse_opt
(
"--strict"
))
{
Params
::
strict
=
true
;
}
if
(
Params
::
have_key
>
1
)
{
error
(
"audiowmark: watermark key can at most be set once (--key / --test-key option)
\n
"
);
...
...
src/wmadd.cc
View file @
1edb27ae
...
...
@@ -751,13 +751,24 @@ add_stream_watermark (AudioInputStream *in_stream, AudioOutputStream *out_stream
}
total_output_frames
+=
samples
.
size
()
/
n_channels
;
}
if
(
Params
::
snr
)
info
(
"SNR: %f dB
\n
"
,
10
*
log10
(
snr_signal_power
/
snr_delta_power
));
info
(
"Data Blocks: %d
\n
"
,
wm_resampler
.
data_blocks
());
if
(
in_stream
->
n_frames
()
!=
AudioInputStream
::
N_FRAMES_UNKNOWN
)
{
const
size_t
expect_frames
=
in_stream
->
n_frames
()
+
zero_frames
;
if
(
total_output_frames
!=
expect_frames
)
{
error
(
"audiowmark: error: input frames (%zd) != output frames (%zd)
\n
"
,
expect_frames
,
total_output_frames
);
return
1
;
auto
msg
=
string_printf
(
"unexpected EOF; input frames (%zd) != output frames (%zd)"
,
expect_frames
,
total_output_frames
);
if
(
Params
::
strict
)
{
warning
(
"audiowmark: error: %s
\n
"
,
msg
.
c_str
());
return
1
;
}
error
(
"audiowmark: warning: %s
\n
"
,
msg
.
c_str
());
}
}
...
...
@@ -767,11 +778,6 @@ add_stream_watermark (AudioInputStream *in_stream, AudioOutputStream *out_stream
error
(
"audiowmark: closing output stream failed: %s
\n
"
,
err
.
message
());
return
1
;
}
if
(
Params
::
snr
)
info
(
"SNR: %f dB
\n
"
,
10
*
log10
(
snr_signal_power
/
snr_delta_power
));
info
(
"Data Blocks: %d
\n
"
,
wm_resampler
.
data_blocks
());
return
0
;
}
...
...
src/wmcommon.cc
View file @
1edb27ae
...
...
@@ -25,6 +25,7 @@ double Params::water_delta = 0.01;
bool
Params
::
mix
=
true
;
bool
Params
::
hard
=
false
;
// hard decode bits? (soft decoding is better)
bool
Params
::
snr
=
false
;
// compute/show snr while adding watermark
bool
Params
::
strict
=
false
;
bool
Params
::
detect_speed
=
false
;
double
Params
::
try_speed
=
-
1
;
double
Params
::
test_speed
=
-
1
;
...
...
src/wmcommon.hh
View file @
1edb27ae
...
...
@@ -41,6 +41,7 @@ public:
static
double
water_delta
;
static
std
::
string
json_output
;
static
bool
strict
;
static
bool
mix
;
static
bool
hard
;
// hard decode bits? (soft decoding is better)
static
bool
snr
;
// compute/show snr while adding watermark
...
...
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