Home | History | Annotate | Download | only in common
      1 /******************************************************************************
      2 *
      3 * Copyright (C) 2012 Ittiam Systems Pvt Ltd, Bangalore
      4 *
      5 * Licensed under the Apache License, Version 2.0 (the "License");
      6 * you may not use this file except in compliance with the License.
      7 * You may obtain a copy of the License at:
      8 *
      9 * http://www.apache.org/licenses/LICENSE-2.0
     10 *
     11 * Unless required by applicable law or agreed to in writing, software
     12 * distributed under the License is distributed on an "AS IS" BASIS,
     13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     14 * See the License for the specific language governing permissions and
     15 * limitations under the License.
     16 *
     17 ******************************************************************************/
     18 /**
     19 *******************************************************************************
     20 * @file
     21 *  iv.h
     22 *
     23 * @brief
     24 *  This file contains all the necessary structure and  enumeration
     25 * definitions needed for the Application  Program Interface(API) of the
     26 * Ittiam Video and Image  codecs
     27 *
     28 * @author
     29 *  100239(RCY)
     30 *
     31 * @par List of Functions:
     32 *
     33 * @remarks
     34 *  None
     35 *
     36 *******************************************************************************
     37 */
     38 
     39 
     40 #ifndef _IV_H
     41 #define _IV_H
     42 
     43 /*****************************************************************************/
     44 /* Constant Macros                                                           */
     45 /*****************************************************************************/
     46 
     47 
     48 /*****************************************************************************/
     49 /* Typedefs                                                                  */
     50 /*****************************************************************************/
     51 
     52 /*****************************************************************************/
     53 /* Enums                                                                     */
     54 /*****************************************************************************/
     55 
     56 
     57 /* IV_API_CALL_STATUS_T:This is only to return the FAIL/PASS status to the  */
     58 /* application for the current API call                                     */
     59 
     60 typedef enum {
     61     IV_STATUS_NA                                = 0x7FFFFFFF,
     62     IV_SUCCESS                                  = 0x0,
     63     IV_FAIL                                     = 0x1,
     64 }IV_API_CALL_STATUS_T;
     65 
     66 /* IV_MEM_TYPE_T: This Enumeration defines the type of memory (Internal/Ext */
     67 /* -ernal) along with the cacheable/non-cacheable attributes                */
     68 
     69 typedef enum {
     70     IV_NA_MEM_TYPE                              = 0x7FFFFFFF,
     71     IV_INTERNAL_CACHEABLE_PERSISTENT_MEM        = 0x1,
     72     IV_INTERNAL_CACHEABLE_SCRATCH_MEM           = 0x2,
     73     IV_EXTERNAL_CACHEABLE_PERSISTENT_MEM        = 0x3,
     74     IV_EXTERNAL_CACHEABLE_SCRATCH_MEM           = 0x4,
     75     IV_INTERNAL_NONCACHEABLE_PERSISTENT_MEM     = 0x5,
     76     IV_INTERNAL_NONCACHEABLE_SCRATCH_MEM        = 0x6,
     77     IV_EXTERNAL_NONCACHEABLE_PERSISTENT_MEM     = 0x7,
     78     IV_EXTERNAL_NONCACHEABLE_SCRATCH_MEM        = 0x8
     79 }IV_MEM_TYPE_T;
     80 
     81 /* IV_COLOR_FORMAT_T: This enumeration lists all the color formats which    */
     82 /* finds usage in video/image codecs                                        */
     83 
     84 typedef enum {
     85     IV_CHROMA_NA                            = 0x7FFFFFFF,
     86     IV_YUV_420P                             = 0x1,
     87     IV_YUV_422P                             = 0x2,
     88     IV_420_UV_INTL                          = 0x3,
     89     IV_YUV_422IBE                           = 0x4,
     90     IV_YUV_422ILE                           = 0x5,
     91     IV_YUV_444P                             = 0x6,
     92     IV_YUV_411P                             = 0x7,
     93     IV_GRAY                                 = 0x8,
     94     IV_RGB_565                              = 0x9,
     95     IV_RGB_24                               = 0xa,
     96     IV_YUV_420SP_UV                         = 0xb,
     97     IV_YUV_420SP_VU                         = 0xc,
     98     IV_RGBA_8888                            = 0xd
     99 }IV_COLOR_FORMAT_T;
    100 
    101 /* IV_PICTURE_CODING_TYPE_T: VOP/Frame coding type Enumeration              */
    102 
    103 typedef enum {
    104     IV_NA_FRAME                             = 0x7FFFFFFF,
    105     IV_I_FRAME                              = 0x0,
    106     IV_P_FRAME                              = 0x1,
    107     IV_B_FRAME                              = 0x2,
    108     IV_IDR_FRAME                            = 0x3,
    109     IV_II_FRAME                             = 0x4,
    110     IV_IP_FRAME                             = 0x5,
    111     IV_IB_FRAME                             = 0x6,
    112     IV_PI_FRAME                             = 0x7,
    113     IV_PP_FRAME                             = 0x8,
    114     IV_PB_FRAME                             = 0x9,
    115     IV_BI_FRAME                             = 0xa,
    116     IV_BP_FRAME                             = 0xb,
    117     IV_BB_FRAME                             = 0xc,
    118     IV_MBAFF_I_FRAME                        = 0xd,
    119     IV_MBAFF_P_FRAME                        = 0xe,
    120     IV_MBAFF_B_FRAME                        = 0xf,
    121     IV_MBAFF_IDR_FRAME                      = 0x10,
    122     IV_NOT_CODED_FRAME                      = 0x11,
    123     IV_FRAMETYPE_DEFAULT                    = IV_I_FRAME
    124 }IV_PICTURE_CODING_TYPE_T;
    125 
    126 /* IV_FLD_TYPE_T: field type Enumeration                                    */
    127 
    128 typedef enum {
    129     IV_NA_FLD                               = 0x7FFFFFFF,
    130     IV_TOP_FLD                              = 0x0,
    131     IV_BOT_FLD                              = 0x1,
    132     IV_FLD_TYPE_DEFAULT                     = IV_TOP_FLD
    133 }IV_FLD_TYPE_T;
    134 
    135 /* IV_CONTENT_TYPE_T: Video content type                                     */
    136 
    137 typedef enum {
    138     IV_CONTENTTYPE_NA                       = 0x7FFFFFFF,
    139     IV_PROGRESSIVE                          = 0x0,
    140     IV_INTERLACED                           = 0x1,
    141     IV_PROGRESSIVE_FRAME                    = 0x2,
    142     IV_INTERLACED_FRAME                     = 0x3,
    143     IV_INTERLACED_TOPFIELD                  = 0x4,
    144     IV_INTERLACED_BOTTOMFIELD               = 0x5,
    145     IV_CONTENTTYPE_DEFAULT                  = IV_PROGRESSIVE,
    146 }IV_CONTENT_TYPE_T;
    147 
    148 /* IV_API_COMMAND_TYPE_T:API command type                                   */
    149 typedef enum {
    150     IV_CMD_NA                           = 0x7FFFFFFF,
    151     IV_CMD_GET_NUM_MEM_REC              = 0x0,
    152     IV_CMD_FILL_NUM_MEM_REC             = 0x1,
    153     IV_CMD_RETRIEVE_MEMREC              = 0x2,
    154     IV_CMD_INIT                         = 0x3,
    155     IV_CMD_DUMMY_ELEMENT                = 0x4,
    156 }IV_API_COMMAND_TYPE_T;
    157 
    158 /*****************************************************************************/
    159 /* Structure                                                                 */
    160 /*****************************************************************************/
    161 
    162 /* IV_OBJ_T: This structure defines the handle for the codec instance        */
    163 
    164 typedef struct {
    165     /**
    166      * u4_size of the structure
    167      */
    168     UWORD32                                     u4_size;
    169 
    170     /**
    171      * Pointer to the API function pointer table of the codec
    172      */
    173     void                                        *pv_fxns;
    174 
    175     /**
    176      * Pointer to the handle of the codec
    177      */
    178     void                                        *pv_codec_handle;
    179 }iv_obj_t;
    180 
    181 /* iv_mem_rec_t: This structure defines the memory record holder which will  */
    182 /* be used by the codec to communicate its memory requirements to the        */
    183 /* application through appropriate API functions                             */
    184 
    185 typedef struct {
    186     /**
    187      * u4_size of the structure
    188      */
    189     UWORD32                                     u4_size;
    190 
    191     /**
    192      * Pointer to the memory allocated by the application
    193      */
    194     void                                        *pv_base;
    195 
    196     /**
    197      * u4_size of the memory to be allocated
    198      */
    199     UWORD32                                     u4_mem_size;
    200 
    201     /**
    202      * Alignment of the memory pointer
    203      */
    204     UWORD32                                     u4_mem_alignment;
    205     /**
    206      * Nature of the memory to be allocated
    207      */
    208     IV_MEM_TYPE_T                               e_mem_type;
    209 }iv_mem_rec_t;
    210 
    211 /* IV_YUV_BUF_T: This structure defines attributes for the yuv buffer        */
    212 
    213 typedef struct {
    214     /**
    215      * u4_size of the structure
    216      */
    217     UWORD32                                     u4_size;
    218 
    219     /**
    220      * Pointer to Luma (Y) Buffer
    221      */
    222 
    223     void                                        *pv_y_buf;
    224     /**
    225      * Pointer to Chroma (Cb) Buffer
    226      */
    227     void                                        *pv_u_buf;
    228 
    229     /**
    230      * Pointer to Chroma (Cr) Buffer
    231      */
    232     void                                        *pv_v_buf;
    233 
    234     /**
    235      * Width of the Luma (Y) Buffer
    236      */
    237     UWORD32                                     u4_y_wd;
    238 
    239     /**
    240      * Height of the Luma (Y) Buffer
    241      */
    242     UWORD32                                     u4_y_ht;
    243 
    244     /**
    245      * Stride/Pitch of the Luma (Y) Buffer
    246      */
    247     UWORD32                                     u4_y_strd;
    248 
    249     /**
    250      * Width of the Chroma (Cb) Buffer
    251      */
    252     UWORD32                                     u4_u_wd;
    253 
    254     /**
    255      * Height of the Chroma (Cb) Buffer
    256      */
    257     UWORD32                                     u4_u_ht;
    258 
    259     /**
    260      * Stride/Pitch of the Chroma (Cb) Buffer
    261      */
    262     UWORD32                                     u4_u_strd;
    263 
    264     /**
    265      * Width of the Chroma (Cr) Buffer
    266      */
    267     UWORD32                                     u4_v_wd;
    268 
    269     /**
    270      * Height of the Chroma (Cr) Buffer
    271      */
    272     UWORD32                                     u4_v_ht;
    273 
    274     /**
    275      * Stride/Pitch of the Chroma (Cr) Buffer
    276      */
    277     UWORD32                                     u4_v_strd;
    278 }iv_yuv_buf_t;
    279 
    280 /*****************************************************************************/
    281 /*  Get Number of Memory Records                                             */
    282 /*****************************************************************************/
    283 
    284 /* IV_API_COMMAND_TYPE_T::e_cmd = IV_CMD_GET_NUM_MEM_REC                     */
    285 
    286 
    287 typedef struct {
    288     /**
    289      * u4_size of the structure
    290      */
    291     UWORD32                                     u4_size;
    292 
    293     /**
    294      * cmd
    295      */
    296     IV_API_COMMAND_TYPE_T                       e_cmd;
    297 }iv_num_mem_rec_ip_t;
    298 
    299 
    300 typedef struct {
    301     /**
    302      * u4_size of the structure
    303      */
    304     UWORD32                                     u4_size;
    305 
    306     /**
    307      * error code
    308      */
    309     UWORD32                                     u4_error_code;
    310 
    311     /**
    312      * num_mem_rec
    313      */
    314     UWORD32                                     u4_num_mem_rec;
    315 }iv_num_mem_rec_op_t;
    316 
    317 
    318 /*****************************************************************************/
    319 /*  Fill Memory Records                                                      */
    320 /*****************************************************************************/
    321 
    322 /* IV_API_COMMAND_TYPE_T::e_cmd = IV_CMD_FILL_NUM_MEM_REC                    */
    323 
    324 
    325 typedef struct {
    326     /**
    327      * u4_size of the structure
    328      */
    329     UWORD32                                     u4_size;
    330 
    331     /**
    332      * cmd
    333      */
    334     IV_API_COMMAND_TYPE_T                       e_cmd;
    335 
    336     /**
    337      * pointer to array of memrecords structures should be filled by codec
    338     with details of memory resource requirements
    339      */
    340     iv_mem_rec_t                                *pv_mem_rec_location;
    341 
    342     /**
    343      * maximum width for which codec should request memory requirements
    344      */
    345     UWORD32                                     u4_max_frm_wd;
    346 
    347     /**
    348      * maximum height for which codec should request memory requirements
    349      */
    350     UWORD32                                     u4_max_frm_ht;
    351 }iv_fill_mem_rec_ip_t;
    352 
    353 
    354 typedef struct {
    355     /**
    356      * u4_size of the structure
    357      */
    358     UWORD32                                     u4_size;
    359 
    360     /**
    361      * error_code
    362      */
    363     UWORD32                                     u4_error_code;
    364 
    365     /**
    366      * no of memory record structures which are filled by codec
    367      */
    368     UWORD32                                     u4_num_mem_rec_filled;
    369 }iv_fill_mem_rec_op_t;
    370 
    371 
    372 /*****************************************************************************/
    373 /*  Retrieve Memory Records                                                  */
    374 /*****************************************************************************/
    375 
    376 /* IV_API_COMMAND_TYPE_T::e_cmd = IV_CMD_RETRIEVE_MEMREC                     */
    377 
    378 
    379 
    380 typedef struct {
    381     /**
    382      * u4_size of the structure
    383      */
    384     UWORD32                                     u4_size;
    385 
    386     /**
    387      * cmd
    388      */
    389     IV_API_COMMAND_TYPE_T                       e_cmd;
    390 
    391     /**
    392      * array of structures where codec should fill with all resources(memory) with it
    393      */
    394     iv_mem_rec_t                                *pv_mem_rec_location;
    395 }iv_retrieve_mem_rec_ip_t;
    396 
    397 
    398 typedef struct {
    399     /**
    400      * u4_size of the structure
    401      */
    402     UWORD32                                     u4_size;
    403 
    404     /**
    405      * error_code
    406      */
    407     UWORD32                                     u4_error_code;
    408 
    409     /**
    410      * no of memory records filled by codec
    411      */
    412     UWORD32                                     u4_num_mem_rec_filled;
    413 }iv_retrieve_mem_rec_op_t;
    414 
    415 
    416 
    417 #endif /* _IV_H */
    418 
    419