]> git.sesse.net Git - vlc/commitdiff
Definition of vlc_fixed_t.
authorChristophe Massiot <massiot@videolan.org>
Sun, 11 Aug 2002 22:46:34 +0000 (22:46 +0000)
committerChristophe Massiot <massiot@videolan.org>
Sun, 11 Aug 2002 22:46:34 +0000 (22:46 +0000)
include/audio_output.h
modules/codec/a52.c

index e5f7a8af422444241a11c6d75e97c5dbee5837bf..e20d7e7a05ff1c583e1d3cc0673ce40b5d651ff9 100644 (file)
@@ -2,7 +2,7 @@
  * audio_output.h : audio output interface
  *****************************************************************************
  * Copyright (C) 2002 VideoLAN
- * $Id: audio_output.h,v 1.55 2002/08/09 23:52:31 sam Exp $
+ * $Id: audio_output.h,v 1.56 2002/08/11 22:46:34 massiot Exp $
  *
  * Authors: Christophe Massiot <massiot@via.ecp.fr>
  *
@@ -67,6 +67,34 @@ struct audio_sample_format_t
        || ((p_format)->i_format == AOUT_FMT_A52)                           \
        || ((p_format)->i_format == AOUT_FMT_DTS) )
 
+/* This is heavily borrowed from libmad, by Robert Leslie <rob@mars.org> */
+/*
+ * Fixed-point format: 0xABBBBBBB
+ * A == whole part      (sign + 3 bits)
+ * B == fractional part (28 bits) 
+ *
+ * Values are signed two's complement, so the effective range is:
+ * 0x80000000 to 0x7fffffff
+ *       -8.0 to +7.9999999962747097015380859375
+ *
+ * The smallest representable value is:
+ * 0x00000001 == 0.0000000037252902984619140625 (i.e. about 3.725e-9)
+ *
+ * 28 bits of fractional accuracy represent about
+ * 8.6 digits of decimal accuracy.
+ * 
+ * Fixed-point numbers can be added or subtracted as normal
+ * integers, but multiplication requires shifting the 64-bit result
+ * from 56 fractional bits back to 28 (and rounding.)
+ */
+typedef s32 vlc_fixed_t;
+#define FIXED32_FRACBITS 28
+#define FIXED32_MIN ((vlc_fixed_t) -0x80000000L)
+#define FIXED32_MAX ((vlc_fixed_t) +0x7fffffffL)
+#define FIXED32_ONE ((vlc_fixed_t) 0x10000000)
+
+
+
 /*****************************************************************************
  * aout_buffer_t : audio output buffer
  *****************************************************************************/
index 9ec4ccf25e9482940cbf9abfbf8d10f0328220d2..84cb573a74697864d69507f74b0350387588e6c7 100644 (file)
@@ -4,7 +4,7 @@
  *   (http://liba52.sf.net/).
  *****************************************************************************
  * Copyright (C) 2001, 2002 VideoLAN
- * $Id: a52.c,v 1.1 2002/08/11 01:27:01 massiot Exp $
+ * $Id: a52.c,v 1.2 2002/08/11 22:46:34 massiot Exp $
  *
  * Authors: Gildas Bazin <gbazin@netcourrier.com>
  *          Christophe Massiot <massiot@via.ecp.fr>
@@ -81,7 +81,7 @@ typedef struct a52_thread_s
  *****************************************************************************/
 static int  OpenDecoder    ( vlc_object_t * );
 static int  RunDecoder     ( decoder_fifo_t * );
-static int  DecodeFrame    ( a52_thread_t *, const byte_t * );
+static int  DecodeFrame    ( a52_thread_t *, byte_t * );
 static int  InitThread     ( a52_thread_t *, decoder_fifo_t * );
 static void EndThread      ( a52_thread_t * );
 
@@ -282,7 +282,7 @@ static void Interleave( float * p_out, const float * p_in, int i_channels )
 /*****************************************************************************
  * DecodeFrame: decode an ATSC A/52 frame.
  *****************************************************************************/
-static int DecodeFrame( a52_thread_t * p_dec, const byte_t * p_frame_buffer )
+static int DecodeFrame( a52_thread_t * p_dec, byte_t * p_frame_buffer )
 {
     sample_t        i_sample_level = 1;
     aout_buffer_t * p_buffer;