3 |
* XVID MPEG-4 VIDEO CODEC |
* XVID MPEG-4 VIDEO CODEC |
4 |
* - Global definitions - |
* - Global definitions - |
5 |
* |
* |
6 |
* Copyright(C) 2002 Michael Militzer <isibaar@xvid.org> |
* Copyright(C) 2002-2010 Michael Militzer <michael@xvid.org> |
7 |
* |
* |
8 |
* This program is free software ; you can redistribute it and/or modify |
* This program is free software ; you can redistribute it and/or modify |
9 |
* it under the terms of the GNU General Public License as published by |
* it under the terms of the GNU General Public License as published by |
19 |
* along with this program ; if not, write to the Free Software |
* along with this program ; if not, write to the Free Software |
20 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
21 |
* |
* |
22 |
* $Id: global.h,v 1.26 2010-09-13 07:38:09 Isibaar Exp $ |
* $Id$ |
23 |
* |
* |
24 |
****************************************************************************/ |
****************************************************************************/ |
25 |
|
|
203 |
int32_t sad8[4]; /* SAD values for inter4v-VECTORs */ |
int32_t sad8[4]; /* SAD values for inter4v-VECTORs */ |
204 |
int32_t sad16; /* SAD value for inter-VECTOR */ |
int32_t sad16; /* SAD value for inter-VECTOR */ |
205 |
|
|
206 |
|
int32_t var16; /* Variance of the 16x16 luma block */ |
207 |
|
int32_t rel_var8[6]; /* Relative variances of the 8x8 sub-blocks */ |
208 |
|
|
209 |
int dquant; |
int dquant; |
210 |
int cbp; |
int cbp; |
211 |
|
|
251 |
|
|
252 |
/* useful macros */ |
/* useful macros */ |
253 |
|
|
254 |
|
#ifndef MIN |
255 |
#define MIN(X, Y) ((X)<(Y)?(X):(Y)) |
#define MIN(X, Y) ((X)<(Y)?(X):(Y)) |
256 |
|
#endif |
257 |
|
#ifndef MAX |
258 |
#define MAX(X, Y) ((X)>(Y)?(X):(Y)) |
#define MAX(X, Y) ((X)>(Y)?(X):(Y)) |
259 |
|
#endif |
260 |
/* #define ABS(X) (((X)>0)?(X):-(X)) */ |
/* #define ABS(X) (((X)>0)?(X):-(X)) */ |
261 |
#define SIGN(X) (((X)>0)?1:-1) |
#define SIGN(X) (((X)>0)?1:-1) |
262 |
#define CLIP(X,AMIN,AMAX) (((X)<(AMIN)) ? (AMIN) : ((X)>(AMAX)) ? (AMAX) : (X)) |
#define CLIP(X,AMIN,AMAX) (((X)<(AMIN)) ? (AMIN) : ((X)>(AMAX)) ? (AMAX) : (X)) |
263 |
#define DIV_DIV(a,b) (((a)>0) ? ((a)+((b)>>1))/(b) : ((a)-((b)>>1))/(b)) |
#define DIV_DIV(a,b) (((a)>0) ? ((a)+((b)>>1))/(b) : ((a)-((b)>>1))/(b)) |
264 |
#define SWAP(_T_,A,B) { _T_ tmp = A; A = B; B = tmp; } |
#define SWAP(_T_,A,B) { _T_ tmp = A; A = B; B = tmp; } |
265 |
|
|
266 |
|
static __inline uint32_t |
267 |
|
isqrt(unsigned long n) |
268 |
|
{ |
269 |
|
uint32_t c = 0x8000; |
270 |
|
uint32_t g = 0x8000; |
271 |
|
|
272 |
|
for(;;) { |
273 |
|
if(g*g > n) |
274 |
|
g ^= c; |
275 |
|
c >>= 1; |
276 |
|
if(c == 0) |
277 |
|
return g; |
278 |
|
g |= c; |
279 |
|
} |
280 |
|
} |
281 |
|
|
282 |
#endif /* _GLOBAL_H_ */ |
#endif /* _GLOBAL_H_ */ |