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

📄 basic.h

📁 au1200 linux2.6.11 硬件解码mae驱动和maiplayer播放器源码
💻 H
字号:
/*************************************************************************This software module was originally developed by 	Ming-Chieh Lee (mingcl@microsoft.com), Microsoft Corporation	Wei-ge Chen (wchen@microsoft.com), Microsoft Corporation	Bruce Lin (blin@microsoft.com), Microsoft Corporation	Chuang Gu (chuanggu@microsoft.com), Microsoft Corporation	(date: March, 1996)and edited by    Fujitsu Laboratories Ltd. (contact: Eishi Morimatsu)in the course of development of the MPEG-4 Video (ISO/IEC 14496-2). This software module is an implementation of a part of one or more MPEG-4 Video tools as specified by the MPEG-4 Video. ISO/IEC gives users of the MPEG-4 Video free license to this software module or modifications thereof for use in hardware or software products claiming conformance to the MPEG-4 Video. Those intending to use this software module in hardware or software products are advised that its use may infringe existing patents. The original developer of this software module and his/her company, the subsequent editors and their companies, and ISO/IEC have no liability for use of this software module or modifications thereof in an implementation. Copyright is not released for non MPEG-4 Video conforming products. Microsoft retains full right to use the code for his/her own purpose, assign or donate the code to a third party and to inhibit third parties from using the code for non MPEG-4 Video conforming products. This copyright notice must be included in all copies or derivative works. Copyright (c) 1996, 1997.Module Name:	basic.hAbstract:    Basic types:		Data, CSite, CVector2D, CVector3D, CRct, CPixel, CMotionVector, CMatrix3x3DRevision History:	Sep.06	1999 : RRV added by Eishi Morimatsu (Fujitsu Laboratories Ltd.) *************************************************************************/#ifndef __BASIC_HPP_ #define __BASIC_HPP_#include "assert.h"#include "string.h"#define own // used as "reserved word" to indicate ownership or transfer to distinguish from const#define TRUE 1#define FALSE 0#ifndef NULL#define NULL 0#endif#define transpValue 0#define opaqueValue 255#define transpValueF 0.0F#define opaqueValueF 255.0F/*BBM// Added for Boundary by Hyundai(1998-5-9)#define BBM             TRUE#define BBS             FALSE// End of Hyundai(1998-5-9)*/#ifdef TRANSPARENT#undef TRANSPARENT#endif#ifdef OPAQUE#undef OPAQUE#endif#define TRANSPARENT 0#define OPAQUE 255#define transpPixel CPixel(0,0,0,0)#define opaquePixel CPixel(255,255,255,255)#define max(a,b) (((a) > (b)) ? (a) : (b))#define min(a, b)  (((a) < (b)) ? (a) : (b))#define signOf(x) (((x) > 0) ? 1 : 0)#define invSignOf(x) ((x) > 0 ? 0 : 1)					// see p.22/H.263#define sign(x) ((x) > 0 ? 1 : -1)					// see p.22/H.263#define rounded(x) ((x) > 0 ? x + 0.5 : x - 0.5)/////////////////////////////////////////////// //  Typedefs for basic types// /////////////////////////////////////////////#define Sizeof(x) ((unsigned long) sizeof (x))#if 1 // in case future compilers redefine longs and shortstypedef unsigned long U32; typedef int I32; typedef unsigned short U16; typedef short I16; ///// WAVELET VTC: begin ///////////////////////////////typedef unsigned short UShort;  // hjleetypedef short Short;   // hjlee///// WAVELET VTC: end ///////////////////////////////#endif // in case future compilers redefine longs and shorts typedef unsigned UInt; typedef double Double; typedef unsigned char U8; typedef signed char I8; ///// WAVELET VTC: begin ///////////////////////////////typedef unsigned char UChar;  // hjlee///// WAVELET VTC: end ///////////////////////////////typedef long Long; typedef unsigned long ULong; typedef int Int; typedef void Void; typedef int Bool; typedef long CoordI; typedef double CoordD; typedef char Byte; typedef char Char; typedef enum {red, green, blue, alpha} RGBA; // define pixel componenttypedef enum {zero, repeat} PadMethod; // define padding techniquetypedef enum {Q_H263, Q_MPEG} Quantizer; typedef enum {IVOP, PVOP, BVOP, SPRITE, UNKNOWNVOPTYPE} VOPpredType;typedef enum {B_FORWARD, B_BACKWARD} ShapeBPredDir;typedef enum BlockNum {	ALL_Y_BLOCKS	= 0,	Y_BLOCK1		= 1, 	Y_BLOCK2		= 2, 	Y_BLOCK3		= 3, 	Y_BLOCK4		= 4, 	U_BLOCK			= 5, 	V_BLOCK			= 6,	A_BLOCK1		= 7, 	A_BLOCK2		= 8, 	A_BLOCK3		= 9, 	A_BLOCK4		= 10, 	ALL_A_BLOCKS	= 11} BlockNum;typedef enum PlaneType {Y_PLANE, U_PLANE, V_PLANE, A_PLANE, BY_PLANE, BUV_PLANE} PlaneType;typedef enum AlphaUsage {RECTANGLE, ONE_BIT, EIGHT_BIT} AlphaUsage;typedef enum ChromType {FOUR_FOUR_FOUR, FOUR_TWO_TWO, FOUR_TWO_ZERO} ChromType;typedef enum EntropyCodeType {huffman, arithmetic} EntropyCodeType;typedef enum TransparentStatus {ALL, PARTIAL, NONE} TransparentStatus;typedef enum {STOP, PIECE, UPDATE, PAUSE, NEXT} SptXmitMode;typedef enum {BASIC_SPRITE, LOW_LATENCY, PIECE_OBJECT, 		PIECE_UPDATE} SptMode;	// basic sprite, and low-latency (object only, update only, intermingled) typedef Int Time;/////////////////////////////////////////////// //  Space// /////////////////////////////////////////////typedef struct _tag_CSite{    CoordI x;     CoordI y; }CSite;typedef CSite CVector;extern CSite g_CAddVect, g_CSubVect, g_CMulVect, g_CDivVect;// CVector#define ADD_VECT(CSrc1, CSrc2)\g_CAddVect.x = CSrc1.x + CSrc2.x;\g_CAddVect.y = CSrc1.y + CSrc2.y#define SUB_VECT(CSrc1, CSrc2)\g_CSubVect.x = CSrc1.x - CSrc2.x;\g_CSubVect.y = CSrc1.y - CSrc2.y#define MUL_VECT(CSrc1, iScale)\g_CMulVect.x = CSrc1.x * iScale;\g_CMulVect.y = CSrc1.y * iScale#define DIV_VECT(CSrc, iScale)\g_CDivVect.x = (CSrc.x > 0) ? (Int) ((Double) (CSrc.x / iScale) + .5) : (Int) ((Double) (CSrc.x / iScale) - .5);\g_CDivVect.x = (CSrc.y > 0) ? (Int) ((Double) (CSrc.y / iScale) + .5) : (Int) ((Double) (CSrc.y / iScale) - .5)#define RESET_VECT(CSrc)       (CSrc.x = CSrc.y = 0)// CMotionVector#define TRUEMVHALFPEL(CMV)      (CMV->m_vctTrueHalfPel)#define TRUEMVHALFPEL_X(CMV)    (CMV->m_vctTrueHalfPel.x)#define TRUEMVHALFPEL_Y(CMV)    (CMV->m_vctTrueHalfPel.y)#define SETTOZERO(CMV)\CMV->m_vctTrueHalfPel.x = 0;\CMV->m_vctTrueHalfPel.y = 0;\CMV->iMVX               = 0;\CMV->iMVY               = 0;\CMV->iHalfX             = 0;\CMV->iHalfY             = 0;#define COMPUTETRUEMV(CMV)\CMV->m_vctTrueHalfPel.x = CMV->iMVX * 2 + CMV->iHalfX;\CMV->m_vctTrueHalfPel.y = CMV->iMVY * 2 + CMV->iHalfY;#define COMPUTEMV(CMV)\CMV->iMVX = CMV->m_vctTrueHalfPel.x / 2;\CMV->iMVY = CMV->m_vctTrueHalfPel.y / 2;\CMV->iHalfX = CMV->m_vctTrueHalfPel.x - CMV->iMVX * 2;\CMV->iHalfY = CMV->m_vctTrueHalfPel.y - CMV->iMVY * 2;#define CMOTIONVECTOR_INIT1(CMV, vctHalfPel)\CMV->m_vctTrueHalfPel = vctHalfPel;\COMPUTEMV(CMV);#define CMOTIONVECTOR_INIT2(CMV) SETTOZERO(CMV);#define CMOTIONVECTOR_INIT3(pCMV, ix, iy)\pCMV->iMVX = ix;\pCMV->iMVY = iy;\pCMV->iHalfX = pCMV->iHalfY = 0;\COMPUTETRUEMV (pCMV);// CRct#define CRCT_Init2(CRct, l, t, r, b)\CRct->left      = l;\CRct->top       = t;\CRct->right     = r;\CRct->bottom    = b;\CRct->width     = CRct->right - CRct->left;#define DOWNSAMPLEBY2(CRct_Dst, CRct_Src)\CRct_Dst->left      = CRct_Src->left/2;\CRct_Dst->top       = CRct_Src->top/2;\CRct_Dst->right     = CRct_Src->right/2;\CRct_Dst->bottom    = CRct_Src->bottom/2;\CRct_Dst->width     = CRct_Dst->right - CRct_Dst->left;#define INVALIDATE(CRct)\CRct->left  = CRct->top     = 0;\CRct->right = CRct->bottom  = -1;#define RCT_EXPAND(CRct, new_size) RCT_EXPAND_ALL(CRct, new_size, new_size, new_size, new_size)#define RCT_EXPAND_ALL(CRct, dl, dt, dr, db)\CRct->left      -= dl;\CRct->top       -= dt;\CRct->right     -= dr;\CRct->bottom    -= db;\CRct->width     += (dr + dl);#define RCT_VALID(CRct) ((CRct->left < CRct->right) && (CRct->top < CRct->bottom))#define RCT_HEIGHT(CRct) (!RCT_VALID(CRct) ? 0 : (CRct->bottom - CRct->top))#define RCT_AREA(CRct)   (CRct->width * RCT_HEIGHT(CRct))#define RCT_OFFSET(CRct, x, y) (RCT_VALID(CRct) ? 0 : (UInt) CRct->width * (y - CRct->top) + (x - CRct->left))typedef struct CVector2D{	CoordD x; 	CoordD y; }CVector2D;typedef CVector2D CSiteD;typedef struct CRct{	CoordI left, top, right, bottom;	Int width; // width is needed almost for every Rect.  So have a member to avoid extra computations.}CRct; /////////////////////////////////////////////// //  Motion Vectors// /////////////////////////////////////////////typedef struct CMotionVector{	CVector m_vctTrueHalfPel;	Int iMVX; // x direction motion	Int iMVY; // y direction motion	Int iHalfX; // x direction half pixel. 3 values: -1, 0, 1	Int iHalfY; // x direction half pixel. 3 values: -1, 0, 1}CMotionVector;#endif // __BASIC_HPP_

⌨️ 快捷键说明

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