Commit bb5805a3 authored by Christophe Massiot's avatar Christophe Massiot

D�finition des matrices de quantification par d�faut, du balayage,

et cr�ation de la crop table pour la saturation qu'on fera pas.
parent 5e62636f
...@@ -58,7 +58,11 @@ typedef struct vpar_thread_s ...@@ -58,7 +58,11 @@ typedef struct vpar_thread_s
macroblock_parsing_t mb; macroblock_parsing_t mb;
video_synchro_t synchro; video_synchro_t synchro;
/* Lookup table for Macroblock_Address_Increment */ /* Lookup tables */
#ifdef MPEG2_COMPLIANT
s16 pi_crop_buf[65536];
s16 * pi_crop;
#endif
mb_addr_inc_t mb_addr_inc[2048]; mb_addr_inc_t mb_addr_inc[2048];
#ifdef STATS #ifdef STATS
...@@ -100,7 +104,7 @@ void vpar_DestroyThread ( vpar_thread_t *p_vpar /*, int *pi_stat ...@@ -100,7 +104,7 @@ void vpar_DestroyThread ( vpar_thread_t *p_vpar /*, int *pi_stat
static __inline__ void LoadQuantizerScale( struct vpar_thread_s * p_vpar ) static __inline__ void LoadQuantizerScale( struct vpar_thread_s * p_vpar )
{ {
/* Quantization coefficient table */ /* Quantization coefficient table */
static unsigned char ppi_quantizer_scale[3][32] = static u8 ppi_quantizer_scale[3][32] =
{ {
/* MPEG-2 */ /* MPEG-2 */
{ {
......
...@@ -89,9 +89,21 @@ typedef struct ...@@ -89,9 +89,21 @@ typedef struct
#define MACROBLOCK_ESCAPE 8 #define MACROBLOCK_ESCAPE 8
#define MACROBLOCK_STUFFING 15 #define MACROBLOCK_STUFFING 15
/* Scan */
#define SCAN_ZIGZAG 0
#define SCAN_ALT 1
/*****************************************************************************
* Constants
*****************************************************************************/
extern int * pi_default_intra_quant;
extern int * pi_default_nonintra_quant;
extern u8 pi_scan[2][64];
/***************************************************************************** /*****************************************************************************
* Prototypes * Prototypes
*****************************************************************************/ *****************************************************************************/
void vpar_InitCrop( struct vpar_thread_s* p_vpar );
int vpar_CodedPattern420( struct vpar_thread_s* p_vpar ); int vpar_CodedPattern420( struct vpar_thread_s* p_vpar );
int vpar_CodedPattern422( struct vpar_thread_s* p_vpar ); int vpar_CodedPattern422( struct vpar_thread_s* p_vpar );
int vpar_CodedPattern444( struct vpar_thread_s* p_vpar ); int vpar_CodedPattern444( struct vpar_thread_s* p_vpar );
......
...@@ -34,9 +34,6 @@ typedef struct quant_matrix_s ...@@ -34,9 +34,6 @@ typedef struct quant_matrix_s
/* Has the matrix been allocated by vpar_headers ? */ /* Has the matrix been allocated by vpar_headers ? */
} quant_matrix_t; } quant_matrix_t;
extern int * pi_default_intra_quant;
extern int * pi_default_nonintra_quant;
/***************************************************************************** /*****************************************************************************
* sequence_t : sequence descriptor * sequence_t : sequence descriptor
*****************************************************************************/ *****************************************************************************/
......
...@@ -221,6 +221,9 @@ static int InitThread( vpar_thread_t *p_vpar ) ...@@ -221,6 +221,9 @@ static int InitThread( vpar_thread_t *p_vpar )
} }
/* Initialize lookup tables */ /* Initialize lookup tables */
#ifdef MPEG2_COMPLIANT
vpar_InitCrop( p_vpar );
#endif
InitMbAddrInc( p_vpar ); InitMbAddrInc( p_vpar );
/* Mark thread as running and return */ /* Mark thread as running and return */
......
...@@ -53,6 +53,116 @@ static void vpar_DecodeMPEG1Intra( vpar_thread_t * p_vpar, macroblock_t * p_mb, ...@@ -53,6 +53,116 @@ static void vpar_DecodeMPEG1Intra( vpar_thread_t * p_vpar, macroblock_t * p_mb,
static void vpar_DecodeMPEG2Non( vpar_thread_t * p_vpar, macroblock_t * p_mb, int i_b ); static void vpar_DecodeMPEG2Non( vpar_thread_t * p_vpar, macroblock_t * p_mb, int i_b );
static void vpar_DecodeMPEG2Intra( vpar_thread_t * p_vpar, macroblock_t * p_mb, int i_b ); static void vpar_DecodeMPEG2Intra( vpar_thread_t * p_vpar, macroblock_t * p_mb, int i_b );
/*
* Standard variables
*/
/*****************************************************************************
* pi_default_intra_quant : default quantization matrix
*****************************************************************************/
#ifndef VDEC_DFT
extern int pi_default_intra_quant =
{
8, 16, 19, 22, 26, 27, 29, 34,
16, 16, 22, 24, 27, 29, 34, 37,
19, 22, 26, 27, 29, 34, 34, 38,
22, 22, 26, 27, 29, 34, 37, 40,
22, 26, 27, 29, 32, 35, 40, 48,
26, 27, 29, 32, 35, 40, 48, 58,
26, 27, 29, 34, 38, 46, 56, 69,
27, 29, 35, 38, 46, 56, 69, 83
}:
#else
extern int pi_default_intra_quant =
{
2048, 5681, 6355, 6623, 6656, 5431, 4018, 2401,
5681, 7880, 10207, 10021, 9587, 8091, 6534, 3625,
6355, 10207, 11363, 10619, 9700, 8935, 6155, 3507,
6623, 9186, 10226, 9557, 8730, 8041, 6028, 3322,
5632, 9232, 9031, 8730, 8192, 7040, 5542, 3390,
5230, 7533, 7621, 7568, 7040, 6321, 5225, 3219,
3602, 5189, 5250, 5539, 5265, 5007, 4199, 2638,
1907, 2841, 3230, 3156, 3249, 3108, 2638, 1617
};
#endif
/*****************************************************************************
* pi_default_nonintra_quant : default quantization matrix
*****************************************************************************/
#ifndef VDEC_DFT
extern int pi_default_nonintra_quant =
{
16, 16, 16, 16, 16, 16, 16, 16,
16, 16, 16, 16, 16, 16, 16, 16,
16, 16, 16, 16, 16, 16, 16, 16,
16, 16, 16, 16, 16, 16, 16, 16,
16, 16, 16, 16, 16, 16, 16, 16,
16, 16, 16, 16, 16, 16, 16, 16,
16, 16, 16, 16, 16, 16, 16, 16,
16, 16, 16, 16, 16, 16, 16, 16
};
#else
extern int pi_default_nonintra_quant =
{
4096, 5680, 5344, 4816, 4096, 3216, 2224, 1136,
5680, 7888, 7424, 6688, 5680, 4464, 3072, 1568,
5344, 7424, 6992, 6288, 5344, 4208, 2896, 1472,
4816, 6688, 6288, 5664, 4816, 3792, 2608, 1328,
4096, 5680, 5344, 4816, 4096, 3216, 2224, 1136,
3216, 4464, 4208, 3792, 3216, 2528, 1744, 880,
2224, 3072, 2896, 2608, 2224, 1744, 1200, 608,
1136, 1568, 1472, 1328, 1136, 880, 608, 304
};
#endif
/*****************************************************************************
* pi_scan : zig-zag and alternate scan patterns
*****************************************************************************/
extern int pi_scan[2][64] =
{
{ /* Zig-Zag pattern */
0,1,8,16,9,2,3,10,17,24,32,25,18,11,4,5,
12,19,26,33,40,48,41,34,27,20,13,6,7,14,21,28,
35,42,49,56,57,50,43,36,29,22,15,23,30,37,44,51,
58,59,52,45,38,31,39,46,53,60,61,54,47,55,62,63
},
{ /* Alternate scan pattern */
0,8,16,24,1,9,2,10,17,25,32,40,48,56,57,49,
41,33,26,18,3,11,4,12,19,27,34,42,50,58,35,43,
51,59,20,28,5,13,6,14,21,29,36,44,52,60,37,45,
53,61,22,30,7,15,23,31,38,46,54,62,39,47,55,63
}
};
/*
* Initialization of lookup tables
*/
/*****************************************************************************
* vpar_InitCrop : Initialize the crop table for saturation
* (ISO/IEC 13818-2 section 7.4.3)
*****************************************************************************/
#ifdef MPEG2_COMPLIANT
void vpar_InitCrop( vpar_thread_t * p_vpar )
{
int i_dummy;
p_vpar->pi_crop = p_vpar->pi_crop_buf + 32768;
for( i_dummy = -32768; i_dummy < -2048; i_dummy++ )
{
p_vpar->pi_crop[i_dummy] = -2048;
}
for( ; i_dummy < 2047; i_dummy++ )
{
p_vpar->pi_crop[i_dummy] = i_dummy;
}
for( ; i_dummy < 32767; i_dummy++ )
{
p_vpar->pi_crop[i_dummy] = 2047;
}
}
#endif
/***************************************************************************** /*****************************************************************************
* InitMbAddrInc : Initialize the lookup table for mb_addr_inc * * InitMbAddrInc : Initialize the lookup table for mb_addr_inc *
...@@ -134,6 +244,9 @@ void InitMbAddrInc( vpar_thread_t * p_vpar ) ...@@ -134,6 +244,9 @@ void InitMbAddrInc( vpar_thread_t * p_vpar )
p_vpar->mb_addr_inc[1024].i_length = 1; p_vpar->mb_addr_inc[1024].i_length = 1;
} }
/*
* Macroblock parsing functions
*/
/***************************************************************************** /*****************************************************************************
* vpar_ParseMacroblock : Parse the next macroblock * vpar_ParseMacroblock : Parse the next macroblock
......
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