Home | History | Annotate | Download | only in encoder
      1 /******************************************************************************
      2  *
      3  * Copyright (C) 2018 The Android Open Source Project
      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  * Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
     19 */
     20 /*!
     21 ******************************************************************************
     22 * \file itt_video_api.h
     23 *
     24 * \brief
     25 *    This file contains the necessary structure and enumeration definitions
     26 *    needed for the Application Program Interface(API)
     27 *
     28 * \date
     29 *    18 09 2010
     30 *
     31 * \author
     32 *    Ittiam
     33 *
     34 ******************************************************************************
     35 */
     36 #ifndef _ITT_VIDEO_API_H_
     37 #define _ITT_VIDEO_API_H_
     38 
     39 /*****************************************************************************/
     40 /* Constant Macros                                                           */
     41 /*****************************************************************************/
     42 
     43 /*****************************************************************************/
     44 /* Typedefs                                                                  */
     45 /*****************************************************************************/
     46 
     47 /*****************************************************************************/
     48 /* Enums                                                                     */
     49 /*****************************************************************************/
     50 
     51 /** @brief IV_API_CALL_STATUS_T: This is only to return the FAIL/PASS status to the
     52  *         application for the current API call
     53  */
     54 
     55 typedef enum
     56 {
     57     IV_FAIL = 0xFFFFFFFF,
     58     IV_SUCCESS = 0
     59 } IV_API_CALL_STATUS_T;
     60 
     61 typedef enum
     62 {
     63     ARCH_NA = 0x7FFFFFFF,
     64     ARCH_ARM_NONEON = 0x0,
     65     ARCH_ARM_V8_NEON,
     66     ARCH_ARM_A9Q,
     67     ARCH_ARM_A7,
     68     ARCH_ARM_A5,
     69     ARCH_ARM_NEONINTR,
     70     ARCH_X86_GENERIC,
     71     ARCH_X86_SSSE3,
     72     ARCH_X86_SSE4,
     73     ARCH_X86_AVX,
     74     ARCH_X86_AVX2
     75 } IV_ARCH_T;
     76 
     77 /** @brief IV_MEM_TYPE_T: This Enumeration defines the type of memory (Internal/Ext
     78  *         -ernal) along with the cacheable/non-cacheable attributes
     79  *        Additional memtypes added ( Normal, Numa_Node0, Numa_node1)
     80  */
     81 
     82 typedef enum
     83 {
     84     IV_NA_MEM_TYPE = 0xFFFFFFFF,
     85     IV_INTERNAL_CACHEABLE_PERSISTENT_MEM = 0x1,
     86     IV_INTERNAL_CACHEABLE_SCRATCH_MEM = 0x2,
     87     IV_EXTERNAL_CACHEABLE_PERSISTENT_MEM = 0x3,
     88     IV_EXTERNAL_CACHEABLE_SCRATCH_MEM = 0x4,
     89     IV_INTERNAL_NONCACHEABLE_PERSISTENT_MEM = 0x5,
     90     IV_INTERNAL_NONCACHEABLE_SCRATCH_MEM = 0x6,
     91     IV_EXTERNAL_NONCACHEABLE_PERSISTENT_MEM = 0x7,
     92     IV_EXTERNAL_NONCACHEABLE_SCRATCH_MEM = 0x8,
     93 
     94     IV_EXT_CACHEABLE_NORMAL_MEM = 0x9,
     95     IV_EXT_CACHEABLE_NUMA_NODE0_MEM = 0xA,
     96     IV_EXT_CACHEABLE_NUMA_NODE1_MEM = 0xB,
     97 
     98 } IV_MEM_TYPE_T;
     99 
    100 /** @brief IV_COLOR_FORMAT_T: This enumeration lists all the color formats which
    101  *         finds usage in video/image codecs
    102  */
    103 
    104 typedef enum
    105 {
    106     IV_CHROMA_NA = 0xFFFFFFFF,
    107     IV_YUV_420P = 0x1,
    108     IV_YUV_422P = 0x2,
    109     IV_420_UV_INTL = 0x3,
    110     IV_YUV_422IBE = 0x4,
    111     IV_YUV_422ILE = 0x5,
    112     IV_YUV_444P = 0x6,
    113     IV_YUV_411P = 0x7,
    114     IV_GRAY = 0x8,
    115     IV_RGB_565 = 0x9,
    116     IV_RGB_24 = 0xa,
    117     IV_YUV_420SP_UV = 0xb,
    118     IV_YUV_420SP_VU = 0xc,
    119     IV_YUV_422SP_UV = 0xd,
    120     IV_YUV_422SP_VU = 0xe
    121 
    122 } IV_COLOR_FORMAT_T;
    123 
    124 /** @brief IV_PICTURE_CODING_TYPE_T: VOP/Frame coding type Enumeration    */
    125 
    126 typedef enum
    127 {
    128     IV_NA_FRAME = 0xFFFFFFFF,
    129     IV_I_FRAME = 0x0,
    130     IV_P_FRAME = 0x1,
    131     IV_B_FRAME = 0x2,
    132     IV_IDR_FRAME = 0x3,
    133     IV_II_FRAME = 0x4,
    134     IV_IP_FRAME = 0x5,
    135     IV_IB_FRAME = 0x6,
    136     IV_PI_FRAME = 0x7,
    137     IV_PP_FRAME = 0x8,
    138     IV_PB_FRAME = 0x9,
    139     IV_BI_FRAME = 0xa,
    140     IV_BP_FRAME = 0xb,
    141     IV_BB_FRAME = 0xc,
    142     IV_MBAFF_I_FRAME = 0xd,
    143     IV_MBAFF_P_FRAME = 0xe,
    144     IV_MBAFF_B_FRAME = 0xf,
    145     IV_MBAFF_IDR_FRAME = 0x10,
    146     IV_NOT_CODED_FRAME = 0x11,
    147     IV_FRAMETYPE_DEFAULT = IV_I_FRAME
    148 } IV_PICTURE_CODING_TYPE_T;
    149 
    150 /* @brief IV_FLD_TYPE_T: field type Enumeration */
    151 
    152 typedef enum
    153 {
    154     IV_NA_FLD = 0xFFFFFFFF,
    155     IV_TOP_FLD = 0x0,
    156     IV_BOT_FLD = 0x1,
    157     IV_FLD_TYPE_DEFAULT = IV_TOP_FLD
    158 } IV_FLD_TYPE_T;
    159 
    160 /* @brief IV_CONTENT_TYPE_T: Video content type */
    161 
    162 typedef enum
    163 {
    164     IV_CONTENTTYPE_NA = -1,
    165     IV_PROGRESSIVE = 0x0,
    166     IV_INTERLACED = 0x1,
    167     IV_PROGRESSIVE_FRAME = 0x2,
    168     IV_INTERLACED_FRAME = 0x3,
    169     IV_INTERLACED_TOPFIELD = 0x4,
    170     IV_INTERLACED_BOTTOMFIELD = 0x5,
    171     IV_CONTENTTYPE_DEFAULT = IV_PROGRESSIVE,
    172 } IV_CONTENT_TYPE_T;
    173 
    174 /*****************************************************************************/
    175 /* Structure                                                                 */
    176 /*****************************************************************************/
    177 
    178 /* @brief iv_mem_rec_t: This structure defines the memory record holder which will
    179  * be used by the modules to communicate its memory requirements to the
    180  * memory manager through appropriate API functions
    181  */
    182 
    183 typedef struct
    184 {
    185     /** i4_size of the structure : used for verison tracking */
    186     WORD32 i4_size;
    187 
    188     /** Pointer to the memory allocated by the memory manager */
    189     void *pv_base;
    190 
    191     /** size of the memory to be allocated */
    192     WORD32 i4_mem_size;
    193 
    194     /** Alignment of the memory pointer */
    195     WORD32 i4_mem_alignment;
    196 
    197     /** Nature of the memory to be allocated */
    198     IV_MEM_TYPE_T e_mem_type;
    199 
    200 } iv_mem_rec_t;
    201 
    202 /* @brief iv_input_bufs_req_t: This structure contains the parameters
    203  * related to input (data and control) buffer requirements of the codec.
    204  * Application can call the memory query API to get these requirements
    205  */
    206 
    207 typedef struct
    208 {
    209     /** i4_size of the structure : used for verison tracking */
    210     WORD32 i4_size;
    211 
    212     /** Minimum sets of input buffers required for the codec */
    213     WORD32 i4_min_num_yuv_bufs;
    214 
    215     /** YUV format of the input */
    216     WORD32 i4_yuv_format;
    217 
    218     /** Minimum Size in bytes of Luma input buffer */
    219     WORD32 i4_min_size_y_buf;
    220 
    221     /** Minimum Size in bytes of CB-CR input buffer .
    222      * if input format is Semiplanar then size will include
    223      * both Cb and Cr requirements
    224      */
    225     WORD32 i4_min_size_uv_buf;
    226 
    227     /** Minimum sets of Synchoronus command buffers
    228      *  required for the codec
    229      */
    230     WORD32 i4_min_num_synch_ctrl_bufs;
    231 
    232     /** Minimum size of the Synchoronus command buffer */
    233     WORD32 i4_min_size_synch_ctrl_bufs;
    234 
    235     /** Minimum sets of Asynchoronus command buffers
    236      *  required for the codec
    237      */
    238     WORD32 i4_min_num_asynch_ctrl_bufs;
    239 
    240     /** Minimum size of the Asynchoronus command buffer */
    241     WORD32 i4_min_size_asynch_ctrl_bufs;
    242 
    243 } iv_input_bufs_req_t;
    244 
    245 /* @brief iv_output_bufs_req_t: This structure contains the parameters
    246  * related to output (data and control) buffer requirements for a
    247  * given target resolution of the codec
    248  */
    249 
    250 typedef struct
    251 {
    252     /** i4_size of the structure : used for verison tracking */
    253     WORD32 i4_size;
    254 
    255     /** Minimum sets of output buffers required for the codec */
    256     WORD32 i4_min_num_out_bufs;
    257 
    258     /** Minimum Size in bytes of bitstream buffer */
    259     WORD32 i4_min_size_bitstream_buf;
    260 
    261 } iv_output_bufs_req_t;
    262 
    263 /* @brief iv_recon_bufs_req_t: This structure contains the parameters
    264  * related to recon buffer requirements for a
    265  * given target resolution of the codec
    266  */
    267 
    268 typedef struct
    269 {
    270     /** i4_size of the structure : used for verison tracking */
    271     WORD32 i4_size;
    272 
    273     /** Minimum sets of recon buffers required for the codec */
    274     WORD32 i4_min_num_recon_bufs;
    275 
    276     /** Minimum Size in bytes of Luma input buffer */
    277     WORD32 i4_min_size_y_buf;
    278 
    279     /** Minimum Size in bytes of CB-CR input buffer .
    280      * if input format is Semiplanar then size will include
    281      * both Cb and Cr requirements
    282      */
    283     WORD32 i4_min_size_uv_buf;
    284 
    285 } iv_recon_bufs_req_t;
    286 
    287 /* @brief iv_input_data_ctrl_buffs_desc_t: This structure contains the parameters
    288  * related to input (data and sync control) buffers
    289  * application should allocate these buffers and pass to the codec
    290  */
    291 
    292 typedef struct
    293 {
    294     /** i4_size of the structure : used for verison tracking */
    295     WORD32 i4_size;
    296 
    297     /** Number of sets of input buffers allocated by application */
    298     WORD32 i4_num_yuv_bufs;
    299 
    300     /** Size in bytes of each Luma input buffers passed */
    301     WORD32 i4_size_y_buf;
    302 
    303     /** Pointer to array of input Luma buffer pointers  */
    304     void **ppv_y_buf;
    305 
    306     /** Size in bytes of each CB-CR input buffer passed.
    307      * if input format is Semiplanar then size should include
    308      * both Cb and Cr requirements
    309      */
    310     WORD32 i4_size_uv_buf;
    311 
    312     /** Pointer to array of input Chroma Cb buffer pointers  */
    313     void **ppv_u_buf;
    314 
    315     /** Pointer to array of input Chroma Cr buffer pointers
    316       * Applicalbe if input format is planar
    317       */
    318     void **ppv_v_buf;
    319 
    320     /** Number of sets of sync control buffers allocated by application */
    321     WORD32 i4_num_synch_ctrl_bufs;
    322 
    323     /** Size of the each Synchoronus command buffer passed*/
    324     WORD32 i4_size_synch_ctrl_bufs;
    325 
    326     /** Pointer to array of input sync command buffer pointers  */
    327     void **ppv_synch_ctrl_bufs;
    328 
    329 } iv_input_data_ctrl_buffs_desc_t;
    330 
    331 /* @brief iv_input_asynch_ctrl_buffs_desc_t: This structure contains the parameters
    332  * related to input async control buffers
    333  * application should allocate these buffers and pass to the codec
    334  */
    335 
    336 typedef struct
    337 {
    338     /** i4_size of the structure : used for verison tracking */
    339     WORD32 i4_size;
    340 
    341     /** Number of sets of async control buffers allocated by application */
    342     WORD32 i4_num_asynch_ctrl_bufs;
    343 
    344     /** Size of each Asynchoronus command buffer */
    345     WORD32 i4_size_asynch_ctrl_bufs;
    346 
    347     /** Pointer to array of async command buffer pointers  */
    348     void **ppv_asynch_ctrl_bufs;
    349 
    350 } iv_input_asynch_ctrl_buffs_desc_t;
    351 
    352 /* @brief iv_output_data_buffs_desc_t: This structure contains the parameters
    353  * related to output  data buffers for a given resolution layer
    354  * application should allocate these buffers and pass to the codec
    355  */
    356 
    357 typedef struct
    358 {
    359     /** i4_size of the structure : used for verison tracking */
    360     WORD32 i4_size;
    361 
    362     /** Number of sets of output buffers allocated by application */
    363     WORD32 i4_num_bitstream_bufs;
    364 
    365     /** Size in bytes of each bitstream buffer passed */
    366     WORD32 i4_size_bitstream_buf;
    367 
    368     /** Pointer to array of output buffer pointers  */
    369     void **ppv_bitstream_bufs;
    370 
    371 } iv_output_data_buffs_desc_t;
    372 
    373 /* @brief iv_output_status_buffs_desc_t: This structure contains the parameters
    374  * related to output control acknowledgement buffers
    375  * application should allocate these buffers and pass to the codec
    376  */
    377 
    378 typedef struct
    379 {
    380     /** i4_size of the structure : used for verison tracking */
    381     WORD32 i4_size;
    382 
    383     /** Number of sets of async control ack buffers allocated by application */
    384     WORD32 i4_num_asynch_status_bufs;
    385 
    386     /** Size of each Asynchoronus command acknowledge buffer passed */
    387     WORD32 i4_size_asynch_status_bufs;
    388 
    389     /** Pointer to array of async command ack buffer pointers  */
    390     void **ppv_asynch_status_bufs;
    391 
    392 } iv_output_status_buffs_desc_t;
    393 
    394 /* @brief iv_recon_data_buffs_desc_t: This structure contains the parameters
    395  * related to recon data buffers
    396  * application should allocate these buffers and pass to the codec
    397  */
    398 
    399 typedef struct
    400 {
    401     /** i4_size of the structure : used for verison tracking */
    402     WORD32 i4_size;
    403 
    404     /** Number of sets of recon buffers allocated by application */
    405     WORD32 i4_num_recon_bufs;
    406 
    407     /** Size in bytes of each Luma recon buffers passed */
    408     WORD32 i4_size_y_buf;
    409 
    410     /** Pointer to array of recon Luma buffer pointers  */
    411     void **ppv_y_buf;
    412 
    413     /** Size in bytes of each CB-CR recon buffer passed.
    414      * if input format is Semiplanar then size should include
    415      * both Cb and Cr requirements
    416      */
    417     WORD32 i4_size_uv_buf;
    418 
    419     /** Pointer to array of recon Chroma Cb buffer pointers  */
    420     void **ppv_u_buf;
    421 
    422     /** Pointer to array of recon Chroma Cr buffer pointers
    423       * Applicalbe if input format is planar
    424       */
    425     void **ppv_v_buf;
    426 
    427 } iv_recon_data_buffs_desc_t;
    428 
    429 /* @brief IV_YUV_BUF_T: This structure defines attributes
    430  *        for the input yuv buffer
    431  */
    432 typedef struct
    433 {
    434     /** i4_size of the structure */
    435     WORD32 i4_size;
    436 
    437     /** Pointer to Luma (Y) Buffer  */
    438     void *pv_y_buf;
    439 
    440     /** Pointer to Chroma (Cb) Buffer  */
    441     void *pv_u_buf;
    442 
    443     /** Pointer to Chroma (Cr) Buffer */
    444     void *pv_v_buf;
    445 
    446     /** Width of the Luma (Y) Buffer in pixels */
    447     WORD32 i4_y_wd;
    448 
    449     /** Height of the Luma (Y) Buffer in pixels */
    450     WORD32 i4_y_ht;
    451 
    452     /** Stride/Pitch of the Luma (Y) Buffer */
    453     WORD32 i4_y_strd;
    454 
    455     /** Width of the Chroma (Cb / Cr) Buffer in pixels */
    456     WORD32 i4_uv_wd;
    457 
    458     /** Height of the Chroma (Cb / Cr) Buffer in pixels */
    459     WORD32 i4_uv_ht;
    460 
    461     /** Stride/Pitch of the Chroma (Cb / Cr) Buffer */
    462     WORD32 i4_uv_strd;
    463 
    464 } iv_yuv_buf_t;
    465 
    466 #endif /* _ITT_VIDEO_API_H_ */
    467