omxtypes.h revision 0c1bc742181ded4930842b46e9507372f0b1b963
1/**
2 * File: omxtypes.h
3 * Brief: Defines basic Data types used in OpenMAX v1.0.2 header files.
4 *
5 * Copyright � 2005-2008 The Khronos Group Inc. All Rights Reserved.
6 *
7 * These materials are protected by copyright laws and contain material
8 * proprietary to the Khronos Group, Inc.  You may use these materials
9 * for implementing Khronos specifications, without altering or removing
10 * any trademark, copyright or other notice from the specification.
11 *
12 * Khronos Group makes no, and expressly disclaims any, representations
13 * or warranties, express or implied, regarding these materials, including,
14 * without limitation, any implied warranties of merchantability or fitness
15 * for a particular purpose or non-infringement of any intellectual property.
16 * Khronos Group makes no, and expressly disclaims any, warranties, express
17 * or implied, regarding the correctness, accuracy, completeness, timeliness,
18 * and reliability of these materials.
19 *
20 * Under no circumstances will the Khronos Group, or any of its Promoters,
21 * Contributors or Members or their respective partners, officers, directors,
22 * employees, agents or representatives be liable for any damages, whether
23 * direct, indirect, special or consequential damages for lost revenues,
24 * lost profits, or otherwise, arising from or in connection with these
25 * materials.
26 *
27 * Khronos and OpenMAX are trademarks of the Khronos Group Inc.
28 *
29 */
30
31#ifndef _OMXTYPES_H_
32#define _OMXTYPES_H_
33
34#include <limits.h>
35
36#define OMX_IN
37#define OMX_OUT
38#define OMX_INOUT
39
40
41typedef enum {
42
43    /* Mandatory return codes - use cases are explicitly described for each function */
44    OMX_Sts_NoErr                    =  0,    /* No error, the function completed successfully */
45    OMX_Sts_Err                      = -2,    /* Unknown/unspecified error */
46    OMX_Sts_InvalidBitstreamValErr   = -182,  /* Invalid value detected during bitstream processing */
47    OMX_Sts_MemAllocErr              = -9,    /* Not enough memory allocated for the operation */
48    OMX_StsACAAC_GainCtrErr    	     = -159,  /* AAC: Unsupported gain control data detected */
49    OMX_StsACAAC_PrgNumErr           = -167,  /* AAC: Invalid number of elements for one program   */
50    OMX_StsACAAC_CoefValErr          = -163,  /* AAC: Invalid quantized coefficient value          */
51    OMX_StsACAAC_MaxSfbErr           = -162,  /* AAC: Invalid maxSfb value in relation to numSwb */
52	OMX_StsACAAC_PlsDataErr		     = -160,  /* AAC: pulse escape sequence data error */
53
54    /* Optional return codes - use cases are explicitly described for each function*/
55    OMX_Sts_BadArgErr                = -5,    /* Bad Arguments */
56
57    OMX_StsACAAC_TnsNumFiltErr       = -157,  /* AAC: Invalid number of TNS filters  */
58    OMX_StsACAAC_TnsLenErr           = -156,  /* AAC: Invalid TNS region length  */
59    OMX_StsACAAC_TnsOrderErr         = -155,  /* AAC: Invalid order of TNS filter  */
60    OMX_StsACAAC_TnsCoefResErr       = -154,  /* AAC: Invalid bit-resolution for TNS filter coefficients  */
61    OMX_StsACAAC_TnsCoefErr          = -153,  /* AAC: Invalid TNS filter coefficients  */
62    OMX_StsACAAC_TnsDirectErr        = -152,  /* AAC: Invalid TNS filter direction  */
63
64    OMX_StsICJP_JPEGMarkerErr        = -183,  /* JPEG marker encountered within an entropy-coded block; */
65                                              /* Huffman decoding operation terminated early.           */
66    OMX_StsICJP_JPEGMarker           = -181,  /* JPEG marker encountered; Huffman decoding */
67                                              /* operation terminated early.                         */
68    OMX_StsIPPP_ContextMatchErr      = -17,   /* Context parameter doesn't match to the operation */
69
70    OMX_StsSP_EvenMedianMaskSizeErr  = -180,  /* Even size of the Median Filter mask was replaced by the odd one */
71
72    OMX_Sts_MaximumEnumeration       = INT_MAX  /*Placeholder, forces enum of size OMX_INT*/
73
74 } OMXResult;          /** Return value or error value returned from a function. Identical to OMX_INT */
75
76
77/* OMX_U8 */
78#if UCHAR_MAX == 0xff
79typedef unsigned char OMX_U8;
80#elif USHRT_MAX == 0xff
81typedef unsigned short int OMX_U8;
82#else
83#error OMX_U8 undefined
84#endif
85
86
87/* OMX_S8 */
88#if SCHAR_MAX == 0x7f
89typedef signed char OMX_S8;
90#elif SHRT_MAX == 0x7f
91typedef signed short int OMX_S8;
92#else
93#error OMX_S8 undefined
94#endif
95
96
97/* OMX_U16 */
98#if USHRT_MAX == 0xffff
99typedef unsigned short int OMX_U16;
100#elif UINT_MAX == 0xffff
101typedef unsigned int OMX_U16;
102#else
103#error OMX_U16 undefined
104#endif
105
106
107/* OMX_S16 */
108#if SHRT_MAX == 0x7fff
109typedef signed short int OMX_S16;
110#elif INT_MAX == 0x7fff
111typedef signed int OMX_S16;
112#else
113#error OMX_S16 undefined
114#endif
115
116
117/* OMX_U32 */
118#if UINT_MAX == 0xffffffff
119typedef unsigned int OMX_U32;
120#elif LONG_MAX == 0xffffffff
121typedef unsigned long int OMX_U32;
122#else
123#error OMX_U32 undefined
124#endif
125
126
127/* OMX_S32 */
128#if INT_MAX == 0x7fffffff
129typedef signed int OMX_S32;
130#elif LONG_MAX == 0x7fffffff
131typedef long signed int OMX_S32;
132#else
133#error OMX_S32 undefined
134#endif
135
136
137/* OMX_U64 & OMX_S64 */
138#if defined( _WIN32 ) || defined ( _WIN64 )
139    typedef __int64 OMX_S64; /** Signed 64-bit integer */
140    typedef unsigned __int64 OMX_U64; /** Unsigned 64-bit integer */
141    #define OMX_MIN_S64			(0x8000000000000000i64)
142    #define OMX_MIN_U64			(0x0000000000000000i64)
143    #define OMX_MAX_S64			(0x7FFFFFFFFFFFFFFFi64)
144    #define OMX_MAX_U64			(0xFFFFFFFFFFFFFFFFi64)
145#else
146    typedef long long OMX_S64; /** Signed 64-bit integer */
147    typedef unsigned long long OMX_U64; /** Unsigned 64-bit integer */
148    #define OMX_MIN_S64			(0x8000000000000000LL)
149    #define OMX_MIN_U64			(0x0000000000000000LL)
150    #define OMX_MAX_S64			(0x7FFFFFFFFFFFFFFFLL)
151    #define OMX_MAX_U64			(0xFFFFFFFFFFFFFFFFLL)
152#endif
153
154
155/* OMX_SC8 */
156typedef struct
157{
158  OMX_S8 Re; /** Real part */
159  OMX_S8 Im; /** Imaginary part */
160
161} OMX_SC8; /** Signed 8-bit complex number */
162
163
164/* OMX_SC16 */
165typedef struct
166{
167  OMX_S16 Re; /** Real part */
168  OMX_S16 Im; /** Imaginary part */
169
170} OMX_SC16; /** Signed 16-bit complex number */
171
172
173/* OMX_SC32 */
174typedef struct
175{
176  OMX_S32 Re; /** Real part */
177  OMX_S32 Im; /** Imaginary part */
178
179} OMX_SC32; /** Signed 32-bit complex number */
180
181
182/* OMX_SC64 */
183typedef struct
184{
185  OMX_S64 Re; /** Real part */
186  OMX_S64 Im; /** Imaginary part */
187
188} OMX_SC64; /** Signed 64-bit complex number */
189
190
191/* OMX_F32 */
192typedef float OMX_F32; /** Single precision floating point,IEEE 754 */
193
194
195/* OMX_F64 */
196typedef double OMX_F64; /** Double precision floating point,IEEE 754 */
197
198
199/* OMX_INT */
200typedef int OMX_INT; /** signed integer corresponding to machine word length, has maximum signed value INT_MAX*/
201
202
203#define OMX_MIN_S8  	   	(-128)
204#define OMX_MIN_U8  		0
205#define OMX_MIN_S16		 	(-32768)
206#define OMX_MIN_U16			0
207#define OMX_MIN_S32			(-2147483647-1)
208#define OMX_MIN_U32			0
209
210#define OMX_MAX_S8			(127)
211#define OMX_MAX_U8			(255)
212#define OMX_MAX_S16			(32767)
213#define OMX_MAX_U16			(0xFFFF)
214#define OMX_MAX_S32			(2147483647)
215#define OMX_MAX_U32			(0xFFFFFFFF)
216
217typedef void OMXVoid;
218
219#ifndef NULL
220#define NULL ((void*)0)
221#endif
222
223/** Defines the geometric position and size of a rectangle,
224  * where x,y defines the coordinates of the top left corner
225  * of the rectangle, with dimensions width in the x-direction
226  * and height in the y-direction */
227typedef struct {
228	OMX_INT x;      /** x-coordinate of top left corner of rectangle */
229	OMX_INT y;      /** y-coordinate of top left corner of rectangle */
230	OMX_INT width;  /** Width in the x-direction. */
231	OMX_INT height; /** Height in the y-direction. */
232}OMXRect;
233
234
235/** Defines the geometric position of a point, */
236typedef struct
237{
238 OMX_INT x; /** x-coordinate */
239 OMX_INT y;	/** y-coordinate */
240
241} OMXPoint;
242
243
244/** Defines the dimensions of a rectangle, or region of interest in an image */
245typedef struct
246{
247 OMX_INT width;  /** Width of the rectangle, in the x-direction */
248 OMX_INT height; /** Height of the rectangle, in the y-direction */
249
250} OMXSize;
251
252#endif /* _OMXTYPES_H_ */
253