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 
67     OMX_IMAGE_CodingTGA,
68     OMX_IMAGE_CodingPPM,
69     OMX_IMAGE_CodingBrcmStatistics, /**< Statistics from the Brcm ISP */
70 
71     OMX_IMAGE_CodingMax = 0x7FFFFFFF
72 } OMX_IMAGE_CODINGTYPE;
73 
74 
75 /**
76  * Data structure used to define an image path. The number of image paths
77  * for input and output will vary by type of the image component.
78  *
79  *  Input (aka Source) : Zero Inputs, one Output,
80  *  Splitter           : One Input, 2 or more Outputs,
81  *  Processing Element : One Input, one output,
82  *  Mixer              : 2 or more inputs, one output,
83  *  Output (aka Sink)  : One Input, zero outputs.
84  *
85  * The PortDefinition structure is used to define all of the parameters
86  * necessary for the compliant component to setup an input or an output
87  * image path.  If additional vendor specific data is required, it should
88  * be transmitted to the component using the CustomCommand function.
89  * Compliant components will prepopulate this structure with optimal
90  * values during the OMX_GetParameter() command.
91  *
92  * STRUCT MEMBERS:
93  *  cMIMEType             : MIME type of data for the port
94  *  pNativeRender         : Platform specific reference for a display if a
95  *                          sync, otherwise this field is 0
96  *  nFrameWidth           : Width of frame to be used on port if
97  *                          uncompressed format is used.  Use 0 for
98  *                          unknown, don't care or variable
99  *  nFrameHeight          : Height of frame to be used on port if
100  *                          uncompressed format is used. Use 0 for
101  *                          unknown, don't care or variable
102  *  nStride               : Number of bytes per span of an image (i.e.
103  *                          indicates the number of bytes to get from
104  *                          span N to span N+1, where negative stride
105  *                          indicates the image is bottom up
106  *  nSliceHeight          : Height used when encoding in slices
107  *  bFlagErrorConcealment : Turns on error concealment if it is supported by
108  *                          the OMX component
109  *  eCompressionFormat    : Compression format used in this instance of
110  *                          the component. When OMX_IMAGE_CodingUnused is
111  *                          specified, eColorFormat is valid
112  *  eColorFormat          : Decompressed format used by this component
113  *  pNativeWindow         : Platform specific reference for a window object if a
114  *                          display sink , otherwise this field is 0x0.
115  */
116 typedef struct OMX_IMAGE_PORTDEFINITIONTYPE {
117     OMX_STRING cMIMEType;
118     OMX_NATIVE_DEVICETYPE pNativeRender;
119     OMX_U32 nFrameWidth;
120     OMX_U32 nFrameHeight;
121     OMX_S32 nStride;
122     OMX_U32 nSliceHeight;
123     OMX_BOOL bFlagErrorConcealment;
124     OMX_IMAGE_CODINGTYPE eCompressionFormat;
125     OMX_COLOR_FORMATTYPE eColorFormat;
126     OMX_NATIVE_WINDOWTYPE pNativeWindow;
127 } OMX_IMAGE_PORTDEFINITIONTYPE;
128 
129 
130 /**
131  * Port format parameter.  This structure is used to enumerate the various
132  * data input/output format supported by the port.
133  *
134  * STRUCT MEMBERS:
135  *  nSize              : Size of the structure in bytes
136  *  nVersion           : OMX specification version information
137  *  nPortIndex         : Indicates which port to set
138  *  nIndex             : Indicates the enumeration index for the format from
139  *                       0x0 to N-1
140  *  eCompressionFormat : Compression format used in this instance of the
141  *                       component. When OMX_IMAGE_CodingUnused is specified,
142  *                       eColorFormat is valid
143  *  eColorFormat       : Decompressed format used by this component
144  */
145 typedef struct OMX_IMAGE_PARAM_PORTFORMATTYPE {
146     OMX_U32 nSize;
147     OMX_VERSIONTYPE nVersion;
148     OMX_U32 nPortIndex;
149     OMX_U32 nIndex;
150     OMX_IMAGE_CODINGTYPE eCompressionFormat;
151     OMX_COLOR_FORMATTYPE eColorFormat;
152 } OMX_IMAGE_PARAM_PORTFORMATTYPE;
153 
154 
155 /**
156  * Flash control type
157  *
158  * ENUMS
159  *  Torch : Flash forced constantly on
160  */
161 typedef enum OMX_IMAGE_FLASHCONTROLTYPE {
162     OMX_IMAGE_FlashControlOn = 0,
163     OMX_IMAGE_FlashControlOff,
164     OMX_IMAGE_FlashControlAuto,
165     OMX_IMAGE_FlashControlRedEyeReduction,
166     OMX_IMAGE_FlashControlFillin,
167     OMX_IMAGE_FlashControlTorch,
168     OMX_IMAGE_FlashControlKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
169     OMX_IMAGE_FlashControlVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
170     OMX_IMAGE_FlashControlMax = 0x7FFFFFFF
171 } OMX_IMAGE_FLASHCONTROLTYPE;
172 
173 
174 /**
175  * Flash control configuration
176  *
177  * STRUCT MEMBERS:
178  *  nSize         : Size of the structure in bytes
179  *  nVersion      : OMX specification version information
180  *  nPortIndex    : Port that this structure applies to
181  *  eFlashControl : Flash control type
182  */
183 typedef struct OMX_IMAGE_PARAM_FLASHCONTROLTYPE {
184     OMX_U32 nSize;
185     OMX_VERSIONTYPE nVersion;
186     OMX_U32 nPortIndex;
187     OMX_IMAGE_FLASHCONTROLTYPE eFlashControl;
188 } OMX_IMAGE_PARAM_FLASHCONTROLTYPE;
189 
190 
191 /**
192  * Focus control type
193  */
194 typedef enum OMX_IMAGE_FOCUSCONTROLTYPE {
195     OMX_IMAGE_FocusControlOn = 0,
196     OMX_IMAGE_FocusControlOff,
197     OMX_IMAGE_FocusControlAuto,
198     OMX_IMAGE_FocusControlAutoLock,
199     OMX_IMAGE_FocusControlKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
200     OMX_IMAGE_FocusControlVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
201     OMX_IMAGE_FocusControlHyperfocal,         /* Focus at the hyperfocal point of the lens. */
202     OMX_IMAGE_FocusControlAutoMacro,          /* CF over a macro range (eg 0-50cm) */
203     OMX_IMAGE_FocusControlAutoInfinity,       /* CF over distant range (eg 50cm to infinity) */
204     OMX_IMAGE_FocusControlAutoLockMacro,      /* AF over a macro range (eg 0-50cm) */
205     OMX_IMAGE_FocusControlAutoLockInfinity,   /* AF over distant range (eg 50cm to infinity) */
206     OMX_IMAGE_FocusControlNearFixed,          /* Focus at a fixed near focus point - (50cm-1m) */
207     OMX_IMAGE_FocusControlAutoNear,           /* CF over a near range (eg 0-200cm) */
208     OMX_IMAGE_FocusControlAutoLockNear,       /* AF over a near range (eg 0-200cm) */
209     OMX_IMAGE_FocusControlInfinityFixed,      /* Focus at infinity */
210     OMX_IMAGE_FocusControlMacroFixed,         /* Focus at a macro distance */
211     OMX_IMAGE_FocusControlAutoFast,           /* CF over a full range with fast response */
212     OMX_IMAGE_FocusControlAutoMacroFast,      /* CF over a macro range (eg 0-50cm) with fast response */
213     OMX_IMAGE_FocusControlAutoNearFast,       /* CF over a near range (eg 0-200cm) */
214     OMX_IMAGE_FocusControlAutoInfinityFast,   /* CF over distant range (eg 50cm to infinity) with fast response */
215     OMX_IMAGE_FocusControlCurrentFixed,       /* Stop the lens at the current position */
216     OMX_IMAGE_FocusControlMax = 0x7FFFFFFF
217 } OMX_IMAGE_FOCUSCONTROLTYPE;
218 
219 
220 /**
221  * Focus control configuration
222  *
223  * STRUCT MEMBERS:
224  *  nSize           : Size of the structure in bytes
225  *  nVersion        : OMX specification version information
226  *  nPortIndex      : Port that this structure applies to
227  *  eFocusControl   : Focus control
228  *  nFocusSteps     : Focus can take on values from 0 mm to infinity.
229  *                    Interest is only in number of steps over this range.
230  *  nFocusStepIndex : Current focus step index
231  */
232 typedef struct OMX_IMAGE_CONFIG_FOCUSCONTROLTYPE {
233     OMX_U32 nSize;
234     OMX_VERSIONTYPE nVersion;
235     OMX_U32 nPortIndex;
236     OMX_IMAGE_FOCUSCONTROLTYPE eFocusControl;
237     OMX_U32 nFocusSteps;
238     OMX_U32 nFocusStepIndex;
239 } OMX_IMAGE_CONFIG_FOCUSCONTROLTYPE;
240 
241 
242 /**
243  * Q Factor for JPEG compression, which controls the tradeoff between image
244  * quality and size.  Q Factor provides a more simple means of controlling
245  * JPEG compression quality, without directly programming Quantization
246  * tables for chroma and luma
247  *
248  * STRUCT MEMBERS:
249  *  nSize      : Size of the structure in bytes
250  *  nVersion   : OMX specification version information
251  *  nPortIndex : Port that this structure applies to
252  *  nQFactor   : JPEG Q factor value in the range of 1-100. A factor of 1
253  *               produces the smallest, worst quality images, and a factor
254  *               of 100 produces the largest, best quality images.  A
255  *               typical default is 75 for small good quality images
256  */
257 typedef struct OMX_IMAGE_PARAM_QFACTORTYPE {
258     OMX_U32 nSize;
259     OMX_VERSIONTYPE nVersion;
260     OMX_U32 nPortIndex;
261     OMX_U32 nQFactor;
262 } OMX_IMAGE_PARAM_QFACTORTYPE;
263 
264 /**
265  * Quantization table type
266  */
267 
268 typedef enum OMX_IMAGE_QUANTIZATIONTABLETYPE {
269     OMX_IMAGE_QuantizationTableLuma = 0,
270     OMX_IMAGE_QuantizationTableChroma,
271     OMX_IMAGE_QuantizationTableChromaCb,
272     OMX_IMAGE_QuantizationTableChromaCr,
273     OMX_IMAGE_QuantizationTableKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
274     OMX_IMAGE_QuantizationTableVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
275     OMX_IMAGE_QuantizationTableMax = 0x7FFFFFFF
276 } OMX_IMAGE_QUANTIZATIONTABLETYPE;
277 
278 /**
279  * JPEG quantization tables are used to determine DCT compression for
280  * YUV data, as an alternative to specifying Q factor, providing exact
281  * control of compression
282  *
283  * STRUCT MEMBERS:
284  *  nSize                   : Size of the structure in bytes
285  *  nVersion                : OMX specification version information
286  *  nPortIndex              : Port that this structure applies to
287  *  eQuantizationTable      : Quantization table type
288  *  nQuantizationMatrix[64] : JPEG quantization table of coefficients stored
289  *                            in increasing columns then by rows of data (i.e.
290  *                            row 1, ... row 8). Quantization values are in
291  *                            the range 0-255 and stored in linear order
292  *                            (i.e. the component will zig-zag the
293  *                            quantization table data if required internally)
294  */
295 typedef struct OMX_IMAGE_PARAM_QUANTIZATIONTABLETYPE {
296     OMX_U32 nSize;
297     OMX_VERSIONTYPE nVersion;
298     OMX_U32 nPortIndex;
299     OMX_IMAGE_QUANTIZATIONTABLETYPE eQuantizationTable;
300     OMX_U8 nQuantizationMatrix[64];
301 } OMX_IMAGE_PARAM_QUANTIZATIONTABLETYPE;
302 
303 
304 /**
305  * Huffman table type, the same Huffman table is applied for chroma and
306  * luma component
307  */
308 typedef enum OMX_IMAGE_HUFFMANTABLETYPE {
309     OMX_IMAGE_HuffmanTableAC = 0,
310     OMX_IMAGE_HuffmanTableDC,
311     OMX_IMAGE_HuffmanTableACLuma,
312     OMX_IMAGE_HuffmanTableACChroma,
313     OMX_IMAGE_HuffmanTableDCLuma,
314     OMX_IMAGE_HuffmanTableDCChroma,
315     OMX_IMAGE_HuffmanTableKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
316     OMX_IMAGE_HuffmanTableVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
317     OMX_IMAGE_HuffmanTableMax = 0x7FFFFFFF
318 } OMX_IMAGE_HUFFMANTABLETYPE;
319 
320 /**
321  * JPEG Huffman table
322  *
323  * STRUCT MEMBERS:
324  *  nSize                            : Size of the structure in bytes
325  *  nVersion                         : OMX specification version information
326  *  nPortIndex                       : Port that this structure applies to
327  *  eHuffmanTable                    : Huffman table type
328  *  nNumberOfHuffmanCodeOfLength[16] : 0-16, number of Huffman codes of each
329  *                                     possible length
330  *  nHuffmanTable[256]               : 0-255, the size used for AC and DC
331  *                                     HuffmanTable are 16 and 162
332  */
333 typedef struct OMX_IMAGE_PARAM_HUFFMANTTABLETYPE {
334     OMX_U32 nSize;
335     OMX_VERSIONTYPE nVersion;
336     OMX_U32 nPortIndex;
337     OMX_IMAGE_HUFFMANTABLETYPE eHuffmanTable;
338     OMX_U8 nNumberOfHuffmanCodeOfLength[16];
339     OMX_U8 nHuffmanTable[256];
340 }OMX_IMAGE_PARAM_HUFFMANTTABLETYPE;
341 
342 /** @} */
343 #ifdef __cplusplus
344 }
345 #endif /* __cplusplus */
346 
347 #endif
348 /* File EOF */
349