⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mvmacro.h

📁 优化过的xvid1.1.2源代码
💻 H
字号:
#ifndef _MVMACRO_H_
#define _MVMACRO_H_

#define 	MBPRED_SIZE  	15

/*operatte type*/
#define		XVID_GBL_INIT    	0 /* initialize xvidcore; must be called before using xvid_decore, or xvid_encore) */
#define		XVID_GBL_INFO    	1 /* return some info about xvidcore, and the host computer */
#define		XVID_GBL_CONVERT 	2 /* colorspace conversion utility */

#define 	XVID_DEC_CREATE  	0 /* create decore instance; return 0 on success */
#define 	XVID_DEC_DESTROY 	1 /* destroy decore instance: return 0 on success */
#define 	XVID_DEC_DECODE  	2 /* decode a frame: returns number of bytes consumed >= 0 */

#define 	MODE_INTER		0
#define 	MODE_INTER_Q		1
#define 	MODE_INTER4V		2
#define		MODE_INTRA		3
#define 	MODE_INTRA_Q		4
#define 	MODE_NOT_CODED		16
#define 	MODE_NOT_CODED_GMC	17

/* --- bframe specific --- */

#define 	MODE_DIRECT		0
#define 	MODE_INTERPOLATE	1
#define 	MODE_BACKWARD		2
#define 	MODE_FORWARD		3
#define 	MODE_DIRECT_NONE_MV	4
#define 	MODE_DIRECT_NO4V	5


/*
 * vop coding types
 * intra, prediction, backward, sprite, not_coded
 */
#define 	I_VOP			0
#define 	P_VOP			1
#define 	B_VOP			2
#define 	S_VOP			3
#define 	N_VOP			4

/* colorspace values */
#define 	XVID_CSP_PLANAR   (1<< 0) /* 4:2:0 planar (==I420, except for pointers/strides) */
#define 	XVID_CSP_USER	  XVID_CSP_PLANAR
#define 	XVID_CSP_I420     (1<< 1) /* 4:2:0 planar */
#define		XVID_CSP_YV12     (1<< 2) /* 4:2:0 planar */
#define 	XVID_CSP_YUY2     (1<< 3) /* 4:2:2 packed */
#define 	XVID_CSP_UYVY     (1<< 4) /* 4:2:2 packed */
#define 	XVID_CSP_YVYU     (1<< 5) /* 4:2:2 packed */
#define 	XVID_CSP_BGRA     (1<< 6) /* 32-bit bgra packed */
#define 	XVID_CSP_ABGR     (1<< 7) /* 32-bit abgr packed */
#define 	XVID_CSP_RGBA     (1<< 8) /* 32-bit rgba packed */
#define 	XVID_CSP_ARGB     (1<<15) /* 32-bit argb packed */
#define 	XVID_CSP_BGR      (1<< 9) /* 24-bit bgr packed */
#define 	XVID_CSP_RGB555   (1<<10) /* 16-bit rgb555 packed */
#define 	XVID_CSP_RGB565   (1<<11) /* 16-bit rgb565 packed */
#define 	XVID_CSP_SLICE    (1<<12) /* decoder only: 4:2:0 planar, per slice rendering */
#define 	XVID_CSP_INTERNAL (1<<13) /* decoder only: 4:2:0 planar, returns ptrs to internal buffers */
#define 	XVID_CSP_NULL     (1<<14) /* decoder only: dont output anything */
#define 	XVID_CSP_VFLIP    (1<<31) /* vertical flip mask */


/*****************************************************************************
 * error codes
 ****************************************************************************/

#define 	XVID_ERR_FAIL		-1		/* general fault */
#define 	XVID_ERR_MEMORY		-2		/* memory allocation error */
#define 	XVID_ERR_FORMAT		-3		/* file format error */
#define 	XVID_ERR_VERSION	-4		/* structure version not supported */
#define 	XVID_ERR_END		-5		/* encoder only; end of stream reached */


#define 	VIDOBJLAY_START_CODE	0x00000120	/* ..0x0000012f */
#define 	VOP_START_CODE		0x000001b6

#define 	VIDOBJLAY_SHAPE_RECTANGULAR		0
#define 	VIDOBJLAY_SHAPE_BINARY			1
#define 	VIDOBJLAY_SHAPE_BINARY_ONLY		2
#define 	VIDOBJLAY_SHAPE_GRAYSCALE		3


#define 	SPRITE_NONE		0
#define 	SPRITE_STATIC		1
#define 	SPRITE_GMC		2

/* vop coding types  */
/* intra, prediction, backward, sprite, not_coded */
#define I_VOP	0
#define P_VOP	1
#define B_VOP	2
#define S_VOP	3
#define N_VOP	4

/* resync-specific */
#define NUMBITS_VP_RESYNC_MARKER  17
#define RESYNC_MARKER 1


/*vlc define*/
#define 	VLC_ERROR		(-1)

#define 	ESCAPE  		3
#define 	ESCAPE1 		6
#define 	ESCAPE2 		14
#define 	ESCAPE3 		15

/* useful macros */
#define 	MIN(X, Y) 		((X)<(Y)?(X):(Y))
#define 	MAX(X, Y) 		((X)>(Y)?(X):(Y))
#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; }
#define     BSWAP(a) \
	        ((a) = (((a) & 0xff) << 24)  | (((a) & 0xff00) << 8) | \
	        (((a) >> 8) & 0xff00) | (((a) >> 24) & 0xff))

#define 	DIV2ROUND(n)  		(((n)>>1)|((n)&1))
#define 	DIV2(n)       		((n)>>1)
#define 	DIVUVMOV(n) 		(((n) >> 1) + roundtab_79[(n) & 0x3])

#define 	GET_BITS(cache, n) ((cache)>>(32-(n)))
	
#define 	EDGE_SIZE  										64
#define     BS_VERSION_BUGGY_DC_CLIPPING                    34

#define 	VM18P 												3
#define 	VM18Q 												4

#define 	SCALEBITS 										17
#define 	FIX(X)	  ((1UL << SCALEBITS) / (X) + 1)
#define     FIXL(X)    ((1UL << 16) / (X) - 1)


#define 	SAFETY						64
#define 	EDGE_SIZE2  				EDGE_SIZE/2


#define 	MLT(i)  				(((16-(i))<<16) + (i))
#define   RSHIFT(a,b)     ((a)>0 ? ((a) + (1<<((b)-1)))>>(b) : ((a) + (1<<((b)-1))-1)>>(b))
#define   RDIV(a,b)       (((a)>0 ? (a) + ((b)>>1) : (a) - ((b)>>1))/(b))
#define   DIV2ROUND(n)    (((n)>>1)|((n)&1))

#define   BS_VERSION_BUGGY_CHROMA_ROUNDING   1
#define   VIDOBJLAY_AR_EXTPAR				 15
#define   LEVELOFFSET						 32

#define	  READ_MARKER()	                    BitstreamSkip(bs, 1)
#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -