Commit 6a7b7ae7 authored by Stéphane Borel's avatar Stéphane Borel

* Fonction de d�codage des Blocs MPEG2intra.
* Correction d'erreurs sur la gestion des tables de lookup
parent 77fdd47e
/******************************************************************************* /*****************************************************************************
* video_decoder.h : video decoder thread * video_decoder.h : video decoder thread
* (c)1999 VideoLAN * (c)1999 VideoLAN
******************************************************************************* *****************************************************************************
******************************************************************************* *****************************************************************************
* Requires: * Requires:
* "config.h" * "config.h"
* "common.h" * "common.h"
...@@ -12,13 +12,13 @@ ...@@ -12,13 +12,13 @@
* "video.h" * "video.h"
* "video_output.h" * "video_output.h"
* "decoder_fifo.h" * "decoder_fifo.h"
*******************************************************************************/ *****************************************************************************/
/******************************************************************************* /*****************************************************************************
* vdec_thread_t: video decoder thread descriptor * vdec_thread_t: video decoder thread descriptor
******************************************************************************* *****************************************************************************
* ?? * ??
*******************************************************************************/ *****************************************************************************/
typedef struct vdec_thread_s typedef struct vdec_thread_s
{ {
/* Thread properties and locks */ /* Thread properties and locks */
...@@ -33,26 +33,19 @@ typedef struct vdec_thread_s ...@@ -33,26 +33,19 @@ typedef struct vdec_thread_s
/*??*/ /*??*/
// int *pi_status; // int *pi_status;
/* Input properties */ /* Input properties */
decoder_fifo_t fifo; /* PES input fifo */ struct vpar_thread_s * p_vpar; /* video_parser thread */
/* The bit stream structure handles the PES stream at the bit level */
bit_stream_t bit_stream;
/* Output properties */
vout_thread_t * p_vout; /* video output thread */
int i_stream; /* video stream id */
/* Lookup tables */
#ifdef MPEG2_COMPLIANT
u8 pi_crop_buf[VDEC_CROPRANGE];
u8 * pi_crop,
#endif
#ifdef STATS #ifdef STATS
/* Statistics */ /* Statistics */
count_t c_loops; /* number of loops */ count_t c_loops; /* number of loops */
count_t c_idle_loops; /* number of idle loops */ count_t c_idle_loops; /* number of idle loops */
count_t c_pictures; /* number of pictures read */
count_t c_i_pictures; /* number of I pictures read */
count_t c_p_pictures; /* number of P pictures read */
count_t c_b_pictures; /* number of B pictures read */
count_t c_decoded_pictures; /* number of pictures decoded */ count_t c_decoded_pictures; /* number of pictures decoded */
count_t c_decoded_i_pictures; /* number of I pictures decoded */ count_t c_decoded_i_pictures; /* number of I pictures decoded */
count_t c_decoded_p_pictures; /* number of P pictures decoded */ count_t c_decoded_p_pictures; /* number of P pictures decoded */
...@@ -60,17 +53,22 @@ typedef struct vdec_thread_s ...@@ -60,17 +53,22 @@ typedef struct vdec_thread_s
#endif #endif
} vdec_thread_t; } vdec_thread_t;
/******************************************************************************* /* Move this somewhere else ASAP !! */
#define data_t short
/*****************************************************************************
* Function pointers
*****************************************************************************/
typedef void (*f_addb_t)( vdec_thread_t*, elem_t*, data_t*, int );
/*****************************************************************************
* Prototypes * Prototypes
*******************************************************************************/ *****************************************************************************/
struct vpar_thread_s;
/* Thread management functions */ /* Thread management functions */
p_vdec_thread_t vdec_CreateThread ( /* video_cfg_t *p_cfg, */ input_thread_t *p_input /*, vdec_thread_t * vdec_CreateThread ( struct vpar_thread_s *p_vpar /*, int *pi_status */ );
vout_thread_t *p_vout, int *pi_status */ );
void vdec_DestroyThread ( vdec_thread_t *p_vdec /*, int *pi_status */ ); void vdec_DestroyThread ( vdec_thread_t *p_vdec /*, int *pi_status */ );
void vdec_AddBlock( vdec_thread_t*, elem_t*, data_t*, int );
/* Time management functions */ void vdec_CopyBlock( vdec_thread_t*, elem_t*, data_t*, int );
/* ?? */ void vdec_DummyBlock( vdec_thread_t*, elem_t*, data_t*, int );
/* Dynamic thread settings */
/* ?? */
...@@ -65,12 +65,14 @@ typedef struct vpar_thread_s ...@@ -65,12 +65,14 @@ typedef struct vpar_thread_s
#endif #endif
lookup_t pl_mb_addr_inc[2048]; /* for macroblock lookup_t pl_mb_addr_inc[2048]; /* for macroblock
address increment */ address increment */
/* variable length codes for the structure dct_dc_size */
lookup_t pppl_dct_dc_size[2][2][32];
/* tables for macroblock types 0=P 1=B */ /* tables for macroblock types 0=P 1=B */
lookup_t pl_mb_type[2][64]; lookup_t ppl_mb_type[2][64];
/* table for coded_block_pattern */ /* table for coded_block_pattern */
lookup_t pl_coded_pattern[512]; lookup_t pl_coded_pattern[512];
/* variable length codes for the structure dct_dc_size for intra blocks */
lookup_t pppl_dct_dc_size[2][2][32];
/* structure to store the tables B14 & B15 */
dct_lookup_t *ppl_dct_coef[10];
#ifdef STATS #ifdef STATS
/* Statistics */ /* Statistics */
......
...@@ -45,7 +45,7 @@ typedef struct macroblock_s ...@@ -45,7 +45,7 @@ typedef struct macroblock_s
/* AddBlock information */ /* AddBlock information */
f_addb_t pf_addb[12]; /* pointer to the Add function */ f_addb_t pf_addb[12]; /* pointer to the Add function */
data_t * p_data[12]; /* pointer to the position data_t p_data[12]; /* pointer to the position
* in the final picture */ * in the final picture */
int i_addb_l_stride, i_addb_c_stride; int i_addb_l_stride, i_addb_c_stride;
} macroblock_t; } macroblock_t;
...@@ -67,9 +67,9 @@ typedef struct ...@@ -67,9 +67,9 @@ typedef struct
int i_l_x, i_l_y, i_c_x, i_c_y; int i_l_x, i_l_y, i_c_x, i_c_y;
} macroblock_parsing_t; } macroblock_parsing_t;
/****************************************************************************** /*****************************************************************************
* lookup_t : entry type for lookup tables * * lookup_t : entry type for lookup tables *
******************************************************************************/ *****************************************************************************/
typedef struct lookup_s typedef struct lookup_s
{ {
...@@ -77,6 +77,17 @@ typedef struct lookup_s ...@@ -77,6 +77,17 @@ typedef struct lookup_s
int i_length; int i_length;
} lookup_t; } lookup_t;
/******************************************************************************
* ac_lookup_t : special entry type for lookup tables about ac coefficients
*****************************************************************************/
typedef struct dct_lookup_s
{
int i_run;
int i_level;
int i_length;
} dct_lookup_t;
/***************************************************************************** /*****************************************************************************
* Standard codes * Standard codes
*****************************************************************************/ *****************************************************************************/
...@@ -104,6 +115,17 @@ typedef struct lookup_s ...@@ -104,6 +115,17 @@ typedef struct lookup_s
#define SCAN_ZIGZAG 0 #define SCAN_ZIGZAG 0
#define SCAN_ALT 1 #define SCAN_ALT 1
/* Constant for block decoding */
#define DCT_EOB 64
#define DCT_ESCAPE 65
/*****************************************************************************
* Constants
*****************************************************************************/
extern int * pi_default_intra_quant;
extern int * pi_default_nonintra_quant;
extern u8 pi_scan[2][64];
/***************************************************************************** /*****************************************************************************
* Prototypes * Prototypes
*****************************************************************************/ *****************************************************************************/
......
...@@ -230,6 +230,7 @@ static int InitThread( vpar_thread_t *p_vpar ) ...@@ -230,6 +230,7 @@ static int InitThread( vpar_thread_t *p_vpar )
InitPMBType( p_vpar ); InitPMBType( p_vpar );
InitBMBType( p_vpar ); InitBMBType( p_vpar );
InitCodedPattern( p_vpar ); InitCodedPattern( p_vpar );
InitDCTTables( p_vpar );
/* Mark thread as running and return */ /* Mark thread as running and return */
intf_DbgMsg("vpar debug: InitThread(%p) succeeded\n", p_vpar); intf_DbgMsg("vpar debug: InitThread(%p) succeeded\n", p_vpar);
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment