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