Home | History | Annotate | Download | only in encoder
      1 /******************************************************************************
      2  *
      3  * Copyright (C) 2015 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 Name         : ih264e.h                                    */
     23 /*                                                                           */
     24 /*  Description       : This file contains all the necessary structure and   */
     25 /*                      enumeration definitions needed for the Application   */
     26 /*                      Program Interface(API) of the Ittiam MPEG4        */
     27 /*                      Encoder on Cortex A8 - Neon platform                 */
     28 /*                                                                           */
     29 /*  List of Functions : ih264e_api_function                              */
     30 /*                                                                           */
     31 /*  Issues / Problems : None                                                 */
     32 /*                                                                           */
     33 /*  Revision History  :                                                      */
     34 /*                                                                           */
     35 /*         DD MM YYYY   Author(s)       Changes (Describe the changes made)  */
     36 /*         26 08 2010   100239(RCY)     Draft                                */
     37 /*                                                                           */
     38 /*****************************************************************************/
     39 
     40 #ifndef _IH264E_H_
     41 #define _IH264E_H_
     42 
     43 #ifdef __cplusplus
     44 extern "C" {
     45 #endif
     46 
     47 #include "iv2.h"
     48 #include "ive2.h"
     49 /*****************************************************************************/
     50 /* Constant Macros                                                           */
     51 /*****************************************************************************/
     52 
     53 
     54 /*****************************************************************************/
     55 /* API Function Prototype                                                    */
     56 /*****************************************************************************/
     57 IV_STATUS_T ih264e_api_function(iv_obj_t *ps_handle, void *pv_api_ip,void *pv_api_op);
     58 
     59 /*****************************************************************************/
     60 /* Enums                                                                     */
     61 /*****************************************************************************/
     62 typedef enum
     63 {
     64     IH264E_CMD_CTL_SET_ME_INFO_ENABLE,
     65 }IH264E_CMD_CTL_SUB_CMDS;
     66 
     67 
     68 /*****************************************************************************/
     69 /* Extended Structures                                                       */
     70 /*****************************************************************************/
     71 
     72 /*****************************************************************************/
     73 /*  Get Number of Memory Records                                             */
     74 /*****************************************************************************/
     75 
     76 
     77 typedef struct
     78 {
     79     iv_num_mem_rec_ip_t                    s_ive_ip;
     80 }ih264e_num_mem_rec_ip_t;
     81 
     82 
     83 typedef struct
     84 {
     85     iv_num_mem_rec_op_t                    s_ive_op;
     86 }ih264e_num_mem_rec_op_t;
     87 
     88 
     89 /*****************************************************************************/
     90 /*  Fill Memory Records                                                      */
     91 /*****************************************************************************/
     92 
     93 
     94 typedef struct
     95 {
     96     iv_fill_mem_rec_ip_t                   s_ive_ip;
     97 }ih264e_fill_mem_rec_ip_t;
     98 
     99 
    100 typedef struct
    101 {
    102     iv_fill_mem_rec_op_t                   s_ive_op;
    103 }ih264e_fill_mem_rec_op_t;
    104 
    105 /*****************************************************************************/
    106 /*  Retrieve Memory Records                                                  */
    107 /*****************************************************************************/
    108 
    109 
    110 typedef struct
    111 {
    112     iv_retrieve_mem_rec_ip_t               s_ive_ip;
    113 }ih264e_retrieve_mem_rec_ip_t;
    114 
    115 
    116 typedef struct
    117 {
    118     iv_retrieve_mem_rec_op_t               s_ive_op;
    119 }ih264e_retrieve_mem_rec_op_t;
    120 
    121 
    122 /*****************************************************************************/
    123 /*   Initialize encoder                                                      */
    124 /*****************************************************************************/
    125 
    126 typedef struct
    127 {
    128     ive_init_ip_t                           s_ive_ip;
    129 }ih264e_init_ip_t;
    130 
    131 
    132 typedef struct
    133 {
    134     ive_init_op_t                           s_ive_op;
    135 }ih264e_init_op_t;
    136 
    137 
    138 /*****************************************************************************/
    139 /*   Queue Input raw buffer - Send the YUV buffer to be encoded              */
    140 /*****************************************************************************/
    141 typedef struct
    142 {
    143     ive_queue_inp_ip_t                      s_ive_ip;
    144 }ih264e_queue_inp_ip_t;
    145 
    146 typedef struct
    147 {
    148     ive_queue_inp_op_t                      s_ive_op;
    149 }ih264e_queue_inp_op_t;
    150 
    151 /*****************************************************************************/
    152 /*   Dequeue Input raw buffer - Get free YUV buffer from the encoder         */
    153 /*****************************************************************************/
    154 typedef struct
    155 {
    156     ive_dequeue_inp_ip_t                      s_ive_ip;
    157 }ih264e_dequeue_inp_ip_t;
    158 
    159 typedef struct
    160 {
    161     ive_dequeue_inp_op_t                      s_ive_op;
    162 }ih264e_dequeue_inp_op_t;
    163 
    164 
    165 /*****************************************************************************/
    166 /*   Queue Output bitstream buffer - Send the bistream buffer to be filled   */
    167 /*****************************************************************************/
    168 typedef struct
    169 {
    170     ive_queue_out_ip_t                      s_ive_ip;
    171 }ih264e_queue_out_ip_t;
    172 
    173 typedef struct
    174 {
    175     ive_queue_out_op_t                      s_ive_op;
    176 }ih264e_queue_out_op_t;
    177 
    178 /*****************************************************************************/
    179 /* Dequeue Output bitstream buffer - Get the bistream buffer filled          */
    180 /*****************************************************************************/
    181 typedef struct
    182 {
    183     ive_dequeue_out_ip_t                      s_ive_ip;
    184 }ih264e_dequeue_out_ip_t;
    185 
    186 typedef struct
    187 {
    188     ive_dequeue_out_op_t                      s_ive_op;
    189 }ih264e_dequeue_out_op_t;
    190 
    191 
    192 /*****************************************************************************/
    193 /* Get Recon data - Get the reconstructed data from encoder                  */
    194 /*****************************************************************************/
    195 typedef struct
    196 {
    197     ive_get_recon_ip_t                        s_ive_ip;
    198 }ih264e_get_recon_ip_t;
    199 
    200 typedef struct
    201 {
    202     ive_get_recon_op_t                        s_ive_op;
    203 }ih264e_get_recon_op_t;
    204 /*****************************************************************************/
    205 /*   Video control  Flush                                                    */
    206 /*****************************************************************************/
    207 
    208 
    209 typedef struct
    210 {
    211     ive_ctl_flush_ip_t                      s_ive_ip;
    212 }ih264e_ctl_flush_ip_t;
    213 
    214 
    215 typedef struct
    216 {
    217     ive_ctl_flush_op_t                      s_ive_op;
    218 }ih264e_ctl_flush_op_t;
    219 
    220 /*****************************************************************************/
    221 /*   Video control reset                                                     */
    222 /*****************************************************************************/
    223 
    224 
    225 typedef struct
    226 {
    227     ive_ctl_reset_ip_t                      s_ive_ip;
    228 }ih264e_ctl_reset_ip_t;
    229 
    230 
    231 typedef struct
    232 {
    233     ive_ctl_reset_op_t                      s_ive_op;
    234 }ih264e_ctl_reset_op_t;
    235 
    236 
    237 /*****************************************************************************/
    238 /*   Video control:Get Buf Info                                              */
    239 /*****************************************************************************/
    240 
    241 
    242 typedef struct
    243 {
    244     ive_ctl_getbufinfo_ip_t             s_ive_ip;
    245 }ih264e_ctl_getbufinfo_ip_t;
    246 
    247 
    248 
    249 typedef struct
    250 {
    251     ive_ctl_getbufinfo_op_t             s_ive_op;
    252 }ih264e_ctl_getbufinfo_op_t;
    253 
    254 
    255 
    256 /*****************************************************************************/
    257 /*   Video control:Get Version Info                                          */
    258 /*****************************************************************************/
    259 
    260 
    261 typedef struct
    262 {
    263     ive_ctl_getversioninfo_ip_t         s_ive_ip;
    264 }ih264e_ctl_getversioninfo_ip_t;
    265 
    266 
    267 
    268 typedef struct
    269 {
    270     ive_ctl_getversioninfo_op_t         s_ive_op;
    271 }ih264e_ctl_getversioninfo_op_t;
    272 
    273 /*****************************************************************************/
    274 /*   Video control:Set default params                                       */
    275 /*****************************************************************************/
    276 
    277 
    278 typedef struct
    279 {
    280     ive_ctl_setdefault_ip_t         s_ive_ip;
    281 }ih264e_ctl_setdefault_ip_t;
    282 
    283 
    284 
    285 typedef struct
    286 {
    287     ive_ctl_setdefault_op_t         s_ive_op;
    288 }ih264e_ctl_setdefault_op_t;
    289 
    290 /*****************************************************************************/
    291 /*   Video control  Set IPE params                                           */
    292 /*****************************************************************************/
    293 typedef struct
    294 {
    295     ive_ctl_set_ipe_params_ip_t     s_ive_ip;
    296 }ih264e_ctl_set_ipe_params_ip_t;
    297 
    298 typedef struct
    299 {
    300     ive_ctl_set_ipe_params_op_t     s_ive_op;
    301 }ih264e_ctl_set_ipe_params_op_t;
    302 
    303 /*****************************************************************************/
    304 /*   Video control  Set Frame dimensions                                     */
    305 /*****************************************************************************/
    306 typedef struct
    307 {
    308     ive_ctl_set_dimensions_ip_t     s_ive_ip;
    309 }ih264e_ctl_set_dimensions_ip_t;
    310 
    311 typedef struct
    312 {
    313     ive_ctl_set_dimensions_op_t     s_ive_op;
    314 }ih264e_ctl_set_dimensions_op_t;
    315 
    316 /*****************************************************************************/
    317 /*   Video control  Set Frame rates                                          */
    318 /*****************************************************************************/
    319 typedef struct
    320 {
    321     ive_ctl_set_frame_rate_ip_t     s_ive_ip;
    322 }ih264e_ctl_set_frame_rate_ip_t;
    323 typedef struct
    324 {
    325     ive_ctl_set_frame_rate_op_t     s_ive_op;
    326 }ih264e_ctl_set_frame_rate_op_t;
    327 
    328 
    329 /*****************************************************************************/
    330 /*   Video control  Set Bitrate                                              */
    331 /*****************************************************************************/
    332 typedef struct
    333 {
    334     ive_ctl_set_bitrate_ip_t        s_ive_ip;
    335 }ih264e_ctl_set_bitrate_ip_t;
    336 
    337 typedef struct
    338 {
    339     ive_ctl_set_bitrate_op_t        s_ive_op;
    340 }ih264e_ctl_set_bitrate_op_t;
    341 
    342 
    343 /*****************************************************************************/
    344 /*   Video control  Set Frame type                                           */
    345 /*****************************************************************************/
    346 typedef struct
    347 {
    348     ive_ctl_set_frame_type_ip_t     s_ive_ip;
    349 }ih264e_ctl_set_frame_type_ip_t;
    350 
    351 typedef struct
    352 {
    353     ive_ctl_set_frame_type_op_t     s_ive_op;
    354 }ih264e_ctl_set_frame_type_op_t;
    355 
    356 /*****************************************************************************/
    357 /*   Video control  Set Encode mode                                          */
    358 /*****************************************************************************/
    359 typedef struct
    360 {
    361     ive_ctl_set_enc_mode_ip_t       s_ive_ip;
    362 }ih264e_ctl_set_enc_mode_ip_t;
    363 
    364 typedef struct
    365 {
    366     ive_ctl_set_enc_mode_op_t       s_ive_op;
    367 }ih264e_ctl_set_enc_mode_op_t;
    368 
    369 /*****************************************************************************/
    370 /*   Video control  Set QP                                                   */
    371 /*****************************************************************************/
    372 typedef struct
    373 {
    374     ive_ctl_set_qp_ip_t             s_ive_ip;
    375 }ih264e_ctl_set_qp_ip_t;
    376 
    377 typedef struct
    378 {
    379     ive_ctl_set_qp_op_t             s_ive_op;
    380 }ih264e_ctl_set_qp_op_t;
    381 
    382 /*****************************************************************************/
    383 /*   Video control  Set AIR params                                           */
    384 /*****************************************************************************/
    385 typedef struct
    386 {
    387     ive_ctl_set_air_params_ip_t     s_ive_ip;
    388 }ih264e_ctl_set_air_params_ip_t;
    389 
    390 typedef struct
    391 {
    392     ive_ctl_set_air_params_op_t     s_ive_op;
    393 }ih264e_ctl_set_air_params_op_t;
    394 
    395 /*****************************************************************************/
    396 /*   Video control  Set VBV params                                           */
    397 /*****************************************************************************/
    398 typedef struct
    399 {
    400     ive_ctl_set_vbv_params_ip_t     s_ive_ip;
    401 }ih264e_ctl_set_vbv_params_ip_t;
    402 
    403 typedef struct
    404 {
    405     ive_ctl_set_vbv_params_op_t     s_ive_op;
    406 }ih264e_ctl_set_vbv_params_op_t;
    407 
    408 /*****************************************************************************/
    409 /*   Video control  Set Processor Details                                    */
    410 /*****************************************************************************/
    411 typedef struct
    412 {
    413     ive_ctl_set_num_cores_ip_t      s_ive_ip;
    414 }ih264e_ctl_set_num_cores_ip_t;
    415 
    416 typedef struct
    417 {
    418     ive_ctl_set_num_cores_op_t      s_ive_op;
    419 }ih264e_ctl_set_num_cores_op_t;
    420 
    421 /*****************************************************************************/
    422 /*   Video control  Set Motion estimation params                             */
    423 /*****************************************************************************/
    424 typedef struct
    425 {
    426     ive_ctl_set_me_params_ip_t      s_ive_ip;
    427 }ih264e_ctl_set_me_params_ip_t;
    428 
    429 typedef struct
    430 {
    431     ive_ctl_set_me_params_op_t      s_ive_op;
    432 }ih264e_ctl_set_me_params_op_t;
    433 
    434 /*****************************************************************************/
    435 /*   Video control  Set GOP params                                           */
    436 /*****************************************************************************/
    437 typedef struct
    438 {
    439     ive_ctl_set_gop_params_ip_t     s_ive_ip;
    440 }ih264e_ctl_set_gop_params_ip_t;
    441 
    442 typedef struct
    443 {
    444     ive_ctl_set_gop_params_op_t     s_ive_op;
    445 }ih264e_ctl_set_gop_params_op_t;
    446 
    447 /*****************************************************************************/
    448 /*   Video control  Set Deblock params                                       */
    449 /*****************************************************************************/
    450 typedef struct
    451 {
    452     ive_ctl_set_deblock_params_ip_t s_ive_ip;
    453 }ih264e_ctl_set_deblock_params_ip_t;
    454 
    455 typedef struct
    456 {
    457     ive_ctl_set_deblock_params_op_t s_ive_op;
    458 }ih264e_ctl_set_deblock_params_op_t;
    459 
    460 /*****************************************************************************/
    461 /*   Video control  Set Profile params                                       */
    462 /*****************************************************************************/
    463 typedef struct
    464 {
    465     ive_ctl_set_profile_params_ip_t s_ive_ip;
    466 }ih264e_ctl_set_profile_params_ip_t;
    467 
    468 typedef struct
    469 {
    470     ive_ctl_set_profile_params_op_t s_ive_op;
    471 }ih264e_ctl_set_profile_params_op_t;
    472 
    473 /*****************************************************************************/
    474 /*   Synchronous video encode call                                           */
    475 /*****************************************************************************/
    476 typedef struct
    477 {
    478     ive_video_encode_ip_t s_ive_ip;
    479 }ih264e_video_encode_ip_t;
    480 
    481 typedef struct
    482 {
    483     ive_video_encode_op_t s_ive_op;
    484 }ih264e_video_encode_op_t;
    485 
    486 
    487 /* The enum values should not have greater than 8 bits as this is assigned to WORD8 */
    488 typedef enum
    489 {
    490     INTRA16x16 = 0,
    491     INTRA4x4,
    492     INTER16x16
    493 }IV_MB_TYPE_T;
    494 
    495 /*****************************************************************************/
    496 /*   Pic info structures                                                     */
    497 /*****************************************************************************/
    498 typedef struct
    499 {
    500     /** Qp  */
    501     UWORD32                                     u4_qp;
    502 
    503     /** Pic Type */
    504     IV_PICTURE_CODING_TYPE_T                    e_frame_type;
    505 
    506 }ih264e_pic_info1_t;
    507 
    508 typedef struct
    509 {
    510     /** Qp  */
    511     UWORD32                                     u4_qp;
    512 
    513     /** Pic Type */
    514     IV_PICTURE_CODING_TYPE_T                    e_frame_type;
    515 
    516     /** Disable deblock level (0: Enable completely, 3: Disable completely */
    517     UWORD32                                     u4_disable_deblock_level;
    518 
    519 }ih264e_pic_info2_t;
    520 
    521 
    522 /*****************************************************************************/
    523 /*   MB info structures                                                     */
    524 /*****************************************************************************/
    525 typedef struct
    526 {
    527     /** MV X    */
    528     WORD16                                  i2_mv_x;
    529 
    530     /** MV Y    */
    531     WORD16                                  i2_mv_y;
    532 }ih264e_mv_t;
    533 
    534 typedef struct
    535 {
    536     /** Intra / Inter    */
    537     WORD8                                       i1_mb_type;
    538     union
    539     {
    540         ih264e_mv_t                                 as_mv[1];
    541 
    542         /** Intra mode */
    543         WORD8                                       ai1_intra_mode[1];
    544     };
    545 }ih264e_mb_info1_t;
    546 
    547 typedef struct
    548 {
    549     /** Intra / Inter    */
    550     WORD8                                       i1_mb_type;
    551 
    552 
    553     /** SAD     */
    554     UWORD16                                     u2_sad;
    555 
    556     union
    557     {
    558         ih264e_mv_t                                 as_mv[1];
    559 
    560         /** Intra mode */
    561         WORD8                                       ai1_intra_mode[1];
    562     };
    563 
    564 
    565 }ih264e_mb_info2_t;
    566 
    567 typedef struct
    568 {
    569     /** Intra / Inter    */
    570     WORD8                                       i1_mb_type;
    571 
    572     union
    573     {
    574         ih264e_mv_t                                 as_mv[4];
    575 
    576         /** Intra mode */
    577         WORD8                                       ai1_intra_mode[16];
    578     };
    579 
    580 }ih264e_mb_info3_t;
    581 
    582 typedef struct
    583 {
    584     /** Intra / Inter    */
    585     WORD8                                       i1_mb_type;
    586 
    587     /** Intra Mode      */
    588     WORD8                                       i1_intra_mode;
    589 
    590     /** SAD     */
    591     UWORD16                                     u2_sad;
    592 
    593     union
    594     {
    595         ih264e_mv_t                                 as_mv[16];
    596 
    597         /** Intra mode */
    598         WORD8                                       ai1_intra_mode[16];
    599     };
    600 
    601 
    602 
    603 }ih264e_mb_info4_t;
    604 
    605 /* Add any new structures to the following union. It is used to calculate the max size needed for allocation of memory */
    606 typedef struct
    607 {
    608     union
    609     {
    610         ih264e_mb_info1_t               s_mb_info1;
    611         ih264e_mb_info2_t               s_mb_info2;
    612         ih264e_mb_info3_t               s_mb_info3;
    613         ih264e_mb_info4_t               s_mb_info4;
    614     };
    615 }ih264e_mb_info_t;
    616 
    617 #ifdef __cplusplus
    618 } /* closing brace for extern "C" */
    619 #endif
    620 #endif /* _IH264E_H_ */
    621