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 ihevce_api.h
     23 *
     24 * \brief
     25 *    This file contains definitions and structures which are shared between
     26 *    application and HEVC Encoder Processing interface layer
     27 *
     28 * \date
     29 *    18/09/2012
     30 *
     31 * \author
     32 *    Ittiam
     33 *
     34 ******************************************************************************
     35 */
     36 
     37 #ifndef _IHEVCE_API_H_
     38 #define _IHEVCE_API_H_
     39 
     40 /*****************************************************************************/
     41 /* Constant Macros                                                           */
     42 /*****************************************************************************/
     43 #define IHEVCE_MAX_IO_BUFFERS 3
     44 
     45 #define IHEVCE_EXTENDED_SAR 255
     46 
     47 #define IHEVCE_MBR_CORE_WEIGHTAGE 0.25f
     48 
     49 /** Maximum number of resolutions encoder can run */
     50 #define IHEVCE_MAX_NUM_RESOLUTIONS 1  //10
     51 
     52 /** Maximum number of bit-rate instances encoder can run */
     53 #define IHEVCE_MAX_NUM_BITRATES 1  //5
     54 
     55 #define MAX_NUM_CORES 8  // Supports upto 160 logical cores.
     56 
     57 /* Max length of filenames */
     58 #define MAX_LEN_FILENAME 200
     59 
     60 /* max number of tiles per row/cols */
     61 //Main/Main10 profile (=4096/256) //Don't change this
     62 #define MAX_TILE_COLUMNS 16
     63 //Main/Main10 profile (=2160/64)  //Don't change this
     64 #define MAX_TILE_ROWS 34
     65 
     66 #define IHEVCE_ASYNCH_ERROR_START 0x0000E600
     67 #define IHEVCE_SYNCH_ERROR_START 0x0000E700
     68 
     69 #define MAX_NUM_DYN_BITRATE_CMDS (IHEVCE_MAX_NUM_RESOLUTIONS * IHEVCE_MAX_NUM_BITRATES)
     70 
     71 /* NAL units related definations */
     72 #define MAX_NUM_PREFIX_NALS_PER_AU 20
     73 #define MAX_NUM_SUFFIX_NALS_PER_AU 20
     74 #define MAX_NUM_VCL_NALS_PER_AU 200 /* as per level 5.1 from spec */
     75 
     76 /* Maximum number of processor groups supported */
     77 #define MAX_NUMBER_PROC_GRPS 4
     78 
     79 /** @brief maximum length of CC User Data in a single frame */
     80 #define MAX_SEI_PAYLOAD_PER_TLV (0x200)
     81 
     82 #define MAX_NUMBER_OF_SEI_PAYLOAD (10)
     83 
     84 #define IHEVCE_COMMANDS_TAG_MASK (0x0000FFFF)
     85 
     86 // Upper 16 bits are used to communicate payload type
     87 #define IHEVCE_PAYLOAD_TYPE_MASK (0xFFFF0000)
     88 
     89 #define IHEVCE_PAYLOAD_TYPE_SHIFT (16)
     90 
     91 #define MAX_FRAME_RATE  120.0
     92 #define MIN_FRAME_RATE  1.0
     93 
     94 /*****************************************************************************/
     95 /* Enums                                                                     */
     96 /*****************************************************************************/
     97 /**
     98  *  @brief      Enumerations for Quality config.
     99  */
    100 typedef enum
    101 {
    102     IHEVCE_QUALITY_DUMMY = 0xFFFFFFFF,
    103     IHEVCE_QUALITY_P0 = 0,
    104     IHEVCE_QUALITY_P2 = 2,
    105     IHEVCE_QUALITY_P3,
    106     IHEVCE_QUALITY_P4,
    107     IHEVCE_QUALITY_P5,
    108     IHEVCE_QUALITY_P6,
    109     IHEVCE_QUALITY_P7,
    110     IHEVCE_NUM_QUALITY_PRESET
    111 } IHEVCE_QUALITY_CONFIG_T;
    112 
    113 /*****************************************************************************/
    114 /* Enums                                                                     */
    115 /*****************************************************************************/
    116 /**
    117  *  @brief      Enumerations for Quality config for auxilary bitrate in case of MBR.
    118  */
    119 typedef enum
    120 {
    121     IHEVCE_MBR_DUMMY = -1,
    122     IHEVCE_MBR_HIGH_QUALITY = 0,
    123     IHEVCE_MBR_MEDIUM_SPEED,
    124     IHEVCE_MBR_HIGH_SPEED,
    125     IHEVCE_MBR_EXTREME_SPEED
    126 } IHEVCE_QUALITY_CONFIG_MBR_T;
    127 
    128 /**
    129  *  @brief      Enumerations for Rate Control config.
    130  */
    131 typedef enum
    132 {
    133     IHEVCE_RC_DUMMY = 0xFFFFFFFF,
    134     IHEVCE_RC_LOW_DELAY = 1,
    135     IHEVCE_RC_STORAGE = 2,
    136     IHEVCE_RC_TWOPASS = 3,
    137     IHEVCE_RC_NONE = 4,
    138     IHEVCE_RC_USER_DEFINED = 5,
    139     IHEVCE_RC_RATECONTROLPRESET_DEFAULT = IHEVCE_RC_LOW_DELAY
    140 } IHEVCE_RATE_CONTROL_CONFIG_T;
    141 
    142 /**
    143  *  @brief      Enumerations for Intra Refresh config.
    144  */
    145 typedef enum
    146 {
    147     IHEVCE_REFRESH_DUMMY = 0,
    148     IHEVCE_I_SILICE = 1,
    149     IHEVCE_COLUMN_BASED = 2,
    150     IHEVCE_DBR = 3,
    151     IHEVCE_GDR = 4
    152 } IHEVCE_REFRESH_CONFIG_T;
    153 
    154 /**
    155  *  @brief      Enumerations for ASYNCH Control Commands Tags.
    156  */
    157 typedef enum
    158 {
    159     IHEVCE_ASYNCH_API_END_TAG = 0xFFFF,
    160     IHEVCE_ASYNCH_API_SETBITRATE_TAG = 0x01,
    161     IHEVCE_ASYNCH_API_SET_RF_TAG = 0x02,
    162     IHEVCE_ASYNCH_API_FORCE_CLOSE_TAG = 0x03
    163 } IHEVCE_ASYNCH_API_COMMAND_TAG_T;
    164 
    165 typedef enum
    166 {
    167     IHEVCE_ASYNCH_ERR_NO_END_TAG = IHEVCE_ASYNCH_ERROR_START + 0x01,
    168     IHEVCE_ASYNCH_ERR_TLV_ERROR = IHEVCE_ASYNCH_ERROR_START + 0x02,
    169     IHEVCE_ASYNCH_ERR_LENGTH_NOT_ZERO = IHEVCE_ASYNCH_ERROR_START + 0x03,
    170     IHEVCE_ASYNCH_ERR_BR_NOT_BYTE = IHEVCE_ASYNCH_ERROR_START + 0x04,
    171     IHEVCE_ASYNCH_FORCE_CLOSE_NOT_SUPPORTED = IHEVCE_ASYNCH_ERROR_START + 0x05
    172 } IHEVCE_ASYNCH_ERROR_TAG_T;
    173 
    174 /**
    175  *  @brief      Enumerations for SYNCH Control Commands Tags.
    176  */
    177 typedef enum
    178 {
    179     IHEVCE_SYNCH_API_END_TAG = 0xFFFF,
    180     IHEVCE_SYNCH_API_FLUSH_TAG = 0x21,
    181     IHEVCE_SYNCH_API_FORCE_IDR_TAG = 0x22,
    182     IHEVCE_SYNCH_API_REG_KEYFRAME_SEI_TAG = 0x23,
    183     IHEVCE_SYNCH_API_REG_ALLFRAME_SEI_TAG = 0x24,
    184     IHEVCE_SYNCH_API_SET_RES_TAG = 0x25
    185 } IHEVCE_SYNCH_API_COMMAND_TAG_T;
    186 
    187 typedef enum
    188 {
    189     IHEVCE_SYNCH_ERR_NO_END_TAG = IHEVCE_SYNCH_ERROR_START + 0x11,
    190     IHEVCE_SYNCH_ERR_TLV_ERROR = IHEVCE_SYNCH_ERROR_START + 0x12,
    191     IHEVCE_SYNCH_ERR_LENGTH_NOT_ZERO = IHEVCE_SYNCH_ERROR_START + 0x13,
    192     IHEVCE_SYNCH_ERR_NO_PADDING = IHEVCE_SYNCH_ERROR_START + 0x14,
    193     IHEVCE_SYNCH_ERR_WRONG_LENGTH = IHEVCE_SYNCH_ERROR_START + 0x15,
    194     IHEVCE_SYNCH_ERR_FREQ_FORCE_IDR_RECEIVED = IHEVCE_SYNCH_ERROR_START + 0x16,
    195     IHEVCE_SYNCH_ERR_TOO_MANY_SEI_MSG = IHEVCE_SYNCH_ERROR_START + 0x17,
    196     IHEVCE_SYNCH_ERR_SET_RES_NOT_SUPPORTED = IHEVCE_SYNCH_ERROR_START + 0x18
    197 } IHEVCE_SYNCH_ERROR_TAG_T;
    198 
    199 /**
    200  *  @brief      Enumerations for output status identifier
    201  */
    202 typedef enum
    203 {
    204     IHEVCE_PROCESS = 0,
    205     IHEVCE_CONTROL_STS,
    206     IHEVCE_CREATE_STS,
    207 } IHEVCE_OUT_STS_ID_T;
    208 
    209 /**
    210   * Scenetype enums
    211   */
    212 typedef enum
    213 {
    214     IHEVCE_SCENE_TYPE_NORMAL = 0,
    215     IHEVCE_SCENE_TYPE_SCENE_CUT,
    216     IHEVCE_SCENE_TYPE_FLASH,
    217     IHEVCE_SCENE_TYPE_FADE_IN,
    218     IHEVCE_SCENE_TYPE_FADE_OUT,
    219     IHEVCE_SCENE_TYPE_DISSOLVE,
    220     IHEVCE_MAX_NUM_SCENE_TYPES
    221 } IHEVCE_SCENE_TYPE;
    222 
    223 /**
    224   * Type of data. Used for scanning the config file
    225   */
    226 typedef enum
    227 {
    228     IHEVCE_STRING = 0,
    229     IHEVCE_INT,
    230     IHEVCE_FLOAT
    231 } IHEVCE_DATA_TYPE;
    232 
    233 /*****************************************************************************/
    234 /* Structure                                                                 */
    235 /*****************************************************************************/
    236 
    237 /**
    238  *  @brief      Structure to describe the properties of Source of encoder.
    239  */
    240 typedef struct
    241 {
    242     /** Used for checking version compatibility  */
    243     WORD32 i4_size;
    244 
    245     /**  Input chroma format
    246      * @sa : IV_COLOR_FORMAT_T
    247      */
    248     WORD32 inp_chr_format;
    249 
    250     /**  Internal chroma format
    251      * @sa : IV_COLOR_FORMAT_T
    252      */
    253     WORD32 i4_chr_format;
    254 
    255     /** Width of input luma */
    256     WORD32 i4_width;
    257 
    258     /** Height of input luma */
    259     WORD32 i4_height;
    260 
    261     /** Configured Width of input luma */
    262     WORD32 i4_orig_width;
    263 
    264     /** Configured Height of input luma */
    265     WORD32 i4_orig_height;
    266 
    267     /** Width of each pixel in bits */
    268     WORD32 i4_input_bit_depth;
    269 
    270     /** Input Content Type
    271      * @sa : IV_CONTENT_TYPE_T
    272      */
    273     WORD32 i4_field_pic;
    274 
    275     /** Frame/Field rate numerator
    276      * (final fps = frame_rate_num/frame_rate_denom)
    277      */
    278     WORD32 i4_frm_rate_num;
    279 
    280     /** Can be 1000 or 1001 to allow proper representation
    281      *  of fractional frame-rates
    282      */
    283     WORD32 i4_frm_rate_denom;
    284 
    285     /**
    286      *  Whether Top field is encoded first or bottom
    287      */
    288     WORD32 i4_topfield_first;
    289 
    290 } ihevce_src_params_t;
    291 
    292 /*****************************************************************************/
    293 /* Structure                                                                 */
    294 /*****************************************************************************/
    295 /**
    296  *  @brief      Structure to describe attributes of a layer.
    297  */
    298 typedef struct
    299 {
    300     /** Used for checking version compatibility  */
    301     WORD32 i4_size;
    302 
    303     /** Width of input luma */
    304     WORD32 i4_width;
    305 
    306     /** Height of input luma */
    307     WORD32 i4_height;
    308 
    309     /** Frame/Field rate
    310      * (final fps = src frame_rate_num/src frame_rate_denom/i4_frm_rate_scale_factor)
    311      */
    312     WORD32 i4_frm_rate_scale_factor;
    313 
    314     /** Quality vs. complexity
    315      * @sa : IHEVCE_QUALITY_CONFIG_T
    316      */
    317     IHEVCE_QUALITY_CONFIG_T i4_quality_preset;
    318 
    319     /** 0 : Level 4, any level above this not supported */
    320     WORD32 i4_codec_level;
    321 
    322     /** Number of bit-rate instances for the current layer
    323     */
    324     WORD32 i4_num_bitrate_instances;
    325 
    326     /** Target Bit-rate in bits for Constant bitrate cases  */
    327     WORD32 ai4_tgt_bitrate[IHEVCE_MAX_NUM_BITRATES];
    328 
    329     /** Peak Bit-rate in bits for each bitrate */
    330     WORD32 ai4_peak_bitrate[IHEVCE_MAX_NUM_BITRATES];
    331 
    332     /** Maximum VBV buffer size in bits for each and each bitrate */
    333     WORD32 ai4_max_vbv_buffer_size[IHEVCE_MAX_NUM_BITRATES];
    334 
    335     /** Frame level Qp for Constant Qp mode */
    336     WORD32 ai4_frame_qp[IHEVCE_MAX_NUM_BITRATES];
    337 
    338 } ihevce_tgt_params_t;
    339 
    340 /*****************************************************************************/
    341 /* Structure                                                                 */
    342 /*****************************************************************************/
    343 /**
    344  *  @brief      Structure to describe the properties of target
    345                 resolution of encoder.
    346  */
    347 typedef struct
    348 {
    349     /** Used for checking version compatibility  */
    350     WORD32 i4_size;
    351 
    352     /**  Number of resolution layers
    353      */
    354     WORD32 i4_num_res_layers;
    355 
    356     /*  Applicable only for multi res cases.
    357      Output of only one resolution to be dumped */
    358 
    359     WORD32 i4_mres_single_out;
    360 
    361     /* Specify starting resolution id for mres single out case.
    362      This is only valid in mres_single out mode */
    363 
    364     WORD32 i4_start_res_id;
    365 
    366     /**  To enable reuse across layers
    367      */
    368     WORD32 i4_multi_res_layer_reuse;
    369 
    370     /** Quality vs. complexity for auxilary bitrates
    371      * @sa : IHEVCE_QUALITY_CONFIG_MBR_T
    372      */
    373     IHEVCE_QUALITY_CONFIG_MBR_T i4_mbr_quality_setting;
    374 
    375     /**
    376      *Bit depth used by encoder
    377      */
    378     WORD32 i4_internal_bit_depth;
    379 
    380     /**
    381     *Temporal scalability enable Flag
    382     */
    383     WORD32 i4_enable_temporal_scalability;
    384 
    385     /** Resolution and frame rate scaling factors for
    386      *  each layer
    387      */
    388     ihevce_tgt_params_t as_tgt_params[IHEVCE_MAX_NUM_RESOLUTIONS];
    389 
    390     /*Scaler handle */
    391     void *pv_scaler_handle;
    392 
    393     /*Function pointer for scaling luma data*/
    394     void (*pf_scale_luma)(
    395         void *pv_scaler_handle,
    396         UWORD8 *pu1_in_buf,
    397         WORD32 i4_inp_width,
    398         WORD32 i4_inp_height,
    399         WORD32 i4_inp_stride,
    400         UWORD8 *pu1_out_buf,
    401         WORD32 i4_out_width,
    402         WORD32 i4_out_height,
    403         WORD32 i4_out_stride);
    404 
    405     /*Function pointer for scaling chroma data*/
    406     void (*pf_scale_chroma)(
    407         void *pv_scaler_handle,
    408         UWORD8 *pu1_in_buf,
    409         WORD32 i4_inp_width,
    410         WORD32 i4_inp_height,
    411         WORD32 i4_inp_stride,
    412         UWORD8 *pu1_out_buf,
    413         WORD32 i4_out_width,
    414         WORD32 i4_out_height,
    415         WORD32 i4_out_stride);
    416 
    417 } ihevce_tgt_layer_params_t;
    418 
    419 /**
    420  *  @brief    Structure to describe the stream level
    421  *            properties encoder should adhere to
    422  */
    423 typedef struct
    424 {
    425     /** Used for checking version compatibility */
    426     WORD32 i4_size;
    427 
    428     /**  0 - HEVC , no other value supported */
    429     WORD32 i4_codec_type;
    430 
    431     /**1 : Main Profile ,2: Main 10 Profile. no other value supported */
    432     WORD32 i4_codec_profile;
    433 
    434     /** 0: Main Tier ,1: High Tier. no other value supported */
    435     WORD32 i4_codec_tier;
    436 
    437     /** Enable VUI output  1: enable 0 : disable */
    438     WORD32 i4_vui_enable;
    439 
    440     /** Enable specific SEI messages in the stream
    441      *  1: enable 0 : disable
    442      */
    443     WORD32 i4_sei_enable_flag;
    444 
    445     /** Enable specific SEI payload (other than pic timing and buffering period) messages in the stream
    446      *  1: enable 0 : disable
    447      */
    448     WORD32 i4_sei_payload_enable_flag;
    449 
    450     /** Enable specific SEI buffering period messages in the stream
    451      *  1: enable 0 : disable
    452      */
    453     WORD32 i4_sei_buffer_period_flags;
    454 
    455     /** Enable specific SEI Picture timing messages in the stream
    456      *  1: enable 0 : disable
    457      */
    458     WORD32 i4_sei_pic_timing_flags;
    459 
    460     /** Enable specific SEI recovery point messages in the stream
    461      *  1: enable 0 : disable
    462      */
    463     WORD32 i4_sei_recovery_point_flags;
    464 
    465     /** Enable specific SEI mastering display colour volume in the stream
    466      *  1: enable 0 : disable
    467      */
    468     WORD32 i4_sei_mastering_disp_colour_vol_flags;
    469 
    470     /**
    471      * Array to store the display_primaries_x values
    472      */
    473     UWORD16 au2_display_primaries_x[3];
    474 
    475     /**
    476      * Array to store the display_primaries_y values
    477      */
    478     UWORD16 au2_display_primaries_y[3];
    479 
    480     /**
    481      * Variable to store the white point x value
    482      */
    483     UWORD16 u2_white_point_x;
    484 
    485     /**
    486      * Variable to store the white point y value
    487      */
    488     UWORD16 u2_white_point_y;
    489 
    490     /**
    491      * Variable to store the max display mastering luminance value
    492      */
    493     UWORD32 u4_max_display_mastering_luminance;
    494 
    495     /**
    496      * Variable to store the min display mastering luminance value
    497      */
    498     UWORD32 u4_min_display_mastering_luminance;
    499 
    500     /**
    501      * Enable Content Level Light Info
    502      */
    503     WORD32 i4_sei_cll_enable;
    504 
    505     /**
    506      * 16bit unsigned number which indicates the maximum pixel intensity of all samples in bit-stream in units of 1 candela per square metre
    507      */
    508     UWORD16 u2_sei_max_cll;
    509 
    510     /**
    511      * 16bit unsigned number which indicates the average pixel intensity of all samples in bit-stream in units of 1 candela per square metre
    512      */
    513     UWORD16 u2_sei_avg_cll;
    514 
    515     /** Enable/Disable SEI Hash on the Decoded picture & Hash type
    516      *  3 : Checksum, 2 : CRC, 1 : MD5, 0 : disable
    517      */
    518     WORD32 i4_decoded_pic_hash_sei_flag;
    519 
    520     /** Enable specific AUD messages in the stream
    521      *  1: enable 0 : disable
    522      */
    523     WORD32 i4_aud_enable_flags;
    524 
    525     /** Enable EOS messages in the stream
    526      *  1: enable 0 : disable
    527      */
    528     WORD32 i4_eos_enable_flags;
    529 
    530     /** Enable automatic insertion of SPS at each CDR
    531      *  1: enable 0 : disable
    532      */
    533     WORD32 i4_sps_at_cdr_enable;
    534 
    535     WORD32 i4_interop_flags;
    536 
    537 } ihevce_out_strm_params_t;
    538 
    539 /**
    540  *  @brief   Structure to describe the Encoding Coding tools
    541  *           to be used by the Encoder
    542  */
    543 typedef struct
    544 {
    545     /** Used for checking version compatibility*/
    546     WORD32 i4_size;
    547 
    548     /** Max spacing between IDR frames -
    549       *  0 indicates only at the beginning
    550       */
    551     WORD32 i4_max_closed_gop_period;
    552 
    553     /** Min spacing between IDR frames  -
    554      *  Max = Min provides fixed segment length
    555      */
    556     WORD32 i4_min_closed_gop_period;
    557 
    558     /** Max spacing between CRA frames -
    559       *
    560       */
    561     WORD32 i4_max_cra_open_gop_period;
    562 
    563     /** Max spacing between I frames  -
    564      *
    565      */
    566     WORD32 i4_max_i_open_gop_period;
    567 
    568     /** Maximum number of dyadic temporal layers */
    569     WORD32 i4_max_temporal_layers;
    570 
    571     /** Maximum number of reference frames */
    572     WORD32 i4_max_reference_frames;
    573 
    574     /** Enable weighted prediction
    575      * 0 - disabled (default); 1 -enabled
    576      */
    577     WORD32 i4_weighted_pred_enable;
    578 
    579     /**  Deblocking type 0 - no deblocking;
    580      *  1 - default; 2 - disable across slices
    581      */
    582     WORD32 i4_deblocking_type;
    583 
    584     /** Use default scaling matrices
    585      * 0 - disabled; 1 - enabled (default)
    586      */
    587     WORD32 i4_use_default_sc_mtx;
    588 
    589     /** Cropping mode for cases  where frame dimensions
    590      *  are not multiple of MIN CU size
    591      *  1 - enable padding to min_cu multiple and generate cropping flags;
    592      *  0 - report error
    593      */
    594     WORD32 i4_cropping_mode;
    595 
    596     /** 0 - no slices; 1 - packet based; 2 - CU based */
    597     WORD32 i4_slice_type;
    598 
    599     /** Use default scaling matrices
    600      * 0 - disabled; 1 - enabled (default)
    601      */
    602     WORD32 i4_enable_entropy_sync;
    603 
    604     /** VQET control parameter */
    605     WORD32 i4_vqet;
    606 
    607 } ihevce_coding_params_t;
    608 
    609 /**
    610  *  @brief  Structure to describe the Configurable parameters of Encoder
    611  */
    612 typedef struct
    613 {
    614     /** Used for checking version compatibility */
    615     WORD32 i4_size;
    616 
    617     /* ---------- Tiles related parameters ------------ */
    618 
    619     /* ----------- CU related parameters -------------- */
    620 
    621     /** 4 - 16x16; 5 - 32x32 (default); 6 - 64x64 */
    622     WORD32 i4_max_log2_cu_size;
    623 
    624     /** 3 - 8x8; 4 - 16x16 (default); 5 - 32x32 ; 6 - 64x64 */
    625     WORD32 i4_min_log2_cu_size;
    626 
    627     /** 2 - 4x4 (default) ; 3 - 8x8; 4 - 16x16; 5 - 32x32 */
    628     WORD32 i4_min_log2_tu_size;
    629 
    630     /** 2 - 4x4; 3 - 8x8 (default); 4 - 16x16; 5 - 32x32 */
    631     WORD32 i4_max_log2_tu_size;
    632 
    633     /** Max transform tree depth for intra */
    634     WORD32 i4_max_tr_tree_depth_I;
    635 
    636     /** Max transform tree depth for inter */
    637     WORD32 i4_max_tr_tree_depth_nI;
    638 
    639     /* ---------- Rate Control related parameters ------ */
    640 
    641     /** Rate control mode  0 - constant qp (default); 1- CBR  */
    642     WORD32 i4_rate_control_mode;
    643 
    644     /** CU level Qp modulation
    645         0 - No Qp modulation at CU level;
    646         1 - QP modulation level 1
    647         2 - QP modulation level 2
    648         3 - QP modulation level 3*/
    649     WORD32 i4_cu_level_rc;
    650 
    651     /* Factor used in capped VBR mode to fine tune for quality */
    652     WORD32 i4_rate_factor;
    653 
    654     /** Enable stuffing 0 - disabled (default); 1 -enabled */
    655     WORD32 i4_stuffing_enable;
    656 
    657     /*The max deivaiton allowed from file size (used only in VBR, in CBR vbv buffer size dictates the deviaiton allowed)*/
    658     WORD32 i4_vbr_max_peak_rate_dur;
    659 
    660     /*Number of frames to encode. required to control allowed bit deviation at any point of time*/
    661     WORD32 i4_num_frms_to_encode;
    662 
    663     /** Initial buffer fullness when decoding starts */
    664     WORD32 i4_init_vbv_fullness;
    665 
    666     /** Frame level I frame max qp in rate control mode */
    667     WORD32 i4_max_frame_qp;
    668 
    669     /** Frame level I frame min qp in rate control mode */
    670     WORD32 i4_min_frame_qp;
    671     /* --------- ME related parameters ---------------- */
    672 
    673     /** Maximum search range in full pel units. horizontal direction */
    674     WORD32 i4_max_search_range_horz;
    675 
    676     /** Maximum search range in full pel units.  vertical direction */
    677     WORD32 i4_max_search_range_vert;
    678 
    679     /* Variable used to save old rate factor */
    680     /* Used only for plugin */
    681     WORD32 i4_old_rate_factor;
    682 
    683 } ihevce_config_prms_t;
    684 
    685 /**
    686  *  @brief    Structure to describe Dynamic configuralbe
    687  *            parameters of encoder
    688  *
    689  *            these new params can be passed as async commands
    690  *            to the enocder by sending a IHEVCE_CMD_CTL_SETPARAMS command
    691  */
    692 typedef struct
    693 {
    694     /** Used for checking version compatibility */
    695     WORD32 i4_size;
    696 
    697     /** Resolution ID  of the stream for which bitrate change needs to be applied */
    698     WORD32 i4_tgt_res_id;
    699 
    700     /** Bitrate ID in the Resolution ID  of the stream for which bitrate change needs to be applied */
    701     WORD32 i4_tgt_br_id;
    702 
    703     /** New Target Bit-rate for on the fly change */
    704     WORD32 i4_new_tgt_bitrate;
    705 
    706     /** New Peak Bit-rate for on the fly change */
    707     WORD32 i4_new_peak_bitrate;
    708 
    709     /** New Rate Factor for on the fly change */
    710     WORD32 i4_new_rate_factor;
    711 } ihevce_dyn_config_prms_t;
    712 
    713 /**
    714  *  @brief    Structure to describe Dynamic configuralbe
    715  *            parameters of encoder for dynamic resolution change
    716  *
    717  *            these new params can be passed as synchromous commands
    718  *            to the enocder by sending a IHEVCE_SYNCH_API_SET_RES_TAG command
    719  */
    720 typedef struct
    721 {
    722     /** Resolution ID  of the stream for which bitrate change needs to be applied */
    723     WORD32 i4_new_res_id;
    724 
    725     /** New Target Bit-rate for on the fly change */
    726     WORD32 i4_new_tgt_bitrate;
    727 
    728 } ihevce_dyn_res_prms_t;
    729 
    730 /**
    731  *  @brief    Structure to describe the Look Ahead
    732  *            Processing Parameters of Encoder
    733  */
    734 typedef struct
    735 {
    736     /** Used for checking version compatibility */
    737     WORD32 i4_size;
    738 
    739     /** Number of frames to look-ahead for RC and adaptive quant -
    740      * counts each fields as one frame for interlaced
    741      */
    742     WORD32 i4_rc_look_ahead_pics;
    743 
    744     /** Enable computation of weights & offsets for weighted prediction */
    745     WORD32 i4_enable_wts_ofsts;
    746 
    747     /* Enables denoiser as a part of video preprocessing. */
    748     WORD32 i4_denoise_enable;
    749 
    750     /* Enable this flag if input is interlaced and output is progressive */
    751     WORD32 i4_deinterlacer_enable;
    752 
    753 } ihevce_lap_params_t;
    754 
    755 /**
    756  *  @brief    Structure to describe the parameters
    757  *            related to multi-bitrate encoding
    758  */
    759 typedef struct
    760 {
    761     /** Number of bit-rate instances */
    762     WORD32 i4_num_bitrate_instances;
    763 
    764     /* Number of intra modes to be evaluated for derived instance */
    765     WORD32 i4_num_modes_intra;
    766 
    767     /* Number of inter modes to be evaluated for derived instance */
    768     WORD32 i4_num_modes_inter;
    769 
    770 } ihevce_mbr_params_t;
    771 
    772 /**
    773  *  @brief  Vui/Sei parameters of Encoder
    774  */
    775 typedef struct
    776 {
    777     /**
    778     *  indicates the presence of aspect_ratio
    779     */
    780     UWORD8 u1_aspect_ratio_info_present_flag;
    781 
    782     /**
    783     *  specifies the aspect ratio of the luma samples
    784     */
    785     UWORD8 au1_aspect_ratio_idc[IHEVCE_MAX_NUM_RESOLUTIONS];
    786 
    787     /**
    788     *  width of the luma samples. user dependent
    789     */
    790     UWORD16 au2_sar_width[IHEVCE_MAX_NUM_RESOLUTIONS];
    791 
    792     /**
    793     *  height of the luma samples. user dependent
    794     */
    795     UWORD16 au2_sar_height[IHEVCE_MAX_NUM_RESOLUTIONS];
    796 
    797     /**
    798     * if 1, specifies that the overscan_appropriate_flag is present
    799     * if 0, the preferred display method for the video signal is unspecified
    800     */
    801     UWORD8 u1_overscan_info_present_flag;
    802 
    803     /**
    804     * if 1,indicates that the cropped decoded pictures output
    805     * are suitable for display using overscan
    806     */
    807     UWORD8 u1_overscan_appropriate_flag;
    808 
    809     /**
    810     * if 1 specifies that video_format, video_full_range_flag and
    811     * colour_description_present_flag are present
    812     */
    813     UWORD8 u1_video_signal_type_present_flag;
    814 
    815     /**
    816     *
    817     */
    818     UWORD8 u1_video_format;
    819 
    820     /**
    821     * indicates the black level and range of the luma and chroma signals
    822     */
    823     UWORD8 u1_video_full_range_flag;
    824 
    825     /**
    826     * if 1,to 1 specifies that colour_primaries, transfer_characteristics
    827     * and matrix_coefficients are present
    828     */
    829     UWORD8 u1_colour_description_present_flag;
    830 
    831     /**
    832     * indicates the chromaticity coordinates of the source primaries
    833     */
    834     UWORD8 u1_colour_primaries;
    835 
    836     /**
    837     * indicates the opto-electronic transfer characteristic of the source picture
    838     */
    839     UWORD8 u1_transfer_characteristics;
    840 
    841     /**
    842     * the matrix coefficients used in deriving luma and chroma signals
    843     * from the green, blue, and red primaries
    844     */
    845     UWORD8 u1_matrix_coefficients;
    846 
    847     /**
    848     * if 1, specifies that chroma_sample_loc_type_top_field and
    849     * chroma_sample_loc_type_bottom_field are present
    850     */
    851     UWORD8 u1_chroma_loc_info_present_flag;
    852 
    853     /**
    854     * location of chroma samples
    855     */
    856     UWORD8 u1_chroma_sample_loc_type_top_field;
    857 
    858     UWORD8 u1_chroma_sample_loc_type_bottom_field;
    859 
    860     /**
    861     *  to 1 specifies that the syntax structure hrd_parameters is present in the vui_parameters syntax structue
    862     */
    863     UWORD8 u1_vui_hrd_parameters_present_flag;
    864 
    865     /**
    866     *  VUI level HRD parameters
    867     */
    868     //hrd_params_t s_vui_hrd_parameters;
    869 
    870     /**
    871     *   HRD parameter Indicates the presence of the
    872     *   num_units_in_ticks, time_scale flag
    873     */
    874     UWORD8 u1_timing_info_present_flag;
    875 
    876     /**
    877     * Nal- hrd parameters flag
    878     */
    879     UWORD8 u1_nal_hrd_parameters_present_flag;
    880 
    881 } ihevce_vui_sei_params_t;
    882 
    883 /**
    884  *  @brief  Multi thread related parameters passed to the encoder during create
    885  */
    886 
    887 typedef struct
    888 {
    889     /** Kept for maintaining backwards compatibility in future */
    890     WORD32 i4_size;
    891 
    892     /** Total number of logical cores, which are assigned to be used by the encoder
    893      */
    894     WORD32 i4_max_num_cores;
    895 
    896     /** Total number of groups in the machine on which encoder is run.
    897      */
    898     WORD32 i4_num_proc_groups;
    899 
    900     /** Total number of logical cores present per processor group of the machine.
    901      */
    902     WORD32 ai4_num_cores_per_grp[MAX_NUMBER_PROC_GRPS];
    903 
    904     /** Flag to enableUse thread affintiy feature
    905      * 0: Thread affinity disabled
    906      * 1: Thread affinity enabled
    907      */
    908     WORD32 i4_use_thrd_affinity;
    909 
    910     /**
    911      * Memory allocation control flag: Reserved (to be used later)
    912      */
    913     WORD32 i4_memory_alloc_ctrl_flag;
    914 
    915     /**
    916      * Array of thread affinity masks for frame processing threads
    917      * PRE Enc Group
    918      */
    919     ULWORD64 au8_core_aff_mask[MAX_NUM_CORES];
    920 
    921 } ihevce_static_multi_thread_params_t;
    922 
    923 /**
    924  *  @brief  File IO APIs
    925  */
    926 typedef struct
    927 {
    928     FILE *(*ihevce_fopen)(void *pv_cb_handle, const char *pi1_filename, const char *pi1_mode);
    929 
    930     int (*ihevce_fclose)(void *pv_cb_handle, FILE *pf_stream);
    931 
    932     int (*ihevce_fflush)(void *pv_cb_handle, FILE *pf_stream);
    933 
    934     int (*ihevce_fseek)(void *pv_cb_handle, FILE *pf_stream, long i4_offset, int i4_origin);
    935 
    936     size_t (*ihevce_fread)(
    937         void *pv_cb_handle, void *pv_ptr, size_t u4_size, size_t u4_count, FILE *pf_stream);
    938 
    939     int (*ihevce_fscanf)(
    940         void *pv_cb_handle,
    941         IHEVCE_DATA_TYPE e_data_type,
    942         FILE *file_ptr,
    943         const char *format,
    944         void *pv_dst);
    945 
    946     int (*ihevce_fprintf)(void *pv_cb_handle, FILE *pf_stream, const char *pi1_format, ...);
    947 
    948     size_t (*ihevce_fwrite)(
    949         void *pv_cb_handle, const void *pv_ptr, size_t i4_size, size_t i4_count, FILE *pf_stream);
    950 
    951     char *(*ihevce_fgets)(void *pv_cb_handle, char *pi1_str, int i4_size, FILE *pf_stream);
    952 
    953 } ihevce_file_io_api_t;
    954 
    955 /**
    956  *  @brief  System APIs to implement call back functions in encoder
    957  */
    958 typedef struct
    959 {
    960     /*Call back handle for all system api*/
    961     void *pv_cb_handle;
    962 
    963     /* Console APIs */
    964     int (*ihevce_printf)(void *pv_cb_handle, const char *i1_str, ...);
    965 
    966     //int   (*ihevce_scanf)    (void *pv_handle, const char *i1_str, ...);
    967 
    968     int (*ihevce_sscanf)(void *pv_cb_handle, const char *pv_src, const char *format, int *p_dst_int);
    969 
    970     int (*ihevce_sprintf)(void *pv_cb_handle, char *pi1_str, const char *format, ...);
    971 
    972     int (*ihevce_sprintf_s)(
    973         void *pv_cb_handle, char *pi1_str, size_t i4_size, const char *format, ...);
    974 
    975     /* File I/O APIs */
    976     ihevce_file_io_api_t s_file_io_api;
    977 
    978 } ihevce_sys_api_t;
    979 
    980 /**
    981  *  @brief    Structure to describe multipass related params
    982  */
    983 typedef struct
    984 {
    985     /** Kept for maintaining backwards compatibility in future */
    986     WORD32 i4_size;
    987 
    988     /* 0:Normal mode 1: only dumps stat 2: 2nd pass reads from stat file and rewrites the same file*/
    989     WORD32 i4_pass;
    990 
    991     /* Flag to specify the algorithm used for bit-distribution
    992     in second pass */
    993     WORD32 i4_multi_pass_algo_mode;
    994 
    995     /* Stat file to read or write data of frame statistics */
    996     WORD8 *pi1_frame_stats_filename;
    997 
    998     /* stat file to read or write data of gop level statstics*/
    999     WORD8 *pi1_gop_stats_filename;
   1000 
   1001     /* Stat file to read or write CTB level data*/
   1002     WORD8 *pi1_sub_frames_stats_filename;
   1003 
   1004 } ihevce_pass_prms_t;
   1005 
   1006 /**
   1007  *  @brief    Structure to describe tile params
   1008  */
   1009 typedef struct
   1010 {
   1011     /** Kept for maintaining backwards compatibility in future */
   1012     WORD32 i4_size;
   1013 
   1014     /* flag to indicate tile encoding enabled/disabled */
   1015     WORD32 i4_tiles_enabled_flag;
   1016 
   1017     /* flag to indicate unifrom spacing of tiles */
   1018     WORD32 i4_uniform_spacing_flag;
   1019 
   1020     /* num syntactical tiles in a frame */
   1021     WORD32 i4_num_tile_cols;
   1022     WORD32 i4_num_tile_rows;
   1023 
   1024     /* Column width array to store width of each tile column */
   1025     WORD32 ai4_column_width[MAX_TILE_COLUMNS];
   1026 
   1027     /* Row height array to store height of each tile row */
   1028     WORD32 ai4_row_height[MAX_TILE_ROWS];
   1029 
   1030 } ihevce_app_tile_params_t;
   1031 
   1032 /**
   1033  *  @brief    Structure to describe slice params
   1034  */
   1035 typedef struct
   1036 {
   1037     /** Kept for maintaining backwards compatibility in future */
   1038     WORD32 i4_size;
   1039 
   1040     /** Flag to control dependent slices.
   1041     0: Disable all slice segment limits
   1042     1: Enforce max number of CTBs
   1043     2: Enforce max number of bytes **/
   1044     WORD32 i4_slice_segment_mode;
   1045 
   1046     /** Depending on i4_slice_segment_mode being:
   1047     1: max number of CTBs per slice segment
   1048     2: max number of bytes per slice segment **/
   1049     WORD32 i4_slice_segment_argument;
   1050 
   1051 } ihevce_slice_params_t;
   1052 
   1053 /**
   1054  *  @brief  Static configuration parameters of Encoder
   1055  */
   1056 typedef struct
   1057 {
   1058     /** Kept for maintaining backwards compatibility in future */
   1059     WORD32 i4_size;
   1060 
   1061     /** Structure describing the input parameters - Applciatiopn should populate
   1062      * maximum values in this structure . Run time values
   1063      * should always be lessthan create time values
   1064      */
   1065     ihevce_src_params_t s_src_prms;
   1066 
   1067     /** Parmeters for target use-case */
   1068     ihevce_tgt_layer_params_t s_tgt_lyr_prms;
   1069 
   1070     /** Output stream parameters */
   1071     ihevce_out_strm_params_t s_out_strm_prms;
   1072 
   1073     /** Coding parameters for the encoder */
   1074     ihevce_coding_params_t s_coding_tools_prms;
   1075 
   1076     /** Configurable parameters for Encoder */
   1077     ihevce_config_prms_t s_config_prms;
   1078 
   1079     /** VUI SEI app parameters*/
   1080     ihevce_vui_sei_params_t s_vui_sei_prms;
   1081 
   1082     /** Multi threads specific pamrameters */
   1083     ihevce_static_multi_thread_params_t s_multi_thrd_prms;
   1084 
   1085     /** Look-ahead processor related parameters */
   1086     ihevce_lap_params_t s_lap_prms;
   1087 
   1088     /** Save Recon flag */
   1089     WORD32 i4_save_recon;
   1090 
   1091     /** Compute PSNR Flag */
   1092     /*  0: No logs
   1093         1: (Frame level:Bits generation + POC) + (summary level: BitRate)
   1094         2: (Frame level:Bits generation + POC + Qp + Pic-type) + (summary level: BitRate + PSNR)
   1095     */
   1096     WORD32 i4_log_dump_level;
   1097 
   1098     WORD32 i4_enable_csv_dump;
   1099 
   1100     FILE *apF_csv_file[IHEVCE_MAX_NUM_RESOLUTIONS][IHEVCE_MAX_NUM_BITRATES];
   1101 
   1102     /** Enable Logo for Eval versions */
   1103     WORD32 i4_enable_logo;
   1104 
   1105     /* API structure for exporting console and file I/O operation */
   1106     ihevce_sys_api_t s_sys_api;
   1107 
   1108     /* Structure to describe multipass related params */
   1109     ihevce_pass_prms_t s_pass_prms;
   1110 
   1111     /* Structure to describe tile params */
   1112     ihevce_app_tile_params_t s_app_tile_params;
   1113 
   1114     /** Structure to describe slice segment params */
   1115     ihevce_slice_params_t s_slice_params;
   1116 
   1117     /** Resolution ID of the current encoder context **/
   1118     WORD32 i4_res_id;
   1119 
   1120     /** Bitrate ID of the current encoder context **/
   1121     WORD32 i4_br_id;
   1122 
   1123     /* Architecture type */
   1124     IV_ARCH_T e_arch_type;
   1125 
   1126     /* Control to free the entropy output buffers   */
   1127     /* 1  for non_blocking mode */
   1128     /* and 0 for blocking mode */
   1129     WORD32 i4_outbuf_buf_free_control;
   1130 
   1131 } ihevce_static_cfg_params_t;
   1132 
   1133 /**
   1134  *  @brief  Input structure in which input data and
   1135  *          other parameters are sent to Encoder
   1136  */
   1137 typedef struct
   1138 {
   1139     /** Kept for maintaining backwards compatibility in future */
   1140     WORD32 i4_size;
   1141 
   1142     /** Buffer id for the current buffer */
   1143     WORD32 i4_buf_id;
   1144 
   1145     /** is bottom field  0 = top field,  1 = bottom field  */
   1146     WORD32 i4_bottom_field;
   1147 
   1148     /** top field first input in case of interlaced case */
   1149     WORD32 i4_topfield_first;
   1150 
   1151     /** input time stamp in terms of ticks: lower 32  */
   1152     WORD32 i4_inp_timestamp_low;
   1153 
   1154     /** input time stamp in terms of ticks: higher 32 */
   1155     WORD32 i4_inp_timestamp_high;
   1156 
   1157     /**  colour format of input,
   1158      * should be same as create time value
   1159      */
   1160     WORD32 u1_colour_format;
   1161 
   1162     /**
   1163      * Input frame buffer valid flag
   1164      * 1 : valid data is present in the s_input_buf
   1165      * 0 : Only command buffer is valid input buffer is a non valid input (dumy input)
   1166      */
   1167     WORD32 i4_inp_frm_data_valid_flag;
   1168 
   1169     /** Synchronous control commands buffer
   1170      * this will an Tag Length Value (TLV) buffer.
   1171      * All commands must be terminated with a tag
   1172      * Tag should be set to IHEVCE_SYNCH_API_END_TAG
   1173      */
   1174     void *pv_synch_ctrl_bufs;
   1175 
   1176     /**
   1177      * Synchronous control commands buffer
   1178      * size in number of bytes
   1179      */
   1180     WORD32 i4_cmd_buf_size;
   1181 
   1182     /** for system use if run time buffer allocation is used*/
   1183     void *pv_metadata;
   1184 
   1185     /** for system to pass frame context from Input to Output
   1186        Same pointer will be returned on the output buffer of this frame */
   1187     void *pv_app_frm_ctxt;
   1188 
   1189     /** Input YUV buffers pointers and related parameters
   1190      *   are set in this structure
   1191      */
   1192     iv_yuv_buf_t s_input_buf;
   1193 
   1194 } iv_input_data_ctrl_buffs_t;
   1195 
   1196 /**
   1197  *  @brief  Input structure in which input async control
   1198  *          commands are sent to Encoder
   1199  */
   1200 typedef struct
   1201 {
   1202     /** Kept for maintaining backwards compatibility in future */
   1203     WORD32 i4_size;
   1204 
   1205     /** Buffer id for the current buffer */
   1206     WORD32 i4_buf_id;
   1207 
   1208     /** Asynchronous control commands buffer
   1209      * this will an Tag Length Value (TLV) buffer.
   1210      * The buffer must be ended with a IHEVCE_ASYNCH_API_END_TAG
   1211      */
   1212     void *pv_asynch_ctrl_bufs;
   1213 
   1214     /**
   1215     * Asynchronous control commands buffer
   1216     * size in number of bytes
   1217     */
   1218     WORD32 i4_cmd_buf_size;
   1219 
   1220 } iv_input_ctrl_buffs_t;
   1221 
   1222 /**
   1223  *  @brief  Ouput structure in which ouput data
   1224  *          and related parameters are sent from Encoder
   1225  */
   1226 typedef struct
   1227 {
   1228     /** Kept for maintaining backwards compatibility in future */
   1229     WORD32 i4_size;
   1230 
   1231     /** Buffer id for the current buffer */
   1232     WORD32 i4_buf_id;
   1233 
   1234     /** processing status of the current output returned */
   1235     WORD32 i4_process_ret_sts;
   1236 
   1237     /** if error encountered the  error code */
   1238     WORD32 i4_process_error_code;
   1239 
   1240     /** picture type of the current encoded output */
   1241     IV_PICTURE_CODING_TYPE_T i4_encoded_frame_type;
   1242 
   1243     /** output time stamp of curr encoded buffer : lower 32  */
   1244     WORD32 i4_out_timestamp_low;
   1245 
   1246     /** output time stamp of curr encoded buffer : higher 32  */
   1247     WORD32 i4_out_timestamp_high;
   1248 
   1249     /** skip status of the current encoded output */
   1250     WORD32 i4_frame_skipped;
   1251 
   1252     /** bytes generated in the output buffer */
   1253     WORD32 i4_bytes_generated;
   1254 
   1255     /** End flag to communicate this is last frame output from encoder */
   1256     WORD32 i4_end_flag;
   1257 
   1258     /** End flag to communicate encoder that this is the last buffer from application
   1259         1 - Last buf, 0 - Not last buffer. No other values are supported.
   1260         Application has to set the appropriate value before queing in encoder queue */
   1261     WORD32 i4_is_last_buf;
   1262 
   1263     /** DBF level after the dynamic bitrate change
   1264         -1 - Value not set by codec
   1265         Encoder sets to positive value when bitrate change control call is done*/
   1266     LWORD64 i8_cur_vbv_level;
   1267 
   1268     /** Output buffer pointer */
   1269     void *pv_bitstream_bufs;
   1270 
   1271     /** Output buffer size */
   1272     WORD32 i4_bitstream_buf_size;
   1273 
   1274     /** Can be used for tracking purpose if run time buffer allocation is used*/
   1275     void *pv_metadata;
   1276 
   1277     /** for system to retrive frame context from Input to Output */
   1278     void *pv_app_frm_ctxt;
   1279 
   1280     /** Can be used for tracking the buffer that is sent back during callback */
   1281     WORD32 i4_cb_buf_id;
   1282 
   1283     /** Number of Prefix Non-VCL NAL units in the output buffer */
   1284     WORD32 i4_num_non_vcl_prefix_nals;
   1285 
   1286     /** Number of Suffix Non-VCL NAL units in the output buffer */
   1287     WORD32 i4_num_non_vcl_suffix_nals;
   1288 
   1289     /** Number of VCL NAL units in the output buffer */
   1290     WORD32 i4_num_vcl_nals;
   1291 
   1292     /************************************************************************/
   1293     /* Size of each NAL based on type: Non-VCL Prefix/ VCL / Non-VCL Suffix */
   1294     /*                                                                      */
   1295     /* Ordering of NALS in output buffer is as follows:                     */
   1296     /* Non-VCL Prefix NALs ->  VCL NALs -> Non-VCL Suffix NALs              */
   1297     /*                                                                      */
   1298     /* As there are no holes between adjacent NALs, these sizes can be used */
   1299     /* to compute the offsets w.r.t start of the output buffer              */
   1300     /************************************************************************/
   1301 
   1302     /** Array to the store the size in bytes of Prefix Non-VCL NAL units */
   1303     WORD32 ai4_size_non_vcl_prefix_nals[MAX_NUM_PREFIX_NALS_PER_AU];
   1304 
   1305     /* Array to the store the size in bytes of Suffix Non-VCL NAL units */
   1306     WORD32 ai4_size_non_vcl_suffix_nals[MAX_NUM_SUFFIX_NALS_PER_AU];
   1307 
   1308     /** Array to the store the size in bytes of VCL NAL units */
   1309     WORD32 ai4_size_vcl_nals[MAX_NUM_VCL_NALS_PER_AU];
   1310 
   1311 } iv_output_data_buffs_t;
   1312 
   1313 /**
   1314  *  @brief  Output structure in which output async control
   1315  *          acknowledgement are sent from Encoder
   1316  */
   1317 typedef struct
   1318 {
   1319     /** Kept for maintaining backwards compatibility in future */
   1320     WORD32 i4_size;
   1321 
   1322     /** Buffer id for the current buffer */
   1323     WORD32 i4_buf_id;
   1324 
   1325     /** Asynchronous control commands ack buffer
   1326      * this will an Tag Length Value (TLV) buffer.
   1327      */
   1328     void *pv_status_bufs;
   1329 
   1330 } iv_output_status_buffs_t;
   1331 
   1332 /**
   1333  *  @brief  structure in which recon data
   1334  *          and related parameters are sent from Encoder
   1335  */
   1336 typedef struct
   1337 {
   1338     /** Kept for maintaining backwards compatibility in future */
   1339     WORD32 i4_size;
   1340 
   1341     /** Buffer id for the current buffer */
   1342     WORD32 i4_buf_id;
   1343 
   1344     /** POC of the current buffer */
   1345     WORD32 i4_poc;
   1346 
   1347     /** End flag to communicate this is last frame output from encoder */
   1348     WORD32 i4_end_flag;
   1349 
   1350     /** End flag to communicate encoder that this is the last buffer from application
   1351         1 - Last buf, 0 - Not last buffer. No other values are supported.
   1352         Application has to set the appropriate value before queing in encoder queue */
   1353     WORD32 i4_is_last_buf;
   1354 
   1355     /** Recon luma buffer pointer */
   1356     void *pv_y_buf;
   1357 
   1358     /** Recon cb buffer pointer */
   1359     void *pv_cb_buf;
   1360 
   1361     /** Recon cr buffer pointer */
   1362     void *pv_cr_buf;
   1363 
   1364     /** Luma size **/
   1365     WORD32 i4_y_pixels;
   1366 
   1367     /** Chroma size **/
   1368     WORD32 i4_uv_pixels;
   1369 
   1370 } iv_recon_data_buffs_t;
   1371 
   1372 /* @brief iv_res_layer_output_bufs_req_t: This structure contains the parameters
   1373  * related to output (data and control) buffer requirements of the codec for all
   1374  * target resolution layers
   1375  * Application can call the memory query API to get these requirements
   1376  */
   1377 
   1378 typedef struct
   1379 {
   1380     /** i4_size of the structure : used for verison tracking */
   1381     WORD32 i4_size;
   1382 
   1383     /*Memory requirements for each of target resolutions*/
   1384     iv_output_bufs_req_t s_output_buf_req[IHEVCE_MAX_NUM_RESOLUTIONS][IHEVCE_MAX_NUM_BITRATES];
   1385 
   1386 } iv_res_layer_output_bufs_req_t;
   1387 
   1388 /* @brief iv_res_layer_recon_bufs_req_t: This structure contains the parameters
   1389  * related to recon buffer requirements of the codec for all target resolution layers
   1390  * Application can call the memory query API to get these requirements
   1391  */
   1392 
   1393 typedef struct
   1394 {
   1395     /** i4_size of the structure : used for verison tracking */
   1396     WORD32 i4_size;
   1397 
   1398     /*Memory requirements for each of target resolutions*/
   1399     iv_recon_bufs_req_t s_recon_buf_req[IHEVCE_MAX_NUM_RESOLUTIONS][IHEVCE_MAX_NUM_BITRATES];
   1400 } iv_res_layer_recon_bufs_req_t;
   1401 
   1402 /* @brief iv_res_layer_output_data_buffs_desc_t: This structure contains
   1403  * the parameters related to output data buffers for all target resolution layers
   1404  */
   1405 
   1406 typedef struct
   1407 {
   1408     /** i4_size of the structure : used for verison tracking */
   1409     WORD32 i4_size;
   1410 
   1411     /*Output buffer requirements of each taregt resolution layer*/
   1412     iv_output_data_buffs_desc_t s_output_data_buffs[IHEVCE_MAX_NUM_RESOLUTIONS]
   1413                                                    [IHEVCE_MAX_NUM_BITRATES];
   1414 
   1415 } iv_res_layer_output_data_buffs_desc_t;
   1416 
   1417 /* @brief iv_res_layer_output_status_buffs_desc_t: This structure contains
   1418  * the parameters related to recon data buffers for all target resolution layers
   1419  */
   1420 
   1421 typedef struct
   1422 {
   1423     /** i4_size of the structure : used for verison tracking */
   1424     WORD32 i4_size;
   1425 
   1426     /*Output buffer requirements of each taregt resolution layer*/
   1427     iv_recon_data_buffs_desc_t s_recon_data_buffs[IHEVCE_MAX_NUM_RESOLUTIONS]
   1428                                                  [IHEVCE_MAX_NUM_BITRATES];
   1429 
   1430 } iv_res_layer_recon_data_buffs_desc_t;
   1431 
   1432 #endif  // _IHEVCE_API_H_
   1433