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
112eef2c
Commit
112eef2c
authored
Dec 11, 2020
by
Stefan Westerfeld
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cleanup debugging output for speed detection, only print info in "cmp".
Signed-off-by:
Stefan Westerfeld
<
stefan@space.twc.de
>
parent
54e7f74a
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
24 additions
and
25 deletions
+24
-25
TODO
src/TODO
+0
-1
wmget.cc
src/wmget.cc
+1
-3
wmspeed.cc
src/wmspeed.cc
+22
-20
wmspeed.hh
src/wmspeed.hh
+1
-1
No files found.
src/TODO
View file @
112eef2c
speed detection:
- double decode
- propagate debug flag from "cmp" to speed detect
- cleanup resampler api
- maybe truncate cleanup
- remove pad start scaling
...
...
src/wmget.cc
View file @
112eef2c
...
...
@@ -592,9 +592,7 @@ decode_and_report (const WavData& in_data, const string& orig_pattern)
WavData
wav_data
;
if
(
Params
::
detect_speed
)
{
double
speed
=
detect_speed
(
in_data
);
printf
(
"## delta %.5f %%
\n
"
,
100
*
fabs
(
speed
-
Params
::
detect_speed_hint
)
/
Params
::
detect_speed_hint
);
printf
(
"## speed refined %f
\n
"
,
speed
);
double
speed
=
detect_speed
(
in_data
,
!
orig_pattern
.
empty
());
int
r
=
Params
::
mark_sample_rate
*
speed
;
if
(
r
!=
Params
::
mark_sample_rate
)
...
...
src/wmspeed.cc
View file @
112eef2c
...
...
@@ -175,14 +175,14 @@ public:
};
static
double
speed_scan
(
ThreadPool
&
thread_pool
,
double
clip_location
,
const
WavData
&
in_data
,
const
SpeedScanParams
&
scan_params
,
double
speed
)
speed_scan
(
ThreadPool
&
thread_pool
,
double
clip_location
,
const
WavData
&
in_data
,
const
SpeedScanParams
&
scan_params
,
double
speed
,
bool
print_results
)
{
/* speed is between 0.8 and 1.25, so we use a clip seconds factor of 1.3 to provide enough samples */
WavData
in_clip
=
get_speed_clip
(
clip_location
,
in_data
,
scan_params
.
seconds
*
1.3
);
vector
<
std
::
unique_ptr
<
SpeedSync
>>
speed_sync
;
auto
t0
=
get_time
()
;
auto
t
=
get_time
()
;
vector
<
std
::
unique_ptr
<
SpeedSync
>>
speed_sync
;
for
(
int
c
=
-
scan_params
.
n_center_steps
;
c
<=
scan_params
.
n_center_steps
;
c
++
)
{
double
c_speed
=
speed
*
pow
(
scan_params
.
step
,
c
*
(
scan_params
.
n_steps
*
2
+
1
));
...
...
@@ -192,17 +192,15 @@ speed_scan (ThreadPool& thread_pool, double clip_location, const WavData& in_dat
for
(
auto
&
s
:
speed_sync
)
s
->
start_prepare_job
(
thread_pool
);
thread_pool
.
wait_all
();
printf
(
"## wait prepare jobs: %f
\n
"
,
get_time
()
-
t
);
t
=
get_time
();
for
(
auto
&
s
:
speed_sync
)
s
->
add_search_jobs
(
thread_pool
);
auto
t1
=
get_time
();
for
(
auto
&
s
:
speed_sync
)
s
->
start_search_jobs
(
thread_pool
);
thread_pool
.
wait_all
();
printf
(
"## wait search jobs: %f
\n
"
,
get_time
()
-
t
);
t
=
get_time
();
auto
t2
=
get_time
();
vector
<
SpeedSync
::
Score
>
scores
;
for
(
auto
&
s
:
speed_sync
)
...
...
@@ -232,11 +230,15 @@ speed_scan (ThreadPool& thread_pool, double clip_location, const WavData& in_dat
if
(
speed_count
)
best_speed
/=
speed_count
;
printf
(
"detect_speed_%.0f %f %f %f
\n
"
,
scan_params
.
seconds
,
best_speed
,
best_quality
,
100
*
fabs
(
best_speed
-
Params
::
detect_speed_hint
)
/
Params
::
detect_speed_hint
);
if
(
print_results
)
{
printf
(
"detect_speed %.0f %f %f %f %.3f %.3f
\n
"
,
scan_params
.
seconds
,
best_speed
,
best_quality
,
100
*
fabs
(
best_speed
-
Params
::
detect_speed_hint
)
/
Params
::
detect_speed_hint
,
t1
-
t0
,
t2
-
t1
);
}
return
best_speed
;
}
...
...
@@ -427,23 +429,23 @@ get_clip_location (const WavData& in_data)
}
double
detect_speed
(
const
WavData
&
in_data
)
detect_speed
(
const
WavData
&
in_data
,
bool
print_results
)
{
double
clip_location
=
get_clip_location
(
in_data
);
ThreadPool
thread_pool
;
/* n_center_steps / n_steps settings: speed approximately 0.8..1.25 */
/* first pass: find approximation for speed */
const
SpeedScanParams
scan1
{
.
seconds
=
21
,
/* step / n_steps / n_center_steps settings: speed approximately 0.8..1.25 */
.
step
=
1.0007
,
.
n_steps
=
5
,
.
n_center_steps
=
28
};
double
speed
=
speed_scan
(
thread_pool
,
clip_location
,
in_data
,
scan1
,
/* start speed */
1.0
);
double
speed
=
speed_scan
(
thread_pool
,
clip_location
,
in_data
,
scan1
,
/* start speed */
1.0
,
print_results
);
/* second pass: fast refine (not always perfect) */
const
SpeedScanParams
scan2
...
...
@@ -453,6 +455,6 @@ detect_speed (const WavData& in_data)
.
n_steps
=
20
,
.
n_center_steps
=
0
};
speed
=
speed_scan
(
thread_pool
,
clip_location
,
in_data
,
scan2
,
speed
);
speed
=
speed_scan
(
thread_pool
,
clip_location
,
in_data
,
scan2
,
speed
,
print_results
);
return
speed
;
}
src/wmspeed.hh
View file @
112eef2c
...
...
@@ -20,6 +20,6 @@
#include "wavdata.hh"
double
detect_speed
(
const
WavData
&
in_data
);
double
detect_speed
(
const
WavData
&
in_data
,
bool
print_results
);
#endif
/* AUDIOWMARK_WM_SPEED_HH */
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