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

📄 mvstruct.h

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


typedef struct
{
	uint8_t *y;
	uint8_t *u;
	uint8_t *v;
}
IMAGE;



/*macroblock*/

typedef struct
{
	int x;
	int y;
}
VECTOR;

typedef struct
{
	VECTOR duv[3];
}
WARPPOINTS;

/* save all warping parameters for GMC once and for all, instead of
   recalculating for every block. This is needed for encoding&decoding
   When switching to incremental calculations, this will get much shorter
*/

/*	we don't include WARPPOINTS wp	here, but in FRAMEINFO itself */

typedef struct
{
	int num_wp;		/* [input]: 0=none, 1=translation, 2,3 = warping */
							/* a value of -1 means: "structure not initialized!" */
	int s;					/* [input]: calc is done with 1/s pel resolution */

	int W;
	int H;

	int ss;
	int smask;
	int sigma;

	int r;
	int rho;

	int i0s;
	int j0s;
	int i1s;
	int j1s;
	int i2s;
	int j2s;

	int i1ss;
	int j1ss;
	int i2ss;
	int j2ss;

	int alpha;
	int beta;
	int Ws;
	int Hs;

	int dxF, dyF, dxG, dyG;
	int Fo, Go;
	int cFo, cGo;
} GMC_DATA;

typedef struct _NEW_GMC_DATA
{
   /*  0=none, 1=translation, 2,3 = warping
	*  a value of -1 means: "structure not initialized!" */
	int num_wp;

	/* {0,1,2,3}  =>   {1/2,1/4,1/8,1/16} pel */
	int accuracy;

	/* sprite size * 16 */
	int sW, sH;

	/* gradient, calculated from warp points */
	int dU[2], dV[2], Uo, Vo, Uco, Vco;

	void (*predict_16x16)(const struct _NEW_GMC_DATA * const This,
						  uint8_t *dst, const uint8_t *src,
						  int dststride, int srcstride, int x, int y, int rounding);
	void (*predict_8x8)  (const struct _NEW_GMC_DATA * const This,
						  uint8_t *uDst, const uint8_t *uSrc,
						  uint8_t *vDst, const uint8_t *vSrc,
						  int dststride, int srcstride, int x, int y, int rounding);
	void (*get_average_mv)(const struct _NEW_GMC_DATA * const Dsp, VECTOR * const mv,
						   int x, int y, int qpel);
} NEW_GMC_DATA;

typedef struct
{
	uint32_t bufa;
	uint32_t bufb;
	uint32_t buf;
	uint32_t pos;
	uint32_t *tail;
	uint32_t *start;
	uint32_t length;
	uint32_t initpos;
}
Bitstream;


typedef struct
{
	/* decoder/encoder */
	VECTOR mvs[4];

	short int pred_values[6][MBPRED_SIZE];
	int acpred_directions[6];

	int mode;
	int quant;					/* absolute quant */

	int field_dct;
	int field_pred;
	int field_for_top;
	int field_for_bot;

	/* encoder specific */

	VECTOR pmvs[4];
	VECTOR qmvs[4];				/* mvs in quarter pixel resolution */

	int32_t sad8[4];			/* SAD values for inter4v-VECTORs */
	int32_t sad16;				/* SAD value for inter-VECTOR */

	int dquant;
	int cbp;

	/* bframe stuff */

	VECTOR b_mvs[4];
	VECTOR b_qmvs[4];

	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?   */

}
MACROBLOCK;


/*vlc table define*/
typedef struct
{
	uint32_t code;
	uint8_t len;
}
VLC;

typedef struct
{
	uint8_t last;
	uint8_t run;
	int8_t level;
}
EVENT;

typedef struct
{
	uint8_t len;
	EVENT event;
}
REVERSE_EVENT;

typedef struct
{
	VLC vlc;
	EVENT event;
}
VLC_TABLE;


/*function define*/

typedef struct
{
	int csp;				/* [in] colorspace; or with XVID_CSP_VFLIP to perform vertical flip */
	void * plane[4];		/* [in] image plane ptrs */
	int stride[4];			/* [in] image stride; "bytes per row"*/
} xvid_image_t;

/* XVID_GBL_INIT param1 */
typedef struct
{
	int version;
	unsigned int cpu_flags; /* [in:opt] zero = autodetect cpu; XVID_CPU_FORCE|{cpu features} = force cpu features */
	int debug;     /* [in:opt] debug level */
} xvid_gbl_init_t;


/* XVID_GBL_INFO param1 */
typedef struct
{
	int version;
	int actual_version; /* [out] returns the actual xvidcore version */
	const char * build; /* [out] if !null, points to description of this xvid core build */
	unsigned int cpu_flags;      /* [out] detected cpu features */
	int num_threads;    /* [out] detected number of cpus/threads */
} xvid_gbl_info_t;


/* XVID_GBL_CONVERT param1 */
typedef struct
{
	int version;
	xvid_image_t input;  /* [in] input image & colorspace */
	xvid_image_t output; /* [in] output image & colorspace */
	int width;           /* [in] width */
	int height;          /* [in] height */
	int interlacing;     /* [in] interlacing */
} xvid_gbl_convert_t;


