1
/*************************************************************************
3
This software module was originally developed by
5
Ming-Chieh Lee (mingcl@microsoft.com), Microsoft Corporation
6
Wei-ge Chen (wchen@microsoft.com), Microsoft Corporation
7
Bruce Lin (blin@microsoft.com), Microsoft Corporation
8
Chuang Gu (chuanggu@microsoft.com), Microsoft Corporation
11
in the course of development of the MPEG-4 Video (ISO/IEC 14496-2).
12
This software module is an implementation of a part of one or more MPEG-4 Video tools
13
as specified by the MPEG-4 Video.
14
ISO/IEC gives users of the MPEG-4 Video free license to this software module or modifications
15
thereof for use in hardware or software products claiming conformance to the MPEG-4 Video.
16
Those intending to use this software module in hardware or software products are advised that its use may infringe existing patents.
17
The original developer of this software module and his/her company,
18
the subsequent editors and their companies,
19
and ISO/IEC have no liability for use of this software module or modifications thereof in an implementation.
20
Copyright is not released for non MPEG-4 Video conforming products.
21
Microsoft retains full right to use the code for his/her own purpose,
22
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.
23
This copyright notice must be included in all copies or derivative works.
25
Copyright (c) 1996, 1997.
34
Glue for TYPE called from elsewhere
38
NOTE: CALLER OWNS ALL THE RETURNED POINTERS!!
40
*************************************************************************/
60
API Int nint (Double x); // returns nearest integer to x, analog of FORTRAN NINT
61
// NBIT: add checkrange for U16
62
API U16 checkrange (U16 x, U16 cMin, U16 cMax); // returns cMin if x < cMin, cMax if x > cMax, otherwise x
63
API Int checkrange (Int x, Int cMin, Int cMax); // returns cMin if x < cMin, cMax if x > cMax, otherwise x
64
API Long checkrange (Long x, Long cMin, Long cMax); // returns cMin if x < cMin, cMax if x > cMax, otherwise x
66
#ifndef __DOUBLE_PRECISION_
67
API Double checkrange (Double x, Double cMin, Double cMax);
68
#endif // __DOUBLE_PRECISION_
70
API Float checkrange (Float x, Float cMin, Float cMax);
71
API U8 checkrangeU8 (U8 x, U8 cMin, U8 cMax); // returns cMin if x < cMin, cMax if x > cMax, otherwise x
73
// handy numerical functions
75
const CIntImage& fi0, // first float image
76
const CIntImage& fi1, // second float image
77
const CIntImage& fiMsk // float image indicating the transparency information
79
API Void mse (const CVideoObjectPlane& vop1, const CVideoObjectPlane& vop2, Double dmse [3]);
80
API Void snr (const CVideoObjectPlane& vop1, const CVideoObjectPlane& vop2, Double dsnr [3]);
83
API CRct rctFromIndex (UInt indexX, UInt indexY, const CRct& rct, UInt size); // starting from 0
84
API CRct rctDivide (const CRct& rctBlk, const CRct& rctVOP, UInt rate); // divide the rctBlk by rate, with refererence to rvtVOP
86
// for MB CVOPIntYUVBA
87
API Void getBlockDataFromMB ( // will create new objects for pfiBlk and pfiA, the caller then owns these two.
88
const CVOPIntYUVBA* pvopfMB, // MacroBlock VOPF data
89
CIntImage*& pfiBlk, // texture of the block
90
CIntImage*& pfiB, // bainry mask of the block
91
Int blkNum // block number
94
API Void getTextureDataFromMB ( // will create new objects for pfiBlk, the caller then owns these two.
95
const CVOPIntYUVBA* pvopfMB, // MacroBlock VOPF data
96
CIntImage*& pfiBlk, // texture of the block
97
Int blkNum // block number
100
API Void getBinaryDataFromMB ( // will create new objects for pfiA, the caller then owns these two.
101
const CVOPIntYUVBA* pvopfMB, // MacroBlock VOPF data
102
CIntImage*& pfiY, // alpha of the block
103
Int blkNum // block number
106
API Void getAlphaYDataFromMB (const CVOPIntYUVBA* pvopfMB, CIntImage*& pfiA, Int blkNum);
109
API CRct fitToMulOfSize (const CRct& rctOrg, UInt size);
110
API own CIntImage* fiFitToMulOfSize (const CIntImage* pfi, UInt size, const CSite* pstLeftTop = NULL);
111
API own CVOPIntYUVBA* vopfFitToMulOfMBSize (const CVOPIntYUVBA* pvopf, const CSite* pstLeftTop = NULL);
113
// load data from MPEG4 file format
114
API own CIntImage* alphaFromCompFile (
115
const Char* pchSeg, // file name
116
UInt ifr, // frame number
117
UInt iobj, // object number
118
const CRct& rct, // rect
119
UInt nszHeader = 0 // number of bytes to skip
123
void pxlcmemset(PixelC *ppxlc, PixelC pxlcVal, Int iCount);
125
#define pxlcmemset(ppxlc, pxlcVal, iCount) memset(ppxlc, pxlcVal, iCount)
128
Int divroundnearest(Int i, Int iDenom);
129
Void dumpNonCodedFrame(FILE* pfYUV, FILE* pfSeg, FILE **ppfAux, Int iAuxCompCount, CRct& rct, UInt nBits);
130
Void fatal_error(char *pchMessage, Int iCont = 0);
132
// for unix compability
143
#endif // __TYPEAPI_H__