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_ipe_pass.h
     23 *
     24 * \brief
     25 *    This file contains interface defination of Encode loop pass function
     26 *
     27 * \date
     28 *    18/09/2012
     29 *
     30 * \author
     31 *    Ittiam
     32 *
     33 ******************************************************************************
     34 */
     35 
     36 #ifndef _IHEVCE_IPE_PASS_H_
     37 #define _IHEVCE_IPE_PASS_H_
     38 
     39 /*****************************************************************************/
     40 /* Constant Macros                                                           */
     41 /*****************************************************************************/
     42 #define IPE_TEST_DBG_L0 0
     43 #define IPE_TEST_DBG_L1 0
     44 #define IPE_TEST_DBG_L2 0
     45 #define IPE_TEST_DBG_L3 0
     46 #define IPE_TEST_DBG_L4 0
     47 
     48 #define IPE_ME_DBG_L0 0
     49 #define IPE_ME_DBG_L1 0
     50 
     51 #define INTRA_PART_DBG 0  // Dump Debug Information related to intra partitioning
     52 
     53 #define INTRA_NON_CTB_PIC_DBG 0
     54 
     55 #define IPE_MODE_MAP_DBG 0
     56 
     57 #define FAST_INTRA_8421_MODES_ENABLE 1
     58 
     59 #define FAST_PART_WITH_OPTION_4 1
     60 
     61 #define IPE_SAD_TYPE 0 /* 0 => Hadamard SAD, 1 => full SAD */
     62 #define IPE_STEP_SIZE 1 /* Intra Prediction Mode Step Size During Analysis */
     63 #define LAMBDA_DIV_FACTOR 1
     64 
     65 /*satd/q_scale is accumualted cu level*/
     66 #define SATD_BY_ACT_Q_FAC 10
     67 
     68 /** defines the ratio of bits generated per cabac bin in Q8 format */
     69 #define CABAC_BITS_PER_BIN 192
     70 
     71 /** define modulation factor for qp modulation */
     72 #define INTRA_QP_MOD_FACTOR_NUM 16
     73 #define INTER_QP_MOD_FACTOR_NUM 4
     74 #define QP_MOD_FACTOR_DEN 2
     75 
     76 /*****************************************************************************/
     77 /* Function Macros                                                           */
     78 /*****************************************************************************/
     79 
     80 /*****************************************************************************/
     81 /* Typedefs                                                                  */
     82 /*****************************************************************************/
     83 
     84 /*****************************************************************************/
     85 /* Enums                                                                     */
     86 /*****************************************************************************/
     87 typedef enum
     88 {
     89     CU_1TU = 0,
     90     CU_4TU,
     91     SUB_CU_1TU,
     92     SUB_CU_4TU
     93 } IPE_CU_TU_SPLIT_PATTERN;
     94 
     95 /*****************************************************************************/
     96 /* Structure                                                                 */
     97 /*****************************************************************************/
     98 
     99 /*****************************************************************************/
    100 /* Extern Variable Declarations                                              */
    101 /*****************************************************************************/
    102 
    103 /*****************************************************************************/
    104 /* Extern Function Declarations                                              */
    105 /*****************************************************************************/
    106 WORD32 ihevce_ipe_get_num_mem_recs(void);
    107 
    108 WORD32
    109     ihevce_ipe_get_mem_recs(iv_mem_rec_t *ps_mem_tab, WORD32 i4_num_proc_thrds, WORD32 i4_mem_space);
    110 
    111 void *ihevce_ipe_init(
    112     iv_mem_rec_t *ps_mem_tab,
    113     ihevce_static_cfg_params_t *ps_init_prms,
    114     WORD32 i4_num_proc_thrds,
    115     WORD32 i4_ref_id,
    116     func_selector_t *ps_func_selector,
    117     rc_quant_t *ps_rc_quant_ctxt,
    118     WORD32 i4_resolution_id,
    119     UWORD8 u1_is_popcnt_available);
    120 
    121 void ihevce_intra_pred_ref_filtering(UWORD8 *pu1_src, WORD32 nt, UWORD8 *pu1_dst);
    122 void ihevce_intra_pred_ref_filtering(UWORD8 *pu1_src, WORD32 nt, UWORD8 *pu1_dst);
    123 
    124 UWORD32 ihevce_ipe_pass_satd(WORD16 *pi2_coeff, WORD32 coeff_stride, WORD32 trans_size);
    125 
    126 void ihevce_ipe_process(
    127     void *pv_ctxt,
    128     frm_ctb_ctxt_t *ps_frm_ctb_prms,
    129     frm_lambda_ctxt_t *ps_frm_lamda,
    130     ihevce_lap_enc_buf_t *ps_curr_inp,
    131     pre_enc_L0_ipe_encloop_ctxt_t *ps_L0_IPE_curr_out_pre_enc,
    132     ctb_analyse_t *ps_ctb_out,
    133     //cu_analyse_t     *ps_cu_out,
    134     ipe_l0_ctb_analyse_for_me_t *ps_ipe_ctb_out,
    135     void *pv_multi_thrd_ctxt,
    136     WORD32 slice_type,
    137     ihevce_ed_blk_t *ps_ed_pic_l1,
    138     ihevce_ed_blk_t *ps_ed_pic_l2,
    139     ihevce_ed_ctb_l1_t *ps_ed_ctb_l1_pic,
    140     WORD32 thrd_id,
    141     WORD32 i4_ping_pong);
    142 
    143 void ihevce_populate_ipe_ol_cu_lambda_prms(
    144     void *pv_ctxt,
    145     frm_lambda_ctxt_t *ps_frm_lamda,
    146     WORD32 i4_slice_type,
    147     WORD32 i4_temporal_lyr_id,
    148     WORD32 i4_lambda_type);
    149 
    150 void ihevce_get_ipe_ol_cu_lambda_prms(void *pv_ctxt, WORD32 i4_cur_cu_qp);
    151 
    152 void ihevce_populate_ipe_frame_init(
    153     void *pv_ctxt,
    154     ihevce_static_cfg_params_t *ps_stat_prms,
    155     WORD32 i4_curr_frm_qp,
    156     WORD32 i4_slice_type,
    157     WORD32 i4_thrd_id,
    158     pre_enc_me_ctxt_t *ps_curr_out,
    159     WORD8 i1_cu_qp_delta_enabled_flag,
    160     rc_quant_t *ps_rc_quant_ctxt,
    161     WORD32 i4_quality_preset,
    162     WORD32 i4_temporal_lyr_id,
    163     ihevce_lap_output_params_t *ps_lap_out);
    164 
    165 LWORD64 ihevce_ipe_get_frame_intra_satd_cost(
    166     void *pv_ctxt,
    167     LWORD64 *pi8_frame_satd_by_qpmod,
    168     LWORD64 *pi8_frame_acc_mode_bits_cost,
    169     LWORD64 *pi8_frame_acc_activity_factor,
    170     LWORD64 *pi8_frame_l0_acc_satd);
    171 #endif /* _IHEVCE_IPE_PASS_H_ */
    172