/* XVID_DEC_CREATE param 1
	image width & height may be specified here when the dimensions are
	known in advance. */
typedef struct
{
	int version;
	int width;     /* [in:opt] image width */
	int height;    /* [in:opt] image width */
	void * handle; /* [out]	   decore context handle */
} xvid_dec_create_t;


typedef struct
{
	int version;
	int general;         /* [in:opt] general flags */
	void *bitstream;     /* [in]     bitstream (read from)*/
	int length;          /* [in]     bitstream length */
	xvid_image_t output; /* [in]     output image (written to) */

	/*the state : 0:success, 1:error  add by wuhaibin 2007-01-12*/
	int   decode_state;
	
/* ------- v1.1.x ------- */
	int brightness;		 /* [in]	 brightness offset (0=none) */
} xvid_dec_frame_t;


/* XVID_DEC_DECODE param2 :: optional */
typedef struct
{
	int version;

	int type;                   /* [out] output data type */
	union {
		struct { /* type>0 {XVID_TYPE_IVOP,XVID_TYPE_PVOP,XVID_TYPE_BVOP,XVID_TYPE_SVOP} */
			int general;        /* [out] flags */
			int time_base;      /* [out] time base */
			int time_increment; /* [out] time increment */

			/* XXX: external deblocking stuff */
			int * qscale;	    /* [out] pointer to quantizer table */
			int qscale_stride;  /* [out] quantizer scale stride */

		} vop;
		struct {	/* XVID_TYPE_VOL */
			int general;        /* [out] flags */
			int width;          /* [out] width */
			int height;         /* [out] height */
			int par;            /* [out] pixel aspect ratio (refer to XVID_PAR_xxx above) */
			int par_width;      /* [out] aspect ratio width  [1..255] */
			int par_height;     /* [out] aspect ratio height [1..255] */
		} vol;
	} data;
} xvid_dec_stats_t;

typedef struct
{
	/* vol bitstream */

	int time_inc_resolution;
	int fixed_time_inc;
	uint32_t time_inc_bits;

	uint32_t shape;
	int ver_id;
	uint32_t quant_bits;
	uint32_t quant_type;
	uint16_t *mpeg_quant_matrices;
	int32_t quarterpel;
	int32_t cartoon_mode;
	int complexity_estimation_disable;
	//ESTIMATION estimation;

	int interlacing;
	uint32_t top_field_first;
	uint32_t alternate_vertical_scan;

	int aspect_ratio;
	int par_width;
	int par_height;

	int sprite_enable;
	int sprite_warping_points;
	int sprite_warping_accuracy;
	int sprite_brightness_change;

	int newpred_enable;
	int reduced_resolution_enable;

	/* The bitstream version if it's a XviD stream */
	int bs_version;

	/* image */

	int fixed_dimensions;
	uint32_t width;
	uint32_t height;
	uint32_t edged_width;
	uint32_t edged_height;

	IMAGE cur;
	IMAGE refn[2];				/* 0   -- last I or P VOP */
								/* 1   -- first I or P */
	IMAGE tmp;		/* bframe interpolation, and post processing tmp buffer */
	IMAGE qtmp;		/* quarter pel tmp buffer */

	/* postprocessing */
	//XVID_POSTPROC postproc; wuhaibin 2007-01-16

	/* macroblock */

	uint32_t mb_width;
	uint32_t mb_height;
	MACROBLOCK *mbs;

	/*
	 * for B-frame & low_delay==0
	 * XXX: should move frame based stuff into a DECODER_FRAMEINFO struct
	 */
	MACROBLOCK *last_mbs;			/* last MB */
        int last_coding_type;           /* last coding type value */
	int last_reduced_resolution;	/* last reduced_resolution value */
	int32_t frames;				/* total frame number */
	int32_t packed_mode;		/* bframes packed bitstream? (1 = yes) */
	int8_t scalability;
	VECTOR p_fmv, p_bmv;		/* pred forward & backward motion vector */
	int64_t time;				/* for record time */
	int64_t time_base;
	int64_t last_time_base;
	int64_t last_non_b_time;
	int32_t time_pp;
	int32_t time_bp;
	uint32_t low_delay;			/* low_delay flage (1 means no B_VOP) */
	uint32_t low_delay_default;	/* default value for low_delay flag */

	/* for GMC: central place for all parameters */

	IMAGE gmc;		/* gmc tmp buffer, remove for blockbased compensation */
	GMC_DATA gmc_data;
	NEW_GMC_DATA new_gmc_data;

	xvid_image_t* out_frm;                /* This is used for slice rendering */

	int * qscale;				/* quantization table for decoder's stats */

	/* Tells if the reference image is edged or not */
	int is_edged[2];

	/* add by wuhaibin 2007-01-12*/
	int n_decode_frame_num;
	
}
DECODER;


#endif

⌨️ 快捷键说明

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