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
df0aa64d
Commit
df0aa64d
authored
Nov 02, 2020
by
Stefan Westerfeld
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implement multiple center based speed scan.
Signed-off-by:
Stefan Westerfeld
<
stefan@space.twc.de
>
parent
b11f3c50
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
3 deletions
+22
-3
wmget.cc
src/wmget.cc
+22
-3
No files found.
src/wmget.cc
View file @
df0aa64d
...
@@ -1137,12 +1137,30 @@ public:
...
@@ -1137,12 +1137,30 @@ public:
}
}
};
};
static
void
speed_scan
(
const
WavData
&
in_data
)
{
SpeedSync
::
Score
best_s
;
const
int
n_center_steps
=
2
;
const
int
n_steps
=
10
;
const
double
step
=
1.001
;
for
(
int
c
=
-
n_center_steps
;
c
<=
n_center_steps
;
c
++
)
{
double
c_speed
=
pow
(
step
,
c
*
(
n_steps
*
2
+
1
));
SpeedSync
speed_sync
;
SpeedSync
::
Score
s
=
speed_sync
.
search
(
in_data
,
c_speed
,
step
,
n_steps
);
if
(
s
.
quality
>
best_s
.
quality
)
best_s
=
s
;
}
printf
(
"## %f %f
\n
"
,
best_s
.
speed
,
best_s
.
quality
);
}
static
int
static
int
decode_and_report
(
const
WavData
&
in_data
,
const
string
&
orig_pattern
)
decode_and_report
(
const
WavData
&
in_data
,
const
string
&
orig_pattern
)
{
{
SpeedSync
speed_sync
;
speed_scan
(
in_data
);
SpeedSync
::
Score
s
=
speed_sync
.
search
(
in_data
,
1.0
,
1.001
,
20
);
printf
(
"## %f %f
\n
"
,
s
.
speed
,
s
.
quality
);
return
0
;
return
0
;
WavData
wav_data
;
WavData
wav_data
;
...
@@ -1229,6 +1247,7 @@ void
...
@@ -1229,6 +1247,7 @@ void
SpeedSync
::
prepare_mags
(
const
WavData
&
in_data
,
double
center
)
SpeedSync
::
prepare_mags
(
const
WavData
&
in_data
,
double
center
)
{
{
WavData
in_data_trc
(
truncate
(
in_data
,
15
));
WavData
in_data_trc
(
truncate
(
in_data
,
15
));
// FIXME: can crash if SR=22050
WavData
in_data_sub
(
resample
(
in_data_trc
,
Params
::
mark_sample_rate
/
2
));
WavData
in_data_sub
(
resample
(
in_data_trc
,
Params
::
mark_sample_rate
/
2
));
// we downsample the audio by factor 2 to improve performance
// we downsample the audio by factor 2 to improve performance
...
...
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