Commit bfe9c3c7 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont
Browse files

Mix 16-bits PCM instead of fixed-point if input is 16-bits or less

Audio output should be more efficient on FPU-less devices.
Firstly the mixer should be faster with 16-bits instead of 32.
Secondly FPU-less systems usually output at 16-bits, so one sample
format conversion between the mixer and the output is now avoided.
Thirdly conversion from input format to the mixer format should
similarly be completely avoided or at least accelerated.
parent 41d30c6a
......@@ -161,20 +161,26 @@ int aout_OutputNew( aout_instance_t * p_aout,
aout_FifoInit( p_aout, &p_aout->output.fifo, p_aout->output.output.i_rate );
aout_FormatPrint( p_aout, "output", &p_aout->output.output );
/* Calculate the resulting mixer output format. */
/* Choose the mixer format. */
p_aout->mixer_format = p_aout->output.output;
if ( !AOUT_FMT_NON_LINEAR(&p_aout->output.output) )
/* Non-S/PDIF mixer only deals with float32 or fixed32. */
aout_FormatPrepare( &p_aout->mixer_format );
if ( AOUT_FMT_NON_LINEAR(&p_aout->output.output) )
p_aout->mixer_format.i_format = p_format->i_format;
/* Most audio filters can only deal with single-precision,
* so lets always use that when hardware supports floating point. */
if( HAVE_FPU )
p_aout->mixer_format.i_format = VLC_CODEC_FL32;
/* Otherwise, audio filters will not work. Use fixed-point if the input has
* more than 16-bits depth. */
if( p_format->i_bitspersample > 16 )
p_aout->mixer_format.i_format = VLC_CODEC_FI32;
/* Fallback to 16-bits. This avoids pointless conversion to and from
* 32-bits samples for the sole purpose of software mixing. */
p_aout->mixer_format.i_format = VLC_CODEC_S16N;
aout_FormatPrepare( &p_aout->mixer_format );
aout_FormatPrint( p_aout, "mixer", &p_aout->mixer_format );
/* Create filters. */
Supports Markdown
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