[svn] / branches / dev-api-4 / xvidcore / src / global.h Repository:
ViewVC logotype

Annotation of /branches/dev-api-4/xvidcore/src/global.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 851 - (view) (download)
Original Path: trunk/xvidcore/src/global.h

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

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