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
38feb73c
Commit
38feb73c
authored
May 31, 2011
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Ugly resampler: implement all linear formats
parent
095526d1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
17 deletions
+14
-17
modules/audio_filter/resampler/ugly.c
modules/audio_filter/resampler/ugly.c
+14
-17
No files found.
modules/audio_filter/resampler/ugly.c
View file @
38feb73c
...
...
@@ -59,17 +59,14 @@ static int Create( vlc_object_t *p_this )
{
filter_t
*
p_filter
=
(
filter_t
*
)
p_this
;
if
(
p_filter
->
fmt_in
.
audio
.
i_rate
==
p_filter
->
fmt_out
.
audio
.
i_rate
||
p_filter
->
fmt_in
.
audio
.
i_format
!=
p_filter
->
fmt_out
.
audio
.
i_format
||
p_filter
->
fmt_in
.
audio
.
i_physical_channels
!=
p_filter
->
fmt_out
.
audio
.
i_physical_channels
||
p_filter
->
fmt_in
.
audio
.
i_original_channels
!=
p_filter
->
fmt_out
.
audio
.
i_original_channels
||
(
p_filter
->
fmt_in
.
audio
.
i_format
!=
VLC_CODEC_FL32
&&
p_filter
->
fmt_in
.
audio
.
i_format
!=
VLC_CODEC_FI32
)
)
{
if
(
p_filter
->
fmt_in
.
audio
.
i_rate
==
p_filter
->
fmt_out
.
audio
.
i_rate
||
p_filter
->
fmt_in
.
audio
.
i_format
!=
p_filter
->
fmt_out
.
audio
.
i_format
||
p_filter
->
fmt_in
.
audio
.
i_physical_channels
!=
p_filter
->
fmt_out
.
audio
.
i_physical_channels
||
p_filter
->
fmt_in
.
audio
.
i_original_channels
!=
p_filter
->
fmt_out
.
audio
.
i_original_channels
||
AOUT_FMT_NON_LINEAR
(
&
p_filter
->
fmt_in
.
audio
)
)
return
VLC_EGENERIC
;
}
p_filter
->
pf_audio_filter
=
DoWork
;
return
VLC_SUCCESS
;
...
...
@@ -87,12 +84,12 @@ static block_t *DoWork( filter_t * p_filter, block_t * p_in_buf )
block_t
*
p_out_buf
=
p_in_buf
;
unsigned
int
i_out_nb
=
p_in_buf
->
i_nb_samples
*
p_filter
->
fmt_out
.
audio
.
i_rate
/
p_filter
->
fmt_in
.
audio
.
i_rate
;
const
unsigned
int
i_sample_bytes
=
aout_FormatNbChannels
(
&
p_filter
->
fmt_in
.
audio
)
*
sizeof
(
int32_t
);
const
unsigned
framesize
=
(
p_filter
->
fmt_in
.
audio
.
i_bitspersample
/
8
)
*
aout_FormatNbChannels
(
&
p_filter
->
fmt_in
.
audio
);
if
(
p_filter
->
fmt_out
.
audio
.
i_rate
>
p_filter
->
fmt_in
.
audio
.
i_rate
)
{
p_out_buf
=
block_Alloc
(
i_out_nb
*
i_sample_bytes
);
p_out_buf
=
block_Alloc
(
i_out_nb
*
framesize
);
if
(
!
p_out_buf
)
goto
out
;
}
...
...
@@ -102,7 +99,7 @@ static block_t *DoWork( filter_t * p_filter, block_t * p_in_buf )
unsigned
int
i_remainder
=
0
;
p_out_buf
->
i_nb_samples
=
i_out_nb
;
p_out_buf
->
i_buffer
=
i_out_nb
*
i_sample_bytes
;
p_out_buf
->
i_buffer
=
i_out_nb
*
framesize
;
p_out_buf
->
i_pts
=
p_in_buf
->
i_pts
;
p_out_buf
->
i_length
=
p_out_buf
->
i_nb_samples
*
1000000
/
p_filter
->
fmt_out
.
audio
.
i_rate
;
...
...
@@ -110,14 +107,14 @@ static block_t *DoWork( filter_t * p_filter, block_t * p_in_buf )
while
(
i_out_nb
)
{
if
(
p_out
!=
p_in
)
memcpy
(
p_out
,
p_in
,
i_sample_bytes
);
p_out
+=
i_sample_bytes
;
memcpy
(
p_out
,
p_in
,
framesize
);
p_out
+=
framesize
;
i_out_nb
--
;
i_remainder
+=
p_filter
->
fmt_in
.
audio
.
i_rate
;
while
(
i_remainder
>=
p_filter
->
fmt_out
.
audio
.
i_rate
)
{
p_in
+=
i_sample_bytes
;
p_in
+=
framesize
;
i_remainder
-=
p_filter
->
fmt_out
.
audio
.
i_rate
;
}
}
...
...
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