]> git.sesse.net Git - vlc/commitdiff
Merge all fixed-point and floating-point audio format converters
authorClément Stenac <zorglub@videolan.org>
Sun, 26 Nov 2006 18:59:52 +0000 (18:59 +0000)
committerClément Stenac <zorglub@videolan.org>
Sun, 26 Nov 2006 18:59:52 +0000 (18:59 +0000)
15 files changed:
configure.ac
modules/audio_filter/converter/Modules.am
modules/audio_filter/converter/fixed.c [moved from modules/audio_filter/converter/fixed32tos16.c with 54% similarity]
modules/audio_filter/converter/fixed32tofloat32.c [deleted file]
modules/audio_filter/converter/float.c [new file with mode: 0644]
modules/audio_filter/converter/float32tos16.c [deleted file]
modules/audio_filter/converter/float32tos8.c [deleted file]
modules/audio_filter/converter/float32tou16.c [deleted file]
modules/audio_filter/converter/float32tou8.c [deleted file]
modules/audio_filter/converter/s16tofixed32.c [deleted file]
modules/audio_filter/converter/s16tofloat32.c [deleted file]
modules/audio_filter/converter/s16tofloat32swab.c [deleted file]
modules/audio_filter/converter/s8tofloat32.c [deleted file]
modules/audio_filter/converter/u8tofixed32.c [deleted file]
modules/audio_filter/converter/u8tofloat32.c [deleted file]

index 8f5d579aee87130ec9c084c68648d4bd54a074be..6fc5fdd42b630b5ee1963e6359ebab36a9122620 100644 (file)
@@ -1108,7 +1108,7 @@ VLC_ADD_PLUGINS([dummy logger memcpy])
 VLC_ADD_PLUGINS([mpgv mpga m4v m4a h264 ps pva avi asf mp4 rawdv nsv real aiff mjpeg demuxdump flacsys tta])
 VLC_ADD_PLUGINS([cvdsub svcdsub spudec subsdec dvbsub mpeg_audio lpcm a52 dts cinepak flac])
 VLC_ADD_PLUGINS([deinterlace invert adjust transform wave ripple psychedelic gradient motionblur rv32 rotate noise])
-VLC_ADD_PLUGINS([fixed32tos16 s16tofixed32 u8tofixed32 mono])
+VLC_ADD_PLUGINS([converter_fixed mono])
 VLC_ADD_PLUGINS([trivial_resampler ugly_resampler])
 VLC_ADD_PLUGINS([trivial_channel_mixer trivial_mixer])
 VLC_ADD_PLUGINS([playlist export sgimb nsc xtag])
@@ -1128,7 +1128,7 @@ if test "${SYS}" != "mingwce"; then
   VLC_ADD_PLUGINS([aout_file linear_resampler bandlimited_resampler])
   VLC_ADD_PLUGINS([float32_mixer spdif_mixer simple_channel_mixer])
   VLC_ADD_PLUGINS([dolby_surround_decoder headphone_channel_mixer normvol equalizer param_eq])
-  VLC_ADD_PLUGINS([fixed32tofloat32 float32tos16 float32tos8 float32tou16 float32tou8 a52tospdif dtstospdif s16tofloat32 s16tofloat32swab s8tofloat32 u8tofloat32 audio_format])
+  VLC_ADD_PLUGINS([converter_float a52tospdif dtstospdif audio_format])
 fi
 
 dnl
index 76462b45d76cac354dcf22bb3be8ee9e19c9a945..f17af3ca5243459d8217cea5f295de195f880ac9 100644 (file)
@@ -1,17 +1,7 @@
-SOURCES_float32tos16 = float32tos16.c
-SOURCES_float32tos8 = float32tos8.c
-SOURCES_float32tou16 = float32tou16.c
-SOURCES_float32tou8 = float32tou8.c
+SOURCES_converter_fixed = fixed.c
+SOURCES_converter_float = float.c
 SOURCES_a52tospdif = a52tospdif.c
 SOURCES_a52tofloat32 = a52tofloat32.c
 SOURCES_dtstospdif = dtstospdif.c
 SOURCES_dtstofloat32 = dtstofloat32.c
-SOURCES_fixed32tos16 = fixed32tos16.c
-SOURCES_s16tofixed32 = s16tofixed32.c
-SOURCES_fixed32tofloat32 = fixed32tofloat32.c
-SOURCES_s16tofloat32 = s16tofloat32.c
-SOURCES_s16tofloat32swab = s16tofloat32swab.c
-SOURCES_s8tofloat32 = s8tofloat32.c
-SOURCES_u8tofixed32 = u8tofixed32.c
-SOURCES_u8tofloat32 = u8tofloat32.c
 SOURCES_mpgatofixed32 = mpgatofixed32.c
similarity index 54%
rename from modules/audio_filter/converter/fixed32tos16.c
rename to modules/audio_filter/converter/fixed.c
index c073a0473df23f16d1f505b80821f8a03c6d4af3..073a704aa1c8047bb7a892e22cd0ce109e9e9067 100644 (file)
@@ -1,10 +1,12 @@
 /*****************************************************************************
- * fixed32tos16.c : converter from fixed32 to signed 16 bits integer
+ * fixed.c: Fixed-point audio format conversions
  *****************************************************************************
  * Copyright (C) 2002, 2006 the VideoLAN team
  * $Id$
  *
  * Authors: Jean-Paul Saman <jpsaman _at_ videolan _dot_ org>
+ *          Marc Ariberti <marcari@videolan.org>
+ *          Samuel Hocevar <sam@zoy.org>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
 /*****************************************************************************
  * Local prototypes
  *****************************************************************************/
-static int  Create    ( vlc_object_t * );
+static int  Create_F32ToS16    ( vlc_object_t * );
+static void Do_F32ToS16( aout_instance_t *, aout_filter_t *, aout_buffer_t *,
+                         aout_buffer_t * );
 
-static void DoWork    ( aout_instance_t *, aout_filter_t *, aout_buffer_t *,
-                        aout_buffer_t * );
+static int  Create_S16ToF32    ( vlc_object_t * );
+static void Do_S16ToF32( aout_instance_t *, aout_filter_t *, aout_buffer_t *,
+                         aout_buffer_t * );
+
+static int  Create_U8ToF32    ( vlc_object_t * );
+static void Do_U8ToF32( aout_instance_t *, aout_filter_t *, aout_buffer_t *,
+                         aout_buffer_t * );
 
 /*****************************************************************************
  * Module descriptor
  *****************************************************************************/
 vlc_module_begin();
-    set_category( CAT_AUDIO );
-    set_subcategory( SUBCAT_AUDIO_MISC );
-    set_description( _("Audio filter for fixed32->s16 conversion") );
-    set_capability( "audio filter", 10 );
-    set_callbacks( Create, NULL );
+    set_description( _("Fixed point audio format conversions") );
+    add_submodule();
+        set_callbacks( Create_F32ToS16, NULL );
+        set_capability( "audio filter", 10 );
+    add_submodule();
+        set_callbacks( Create_S16ToF32, NULL );
+        set_capability( "audio filter", 15 );
+    add_submodule();
+        set_callbacks( Create_U8ToF32, NULL );
+        set_capability( "audio filter", 1 );
 vlc_module_end();
 
 /*****************************************************************************
- * Create: allocate trivial mixer
- *****************************************************************************
- * This function allocates and initializes a Crop vout method.
+ * F32 to S16
  *****************************************************************************/
-static int Create( vlc_object_t *p_this )
+static int Create_F32ToS16( vlc_object_t *p_this )
 {
     aout_filter_t * p_filter = (aout_filter_t *)p_this;
 
@@ -69,10 +81,10 @@ static int Create( vlc_object_t *p_this )
         return -1;
     }
 
-    p_filter->pf_do_work = DoWork;
+    p_filter->pf_do_work = Do_F32ToS16;
     p_filter->b_in_place = 1;
 
-    return 0;
+    return VLC_SUCCESS;;
 }
 
 /*****************************************************************************
@@ -98,77 +110,6 @@ static int Create( vlc_object_t *p_this )
 
 # define VLC_F_ONE VLC_F(0x10000000)
 
-struct audio_dither {
-    vlc_fixed_t error[3];
-    vlc_fixed_t random;
-};
-
-/********************************************************************
- * NAME:                prng()
- * DESCRIPTION: 32-bit pseudo-random number generator
- ********************************************************************/
-static inline unsigned long prng(unsigned long state)
-{
-    return (state * 0x0019660dL + 0x3c6ef35fL) & 0xffffffffL;
-}
-
-/********************************************************************
- * NAME:        mpg321_s24_to_s16_pcm()
- * DESCRIPTION: generic linear sample quantize and dither routine
- ********************************************************************/
-static inline int16_t mpg321_s24_to_s16_pcm(unsigned int bits, vlc_fixed_t sample,
-                                            struct audio_dither *dither)
-{
-    unsigned int scalebits;
-    vlc_fixed_t output, mask, random;
-
-    enum {
-        MIN = -VLC_F_ONE,
-        MAX = VLC_F_ONE - 1
-    };
-
-    /* noise shape */
-    sample += dither->error[0] - dither->error[1] + dither->error[2];
-
-    dither->error[2] = dither->error[1];
-    dither->error[1] = dither->error[0] / 2;
-
-    /* bias */
-    output = sample + (1L << (VLC_F_FRACBITS + 1 - bits - 1));
-
-    scalebits = VLC_F_FRACBITS + 1 - bits;
-    mask = (1L << scalebits) - 1;
-
-    /* dither */
-    random    = prng(dither->random);
-    output += (random & mask) - (dither->random & mask);
-
-    dither->random = random;
-
-    /* clip */
-    if (output > MAX) {
-        output = MAX;
-
-        if (sample > MAX)
-            sample = MAX;
-    }
-    else if (output < MIN) {
-        output = MIN;
-
-        if (sample < MIN)
-            sample = MIN;
-    }
-
-    /* quantize */
-    output &= ~mask;
-
-    /* error feedback */
-    dither->error[0] = sample - output;
-
-    /* scale */
-    return output >> scalebits;
-}
-
 /*****************************************************************************
  * s24_to_s16_pcm: Scale a 24 bit pcm sample to a 16 bit pcm sample.
  *****************************************************************************/
@@ -187,29 +128,108 @@ static inline int16_t s24_to_s16_pcm(vlc_fixed_t sample)
   return (sample >> (VLC_F_FRACBITS + 1 - 16));
 }
 
