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
552b005a
Commit
552b005a
authored
Jun 18, 2009
by
Rémi Duraffort
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
No need to test for p_sys != NULL as it's already tested in the constructor.
parent
5b6db145
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
57 additions
and
64 deletions
+57
-64
modules/audio_filter/channel_mixer/mono.c
modules/audio_filter/channel_mixer/mono.c
+57
-64
No files found.
modules/audio_filter/channel_mixer/mono.c
View file @
552b005a
...
@@ -558,84 +558,77 @@ static void stereo2mono_downmix( aout_filter_t * p_filter,
...
@@ -558,84 +558,77 @@ static void stereo2mono_downmix( aout_filter_t * p_filter,
p_out
=
p_out_buf
->
p_buffer
;
p_out
=
p_out_buf
->
p_buffer
;
i_out_size
=
p_out_buf
->
i_nb_bytes
;
i_out_size
=
p_out_buf
->
i_nb_bytes
;
if
(
p_sys
!=
NULL
)
/* Slide the overflow buffer */
{
p_overflow
=
p_sys
->
p_overflow_buffer
;
/* Slide the overflow buffer */
i_overflow_size
=
p_sys
->
i_overflow_buffer_size
;
p_overflow
=
p_sys
->
p_overflow_buffer
;
i_overflow_size
=
p_sys
->
i_overflow_buffer_size
;
if
(
i_out_size
>
i_overflow_size
)
memcpy
(
p_out
,
p_overflow
,
i_overflow_size
);
else
memcpy
(
p_out
,
p_overflow
,
i_out_size
);
if
(
i_out_size
>
i_overflow_size
)
p_slide
=
p_sys
->
p_overflow_buffer
;
memcpy
(
p_out
,
p_overflow
,
i_overflow_size
);
while
(
p_slide
<
p_overflow
+
i_overflow_size
)
{
if
(
p_slide
+
i_out_size
<
p_overflow
+
i_overflow_size
)
{
memset
(
p_slide
,
0
,
i_out_size
);
if
(
p_slide
+
2
*
i_out_size
<
p_overflow
+
i_overflow_size
)
memcpy
(
p_slide
,
p_slide
+
i_out_size
,
i_out_size
);
else
memcpy
(
p_slide
,
p_slide
+
i_out_size
,
p_overflow
+
i_overflow_size
-
(
p_slide
+
i_out_size
)
);
}
else
else
memcpy
(
p_out
,
p_overflow
,
i_out_size
);
{
memset
(
p_slide
,
0
,
p_overflow
+
i_overflow_size
-
p_slide
);
}
p_slide
+=
i_out_size
;
}
/* apply the atomic operations */
for
(
i
=
0
;
i
<
p_sys
->
i_nb_atomic_operations
;
i
++
)
{
/* shorter variable names */
i_source_channel_offset
=
p_sys
->
p_atomic_operations
[
i
].
i_source_channel_offset
;
i_dest_channel_offset
=
p_sys
->
p_atomic_operations
[
i
].
i_dest_channel_offset
;
i_delay
=
p_sys
->
p_atomic_operations
[
i
].
i_delay
;
d_amplitude_factor
=
p_sys
->
p_atomic_operations
[
i
].
d_amplitude_factor
;
p_slide
=
p_sys
->
p_overflow_buffer
;
if
(
p_out_buf
->
i_nb_samples
>
i_delay
)
while
(
p_slide
<
p_overflow
+
i_overflow_size
)
{
{
if
(
p_slide
+
i_out_size
<
p_overflow
+
i_overflow_size
)
/* current buffer coefficients */
for
(
j
=
0
;
j
<
p_out_buf
->
i_nb_samples
-
i_delay
;
j
++
)
{
{
memset
(
p_slide
,
0
,
i_out_size
);
((
int16_t
*
)
p_out
)[
(
i_delay
+
j
)
*
i_output_nb
+
i_dest_channel_offset
]
if
(
p_slide
+
2
*
i_out_size
<
p_overflow
+
i_overflow_size
)
+=
p_in
[
j
*
i_input_nb
+
i_source_channel_offset
]
memcpy
(
p_slide
,
p_slide
+
i_out_size
,
i_out_size
);
*
d_amplitude_factor
;
else
memcpy
(
p_slide
,
p_slide
+
i_out_size
,
p_overflow
+
i_overflow_size
-
(
p_slide
+
i_out_size
)
);
}
}
else
/* overflow buffer coefficients */
for
(
j
=
0
;
j
<
i_delay
;
j
++
)
{
{
memset
(
p_slide
,
0
,
p_overflow
+
i_overflow_size
-
p_slide
);
((
int16_t
*
)
p_overflow
)[
j
*
i_output_nb
+
i_dest_channel_offset
]
+=
p_in
[
(
p_out_buf
->
i_nb_samples
-
i_delay
+
j
)
*
i_input_nb
+
i_source_channel_offset
]
*
d_amplitude_factor
;
}
}
p_slide
+=
i_out_size
;
}
}
else
/* apply the atomic operations */
for
(
i
=
0
;
i
<
p_sys
->
i_nb_atomic_operations
;
i
++
)
{
{
/* shorter variable names */
/* overflow buffer coefficients only */
i_source_channel_offset
for
(
j
=
0
;
j
<
p_out_buf
->
i_nb_samples
;
j
++
)
=
p_sys
->
p_atomic_operations
[
i
].
i_source_channel_offset
;
i_dest_channel_offset
=
p_sys
->
p_atomic_operations
[
i
].
i_dest_channel_offset
;
i_delay
=
p_sys
->
p_atomic_operations
[
i
].
i_delay
;
d_amplitude_factor
=
p_sys
->
p_atomic_operations
[
i
].
d_amplitude_factor
;
if
(
p_out_buf
->
i_nb_samples
>
i_delay
)
{
{
/* current buffer coefficients */
((
int16_t
*
)
p_overflow
)[
(
i_delay
-
p_out_buf
->
i_nb_samples
+
j
)
for
(
j
=
0
;
j
<
p_out_buf
->
i_nb_samples
-
i_delay
;
j
++
)
*
i_output_nb
+
i_dest_channel_offset
]
{
+=
p_in
[
j
*
i_input_nb
+
i_source_channel_offset
]
((
int16_t
*
)
p_out
)[
(
i_delay
+
j
)
*
i_output_nb
+
i_dest_channel_offset
]
*
d_amplitude_factor
;
+=
p_in
[
j
*
i_input_nb
+
i_source_channel_offset
]
*
d_amplitude_factor
;
}
/* overflow buffer coefficients */
for
(
j
=
0
;
j
<
i_delay
;
j
++
)
{
((
int16_t
*
)
p_overflow
)[
j
*
i_output_nb
+
i_dest_channel_offset
]
+=
p_in
[
(
p_out_buf
->
i_nb_samples
-
i_delay
+
j
)
*
i_input_nb
+
i_source_channel_offset
]
*
d_amplitude_factor
;
}
}
else
{
/* overflow buffer coefficients only */
for
(
j
=
0
;
j
<
p_out_buf
->
i_nb_samples
;
j
++
)
{
((
int16_t
*
)
p_overflow
)[
(
i_delay
-
p_out_buf
->
i_nb_samples
+
j
)
*
i_output_nb
+
i_dest_channel_offset
]
+=
p_in
[
j
*
i_input_nb
+
i_source_channel_offset
]
*
d_amplitude_factor
;
}
}
}
}
}
}
}
else
{
memset
(
p_out
,
0
,
i_out_size
);
}
}
}
/* Simple stereo to mono mixing. */
/* Simple stereo to mono mixing. */
...
...
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