Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc
Commits
dfbb6e18
Commit
dfbb6e18
authored
Nov 02, 2015
by
Thomas Guillem
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
soxr: factor output len calculation
parent
5ad44ad0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
3 deletions
+10
-3
modules/audio_filter/resampler/soxr.c
modules/audio_filter/resampler/soxr.c
+10
-3
No files found.
modules/audio_filter/resampler/soxr.c
View file @
dfbb6e18
...
...
@@ -212,6 +212,14 @@ Close( vlc_object_t *p_obj )
free
(
p_sys
);
}
static
size_t
SoXR_GetOutLen
(
size_t
i_ilen
,
double
f_ratio
)
{
/* Processed output len might be a little bigger than expected. Indeed SoXR
* can hold a few samples to meet the need of the resampling filter. */
return
lrint
(
(
i_ilen
+
2
)
*
f_ratio
*
11
.
/
10
.
);
}
static
block_t
*
Resample
(
filter_t
*
p_filter
,
block_t
*
p_in
)
{
...
...
@@ -244,13 +252,12 @@ Resample( filter_t *p_filter, block_t *p_in )
if
(
f_ratio
==
1
.
0
f
)
return
p_in
;
/* processed output len might be a little bigger than expected */
i_olen
=
lrint
(
(
i_ilen
+
2
)
*
f_ratio
*
11
.
/
10
.
);
i_olen
=
SoXR_GetOutLen
(
i_ilen
,
f_ratio
);
soxr_set_io_ratio
(
p_sys
->
soxr
,
1
/
f_ratio
,
i_olen
);
}
else
i_olen
=
lrint
(
i_ilen
*
p_sys
->
f_fixed_ratio
);
i_olen
=
SoXR_GetOutLen
(
i_ilen
,
p_sys
->
f_fixed_ratio
);
/* Use input buffer as output if there is enough room */
block_t
*
p_out
=
i_ilen
>=
i_olen
?
p_in
...
...
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