-/*****************************************************************************
- * DoWork: convert a buffer
- *****************************************************************************/
-static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter,
-                    aout_buffer_t * p_in_buf, aout_buffer_t * p_out_buf )
+static void Do_F32ToS16( aout_instance_t * p_aout, aout_filter_t * p_filter,
+                         aout_buffer_t * p_in_buf, aout_buffer_t * p_out_buf )
 {
     int i;
     vlc_fixed_t * p_in = (vlc_fixed_t *)p_in_buf->p_buffer;
     int16_t * p_out = (int16_t *)p_out_buf->p_buffer;
-#if 0
-    static struct audio_dither dither;
-#endif
 
     for ( i = p_in_buf->i_nb_samples
                * aout_FormatNbChannels( &p_filter->input ) ; i-- ; )
     {
-#if 0
-        /* Accurate scaling */
-        *p_out++ = mpg321_s24_to_s16_pcm(16, *p_in++, &dither);
-#endif
         /* Fast Scaling */
         *p_out++ = s24_to_s16_pcm(*p_in++);
     }
     p_out_buf->i_nb_samples = p_in_buf->i_nb_samples;
     p_out_buf->i_nb_bytes = p_in_buf->i_nb_bytes / 2;
 }
+
+
+/*****************************************************************************
+ * S16 to F32
+ *****************************************************************************/
+static int Create_S16ToF32( vlc_object_t *p_this )
+{
+    aout_filter_t * p_filter = (aout_filter_t *)p_this;
+
+    if ( p_filter->output.i_format != VLC_FOURCC('f','i','3','2')
+          || p_filter->input.i_format != AOUT_FMT_S16_NE )
+    {
+        return -1;
+    }
+
+    if ( !AOUT_FMTS_SIMILAR( &p_filter->input, &p_filter->output ) )
+    {
+        return -1;
+    }
+
+    p_filter->pf_do_work = Do_S16ToF32;
+    p_filter->b_in_place = 1;
+
+    return 0;
+}
+
+static void Do_S16ToF32( aout_instance_t * p_aout, aout_filter_t * p_filter,
+                         aout_buffer_t * p_in_buf, aout_buffer_t * p_out_buf )
+{
+    int i = p_in_buf->i_nb_samples * aout_FormatNbChannels( &p_filter->input );
+
+    /* We start from the end because b_in_place is true */
+    int16_t * p_in = (int16_t *)p_in_buf->p_buffer + i - 1;
+    vlc_fixed_t * p_out = (vlc_fixed_t *)p_out_buf->p_buffer + i - 1;
+
+    while( i-- )
+    {
+        *p_out = (vlc_fixed_t)( (int32_t)(*p_in) * (FIXED32_ONE >> 16) );
+        p_in--; p_out--;
+    }
+
+    p_out_buf->i_nb_samples = p_in_buf->i_nb_samples;
+    p_out_buf->i_nb_bytes = p_in_buf->i_nb_bytes
+            * sizeof(vlc_fixed_t) / sizeof(int16_t);
+}
+
+
+/*****************************************************************************
+ * U8 to F32
+ *****************************************************************************/
+static int Create_U8ToF32( vlc_object_t *p_this )
+{
+    aout_filter_t * p_filter = (aout_filter_t *)p_this;
+
+    if ( p_filter->input.i_format != VLC_FOURCC('u','8',' ',' ')
+          || p_filter->output.i_format != VLC_FOURCC('f','i','3','2') )
+    {
+        return -1;
+    }
+
+    if ( !AOUT_FMTS_SIMILAR( &p_filter->input, &p_filter->output ) )
+    {
+        return -1;
+    }
+
+    p_filter->pf_do_work = Do_U8ToF32;
+    p_filter->b_in_place = VLC_TRUE;
+
+    return 0;
+}
+
+static void Do_U8ToF32( aout_instance_t * p_aout, aout_filter_t * p_filter,
+                        aout_buffer_t * p_in_buf, aout_buffer_t * p_out_buf )
+{
+    int i = p_in_buf->i_nb_samples * aout_FormatNbChannels( &p_filter->input );
+
+    /* We start from the end because b_in_place is true */
+    uint8_t * p_in = (uint8_t *)p_in_buf->p_buffer + i - 1;
+    vlc_fixed_t * p_out = (vlc_fixed_t *)p_out_buf->p_buffer + i - 1;
+
+    while( i-- )
+    {
+        *p_out = (vlc_fixed_t)( (int32_t)(*p_in - 128) * (FIXED32_ONE / 128) );
+        p_in--; p_out--;
+    }
+
+    p_out_buf->i_nb_samples = p_in_buf->i_nb_samples;
+    p_out_buf->i_nb_bytes = p_in_buf->i_nb_bytes * sizeof(vlc_fixed_t);
+}
diff --git a/modules/audio_filter/converter/fixed32tofloat32.c b/modules/audio_filter/converter/fixed32tofloat32.c
deleted file mode 100644 (file)
index b93efa6..0000000
+++ /dev/null
@@ -1,129 +0,0 @@
-/*****************************************************************************
- * fixed32float32.c: converter from fixed32 to float32 bits integer
- *****************************************************************************
- * Copyright (C) 2002, 2006 the VideoLAN team
- * $Id$
- *
- * Authors: Jean-Paul Saman <jpsaman _at_ videolan _dot_ org>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
- *****************************************************************************/
-
-/*****************************************************************************
- * Preamble
- *****************************************************************************/
-#include <stdlib.h>                                      /* malloc(), free() */
-#include <string.h>
-
-#include <vlc/vlc.h>
-#include <vlc_aout.h>
-
-/*****************************************************************************
- * Local prototypes
- *****************************************************************************/
-static int  Create       ( vlc_object_t * );
-
-static void FixedToFloat ( aout_instance_t *, aout_filter_t *, aout_buffer_t *,
-                           aout_buffer_t * );
-static void FloatToFixed ( aout_instance_t *, aout_filter_t *, aout_buffer_t *,
-                           aout_buffer_t * );
-
-/*****************************************************************************
- * Module descriptor
- *****************************************************************************/
-vlc_module_begin();
-    set_category( CAT_AUDIO );
-    set_subcategory( SUBCAT_AUDIO_MISC );
-    set_description( _("Audio filter for fixed32<->float32 conversion") );
-    set_capability( "audio filter", 10 );
-    set_callbacks( Create, NULL );
-vlc_module_end();
-
-/*****************************************************************************
- * Create: allocate trivial mixer
- *****************************************************************************
- * This function allocates and initializes a Crop vout method.
- *****************************************************************************/
-static int Create( vlc_object_t *p_this )
-{
-    aout_filter_t * p_filter = (aout_filter_t *)p_this;
-
-    if( ( p_filter->input.i_format != VLC_FOURCC('f','i','3','2')
-           || p_filter->output.i_format != VLC_FOURCC('f','l','3','2') )
-      && ( p_filter->input.i_format != VLC_FOURCC('f','l','3','2')
-            || p_filter->output.i_format != VLC_FOURCC('f','i','3','2') ) )
-    {
-        return -1;
-    }
-
-    if ( !AOUT_FMTS_SIMILAR( &p_filter->input, &p_filter->output ) )
-    {
-        return -1;
-    }
-
-    if( p_filter->input.i_format == VLC_FOURCC('f','i','3','2') )
-    {
-        p_filter->pf_do_work = FixedToFloat;
-    }
-    else
-    {
-        p_filter->pf_do_work = FloatToFixed;
-    }
-
-    p_filter->b_in_place = 1;
-
-    return 0;
-}
-
-/*****************************************************************************
- * FixedToFloat: convert a buffer
- *****************************************************************************/
-static void FixedToFloat( aout_instance_t * p_aout, aout_filter_t * p_filter,
-                          aout_buffer_t * p_in_buf, aout_buffer_t * p_out_buf )
-{
-    int i;
-    vlc_fixed_t * p_in = (vlc_fixed_t *)p_in_buf->p_buffer;
-    float * p_out = (float *)p_out_buf->p_buffer;
-
-    for ( i = p_in_buf->i_nb_samples
-               * aout_FormatNbChannels( &p_filter->input ) ; i-- ; )
-    {
-        *p_out++ = (float)*p_in++ / (float)FIXED32_ONE;
-    }
-
-    p_out_buf->i_nb_samples = p_in_buf->i_nb_samples;
-    p_out_buf->i_nb_bytes = p_in_buf->i_nb_bytes;
-}
-
-/*****************************************************************************
- * FloatToFixed: convert a buffer
- *****************************************************************************/
-static void FloatToFixed( aout_instance_t * p_aout, aout_filter_t * p_filter,
-                          aout_buffer_t * p_in_buf, aout_buffer_t * p_out_buf )
-{
-    int i;
-    float * p_in = (float *)p_in_buf->p_buffer;
-    vlc_fixed_t * p_out = (vlc_fixed_t *)p_out_buf->p_buffer;
-
-    for ( i = p_in_buf->i_nb_samples
-               * aout_FormatNbChannels( &p_filter->input ) ; i-- ; )
-    {
-        *p_out++ = (vlc_fixed_t)( *p_in++ * (float)FIXED32_ONE );
-    }
-
-    p_out_buf->i_nb_samples = p_in_buf->i_nb_samples;
-    p_out_buf->i_nb_bytes = p_in_buf->i_nb_bytes;
-}
-
diff --git a/modules/audio_filter/converter/float.c b/modules/audio_filter/converter/float.c
new file mode 100644 (file)
index 0000000..c35e220
--- /dev/null
@@ -0,0 +1,660 @@
+/*****************************************************************************
+ * float.c: Floating point audio format conversions
+ *****************************************************************************
+ * Copyright (C) 2002, 2006 the VideoLAN team
+ * $Id$
+ *
+ * Authors: Jean-Paul Saman <jpsaman _at_ videolan _dot_ org>
+ *          Christophe Massiot <massiot@via.ecp.fr>
+ *          Samuel Hocevar <sam@zoy.org>
+ *          Xavier Maillard <zedek@fxgsproject.org>
+ *          Henri Fallon <henri@videolan.org>
+ *          Gildas Bazin <gbazin@netcourrier.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+
+/*****************************************************************************
+ * Preamble
+ *****************************************************************************/
+#include <vlc/vlc.h>
+#include <stdlib.h>                                      /* malloc(), free() */
+#include <string.h>
+
+#ifdef HAVE_UNISTD_H
+#   include <unistd.h>
+#endif
+
+#ifdef HAVE_ALLOCA_H
+#   include <alloca.h>
+#endif
+
+#include <vlc_aout.h>
+
+/*****************************************************************************
+ * Local prototypes
+ *****************************************************************************/
+static int  Create_F32ToFL32 ( vlc_object_t * );
+static void Do_F32ToFL32( aout_instance_t *, aout_filter_t *, aout_buffer_t *,
+                           aout_buffer_t * );
+static void Do_FL32ToF32 ( aout_instance_t *, aout_filter_t *, aout_buffer_t *,
+                           aout_buffer_t * );
+
+static int  Create_FL32ToS16 ( vlc_object_t * );
+static void Do_FL32ToS16( aout_instance_t *, aout_filter_t *, aout_buffer_t *,
+                           aout_buffer_t * );
+
+static int  Create_FL32ToS8 ( vlc_object_t * );
+static void Do_FL32ToS8( aout_instance_t *, aout_filter_t *, aout_buffer_t *,
+                           aout_buffer_t * );
+
+static int  Create_FL32ToU16 ( vlc_object_t * );
+static void Do_FL32ToU16( aout_instance_t *, aout_filter_t *, aout_buffer_t *,
+                           aout_buffer_t * );
+
+static int  Create_FL32ToU8 ( vlc_object_t * );
+static void Do_FL32ToU8( aout_instance_t *, aout_filter_t *, aout_buffer_t *,
+                           aout_buffer_t * );
+
+static int  Create_S16ToFL32( vlc_object_t * );
+static void Do_S16ToFL32( aout_instance_t *, aout_filter_t *, aout_buffer_t *,
+                           aout_buffer_t * );
+static void Do_S16ToFL24( aout_instance_t *, aout_filter_t *, aout_buffer_t *,
+                           aout_buffer_t * );
+
+static int  Create_S16ToFL32_SW( vlc_object_t * );
+static void Do_S16ToFL32_SW( aout_instance_t *, aout_filter_t *, aout_buffer_t *,
+                           aout_buffer_t * );
+static void Do_S16ToFL24_SW( aout_instance_t *, aout_filter_t *, aout_buffer_t *,
+                           aout_buffer_t * );
+
+static int  Create_S8ToFL32( vlc_object_t * );
+static void Do_S8ToFL32( aout_instance_t *, aout_filter_t *, aout_buffer_t *,
+                           aout_buffer_t * );
+
+static int  Create_U8ToFL32( vlc_object_t * );
+static void Do_U8ToFL32( aout_instance_t *, aout_filter_t *, aout_buffer_t *,
+                           aout_buffer_t * );
+
+/*****************************************************************************
+ * Module descriptor
+ *****************************************************************************/
+vlc_module_begin();
+    set_description( _("Floating-point audio format conversions") );
+    add_submodule();
+        set_capability( "audio filter", 10 );
+        set_callbacks( Create_F32ToFL32, NULL );
+    add_submodule();
+        set_capability( "audio filter", 1 );
+        set_callbacks( Create_FL32ToS16, NULL );
+    add_submodule();
+        set_capability( "audio filter", 1 );
+        set_callbacks( Create_FL32ToS8, NULL );
+    add_submodule();
+        set_capability( "audio filter", 1 );
+        set_callbacks( Create_FL32ToU16, NULL );
+    add_submodule();
+        set_capability( "audio filter", 1 );
+        set_callbacks( Create_FL32ToU8, NULL );
+    add_submodule();
+        set_capability( "audio filter", 1 );
+        set_callbacks( Create_S16ToFL32, NULL );
+    add_submodule();
+        set_capability( "audio filter", 1 );
+        set_callbacks( Create_S16ToFL32_SW, NULL ); /* Endianness conversion*/
+    add_submodule();
+        set_capability( "audio filter", 1 );
+        set_callbacks( Create_S8ToFL32, NULL );
+    add_submodule();
+        set_capability( "audio filter", 1 );
+        set_callbacks( Create_U8ToFL32, NULL );
+vlc_module_end();
+
+/*****************************************************************************
+ * Fixed 32 to Float 32 and backwards
+ *****************************************************************************/
+static int Create_F32ToFL32( vlc_object_t *p_this )
+{
+    aout_filter_t * p_filter = (aout_filter_t *)p_this;
+
+    if( ( p_filter->input.i_format != VLC_FOURCC('f','i','3','2')
+           || p_filter->output.i_format != VLC_FOURCC('f','l','3','2') )
+      && ( p_filter->input.i_format != VLC_FOURCC('f','l','3','2')
+            || p_filter->output.i_format != VLC_FOURCC('f','i','3','2') ) )
+    {
+        return -1;
+    }
+
+    if ( !AOUT_FMTS_SIMILAR( &p_filter->input, &p_filter->output ) )
+    {
+        return -1;
+    }
+
+    if( p_filter->input.i_format == VLC_FOURCC('f','i','3','2') )
+    {
+        p_filter->pf_do_work = Do_F32ToFL32;
+    }
+    else
+    {
+        p_filter->pf_do_work = Do_FL32ToF32;
+    }
+
+    p_filter->b_in_place = 1;
+
+    return 0;
+}
+
+static void Do_F32ToFL32( aout_instance_t * p_aout, aout_filter_t * p_filter,
+                          aout_buffer_t * p_in_buf, aout_buffer_t * p_out_buf )
+{
+    int i;
+    vlc_fixed_t * p_in = (vlc_fixed_t *)p_in_buf->p_buffer;
+    float * p_out = (float *)p_out_buf->p_buffer;
+
+    for ( i = p_in_buf->i_nb_samples
+               * aout_FormatNbChannels( &p_filter->input ) ; i-- ; )
+    {
+        *p_out++ = (float)*p_in++ / (float)FIXED32_ONE;
+    }
+
+    p_out_buf->i_nb_samples = p_in_buf->i_nb_samples;
+    p_out_buf->i_nb_bytes = p_in_buf->i_nb_bytes;
+}
+
+static void Do_FL32ToF32( aout_instance_t * p_aout, aout_filter_t * p_filter,
+                          aout_buffer_t * p_in_buf, aout_buffer_t * p_out_buf )
+{
+    int i;
+    float * p_in = (float *)p_in_buf->p_buffer;
+    vlc_fixed_t * p_out = (vlc_fixed_t *)p_out_buf->p_buffer;
+
+    for ( i = p_in_buf->i_nb_samples
+               * aout_FormatNbChannels( &p_filter->input ) ; i-- ; )
+    {
+        *p_out++ = (vlc_fixed_t)( *p_in++ * (float)FIXED32_ONE );
+    }
+
+    p_out_buf->i_nb_samples = p_in_buf->i_nb_samples;
+    p_out_buf->i_nb_bytes = p_in_buf->i_nb_bytes;
+}
+
+/*****************************************************************************
+ * FL32 To S16
+ *****************************************************************************/
+static int Create_FL32ToS16( vlc_object_t *p_this )
+{
+    aout_filter_t * p_filter = (aout_filter_t *)p_this;
+
+    if ( p_filter->input.i_format != VLC_FOURCC('f','l','3','2')
+          || p_filter->output.i_format != AOUT_FMT_S16_NE )
+    {
+        return -1;
+    }
+
+    if ( !AOUT_FMTS_SIMILAR( &p_filter->input, &p_filter->output ) )
+    {
+        return -1;
+    }
+
+    p_filter->pf_do_work = Do_FL32ToS16;
+    p_filter->b_in_place = 1;
+
+    return 0;
+}
+
+static void Do_FL32ToS16( aout_instance_t * p_aout, aout_filter_t * p_filter,
+                          aout_buffer_t * p_in_buf, aout_buffer_t * p_out_buf )
+{
+    int i;
+    float * p_in = (float *)p_in_buf->p_buffer;
+    int16_t * p_out = (int16_t *)p_out_buf->p_buffer;
+
+    for ( i = p_in_buf->i_nb_samples
+               * aout_FormatNbChannels( &p_filter->input ); i-- ; )
+    {
+#if 0
+        /* Slow version. */
+        if ( *p_in >= 1.0 ) *p_out = 32767;
+        else if ( *p_in < -1.0 ) *p_out = -32768;
+        else *p_out = *p_in * 32768.0;
+#else
+        /* This is walken's trick based on IEEE float format. */
+        union { float f; int32_t i; } u;
+        u.f = *p_in + 384.0;
+        if ( u.i > 0x43c07fff ) *p_out = 32767;
+        else if ( u.i < 0x43bf8000 ) *p_out = -32768;
+        else *p_out = u.i - 0x43c00000;
+#endif
+        p_in++; p_out++;
+    }
+
+    p_out_buf->i_nb_samples = p_in_buf->i_nb_samples;
+    p_out_buf->i_nb_bytes = p_in_buf->i_nb_bytes / 2;
+}
+
+/*****************************************************************************
+ * FL32 To S8
+ *****************************************************************************/
+static int Create_FL32ToS8( vlc_object_t *p_this )
+{
+    aout_filter_t * p_filter = (aout_filter_t *)p_this;
+
+    if ( p_filter->input.i_format != VLC_FOURCC('f','l','3','2')
+          || p_filter->output.i_format != VLC_FOURCC('s','8',' ',' ') )
+    {
+        return -1;
+    }
+
+    if ( !AOUT_FMTS_SIMILAR( &p_filter->input, &p_filter->output ) )
+    {
+        return -1;
+    }
+
+    p_filter->pf_do_work = Do_FL32ToS8;
+    p_filter->b_in_place = 1;
+
+    return 0;
+}
+
+static void Do_FL32ToS8( aout_instance_t * p_aout, aout_filter_t * p_filter,
+                         aout_buffer_t * p_in_buf, aout_buffer_t * p_out_buf )
+{
+    int i;
+    float * p_in = (float *)p_in_buf->p_buffer;
+    int8_t * p_out = (int8_t *)p_out_buf->p_buffer;
+
+    for ( i = p_in_buf->i_nb_samples
+               * aout_FormatNbChannels( &p_filter->input ); i-- ; )
+    {
+        if ( *p_in >= 1.0 ) *p_out = 127;
+        else if ( *p_in < -1.0 ) *p_out = -128;
+        else *p_out = (int8_t)(*p_in * 128);
+        p_in++; p_out++;
+    }
+
+    p_out_buf->i_nb_samples = p_in_buf->i_nb_samples;
+    p_out_buf->i_nb_bytes = p_in_buf->i_nb_bytes / 4;
+}
+
+/*****************************************************************************
+ * FL32 To U16
+ *****************************************************************************/
+static int Create_FL32ToU16( vlc_object_t *p_this )
+{
+    aout_filter_t * p_filter = (aout_filter_t *)p_this;
+
+    if ( p_filter->input.i_format != VLC_FOURCC('f','l','3','2')
+          || p_filter->output.i_format != AOUT_FMT_U16_NE )
+    {
+        return -1;
+    }
+
+    if ( !AOUT_FMTS_SIMILAR( &p_filter->input, &p_filter->output ) )
+    {
+        return -1;
+    }
+
+    p_filter->pf_do_work = Do_FL32ToU16;
+    p_filter->b_in_place = 1;
+
+    return 0;
+}
+
+static void Do_FL32ToU16( aout_instance_t * p_aout, aout_filter_t * p_filter,
+                          aout_buffer_t * p_in_buf, aout_buffer_t * p_out_buf )
+{
+    int i;
+    float * p_in = (float *)p_in_buf->p_buffer;
+    uint16_t * p_out = (uint16_t *)p_out_buf->p_buffer;
+
+    for ( i = p_in_buf->i_nb_samples
+               * aout_FormatNbChannels( &p_filter->input ); i-- ; )
+    {
+        if ( *p_in >= 1.0 ) *p_out = 65535;
+        else if ( *p_in < -1.0 ) *p_out = 0;
+        else *p_out = (uint16_t)(32768 + *p_in * 32768);
+        p_in++; p_out++;
+    }
+
+    p_out_buf->i_nb_samples = p_in_buf->i_nb_samples;
+    p_out_buf->i_nb_bytes = p_in_buf->i_nb_bytes / 2;
+}
+
+/*****************************************************************************
+ * FL32 To U8
+ *****************************************************************************/
+static int Create_FL32ToU8( vlc_object_t *p_this )
+{
+    aout_filter_t * p_filter = (aout_filter_t *)p_this;
+
+    if ( p_filter->input.i_format != VLC_FOURCC('f','l','3','2')
+          || p_filter->output.i_format != VLC_FOURCC('u','8',' ',' ') )
+    {
+        return -1;
+    }
+
+    if ( !AOUT_FMTS_SIMILAR( &p_filter->input, &p_filter->output ) )
+    {
+        return -1;
+    }
+
+    p_filter->pf_do_work = Do_FL32ToU8;
+    p_filter->b_in_place = 1;
+
+    return 0;
+}
+
+static void Do_FL32ToU8( aout_instance_t * p_aout, aout_filter_t * p_filter,
+                         aout_buffer_t * p_in_buf, aout_buffer_t * p_out_buf )
+{
+    int i;
+    float * p_in = (float *)p_in_buf->p_buffer;
+    uint8_t * p_out = (uint8_t *)p_out_buf->p_buffer;
+
+    for ( i = p_in_buf->i_nb_samples
+               * aout_FormatNbChannels( &p_filter->input ); i-- ; )
+    {
+        if ( *p_in >= 1.0 ) *p_out = 255;
+        else if ( *p_in < -1.0 ) *p_out = 0;
+        else *p_out = (uint8_t)(128 + *p_in * 128);
+        p_in++; p_out++;
+    }
+
+    p_out_buf->i_nb_samples = p_in_buf->i_nb_samples;
+    p_out_buf->i_nb_bytes = p_in_buf->i_nb_bytes / 4;
+}
+
+/*****************************************************************************
+ * S16 To Float32
+ *****************************************************************************/
+static int Create_S16ToFL32( vlc_object_t *p_this )
+{
+    aout_filter_t * p_filter = (aout_filter_t *)p_this;
+
+    if ( ( p_filter->input.i_format != AOUT_FMT_S16_NE &&
+           p_filter->input.i_format != AOUT_FMT_S24_NE )
+          || p_filter->output.i_format != VLC_FOURCC('f','l','3','2') )
+    {
+        return -1;
+    }
+
+    if ( !AOUT_FMTS_SIMILAR( &p_filter->input, &p_filter->output ) )
+    {
+        return -1;
+    }
+
+    if( p_filter->input.i_format == AOUT_FMT_S24_NE )
+        p_filter->pf_do_work = Do_S16ToFL24;
+    else
+        p_filter->pf_do_work = Do_S16ToFL32;
+
+    p_filter->b_in_place = VLC_TRUE;
+
+    return 0;
+}
+
+static void Do_S16ToFL32( aout_instance_t * p_aout, aout_filter_t * p_filter,
+                          aout_buffer_t * p_in_buf, aout_buffer_t * p_out_buf )
+{
+    int i = p_in_buf->i_nb_samples * aout_FormatNbChannels( &p_filter->input );
+
+    /* We start from the end because b_in_place is true */
+    int16_t * p_in = (int16_t *)p_in_buf->p_buffer + i - 1;
+    float * p_out = (float *)p_out_buf->p_buffer + i - 1;
+
+    while( i-- )
+    {
+#if 0
+        /* Slow version */
+        *p_out = (float)*p_in / 32768.0;
+#else
+        /* This is walken's trick based on IEEE float format. On my PIII
+         * this takes 16 seconds to perform one billion conversions, instead
+         * of 19 seconds for the above division. */
+        union { float f; int32_t i; } u;
+        u.i = *p_in + 0x43c00000;
+        *p_out = u.f - 384.0;
+#endif
+
+        p_in--; p_out--;
+    }
+
+    p_out_buf->i_nb_samples = p_in_buf->i_nb_samples;
+    p_out_buf->i_nb_bytes = p_in_buf->i_nb_bytes * 2;
+}
+
+static void Do_S16ToFL24( aout_instance_t * p_aout, aout_filter_t * p_filter,
+                          aout_buffer_t * p_in_buf, aout_buffer_t * p_out_buf )
+{
+    int i = p_in_buf->i_nb_samples * aout_FormatNbChannels( &p_filter->input );
+
+    /* We start from the end because b_in_place is true */
+    uint8_t * p_in = (uint8_t *)p_in_buf->p_buffer + (i - 1) * 3;
+    float * p_out = (float *)p_out_buf->p_buffer + i - 1;
+
+    while( i-- )
+    {
+#ifdef WORDS_BIGENDIAN
+        *p_out = ((float)( (((int32_t)*(int16_t *)(p_in)) << 8) + p_in[2]))
+#else
+        *p_out = ((float)( (((int32_t)*(int16_t *)(p_in+1)) << 8) + p_in[0]))
+#endif
+            / 8388608.0;
+
+        p_in -= 3; p_out--;
+    }
+
+    p_out_buf->i_nb_samples = p_in_buf->i_nb_samples;
+    p_out_buf->i_nb_bytes = p_in_buf->i_nb_bytes * 4 / 3;
+}
+
+/*****************************************************************************
+ * S16 To Float32 with endianness conversion
+ *****************************************************************************/
+static int Create_S16ToFL32_SW( vlc_object_t *p_this )
+{
+    aout_filter_t * p_filter = (aout_filter_t *)p_this;
+
+    if ( !AOUT_FMTS_SIMILAR( &p_filter->input, &p_filter->output ) )
+    {
+        return -1;
+    }
+
+    if ( (p_filter->input.i_format == VLC_FOURCC('s','1','6','l') ||
+         p_filter->input.i_format == VLC_FOURCC('s','1','6','b'))
+         && p_filter->output.i_format == VLC_FOURCC('f','l','3','2')
+         && p_filter->input.i_format != AOUT_FMT_S16_NE )
+    {
+        p_filter->pf_do_work = Do_S16ToFL32_SW;
+        p_filter->b_in_place = VLC_TRUE;
+
+        return 0;
+    }
+
+    if ( (p_filter->input.i_format == VLC_FOURCC('s','2','4','l') ||
+         p_filter->input.i_format == VLC_FOURCC('s','2','4','b'))
+         && p_filter->output.i_format == VLC_FOURCC('f','l','3','2')
+         && p_filter->input.i_format != AOUT_FMT_S24_NE )
+    {
+        p_filter->pf_do_work = Do_S16ToFL24_SW;
+        p_filter->b_in_place = VLC_TRUE;
+
+        return 0;
+    }
+    return -1;
+}
+
+static void Do_S16ToFL32_SW( aout_instance_t * p_aout, aout_filter_t * p_filter,
+                          aout_buffer_t * p_in_buf, aout_buffer_t * p_out_buf )
+{
+    int i = p_in_buf->i_nb_samples * aout_FormatNbChannels( &p_filter->input );
+
+    /* We start from the end because b_in_place is true */
+    int16_t * p_in;
+    float * p_out = (float *)p_out_buf->p_buffer + i - 1;
+
+#ifdef HAVE_SWAB
+#   ifdef HAVE_ALLOCA
+    int16_t * p_swabbed = alloca( i * sizeof(int16_t) );
+#   else
+    int16_t * p_swabbed = malloc( i * sizeof(int16_t) );
+#   endif
+
+    swab( p_in_buf->p_buffer, (void *)p_swabbed, i * sizeof(int16_t) );
+    p_in = p_swabbed + i - 1;
+
+#else
+    byte_t p_tmp[2];
+    p_in = (int16_t *)p_in_buf->p_buffer + i - 1;
+#endif
+
+    while( i-- )
+    {
+#ifndef HAVE_SWAB
+        p_tmp[0] = ((byte_t *)p_in)[1];
+        p_tmp[1] = ((byte_t *)p_in)[0];
+        *p_out = (float)( *(int16_t *)p_tmp ) / 32768.0;
+#else
+        *p_out = (float)*p_in / 32768.0;
+#endif
+        p_in--; p_out--;
+    }
+
+#ifdef HAVE_SWAB
+#   ifndef HAVE_ALLOCA
+    free( p_swabbed );
+#   endif
+#endif
+
+    p_out_buf->i_nb_samples = p_in_buf->i_nb_samples;
+    p_out_buf->i_nb_bytes = p_in_buf->i_nb_bytes * 2;
+}
+
+static void Do_S16ToFL24_SW( aout_instance_t * p_aout, aout_filter_t * p_filter,
+                           aout_buffer_t * p_in_buf, aout_buffer_t * p_out_buf )
+{
+    int i = p_in_buf->i_nb_samples * aout_FormatNbChannels( &p_filter->input );
+
+    /* We start from the end because b_in_place is true */
+    uint8_t * p_in = (uint8_t *)p_in_buf->p_buffer + (i - 1) * 3;
+    float * p_out = (float *)p_out_buf->p_buffer + i - 1;
+
+    byte_t p_tmp[3];
+
+    while( i-- )
+    {
+        p_tmp[0] = p_in[2];
+        p_tmp[1] = p_in[1];
+        p_tmp[2] = p_in[0];
+
+#ifdef WORDS_BIGENDIAN
+        *p_out = ((float)( (((int32_t)*(int16_t *)(p_tmp)) << 8) + p_tmp[2]))
+#else
+        *p_out = ((float)( (((int32_t)*(int16_t *)(p_tmp+1)) << 8) + p_tmp[0]))
+#endif
+            / 8388608.0;
+
+        p_in -= 3; p_out--;
+    }
+
+    p_out_buf->i_nb_samples = p_in_buf->i_nb_samples;
+    p_out_buf->i_nb_bytes = p_in_buf->i_nb_bytes * 4 / 3;
+}
+
+/*****************************************************************************
+ * S8 To FL32
+ *****************************************************************************/
+static int Create_S8ToFL32( vlc_object_t *p_this )
+{
+    aout_filter_t * p_filter = (aout_filter_t *)p_this;
+
+    if ( p_filter->input.i_format != VLC_FOURCC('s','8',' ',' ')
+          || p_filter->output.i_format != VLC_FOURCC('f','l','3','2') )
+    {
+        return -1;
+    }
+
+    if ( !AOUT_FMTS_SIMILAR( &p_filter->input, &p_filter->output ) )
+    {
+        return -1;
+    }
+
+    p_filter->pf_do_work = Do_S8ToFL32;
+    p_filter->b_in_place = VLC_TRUE;
+
+    return 0;
+}
+
+static void Do_S8ToFL32( aout_instance_t * p_aout, aout_filter_t * p_filter,
+                         aout_buffer_t * p_in_buf, aout_buffer_t * p_out_buf )
+{
+    int i = p_in_buf->i_nb_samples * aout_FormatNbChannels( &p_filter->input );
+
+    /* We start from the end because b_in_place is true */
+    int8_t * p_in = (int8_t *)p_in_buf->p_buffer + i - 1;
+    float * p_out = (float *)p_out_buf->p_buffer + i - 1;
+
+    while( i-- )
+    {
+        *p_out = (float)(*p_in) / 128.0;
+        p_in--; p_out--;
+    }
+
+    p_out_buf->i_nb_samples = p_in_buf->i_nb_samples;
+    p_out_buf->i_nb_bytes = p_in_buf->i_nb_bytes * sizeof(float);
+}
+
+/*****************************************************************************
+ * U8 To FL32
+ *****************************************************************************/
+static int Create_U8ToFL32( vlc_object_t *p_this )
+{
+    aout_filter_t * p_filter = (aout_filter_t *)p_this;
+
+    if ( p_filter->input.i_format != VLC_FOURCC('u','8',' ',' ')
+          || p_filter->output.i_format != VLC_FOURCC('f','l','3','2') )
+    {
+        return -1;
+    }
+
+    if ( !AOUT_FMTS_SIMILAR( &p_filter->input, &p_filter->output ) )
+    {
+        return -1;
+    }
+
+    p_filter->pf_do_work = Do_U8ToFL32;
+    p_filter->b_in_place = VLC_TRUE;
+
+    return 0;
+}
+
+static void Do_U8ToFL32( aout_instance_t * p_aout, aout_filter_t * p_filter,
+                         aout_buffer_t * p_in_buf, aout_buffer_t * p_out_buf )
+{
+    int i = p_in_buf->i_nb_samples * aout_FormatNbChannels( &p_filter->input );
+
+    /* We start from the end because b_in_place is true */
+    uint8_t * p_in = (uint8_t *)p_in_buf->p_buffer + i - 1;
+    float * p_out = (float *)p_out_buf->p_buffer + i - 1;
+
+    while( i-- )
+    {
+        *p_out = ((float)*p_in -128) / 128.0;
+        p_in--; p_out--;
+    }
+
+    p_out_buf->i_nb_samples = p_in_buf->i_nb_samples;
+    p_out_buf->i_nb_bytes = p_in_buf->i_nb_bytes * sizeof(float);
+}
diff --git a/modules/audio_filter/converter/float32tos16.c b/modules/audio_filter/converter/float32tos16.c
deleted file mode 100644 (file)
index ddd7dff..0000000
+++ /dev/null
@@ -1,108 +0,0 @@
-/*****************************************************************************
- * float32tos16.c : converter from float32 to signed 16 bits integer
- *****************************************************************************
- * Copyright (C) 2002, 2006 the VideoLAN team
- * $Id$
- *
- * Authors: Christophe Massiot <massiot@via.ecp.fr>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
- *****************************************************************************/
-
-/*****************************************************************************
- * Preamble
- *****************************************************************************/
-#include <stdlib.h>                                      /* malloc(), free() */
-#include <string.h>
-
-#include <vlc/vlc.h>
-#include <vlc_aout.h>
-
-/*****************************************************************************
- * Local prototypes
- *****************************************************************************/
-static int  Create    ( vlc_object_t * );
-
-static void DoWork    ( aout_instance_t *, aout_filter_t *, aout_buffer_t *,
-                        aout_buffer_t * );
-
-/*****************************************************************************
- * Module descriptor
- *****************************************************************************/
-vlc_module_begin();
-    set_category( CAT_AUDIO );
-    set_subcategory( SUBCAT_AUDIO_MISC );
-    set_description( _("Audio filter for float32->s16 conversion") );
-    set_capability( "audio filter", 1 );
-    set_callbacks( Create, NULL );
-vlc_module_end();
-
-/*****************************************************************************
- * Create: allocate trivial mixer
- *****************************************************************************/
-static int Create( vlc_object_t *p_this )
-{
-    aout_filter_t * p_filter = (aout_filter_t *)p_this;
-
-    if ( p_filter->input.i_format != VLC_FOURCC('f','l','3','2')
-          || p_filter->output.i_format != AOUT_FMT_S16_NE )
-    {
-        return -1;
-    }
-
-    if ( !AOUT_FMTS_SIMILAR( &p_filter->input, &p_filter->output ) )
-    {
-        return -1;
-    }
-
-    p_filter->pf_do_work = DoWork;
-    p_filter->b_in_place = 1;
-
-    return 0;
-}
-
-/*****************************************************************************
- * DoWork: convert a buffer
- *****************************************************************************/
-static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter,
-                    aout_buffer_t * p_in_buf, aout_buffer_t * p_out_buf )
-{
-    int i;
-    float * p_in = (float *)p_in_buf->p_buffer;
-    int16_t * p_out = (int16_t *)p_out_buf->p_buffer;
-
-    for ( i = p_in_buf->i_nb_samples
-               * aout_FormatNbChannels( &p_filter->input ); i-- ; )
-    {
-#if 0
-        /* Slow version. */
-        if ( *p_in >= 1.0 ) *p_out = 32767;
-        else if ( *p_in < -1.0 ) *p_out = -32768;
-        else *p_out = *p_in * 32768.0;
-#else
-        /* This is walken's trick based on IEEE float format. */
-        union { float f; int32_t i; } u;
-        u.f = *p_in + 384.0;
-        if ( u.i > 0x43c07fff ) *p_out = 32767;
-        else if ( u.i < 0x43bf8000 ) *p_out = -32768;
-        else *p_out = u.i - 0x43c00000;
-#endif
-        p_in++; p_out++;
-    }
-
-    p_out_buf->i_nb_samples = p_in_buf->i_nb_samples;
-    p_out_buf->i_nb_bytes = p_in_buf->i_nb_bytes / 2;
-}
-
diff --git a/modules/audio_filter/converter/float32tos8.c b/modules/audio_filter/converter/float32tos8.c
deleted file mode 100644 (file)
index 975a6a6..0000000
+++ /dev/null
@@ -1,100 +0,0 @@
-/*****************************************************************************
- * float32tos8.c : converter from float32 to signed 8 bits integer
- *****************************************************************************
- * Copyright (C) 2002, 2006 the VideoLAN team
- * $Id$
- *
- * Authors: Xavier Maillard <zedek@fxgsproject.org>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
- *****************************************************************************/
-
-/*****************************************************************************
- * Preamble
- *****************************************************************************/
-#include <stdlib.h>                                      /* malloc(), free() */
-#include <string.h>
-
-#include <vlc/vlc.h>
-#include <vlc_aout.h>
-
-/*****************************************************************************
- * Local prototypes
- *****************************************************************************/
-static int  Create    ( vlc_object_t * );
-
-static void DoWork    ( aout_instance_t *, aout_filter_t *, aout_buffer_t *,
-                        aout_buffer_t * );
-
-/*****************************************************************************
- * Module descriptor
- *****************************************************************************/
-vlc_module_begin();
-    set_category( CAT_AUDIO );
-    set_subcategory( SUBCAT_AUDIO_MISC );
-    set_description( _("Audio filter for float32->s8 conversion") );
-    set_capability( "audio filter", 1 );
-    set_callbacks( Create, NULL );
-vlc_module_end();
-
-/*****************************************************************************
- * Create: allocate trivial mixer
- *****************************************************************************
- * This function allocates and initializes a Crop vout method.
- *****************************************************************************/
-static int Create( vlc_object_t *p_this )
-{
-    aout_filter_t * p_filter = (aout_filter_t *)p_this;
-
-    if ( p_filter->input.i_format != VLC_FOURCC('f','l','3','2')
-          || p_filter->output.i_format != VLC_FOURCC('s','8',' ',' ') )
-    {
-        return -1;
-    }
-
-    if ( !AOUT_FMTS_SIMILAR( &p_filter->input, &p_filter->output ) )
-    {
-        return -1;
-    }
-
-    p_filter->pf_do_work = DoWork;
-    p_filter->b_in_place = 1;
-
-    return 0;
-}
-
-/*****************************************************************************
- * DoWork: convert a buffer
- *****************************************************************************/
-static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter,
-                    aout_buffer_t * p_in_buf, aout_buffer_t * p_out_buf )
-{
-    int i;
-    float * p_in = (float *)p_in_buf->p_buffer;
-    int8_t * p_out = (int8_t *)p_out_buf->p_buffer;
-
-    for ( i = p_in_buf->i_nb_samples
-               * aout_FormatNbChannels( &p_filter->input ); i-- ; )
-    {
-        if ( *p_in >= 1.0 ) *p_out = 127;
-        else if ( *p_in < -1.0 ) *p_out = -128;
-        else *p_out = (int8_t)(*p_in * 128);
-        p_in++; p_out++;
-    }
-
-    p_out_buf->i_nb_samples = p_in_buf->i_nb_samples;
-    p_out_buf->i_nb_bytes = p_in_buf->i_nb_bytes / 4;
-}
-
diff --git a/modules/audio_filter/converter/float32tou16.c b/modules/audio_filter/converter/float32tou16.c
deleted file mode 100644 (file)
index 2b73348..0000000
+++ /dev/null
@@ -1,100 +0,0 @@
-/*****************************************************************************
- * float32tou16.c : converter from float32 to unsigned 16 bits integer
- *****************************************************************************
- * Copyright (C) 2002, 2006 the VideoLAN team
- * $Id$
- *
- * Authors: Xavier Maillard <zedek@fxgsproject.org>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
- *****************************************************************************/
-
-/*****************************************************************************
- * Preamble
- *****************************************************************************/
-#include <stdlib.h>                                      /* malloc(), free() */
-#include <string.h>
-
-#include <vlc/vlc.h>
-#include "vlc_aout.h"
-
-/*****************************************************************************
- * Local prototypes
- *****************************************************************************/
-static int  Create    ( vlc_object_t * );
-
-static void DoWork    ( aout_instance_t *, aout_filter_t *, aout_buffer_t *,
-                        aout_buffer_t * );
-
-/*****************************************************************************
- * Module descriptor
- *****************************************************************************/
-vlc_module_begin();
-    set_category( CAT_AUDIO );
-    set_subcategory( SUBCAT_AUDIO_MISC );
-    set_description( _("Audio filter for float32->u16 conversion") );
-    set_capability( "audio filter", 1 );
-    set_callbacks( Create, NULL );
-vlc_module_end();
-
-/*****************************************************************************
- * Create: allocate trivial mixer
- *****************************************************************************
- * This function allocates and initializes a Crop vout method.
- *****************************************************************************/
-static int Create( vlc_object_t *p_this )
-{
-    aout_filter_t * p_filter = (aout_filter_t *)p_this;
-
-    if ( p_filter->input.i_format != VLC_FOURCC('f','l','3','2')
-          || p_filter->output.i_format != AOUT_FMT_U16_NE )
-    {
-        return -1;
-    }
-
-    if ( !AOUT_FMTS_SIMILAR( &p_filter->input, &p_filter->output ) )
-    {
-        return -1;
-    }
-
-    p_filter->pf_do_work = DoWork;
-    p_filter->b_in_place = 1;
-
-    return 0;
-}
-
-/*****************************************************************************
- * DoWork: convert a buffer
- *****************************************************************************/
-static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter,
-                    aout_buffer_t * p_in_buf, aout_buffer_t * p_out_buf )
-{
-    int i;
-    float * p_in = (float *)p_in_buf->p_buffer;
-    uint16_t * p_out = (uint16_t *)p_out_buf->p_buffer;
-
-    for ( i = p_in_buf->i_nb_samples
-               * aout_FormatNbChannels( &p_filter->input ); i-- ; )
-    {
-        if ( *p_in >= 1.0 ) *p_out = 65535;
-        else if ( *p_in < -1.0 ) *p_out = 0;
-        else *p_out = (uint16_t)(32768 + *p_in * 32768);
-        p_in++; p_out++;
-    }
-
-    p_out_buf->i_nb_samples = p_in_buf->i_nb_samples;
-    p_out_buf->i_nb_bytes = p_in_buf->i_nb_bytes / 2;
-}
-
diff --git a/modules/audio_filter/converter/float32tou8.c b/modules/audio_filter/converter/float32tou8.c
deleted file mode 100644 (file)
index babc43c..0000000
+++ /dev/null
@@ -1,100 +0,0 @@
-/*****************************************************************************
- * float32tou8.c : converter from float32 to unsigned 8 bits integer
- *****************************************************************************
- * Copyright (C) 2002, 2006 the VideoLAN team
- * $Id$
- *
- * Authors: Xavier Maillard <zedek@fxgsproject.org>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
- *****************************************************************************/
-
-/*****************************************************************************
- * Preamble
- *****************************************************************************/
-#include <stdlib.h>                                      /* malloc(), free() */
-#include <string.h>
-
-#include <vlc/vlc.h>
-#include "vlc_aout.h"
-
-/*****************************************************************************
- * Local prototypes
- *****************************************************************************/
-static int  Create    ( vlc_object_t * );
-
-static void DoWork    ( aout_instance_t *, aout_filter_t *, aout_buffer_t *,
-                        aout_buffer_t * );
-
-/*****************************************************************************
- * Module descriptor
- *****************************************************************************/
-vlc_module_begin();
-    set_category( CAT_AUDIO );
-    set_subcategory( SUBCAT_AUDIO_MISC );
-    set_description( _("Audio filter for float32->u8 conversion") );
-    set_capability( "audio filter", 1 );
-    set_callbacks( Create, NULL );
-vlc_module_end();
-
-/*****************************************************************************
- * Create: allocate trivial mixer
- *****************************************************************************
- * This function allocates and initializes a Crop vout method.
- *****************************************************************************/
-static int Create( vlc_object_t *p_this )
-{
-    aout_filter_t * p_filter = (aout_filter_t *)p_this;
-
-    if ( p_filter->input.i_format != VLC_FOURCC('f','l','3','2')
-          || p_filter->output.i_format != VLC_FOURCC('u','8',' ',' ') )
-    {
-        return -1;
-    }
-
-    if ( !AOUT_FMTS_SIMILAR( &p_filter->input, &p_filter->output ) )
-    {
-        return -1;
-    }
-
-    p_filter->pf_do_work = DoWork;
-    p_filter->b_in_place = 1;
-
-    return 0;
-}
-
-/*****************************************************************************
- * DoWork: convert a buffer
- *****************************************************************************/
-static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter,
-                    aout_buffer_t * p_in_buf, aout_buffer_t * p_out_buf )
-{
-    int i;
-    float * p_in = (float *)p_in_buf->p_buffer;
-    uint8_t * p_out = (uint8_t *)p_out_buf->p_buffer;
-
-    for ( i = p_in_buf->i_nb_samples
-               * aout_FormatNbChannels( &p_filter->input ); i-- ; )
-    {
-        if ( *p_in >= 1.0 ) *p_out = 255;
-        else if ( *p_in < -1.0 ) *p_out = 0;
-        else *p_out = (uint8_t)(128 + *p_in * 128);
-        p_in++; p_out++;
-    }
-
-    p_out_buf->i_nb_samples = p_in_buf->i_nb_samples;
-    p_out_buf->i_nb_bytes = p_in_buf->i_nb_bytes / 4;
-}
-
diff --git a/modules/audio_filter/converter/s16tofixed32.c b/modules/audio_filter/converter/s16tofixed32.c
deleted file mode 100644 (file)
index 2875725..0000000
+++ /dev/null
@@ -1,100 +0,0 @@
-/*****************************************************************************
- * s16tofixed32.c : converter from signed 16 bits integer to fixed 32
- *****************************************************************************
- * Copyright (C) 2002, 2006 the VideoLAN team
- * $Id$
- *
- * Authors: Marc Ariberti <marcari@videolan.ord>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
- *****************************************************************************/
-
-/*****************************************************************************
- * Preamble
- *****************************************************************************/
-#include <stdlib.h>                                      /* malloc(), free() */
-#include <string.h>
-
-#include <vlc/vlc.h>
-#include "vlc_aout.h"
-
-/*****************************************************************************
- * Local prototypes
- *****************************************************************************/
-static int  Create    ( vlc_object_t * );
-
-static void DoWork    ( aout_instance_t *, aout_filter_t *, aout_buffer_t *,
-                        aout_buffer_t * );
-
-/*****************************************************************************
- * Module descriptor
- *****************************************************************************/
-vlc_module_begin();
-    set_category( CAT_AUDIO );
-    set_subcategory( SUBCAT_AUDIO_MISC );
-    set_description( _("Audio filter for s16->fixed32 conversion") );
-    set_capability( "audio filter", 15 );
-    set_callbacks( Create, NULL );
-vlc_module_end();
-
-/*****************************************************************************
- * Create: allocate filter
- *****************************************************************************
- * This function allocates and initializes a s16->fixed32 audio filter.
- *****************************************************************************/
-static int Create( vlc_object_t *p_this )
-{
-    aout_filter_t * p_filter = (aout_filter_t *)p_this;
-
-    if ( p_filter->output.i_format != VLC_FOURCC('f','i','3','2')
-          || p_filter->input.i_format != AOUT_FMT_S16_NE )
-    {
-        return -1;
-    }
-
-    if ( !AOUT_FMTS_SIMILAR( &p_filter->input, &p_filter->output ) )
-    {
-        return -1;
-    }
-
-    p_filter->pf_do_work = DoWork;
-    p_filter->b_in_place = 1;
-
-    return 0;
-}
-
-
-/*****************************************************************************
- * DoWork: convert a buffer
- *****************************************************************************/
-static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter,
-                    aout_buffer_t * p_in_buf, aout_buffer_t * p_out_buf )
-{
-    int i = p_in_buf->i_nb_samples * aout_FormatNbChannels( &p_filter->input );
-
-    /* We start from the end because b_in_place is true */
-    int16_t * p_in = (int16_t *)p_in_buf->p_buffer + i - 1;
-    vlc_fixed_t * p_out = (vlc_fixed_t *)p_out_buf->p_buffer + i - 1;
-
-    while( i-- )
-    {
-        *p_out = (vlc_fixed_t)( (int32_t)(*p_in) * (FIXED32_ONE >> 16) );
-        p_in--; p_out--;
-    }
-
-    p_out_buf->i_nb_samples = p_in_buf->i_nb_samples;
-    p_out_buf->i_nb_bytes = p_in_buf->i_nb_bytes
-            * sizeof(vlc_fixed_t) / sizeof(int16_t);
-}
diff --git a/modules/audio_filter/converter/s16tofloat32.c b/modules/audio_filter/converter/s16tofloat32.c
deleted file mode 100644 (file)
index e4d3ad2..0000000
+++ /dev/null
@@ -1,141 +0,0 @@
-/*****************************************************************************
- * s16tofloat32.c : converter from signed 16 bits integer to float32
- *****************************************************************************
- * Copyright (C) 2002-2006 the VideoLAN team
- * $Id$
- *
- * Authors: Samuel Hocevar <sam@zoy.org>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
- *****************************************************************************/
-
-/*****************************************************************************
- * Preamble
- *****************************************************************************/
-#include <stdlib.h>                                      /* malloc(), free() */
-#include <string.h>
-
-#include <vlc/vlc.h>
-#include "vlc_aout.h"
-
-/*****************************************************************************
- * Local prototypes
- *****************************************************************************/
-static int  Create    ( vlc_object_t * );
-
-static void DoWork    ( aout_instance_t *, aout_filter_t *, aout_buffer_t *,
-                        aout_buffer_t * );
-static void DoWork24  ( aout_instance_t *, aout_filter_t *, aout_buffer_t *,
-                        aout_buffer_t * );
-
-/*****************************************************************************
- * Module descriptor
- *****************************************************************************/
-vlc_module_begin();
-    set_category( CAT_AUDIO );
-    set_subcategory( SUBCAT_AUDIO_MISC );
-    set_description( _("Audio filter for s16->float32 conversion") );
-    set_capability( "audio filter", 1 );
-    set_callbacks( Create, NULL );
-vlc_module_end();
-
-/*****************************************************************************
- * Create: allocate trivial mixer
- *****************************************************************************
- * This function allocates and initializes a Crop vout method.
- *****************************************************************************/
-static int Create( vlc_object_t *p_this )
-{
-    aout_filter_t * p_filter = (aout_filter_t *)p_this;
-
-    if ( ( p_filter->input.i_format != AOUT_FMT_S16_NE &&
-           p_filter->input.i_format != AOUT_FMT_S24_NE )
-          || p_filter->output.i_format != VLC_FOURCC('f','l','3','2') )
-    {
-        return -1;
-    }
-
-    if ( !AOUT_FMTS_SIMILAR( &p_filter->input, &p_filter->output ) )
-    {
-        return -1;
-    }
-
-    if( p_filter->input.i_format == AOUT_FMT_S24_NE )
-        p_filter->pf_do_work = DoWork24;
-    else
-        p_filter->pf_do_work = DoWork;
-
-    p_filter->b_in_place = VLC_TRUE;
-
-    return 0;
-}
-
-/*****************************************************************************
- * DoWork: convert a buffer
- *****************************************************************************/
-static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter,
-                    aout_buffer_t * p_in_buf, aout_buffer_t * p_out_buf )
-{
-    int i = p_in_buf->i_nb_samples * aout_FormatNbChannels( &p_filter->input );
-
-    /* We start from the end because b_in_place is true */
-    int16_t * p_in = (int16_t *)p_in_buf->p_buffer + i - 1;
-    float * p_out = (float *)p_out_buf->p_buffer + i - 1;
-
-    while( i-- )
-    {
-#if 0
-        /* Slow version */
-        *p_out = (float)*p_in / 32768.0;
-#else
-        /* This is walken's trick based on IEEE float format. On my PIII
-         * this takes 16 seconds to perform one billion conversions, instead
-         * of 19 seconds for the above division. */
-        union { float f; int32_t i; } u;
-        u.i = *p_in + 0x43c00000;
-        *p_out = u.f - 384.0;
-#endif
-
-        p_in--; p_out--;
-    }
-
-    p_out_buf->i_nb_samples = p_in_buf->i_nb_samples;
-    p_out_buf->i_nb_bytes = p_in_buf->i_nb_bytes * 2;
-}
-
-static void DoWork24( aout_instance_t * p_aout, aout_filter_t * p_filter,
-                      aout_buffer_t * p_in_buf, aout_buffer_t * p_out_buf )
-{
-    int i = p_in_buf->i_nb_samples * aout_FormatNbChannels( &p_filter->input );
-
-    /* We start from the end because b_in_place is true */
-    uint8_t * p_in = (uint8_t *)p_in_buf->p_buffer + (i - 1) * 3;
-    float * p_out = (float *)p_out_buf->p_buffer + i - 1;
-
-    while( i-- )
-    {
-#ifdef WORDS_BIGENDIAN
-        *p_out = ((float)( (((int32_t)*(int16_t *)(p_in)) << 8) + p_in[2]))
-#else
-        *p_out = ((float)( (((int32_t)*(int16_t *)(p_in+1)) << 8) + p_in[0]))
-#endif
-            / 8388608.0;
-
-        p_in -= 3; p_out--;
-    }
-
-    p_out_buf->i_nb_samples = p_in_buf->i_nb_samples;
-    p_out_buf->i_nb_bytes = p_in_buf->i_nb_bytes * 4 / 3;
-}
diff --git a/modules/audio_filter/converter/s16tofloat32swab.c b/modules/audio_filter/converter/s16tofloat32swab.c
deleted file mode 100644 (file)
index 482e719..0000000
+++ /dev/null
@@ -1,182 +0,0 @@
-/*****************************************************************************
- * s16tofloat32swab.c : converter from signed 16 bits integer to float32
- *                      with endianness change
- *****************************************************************************
- * Copyright (C) 2002-2006 the VideoLAN team
- * $Id$
- *
- * Authors: Samuel Hocevar <sam@zoy.org>
- *          Henri Fallon <henri@videolan.org>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
- *****************************************************************************/
-
-/*****************************************************************************
- * Preamble
- *****************************************************************************/
-#include <vlc/vlc.h>
-#include <stdlib.h>                                      /* malloc(), free() */
-#include <string.h>
-
-#ifdef HAVE_UNISTD_H
-#   include <unistd.h>
-#endif
-
-#ifdef HAVE_ALLOCA_H
-#   include <alloca.h>
-#endif
-
-#include <vlc_aout.h>
-
-/*****************************************************************************
- * Local prototypes
- *****************************************************************************/
-static int  Create    ( vlc_object_t * );
-
-static void DoWork    ( aout_instance_t *, aout_filter_t *, aout_buffer_t *,
-                        aout_buffer_t * );
-static void DoWork24  ( aout_instance_t *, aout_filter_t *, aout_buffer_t *,
-                        aout_buffer_t * );
-
-/*****************************************************************************
- * Module descriptor
- *****************************************************************************/
-vlc_module_begin();
-    set_category( CAT_AUDIO );
-    set_subcategory( SUBCAT_AUDIO_MISC );
-    set_description(
-            _("Audio filter for s16->float32 with endianness conversion") );
-    set_capability( "audio filter", 1 );
-    set_callbacks( Create, NULL );
-vlc_module_end();
-
-/*****************************************************************************
- * Create: allocate trivial mixer
- *****************************************************************************
- * This function allocates and initializes a Crop vout method.
- *****************************************************************************/
-static int Create( vlc_object_t *p_this )
-{
-    aout_filter_t * p_filter = (aout_filter_t *)p_this;
-
-    if ( !AOUT_FMTS_SIMILAR( &p_filter->input, &p_filter->output ) )
-    {
-        return -1;
-    }
-
-    if ( (p_filter->input.i_format == VLC_FOURCC('s','1','6','l') ||
-         p_filter->input.i_format == VLC_FOURCC('s','1','6','b'))
-         && p_filter->output.i_format == VLC_FOURCC('f','l','3','2')
-         && p_filter->input.i_format != AOUT_FMT_S16_NE )
-    {
-        p_filter->pf_do_work = DoWork;
-        p_filter->b_in_place = VLC_TRUE;
-
-        return 0;
-    }
-
-    if ( (p_filter->input.i_format == VLC_FOURCC('s','2','4','l') ||
-         p_filter->input.i_format == VLC_FOURCC('s','2','4','b'))
-         && p_filter->output.i_format == VLC_FOURCC('f','l','3','2')
-         && p_filter->input.i_format != AOUT_FMT_S24_NE )
-    {
-        p_filter->pf_do_work = DoWork24;
-        p_filter->b_in_place = VLC_TRUE;
-
-        return 0;
-    }
-
-    return -1;
-}
-
-/*****************************************************************************
- * DoWork: convert a buffer
- *****************************************************************************/
-static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter,
-                    aout_buffer_t * p_in_buf, aout_buffer_t * p_out_buf )
-{
-    int i = p_in_buf->i_nb_samples * aout_FormatNbChannels( &p_filter->input );
-
-    /* We start from the end because b_in_place is true */
-    int16_t * p_in;
-    float * p_out = (float *)p_out_buf->p_buffer + i - 1;
-
-#ifdef HAVE_SWAB
-#   ifdef HAVE_ALLOCA
-    int16_t * p_swabbed = alloca( i * sizeof(int16_t) );
-#   else
-    int16_t * p_swabbed = malloc( i * sizeof(int16_t) );
-#   endif
-
-    swab( p_in_buf->p_buffer, (void *)p_swabbed, i * sizeof(int16_t) );
-    p_in = p_swabbed + i - 1;
-
-#else
-    byte_t p_tmp[2];
-    p_in = (int16_t *)p_in_buf->p_buffer + i - 1;
-#endif
-
-    while( i-- )
-    {
-#ifndef HAVE_SWAB
-        p_tmp[0] = ((byte_t *)p_in)[1];
-        p_tmp[1] = ((byte_t *)p_in)[0];
-        *p_out = (float)( *(int16_t *)p_tmp ) / 32768.0;
-#else
-        *p_out = (float)*p_in / 32768.0;
-#endif
-        p_in--; p_out--;
-    }
-
-#ifdef HAVE_SWAB
-#   ifndef HAVE_ALLOCA
-    free( p_swabbed );
-#   endif
-#endif
-
-    p_out_buf->i_nb_samples = p_in_buf->i_nb_samples;
-    p_out_buf->i_nb_bytes = p_in_buf->i_nb_bytes * 2;
-}
-
-static void DoWork24( aout_instance_t * p_aout, aout_filter_t * p_filter,
-                      aout_buffer_t * p_in_buf, aout_buffer_t * p_out_buf )
-{
-    int i = p_in_buf->i_nb_samples * aout_FormatNbChannels( &p_filter->input );
-
-    /* We start from the end because b_in_place is true */
-    uint8_t * p_in = (uint8_t *)p_in_buf->p_buffer + (i - 1) * 3;
-    float * p_out = (float *)p_out_buf->p_buffer + i - 1;
-
-    byte_t p_tmp[3];
-
-    while( i-- )
-    {
-        p_tmp[0] = p_in[2];
-        p_tmp[1] = p_in[1];
-        p_tmp[2] = p_in[0];
-
-#ifdef WORDS_BIGENDIAN
-        *p_out = ((float)( (((int32_t)*(int16_t *)(p_tmp)) << 8) + p_tmp[2]))
-#else
-        *p_out = ((float)( (((int32_t)*(int16_t *)(p_tmp+1)) << 8) + p_tmp[0]))
-#endif
-            / 8388608.0;
-
-        p_in -= 3; p_out--;
-    }
-
-    p_out_buf->i_nb_samples = p_in_buf->i_nb_samples;
-    p_out_buf->i_nb_bytes = p_in_buf->i_nb_bytes * 4 / 3;
-}
diff --git a/modules/audio_filter/converter/s8tofloat32.c b/modules/audio_filter/converter/s8tofloat32.c
deleted file mode 100644 (file)
index caa61a5..0000000
+++ /dev/null
@@ -1,96 +0,0 @@
-/*****************************************************************************
- * s8tofloat32.c : converter from signed 8 bits integer to float32.
- *****************************************************************************
- * Copyright (C) 2002, 2006 the VideoLAN team
- * $Id$
- *
- * Authors: Gildas Bazin <gbazin@netcourrier.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
- *****************************************************************************/
-
-/*****************************************************************************
- * Preamble
- *****************************************************************************/
-#include <stdlib.h>                                      /* malloc(), free() */
-#include <string.h>
-
-#include <vlc/vlc.h>
-#include "vlc_aout.h"
-
-/*****************************************************************************
- * Local prototypes
- *****************************************************************************/
-static int  Create    ( vlc_object_t * );
-
-static void DoWork    ( aout_instance_t *, aout_filter_t *, aout_buffer_t *,
-                        aout_buffer_t * );
-
-/*****************************************************************************
- * Module descriptor
- *****************************************************************************/
-vlc_module_begin();
-    set_category( CAT_AUDIO );
-    set_subcategory( SUBCAT_AUDIO_MISC );
-    set_description( _("Audio filter for s8->float32 conversion") );
-    set_capability( "audio filter", 1 );
-    set_callbacks( Create, NULL );
-vlc_module_end();
-
-/*****************************************************************************
- * Create: create and initialize converter
- *****************************************************************************/
-static int Create( vlc_object_t *p_this )
-{
-    aout_filter_t * p_filter = (aout_filter_t *)p_this;
-
-    if ( p_filter->input.i_format != VLC_FOURCC('s','8',' ',' ')
-          || p_filter->output.i_format != VLC_FOURCC('f','l','3','2') )
-    {
-        return -1;
-    }
-
-    if ( !AOUT_FMTS_SIMILAR( &p_filter->input, &p_filter->output ) )
-    {
-        return -1;
-    }
-
-    p_filter->pf_do_work = DoWork;
-    p_filter->b_in_place = VLC_TRUE;
-
-    return 0;
-}
-
-/*****************************************************************************
- * DoWork: convert a buffer
- *****************************************************************************/
-static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter,
-                    aout_buffer_t * p_in_buf, aout_buffer_t * p_out_buf )
-{
-    int i = p_in_buf->i_nb_samples * aout_FormatNbChannels( &p_filter->input );
-
-    /* We start from the end because b_in_place is true */
-    int8_t * p_in = (int8_t *)p_in_buf->p_buffer + i - 1;
-    float * p_out = (float *)p_out_buf->p_buffer + i - 1;
-
-    while( i-- )
-    {
-        *p_out = (float)(*p_in) / 128.0;
-        p_in--; p_out--;
-    }
-
-    p_out_buf->i_nb_samples = p_in_buf->i_nb_samples;
-    p_out_buf->i_nb_bytes = p_in_buf->i_nb_bytes * sizeof(float);
-}
diff --git a/modules/audio_filter/converter/u8tofixed32.c b/modules/audio_filter/converter/u8tofixed32.c
deleted file mode 100644 (file)
index bafa208..0000000
+++ /dev/null
@@ -1,96 +0,0 @@
-/*****************************************************************************
- * u8tofixed32.c : converter from unsigned 8 bits integer to fixed32.
- *****************************************************************************
- * Copyright (C) 2002, 2006 the VideoLAN team
- * $Id$
- *
- * Authors: Samuel Hocevar <sam@zoy.org>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
- *****************************************************************************/
-
-/*****************************************************************************
- * Preamble
- *****************************************************************************/
-#include <stdlib.h>                                      /* malloc(), free() */
-#include <string.h>
-
-#include <vlc/vlc.h>
-#include "vlc_aout.h"
-
-/*****************************************************************************
- * Local prototypes
- *****************************************************************************/
-static int  Create    ( vlc_object_t * );
-
-static void DoWork    ( aout_instance_t *, aout_filter_t *, aout_buffer_t *,
-                        aout_buffer_t * );
-
-/*****************************************************************************
- * Module descriptor
- *****************************************************************************/
-vlc_module_begin();
-    set_category( CAT_AUDIO );
-    set_subcategory( SUBCAT_AUDIO_MISC );
-    set_description( _("Audio filter for u8->fixed32 conversion") );
-    set_capability( "audio filter", 1 );
-    set_callbacks( Create, NULL );
-vlc_module_end();
-
-/*****************************************************************************
- * Create: create and initialize converter
- *****************************************************************************/
-static int Create( vlc_object_t *p_this )
-{
-    aout_filter_t * p_filter = (aout_filter_t *)p_this;
-
-    if ( p_filter->input.i_format != VLC_FOURCC('u','8',' ',' ')
-          || p_filter->output.i_format != VLC_FOURCC('f','i','3','2') )
-    {
-        return -1;
-    }
-
-    if ( !AOUT_FMTS_SIMILAR( &p_filter->input, &p_filter->output ) )
-    {
-        return -1;
-    }
-
-    p_filter->pf_do_work = DoWork;
-    p_filter->b_in_place = VLC_TRUE;
-
-    return 0;
-}
-
-/*****************************************************************************
- * DoWork: convert a buffer
- *****************************************************************************/
-static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter,
-                    aout_buffer_t * p_in_buf, aout_buffer_t * p_out_buf )
-{
-    int i = p_in_buf->i_nb_samples * aout_FormatNbChannels( &p_filter->input );
-
-    /* We start from the end because b_in_place is true */
-    uint8_t * p_in = (uint8_t *)p_in_buf->p_buffer + i - 1;
-    vlc_fixed_t * p_out = (vlc_fixed_t *)p_out_buf->p_buffer + i - 1;
-
-    while( i-- )
-    {
-        *p_out = (vlc_fixed_t)( (int32_t)(*p_in - 128) * (FIXED32_ONE / 128) );
-        p_in--; p_out--;
-    }
-
-    p_out_buf->i_nb_samples = p_in_buf->i_nb_samples;
-    p_out_buf->i_nb_bytes = p_in_buf->i_nb_bytes * sizeof(vlc_fixed_t);
-}
diff --git a/modules/audio_filter/converter/u8tofloat32.c b/modules/audio_filter/converter/u8tofloat32.c
deleted file mode 100644 (file)
index 46c6349..0000000
+++ /dev/null
@@ -1,96 +0,0 @@
-/*****************************************************************************
- * u8tofloat32.c : converter from unsigned 8 bits integer to float32.
- *****************************************************************************
- * Copyright (C) 2002, 2006 the VideoLAN team
- * $Id$
- *
- * Authors: Gildas Bazin <gbazin@netcourrier.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
- *****************************************************************************/
-
-/*****************************************************************************
- * Preamble
- *****************************************************************************/
-#include <stdlib.h>                                      /* malloc(), free() */
-#include <string.h>
-
-#include <vlc/vlc.h>
-#include "vlc_aout.h"
-
-/*****************************************************************************
- * Local prototypes
- *****************************************************************************/
-static int  Create    ( vlc_object_t * );
-
-static void DoWork    ( aout_instance_t *, aout_filter_t *, aout_buffer_t *,
-                        aout_buffer_t * );
-
-/*****************************************************************************
- * Module descriptor
- *****************************************************************************/
-vlc_module_begin();
-    set_category( CAT_AUDIO );
-    set_subcategory( SUBCAT_AUDIO_MISC );
-    set_description( _("Audio filter for u8->float32 conversion") );
-    set_capability( "audio filter", 1 );
-    set_callbacks( Create, NULL );
-vlc_module_end();
-
-/*****************************************************************************
- * Create: create and initialize converter
- *****************************************************************************/
-static int Create( vlc_object_t *p_this )
-{
-    aout_filter_t * p_filter = (aout_filter_t *)p_this;
-
-    if ( p_filter->input.i_format != VLC_FOURCC('u','8',' ',' ')
-          || p_filter->output.i_format != VLC_FOURCC('f','l','3','2') )
-    {
-        return -1;
-    }
-
-    if ( !AOUT_FMTS_SIMILAR( &p_filter->input, &p_filter->output ) )
-    {
-        return -1;
-    }
-
-    p_filter->pf_do_work = DoWork;
-    p_filter->b_in_place = VLC_TRUE;
-
-    return 0;
-}
-
-/*****************************************************************************
- * DoWork: convert a buffer
- *****************************************************************************/
-static void DoWork( aout_instance_t * p_aout, aout_filter_t * p_filter,
-                    aout_buffer_t * p_in_buf, aout_buffer_t * p_out_buf )
-{
-    int i = p_in_buf->i_nb_samples * aout_FormatNbChannels( &p_filter->input );
-
-    /* We start from the end because b_in_place is true */
-    uint8_t * p_in = (uint8_t *)p_in_buf->p_buffer + i - 1;
-    float * p_out = (float *)p_out_buf->p_buffer + i - 1;
-
-    while( i-- )
-    {
-        *p_out = ((float)*p_in -128) / 128.0;
-        p_in--; p_out--;
-    }
-
-    p_out_buf->i_nb_samples = p_in_buf->i_nb_samples;
-    p_out_buf->i_nb_bytes = p_in_buf->i_nb_bytes * sizeof(float);
-}