• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*Copyright (c) 2012-2015, The Linux Foundation. All rights reserved.
2 
3 Redistribution and use in source and binary forms, with or without
4 modification, are permitted provided that the following conditions are
5 met:
6     * Redistributions of source code must retain the above copyright
7       notice, this list of conditions and the following disclaimer.
8     * Redistributions in binary form must reproduce the above
9       copyright notice, this list of conditions and the following
10       disclaimer in the documentation and/or other materials provided
11       with the distribution.
12     * Neither the name of The Linux Foundation nor the names of its
13       contributors may be used to endorse or promote products derived
14       from this software without specific prior written permission.
15 
16 THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
17 WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
18 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
19 ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
20 BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
23 BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
24 WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
25 OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
26 IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.*/
27 
28 #ifndef __QOMX_EXTENSIONS_H__
29 #define __QOMX_EXTENSIONS_H__
30 
31 #ifdef __cplusplus
32 extern "C" {
33 #endif
34 
35 #include <OMX_Image.h>
36 #include <qexif.h>
37 
38 /** qomx_image_eventd
39 *  Qcom specific events extended from OMX_EVENT
40 *  @ OMX_EVENT_THUMBNAIL_DROPPED - Indicates that the thumbnail
41 *                                 size id too big to be included
42 *                                 in the exif and will be
43 *                                 dropped
44 **/
45 typedef enum {
46  OMX_EVENT_THUMBNAIL_DROPPED = OMX_EventVendorStartUnused+1
47 } QOMX_IMAGE_EXT_EVENTS;
48 
49 /**
50 *  The following macros defines the string to be used for
51 *  getting the extension indices.
52 **/
53 #define QOMX_IMAGE_EXT_EXIF_NAME                  "OMX.QCOM.image.exttype.exif"
54 #define QOMX_IMAGE_EXT_THUMBNAIL_NAME        "OMX.QCOM.image.exttype.thumbnail"
55 #define QOMX_IMAGE_EXT_BUFFER_OFFSET_NAME "OMX.QCOM.image.exttype.bufferOffset"
56 #define QOMX_IMAGE_EXT_MOBICAT_NAME            "OMX.QCOM.image.exttype.mobicat"
57 #define QOMX_IMAGE_EXT_ENCODING_MODE_NAME        "OMX.QCOM.image.encoding.mode"
58 #define QOMX_IMAGE_EXT_WORK_BUFFER_NAME      "OMX.QCOM.image.exttype.workbuffer"
59 #define QOMX_IMAGE_EXT_METADATA_NAME      "OMX.QCOM.image.exttype.metadata"
60 #define QOMX_IMAGE_EXT_META_ENC_KEY_NAME      "OMX.QCOM.image.exttype.metaEncKey"
61 #define QOMX_IMAGE_EXT_MEM_OPS_NAME      "OMX.QCOM.image.exttype.mem_ops"
62 #define QOMX_IMAGE_EXT_JPEG_SPEED_NAME      "OMX.QCOM.image.exttype.jpeg.speed"
63 
64 /** QOMX_IMAGE_EXT_INDEXTYPE
65 *  This enum is an extension of the OMX_INDEXTYPE enum and
66 *  specifies Qcom supported extention indexes. These indexes are
67 *  associated with the extension names and can be used as
68 *  Indexes in the SetParameter and Getparameter functins to set
69 *  or get values from qcom specific data structures
70 **/
71 typedef enum {
72   //Name: OMX.QCOM.image.exttype.exif
73   QOMX_IMAGE_EXT_EXIF = 0x07F00000,
74 
75   //Name: OMX.QCOM.image.exttype.thumbnail
76   QOMX_IMAGE_EXT_THUMBNAIL = 0x07F00001,
77 
78   //Name: OMX.QCOM.image.exttype.bufferOffset
79   QOMX_IMAGE_EXT_BUFFER_OFFSET = 0x07F00002,
80 
81   //Name: OMX.QCOM.image.exttype.mobicat
82   QOMX_IMAGE_EXT_MOBICAT = 0x07F00003,
83 
84   //Name: OMX.QCOM.image.encoding.approach
85   QOMX_IMAGE_EXT_ENCODING_MODE = 0x07F00004,
86 
87   //Name: OMX.QCOM.image.exttype.workbuffer
88   QOMX_IMAGE_EXT_WORK_BUFFER = 0x07F00005,
89 
90   //Name: OMX.QCOM.image.exttype.metadata
91   QOMX_IMAGE_EXT_METADATA = 0x07F00008,
92 
93   //Name: OMX.QCOM.image.exttype.metaEncKey
94   QOMX_IMAGE_EXT_META_ENC_KEY = 0x07F00009,
95 
96   //Name: OMX.QCOM.image.exttype.memOps
97   QOMX_IMAGE_EXT_MEM_OPS = 0x07F0000A,
98 
99   //Name: OMX.QCOM.image.exttype.jpeg.speed
100   QOMX_IMAGE_EXT_JPEG_SPEED = 0x07F000B,
101 
102 } QOMX_IMAGE_EXT_INDEXTYPE;
103 
104 /** QOMX_BUFFER_INFO
105 *  The structure specifies informaton
106 *   associated with the buffers and should be passed as appData
107 *   in UseBuffer calls to the OMX component with buffer specific
108 *   data. @ fd - FD of the buffer allocated. If the buffer is
109 *          allocated on the heap, it can be zero.
110 *   @offset - Buffer offset
111 **/
112 
113 typedef struct {
114   OMX_U32 fd;
115   OMX_U32 offset;
116 } QOMX_BUFFER_INFO;
117 
118 /** QEXIF_INFO_DATA
119 *   The basic exif structure used to construct
120 *   information for a single exif tag.
121 *   @tag_entry
122 *   @tag_id
123 **/
124 typedef struct{
125   exif_tag_entry_t tag_entry;
126   exif_tag_id_t tag_id;
127 } QEXIF_INFO_DATA;
128 
129 /** QEXTN_DATA
130 *   The structure used to carry addtional payload
131 *   meant to be in EXIF Appx marker fields.
132 *   @sw_3a_version
133 **/
134 typedef struct {
135   uint16_t sw_3a_version[4];
136 } QEXTN_DATA;
137 
138 /**QOMX_EXIF_INFO
139 *  The structure contains an array of exif tag
140 *  structures(qexif_info_data) and should be passed to the OMX
141 *  layer by the OMX client using the extension index.
142 *  @exif_data - Array of exif tags
143 *  @numOfEntries - Number of exif tags entries being passed in
144 *                  the array
145 *  @debug_data - specific debug information for internal use
146 **/
147 typedef struct {
148   QEXIF_INFO_DATA *exif_data;
149   OMX_U32 numOfEntries;
150   QEXTN_DATA debug_data;
151 } QOMX_EXIF_INFO;
152 
153 /**QOMX_YUV_FRAME_INFO
154 *  The structre contains all the offsets
155 *  associated with the Y and cbcr buffers.
156 *  @yOffset - Offset within the Y buffer
157 *  @cbcrOffset - Offset within the cb/cr buffer. The array
158 *                should be populated in order depending on cb
159 *                first or cr first in case of planar data. For
160 *                pseusoplanar, only the first array element
161 *                needs to be filled and the secnd element should
162 *                be set to zero.
163 *  @cbcrStartOffset - Start offset of the cb/cr buffer starting
164 *                     starting from the Y buffer. The array
165 *                     should be populated in order depending on
166 *                     cb first or cr first in case of planar
167 *                     data. For pseusoplanar, only the first
168 *                     array element needs to be filled and the
169 *                     secnd element should be set to zero.
170 **/
171 typedef struct {
172   OMX_U32 yOffset;
173   OMX_U32 cbcrOffset[2];
174   OMX_U32 cbcrStartOffset[2];
175 } QOMX_YUV_FRAME_INFO;
176 
177 /** qomx_thumbnail_info
178 *  Includes all information associated with the thumbnail
179 *  @input_width - Width of the input thumbnail buffer
180 *  @input_height - Heighr of the input thumbnail buffer
181 *  @scaling_enabled - Flag indicating if thumbnail scaling is
182 *  enabled.
183 *  @quality - JPEG Q factor value in the range of 1-100. A factor of 1
184  *               produces the smallest, worst quality images, and a factor
185  *               of 100 produces the largest, best quality images.  A
186  *               typical default is 75 for small good quality images.
187 *  @crop_info - Includes the crop width, crop height,
188 *               horizontal and vertical offsets.
189 *  @output_width - Output Width of the the thumbnail. This is
190 *                the width after scaling if scaling is enabled
191 *                or width after cropping if only cropping is
192 *                enabled or same same input width otherwise
193 *  @output_height - Output height of the thumbnail. This is
194 *                the height after scaling if scaling is enabled
195 *                or height after cropping if only cropping is
196 *                enabled or same same input height otherwise
197 **/
198 typedef struct {
199   OMX_U32 input_width;
200   OMX_U32 input_height;
201   OMX_U8 scaling_enabled;
202   OMX_U32 quality;
203   OMX_CONFIG_RECTTYPE crop_info;
204   OMX_U32 output_width;
205   OMX_U32 output_height;
206   QOMX_YUV_FRAME_INFO tmbOffset;
207   OMX_U32 rotation;
208 } QOMX_THUMBNAIL_INFO;
209 
210 /**qomx_mobicat
211 *  Mobicat data to padded tot he OMX layer
212 *  @mobicatData - Mobicate data
213 *  @mobicatDataLength - length of the mobicat data
214 **/
215 typedef struct {
216   OMX_U8 *mobicatData;
217   OMX_U32 mobicatDataLength;
218 } QOMX_MOBICAT;
219 
220 /**qomx_workbuffer
221 *  Ion buffer to be used for the H/W encoder
222 *  @fd - FD of the buffer allocated
223 *  @vaddr - Buffer address
224 **/
225 typedef struct {
226   int fd;
227   uint8_t *vaddr;
228   uint32_t length;
229 } QOMX_WORK_BUFFER;
230 
231 /**QOMX_METADATA
232  *
233  * meta data to be set in EXIF
234  */
235 typedef struct {
236   OMX_U8  *metadata;
237   OMX_U32 metaPayloadSize;
238   OMX_U8 mobicat_mask;
239 } QOMX_METADATA;
240 
241 /**QOMX_META_ENC_KEY
242  *
243  * meta data encryption key
244  */
245 typedef struct {
246   OMX_U8  *metaKey;
247   OMX_U32 keyLen;
248 } QOMX_META_ENC_KEY;
249 
250 /** QOMX_IMG_COLOR_FORMATTYPE
251 *  This enum is an extension of the OMX_COLOR_FORMATTYPE enum.
252 *  It specifies Qcom supported color formats.
253 **/
254 typedef enum QOMX_IMG_COLOR_FORMATTYPE {
255   OMX_QCOM_IMG_COLOR_FormatYVU420SemiPlanar = OMX_COLOR_FormatVendorStartUnused + 0x300,
256   OMX_QCOM_IMG_COLOR_FormatYVU422SemiPlanar,
257   OMX_QCOM_IMG_COLOR_FormatYVU422SemiPlanar_h1v2,
258   OMX_QCOM_IMG_COLOR_FormatYUV422SemiPlanar_h1v2,
259   OMX_QCOM_IMG_COLOR_FormatYVU444SemiPlanar,
260   OMX_QCOM_IMG_COLOR_FormatYUV444SemiPlanar,
261   OMX_QCOM_IMG_COLOR_FormatYVU420Planar,
262   OMX_QCOM_IMG_COLOR_FormatYVU422Planar,
263   OMX_QCOM_IMG_COLOR_FormatYVU422Planar_h1v2,
264   OMX_QCOM_IMG_COLOR_FormatYUV422Planar_h1v2,
265   OMX_QCOM_IMG_COLOR_FormatYVU444Planar,
266   OMX_QCOM_IMG_COLOR_FormatYUV444Planar
267 } QOMX_IMG_COLOR_FORMATTYPE;
268 
269 /** QOMX_ENCODING_MODE
270 *  This enum is used to select parallel encoding
271 *  or sequential encoding for the thumbnail and
272 *  main image
273 **/
274 typedef enum {
275   OMX_Serial_Encoding,
276   OMX_Parallel_Encoding
277 } QOMX_ENCODING_MODE;
278 
279 
280 /**omx_jpeg_ouput_buf_t
281 *  Structure describing jpeg output buffer
282 *  @handle - Handle to the containing class
283 *  @mem_hdl - Handle to camera memory struct
284 *  @vaddr - Buffer address
285 *  @size - Buffer size
286 *  @fd - file descriptor
287 **/
288 typedef struct {
289   void *handle;
290   void *mem_hdl;
291   int8_t isheap;
292   size_t size; /*input*/
293   void *vaddr;
294   int fd;
295 } omx_jpeg_ouput_buf_t;
296 
297 /** QOMX_MEM_OPS
298 * Structure holding the function pointers to
299 * buffer memory operations
300 * @get_memory - function to allocate buffer memory
301 **/
302 typedef struct {
303   int (*get_memory)( omx_jpeg_ouput_buf_t *p_out_buf);
304 } QOMX_MEM_OPS;
305 
306 /** QOMX_JPEG_SPEED_MODE
307 * Enum specifying the values for the jpeg
308 * speed mode setting
309 **/
310 typedef enum {
311   QOMX_JPEG_SPEED_MODE_NORMAL,
312   QOMX_JPEG_SPEED_MODE_HIGH
313 } QOMX_JPEG_SPEED_MODE;
314 
315 /** QOMX_JPEG_SPEED
316 * Structure used to set the jpeg speed mode
317 * parameter
318 * @speedMode - jpeg speed mode
319 **/
320 typedef struct {
321   QOMX_JPEG_SPEED_MODE speedMode;
322 } QOMX_JPEG_SPEED;
323 
324 #ifdef __cplusplus
325  }
326 #endif
327 
328 #endif
329