[cvs] / xvidcore / src / global.h Repository:
ViewVC logotype

Annotation of /xvidcore/src/global.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.21.2.5 - (view) (download)

1 : Isibaar 1.1 #ifndef _GLOBAL_H_
2 :     #define _GLOBAL_H_
3 :    
4 : h 1.4 #include "xvid.h"
5 : Isibaar 1.1 #include "portab.h"
6 :    
7 : suxen_drol 1.5 /* --- macroblock modes --- */
8 : Isibaar 1.1
9 :     #define MODE_INTER 0
10 :     #define MODE_INTER_Q 1
11 :     #define MODE_INTER4V 2
12 :     #define MODE_INTRA 3
13 :     #define MODE_INTRA_Q 4
14 :     #define MODE_NOT_CODED 16
15 : edgomez 1.19 #define MODE_NOT_CODED_GMC 17
16 : Isibaar 1.1
17 : suxen_drol 1.5 /* --- bframe specific --- */
18 :    
19 :     #define MODE_DIRECT 0
20 :     #define MODE_INTERPOLATE 1
21 :     #define MODE_BACKWARD 2
22 :     #define MODE_FORWARD 3
23 : chenm001 1.6 #define MODE_DIRECT_NONE_MV 4
24 : edgomez 1.19 #define MODE_DIRECT_NO4V 5
25 :    
26 : suxen_drol 1.21.2.1
27 : edgomez 1.21.2.5 /*
28 :     * vop coding types
29 :     * intra, prediction, backward, sprite, not_coded
30 :     */
31 : suxen_drol 1.21.2.1 #define I_VOP 0
32 :     #define P_VOP 1
33 :     #define B_VOP 2
34 :     #define S_VOP 3
35 :     #define N_VOP 4
36 :    
37 :     /* convert mpeg-4 coding type i/p/b/s_VOP to XVID_TYPE_xxx */
38 :     static __inline int
39 :     coding2type(int coding_type)
40 :     {
41 :     return coding_type + 1;
42 :     }
43 :    
44 :     /* convert XVID_TYPE_xxx to bitstream coding type i/p/b/s_VOP */
45 :     static __inline int
46 :     type2coding(int xvid_type)
47 :     {
48 :     return xvid_type - 1;
49 :     }
50 :    
51 :    
52 :     typedef struct
53 :     {
54 :     int x;
55 :     int y;
56 :     }
57 :     VECTOR;
58 :    
59 :    
60 :    
61 : edgomez 1.19 typedef struct
62 :     {
63 :     VECTOR duv[3];
64 :     }
65 :     WARPPOINTS;
66 :    
67 :     /* save all warping parameters for GMC once and for all, instead of
68 :     recalculating for every block. This is needed for encoding&decoding
69 :     When switching to incremental calculations, this will get much shorter
70 :     */
71 :    
72 :     /* we don't include WARPPOINTS wp here, but in FRAMEINFO itself */
73 :    
74 :     typedef struct
75 :     {
76 : edgomez 1.21.2.5 int num_wp; /* [input]: 0=none, 1=translation, 2,3 = warping */
77 :     /* a value of -1 means: "structure not initialized!" */
78 :     int s; /* [input]: calc is done with 1/s pel resolution */
79 : edgomez 1.19
80 :     int W;
81 :     int H;
82 :    
83 :     int ss;
84 :     int smask;
85 :     int sigma;
86 :    
87 :     int r;
88 :     int rho;
89 :    
90 :     int i0s;
91 :     int j0s;
92 :     int i1s;
93 :     int j1s;
94 :     int i2s;
95 :     int j2s;
96 :    
97 :     int i1ss;
98 :     int j1ss;
99 :     int i2ss;
100 :     int j2ss;
101 :    
102 :     int alpha;
103 :     int beta;
104 :     int Ws;
105 :     int Hs;
106 :    
107 :     int dxF, dyF, dxG, dyG;
108 :     int Fo, Go;
109 :     int cFo, cGo;
110 :     }
111 :     GMC_DATA;
112 :    
113 :    
114 :     typedef struct
115 :     {
116 :     uint8_t *y;
117 :     uint8_t *u;
118 :     uint8_t *v;
119 :     }
120 :     IMAGE;
121 : suxen_drol 1.5
122 :    
123 : Isibaar 1.1 typedef struct
124 :     {
125 : h 1.4 uint32_t bufa;
126 :     uint32_t bufb;
127 :     uint32_t buf;
128 :     uint32_t pos;
129 :     uint32_t *tail;
130 :     uint32_t *start;
131 :     uint32_t length;
132 : edgomez 1.21.2.3 uint32_t initpos;
133 : edgomez 1.10 }
134 : h 1.4 Bitstream;
135 : Isibaar 1.1
136 :    
137 :     #define MBPRED_SIZE 15
138 :    
139 :    
140 :     typedef struct
141 :     {
142 : edgomez 1.21.2.5 /* decoder/encoder */
143 : Isibaar 1.1 VECTOR mvs[4];
144 :    
145 : chl 1.9 short int pred_values[6][MBPRED_SIZE];
146 :     int acpred_directions[6];
147 : edgomez 1.10
148 : Isibaar 1.1 int mode;
149 : edgomez 1.21.2.5 int quant; /* absolute quant */
150 : Isibaar 1.1
151 : h 1.2 int field_dct;
152 :     int field_pred;
153 :     int field_for_top;
154 :     int field_for_bot;
155 :    
156 : edgomez 1.21.2.5 /* encoder specific */
157 : Isibaar 1.1
158 : chl 1.9 VECTOR mv16;
159 : Isibaar 1.1 VECTOR pmvs[4];
160 : edgomez 1.21.2.5 VECTOR qmvs[4]; /* mvs in quarter pixel resolution */
161 : chl 1.9
162 : edgomez 1.21.2.5 int32_t sad8[4]; /* SAD values for inter4v-VECTORs */
163 :     int32_t sad16; /* SAD value for inter-VECTOR */
164 : chl 1.9
165 : Isibaar 1.1 int dquant;
166 :     int cbp;
167 :    
168 : edgomez 1.21.2.5 /* bframe stuff */
169 : suxen_drol 1.5
170 :     VECTOR b_mvs[4];
171 : edgomez 1.19 VECTOR b_qmvs[4];
172 : chl 1.13
173 : chenm001 1.6 int mb_type;
174 : suxen_drol 1.5
175 : edgomez 1.21.2.5 /*
176 :     * stuff for block based ME (needed for Qpel ME)
177 :     * backup of last integer ME vectors/sad
178 :     */
179 : edgomez 1.19
180 : edgomez 1.21.2.5 VECTOR amv; /* average motion vectors from GMC */
181 : edgomez 1.19 int32_t mcsel;
182 :    
183 :     /* This structure has become way to big! What to do? Split it up? */
184 : chl 1.11
185 : edgomez 1.10 }
186 :     MACROBLOCK;
187 : Isibaar 1.1
188 : edgomez 1.19 static __inline uint32_t
189 : edgomez 1.10 get_dc_scaler(uint32_t quant,
190 :     uint32_t lum)
191 : Isibaar 1.1 {
192 : edgomez 1.10 if (quant < 5)
193 :     return 8;
194 : Isibaar 1.1
195 : edgomez 1.10 if (quant < 25 && !lum)
196 : edgomez 1.19 return (quant + 13) / 2;
197 : Isibaar 1.1
198 : edgomez 1.10 if (quant < 9)
199 : edgomez 1.19 return 2 * quant;
200 : Isibaar 1.1
201 : edgomez 1.10 if (quant < 25)
202 : edgomez 1.19 return quant + 8;
203 : Isibaar 1.1
204 : edgomez 1.10 if (lum)
205 : edgomez 1.19 return 2 * quant - 16;
206 : Isibaar 1.1 else
207 : edgomez 1.19 return quant - 6;
208 : Isibaar 1.1 }
209 : suxen_drol 1.5
210 : edgomez 1.21.2.5 /* useful macros */
211 : suxen_drol 1.5
212 :     #define MIN(X, Y) ((X)<(Y)?(X):(Y))
213 :     #define MAX(X, Y) ((X)>(Y)?(X):(Y))
214 : edgomez 1.21.2.4 /* #define ABS(X) (((X)>0)?(X):-(X)) */
215 : suxen_drol 1.5 #define SIGN(X) (((X)>0)?1:-1)
216 : edgomez 1.19 #define CLIP(X,AMIN,AMAX) (((X)<(AMIN)) ? (AMIN) : ((X)>(AMAX)) ? (AMAX) : (X))
217 :     #define DIV_DIV(a,b) (((a)>0) ? ((a)+((b)>>1))/(b) : ((a)-((b)>>1))/(b))
218 : suxen_drol 1.21.2.2 #define SWAP(_T_,A,B) { _T_ tmp = A; A = B; B = tmp; }
219 : suxen_drol 1.5
220 : Isibaar 1.1
221 : edgomez 1.19 #endif /* _GLOBAL_H_ */

No admin address has been configured
ViewVC Help
Powered by ViewVC 1.0.4