--- trunk/xvidcore/src/global.h 2005/09/13 12:12:15 1632 +++ trunk/xvidcore/src/global.h 2019/11/03 11:50:49 2177 @@ -3,7 +3,7 @@ * XVID MPEG-4 VIDEO CODEC * - Global definitions - * - * Copyright(C) 2002 Michael Militzer + * Copyright(C) 2002-2010 Michael Militzer * * This program is free software ; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -19,7 +19,7 @@ * along with this program ; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * - * $Id: global.h,v 1.24 2005-09-13 12:12:15 suxen_drol Exp $ + * $Id$ * ****************************************************************************/ @@ -48,7 +48,6 @@ #define MODE_DIRECT_NONE_MV 4 #define MODE_DIRECT_NO4V 5 - /* * vop coding types * intra, prediction, backward, sprite, not_coded @@ -73,7 +72,6 @@ return xvid_type - 1; } - typedef struct { int x; @@ -81,11 +79,9 @@ } VECTOR; - - typedef struct { - VECTOR duv[3]; + VECTOR duv[4]; } WARPPOINTS; @@ -168,7 +164,6 @@ } IMAGE; - typedef struct { uint32_t bufa; @@ -182,10 +177,8 @@ } Bitstream; - #define MBPRED_SIZE 15 - typedef struct { /* decoder/encoder */ @@ -210,9 +203,15 @@ int32_t sad8[4]; /* SAD values for inter4v-VECTORs */ int32_t sad16; /* SAD value for inter-VECTOR */ + int32_t var16; /* Variance of the 16x16 luma block */ + int32_t rel_var8[6]; /* Relative variances of the 8x8 sub-blocks */ + int dquant; int cbp; + /* lambda for these blocks */ + int lambda[6]; + /* bframe stuff */ VECTOR b_mvs[4]; @@ -252,13 +251,32 @@ /* useful macros */ +#ifndef MIN #define MIN(X, Y) ((X)<(Y)?(X):(Y)) +#endif +#ifndef MAX #define MAX(X, Y) ((X)>(Y)?(X):(Y)) +#endif /* #define ABS(X) (((X)>0)?(X):-(X)) */ #define SIGN(X) (((X)>0)?1:-1) #define CLIP(X,AMIN,AMAX) (((X)<(AMIN)) ? (AMIN) : ((X)>(AMAX)) ? (AMAX) : (X)) #define DIV_DIV(a,b) (((a)>0) ? ((a)+((b)>>1))/(b) : ((a)-((b)>>1))/(b)) #define SWAP(_T_,A,B) { _T_ tmp = A; A = B; B = tmp; } +static __inline uint32_t +isqrt(unsigned long n) +{ + uint32_t c = 0x8000; + uint32_t g = 0x8000; + + for(;;) { + if(g*g > n) + g ^= c; + c >>= 1; + if(c == 0) + return g; + g |= c; + } +} #endif /* _GLOBAL_H_ */