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

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