Commit 6ec1835e authored by Michel Lespinasse's avatar Michel Lespinasse

travail sur l'ac3_decoder : debut de separation de ce qui est specifique a
videolan (ac3_decoder_thread) et de ce qui ne l'est pas. Ce n'est pas encore
ideal, la partie "videolan" fait des inits a l'interieur de la partie
"ac3"... il faudra que je fasse une belle interface pour ca.

Le probleme des includes n'est pas non plus regle, mais c'est a cause des
bit_streams :) patience.
parent d9f73a70
......@@ -201,7 +201,8 @@ video_output_obj = video_output/video_output.o \
video_output/video_text.o \
video_output/video_yuv.o
ac3_decoder_obj = ac3_decoder/ac3_decoder.o \
ac3_decoder_obj = ac3_decoder/ac3_decoder_thread.o \
ac3_decoder/ac3_decoder.o \
ac3_decoder/ac3_parse.o \
ac3_decoder/ac3_exponent.o \
ac3_decoder/ac3_bit_allocate.o \
......
......@@ -325,22 +325,16 @@ typedef struct stream_samples_s
typedef s16 ac3dec_frame_t[ AC3DEC_FRAME_SIZE ];
/*****************************************************************************
* ac3dec_thread_t : ac3 decoder thread descriptor
* ac3dec_t : ac3 decoder descriptor
*****************************************************************************/
typedef struct ac3dec_thread_s
typedef struct ac3dec_s
{
/*
* Thread properties
*/
vlc_thread_t thread_id; /* id for thread functions */
boolean_t b_die; /* `die' flag */
boolean_t b_error; /* `error' flag */
boolean_t b_invalid; /* `invalid' flag */
/*
* Input properties
*/
decoder_fifo_t fifo; /* stores the PES stream data */
/* The bit stream structure handles the PES stream at the bit level */
bit_stream_t bit_stream;
......@@ -356,16 +350,6 @@ typedef struct ac3dec_thread_s
stream_coeffs_t coeffs;
stream_samples_t samples;
/*
* Output properties
*/
aout_fifo_t * p_aout_fifo; /* stores the decompressed audio frames */
aout_thread_t * p_aout; /* needed to create the audio fifo */
} ac3dec_thread_t;
} ac3dec_t;
/*****************************************************************************
* Prototypes
*****************************************************************************/
ac3dec_thread_t * ac3dec_CreateThread( input_thread_t * p_input );
void ac3dec_DestroyThread( ac3dec_thread_t * p_ac3dec );
int ac3_audio_block (ac3dec_t * p_ac3dec, s16 * buffer);
/*****************************************************************************
* ac3_decoder.h : ac3 decoder thread interface
* (c)1999 VideoLAN
*****************************************************************************/
/*****************************************************************************
* ac3dec_thread_t : ac3 decoder thread descriptor
*****************************************************************************/
typedef struct ac3dec_thread_s
{
/*
* Thread properties
*/
vlc_thread_t thread_id; /* id for thread functions */
boolean_t b_die; /* `die' flag */
boolean_t b_error; /* `error' flag */
/*
* Input properties
*/
decoder_fifo_t fifo; /* stores the PES stream data */
/*
* Decoder properties
*/
ac3dec_t ac3_decoder;
/*
* Output properties
*/
aout_fifo_t * p_aout_fifo; /* stores the decompressed audio frames */
aout_thread_t * p_aout; /* needed to create the audio fifo */
} ac3dec_thread_t;
/*****************************************************************************
* Prototypes
*****************************************************************************/
ac3dec_thread_t * ac3dec_CreateThread( input_thread_t * p_input );
void ac3dec_DestroyThread( ac3dec_thread_t * p_ac3dec );
......@@ -202,7 +202,7 @@ static __inline__ s16 calc_lowcomp( s16 a, s16 b0, s16 b1, s16 bin )
return(a);
}
void bit_allocate( ac3dec_thread_t * p_ac3dec )
void bit_allocate( ac3dec_t * p_ac3dec )
{
u16 i;
s16 fgain;
......
void bit_allocate( ac3dec_thread_t * );
void bit_allocate( ac3dec_t * );
This diff is collapsed.
......@@ -42,7 +42,7 @@ static float smixlev_lut[4] = { 0.2928, 0.2071, 0.0 , 0.2071 };
* to reduce complexity. Realistically, there aren't many machines around
* with > 2 channel output anyways */
void downmix( ac3dec_thread_t * p_ac3dec, s16 * out_buf )
void downmix( ac3dec_t * p_ac3dec, s16 * out_buf )
{
int j;
float right_tmp;
......
void downmix( ac3dec_thread_t *, s16 * );
void downmix( ac3dec_t *, s16 * );
......@@ -29,7 +29,7 @@ static const s16 exps_2[128] = { -2, -2, -2, -2, -2, -1, -1, -1, -1, -1, 0, 0, 0
static const s16 exps_3[128] = { -2, -1, 0, 1, 2, -2, -1, 0, 1, 2, -2, -1, 0, 1, 2, -2, -1, 0, 1, 2, -2, -1, 0, 1, 2, -2, -1, 0, 1, 2, -2, -1, 0, 1, 2, -2, -1, 0, 1, 2, -2, -1, 0, 1, 2, -2, -1, 0, 1, 2, -2, -1, 0, 1, 2, -2, -1, 0, 1, 2, -2, -1, 0, 1, 2, -2, -1, 0, 1, 2, -2, -1, 0, 1, 2, -2, -1, 0, 1, 2, -2, -1, 0, 1, 2, -2, -1, 0, 1, 2, -2, -1, 0, 1, 2, -2, -1, 0, 1, 2, -2, -1, 0, 1, 2, -2, -1, 0, 1, 2, -2, -1, 0, 1, 2, -2, -1, 0, 1, 2, -2, -1, 0, 1, 2, -2, -1, 0 };
static __inline__ void exp_unpack_ch( ac3dec_thread_t * p_ac3dec, u16 type, u16 expstr, u16 ngrps, u16 initial_exp, u16 exps[], u16 * dest )
static __inline__ void exp_unpack_ch( ac3dec_t * p_ac3dec, u16 type, u16 expstr, u16 ngrps, u16 initial_exp, u16 exps[], u16 * dest )
{
u16 i,j;
s16 exp_acc;
......@@ -118,7 +118,7 @@ static __inline__ void exp_unpack_ch( ac3dec_thread_t * p_ac3dec, u16 type, u16
}
}
void exponent_unpack( ac3dec_thread_t * p_ac3dec )
void exponent_unpack( ac3dec_t * p_ac3dec )
{
u16 i;
......
......@@ -2,4 +2,4 @@
#define UNPACK_CPL 2
#define UNPACK_LFE 4
void exponent_unpack( ac3dec_thread_t * );
void exponent_unpack( ac3dec_t * );
#include <unistd.h> /* getpid() */
#include <math.h>
#include <stdio.h> /* "intf_msg.h" */
#include <stdlib.h> /* malloc(), free() */
#include <sys/soundcard.h> /* "audio_output.h" */
#include <sys/types.h>
#include <sys/uio.h> /* "input.h" */
#include "common.h"
#include "config.h"
#include "mtime.h"
#include "vlc_thread.h"
#include "debug.h" /* "input_netlist.h" */
#include "intf_msg.h" /* intf_DbgMsg(), intf_ErrMsg() */
#include "input.h" /* pes_packet_t */
#include "input_netlist.h" /* input_NetlistFreePES() */
#include "decoder_fifo.h" /* DECODER_FIFO_(ISEMPTY|START|INCSTART)() */
#include "mtime.h"
#include "input.h"
#include "decoder_fifo.h"
#include "audio_output.h"
#include "ac3_decoder.h"
#include "ac3_imdct.h"
......@@ -185,7 +171,7 @@ void imdct_init(void)
}
}
void imdct( ac3dec_thread_t * p_ac3dec )
void imdct( ac3dec_t * p_ac3dec )
{
int i;
......
void imdct( ac3dec_thread_t * p_ac3dec );
void imdct( ac3dec_t * p_ac3dec );
void imdct_init( void );
......@@ -101,7 +101,7 @@ static float exp_lut[ 25 ] =
};
/* Fetch an unpacked, left justified, and properly biased/dithered mantissa value */
static __inline__ float float_get( ac3dec_thread_t * p_ac3dec, u16 bap, u16 exp )
static __inline__ float float_get( ac3dec_t * p_ac3dec, u16 bap, u16 exp )
{
u32 group_code;
......@@ -217,7 +217,7 @@ static __inline__ float float_get( ac3dec_thread_t * p_ac3dec, u16 bap, u16 exp
}
}
static __inline__ void uncouple_channel( ac3dec_thread_t * p_ac3dec, u32 ch )
static __inline__ void uncouple_channel( ac3dec_t * p_ac3dec, u32 ch )
{
u32 bnd = 0;
u32 i,j;
......@@ -247,7 +247,7 @@ static __inline__ void uncouple_channel( ac3dec_thread_t * p_ac3dec, u32 ch )
}
}
void mantissa_unpack( ac3dec_thread_t * p_ac3dec )
void mantissa_unpack( ac3dec_t * p_ac3dec )
{
int i, j;
......
void mantissa_unpack( ac3dec_thread_t * );
void mantissa_unpack( ac3dec_t * );
......@@ -70,7 +70,7 @@ static struct frmsize_s frmsizecod_tbl[] = {
{ 640 ,{1280 ,1394 ,1920 } }};
/* Parse a syncinfo structure, minus the sync word */
void parse_syncinfo( ac3dec_thread_t * p_ac3dec )
void parse_syncinfo( ac3dec_t * p_ac3dec )
{
/* Get crc1 - we don't actually use this data though */
NeedBits( &(p_ac3dec->bit_stream), 16 );
......@@ -100,7 +100,7 @@ void parse_syncinfo( ac3dec_thread_t * p_ac3dec )
/*
* This routine fills a bsi struct from the AC3 stream
*/
void parse_bsi( ac3dec_thread_t * p_ac3dec )
void parse_bsi( ac3dec_t * p_ac3dec )
{
u32 i;
......@@ -336,7 +336,7 @@ void parse_bsi( ac3dec_thread_t * p_ac3dec )
}
/* More pain inducing parsing */
void parse_audblk( ac3dec_thread_t * p_ac3dec )
void parse_audblk( ac3dec_t * p_ac3dec )
{
int i, j;
......@@ -861,7 +861,7 @@ void parse_audblk( ac3dec_thread_t * p_ac3dec )
}
}
void parse_auxdata( ac3dec_thread_t * p_ac3dec )
void parse_auxdata( ac3dec_t * p_ac3dec )
{
int i;
int skip_length;
......
void parse_syncinfo( ac3dec_thread_t * );
void parse_bsi( ac3dec_thread_t * );
void parse_audblk( ac3dec_thread_t * );
void parse_auxdata( ac3dec_thread_t * );
void parse_syncinfo( ac3dec_t * );
void parse_bsi( ac3dec_t * );
void parse_audblk( ac3dec_t * );
void parse_auxdata( ac3dec_t * );
......@@ -42,7 +42,7 @@ static __inline__ u32 min( u32 a, u32 b )
/* This routine simply does stereo rematixing for the 2 channel
* stereo mode */
void rematrix( ac3dec_thread_t * p_ac3dec )
void rematrix( ac3dec_t * p_ac3dec )
{
u32 num_bands;
u32 start;
......
void rematrix( ac3dec_thread_t * );
void rematrix( ac3dec_t * );
......@@ -48,6 +48,7 @@
#include "video_parser.h"
#include "ac3_decoder.h"
#include "ac3_decoder_thread.h"
#include "spu_decoder.h"
#include "main.h"
......
......@@ -34,6 +34,7 @@
#include "audio_output.h"
#include "audio_decoder.h"
#include "ac3_decoder.h"
#include "ac3_decoder_thread.h"
#include "video.h"
#include "video_output.h"
......
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