OMX_Image.h 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346
  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. * @file OMX_Image.h - OpenMax IL version 1.1.2
  41. * The structures needed by Image components to exchange parameters and
  42. * configuration data with the components.
  43. */
  44. #ifndef OMX_Image_h
  45. #define OMX_Image_h
  46. #ifdef __cplusplus
  47. extern "C" {
  48. #endif /* __cplusplus */
  49. /**
  50. * Each OMX header must include all required header files to allow the
  51. * header to compile without errors. The includes below are required
  52. * for this header file to compile successfully
  53. */
  54. #include <OMX_IVCommon.h>
  55. /** @defgroup imaging OpenMAX IL Imaging Domain
  56. * @ingroup iv
  57. * Structures for OpenMAX IL Imaging domain
  58. * @{
  59. */
  60. /**
  61. * Enumeration used to define the possible image compression coding.
  62. */
  63. typedef enum OMX_IMAGE_CODINGTYPE {
  64. OMX_IMAGE_CodingUnused, /**< Value when format is N/A */
  65. OMX_IMAGE_CodingAutoDetect, /**< Auto detection of image format */
  66. OMX_IMAGE_CodingJPEG, /**< JPEG/JFIF image format */
  67. OMX_IMAGE_CodingJPEG2K, /**< JPEG 2000 image format */
  68. OMX_IMAGE_CodingEXIF, /**< EXIF image format */
  69. OMX_IMAGE_CodingTIFF, /**< TIFF image format */
  70. OMX_IMAGE_CodingGIF, /**< Graphics image format */
  71. OMX_IMAGE_CodingPNG, /**< PNG image format */
  72. OMX_IMAGE_CodingLZW, /**< LZW image format */
  73. OMX_IMAGE_CodingBMP, /**< Windows Bitmap format */
  74. OMX_IMAGE_CodingKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
  75. OMX_IMAGE_CodingVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
  76. OMX_IMAGE_CodingMax = 0x7FFFFFFF
  77. } OMX_IMAGE_CODINGTYPE;
  78. /**
  79. * Data structure used to define an image path. The number of image paths
  80. * for input and output will vary by type of the image component.
  81. *
  82. * Input (aka Source) : Zero Inputs, one Output,
  83. * Splitter : One Input, 2 or more Outputs,
  84. * Processing Element : One Input, one output,
  85. * Mixer : 2 or more inputs, one output,
  86. * Output (aka Sink) : One Input, zero outputs.
  87. *
  88. * The PortDefinition structure is used to define all of the parameters
  89. * necessary for the compliant component to setup an input or an output
  90. * image path. If additional vendor specific data is required, it should
  91. * be transmitted to the component using the CustomCommand function.
  92. * Compliant components will prepopulate this structure with optimal
  93. * values during the OMX_GetParameter() command.
  94. *
  95. * STRUCT MEMBERS:
  96. * cMIMEType : MIME type of data for the port
  97. * pNativeRender : Platform specific reference for a display if a
  98. * sync, otherwise this field is 0
  99. * nFrameWidth : Width of frame to be used on port if
  100. * uncompressed format is used. Use 0 for
  101. * unknown, don't care or variable
  102. * nFrameHeight : Height of frame to be used on port if
  103. * uncompressed format is used. Use 0 for
  104. * unknown, don't care or variable
  105. * nStride : Number of bytes per span of an image (i.e.
  106. * indicates the number of bytes to get from
  107. * span N to span N+1, where negative stride
  108. * indicates the image is bottom up
  109. * nSliceHeight : Height used when encoding in slices
  110. * bFlagErrorConcealment : Turns on error concealment if it is supported by
  111. * the OMX component
  112. * eCompressionFormat : Compression format used in this instance of
  113. * the component. When OMX_IMAGE_CodingUnused is
  114. * specified, eColorFormat is valid
  115. * eColorFormat : Decompressed format used by this component
  116. * pNativeWindow : Platform specific reference for a window object if a
  117. * display sink , otherwise this field is 0x0.
  118. */
  119. typedef struct OMX_IMAGE_PORTDEFINITIONTYPE {
  120. OMX_STRING cMIMEType;
  121. OMX_NATIVE_DEVICETYPE pNativeRender;
  122. OMX_U32 nFrameWidth;
  123. OMX_U32 nFrameHeight;
  124. OMX_S32 nStride;
  125. OMX_U32 nSliceHeight;
  126. OMX_BOOL bFlagErrorConcealment;
  127. OMX_IMAGE_CODINGTYPE eCompressionFormat;
  128. OMX_COLOR_FORMATTYPE eColorFormat;
  129. OMX_NATIVE_WINDOWTYPE pNativeWindow;
  130. } OMX_IMAGE_PORTDEFINITIONTYPE;
  131. /**
  132. * Port format parameter. This structure is used to enumerate the various
  133. * data input/output format supported by the port.
  134. *
  135. * STRUCT MEMBERS:
  136. * nSize : Size of the structure in bytes
  137. * nVersion : OMX specification version information
  138. * nPortIndex : Indicates which port to set
  139. * nIndex : Indicates the enumeration index for the format from
  140. * 0x0 to N-1
  141. * eCompressionFormat : Compression format used in this instance of the
  142. * component. When OMX_IMAGE_CodingUnused is specified,
  143. * eColorFormat is valid
  144. * eColorFormat : Decompressed format used by this component
  145. */
  146. typedef struct OMX_IMAGE_PARAM_PORTFORMATTYPE {
  147. OMX_U32 nSize;
  148. OMX_VERSIONTYPE nVersion;
  149. OMX_U32 nPortIndex;
  150. OMX_U32 nIndex;
  151. OMX_IMAGE_CODINGTYPE eCompressionFormat;
  152. OMX_COLOR_FORMATTYPE eColorFormat;
  153. } OMX_IMAGE_PARAM_PORTFORMATTYPE;
  154. /**
  155. * Flash control type
  156. *
  157. * ENUMS
  158. * Torch : Flash forced constantly on
  159. */
  160. typedef enum OMX_IMAGE_FLASHCONTROLTYPE {
  161. OMX_IMAGE_FlashControlOn = 0,
  162. OMX_IMAGE_FlashControlOff,
  163. OMX_IMAGE_FlashControlAuto,
  164. OMX_IMAGE_FlashControlRedEyeReduction,
  165. OMX_IMAGE_FlashControlFillin,
  166. OMX_IMAGE_FlashControlTorch,
  167. OMX_IMAGE_FlashControlKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
  168. OMX_IMAGE_FlashControlVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
  169. OMX_IMAGE_FlashControlMax = 0x7FFFFFFF
  170. } OMX_IMAGE_FLASHCONTROLTYPE;
  171. /**
  172. * Flash control configuration
  173. *
  174. * STRUCT MEMBERS:
  175. * nSize : Size of the structure in bytes
  176. * nVersion : OMX specification version information
  177. * nPortIndex : Port that this structure applies to
  178. * eFlashControl : Flash control type
  179. */
  180. typedef struct OMX_IMAGE_PARAM_FLASHCONTROLTYPE {
  181. OMX_U32 nSize;
  182. OMX_VERSIONTYPE nVersion;
  183. OMX_U32 nPortIndex;
  184. OMX_IMAGE_FLASHCONTROLTYPE eFlashControl;
  185. } OMX_IMAGE_PARAM_FLASHCONTROLTYPE;
  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. * Focus control configuration
  200. *
  201. * STRUCT MEMBERS:
  202. * nSize : Size of the structure in bytes
  203. * nVersion : OMX specification version information
  204. * nPortIndex : Port that this structure applies to
  205. * eFocusControl : Focus control
  206. * nFocusSteps : Focus can take on values from 0 mm to infinity.
  207. * Interest is only in number of steps over this range.
  208. * nFocusStepIndex : Current focus step index
  209. */
  210. typedef struct OMX_IMAGE_CONFIG_FOCUSCONTROLTYPE {
  211. OMX_U32 nSize;
  212. OMX_VERSIONTYPE nVersion;
  213. OMX_U32 nPortIndex;
  214. OMX_IMAGE_FOCUSCONTROLTYPE eFocusControl;
  215. OMX_U32 nFocusSteps;
  216. OMX_U32 nFocusStepIndex;
  217. } OMX_IMAGE_CONFIG_FOCUSCONTROLTYPE;
  218. /**
  219. * Q Factor for JPEG compression, which controls the tradeoff between image
  220. * quality and size. Q Factor provides a more simple means of controlling
  221. * JPEG compression quality, without directly programming Quantization
  222. * tables for chroma and luma
  223. *
  224. * STRUCT MEMBERS:
  225. * nSize : Size of the structure in bytes
  226. * nVersion : OMX specification version information
  227. * nPortIndex : Port that this structure applies to
  228. * nQFactor : JPEG Q factor value in the range of 1-100. A factor of 1
  229. * produces the smallest, worst quality images, and a factor
  230. * of 100 produces the largest, best quality images. A
  231. * typical default is 75 for small good quality images
  232. */
  233. typedef struct OMX_IMAGE_PARAM_QFACTORTYPE {
  234. OMX_U32 nSize;
  235. OMX_VERSIONTYPE nVersion;
  236. OMX_U32 nPortIndex;
  237. OMX_U32 nQFactor;
  238. } OMX_IMAGE_PARAM_QFACTORTYPE;
  239. /**
  240. * Quantization table type
  241. */
  242. typedef enum OMX_IMAGE_QUANTIZATIONTABLETYPE {
  243. OMX_IMAGE_QuantizationTableLuma = 0,
  244. OMX_IMAGE_QuantizationTableChroma,
  245. OMX_IMAGE_QuantizationTableChromaCb,
  246. OMX_IMAGE_QuantizationTableChromaCr,
  247. OMX_IMAGE_QuantizationTableKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
  248. OMX_IMAGE_QuantizationTableVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
  249. OMX_IMAGE_QuantizationTableMax = 0x7FFFFFFF
  250. } OMX_IMAGE_QUANTIZATIONTABLETYPE;
  251. /**
  252. * JPEG quantization tables are used to determine DCT compression for
  253. * YUV data, as an alternative to specifying Q factor, providing exact
  254. * control of compression
  255. *
  256. * STRUCT MEMBERS:
  257. * nSize : Size of the structure in bytes
  258. * nVersion : OMX specification version information
  259. * nPortIndex : Port that this structure applies to
  260. * eQuantizationTable : Quantization table type
  261. * nQuantizationMatrix[64] : JPEG quantization table of coefficients stored
  262. * in increasing columns then by rows of data (i.e.
  263. * row 1, ... row 8). Quantization values are in
  264. * the range 0-255 and stored in linear order
  265. * (i.e. the component will zig-zag the
  266. * quantization table data if required internally)
  267. */
  268. typedef struct OMX_IMAGE_PARAM_QUANTIZATIONTABLETYPE {
  269. OMX_U32 nSize;
  270. OMX_VERSIONTYPE nVersion;
  271. OMX_U32 nPortIndex;
  272. OMX_IMAGE_QUANTIZATIONTABLETYPE eQuantizationTable;
  273. OMX_U8 nQuantizationMatrix[64];
  274. } OMX_IMAGE_PARAM_QUANTIZATIONTABLETYPE;
  275. /**
  276. * Huffman table type, the same Huffman table is applied for chroma and
  277. * luma component
  278. */
  279. typedef enum OMX_IMAGE_HUFFMANTABLETYPE {
  280. OMX_IMAGE_HuffmanTableAC = 0,
  281. OMX_IMAGE_HuffmanTableDC,
  282. OMX_IMAGE_HuffmanTableACLuma,
  283. OMX_IMAGE_HuffmanTableACChroma,
  284. OMX_IMAGE_HuffmanTableDCLuma,
  285. OMX_IMAGE_HuffmanTableDCChroma,
  286. OMX_IMAGE_HuffmanTableKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */
  287. OMX_IMAGE_HuffmanTableVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */
  288. OMX_IMAGE_HuffmanTableMax = 0x7FFFFFFF
  289. } OMX_IMAGE_HUFFMANTABLETYPE;
  290. /**
  291. * JPEG Huffman table
  292. *
  293. * STRUCT MEMBERS:
  294. * nSize : Size of the structure in bytes
  295. * nVersion : OMX specification version information
  296. * nPortIndex : Port that this structure applies to
  297. * eHuffmanTable : Huffman table type
  298. * nNumberOfHuffmanCodeOfLength[16] : 0-16, number of Huffman codes of each
  299. * possible length
  300. * nHuffmanTable[256] : 0-255, the size used for AC and DC
  301. * HuffmanTable are 16 and 162
  302. */
  303. typedef struct OMX_IMAGE_PARAM_HUFFMANTTABLETYPE {
  304. OMX_U32 nSize;
  305. OMX_VERSIONTYPE nVersion;
  306. OMX_U32 nPortIndex;
  307. OMX_IMAGE_HUFFMANTABLETYPE eHuffmanTable;
  308. OMX_U8 nNumberOfHuffmanCodeOfLength[16];
  309. OMX_U8 nHuffmanTable[256];
  310. }OMX_IMAGE_PARAM_HUFFMANTTABLETYPE;
  311. /** @} */
  312. #ifdef __cplusplus
  313. }
  314. #endif /* __cplusplus */
  315. #endif
  316. /* File EOF */