mirror of
https://github.com/videolan/vlc.git
synced 2024-11-25 19:04:12 +08:00
Le retour du demoronifier qui n'est pas content.
. 11 moronic long lines destroyed . 1282 trailing spaces eradicated . 4 ugly macros fixed . 5 innocent a_bit_long lines shortened . 5987 tabulations transform�es en espaces . 153 '??' transform�s en 'XXX??' ou 'FIXME??' (ptyx, j'esp�re que ce compromis te convient) . commentaires en // corrig�s en /* */ (je parle bien des commentaires, pas des morceaux de code mis en // comme les printf de debug par exemple) Au passage : . version du vlc modifi�e en 0.1.99 (la release sera la 0.2.0) . suppression de video_x11.h . correction d'un warning dans intf_ctrl.c
This commit is contained in:
parent
3f8bf7fb19
commit
36ac163c85
8
Makefile
8
Makefile
@ -16,15 +16,15 @@ SHELL=/bin/sh
|
||||
# Audio output settings
|
||||
AUDIO = dsp
|
||||
# Not yet supported
|
||||
#AUDIO += esd
|
||||
AUDIO += esd
|
||||
# Fallback method that should always work
|
||||
AUDIO += dummy
|
||||
|
||||
# Video output settings
|
||||
VIDEO = x11
|
||||
#VIDEO += fb
|
||||
VIDEO += fb
|
||||
#VIDEO += ggi
|
||||
#VIDEO += glide
|
||||
VIDEO += glide
|
||||
# Not yet supported
|
||||
#VIDEO += beos
|
||||
#VIDEO += dga
|
||||
@ -59,7 +59,7 @@ DEBUG=0
|
||||
################################################################################
|
||||
|
||||
# Program version - may only be changed by the project leader
|
||||
PROGRAM_VERSION = 0.95.0
|
||||
PROGRAM_VERSION = 0.1.99
|
||||
|
||||
# audio options
|
||||
audio := $(shell echo $(AUDIO) | tr 'A-Z' 'a-z')
|
||||
|
@ -202,14 +202,14 @@ typedef struct audblk_s
|
||||
u16 lfefsnroffst;
|
||||
/* lfe fast gain code */
|
||||
u16 lfefgaincod;
|
||||
|
||||
|
||||
/* Coupling leak info */
|
||||
u16 cplleake;
|
||||
/* coupling fast leak initialization */
|
||||
u16 cplfleak;
|
||||
/* coupling slow leak initialization */
|
||||
u16 cplsleak;
|
||||
|
||||
|
||||
/* delta bit allocation info */
|
||||
u16 deltbaie;
|
||||
/* coupling delta bit allocation exists */
|
||||
@ -264,7 +264,7 @@ typedef struct audblk_s
|
||||
/* Number of coupling exponent groups
|
||||
* Derived from cplbegf, cplendf, cplexpstr */
|
||||
u16 ncplgrps;
|
||||
|
||||
|
||||
/* End mantissa numbers of fbw channels */
|
||||
u16 endmant[5];
|
||||
|
||||
@ -279,7 +279,7 @@ typedef struct audblk_s
|
||||
|
||||
/* Bit allocation pointer results */
|
||||
u16 fbw_bap[5][256];
|
||||
//FIXME figure out exactly how many entries there should be (253-37?)
|
||||
/* FIXME?? figure out exactly how many entries there should be (253-37?) */
|
||||
u16 cpl_bap[256];
|
||||
u16 lfe_bap[7];
|
||||
|
||||
|
@ -40,7 +40,7 @@
|
||||
#define AOUT_DEFAULT_STEREO 1
|
||||
|
||||
/* Audio output rate, in Hz */
|
||||
#define AOUT_MIN_RATE 22050 /* ?? */
|
||||
#define AOUT_MIN_RATE 22050 /* XXX?? */
|
||||
#define AOUT_DEFAULT_RATE 44100
|
||||
#define AOUT_MAX_RATE 48000
|
||||
|
||||
|
@ -97,7 +97,7 @@ typedef struct video_parser_s * p_video_parser_t;
|
||||
* byte orders other than little and big endians are not supported, but only
|
||||
* the VAX seems to have such exotic properties - note that these 'functions'
|
||||
* needs <netinet/in.h> or the local equivalent. */
|
||||
/* ?? hton64 should be declared as an extern inline function to avoid border
|
||||
/* FIXME??: hton64 should be declared as an extern inline function to avoid border
|
||||
* effects (see byteorder.h) */
|
||||
#if __BYTE_ORDER == __LITTLE_ENDIAN
|
||||
#define hton16 htons
|
||||
@ -114,7 +114,7 @@ typedef struct video_parser_s * p_video_parser_t;
|
||||
#define ntoh32 ntohl
|
||||
#define ntoh64(i) ( i )
|
||||
#else
|
||||
/* ?? cause a compilation error */
|
||||
/* XXX??: cause a compilation error */
|
||||
#endif
|
||||
|
||||
/* Macros used by input to access the TS buffer */
|
||||
|
@ -47,7 +47,7 @@
|
||||
* or pictures count won't be available if it not set */
|
||||
#define STATS
|
||||
|
||||
/* Define for unthreaded version of the program - ?? not yet implemented */
|
||||
/* Define for unthreaded version of the program FIXME: not yet implemented ??*/
|
||||
//#define NO_THREAD
|
||||
|
||||
/*****************************************************************************
|
||||
@ -80,7 +80,7 @@
|
||||
|
||||
|
||||
/* Automagically spawn input, audio and video threads ? */
|
||||
// ?? used ?
|
||||
/* XXX?? used ? */
|
||||
#define AUTO_SPAWN
|
||||
|
||||
/* When creating or destroying threads in blocking mode, delay to poll thread
|
||||
@ -125,7 +125,7 @@
|
||||
* Input thread configuration
|
||||
*****************************************************************************/
|
||||
|
||||
/* ?? */
|
||||
/* XXX?? */
|
||||
#define INPUT_IDLE_SLEEP ((int)(0.100*CLOCK_FREQ))
|
||||
|
||||
/*
|
||||
|
@ -13,7 +13,7 @@
|
||||
* Macros
|
||||
*****************************************************************************/
|
||||
|
||||
/* ?? move to inline functions */
|
||||
/* FIXME: move to inline functions ??*/
|
||||
#define DECODER_FIFO_ISEMPTY( fifo ) ( (fifo).i_start == (fifo).i_end )
|
||||
#define DECODER_FIFO_ISFULL( fifo ) ( ( ( (fifo).i_end + 1 - (fifo).i_start ) \
|
||||
& FIFO_SIZE ) == 0 )
|
||||
@ -80,7 +80,7 @@ typedef struct bit_stream_s
|
||||
*/
|
||||
/* Current TS packet (in the current PES packet of the PES stream) */
|
||||
ts_packet_t * p_ts;
|
||||
/* Pointer to the next byte that is to be read (in the current TS packet) */
|
||||
/* Pointer to the next byte that is to be read (in the current TS packet) */
|
||||
byte_t * p_byte;
|
||||
/* Pointer to the last byte that is to be read (in the current TS packet */
|
||||
byte_t * p_end;
|
||||
@ -103,8 +103,8 @@ static __inline__ byte_t GetByte( bit_stream_t * p_bit_stream )
|
||||
/* could change this test to have a if (! (bytes--)) instead */
|
||||
if ( p_bit_stream->p_byte >= p_bit_stream->p_end )
|
||||
{
|
||||
/* no, switch to next TS packet */
|
||||
decoder_fifo_next( p_bit_stream );
|
||||
/* no, switch to next TS packet */
|
||||
decoder_fifo_next( p_bit_stream );
|
||||
}
|
||||
|
||||
return( *(p_bit_stream->p_byte++));
|
||||
|
@ -95,7 +95,7 @@ typedef struct es_descriptor_t
|
||||
u8 i_type; /* stream type */
|
||||
|
||||
boolean_t b_pcr; /* does the stream include a PCR ? */
|
||||
/* ?? b_pcr will be replaced by something else: since a PCR can't be shared
|
||||
/* XXX?? b_pcr will be replaced by something else: since a PCR can't be shared
|
||||
* between several ES, we will probably store the PCR fields directly here,
|
||||
* and one of those fields will probably (again) be used as a test of the
|
||||
* PCR presence */
|
||||
@ -119,12 +119,12 @@ typedef struct es_descriptor_t
|
||||
* vdec_thread_t. We will use explicit
|
||||
* casts. */
|
||||
|
||||
/* ?? video stream descriptor ? */
|
||||
/* ?? audio stream descriptor ? */
|
||||
/* ?? hierarchy descriptor ? */
|
||||
/* ?? target background grid descriptor ? */
|
||||
/* ?? video window descriptor ? */
|
||||
/* ?? ISO 639 language descriptor ? */
|
||||
/* XXX?? video stream descriptor ? */
|
||||
/* XXX?? audio stream descriptor ? */
|
||||
/* XXX?? hierarchy descriptor ? */
|
||||
/* XXX?? target background grid descriptor ? */
|
||||
/* XXX?? video window descriptor ? */
|
||||
/* XXX?? ISO 639 language descriptor ? */
|
||||
|
||||
#ifdef STATS
|
||||
/* Stats */
|
||||
@ -132,7 +132,7 @@ typedef struct es_descriptor_t
|
||||
count_t c_payload_bytes;/* total of payload usefull bytes */
|
||||
count_t c_packets; /* total packets read */
|
||||
count_t c_invalid_packets; /* invalid packets read */
|
||||
/* ?? ... other stats */
|
||||
/* XXX?? ... other stats */
|
||||
#endif
|
||||
} es_descriptor_t;
|
||||
|
||||
@ -173,13 +173,13 @@ typedef struct
|
||||
char* psz_srv_name;
|
||||
#endif
|
||||
|
||||
/* ?? target background grid descriptor ? */
|
||||
/* ?? video window descriptor ? */
|
||||
/* ?? ISO 639 language descriptor ? */
|
||||
/* XXX?? target background grid descriptor ? */
|
||||
/* XXX?? video window descriptor ? */
|
||||
/* XXX?? ISO 639 language descriptor ? */
|
||||
|
||||
#ifdef STATS
|
||||
/* Stats */
|
||||
/* ?? ...stats */
|
||||
/* XXX?? ...stats */
|
||||
#endif
|
||||
} pgrm_descriptor_t;
|
||||
|
||||
@ -241,7 +241,7 @@ typedef struct
|
||||
|
||||
#ifdef STATS
|
||||
/* Stats */
|
||||
/* ?? ...stats */
|
||||
/* XXX?? ...stats */
|
||||
#endif
|
||||
} stream_descriptor_t;
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
* input_vlan.h: vlan input method
|
||||
* (c)1999 VideoLAN
|
||||
*****************************************************************************
|
||||
* ??
|
||||
* XXX??
|
||||
*****************************************************************************
|
||||
* Required headers:
|
||||
* <netinet/in.h>
|
||||
|
@ -17,7 +17,7 @@
|
||||
/*****************************************************************************
|
||||
* vdec_thread_t: video decoder thread descriptor
|
||||
*****************************************************************************
|
||||
* ??
|
||||
* XXX??
|
||||
*****************************************************************************/
|
||||
typedef struct vdec_thread_s
|
||||
{
|
||||
@ -29,8 +29,7 @@ typedef struct vdec_thread_s
|
||||
vlc_thread_t thread_id; /* id for thread functions */
|
||||
|
||||
/* Thread configuration */
|
||||
/* ?? */
|
||||
/*??*/
|
||||
/* XXX?? */
|
||||
// int *pi_status;
|
||||
|
||||
#ifdef OLD_DECODER
|
||||
|
@ -16,7 +16,7 @@
|
||||
*****************************************************************************/
|
||||
|
||||
#ifdef VDEC_SMP
|
||||
/* ?? move to inline functions */
|
||||
/* FIXME: move to inline functions ??*/
|
||||
#define VIDEO_FIFO_ISEMPTY( fifo ) ( (fifo).i_start == (fifo).i_end )
|
||||
#define VIDEO_FIFO_ISFULL( fifo ) ( ( ( (fifo).i_end + 1 - (fifo).i_start )\
|
||||
& VFIFO_SIZE ) == 0 )
|
||||
|
@ -166,7 +166,7 @@ typedef struct vout_thread_s
|
||||
int i_buffer_index; /* buffer index */
|
||||
vout_buffer_t p_buffer[2]; /* buffers properties */
|
||||
|
||||
/* Videos heap and translation tables */
|
||||
/* Videos heap and translation tables */
|
||||
picture_t p_picture[VOUT_MAX_PICTURES]; /* pictures */
|
||||
subpicture_t p_subpicture[VOUT_MAX_PICTURES]; /* subpictures */
|
||||
int i_pictures; /* current heap size */
|
||||
@ -178,7 +178,7 @@ typedef struct vout_thread_s
|
||||
|
||||
/* Synchronisation informations - synchro level is updated by the vout
|
||||
* thread and read by decoder threads */
|
||||
int i_synchro_level; /* trashing level */
|
||||
int i_synchro_level; /* trashing level */
|
||||
} vout_thread_t;
|
||||
|
||||
/* Flags for changes - these flags are set in the i_changes field when another
|
||||
|
@ -60,7 +60,7 @@ typedef struct video_buffer_s
|
||||
/*****************************************************************************
|
||||
* vpar_thread_t: video parser thread descriptor
|
||||
*****************************************************************************
|
||||
* ??
|
||||
* XXX??
|
||||
*****************************************************************************/
|
||||
typedef struct vpar_thread_s
|
||||
{
|
||||
@ -72,8 +72,7 @@ typedef struct vpar_thread_s
|
||||
vlc_thread_t thread_id; /* id for thread functions */
|
||||
|
||||
/* Thread configuration */
|
||||
/* ?? */
|
||||
/*??*/
|
||||
/* XXX?? */
|
||||
// int *pi_status;
|
||||
|
||||
|
||||
@ -143,10 +142,10 @@ vpar_thread_t * vpar_CreateThread ( /* video_cfg_t *p_cfg, */ input_thread
|
||||
void vpar_DestroyThread ( vpar_thread_t *p_vpar /*, int *pi_status */ );
|
||||
|
||||
/* Time management functions */
|
||||
/* ?? */
|
||||
/* XXX?? */
|
||||
|
||||
/* Dynamic thread settings */
|
||||
/* ?? */
|
||||
/* XXX?? */
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
|
@ -59,8 +59,10 @@ static __inline__ int vlc_cond_init ( vlc_cond_t *p_condvar );
|
||||
static __inline__ int vlc_cond_signal ( vlc_cond_t *p_condvar );
|
||||
static __inline__ int vlc_cond_wait ( vlc_cond_t *p_condvar, vlc_mutex_t *p_mutex );
|
||||
|
||||
//static _inline__ int vlc_cond_timedwait ( vlc_cond_t * condvar, vlc_mutex_t * mutex,
|
||||
// mtime_t absoute_timeout_time );
|
||||
#if 0
|
||||
static _inline__ int vlc_cond_timedwait ( vlc_cond_t * condvar, vlc_mutex_t * mutex,
|
||||
mtime_t absoute_timeout_time );
|
||||
#endif
|
||||
|
||||
/*****************************************************************************
|
||||
* vlc_thread_create: create a thread
|
||||
|
@ -91,8 +91,8 @@ typedef struct video_synchro_s
|
||||
int i_coding_type;
|
||||
} video_synchro_t;
|
||||
|
||||
#define SYNC_TOLERATE ((int)(0.010*CLOCK_FREQ)) /* 10 ms */
|
||||
#define SYNC_DELAY ((int)(0.500*CLOCK_FREQ)) /* 500 ms */
|
||||
#define SYNC_TOLERATE ((int)(0.010*CLOCK_FREQ)) /* 10 ms */
|
||||
#define SYNC_DELAY ((int)(0.500*CLOCK_FREQ)) /* 500 ms */
|
||||
#endif
|
||||
|
||||
#ifdef POLUX_SYNCHRO
|
||||
@ -102,19 +102,19 @@ typedef struct video_synchro_s
|
||||
typedef struct video_synchro_s
|
||||
{
|
||||
/* Date Section */
|
||||
|
||||
/* Dates needed to compute the date of the current frame
|
||||
|
||||
/* Dates needed to compute the date of the current frame
|
||||
* We also use the stream frame rate (sequence.r_frame_rate) */
|
||||
mtime_t i_current_frame_date;
|
||||
mtime_t i_backward_frame_date;
|
||||
|
||||
/* Frame Trashing Section */
|
||||
|
||||
|
||||
int i_b_nb, i_p_nb; /* number of decoded P and B between two I */
|
||||
float r_b_average, r_p_average;
|
||||
int i_b_count, i_p_count, i_i_count;
|
||||
int i_b_trasher; /* used for brensenham algorithm */
|
||||
|
||||
|
||||
} video_synchro_t;
|
||||
|
||||
#endif
|
||||
|
@ -30,16 +30,16 @@ static inline u16 min(s16 a,s16 b);
|
||||
static inline u16 max(s16 a,s16 b);
|
||||
*/
|
||||
static void ba_compute_psd(s16 start, s16 end, s16 exps[],
|
||||
s16 psd[], s16 bndpsd[]);
|
||||
s16 psd[], s16 bndpsd[]);
|
||||
|
||||
static void ba_compute_excitation(s16 start, s16 end,s16 fgain,
|
||||
s16 fastleak, s16 slowleak, s16 is_lfe, s16 bndpsd[],
|
||||
s16 excite[]);
|
||||
s16 fastleak, s16 slowleak, s16 is_lfe, s16 bndpsd[],
|
||||
s16 excite[]);
|
||||
static void ba_compute_mask(s16 start, s16 end, u16 fscod,
|
||||
u16 deltbae, u16 deltnseg, u16 deltoffst[], u16 deltba[],
|
||||
u16 deltlen[], s16 excite[], s16 mask[]);
|
||||
u16 deltbae, u16 deltnseg, u16 deltoffst[], u16 deltba[],
|
||||
u16 deltlen[], s16 excite[], s16 mask[]);
|
||||
static void ba_compute_bap(s16 start, s16 end, s16 snroffset,
|
||||
s16 psd[], s16 mask[], s16 bap[]);
|
||||
s16 psd[], s16 mask[], s16 bap[]);
|
||||
|
||||
/* Misc LUTs for bit allocation process */
|
||||
|
||||
@ -158,321 +158,321 @@ static s16 mask[256];
|
||||
|
||||
static __inline__ u16 max( s16 a, s16 b )
|
||||
{
|
||||
return( a > b ? a : b );
|
||||
return( a > b ? a : b );
|
||||
}
|
||||
|
||||
|
||||
static __inline__ u16 min( s16 a, s16 b )
|
||||
{
|
||||
return( a < b ? a : b );
|
||||
return( a < b ? a : b );
|
||||
}
|
||||
|
||||
static __inline__ s16 logadd( s16 a, s16 b )
|
||||
{
|
||||
s16 c;
|
||||
s16 c;
|
||||
|
||||
if ( (c = a - b) >= 0 )
|
||||
{
|
||||
return( a + latab[min(((c) >> 1), 255)] );
|
||||
}
|
||||
else
|
||||
{
|
||||
return( b + latab[min(((-c) >> 1), 255)] );
|
||||
}
|
||||
if ( (c = a - b) >= 0 )
|
||||
{
|
||||
return( a + latab[min(((c) >> 1), 255)] );
|
||||
}
|
||||
else
|
||||
{
|
||||
return( b + latab[min(((-c) >> 1), 255)] );
|
||||
}
|
||||
}
|
||||
|
||||
static __inline__ s16 calc_lowcomp( s16 a, s16 b0, s16 b1, s16 bin )
|
||||
{
|
||||
if (bin < 7)
|
||||
{
|
||||
if ((b0 + 256) == b1)
|
||||
a = 384;
|
||||
else if (b0 > b1)
|
||||
a = max(0, a - 64);
|
||||
}
|
||||
else if (bin < 20)
|
||||
{
|
||||
if ((b0 + 256) == b1)
|
||||
a = 320;
|
||||
else if (b0 > b1)
|
||||
a = max(0, a - 64) ;
|
||||
}
|
||||
else
|
||||
a = max(0, a - 128);
|
||||
|
||||
return(a);
|
||||
if (bin < 7)
|
||||
{
|
||||
if ((b0 + 256) == b1)
|
||||
a = 384;
|
||||
else if (b0 > b1)
|
||||
a = max(0, a - 64);
|
||||
}
|
||||
else if (bin < 20)
|
||||
{
|
||||
if ((b0 + 256) == b1)
|
||||
a = 320;
|
||||
else if (b0 > b1)
|
||||
a = max(0, a - 64) ;
|
||||
}
|
||||
else
|
||||
a = max(0, a - 128);
|
||||
|
||||
return(a);
|
||||
}
|
||||
|
||||
void bit_allocate( ac3dec_t * p_ac3dec )
|
||||
{
|
||||
u16 i;
|
||||
s16 fgain;
|
||||
s16 snroffset;
|
||||
s16 start;
|
||||
s16 end;
|
||||
s16 fastleak;
|
||||
s16 slowleak;
|
||||
u16 i;
|
||||
s16 fgain;
|
||||
s16 snroffset;
|
||||
s16 start;
|
||||
s16 end;
|
||||
s16 fastleak;
|
||||
s16 slowleak;
|
||||
|
||||
/* Only perform bit_allocation if the exponents have changed or we
|
||||
* have new sideband information */
|
||||
if (p_ac3dec->audblk.chexpstr[0] == 0 && p_ac3dec->audblk.chexpstr[1] == 0 &&
|
||||
p_ac3dec->audblk.chexpstr[2] == 0 && p_ac3dec->audblk.chexpstr[3] == 0 &&
|
||||
p_ac3dec->audblk.chexpstr[4] == 0 && p_ac3dec->audblk.cplexpstr == 0 &&
|
||||
p_ac3dec->audblk.lfeexpstr == 0 && p_ac3dec->audblk.baie == 0 &&
|
||||
p_ac3dec->audblk.snroffste == 0 && p_ac3dec->audblk.deltbaie == 0)
|
||||
return;
|
||||
/* Only perform bit_allocation if the exponents have changed or we
|
||||
* have new sideband information */
|
||||
if (p_ac3dec->audblk.chexpstr[0] == 0 && p_ac3dec->audblk.chexpstr[1] == 0 &&
|
||||
p_ac3dec->audblk.chexpstr[2] == 0 && p_ac3dec->audblk.chexpstr[3] == 0 &&
|
||||
p_ac3dec->audblk.chexpstr[4] == 0 && p_ac3dec->audblk.cplexpstr == 0 &&
|
||||
p_ac3dec->audblk.lfeexpstr == 0 && p_ac3dec->audblk.baie == 0 &&
|
||||
p_ac3dec->audblk.snroffste == 0 && p_ac3dec->audblk.deltbaie == 0)
|
||||
return;
|
||||
|
||||
/* Do some setup before we do the bit alloc */
|
||||
sdecay = slowdec[p_ac3dec->audblk.sdcycod];
|
||||
fdecay = fastdec[p_ac3dec->audblk.fdcycod];
|
||||
sgain = slowgain[p_ac3dec->audblk.sgaincod];
|
||||
dbknee = dbpbtab[p_ac3dec->audblk.dbpbcod];
|
||||
floor = floortab[p_ac3dec->audblk.floorcod];
|
||||
/* Do some setup before we do the bit alloc */
|
||||
sdecay = slowdec[p_ac3dec->audblk.sdcycod];
|
||||
fdecay = fastdec[p_ac3dec->audblk.fdcycod];
|
||||
sgain = slowgain[p_ac3dec->audblk.sgaincod];
|
||||
dbknee = dbpbtab[p_ac3dec->audblk.dbpbcod];
|
||||
floor = floortab[p_ac3dec->audblk.floorcod];
|
||||
|
||||
/* if all the SNR offset constants are zero then the whole block is zero */
|
||||
if(!p_ac3dec->audblk.csnroffst && !p_ac3dec->audblk.fsnroffst[0] &&
|
||||
!p_ac3dec->audblk.fsnroffst[1] && !p_ac3dec->audblk.fsnroffst[2] &&
|
||||
!p_ac3dec->audblk.fsnroffst[3] && !p_ac3dec->audblk.fsnroffst[4] &&
|
||||
!p_ac3dec->audblk.cplfsnroffst && !p_ac3dec->audblk.lfefsnroffst)
|
||||
{
|
||||
memset(p_ac3dec->audblk.fbw_bap,0,sizeof(u16) * 256 * 5);
|
||||
memset(p_ac3dec->audblk.cpl_bap,0,sizeof(u16) * 256);
|
||||
memset(p_ac3dec->audblk.lfe_bap,0,sizeof(u16) * 7);
|
||||
return;
|
||||
}
|
||||
/* if all the SNR offset constants are zero then the whole block is zero */
|
||||
if(!p_ac3dec->audblk.csnroffst && !p_ac3dec->audblk.fsnroffst[0] &&
|
||||
!p_ac3dec->audblk.fsnroffst[1] && !p_ac3dec->audblk.fsnroffst[2] &&
|
||||
!p_ac3dec->audblk.fsnroffst[3] && !p_ac3dec->audblk.fsnroffst[4] &&
|
||||
!p_ac3dec->audblk.cplfsnroffst && !p_ac3dec->audblk.lfefsnroffst)
|
||||
{
|
||||
memset(p_ac3dec->audblk.fbw_bap,0,sizeof(u16) * 256 * 5);
|
||||
memset(p_ac3dec->audblk.cpl_bap,0,sizeof(u16) * 256);
|
||||
memset(p_ac3dec->audblk.lfe_bap,0,sizeof(u16) * 7);
|
||||
return;
|
||||
}
|
||||
|
||||
for(i = 0; i < p_ac3dec->bsi.nfchans; i++)
|
||||
{
|
||||
start = 0;
|
||||
end = p_ac3dec->audblk.endmant[i] ;
|
||||
fgain = fastgain[p_ac3dec->audblk.fgaincod[i]];
|
||||
snroffset = (((p_ac3dec->audblk.csnroffst - 15) << 4) + p_ac3dec->audblk.fsnroffst[i]) << 2 ;
|
||||
fastleak = 0;
|
||||
slowleak = 0;
|
||||
for(i = 0; i < p_ac3dec->bsi.nfchans; i++)
|
||||
{
|
||||
start = 0;
|
||||
end = p_ac3dec->audblk.endmant[i] ;
|
||||
fgain = fastgain[p_ac3dec->audblk.fgaincod[i]];
|
||||
snroffset = (((p_ac3dec->audblk.csnroffst - 15) << 4) + p_ac3dec->audblk.fsnroffst[i]) << 2 ;
|
||||
fastleak = 0;
|
||||
slowleak = 0;
|
||||
|
||||
ba_compute_psd(start, end, p_ac3dec->audblk.fbw_exp[i], psd, bndpsd);
|
||||
ba_compute_psd(start, end, p_ac3dec->audblk.fbw_exp[i], psd, bndpsd);
|
||||
|
||||
ba_compute_excitation(start, end , fgain, fastleak, slowleak, 0, bndpsd, excite);
|
||||
ba_compute_excitation(start, end , fgain, fastleak, slowleak, 0, bndpsd, excite);
|
||||
|
||||
ba_compute_mask(start, end, p_ac3dec->syncinfo.fscod, p_ac3dec->audblk.deltbae[i], p_ac3dec->audblk.deltnseg[i], p_ac3dec->audblk.deltoffst[i], p_ac3dec->audblk.deltba[i], p_ac3dec->audblk.deltlen[i], excite, mask);
|
||||
ba_compute_mask(start, end, p_ac3dec->syncinfo.fscod, p_ac3dec->audblk.deltbae[i], p_ac3dec->audblk.deltnseg[i], p_ac3dec->audblk.deltoffst[i], p_ac3dec->audblk.deltba[i], p_ac3dec->audblk.deltlen[i], excite, mask);
|
||||
|
||||
ba_compute_bap(start, end, snroffset, psd, mask, p_ac3dec->audblk.fbw_bap[i]);
|
||||
}
|
||||
ba_compute_bap(start, end, snroffset, psd, mask, p_ac3dec->audblk.fbw_bap[i]);
|
||||
}
|
||||
|
||||
if(p_ac3dec->audblk.cplinu)
|
||||
{
|
||||
start = p_ac3dec->audblk.cplstrtmant;
|
||||
end = p_ac3dec->audblk.cplendmant;
|
||||
fgain = fastgain[p_ac3dec->audblk.cplfgaincod];
|
||||
snroffset = (((p_ac3dec->audblk.csnroffst - 15) << 4) + p_ac3dec->audblk.cplfsnroffst) << 2 ;
|
||||
fastleak = (p_ac3dec->audblk.cplfleak << 8) + 768;
|
||||
slowleak = (p_ac3dec->audblk.cplsleak << 8) + 768;
|
||||
if(p_ac3dec->audblk.cplinu)
|
||||
{
|
||||
start = p_ac3dec->audblk.cplstrtmant;
|
||||
end = p_ac3dec->audblk.cplendmant;
|
||||
fgain = fastgain[p_ac3dec->audblk.cplfgaincod];
|
||||
snroffset = (((p_ac3dec->audblk.csnroffst - 15) << 4) + p_ac3dec->audblk.cplfsnroffst) << 2 ;
|
||||
fastleak = (p_ac3dec->audblk.cplfleak << 8) + 768;
|
||||
slowleak = (p_ac3dec->audblk.cplsleak << 8) + 768;
|
||||
|
||||
ba_compute_psd(start, end, p_ac3dec->audblk.cpl_exp, psd, bndpsd);
|
||||
ba_compute_psd(start, end, p_ac3dec->audblk.cpl_exp, psd, bndpsd);
|
||||
|
||||
ba_compute_excitation(start, end , fgain, fastleak, slowleak, 0, bndpsd, excite);
|
||||
ba_compute_excitation(start, end , fgain, fastleak, slowleak, 0, bndpsd, excite);
|
||||
|
||||
ba_compute_mask(start, end, p_ac3dec->syncinfo.fscod, p_ac3dec->audblk.cpldeltbae, p_ac3dec->audblk.cpldeltnseg, p_ac3dec->audblk.cpldeltoffst, p_ac3dec->audblk.cpldeltba, p_ac3dec->audblk.cpldeltlen, excite, mask);
|
||||
ba_compute_mask(start, end, p_ac3dec->syncinfo.fscod, p_ac3dec->audblk.cpldeltbae, p_ac3dec->audblk.cpldeltnseg, p_ac3dec->audblk.cpldeltoffst, p_ac3dec->audblk.cpldeltba, p_ac3dec->audblk.cpldeltlen, excite, mask);
|
||||
|
||||
ba_compute_bap(start, end, snroffset, psd, mask, p_ac3dec->audblk.cpl_bap);
|
||||
}
|
||||
ba_compute_bap(start, end, snroffset, psd, mask, p_ac3dec->audblk.cpl_bap);
|
||||
}
|
||||
|
||||
if(p_ac3dec->bsi.lfeon)
|
||||
{
|
||||
start = 0;
|
||||
end = 7;
|
||||
fgain = fastgain[p_ac3dec->audblk.lfefgaincod];
|
||||
snroffset = (((p_ac3dec->audblk.csnroffst - 15) << 4) + p_ac3dec->audblk.lfefsnroffst) << 2 ;
|
||||
fastleak = 0;
|
||||
slowleak = 0;
|
||||
if(p_ac3dec->bsi.lfeon)
|
||||
{
|
||||
start = 0;
|
||||
end = 7;
|
||||
fgain = fastgain[p_ac3dec->audblk.lfefgaincod];
|
||||
snroffset = (((p_ac3dec->audblk.csnroffst - 15) << 4) + p_ac3dec->audblk.lfefsnroffst) << 2 ;
|
||||
fastleak = 0;
|
||||
slowleak = 0;
|
||||
|
||||
ba_compute_psd(start, end, p_ac3dec->audblk.lfe_exp, psd, bndpsd);
|
||||
ba_compute_psd(start, end, p_ac3dec->audblk.lfe_exp, psd, bndpsd);
|
||||
|
||||
ba_compute_excitation(start, end , fgain, fastleak, slowleak, 1, bndpsd, excite);
|
||||
ba_compute_excitation(start, end , fgain, fastleak, slowleak, 1, bndpsd, excite);
|
||||
|
||||
ba_compute_mask(start, end, p_ac3dec->syncinfo.fscod, 2, 0, 0, 0, 0, excite, mask);
|
||||
ba_compute_mask(start, end, p_ac3dec->syncinfo.fscod, 2, 0, 0, 0, 0, excite, mask);
|
||||
|
||||
ba_compute_bap(start, end, snroffset, psd, mask, p_ac3dec->audblk.lfe_bap);
|
||||
}
|
||||
ba_compute_bap(start, end, snroffset, psd, mask, p_ac3dec->audblk.lfe_bap);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void ba_compute_psd(s16 start, s16 end, s16 exps[],
|
||||
s16 psd[], s16 bndpsd[])
|
||||
s16 psd[], s16 bndpsd[])
|
||||
{
|
||||
int bin,i,j,k;
|
||||
s16 lastbin = 0;
|
||||
|
||||
/* Map the exponents into dBs */
|
||||
for (bin=start; bin<end; bin++)
|
||||
{
|
||||
psd[bin] = (3072 - (exps[bin] << 7));
|
||||
}
|
||||
int bin,i,j,k;
|
||||
s16 lastbin = 0;
|
||||
|
||||
/* Integrate the psd function over each bit allocation band */
|
||||
j = start;
|
||||
k = masktab[start];
|
||||
|
||||
do
|
||||
{
|
||||
lastbin = min(bndtab[k] + bndsz[k], end);
|
||||
bndpsd[k] = psd[j];
|
||||
j++;
|
||||
/* Map the exponents into dBs */
|
||||
for (bin=start; bin<end; bin++)
|
||||
{
|
||||
psd[bin] = (3072 - (exps[bin] << 7));
|
||||
}
|
||||
|
||||
for (i = j; i < lastbin; i++)
|
||||
{
|
||||
bndpsd[k] = logadd(bndpsd[k], psd[j]);
|
||||
j++;
|
||||
}
|
||||
|
||||
k++;
|
||||
} while (end > lastbin);
|
||||
/* Integrate the psd function over each bit allocation band */
|
||||
j = start;
|
||||
k = masktab[start];
|
||||
|
||||
do
|
||||
{
|
||||
lastbin = min(bndtab[k] + bndsz[k], end);
|
||||
bndpsd[k] = psd[j];
|
||||
j++;
|
||||
|
||||
for (i = j; i < lastbin; i++)
|
||||
{
|
||||
bndpsd[k] = logadd(bndpsd[k], psd[j]);
|
||||
j++;
|
||||
}
|
||||
|
||||
k++;
|
||||
} while (end > lastbin);
|
||||
}
|
||||
|
||||
static void ba_compute_excitation(s16 start, s16 end,s16 fgain,
|
||||
s16 fastleak, s16 slowleak, s16 is_lfe, s16 bndpsd[],
|
||||
s16 excite[])
|
||||
s16 fastleak, s16 slowleak, s16 is_lfe, s16 bndpsd[],
|
||||
s16 excite[])
|
||||
{
|
||||
int bin;
|
||||
s16 bndstrt;
|
||||
s16 bndend;
|
||||
s16 lowcomp = 0;
|
||||
s16 begin = 0;
|
||||
int bin;
|
||||
s16 bndstrt;
|
||||
s16 bndend;
|
||||
s16 lowcomp = 0;
|
||||
s16 begin = 0;
|
||||
|
||||
/* Compute excitation function */
|
||||
bndstrt = masktab[start];
|
||||
bndend = masktab[end - 1] + 1;
|
||||
|
||||
if (bndstrt == 0) /* For fbw and lfe channels */
|
||||
{
|
||||
lowcomp = calc_lowcomp(lowcomp, bndpsd[0], bndpsd[1], 0);
|
||||
excite[0] = bndpsd[0] - fgain - lowcomp;
|
||||
lowcomp = calc_lowcomp(lowcomp, bndpsd[1], bndpsd[2], 1);
|
||||
excite[1] = bndpsd[1] - fgain - lowcomp;
|
||||
begin = 7 ;
|
||||
|
||||
/* Note: Do not call calc_lowcomp() for the last band of the lfe channel, (bin = 6) */
|
||||
for (bin = 2; bin < 7; bin++)
|
||||
{
|
||||
if (!(is_lfe && (bin == 6)))
|
||||
lowcomp = calc_lowcomp(lowcomp, bndpsd[bin], bndpsd[bin+1], bin);
|
||||
fastleak = bndpsd[bin] - fgain;
|
||||
slowleak = bndpsd[bin] - sgain;
|
||||
excite[bin] = fastleak - lowcomp;
|
||||
|
||||
if (!(is_lfe && (bin == 6)))
|
||||
{
|
||||
if (bndpsd[bin] <= bndpsd[bin+1])
|
||||
{
|
||||
begin = bin + 1 ;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (bin = begin; bin < min(bndend, 22); bin++)
|
||||
{
|
||||
if (!(is_lfe && (bin == 6)))
|
||||
lowcomp = calc_lowcomp(lowcomp, bndpsd[bin], bndpsd[bin+1], bin);
|
||||
fastleak -= fdecay ;
|
||||
fastleak = max(fastleak, bndpsd[bin] - fgain);
|
||||
slowleak -= sdecay ;
|
||||
slowleak = max(slowleak, bndpsd[bin] - sgain);
|
||||
excite[bin] = max(fastleak - lowcomp, slowleak);
|
||||
}
|
||||
begin = 22;
|
||||
}
|
||||
else /* For coupling channel */
|
||||
{
|
||||
begin = bndstrt;
|
||||
}
|
||||
/* Compute excitation function */
|
||||
bndstrt = masktab[start];
|
||||
bndend = masktab[end - 1] + 1;
|
||||
|
||||
for (bin = begin; bin < bndend; bin++)
|
||||
{
|
||||
fastleak -= fdecay;
|
||||
fastleak = max(fastleak, bndpsd[bin] - fgain);
|
||||
slowleak -= sdecay;
|
||||
slowleak = max(slowleak, bndpsd[bin] - sgain);
|
||||
excite[bin] = max(fastleak, slowleak) ;
|
||||
}
|
||||
if (bndstrt == 0) /* For fbw and lfe channels */
|
||||
{
|
||||
lowcomp = calc_lowcomp(lowcomp, bndpsd[0], bndpsd[1], 0);
|
||||
excite[0] = bndpsd[0] - fgain - lowcomp;
|
||||
lowcomp = calc_lowcomp(lowcomp, bndpsd[1], bndpsd[2], 1);
|
||||
excite[1] = bndpsd[1] - fgain - lowcomp;
|
||||
begin = 7 ;
|
||||
|
||||
/* Note: Do not call calc_lowcomp() for the last band of the lfe channel, (bin = 6) */
|
||||
for (bin = 2; bin < 7; bin++)
|
||||
{
|
||||
if (!(is_lfe && (bin == 6)))
|
||||
lowcomp = calc_lowcomp(lowcomp, bndpsd[bin], bndpsd[bin+1], bin);
|
||||
fastleak = bndpsd[bin] - fgain;
|
||||
slowleak = bndpsd[bin] - sgain;
|
||||
excite[bin] = fastleak - lowcomp;
|
||||
|
||||
if (!(is_lfe && (bin == 6)))
|
||||
{
|
||||
if (bndpsd[bin] <= bndpsd[bin+1])
|
||||
{
|
||||
begin = bin + 1 ;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (bin = begin; bin < min(bndend, 22); bin++)
|
||||
{
|
||||
if (!(is_lfe && (bin == 6)))
|
||||
lowcomp = calc_lowcomp(lowcomp, bndpsd[bin], bndpsd[bin+1], bin);
|
||||
fastleak -= fdecay ;
|
||||
fastleak = max(fastleak, bndpsd[bin] - fgain);
|
||||
slowleak -= sdecay ;
|
||||
slowleak = max(slowleak, bndpsd[bin] - sgain);
|
||||
excite[bin] = max(fastleak - lowcomp, slowleak);
|
||||
}
|
||||
begin = 22;
|
||||
}
|
||||
else /* For coupling channel */
|
||||
{
|
||||
begin = bndstrt;
|
||||
}
|
||||
|
||||
for (bin = begin; bin < bndend; bin++)
|
||||
{
|
||||
fastleak -= fdecay;
|
||||
fastleak = max(fastleak, bndpsd[bin] - fgain);
|
||||
slowleak -= sdecay;
|
||||
slowleak = max(slowleak, bndpsd[bin] - sgain);
|
||||
excite[bin] = max(fastleak, slowleak) ;
|
||||
}
|
||||
}
|
||||
|
||||
static void ba_compute_mask(s16 start, s16 end, u16 fscod,
|
||||
u16 deltbae, u16 deltnseg, u16 deltoffst[], u16 deltba[],
|
||||
u16 deltlen[], s16 excite[], s16 mask[])
|
||||
u16 deltbae, u16 deltnseg, u16 deltoffst[], u16 deltba[],
|
||||
u16 deltlen[], s16 excite[], s16 mask[])
|
||||
{
|
||||
int bin,k;
|
||||
s16 bndstrt;
|
||||
s16 bndend;
|
||||
s16 delta;
|
||||
int bin,k;
|
||||
s16 bndstrt;
|
||||
s16 bndend;
|
||||
s16 delta;
|
||||
|
||||
bndstrt = masktab[start];
|
||||
bndend = masktab[end - 1] + 1;
|
||||
bndstrt = masktab[start];
|
||||
bndend = masktab[end - 1] + 1;
|
||||
|
||||
/* Compute the masking curve */
|
||||
for (bin = bndstrt; bin < bndend; bin++)
|
||||
{
|
||||
if (bndpsd[bin] < dbknee)
|
||||
{
|
||||
excite[bin] += ((dbknee - bndpsd[bin]) >> 2);
|
||||
}
|
||||
mask[bin] = max(excite[bin], hth[fscod][bin]);
|
||||
}
|
||||
/* Compute the masking curve */
|
||||
for (bin = bndstrt; bin < bndend; bin++)
|
||||
{
|
||||
if (bndpsd[bin] < dbknee)
|
||||
{
|
||||
excite[bin] += ((dbknee - bndpsd[bin]) >> 2);
|
||||
}
|
||||
mask[bin] = max(excite[bin], hth[fscod][bin]);
|
||||
}
|
||||
|
||||
/* Perform delta bit modulation if necessary */
|
||||
if ((deltbae == DELTA_BIT_REUSE) || (deltbae == DELTA_BIT_NEW))
|
||||
{
|
||||
s16 band = 0;
|
||||
s16 seg = 0;
|
||||
/* Perform delta bit modulation if necessary */
|
||||
if ((deltbae == DELTA_BIT_REUSE) || (deltbae == DELTA_BIT_NEW))
|
||||
{
|
||||
s16 band = 0;
|
||||
s16 seg = 0;
|
||||
|
||||
for (seg = 0; seg < deltnseg+1; seg++)
|
||||
{
|
||||
band += deltoffst[seg];
|
||||
if (deltba[seg] >= 4)
|
||||
{
|
||||
delta = (deltba[seg] - 3) << 7;
|
||||
}
|
||||
else
|
||||
{
|
||||
delta = (deltba[seg] - 4) << 7;
|
||||
}
|
||||
for (k = 0; k < deltlen[seg]; k++)
|
||||
{
|
||||
for (seg = 0; seg < deltnseg+1; seg++)
|
||||
{
|
||||
band += deltoffst[seg];
|
||||
if (deltba[seg] >= 4)
|
||||
{
|
||||
delta = (deltba[seg] - 3) << 7;
|
||||
}
|
||||
else
|
||||
{
|
||||
delta = (deltba[seg] - 4) << 7;
|
||||
}
|
||||
for (k = 0; k < deltlen[seg]; k++)
|
||||
{
|
||||
mask[band] += delta;
|
||||
band++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void ba_compute_bap(s16 start, s16 end, s16 snroffset,
|
||||
s16 psd[], s16 mask[], s16 bap[])
|
||||
s16 psd[], s16 mask[], s16 bap[])
|
||||
{
|
||||
int i,j,k;
|
||||
s16 lastbin = 0;
|
||||
s16 address = 0;
|
||||
int i,j,k;
|
||||
s16 lastbin = 0;
|
||||
s16 address = 0;
|
||||
|
||||
/* Compute the bit allocation pointer for each bin */
|
||||
i = start;
|
||||
j = masktab[start];
|
||||
/* Compute the bit allocation pointer for each bin */
|
||||
i = start;
|
||||
j = masktab[start];
|
||||
|
||||
do
|
||||
{
|
||||
lastbin = min(bndtab[j] + bndsz[j], end);
|
||||
mask[j] -= snroffset;
|
||||
mask[j] -= floor;
|
||||
|
||||
if (mask[j] < 0)
|
||||
mask[j] = 0;
|
||||
do
|
||||
{
|
||||
lastbin = min(bndtab[j] + bndsz[j], end);
|
||||
mask[j] -= snroffset;
|
||||
mask[j] -= floor;
|
||||
|
||||
mask[j] &= 0x1fe0;
|
||||
mask[j] += floor;
|
||||
for (k = i; k < lastbin; k++)
|
||||
{
|
||||
address = (psd[i] - mask[j]) >> 5;
|
||||
address = min(63, max(0, address));
|
||||
bap[i] = baptab[address];
|
||||
i++;
|
||||
}
|
||||
j++;
|
||||
} while (end > lastbin);
|
||||
if (mask[j] < 0)
|
||||
mask[j] = 0;
|
||||
|
||||
mask[j] &= 0x1fe0;
|
||||
mask[j] += floor;
|
||||
for (k = i; k < lastbin; k++)
|
||||
{
|
||||
address = (psd[i] - mask[j]) >> 5;
|
||||
address = min(63, max(0, address));
|
||||
bap[i] = baptab[address];
|
||||
i++;
|
||||
}
|
||||
j++;
|
||||
} while (end > lastbin);
|
||||
}
|
||||
|
@ -1,35 +1,35 @@
|
||||
#include <math.h>
|
||||
#include <sys/uio.h> /* "input.h" */
|
||||
|
||||
#include "common.h"
|
||||
#include "config.h"
|
||||
#include "vlc_thread.h"
|
||||
#include "mtime.h"
|
||||
#include "input.h"
|
||||
#include "decoder_fifo.h"
|
||||
#include "audio_output.h"
|
||||
#include <math.h>
|
||||
#include <sys/uio.h> /* "input.h" */
|
||||
|
||||
#include "ac3_decoder.h"
|
||||
#include "ac3_parse.h"
|
||||
#include "ac3_exponent.h"
|
||||
#include "ac3_bit_allocate.h"
|
||||
#include "ac3_mantissa.h"
|
||||
#include "ac3_rematrix.h"
|
||||
#include "ac3_imdct.h"
|
||||
#include "ac3_downmix.h"
|
||||
#include "common.h"
|
||||
#include "config.h"
|
||||
#include "vlc_thread.h"
|
||||
#include "mtime.h"
|
||||
#include "input.h"
|
||||
#include "decoder_fifo.h"
|
||||
#include "audio_output.h"
|
||||
|
||||
#include "ac3_decoder.h"
|
||||
#include "ac3_parse.h"
|
||||
#include "ac3_exponent.h"
|
||||
#include "ac3_bit_allocate.h"
|
||||
#include "ac3_mantissa.h"
|
||||
#include "ac3_rematrix.h"
|
||||
#include "ac3_imdct.h"
|
||||
#include "ac3_downmix.h"
|
||||
|
||||
int ac3_audio_block (ac3dec_t * p_ac3dec, s16 * buffer)
|
||||
{
|
||||
parse_audblk( p_ac3dec );
|
||||
exponent_unpack( p_ac3dec );
|
||||
if ( p_ac3dec->b_invalid )
|
||||
return 1;
|
||||
return 1;
|
||||
bit_allocate( p_ac3dec );
|
||||
mantissa_unpack( p_ac3dec );
|
||||
if ( p_ac3dec->b_invalid )
|
||||
return 1;
|
||||
return 1;
|
||||
if ( p_ac3dec->bsi.acmod == 0x2 )
|
||||
rematrix( p_ac3dec );
|
||||
rematrix( p_ac3dec );
|
||||
imdct( p_ac3dec );
|
||||
downmix( p_ac3dec, buffer );
|
||||
return 0;
|
||||
|
@ -146,7 +146,7 @@ static __inline__ int decode_find_sync( ac3dec_thread_t * p_ac3dec )
|
||||
p_ac3dec->ac3_decoder.total_bits_read = 16;
|
||||
return( 0 );
|
||||
}
|
||||
DumpBits( &(p_ac3dec->ac3_decoder.bit_stream), 1 ); /* XXX */
|
||||
DumpBits( &(p_ac3dec->ac3_decoder.bit_stream), 1 ); /* XXX?? */
|
||||
}
|
||||
return( -1 );
|
||||
}
|
||||
@ -203,76 +203,76 @@ static void RunThread( ac3dec_thread_t * p_ac3dec )
|
||||
msleep( INPUT_PTS_DELAY );
|
||||
|
||||
/* Initializing the ac3 decoder thread */
|
||||
if ( InitThread(p_ac3dec) ) /* XXX */
|
||||
if ( InitThread(p_ac3dec) ) /* XXX?? */
|
||||
{
|
||||
p_ac3dec->b_error = 1;
|
||||
}
|
||||
|
||||
/* ac3 decoder thread's main loop */
|
||||
/* FIXME : do we have enough room to store the decoded frames ? */
|
||||
/* FIXME : do we have enough room to store the decoded frames ?? */
|
||||
while ( (!p_ac3dec->b_die) && (!p_ac3dec->b_error) )
|
||||
{
|
||||
int i;
|
||||
|
||||
p_ac3dec->ac3_decoder.b_invalid = 0;
|
||||
|
||||
decode_find_sync( p_ac3dec );
|
||||
decode_find_sync( p_ac3dec );
|
||||
|
||||
if ( DECODER_FIFO_START(p_ac3dec->fifo)->b_has_pts )
|
||||
{
|
||||
p_ac3dec->p_aout_fifo->date[p_ac3dec->p_aout_fifo->l_end_frame] = DECODER_FIFO_START(p_ac3dec->fifo)->i_pts;
|
||||
DECODER_FIFO_START(p_ac3dec->fifo)->b_has_pts = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
p_ac3dec->p_aout_fifo->date[p_ac3dec->p_aout_fifo->l_end_frame] = LAST_MDATE;
|
||||
}
|
||||
|
||||
parse_syncinfo( &p_ac3dec->ac3_decoder );
|
||||
switch ( p_ac3dec->ac3_decoder.syncinfo.fscod )
|
||||
{
|
||||
case 0:
|
||||
p_ac3dec->p_aout_fifo->l_rate = 48000;
|
||||
break;
|
||||
|
||||
case 1:
|
||||
p_ac3dec->p_aout_fifo->l_rate = 44100;
|
||||
break;
|
||||
|
||||
case 2:
|
||||
p_ac3dec->p_aout_fifo->l_rate = 32000;
|
||||
break;
|
||||
|
||||
default: /* XXX */
|
||||
fprintf( stderr, "ac3dec debug: invalid fscod\n" );
|
||||
p_ac3dec->ac3_decoder.b_invalid = 1;
|
||||
break;
|
||||
}
|
||||
if ( p_ac3dec->ac3_decoder.b_invalid ) /* XXX */
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
parse_bsi( &p_ac3dec->ac3_decoder );
|
||||
|
||||
for (i = 0; i < 6; i++)
|
||||
{
|
||||
s16 * buffer;
|
||||
|
||||
buffer = ((ac3dec_frame_t *)p_ac3dec->p_aout_fifo->buffer)[ p_ac3dec->p_aout_fifo->l_end_frame ];
|
||||
|
||||
if (ac3_audio_block (&p_ac3dec->ac3_decoder, buffer))
|
||||
goto bad_frame;
|
||||
|
||||
if (i)
|
||||
p_ac3dec->p_aout_fifo->date[p_ac3dec->p_aout_fifo->l_end_frame] = LAST_MDATE;
|
||||
vlc_mutex_lock( &p_ac3dec->p_aout_fifo->data_lock );
|
||||
p_ac3dec->p_aout_fifo->l_end_frame = (p_ac3dec->p_aout_fifo->l_end_frame + 1) & AOUT_FIFO_SIZE;
|
||||
vlc_cond_signal( &p_ac3dec->p_aout_fifo->data_wait );
|
||||
vlc_mutex_unlock( &p_ac3dec->p_aout_fifo->data_lock );
|
||||
if ( DECODER_FIFO_START(p_ac3dec->fifo)->b_has_pts )
|
||||
{
|
||||
p_ac3dec->p_aout_fifo->date[p_ac3dec->p_aout_fifo->l_end_frame] = DECODER_FIFO_START(p_ac3dec->fifo)->i_pts;
|
||||
DECODER_FIFO_START(p_ac3dec->fifo)->b_has_pts = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
p_ac3dec->p_aout_fifo->date[p_ac3dec->p_aout_fifo->l_end_frame] = LAST_MDATE;
|
||||
}
|
||||
|
||||
parse_auxdata( &p_ac3dec->ac3_decoder );
|
||||
parse_syncinfo( &p_ac3dec->ac3_decoder );
|
||||
switch ( p_ac3dec->ac3_decoder.syncinfo.fscod )
|
||||
{
|
||||
case 0:
|
||||
p_ac3dec->p_aout_fifo->l_rate = 48000;
|
||||
break;
|
||||
|
||||
case 1:
|
||||
p_ac3dec->p_aout_fifo->l_rate = 44100;
|
||||
break;
|
||||
|
||||
case 2:
|
||||
p_ac3dec->p_aout_fifo->l_rate = 32000;
|
||||
break;
|
||||
|
||||
default: /* XXX?? */
|
||||
fprintf( stderr, "ac3dec debug: invalid fscod\n" );
|
||||
p_ac3dec->ac3_decoder.b_invalid = 1;
|
||||
break;
|
||||
}
|
||||
if ( p_ac3dec->ac3_decoder.b_invalid ) /* XXX?? */
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
parse_bsi( &p_ac3dec->ac3_decoder );
|
||||
|
||||
for (i = 0; i < 6; i++)
|
||||
{
|
||||
s16 * buffer;
|
||||
|
||||
buffer = ((ac3dec_frame_t *)p_ac3dec->p_aout_fifo->buffer)[ p_ac3dec->p_aout_fifo->l_end_frame ];
|
||||
|
||||
if (ac3_audio_block (&p_ac3dec->ac3_decoder, buffer))
|
||||
goto bad_frame;
|
||||
|
||||
if (i)
|
||||
p_ac3dec->p_aout_fifo->date[p_ac3dec->p_aout_fifo->l_end_frame] = LAST_MDATE;
|
||||
vlc_mutex_lock( &p_ac3dec->p_aout_fifo->data_lock );
|
||||
p_ac3dec->p_aout_fifo->l_end_frame = (p_ac3dec->p_aout_fifo->l_end_frame + 1) & AOUT_FIFO_SIZE;
|
||||
vlc_cond_signal( &p_ac3dec->p_aout_fifo->data_wait );
|
||||
vlc_mutex_unlock( &p_ac3dec->p_aout_fifo->data_lock );
|
||||
}
|
||||
|
||||
parse_auxdata( &p_ac3dec->ac3_decoder );
|
||||
bad_frame:
|
||||
}
|
||||
|
||||
@ -302,7 +302,7 @@ static void ErrorThread( ac3dec_thread_t * p_ac3dec )
|
||||
while( !DECODER_FIFO_ISEMPTY(p_ac3dec->fifo) )
|
||||
{
|
||||
input_NetlistFreePES( p_ac3dec->ac3_decoder.bit_stream.p_input, DECODER_FIFO_START(p_ac3dec->fifo) );
|
||||
DECODER_FIFO_INCSTART( p_ac3dec->fifo );
|
||||
DECODER_FIFO_INCSTART( p_ac3dec->fifo );
|
||||
}
|
||||
|
||||
/* Waiting for the input thread to put new PES packets in the fifo */
|
||||
|
@ -27,14 +27,14 @@
|
||||
|
||||
typedef struct prefs_s
|
||||
{
|
||||
u16 use_dolby_surround;
|
||||
u16 dual_mono_channel_select;
|
||||
u16 use_dolby_surround;
|
||||
u16 dual_mono_channel_select;
|
||||
|
||||
} prefs_t;
|
||||
|
||||
prefs_t global_prefs = {0,0};
|
||||
|
||||
//Pre-scaled downmix coefficients
|
||||
/* Pre-scaled downmix coefficients */
|
||||
static float cmixlev_lut[4] = { 0.2928, 0.2468, 0.2071, 0.2468 };
|
||||
static float smixlev_lut[4] = { 0.2928, 0.2071, 0.0 , 0.2071 };
|
||||
|
||||
@ -44,354 +44,354 @@ static float smixlev_lut[4] = { 0.2928, 0.2071, 0.0 , 0.2071 };
|
||||
|
||||
void downmix( ac3dec_t * p_ac3dec, s16 * out_buf )
|
||||
{
|
||||
int j;
|
||||
float right_tmp;
|
||||
float left_tmp;
|
||||
float clev,slev;
|
||||
float *centre = 0, *left = 0, *right = 0, *left_sur = 0, *right_sur = 0;
|
||||
int j;
|
||||
float right_tmp;
|
||||
float left_tmp;
|
||||
float clev,slev;
|
||||
float *centre = 0, *left = 0, *right = 0, *left_sur = 0, *right_sur = 0;
|
||||
|
||||
/*
|
||||
if(p_ac3dec->bsi.acmod > 7)
|
||||
dprintf("(downmix) invalid acmod number\n");
|
||||
*/
|
||||
/*
|
||||
if(p_ac3dec->bsi.acmod > 7)
|
||||
dprintf("(downmix) invalid acmod number\n");
|
||||
*/
|
||||
|
||||
//There are two main cases, with or without Dolby Surround
|
||||
if(global_prefs.use_dolby_surround)
|
||||
{
|
||||
switch(p_ac3dec->bsi.acmod)
|
||||
{
|
||||
// 3/2
|
||||
case 7:
|
||||
left = p_ac3dec->samples.channel[0];
|
||||
centre = p_ac3dec->samples.channel[1];
|
||||
right = p_ac3dec->samples.channel[2];
|
||||
left_sur = p_ac3dec->samples.channel[3];
|
||||
right_sur = p_ac3dec->samples.channel[4];
|
||||
/* There are two main cases, with or without Dolby Surround */
|
||||
if(global_prefs.use_dolby_surround)
|
||||
{
|
||||
switch(p_ac3dec->bsi.acmod)
|
||||
{
|
||||
/* 3/2 */
|
||||
case 7:
|
||||
left = p_ac3dec->samples.channel[0];
|
||||
centre = p_ac3dec->samples.channel[1];
|
||||
right = p_ac3dec->samples.channel[2];
|
||||
left_sur = p_ac3dec->samples.channel[3];
|
||||
right_sur = p_ac3dec->samples.channel[4];
|
||||
|
||||
for ( j = 0; j < 256; j++ )
|
||||
{
|
||||
right_tmp = 0.2265f * *left_sur++ + 0.2265f * *right_sur++;
|
||||
left_tmp = -1 * right_tmp;
|
||||
right_tmp += 0.3204f * *right++ + 0.2265f * *centre;
|
||||
left_tmp += 0.3204f * *left++ + 0.2265f * *centre++;
|
||||
for ( j = 0; j < 256; j++ )
|
||||
{
|
||||
right_tmp = 0.2265f * *left_sur++ + 0.2265f * *right_sur++;
|
||||
left_tmp = -1 * right_tmp;
|
||||
right_tmp += 0.3204f * *right++ + 0.2265f * *centre;
|
||||
left_tmp += 0.3204f * *left++ + 0.2265f * *centre++;
|
||||
|
||||
*(out_buf++) = left_tmp * NORM;
|
||||
*(out_buf++) = right_tmp * NORM;
|
||||
/*
|
||||
p_ac3dec->samples.channel[1][j] = right_tmp;
|
||||
p_ac3dec->samples.channel[0][j] = left_tmp;
|
||||
*/
|
||||
}
|
||||
break;
|
||||
*(out_buf++) = left_tmp * NORM;
|
||||
*(out_buf++) = right_tmp * NORM;
|
||||
/*
|
||||
p_ac3dec->samples.channel[1][j] = right_tmp;
|
||||
p_ac3dec->samples.channel[0][j] = left_tmp;
|
||||
*/
|
||||
}
|
||||
break;
|
||||
|
||||
// 2/2
|
||||
case 6:
|
||||
left = p_ac3dec->samples.channel[0];
|
||||
right = p_ac3dec->samples.channel[1];
|
||||
left_sur = p_ac3dec->samples.channel[2];
|
||||
right_sur = p_ac3dec->samples.channel[3];
|
||||
/* 2/2 */
|
||||
case 6:
|
||||
left = p_ac3dec->samples.channel[0];
|
||||
right = p_ac3dec->samples.channel[1];
|
||||
left_sur = p_ac3dec->samples.channel[2];
|
||||
right_sur = p_ac3dec->samples.channel[3];
|
||||
|
||||
for (j = 0; j < 256; j++)
|
||||
{
|
||||
right_tmp = 0.2265f * *left_sur++ + 0.2265f * *right_sur++;
|
||||
left_tmp = -1 * right_tmp;
|
||||
right_tmp += 0.3204f * *right++;
|
||||
left_tmp += 0.3204f * *left++ ;
|
||||
for (j = 0; j < 256; j++)
|
||||
{
|
||||
right_tmp = 0.2265f * *left_sur++ + 0.2265f * *right_sur++;
|
||||
left_tmp = -1 * right_tmp;
|
||||
right_tmp += 0.3204f * *right++;
|
||||
left_tmp += 0.3204f * *left++ ;
|
||||
|
||||
*(out_buf++) = left_tmp * NORM;
|
||||
*(out_buf++) = right_tmp * NORM;
|
||||
/*
|
||||
p_ac3dec->samples.channel[1][j] = right_tmp;
|
||||
p_ac3dec->samples.channel[0][j] = left_tmp;
|
||||
*/
|
||||
}
|
||||
break;
|
||||
*(out_buf++) = left_tmp * NORM;
|
||||
*(out_buf++) = right_tmp * NORM;
|
||||
/*
|
||||
p_ac3dec->samples.channel[1][j] = right_tmp;
|
||||
p_ac3dec->samples.channel[0][j] = left_tmp;
|
||||
*/
|
||||
}
|
||||
break;
|
||||
|
||||
// 3/1
|
||||
case 5:
|
||||
left = p_ac3dec->samples.channel[0];
|
||||
centre = p_ac3dec->samples.channel[1];
|
||||
right = p_ac3dec->samples.channel[2];
|
||||
//Mono surround
|
||||
right_sur = p_ac3dec->samples.channel[3];
|
||||
/* 3/1 */
|
||||
case 5:
|
||||
left = p_ac3dec->samples.channel[0];
|
||||
centre = p_ac3dec->samples.channel[1];
|
||||
right = p_ac3dec->samples.channel[2];
|
||||
/* Mono surround */
|
||||
right_sur = p_ac3dec->samples.channel[3];
|
||||
|
||||
for (j = 0; j < 256; j++)
|
||||
{
|
||||
right_tmp = 0.2265f * *right_sur++;
|
||||
left_tmp = - right_tmp;
|
||||
right_tmp += 0.3204f * *right++ + 0.2265f * *centre;
|
||||
left_tmp += 0.3204f * *left++ + 0.2265f * *centre++;
|
||||
for (j = 0; j < 256; j++)
|
||||
{
|
||||
right_tmp = 0.2265f * *right_sur++;
|
||||
left_tmp = - right_tmp;
|
||||
right_tmp += 0.3204f * *right++ + 0.2265f * *centre;
|
||||
left_tmp += 0.3204f * *left++ + 0.2265f * *centre++;
|
||||
|
||||
*(out_buf++) = left_tmp * NORM;
|
||||
*(out_buf++) = right_tmp * NORM;
|
||||
/*
|
||||
p_ac3dec->samples.channel[1][j] = right_tmp;
|
||||
p_ac3dec->samples.channel[0][j] = left_tmp;
|
||||
*/
|
||||
}
|
||||
break;
|
||||
*(out_buf++) = left_tmp * NORM;
|
||||
*(out_buf++) = right_tmp * NORM;
|
||||
/*
|
||||
p_ac3dec->samples.channel[1][j] = right_tmp;
|
||||
p_ac3dec->samples.channel[0][j] = left_tmp;
|
||||
*/
|
||||
}
|
||||
break;
|
||||
|
||||
// 2/1
|
||||
case 4:
|
||||
left = p_ac3dec->samples.channel[0];
|
||||
right = p_ac3dec->samples.channel[1];
|
||||
//Mono surround
|
||||
right_sur = p_ac3dec->samples.channel[2];
|
||||
/* 2/1 */
|
||||
case 4:
|
||||
left = p_ac3dec->samples.channel[0];
|
||||
right = p_ac3dec->samples.channel[1];
|
||||
/* Mono surround */
|
||||
right_sur = p_ac3dec->samples.channel[2];
|
||||
|
||||
for (j = 0; j < 256; j++)
|
||||
{
|
||||
right_tmp = 0.2265f * *right_sur++;
|
||||
left_tmp = - right_tmp;
|
||||
right_tmp += 0.3204f * *right++;
|
||||
left_tmp += 0.3204f * *left++;
|
||||
for (j = 0; j < 256; j++)
|
||||
{
|
||||
right_tmp = 0.2265f * *right_sur++;
|
||||
left_tmp = - right_tmp;
|
||||
right_tmp += 0.3204f * *right++;
|
||||
left_tmp += 0.3204f * *left++;
|
||||
|
||||
*(out_buf++) = left_tmp * NORM;
|
||||
*(out_buf++) = right_tmp * NORM;
|
||||
/*
|
||||
p_ac3dec->samples.channel[1][j] = right_tmp;
|
||||
p_ac3dec->samples.channel[0][j] = left_tmp;
|
||||
*/
|
||||
}
|
||||
break;
|
||||
*(out_buf++) = left_tmp * NORM;
|
||||
*(out_buf++) = right_tmp * NORM;
|
||||
/*
|
||||
p_ac3dec->samples.channel[1][j] = right_tmp;
|
||||
p_ac3dec->samples.channel[0][j] = left_tmp;
|
||||
*/
|
||||
}
|
||||
break;
|
||||
|
||||
// 3/0
|
||||
case 3:
|
||||
left = p_ac3dec->samples.channel[0];
|
||||
centre = p_ac3dec->samples.channel[1];
|
||||
right = p_ac3dec->samples.channel[2];
|
||||
/* 3/0 */
|
||||
case 3:
|
||||
left = p_ac3dec->samples.channel[0];
|
||||
centre = p_ac3dec->samples.channel[1];
|
||||
right = p_ac3dec->samples.channel[2];
|
||||
|
||||
for (j = 0; j < 256; j++)
|
||||
{
|
||||
right_tmp = 0.3204f * *right++ + 0.2265f * *centre;
|
||||
left_tmp = 0.3204f * *left++ + 0.2265f * *centre++;
|
||||
for (j = 0; j < 256; j++)
|
||||
{
|
||||
right_tmp = 0.3204f * *right++ + 0.2265f * *centre;
|
||||
left_tmp = 0.3204f * *left++ + 0.2265f * *centre++;
|
||||
|
||||
*(out_buf++) = left_tmp * NORM;
|
||||
*(out_buf++) = right_tmp * NORM;
|
||||
/*
|
||||
p_ac3dec->samples.channel[1][j] = right_tmp;
|
||||
p_ac3dec->samples.channel[0][j] = left_tmp;
|
||||
*/
|
||||
}
|
||||
break;
|
||||
*(out_buf++) = left_tmp * NORM;
|
||||
*(out_buf++) = right_tmp * NORM;
|
||||
/*
|
||||
p_ac3dec->samples.channel[1][j] = right_tmp;
|
||||
p_ac3dec->samples.channel[0][j] = left_tmp;
|
||||
*/
|
||||
}
|
||||
break;
|
||||
|
||||
// 2/0
|
||||
case 2:
|
||||
left = p_ac3dec->samples.channel[0];
|
||||
right = p_ac3dec->samples.channel[1];
|
||||
/* 2/0 */
|
||||
case 2:
|
||||
left = p_ac3dec->samples.channel[0];
|
||||
right = p_ac3dec->samples.channel[1];
|
||||
|
||||
for ( j = 0; j < 256; j++ )
|
||||
{
|
||||
*(out_buf++) = *(left++) * NORM;
|
||||
*(out_buf++) = *(right++) * NORM;
|
||||
}
|
||||
break;
|
||||
for ( j = 0; j < 256; j++ )
|
||||
{
|
||||
*(out_buf++) = *(left++) * NORM;
|
||||
*(out_buf++) = *(right++) * NORM;
|
||||
}
|
||||
break;
|
||||
|
||||
// 1/0
|
||||
case 1:
|
||||
//Mono program!
|
||||
right = p_ac3dec->samples.channel[0];
|
||||
/* 1/0 */
|
||||
case 1:
|
||||
/* Mono program! */
|
||||
right = p_ac3dec->samples.channel[0];
|
||||
|
||||
for (j = 0; j < 256; j++)
|
||||
{
|
||||
right_tmp = 0.7071f * *right++;
|
||||
for (j = 0; j < 256; j++)
|
||||
{
|
||||
right_tmp = 0.7071f * *right++;
|
||||
|
||||
*(out_buf++) = right_tmp * NORM;
|
||||
*(out_buf++) = right_tmp * NORM;
|
||||
/*
|
||||
p_ac3dec->samples.channel[1][j] = right_tmp;
|
||||
p_ac3dec->samples.channel[0][j] = right_tmp;
|
||||
*/
|
||||
}
|
||||
break;
|
||||
*(out_buf++) = right_tmp * NORM;
|
||||
*(out_buf++) = right_tmp * NORM;
|
||||
/*
|
||||
p_ac3dec->samples.channel[1][j] = right_tmp;
|
||||
p_ac3dec->samples.channel[0][j] = right_tmp;
|
||||
*/
|
||||
}
|
||||
break;
|
||||
|
||||
// 1+1
|
||||
case 0:
|
||||
//Dual mono, output selected by user
|
||||
right = p_ac3dec->samples.channel[global_prefs.dual_mono_channel_select];
|
||||
/* 1+1 */
|
||||
case 0:
|
||||
/* Dual mono, output selected by user */
|
||||
right = p_ac3dec->samples.channel[global_prefs.dual_mono_channel_select];
|
||||
|
||||
for (j = 0; j < 256; j++)
|
||||
{
|
||||
right_tmp = 0.7071f * *right++;
|
||||
for (j = 0; j < 256; j++)
|
||||
{
|
||||
right_tmp = 0.7071f * *right++;
|
||||
|
||||
*(out_buf++) = right_tmp * NORM;
|
||||
*(out_buf++) = right_tmp * NORM;
|
||||
/*
|
||||
p_ac3dec->samples.channel[1][j] = right_tmp;
|
||||
p_ac3dec->samples.channel[0][j] = right_tmp;
|
||||
*/
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//Non-Dolby surround downmixes
|
||||
switch(p_ac3dec->bsi.acmod)
|
||||
{
|
||||
// 3/2
|
||||
case 7:
|
||||
left = p_ac3dec->samples.channel[0];
|
||||
centre = p_ac3dec->samples.channel[1];
|
||||
right = p_ac3dec->samples.channel[2];
|
||||
left_sur = p_ac3dec->samples.channel[3];
|
||||
right_sur = p_ac3dec->samples.channel[4];
|
||||
*(out_buf++) = right_tmp * NORM;
|
||||
*(out_buf++) = right_tmp * NORM;
|
||||
/*
|
||||
p_ac3dec->samples.channel[1][j] = right_tmp;
|
||||
p_ac3dec->samples.channel[0][j] = right_tmp;
|
||||
*/
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Non-Dolby surround downmixes */
|
||||
switch(p_ac3dec->bsi.acmod)
|
||||
{
|
||||
/* 3/2 */
|
||||
case 7:
|
||||
left = p_ac3dec->samples.channel[0];
|
||||
centre = p_ac3dec->samples.channel[1];
|
||||
right = p_ac3dec->samples.channel[2];
|
||||
left_sur = p_ac3dec->samples.channel[3];
|
||||
right_sur = p_ac3dec->samples.channel[4];
|
||||
|
||||
clev = cmixlev_lut[p_ac3dec->bsi.cmixlev];
|
||||
slev = smixlev_lut[p_ac3dec->bsi.surmixlev];
|
||||
clev = cmixlev_lut[p_ac3dec->bsi.cmixlev];
|
||||
slev = smixlev_lut[p_ac3dec->bsi.surmixlev];
|
||||
|
||||
for (j = 0; j < 256; j++)
|
||||
{
|
||||
right_tmp= 0.4142f * *right++ + clev * *centre + slev * *right_sur++;
|
||||
left_tmp = 0.4142f * *left++ + clev * *centre++ + slev * *left_sur++;
|
||||
for (j = 0; j < 256; j++)
|
||||
{
|
||||
right_tmp= 0.4142f * *right++ + clev * *centre + slev * *right_sur++;
|
||||
left_tmp = 0.4142f * *left++ + clev * *centre++ + slev * *left_sur++;
|
||||
|
||||
*(out_buf++) = left_tmp * NORM;
|
||||
*(out_buf++) = right_tmp * NORM;
|
||||
/*
|
||||
p_ac3dec->samples.channel[1][j] = right_tmp;
|
||||
p_ac3dec->samples.channel[0][j] = left_tmp;
|
||||
*/
|
||||
}
|
||||
break;
|
||||
*(out_buf++) = left_tmp * NORM;
|
||||
*(out_buf++) = right_tmp * NORM;
|
||||
/*
|
||||
p_ac3dec->samples.channel[1][j] = right_tmp;
|
||||
p_ac3dec->samples.channel[0][j] = left_tmp;
|
||||
*/
|
||||
}
|
||||
break;
|
||||
|
||||
// 2/2
|
||||
case 6:
|
||||
left = p_ac3dec->samples.channel[0];
|
||||
right = p_ac3dec->samples.channel[1];
|
||||
left_sur = p_ac3dec->samples.channel[2];
|
||||
right_sur = p_ac3dec->samples.channel[3];
|
||||
/* 2/2 */
|
||||
case 6:
|
||||
left = p_ac3dec->samples.channel[0];
|
||||
right = p_ac3dec->samples.channel[1];
|
||||
left_sur = p_ac3dec->samples.channel[2];
|
||||
right_sur = p_ac3dec->samples.channel[3];
|
||||
|
||||
slev = smixlev_lut[p_ac3dec->bsi.surmixlev];
|
||||
slev = smixlev_lut[p_ac3dec->bsi.surmixlev];
|
||||
|
||||
for (j = 0; j < 256; j++)
|
||||
{
|
||||
right_tmp= 0.4142f * *right++ + slev * *right_sur++;
|
||||
left_tmp = 0.4142f * *left++ + slev * *left_sur++;
|
||||
for (j = 0; j < 256; j++)
|
||||
{
|
||||
right_tmp= 0.4142f * *right++ + slev * *right_sur++;
|
||||
left_tmp = 0.4142f * *left++ + slev * *left_sur++;
|
||||
|
||||
*(out_buf++) = left_tmp * NORM;
|
||||
*(out_buf++) = right_tmp * NORM;
|
||||
/*
|
||||
p_ac3dec->samples.channel[1][j] = right_tmp;
|
||||
p_ac3dec->samples.channel[0][j] = left_tmp;
|
||||
*/
|
||||
}
|
||||
break;
|
||||
*(out_buf++) = left_tmp * NORM;
|
||||
*(out_buf++) = right_tmp * NORM;
|
||||
/*
|
||||
p_ac3dec->samples.channel[1][j] = right_tmp;
|
||||
p_ac3dec->samples.channel[0][j] = left_tmp;
|
||||
*/
|
||||
}
|
||||
break;
|
||||
|
||||
// 3/1
|
||||
case 5:
|
||||
left = p_ac3dec->samples.channel[0];
|
||||
centre = p_ac3dec->samples.channel[1];
|
||||
right = p_ac3dec->samples.channel[2];
|
||||
//Mono surround
|
||||
right_sur = p_ac3dec->samples.channel[3];
|
||||
/* 3/1 */
|
||||
case 5:
|
||||
left = p_ac3dec->samples.channel[0];
|
||||
centre = p_ac3dec->samples.channel[1];
|
||||
right = p_ac3dec->samples.channel[2];
|
||||
/* Mono surround */
|
||||
right_sur = p_ac3dec->samples.channel[3];
|
||||
|
||||
clev = cmixlev_lut[p_ac3dec->bsi.cmixlev];
|
||||
slev = smixlev_lut[p_ac3dec->bsi.surmixlev];
|
||||
clev = cmixlev_lut[p_ac3dec->bsi.cmixlev];
|
||||
slev = smixlev_lut[p_ac3dec->bsi.surmixlev];
|
||||
|
||||
for (j = 0; j < 256; j++)
|
||||
{
|
||||
right_tmp= 0.4142f * *right++ + clev * *centre + slev * *right_sur;
|
||||
left_tmp = 0.4142f * *left++ + clev * *centre++ + slev * *right_sur++;
|
||||
for (j = 0; j < 256; j++)
|
||||
{
|
||||
right_tmp= 0.4142f * *right++ + clev * *centre + slev * *right_sur;
|
||||
left_tmp = 0.4142f * *left++ + clev * *centre++ + slev * *right_sur++;
|
||||
|
||||
*(out_buf++) = left_tmp * NORM;
|
||||
*(out_buf++) = right_tmp * NORM;
|
||||
/*
|
||||
p_ac3dec->samples.channel[1][j] = right_tmp;
|
||||
p_ac3dec->samples.channel[0][j] = left_tmp;
|
||||
*/
|
||||
}
|
||||
break;
|
||||
*(out_buf++) = left_tmp * NORM;
|
||||
*(out_buf++) = right_tmp * NORM;
|
||||
/*
|
||||
p_ac3dec->samples.channel[1][j] = right_tmp;
|
||||
p_ac3dec->samples.channel[0][j] = left_tmp;
|
||||
*/
|
||||
}
|
||||
break;
|
||||
|
||||
// 2/1
|
||||
case 4:
|
||||
left = p_ac3dec->samples.channel[0];
|
||||
right = p_ac3dec->samples.channel[1];
|
||||
//Mono surround
|
||||
right_sur = p_ac3dec->samples.channel[2];
|
||||
/* 2/1 */
|
||||
case 4:
|
||||
left = p_ac3dec->samples.channel[0];
|
||||
right = p_ac3dec->samples.channel[1];
|
||||
/* Mono surround */
|
||||
right_sur = p_ac3dec->samples.channel[2];
|
||||
|
||||
slev = smixlev_lut[p_ac3dec->bsi.surmixlev];
|
||||
slev = smixlev_lut[p_ac3dec->bsi.surmixlev];
|
||||
|
||||
for (j = 0; j < 256; j++)
|
||||
{
|
||||
right_tmp= 0.4142f * *right++ + slev * *right_sur;
|
||||
left_tmp = 0.4142f * *left++ + slev * *right_sur++;
|
||||
for (j = 0; j < 256; j++)
|
||||
{
|
||||
right_tmp= 0.4142f * *right++ + slev * *right_sur;
|
||||
left_tmp = 0.4142f * *left++ + slev * *right_sur++;
|
||||
|
||||
*(out_buf++) = left_tmp * NORM;
|
||||
*(out_buf++) = right_tmp * NORM;
|
||||
/*
|
||||
p_ac3dec->samples.channel[1][j] = right_tmp;
|
||||
p_ac3dec->samples.channel[0][j] = left_tmp;
|
||||
*/
|
||||
}
|
||||
break;
|
||||
*(out_buf++) = left_tmp * NORM;
|
||||
*(out_buf++) = right_tmp * NORM;
|
||||
/*
|
||||
p_ac3dec->samples.channel[1][j] = right_tmp;
|
||||
p_ac3dec->samples.channel[0][j] = left_tmp;
|
||||
*/
|
||||
}
|
||||
break;
|
||||
|
||||
// 3/0
|
||||
case 3:
|
||||
left = p_ac3dec->samples.channel[0];
|
||||
centre = p_ac3dec->samples.channel[1];
|
||||
right = p_ac3dec->samples.channel[2];
|
||||
/* 3/0 */
|
||||
case 3:
|
||||
left = p_ac3dec->samples.channel[0];
|
||||
centre = p_ac3dec->samples.channel[1];
|
||||
right = p_ac3dec->samples.channel[2];
|
||||
|
||||
clev = cmixlev_lut[p_ac3dec->bsi.cmixlev];
|
||||
clev = cmixlev_lut[p_ac3dec->bsi.cmixlev];
|
||||
|
||||
for (j = 0; j < 256; j++)
|
||||
{
|
||||
right_tmp= 0.4142f * *right++ + clev * *centre;
|
||||
left_tmp = 0.4142f * *left++ + clev * *centre++;
|
||||
for (j = 0; j < 256; j++)
|
||||
{
|
||||
right_tmp= 0.4142f * *right++ + clev * *centre;
|
||||
left_tmp = 0.4142f * *left++ + clev * *centre++;
|
||||
|
||||
*(out_buf++) = left_tmp * NORM;
|
||||
*(out_buf++) = right_tmp * NORM;
|
||||
/*
|
||||
p_ac3dec->samples.channel[1][j] = right_tmp;
|
||||
p_ac3dec->samples.channel[0][j] = left_tmp;
|
||||
*/
|
||||
}
|
||||
break;
|
||||
*(out_buf++) = left_tmp * NORM;
|
||||
*(out_buf++) = right_tmp * NORM;
|
||||
/*
|
||||
p_ac3dec->samples.channel[1][j] = right_tmp;
|
||||
p_ac3dec->samples.channel[0][j] = left_tmp;
|
||||
*/
|
||||
}
|
||||
break;
|
||||
|
||||
case 2:
|
||||
left = p_ac3dec->samples.channel[0];
|
||||
right = p_ac3dec->samples.channel[1];
|
||||
case 2:
|
||||
left = p_ac3dec->samples.channel[0];
|
||||
right = p_ac3dec->samples.channel[1];
|
||||
|
||||
for ( j = 0; j < 256; j++ )
|
||||
{
|
||||
*(out_buf++) = *(left++) * NORM;
|
||||
*(out_buf++) = *(right++) * NORM;
|
||||
}
|
||||
break;
|
||||
for ( j = 0; j < 256; j++ )
|
||||
{
|
||||
*(out_buf++) = *(left++) * NORM;
|
||||
*(out_buf++) = *(right++) * NORM;
|
||||
}
|
||||
break;
|
||||
|
||||
// 1/0
|
||||
case 1:
|
||||
//Mono program!
|
||||
right = p_ac3dec->samples.channel[0];
|
||||
/* 1/0 */
|
||||
case 1:
|
||||
/* Mono program! */
|
||||
right = p_ac3dec->samples.channel[0];
|
||||
|
||||
for (j = 0; j < 256; j++)
|
||||
{
|
||||
right_tmp = 0.7071f * *right++;
|
||||
for (j = 0; j < 256; j++)
|
||||
{
|
||||
right_tmp = 0.7071f * *right++;
|
||||
|
||||
*(out_buf++) = right_tmp * NORM;
|
||||
*(out_buf++) = right_tmp * NORM;
|
||||
/*
|
||||
p_ac3dec->samples.channel[1][j] = right_tmp;
|
||||
p_ac3dec->samples.channel[0][j] = right_tmp;
|
||||
*/
|
||||
}
|
||||
break;
|
||||
*(out_buf++) = right_tmp * NORM;
|
||||
*(out_buf++) = right_tmp * NORM;
|
||||
/*
|
||||
p_ac3dec->samples.channel[1][j] = right_tmp;
|
||||
p_ac3dec->samples.channel[0][j] = right_tmp;
|
||||
*/
|
||||
}
|
||||
break;
|
||||
|
||||
// 1+1
|
||||
case 0:
|
||||
//Dual mono, output selected by user
|
||||
right = p_ac3dec->samples.channel[global_prefs.dual_mono_channel_select];
|
||||
/* 1+1 */
|
||||
case 0:
|
||||
/* Dual mono, output selected by user */
|
||||
right = p_ac3dec->samples.channel[global_prefs.dual_mono_channel_select];
|
||||
|
||||
for (j = 0; j < 256; j++)
|
||||
{
|
||||
right_tmp = 0.7071f * *right++;
|
||||
for (j = 0; j < 256; j++)
|
||||
{
|
||||
right_tmp = 0.7071f * *right++;
|
||||
|
||||
*(out_buf++) = right_tmp * NORM;
|
||||
*(out_buf++) = right_tmp * NORM;
|
||||
/*
|
||||
p_ac3dec->samples.channel[1][j] = right_tmp;
|
||||
p_ac3dec->samples.channel[0][j] = right_tmp;
|
||||
*/
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
*(out_buf++) = right_tmp * NORM;
|
||||
*(out_buf++) = right_tmp * NORM;
|
||||
/*
|
||||
p_ac3dec->samples.channel[1][j] = right_tmp;
|
||||
p_ac3dec->samples.channel[0][j] = right_tmp;
|
||||
*/
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -31,109 +31,109 @@ static const s16 exps_3[128] = { -2, -1, 0, 1, 2, -2, -1, 0, 1, 2, -2, -1, 0, 1,
|
||||
|
||||
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;
|
||||
u16 i,j;
|
||||
s16 exp_acc;
|
||||
|
||||
if ( expstr == EXP_REUSE )
|
||||
{
|
||||
return;
|
||||
}
|
||||
if ( expstr == EXP_REUSE )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
/* Handle the initial absolute exponent */
|
||||
exp_acc = initial_exp;
|
||||
j = 0;
|
||||
/* Handle the initial absolute exponent */
|
||||
exp_acc = initial_exp;
|
||||
j = 0;
|
||||
|
||||
/* In the case of a fbw channel then the initial absolute values is
|
||||
* also an exponent */
|
||||
if ( type != UNPACK_CPL )
|
||||
{
|
||||
dest[j++] = exp_acc;
|
||||
}
|
||||
/* In the case of a fbw channel then the initial absolute values is
|
||||
* also an exponent */
|
||||
if ( type != UNPACK_CPL )
|
||||
{
|
||||
dest[j++] = exp_acc;
|
||||
}
|
||||
|
||||
/* Loop through the groups and fill the dest array appropriately */
|
||||
switch ( expstr )
|
||||
{
|
||||
case EXP_D45:
|
||||
for ( i = 0; i < ngrps; i++ )
|
||||
{
|
||||
if ( exps[i] > 124 )
|
||||
{
|
||||
fprintf( stderr, "ac3dec debug: invalid exponent\n" );
|
||||
p_ac3dec->b_invalid = 1;
|
||||
}
|
||||
exp_acc += (exps_1[exps[i]] /*- 2*/);
|
||||
dest[j++] = exp_acc;
|
||||
dest[j++] = exp_acc;
|
||||
dest[j++] = exp_acc;
|
||||
dest[j++] = exp_acc;
|
||||
exp_acc += (exps_2[exps[i]] /*- 2*/);
|
||||
dest[j++] = exp_acc;
|
||||
dest[j++] = exp_acc;
|
||||
dest[j++] = exp_acc;
|
||||
dest[j++] = exp_acc;
|
||||
exp_acc += (exps_3[exps[i]] /*- 2*/);
|
||||
dest[j++] = exp_acc;
|
||||
dest[j++] = exp_acc;
|
||||
dest[j++] = exp_acc;
|
||||
dest[j++] = exp_acc;
|
||||
}
|
||||
break;
|
||||
/* Loop through the groups and fill the dest array appropriately */
|
||||
switch ( expstr )
|
||||
{
|
||||
case EXP_D45:
|
||||
for ( i = 0; i < ngrps; i++ )
|
||||
{
|
||||
if ( exps[i] > 124 )
|
||||
{
|
||||
fprintf( stderr, "ac3dec debug: invalid exponent\n" );
|
||||
p_ac3dec->b_invalid = 1;
|
||||
}
|
||||
exp_acc += (exps_1[exps[i]] /*- 2*/);
|
||||
dest[j++] = exp_acc;
|
||||
dest[j++] = exp_acc;
|
||||
dest[j++] = exp_acc;
|
||||
dest[j++] = exp_acc;
|
||||
exp_acc += (exps_2[exps[i]] /*- 2*/);
|
||||
dest[j++] = exp_acc;
|
||||
dest[j++] = exp_acc;
|
||||
dest[j++] = exp_acc;
|
||||
dest[j++] = exp_acc;
|
||||
exp_acc += (exps_3[exps[i]] /*- 2*/);
|
||||
dest[j++] = exp_acc;
|
||||
dest[j++] = exp_acc;
|
||||
dest[j++] = exp_acc;
|
||||
dest[j++] = exp_acc;
|
||||
}
|
||||
break;
|
||||
|
||||
case EXP_D25:
|
||||
for ( i = 0; i < ngrps; i++ )
|
||||
{
|
||||
if ( exps[i] > 124 )
|
||||
{
|
||||
fprintf( stderr, "ac3dec debug: invalid exponent\n" );
|
||||
p_ac3dec->b_invalid = 1;
|
||||
}
|
||||
exp_acc += (exps_1[exps[i]] /*- 2*/);
|
||||
dest[j++] = exp_acc;
|
||||
dest[j++] = exp_acc;
|
||||
exp_acc += (exps_2[exps[i]] /*- 2*/);
|
||||
dest[j++] = exp_acc;
|
||||
dest[j++] = exp_acc;
|
||||
exp_acc += (exps_3[exps[i]] /*- 2*/);
|
||||
dest[j++] = exp_acc;
|
||||
dest[j++] = exp_acc;
|
||||
}
|
||||
break;
|
||||
case EXP_D25:
|
||||
for ( i = 0; i < ngrps; i++ )
|
||||
{
|
||||
if ( exps[i] > 124 )
|
||||
{
|
||||
fprintf( stderr, "ac3dec debug: invalid exponent\n" );
|
||||
p_ac3dec->b_invalid = 1;
|
||||
}
|
||||
exp_acc += (exps_1[exps[i]] /*- 2*/);
|
||||
dest[j++] = exp_acc;
|
||||
dest[j++] = exp_acc;
|
||||
exp_acc += (exps_2[exps[i]] /*- 2*/);
|
||||
dest[j++] = exp_acc;
|
||||
dest[j++] = exp_acc;
|
||||
exp_acc += (exps_3[exps[i]] /*- 2*/);
|
||||
dest[j++] = exp_acc;
|
||||
dest[j++] = exp_acc;
|
||||
}
|
||||
break;
|
||||
|
||||
case EXP_D15:
|
||||
for ( i = 0; i < ngrps; i++ )
|
||||
{
|
||||
if ( exps[i] > 124 )
|
||||
{
|
||||
fprintf( stderr, "ac3dec debug: invalid exponent\n" );
|
||||
p_ac3dec->b_invalid = 1;
|
||||
}
|
||||
exp_acc += (exps_1[exps[i]] /*- 2*/);
|
||||
dest[j++] = exp_acc;
|
||||
exp_acc += (exps_2[exps[i]] /*- 2*/);
|
||||
dest[j++] = exp_acc;
|
||||
exp_acc += (exps_3[exps[i]] /*- 2*/);
|
||||
dest[j++] = exp_acc;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case EXP_D15:
|
||||
for ( i = 0; i < ngrps; i++ )
|
||||
{
|
||||
if ( exps[i] > 124 )
|
||||
{
|
||||
fprintf( stderr, "ac3dec debug: invalid exponent\n" );
|
||||
p_ac3dec->b_invalid = 1;
|
||||
}
|
||||
exp_acc += (exps_1[exps[i]] /*- 2*/);
|
||||
dest[j++] = exp_acc;
|
||||
exp_acc += (exps_2[exps[i]] /*- 2*/);
|
||||
dest[j++] = exp_acc;
|
||||
exp_acc += (exps_3[exps[i]] /*- 2*/);
|
||||
dest[j++] = exp_acc;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void exponent_unpack( ac3dec_t * p_ac3dec )
|
||||
{
|
||||
u16 i;
|
||||
u16 i;
|
||||
|
||||
for ( i = 0; i < p_ac3dec->bsi.nfchans; i++ )
|
||||
{
|
||||
exp_unpack_ch( p_ac3dec, UNPACK_FBW, p_ac3dec->audblk.chexpstr[i], p_ac3dec->audblk.nchgrps[i], p_ac3dec->audblk.exps[i][0], &p_ac3dec->audblk.exps[i][1], p_ac3dec->audblk.fbw_exp[i] );
|
||||
}
|
||||
for ( i = 0; i < p_ac3dec->bsi.nfchans; i++ )
|
||||
{
|
||||
exp_unpack_ch( p_ac3dec, UNPACK_FBW, p_ac3dec->audblk.chexpstr[i], p_ac3dec->audblk.nchgrps[i], p_ac3dec->audblk.exps[i][0], &p_ac3dec->audblk.exps[i][1], p_ac3dec->audblk.fbw_exp[i] );
|
||||
}
|
||||
|
||||
if ( p_ac3dec->audblk.cplinu )
|
||||
{
|
||||
exp_unpack_ch( p_ac3dec, UNPACK_CPL, p_ac3dec->audblk.cplexpstr, p_ac3dec->audblk.ncplgrps, p_ac3dec->audblk.cplabsexp << 1, p_ac3dec->audblk.cplexps, &p_ac3dec->audblk.cpl_exp[p_ac3dec->audblk.cplstrtmant] );
|
||||
}
|
||||
if ( p_ac3dec->audblk.cplinu )
|
||||
{
|
||||
exp_unpack_ch( p_ac3dec, UNPACK_CPL, p_ac3dec->audblk.cplexpstr, p_ac3dec->audblk.ncplgrps, p_ac3dec->audblk.cplabsexp << 1, p_ac3dec->audblk.cplexps, &p_ac3dec->audblk.cpl_exp[p_ac3dec->audblk.cplstrtmant] );
|
||||
}
|
||||
|
||||
if ( p_ac3dec->bsi.lfeon )
|
||||
{
|
||||
exp_unpack_ch( p_ac3dec, UNPACK_LFE, p_ac3dec->audblk.lfeexpstr, 2, p_ac3dec->audblk.lfeexps[0], &p_ac3dec->audblk.lfeexps[1], p_ac3dec->audblk.lfe_exp );
|
||||
}
|
||||
if ( p_ac3dec->bsi.lfeon )
|
||||
{
|
||||
exp_unpack_ch( p_ac3dec, UNPACK_LFE, p_ac3dec->audblk.lfeexpstr, 2, p_ac3dec->audblk.lfeexps[0], &p_ac3dec->audblk.lfeexps[1], p_ac3dec->audblk.lfe_exp );
|
||||
}
|
||||
}
|
||||
|
@ -16,8 +16,8 @@ void imdct_do_512(float x[],float y[],float delay[]);
|
||||
|
||||
typedef struct complex_s
|
||||
{
|
||||
float real;
|
||||
float imag;
|
||||
float real;
|
||||
float imag;
|
||||
} complex_t;
|
||||
|
||||
#define N 512
|
||||
@ -26,32 +26,32 @@ static complex_t buf[N/4];
|
||||
|
||||
/* 128 point bit-reverse LUT */
|
||||
static u8 bit_reverse_512[] = {
|
||||
0x00, 0x40, 0x20, 0x60, 0x10, 0x50, 0x30, 0x70,
|
||||
0x08, 0x48, 0x28, 0x68, 0x18, 0x58, 0x38, 0x78,
|
||||
0x04, 0x44, 0x24, 0x64, 0x14, 0x54, 0x34, 0x74,
|
||||
0x0c, 0x4c, 0x2c, 0x6c, 0x1c, 0x5c, 0x3c, 0x7c,
|
||||
0x02, 0x42, 0x22, 0x62, 0x12, 0x52, 0x32, 0x72,
|
||||
0x0a, 0x4a, 0x2a, 0x6a, 0x1a, 0x5a, 0x3a, 0x7a,
|
||||
0x06, 0x46, 0x26, 0x66, 0x16, 0x56, 0x36, 0x76,
|
||||
0x0e, 0x4e, 0x2e, 0x6e, 0x1e, 0x5e, 0x3e, 0x7e,
|
||||
0x01, 0x41, 0x21, 0x61, 0x11, 0x51, 0x31, 0x71,
|
||||
0x09, 0x49, 0x29, 0x69, 0x19, 0x59, 0x39, 0x79,
|
||||
0x05, 0x45, 0x25, 0x65, 0x15, 0x55, 0x35, 0x75,
|
||||
0x0d, 0x4d, 0x2d, 0x6d, 0x1d, 0x5d, 0x3d, 0x7d,
|
||||
0x03, 0x43, 0x23, 0x63, 0x13, 0x53, 0x33, 0x73,
|
||||
0x0b, 0x4b, 0x2b, 0x6b, 0x1b, 0x5b, 0x3b, 0x7b,
|
||||
0x07, 0x47, 0x27, 0x67, 0x17, 0x57, 0x37, 0x77,
|
||||
0x0f, 0x4f, 0x2f, 0x6f, 0x1f, 0x5f, 0x3f, 0x7f};
|
||||
0x00, 0x40, 0x20, 0x60, 0x10, 0x50, 0x30, 0x70,
|
||||
0x08, 0x48, 0x28, 0x68, 0x18, 0x58, 0x38, 0x78,
|
||||
0x04, 0x44, 0x24, 0x64, 0x14, 0x54, 0x34, 0x74,
|
||||
0x0c, 0x4c, 0x2c, 0x6c, 0x1c, 0x5c, 0x3c, 0x7c,
|
||||
0x02, 0x42, 0x22, 0x62, 0x12, 0x52, 0x32, 0x72,
|
||||
0x0a, 0x4a, 0x2a, 0x6a, 0x1a, 0x5a, 0x3a, 0x7a,
|
||||
0x06, 0x46, 0x26, 0x66, 0x16, 0x56, 0x36, 0x76,
|
||||
0x0e, 0x4e, 0x2e, 0x6e, 0x1e, 0x5e, 0x3e, 0x7e,
|
||||
0x01, 0x41, 0x21, 0x61, 0x11, 0x51, 0x31, 0x71,
|
||||
0x09, 0x49, 0x29, 0x69, 0x19, 0x59, 0x39, 0x79,
|
||||
0x05, 0x45, 0x25, 0x65, 0x15, 0x55, 0x35, 0x75,
|
||||
0x0d, 0x4d, 0x2d, 0x6d, 0x1d, 0x5d, 0x3d, 0x7d,
|
||||
0x03, 0x43, 0x23, 0x63, 0x13, 0x53, 0x33, 0x73,
|
||||
0x0b, 0x4b, 0x2b, 0x6b, 0x1b, 0x5b, 0x3b, 0x7b,
|
||||
0x07, 0x47, 0x27, 0x67, 0x17, 0x57, 0x37, 0x77,
|
||||
0x0f, 0x4f, 0x2f, 0x6f, 0x1f, 0x5f, 0x3f, 0x7f};
|
||||
|
||||
static u8 bit_reverse_256[] = {
|
||||
0x00, 0x20, 0x10, 0x30, 0x08, 0x28, 0x18, 0x38,
|
||||
0x04, 0x24, 0x14, 0x34, 0x0c, 0x2c, 0x1c, 0x3c,
|
||||
0x02, 0x22, 0x12, 0x32, 0x0a, 0x2a, 0x1a, 0x3a,
|
||||
0x06, 0x26, 0x16, 0x36, 0x0e, 0x2e, 0x1e, 0x3e,
|
||||
0x01, 0x21, 0x11, 0x31, 0x09, 0x29, 0x19, 0x39,
|
||||
0x05, 0x25, 0x15, 0x35, 0x0d, 0x2d, 0x1d, 0x3d,
|
||||
0x03, 0x23, 0x13, 0x33, 0x0b, 0x2b, 0x1b, 0x3b,
|
||||
0x07, 0x27, 0x17, 0x37, 0x0f, 0x2f, 0x1f, 0x3f};
|
||||
0x00, 0x20, 0x10, 0x30, 0x08, 0x28, 0x18, 0x38,
|
||||
0x04, 0x24, 0x14, 0x34, 0x0c, 0x2c, 0x1c, 0x3c,
|
||||
0x02, 0x22, 0x12, 0x32, 0x0a, 0x2a, 0x1a, 0x3a,
|
||||
0x06, 0x26, 0x16, 0x36, 0x0e, 0x2e, 0x1e, 0x3e,
|
||||
0x01, 0x21, 0x11, 0x31, 0x09, 0x29, 0x19, 0x39,
|
||||
0x05, 0x25, 0x15, 0x35, 0x0d, 0x2d, 0x1d, 0x3d,
|
||||
0x03, 0x23, 0x13, 0x33, 0x0b, 0x2b, 0x1b, 0x3b,
|
||||
0x07, 0x27, 0x17, 0x37, 0x0f, 0x2f, 0x1f, 0x3f};
|
||||
|
||||
/* Twiddle factor LUT */
|
||||
static complex_t *w[7];
|
||||
@ -74,339 +74,338 @@ static float delay[6][256];
|
||||
|
||||
/* Windowing function for Modified DCT - Thank you acroread */
|
||||
static float window[] = {
|
||||
0.00014, 0.00024, 0.00037, 0.00051, 0.00067, 0.00086, 0.00107, 0.00130,
|
||||
0.00157, 0.00187, 0.00220, 0.00256, 0.00297, 0.00341, 0.00390, 0.00443,
|
||||
0.00501, 0.00564, 0.00632, 0.00706, 0.00785, 0.00871, 0.00962, 0.01061,
|
||||
0.01166, 0.01279, 0.01399, 0.01526, 0.01662, 0.01806, 0.01959, 0.02121,
|
||||
0.02292, 0.02472, 0.02662, 0.02863, 0.03073, 0.03294, 0.03527, 0.03770,
|
||||
0.04025, 0.04292, 0.04571, 0.04862, 0.05165, 0.05481, 0.05810, 0.06153,
|
||||
0.06508, 0.06878, 0.07261, 0.07658, 0.08069, 0.08495, 0.08935, 0.09389,
|
||||
0.09859, 0.10343, 0.10842, 0.11356, 0.11885, 0.12429, 0.12988, 0.13563,
|
||||
0.14152, 0.14757, 0.15376, 0.16011, 0.16661, 0.17325, 0.18005, 0.18699,
|
||||
0.19407, 0.20130, 0.20867, 0.21618, 0.22382, 0.23161, 0.23952, 0.24757,
|
||||
0.25574, 0.26404, 0.27246, 0.28100, 0.28965, 0.29841, 0.30729, 0.31626,
|
||||
0.32533, 0.33450, 0.34376, 0.35311, 0.36253, 0.37204, 0.38161, 0.39126,
|
||||
0.40096, 0.41072, 0.42054, 0.43040, 0.44030, 0.45023, 0.46020, 0.47019,
|
||||
0.48020, 0.49022, 0.50025, 0.51028, 0.52031, 0.53033, 0.54033, 0.55031,
|
||||
0.56026, 0.57019, 0.58007, 0.58991, 0.59970, 0.60944, 0.61912, 0.62873,
|
||||
0.63827, 0.64774, 0.65713, 0.66643, 0.67564, 0.68476, 0.69377, 0.70269,
|
||||
0.71150, 0.72019, 0.72877, 0.73723, 0.74557, 0.75378, 0.76186, 0.76981,
|
||||
0.77762, 0.78530, 0.79283, 0.80022, 0.80747, 0.81457, 0.82151, 0.82831,
|
||||
0.83496, 0.84145, 0.84779, 0.85398, 0.86001, 0.86588, 0.87160, 0.87716,
|
||||
0.88257, 0.88782, 0.89291, 0.89785, 0.90264, 0.90728, 0.91176, 0.91610,
|
||||
0.92028, 0.92432, 0.92822, 0.93197, 0.93558, 0.93906, 0.94240, 0.94560,
|
||||
0.94867, 0.95162, 0.95444, 0.95713, 0.95971, 0.96217, 0.96451, 0.96674,
|
||||
0.96887, 0.97089, 0.97281, 0.97463, 0.97635, 0.97799, 0.97953, 0.98099,
|
||||
0.98236, 0.98366, 0.98488, 0.98602, 0.98710, 0.98811, 0.98905, 0.98994,
|
||||
0.99076, 0.99153, 0.99225, 0.99291, 0.99353, 0.99411, 0.99464, 0.99513,
|
||||
0.99558, 0.99600, 0.99639, 0.99674, 0.99706, 0.99736, 0.99763, 0.99788,
|
||||
0.99811, 0.99831, 0.99850, 0.99867, 0.99882, 0.99895, 0.99908, 0.99919,
|
||||
0.99929, 0.99938, 0.99946, 0.99953, 0.99959, 0.99965, 0.99969, 0.99974,
|
||||
0.99978, 0.99981, 0.99984, 0.99986, 0.99988, 0.99990, 0.99992, 0.99993,
|
||||
0.99994, 0.99995, 0.99996, 0.99997, 0.99998, 0.99998, 0.99998, 0.99999,
|
||||
0.99999, 0.99999, 0.99999, 1.00000, 1.00000, 1.00000, 1.00000, 1.00000,
|
||||
1.00000, 1.00000, 1.00000, 1.00000, 1.00000, 1.00000, 1.00000, 1.00000 };
|
||||
0.00014, 0.00024, 0.00037, 0.00051, 0.00067, 0.00086, 0.00107, 0.00130,
|
||||
0.00157, 0.00187, 0.00220, 0.00256, 0.00297, 0.00341, 0.00390, 0.00443,
|
||||
0.00501, 0.00564, 0.00632, 0.00706, 0.00785, 0.00871, 0.00962, 0.01061,
|
||||
0.01166, 0.01279, 0.01399, 0.01526, 0.01662, 0.01806, 0.01959, 0.02121,
|
||||
0.02292, 0.02472, 0.02662, 0.02863, 0.03073, 0.03294, 0.03527, 0.03770,
|
||||
0.04025, 0.04292, 0.04571, 0.04862, 0.05165, 0.05481, 0.05810, 0.06153,
|
||||
0.06508, 0.06878, 0.07261, 0.07658, 0.08069, 0.08495, 0.08935, 0.09389,
|
||||
0.09859, 0.10343, 0.10842, 0.11356, 0.11885, 0.12429, 0.12988, 0.13563,
|
||||
0.14152, 0.14757, 0.15376, 0.16011, 0.16661, 0.17325, 0.18005, 0.18699,
|
||||
0.19407, 0.20130, 0.20867, 0.21618, 0.22382, 0.23161, 0.23952, 0.24757,
|
||||
0.25574, 0.26404, 0.27246, 0.28100, 0.28965, 0.29841, 0.30729, 0.31626,
|
||||
0.32533, 0.33450, 0.34376, 0.35311, 0.36253, 0.37204, 0.38161, 0.39126,
|
||||
0.40096, 0.41072, 0.42054, 0.43040, 0.44030, 0.45023, 0.46020, 0.47019,
|
||||
0.48020, 0.49022, 0.50025, 0.51028, 0.52031, 0.53033, 0.54033, 0.55031,
|
||||
0.56026, 0.57019, 0.58007, 0.58991, 0.59970, 0.60944, 0.61912, 0.62873,
|
||||
0.63827, 0.64774, 0.65713, 0.66643, 0.67564, 0.68476, 0.69377, 0.70269,
|
||||
0.71150, 0.72019, 0.72877, 0.73723, 0.74557, 0.75378, 0.76186, 0.76981,
|
||||
0.77762, 0.78530, 0.79283, 0.80022, 0.80747, 0.81457, 0.82151, 0.82831,
|
||||
0.83496, 0.84145, 0.84779, 0.85398, 0.86001, 0.86588, 0.87160, 0.87716,
|
||||
0.88257, 0.88782, 0.89291, 0.89785, 0.90264, 0.90728, 0.91176, 0.91610,
|
||||
0.92028, 0.92432, 0.92822, 0.93197, 0.93558, 0.93906, 0.94240, 0.94560,
|
||||
0.94867, 0.95162, 0.95444, 0.95713, 0.95971, 0.96217, 0.96451, 0.96674,
|
||||
0.96887, 0.97089, 0.97281, 0.97463, 0.97635, 0.97799, 0.97953, 0.98099,
|
||||
0.98236, 0.98366, 0.98488, 0.98602, 0.98710, 0.98811, 0.98905, 0.98994,
|
||||
0.99076, 0.99153, 0.99225, 0.99291, 0.99353, 0.99411, 0.99464, 0.99513,
|
||||
0.99558, 0.99600, 0.99639, 0.99674, 0.99706, 0.99736, 0.99763, 0.99788,
|
||||
0.99811, 0.99831, 0.99850, 0.99867, 0.99882, 0.99895, 0.99908, 0.99919,
|
||||
0.99929, 0.99938, 0.99946, 0.99953, 0.99959, 0.99965, 0.99969, 0.99974,
|
||||
0.99978, 0.99981, 0.99984, 0.99986, 0.99988, 0.99990, 0.99992, 0.99993,
|
||||
0.99994, 0.99995, 0.99996, 0.99997, 0.99998, 0.99998, 0.99998, 0.99999,
|
||||
0.99999, 0.99999, 0.99999, 1.00000, 1.00000, 1.00000, 1.00000, 1.00000,
|
||||
1.00000, 1.00000, 1.00000, 1.00000, 1.00000, 1.00000, 1.00000, 1.00000 };
|
||||
|
||||
static __inline__ void swap_cmplx(complex_t *a, complex_t *b)
|
||||
{
|
||||
complex_t tmp;
|
||||
complex_t tmp;
|
||||
|
||||
tmp = *a;
|
||||
*a = *b;
|
||||
*b = tmp;
|
||||
tmp = *a;
|
||||
*a = *b;
|
||||
*b = tmp;
|
||||
}
|
||||
|
||||
static __inline__ complex_t cmplx_mult(complex_t a, complex_t b)
|
||||
{
|
||||
complex_t ret;
|
||||
complex_t ret;
|
||||
|
||||
ret.real = a.real * b.real - a.imag * b.imag;
|
||||
ret.imag = a.real * b.imag + a.imag * b.real;
|
||||
ret.real = a.real * b.real - a.imag * b.imag;
|
||||
ret.imag = a.real * b.imag + a.imag * b.real;
|
||||
|
||||
return ret;
|
||||
return ret;
|
||||
}
|
||||
|
||||
void imdct_init(void)
|
||||
{
|
||||
int i,k;
|
||||
complex_t angle_step;
|
||||
complex_t current_angle;
|
||||
int i,k;
|
||||
complex_t angle_step;
|
||||
complex_t current_angle;
|
||||
|
||||
/* Twiddle factors to turn IFFT into IMDCT */
|
||||
for( i=0; i < N/4; i++)
|
||||
{
|
||||
xcos1[i] = -cos(2 * M_PI * (8*i+1)/(8*N)) ;
|
||||
xsin1[i] = -sin(2 * M_PI * (8*i+1)/(8*N)) ;
|
||||
}
|
||||
|
||||
/* More twiddle factors to turn IFFT into IMDCT */
|
||||
for( i=0; i < N/8; i++)
|
||||
{
|
||||
xcos2[i] = -cos(2 * M_PI * (8*i+1)/(4*N)) ;
|
||||
xsin2[i] = -sin(2 * M_PI * (8*i+1)/(4*N)) ;
|
||||
}
|
||||
/* Twiddle factors to turn IFFT into IMDCT */
|
||||
for( i=0; i < N/4; i++)
|
||||
{
|
||||
xcos1[i] = -cos(2 * M_PI * (8*i+1)/(8*N)) ;
|
||||
xsin1[i] = -sin(2 * M_PI * (8*i+1)/(8*N)) ;
|
||||
}
|
||||
|
||||
/* Canonical twiddle factors for FFT */
|
||||
w[0] = w_1;
|
||||
w[1] = w_2;
|
||||
w[2] = w_4;
|
||||
w[3] = w_8;
|
||||
w[4] = w_16;
|
||||
w[5] = w_32;
|
||||
w[6] = w_64;
|
||||
/* More twiddle factors to turn IFFT into IMDCT */
|
||||
for( i=0; i < N/8; i++)
|
||||
{
|
||||
xcos2[i] = -cos(2 * M_PI * (8*i+1)/(4*N)) ;
|
||||
xsin2[i] = -sin(2 * M_PI * (8*i+1)/(4*N)) ;
|
||||
}
|
||||
|
||||
for( i = 0; i < 7; i++)
|
||||
{
|
||||
angle_step.real = cos(-2.0f * M_PI / (1 << (i+1)));
|
||||
angle_step.imag = sin(-2.0f * M_PI / (1 << (i+1)));
|
||||
/* Canonical twiddle factors for FFT */
|
||||
w[0] = w_1;
|
||||
w[1] = w_2;
|
||||
w[2] = w_4;
|
||||
w[3] = w_8;
|
||||
w[4] = w_16;
|
||||
w[5] = w_32;
|
||||
w[6] = w_64;
|
||||
|
||||
current_angle.real = 1.0f;
|
||||
current_angle.imag = 0.0f;
|
||||
for( i = 0; i < 7; i++)
|
||||
{
|
||||
angle_step.real = cos(-2.0f * M_PI / (1 << (i+1)));
|
||||
angle_step.imag = sin(-2.0f * M_PI / (1 << (i+1)));
|
||||
|
||||
for (k = 0; k < 1 << i; k++)
|
||||
{
|
||||
w[i][k] = current_angle;
|
||||
current_angle = cmplx_mult(current_angle,angle_step);
|
||||
}
|
||||
}
|
||||
current_angle.real = 1.0f;
|
||||
current_angle.imag = 0.0f;
|
||||
|
||||
for (k = 0; k < 1 << i; k++)
|
||||
{
|
||||
w[i][k] = current_angle;
|
||||
current_angle = cmplx_mult(current_angle,angle_step);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void imdct( ac3dec_t * p_ac3dec )
|
||||
{
|
||||
int i;
|
||||
int i;
|
||||
|
||||
for(i=0; i<p_ac3dec->bsi.nfchans;i++)
|
||||
{
|
||||
if(p_ac3dec->audblk.blksw[i])
|
||||
imdct_do_256(p_ac3dec->coeffs.fbw[i],p_ac3dec->samples.channel[i],delay[i]);
|
||||
else
|
||||
imdct_do_512(p_ac3dec->coeffs.fbw[i],p_ac3dec->samples.channel[i],delay[i]);
|
||||
}
|
||||
for(i=0; i<p_ac3dec->bsi.nfchans;i++)
|
||||
{
|
||||
if(p_ac3dec->audblk.blksw[i])
|
||||
imdct_do_256(p_ac3dec->coeffs.fbw[i],p_ac3dec->samples.channel[i],delay[i]);
|
||||
else
|
||||
imdct_do_512(p_ac3dec->coeffs.fbw[i],p_ac3dec->samples.channel[i],delay[i]);
|
||||
}
|
||||
|
||||
//XXX We don't bother with the IMDCT for the LFE as it's currently
|
||||
//unused.
|
||||
//if (bsi->lfeon)
|
||||
// imdct_do_512(coeffs->lfe,samples->channel[5],delay[5]);
|
||||
//
|
||||
/* XXX?? We don't bother with the IMDCT for the LFE as it's currently
|
||||
* unused. */
|
||||
//if (bsi->lfeon)
|
||||
// imdct_do_512(coeffs->lfe,samples->channel[5],delay[5]);
|
||||
}
|
||||
|
||||
void
|
||||
imdct_do_512(float x[],float y[],float delay[])
|
||||
{
|
||||
int i,k;
|
||||
int p,q;
|
||||
int m;
|
||||
int two_m;
|
||||
int two_m_plus_one;
|
||||
int i,k;
|
||||
int p,q;
|
||||
int m;
|
||||
int two_m;
|
||||
int two_m_plus_one;
|
||||
|
||||
float tmp_a_i;
|
||||
float tmp_a_r;
|
||||
float tmp_b_i;
|
||||
float tmp_b_r;
|
||||
float tmp_a_i;
|
||||
float tmp_a_r;
|
||||
float tmp_b_i;
|
||||
float tmp_b_r;
|
||||
|
||||
|
||||
float *y_ptr;
|
||||
float *delay_ptr;
|
||||
float *window_ptr;
|
||||
float *y_ptr;
|
||||
float *delay_ptr;
|
||||
float *window_ptr;
|
||||
|
||||
// Pre IFFT complex multiply plus IFFT cmplx conjugate
|
||||
for( i=0; i < N/4; i++)
|
||||
{
|
||||
/* z[i] = (X[N/2-2*i-1] + j * X[2*i]) * (xcos1[i] + j * xsin1[i]) ; */
|
||||
buf[i].real = (x[N/2-2*i-1] * xcos1[i]) - (x[2*i] * xsin1[i]);
|
||||
buf[i].imag = -((x[2*i] * xcos1[i]) + (x[N/2-2*i-1] * xsin1[i]));
|
||||
}
|
||||
/* Pre IFFT complex multiply plus IFFT cmplx conjugate */
|
||||
for( i=0; i < N/4; i++)
|
||||
{
|
||||
/* z[i] = (X[N/2-2*i-1] + j * X[2*i]) * (xcos1[i] + j * xsin1[i]) ; */
|
||||
buf[i].real = (x[N/2-2*i-1] * xcos1[i]) - (x[2*i] * xsin1[i]);
|
||||
buf[i].imag = -((x[2*i] * xcos1[i]) + (x[N/2-2*i-1] * xsin1[i]));
|
||||
}
|
||||
|
||||
//Bit reversed shuffling
|
||||
for(i=0; i<N/4; i++)
|
||||
{
|
||||
k = bit_reverse_512[i];
|
||||
if (k < i)
|
||||
swap_cmplx(&buf[i],&buf[k]);
|
||||
}
|
||||
/* Bit reversed shuffling */
|
||||
for(i=0; i<N/4; i++)
|
||||
{
|
||||
k = bit_reverse_512[i];
|
||||
if (k < i)
|
||||
swap_cmplx(&buf[i],&buf[k]);
|
||||
}
|
||||
|
||||
/* FFT Merge */
|
||||
for (m=0; m < 7; m++)
|
||||
{
|
||||
two_m = (1 << m);
|
||||
two_m_plus_one = (1 << (m+1));
|
||||
/* FFT Merge */
|
||||
for (m=0; m < 7; m++)
|
||||
{
|
||||
two_m = (1 << m);
|
||||
two_m_plus_one = (1 << (m+1));
|
||||
|
||||
for(k = 0; k < two_m; k++)
|
||||
{
|
||||
for(i = 0; i < 128; i += two_m_plus_one)
|
||||
{
|
||||
p = k + i;
|
||||
q = p + two_m;
|
||||
tmp_a_r = buf[p].real;
|
||||
tmp_a_i = buf[p].imag;
|
||||
tmp_b_r = buf[q].real * w[m][k].real - buf[q].imag * w[m][k].imag;
|
||||
tmp_b_i = buf[q].imag * w[m][k].real + buf[q].real * w[m][k].imag;
|
||||
buf[p].real = tmp_a_r + tmp_b_r;
|
||||
buf[p].imag = tmp_a_i + tmp_b_i;
|
||||
buf[q].real = tmp_a_r - tmp_b_r;
|
||||
buf[q].imag = tmp_a_i - tmp_b_i;
|
||||
for(k = 0; k < two_m; k++)
|
||||
{
|
||||
for(i = 0; i < 128; i += two_m_plus_one)
|
||||
{
|
||||
p = k + i;
|
||||
q = p + two_m;
|
||||
tmp_a_r = buf[p].real;
|
||||
tmp_a_i = buf[p].imag;
|
||||
tmp_b_r = buf[q].real * w[m][k].real - buf[q].imag * w[m][k].imag;
|
||||
tmp_b_i = buf[q].imag * w[m][k].real + buf[q].real * w[m][k].imag;
|
||||
buf[p].real = tmp_a_r + tmp_b_r;
|
||||
buf[p].imag = tmp_a_i + tmp_b_i;
|
||||
buf[q].real = tmp_a_r - tmp_b_r;
|
||||
buf[q].imag = tmp_a_i - tmp_b_i;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Post IFFT complex multiply plus IFFT complex conjugate*/
|
||||
for( i=0; i < N/4; i++)
|
||||
{
|
||||
/* y[n] = z[n] * (xcos1[n] + j * xsin1[n]) ; */
|
||||
tmp_a_r = buf[i].real;
|
||||
tmp_a_i = - buf[i].imag;
|
||||
buf[i].real =(tmp_a_r * xcos1[i]) - (tmp_a_i * xsin1[i]);
|
||||
buf[i].imag =(tmp_a_r * xsin1[i]) + (tmp_a_i * xcos1[i]);
|
||||
}
|
||||
|
||||
/* Post IFFT complex multiply plus IFFT complex conjugate*/
|
||||
for( i=0; i < N/4; i++)
|
||||
{
|
||||
/* y[n] = z[n] * (xcos1[n] + j * xsin1[n]) ; */
|
||||
tmp_a_r = buf[i].real;
|
||||
tmp_a_i = - buf[i].imag;
|
||||
buf[i].real =(tmp_a_r * xcos1[i]) - (tmp_a_i * xsin1[i]);
|
||||
buf[i].imag =(tmp_a_r * xsin1[i]) + (tmp_a_i * xcos1[i]);
|
||||
}
|
||||
|
||||
y_ptr = y;
|
||||
delay_ptr = delay;
|
||||
window_ptr = window;
|
||||
/* Window and convert to real valued signal */
|
||||
for(i=0; i<N/8; i++)
|
||||
{
|
||||
*y_ptr++ = 2.0f * (-buf[N/8+i].imag * *window_ptr++ + *delay_ptr++);
|
||||
*y_ptr++ = 2.0f * ( buf[N/8-i-1].real * *window_ptr++ + *delay_ptr++);
|
||||
}
|
||||
delay_ptr = delay;
|
||||
window_ptr = window;
|
||||
/* Window and convert to real valued signal */
|
||||
for(i=0; i<N/8; i++)
|
||||
{
|
||||
*y_ptr++ = 2.0f * (-buf[N/8+i].imag * *window_ptr++ + *delay_ptr++);
|
||||
*y_ptr++ = 2.0f * ( buf[N/8-i-1].real * *window_ptr++ + *delay_ptr++);
|
||||
}
|
||||
|
||||
for(i=0; i<N/8; i++)
|
||||
{
|
||||
*y_ptr++ = 2.0f * (-buf[i].real * *window_ptr++ + *delay_ptr++);
|
||||
*y_ptr++ = 2.0f * ( buf[N/4-i-1].imag * *window_ptr++ + *delay_ptr++);
|
||||
}
|
||||
for(i=0; i<N/8; i++)
|
||||
{
|
||||
*y_ptr++ = 2.0f * (-buf[i].real * *window_ptr++ + *delay_ptr++);
|
||||
*y_ptr++ = 2.0f * ( buf[N/4-i-1].imag * *window_ptr++ + *delay_ptr++);
|
||||
}
|
||||
|
||||
/* The trailing edge of the window goes into the delay line */
|
||||
delay_ptr = delay;
|
||||
/* The trailing edge of the window goes into the delay line */
|
||||
delay_ptr = delay;
|
||||
|
||||
for(i=0; i<N/8; i++)
|
||||
{
|
||||
*delay_ptr++ = -buf[N/8+i].real * *--window_ptr;
|
||||
*delay_ptr++ = buf[N/8-i-1].imag * *--window_ptr;
|
||||
}
|
||||
for(i=0; i<N/8; i++)
|
||||
{
|
||||
*delay_ptr++ = -buf[N/8+i].real * *--window_ptr;
|
||||
*delay_ptr++ = buf[N/8-i-1].imag * *--window_ptr;
|
||||
}
|
||||
|
||||
for(i=0; i<N/8; i++)
|
||||
{
|
||||
*delay_ptr++ = buf[i].imag * *--window_ptr;
|
||||
*delay_ptr++ = -buf[N/4-i-1].real * *--window_ptr;
|
||||
}
|
||||
for(i=0; i<N/8; i++)
|
||||
{
|
||||
*delay_ptr++ = buf[i].imag * *--window_ptr;
|
||||
*delay_ptr++ = -buf[N/4-i-1].real * *--window_ptr;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
imdct_do_256(float x[],float y[],float delay[])
|
||||
{
|
||||
int i,k;
|
||||
int p,q;
|
||||
int m;
|
||||
int two_m;
|
||||
int two_m_plus_one;
|
||||
int i,k;
|
||||
int p,q;
|
||||
int m;
|
||||
int two_m;
|
||||
int two_m_plus_one;
|
||||
|
||||
float tmp_a_i;
|
||||
float tmp_a_r;
|
||||
float tmp_b_i;
|
||||
float tmp_b_r;
|
||||
float tmp_a_i;
|
||||
float tmp_a_r;
|
||||
float tmp_b_i;
|
||||
float tmp_b_r;
|
||||
|
||||
complex_t *buf_1, *buf_2;
|
||||
complex_t *buf_1, *buf_2;
|
||||
|
||||
buf_1 = &buf[0];
|
||||
buf_2 = &buf[64];
|
||||
buf_1 = &buf[0];
|
||||
buf_2 = &buf[64];
|
||||
|
||||
/* Pre IFFT complex multiply plus IFFT cmplx conjugate */
|
||||
for(k=0; k<N/8; k++)
|
||||
{
|
||||
/* X1[k] = X[2*k] */
|
||||
/* X2[k] = X[2*k+1] */
|
||||
/* Pre IFFT complex multiply plus IFFT cmplx conjugate */
|
||||
for(k=0; k<N/8; k++)
|
||||
{
|
||||
/* X1[k] = X[2*k] */
|
||||
/* X2[k] = X[2*k+1] */
|
||||
|
||||
p = 2 * (N/4-2*k-1);
|
||||
q = 2 * (2 * k);
|
||||
p = 2 * (N/4-2*k-1);
|
||||
q = 2 * (2 * k);
|
||||
|
||||
/* Z1[k] = (X1[N/4-2*k-1] + j * X1[2*k]) * (xcos2[k] + j * xsin2[k]); */
|
||||
buf_1[k].real = x[p] * xcos2[k] - x[q] * xsin2[k];
|
||||
buf_1[k].imag = - (x[q] * xcos2[k] + x[p] * xsin2[k]);
|
||||
/* Z2[k] = (X2[N/4-2*k-1] + j * X2[2*k]) * (xcos2[k] + j * xsin2[k]); */
|
||||
buf_2[k].real = x[p + 1] * xcos2[k] - x[q + 1] * xsin2[k];
|
||||
buf_2[k].imag = - (x[q + 1] * xcos2[k] + x[p + 1] * xsin2[k]);
|
||||
}
|
||||
/* Z1[k] = (X1[N/4-2*k-1] + j * X1[2*k]) * (xcos2[k] + j * xsin2[k]); */
|
||||
buf_1[k].real = x[p] * xcos2[k] - x[q] * xsin2[k];
|
||||
buf_1[k].imag = - (x[q] * xcos2[k] + x[p] * xsin2[k]);
|
||||
/* Z2[k] = (X2[N/4-2*k-1] + j * X2[2*k]) * (xcos2[k] + j * xsin2[k]); */
|
||||
buf_2[k].real = x[p + 1] * xcos2[k] - x[q + 1] * xsin2[k];
|
||||
buf_2[k].imag = - (x[q + 1] * xcos2[k] + x[p + 1] * xsin2[k]);
|
||||
}
|
||||
|
||||
//IFFT Bit reversed shuffling
|
||||
for(i=0; i<N/8; i++)
|
||||
{
|
||||
k = bit_reverse_256[i];
|
||||
if (k < i)
|
||||
{
|
||||
swap_cmplx(&buf_1[i],&buf_1[k]);
|
||||
swap_cmplx(&buf_2[i],&buf_2[k]);
|
||||
}
|
||||
}
|
||||
/* IFFT Bit reversed shuffling */
|
||||
for(i=0; i<N/8; i++)
|
||||
{
|
||||
k = bit_reverse_256[i];
|
||||
if (k < i)
|
||||
{
|
||||
swap_cmplx(&buf_1[i],&buf_1[k]);
|
||||
swap_cmplx(&buf_2[i],&buf_2[k]);
|
||||
}
|
||||
}
|
||||
|
||||
/* FFT Merge */
|
||||
for (m=0; m < 6; m++)
|
||||
{
|
||||
two_m = (1 << m);
|
||||
two_m_plus_one = (1 << (m+1));
|
||||
/* FFT Merge */
|
||||
for (m=0; m < 6; m++)
|
||||
{
|
||||
two_m = (1 << m);
|
||||
two_m_plus_one = (1 << (m+1));
|
||||
|
||||
for(k = 0; k < two_m; k++)
|
||||
{
|
||||
for(i = 0; i < 64; i += two_m_plus_one)
|
||||
{
|
||||
p = k + i;
|
||||
q = p + two_m;
|
||||
//Do block 1
|
||||
tmp_a_r = buf_1[p].real;
|
||||
tmp_a_i = buf_1[p].imag;
|
||||
tmp_b_r = buf_1[q].real * w[m][k].real - buf_1[q].imag * w[m][k].imag;
|
||||
tmp_b_i = buf_1[q].imag * w[m][k].real + buf_1[q].real * w[m][k].imag;
|
||||
buf_1[p].real = tmp_a_r + tmp_b_r;
|
||||
buf_1[p].imag = tmp_a_i + tmp_b_i;
|
||||
buf_1[q].real = tmp_a_r - tmp_b_r;
|
||||
buf_1[q].imag = tmp_a_i - tmp_b_i;
|
||||
for(k = 0; k < two_m; k++)
|
||||
{
|
||||
for(i = 0; i < 64; i += two_m_plus_one)
|
||||
{
|
||||
p = k + i;
|
||||
q = p + two_m;
|
||||
/* Do block 1 */
|
||||
tmp_a_r = buf_1[p].real;
|
||||
tmp_a_i = buf_1[p].imag;
|
||||
tmp_b_r = buf_1[q].real * w[m][k].real - buf_1[q].imag * w[m][k].imag;
|
||||
tmp_b_i = buf_1[q].imag * w[m][k].real + buf_1[q].real * w[m][k].imag;
|
||||
buf_1[p].real = tmp_a_r + tmp_b_r;
|
||||
buf_1[p].imag = tmp_a_i + tmp_b_i;
|
||||
buf_1[q].real = tmp_a_r - tmp_b_r;
|
||||
buf_1[q].imag = tmp_a_i - tmp_b_i;
|
||||
|
||||
//Do block 2
|
||||
tmp_a_r = buf_2[p].real;
|
||||
tmp_a_i = buf_2[p].imag;
|
||||
tmp_b_r = buf_2[q].real * w[m][k].real - buf_2[q].imag * w[m][k].imag;
|
||||
tmp_b_i = buf_2[q].imag * w[m][k].real + buf_2[q].real * w[m][k].imag;
|
||||
buf_2[p].real = tmp_a_r + tmp_b_r;
|
||||
buf_2[p].imag = tmp_a_i + tmp_b_i;
|
||||
buf_2[q].real = tmp_a_r - tmp_b_r;
|
||||
buf_2[q].imag = tmp_a_i - tmp_b_i;
|
||||
/* Do block 2 */
|
||||
tmp_a_r = buf_2[p].real;
|
||||
tmp_a_i = buf_2[p].imag;
|
||||
tmp_b_r = buf_2[q].real * w[m][k].real - buf_2[q].imag * w[m][k].imag;
|
||||
tmp_b_i = buf_2[q].imag * w[m][k].real + buf_2[q].real * w[m][k].imag;
|
||||
buf_2[p].real = tmp_a_r + tmp_b_r;
|
||||
buf_2[p].imag = tmp_a_i + tmp_b_i;
|
||||
buf_2[q].real = tmp_a_r - tmp_b_r;
|
||||
buf_2[q].imag = tmp_a_i - tmp_b_i;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Post IFFT complex multiply */
|
||||
for( i=0; i < N/8; i++)
|
||||
{
|
||||
/* y1[n] = z1[n] * (xcos2[n] + j * xs in2[n]) ; */
|
||||
tmp_a_r = buf_1[i].real;
|
||||
tmp_a_i = - buf_1[i].imag;
|
||||
buf_1[i].real =(tmp_a_r * xcos2[i]) - (tmp_a_i * xsin2[i]);
|
||||
buf_1[i].imag =(tmp_a_r * xsin2[i]) + (tmp_a_i * xcos2[i]);
|
||||
/* y2[n] = z2[n] * (xcos2[n] + j * xsin2[n]) ; */
|
||||
tmp_a_r = buf_2[i].real;
|
||||
tmp_a_i = - buf_2[i].imag;
|
||||
buf_2[i].real =(tmp_a_r * xcos2[i]) - (tmp_a_i * xsin2[i]);
|
||||
buf_2[i].imag =(tmp_a_r * xsin2[i]) + (tmp_a_i * xcos2[i]);
|
||||
}
|
||||
|
||||
/* Window and convert to real valued signal */
|
||||
for(i=0; i<N/8; i++)
|
||||
{
|
||||
y[2*i] = -buf_1[i].imag * window[2*i];
|
||||
y[2*i+1] = buf_1[N/8-i-1].real * window[2*i+1];
|
||||
y[N/4+2*i] = -buf_1[i].real * window[N/4+2*i];
|
||||
y[N/4+2*i+1] = buf_1[N/8-i-1].imag * window[N/4+2*i+1];
|
||||
y[N/2+2*i] = -buf_2[i].real * window[N/2-2*i-1];
|
||||
y[N/2+2*i+1] = buf_2[N/8-i-1].imag * window[N/2-2*i-2];
|
||||
y[3*N/4+2*i] = buf_2[i].imag * window[N/4-2*i-1];
|
||||
y[3*N/4+2*i+1] = -buf_2[N/8-i-1].real * window[N/4-2*i-2];
|
||||
}
|
||||
|
||||
/* Overlap and add */
|
||||
for(i=0; i<N/2; i++)
|
||||
{
|
||||
y[i] = 2 * (y[i] + delay[i]);
|
||||
delay[i] = y[N/2+i];
|
||||
}
|
||||
/* Post IFFT complex multiply */
|
||||
for( i=0; i < N/8; i++)
|
||||
{
|
||||
/* y1[n] = z1[n] * (xcos2[n] + j * xs in2[n]) ; */
|
||||
tmp_a_r = buf_1[i].real;
|
||||
tmp_a_i = - buf_1[i].imag;
|
||||
buf_1[i].real =(tmp_a_r * xcos2[i]) - (tmp_a_i * xsin2[i]);
|
||||
buf_1[i].imag =(tmp_a_r * xsin2[i]) + (tmp_a_i * xcos2[i]);
|
||||
/* y2[n] = z2[n] * (xcos2[n] + j * xsin2[n]) ; */
|
||||
tmp_a_r = buf_2[i].real;
|
||||
tmp_a_i = - buf_2[i].imag;
|
||||
buf_2[i].real =(tmp_a_r * xcos2[i]) - (tmp_a_i * xsin2[i]);
|
||||
buf_2[i].imag =(tmp_a_r * xsin2[i]) + (tmp_a_i * xcos2[i]);
|
||||
}
|
||||
|
||||
/* Window and convert to real valued signal */
|
||||
for(i=0; i<N/8; i++)
|
||||
{
|
||||
y[2*i] = -buf_1[i].imag * window[2*i];
|
||||
y[2*i+1] = buf_1[N/8-i-1].real * window[2*i+1];
|
||||
y[N/4+2*i] = -buf_1[i].real * window[N/4+2*i];
|
||||
y[N/4+2*i+1] = buf_1[N/8-i-1].imag * window[N/4+2*i+1];
|
||||
y[N/2+2*i] = -buf_2[i].real * window[N/2-2*i-1];
|
||||
y[N/2+2*i+1] = buf_2[N/8-i-1].imag * window[N/2-2*i-2];
|
||||
y[3*N/4+2*i] = buf_2[i].imag * window[N/4-2*i-1];
|
||||
y[3*N/4+2*i+1] = -buf_2[N/8-i-1].real * window[N/4-2*i-2];
|
||||
}
|
||||
|
||||
/* Overlap and add */
|
||||
for(i=0; i<N/2; i++)
|
||||
{
|
||||
y[i] = 2 * (y[i] + delay[i]);
|
||||
delay[i] = y[N/2+i];
|
||||
}
|
||||
}
|
||||
|
@ -34,32 +34,32 @@ static float q_2_2[ 128 ] = { (-4 << 15) / 5, (-2 << 15) / 5, 0, (2 << 15) / 5,
|
||||
static float q_4_0[ 128 ] = { (-10 << 15) / 11, (-10 << 15) / 11, (-10 << 15) / 11, (-10 << 15) / 11, (-10 << 15) / 11, (-10 << 15) / 11, (-10 << 15) / 11, (-10 << 15) / 11, (-10 << 15) / 11, (-10 << 15) / 11, (-10 << 15) / 11, (-8 << 15) / 11, (-8 << 15) / 11, (-8 << 15) / 11, (-8 << 15) / 11, (-8 << 15) / 11, (-8 << 15) / 11, (-8 << 15) / 11, (-8 << 15) / 11, (-8 << 15) / 11, (-8 << 15) / 11, (-8 << 15) / 11, (-6 << 15) / 11, (-6 << 15) / 11, (-6 << 15) / 11, (-6 << 15) / 11, (-6 << 15) / 11, (-6 << 15) / 11, (-6 << 15) / 11, (-6 << 15) / 11, (-6 << 15) / 11, (-6 << 15) / 11, (-6 << 15) / 11, (-4 << 15) / 11, (-4 << 15) / 11, (-4 << 15) / 11, (-4 << 15) / 11, (-4 << 15) / 11, (-4 << 15) / 11, (-4 << 15) / 11, (-4 << 15) / 11, (-4 << 15) / 11, (-4 << 15) / 11, (-4 << 15) / 11, (-2 << 15) / 11, (-2 << 15) / 11, (-2 << 15) / 11, (-2 << 15) / 11, (-2 << 15) / 11, (-2 << 15) / 11, (-2 << 15) / 11, (-2 << 15) / 11, (-2 << 15) / 11, (-2 << 15) / 11, (-2 << 15) / 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, (2 << 15) / 11, (2 << 15) / 11, (2 << 15) / 11, (2 << 15) / 11, (2 << 15) / 11, (2 << 15) / 11, (2 << 15) / 11, (2 << 15) / 11, (2 << 15) / 11, (2 << 15) / 11, (2 << 15) / 11, (4 << 15) / 11, (4 << 15) / 11, (4 << 15) / 11, (4 << 15) / 11, (4 << 15) / 11, (4 << 15) / 11, (4 << 15) / 11, (4 << 15) / 11, (4 << 15) / 11, (4 << 15) / 11, (4 << 15) / 11, (6 << 15) / 11, (6 << 15) / 11, (6 << 15) / 11, (6 << 15) / 11, (6 << 15) / 11, (6 << 15) / 11, (6 << 15) / 11, (6 << 15) / 11, (6 << 15) / 11, (6 << 15) / 11, (6 << 15) / 11, (8 << 15) / 11, (8 << 15) / 11, (8 << 15) / 11, (8 << 15) / 11, (8 << 15) / 11, (8 << 15) / 11, (8 << 15) / 11, (8 << 15) / 11, (8 << 15) / 11, (8 << 15) / 11, (8 << 15) / 11, (10 << 15) / 11, (10 << 15) / 11, (10 << 15) / 11, (10 << 15) / 11, (10 << 15) / 11, (10 << 15) / 11, (10 << 15) / 11, (10 << 15) / 11, (10 << 15) / 11, (10 << 15) / 11, (10 << 15) / 11, 0, 0, 0, 0, 0, 0, 0 };
|
||||
static float q_4_1[ 128 ] = { (-10 << 15) / 11, (-8 << 15) / 11, (-6 << 15) / 11, (-4 << 15) / 11, (-2 << 15) / 11, 0, (2 << 15) / 11, (4 << 15) / 11, (6 << 15) / 11, (8 << 15) / 11, (10 << 15) / 11, (-10 << 15) / 11, (-8 << 15) / 11, (-6 << 15) / 11, (-4 << 15) / 11, (-2 << 15) / 11, 0, (2 << 15) / 11, (4 << 15) / 11, (6 << 15) / 11, (8 << 15) / 11, (10 << 15) / 11, (-10 << 15) / 11, (-8 << 15) / 11, (-6 << 15) / 11, (-4 << 15) / 11, (-2 << 15) / 11, 0, (2 << 15) / 11, (4 << 15) / 11, (6 << 15) / 11, (8 << 15) / 11, (10 << 15) / 11, (-10 << 15) / 11, (-8 << 15) / 11, (-6 << 15) / 11, (-4 << 15) / 11, (-2 << 15) / 11, 0, (2 << 15) / 11, (4 << 15) / 11, (6 << 15) / 11, (8 << 15) / 11, (10 << 15) / 11, (-10 << 15) / 11, (-8 << 15) / 11, (-6 << 15) / 11, (-4 << 15) / 11, (-2 << 15) / 11, 0, (2 << 15) / 11, (4 << 15) / 11, (6 << 15) / 11, (8 << 15) / 11, (10 << 15) / 11, (-10 << 15) / 11, (-8 << 15) / 11, (-6 << 15) / 11, (-4 << 15) / 11, (-2 << 15) / 11, 0, (2 << 15) / 11, (4 << 15) / 11, (6 << 15) / 11, (8 << 15) / 11, (10 << 15) / 11, (-10 << 15) / 11, (-8 << 15) / 11, (-6 << 15) / 11, (-4 << 15) / 11, (-2 << 15) / 11, 0, (2 << 15) / 11, (4 << 15) / 11, (6 << 15) / 11, (8 << 15) / 11, (10 << 15) / 11, (-10 << 15) / 11, (-8 << 15) / 11, (-6 << 15) / 11, (-4 << 15) / 11, (-2 << 15) / 11, 0, (2 << 15) / 11, (4 << 15) / 11, (6 << 15) / 11, (8 << 15) / 11, (10 << 15) / 11, (-10 << 15) / 11, (-8 << 15) / 11, (-6 << 15) / 11, (-4 << 15) / 11, (-2 << 15) / 11, 0, (2 << 15) / 11, (4 << 15) / 11, (6 << 15) / 11, (8 << 15) / 11, (10 << 15) / 11, (-10 << 15) / 11, (-8 << 15) / 11, (-6 << 15) / 11, (-4 << 15) / 11, (-2 << 15) / 11, 0, (2 << 15) / 11, (4 << 15) / 11, (6 << 15) / 11, (8 << 15) / 11, (10 << 15) / 11, (-10 << 15) / 11, (-8 << 15) / 11, (-6 << 15) / 11, (-4 << 15) / 11, (-2 << 15) / 11, 0, (2 << 15) / 11, (4 << 15) / 11, (6 << 15) / 11, (8 << 15) / 11, (10 << 15) / 11, 0, 0, 0, 0, 0, 0, 0 };
|
||||
|
||||
//Lookup tables of 0.16 two's complement quantization values
|
||||
/* Lookup tables of 0.16 two's complement quantization values */
|
||||
|
||||
/*
|
||||
s32 q_1[3] = {( -2 << 15)/3, 0 ,( 2 << 15)/3 };
|
||||
|
||||
s32 q_2[5] = {( -4 << 15)/5,( -2 << 15)/5, 0 ,
|
||||
( 2 << 15)/5,( 4 << 15)/5};
|
||||
( 2 << 15)/5,( 4 << 15)/5};
|
||||
*/
|
||||
|
||||
static float q_3[7] = {( -6 << 15)/7,( -4 << 15)/7,( -2 << 15)/7,
|
||||
0 ,( 2 << 15)/7,( 4 << 15)/7,
|
||||
( 6 << 15)/7};
|
||||
0 ,( 2 << 15)/7,( 4 << 15)/7,
|
||||
( 6 << 15)/7};
|
||||
|
||||
/*
|
||||
s32 q_4[11] = {(-10 << 15)/11,(-8 << 15)/11,(-6 << 15)/11,
|
||||
( -4 << 15)/11,(-2 << 15)/11, 0 ,
|
||||
( 2 << 15)/11,( 4 << 15)/11,( 6 << 15)/11,
|
||||
( 8 << 15)/11,(10 << 15)/11};
|
||||
( -4 << 15)/11,(-2 << 15)/11, 0 ,
|
||||
( 2 << 15)/11,( 4 << 15)/11,( 6 << 15)/11,
|
||||
( 8 << 15)/11,(10 << 15)/11};
|
||||
*/
|
||||
static float q_5[15] = {(-14 << 15)/15,(-12 << 15)/15,(-10 << 15)/15,
|
||||
( -8 << 15)/15,( -6 << 15)/15,( -4 << 15)/15,
|
||||
( -2 << 15)/15, 0 ,( 2 << 15)/15,
|
||||
( 4 << 15)/15,( 6 << 15)/15,( 8 << 15)/15,
|
||||
( 10 << 15)/15,( 12 << 15)/15,( 14 << 15)/15};
|
||||
( -8 << 15)/15,( -6 << 15)/15,( -4 << 15)/15,
|
||||
( -2 << 15)/15, 0 ,( 2 << 15)/15,
|
||||
( 4 << 15)/15,( 6 << 15)/15,( 8 << 15)/15,
|
||||
( 10 << 15)/15,( 12 << 15)/15,( 14 << 15)/15};
|
||||
|
||||
//These store the persistent state of the packed mantissas
|
||||
/* These store the persistent state of the packed mantissas */
|
||||
static float q_1[2];
|
||||
static float q_2[2];
|
||||
static float q_4[1];
|
||||
@ -67,246 +67,246 @@ static s32 q_1_pointer;
|
||||
static s32 q_2_pointer;
|
||||
static s32 q_4_pointer;
|
||||
|
||||
//Conversion from bap to number of bits in the mantissas
|
||||
//zeros account for cases 0,1,2,4 which are special cased
|
||||
/* Conversion from bap to number of bits in the mantissas
|
||||
* zeros account for cases 0,1,2,4 which are special cased */
|
||||
static u16 qnttztab[16] = { 0, 0, 0, 3, 0 , 4, 5, 6, 7, 8, 9, 10, 11, 12, 14, 16};
|
||||
|
||||
static float exp_lut[ 25 ] =
|
||||
{
|
||||
6.10351562500000000000000000e-05,
|
||||
3.05175781250000000000000000e-05,
|
||||
1.52587890625000000000000000e-05,
|
||||
7.62939453125000000000000000e-06,
|
||||
3.81469726562500000000000000e-06,
|
||||
1.90734863281250000000000000e-06,
|
||||
9.53674316406250000000000000e-07,
|
||||
4.76837158203125000000000000e-07,
|
||||
2.38418579101562500000000000e-07,
|
||||
1.19209289550781250000000000e-07,
|
||||
5.96046447753906250000000000e-08,
|
||||
2.98023223876953125000000000e-08,
|
||||
1.49011611938476562500000000e-08,
|
||||
7.45058059692382812500000000e-09,
|
||||
3.72529029846191406250000000e-09,
|
||||
1.86264514923095703125000000e-09,
|
||||
9.31322574615478515625000000e-10,
|
||||
4.65661287307739257812500000e-10,
|
||||
2.32830643653869628906250000e-10,
|
||||
1.16415321826934814453125000e-10,
|
||||
5.82076609134674072265625000e-11,
|
||||
2.91038304567337036132812500e-11,
|
||||
1.45519152283668518066406250e-11,
|
||||
7.27595761418342590332031250e-12,
|
||||
3.63797880709171295166015625e-12,
|
||||
6.10351562500000000000000000e-05,
|
||||
3.05175781250000000000000000e-05,
|
||||
1.52587890625000000000000000e-05,
|
||||
7.62939453125000000000000000e-06,
|
||||
3.81469726562500000000000000e-06,
|
||||
1.90734863281250000000000000e-06,
|
||||
9.53674316406250000000000000e-07,
|
||||
4.76837158203125000000000000e-07,
|
||||
2.38418579101562500000000000e-07,
|
||||
1.19209289550781250000000000e-07,
|
||||
5.96046447753906250000000000e-08,
|
||||
2.98023223876953125000000000e-08,
|
||||
1.49011611938476562500000000e-08,
|
||||
7.45058059692382812500000000e-09,
|
||||
3.72529029846191406250000000e-09,
|
||||
1.86264514923095703125000000e-09,
|
||||
9.31322574615478515625000000e-10,
|
||||
4.65661287307739257812500000e-10,
|
||||
2.32830643653869628906250000e-10,
|
||||
1.16415321826934814453125000e-10,
|
||||
5.82076609134674072265625000e-11,
|
||||
2.91038304567337036132812500e-11,
|
||||
1.45519152283668518066406250e-11,
|
||||
7.27595761418342590332031250e-12,
|
||||
3.63797880709171295166015625e-12,
|
||||
};
|
||||
|
||||
/* Fetch an unpacked, left justified, and properly biased/dithered mantissa value */
|
||||
static __inline__ float float_get( ac3dec_t * p_ac3dec, u16 bap, u16 exp )
|
||||
{
|
||||
u32 group_code;
|
||||
u32 group_code;
|
||||
|
||||
//If the bap is 0-5 then we have special cases to take care of
|
||||
switch ( bap )
|
||||
{
|
||||
case 0:
|
||||
return( 0 );
|
||||
/* If the bap is 0-5 then we have special cases to take care of */
|
||||
switch ( bap )
|
||||
{
|
||||
case 0:
|
||||
return( 0 );
|
||||
|
||||
case 1:
|
||||
if ( q_1_pointer >= 0 )
|
||||
{
|
||||
return( q_1[q_1_pointer--] * exp_lut[exp] );
|
||||
}
|
||||
NeedBits( &(p_ac3dec->bit_stream), 5 );
|
||||
group_code = p_ac3dec->bit_stream.fifo.buffer >> (32 - 5);
|
||||
DumpBits( &(p_ac3dec->bit_stream), 5 );
|
||||
p_ac3dec->total_bits_read += 5;
|
||||
case 1:
|
||||
if ( q_1_pointer >= 0 )
|
||||
{
|
||||
return( q_1[q_1_pointer--] * exp_lut[exp] );
|
||||
}
|
||||
NeedBits( &(p_ac3dec->bit_stream), 5 );
|
||||
group_code = p_ac3dec->bit_stream.fifo.buffer >> (32 - 5);
|
||||
DumpBits( &(p_ac3dec->bit_stream), 5 );
|
||||
p_ac3dec->total_bits_read += 5;
|
||||
|
||||
if ( group_code > 26 )
|
||||
{
|
||||
fprintf( stderr, "ac3dec debug: invalid mantissa\n" );
|
||||
p_ac3dec->b_invalid = 1;
|
||||
}
|
||||
if ( group_code > 26 )
|
||||
{
|
||||
fprintf( stderr, "ac3dec debug: invalid mantissa\n" );
|
||||
p_ac3dec->b_invalid = 1;
|
||||
}
|
||||
|
||||
q_1[ 1 ] = q_1_1[ group_code ];
|
||||
q_1[ 0 ] = q_1_2[ group_code ];
|
||||
q_1[ 1 ] = q_1_1[ group_code ];
|
||||
q_1[ 0 ] = q_1_2[ group_code ];
|
||||
|
||||
q_1_pointer = 1;
|
||||
q_1_pointer = 1;
|
||||
|
||||
return( q_1_0[group_code] * exp_lut[exp] );
|
||||
return( q_1_0[group_code] * exp_lut[exp] );
|
||||
|
||||
case 2:
|
||||
if ( q_2_pointer >= 0 )
|
||||
{
|
||||
return( q_2[q_2_pointer--] * exp_lut[exp] );
|
||||
}
|
||||
NeedBits( &(p_ac3dec->bit_stream), 7 );
|
||||
group_code = p_ac3dec->bit_stream.fifo.buffer >> (32 - 7);
|
||||
DumpBits( &(p_ac3dec->bit_stream), 7 );
|
||||
p_ac3dec->total_bits_read += 7;
|
||||
case 2:
|
||||
if ( q_2_pointer >= 0 )
|
||||
{
|
||||
return( q_2[q_2_pointer--] * exp_lut[exp] );
|
||||
}
|
||||
NeedBits( &(p_ac3dec->bit_stream), 7 );
|
||||
group_code = p_ac3dec->bit_stream.fifo.buffer >> (32 - 7);
|
||||
DumpBits( &(p_ac3dec->bit_stream), 7 );
|
||||
p_ac3dec->total_bits_read += 7;
|
||||
|
||||
if ( group_code > 124 )
|
||||
{
|
||||
fprintf( stderr, "ac3dec debug: invalid mantissa\n" );
|
||||
p_ac3dec->b_invalid = 1;
|
||||
}
|
||||
if ( group_code > 124 )
|
||||
{
|
||||
fprintf( stderr, "ac3dec debug: invalid mantissa\n" );
|
||||
p_ac3dec->b_invalid = 1;
|
||||
}
|
||||
|
||||
q_2[ 1 ] = q_2_1[ group_code ];
|
||||
q_2[ 0 ] = q_2_2[ group_code ];
|
||||
q_2[ 1 ] = q_2_1[ group_code ];
|
||||
q_2[ 0 ] = q_2_2[ group_code ];
|
||||
|
||||
q_2_pointer = 1;
|
||||
q_2_pointer = 1;
|
||||
|
||||
return( q_2_0[ group_code ] * exp_lut[exp] );
|
||||
return( q_2_0[ group_code ] * exp_lut[exp] );
|
||||
|
||||
case 3:
|
||||
NeedBits( &(p_ac3dec->bit_stream), 3 );
|
||||
group_code = p_ac3dec->bit_stream.fifo.buffer >> (32 - 3);
|
||||
DumpBits( &(p_ac3dec->bit_stream), 3 );
|
||||
p_ac3dec->total_bits_read += 3;
|
||||
case 3:
|
||||
NeedBits( &(p_ac3dec->bit_stream), 3 );
|
||||
group_code = p_ac3dec->bit_stream.fifo.buffer >> (32 - 3);
|
||||
DumpBits( &(p_ac3dec->bit_stream), 3 );
|
||||
p_ac3dec->total_bits_read += 3;
|
||||
|
||||
if ( group_code > 6 )
|
||||
{
|
||||
fprintf( stderr, "ac3dec debug: invalid mantissa\n" );
|
||||
p_ac3dec->b_invalid = 1;
|
||||
}
|
||||
if ( group_code > 6 )
|
||||
{
|
||||
fprintf( stderr, "ac3dec debug: invalid mantissa\n" );
|
||||
p_ac3dec->b_invalid = 1;
|
||||
}
|
||||
|
||||
return( q_3[group_code] * exp_lut[exp] );
|
||||
return( q_3[group_code] * exp_lut[exp] );
|
||||
|
||||
case 4:
|
||||
if ( q_4_pointer >= 0 )
|
||||
{
|
||||
return( q_4[q_4_pointer--] * exp_lut[exp] );
|
||||
}
|
||||
NeedBits( &(p_ac3dec->bit_stream), 7 );
|
||||
group_code = p_ac3dec->bit_stream.fifo.buffer >> (32 - 7);
|
||||
DumpBits( &(p_ac3dec->bit_stream), 7 );
|
||||
p_ac3dec->total_bits_read += 7;
|
||||
case 4:
|
||||
if ( q_4_pointer >= 0 )
|
||||
{
|
||||
return( q_4[q_4_pointer--] * exp_lut[exp] );
|
||||
}
|
||||
NeedBits( &(p_ac3dec->bit_stream), 7 );
|
||||
group_code = p_ac3dec->bit_stream.fifo.buffer >> (32 - 7);
|
||||
DumpBits( &(p_ac3dec->bit_stream), 7 );
|
||||
p_ac3dec->total_bits_read += 7;
|
||||
|
||||
if ( group_code > 120 )
|
||||
{
|
||||
fprintf( stderr, "ac3dec debug: invalid mantissa\n" );
|
||||
p_ac3dec->b_invalid = 1;
|
||||
}
|
||||
if ( group_code > 120 )
|
||||
{
|
||||
fprintf( stderr, "ac3dec debug: invalid mantissa\n" );
|
||||
p_ac3dec->b_invalid = 1;
|
||||
}
|
||||
|
||||
q_4[ 0 ] = q_4_1[ group_code ];
|
||||
q_4[ 0 ] = q_4_1[ group_code ];
|
||||
|
||||
q_4_pointer = 0;
|
||||
q_4_pointer = 0;
|
||||
|
||||
return( q_4_0[ group_code ] * exp_lut[exp] );
|
||||
return( q_4_0[ group_code ] * exp_lut[exp] );
|
||||
|
||||
case 5:
|
||||
NeedBits( &(p_ac3dec->bit_stream), 4 );
|
||||
group_code = p_ac3dec->bit_stream.fifo.buffer >> (32 - 4);
|
||||
DumpBits( &(p_ac3dec->bit_stream), 4 );
|
||||
p_ac3dec->total_bits_read += 4;
|
||||
case 5:
|
||||
NeedBits( &(p_ac3dec->bit_stream), 4 );
|
||||
group_code = p_ac3dec->bit_stream.fifo.buffer >> (32 - 4);
|
||||
DumpBits( &(p_ac3dec->bit_stream), 4 );
|
||||
p_ac3dec->total_bits_read += 4;
|
||||
|
||||
if ( group_code > 14 )
|
||||
{
|
||||
fprintf( stderr, "ac3dec debug: invalid mantissa\n" );
|
||||
p_ac3dec->b_invalid = 1;
|
||||
}
|
||||
if ( group_code > 14 )
|
||||
{
|
||||
fprintf( stderr, "ac3dec debug: invalid mantissa\n" );
|
||||
p_ac3dec->b_invalid = 1;
|
||||
}
|
||||
|
||||
return( q_5[group_code] * exp_lut[exp] );
|
||||
return( q_5[group_code] * exp_lut[exp] );
|
||||
|
||||
default:
|
||||
NeedBits( &(p_ac3dec->bit_stream), qnttztab[bap] );
|
||||
group_code = (((s32)(p_ac3dec->bit_stream.fifo.buffer)) >> (32 - qnttztab[bap])) << (16 - qnttztab[bap]);
|
||||
DumpBits( &(p_ac3dec->bit_stream), qnttztab[bap] );
|
||||
p_ac3dec->total_bits_read += qnttztab[bap];
|
||||
default:
|
||||
NeedBits( &(p_ac3dec->bit_stream), qnttztab[bap] );
|
||||
group_code = (((s32)(p_ac3dec->bit_stream.fifo.buffer)) >> (32 - qnttztab[bap])) << (16 - qnttztab[bap]);
|
||||
DumpBits( &(p_ac3dec->bit_stream), qnttztab[bap] );
|
||||
p_ac3dec->total_bits_read += qnttztab[bap];
|
||||
|
||||
return( ((s32)group_code) * exp_lut[exp] );
|
||||
}
|
||||
return( ((s32)group_code) * exp_lut[exp] );
|
||||
}
|
||||
}
|
||||
|
||||
static __inline__ void uncouple_channel( ac3dec_t * p_ac3dec, u32 ch )
|
||||
{
|
||||
u32 bnd = 0;
|
||||
u32 i,j;
|
||||
float cpl_coord = 0;
|
||||
u32 cpl_exp_tmp;
|
||||
u32 cpl_mant_tmp;
|
||||
u32 bnd = 0;
|
||||
u32 i,j;
|
||||
float cpl_coord = 0;
|
||||
u32 cpl_exp_tmp;
|
||||
u32 cpl_mant_tmp;
|
||||
|
||||
for(i=p_ac3dec->audblk.cplstrtmant;i<p_ac3dec->audblk.cplendmant;)
|
||||
{
|
||||
if(!p_ac3dec->audblk.cplbndstrc[bnd])
|
||||
{
|
||||
cpl_exp_tmp = p_ac3dec->audblk.cplcoexp[ch][bnd] + 3 * p_ac3dec->audblk.mstrcplco[ch];
|
||||
if(p_ac3dec->audblk.cplcoexp[ch][bnd] == 15)
|
||||
cpl_mant_tmp = (p_ac3dec->audblk.cplcomant[ch][bnd]) << 12;
|
||||
else
|
||||
cpl_mant_tmp = ((0x10) | p_ac3dec->audblk.cplcomant[ch][bnd]) << 11;
|
||||
for(i=p_ac3dec->audblk.cplstrtmant;i<p_ac3dec->audblk.cplendmant;)
|
||||
{
|
||||
if(!p_ac3dec->audblk.cplbndstrc[bnd])
|
||||
{
|
||||
cpl_exp_tmp = p_ac3dec->audblk.cplcoexp[ch][bnd] + 3 * p_ac3dec->audblk.mstrcplco[ch];
|
||||
if(p_ac3dec->audblk.cplcoexp[ch][bnd] == 15)
|
||||
cpl_mant_tmp = (p_ac3dec->audblk.cplcomant[ch][bnd]) << 12;
|
||||
else
|
||||
cpl_mant_tmp = ((0x10) | p_ac3dec->audblk.cplcomant[ch][bnd]) << 11;
|
||||
|
||||
cpl_coord = ((s16)cpl_mant_tmp) * exp_lut[cpl_exp_tmp];
|
||||
}
|
||||
bnd++;
|
||||
cpl_coord = ((s16)cpl_mant_tmp) * exp_lut[cpl_exp_tmp];
|
||||
}
|
||||
bnd++;
|
||||
|
||||
for(j=0;j < 12; j++)
|
||||
{
|
||||
p_ac3dec->coeffs.fbw[ch][i] = cpl_coord * p_ac3dec->audblk.cplfbw[i];
|
||||
i++;
|
||||
}
|
||||
}
|
||||
for(j=0;j < 12; j++)
|
||||
{
|
||||
p_ac3dec->coeffs.fbw[ch][i] = cpl_coord * p_ac3dec->audblk.cplfbw[i];
|
||||
i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void mantissa_unpack( ac3dec_t * p_ac3dec )
|
||||
{
|
||||
int i, j;
|
||||
int i, j;
|
||||
|
||||
q_1_pointer = -1;
|
||||
q_2_pointer = -1;
|
||||
q_4_pointer = -1;
|
||||
q_1_pointer = -1;
|
||||
q_2_pointer = -1;
|
||||
q_4_pointer = -1;
|
||||
|
||||
if ( p_ac3dec->audblk.cplinu )
|
||||
{
|
||||
/* 1 */
|
||||
for ( i = 0; !p_ac3dec->audblk.chincpl[i]; i++ )
|
||||
{
|
||||
for ( j = 0; j < p_ac3dec->audblk.endmant[i]; j++ )
|
||||
{
|
||||
p_ac3dec->coeffs.fbw[i][j] = float_get( p_ac3dec, p_ac3dec->audblk.fbw_bap[i][j], p_ac3dec->audblk.fbw_exp[i][j] );
|
||||
}
|
||||
}
|
||||
if ( p_ac3dec->audblk.cplinu )
|
||||
{
|
||||
/* 1 */
|
||||
for ( i = 0; !p_ac3dec->audblk.chincpl[i]; i++ )
|
||||
{
|
||||
for ( j = 0; j < p_ac3dec->audblk.endmant[i]; j++ )
|
||||
{
|
||||
p_ac3dec->coeffs.fbw[i][j] = float_get( p_ac3dec, p_ac3dec->audblk.fbw_bap[i][j], p_ac3dec->audblk.fbw_exp[i][j] );
|
||||
}
|
||||
}
|
||||
|
||||
/* 2 */
|
||||
for ( j = 0; j < p_ac3dec->audblk.endmant[i]; j++ )
|
||||
{
|
||||
p_ac3dec->coeffs.fbw[i][j] = float_get( p_ac3dec, p_ac3dec->audblk.fbw_bap[i][j], p_ac3dec->audblk.fbw_exp[i][j] );
|
||||
}
|
||||
for ( j = p_ac3dec->audblk.cplstrtmant; j < p_ac3dec->audblk.cplendmant; j++ )
|
||||
{
|
||||
p_ac3dec->audblk.cplfbw[j] = float_get( p_ac3dec, p_ac3dec->audblk.cpl_bap[j], p_ac3dec->audblk.cpl_exp[j] );
|
||||
}
|
||||
uncouple_channel( p_ac3dec, i );
|
||||
/* 2 */
|
||||
for ( j = 0; j < p_ac3dec->audblk.endmant[i]; j++ )
|
||||
{
|
||||
p_ac3dec->coeffs.fbw[i][j] = float_get( p_ac3dec, p_ac3dec->audblk.fbw_bap[i][j], p_ac3dec->audblk.fbw_exp[i][j] );
|
||||
}
|
||||
for ( j = p_ac3dec->audblk.cplstrtmant; j < p_ac3dec->audblk.cplendmant; j++ )
|
||||
{
|
||||
p_ac3dec->audblk.cplfbw[j] = float_get( p_ac3dec, p_ac3dec->audblk.cpl_bap[j], p_ac3dec->audblk.cpl_exp[j] );
|
||||
}
|
||||
uncouple_channel( p_ac3dec, i );
|
||||
|
||||
/* 3 */
|
||||
for ( i++; i < p_ac3dec->bsi.nfchans; i++ )
|
||||
{
|
||||
for ( j = 0; j < p_ac3dec->audblk.endmant[i]; j++ )
|
||||
{
|
||||
p_ac3dec->coeffs.fbw[i][j] = float_get( p_ac3dec, p_ac3dec->audblk.fbw_bap[i][j], p_ac3dec->audblk.fbw_exp[i][j] );
|
||||
}
|
||||
if ( p_ac3dec->audblk.chincpl[i] )
|
||||
{
|
||||
uncouple_channel( p_ac3dec, i );
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for ( i = 0; i < p_ac3dec->bsi.nfchans; i++ )
|
||||
{
|
||||
for ( j = 0; j < p_ac3dec->audblk.endmant[i]; j++ )
|
||||
{
|
||||
p_ac3dec->coeffs.fbw[i][j] = float_get( p_ac3dec, p_ac3dec->audblk.fbw_bap[i][j], p_ac3dec->audblk.fbw_exp[i][j] );
|
||||
}
|
||||
}
|
||||
}
|
||||
/* 3 */
|
||||
for ( i++; i < p_ac3dec->bsi.nfchans; i++ )
|
||||
{
|
||||
for ( j = 0; j < p_ac3dec->audblk.endmant[i]; j++ )
|
||||
{
|
||||
p_ac3dec->coeffs.fbw[i][j] = float_get( p_ac3dec, p_ac3dec->audblk.fbw_bap[i][j], p_ac3dec->audblk.fbw_exp[i][j] );
|
||||
}
|
||||
if ( p_ac3dec->audblk.chincpl[i] )
|
||||
{
|
||||
uncouple_channel( p_ac3dec, i );
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for ( i = 0; i < p_ac3dec->bsi.nfchans; i++ )
|
||||
{
|
||||
for ( j = 0; j < p_ac3dec->audblk.endmant[i]; j++ )
|
||||
{
|
||||
p_ac3dec->coeffs.fbw[i][j] = float_get( p_ac3dec, p_ac3dec->audblk.fbw_bap[i][j], p_ac3dec->audblk.fbw_exp[i][j] );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( p_ac3dec->bsi.lfeon )
|
||||
{
|
||||
/* There are always 7 mantissas for lfe, no dither for lfe */
|
||||
for ( j = 0; j < 7; j++ )
|
||||
{
|
||||
p_ac3dec->coeffs.lfe[j] = float_get( p_ac3dec, p_ac3dec->audblk.lfe_bap[j], p_ac3dec->audblk.lfe_exp[j] );
|
||||
}
|
||||
}
|
||||
if ( p_ac3dec->bsi.lfeon )
|
||||
{
|
||||
/* There are always 7 mantissas for lfe, no dither for lfe */
|
||||
for ( j = 0; j < 7; j++ )
|
||||
{
|
||||
p_ac3dec->coeffs.lfe[j] = float_get( p_ac3dec, p_ac3dec->audblk.lfe_bap[j], p_ac3dec->audblk.lfe_exp[j] );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -29,48 +29,48 @@
|
||||
|
||||
struct rematrix_band_s
|
||||
{
|
||||
u32 start;
|
||||
u32 end;
|
||||
u32 start;
|
||||
u32 end;
|
||||
};
|
||||
|
||||
static struct rematrix_band_s rematrix_band[] = { {13,24}, {25,36}, {37 ,60}, {61,252}};
|
||||
|
||||
static __inline__ u32 min( u32 a, u32 b )
|
||||
{
|
||||
return( a < b ? a : b );
|
||||
return( a < b ? a : b );
|
||||
}
|
||||
|
||||
/* This routine simply does stereo rematixing for the 2 channel
|
||||
* stereo mode */
|
||||
void rematrix( ac3dec_t * p_ac3dec )
|
||||
{
|
||||
u32 num_bands;
|
||||
u32 start;
|
||||
u32 end;
|
||||
u32 i,j;
|
||||
float left,right;
|
||||
u32 num_bands;
|
||||
u32 start;
|
||||
u32 end;
|
||||
u32 i,j;
|
||||
float left,right;
|
||||
|
||||
if(p_ac3dec->audblk.cplinu || p_ac3dec->audblk.cplbegf > 2)
|
||||
num_bands = 4;
|
||||
else if (p_ac3dec->audblk.cplbegf > 0)
|
||||
num_bands = 3;
|
||||
else
|
||||
num_bands = 2;
|
||||
if(p_ac3dec->audblk.cplinu || p_ac3dec->audblk.cplbegf > 2)
|
||||
num_bands = 4;
|
||||
else if (p_ac3dec->audblk.cplbegf > 0)
|
||||
num_bands = 3;
|
||||
else
|
||||
num_bands = 2;
|
||||
|
||||
for(i=0;i < num_bands; i++)
|
||||
{
|
||||
if(!p_ac3dec->audblk.rematflg[i])
|
||||
continue;
|
||||
for(i=0;i < num_bands; i++)
|
||||
{
|
||||
if(!p_ac3dec->audblk.rematflg[i])
|
||||
continue;
|
||||
|
||||
start = rematrix_band[i].start;
|
||||
end = min(rematrix_band[i].end ,12 * p_ac3dec->audblk.cplbegf + 36);
|
||||
|
||||
for(j=start;j < end; j++)
|
||||
{
|
||||
left = 0.5f * (p_ac3dec->coeffs.fbw[0][j] + p_ac3dec->coeffs.fbw[1][j]);
|
||||
right = 0.5f * (p_ac3dec->coeffs.fbw[0][j] - p_ac3dec->coeffs.fbw[1][j]);
|
||||
p_ac3dec->coeffs.fbw[0][j] = left;
|
||||
p_ac3dec->coeffs.fbw[1][j] = right;
|
||||
}
|
||||
}
|
||||
start = rematrix_band[i].start;
|
||||
end = min(rematrix_band[i].end ,12 * p_ac3dec->audblk.cplbegf + 36);
|
||||
|
||||
for(j=start;j < end; j++)
|
||||
{
|
||||
left = 0.5f * (p_ac3dec->coeffs.fbw[0][j] + p_ac3dec->coeffs.fbw[1][j]);
|
||||
right = 0.5f * (p_ac3dec->coeffs.fbw[0][j] - p_ac3dec->coeffs.fbw[1][j]);
|
||||
p_ac3dec->coeffs.fbw[0][j] = left;
|
||||
p_ac3dec->coeffs.fbw[1][j] = right;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -246,7 +246,7 @@
|
||||
/*54*/ 0.00000762939453, /*55*/ 0.00000605545445, /*56*/ 0.00000480621738,\
|
||||
/*57*/ 0.00000381469727, /*58*/ 0.00000302772723, /*59*/ 0.00000240310869,\
|
||||
/*60*/ 0.00000190734863, /*61*/ 0.00000151386361, /*62*/ 0.00000120155435,\
|
||||
/*63*/ 0.0 /* ?? invalid scale factor ?? */ \
|
||||
/*63*/ 0.0 /* XXX?? invalid scale factor ? */ \
|
||||
}
|
||||
|
||||
|
||||
|
@ -272,7 +272,9 @@ static __inline__ int adec_Layer2_Stereo( adec_thread_t * p_adec )
|
||||
s16 * p_s16;
|
||||
|
||||
int i_need = 0, i_dump = 0;
|
||||
// static const int pi_framesize[512] = ADEC_FRAME_SIZE;
|
||||
#if 0
|
||||
static const int pi_framesize[512] = ADEC_FRAME_SIZE;
|
||||
#endif
|
||||
|
||||
/* Read the audio frame header and flush the bit buffer */
|
||||
i_header = p_adec->bit_stream.fifo.buffer;
|
||||
@ -679,18 +681,20 @@ static __inline__ int adec_Layer2_Stereo( adec_thread_t * p_adec )
|
||||
NEXT_BUF
|
||||
READ_SAMPLE_L2S( pf_scalefactor_0_2, pf_scalefactor_1_2, 12 )
|
||||
|
||||
// fprintf(stderr, "adec debug: layer == %i, padding_bit == %i, sampling_frequency == %i, bitrate_index == %i\n",
|
||||
// (i_header & ADEC_HEADER_LAYER_MASK) >> ADEC_HEADER_LAYER_SHIFT,
|
||||
// (i_header & ADEC_HEADER_PADDING_BIT_MASK) >> ADEC_HEADER_PADDING_BIT_SHIFT,
|
||||
// (i_header & ADEC_HEADER_SAMPLING_FREQUENCY_MASK) >> ADEC_HEADER_SAMPLING_FREQUENCY_SHIFT,
|
||||
// (i_header & ADEC_HEADER_BITRATE_INDEX_MASK) >> ADEC_HEADER_BITRATE_INDEX_SHIFT);
|
||||
// fprintf(stderr, "adec debug: framesize == %i, i_need == %i, i_dump == %i\n",
|
||||
// pi_framesize[ 128 * ((i_header & ADEC_HEADER_LAYER_MASK) >> ADEC_HEADER_LAYER_SHIFT) +
|
||||
// 64 * ((i_header & ADEC_HEADER_PADDING_BIT_MASK) >> ADEC_HEADER_PADDING_BIT_SHIFT) +
|
||||
// 16 * ((i_header & ADEC_HEADER_SAMPLING_FREQUENCY_MASK) >> ADEC_HEADER_SAMPLING_FREQUENCY_SHIFT) +
|
||||
// 1 * ((i_header & ADEC_HEADER_BITRATE_INDEX_MASK) >> ADEC_HEADER_BITRATE_INDEX_SHIFT) ],
|
||||
// i_need,
|
||||
// i_dump);
|
||||
#if 0
|
||||
fprintf(stderr, "adec debug: layer == %i, padding_bit == %i, sampling_frequency == %i, bitrate_index == %i\n",
|
||||
(i_header & ADEC_HEADER_LAYER_MASK) >> ADEC_HEADER_LAYER_SHIFT,
|
||||
(i_header & ADEC_HEADER_PADDING_BIT_MASK) >> ADEC_HEADER_PADDING_BIT_SHIFT,
|
||||
(i_header & ADEC_HEADER_SAMPLING_FREQUENCY_MASK) >> ADEC_HEADER_SAMPLING_FREQUENCY_SHIFT,
|
||||
(i_header & ADEC_HEADER_BITRATE_INDEX_MASK) >> ADEC_HEADER_BITRATE_INDEX_SHIFT);
|
||||
fprintf(stderr, "adec debug: framesize == %i, i_need == %i, i_dump == %i\n",
|
||||
pi_framesize[ 128 * ((i_header & ADEC_HEADER_LAYER_MASK) >> ADEC_HEADER_LAYER_SHIFT) +
|
||||
64 * ((i_header & ADEC_HEADER_PADDING_BIT_MASK) >> ADEC_HEADER_PADDING_BIT_SHIFT) +
|
||||
16 * ((i_header & ADEC_HEADER_SAMPLING_FREQUENCY_MASK) >> ADEC_HEADER_SAMPLING_FREQUENCY_SHIFT) +
|
||||
1 * ((i_header & ADEC_HEADER_BITRATE_INDEX_MASK) >> ADEC_HEADER_BITRATE_INDEX_SHIFT) ],
|
||||
i_need,
|
||||
i_dump);
|
||||
#endif
|
||||
p_adec->bit_stream.fifo.buffer = 0;
|
||||
p_adec->bit_stream.fifo.i_available = 0;
|
||||
return( 6 );
|
||||
@ -796,10 +800,12 @@ static int InitThread( adec_thread_t * p_adec )
|
||||
*****************************************************************************/
|
||||
static void RunThread( adec_thread_t * p_adec )
|
||||
{
|
||||
// static const int pi_framesize[512] = ADEC_FRAME_SIZE;
|
||||
// int i_header;
|
||||
// int i_framesize;
|
||||
// int i_dummy;
|
||||
#if 0
|
||||
static const int pi_framesize[512] = ADEC_FRAME_SIZE;
|
||||
int i_header;
|
||||
int i_framesize;
|
||||
int i_dummy;
|
||||
#endif
|
||||
|
||||
intf_DbgMsg("adec debug: running audio decoder thread (%p) (pid == %i)\n", p_adec, getpid());
|
||||
|
||||
@ -840,27 +846,27 @@ static void RunThread( adec_thread_t * p_adec )
|
||||
/* Waiting until there is enough free space in the audio output fifo
|
||||
* in order to store the new decoded frames */
|
||||
vlc_mutex_lock( &p_adec->p_aout_fifo->data_lock );
|
||||
/* adec_Layer2_Stereo() produces 6 output frames (2*1152/384)...
|
||||
/* adec_Layer2_Stereo() produces 6 output frames (2*1152/384)...
|
||||
* If these 6 frames were recorded in the audio output fifo, the
|
||||
* l_end_frame index would be incremented 6 times. But, if after
|
||||
* this operation the audio output fifo contains less than 6 frames,
|
||||
* it would mean that we had not enough room to store the 6 frames :-P */
|
||||
while ( (((p_adec->p_aout_fifo->l_end_frame + 6) - p_adec->p_aout_fifo->l_start_frame) & AOUT_FIFO_SIZE) < 6 ) /* XXX */
|
||||
while ( (((p_adec->p_aout_fifo->l_end_frame + 6) - p_adec->p_aout_fifo->l_start_frame) & AOUT_FIFO_SIZE) < 6 ) /* XXX?? */
|
||||
{
|
||||
vlc_cond_wait( &p_adec->p_aout_fifo->data_wait, &p_adec->p_aout_fifo->data_lock );
|
||||
}
|
||||
if ( DECODER_FIFO_START(p_adec->fifo)->b_has_pts )
|
||||
{
|
||||
if ( DECODER_FIFO_START(p_adec->fifo)->b_has_pts )
|
||||
{
|
||||
p_adec->p_aout_fifo->date[p_adec->p_aout_fifo->l_end_frame] = DECODER_FIFO_START(p_adec->fifo)->i_pts;
|
||||
DECODER_FIFO_START(p_adec->fifo)->b_has_pts = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
p_adec->p_aout_fifo->date[p_adec->p_aout_fifo->l_end_frame] = LAST_MDATE;
|
||||
}
|
||||
}
|
||||
vlc_mutex_unlock( &p_adec->p_aout_fifo->data_lock );
|
||||
|
||||
/* Decoding the frames */
|
||||
/* Decoding the frames */
|
||||
if ( adec_Layer2_Stereo(p_adec) )
|
||||
{
|
||||
vlc_mutex_lock( &p_adec->p_aout_fifo->data_lock );
|
||||
@ -868,23 +874,23 @@ static void RunThread( adec_thread_t * p_adec )
|
||||
/* Frame 1 */
|
||||
p_adec->p_aout_fifo->l_end_frame = (p_adec->p_aout_fifo->l_end_frame + 1) & AOUT_FIFO_SIZE;
|
||||
|
||||
/* Frame 2 */
|
||||
/* Frame 2 */
|
||||
p_adec->p_aout_fifo->date[p_adec->p_aout_fifo->l_end_frame] = LAST_MDATE;
|
||||
p_adec->p_aout_fifo->l_end_frame = (p_adec->p_aout_fifo->l_end_frame + 1) & AOUT_FIFO_SIZE;
|
||||
|
||||
/* Frame 3 */
|
||||
/* Frame 3 */
|
||||
p_adec->p_aout_fifo->date[p_adec->p_aout_fifo->l_end_frame] = LAST_MDATE;
|
||||
p_adec->p_aout_fifo->l_end_frame = (p_adec->p_aout_fifo->l_end_frame + 1) & AOUT_FIFO_SIZE;
|
||||
|
||||
/* Frame 4 */
|
||||
/* Frame 4 */
|
||||
p_adec->p_aout_fifo->date[p_adec->p_aout_fifo->l_end_frame] = LAST_MDATE;
|
||||
p_adec->p_aout_fifo->l_end_frame = (p_adec->p_aout_fifo->l_end_frame + 1) & AOUT_FIFO_SIZE;
|
||||
|
||||
/* Frame 5 */
|
||||
/* Frame 5 */
|
||||
p_adec->p_aout_fifo->date[p_adec->p_aout_fifo->l_end_frame] = LAST_MDATE;
|
||||
p_adec->p_aout_fifo->l_end_frame = (p_adec->p_aout_fifo->l_end_frame + 1) & AOUT_FIFO_SIZE;
|
||||
|
||||
/* Frame 6 */
|
||||
/* Frame 6 */
|
||||
p_adec->p_aout_fifo->date[p_adec->p_aout_fifo->l_end_frame] = LAST_MDATE;
|
||||
p_adec->p_aout_fifo->l_end_frame = (p_adec->p_aout_fifo->l_end_frame + 1) & AOUT_FIFO_SIZE;
|
||||
|
||||
@ -947,7 +953,7 @@ static void ErrorThread( adec_thread_t *p_adec )
|
||||
while( !DECODER_FIFO_ISEMPTY(p_adec->fifo) )
|
||||
{
|
||||
input_NetlistFreePES( p_adec->bit_stream.p_input, DECODER_FIFO_START(p_adec->fifo) );
|
||||
DECODER_FIFO_INCSTART( p_adec->fifo );
|
||||
DECODER_FIFO_INCSTART( p_adec->fifo );
|
||||
}
|
||||
|
||||
/* Waiting for the input thread to put new PES packets in the fifo */
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -64,7 +64,9 @@ aout_thread_t *aout_CreateThread( int *pi_status )
|
||||
aout_thread_t * p_aout; /* thread descriptor */
|
||||
char * psz_method;
|
||||
char * psz_plugin;
|
||||
// int i_status; /* thread status */
|
||||
#if 0
|
||||
int i_status; /* thread status */
|
||||
#endif
|
||||
|
||||
/* Allocate descriptor */
|
||||
p_aout = (aout_thread_t *) malloc( sizeof(aout_thread_t) );
|
||||
@ -79,11 +81,11 @@ aout_thread_t *aout_CreateThread( int *pi_status )
|
||||
psz_plugin = malloc( sizeof("./audio_output/aout_.so") + strlen(psz_method) );
|
||||
sprintf( psz_plugin, "./audio_output/aout_%s.so", psz_method );
|
||||
|
||||
p_aout->p_aout_plugin = dlopen (psz_plugin, RTLD_LAZY);
|
||||
p_aout->p_aout_plugin = dlopen( psz_plugin, RTLD_NOW | RTLD_GLOBAL );
|
||||
|
||||
if( p_aout->p_aout_plugin == NULL )
|
||||
{
|
||||
intf_ErrMsg( "error: could not open audio plugin %s\n", psz_method );
|
||||
intf_ErrMsg( "error: could not open audio plugin %s\n", psz_plugin );
|
||||
free( psz_plugin );
|
||||
free( p_aout );
|
||||
return( NULL );
|
||||
@ -110,47 +112,47 @@ aout_thread_t *aout_CreateThread( int *pi_status )
|
||||
return( NULL );
|
||||
}
|
||||
|
||||
p_aout->b_stereo = ( p_aout->i_channels == 2 ) ? 1 : 0; /* XXX only works
|
||||
for i_channels == 1 or 2 */
|
||||
|
||||
p_aout->b_stereo = ( p_aout->i_channels == 2 ) ? 1 : 0; /* FIXME: only works
|
||||
for i_channels == 1 or 2 ??*/
|
||||
|
||||
if ( p_aout->p_sys_reset( p_aout ) )
|
||||
{
|
||||
p_aout->p_sys_close( p_aout );
|
||||
p_aout->p_sys_close( p_aout );
|
||||
dlclose( p_aout->p_aout_plugin );
|
||||
free( p_aout );
|
||||
return( NULL );
|
||||
free( p_aout );
|
||||
return( NULL );
|
||||
}
|
||||
if ( p_aout->p_sys_setformat( p_aout ) )
|
||||
{
|
||||
p_aout->p_sys_close( p_aout );
|
||||
p_aout->p_sys_close( p_aout );
|
||||
dlclose( p_aout->p_aout_plugin );
|
||||
free( p_aout );
|
||||
return( NULL );
|
||||
free( p_aout );
|
||||
return( NULL );
|
||||
}
|
||||
if ( p_aout->p_sys_setchannels( p_aout ) )
|
||||
{
|
||||
p_aout->p_sys_close( p_aout );
|
||||
p_aout->p_sys_close( p_aout );
|
||||
dlclose( p_aout->p_aout_plugin );
|
||||
free( p_aout );
|
||||
free( p_aout );
|
||||
return( NULL );
|
||||
}
|
||||
if ( p_aout->p_sys_setrate( p_aout ) )
|
||||
{
|
||||
p_aout->p_sys_close( p_aout );
|
||||
p_aout->p_sys_close( p_aout );
|
||||
dlclose( p_aout->p_aout_plugin );
|
||||
free( p_aout );
|
||||
return( NULL );
|
||||
free( p_aout );
|
||||
return( NULL );
|
||||
}
|
||||
|
||||
//?? maybe it would be cleaner to change SpawnThread prototype
|
||||
//?? see vout to handle status correctly - however, it is not critical since
|
||||
//?? this thread is only called in main and all calls are blocking
|
||||
/* FIXME: maybe it would be cleaner to change SpawnThread prototype
|
||||
* see vout to handle status correctly ?? however, it is not critical since
|
||||
* this thread is only called in main and all calls are blocking */
|
||||
if( aout_SpawnThread( p_aout ) )
|
||||
{
|
||||
p_aout->p_sys_close( p_aout );
|
||||
p_aout->p_sys_close( p_aout );
|
||||
dlclose( p_aout->p_aout_plugin );
|
||||
free( p_aout );
|
||||
return( NULL );
|
||||
free( p_aout );
|
||||
return( NULL );
|
||||
}
|
||||
|
||||
return( p_aout );
|
||||
@ -217,9 +219,9 @@ static int aout_SpawnThread( aout_thread_t * p_aout )
|
||||
break;
|
||||
|
||||
default:
|
||||
intf_ErrMsg("aout error: unknown audio output format (%i)\n",
|
||||
p_aout->i_format);
|
||||
return( -1 );
|
||||
intf_ErrMsg( "aout error: unknown audio output format (%i)\n",
|
||||
p_aout->i_format );
|
||||
return( -1 );
|
||||
}
|
||||
break;
|
||||
|
||||
@ -298,13 +300,13 @@ static int aout_SpawnThread( aout_thread_t * p_aout )
|
||||
*****************************************************************************/
|
||||
void aout_DestroyThread( aout_thread_t * p_aout, int *pi_status )
|
||||
{
|
||||
//???? pi_status is not handled correctly: check vout how to do!
|
||||
/* FIXME: pi_status is not handled correctly: check vout how to do!?? */
|
||||
|
||||
intf_DbgMsg("aout debug: requesting termination of audio output thread (%p)\n", p_aout);
|
||||
|
||||
/* Ask thread to kill itself and wait until it's done */
|
||||
p_aout->b_die = 1;
|
||||
vlc_thread_join( p_aout->thread_id ); // only if pi_status is NULL
|
||||
vlc_thread_join( p_aout->thread_id ); /* only if pi_status is NULL */
|
||||
|
||||
/* Free the allocated memory */
|
||||
free( p_aout->buffer );
|
||||
@ -335,7 +337,7 @@ aout_fifo_t * aout_CreateFifo( aout_thread_t * p_aout, aout_fifo_t * p_fifo )
|
||||
for ( i_fifo = 0; i_fifo < AOUT_MAX_FIFOS; i_fifo++ )
|
||||
{
|
||||
if ( p_aout->fifo[i_fifo].i_type == AOUT_EMPTY_FIFO)
|
||||
{
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -351,11 +353,11 @@ aout_fifo_t * aout_CreateFifo( aout_thread_t * p_aout, aout_fifo_t * p_fifo )
|
||||
{
|
||||
case AOUT_INTF_MONO_FIFO:
|
||||
case AOUT_INTF_STEREO_FIFO:
|
||||
p_aout->fifo[i_fifo].b_die = 0;
|
||||
p_aout->fifo[i_fifo].b_die = 0;
|
||||
|
||||
p_aout->fifo[i_fifo].i_channels = p_fifo->i_channels;
|
||||
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].i_channels = p_fifo->i_channels;
|
||||
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].buffer = p_fifo->buffer;
|
||||
|
||||
@ -369,21 +371,21 @@ aout_fifo_t * aout_CreateFifo( aout_thread_t * p_aout, aout_fifo_t * p_fifo )
|
||||
p_aout->fifo[i_fifo].b_die = 0;
|
||||
|
||||
p_aout->fifo[i_fifo].i_channels = p_fifo->i_channels;
|
||||
p_aout->fifo[i_fifo].b_stereo = p_fifo->b_stereo;
|
||||
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;
|
||||
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)*p_fifo->l_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;
|
||||
vlc_mutex_unlock( &p_aout->fifos_lock );
|
||||
return( NULL );
|
||||
}
|
||||
vlc_mutex_unlock( &p_aout->fifos_lock );
|
||||
return( NULL );
|
||||
}
|
||||
|
||||
/* Allocate the memory needed to store the dates of the frames */
|
||||
if ( (p_aout->fifo[i_fifo].date = (mtime_t *)malloc( sizeof(mtime_t)*(AOUT_FIFO_SIZE+1) )) == NULL )
|
||||
@ -486,7 +488,7 @@ static __inline__ int NextFrame( aout_thread_t * p_aout, aout_fifo_t * p_fifo, m
|
||||
{
|
||||
p_fifo->b_start_frame = 1;
|
||||
p_fifo->l_next_frame = (p_fifo->l_start_frame + 1) & AOUT_FIFO_SIZE;
|
||||
p_fifo->l_unit = p_fifo->l_start_frame * (p_fifo->l_frame_size >> (p_fifo->b_stereo));
|
||||
p_fifo->l_unit = p_fifo->l_start_frame * (p_fifo->l_frame_size >> (p_fifo->b_stereo));
|
||||
break;
|
||||
}
|
||||
p_fifo->l_start_frame = (p_fifo->l_start_frame + 1) & AOUT_FIFO_SIZE;
|
||||
@ -500,7 +502,7 @@ static __inline__ int NextFrame( aout_thread_t * p_aout, aout_fifo_t * p_fifo, m
|
||||
}
|
||||
|
||||
/* We are looking for the next dated frame */
|
||||
/* FIXME : is the output fifo full ? */
|
||||
/* FIXME : is the output fifo full ?? */
|
||||
while ( !p_fifo->b_next_frame )
|
||||
{
|
||||
while ( p_fifo->l_next_frame != p_fifo->l_end_frame )
|
||||
@ -567,18 +569,18 @@ void aout_Thread_U8_Stereo( aout_thread_t * p_aout )
|
||||
{
|
||||
vlc_mutex_lock( &p_aout->fifos_lock );
|
||||
for ( i_fifo = 0; i_fifo < AOUT_MAX_FIFOS; i_fifo++ )
|
||||
{
|
||||
{
|
||||
switch ( p_aout->fifo[i_fifo].i_type )
|
||||
{
|
||||
case AOUT_EMPTY_FIFO:
|
||||
{
|
||||
case AOUT_EMPTY_FIFO:
|
||||
break;
|
||||
|
||||
case AOUT_INTF_MONO_FIFO:
|
||||
case AOUT_INTF_MONO_FIFO:
|
||||
if ( p_aout->fifo[i_fifo].l_units > p_aout->l_units )
|
||||
{
|
||||
{
|
||||
l_buffer = 0;
|
||||
while ( l_buffer < (p_aout->l_units << 1) ) /* p_aout->b_stereo == 1 */
|
||||
{
|
||||
{
|
||||
p_aout->s32_buffer[l_buffer++] +=
|
||||
(s32)( ((s16 *)p_aout->fifo[i_fifo].buffer)[p_aout->fifo[i_fifo].l_unit] );
|
||||
p_aout->s32_buffer[l_buffer++] +=
|
||||
@ -588,10 +590,10 @@ void aout_Thread_U8_Stereo( aout_thread_t * p_aout )
|
||||
p_aout->fifo[i_fifo].l_units -= p_aout->l_units;
|
||||
}
|
||||
else
|
||||
{
|
||||
{
|
||||
l_buffer = 0;
|
||||
while ( l_buffer < (p_aout->fifo[i_fifo].l_units << 1) ) /* p_aout->b_stereo == 1 */
|
||||
{
|
||||
{
|
||||
p_aout->s32_buffer[l_buffer++] +=
|
||||
(s32)( ((s16 *)p_aout->fifo[i_fifo].buffer)[p_aout->fifo[i_fifo].l_unit] );
|
||||
p_aout->s32_buffer[l_buffer++] +=
|
||||
@ -606,10 +608,10 @@ void aout_Thread_U8_Stereo( aout_thread_t * p_aout )
|
||||
|
||||
case AOUT_INTF_STEREO_FIFO:
|
||||
if ( p_aout->fifo[i_fifo].l_units > p_aout->l_units )
|
||||
{
|
||||
{
|
||||
l_buffer = 0;
|
||||
while ( l_buffer < (p_aout->l_units << 1) ) /* p_aout->b_stereo == 1 */
|
||||
{
|
||||
{
|
||||
p_aout->s32_buffer[l_buffer++] +=
|
||||
(s32)( ((s16 *)p_aout->fifo[i_fifo].buffer)[2*p_aout->fifo[i_fifo].l_unit] );
|
||||
p_aout->s32_buffer[l_buffer++] +=
|
||||
@ -619,10 +621,10 @@ void aout_Thread_U8_Stereo( aout_thread_t * p_aout )
|
||||
p_aout->fifo[i_fifo].l_units -= p_aout->l_units;
|
||||
}
|
||||
else
|
||||
{
|
||||
{
|
||||
l_buffer = 0;
|
||||
while ( l_buffer < (p_aout->fifo[i_fifo].l_units << 1) ) /* p_aout->b_stereo == 1 */
|
||||
{
|
||||
{
|
||||
p_aout->s32_buffer[l_buffer++] +=
|
||||
(s32)( ((s16 *)p_aout->fifo[i_fifo].buffer)[2*p_aout->fifo[i_fifo].l_unit] );
|
||||
p_aout->s32_buffer[l_buffer++] +=
|
||||
@ -789,7 +791,7 @@ void aout_Thread_U8_Stereo( aout_thread_t * p_aout )
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
default:
|
||||
intf_DbgMsg("aout debug: unknown fifo type (%i)\n", p_aout->fifo[i_fifo].i_type);
|
||||
break;
|
||||
}
|
||||
@ -799,7 +801,7 @@ void aout_Thread_U8_Stereo( aout_thread_t * p_aout )
|
||||
l_buffer_limit = p_aout->l_units << 1 ; /* p_aout->b_stereo == 1 */
|
||||
|
||||
for ( l_buffer = 0; l_buffer < l_buffer_limit; l_buffer++ )
|
||||
{
|
||||
{
|
||||
((u8 *)p_aout->buffer)[l_buffer] = (u8)( (p_aout->s32_buffer[l_buffer] / 256) + 128 );
|
||||
p_aout->s32_buffer[l_buffer] = 0;
|
||||
}
|
||||
@ -853,8 +855,8 @@ void aout_Thread_S16_Stereo( aout_thread_t * p_aout )
|
||||
long l_buffer, l_buffer_limit;
|
||||
long l_units, l_bytes;
|
||||
|
||||
intf_DbgMsg("adec debug: ********aout_Thread_S16_Stereo********\n");
|
||||
intf_DbgMsg("adec debug: running audio output thread (%p) (pid == %i)\n", p_aout, getpid());
|
||||
intf_DbgMsg("adec debug: ********aout_Thread_S16_Stereo********\n");
|
||||
intf_DbgMsg("adec debug: running audio output thread (%p) (pid == %i)\n", p_aout, getpid());
|
||||
|
||||
/* As the s32_buffer was created with calloc(), we don't have to set this
|
||||
* memory to zero and we can immediately jump into the thread's loop */
|
||||
@ -862,18 +864,18 @@ void aout_Thread_S16_Stereo( aout_thread_t * p_aout )
|
||||
{
|
||||
vlc_mutex_lock( &p_aout->fifos_lock );
|
||||
for ( i_fifo = 0; i_fifo < AOUT_MAX_FIFOS; i_fifo++ )
|
||||
{
|
||||
{
|
||||
switch ( p_aout->fifo[i_fifo].i_type )
|
||||
{
|
||||
case AOUT_EMPTY_FIFO:
|
||||
{
|
||||
case AOUT_EMPTY_FIFO:
|
||||
break;
|
||||
|
||||
case AOUT_INTF_MONO_FIFO:
|
||||
case AOUT_INTF_MONO_FIFO:
|
||||
if ( p_aout->fifo[i_fifo].l_units > p_aout->l_units )
|
||||
{
|
||||
{
|
||||
l_buffer = 0;
|
||||
while ( l_buffer < (p_aout->l_units << 1) ) /* p_aout->b_stereo == 1 */
|
||||
{
|
||||
{
|
||||
p_aout->s32_buffer[l_buffer++] +=
|
||||
(s32)( ((s16 *)p_aout->fifo[i_fifo].buffer)[p_aout->fifo[i_fifo].l_unit] );
|
||||
p_aout->s32_buffer[l_buffer++] +=
|
||||
@ -883,10 +885,10 @@ void aout_Thread_S16_Stereo( aout_thread_t * p_aout )
|
||||
p_aout->fifo[i_fifo].l_units -= p_aout->l_units;
|
||||
}
|
||||
else
|
||||
{
|
||||
{
|
||||
l_buffer = 0;
|
||||
while ( l_buffer < (p_aout->fifo[i_fifo].l_units << 1) ) /* p_aout->b_stereo == 1 */
|
||||
{
|
||||
{
|
||||
p_aout->s32_buffer[l_buffer++] +=
|
||||
(s32)( ((s16 *)p_aout->fifo[i_fifo].buffer)[p_aout->fifo[i_fifo].l_unit] );
|
||||
p_aout->s32_buffer[l_buffer++] +=
|
||||
@ -901,10 +903,10 @@ void aout_Thread_S16_Stereo( aout_thread_t * p_aout )
|
||||
|
||||
case AOUT_INTF_STEREO_FIFO:
|
||||
if ( p_aout->fifo[i_fifo].l_units > p_aout->l_units )
|
||||
{
|
||||
{
|
||||
l_buffer = 0;
|
||||
while ( l_buffer < (p_aout->l_units << 1) ) /* p_aout->b_stereo == 1 */
|
||||
{
|
||||
{
|
||||
p_aout->s32_buffer[l_buffer++] +=
|
||||
(s32)( ((s16 *)p_aout->fifo[i_fifo].buffer)[2*p_aout->fifo[i_fifo].l_unit] );
|
||||
p_aout->s32_buffer[l_buffer++] +=
|
||||
@ -914,10 +916,10 @@ void aout_Thread_S16_Stereo( aout_thread_t * p_aout )
|
||||
p_aout->fifo[i_fifo].l_units -= p_aout->l_units;
|
||||
}
|
||||
else
|
||||
{
|
||||
{
|
||||
l_buffer = 0;
|
||||
while ( l_buffer < (p_aout->fifo[i_fifo].l_units << 1) ) /* p_aout->b_stereo == 1 */
|
||||
{
|
||||
{
|
||||
p_aout->s32_buffer[l_buffer++] +=
|
||||
(s32)( ((s16 *)p_aout->fifo[i_fifo].buffer)[2*p_aout->fifo[i_fifo].l_unit] );
|
||||
p_aout->s32_buffer[l_buffer++] +=
|
||||
@ -1084,7 +1086,7 @@ void aout_Thread_S16_Stereo( aout_thread_t * p_aout )
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
default:
|
||||
intf_DbgMsg("aout debug: unknown fifo type (%i)\n", p_aout->fifo[i_fifo].i_type);
|
||||
break;
|
||||
}
|
||||
@ -1094,7 +1096,7 @@ void aout_Thread_S16_Stereo( aout_thread_t * p_aout )
|
||||
l_buffer_limit = p_aout->l_units << 1; /* p_aout->b_stereo == 1 */
|
||||
|
||||
for ( l_buffer = 0; l_buffer < l_buffer_limit; l_buffer++ )
|
||||
{
|
||||
{
|
||||
((s16 *)p_aout->buffer)[l_buffer] = (s16)( p_aout->s32_buffer[l_buffer] / AOUT_MAX_FIFOS );
|
||||
p_aout->s32_buffer[l_buffer] = 0;
|
||||
}
|
||||
|
@ -65,7 +65,7 @@ static void PrintPES ( pes_packet_t *p_pes, int i_stream_id );
|
||||
* to its description. On error, it returns NULL.
|
||||
* Following configuration properties are used:
|
||||
* GDEC_CFG_ACTIONS (required)
|
||||
* ??
|
||||
* XXX??
|
||||
*****************************************************************************/
|
||||
gdec_thread_t * gdec_CreateThread( gdec_cfg_t *p_cfg, input_thread_t *p_input,
|
||||
int *pi_status )
|
||||
@ -90,7 +90,7 @@ gdec_thread_t * gdec_CreateThread( gdec_cfg_t *p_cfg, input_thread_t *p_input,
|
||||
|
||||
/* Copy configuration */
|
||||
p_gdec->i_actions = p_cfg->i_actions;
|
||||
/* ?? */
|
||||
/* XXX?? */
|
||||
|
||||
/* Set status */
|
||||
p_gdec->pi_status = (pi_status != NULL) ? pi_status : &i_status;
|
||||
@ -194,7 +194,7 @@ static int CheckConfiguration( gdec_cfg_t *p_cfg )
|
||||
*****************************************************************************/
|
||||
static int InitThread( gdec_thread_t *p_gdec )
|
||||
{
|
||||
/* ?? */
|
||||
/* XXX?? */
|
||||
|
||||
/* Update status */
|
||||
*p_gdec->pi_status = THREAD_START;
|
||||
@ -239,8 +239,8 @@ static void RunThread( gdec_thread_t *p_gdec )
|
||||
*/
|
||||
while( (!p_gdec->b_die) && (!p_gdec->b_error) )
|
||||
{
|
||||
/* ?? locks à rajouter ? - vérifier les macros (transformer en inline ?) */
|
||||
/* ?? on idle loop, increment c_idle_loops */
|
||||
/* FIXME: locks à rajouter ?? - vérifier les macros (transformer en inline ?) */
|
||||
/* on idle loop, increment c_idle_loops */
|
||||
while( !DECODER_FIFO_ISEMPTY( p_gdec->fifo ) )
|
||||
{
|
||||
p_pes = DECODER_FIFO_START( p_gdec->fifo );
|
||||
@ -262,13 +262,13 @@ static void RunThread( gdec_thread_t *p_gdec )
|
||||
/* PES multiplexed stream saving */
|
||||
if( p_gdec->i_actions & GDEC_SAVE )
|
||||
{
|
||||
/* ?? */
|
||||
/* XXX?? */
|
||||
}
|
||||
|
||||
/* PES demultiplexed stream saving */
|
||||
if( p_gdec->i_actions & GDEC_SAVE_DEMUX )
|
||||
{
|
||||
/* ?? */
|
||||
/* XXX?? */
|
||||
}
|
||||
|
||||
/* PES information printing */
|
||||
@ -344,7 +344,7 @@ static void EndThread( gdec_thread_t *p_gdec )
|
||||
|
||||
#ifdef DEBUG
|
||||
/* Check for remaining PES packets */
|
||||
/* ?? */
|
||||
/* XXX?? */
|
||||
#endif
|
||||
|
||||
/* Destroy thread structures allocated by InitThread */
|
||||
@ -372,7 +372,7 @@ static void IdentifyPES( gdec_thread_t *p_gdec, pes_packet_t *p_pes, int i_strea
|
||||
case INPUT_METHOD_TS_UCAST:
|
||||
case INPUT_METHOD_TS_BCAST:
|
||||
case INPUT_METHOD_TS_VLAN_BCAST:
|
||||
/* ?? since PID is extracted by demux, it could be usefull to store it
|
||||
/* XXX?? since PID is extracted by demux, it could be usefull to store it
|
||||
* in a readable place, i.e. the TS packet descriptor, rather than to
|
||||
* re-extract it now */
|
||||
i_id = U16_AT(&p_pes->p_first_ts->buffer[1]) & 0x1fff;
|
||||
@ -419,7 +419,7 @@ static void IdentifyPES( gdec_thread_t *p_gdec, pes_packet_t *p_pes, int i_strea
|
||||
}
|
||||
|
||||
/* Update ES table */
|
||||
/* ?? */
|
||||
/* XXX?? */
|
||||
}
|
||||
|
||||
/*****************************************************************************
|
||||
|
@ -9,7 +9,7 @@
|
||||
* "vlc_thread.h"
|
||||
* "input.h"
|
||||
* "decoder_fifo.h"
|
||||
* ??
|
||||
* XXX??
|
||||
*****************************************************************************/
|
||||
|
||||
/*****************************************************************************
|
||||
@ -50,13 +50,13 @@ typedef struct gdec_thread_s
|
||||
input_thread_t * p_input; /* input thread */
|
||||
decoder_fifo_t fifo; /* PES input fifo */
|
||||
|
||||
/* ?? status info */
|
||||
/* XXX?? status info */
|
||||
int * pi_status;
|
||||
|
||||
|
||||
/* Files array - these files are used to extract ES streams from a
|
||||
* demultiplexed stream */
|
||||
/* ?? */
|
||||
/* XXX?? */
|
||||
|
||||
#ifdef STATS
|
||||
/* Statistics */
|
||||
@ -83,7 +83,7 @@ gdec_thread_t * gdec_CreateThread ( gdec_cfg_t *p_cfg,
|
||||
void gdec_DestroyThread ( gdec_thread_t *p_gdec, int *pi_status );
|
||||
|
||||
/* Time management functions */
|
||||
/* ?? */
|
||||
/* XXX?? */
|
||||
|
||||
/* Dynamic thread settings */
|
||||
/* ?? */
|
||||
/* XXX?? */
|
||||
|
@ -264,7 +264,7 @@ void input_DestroyThread( input_thread_t *p_input, int *pi_status )
|
||||
*****************************************************************************/
|
||||
int input_OpenAudioStream( input_thread_t *p_input, int i_id )
|
||||
{
|
||||
/* ?? */
|
||||
/* XXX?? */
|
||||
}
|
||||
|
||||
/*****************************************************************************
|
||||
@ -274,7 +274,7 @@ int input_OpenAudioStream( input_thread_t *p_input, int i_id )
|
||||
*****************************************************************************/
|
||||
void input_CloseAudioStream( input_thread_t *p_input, int i_id )
|
||||
{
|
||||
/* ?? */
|
||||
/* XXX?? */
|
||||
}
|
||||
|
||||
/*****************************************************************************
|
||||
@ -285,7 +285,7 @@ void input_CloseAudioStream( input_thread_t *p_input, int i_id )
|
||||
int input_OpenVideoStream( input_thread_t *p_input,
|
||||
struct vout_thread_s *p_vout, struct video_cfg_s * p_cfg )
|
||||
{
|
||||
/* ?? */
|
||||
/* XXX?? */
|
||||
}
|
||||
|
||||
/*****************************************************************************
|
||||
@ -295,7 +295,7 @@ int input_OpenVideoStream( input_thread_t *p_input,
|
||||
*****************************************************************************/
|
||||
void input_CloseVideoStream( input_thread_t *p_input, int i_id )
|
||||
{
|
||||
/* ?? */
|
||||
/* XXX?? */
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -343,7 +343,7 @@ static void RunThread( input_thread_t *p_input )
|
||||
/* Scatter read the UDP packet from the network or the file. */
|
||||
if( (input_ReadPacket( p_input )) == (-1) )
|
||||
{
|
||||
/* ??? Normally, a thread can't kill itself, but we don't have
|
||||
/* FIXME??: Normally, a thread can't kill itself, but we don't have
|
||||
* any method in case of an error condition ... */
|
||||
p_input->b_error = 1;
|
||||
}
|
||||
@ -489,7 +489,7 @@ static __inline__ int input_ReadPacket( input_thread_t *p_input )
|
||||
if( ((p_input->netlist.i_ts_end -1 - p_input->netlist.i_ts_start) & INPUT_MAX_TS) <= INPUT_TS_READ_ONCE )
|
||||
{
|
||||
intf_ErrMsg("input error: TS netlist is empty !\n");
|
||||
return( -1 );
|
||||
return( -1 );
|
||||
}
|
||||
#endif /* FIFO netlist */
|
||||
|
||||
@ -499,10 +499,12 @@ static __inline__ int input_ReadPacket( input_thread_t *p_input )
|
||||
INPUT_TS_READ_ONCE );
|
||||
if( i_packet_size == (-1) )
|
||||
{
|
||||
// intf_DbgMsg("Read packet %d %p %d %d\n", i_base_index,
|
||||
// &p_input->netlist.p_ts_free[i_base_index],
|
||||
// p_input->netlist.i_ts_start,
|
||||
// p_input->netlist.i_ts_end);
|
||||
#if 0
|
||||
intf_DbgMsg("Read packet %d %p %d %d\n", i_base_index,
|
||||
&p_input->netlist.p_ts_free[i_base_index],
|
||||
p_input->netlist.i_ts_start,
|
||||
p_input->netlist.i_ts_end);
|
||||
#endif
|
||||
intf_ErrMsg("input error: readv() failed (%s)\n", strerror(errno));
|
||||
return( -1 );
|
||||
}
|
||||
@ -614,13 +616,13 @@ static __inline__ void input_SortPacket( input_thread_t *p_input,
|
||||
purposes (see man page). */
|
||||
i_current_pid = U16_AT(&p_ts_packet->buffer[1]) & 0x1fff;
|
||||
|
||||
// intf_DbgMsg("input debug: pid %d received (%p)\n",
|
||||
// i_current_pid, p_ts_packet);
|
||||
//intf_DbgMsg("input debug: pid %d received (%p)\n",
|
||||
// i_current_pid, p_ts_packet);
|
||||
|
||||
/* Lock current ES state. */
|
||||
vlc_mutex_lock( &p_input->es_lock );
|
||||
|
||||
/* Verify that we actually want this PID. */
|
||||
/* Verify that we actually want this PID. */
|
||||
for( i_es_loop = 0; i_es_loop < INPUT_MAX_SELECTED_ES; i_es_loop++ )
|
||||
{
|
||||
if( p_input->pp_selected_es[i_es_loop] != NULL)
|
||||
@ -639,7 +641,7 @@ static __inline__ void input_SortPacket( input_thread_t *p_input,
|
||||
input_DemuxTS( p_input, p_ts_packet,
|
||||
p_input->pp_selected_es[i_es_loop] );
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -652,8 +654,8 @@ static __inline__ void input_SortPacket( input_thread_t *p_input,
|
||||
|
||||
/* We weren't interested in receiving this packet. Give it back to the
|
||||
netlist. */
|
||||
// intf_DbgMsg("SortPacket: freeing unwanted TS %p (pid %d)\n", p_ts_packet,
|
||||
// U16_AT(&p_ts_packet->buffer[1]) & 0x1fff);
|
||||
//intf_DbgMsg("SortPacket: freeing unwanted TS %p (pid %d)\n", p_ts_packet,
|
||||
// U16_AT(&p_ts_packet->buffer[1]) & 0x1fff);
|
||||
input_NetlistFreeTS( p_input, p_ts_packet );
|
||||
#ifdef STATS
|
||||
p_input->c_packets_trashed++;
|
||||
@ -682,8 +684,8 @@ static __inline__ void input_DemuxTS( input_thread_t *p_input,
|
||||
|
||||
#define p (p_ts_packet->buffer)
|
||||
|
||||
// intf_DbgMsg("input debug: TS-demultiplexing packet %p, pid %d, number %d\n",
|
||||
// p_ts_packet, U16_AT(&p[1]) & 0x1fff, p[3] & 0x0f);
|
||||
//intf_DbgMsg("input debug: TS-demultiplexing packet %p, pid %d, number %d\n",
|
||||
// p_ts_packet, U16_AT(&p[1]) & 0x1fff, p[3] & 0x0f);
|
||||
|
||||
#ifdef STATS
|
||||
p_es_descriptor->c_packets++;
|
||||
@ -713,7 +715,7 @@ static __inline__ void input_DemuxTS( input_thread_t *p_input,
|
||||
{
|
||||
/* If the packet has both adaptation_field and payload, adaptation_field
|
||||
cannot be more than 182 bytes long; if there is only an
|
||||
adaptation_field, it must fill the next 183 bytes. */
|
||||
adaptation_field, it must fill the next 183 bytes. */
|
||||
if( b_payload ? (p[4] > 182) : (p[4] != 183) )
|
||||
{
|
||||
intf_DbgMsg("input debug: invalid TS adaptation field (%p)\n",
|
||||
@ -739,7 +741,7 @@ static __inline__ void input_DemuxTS( input_thread_t *p_input,
|
||||
p_es_descriptor->b_discontinuity = 1;
|
||||
|
||||
/* There also may be a continuity_counter discontinuity:
|
||||
resynchronise our counter with the one of the stream */
|
||||
resynchronise our counter with the one of the stream */
|
||||
p_es_descriptor->i_continuity_counter = (p[3] & 0x0f) - 1;
|
||||
}
|
||||
|
||||
@ -747,11 +749,11 @@ static __inline__ void input_DemuxTS( input_thread_t *p_input,
|
||||
p_es_descriptor->b_random |= p[5] & 0x40;
|
||||
|
||||
/* If this is a PCR_PID, and this TS packet contains a PCR,
|
||||
we pass it along to the PCR decoder. */
|
||||
we pass it along to the PCR decoder. */
|
||||
if( (p_es_descriptor->b_pcr) && (p[5] & 0x10) )
|
||||
{
|
||||
/* There should be a PCR field in the packet, check if the
|
||||
adaption field is long enough to carry it */
|
||||
adaption field is long enough to carry it */
|
||||
if( p[4] >= 7 )
|
||||
{
|
||||
/* Call the PCR decoder */
|
||||
@ -864,7 +866,7 @@ static __inline__ void input_DemuxPES( input_thread_t *p_input,
|
||||
ASSERT(p_ts_packet);
|
||||
ASSERT(p_es_descriptor);
|
||||
|
||||
// intf_DbgMsg("PES-demultiplexing %p (%p)\n", p_ts_packet, p_pes);
|
||||
//intf_DbgMsg("PES-demultiplexing %p (%p)\n", p_ts_packet, p_pes);
|
||||
|
||||
/* If we lost data, discard the PES packet we are trying to reassemble
|
||||
if any and wait for the beginning of a new one in order to synchronise
|
||||
@ -881,7 +883,7 @@ static __inline__ void input_DemuxPES( input_thread_t *p_input,
|
||||
so parse its header and give it to the decoders */
|
||||
if( b_unit_start && p_pes != NULL )
|
||||
{
|
||||
// intf_DbgMsg("End of PES packet %p\n", p_pes);
|
||||
//intf_DbgMsg("End of PES packet %p\n", p_pes);
|
||||
|
||||
/* Parse the header. The header has a variable length, but in order
|
||||
to improve the algorithm, we will read the 14 bytes we may be
|
||||
@ -905,7 +907,7 @@ static __inline__ void input_DemuxPES( input_thread_t *p_input,
|
||||
intf_DbgMsg("Code never tested encountered, WARNING ! (benny)\n");
|
||||
if( !p_pes->p_pes_header_save )
|
||||
{
|
||||
p_pes->p_pes_header_save = malloc(PES_HEADER_SIZE);
|
||||
p_pes->p_pes_header_save = malloc(PES_HEADER_SIZE);
|
||||
}
|
||||
|
||||
do
|
||||
@ -925,7 +927,7 @@ static __inline__ void input_DemuxPES( input_thread_t *p_input,
|
||||
intf_DbgMsg("PES packet too short: trashed\n");
|
||||
input_NetlistFreePES( p_input, p_pes );
|
||||
p_pes = NULL;
|
||||
/* Stats ?? */
|
||||
/* Stats XXX?? */
|
||||
return;
|
||||
}
|
||||
|
||||
@ -960,7 +962,7 @@ static __inline__ void input_DemuxPES( input_thread_t *p_input,
|
||||
intf_DbgMsg("Corrupted PES packet received: trashed\n");
|
||||
input_NetlistFreePES( p_input, p_pes );
|
||||
p_pes = NULL;
|
||||
/* Stats ?? */
|
||||
/* Stats XXX?? */
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1052,7 +1054,7 @@ static __inline__ void input_DemuxPES( input_thread_t *p_input,
|
||||
/* This last packet is partly header, partly payload. */
|
||||
p_ts->i_payload_start += i_pes_header_size;
|
||||
|
||||
|
||||
|
||||
/* Now we can eventually put the PES packet in the decoder's
|
||||
PES fifo */
|
||||
switch( p_es_descriptor->i_type )
|
||||
@ -1105,10 +1107,10 @@ static __inline__ void input_DemuxPES( input_thread_t *p_input,
|
||||
intf_DbgMsg("PES trashed - fifo full ! (%d, %d)\n",
|
||||
p_es_descriptor->i_id, p_es_descriptor->i_type);
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
// intf_DbgMsg("Putting %p into fifo %p/%d\n",
|
||||
// p_pes, p_fifo, p_fifo->i_end);
|
||||
//intf_DbgMsg("Putting %p into fifo %p/%d\n",
|
||||
// p_pes, p_fifo, p_fifo->i_end);
|
||||
p_fifo->buffer[p_fifo->i_end] = p_pes;
|
||||
DECODER_FIFO_INCEND( *p_fifo );
|
||||
|
||||
@ -1146,7 +1148,7 @@ static __inline__ void input_DemuxPES( input_thread_t *p_input,
|
||||
}
|
||||
else
|
||||
{
|
||||
// intf_DbgMsg("New PES packet %p (first TS: %p)\n", p_pes, p_ts_packet);
|
||||
//intf_DbgMsg("New PES packet %p (first TS: %p)\n", p_pes, p_ts_packet);
|
||||
|
||||
/* Init the PES fields so that the first TS packet could be correctly
|
||||
added to the PES packet (see below) */
|
||||
@ -1171,7 +1173,7 @@ static __inline__ void input_DemuxPES( input_thread_t *p_input,
|
||||
packet */
|
||||
if( p_pes != NULL )
|
||||
{
|
||||
// intf_DbgMsg("Adding TS %p to PES %p\n", p_ts_packet, p_pes);
|
||||
//intf_DbgMsg("Adding TS %p to PES %p\n", p_ts_packet, p_pes);
|
||||
|
||||
/* Size of the payload carried in the TS packet */
|
||||
i_ts_payload_size = p_ts_packet->i_payload_end -
|
||||
@ -1203,7 +1205,7 @@ static __inline__ void input_DemuxPES( input_thread_t *p_input,
|
||||
{
|
||||
/* Since we don't use the TS packet to build a PES packet, we don't
|
||||
need it anymore, so give it back to the netlist */
|
||||
// intf_DbgMsg("Trashing TS %p: no PES being build\n", p_ts_packet);
|
||||
//intf_DbgMsg("Trashing TS %p: no PES being build\n", p_ts_packet);
|
||||
input_NetlistFreeTS( p_input, p_ts_packet );
|
||||
}
|
||||
|
||||
@ -1217,7 +1219,7 @@ static __inline__ void input_DemuxPES( input_thread_t *p_input,
|
||||
* input_DemuxPSI:
|
||||
*****************************************************************************
|
||||
* Notice that current ES state has been locked by input_SortPacket. (No more true,
|
||||
* changed by benny - See if it's ok, and definitely change the code ???????? )
|
||||
* changed by benny - FIXME: See if it's ok, and definitely change the code ?? )
|
||||
*****************************************************************************/
|
||||
static __inline__ void input_DemuxPSI( input_thread_t *p_input,
|
||||
ts_packet_t *p_ts_packet,
|
||||
@ -1234,9 +1236,9 @@ static __inline__ void input_DemuxPSI( input_thread_t *p_input,
|
||||
|
||||
#define p_psi (p_es_descriptor->p_psi_section)
|
||||
|
||||
// intf_DbgMsg( "input debug: PSI demultiplexing %p (%p)\n", p_ts_packet, p_input);
|
||||
//intf_DbgMsg( "input debug: PSI demultiplexing %p (%p)\n", p_ts_packet, p_input);
|
||||
|
||||
// intf_DbgMsg( "Packet: %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x (unit start: %d)\n", p_ts_packet->buffer[p_ts_packet->i_payload_start], p_ts_packet->buffer[p_ts_packet->i_payload_start+1], p_ts_packet->buffer[p_ts_packet->i_payload_start+2], p_ts_packet->buffer[p_ts_packet->i_payload_start+3], p_ts_packet->buffer[p_ts_packet->i_payload_start+4], p_ts_packet->buffer[p_ts_packet->i_payload_start+5], p_ts_packet->buffer[p_ts_packet->i_payload_start+6], p_ts_packet->buffer[p_ts_packet->i_payload_start+7], p_ts_packet->buffer[p_ts_packet->i_payload_start+8], p_ts_packet->buffer[p_ts_packet->i_payload_start+9], p_ts_packet->buffer[p_ts_packet->i_payload_start+10], p_ts_packet->buffer[p_ts_packet->i_payload_start+11], p_ts_packet->buffer[p_ts_packet->i_payload_start+12], p_ts_packet->buffer[p_ts_packet->i_payload_start+13], p_ts_packet->buffer[p_ts_packet->i_payload_start+14], p_ts_packet->buffer[p_ts_packet->i_payload_start+15], p_ts_packet->buffer[p_ts_packet->i_payload_start+16], p_ts_packet->buffer[p_ts_packet->i_payload_start+17], p_ts_packet->buffer[p_ts_packet->i_payload_start+18], p_ts_packet->buffer[p_ts_packet->i_payload_start+19], p_ts_packet->buffer[p_ts_packet->i_payload_start+20], b_unit_start);
|
||||
//intf_DbgMsg( "Packet: %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x %x (unit start: %d)\n", p_ts_packet->buffer[p_ts_packet->i_payload_start], p_ts_packet->buffer[p_ts_packet->i_payload_start+1], p_ts_packet->buffer[p_ts_packet->i_payload_start+2], p_ts_packet->buffer[p_ts_packet->i_payload_start+3], p_ts_packet->buffer[p_ts_packet->i_payload_start+4], p_ts_packet->buffer[p_ts_packet->i_payload_start+5], p_ts_packet->buffer[p_ts_packet->i_payload_start+6], p_ts_packet->buffer[p_ts_packet->i_payload_start+7], p_ts_packet->buffer[p_ts_packet->i_payload_start+8], p_ts_packet->buffer[p_ts_packet->i_payload_start+9], p_ts_packet->buffer[p_ts_packet->i_payload_start+10], p_ts_packet->buffer[p_ts_packet->i_payload_start+11], p_ts_packet->buffer[p_ts_packet->i_payload_start+12], p_ts_packet->buffer[p_ts_packet->i_payload_start+13], p_ts_packet->buffer[p_ts_packet->i_payload_start+14], p_ts_packet->buffer[p_ts_packet->i_payload_start+15], p_ts_packet->buffer[p_ts_packet->i_payload_start+16], p_ts_packet->buffer[p_ts_packet->i_payload_start+17], p_ts_packet->buffer[p_ts_packet->i_payload_start+18], p_ts_packet->buffer[p_ts_packet->i_payload_start+19], p_ts_packet->buffer[p_ts_packet->i_payload_start+20], b_unit_start);
|
||||
|
||||
|
||||
/* Try to find the beginning of the payload in the packet to initialise
|
||||
@ -1264,7 +1266,7 @@ static __inline__ void input_DemuxPSI( input_thread_t *p_input,
|
||||
/* ...Unless there is a pointer field, that we have to bypass */
|
||||
if( b_unit_start )
|
||||
i_data_offset++;
|
||||
// intf_DbgMsg( "New part of the section received at offset %d\n", i_data_offset );
|
||||
//intf_DbgMsg( "New part of the section received at offset %d\n", i_data_offset );
|
||||
}
|
||||
}
|
||||
/* We are looking for the beginning of a new section */
|
||||
@ -1278,7 +1280,7 @@ static __inline__ void input_DemuxPSI( input_thread_t *p_input,
|
||||
the pointer field */
|
||||
i_data_offset = p_ts_packet->i_payload_start +
|
||||
p_ts_packet->buffer[p_ts_packet->i_payload_start] + 1;
|
||||
// intf_DbgMsg( "New section beginning at offset %d in TS packet\n", i_data_offset );
|
||||
//intf_DbgMsg( "New section beginning at offset %d in TS packet\n", i_data_offset );
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1306,7 +1308,7 @@ static __inline__ void input_DemuxPSI( input_thread_t *p_input,
|
||||
{
|
||||
/* Read the length of the new section */
|
||||
p_psi->i_length = (U16_AT(&p_ts_packet->buffer[i_data_offset+1]) & 0xFFF) + 3;
|
||||
// intf_DbgMsg( "Section length %d\n", p_psi->i_length );
|
||||
//intf_DbgMsg( "Section length %d\n", p_psi->i_length );
|
||||
if( p_psi->i_length > PSI_SECTION_SIZE )
|
||||
{
|
||||
/* The TS packet is corrupted, stop here to avoid possible a seg fault */
|
||||
@ -1337,7 +1339,7 @@ static __inline__ void input_DemuxPSI( input_thread_t *p_input,
|
||||
if (p_psi->i_length == p_psi->i_current_position + i_data_length)
|
||||
{
|
||||
/* Packet is complete, decode it */
|
||||
// intf_DbgMsg( "SECTION COMPLETE: starting decoding of its data\n" );
|
||||
//intf_DbgMsg( "SECTION COMPLETE: starting decoding of its data\n" );
|
||||
input_PsiDecode( p_input, p_psi );
|
||||
|
||||
/* Prepare the buffer to receive a new section */
|
||||
@ -1351,11 +1353,11 @@ static __inline__ void input_DemuxPSI( input_thread_t *p_input,
|
||||
{
|
||||
/* Prepare the buffer to receive the next part of the section */
|
||||
p_psi->i_current_position += i_data_length;
|
||||
// intf_DbgMsg( "Section not complete, waiting for the end\n" );
|
||||
//intf_DbgMsg( "Section not complete, waiting for the end\n" );
|
||||
}
|
||||
|
||||
// intf_DbgMsg( "Must loop ? Next data offset: %d, stuffing: %d\n",
|
||||
// i_data_offset, p_ts_packet->buffer[i_data_offset] );
|
||||
//intf_DbgMsg( "Must loop ? Next data offset: %d, stuffing: %d\n",
|
||||
// i_data_offset, p_ts_packet->buffer[i_data_offset] );
|
||||
}
|
||||
|
||||
/* Relase the TS packet, we don't need it anymore */
|
||||
|
@ -173,7 +173,7 @@ int input_AddPgrmElem( input_thread_t *p_input, int i_current_id )
|
||||
p_input->p_es[i_es_loop].p_pes_packet = NULL;
|
||||
p_input->p_es[i_es_loop].i_continuity_counter = 0xff;
|
||||
p_input->p_es[i_es_loop].b_random = 0;
|
||||
|
||||
|
||||
/* Mark stream to be demultiplexed. */
|
||||
intf_DbgMsg("Stream %d added in %d\n", i_current_id, i_selected_es_loop);
|
||||
p_input->pp_selected_es[i_selected_es_loop] = &p_input->p_es[i_es_loop];
|
||||
|
@ -22,7 +22,7 @@
|
||||
*****************************************************************************/
|
||||
int input_FileOpen( input_thread_t *p_input )
|
||||
{
|
||||
//??
|
||||
/* XXX?? */
|
||||
return( 1 );
|
||||
}
|
||||
|
||||
@ -32,7 +32,7 @@ int input_FileOpen( input_thread_t *p_input )
|
||||
int input_FileRead( input_thread_t *p_input, const struct iovec *p_vector,
|
||||
size_t i_count )
|
||||
{
|
||||
//??
|
||||
/* XXX?? */
|
||||
return( -1 );
|
||||
}
|
||||
|
||||
@ -41,5 +41,5 @@ int input_FileRead( input_thread_t *p_input, const struct iovec *p_vector,
|
||||
*****************************************************************************/
|
||||
void input_FileClose( input_thread_t *p_input )
|
||||
{
|
||||
//??
|
||||
/* XXX?? */
|
||||
}
|
||||
|
@ -130,9 +130,9 @@ void input_NetlistEnd( input_thread_t *p_input )
|
||||
been allocated */
|
||||
for( i = 0; i < INPUT_MAX_PES + 1; i++ )
|
||||
{
|
||||
byte_t* p_buffer = p_input->netlist.p_pes_packets[i].p_pes_header_save;
|
||||
if(p_buffer)
|
||||
free(p_buffer);
|
||||
byte_t* p_buffer = p_input->netlist.p_pes_packets[i].p_pes_header_save;
|
||||
if(p_buffer)
|
||||
free(p_buffer);
|
||||
}
|
||||
|
||||
/* free PES netlist */
|
||||
|
@ -98,8 +98,8 @@ void input_PcrDecode( input_thread_t *p_input, es_descriptor_t *p_es,
|
||||
|
||||
if( p_es->b_discontinuity ||
|
||||
( p_pcr->last_pcr != 0 &&
|
||||
( (p_pcr->last_pcr - pcr_time) > PCR_MAX_GAP
|
||||
|| (p_pcr->last_pcr - pcr_time) < - PCR_MAX_GAP ) ) )
|
||||
( (p_pcr->last_pcr - pcr_time) > PCR_MAX_GAP
|
||||
|| (p_pcr->last_pcr - pcr_time) < - PCR_MAX_GAP ) ) )
|
||||
{
|
||||
intf_DbgMsg("input debug: input_PcrReInit()\n");
|
||||
input_PcrReInit(p_input);
|
||||
|
@ -49,7 +49,7 @@ u32 i_crc_32_table[256];
|
||||
* the option (audio and video) passed to the VideoLAN client.
|
||||
*/
|
||||
#ifdef AUTO_SPAWN
|
||||
//??extern program_data_t *p_main;
|
||||
//XXX?? extern program_data_t *p_main;
|
||||
#endif
|
||||
|
||||
/*
|
||||
@ -107,8 +107,8 @@ int input_PsiInit( input_thread_t *p_input )
|
||||
{
|
||||
ASSERT(p_input);
|
||||
|
||||
/* Precalculate the 32-bit CRC table if not already done ???
|
||||
TO DO -> Put a lock or do that at pgrm init */
|
||||
/* Precalculate the 32-bit CRC table if not already done ?
|
||||
FIXME: Put a lock or do that at pgrm init ?? */
|
||||
if( !b_crc_initialised )
|
||||
{
|
||||
BuildCrc32Table();
|
||||
@ -137,10 +137,10 @@ int input_PsiEnd( input_thread_t *p_input )
|
||||
ASSERT(p_input);
|
||||
|
||||
/* Stop to receive all the PSI tables associated with that program */
|
||||
/* TO DO ??? -> Not really usefull */
|
||||
/* FIXME: Not really useful ??*/
|
||||
|
||||
/* Clean also descriptors for programs associated with that stream */
|
||||
/* TO DO ??? -> Not really usefull and maybe buggy */
|
||||
/* FIXME: -> Not really useful and maybe buggy ??*/
|
||||
|
||||
/* Destroy the stream description */
|
||||
DestroyStreamDescr( p_input, p_input->p_stream->i_stream_id );
|
||||
@ -151,9 +151,9 @@ int input_PsiEnd( input_thread_t *p_input )
|
||||
/*****************************************************************************
|
||||
* input_PsiRead: Read the table of programs
|
||||
*****************************************************************************
|
||||
* Ugly debugging function at that time ???????
|
||||
* Ugly debugging function at that time ? XXX??
|
||||
*****************************************************************************/
|
||||
void input_PsiRead( input_thread_t *p_input /* ??? */ )
|
||||
void input_PsiRead( input_thread_t *p_input /* XXX?? */ )
|
||||
{
|
||||
int i_index;
|
||||
int i_index2;
|
||||
@ -679,7 +679,7 @@ static void DecodePgrmMapSection( u8* p_pms, input_thread_t* p_input )
|
||||
/*****************************************************************************
|
||||
* DecodeSrvDescrSection
|
||||
*****************************************************************************
|
||||
* A finir et a refaire proprement ????
|
||||
* FIXME: A finir et a refaire proprement ??
|
||||
*****************************************************************************/
|
||||
void DecodeSrvDescrSection( byte_t* p_sdt, input_thread_t *p_input )
|
||||
{
|
||||
@ -1183,7 +1183,7 @@ static pgrm_descriptor_t* AddPgrmDescr( stream_descriptor_t* p_stream,
|
||||
p_stream->ap_programs[i_pgrm_index]->i_es_number = 0;
|
||||
p_stream->ap_programs[i_pgrm_index]->ap_es = NULL;
|
||||
|
||||
/* descriptors ???? */
|
||||
/* descriptors ? XXX?? */
|
||||
|
||||
return p_stream->ap_programs[i_pgrm_index];
|
||||
}
|
||||
@ -1272,7 +1272,7 @@ static es_descriptor_t* AddESDescr(input_thread_t* p_input,
|
||||
intf_DbgMsg("Slot %d in p_es table assigned to ES %d\n", i_index, i_es_pid);
|
||||
|
||||
/* Init its values */
|
||||
p_es->i_type = 0; /* ??? */
|
||||
p_es->i_type = 0; /* XXX?? */
|
||||
p_es->b_psi = 0;
|
||||
p_es->b_pcr = 0;
|
||||
p_es->i_continuity_counter = 0xFF;
|
||||
|
@ -110,7 +110,7 @@ int input_VlanJoin( int i_vlan_id )
|
||||
p_main->p_vlan->i_vlan_id = i_vlan_id;
|
||||
|
||||
intf_Msg("Joining VLAN %d (channel %d)\n", i_vlan_id + 2, i_vlan_id );
|
||||
return( ZeTrucMucheFunction( i_vlan_id ) ); // ?? join vlan
|
||||
return( ZeTrucMucheFunction( i_vlan_id ) ); /* FIXME: join vlan ?? */
|
||||
}
|
||||
|
||||
/*****************************************************************************
|
||||
@ -121,92 +121,92 @@ int input_VlanJoin( int i_vlan_id )
|
||||
*****************************************************************************/
|
||||
void input_VlanLeave( int i_vlan_id )
|
||||
{
|
||||
// ??
|
||||
/* XXX?? */
|
||||
}
|
||||
|
||||
/* following functions are local */
|
||||
|
||||
static int ZeTrucMucheFunction( int Channel)
|
||||
{
|
||||
int i_socket;
|
||||
char * ipaddr;
|
||||
struct ifreq interface;
|
||||
struct sockaddr_in sa_server;
|
||||
struct sockaddr_in sa_client;
|
||||
char mess[80];
|
||||
int i_socket;
|
||||
char * ipaddr;
|
||||
struct ifreq interface;
|
||||
struct sockaddr_in sa_server;
|
||||
struct sockaddr_in sa_client;
|
||||
char mess[80];
|
||||
|
||||
/*
|
||||
*Looking for informations about the eth0 interface
|
||||
*/
|
||||
/*
|
||||
*Looking for informations about the eth0 interface
|
||||
*/
|
||||
|
||||
interface.ifr_addr.sa_family = AF_INET;
|
||||
strcpy( interface.ifr_name, main_GetPszVariable( INPUT_IFACE_VAR, INPUT_IFACE_DEFAULT ) );
|
||||
interface.ifr_addr.sa_family = AF_INET;
|
||||
strcpy( interface.ifr_name, main_GetPszVariable( INPUT_IFACE_VAR, INPUT_IFACE_DEFAULT ) );
|
||||
|
||||
i_socket = socket( AF_INET, SOCK_DGRAM, 0 );
|
||||
i_socket = socket( AF_INET, SOCK_DGRAM, 0 );
|
||||
|
||||
/* Looking for the interface IP address */
|
||||
ioctl( i_socket, SIOCGIFDSTADDR, &interface );
|
||||
ipaddr = inet_ntoa((*(struct sockaddr_in *)(&(interface.ifr_addr))).sin_addr );
|
||||
/* Looking for the interface IP address */
|
||||
ioctl( i_socket, SIOCGIFDSTADDR, &interface );
|
||||
ipaddr = inet_ntoa((*(struct sockaddr_in *)(&(interface.ifr_addr))).sin_addr );
|
||||
|
||||
/* Looking for the interface MAC address */
|
||||
ioctl( i_socket, SIOCGIFHWADDR, &interface );
|
||||
close( i_socket );
|
||||
|
||||
/*
|
||||
* Getting address, port, ... of the server
|
||||
*/
|
||||
/* Looking for the interface MAC address */
|
||||
ioctl( i_socket, SIOCGIFHWADDR, &interface );
|
||||
close( i_socket );
|
||||
|
||||
/* Initialize */
|
||||
bzero( &sa_server, sizeof(struct sockaddr_in) );
|
||||
/* sin_family is ALWAYS set to AF_INET (see in man 7 ip)*/
|
||||
sa_server.sin_family = AF_INET;
|
||||
/* Giving port on to connect after having convert it*/
|
||||
sa_server.sin_port = htons ( main_GetIntVariable( INPUT_VLAN_PORT_VAR, INPUT_VLAN_PORT_DEFAULT ));
|
||||
/* Giving address after having convert it into binary data*/
|
||||
inet_aton( main_GetPszVariable( INPUT_VLAN_SERVER_VAR, INPUT_VLAN_SERVER_DEFAULT ), &(sa_server.sin_addr) );
|
||||
|
||||
/*
|
||||
* Getting address, port, ... of the client
|
||||
*/
|
||||
/*
|
||||
* Getting address, port, ... of the server
|
||||
*/
|
||||
|
||||
/* Initialize */
|
||||
bzero( &sa_client, sizeof(struct sockaddr_in) );
|
||||
/* sin_family is ALWAYS set to AF_INET (see in man 7 ip)*/
|
||||
sa_client.sin_family = AF_INET;
|
||||
/* Giving port on to connect after having convert it*/
|
||||
sa_client.sin_port = htons( 0 );
|
||||
/* Giving address after having convert it into binary data*/
|
||||
inet_aton( ipaddr, &(sa_client.sin_addr) );
|
||||
|
||||
/* Initialization of the socket */
|
||||
i_socket = socket(AF_INET, SOCK_DGRAM, 17 ); // ?? UDP
|
||||
/* SOCK_DGRAM because here we use DATAGRAM
|
||||
* Sachant qu'il y a un #define AF_INET = PF_INET dans sys/socket.h et que PF_INET est le IP protocol family ...
|
||||
* Protocol is in #define, should be 17 for udp */
|
||||
/* Initialize */
|
||||
bzero( &sa_server, sizeof(struct sockaddr_in) );
|
||||
/* sin_family is ALWAYS set to AF_INET (see in man 7 ip)*/
|
||||
sa_server.sin_family = AF_INET;
|
||||
/* Giving port on to connect after having convert it*/
|
||||
sa_server.sin_port = htons ( main_GetIntVariable( INPUT_VLAN_PORT_VAR, INPUT_VLAN_PORT_DEFAULT ));
|
||||
/* Giving address after having convert it into binary data*/
|
||||
inet_aton( main_GetPszVariable( INPUT_VLAN_SERVER_VAR, INPUT_VLAN_SERVER_DEFAULT ), &(sa_server.sin_addr) );
|
||||
|
||||
/* Elaborate the message to send */
|
||||
/*
|
||||
* Getting address, port, ... of the client
|
||||
*/
|
||||
|
||||
/* Initialize */
|
||||
bzero( &sa_client, sizeof(struct sockaddr_in) );
|
||||
/* sin_family is ALWAYS set to AF_INET (see in man 7 ip)*/
|
||||
sa_client.sin_family = AF_INET;
|
||||
/* Giving port on to connect after having convert it*/
|
||||
sa_client.sin_port = htons( 0 );
|
||||
/* Giving address after having convert it into binary data*/
|
||||
inet_aton( ipaddr, &(sa_client.sin_addr) );
|
||||
|
||||
/* Initialization of the socket */
|
||||
i_socket = socket(AF_INET, SOCK_DGRAM, 17 ); /* XXX?? UDP */
|
||||
/* SOCK_DGRAM because here we use DATAGRAM
|
||||
* Sachant qu'il y a un #define AF_INET = PF_INET dans sys/socket.h et que PF_INET est le IP protocol family ...
|
||||
* Protocol is in #define, should be 17 for udp */
|
||||
|
||||
/* Elaborate the message to send */
|
||||
sprintf( mess , "%d %s %2.2x%2.2x%2.2x%2.2x%2.2x%2.2x %2.2x:%2.2x:%2.2x:%2.2x:%2.2x:%2.2x \n",
|
||||
Channel, ipaddr,
|
||||
interface.ifr_hwaddr.sa_data[0] & 0xff,
|
||||
interface.ifr_hwaddr.sa_data[1] & 0xff,
|
||||
interface.ifr_hwaddr.sa_data[2] & 0xff,
|
||||
interface.ifr_hwaddr.sa_data[3] & 0xff,
|
||||
interface.ifr_hwaddr.sa_data[4] & 0xff,
|
||||
interface.ifr_hwaddr.sa_data[5] & 0xff,
|
||||
Channel, ipaddr,
|
||||
interface.ifr_hwaddr.sa_data[0] & 0xff,
|
||||
interface.ifr_hwaddr.sa_data[1] & 0xff,
|
||||
interface.ifr_hwaddr.sa_data[2] & 0xff,
|
||||
interface.ifr_hwaddr.sa_data[3] & 0xff,
|
||||
interface.ifr_hwaddr.sa_data[4] & 0xff,
|
||||
interface.ifr_hwaddr.sa_data[5] & 0xff,
|
||||
interface.ifr_hwaddr.sa_data[0] & 0xff,
|
||||
interface.ifr_hwaddr.sa_data[1] & 0xff,
|
||||
interface.ifr_hwaddr.sa_data[2] & 0xff,
|
||||
interface.ifr_hwaddr.sa_data[3] & 0xff,
|
||||
interface.ifr_hwaddr.sa_data[4] & 0xff,
|
||||
interface.ifr_hwaddr.sa_data[5] & 0xff
|
||||
);
|
||||
|
||||
/* Send the message */
|
||||
intf_DbgMsg("%s\n", mess);
|
||||
sendto(i_socket,mess,80,0,(struct sockaddr *)&sa_server,sizeof(struct sockaddr));
|
||||
|
||||
/*Close the socket */
|
||||
close( i_socket );
|
||||
interface.ifr_hwaddr.sa_data[1] & 0xff,
|
||||
interface.ifr_hwaddr.sa_data[2] & 0xff,
|
||||
interface.ifr_hwaddr.sa_data[3] & 0xff,
|
||||
interface.ifr_hwaddr.sa_data[4] & 0xff,
|
||||
interface.ifr_hwaddr.sa_data[5] & 0xff
|
||||
);
|
||||
|
||||
return 0;
|
||||
/* Send the message */
|
||||
intf_DbgMsg("%s\n", mess);
|
||||
sendto(i_socket,mess,80,0,(struct sockaddr *)&sa_server,sizeof(struct sockaddr));
|
||||
|
||||
/*Close the socket */
|
||||
close( i_socket );
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -81,11 +81,11 @@ intf_thread_t* intf_Create( void )
|
||||
|
||||
/* Initialize method-dependent functions */
|
||||
psz_method = main_GetPszVariable( VOUT_METHOD_VAR, VOUT_DEFAULT_METHOD );
|
||||
|
||||
|
||||
psz_plugin = malloc( sizeof("./interface/intf_.so") + strlen(psz_method) );
|
||||
sprintf( psz_plugin, "./interface/intf_%s.so", psz_method );
|
||||
|
||||
p_intf->p_intf_plugin = dlopen( psz_plugin, RTLD_LAZY );
|
||||
p_intf->p_intf_plugin = dlopen( psz_plugin, RTLD_NOW | RTLD_GLOBAL );
|
||||
|
||||
if( p_intf->p_intf_plugin == NULL )
|
||||
{
|
||||
@ -159,7 +159,7 @@ void intf_Run( intf_thread_t *p_intf )
|
||||
/* Check attached threads status */
|
||||
if( (p_intf->p_vout != NULL) && p_intf->p_vout->b_error )
|
||||
{
|
||||
//?? add aout error detection
|
||||
/* FIXME: add aout error detection ?? */
|
||||
p_intf->b_die = 1;
|
||||
}
|
||||
if( (p_intf->p_input != NULL) && p_intf->p_input->b_error )
|
||||
@ -191,7 +191,7 @@ void intf_Destroy( intf_thread_t *p_intf )
|
||||
|
||||
/* Close plugin */
|
||||
dlclose( p_intf->p_intf_plugin );
|
||||
|
||||
|
||||
/* Free structure */
|
||||
free( p_intf );
|
||||
}
|
||||
@ -270,14 +270,14 @@ int intf_ProcessKey( intf_thread_t *p_intf, int i_key )
|
||||
intf_SelectChannel( p_intf, i_key - '0' );
|
||||
break;
|
||||
case '+': /* volume + */
|
||||
// ??
|
||||
/* XXX?? */
|
||||
break;
|
||||
case '-': /* volume - */
|
||||
// ??
|
||||
/* XXX?? */
|
||||
break;
|
||||
case 'M': /* toggle mute */
|
||||
case 'm':
|
||||
// ??
|
||||
/* XXX?? */
|
||||
break;
|
||||
case 'g': /* gamma - */
|
||||
if( (p_intf->p_vout != NULL) && (p_intf->p_vout->f_gamma > -INTF_GAMMA_LIMIT) )
|
||||
|
@ -58,7 +58,7 @@ void intf_ConsoleDestroy( intf_console_t *p_console )
|
||||
*****************************************************************************/
|
||||
void intf_ConsoleClear( intf_console_t *p_console )
|
||||
{
|
||||
//??
|
||||
/* XXX?? */
|
||||
}
|
||||
|
||||
/*****************************************************************************
|
||||
@ -68,7 +68,7 @@ void intf_ConsoleClear( intf_console_t *p_console )
|
||||
*****************************************************************************/
|
||||
void intf_ConsolePrint( intf_console_t *p_console, char *psz_str )
|
||||
{
|
||||
//??
|
||||
/* XXX?? */
|
||||
}
|
||||
|
||||
|
||||
@ -79,7 +79,7 @@ void intf_ConsolePrint( intf_console_t *p_console, char *psz_str )
|
||||
*****************************************************************************/
|
||||
void intf_ConsoleExec( intf_console_t *p_console, char *psz_str )
|
||||
{
|
||||
//??
|
||||
/* XXX?? */
|
||||
}
|
||||
|
||||
/* following functions are local */
|
||||
|
@ -220,7 +220,7 @@ static int Exec( int i_argc, intf_arg_t *p_argv )
|
||||
*****************************************************************************/
|
||||
static int DisplayImage( int i_argc, intf_arg_t *p_argv )
|
||||
{
|
||||
/* ?? */
|
||||
/* XXX?? */
|
||||
return( INTF_NO_ERROR );
|
||||
}
|
||||
|
||||
@ -359,7 +359,7 @@ static int PlayAudio( int i_argc, intf_arg_t *p_argv )
|
||||
}
|
||||
close( i_fd );
|
||||
|
||||
/* Now we can work out how many output units we can compute with the fifo */
|
||||
/* Now we can work out how many output units we can compute with the fifo */
|
||||
fifo.l_units = (long)(((s64)fifo.l_units*(s64)p_main->p_aout->l_rate)/(s64)fifo.l_rate);
|
||||
|
||||
/* Create the fifo */
|
||||
@ -376,11 +376,11 @@ static int PlayAudio( int i_argc, intf_arg_t *p_argv )
|
||||
/*****************************************************************************
|
||||
* PlayVideo: play a video sequence from a file
|
||||
*****************************************************************************
|
||||
* ??
|
||||
* XXX??
|
||||
*****************************************************************************/
|
||||
static int PlayVideo( int i_argc, intf_arg_t *p_argv )
|
||||
{
|
||||
/* ?? */
|
||||
/* XXX?? */
|
||||
return( INTF_NO_ERROR );
|
||||
}
|
||||
|
||||
@ -412,7 +412,7 @@ static int SelectPID( int i_argc, intf_arg_t *p_argv )
|
||||
switch( p_argv[i_arg].i_index )
|
||||
{
|
||||
case 0:
|
||||
// ?? useless
|
||||
/* FIXME: useless ?? */
|
||||
i_input = p_argv[i_arg].i_num;
|
||||
break;
|
||||
case 1:
|
||||
@ -424,8 +424,8 @@ static int SelectPID( int i_argc, intf_arg_t *p_argv )
|
||||
|
||||
/* Find to which input this command is destinated */
|
||||
intf_IntfMsg( "Adding PID %d to input %d\n", i_pid, i_input );
|
||||
//???? input_AddPgrmElem( p_main->p_intf->p_x11->p_input,
|
||||
//???? i_pid );
|
||||
//XXX?? input_AddPgrmElem( p_main->p_intf->p_x11->p_input,
|
||||
//XXX?? i_pid );
|
||||
return( INTF_NO_ERROR );
|
||||
}
|
||||
|
||||
@ -489,7 +489,7 @@ static int Test( int i_argc, intf_arg_t *p_argv )
|
||||
{
|
||||
int i_thread;
|
||||
|
||||
/*?? if( i_argc == 1 )
|
||||
/*XXX?? if( i_argc == 1 )
|
||||
{
|
||||
i_thread = intf_CreateVoutThread( &p_main->intf_thread, NULL, -1, -1);
|
||||
intf_IntfMsg("return value: %d", i_thread );
|
||||
@ -497,7 +497,7 @@ static int Test( int i_argc, intf_arg_t *p_argv )
|
||||
else*/
|
||||
{
|
||||
i_thread = p_argv[1].i_num;
|
||||
//?? intf_DestroyVoutThread( &p_main->intf_thread, i_thread );
|
||||
//XXX?? intf_DestroyVoutThread( &p_main->intf_thread, i_thread );
|
||||
}
|
||||
|
||||
return( INTF_NO_ERROR );
|
||||
@ -530,12 +530,12 @@ static int Vlan( int i_argc, intf_arg_t *p_argv )
|
||||
/* Command is 'join' */
|
||||
if( !strcmp(p_argv[i_command].psz_str, "join") )
|
||||
{
|
||||
/* ?? */
|
||||
/* XXX?? */
|
||||
}
|
||||
/* Command is 'leave' */
|
||||
else if( !strcmp(p_argv[i_command].psz_str, "leave") )
|
||||
{
|
||||
/* ?? */
|
||||
/* XXX?? */
|
||||
}
|
||||
/* Command is unknown */
|
||||
else
|
||||
@ -558,6 +558,6 @@ static int Psi( int i_argc, intf_arg_t *p_argv )
|
||||
int i_index = p_argv[1].i_num;
|
||||
|
||||
intf_IntfMsg("Reading PSI table for input %d\n", i_index);
|
||||
//???? input_PsiRead(p_main->p_intf->p_x11->p_input );
|
||||
//XXX?? input_PsiRead(p_main->p_intf->p_x11->p_input );
|
||||
return( INTF_NO_ERROR );
|
||||
}
|
||||
|
@ -175,7 +175,7 @@ int main( int i_argc, char *ppsz_argv[], char *ppsz_env[] )
|
||||
main_data.p_intf = intf_Create();
|
||||
if( main_data.p_intf != NULL )
|
||||
{
|
||||
InitSignalHandler(); /* prepare signals for interception */
|
||||
InitSignalHandler(); /* prepare signals for interception */
|
||||
intf_Run( main_data.p_intf );
|
||||
intf_Destroy( main_data.p_intf );
|
||||
}
|
||||
@ -425,11 +425,11 @@ static void Usage( int i_fashion )
|
||||
/* Options */
|
||||
intf_Msg("Options:\n" \
|
||||
" -h, --help, -H, --longhelp \tprint short/long usage\n" \
|
||||
" -v, --version \tprint version information\n" \
|
||||
" -v, --version \tprint version information\n"\
|
||||
" --noaudio, --novideo \tdisable audio/video\n" \
|
||||
" --aout {" AUDIO_OPTIONS "} \taudio output method\n" \
|
||||
" --aout {" AUDIO_OPTIONS "} \taudio output method\n"\
|
||||
" --stereo, --mono \tstereo/mono audio\n" \
|
||||
" --vout {" VIDEO_OPTIONS "} \tvideo output method\n" \
|
||||
" --vout {" VIDEO_OPTIONS "} \tvideo output method\n"\
|
||||
" --display <display> \tdisplay string\n" \
|
||||
" --width <w>, --height <h> \tdisplay dimensions\n" \
|
||||
" -g, --grayscale, --color \tgrayscale/color video\n" \
|
||||
@ -468,7 +468,7 @@ static void Usage( int i_fashion )
|
||||
intf_Msg("Input parameters:\n" \
|
||||
" " INPUT_SERVER_VAR "=<hostname> \tvideo server\n" \
|
||||
" " INPUT_PORT_VAR "=<port> \tvideo server port\n" \
|
||||
" " INPUT_IFACE_VAR "=<interface> \tnetwork interface\n" \
|
||||
" " INPUT_IFACE_VAR "=<interface> \tnetwork interface\n"\
|
||||
" " INPUT_VLAN_SERVER_VAR "=<hostname> \tvlan server\n" \
|
||||
" " INPUT_VLAN_PORT_VAR "=<port> \tvlan server port\n"\
|
||||
);
|
||||
@ -552,7 +552,7 @@ static int TestMMX( void )
|
||||
xorl %%ecx, %%eax
|
||||
andl $0x40000, %%eax"
|
||||
: "=a" ( i_reg ) );
|
||||
|
||||
|
||||
if( !i_reg )
|
||||
return( 0 );
|
||||
|
||||
@ -564,11 +564,11 @@ static int TestMMX( void )
|
||||
pushfl
|
||||
popl %%eax
|
||||
xorl %%ecx, %%eax
|
||||
pushl %%ecx
|
||||
pushl %%ecx
|
||||
popfl
|
||||
andl $0x200000, %%eax"
|
||||
: "=a" ( i_reg ) );
|
||||
|
||||
|
||||
if( !i_reg )
|
||||
return( 0 );
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*****************************************************************************
|
||||
/*****************************************************************************
|
||||
* decoder_fifo.c: auxiliaries functions used in decoder_fifo.h
|
||||
* (c)1998 VideoLAN
|
||||
* (c)1998 VideoLAN
|
||||
*****************************************************************************/
|
||||
|
||||
#include <sys/uio.h>
|
||||
@ -10,7 +10,7 @@
|
||||
#include "mtime.h"
|
||||
#include "vlc_thread.h"
|
||||
|
||||
#include "debug.h" /* ?? temporaire, requis par netlist.h */
|
||||
#include "debug.h" /* XXX?? temporaire, requis par netlist.h */
|
||||
|
||||
#include "input.h"
|
||||
#include "input_netlist.h"
|
||||
@ -22,52 +22,52 @@ void decoder_fifo_next( bit_stream_t * p_bit_stream )
|
||||
* and not just a PES header */
|
||||
do
|
||||
{
|
||||
/* We were reading the last TS packet of this PES packet... It's
|
||||
* time to jump to the next PES packet */
|
||||
if ( p_bit_stream->p_ts->p_next_ts == NULL )
|
||||
{
|
||||
/* We are going to read/write the start and end indexes of the
|
||||
* decoder fifo and to use the fifo's conditional variable,
|
||||
* that's why we need to take the lock before */
|
||||
vlc_mutex_lock( &p_bit_stream->p_decoder_fifo->data_lock );
|
||||
/* We were reading the last TS packet of this PES packet... It's
|
||||
* time to jump to the next PES packet */
|
||||
if ( p_bit_stream->p_ts->p_next_ts == NULL )
|
||||
{
|
||||
/* We are going to read/write the start and end indexes of the
|
||||
* decoder fifo and to use the fifo's conditional variable,
|
||||
* that's why we need to take the lock before */
|
||||
vlc_mutex_lock( &p_bit_stream->p_decoder_fifo->data_lock );
|
||||
|
||||
/* Is the input thread dying ? */
|
||||
if ( p_bit_stream->p_input->b_die )
|
||||
{
|
||||
vlc_mutex_unlock( &(p_bit_stream->p_decoder_fifo->data_lock) );
|
||||
return;
|
||||
}
|
||||
/* Is the input thread dying ? */
|
||||
if ( p_bit_stream->p_input->b_die )
|
||||
{
|
||||
vlc_mutex_unlock( &(p_bit_stream->p_decoder_fifo->data_lock) );
|
||||
return;
|
||||
}
|
||||
|
||||
/* We should increase the start index of the decoder fifo, but
|
||||
* if we do this now, the input thread could overwrite the
|
||||
* pointer to the current PES packet, and we weren't able to
|
||||
* give it back to the netlist. That's why we free the PES
|
||||
* packet first. */
|
||||
input_NetlistFreePES( p_bit_stream->p_input, DECODER_FIFO_START(*p_bit_stream->p_decoder_fifo) );
|
||||
DECODER_FIFO_INCSTART( *p_bit_stream->p_decoder_fifo );
|
||||
/* We should increase the start index of the decoder fifo, but
|
||||
* if we do this now, the input thread could overwrite the
|
||||
* pointer to the current PES packet, and we weren't able to
|
||||
* give it back to the netlist. That's why we free the PES
|
||||
* packet first. */
|
||||
input_NetlistFreePES( p_bit_stream->p_input, DECODER_FIFO_START(*p_bit_stream->p_decoder_fifo) );
|
||||
DECODER_FIFO_INCSTART( *p_bit_stream->p_decoder_fifo );
|
||||
|
||||
while ( DECODER_FIFO_ISEMPTY(*p_bit_stream->p_decoder_fifo) )
|
||||
{
|
||||
vlc_cond_wait( &p_bit_stream->p_decoder_fifo->data_wait, &p_bit_stream->p_decoder_fifo->data_lock );
|
||||
if ( p_bit_stream->p_input->b_die )
|
||||
{
|
||||
vlc_mutex_unlock( &(p_bit_stream->p_decoder_fifo->data_lock) );
|
||||
return;
|
||||
}
|
||||
}
|
||||
while ( DECODER_FIFO_ISEMPTY(*p_bit_stream->p_decoder_fifo) )
|
||||
{
|
||||
vlc_cond_wait( &p_bit_stream->p_decoder_fifo->data_wait, &p_bit_stream->p_decoder_fifo->data_lock );
|
||||
if ( p_bit_stream->p_input->b_die )
|
||||
{
|
||||
vlc_mutex_unlock( &(p_bit_stream->p_decoder_fifo->data_lock) );
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/* The next byte could be found in the next PES packet */
|
||||
p_bit_stream->p_ts = DECODER_FIFO_START( *p_bit_stream->p_decoder_fifo )->p_first_ts;
|
||||
/* The next byte could be found in the next PES packet */
|
||||
p_bit_stream->p_ts = DECODER_FIFO_START( *p_bit_stream->p_decoder_fifo )->p_first_ts;
|
||||
|
||||
/* We can release the fifo's data lock */
|
||||
vlc_mutex_unlock( &p_bit_stream->p_decoder_fifo->data_lock );
|
||||
}
|
||||
/* Perhaps the next TS packet of the current PES packet contains
|
||||
* real data (ie its payload's size is greater than 0) */
|
||||
else
|
||||
{
|
||||
p_bit_stream->p_ts = p_bit_stream->p_ts->p_next_ts;
|
||||
}
|
||||
/* We can release the fifo's data lock */
|
||||
vlc_mutex_unlock( &p_bit_stream->p_decoder_fifo->data_lock );
|
||||
}
|
||||
/* Perhaps the next TS packet of the current PES packet contains
|
||||
* real data (ie its payload's size is greater than 0) */
|
||||
else
|
||||
{
|
||||
p_bit_stream->p_ts = p_bit_stream->p_ts->p_next_ts;
|
||||
}
|
||||
} while ( p_bit_stream->p_ts->i_payload_start == p_bit_stream->p_ts->i_payload_end );
|
||||
|
||||
/* We've found a TS packet which contains interesting data... */
|
||||
|
@ -2,7 +2,7 @@
|
||||
* netutils.c: various network functions
|
||||
* (c)1999 VideoLAN
|
||||
*****************************************************************************
|
||||
* ??
|
||||
* XXX??
|
||||
*****************************************************************************
|
||||
* Required headers:
|
||||
* <netinet/in.h>
|
||||
@ -275,7 +275,7 @@ int ReadNetConf(int i_sockfd, net_descr_t* p_net_descr)
|
||||
p_net_descr->i_if_number++;
|
||||
p_net_descr->a_if = realloc(p_net_descr->a_if,
|
||||
p_net_descr->i_if_number*sizeof(if_descr_t));
|
||||
/* Read the info ??? */
|
||||
/* FIXME: Read the info ?? */
|
||||
i_rc = ReadIfConf(i_sockfd, &p_net_descr->a_if[p_net_descr->i_if_number-1],
|
||||
p_ifr_current_if->ifr_name);
|
||||
}
|
||||
|
@ -4,7 +4,7 @@
|
||||
*****************************************************************************/
|
||||
|
||||
/* repompé sur video_decoder.c
|
||||
* ?? passer en terminate/destroy avec les signaux supplémentaires */
|
||||
* FIXME: passer en terminate/destroy avec les signaux supplémentaires ?? */
|
||||
|
||||
/*****************************************************************************
|
||||
* Preamble
|
||||
@ -24,7 +24,7 @@
|
||||
#include "vlc_thread.h"
|
||||
|
||||
#include "intf_msg.h"
|
||||
#include "debug.h" /* ?? temporaire, requis par netlist.h */
|
||||
#include "debug.h" /* XXX?? temporaire, requis par netlist.h */
|
||||
|
||||
#include "input.h"
|
||||
#include "input_netlist.h"
|
||||
|
@ -20,7 +20,7 @@
|
||||
#include "vlc_thread.h"
|
||||
|
||||
#include "intf_msg.h"
|
||||
#include "debug.h" /* ?? temporaire, requis par netlist.h */
|
||||
#include "debug.h" /* XXX?? temporaire, requis par netlist.h */
|
||||
|
||||
#include "input.h"
|
||||
#include "input_netlist.h"
|
||||
@ -646,7 +646,7 @@ void vdec_IDCT( vdec_thread_t * p_vdec, dctelem_t * p_block, int i_idontcare )
|
||||
z3 = d7 + d3;
|
||||
z4 = d5 + d1;
|
||||
z5 = MULTIPLY(z3 + z4, FIX(1.175875602));
|
||||
|
||||
|
||||
tmp0 = MULTIPLY(d7, FIX(0.298631336));
|
||||
tmp1 = MULTIPLY(d5, FIX(2.053119869));
|
||||
tmp2 = MULTIPLY(d3, FIX(3.072711026));
|
||||
@ -658,7 +658,7 @@ void vdec_IDCT( vdec_thread_t * p_vdec, dctelem_t * p_block, int i_idontcare )
|
||||
|
||||
z3 += z5;
|
||||
z4 += z5;
|
||||
|
||||
|
||||
tmp0 += z1 + z3;
|
||||
tmp1 += z2 + z4;
|
||||
tmp2 += z2 + z3;
|
||||
@ -670,7 +670,7 @@ void vdec_IDCT( vdec_thread_t * p_vdec, dctelem_t * p_block, int i_idontcare )
|
||||
z2 = d5 + d3;
|
||||
z3 = d7 + d3;
|
||||
z5 = MULTIPLY(z3 + d5, FIX(1.175875602));
|
||||
|
||||
|
||||
tmp0 = MULTIPLY(d7, FIX(0.298631336));
|
||||
tmp1 = MULTIPLY(d5, FIX(2.053119869));
|
||||
tmp2 = MULTIPLY(d3, FIX(3.072711026));
|
||||
@ -678,10 +678,10 @@ void vdec_IDCT( vdec_thread_t * p_vdec, dctelem_t * p_block, int i_idontcare )
|
||||
z2 = MULTIPLY(z2, - FIX(2.562915447));
|
||||
z3 = MULTIPLY(z3, - FIX(1.961570560));
|
||||
z4 = MULTIPLY(d5, - FIX(0.390180644));
|
||||
|
||||
|
||||
z3 += z5;
|
||||
z4 += z5;
|
||||
|
||||
|
||||
tmp0 += z1 + z3;
|
||||
tmp1 += z2 + z4;
|
||||
tmp2 += z2 + z3;
|
||||
@ -696,7 +696,7 @@ void vdec_IDCT( vdec_thread_t * p_vdec, dctelem_t * p_block, int i_idontcare )
|
||||
z1 = d7 + d1;
|
||||
z4 = d5 + d1;
|
||||
z5 = MULTIPLY(d7 + z4, FIX(1.175875602));
|
||||
|
||||
|
||||
tmp0 = MULTIPLY(d7, FIX(0.298631336));
|
||||
tmp1 = MULTIPLY(d5, FIX(2.053119869));
|
||||
tmp3 = MULTIPLY(d1, FIX(1.501321110));
|
||||
@ -704,10 +704,10 @@ void vdec_IDCT( vdec_thread_t * p_vdec, dctelem_t * p_block, int i_idontcare )
|
||||
z2 = MULTIPLY(d5, - FIX(2.562915447));
|
||||
z3 = MULTIPLY(d7, - FIX(1.961570560));
|
||||
z4 = MULTIPLY(z4, - FIX(0.390180644));
|
||||
|
||||
|
||||
z3 += z5;
|
||||
z4 += z5;
|
||||
|
||||
|
||||
tmp0 += z1 + z3;
|
||||
tmp1 += z2 + z4;
|
||||
tmp2 = z2 + z3;
|
||||
@ -724,10 +724,10 @@ void vdec_IDCT( vdec_thread_t * p_vdec, dctelem_t * p_block, int i_idontcare )
|
||||
z3 = MULTIPLY(d7, - FIX(1.961570560));
|
||||
z2 = MULTIPLY(d5, - FIX(2.562915447));
|
||||
z4 = MULTIPLY(d5, - FIX(0.390180644));
|
||||
|
||||
|
||||
z3 += z5;
|
||||
z4 += z5;
|
||||
|
||||
|
||||
tmp0 += z3;
|
||||
tmp1 += z4;
|
||||
tmp2 = z2 + z3;
|
||||
@ -745,7 +745,7 @@ void vdec_IDCT( vdec_thread_t * p_vdec, dctelem_t * p_block, int i_idontcare )
|
||||
z1 = d7 + d1;
|
||||
z3 = d7 + d3;
|
||||
z5 = MULTIPLY(z3 + d1, FIX(1.175875602));
|
||||
|
||||
|
||||
tmp0 = MULTIPLY(d7, FIX(0.298631336));
|
||||
tmp2 = MULTIPLY(d3, FIX(3.072711026));
|
||||
tmp3 = MULTIPLY(d1, FIX(1.501321110));
|
||||
@ -753,10 +753,10 @@ void vdec_IDCT( vdec_thread_t * p_vdec, dctelem_t * p_block, int i_idontcare )
|
||||
z2 = MULTIPLY(d3, - FIX(2.562915447));
|
||||
z3 = MULTIPLY(z3, - FIX(1.961570560));
|
||||
z4 = MULTIPLY(d1, - FIX(0.390180644));
|
||||
|
||||
|
||||
z3 += z5;
|
||||
z4 += z5;
|
||||
|
||||
|
||||
tmp0 += z1 + z3;
|
||||
tmp1 = z2 + z4;
|
||||
tmp2 += z2 + z3;
|
||||
@ -767,7 +767,7 @@ void vdec_IDCT( vdec_thread_t * p_vdec, dctelem_t * p_block, int i_idontcare )
|
||||
/* d1 == 0, d3 != 0, d5 == 0, d7 != 0 */
|
||||
z3 = d7 + d3;
|
||||
z5 = MULTIPLY(z3, FIX(1.175875602));
|
||||
|
||||
|
||||
tmp0 = MULTIPLY(d7, - FIX2(0.601344887));
|
||||
tmp2 = MULTIPLY(d3, FIX(0.509795579));
|
||||
z1 = MULTIPLY(d7, - FIX(0.899976223));
|
||||
@ -822,7 +822,7 @@ void vdec_IDCT( vdec_thread_t * p_vdec, dctelem_t * p_block, int i_idontcare )
|
||||
z2 = d5 + d3;
|
||||
z4 = d5 + d1;
|
||||
z5 = MULTIPLY(d3 + z4, FIX(1.175875602));
|
||||
|
||||
|
||||
tmp1 = MULTIPLY(d5, FIX(2.053119869));
|
||||
tmp2 = MULTIPLY(d3, FIX(3.072711026));
|
||||
tmp3 = MULTIPLY(d1, FIX(1.501321110));
|
||||
@ -830,10 +830,10 @@ void vdec_IDCT( vdec_thread_t * p_vdec, dctelem_t * p_block, int i_idontcare )
|
||||
z2 = MULTIPLY(z2, - FIX(2.562915447));
|
||||
z3 = MULTIPLY(d3, - FIX(1.961570560));
|
||||
z4 = MULTIPLY(z4, - FIX(0.390180644));
|
||||
|
||||
|
||||
z3 += z5;
|
||||
z4 += z5;
|
||||
|
||||
|
||||
tmp0 = z1 + z3;
|
||||
tmp1 += z2 + z4;
|
||||
tmp2 += z2 + z3;
|
||||
@ -844,13 +844,13 @@ void vdec_IDCT( vdec_thread_t * p_vdec, dctelem_t * p_block, int i_idontcare )
|
||||
/* d1 == 0, d3 != 0, d5 != 0, d7 == 0 */
|
||||
z2 = d5 + d3;
|
||||
z5 = MULTIPLY(z2, FIX(1.175875602));
|
||||
|
||||
|
||||
tmp1 = MULTIPLY(d5, FIX2(1.662939225));
|
||||
tmp2 = MULTIPLY(d3, FIX2(1.111140466));
|
||||
z2 = MULTIPLY(z2, - FIX2(1.387039845));
|
||||
z3 = MULTIPLY(d3, - FIX(1.961570560));
|
||||
z4 = MULTIPLY(d5, - FIX(0.390180644));
|
||||
|
||||
|
||||
tmp0 = z3 + z5;
|
||||
tmp1 += z2;
|
||||
tmp2 += z2;
|
||||
@ -864,13 +864,13 @@ void vdec_IDCT( vdec_thread_t * p_vdec, dctelem_t * p_block, int i_idontcare )
|
||||
/* d1 != 0, d3 == 0, d5 != 0, d7 == 0 */
|
||||
z4 = d5 + d1;
|
||||
z5 = MULTIPLY(z4, FIX(1.175875602));
|
||||
|
||||
|
||||
tmp1 = MULTIPLY(d5, - FIX2(0.509795578));
|
||||
tmp3 = MULTIPLY(d1, FIX2(0.601344887));
|
||||
z1 = MULTIPLY(d1, - FIX(0.899976223));
|
||||
z2 = MULTIPLY(d5, - FIX(2.562915447));
|
||||
z4 = MULTIPLY(z4, FIX2(0.785694958));
|
||||
|
||||
|
||||
tmp0 = z1 + z5;
|
||||
tmp1 += z4;
|
||||
tmp2 = z2 + z5;
|
||||
@ -901,7 +901,7 @@ void vdec_IDCT( vdec_thread_t * p_vdec, dctelem_t * p_block, int i_idontcare )
|
||||
z2 = MULTIPLY(d3, - FIX(2.172734803));
|
||||
z4 = MULTIPLY(z5, FIX(0.785694958));
|
||||
z5 = MULTIPLY(z5, FIX(1.175875602));
|
||||
|
||||
|
||||
tmp0 = z1 - z4;
|
||||
tmp1 = z2 + z4;
|
||||
tmp2 += z5;
|
||||
@ -1213,7 +1213,7 @@ void vdec_IDCT( vdec_thread_t * p_vdec, dctelem_t * p_block, int i_idontcare )
|
||||
z3 = d7 + d3;
|
||||
z4 = d5 + d1;
|
||||
z5 = MULTIPLY(z3 + z4, FIX(1.175875602));
|
||||
|
||||
|
||||
tmp0 = MULTIPLY(d7, FIX(0.298631336));
|
||||
tmp1 = MULTIPLY(d5, FIX(2.053119869));
|
||||
tmp2 = MULTIPLY(d3, FIX(3.072711026));
|
||||
@ -1222,10 +1222,10 @@ void vdec_IDCT( vdec_thread_t * p_vdec, dctelem_t * p_block, int i_idontcare )
|
||||
z2 = MULTIPLY(z2, - FIX(2.562915447));
|
||||
z3 = MULTIPLY(z3, - FIX(1.961570560));
|
||||
z4 = MULTIPLY(z4, - FIX(0.390180644));
|
||||
|
||||
|
||||
z3 += z5;
|
||||
z4 += z5;
|
||||
|
||||
|
||||
tmp0 += z1 + z3;
|
||||
tmp1 += z2 + z4;
|
||||
tmp2 += z2 + z3;
|
||||
@ -1237,7 +1237,7 @@ void vdec_IDCT( vdec_thread_t * p_vdec, dctelem_t * p_block, int i_idontcare )
|
||||
z2 = d5 + d3;
|
||||
z3 = d7 + d3;
|
||||
z5 = MULTIPLY(z3 + d5, FIX(1.175875602));
|
||||
|
||||
|
||||
tmp0 = MULTIPLY(d7, FIX(0.298631336));
|
||||
tmp1 = MULTIPLY(d5, FIX(2.053119869));
|
||||
tmp2 = MULTIPLY(d3, FIX(3.072711026));
|
||||
@ -1245,10 +1245,10 @@ void vdec_IDCT( vdec_thread_t * p_vdec, dctelem_t * p_block, int i_idontcare )
|
||||
z2 = MULTIPLY(z2, - FIX(2.562915447));
|
||||
z3 = MULTIPLY(z3, - FIX(1.961570560));
|
||||
z4 = MULTIPLY(d5, - FIX(0.390180644));
|
||||
|
||||
|
||||
z3 += z5;
|
||||
z4 += z5;
|
||||
|
||||
|
||||
tmp0 += z1 + z3;
|
||||
tmp1 += z2 + z4;
|
||||
tmp2 += z2 + z3;
|
||||
@ -1263,7 +1263,7 @@ void vdec_IDCT( vdec_thread_t * p_vdec, dctelem_t * p_block, int i_idontcare )
|
||||
z1 = d7 + d1;
|
||||
z4 = d5 + d1;
|
||||
z5 = MULTIPLY(d7 + z4, FIX(1.175875602));
|
||||
|
||||
|
||||
tmp0 = MULTIPLY(d7, FIX(0.298631336));
|
||||
tmp1 = MULTIPLY(d5, FIX(2.053119869));
|
||||
tmp3 = MULTIPLY(d1, FIX(1.501321110));
|
||||
@ -1271,10 +1271,10 @@ void vdec_IDCT( vdec_thread_t * p_vdec, dctelem_t * p_block, int i_idontcare )
|
||||
z2 = MULTIPLY(d5, - FIX(2.562915447));
|
||||
z3 = MULTIPLY(d7, - FIX(1.961570560));
|
||||
z4 = MULTIPLY(z4, - FIX(0.390180644));
|
||||
|
||||
|
||||
z3 += z5;
|
||||
z4 += z5;
|
||||
|
||||
|
||||
tmp0 += z1 + z3;
|
||||
tmp1 += z2 + z4;
|
||||
tmp2 = z2 + z3;
|
||||
@ -1291,10 +1291,10 @@ void vdec_IDCT( vdec_thread_t * p_vdec, dctelem_t * p_block, int i_idontcare )
|
||||
z3 = MULTIPLY(d7, - FIX(1.961570560));
|
||||
z2 = MULTIPLY(d5, - FIX(2.562915447));
|
||||
z4 = MULTIPLY(d5, - FIX(0.390180644));
|
||||
|
||||
|
||||
z3 += z5;
|
||||
z4 += z5;
|
||||
|
||||
|
||||
tmp0 += z3;
|
||||
tmp1 += z4;
|
||||
tmp2 = z2 + z3;
|
||||
@ -1312,7 +1312,7 @@ void vdec_IDCT( vdec_thread_t * p_vdec, dctelem_t * p_block, int i_idontcare )
|
||||
z1 = d7 + d1;
|
||||
z3 = d7 + d3;
|
||||
z5 = MULTIPLY(z3 + d1, FIX(1.175875602));
|
||||
|
||||
|
||||
tmp0 = MULTIPLY(d7, FIX(0.298631336));
|
||||
tmp2 = MULTIPLY(d3, FIX(3.072711026));
|
||||
tmp3 = MULTIPLY(d1, FIX(1.501321110));
|
||||
@ -1320,10 +1320,10 @@ void vdec_IDCT( vdec_thread_t * p_vdec, dctelem_t * p_block, int i_idontcare )
|
||||
z2 = MULTIPLY(d3, - FIX(2.562915447));
|
||||
z3 = MULTIPLY(z3, - FIX(1.961570560));
|
||||
z4 = MULTIPLY(d1, - FIX(0.390180644));
|
||||
|
||||
|
||||
z3 += z5;
|
||||
z4 += z5;
|
||||
|
||||
|
||||
tmp0 += z1 + z3;
|
||||
tmp1 = z2 + z4;
|
||||
tmp2 += z2 + z3;
|
||||
@ -1334,13 +1334,13 @@ void vdec_IDCT( vdec_thread_t * p_vdec, dctelem_t * p_block, int i_idontcare )
|
||||
/* d1 == 0, d3 != 0, d5 == 0, d7 != 0 */
|
||||
z3 = d7 + d3;
|
||||
z5 = MULTIPLY(z3, FIX(1.175875602));
|
||||
|
||||
|
||||
tmp0 = MULTIPLY(d7, - FIX2(0.601344887));
|
||||
z1 = MULTIPLY(d7, - FIX(0.899976223));
|
||||
tmp2 = MULTIPLY(d3, FIX(0.509795579));
|
||||
z2 = MULTIPLY(d3, - FIX(2.562915447));
|
||||
z3 = MULTIPLY(z3, - FIX2(0.785694958));
|
||||
|
||||
|
||||
tmp0 += z3;
|
||||
tmp1 = z2 + z5;
|
||||
tmp2 += z3;
|
||||
@ -1389,7 +1389,7 @@ void vdec_IDCT( vdec_thread_t * p_vdec, dctelem_t * p_block, int i_idontcare )
|
||||
z2 = d5 + d3;
|
||||
z4 = d5 + d1;
|
||||
z5 = MULTIPLY(d3 + z4, FIX(1.175875602));
|
||||
|
||||
|
||||
tmp1 = MULTIPLY(d5, FIX(2.053119869));
|
||||
tmp2 = MULTIPLY(d3, FIX(3.072711026));
|
||||
tmp3 = MULTIPLY(d1, FIX(1.501321110));
|
||||
@ -1397,10 +1397,10 @@ void vdec_IDCT( vdec_thread_t * p_vdec, dctelem_t * p_block, int i_idontcare )
|
||||
z2 = MULTIPLY(z2, - FIX(2.562915447));
|
||||
z3 = MULTIPLY(d3, - FIX(1.961570560));
|
||||
z4 = MULTIPLY(z4, - FIX(0.390180644));
|
||||
|
||||
|
||||
z3 += z5;
|
||||
z4 += z5;
|
||||
|
||||
|
||||
tmp0 = z1 + z3;
|
||||
tmp1 += z2 + z4;
|
||||
tmp2 += z2 + z3;
|
||||
@ -1417,7 +1417,7 @@ void vdec_IDCT( vdec_thread_t * p_vdec, dctelem_t * p_block, int i_idontcare )
|
||||
z2 = MULTIPLY(z2, - FIX2(1.387039845));
|
||||
z3 = MULTIPLY(d3, - FIX(1.961570560));
|
||||
z4 = MULTIPLY(d5, - FIX(0.390180644));
|
||||
|
||||
|
||||
tmp0 = z3 + z5;
|
||||
tmp1 += z2;
|
||||
tmp2 += z2;
|
||||
@ -1431,13 +1431,13 @@ void vdec_IDCT( vdec_thread_t * p_vdec, dctelem_t * p_block, int i_idontcare )
|
||||
/* d1 != 0, d3 == 0, d5 != 0, d7 == 0 */
|
||||
z4 = d5 + d1;
|
||||
z5 = MULTIPLY(z4, FIX(1.175875602));
|
||||
|
||||
|
||||
tmp1 = MULTIPLY(d5, - FIX2(0.509795578));
|
||||
tmp3 = MULTIPLY(d1, FIX2(0.601344887));
|
||||
z1 = MULTIPLY(d1, - FIX(0.899976223));
|
||||
z2 = MULTIPLY(d5, - FIX(2.562915447));
|
||||
z4 = MULTIPLY(z4, FIX2(0.785694958));
|
||||
|
||||
|
||||
tmp0 = z1 + z5;
|
||||
tmp1 += z4;
|
||||
tmp2 = z2 + z5;
|
||||
@ -1468,7 +1468,7 @@ void vdec_IDCT( vdec_thread_t * p_vdec, dctelem_t * p_block, int i_idontcare )
|
||||
z2 = MULTIPLY(d3, - FIX(2.172734803));
|
||||
z4 = MULTIPLY(z5, FIX(0.785694958));
|
||||
z5 = MULTIPLY(z5, FIX(1.175875602));
|
||||
|
||||
|
||||
tmp0 = z1 - z4;
|
||||
tmp1 = z2 + z4;
|
||||
tmp2 += z5;
|
||||
|
@ -19,7 +19,7 @@
|
||||
#include "vlc_thread.h"
|
||||
|
||||
#include "intf_msg.h"
|
||||
#include "debug.h" /* ?? temporaire, requis par netlist.h */
|
||||
#include "debug.h" /* XXX?? temporaire, requis par netlist.h */
|
||||
|
||||
#include "input.h"
|
||||
#include "input_netlist.h"
|
||||
@ -503,7 +503,7 @@ void vdec_MotionFieldField444( macroblock_t * p_mb )
|
||||
}
|
||||
|
||||
/*****************************************************************************
|
||||
* vdec_MotionField16x8XXX : motion compensation for 16x8 motion type (field)
|
||||
* vdec_MotionField16x8XXX?? : motion compensation for 16x8 motion type (field)
|
||||
*****************************************************************************/
|
||||
#define FIELD16X8( MOTION ) \
|
||||
{ \
|
||||
@ -585,7 +585,7 @@ void vdec_MotionField16x8444( macroblock_t * p_mb )
|
||||
}
|
||||
|
||||
/*****************************************************************************
|
||||
* vdec_MotionFieldDMVXXX : motion compensation for dmv motion type (field)
|
||||
* vdec_MotionFieldDMVXXX?? : motion compensation for dmv motion type (field)
|
||||
*****************************************************************************/
|
||||
#define FIELDDMV( MOTION ) \
|
||||
{ \
|
||||
@ -627,7 +627,7 @@ void vdec_MotionFieldDMV444( macroblock_t * p_mb )
|
||||
}
|
||||
|
||||
/*****************************************************************************
|
||||
* vdec_MotionFrameFrameXXX : motion compensation for frame motion type (frame)
|
||||
* vdec_MotionFrameFrameXXX?? : motion compensation for frame motion type (frame)
|
||||
*****************************************************************************/
|
||||
#define FRAMEFRAME( MOTION ) \
|
||||
{ \
|
||||
@ -672,7 +672,7 @@ void vdec_MotionFrameFrame444( macroblock_t * p_mb )
|
||||
}
|
||||
|
||||
/*****************************************************************************
|
||||
* vdec_MotionFrameFieldXXX : motion compensation for field motion type (frame)
|
||||
* vdec_MotionFrameFieldXXX?? : motion compensation for field motion type (frame)
|
||||
*****************************************************************************/
|
||||
#define FRAMEFIELD( MOTION ) \
|
||||
{ \
|
||||
@ -737,7 +737,7 @@ void vdec_MotionFrameField444( macroblock_t * p_mb )
|
||||
}
|
||||
|
||||
/*****************************************************************************
|
||||
* vdec_MotionFrameDMVXXX : motion compensation for dmv motion type (frame)
|
||||
* vdec_MotionFrameDMVXXX?? : motion compensation for dmv motion type (frame)
|
||||
*****************************************************************************/
|
||||
#define FRAMEDMV( MOTION ) \
|
||||
{ \
|
||||
@ -748,7 +748,7 @@ void vdec_MotionFrameField444( macroblock_t * p_mb )
|
||||
MOTION( p_mb, p_mb->p_forward, 0, 0, \
|
||||
p_mb->pppi_motion_vectors[0][0][0], \
|
||||
p_mb->pppi_motion_vectors[0][0][1], \
|
||||
/* ????? >> 1 ? */ \
|
||||
/* XXX?? XXX?? >> 1 ? */ \
|
||||
p_mb->i_l_stride << 1, p_mb->i_c_stride << 1, 8, 0, 0 ); \
|
||||
\
|
||||
/* predict and add to top field from bottom field */ \
|
||||
@ -760,7 +760,7 @@ void vdec_MotionFrameField444( macroblock_t * p_mb )
|
||||
MOTION( p_mb, p_mb->p_forward, 1, 1, \
|
||||
p_mb->pppi_motion_vectors[0][0][0], \
|
||||
p_mb->pppi_motion_vectors[0][0][1], \
|
||||
/* ????? >> 1 ? */ \
|
||||
/* XXX?? XXX?? >> 1 ? */ \
|
||||
p_mb->i_l_stride << 1, p_mb->i_c_stride << 1, 8, 0, 0 ); \
|
||||
\
|
||||
/* predict and add to bottom field from top field */ \
|
||||
|
@ -3,7 +3,7 @@
|
||||
* (c)1999 VideoLAN
|
||||
*****************************************************************************/
|
||||
|
||||
/* ?? passer en terminate/destroy avec les signaux supplémentaires */
|
||||
/* FIXME: passer en terminate/destroy avec les signaux supplémentaires ?? */
|
||||
|
||||
/*****************************************************************************
|
||||
* Preamble
|
||||
@ -23,7 +23,7 @@
|
||||
#include "vlc_thread.h"
|
||||
|
||||
#include "intf_msg.h"
|
||||
#include "debug.h" /* ?? temporaire, requis par netlist.h */
|
||||
#include "debug.h" /* XXX?? temporaire, requis par netlist.h */
|
||||
|
||||
#include "input.h"
|
||||
#include "input_netlist.h"
|
||||
@ -59,7 +59,7 @@ static void EndThread ( vdec_thread_t *p_vdec );
|
||||
* This function creates a new video decoder thread, and returns a pointer
|
||||
* to its description. On error, it returns NULL.
|
||||
* Following configuration properties are used:
|
||||
* ??
|
||||
* XXX??
|
||||
*****************************************************************************/
|
||||
vdec_thread_t * vdec_CreateThread( vpar_thread_t *p_vpar /*, int *pi_status */ )
|
||||
{
|
||||
|
@ -91,11 +91,11 @@ vout_thread_t * vout_CreateThread ( char *psz_display, int i_root_window,
|
||||
psz_plugin = malloc( sizeof("./video_output/vout_.so") + strlen(psz_method) );
|
||||
sprintf( psz_plugin, "./video_output/vout_%s.so", psz_method );
|
||||
|
||||
p_vout->p_vout_plugin = dlopen( psz_plugin, RTLD_LAZY );
|
||||
|
||||
p_vout->p_vout_plugin = dlopen( psz_plugin, RTLD_NOW | RTLD_GLOBAL );
|
||||
|
||||
if( p_vout->p_vout_plugin == NULL )
|
||||
{
|
||||
intf_ErrMsg( "error: could not open video plugin %s\n", psz_method );
|
||||
intf_ErrMsg( "error: could not open video plugin %s\n", psz_plugin );
|
||||
free( psz_plugin );
|
||||
free( p_vout );
|
||||
return( NULL );
|
||||
@ -162,7 +162,7 @@ vout_thread_t * vout_CreateThread ( char *psz_display, int i_root_window,
|
||||
p_vout->p_subpicture[i_index].i_type = EMPTY_SUBPICTURE;
|
||||
p_vout->p_subpicture[i_index].i_status= FREE_SUBPICTURE;
|
||||
}
|
||||
p_vout->i_pictures = 0;
|
||||
p_vout->i_pictures = 0;
|
||||
|
||||
/* Initialize synchronization informations */
|
||||
p_vout->i_synchro_level = VOUT_SYNCHRO_LEVEL_START;
|
||||
@ -559,7 +559,7 @@ picture_t *vout_CreatePicture( vout_thread_t *p_vout, int i_type,
|
||||
* can end immediately - this is the best possible case, since no
|
||||
* memory allocation needs to be done */
|
||||
p_vout->p_picture[i_picture].i_status = RESERVED_PICTURE;
|
||||
p_vout->i_pictures++;
|
||||
p_vout->i_pictures++;
|
||||
#ifdef DEBUG_VIDEO
|
||||
intf_DbgMsg("picture %p (in destroyed picture slot)\n",
|
||||
&p_vout->p_picture[i_picture] );
|
||||
@ -643,7 +643,7 @@ picture_t *vout_CreatePicture( vout_thread_t *p_vout, int i_type,
|
||||
p_free_picture->i_display_height = i_height;
|
||||
p_free_picture->i_aspect_ratio = AR_SQUARE_PICTURE;
|
||||
p_free_picture->i_refcount = 0;
|
||||
p_vout->i_pictures++;
|
||||
p_vout->i_pictures++;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -676,7 +676,7 @@ picture_t *vout_CreatePicture( vout_thread_t *p_vout, int i_type,
|
||||
*****************************************************************************/
|
||||
void vout_DestroyPicture( vout_thread_t *p_vout, picture_t *p_pic )
|
||||
{
|
||||
vlc_mutex_lock( &p_vout->picture_lock );
|
||||
vlc_mutex_lock( &p_vout->picture_lock );
|
||||
|
||||
#ifdef DEBUG
|
||||
/* Check if picture status is valid */
|
||||
@ -689,12 +689,12 @@ void vout_DestroyPicture( vout_thread_t *p_vout, picture_t *p_pic )
|
||||
#endif
|
||||
|
||||
p_pic->i_status = DESTROYED_PICTURE;
|
||||
p_vout->i_pictures--;
|
||||
p_vout->i_pictures--;
|
||||
|
||||
#ifdef DEBUG_VIDEO
|
||||
intf_DbgMsg("picture %p\n", p_pic);
|
||||
#endif
|
||||
vlc_mutex_unlock( &p_vout->picture_lock );
|
||||
vlc_mutex_unlock( &p_vout->picture_lock );
|
||||
}
|
||||
|
||||
/*****************************************************************************
|
||||
@ -736,7 +736,7 @@ void vout_UnlinkPicture( vout_thread_t *p_vout, picture_t *p_pic )
|
||||
if( (p_pic->i_refcount == 0) && (p_pic->i_status == DISPLAYED_PICTURE) )
|
||||
{
|
||||
p_pic->i_status = DESTROYED_PICTURE;
|
||||
p_vout->i_pictures--;
|
||||
p_vout->i_pictures--;
|
||||
}
|
||||
|
||||
#ifdef DEBUG_VIDEO
|
||||
@ -895,10 +895,10 @@ static int InitThread( vout_thread_t *p_vout )
|
||||
*****************************************************************************/
|
||||
static void RunThread( vout_thread_t *p_vout)
|
||||
{
|
||||
//?? welcome to gore land
|
||||
/* XXX?? welcome to gore land */
|
||||
static int i_trash_count = 0;
|
||||
static mtime_t last_display_date = 0;
|
||||
|
||||
|
||||
int i_index; /* index in heap */
|
||||
mtime_t current_date; /* current date */
|
||||
mtime_t display_date; /* display date */
|
||||
@ -950,7 +950,7 @@ static void RunThread( vout_thread_t *p_vout)
|
||||
/* Computes FPS rate */
|
||||
p_vout->p_fps_sample[ p_vout->c_fps_samples++ % VOUT_FPS_SAMPLES ] = display_date;
|
||||
#endif
|
||||
// ???
|
||||
/* XXX?? */
|
||||
i_trash_count++;
|
||||
//fprintf( stderr, "gap : %Ld\n", display_date-last_display_date );
|
||||
last_display_date = display_date;
|
||||
@ -963,26 +963,26 @@ last_display_date = display_date;
|
||||
vlc_mutex_lock( &p_vout->picture_lock );
|
||||
if( p_pic->i_refcount )
|
||||
{
|
||||
p_pic->i_status = DISPLAYED_PICTURE;
|
||||
p_pic->i_status = DISPLAYED_PICTURE;
|
||||
}
|
||||
else
|
||||
{
|
||||
p_pic->i_status = DESTROYED_PICTURE;
|
||||
p_vout->i_pictures--;
|
||||
p_vout->i_pictures--;
|
||||
}
|
||||
intf_DbgMsg( "warning: late picture %p skipped refcount=%d\n", p_pic, p_pic->i_refcount );
|
||||
vlc_mutex_unlock( &p_vout->picture_lock );
|
||||
|
||||
/* Update synchronization information as if display delay
|
||||
/* Update synchronization information as if display delay
|
||||
* was 0 */
|
||||
Synchronize( p_vout, display_date - current_date );
|
||||
|
||||
|
||||
p_pic = NULL;
|
||||
display_date = 0;
|
||||
i_trash_count = 0;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
else
|
||||
#endif
|
||||
if( display_date > current_date + VOUT_DISPLAY_DELAY )
|
||||
{
|
||||
/* A picture is ready to be rendered, but its rendering date is
|
||||
@ -993,7 +993,7 @@ last_display_date = display_date;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Picture will be displayed, update synchronization
|
||||
/* Picture will be displayed, update synchronization
|
||||
* information */
|
||||
Synchronize( p_vout, display_date - current_date );
|
||||
}
|
||||
@ -1003,7 +1003,7 @@ last_display_date = display_date;
|
||||
* only READY_SUBPICTURES are handled. If no picture has been selected,
|
||||
* display_date will depend on the subpicture
|
||||
*/
|
||||
//??
|
||||
/* XXX?? */
|
||||
|
||||
/*
|
||||
* Perform rendering, sleep and display rendered picture
|
||||
@ -1031,12 +1031,12 @@ last_display_date = display_date;
|
||||
vlc_mutex_lock( &p_vout->picture_lock );
|
||||
if( p_pic->i_refcount )
|
||||
{
|
||||
p_pic->i_status = DISPLAYED_PICTURE;
|
||||
p_pic->i_status = DISPLAYED_PICTURE;
|
||||
}
|
||||
else
|
||||
{
|
||||
p_pic->i_status = DESTROYED_PICTURE;
|
||||
p_vout->i_pictures--;
|
||||
p_vout->i_pictures--;
|
||||
}
|
||||
vlc_mutex_unlock( &p_vout->picture_lock );
|
||||
|
||||
@ -1088,7 +1088,7 @@ last_display_date = display_date;
|
||||
}
|
||||
else if( p_vout->b_active ) /* idle or interface screen alone */
|
||||
{
|
||||
if( p_vout->b_interface && 0 /* && ?? intf_change */ )
|
||||
if( p_vout->b_interface && 0 /* && XXX?? intf_change */ )
|
||||
{
|
||||
/* Interface has changed, so a new rendering is required - force
|
||||
* it by setting last idle date to 0 */
|
||||
@ -1848,7 +1848,7 @@ static void RenderInterface( vout_thread_t *p_vout )
|
||||
i_byte < p_vout->i_height * p_vout->i_bytes_per_line;
|
||||
i_byte++ )
|
||||
{
|
||||
//?? noooo !
|
||||
/* XXX?? noooo ! */
|
||||
p_vout->p_buffer[ p_vout->i_buffer_index ].p_data[ i_byte ] = p_vout->i_blue_pixel;
|
||||
}
|
||||
|
||||
@ -1882,7 +1882,7 @@ static void RenderInterface( vout_thread_t *p_vout )
|
||||
static void Synchronize( vout_thread_t *p_vout, s64 i_delay )
|
||||
{
|
||||
int i_synchro_inc = 0;
|
||||
//???? gore following
|
||||
/* XXX?? gore following */
|
||||
static int i_panic_count = 0;
|
||||
static int i_last_synchro_inc = 0;
|
||||
static float r_synchro_level = VOUT_SYNCHRO_LEVEL_START;
|
||||
@ -1893,16 +1893,16 @@ static void Synchronize( vout_thread_t *p_vout, s64 i_delay )
|
||||
//fprintf( stderr, "PANIC %d\n", i_panic_count );
|
||||
i_panic_count++;
|
||||
}
|
||||
|
||||
|
||||
i_truc *= 2;
|
||||
|
||||
|
||||
if( p_vout->i_pictures > VOUT_SYNCHRO_HEAP_IDEAL_SIZE+1 )
|
||||
{
|
||||
i_truc = 40;
|
||||
i_synchro_inc += p_vout->i_pictures - VOUT_SYNCHRO_HEAP_IDEAL_SIZE - 1;
|
||||
|
||||
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
if( p_vout->i_pictures < VOUT_SYNCHRO_HEAP_IDEAL_SIZE )
|
||||
{
|
||||
@ -1910,13 +1910,13 @@ static void Synchronize( vout_thread_t *p_vout, s64 i_delay )
|
||||
i_synchro_inc += p_vout->i_pictures - VOUT_SYNCHRO_HEAP_IDEAL_SIZE;
|
||||
}
|
||||
}
|
||||
|
||||
if( i_truc > VOUT_SYNCHRO_LEVEL_MAX*2*2*2*2*2 ||
|
||||
|
||||
if( i_truc > VOUT_SYNCHRO_LEVEL_MAX*2*2*2*2*2 ||
|
||||
i_synchro_inc*i_last_synchro_inc < 0 )
|
||||
{
|
||||
i_truc = 32;
|
||||
}
|
||||
|
||||
|
||||
if( i_delay < 6000 )
|
||||
{
|
||||
i_truc = 16;
|
||||
@ -1928,25 +1928,25 @@ static void Synchronize( vout_thread_t *p_vout, s64 i_delay )
|
||||
if( i_truc < 16 )
|
||||
i_truc = 16;
|
||||
i_synchro_inc -= 1+(5*(70000-i_delay))/70000;
|
||||
}
|
||||
}
|
||||
else if( i_delay > 100000 )
|
||||
{
|
||||
r_synchro_level += 1;
|
||||
if( i_delay > 130000 )
|
||||
r_synchro_level += 1;
|
||||
}
|
||||
|
||||
|
||||
r_synchro_level += (float)i_synchro_inc / i_truc;
|
||||
p_vout->i_synchro_level = (int)(r_synchro_level+0.5);
|
||||
|
||||
|
||||
if( r_synchro_level > VOUT_SYNCHRO_LEVEL_MAX )
|
||||
{
|
||||
r_synchro_level = VOUT_SYNCHRO_LEVEL_MAX;
|
||||
}
|
||||
|
||||
//fprintf( stderr, "synchro level : %d, heap : %d (%d, %d) (%d, %f) - %Ld\n", p_vout->i_synchro_level,
|
||||
// p_vout->i_pictures, i_last_synchro_inc, i_synchro_inc, i_truc, r_synchro_level, i_delay );
|
||||
i_last_synchro_inc = i_synchro_inc;
|
||||
// p_vout->i_pictures, i_last_synchro_inc, i_synchro_inc, i_truc, r_synchro_level, i_delay );
|
||||
i_last_synchro_inc = i_synchro_inc;
|
||||
}
|
||||
|
||||
/*****************************************************************************
|
||||
|
@ -350,7 +350,7 @@ void vout_Print( vout_font_t *p_font, byte_t *p_pic, int i_bytes_per_pixel, int
|
||||
int i_font_bytes_per_line, i_font_height; /* font properties */
|
||||
vout_put_byte_t *p_PutByte; /* PutByte function */
|
||||
|
||||
//?? background: can be something else that whole byte
|
||||
/* FIXME: background: can be something else that whole byte ?? */
|
||||
|
||||
/* Select output function */
|
||||
switch( i_bytes_per_pixel )
|
||||
@ -479,7 +479,7 @@ static void PutByte16( u16 *p_pic, int i_byte, int i_char, int i_border,
|
||||
static void PutByte24( void *p_pic, int i_byte, byte_t i_char, byte_t i_border, byte_t i_bg,
|
||||
u32 i_char_color, u32 i_border_color, u32 i_bg_color )
|
||||
{
|
||||
//??
|
||||
/* XXX?? */
|
||||
}
|
||||
|
||||
/*****************************************************************************
|
||||
|
@ -1,75 +0,0 @@
|
||||
/*****************************************************************************
|
||||
* video_x11.h: X11 video output display method
|
||||
* (c)1999 VideoLAN
|
||||
*****************************************************************************
|
||||
* The X11 method for video output thread. The functions declared here should
|
||||
* not be needed by any other module than video_output.c.
|
||||
*****************************************************************************
|
||||
* Required headers:
|
||||
* <X11/Xlib.h>
|
||||
* <X11/Xutil.h>
|
||||
* <X11/extensions/XShm.h>
|
||||
* "config.h"
|
||||
* "common.h"
|
||||
* "mtime.h"
|
||||
* "video.h"
|
||||
* "video_output.h"
|
||||
*****************************************************************************/
|
||||
|
||||
/*****************************************************************************
|
||||
* vout_x11_t: video output X11 method descriptor
|
||||
*****************************************************************************
|
||||
* This structure is part of the video output thread descriptor.
|
||||
* It describes the X11 specific properties of an output thread. X11 video
|
||||
* output is performed through regular resizable windows. Windows can be
|
||||
* dynamically resized to adapt to the size of the streams.
|
||||
*****************************************************************************/
|
||||
typedef struct vout_x11_s
|
||||
{
|
||||
/* User settings */
|
||||
boolean_t b_shm_ext; /* shared memory extension flag */
|
||||
|
||||
/* Thread configuration - these properties are copied from a video_cfg_t
|
||||
* structure to be used in second step of initialization */
|
||||
char * psz_display; /* display name */
|
||||
char * psz_title; /* window title */
|
||||
|
||||
/* Internal settings and properties */
|
||||
Display * p_display; /* display pointer */
|
||||
int i_screen; /* screen number */
|
||||
Window window; /* window instance handler */
|
||||
GC gc; /* graphic context instance handler */
|
||||
|
||||
/* Window manager hints and atoms */
|
||||
Atom wm_protocols; /* WM_PROTOCOLS atom */
|
||||
Atom wm_delete_window; /* WM_DELETE_WINDOW atom */
|
||||
|
||||
/* Color maps and translation tables - some of those tables are shifted,
|
||||
* see x11.c for more informations. */
|
||||
u8 * trans_16bpp_red; /* red (16 bpp) (SHIFTED !) */
|
||||
u8 * trans_16bpp_green; /* green (16 bpp) (SHIFTED !) */
|
||||
u8 * trans_16bpp_blue; /* blue (16 bpp) (SHIFTED !) */
|
||||
|
||||
/* ?? colormaps ? */
|
||||
boolean_t b_private_colormap; /* private color map flag */
|
||||
Colormap private_colormap; /* private color map */
|
||||
|
||||
/* Display buffers and shared memory information */
|
||||
int i_buffer_index; /* buffer index */
|
||||
XImage * p_ximage[2]; /* XImage pointer */
|
||||
XShmSegmentInfo shm_info[2]; /* shared memory zone information */
|
||||
|
||||
int i_completion_type; /* ?? */
|
||||
} vout_x11_t;
|
||||
|
||||
/*****************************************************************************
|
||||
* Prototypes
|
||||
*****************************************************************************/
|
||||
int vout_X11AllocOutputMethod ( vout_thread_t *p_vout, video_cfg_t *p_cfg );
|
||||
void vout_X11FreeOutputMethod ( vout_thread_t *p_vout );
|
||||
int vout_X11CreateOutputMethod ( vout_thread_t *p_vout );
|
||||
void vout_X11DestroyOutputMethod ( vout_thread_t *p_vout );
|
||||
int vout_X11ManageOutputMethod ( vout_thread_t *p_vout );
|
||||
void vout_X11DisplayOutput ( vout_thread_t *p_vout );
|
||||
|
||||
|
@ -991,7 +991,7 @@ static void ConvertY4Gray24( p_vout_thread_t p_vout, void *p_pic, yuv_data_t *p_
|
||||
int i_width, int i_height, int i_pic_width, int i_pic_height, int i_pic_line_width,
|
||||
int i_matrix_coefficients )
|
||||
{
|
||||
//??
|
||||
/* XXX?? */
|
||||
}
|
||||
|
||||
/*****************************************************************************
|
||||
@ -1083,12 +1083,14 @@ static void ConvertYUV420RGB8( p_vout_thread_t p_vout, u8 *p_pic, yuv_data_t *p_
|
||||
int dither23[4] = { 0x1e, 0xe, 0x1a, 0xa };
|
||||
|
||||
/* other matrices that can be interesting, either for debugging or for effects */
|
||||
//int dither[4][4] = { { 0, 8, 2, 10 }, { 12, 4, 14, 16 }, { 3, 11, 1, 9}, {15, 7, 13, 5} };
|
||||
//int dither[4][4] = { { 7, 8, 0, 15 }, { 0, 15, 8, 7 }, { 7, 0, 15, 8 }, { 15, 7, 8, 0 } };
|
||||
//int dither[4][4] = { { 0, 15, 0, 15 }, { 15, 0, 15, 0 }, { 0, 15, 0, 15 }, { 15, 0, 15, 0 } };
|
||||
//int dither[4][4] = { { 15, 15, 0, 0 }, { 15, 15, 0, 0 }, { 0, 0, 15, 15 }, { 0, 0, 15, 15 } };
|
||||
//int dither[4][4] = { { 8, 8, 8, 8 }, { 8, 8, 8, 8 }, { 8, 8, 8, 8 }, { 8, 8, 8, 8 } };
|
||||
//int dither[4][4] = { { 0, 1, 2, 3 }, { 4, 5, 6, 7 }, { 8, 9, 10, 11 }, { 12, 13, 14, 15 } };
|
||||
#if 0
|
||||
int dither[4][4] = { { 0, 8, 2, 10 }, { 12, 4, 14, 16 }, { 3, 11, 1, 9}, {15, 7, 13, 5} };
|
||||
int dither[4][4] = { { 7, 8, 0, 15 }, { 0, 15, 8, 7 }, { 7, 0, 15, 8 }, { 15, 7, 8, 0 } };
|
||||
int dither[4][4] = { { 0, 15, 0, 15 }, { 15, 0, 15, 0 }, { 0, 15, 0, 15 }, { 15, 0, 15, 0 } };
|
||||
int dither[4][4] = { { 15, 15, 0, 0 }, { 15, 15, 0, 0 }, { 0, 0, 15, 15 }, { 0, 0, 15, 15 } };
|
||||
int dither[4][4] = { { 8, 8, 8, 8 }, { 8, 8, 8, 8 }, { 8, 8, 8, 8 }, { 8, 8, 8, 8 } };
|
||||
int dither[4][4] = { { 0, 1, 2, 3 }, { 4, 5, 6, 7 }, { 8, 9, 10, 11 }, { 12, 13, 14, 15 } };
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Initialize some values - i_pic_line_width will store the line skip
|
||||
@ -1247,9 +1249,10 @@ static void ConvertYUV420RGB16( p_vout_thread_t p_vout, u16 *p_pic, yuv_data_t *
|
||||
int i_width, int i_height, int i_pic_width, int i_pic_height, int i_pic_line_width,
|
||||
int i_matrix_coefficients )
|
||||
{
|
||||
/* MMX version */
|
||||
// int i_chroma_width, i_chroma_skip; /* width and eol for chroma */
|
||||
/*
|
||||
#if 0
|
||||
/* MMX version */
|
||||
int i_chroma_width, i_chroma_skip; /* width and eol for chroma */
|
||||
|
||||
i_chroma_width = i_width / 2;
|
||||
i_chroma_skip = i_skip / 2;
|
||||
ConvertYUV420RGB16MMX( p_y, p_u, p_v, i_width, i_height,
|
||||
@ -1257,7 +1260,7 @@ static void ConvertYUV420RGB16( p_vout_thread_t p_vout, u16 *p_pic, yuv_data_t *
|
||||
(i_chroma_width + i_chroma_skip) * sizeof( yuv_data_t),
|
||||
i_scale, (u8 *)p_pic, 0, 0, (i_width + i_pic_eol) * sizeof( u16 ),
|
||||
p_vout->i_screen_depth == 15 );
|
||||
*/
|
||||
#endif
|
||||
boolean_t b_horizontal_scaling; /* horizontal scaling type */
|
||||
int i_vertical_scaling; /* vertical scaling type */
|
||||
int i_x, i_y; /* horizontal and vertical indexes */
|
||||
@ -1449,7 +1452,7 @@ static void ConvertYUV420RGB24( p_vout_thread_t p_vout, void *p_pic, yuv_data_t
|
||||
int i_width, int i_height, int i_pic_width, int i_pic_height, int i_pic_line_width,
|
||||
int i_matrix_coefficients )
|
||||
{
|
||||
//???
|
||||
/* XXX?? */
|
||||
}
|
||||
|
||||
/*****************************************************************************
|
||||
@ -1459,7 +1462,7 @@ static void ConvertYUV422RGB24( p_vout_thread_t p_vout, void *p_pic, yuv_data_t
|
||||
int i_width, int i_height, int i_pic_width, int i_pic_height, int i_pic_line_width,
|
||||
int i_matrix_coefficients )
|
||||
{
|
||||
//???
|
||||
/* XXX?? */
|
||||
}
|
||||
|
||||
/*****************************************************************************
|
||||
@ -1469,7 +1472,7 @@ static void ConvertYUV444RGB24( p_vout_thread_t p_vout, void *p_pic, yuv_data_t
|
||||
int i_width, int i_height, int i_pic_width, int i_pic_height, int i_pic_line_width,
|
||||
int i_matrix_coefficients )
|
||||
{
|
||||
//???
|
||||
/* XXX?? */
|
||||
}
|
||||
|
||||
/*****************************************************************************
|
||||
@ -1663,7 +1666,7 @@ static void ConvertYUV444RGB32( p_vout_thread_t p_vout, u32 *p_pic, yuv_data_t *
|
||||
}
|
||||
}
|
||||
|
||||
//-------------------- walken code follows ------------------------------------
|
||||
/*-------------------- walken code follows ----------------------------------*/
|
||||
|
||||
/*
|
||||
* YUV to RGB routines.
|
||||
@ -1689,7 +1692,7 @@ static void ConvertYUV444RGB32( p_vout_thread_t p_vout, u32 *p_pic, yuv_data_t *
|
||||
*/
|
||||
|
||||
#if 0
|
||||
//??
|
||||
/* XXX?? */
|
||||
static void yuvToRgb24 (unsigned char * Y,
|
||||
unsigned char * U, unsigned char * V,
|
||||
char * dest, int table[1935], int width)
|
||||
|
@ -24,8 +24,8 @@ void vout_EndYUV ( vout_thread_t *p_vout );
|
||||
* i_ypitch, i_vpitch: Y and V lines sizes (bytes)
|
||||
* i_aspect: vertical aspect factor
|
||||
* p_pic: RGB frame
|
||||
* i_dci_offset: ?? x offset for left image border
|
||||
* i_offset_to_line_0: ?? x offset for left image border
|
||||
* i_dci_offset: XXX?? x offset for left image border
|
||||
* i_offset_to_line_0: XXX?? x offset for left image border
|
||||
* i_pitch: RGB line size (bytes)
|
||||
* i_colortype: 0 for 565, 1 for 555 */
|
||||
void ConvertYUV420RGB16MMX( u8* p_y, u8* p_u, u8 *p_v,
|
||||
|
@ -19,7 +19,7 @@
|
||||
#include "vlc_thread.h"
|
||||
|
||||
#include "intf_msg.h"
|
||||
#include "debug.h" /* ?? temporaire, requis par netlist.h */
|
||||
#include "debug.h" /* XXX?? temporaire, requis par netlist.h */
|
||||
|
||||
#include "input.h"
|
||||
#include "input_netlist.h"
|
||||
|
@ -3,7 +3,7 @@
|
||||
* (c)1999 VideoLAN
|
||||
*****************************************************************************/
|
||||
|
||||
/* ?? passer en terminate/destroy avec les signaux supplémentaires */
|
||||
/* FIXME: passer en terminate/destroy avec les signaux supplémentaires ?? */
|
||||
|
||||
/*****************************************************************************
|
||||
* Preamble
|
||||
@ -21,7 +21,7 @@
|
||||
#include "vlc_thread.h"
|
||||
|
||||
#include "intf_msg.h"
|
||||
#include "debug.h" /* ?? temporaire, requis par netlist.h */
|
||||
#include "debug.h" /* XXX?? temporaire, requis par netlist.h */
|
||||
|
||||
#include "input.h"
|
||||
#include "input_netlist.h"
|
||||
@ -54,7 +54,7 @@ static void EndThread ( vpar_thread_t *p_vpar );
|
||||
* This function creates a new video parser thread, and returns a pointer
|
||||
* to its description. On error, it returns NULL.
|
||||
* Following configuration properties are used:
|
||||
* ??
|
||||
* XXX??
|
||||
*****************************************************************************/
|
||||
#include "main.h"
|
||||
#include "interface.h"
|
||||
@ -94,7 +94,7 @@ vpar_thread_t * vpar_CreateThread( /* video_cfg_t *p_cfg, */ input_thread_t *p_i
|
||||
p_vpar->bit_stream.fifo.buffer = 0;
|
||||
p_vpar->bit_stream.fifo.i_available = 0;
|
||||
|
||||
/* FIXME !!!! */
|
||||
/* FIXME !!!!?? */
|
||||
p_vpar->p_vout = p_main->p_intf->p_vout;
|
||||
|
||||
/* Spawn the video parser thread */
|
||||
@ -143,7 +143,7 @@ void vpar_DestroyThread( vpar_thread_t *p_vpar /*, int *pi_status */ )
|
||||
#if 0
|
||||
static int CheckConfiguration( video_cfg_t *p_cfg )
|
||||
{
|
||||
/* ?? */
|
||||
/* XXX?? */
|
||||
|
||||
return( 0 );
|
||||
}
|
||||
@ -223,7 +223,7 @@ static int InitThread( vpar_thread_t *p_vpar )
|
||||
|
||||
#ifdef VDEC_SMP
|
||||
/* Spawn video_decoder threads */
|
||||
/* ??? modify the number of vdecs at runtime ? */
|
||||
/* FIXME: modify the number of vdecs at runtime ?? */
|
||||
for( i_dummy = 0; i_dummy < NB_VDEC; i_dummy++ )
|
||||
{
|
||||
if( (p_vpar->pp_vdec[i_dummy] = vdec_CreateThread( p_vpar )) == NULL )
|
||||
@ -306,14 +306,14 @@ static int InitThread( vpar_thread_t *p_vpar )
|
||||
#ifdef POLUX_SYNCHRO
|
||||
p_vpar->synchro.i_current_frame_date = 0;
|
||||
p_vpar->synchro.i_backward_frame_date = 0;
|
||||
|
||||
|
||||
p_vpar->synchro.r_p_average = p_vpar->synchro.i_p_nb = 6;
|
||||
p_vpar->synchro.r_b_average = p_vpar->synchro.i_b_nb = 6;
|
||||
p_vpar->synchro.i_p_count = 0;
|
||||
p_vpar->synchro.i_b_count = 0;
|
||||
p_vpar->synchro.i_i_count = 0;
|
||||
#endif
|
||||
|
||||
|
||||
/* Mark thread as running and return */
|
||||
intf_DbgMsg("vpar debug: InitThread(%p) succeeded\n", p_vpar);
|
||||
return( 0 );
|
||||
@ -421,12 +421,12 @@ static void EndThread( vpar_thread_t *p_vpar )
|
||||
|
||||
#ifdef DEBUG
|
||||
/* Check for remaining PES packets */
|
||||
/* ?? */
|
||||
/* XXX?? */
|
||||
#endif
|
||||
|
||||
/* Destroy thread structures allocated by InitThread */
|
||||
// vout_DestroyStream( p_vpar->p_vout, p_vpar->i_stream );
|
||||
/* ?? */
|
||||
/* XXX?? */
|
||||
|
||||
/* Dispose of matrices if they have been allocated. */
|
||||
if( p_vpar->sequence.intra_quant.b_allocated )
|
||||
|
@ -19,7 +19,7 @@
|
||||
#include "vlc_thread.h"
|
||||
|
||||
#include "intf_msg.h"
|
||||
#include "debug.h" /* ?? temporaire, requis par netlist.h */
|
||||
#include "debug.h" /* XXX?? temporaire, requis par netlist.h */
|
||||
|
||||
#include "input.h"
|
||||
#include "input_netlist.h"
|
||||
@ -137,7 +137,7 @@ static lookup_t pl_coded_pattern[512] =
|
||||
* Tables are cut in two parts to reduce memory occupation
|
||||
*/
|
||||
|
||||
/* Table B-12, dct_dc_size_luminance, codes 00xxx ... 11110 */
|
||||
/* Table B-12, dct_dc_size_luminance, codes 00XXX ... 11110 */
|
||||
static lookup_t pl_dct_dc_lum_init_table_1[32] =
|
||||
{ {1, 2}, {1, 2}, {1, 2}, {1, 2}, {1, 2}, {1, 2}, {1, 2}, {1, 2},
|
||||
{2, 2}, {2, 2}, {2, 2}, {2, 2}, {2, 2}, {2, 2}, {2, 2}, {2, 2},
|
||||
@ -163,7 +163,7 @@ static lookup_t pl_dct_dc_chrom_init_table_1[32] =
|
||||
{3, 3}, {3, 3}, {3, 3}, {3, 3}, {4, 4}, {4, 4}, {5, 5}, {MB_ERROR, 0}
|
||||
};
|
||||
|
||||
/* Table B-13, dct_dc_size_chrominance, codes 111110xxxx ... 1111111111 */
|
||||
/* Table B-13, dct_dc_size_chrominance, codes 111110xxxx ... 1111111111 */
|
||||
static lookup_t pl_dct_dc_chrom_init_table_2[32] =
|
||||
{ {6, 6}, {6, 6}, {6, 6}, {6, 6}, {6, 6}, {6, 6}, {6, 6}, {6, 6},
|
||||
{6, 6}, {6, 6}, {6, 6}, {6, 6}, {6, 6}, {6, 6}, {6, 6}, {6, 6},
|
||||
@ -543,11 +543,11 @@ void vpar_InitDCTTables( vpar_thread_t * p_vpar )
|
||||
p_vpar->pppl_dct_dc_size[1][0] = pl_dct_dc_chrom_init_table_1;
|
||||
p_vpar->pppl_dct_dc_size[1][1] = pl_dct_dc_chrom_init_table_2;
|
||||
|
||||
/* ??? MB_ERROR is replaced by 0 because if we use -1 we
|
||||
/* XXX?? MB_ERROR is replaced by 0 because if we use -1 we
|
||||
* can block in DecodeMPEG2Intra and others */
|
||||
memset( p_vpar->ppl_dct_coef[0], 0, 16 );
|
||||
memset( p_vpar->ppl_dct_coef[1], 0, 16 );
|
||||
|
||||
|
||||
/* For table B14 & B15, we have a pointer to tables */
|
||||
/* We fill the table thanks to the fonction defined above */
|
||||
FillDCTTable( p_vpar->ppl_dct_coef[0], pl_DCT_tab0, 256, 60, 4 );
|
||||
@ -1485,7 +1485,7 @@ static __inline__ void MacroblockModes( vpar_thread_t * p_vpar,
|
||||
p_vpar->mb.i_motion_type = MOTION_FRAME;
|
||||
}
|
||||
|
||||
/* ???? */
|
||||
/* XXX?? */
|
||||
p_vpar->mb.i_mv_count = ppi_mv_count[i_structure == FRAME_STRUCTURE]
|
||||
[p_vpar->mb.i_motion_type];
|
||||
p_vpar->mb.i_mv_format = ppi_mv_format[i_structure == FRAME_STRUCTURE]
|
||||
@ -1646,7 +1646,7 @@ i_count++;
|
||||
p_vpar->picture.b_error = 1;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if( *pi_mb_address - i_mb_previous - 1 )
|
||||
{
|
||||
/* Skipped macroblock (ISO/IEC 13818-2 7.6.6). */
|
||||
@ -1858,7 +1858,7 @@ static __inline__ void SliceHeader( vpar_thread_t * p_vpar,
|
||||
{
|
||||
RemoveBits( &p_vpar->bit_stream, 8 );
|
||||
}
|
||||
}
|
||||
}
|
||||
*pi_mb_address = (i_vert_code - 1)*p_vpar->sequence.i_mb_width;
|
||||
|
||||
if( *pi_mb_address < i_mb_address_save )
|
||||
@ -1881,7 +1881,7 @@ static __inline__ void SliceHeader( vpar_thread_t * p_vpar,
|
||||
if( i_mb_address_save >= p_vpar->sequence.i_mb_size )
|
||||
{
|
||||
p_vpar->picture.b_error = 1;
|
||||
return;
|
||||
return;
|
||||
}
|
||||
ParseMacroblock( p_vpar, pi_mb_address, i_mb_address_save,
|
||||
i_mb_base, b_mpeg2, i_coding_type,
|
||||
|
@ -19,7 +19,7 @@
|
||||
#include "vlc_thread.h"
|
||||
|
||||
#include "intf_msg.h"
|
||||
#include "debug.h" /* ?? temporaire, requis par netlist.h */
|
||||
#include "debug.h" /* XXX?? temporaire, requis par netlist.h */
|
||||
|
||||
#include "input.h"
|
||||
#include "input_netlist.h"
|
||||
@ -458,7 +458,7 @@ static void SequenceHeader( vpar_thread_t * p_vpar )
|
||||
if( p_vpar->sequence.i_width != i_width_save
|
||||
|| p_vpar->sequence.i_height != i_height_save )
|
||||
{
|
||||
/* What do we do in case of a size change ??? */
|
||||
/* FIXME: What do we do in case of a size change ?? */
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -529,7 +529,7 @@ static void PictureHeader( vpar_thread_t * p_vpar )
|
||||
RemoveBits( &p_vpar->bit_stream, 10 ); /* temporal_reference */
|
||||
p_vpar->picture.i_coding_type = GetBits( &p_vpar->bit_stream, 3 );
|
||||
RemoveBits( &p_vpar->bit_stream, 16 ); /* vbv_delay */
|
||||
|
||||
|
||||
if( p_vpar->picture.i_coding_type == P_CODING_TYPE
|
||||
|| p_vpar->picture.i_coding_type == B_CODING_TYPE )
|
||||
{
|
||||
@ -656,7 +656,7 @@ static void PictureHeader( vpar_thread_t * p_vpar )
|
||||
vpar_SynchroTrash( p_vpar, p_vpar->picture.i_coding_type, i_structure );
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
if( !b_parsable )
|
||||
{
|
||||
/* Update the reference pointers. */
|
||||
@ -682,7 +682,7 @@ static void PictureHeader( vpar_thread_t * p_vpar )
|
||||
{
|
||||
/* This is a new frame. Get a structure from the video_output. */
|
||||
while( ( P_picture = vout_CreatePicture( p_vpar->p_vout,
|
||||
99+p_vpar->sequence.i_chroma_format, /*???*/
|
||||
99+p_vpar->sequence.i_chroma_format, /*XXX??*/
|
||||
p_vpar->sequence.i_width,
|
||||
p_vpar->sequence.i_height ) )
|
||||
== NULL )
|
||||
@ -709,7 +709,7 @@ static void PictureHeader( vpar_thread_t * p_vpar )
|
||||
#ifdef VDEC_SMP
|
||||
memset( p_vpar->picture.pp_mb, 0, MAX_MB*sizeof(macroblock_t *) );
|
||||
#endif
|
||||
/* FIXME ! remove asap */
|
||||
/* FIXME ! remove asap ?? */
|
||||
//memset( P_picture->p_data, 0, (p_vpar->sequence.i_mb_size*384));
|
||||
|
||||
/* Update the reference pointers. */
|
||||
|
@ -19,7 +19,7 @@
|
||||
#include "vlc_thread.h"
|
||||
|
||||
#include "intf_msg.h"
|
||||
#include "debug.h" /* ?? temporaire, requis par netlist.h */
|
||||
#include "debug.h" /* XXX?? temporaire, requis par netlist.h */
|
||||
|
||||
#include "input.h"
|
||||
#include "input_netlist.h"
|
||||
@ -49,7 +49,7 @@
|
||||
*****************************************************************************/
|
||||
float vpar_SynchroUpdateTab( video_synchro_tab_t * tab, int count )
|
||||
{
|
||||
|
||||
|
||||
tab->mean = ( tab->mean + MAX_COUNT * count ) / ( MAX_COUNT + 1 );
|
||||
tab->deviation = ( tab->deviation + MAX_COUNT * abs (tab->mean - count) )
|
||||
/ ( MAX_COUNT + 1 );
|
||||
@ -210,7 +210,7 @@ void vpar_SynchroUpdateStructures( vpar_thread_t * p_vpar,
|
||||
|
||||
p_vpar->synchro.b_count_predict = predict;
|
||||
p_vpar->synchro.current_b_count = 0;
|
||||
|
||||
|
||||
/* now we calculated all statistics, it's time to
|
||||
* decide what we have the time to display
|
||||
*/
|
||||
@ -524,10 +524,10 @@ void vpar_SynchroKludge( vpar_thread_t * p_vpar, mtime_t date )
|
||||
|
||||
void vpar_SynchroSetCurrentDate( vpar_thread_t * p_vpar, int i_coding_type )
|
||||
{
|
||||
pes_packet_t * p_pes =
|
||||
p_vpar->bit_stream.p_decoder_fifo->buffer[p_vpar->bit_stream.p_decoder_fifo->i_start];
|
||||
pes_packet_t * p_pes =
|
||||
p_vpar->bit_stream.p_decoder_fifo->buffer[p_vpar->bit_stream.p_decoder_fifo->i_start];
|
||||
|
||||
|
||||
|
||||
switch( i_coding_type )
|
||||
{
|
||||
case B_CODING_TYPE:
|
||||
@ -545,7 +545,7 @@ void vpar_SynchroSetCurrentDate( vpar_thread_t * p_vpar, int i_coding_type )
|
||||
p_vpar->synchro.i_current_frame_date += 1000000/(p_vpar->sequence.r_frame_rate);
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
|
||||
if( p_vpar->synchro.i_backward_frame_date == 0 )
|
||||
@ -577,14 +577,14 @@ boolean_t vpar_SynchroChoose( vpar_thread_t * p_vpar, int i_coding_type,
|
||||
{
|
||||
boolean_t b_result = 1;
|
||||
int i_synchro_level = p_vpar->p_vout->i_synchro_level;
|
||||
|
||||
|
||||
vpar_SynchroSetCurrentDate( p_vpar, i_coding_type );
|
||||
|
||||
/*
|
||||
/*
|
||||
* The synchro level is updated by the video input (see SynchroLevelUpdate)
|
||||
* so we just use the synchro_level to decide which frame to trash
|
||||
*/
|
||||
|
||||
|
||||
switch( i_coding_type )
|
||||
{
|
||||
case I_CODING_TYPE:
|
||||
@ -596,7 +596,7 @@ boolean_t vpar_SynchroChoose( vpar_thread_t * p_vpar, int i_coding_type,
|
||||
(p_vpar->synchro.r_p_average*(SYNC_AVERAGE_COUNT-1)+p_vpar->synchro.i_p_count)/SYNC_AVERAGE_COUNT;
|
||||
p_vpar->synchro.r_b_average =
|
||||
(p_vpar->synchro.r_b_average*(SYNC_AVERAGE_COUNT-1)+p_vpar->synchro.i_b_count)/SYNC_AVERAGE_COUNT;
|
||||
|
||||
|
||||
p_vpar->synchro.i_p_nb = (int)(p_vpar->synchro.r_p_average+0.5);
|
||||
p_vpar->synchro.i_b_nb = (int)(p_vpar->synchro.r_b_average+0.5);
|
||||
|
||||
@ -612,7 +612,7 @@ boolean_t vpar_SynchroChoose( vpar_thread_t * p_vpar, int i_coding_type,
|
||||
b_result = 0;
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case B_CODING_TYPE:
|
||||
p_vpar->synchro.i_b_count++;
|
||||
if( p_vpar->synchro.i_p_nb >= i_synchro_level )
|
||||
@ -633,7 +633,7 @@ boolean_t vpar_SynchroChoose( vpar_thread_t * p_vpar, int i_coding_type,
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
return( b_result );
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user