]> git.sesse.net Git - vlc/commitdiff
* Makefile :
authorMichel Kaempf <maxx@videolan.org>
Sun, 9 Jan 2000 23:38:46 +0000 (23:38 +0000)
committerMichel Kaempf <maxx@videolan.org>
Sun, 9 Jan 2000 23:38:46 +0000 (23:38 +0000)
- rajout de l'option de compilation qui marche bien -fomit-frame-pointer ;

* include/audio_output.h, audio_output/audio_output.c :
- modification de la m�thode de lecture d'un flux provenant d'un d�codeur
audio : qu'il s'agisse d'un flux audio MPEG2, AC3 ou MPEG12, l'algorithme
reste le m�me ;

* include/audio_decoder.h, audio_decoder/audio_decoder.c :
- rajout de la constante AOUT_FRAME_SIZE et de la structure aout_frame_t
qui d�crivent la forme sous laquelle les samples audio d�cod�s sont
transmis � l'audio_output (cf point pr�c�dent) ;

Makefile
include/audio_decoder.h
include/audio_output.h
src/audio_decoder/audio_decoder.c
src/audio_output/audio_output.c

index 3feb81305f27b7875bf04d6de6adab53a8f44caa..2339a94941a148832190ba17f7648abd48310eb6 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -42,6 +42,7 @@ CCFLAGS += -D_GNU_SOURCE
 # Optimizations : don't compile debug versions with them
 CCFLAGS += -O6
 CCFLAGS += -ffast-math -funroll-loops -fargument-noalias-global
+CCFLAGS += -fomit-frame-pointer
 #CCFLAGS += -fomit-frame-pointer -s
 #LCFLAGS += -s
 
index ad9fc38087e45277a9422817e866b15ced526212..11a4db717c4a38f5c5ab887df2696de867fccf15 100644 (file)
@@ -73,6 +73,13 @@ typedef struct adec_thread_s
 
 } adec_thread_t;
 
+#define AOUT_FRAME_SIZE 384
+
+/******************************************************************************
+ * aout_frame_t
+ ******************************************************************************/
+typedef s16 aout_frame_t[ AOUT_FRAME_SIZE ];
+
 /******************************************************************************
  * Prototypes
  ******************************************************************************/
index 90cac84327f6ce01f8766bd779cc204e58eb2d58..2c1e7bf91cc4159cbfe349a48d36cb709bb0bd0d 100644 (file)
@@ -39,7 +39,9 @@
 /* Number of audio samples (s16 integers) contained in an audio output frame...
  * - Layer I        : a decoded frame contains 384 samples
  * - Layer II & III : a decoded frame contains 1152 = 3*384 samples */
+/*
 #define AOUT_FRAME_SIZE         384
+*/
 
 /* Number of audio output frames contained in an audio output fifo.
  * (AOUT_FIFO_SIZE + 1) must be a power of 2, in order to optimise the
@@ -117,7 +119,7 @@ typedef struct
 /******************************************************************************
  * aout_frame_t
  ******************************************************************************/
