Home | History | Annotate | Download | only in qomx_core
      1 /*Copyright (c) 2012, 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 
     60 /** QOMX_IMAGE_EXT_INDEXTYPE
     61 *  This enum is an extension of the OMX_INDEXTYPE enum and
     62 *  specifies Qcom supported extention indexes. These indexes are
     63 *  associated with the extension names and can be used as
     64 *  Indexes in the SetParameter and Getparameter functins to set
     65 *  or get values from qcom specific data structures
     66 **/
     67 typedef enum {
     68   //Name: OMX.QCOM.image.exttype.exif
     69   QOMX_IMAGE_EXT_EXIF = 0x07F00000,
     70 
     71   //Name: OMX.QCOM.image.exttype.thumbnail
     72   QOMX_IMAGE_EXT_THUMBNAIL = 0x07F00001,
     73 
     74   //Name: OMX.QCOM.image.exttype.bufferOffset
     75   QOMX_IMAGE_EXT_BUFFER_OFFSET = 0x07F00002,
     76 
     77   //Name: OMX.QCOM.image.exttype.mobicat
     78   QOMX_IMAGE_EXT_MOBICAT = 0x07F00003,
     79 
     80   //Name: OMX.QCOM.image.encoding.approach
     81   QOMX_IMAGE_EXT_ENCODING_MODE = 0x07F00004,
     82 
     83   //Name: OMX.QCOM.image.exttype.workbuffer
     84   QOMX_IMAGE_EXT_WORK_BUFFER = 0x07F00004,
     85 
     86 } QOMX_IMAGE_EXT_INDEXTYPE;
     87 
     88 /** QOMX_BUFFER_INFO
     89 *  The structure specifies informaton
     90 *   associated with the buffers and should be passed as appData
     91 *   in UseBuffer calls to the OMX component with buffer specific
     92 *   data. @ fd - FD of the buffer allocated. If the buffer is
     93 *          allocated on the heap, it can be zero.
     94 *   @offset - Buffer offset
     95 **/
     96 
     97 typedef struct {
     98   OMX_U32 fd;
     99   OMX_U32 offset;
    100 } QOMX_BUFFER_INFO;
    101 
    102 /** QEXIF_INFO_DATA
    103 *   The basic exif structure used to construct
    104 *   information for a single exif tag.
    105 *   @tag_entry
    106 *   @tag_id
    107 **/
    108 typedef struct{
    109   exif_tag_entry_t tag_entry;
    110   exif_tag_id_t tag_id;
    111 } QEXIF_INFO_DATA;
    112 
    113 /**QOMX_EXIF_INFO
    114 *  The structure contains an array of exif tag
    115 *  structures(qexif_info_data) and should be passed to the OMX
    116 *  layer by the OMX client using the extension index.
    117 *  @exif_data - Array of exif tags
    118 *  @numOfEntries - Number of exif tags entries being passed in
    119 *                 the array
    120 **/
    121 typedef struct {
    122   QEXIF_INFO_DATA *exif_data;
    123   OMX_U32 numOfEntries;
    124 } QOMX_EXIF_INFO;
    125 
    126 /**QOMX_YUV_FRAME_INFO
    127 *  The structre contains all the offsets
    128 *  associated with the Y and cbcr buffers.
    129 *  @yOffset - Offset within the Y buffer
    130 *  @cbcrOffset - Offset within the cb/cr buffer. The array
    131 *                should be populated in order depending on cb
    132 *                first or cr first in case of planar data. For
    133 *                pseusoplanar, only the first array element
    134 *                needs to be filled and the secnd element should
    135 *                be set to zero.
    136 *  @cbcrStartOffset - Start offset of the cb/cr buffer starting
    137 *                     starting from the Y buffer. The array
    138 *                     should be populated in order depending on
    139 *                     cb first or cr first in case of planar
    140 *                     data. For pseusoplanar, only the first
    141 *                     array element needs to be filled and the
    142 *                     secnd element should be set to zero.
    143 **/
    144 typedef struct {
    145   OMX_U32 yOffset;
    146   OMX_U32 cbcrOffset[2];
    147   OMX_U32 cbcrStartOffset[2];
    148 } QOMX_YUV_FRAME_INFO;
    149 
    150 /** qomx_thumbnail_info
    151 *  Includes all information associated with the thumbnail
    152 *  @input_width - Width of the input thumbnail buffer
    153 *  @input_height - Heighr of the input thumbnail buffer
    154 *  @scaling_enabled - Flag indicating if thumbnail scaling is
    155 *  enabled.
    156 *  @quality - JPEG Q factor value in the range of 1-100. A factor of 1
    157  *               produces the smallest, worst quality images, and a factor
    158  *               of 100 produces the largest, best quality images.  A
    159  *               typical default is 75 for small good quality images.
    160 *  @crop_info - Includes the crop width, crop height,
    161 *               horizontal and vertical offsets.
    162 *  @output_width - Output Width of the the thumbnail. This is
    163 *                the width after scaling if scaling is enabled
    164 *                or width after cropping if only cropping is
    165 *                enabled or same same input width otherwise
    166 *  @output_height - Output height of the thumbnail. This is
    167 *                the height after scaling if scaling is enabled
    168 *                or height after cropping if only cropping is
    169 *                enabled or same same input height otherwise
    170 **/
    171 typedef struct {
    172   OMX_U32 input_width;
    173   OMX_U32 input_height;
    174   OMX_U8 scaling_enabled;
    175   OMX_U32 quality;
    176   OMX_CONFIG_RECTTYPE crop_info;
    177   OMX_U32 output_width;
    178   OMX_U32 output_height;
    179   QOMX_YUV_FRAME_INFO tmbOffset;
    180 } QOMX_THUMBNAIL_INFO;
    181 
    182 /**qomx_mobicat
    183 *  Mobicat data to padded tot he OMX layer
    184 *  @mobicatData - Mobicate data
    185 *  @mobicatDataLength - length of the mobicat data
    186 **/
    187 typedef struct {
    188   OMX_U8 *mobicatData;
    189   OMX_U32 mobicatDataLength;
    190 } QOMX_MOBICAT;
    191 
    192 /**qomx_workbuffer
    193 *  Ion buffer to be used for the H/W encoder
    194 *  @fd - FD of the buffer allocated
    195 *  @vaddr - Buffer address
    196 **/
    197 typedef struct {
    198   int fd;
    199   uint8_t *vaddr;
    200 } QOMX_WORK_BUFFER;
    201 
    202 /** QOMX_IMG_COLOR_FORMATTYPE
    203 *  This enum is an extension of the OMX_COLOR_FORMATTYPE enum.
    204 *  It specifies Qcom supported color formats.
    205 **/
    206 typedef enum QOMX_IMG_COLOR_FORMATTYPE {
    207   OMX_QCOM_IMG_COLOR_FormatYVU420SemiPlanar = OMX_COLOR_FormatVendorStartUnused + 0x300,
    208   OMX_QCOM_IMG_COLOR_FormatYVU422SemiPlanar,
    209   OMX_QCOM_IMG_COLOR_FormatYVU422SemiPlanar_h1v2,
    210   OMX_QCOM_IMG_COLOR_FormatYUV422SemiPlanar_h1v2,
    211   OMX_QCOM_IMG_COLOR_FormatYVU444SemiPlanar,
    212   OMX_QCOM_IMG_COLOR_FormatYUV444SemiPlanar,
    213   OMX_QCOM_IMG_COLOR_FormatYVU420Planar,
    214   OMX_QCOM_IMG_COLOR_FormatYVU422Planar,
    215   OMX_QCOM_IMG_COLOR_FormatYVU422Planar_h1v2,
    216   OMX_QCOM_IMG_COLOR_FormatYUV422Planar_h1v2,
    217   OMX_QCOM_IMG_COLOR_FormatYVU444Planar,
    218   OMX_QCOM_IMG_COLOR_FormatYUV444Planar
    219 } QOMX_IMG_COLOR_FORMATTYPE;
    220 
    221 /** QOMX_ENCODING_MODE
    222 *  This enum is used to select parallel encoding
    223 *  or sequential encoding for the thumbnail and
    224 *  main image
    225 **/
    226 typedef enum {
    227   OMX_Serial_Encoding,
    228   OMX_Parallel_Encoding
    229 } QOMX_ENCODING_MODE;
    230 
    231 #ifdef __cplusplus
    232  }
    233 #endif
    234 
    235 #endif
    236