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_multi_thrd_structs.h
     23 *
     24 * \brief
     25 *    This file contains structure definations  of multi thread based processing
     26 *
     27 * \date
     28 *    18/09/2012
     29 *
     30 * \author
     31 *    Ittiam
     32 *
     33 ******************************************************************************
     34 */
     35 
     36 #ifndef _IHEVCE_MULTI_THRD_STRUCTS_H_
     37 #define _IHEVCE_MULTI_THRD_STRUCTS_H_
     38 
     39 /*****************************************************************************/
     40 /* File Includes                                                             */
     41 /*****************************************************************************/
     42 
     43 /*****************************************************************************/
     44 /* Constant Macros                                                           */
     45 /*****************************************************************************/
     46 /** Maximum number of modules on whose outputs any module's inputs are dependent */
     47 #define MAX_IN_DEP 80
     48 
     49 /** Maximum number of modules whose inputs are dependent on any module's outputs */
     50 #define MAX_OUT_DEP 80
     51 
     52 /*****************************************************************************/
     53 /* Function Macros                                                           */
     54 /*****************************************************************************/
     55 
     56 /*****************************************************************************/
     57 /* Typedefs                                                                  */
     58 /*****************************************************************************/
     59 
     60 /*****************************************************************************/
     61 /* Enums                                                                     */
     62 /*****************************************************************************/
     63 
     64 typedef enum
     65 {
     66     ME_JOB_ENC_LYR = 0,
     67     ENC_LOOP_JOB,
     68     ENC_LOOP_JOB1,
     69     ENC_LOOP_JOB2,
     70     ENC_LOOP_JOB3,
     71     ENC_LOOP_JOB4,  //MBR: enc_loop job instance created for each bit-rate.
     72     //change instances based on IHEVCE_MAX_NUM_BITRATES
     73 
     74     NUM_ENC_JOBS_QUES,
     75 
     76 } HEVCE_ENC_JOB_TYPES_T;
     77 
     78 typedef enum
     79 {
     80     DECOMP_JOB_LYR0 = 0,
     81     DECOMP_JOB_LYR1,
     82     DECOMP_JOB_LYR2,
     83     DECOMP_JOB_LYR3,
     84     ME_JOB_LYR4,
     85     ME_JOB_LYR3,
     86     ME_JOB_LYR2,
     87     ME_JOB_LYR1,
     88     IPE_JOB_LYR0,
     89 
     90     NUM_PRE_ENC_JOBS_QUES,
     91 
     92 } HEVCE_PRE_ENC_JOB_TYPES_T;
     93 
     94 /*****************************************************************************/
     95 /* Structure                                                                 */
     96 /*****************************************************************************/
     97 
     98 /**
     99 ******************************************************************************
    100  *  @brief     IPE Job parameters structure
    101 ******************************************************************************
    102  */
    103 typedef struct
    104 {
    105     /*!< Index of the CTB Row */
    106     WORD32 i4_ctb_row_no;
    107 
    108 } ipe_job_node_t;
    109 
    110 /**
    111 ******************************************************************************
    112  *  @brief     ME Job parameters structure
    113 ******************************************************************************
    114  */
    115 typedef struct
    116 {
    117     /** Index of the Vertical unit Row */
    118     WORD32 i4_vert_unit_row_no;
    119     WORD32 i4_tile_col_idx;
    120 
    121 } me_job_node_t;
    122 
    123 /**
    124 ******************************************************************************
    125  *  @brief     Encode Loop Job parameters structure
    126 ******************************************************************************
    127  */
    128 typedef struct
    129 {
    130     /** Index of the CTB Row */
    131     WORD32 i4_ctb_row_no;
    132     WORD32 i4_tile_col_idx;
    133     WORD32 i4_bitrate_instance_no;
    134 
    135 } enc_loop_job_node_t;
    136 
    137 /**
    138 ******************************************************************************
    139  *  @brief     Decomposition Job parameters structure
    140 ******************************************************************************
    141  */
    142 typedef struct
    143 {
    144     /** Index of the Vertical unit Row */
    145     WORD32 i4_vert_unit_row_no;
    146 
    147 } decomp_job_node_t;
    148 
    149 /**
    150 ******************************************************************************
    151  *  @brief     Union Job parameters structure
    152 ******************************************************************************
    153  */
    154 typedef union /* Make sure that the size is a multiple of 4 */
    155 {
    156     ipe_job_node_t s_ipe_job_info;
    157 
    158     me_job_node_t s_me_job_info;
    159 
    160     enc_loop_job_node_t s_enc_loop_job_info;
    161 
    162     decomp_job_node_t s_decomp_job_info;
    163 
    164 } job_info_t;
    165 
    166 /**
    167 ******************************************************************************
    168  *  @brief     Job Queue Element parameters structure
    169 ******************************************************************************
    170  */
    171 typedef struct
    172 {
    173     /** Array of flags indicating the input dependencies of the module.
    174       *      Flag set to 0 indicates that the input dependency is resolved.
    175       *     Processing can start only after all the flags are 0.
    176       *
    177             *    This has to be the first element of the array, MAX_IN_DEP has to be multiple of 4
    178             */
    179     UWORD8 au1_in_dep[MAX_IN_DEP];
    180 
    181     /** Pointer to the next link in the job queue */
    182     void *pv_next;
    183 
    184     /** Job information ctxt of the module */
    185     job_info_t s_job_info;
    186 
    187     /** Array of offsets for the output dependencies' pointers.
    188              *   Indicates the location where  the dependency flag needs to
    189              *   be set after the processing of the current NMB/row/slice
    190              */
    191     UWORD32 au4_out_ofsts[MAX_OUT_DEP];
    192 
    193     /** Number of input dependencies to be checked before starting current task */
    194     WORD32 i4_num_input_dep;
    195 
    196     /** Number of output dependencies to be updated after finishing current task */
    197     WORD32 i4_num_output_dep;
    198 
    199     /** indicates what type of task is to be    executed
    200      * [ME_JOB for layer 0,ENC_LOOP_JOB] are valid
    201      * -1 will be set if this hob task type is irrelevant
    202      */
    203     HEVCE_ENC_JOB_TYPES_T i4_task_type;
    204 
    205     /** indicates what type of task is to be    executed
    206      * [ME_JOB for coarse and refine layers, DECOMP Jobs  and IPE JOB] are valid
    207      * -1 will be set if this hob task type is irrelevant
    208      */
    209     HEVCE_PRE_ENC_JOB_TYPES_T i4_pre_enc_task_type;
    210 
    211 } job_queue_t;
    212 
    213 /**
    214 ******************************************************************************
    215  *  @brief     Job Queue Handle structure
    216 ******************************************************************************
    217  */
    218 typedef struct
    219 {
    220     /** Pointer to the next link in the job queue  */
    221     void *pv_next;
    222 
    223 } job_queue_handle_t;
    224 
    225 /*****************************************************************************/
    226 /* Extern Variable Declarations                                              */
    227 /*****************************************************************************/
    228 
    229 /*****************************************************************************/
    230 /* Extern Function Declarations                                              */
    231 /*****************************************************************************/
    232 
    233 #endif /* _IHEVCE_MULTI_THRD_STRUCTS_H_ */
    234