-typedef s16 aout_frame_t[ AOUT_FRAME_SIZE ];
+/*typedef s16 aout_frame_t[ AOUT_FRAME_SIZE ];*/
 
 /******************************************************************************
  * aout_fifo_t
@@ -134,6 +136,7 @@ typedef struct
     vlc_mutex_t         data_lock;
     vlc_cond_t          data_wait;
 
+    long                l_frame_size;
     void *              buffer;
     mtime_t *           date;
     /* The start frame is the first frame in the buffer that contains decoded
index f408299093ecf07cf8a692c0b9d71d4efb40eeb1..23c053f351236dbad2672c2d859f930a5c91faa9 100644 (file)
@@ -760,6 +760,8 @@ static int InitThread( adec_thread_t * p_adec )
             return( -1 );
     }
 
+    aout_fifo.l_frame_size = AOUT_FRAME_SIZE;
+
     /* Creating the audio output fifo */
     if ( (p_adec->p_aout_fifo = aout_CreateFifo(p_adec->p_aout, &aout_fifo)) == NULL )
     {
index d4bf1534f2a6ece29a3c814da6895840031059b2..3a609b9d920d03776b61a3b0e3a43a7572f8e61b 100644 (file)
@@ -325,11 +325,12 @@ aout_fifo_t * aout_CreateFifo( aout_thread_t * p_aout, aout_fifo_t * p_fifo )
             p_aout->fifo[i_fifo].b_stereo = p_fifo->b_stereo;
             p_aout->fifo[i_fifo].l_rate = p_fifo->l_rate;
 
+           p_aout->fifo[i_fifo].l_frame_size = p_fifo->l_frame_size;
             /* Allocate the memory needed to store the audio frames. As the
              * fifo is a rotative fifo, we must be able to find out whether the
              * fifo is full or empty, that's why we must in fact allocate memory
              * for (AOUT_FIFO_SIZE+1) audio frames. */
-           if ( (p_aout->fifo[i_fifo].buffer = malloc( sizeof(s16)*(AOUT_FIFO_SIZE+1)*AOUT_FRAME_SIZE )) == NULL )
+           if ( (p_aout->fifo[i_fifo].buffer = malloc( sizeof(s16)*(AOUT_FIFO_SIZE+1)*p_fifo->l_frame_size )) == NULL )
            {
                 intf_ErrMsg("aout error: not enough memory to create the frames buffer\n");
                 p_aout->fifo[i_fifo].i_type = AOUT_EMPTY_FIFO;
@@ -469,10 +470,12 @@ static __inline__ int NextFrame( aout_thread_t * p_aout, aout_fifo_t * p_fifo/*,
             if ( aout_date < p_fifo->date[p_fifo->l_next_frame] )
             {
 */
+/*
             if ( p_fifo->date[p_fifo->l_next_frame] - p_fifo->date[p_fifo->l_start_frame] > 1000000 )
             {
                 p_fifo->date[p_fifo->l_start_frame] = p_fifo->date[p_fifo->l_next_frame] - ((1000000 * AOUT_FRAME_SIZE * ((mtime_t)((p_fifo->l_next_frame - p_fifo->l_start_frame) & AOUT_FIFO_SIZE)) >> p_fifo->b_stereo) / ((mtime_t)p_fifo->l_rate));
             }
+*/
             p_fifo->b_next_frame = 1;
             break;
 /*
@@ -500,8 +503,7 @@ static __inline__ int NextFrame( aout_thread_t * p_aout, aout_fifo_t * p_fifo/*,
         return( -1 );
     }
 
-    l_units = ((p_fifo->l_next_frame - p_fifo->l_start_frame) & AOUT_FIFO_SIZE)
-        * (AOUT_FRAME_SIZE >> p_fifo->b_stereo);
+    l_units = ((p_fifo->l_next_frame - p_fifo->l_start_frame) & AOUT_FIFO_SIZE) * (p_fifo->l_frame_size >> p_fifo->b_stereo);
 
     l_rate = (long)( ((mtime_t)l_units * 1000000)
         / (p_fifo->date[p_fifo->l_next_frame] - p_fifo->date[p_fifo->l_start_frame]) );
@@ -509,7 +511,7 @@ static __inline__ int NextFrame( aout_thread_t * p_aout, aout_fifo_t * p_fifo/*,
     InitializeIncrement( &p_fifo->unit_increment, l_rate, p_aout->dsp.l_rate );
 
     p_fifo->l_units = (((l_units - (p_fifo->l_unit -
-        (p_fifo->l_start_frame * (AOUT_FRAME_SIZE >> p_fifo->b_stereo))))
+        (p_fifo->l_start_frame * (p_fifo->l_frame_size >> p_fifo->b_stereo))))
         * p_aout->dsp.l_rate) / l_rate) + 1;
 
     /* We release the lock before leaving */
@@ -644,10 +646,10 @@ void aout_Thread_S16_Stereo( aout_thread_t * p_aout )
 
                                 UPDATE_INCREMENT( p_aout->fifo[i_fifo].unit_increment, p_aout->fifo[i_fifo].l_unit )
                                 if ( p_aout->fifo[i_fifo].l_unit >= /* p_aout->fifo[i_fifo].b_stereo == 0 */
-                                     ((AOUT_FIFO_SIZE + 1) * (AOUT_FRAME_SIZE >> 0)) )
+                                     ((AOUT_FIFO_SIZE + 1) * (p_aout->fifo[i_fifo].l_frame_size >> 0)) )
                                 {
                                     p_aout->fifo[i_fifo].l_unit -= /* p_aout->fifo[i_fifo].b_stereo == 0 */
-                                        ((AOUT_FIFO_SIZE + 1) * (AOUT_FRAME_SIZE >> 0));
+                                        ((AOUT_FIFO_SIZE + 1) * (p_aout->fifo[i_fifo].l_frame_size >> 0));
                                 }
                             }
                             p_aout->fifo[i_fifo].l_units -= l_units;
@@ -666,10 +668,10 @@ void aout_Thread_S16_Stereo( aout_thread_t * p_aout )
 
                                 UPDATE_INCREMENT( p_aout->fifo[i_fifo].unit_increment, p_aout->fifo[i_fifo].l_unit )
                                 if ( p_aout->fifo[i_fifo].l_unit >= /* p_aout->fifo[i_fifo].b_stereo == 0 */
-                                     ((AOUT_FIFO_SIZE + 1) * (AOUT_FRAME_SIZE >> 0)) )
+                                     ((AOUT_FIFO_SIZE + 1) * (p_aout->fifo[i_fifo].l_frame_size >> 0)) )
                                 {
                                     p_aout->fifo[i_fifo].l_unit -= /* p_aout->fifo[i_fifo].b_stereo == 0 */
-                                        ((AOUT_FIFO_SIZE + 1) * (AOUT_FRAME_SIZE >> 0));
+                                        ((AOUT_FIFO_SIZE + 1) * (p_aout->fifo[i_fifo].l_frame_size >> 0));
                                 }
                             }
                             l_units -= p_aout->fifo[i_fifo].l_units;
