~ubuntu-branches/ubuntu/trusty/mpeg4ip/trusty

« back to all changes in this revision

Viewing changes to common/video/iso-mpeg4/include/typeapi.h

  • Committer: Bazaar Package Importer
  • Author(s): Mario Limonciello
  • Date: 2008-01-12 15:59:56 UTC
  • Revision ID: james.westby@ubuntu.com-20080112155956-1vznw5njidvrh649
Tags: upstream-1.6dfsg
ImportĀ upstreamĀ versionĀ 1.6dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*************************************************************************
 
2
 
 
3
This software module was originally developed by 
 
4
 
 
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
 
9
        (date: March, 1996)
 
10
 
 
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. 
 
24
 
 
25
Copyright (c) 1996, 1997.
 
26
 
 
27
 
 
28
Module Name:
 
29
 
 
30
    typeapi.h
 
31
 
 
32
Abstract:
 
33
 
 
34
    Glue for TYPE called from elsewhere
 
35
 
 
36
Revision History:
 
37
        
 
38
NOTE: CALLER OWNS ALL THE RETURNED POINTERS!!
 
39
 
 
40
*************************************************************************/
 
41
 
 
42
#ifndef __TYPEAPI_H__
 
43
#define __TYPEAPI_H__
 
44
 
 
45
#include <stdio.h>
 
46
#include <stdlib.h>
 
47
#include "header.h"
 
48
#include "basic.hpp"
 
49
#include "geom.hpp"
 
50
#include "transf.hpp"
 
51
#include "warp.hpp"
 
52
#include "vop.hpp"
 
53
#include "grayf.hpp"
 
54
#include "grayi.hpp"
 
55
#include "yuvai.hpp"
 
56
#include "grayc.hpp"
 
57
#include "yuvac.hpp"
 
58
 
 
59
// handy functions
 
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
 
65
 
 
66
#ifndef __DOUBLE_PRECISION_
 
67
API Double checkrange (Double x, Double cMin, Double cMax);
 
68
#endif // __DOUBLE_PRECISION_
 
69
 
 
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
 
72
 
 
73
// handy numerical functions
 
74
API Int sad (
 
75
        const CIntImage& fi0, // first float image
 
76
        const CIntImage& fi1, // second float image
 
77
        const CIntImage& fiMsk // float image indicating the transparency information
 
78
);
 
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]);
 
81
 
 
82
// CRct
 
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
 
85
 
 
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
 
92
);
 
93
 
 
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
 
98
);
 
99
 
 
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
 
104
);
 
105
 
 
106
API Void getAlphaYDataFromMB (const CVOPIntYUVBA* pvopfMB, CIntImage*& pfiA, Int blkNum);
 
107
 
 
108
// expand
 
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);
 
112
 
 
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
 
120
);
 
121
 
 
122
#ifdef __NBIT_
 
123
void pxlcmemset(PixelC *ppxlc, PixelC pxlcVal, Int iCount);
 
124
#else
 
125
#define pxlcmemset(ppxlc, pxlcVal, iCount)  memset(ppxlc, pxlcVal, iCount)
 
126
#endif
 
127
 
 
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);
 
131
 
 
132
// for unix compability
 
133
#ifndef SEEK_CUR
 
134
#define SEEK_CUR    1
 
135
#endif
 
136
#ifndef SEEK_END
 
137
#define SEEK_END    2
 
138
#endif
 
139
#ifndef SEEK_SET
 
140
#define SEEK_SET    0
 
141
#endif
 
142
 
 
143
#endif // __TYPEAPI_H__
 
144
 
 
145
 
 
146
 
 
147
 
 
148