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_dep_mngr_interface.h
     23 *
     24 * \brief
     25 *    This file contains infertace prototypes of Sync manager functions
     26 *
     27 * \date
     28 *    13/12/2013
     29 *
     30 * \author
     31 *    Ittiam
     32 *
     33 ******************************************************************************
     34 */
     35 
     36 #ifndef _IHEVCE_DEPENDENCY_MANAGER_INTERFACE_H_
     37 #define _IHEVCE_DEPENDENCY_MANAGER_INTERFACE_H_
     38 
     39 /*****************************************************************************/
     40 /* Constant Macros                                                           */
     41 /*****************************************************************************/
     42 
     43 /*****************************************************************************/
     44 /* Function Macros                                                           */
     45 /*****************************************************************************/
     46 
     47 /*****************************************************************************/
     48 /* Typedefs                                                                  */
     49 /*****************************************************************************/
     50 
     51 /*****************************************************************************/
     52 /* Enums                                                                     */
     53 /*****************************************************************************/
     54 
     55 typedef enum
     56 {
     57     DEP_MNGR_FRM_FRM_SYNC = 0, /*!< To be used for multi threads Frame-
     58                                       Frame level sync, where threads entering
     59                                       a particular frame processing stage at
     60                                       a particular index waits for all the threads
     61                                       to complete the that stage at the same index
     62                                       in the previous  iteration
     63                                       Ex: Wait for Encloop at Index i frame
     64                                       to complete before starting encloop of
     65                                       MAX_NUM_ENCLOOP + i frame at Index i
     66                                       (FRAME LEVEl SYNCS)*/
     67 
     68     DEP_MNGR_ROW_FRM_SYNC, /*!< To be used for multi threads Row-
     69                                       Frame level sync, where multiple threads
     70                                       entering a particular frame processing stage at
     71                                       a particular index waits for corresponding
     72                                       row to be completely processed in the
     73                                       dependent stage
     74                                       Ex: Multiple threads Wait in ME at a
     75                                       particular row X (of Frame I)
     76                                       until encloop of row X in Frame I
     77                                       is completed
     78                                       (REVERSE ME DEPENDENCY SYNC)*/
     79 
     80     DEP_MNGR_ROW_ROW_SYNC, /*!< To be used for multi threads Row-
     81                                       Row level sync, where a thread
     82                                       entering a particular frame processing stage at
     83                                       a particular index waits for corresponding
     84                                       row to be processed til dependent position
     85                                       in the dependent stage
     86                                       Ex: (ENC LOOP to ME FORWARD Sync)
     87                                           ( TOP RIGHT SYNC) */
     88 
     89     DEP_MNGR_MAP_SYNC
     90 
     91 } DEP_MNGR_MODE_T;
     92 
     93 typedef enum
     94 {
     95     MAP_CTB_INIT = 0,
     96     MAP_CTB_RECON_DONE = 1,
     97     MAP_CTB_COMPLETE = 2,  //after hpel plane creation
     98 
     99 } DEP_MNGR_MAP_CTB_STATUS_T;
    100 
    101 /*****************************************************************************/
    102 /* Structure                                                                 */
    103 /*****************************************************************************/
    104 
    105 /*****************************************************************************/
    106 /* Extern Variable Declarations                                              */
    107 /*****************************************************************************/
    108 
    109 /*****************************************************************************/
    110 /* Extern Function Declarations                                              */
    111 /*****************************************************************************/
    112 
    113 /* Create APIs */
    114 WORD32 ihevce_dmgr_get_num_mem_recs(void);
    115 
    116 WORD32 ihevce_dmgr_get_mem_recs(
    117     iv_mem_rec_t *ps_mem_tab,
    118     WORD32 dep_mngr_mode, /* should be part of DEP_MNGR_MODE_T*/
    119     WORD32 max_num_vert_units,
    120     WORD32 num_tile_cols,
    121     WORD32 num_threads,
    122     WORD32 i4_mem_space);
    123 
    124 WORD32 ihevce_dmgr_map_get_mem_recs(
    125     iv_mem_rec_t *ps_mem_tab, WORD32 num_units, WORD32 num_threads, WORD32 i4_mem_space);
    126 
    127 void *ihevce_dmgr_init(
    128     iv_mem_rec_t *ps_mem_tab,
    129     void *pv_osal_handle,
    130     WORD32 dep_mngr_mode, /* should be part of DEP_MNGR_MODE_T*/
    131     WORD32 max_num_vert_units,
    132     WORD32 max_num_horz_units,
    133     WORD32 num_tile_cols,
    134     WORD32 num_threads,
    135     WORD32 sem_enable);
    136 
    137 void *ihevce_dmgr_map_init(
    138     iv_mem_rec_t *ps_mem_tab,
    139     WORD32 max_num_vert_units,
    140     WORD32 max_num_horz_units,
    141     WORD32 sem_enable,
    142     WORD32 num_threads,
    143     WORD32 ai4_tile_xtra_ctb[4]);
    144 
    145 void ihevce_dmgr_reg_sem_hdls(
    146     void *pv_dep_mngr_state, void **ppv_thread_sem_hdl, WORD32 num_threads);
    147 
    148 /* Row-Row sync Process APIs*/
    149 void ihevce_dmgr_rst_row_row_sync(void *pv_dep_mngr_state);
    150 
    151 WORD32 ihevce_dmgr_chk_row_row_sync(
    152     void *pv_dep_mngr_state,
    153     WORD32 cur_offset,
    154     WORD32 dep_offset,
    155     WORD32 dep_row,
    156     WORD32 cur_tile_col,
    157     WORD32 thrd_id);
    158 
    159 WORD32 ihevce_dmgr_set_row_row_sync(
    160     void *pv_dep_mngr_state, WORD32 cur_offset, WORD32 cur_row, WORD32 cur_tile_col);
    161 
    162 /* Row-Frame sync Process APIs*/
    163 void ihevce_dmgr_rst_row_frm_sync(void *pv_dep_mngr_state);
    164 
    165 /* Frame-Frame sync Process APIs*/
    166 void ihevce_dmgr_set_done_frm_frm_sync(void *pv_dep_mngr_state);
    167 
    168 void ihevce_dmgr_set_prev_done_frm_frm_sync(void *pv_dep_mngr_state);
    169 
    170 WORD32 ihevce_dmgr_chk_frm_frm_sync(void *pv_dep_mngr_state, WORD32 thrd_id);
    171 
    172 WORD32 ihevce_dmgr_update_frm_frm_sync(void *pv_dep_mngr_state);
    173 
    174 /* Map sync Process APIs*/
    175 void ihevce_dmgr_map_rst_sync(void *pv_dep_mngr_state);
    176 
    177 WORD32 ihevce_dmgr_map_chk_sync(
    178     void *pv_dep_mngr_state,
    179     WORD32 thrd_id,
    180     WORD32 offset_x,
    181     WORD32 offset_y,
    182     WORD32 i4_sr_ctb_x,
    183     WORD32 i4_sr_ctb_y);
    184 
    185 WORD32 ihevce_dmgr_map_set_sync(
    186     void *pv_dep_mngr_state, WORD32 offset_x, WORD32 offset_y, WORD32 e_map_value);
    187 
    188 /* Delete APIs */
    189 void ihevce_dmgr_del(void *pv_dep_mngr_state);
    190 
    191 #endif /* _IHEVCE_DEPENDENCY_MANAGER_INTERFACE_H_ */
    192