[vlc-devel] commit: Move FL32->FI32 conversion to fixed plugin ( Rémi Denis-Courmont )
git version control
git at videolan.org
Sat Jan 30 12:59:16 CET 2010
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sat Jan 30 13:58:08 2010 +0200| [0b764e2a1ec922fb0fd11e6ade08192b3b9bd023] | committer: Rémi Denis-Courmont
Move FL32->FI32 conversion to fixed plugin
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=0b764e2a1ec922fb0fd11e6ade08192b3b9bd023
---
modules/audio_filter/converter/fixed.c | 18 +++++++++++++
modules/audio_filter/converter/float.c | 43 ++++++++-----------------------
2 files changed, 29 insertions(+), 32 deletions(-)
diff --git a/modules/audio_filter/converter/fixed.c b/modules/audio_filter/converter/fixed.c
index e982c6d..f994fda 100644
--- a/modules/audio_filter/converter/fixed.c
+++ b/modules/audio_filter/converter/fixed.c
@@ -138,6 +138,7 @@ static block_t *Do_F32ToS16( filter_t * p_filter, block_t * p_in_buf )
}
/*** 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_U8ToF32( filter_t *, block_t * );
@@ -152,6 +153,10 @@ static int CreateTo( vlc_object_t *p_this )
switch( p_filter->fmt_in.audio.i_format )
{
+ case VLC_CODEC_FL32:
+ p_filter->pf_audio_filter = Do_FL32ToF32;
+ break;
+
case VLC_CODEC_S16N:
p_filter->pf_audio_filter = Do_S16ToF32;
break;
@@ -223,3 +228,16 @@ out:
block_Release( p_in_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;
+}
diff --git a/modules/audio_filter/converter/float.c b/modules/audio_filter/converter/float.c
index 54d90ab..e362cf6 100644
--- a/modules/audio_filter/converter/float.c
+++ b/modules/audio_filter/converter/float.c
@@ -43,16 +43,14 @@
*****************************************************************************/
static int Create_F32ToFL32 ( vlc_object_t * );
static block_t *Do_F32ToFL32( filter_t *, block_t * );
-static block_t *Do_FL32ToF32 ( filter_t *, block_t * );
/*****************************************************************************
* Module descriptor
*****************************************************************************/
vlc_module_begin ()
set_description( N_("Floating-point audio format conversions") )
- add_submodule ()
- set_capability( "audio filter", 10 )
- set_callbacks( Create_F32ToFL32, NULL )
+ set_capability( "audio filter", 10 )
+ set_callbacks( Create_F32ToFL32, NULL )
vlc_module_end ()
/*****************************************************************************
@@ -62,26 +60,19 @@ static int Create_F32ToFL32( vlc_object_t *p_this )
{
filter_t * p_filter = (filter_t *)p_this;
- if( ( p_filter->fmt_in.audio.i_format != VLC_CODEC_FI32
- || p_filter->fmt_out.audio.i_format != VLC_CODEC_FL32 )
- && ( p_filter->fmt_in.audio.i_format != VLC_CODEC_FL32
- || p_filter->fmt_out.audio.i_format != VLC_CODEC_FI32 ) )
- {
+ if( p_filter->fmt_out.audio.i_format != VLC_CODEC_FL32
+ || !AOUT_FMTS_SIMILAR( &p_filter->fmt_in.audio,
+ &p_filter->fmt_out.audio ) )
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;
- }
+ case VLC_CODEC_FI32:
+ p_filter->pf_audio_filter = Do_F32ToFL32;
+ break;
- if( p_filter->fmt_in.audio.i_format == VLC_CODEC_FI32 )
- {
- p_filter->pf_audio_filter = Do_F32ToFL32;
- }
- else
- {
- p_filter->pf_audio_filter = Do_FL32ToF32;
+ default:
+ return VLC_EGENERIC;
}
return VLC_SUCCESS;
@@ -101,16 +92,4 @@ static block_t *Do_F32ToFL32( filter_t * p_filter, block_t * 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;
-}
More information about the vlc-devel
mailing list