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

Annotation of /xvidcore/src/global.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.13.2.8 - (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 : suxen_drol 1.13.2.6 #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 : chl 1.13.2.1 #define MODE_DIRECT_NO4V 5
25 : suxen_drol 1.5
26 : chl 1.13.2.8 typedef struct
27 :     {
28 :     VECTOR duv[3];
29 :     }
30 :     WARPPOINTS;
31 :    
32 :     /* 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 :     GMC_DATA;
73 :    
74 :    
75 : suxen_drol 1.13.2.5 typedef struct
76 :     {
77 :     uint8_t *y;
78 :     uint8_t *u;
79 :     uint8_t *v;
80 :     }
81 :     IMAGE;
82 :    
83 : suxen_drol 1.5
84 : Isibaar 1.1 typedef struct
85 :     {
86 : h 1.4 uint32_t bufa;
87 :     uint32_t bufb;
88 :     uint32_t buf;
89 :     uint32_t pos;
90 :     uint32_t *tail;
91 :     uint32_t *start;
92 :     uint32_t length;
93 : edgomez 1.10 }
94 : h 1.4 Bitstream;
95 : Isibaar 1.1
96 :    
97 :     #define MBPRED_SIZE 15
98 :    
99 :    
100 :     typedef struct
101 :     {
102 :     // decoder/encoder
103 :     VECTOR mvs[4];
104 :    
105 : chl 1.9 short int pred_values[6][MBPRED_SIZE];
106 :     int acpred_directions[6];
107 : edgomez 1.10
108 : Isibaar 1.1 int mode;
109 : edgomez 1.10 int quant; // absolute quant
110 : Isibaar 1.1
111 : h 1.2 int field_dct;
112 :     int field_pred;
113 :     int field_for_top;
114 :     int field_for_bot;
115 :    
116 : Isibaar 1.1 // encoder specific
117 :    
118 : chl 1.9 VECTOR mv16;
119 : Isibaar 1.1 VECTOR pmvs[4];
120 : Isibaar 1.13.2.2 VECTOR qmvs[4]; // mvs in quarter pixel resolution
121 : chl 1.9
122 : edgomez 1.10 int32_t sad8[4]; // SAD values for inter4v-VECTORs
123 :     int32_t sad16; // SAD value for inter-VECTOR
124 : chl 1.9
125 : Isibaar 1.1 int dquant;
126 :     int cbp;
127 :    
128 : suxen_drol 1.5 // bframe stuff
129 :    
130 :     VECTOR b_mvs[4];
131 : syskin 1.13.2.3 VECTOR b_qmvs[4];
132 : chl 1.13.2.1 // VECTOR b_pmvs[1];
133 : chenm001 1.6
134 : chl 1.13 // bframe direct mode
135 :    
136 : chl 1.13.2.1 // VECTOR directmv[4];
137 :     // VECTOR deltamv;
138 : chl 1.13
139 : chenm001 1.6 int mb_type;
140 :     int dbquant;
141 : suxen_drol 1.5
142 : chl 1.11 // stuff for block based ME (needed for Qpel ME)
143 :     // backup of last integer ME vectors/sad
144 : syskin 1.13.2.3
145 :     // VECTOR i_mv16;
146 : chl 1.12 VECTOR i_mvs[4];
147 : chl 1.11
148 : chl 1.12 int32_t i_sad8[4]; // SAD values for inter4v-VECTORs
149 : syskin 1.13.2.3 // int32_t i_sad16; // SAD value for inter-VECTOR
150 :    
151 : chl 1.13.2.8 VECTOR amv; // average motion vectors from GMC
152 :     int32_t mcsel;
153 :    
154 :     /* This structure has become way to big! What to do? Split it up? */
155 : chl 1.11
156 : edgomez 1.10 }
157 :     MACROBLOCK;
158 : Isibaar 1.1
159 : edgomez 1.10 static __inline int8_t
160 :     get_dc_scaler(uint32_t quant,
161 :     uint32_t lum)
162 : Isibaar 1.1 {
163 : edgomez 1.10 if (quant < 5)
164 :     return 8;
165 : Isibaar 1.1
166 : edgomez 1.10 if (quant < 25 && !lum)
167 :     return (quant + 13) / 2;
168 : Isibaar 1.1
169 : edgomez 1.10 if (quant < 9)
170 :     return 2 * quant;
171 : Isibaar 1.1
172 : edgomez 1.10 if (quant < 25)
173 :     return quant + 8;
174 : Isibaar 1.1
175 : edgomez 1.10 if (lum)
176 : Isibaar 1.7 return 2 * quant - 16;
177 : Isibaar 1.1 else
178 : edgomez 1.10 return quant - 6;
179 : Isibaar 1.1 }
180 : suxen_drol 1.5
181 :     // useful macros
182 :    
183 :     #define MIN(X, Y) ((X)<(Y)?(X):(Y))
184 :     #define MAX(X, Y) ((X)>(Y)?(X):(Y))
185 :     #define ABS(X) (((X)>0)?(X):-(X))
186 :     #define SIGN(X) (((X)>0)?1:-1)
187 : suxen_drol 1.13.2.7 #define CLIP(X,AMIN,AMAX) (((X)<(AMIN)) ? (AMIN) : ((X)>(AMAX)) ? (AMAX) : (X))
188 :     #define DIV_DIV(a,b) (((a)>0) ? ((a)+((b)>>1))/(b) : ((a)-((b)>>1))/(b))
189 : suxen_drol 1.5
190 : Isibaar 1.1
191 : edgomez 1.10 #endif /* _GLOBAL_H_ */

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