[vlc-commits] Allow float mixer to run with 1.0 multiplier
Rémi Denis-Courmont
git at videolan.org
Mon May 30 18:43:57 CEST 2011
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Mon May 30 19:15:38 2011 +0300| [91307e828f43a6f1a578af262e0ad1f11711e73c] | committer: Rémi Denis-Courmont
Allow float mixer to run with 1.0 multiplier
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=91307e828f43a6f1a578af262e0ad1f11711e73c
---
modules/audio_mixer/float32.c | 13 +++++++------
1 files changed, 7 insertions(+), 6 deletions(-)
diff --git a/modules/audio_mixer/float32.c b/modules/audio_mixer/float32.c
index a391cd4..60a02c5 100644
--- a/modules/audio_mixer/float32.c
+++ b/modules/audio_mixer/float32.c
@@ -63,10 +63,6 @@ static int Create( vlc_object_t *p_this )
if ( p_mixer->fmt.i_format != VLC_CODEC_FL32 )
return -1;
- /* Use the trivial mixer when we can */
- if( p_mixer->multiplier == 1.0 && p_mixer->input->multiplier == 1.0 )
- return -1;
-
p_mixer->mix = DoWork;
return 0;
}
@@ -77,6 +73,12 @@ static int Create( vlc_object_t *p_this )
static void ScaleWords( float * p_out, const float * p_in, size_t i_nb_words,
float f_multiplier )
{
+ if( f_multiplier == 1.0 )
+ {
+ vlc_memcpy( p_out, p_in, i_nb_words * sizeof(float) );
+ return;
+ }
+
for( size_t i = 0; i < i_nb_words; i++ )
*p_out++ = *p_in++ * f_multiplier;
}
@@ -89,12 +91,11 @@ static void ScaleWords( float * p_out, const float * p_in, size_t i_nb_words,
*****************************************************************************/
static void DoWork( aout_mixer_t * p_mixer, aout_buffer_t * p_buffer )
{
- const float f_multiplier_global = p_mixer->multiplier;
const int i_nb_channels = aout_FormatNbChannels( &p_mixer->fmt );
int i_nb_words = p_buffer->i_nb_samples * i_nb_channels;
aout_mixer_input_t * p_input = p_mixer->input;
- float f_multiplier = f_multiplier_global * p_input->multiplier;
+ float f_multiplier = p_mixer->multiplier * p_input->multiplier;
float * p_out = (float *)p_buffer->p_buffer;
float * p_in = (float *)p_input->begin;
More information about the vlc-commits
mailing list