1 /*****************************************************************************
2 * vpar_blocks.h : video parser blocks management
4 *****************************************************************************
5 *****************************************************************************
16 *****************************************************************************/
18 /*****************************************************************************
19 * macroblock_t : information on a macroblock
20 *****************************************************************************/
21 typedef struct macroblock_s
23 picture_t * p_picture;
26 int i_l_x, i_l_y; /* position of macroblock (lum) */
27 int i_c_x, i_c_y; /* position of macroblock (chroma) */
29 int i_chroma_nb_blocks; /* nb of bks for a chr comp */
31 /* IDCT information */
32 elem_t ppi_blocks[12][64]; /* blocks */
33 f_idct_t pf_idct[12]; /* sparse IDCT or not ? */
34 int pi_sparse_pos[12];
36 /* Motion compensation information */
37 f_motion_t pf_motion; /* function to use for motion comp */
38 f_chroma_motion_t pf_chroma_motion;
39 picture_t * p_backw_top, p_backw_bot;
40 picture_t * p_forw_top, p_forw_bot;
41 int i_field_select_backw_top, i_field_select_backw_bot;
42 int i_field_select_forw_top, i_field_select_forw_bot;
43 int pi_motion_vectors_backw_top[2];
44 int pi_motion_vectors_backw_bot[2];
45 int pi_motion_vectors_forw_top[2];
46 int pi_motion_vectors_forw_bot[2];
48 /* AddBlock information */
50 data_t * p_data[12]; /* positions of blocks in picture */
51 int i_lum_incr, i_chroma_incr;
54 /*****************************************************************************
55 * macroblock_parsing_t : parser context descriptor #3
56 *****************************************************************************/
59 int i_mb_type, i_motion_type, i_mv_count, i_mv_format;
60 int i_coded_block_pattern;
62 } macroblock_parsing_t;
64 /*****************************************************************************
66 *****************************************************************************
67 * Quantizer scale factor (ISO/IEC 13818-2 7.4.2.2)
68 *****************************************************************************/
69 static __inline__ void LoadQuantizerScale( vpar_thread_t * p_vpar )
71 /* Quantization coefficient table */
72 static unsigned char ppi_quantizer_scale[3][32] =
78 0,2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,
79 32,34,36,38,40,42,44,46,48,50,52,54,56,58,60,62
83 0, 1, 2, 3, 4, 5, 6, 7, 8, 10,12,14,16,18,20, 22,
84 24,28,32,36,40,44,48,52,56,64,72,80,88,96,104,112
88 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,
89 16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31
93 p_vpar->slice.i_quantizer_scale = ppi_quantizer_scale
94 [(!p_vpar->sequence.b_mpeg2 << 1) | p_vpar->picture.b_q_scale_type]
95 [GetBits( &p_vpar->bit_stream, 5 )];
98 /*****************************************************************************
100 *****************************************************************************/
101 /* Macroblock types */
104 #define MB_MOTION_BACKWARD 4
105 #define MB_MOTION_FORWARD 8
109 #define MOTION_FIELD 1
110 #define MOTION_FRAME 2
111 #define MOTION_16X8 2