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
f5fcd8b6
Commit
f5fcd8b6
authored
Dec 09, 2020
by
Stefan Westerfeld
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove support for --detect-speed-slow.
Signed-off-by:
Stefan Westerfeld
<
stefan@space.twc.de
>
parent
8092e284
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
26 additions
and
105 deletions
+26
-105
audiowmark.cc
src/audiowmark.cc
+0
-4
wmcommon.cc
src/wmcommon.cc
+0
-1
wmcommon.hh
src/wmcommon.hh
+0
-1
wmget.cc
src/wmget.cc
+1
-1
wmspeed.cc
src/wmspeed.cc
+25
-98
No files found.
src/audiowmark.cc
View file @
f5fcd8b6
...
@@ -592,10 +592,6 @@ parse_get_options (ArgParser& ap)
...
@@ -592,10 +592,6 @@ parse_get_options (ArgParser& ap)
{
{
Params
::
detect_speed
=
true
;
Params
::
detect_speed
=
true
;
}
}
if
(
ap
.
parse_opt
(
"--detect-speed-slow"
))
{
Params
::
detect_speed_slow
=
true
;
}
if
(
ap
.
parse_opt
(
"--detect-speed-hint"
,
f
))
if
(
ap
.
parse_opt
(
"--detect-speed-hint"
,
f
))
{
{
Params
::
detect_speed_hint
=
f
;
Params
::
detect_speed_hint
=
f
;
...
...
src/wmcommon.cc
View file @
f5fcd8b6
...
@@ -26,7 +26,6 @@ bool Params::mix = true;
...
@@ -26,7 +26,6 @@ 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
;
bool
Params
::
detect_speed_slow
=
false
;
double
Params
::
detect_speed_hint
=
-
1
;
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
;
...
...
src/wmcommon.hh
View file @
f5fcd8b6
...
@@ -46,7 +46,6 @@ public:
...
@@ -46,7 +46,6 @@ public:
static
int
have_key
;
static
int
have_key
;
static
bool
detect_speed
;
static
bool
detect_speed
;
static
bool
detect_speed_slow
;
static
double
detect_speed_hint
;
// for debugging --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
...
...
src/wmget.cc
View file @
f5fcd8b6
...
@@ -590,7 +590,7 @@ decode_and_report (const WavData& in_data, const string& orig_pattern)
...
@@ -590,7 +590,7 @@ decode_and_report (const WavData& in_data, const string& orig_pattern)
{
{
WavData
wav_data
;
WavData
wav_data
;
if
(
Params
::
detect_speed
||
Params
::
detect_speed_slow
)
if
(
Params
::
detect_speed
)
{
{
double
speed
=
detect_speed
(
in_data
);
double
speed
=
detect_speed
(
in_data
);
printf
(
"## delta %.5f %%
\n
"
,
100
*
fabs
(
speed
-
Params
::
detect_speed_hint
)
/
Params
::
detect_speed_hint
);
printf
(
"## delta %.5f %%
\n
"
,
100
*
fabs
(
speed
-
Params
::
detect_speed_hint
)
/
Params
::
detect_speed_hint
);
...
...
src/wmspeed.cc
View file @
f5fcd8b6
...
@@ -82,62 +82,6 @@ truncate (const WavData& in_data, double seconds)
...
@@ -82,62 +82,6 @@ truncate (const WavData& in_data, double seconds)
}
}
return
out_data
;
return
out_data
;
}
}
#if 0
static double
detect_speed (const WavData& wav_data, double center, double step, int n_steps, int seconds, double *quality_p)
{
WavData wd_truncated = truncate (wav_data, seconds * 1.5);
double best_speed = 1.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);
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);
WavData wd_resampled = resample_ratio (wd_truncated, speed, Params::mark_sample_rate);
wd_resampled = truncate (wd_resampled, seconds);
ResultSet result_set;
ClipDecoder clip_decoder;
clip_decoder.run (wd_resampled, result_set);
printf ("%f %f ", speed, result_set.best_quality());
if (result_set.best_quality() > 0)
{
printf ("\n");
if (result_set.best_quality() > best_quality)
{
best_quality = result_set.best_quality();
best_speed = speed;
}
}
else
printf ("\r");
fflush (stdout);
}
if (quality_p)
*quality_p = best_quality;
return best_speed;
}
#endif
class
SpeedSync
class
SpeedSync
{
{
...
@@ -464,49 +408,32 @@ get_speed_clip (double location, const WavData& in_data, double clip_seconds)
...
@@ -464,49 +408,32 @@ get_speed_clip (double location, const WavData& in_data, double clip_seconds)
double
double
detect_speed
(
const
WavData
&
in_data
)
detect_speed
(
const
WavData
&
in_data
)
{
{
if
(
Params
::
detect_speed_slow
)
/* SLOW */
double
clip_location
=
get_clip_location
(
in_data
);
{
#if 0
/* first pass: find approximation for speed */
speed = detect_speed (in_data, 1.0, 1.001, /* steps */ 200, /* seconds */ 15, nullptr);
/* second pass: refine speed */
/* speed is between 0.8 and 1.25, so we use a clip seconds factor of 1.3 to provide enough samples */
speed = detect_speed (in_data, speed, 1.00005, /* steps */ 20, /* seconds */ 50, nullptr);
WavData
in_clip_short
=
get_speed_clip
(
clip_location
,
in_data
,
21
*
1.3
);
#endif
WavData
in_clip_long
=
get_speed_clip
(
clip_location
,
in_data
,
50
*
1.3
);
return
42
;
// FIXME
}
else
/* better performance, less accurate */
{
double
speed
=
1.0
;
double
clip_location
=
get_clip_location
(
in_data
);
/* speed is between 0.8 and 1.25, so we use a clip seconds factor of 1.3 to provide enough samples */
ThreadPool
thread_pool
;
WavData
in_clip_short
=
get_speed_clip
(
clip_location
,
in_data
,
21
*
1.3
);
WavData
in_clip_long
=
get_speed_clip
(
clip_location
,
in_data
,
50
*
1.3
);
ThreadPool
thread_pool
;
/* first pass: find approximation for speed */
const
SpeedScanParams
scan1
/* first pass: find approximation for speed */
{
const
SpeedScanParams
scan1
.
seconds
=
21
,
{
.
step
=
1.0007
,
.
seconds
=
21
,
.
n_steps
=
5
,
.
step
=
1.0007
,
.
n_center_steps
=
28
.
n_steps
=
5
,
};
.
n_center_steps
=
28
double
speed
=
speed_scan
(
thread_pool
,
in_clip_short
,
scan1
,
/* start speed */
1.0
);
};
speed
=
speed_scan
(
thread_pool
,
in_clip_short
,
scan1
,
speed
);
/* second pass: fast refine (not always perfect) */
const
SpeedScanParams
scan2
/* second pass: fast refine (not always perfect) */
{
const
SpeedScanParams
scan2
.
seconds
=
50
,
{
.
step
=
1.00005
,
.
seconds
=
50
,
.
n_steps
=
20
,
.
step
=
1.00005
,
.
n_center_steps
=
0
.
n_steps
=
20
,
};
.
n_center_steps
=
0
speed
=
speed_scan
(
thread_pool
,
in_clip_long
,
scan2
,
speed
);
};
return
speed
;
speed
=
speed_scan
(
thread_pool
,
in_clip_long
,
scan2
,
speed
);
return
speed
;
}
}
}
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