@@ -712,10 +714,10 @@ void aout_Thread_S16_Stereo( aout_thread_t * p_aout )
 
                                 UPDATE_INCREMENT( p_aout->fifo[i_fifo].unit_increment, p_aout->fifo[i_fifo].l_unit )
                                 if ( p_aout->fifo[i_fifo].l_unit >= /* p_aout->fifo[i_fifo].b_stereo == 1 */
-                                     ((AOUT_FIFO_SIZE + 1) * (AOUT_FRAME_SIZE >> 1)) )
+                                     ((AOUT_FIFO_SIZE + 1) * (p_aout->fifo[i_fifo].l_frame_size >> 1)) )
                                 {
                                     p_aout->fifo[i_fifo].l_unit -= /* p_aout->fifo[i_fifo].b_stereo == 1 */
-                                        ((AOUT_FIFO_SIZE + 1) * (AOUT_FRAME_SIZE >> 1));
+                                        ((AOUT_FIFO_SIZE + 1) * (p_aout->fifo[i_fifo].l_frame_size >> 1));
                                 }
                             }
                             p_aout->fifo[i_fifo].l_units -= l_units;
@@ -734,10 +736,10 @@ void aout_Thread_S16_Stereo( aout_thread_t * p_aout )
 
                                 UPDATE_INCREMENT( p_aout->fifo[i_fifo].unit_increment, p_aout->fifo[i_fifo].l_unit )
                                 if ( p_aout->fifo[i_fifo].l_unit >= /* p_aout->fifo[i_fifo].b_stereo == 1 */
-                                     ((AOUT_FIFO_SIZE + 1) * (AOUT_FRAME_SIZE >> 1)) )
+                                     ((AOUT_FIFO_SIZE + 1) * (p_aout->fifo[i_fifo].l_frame_size >> 1)) )
                                 {
                                     p_aout->fifo[i_fifo].l_unit -= /* p_aout->fifo[i_fifo].b_stereo == 1 */
-                                        ((AOUT_FIFO_SIZE + 1) * (AOUT_FRAME_SIZE >> 1));
+                                        ((AOUT_FIFO_SIZE + 1) * (p_aout->fifo[i_fifo].l_frame_size >> 1));
                                 }
                             }
                             l_units -= p_aout->fifo[i_fifo].l_units;