Commit a551606d authored by Michel Kaempf's avatar Michel Kaempf

* Makefile :

- 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) ;
parent 853d3d6b
......@@ -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
......
......@@ -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
******************************************************************************/
......
......@@ -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
......
......@@ -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 )
{
......
......@@ -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;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment