vpar_blocks.h 6.07 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
/*****************************************************************************
 * vpar_blocks.h : video parser blocks management
 * (c)1999 VideoLAN
 *****************************************************************************
 *****************************************************************************
 * Requires:
 *  "config.h"
 *  "common.h"
 *  "mtime.h"
 *  "vlc_thread.h"
 *  "input.h"
 *  "video.h"
 *  "video_output.h"
 *  "decoder_fifo.h"
 *  "video_fifo.h"
 *****************************************************************************/

/*****************************************************************************
19 20 21 22
 * macroblock_t : information on a macroblock
 *****************************************************************************/
typedef struct macroblock_s
{
23
    int                     i_mb_type;                    /* macroblock type */
24
    int                     i_coded_block_pattern;
25
    int                     i_structure;
26 27 28
    int                     i_current_structure;
    boolean_t               b_P_coding_type;        /* Is it P_CODING_TYPE ? */
    picture_t *             p_picture;
29 30 31
    int                     i_l_x, i_l_y;    /* position of macroblock (lum) */
    int                     i_c_x, i_c_y; /* position of macroblock (chroma) */
    int                     i_chroma_nb_blocks;  /* nb of bks for a chr comp */
32
    int                     i_l_stride;       /* number of yuv_data_t to ignore
33
		                               * when changing lines     */
34
    int                     i_c_stride;                  /* idem, for chroma */
Jean-Marc Dressler's avatar
Jean-Marc Dressler committed
35
    
36
    /* IDCT information */
37
    dctelem_t               ppi_blocks[12][64];                    /* blocks */
38 39 40 41 42
    f_idct_t                pf_idct[12];             /* sparse IDCT or not ? */
    int                     pi_sparse_pos[12];

    /* Motion compensation information */
    f_motion_t              pf_motion;    /* function to use for motion comp */
Jean-Marc Dressler's avatar
Jean-Marc Dressler committed
43 44
    picture_t *             p_backward;
    picture_t *             p_forward;
45 46 47
    int                     ppi_field_select[2][2];
    int                     pppi_motion_vectors[2][2][2];
    int                     pi_dm_vector[2];
48
    boolean_t               b_top_field_first;
49 50 51
    int                     i_motion_l_y;
    int                     i_motion_c_y;
    boolean_t               b_motion_field;
52
  
53
    /* AddBlock information */
54
    yuv_data_t *            p_data[12];              /* pointer to the position
55
                                                      * in the final picture */
56
    int                     i_addb_l_stride, i_addb_c_stride;
57 58 59 60 61 62 63 64
} macroblock_t;

/*****************************************************************************
 * macroblock_parsing_t : parser context descriptor #3
 *****************************************************************************/
typedef struct
{
    int                     i_mb_type, i_motion_type, i_mv_count, i_mv_format;
65
    boolean_t               b_dmv;
66 67

    /* Macroblock Type */
68 69
    int                     i_coded_block_pattern;
    boolean_t               b_dct_type;
70 71

    int                     i_l_x, i_l_y, i_c_x, i_c_y;
72 73
} macroblock_parsing_t;

74 75 76
/*****************************************************************************
 * lookup_t : entry type for lookup tables                                   *
 *****************************************************************************/
77 78 79 80 81 82 83

typedef struct lookup_s
{
    int    i_value;
    int    i_length;
} lookup_t;

84 85 86 87 88 89
/******************************************************************************
 * ac_lookup_t : special entry type for lookup tables about ac coefficients
 *****************************************************************************/ 

typedef struct dct_lookup_s
{
90 91 92
    char   i_run;
    char   i_level;
    char   i_length;
93 94
} dct_lookup_t;

95 96 97 98 99 100 101 102 103
/*****************************************************************************
 * Standard codes
 *****************************************************************************/
/* Macroblock types */
#define MB_INTRA                        1
#define MB_PATTERN                      2
#define MB_MOTION_BACKWARD              4
#define MB_MOTION_FORWARD               8
#define MB_QUANT                        16
104

105 106 107 108 109
/* Motion types */
#define MOTION_FIELD                    1
#define MOTION_FRAME                    2
#define MOTION_16X8                     2
#define MOTION_DMV                      3
110

111
/* Macroblock Address Increment types */
112 113 114 115 116
#define MB_ADDRINC_ESCAPE               8
#define MB_ADDRINC_STUFFING             15

/* Error constant for lookup tables */
#define MB_ERROR                        (-1)
117

118 119 120 121
/* Scan */
#define SCAN_ZIGZAG                         0
#define SCAN_ALT                            1

122 123 124 125 126 127 128
/* Constant for block decoding */
#define DCT_EOB                                 64
#define DCT_ESCAPE                              65

/*****************************************************************************
 * Constants
 *****************************************************************************/
129 130
extern int      pi_default_intra_quant[];
extern int      pi_default_nonintra_quant[];
131 132
extern u8       pi_scan[2][64];

133 134 135
/*****************************************************************************
 * Prototypes
 *****************************************************************************/
136
void vpar_InitCrop( struct vpar_thread_s* p_vpar );
137 138 139 140 141 142 143
void vpar_InitMbAddrInc( struct vpar_thread_s * p_vpar );
void vpar_InitPMBType( struct vpar_thread_s * p_vpar );
void vpar_InitBMBType( struct vpar_thread_s * p_vpar );
void vpar_InitCodedPattern( struct vpar_thread_s * p_vpar );
void vpar_InitDCTTables( struct vpar_thread_s * p_vpar );
void vpar_ParseMacroblock( struct vpar_thread_s * p_vpar, int * pi_mb_address,
                           int i_mb_previous, int i_mb_base );
144 145 146
int vpar_CodedPattern420( struct vpar_thread_s* p_vpar );
int vpar_CodedPattern422( struct vpar_thread_s* p_vpar );
int vpar_CodedPattern444( struct vpar_thread_s* p_vpar );
147 148 149 150
int vpar_IMBType( struct vpar_thread_s* p_vpar );
int vpar_PMBType( struct vpar_thread_s* p_vpar );
int vpar_BMBType( struct vpar_thread_s* p_vpar );
int vpar_DMBType( struct vpar_thread_s* p_vpar );