1 /**
2  * Copyright (c) 2008 The Khronos Group Inc.
3  *
4  * Permission is hereby granted, free of charge, to any person obtaining
5  * a copy of this software and associated documentation files (the
6  * "Software"), to deal in the Software without restriction, including
7  * without limitation the rights to use, copy, modify, merge, publish,
8  * distribute, sublicense, and/or sell copies of the Software, and to
9  * permit persons to whom the Software is furnished to do so, subject
10  * to the following conditions:
11  * The above copyright notice and this permission notice shall be included
12  * in all copies or substantial portions of the Software.
13  *
14  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
17  * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
18  * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
19  * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
20  * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21  */
22 
23 /**
24  * @file OMX_Image.h - OpenMax IL version 1.1.2
25  * The structures needed by Image components to exchange parameters and
26  * configuration data with the components.
27  */
28 #ifndef OMX_Image_h
29 #define OMX_Image_h
30 
31 #ifdef __cplusplus
32 extern "C" {
33 #endif /* __cplusplus */
34 
35 
36 /**
37  * Each OMX header must include all required header files to allow the
38  * header to compile without errors.  The includes below are required
39  * for this header file to compile successfully
40  */
41 
42 #include <OMX_IVCommon.h>
43 
44 /** @defgroup imaging OpenMAX IL Imaging Domain
45  * @ingroup iv
46  * Structures for OpenMAX IL Imaging domain
47  * @{
48  */
49 
50 /**
51  * Enumeration used to define the possible image compression coding.
52  */
53 typedef enum OMX_IMAGE_CODINGTYPE {
54     OMX_IMAGE_CodingUnused,      /**< Value when format is N/A */
55     OMX_IMAGE_CodingAutoDetect,  /**< Auto detection of image format */
56     OMX_IMAGE_CodingJPEG,        /**< JPEG/JFIF image format */
57     OMX_IMAGE_CodingJPEG2K,      /**< JPEG 2000 image format */
58     OMX_IMAGE_CodingEXIF,        /**< EXIF image format */
59     OMX_IMAGE_CodingTIFF,        /**< TIFF image format */
60     OMX_IMAGE_CodingGIF,         /**< Graphics image format */
61     OMX_IMAGE_CodingPNG,         /**< PNG image format */
62     OMX_IMAGE_CodingLZW,         /**< LZW image format */
63     OMX_IMAGE_CodingBMP,         /**< Windows Bitmap format */
64     OMX_IMAGE_CodingKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
65     OMX_IMAGE_CodingVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
66     OMX_IMAGE_CodingMax = 0x7FFFFFFF
67 } OMX_IMAGE_CODINGTYPE;
68 
69 
70 /**
71  * Data structure used to define an image path. The number of image paths
72  * for input and output will vary by type of the image component.
73  *
74  *  Input (aka Source) : Zero Inputs, one Output,
75  *  Splitter           : One Input, 2 or more Outputs,
76  *  Processing Element : One Input, one output,
77  *  Mixer              : 2 or more inputs, one output,
78  *  Output (aka Sink)  : One Input, zero outputs.
79  *
80  * The PortDefinition structure is used to define all of the parameters
81  * necessary for the compliant component to setup an input or an output
82  * image path.  If additional vendor specific data is required, it should
83  * be transmitted to the component using the CustomCommand function.
84  * Compliant components will prepopulate this structure with optimal
85  * values during the OMX_GetParameter() command.
86  *
87  * STRUCT MEMBERS:
88  *  cMIMEType             : MIME type of data for the port
89  *  pNativeRender         : Platform specific reference for a display if a
90  *                          sync, otherwise this field is 0
91  *  nFrameWidth           : Width of frame to be used on port if
92  *                          uncompressed format is used.  Use 0 for
93  *                          unknown, don't care or variable
94  *  nFrameHeight          : Height of frame to be used on port if
95  *                          uncompressed format is used. Use 0 for
96  *                          unknown, don't care or variable
97  *  nStride               : Number of bytes per span of an image (i.e.
98  *                          indicates the number of bytes to get from
99  *                          span N to span N+1, where negative stride
100  *                          indicates the image is bottom up
101  *  nSliceHeight          : Height used when encoding in slices
102  *  bFlagErrorConcealment : Turns on error concealment if it is supported by
103  *                          the OMX component
104  *  eCompressionFormat    : Compression format used in this instance of
105  *                          the component. When OMX_IMAGE_CodingUnused is
106  *                          specified, eColorFormat is valid
107  *  eColorFormat          : Decompressed format used by this component
108  *  pNativeWindow         : Platform specific reference for a window object if a
109  *                          display sink , otherwise this field is 0x0.
110  */
111 typedef struct OMX_IMAGE_PORTDEFINITIONTYPE {
112     OMX_STRING cMIMEType;
113     OMX_NATIVE_DEVICETYPE pNativeRender;
114     OMX_U32 nFrameWidth;
115     OMX_U32 nFrameHeight;
116     OMX_S32 nStride;
117     OMX_U32 nSliceHeight;
118     OMX_BOOL bFlagErrorConcealment;
119     OMX_IMAGE_CODINGTYPE eCompressionFormat;
120     OMX_COLOR_FORMATTYPE eColorFormat;
121     OMX_NATIVE_WINDOWTYPE pNativeWindow;
122 } OMX_IMAGE_PORTDEFINITIONTYPE;
123 
124 
125 /**
126  * Port format parameter.  This structure is used to enumerate the various
127  * data input/output format supported by the port.
128  *
129  * STRUCT MEMBERS:
130  *  nSize              : Size of the structure in bytes
131  *  nVersion           : OMX specification version information
132  *  nPortIndex         : Indicates which port to set
133  *  nIndex             : Indicates the enumeration index for the format from
134  *                       0x0 to N-1
135  *  eCompressionFormat : Compression format used in this instance of the
136  *                       component. When OMX_IMAGE_CodingUnused is specified,
137  *                       eColorFormat is valid
138  *  eColorFormat       : Decompressed format used by this component
139  */
140 typedef struct OMX_IMAGE_PARAM_PORTFORMATTYPE {
141     OMX_U32 nSize;
142     OMX_VERSIONTYPE nVersion;
143     OMX_U32 nPortIndex;
144     OMX_U32 nIndex;
145     OMX_IMAGE_CODINGTYPE eCompressionFormat;
146     OMX_COLOR_FORMATTYPE eColorFormat;
147 } OMX_IMAGE_PARAM_PORTFORMATTYPE;
148 
149 
150 /**
151  * Flash control type
152  *
153  * ENUMS
154  *  Torch : Flash forced constantly on
155  */
156 typedef enum OMX_IMAGE_FLASHCONTROLTYPE {
157     OMX_IMAGE_FlashControlOn = 0,
158     OMX_IMAGE_FlashControlOff,
159     OMX_IMAGE_FlashControlAuto,
160     OMX_IMAGE_FlashControlRedEyeReduction,
161     OMX_IMAGE_FlashControlFillin,
162     OMX_IMAGE_FlashControlTorch,
163     OMX_IMAGE_FlashControlKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
164     OMX_IMAGE_FlashControlVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
165     OMX_IMAGE_FlashControlMax = 0x7FFFFFFF
166 } OMX_IMAGE_FLASHCONTROLTYPE;
167 
168 
169 /**
170  * Flash control configuration
171  *
172  * STRUCT MEMBERS:
173  *  nSize         : Size of the structure in bytes
174  *  nVersion      : OMX specification version information
175  *  nPortIndex    : Port that this structure applies to
176  *  eFlashControl : Flash control type
177  */
178 typedef struct OMX_IMAGE_PARAM_FLASHCONTROLTYPE {
179     OMX_U32 nSize;
180     OMX_VERSIONTYPE nVersion;
181     OMX_U32 nPortIndex;
182     OMX_IMAGE_FLASHCONTROLTYPE eFlashControl;
183 } OMX_IMAGE_PARAM_FLASHCONTROLTYPE;
184 
185 
186 /**
187  * Focus control type
188  */
189 typedef enum OMX_IMAGE_FOCUSCONTROLTYPE {
190     OMX_IMAGE_FocusControlOn = 0,
191     OMX_IMAGE_FocusControlOff,
192     OMX_IMAGE_FocusControlAuto,
193     OMX_IMAGE_FocusControlAutoLock,
194     OMX_IMAGE_FocusControlKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
195     OMX_IMAGE_FocusControlVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
196     OMX_IMAGE_FocusControlMax = 0x7FFFFFFF
197 } OMX_IMAGE_FOCUSCONTROLTYPE;
198 
199 
200 /**
201  * Focus control configuration
202  *
203  * STRUCT MEMBERS:
204  *  nSize           : Size of the structure in bytes
205  *  nVersion        : OMX specification version information
206  *  nPortIndex      : Port that this structure applies to
207  *  eFocusControl   : Focus control
208  *  nFocusSteps     : Focus can take on values from 0 mm to infinity.
209  *                    Interest is only in number of steps over this range.
210  *  nFocusStepIndex : Current focus step index
211  */
212 typedef struct OMX_IMAGE_CONFIG_FOCUSCONTROLTYPE {
213     OMX_U32 nSize;
214     OMX_VERSIONTYPE nVersion;
215     OMX_U32 nPortIndex;
216     OMX_IMAGE_FOCUSCONTROLTYPE eFocusControl;
217     OMX_U32 nFocusSteps;
218     OMX_U32 nFocusStepIndex;
219 } OMX_IMAGE_CONFIG_FOCUSCONTROLTYPE;
220 
221 
222 /**
223  * Q Factor for JPEG compression, which controls the tradeoff between image
224  * quality and size.  Q Factor provides a more simple means of controlling
225  * JPEG compression quality, without directly programming Quantization
226  * tables for chroma and luma
227  *
228  * STRUCT MEMBERS:
229  *  nSize      : Size of the structure in bytes
230  *  nVersion   : OMX specification version information
231  *  nPortIndex : Port that this structure applies to
232  *  nQFactor   : JPEG Q factor value in the range of 1-100. A factor of 1
233  *               produces the smallest, worst quality images, and a factor
234  *               of 100 produces the largest, best quality images.  A
235  *               typical default is 75 for small good quality images
236  */
237 typedef struct OMX_IMAGE_PARAM_QFACTORTYPE {
238     OMX_U32 nSize;
239     OMX_VERSIONTYPE nVersion;
240     OMX_U32 nPortIndex;
241     OMX_U32 nQFactor;
242 } OMX_IMAGE_PARAM_QFACTORTYPE;
243 
244 /**
245  * Quantization table type
246  */
247 
248 typedef enum OMX_IMAGE_QUANTIZATIONTABLETYPE {
249     OMX_IMAGE_QuantizationTableLuma = 0,
250     OMX_IMAGE_QuantizationTableChroma,
251     OMX_IMAGE_QuantizationTableChromaCb,
252     OMX_IMAGE_QuantizationTableChromaCr,
253     OMX_IMAGE_QuantizationTableKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
254     OMX_IMAGE_QuantizationTableVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
255     OMX_IMAGE_QuantizationTableMax = 0x7FFFFFFF
256 } OMX_IMAGE_QUANTIZATIONTABLETYPE;
257 
258 /**
259  * JPEG quantization tables are used to determine DCT compression for
260  * YUV data, as an alternative to specifying Q factor, providing exact
261  * control of compression
262  *
263  * STRUCT MEMBERS:
264  *  nSize                   : Size of the structure in bytes
265  *  nVersion                : OMX specification version information
266  *  nPortIndex              : Port that this structure applies to
267  *  eQuantizationTable      : Quantization table type
268  *  nQuantizationMatrix[64] : JPEG quantization table of coefficients stored
269  *                            in increasing columns then by rows of data (i.e.
270  *                            row 1, ... row 8). Quantization values are in
271  *                            the range 0-255 and stored in linear order
272  *                            (i.e. the component will zig-zag the
273  *                            quantization table data if required internally)
274  */
275 typedef struct OMX_IMAGE_PARAM_QUANTIZATIONTABLETYPE {
276     OMX_U32 nSize;
277     OMX_VERSIONTYPE nVersion;
278     OMX_U32 nPortIndex;
279     OMX_IMAGE_QUANTIZATIONTABLETYPE eQuantizationTable;
280     OMX_U8 nQuantizationMatrix[64];
281 } OMX_IMAGE_PARAM_QUANTIZATIONTABLETYPE;
282 
283 
284 /**
285  * Huffman table type, the same Huffman table is applied for chroma and
286  * luma component
287  */
288 typedef enum OMX_IMAGE_HUFFMANTABLETYPE {
289     OMX_IMAGE_HuffmanTableAC = 0,
290     OMX_IMAGE_HuffmanTableDC,
291     OMX_IMAGE_HuffmanTableACLuma,
292     OMX_IMAGE_HuffmanTableACChroma,
293     OMX_IMAGE_HuffmanTableDCLuma,
294     OMX_IMAGE_HuffmanTableDCChroma,
295     OMX_IMAGE_HuffmanTableKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
296     OMX_IMAGE_HuffmanTableVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
297     OMX_IMAGE_HuffmanTableMax = 0x7FFFFFFF
298 } OMX_IMAGE_HUFFMANTABLETYPE;
299 
300 /**
301  * JPEG Huffman table
302  *
303  * STRUCT MEMBERS:
304  *  nSize                            : Size of the structure in bytes
305  *  nVersion                         : OMX specification version information
306  *  nPortIndex                       : Port that this structure applies to
307  *  eHuffmanTable                    : Huffman table type
308  *  nNumberOfHuffmanCodeOfLength[16] : 0-16, number of Huffman codes of each
309  *                                     possible length
310  *  nHuffmanTable[256]               : 0-255, the size used for AC and DC
311  *                                     HuffmanTable are 16 and 162
312  */
313 typedef struct OMX_IMAGE_PARAM_HUFFMANTTABLETYPE {
314     OMX_U32 nSize;
315     OMX_VERSIONTYPE nVersion;
316     OMX_U32 nPortIndex;
317     OMX_IMAGE_HUFFMANTABLETYPE eHuffmanTable;
318     OMX_U8 nNumberOfHuffmanCodeOfLength[16];
319     OMX_U8 nHuffmanTable[256];
320 }OMX_IMAGE_PARAM_HUFFMANTTABLETYPE;
321 
322 /** @} */
323 #ifdef __cplusplus
324 }
325 #endif /* __cplusplus */
326 
327 #endif
328 /* File EOF */
329