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
f0f0a364
Commit
f0f0a364
authored
Oct 20, 2020
by
Stefan Westerfeld
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Correct speed before decode.
Signed-off-by:
Stefan Westerfeld
<
stefan@space.twc.de
>
parent
a746531d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
6 deletions
+25
-6
wmget.cc
src/wmget.cc
+25
-6
No files found.
src/wmget.cc
View file @
f0f0a364
...
@@ -1046,9 +1046,11 @@ truncate (const WavData& in_data, int seconds)
...
@@ -1046,9 +1046,11 @@ truncate (const WavData& in_data, int seconds)
return
out_data
;
return
out_data
;
}
}
static
float
static
double
detect_speed
(
const
WavData
&
wav_data
)
detect_speed
(
const
WavData
&
wav_data
)
{
{
double
best_speed
=
1.0
;
double
best_quality
=
0
;
for
(
int
p
=
-
20
;
p
<=
20
;
p
++
)
for
(
int
p
=
-
20
;
p
<=
20
;
p
++
)
{
{
double
speed
=
pow
(
1.001
,
p
);
double
speed
=
pow
(
1.001
,
p
);
...
@@ -1064,21 +1066,38 @@ detect_speed (const WavData& wav_data)
...
@@ -1064,21 +1066,38 @@ detect_speed (const WavData& wav_data)
clip_decoder
.
run
(
wd_resampled
,
result_set
);
clip_decoder
.
run
(
wd_resampled
,
result_set
);
printf
(
"%f %f "
,
speed
,
result_set
.
best_quality
());
printf
(
"%f %f "
,
speed
,
result_set
.
best_quality
());
if
(
result_set
.
best_quality
()
>
0
)
if
(
result_set
.
best_quality
()
>
0
)
printf
(
"
\n
"
);
{
printf
(
"
\n
"
);
if
(
result_set
.
best_quality
()
>
best_quality
)
{
best_quality
=
result_set
.
best_quality
();
best_speed
=
speed
;
}
}
else
else
printf
(
"
\r
"
);
printf
(
"
\r
"
);
fflush
(
stdout
);
fflush
(
stdout
);
}
}
return
1.0
;
return
best_speed
;
}
}
static
int
static
int
decode_and_report
(
const
WavData
&
wav
_data
,
const
string
&
orig_pattern
)
decode_and_report
(
const
WavData
&
in
_data
,
const
string
&
orig_pattern
)
{
{
WavData
wav_data
;
if
(
Params
::
detect_speed
)
if
(
Params
::
detect_speed
)
{
{
detect_speed
(
wav_data
);
double
speed
=
detect_speed
(
in_data
);
return
1
;
int
r
=
Params
::
mark_sample_rate
*
speed
;
if
(
r
!=
Params
::
mark_sample_rate
)
wav_data
=
resample
(
in_data
,
Params
::
mark_sample_rate
*
speed
);
else
wav_data
=
in_data
;
}
else
{
wav_data
=
in_data
;
}
}
ResultSet
result_set
;
ResultSet
result_set
;
...
...
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