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
77d011e4
Commit
77d011e4
authored
Oct 20, 2020
by
Stefan Westerfeld
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Simple speed detection first pass.
Signed-off-by:
Stefan Westerfeld
<
stefan@space.twc.de
>
parent
6c456c7b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
40 additions
and
0 deletions
+40
-0
wmget.cc
src/wmget.cc
+40
-0
No files found.
src/wmget.cc
View file @
77d011e4
...
...
@@ -728,6 +728,15 @@ public:
}
printf
(
"match_count %d %zd
\n
"
,
match_count
,
patterns
.
size
());
}
double
best_quality
()
const
{
double
q
=
-
1
;
for
(
const
auto
&
pattern
:
patterns
)
if
(
pattern
.
sync_score
.
quality
>
q
)
q
=
pattern
.
sync_score
.
quality
;
return
q
;
}
};
/*
...
...
@@ -1022,9 +1031,40 @@ public:
}
};
static
float
detect_speed
(
const
WavData
&
wav_data
)
{
for
(
int
p
=
-
200
;
p
<=
200
;
p
++
)
{
double
speed
=
pow
(
1.001
,
p
);
WavData
wd_resampled
=
wav_data
;
if
(
p
!=
0
)
wd_resampled
=
resample
(
wav_data
,
Params
::
mark_sample_rate
*
speed
);
vector
<
float
>
short_samples
=
wd_resampled
.
samples
();
const
size_t
want_n_samples
=
wd_resampled
.
sample_rate
()
*
wd_resampled
.
n_channels
()
*
15
;
if
(
short_samples
.
size
()
>
want_n_samples
)
{
short_samples
.
resize
(
want_n_samples
);
wd_resampled
.
set_samples
(
short_samples
);
}
ResultSet
result_set
;
ClipDecoder
clip_decoder
;
clip_decoder
.
run
(
wd_resampled
,
result_set
);
printf
(
"%f %f
\n
"
,
speed
,
result_set
.
best_quality
());
}
return
1.0
;
}
static
int
decode_and_report
(
const
WavData
&
wav_data
,
const
string
&
orig_pattern
)
{
if
(
Params
::
detect_speed
)
{
detect_speed
(
wav_data
);
return
1
;
}
ResultSet
result_set
;
BlockDecoder
block_decoder
;
...
...
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