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
1c25fe83
Commit
1c25fe83
authored
Oct 21, 2020
by
Stefan Westerfeld
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add --detect-speed-hint for improving test time for speed detection.
Signed-off-by:
Stefan Westerfeld
<
stefan@space.twc.de
>
parent
24e5194d
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
28 additions
and
0 deletions
+28
-0
audiowmark.cc
src/audiowmark.cc
+6
-0
wmcommon.cc
src/wmcommon.cc
+1
-0
wmcommon.hh
src/wmcommon.hh
+2
-0
wmget.cc
src/wmget.cc
+19
-0
No files found.
src/audiowmark.cc
View file @
1c25fe83
...
@@ -565,6 +565,8 @@ parse_add_options (ArgParser& ap)
...
@@ -565,6 +565,8 @@ parse_add_options (ArgParser& ap)
void
void
parse_get_options
(
ArgParser
&
ap
)
parse_get_options
(
ArgParser
&
ap
)
{
{
float
f
;
ap
.
parse_opt
(
"--test-cut"
,
Params
::
test_cut
);
ap
.
parse_opt
(
"--test-cut"
,
Params
::
test_cut
);
ap
.
parse_opt
(
"--test-truncate"
,
Params
::
test_truncate
);
ap
.
parse_opt
(
"--test-truncate"
,
Params
::
test_truncate
);
...
@@ -580,6 +582,10 @@ parse_get_options (ArgParser& ap)
...
@@ -580,6 +582,10 @@ parse_get_options (ArgParser& ap)
{
{
Params
::
detect_speed
=
true
;
Params
::
detect_speed
=
true
;
}
}
if
(
ap
.
parse_opt
(
"--detect-speed-hint"
,
f
))
{
Params
::
detect_speed_hint
=
f
;
}
}
}
int
int
...
...
src/wmcommon.cc
View file @
1c25fe83
...
@@ -26,6 +26,7 @@ bool Params::mix = true;
...
@@ -26,6 +26,7 @@ bool Params::mix = true;
bool
Params
::
hard
=
false
;
// hard decode bits? (soft decoding is better)
bool
Params
::
hard
=
false
;
// hard decode bits? (soft decoding is better)
bool
Params
::
snr
=
false
;
// compute/show snr while adding watermark
bool
Params
::
snr
=
false
;
// compute/show snr while adding watermark
bool
Params
::
detect_speed
=
false
;
bool
Params
::
detect_speed
=
false
;
double
Params
::
detect_speed_hint
=
-
1
;
int
Params
::
have_key
=
0
;
int
Params
::
have_key
=
0
;
size_t
Params
::
payload_size
=
128
;
size_t
Params
::
payload_size
=
128
;
bool
Params
::
payload_short
=
false
;
bool
Params
::
payload_short
=
false
;
...
...
src/wmcommon.hh
View file @
1c25fe83
...
@@ -42,7 +42,9 @@ public:
...
@@ -42,7 +42,9 @@ public:
static
bool
hard
;
// hard decode bits? (soft decoding is better)
static
bool
hard
;
// hard decode bits? (soft decoding is better)
static
bool
snr
;
// compute/show snr while adding watermark
static
bool
snr
;
// compute/show snr while adding watermark
static
int
have_key
;
static
int
have_key
;
static
bool
detect_speed
;
static
bool
detect_speed
;
static
double
detect_speed_hint
;
// for debugging --detect-speed
static
size_t
payload_size
;
// number of payload bits for the watermark
static
size_t
payload_size
;
// number of payload bits for the watermark
static
bool
payload_short
;
static
bool
payload_short
;
...
...
src/wmget.cc
View file @
1c25fe83
...
@@ -1052,9 +1052,28 @@ detect_speed (const WavData& wav_data, double center, double step, int n_steps,
...
@@ -1052,9 +1052,28 @@ detect_speed (const WavData& wav_data, double center, double step, int n_steps,
WavData
wd_truncated
=
truncate
(
wav_data
,
seconds
*
1.5
);
WavData
wd_truncated
=
truncate
(
wav_data
,
seconds
*
1.5
);
double
best_speed
=
1.0
;
double
best_speed
=
1.0
;
double
best_quality
=
0
;
double
best_quality
=
0
;
int
best_hint_step
=
0
;
if
(
Params
::
detect_speed_hint
>
0
)
{
double
best_dist
=
1000
;
for
(
int
p
=
-
n_steps
;
p
<=
n_steps
;
p
++
)
{
double
dist
=
fabs
(
center
*
pow
(
step
,
p
)
-
Params
::
detect_speed_hint
);
if
(
dist
<
best_dist
)
{
best_hint_step
=
p
;
best_dist
=
dist
;
}
}
}
printf
(
"## range [%f..%f], n_steps=%d
\n
"
,
center
*
pow
(
step
,
-
n_steps
),
center
*
pow
(
step
,
n_steps
),
n_steps
);
printf
(
"## range [%f..%f], n_steps=%d
\n
"
,
center
*
pow
(
step
,
-
n_steps
),
center
*
pow
(
step
,
n_steps
),
n_steps
);
for
(
int
p
=
-
n_steps
;
p
<=
n_steps
;
p
++
)
for
(
int
p
=
-
n_steps
;
p
<=
n_steps
;
p
++
)
{
{
if
(
Params
::
detect_speed_hint
>
0
)
if
(
abs
(
p
-
best_hint_step
)
>
2
)
continue
;
double
speed
=
center
*
pow
(
step
,
p
);
double
speed
=
center
*
pow
(
step
,
p
);
WavData
wd_resampled
=
wd_truncated
;
WavData
wd_resampled
=
wd_truncated
;
...
...
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