Commit 0b764e2a authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

Move FL32->FI32 conversion to fixed plugin

parent e71c332d
...@@ -138,6 +138,7 @@ static block_t *Do_F32ToS16( filter_t * p_filter, block_t * p_in_buf ) ...@@ -138,6 +138,7 @@ static block_t *Do_F32ToS16( filter_t * p_filter, block_t * p_in_buf )
} }
/*** Conversions from decoders to FI32 */ /*** Conversions from decoders to FI32 */
static block_t *Do_FL32ToF32( filter_t *, block_t * );
static block_t *Do_S16ToF32( filter_t *, block_t * ); static block_t *Do_S16ToF32( filter_t *, block_t * );
static block_t *Do_U8ToF32( filter_t *, block_t * ); static block_t *Do_U8ToF32( filter_t *, block_t * );
...@@ -152,6 +153,10 @@ static int CreateTo( vlc_object_t *p_this ) ...@@ -152,6 +153,10 @@ static int CreateTo( vlc_object_t *p_this )
switch( p_filter->fmt_in.audio.i_format ) switch( p_filter->fmt_in.audio.i_format )
{ {
case VLC_CODEC_FL32:
p_filter->pf_audio_filter = Do_FL32ToF32;
break;
case VLC_CODEC_S16N: case VLC_CODEC_S16N:
p_filter->pf_audio_filter = Do_S16ToF32; p_filter->pf_audio_filter = Do_S16ToF32;
break; break;
...@@ -223,3 +228,16 @@ out: ...@@ -223,3 +228,16 @@ out:
block_Release( p_in_buf ); block_Release( p_in_buf );
return p_out_buf; return p_out_buf;
} }
static block_t *Do_FL32ToF32( filter_t * p_filter, block_t * p_in_buf )
{
const float * p_in = (float *)p_in_buf->p_buffer;
vlc_fixed_t * p_out = (vlc_fixed_t *)p_in_buf->p_buffer;
for ( unsigned i = p_in_buf->i_nb_samples
* aout_FormatNbChannels( &p_filter->fmt_in.audio ) ; i-- ; )
{
*p_out++ = (vlc_fixed_t)( *p_in++ * (float)FIXED32_ONE );
}
return p_in_buf;
}
...@@ -43,14 +43,12 @@ ...@@ -43,14 +43,12 @@
*****************************************************************************/ *****************************************************************************/
static int Create_F32ToFL32 ( vlc_object_t * ); static int Create_F32ToFL32 ( vlc_object_t * );
static block_t *Do_F32ToFL32( filter_t *, block_t * ); static block_t *Do_F32ToFL32( filter_t *, block_t * );
static block_t *Do_FL32ToF32 ( filter_t *, block_t * );
/***************************************************************************** /*****************************************************************************
* Module descriptor * Module descriptor
*****************************************************************************/ *****************************************************************************/
vlc_module_begin () vlc_module_begin ()
set_description( N_("Floating-point audio format conversions") ) set_description( N_("Floating-point audio format conversions") )
add_submodule ()
set_capability( "audio filter", 10 ) set_capability( "audio filter", 10 )
set_callbacks( Create_F32ToFL32, NULL ) set_callbacks( Create_F32ToFL32, NULL )
vlc_module_end () vlc_module_end ()
...@@ -62,26 +60,19 @@ static int Create_F32ToFL32( vlc_object_t *p_this ) ...@@ -62,26 +60,19 @@ static int Create_F32ToFL32( vlc_object_t *p_this )
{ {
filter_t * p_filter = (filter_t *)p_this; filter_t * p_filter = (filter_t *)p_this;
if( ( p_filter->fmt_in.audio.i_format != VLC_CODEC_FI32 if( p_filter->fmt_out.audio.i_format != VLC_CODEC_FL32
|| p_filter->fmt_out.audio.i_format != VLC_CODEC_FL32 ) || !AOUT_FMTS_SIMILAR( &p_filter->fmt_in.audio,
&& ( p_filter->fmt_in.audio.i_format != VLC_CODEC_FL32 &p_filter->fmt_out.audio ) )
|| p_filter->fmt_out.audio.i_format != VLC_CODEC_FI32 ) )
{
return VLC_EGENERIC; return VLC_EGENERIC;
}
if ( !AOUT_FMTS_SIMILAR( &p_filter->fmt_in.audio, &p_filter->fmt_out.audio ) ) switch( p_filter->fmt_in.audio.i_format )
{
return VLC_EGENERIC;
}
if( p_filter->fmt_in.audio.i_format == VLC_CODEC_FI32 )
{ {
case VLC_CODEC_FI32:
p_filter->pf_audio_filter = Do_F32ToFL32; p_filter->pf_audio_filter = Do_F32ToFL32;
} break;
else
{ default:
p_filter->pf_audio_filter = Do_FL32ToF32; return VLC_EGENERIC;
} }
return VLC_SUCCESS; return VLC_SUCCESS;
...@@ -101,16 +92,4 @@ static block_t *Do_F32ToFL32( filter_t * p_filter, block_t * p_in_buf ) ...@@ -101,16 +92,4 @@ static block_t *Do_F32ToFL32( filter_t * p_filter, block_t * p_in_buf )
return p_in_buf; return p_in_buf;
} }
static block_t *Do_FL32ToF32( filter_t * p_filter, block_t * p_in_buf )
{
int i;
float * p_in = (float *)p_in_buf->p_buffer;
vlc_fixed_t * p_out = (vlc_fixed_t *)p_in_buf->p_buffer;
for ( i = p_in_buf->i_nb_samples
* aout_FormatNbChannels( &p_filter->fmt_in.audio ) ; i-- ; )
{
*p_out++ = (vlc_fixed_t)( *p_in++ * (float)FIXED32_ONE );
}
return p_in_buf;
}
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