--- global.h 2004/03/22 22:36:23 1.23 +++ global.h 2010/11/28 15:18:21 1.27 @@ -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.23 2004/03/22 22:36:23 edgomez Exp $ + * $Id: global.h,v 1.27 2010/11/28 15:18:21 Isibaar Exp $ * ****************************************************************************/ @@ -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,8 +79,6 @@ } VECTOR; - - typedef struct { VECTOR duv[3]; @@ -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]; @@ -220,6 +219,8 @@ VECTOR amv; /* average motion vectors from GMC */ int32_t mcsel; + + VECTOR mvs_avg; //CK average of field motion vectors /* This structure has become way to big! What to do? Split it up? */ @@ -258,5 +259,20 @@ #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_ */