Commit f9dfd984 authored by Jean-Paul Saman's avatar Jean-Paul Saman

combine two channels into mono for the dowmix as last step.

parent b19ddef0
......@@ -55,6 +55,8 @@ static block_t *Convert( filter_t *p_filter, block_t *p_block );
static unsigned int stereo_to_mono( aout_instance_t *, aout_filter_t *,
aout_buffer_t *, aout_buffer_t * );
static unsigned int mono( aout_instance_t *, aout_filter_t *,
aout_buffer_t *, aout_buffer_t * );
static void stereo2mono_downmix( aout_instance_t *, aout_filter_t *,
aout_buffer_t *, aout_buffer_t * );
......@@ -349,7 +351,7 @@ static int Init( vlc_object_t *p_this, struct filter_sys_t * p_data,
msg_Err( p_this, "out of memory" );
return -1;
}
memset( p_data->p_overflow_buffer, 0 , p_data->i_overflow_buffer_size );
memset( p_data->p_overflow_buffer, 0, p_data->i_overflow_buffer_size );
/* end */
return 0;
......@@ -526,6 +528,8 @@ static block_t *Convert( filter_t *p_filter, block_t *p_block )
{
stereo2mono_downmix( (aout_instance_t *)p_filter, &aout_filter,
&in_buf, &out_buf );
i_samples = mono( (aout_instance_t *)p_filter, &aout_filter,
&out_buf, &in_buf );
}
else
{
......@@ -654,6 +658,26 @@ static void stereo2mono_downmix( aout_instance_t * p_aout, aout_filter_t * p_fil
}
}
/* Simple stereo to mono mixing. */
static unsigned int mono( aout_instance_t * p_aout, aout_filter_t *p_filter,
aout_buffer_t *p_output, aout_buffer_t *p_input )
{
filter_sys_t *p_sys = (filter_sys_t *)p_filter->p_sys;
int16_t *p_in, *p_out;
unsigned int n = 0, r = 0;
p_in = (int16_t *) p_input->p_buffer;
p_out = (int16_t *) p_output->p_buffer;
while( n < (p_input->i_nb_samples * p_sys->i_nb_channels) )
{
p_out[r] = (p_in[n] + p_in[n+1]) >> 1;
r++;
n += 2;
}
return r;
}
/* Simple stereo to mono mixing. */
static unsigned int stereo_to_mono( aout_instance_t * p_aout, aout_filter_t *p_filter,
aout_buffer_t *p_output, aout_buffer_t *p_input )
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment