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
     23 *  ihevce_function_selector.c
     24 *
     25 * @brief
     26 *  Contains functions to initialize function pointers used in hevc
     27 *
     28 * @author
     29 *  ittiam
     30 *
     31 * @par List of Functions:
     32 *  ihevce_default_arch()
     33 *  ihevce_init_function_ptr_generic()
     34 *  ihevce_init_function_ptr_av8()
     35 *  ihevce_init_function_ptr_a9q()
     36 *  ihevce_init_function_ptr()
     37 *
     38 * @remarks
     39 *  None
     40 *
     41 *******************************************************************************
     42 */
     43 
     44 /*****************************************************************************/
     45 /* File Includes                                                             */
     46 /*****************************************************************************/
     47 /* System include files */
     48 #include <stdio.h>
     49 #include <string.h>
     50 #include <stddef.h>
     51 #include <stdlib.h>
     52 #include <assert.h>
     53 
     54 /* User include files */
     55 #include "ihevc_typedefs.h"
     56 #include "itt_video_api.h"
     57 #include "ihevce_api.h"
     58 
     59 #include "rc_cntrl_param.h"
     60 #include "rc_frame_info_collector.h"
     61 #include "rc_look_ahead_params.h"
     62 
     63 #include "ihevc_defs.h"
     64 #include "ihevc_structs.h"
     65 #include "ihevc_platform_macros.h"
     66 #include "ihevc_deblk.h"
     67 #include "ihevc_itrans_recon.h"
     68 #include "ihevc_chroma_itrans_recon.h"
     69 #include "ihevc_chroma_intra_pred.h"
     70 #include "ihevc_intra_pred.h"
     71 #include "ihevc_inter_pred.h"
     72 #include "ihevc_mem_fns.h"
     73 #include "ihevc_padding.h"
     74 #include "ihevc_weighted_pred.h"
     75 #include "ihevc_sao.h"
     76 #include "ihevc_resi_trans.h"
     77 #include "ihevc_quant_iquant_ssd.h"
     78 #include "ihevc_cabac_tables.h"
     79 
     80 #include "ihevce_defs.h"
     81 #include "ihevce_lap_enc_structs.h"
     82 #include "ihevce_multi_thrd_structs.h"
     83 #include "ihevce_multi_thrd_funcs.h"
     84 #include "ihevce_me_common_defs.h"
     85 #include "ihevce_had_satd.h"
     86 #include "ihevce_error_codes.h"
     87 #include "ihevce_bitstream.h"
     88 #include "ihevce_cabac.h"
     89 #include "ihevce_rdoq_macros.h"
     90 #include "ihevce_function_selector.h"
     91 #include "ihevce_enc_structs.h"
     92 #include "ihevce_cmn_utils_instr_set_router.h"
     93 
     94 /*****************************************************************************/
     95 /* Function Definitions                                                      */
     96 /*****************************************************************************/
     97 
     98 /*!
     99 ******************************************************************************
    100 * \if Function name : ihevce_default_arch \endif
    101 *
    102 * \brief
    103 *    Get Default architecture
    104 *
    105 *****************************************************************************
    106 */
    107 IV_ARCH_T ihevce_default_arch(void)
    108 {
    109 #if(defined(ENABLE_NEON) && defined(ARMV8))
    110     return ARCH_ARM_V8_NEON;
    111 #elif(defined(ENABLE_NEON) && defined(ARM))
    112     return ARCH_ARM_A9Q;
    113 #else
    114     return ARCH_ARM_NONEON;
    115 #endif
    116 }
    117 
    118 // clang-format off
    119 /*!
    120 ******************************************************************************
    121 * \if Function name : ihevce_init_function_ptr_generic \endif
    122 *
    123 * \brief
    124 *    Function pointer initialization of encoder context struct
    125 *
    126 *****************************************************************************
    127 */
    128 static void ihevce_init_function_ptr_generic(enc_ctxt_t *ps_enc_ctxt)
    129 {
    130     ps_enc_ctxt->s_func_selector.ihevc_deblk_chroma_horz_fptr = &ihevc_deblk_chroma_horz;
    131     ps_enc_ctxt->s_func_selector.ihevc_deblk_chroma_vert_fptr = &ihevc_deblk_chroma_vert;
    132     ps_enc_ctxt->s_func_selector.ihevc_deblk_422chroma_horz_fptr = &ihevc_deblk_422chroma_horz;
    133     ps_enc_ctxt->s_func_selector.ihevc_deblk_422chroma_vert_fptr = &ihevc_deblk_422chroma_vert;
    134     ps_enc_ctxt->s_func_selector.ihevc_deblk_luma_vert_fptr = &ihevc_deblk_luma_vert;
    135     ps_enc_ctxt->s_func_selector.ihevc_deblk_luma_horz_fptr = &ihevc_deblk_luma_horz;
    136     ps_enc_ctxt->s_func_selector.ihevc_inter_pred_chroma_copy_fptr = &ihevc_inter_pred_chroma_copy;
    137     ps_enc_ctxt->s_func_selector.ihevc_inter_pred_chroma_copy_w16out_fptr = &ihevc_inter_pred_chroma_copy_w16out;
    138     ps_enc_ctxt->s_func_selector.ihevc_inter_pred_chroma_horz_fptr = &ihevc_inter_pred_chroma_horz;
    139     ps_enc_ctxt->s_func_selector.ihevc_inter_pred_chroma_horz_w16out_fptr = &ihevc_inter_pred_chroma_horz_w16out;
    140     ps_enc_ctxt->s_func_selector.ihevc_inter_pred_chroma_vert_fptr = &ihevc_inter_pred_chroma_vert;
    141     ps_enc_ctxt->s_func_selector.ihevc_inter_pred_chroma_vert_w16inp_fptr = &ihevc_inter_pred_chroma_vert_w16inp;
    142     ps_enc_ctxt->s_func_selector.ihevc_inter_pred_chroma_vert_w16inp_w16out_fptr = &ihevc_inter_pred_chroma_vert_w16inp_w16out;
    143     ps_enc_ctxt->s_func_selector.ihevc_inter_pred_chroma_vert_w16out_fptr = &ihevc_inter_pred_chroma_vert_w16out;
    144     ps_enc_ctxt->s_func_selector.ihevc_inter_pred_luma_horz_fptr = &ihevc_inter_pred_luma_horz;
    145     ps_enc_ctxt->s_func_selector.ihevc_inter_pred_luma_vert_fptr = &ihevc_inter_pred_luma_vert;
    146     ps_enc_ctxt->s_func_selector.ihevc_inter_pred_luma_vert_w16out_fptr = &ihevc_inter_pred_luma_vert_w16out;
    147     ps_enc_ctxt->s_func_selector.ihevc_inter_pred_luma_vert_w16inp_fptr = &ihevc_inter_pred_luma_vert_w16inp;
    148     ps_enc_ctxt->s_func_selector.ihevc_inter_pred_luma_copy_fptr = &ihevc_inter_pred_luma_copy;
    149     ps_enc_ctxt->s_func_selector.ihevc_inter_pred_luma_copy_w16out_fptr = &ihevc_inter_pred_luma_copy_w16out;
    150     ps_enc_ctxt->s_func_selector.ihevc_inter_pred_luma_horz_w16out_fptr = &ihevc_inter_pred_luma_horz_w16out;
    151     ps_enc_ctxt->s_func_selector.ihevc_inter_pred_luma_vert_w16inp_w16out_fptr = &ihevc_inter_pred_luma_vert_w16inp_w16out;
    152     ps_enc_ctxt->s_func_selector.ihevc_intra_pred_chroma_ref_substitution_fptr = &ihevc_intra_pred_chroma_ref_substitution;
    153     ps_enc_ctxt->s_func_selector.ihevc_intra_pred_luma_ref_substitution_fptr = &ihevc_intra_pred_luma_ref_substitution;
    154     ps_enc_ctxt->s_func_selector.ihevc_intra_pred_ref_filtering_fptr = &ihevc_intra_pred_ref_filtering;
    155     ps_enc_ctxt->s_func_selector.ihevc_intra_pred_chroma_dc_fptr = &ihevc_intra_pred_chroma_dc;
    156     ps_enc_ctxt->s_func_selector.ihevc_intra_pred_chroma_horz_fptr = &ihevc_intra_pred_chroma_horz;
    157     ps_enc_ctxt->s_func_selector.ihevc_intra_pred_chroma_mode2_fptr = &ihevc_intra_pred_chroma_mode2;
    158     ps_enc_ctxt->s_func_selector.ihevc_intra_pred_chroma_mode_18_34_fptr = &ihevc_intra_pred_chroma_mode_18_34;
    159     ps_enc_ctxt->s_func_selector.ihevc_intra_pred_chroma_mode_27_to_33_fptr = &ihevc_intra_pred_chroma_mode_27_to_33;
    160     ps_enc_ctxt->s_func_selector.ihevc_intra_pred_chroma_mode_3_to_9_fptr = &ihevc_intra_pred_chroma_mode_3_to_9;
    161     ps_enc_ctxt->s_func_selector.ihevc_intra_pred_chroma_planar_fptr = &ihevc_intra_pred_chroma_planar;
    162     ps_enc_ctxt->s_func_selector.ihevc_intra_pred_chroma_ver_fptr = &ihevc_intra_pred_chroma_ver;
    163     ps_enc_ctxt->s_func_selector.ihevc_intra_pred_chroma_mode_11_to_17_fptr = &ihevc_intra_pred_chroma_mode_11_to_17;
    164     ps_enc_ctxt->s_func_selector.ihevc_intra_pred_chroma_mode_19_to_25_fptr = &ihevc_intra_pred_chroma_mode_19_to_25;
    165     ps_enc_ctxt->s_func_selector.ihevc_intra_pred_luma_mode_11_to_17_fptr = &ihevc_intra_pred_luma_mode_11_to_17;
    166     ps_enc_ctxt->s_func_selector.ihevc_intra_pred_luma_mode_19_to_25_fptr = &ihevc_intra_pred_luma_mode_19_to_25;
    167     ps_enc_ctxt->s_func_selector.ihevc_intra_pred_luma_dc_fptr = &ihevc_intra_pred_luma_dc;
    168     ps_enc_ctxt->s_func_selector.ihevc_intra_pred_luma_horz_fptr = &ihevc_intra_pred_luma_horz;
    169     ps_enc_ctxt->s_func_selector.ihevc_intra_pred_luma_mode2_fptr = &ihevc_intra_pred_luma_mode2;
    170     ps_enc_ctxt->s_func_selector.ihevc_intra_pred_luma_mode_18_34_fptr = &ihevc_intra_pred_luma_mode_18_34;
    171     ps_enc_ctxt->s_func_selector.ihevc_intra_pred_luma_mode_27_to_33_fptr = &ihevc_intra_pred_luma_mode_27_to_33;
    172     ps_enc_ctxt->s_func_selector.ihevc_intra_pred_luma_mode_3_to_9_fptr = &ihevc_intra_pred_luma_mode_3_to_9;
    173     ps_enc_ctxt->s_func_selector.ihevc_intra_pred_luma_planar_fptr = &ihevc_intra_pred_luma_planar;
    174     ps_enc_ctxt->s_func_selector.ihevc_intra_pred_luma_ver_fptr = &ihevc_intra_pred_luma_ver;
    175 
    176     ps_enc_ctxt->s_func_selector.ihevc_itrans_recon_4x4_ttype1_fptr = &ihevc_itrans_recon_4x4_ttype1;
    177     ps_enc_ctxt->s_func_selector.ihevc_itrans_recon_4x4_fptr = &ihevc_itrans_recon_4x4;
    178     ps_enc_ctxt->s_func_selector.ihevc_itrans_recon_8x8_fptr = &ihevc_itrans_recon_8x8;
    179     ps_enc_ctxt->s_func_selector.ihevc_itrans_recon_16x16_fptr = &ihevc_itrans_recon_16x16;
    180     ps_enc_ctxt->s_func_selector.ihevc_itrans_recon_32x32_fptr = &ihevc_itrans_recon_32x32;
    181     ps_enc_ctxt->s_func_selector.ihevc_chroma_itrans_recon_4x4_fptr = &ihevc_chroma_itrans_recon_4x4;
    182     ps_enc_ctxt->s_func_selector.ihevc_chroma_itrans_recon_8x8_fptr = &ihevc_chroma_itrans_recon_8x8;
    183     ps_enc_ctxt->s_func_selector.ihevc_chroma_itrans_recon_16x16_fptr = &ihevc_chroma_itrans_recon_16x16;
    184 
    185     ps_enc_ctxt->s_func_selector.ihevc_memcpy_mul_8_fptr = &ihevc_memcpy_mul_8;
    186     ps_enc_ctxt->s_func_selector.ihevc_memcpy_fptr = &ihevc_memcpy;
    187     ps_enc_ctxt->s_func_selector.ihevc_memset_mul_8_fptr = &ihevc_memset_mul_8;
    188     ps_enc_ctxt->s_func_selector.ihevc_memset_fptr = &ihevc_memset;
    189     ps_enc_ctxt->s_func_selector.ihevc_memset_16bit_mul_8_fptr = &ihevc_memset_16bit_mul_8;
    190     ps_enc_ctxt->s_func_selector.ihevc_memset_16bit_fptr = &ihevc_memset_16bit;
    191 
    192     ps_enc_ctxt->s_func_selector.ihevc_weighted_pred_bi_fptr = &ihevc_weighted_pred_bi;
    193     ps_enc_ctxt->s_func_selector.ihevc_weighted_pred_bi_default_fptr = &ihevc_weighted_pred_bi_default;
    194     ps_enc_ctxt->s_func_selector.ihevc_weighted_pred_uni_fptr = &ihevc_weighted_pred_uni;
    195     ps_enc_ctxt->s_func_selector.ihevc_weighted_pred_chroma_bi_fptr = &ihevc_weighted_pred_chroma_bi;
    196     ps_enc_ctxt->s_func_selector.ihevc_weighted_pred_chroma_bi_default_fptr = &ihevc_weighted_pred_chroma_bi_default;
    197     ps_enc_ctxt->s_func_selector.ihevc_weighted_pred_chroma_uni_fptr = &ihevc_weighted_pred_chroma_uni;
    198 
    199     ps_enc_ctxt->s_func_selector.ihevc_resi_trans_4x4_ttype1_fptr = &ihevc_resi_trans_4x4_ttype1;
    200     ps_enc_ctxt->s_func_selector.ihevc_resi_trans_4x4_fptr = &ihevc_resi_trans_4x4;
    201     ps_enc_ctxt->s_func_selector.ihevc_resi_trans_8x8_fptr = &ihevc_resi_trans_8x8;
    202     ps_enc_ctxt->s_func_selector.ihevc_resi_trans_16x16_fptr = &ihevc_resi_trans_16x16;
    203     ps_enc_ctxt->s_func_selector.ihevc_resi_trans_32x32_fptr = &ihevc_resi_trans_32x32;
    204 
    205     ps_enc_ctxt->s_func_selector.ihevc_quant_iquant_ssd_fptr = &ihevc_quant_iquant_ssd;
    206     ps_enc_ctxt->s_func_selector.ihevc_quant_iquant_ssd_rdoq_fptr = &ihevc_quant_iquant_ssd_rdoq;
    207     ps_enc_ctxt->s_func_selector.ihevc_quant_iquant_ssd_flat_scale_mat_fptr = &ihevc_quant_iquant_ssd_flat_scale_mat;
    208     ps_enc_ctxt->s_func_selector.ihevc_quant_iquant_ssd_flat_scale_mat_rdoq_fptr = &ihevc_quant_iquant_ssd_flat_scale_mat_rdoq;
    209     ps_enc_ctxt->s_func_selector.ihevc_q_iq_ssd_var_rnd_fact_fptr = &ihevc_q_iq_ssd_var_rnd_fact;
    210     ps_enc_ctxt->s_func_selector.ihevc_q_iq_ssd_flat_scale_mat_var_rnd_fact_fptr = &ihevc_q_iq_ssd_flat_scale_mat_var_rnd_fact;
    211 
    212     ps_enc_ctxt->s_func_selector.ihevc_quant_iquant_fptr = &ihevc_quant_iquant;
    213     ps_enc_ctxt->s_func_selector.ihevc_quant_iquant_rdoq_fptr = &ihevc_quant_iquant_rdoq;
    214     ps_enc_ctxt->s_func_selector.ihevc_quant_iquant_flat_scale_mat_fptr = &ihevc_quant_iquant_flat_scale_mat;
    215     ps_enc_ctxt->s_func_selector.ihevc_quant_iquant_flat_scale_mat_rdoq_fptr = &ihevc_quant_iquant_flat_scale_mat_rdoq;
    216     ps_enc_ctxt->s_func_selector.ihevc_q_iq_var_rnd_fact_fptr = &ihevc_q_iq_var_rnd_fact;
    217     ps_enc_ctxt->s_func_selector.ihevc_q_iq_flat_scale_mat_var_rnd_fact_fptr = &ihevc_q_iq_flat_scale_mat_var_rnd_fact;
    218     ps_enc_ctxt->s_func_selector.ihevc_pad_bottom_fptr = &ihevc_pad_bottom;
    219     ps_enc_ctxt->s_func_selector.ihevc_pad_horz_chroma_fptr = &ihevc_pad_horz_chroma;
    220     ps_enc_ctxt->s_func_selector.ihevc_pad_horz_luma_fptr = &ihevc_pad_horz_luma;
    221     ps_enc_ctxt->s_func_selector.ihevc_pad_left_chroma_fptr = &ihevc_pad_left_chroma;
    222     ps_enc_ctxt->s_func_selector.ihevc_pad_left_luma_fptr = &ihevc_pad_left_luma;
    223     ps_enc_ctxt->s_func_selector.ihevc_pad_right_chroma_fptr = &ihevc_pad_right_chroma;
    224     ps_enc_ctxt->s_func_selector.ihevc_pad_right_luma_fptr = &ihevc_pad_right_luma;
    225     ps_enc_ctxt->s_func_selector.ihevc_pad_top_fptr = &ihevc_pad_top;
    226     ps_enc_ctxt->s_func_selector.ihevc_pad_vert_fptr = &ihevc_pad_vert;
    227     ps_enc_ctxt->s_func_selector.ihevc_sao_edge_offset_class0_fptr = &ihevc_sao_edge_offset_class0;
    228     ps_enc_ctxt->s_func_selector.ihevc_sao_edge_offset_class1_fptr = &ihevc_sao_edge_offset_class1;
    229     ps_enc_ctxt->s_func_selector.ihevc_sao_edge_offset_class2_fptr = &ihevc_sao_edge_offset_class2;
    230     ps_enc_ctxt->s_func_selector.ihevc_sao_edge_offset_class3_fptr = &ihevc_sao_edge_offset_class3;
    231 
    232     ps_enc_ctxt->s_func_selector.ihevc_sao_edge_offset_class0_chroma_fptr = &ihevc_sao_edge_offset_class0_chroma;
    233     ps_enc_ctxt->s_func_selector.ihevc_sao_edge_offset_class1_chroma_fptr = &ihevc_sao_edge_offset_class1_chroma;
    234     ps_enc_ctxt->s_func_selector.ihevc_sao_edge_offset_class2_chroma_fptr = &ihevc_sao_edge_offset_class2_chroma;
    235     ps_enc_ctxt->s_func_selector.ihevc_sao_edge_offset_class3_chroma_fptr = &ihevc_sao_edge_offset_class3_chroma;
    236 }
    237 
    238 #ifdef ENABLE_NEON
    239 #ifdef ARMV8
    240 /*!
    241 ******************************************************************************
    242 * \if Function name : ihevce_init_function_ptr_av8 \endif
    243 *
    244 * \brief
    245 *    Function pointer initialization of encoder context struct
    246 *
    247 *****************************************************************************
    248 */
    249 static void ihevce_init_function_ptr_av8(enc_ctxt_t *ps_enc_ctxt)
    250 {
    251     ps_enc_ctxt->s_func_selector.ihevc_deblk_chroma_horz_fptr = &ihevc_deblk_chroma_horz_av8;
    252     ps_enc_ctxt->s_func_selector.ihevc_deblk_chroma_vert_fptr = &ihevc_deblk_chroma_vert_av8;
    253     ps_enc_ctxt->s_func_selector.ihevc_deblk_luma_vert_fptr = &ihevc_deblk_luma_vert_av8;
    254     ps_enc_ctxt->s_func_selector.ihevc_deblk_luma_horz_fptr = &ihevc_deblk_luma_horz_av8;
    255     ps_enc_ctxt->s_func_selector.ihevc_inter_pred_chroma_copy_fptr = &ihevc_inter_pred_chroma_copy_av8;
    256     ps_enc_ctxt->s_func_selector.ihevc_inter_pred_chroma_copy_w16out_fptr = &ihevc_inter_pred_chroma_copy_w16out_av8;
    257     ps_enc_ctxt->s_func_selector.ihevc_inter_pred_chroma_horz_fptr = &ihevc_inter_pred_chroma_horz;
    258     ps_enc_ctxt->s_func_selector.ihevc_inter_pred_chroma_horz_w16out_fptr = &ihevc_inter_pred_chroma_horz_w16out_av8;
    259     ps_enc_ctxt->s_func_selector.ihevc_inter_pred_chroma_vert_fptr = &ihevc_inter_pred_chroma_vert;
    260     ps_enc_ctxt->s_func_selector.ihevc_inter_pred_chroma_vert_w16inp_fptr = &ihevc_inter_pred_chroma_vert_w16inp_av8;
    261     ps_enc_ctxt->s_func_selector.ihevc_inter_pred_chroma_vert_w16inp_w16out_fptr = &ihevc_inter_pred_chroma_vert_w16inp_w16out_av8;
    262     ps_enc_ctxt->s_func_selector.ihevc_inter_pred_chroma_vert_w16out_fptr = &ihevc_inter_pred_chroma_vert_w16out_av8;
    263     ps_enc_ctxt->s_func_selector.ihevc_inter_pred_luma_horz_fptr = &ihevc_inter_pred_luma_horz_av8;
    264     ps_enc_ctxt->s_func_selector.ihevc_inter_pred_luma_vert_fptr = &ihevc_inter_pred_luma_vert_av8;
    265     ps_enc_ctxt->s_func_selector.ihevc_inter_pred_luma_vert_w16out_fptr = &ihevc_inter_pred_luma_vert_w16out_av8;
    266     ps_enc_ctxt->s_func_selector.ihevc_inter_pred_luma_vert_w16inp_fptr = &ihevc_inter_pred_luma_vert_w16inp_av8;
    267     ps_enc_ctxt->s_func_selector.ihevc_inter_pred_luma_copy_fptr = &ihevc_inter_pred_luma_copy_av8;
    268     ps_enc_ctxt->s_func_selector.ihevc_inter_pred_luma_copy_w16out_fptr = &ihevc_inter_pred_luma_copy_w16out_av8;
    269     ps_enc_ctxt->s_func_selector.ihevc_inter_pred_luma_horz_w16out_fptr = &ihevc_inter_pred_luma_horz_w16out_av8;
    270     ps_enc_ctxt->s_func_selector.ihevc_inter_pred_luma_vert_w16inp_w16out_fptr = &ihevc_inter_pred_luma_vert_w16inp_w16out_av8;
    271     ps_enc_ctxt->s_func_selector.ihevc_intra_pred_chroma_ref_substitution_fptr = &ihevc_intra_pred_chroma_ref_substitution;
    272     ps_enc_ctxt->s_func_selector.ihevc_intra_pred_luma_ref_substitution_fptr = &ihevc_intra_pred_luma_ref_substitution;
    273     ps_enc_ctxt->s_func_selector.ihevc_intra_pred_ref_filtering_fptr = &ihevc_intra_pred_ref_filtering_neonintr;
    274     ps_enc_ctxt->s_func_selector.ihevc_intra_pred_chroma_dc_fptr = &ihevc_intra_pred_chroma_dc_av8;
    275     ps_enc_ctxt->s_func_selector.ihevc_intra_pred_chroma_horz_fptr = &ihevc_intra_pred_chroma_horz_av8;
    276     ps_enc_ctxt->s_func_selector.ihevc_intra_pred_chroma_mode2_fptr = &ihevc_intra_pred_chroma_mode2_av8;
    277     ps_enc_ctxt->s_func_selector.ihevc_intra_pred_chroma_mode_18_34_fptr = &ihevc_intra_pred_chroma_mode_18_34_av8;
    278     ps_enc_ctxt->s_func_selector.ihevc_intra_pred_chroma_mode_27_to_33_fptr = &ihevc_intra_pred_chroma_mode_27_to_33_av8;
    279     ps_enc_ctxt->s_func_selector.ihevc_intra_pred_chroma_mode_3_to_9_fptr = &ihevc_intra_pred_chroma_mode_3_to_9_av8;
    280     ps_enc_ctxt->s_func_selector.ihevc_intra_pred_chroma_planar_fptr = &ihevc_intra_pred_chroma_planar_av8;
    281     ps_enc_ctxt->s_func_selector.ihevc_intra_pred_chroma_ver_fptr = &ihevc_intra_pred_chroma_ver_av8;
    282     ps_enc_ctxt->s_func_selector.ihevc_intra_pred_chroma_mode_11_to_17_fptr = &ihevc_intra_pred_chroma_mode_11_to_17_av8;
    283     ps_enc_ctxt->s_func_selector.ihevc_intra_pred_chroma_mode_19_to_25_fptr = &ihevc_intra_pred_chroma_mode_19_to_25_av8;
    284     ps_enc_ctxt->s_func_selector.ihevc_intra_pred_luma_mode_11_to_17_fptr = &ihevc_intra_pred_luma_mode_11_to_17_av8;
    285     ps_enc_ctxt->s_func_selector.ihevc_intra_pred_luma_mode_19_to_25_fptr = &ihevc_intra_pred_luma_mode_19_to_25_av8;
    286     ps_enc_ctxt->s_func_selector.ihevc_intra_pred_luma_dc_fptr = &ihevc_intra_pred_luma_dc_av8;
    287     ps_enc_ctxt->s_func_selector.ihevc_intra_pred_luma_horz_fptr = &ihevc_intra_pred_luma_horz_av8;
    288     ps_enc_ctxt->s_func_selector.ihevc_intra_pred_luma_mode2_fptr = &ihevc_intra_pred_luma_mode2_av8;
    289     ps_enc_ctxt->s_func_selector.ihevc_intra_pred_luma_mode_18_34_fptr = &ihevc_intra_pred_luma_mode_18_34_av8;
    290     ps_enc_ctxt->s_func_selector.ihevc_intra_pred_luma_mode_27_to_33_fptr = &ihevc_intra_pred_luma_mode_27_to_33_av8;
    291     ps_enc_ctxt->s_func_selector.ihevc_intra_pred_luma_mode_3_to_9_fptr = &ihevc_intra_pred_luma_mode_3_to_9_av8;
    292     ps_enc_ctxt->s_func_selector.ihevc_intra_pred_luma_planar_fptr = &ihevc_intra_pred_luma_planar_av8;
    293     ps_enc_ctxt->s_func_selector.ihevc_intra_pred_luma_ver_fptr = &ihevc_intra_pred_luma_ver_av8;
    294 
    295     ps_enc_ctxt->s_func_selector.ihevc_itrans_recon_4x4_ttype1_fptr = &ihevc_itrans_recon_4x4_ttype1_av8;
    296     ps_enc_ctxt->s_func_selector.ihevc_itrans_recon_4x4_fptr = &ihevc_itrans_recon_4x4_av8;
    297     ps_enc_ctxt->s_func_selector.ihevc_itrans_recon_8x8_fptr = &ihevc_itrans_recon_8x8_av8;
    298     ps_enc_ctxt->s_func_selector.ihevc_itrans_recon_16x16_fptr = &ihevc_itrans_recon_16x16_av8;
    299     ps_enc_ctxt->s_func_selector.ihevc_itrans_recon_32x32_fptr = &ihevc_itrans_recon_32x32;
    300 
    301     ps_enc_ctxt->s_func_selector.ihevc_memcpy_mul_8_fptr = &ihevc_memcpy_mul_8_av8;
    302     ps_enc_ctxt->s_func_selector.ihevc_memcpy_fptr = &ihevc_memcpy_av8;
    303     ps_enc_ctxt->s_func_selector.ihevc_memset_mul_8_fptr = &ihevc_memset_mul_8_av8;
    304     ps_enc_ctxt->s_func_selector.ihevc_memset_fptr = &ihevc_memset_av8;
    305     ps_enc_ctxt->s_func_selector.ihevc_memset_16bit_mul_8_fptr = &ihevc_memset_16bit_mul_8_av8;
    306     ps_enc_ctxt->s_func_selector.ihevc_memset_16bit_fptr = &ihevc_memset_16bit_av8;
    307 
    308     ps_enc_ctxt->s_func_selector.ihevc_weighted_pred_bi_fptr = &ihevc_weighted_pred_bi_av8;
    309     ps_enc_ctxt->s_func_selector.ihevc_weighted_pred_bi_default_fptr = &ihevc_weighted_pred_bi_default_av8;
    310     ps_enc_ctxt->s_func_selector.ihevc_weighted_pred_uni_fptr = &ihevc_weighted_pred_uni_av8;
    311     ps_enc_ctxt->s_func_selector.ihevc_weighted_pred_chroma_bi_fptr = &ihevc_weighted_pred_chroma_bi_neonintr;
    312     ps_enc_ctxt->s_func_selector.ihevc_weighted_pred_chroma_bi_default_fptr = &ihevc_weighted_pred_chroma_bi_default_neonintr;
    313     ps_enc_ctxt->s_func_selector.ihevc_weighted_pred_chroma_uni_fptr = &ihevc_weighted_pred_chroma_uni_neonintr;
    314 
    315     ps_enc_ctxt->s_func_selector.ihevc_resi_trans_4x4_ttype1_fptr = &ihevc_resi_trans_4x4_ttype1_neon;
    316     ps_enc_ctxt->s_func_selector.ihevc_resi_trans_4x4_fptr = &ihevc_resi_trans_4x4_neon;
    317     ps_enc_ctxt->s_func_selector.ihevc_resi_trans_8x8_fptr = &ihevc_resi_trans_8x8_neon;
    318     ps_enc_ctxt->s_func_selector.ihevc_resi_trans_16x16_fptr = &ihevc_resi_trans_16x16_neon;
    319     ps_enc_ctxt->s_func_selector.ihevc_resi_trans_32x32_fptr = &ihevc_resi_trans_32x32_neon;
    320 
    321     ps_enc_ctxt->s_func_selector.ihevc_quant_iquant_ssd_flat_scale_mat_fptr = &ihevc_quant_iquant_ssd_flat_scale_mat_neon;
    322     ps_enc_ctxt->s_func_selector.ihevc_q_iq_ssd_flat_scale_mat_var_rnd_fact_fptr = &ihevc_q_iq_ssd_flat_scale_mat_var_rnd_fact_neon;
    323 
    324     ps_enc_ctxt->s_func_selector.ihevc_sao_edge_offset_class0_fptr = &ihevc_sao_edge_offset_class0_av8;
    325     ps_enc_ctxt->s_func_selector.ihevc_sao_edge_offset_class1_fptr = &ihevc_sao_edge_offset_class1_av8;
    326     ps_enc_ctxt->s_func_selector.ihevc_sao_edge_offset_class2_fptr = &ihevc_sao_edge_offset_class2_av8;
    327     ps_enc_ctxt->s_func_selector.ihevc_sao_edge_offset_class3_fptr = &ihevc_sao_edge_offset_class3_av8;
    328 
    329     ps_enc_ctxt->s_func_selector.ihevc_sao_edge_offset_class0_chroma_fptr = &ihevc_sao_edge_offset_class0_chroma_av8;
    330     ps_enc_ctxt->s_func_selector.ihevc_sao_edge_offset_class1_chroma_fptr = &ihevc_sao_edge_offset_class1_chroma_av8;
    331     ps_enc_ctxt->s_func_selector.ihevc_sao_edge_offset_class2_chroma_fptr = &ihevc_sao_edge_offset_class2_chroma_av8;
    332     ps_enc_ctxt->s_func_selector.ihevc_sao_edge_offset_class3_chroma_fptr = &ihevc_sao_edge_offset_class3_chroma_av8;
    333 }
    334 
    335 #else
    336 
    337 /*!
    338 ******************************************************************************
    339 * \if Function name : ihevce_init_function_ptr_a9q \endif
    340 *
    341 * \brief
    342 *    Function pointer initialization of encoder context struct
    343 *
    344 *****************************************************************************
    345 */
    346 static void ihevce_init_function_ptr_a9q(enc_ctxt_t *ps_enc_ctxt)
    347 {
    348     ps_enc_ctxt->s_func_selector.ihevc_deblk_chroma_horz_fptr = &ihevc_deblk_chroma_horz_a9q;
    349     ps_enc_ctxt->s_func_selector.ihevc_deblk_chroma_vert_fptr = &ihevc_deblk_chroma_vert_a9q;
    350     ps_enc_ctxt->s_func_selector.ihevc_deblk_luma_vert_fptr = &ihevc_deblk_luma_vert_a9q;
    351     ps_enc_ctxt->s_func_selector.ihevc_deblk_luma_horz_fptr = &ihevc_deblk_luma_horz_a9q;
    352     ps_enc_ctxt->s_func_selector.ihevc_inter_pred_chroma_copy_fptr = &ihevc_inter_pred_chroma_copy_a9q;
    353     ps_enc_ctxt->s_func_selector.ihevc_inter_pred_chroma_copy_w16out_fptr = &ihevc_inter_pred_chroma_copy_w16out_a9q;
    354     ps_enc_ctxt->s_func_selector.ihevc_inter_pred_chroma_horz_fptr = &ihevc_inter_pred_chroma_horz;
    355     ps_enc_ctxt->s_func_selector.ihevc_inter_pred_chroma_horz_w16out_fptr = &ihevc_inter_pred_chroma_horz_w16out_a9q;
    356     ps_enc_ctxt->s_func_selector.ihevc_inter_pred_chroma_vert_fptr = &ihevc_inter_pred_chroma_vert_a9q;
    357     ps_enc_ctxt->s_func_selector.ihevc_inter_pred_chroma_vert_w16inp_fptr = &ihevc_inter_pred_chroma_vert_w16inp_a9q;
    358     ps_enc_ctxt->s_func_selector.ihevc_inter_pred_chroma_vert_w16inp_w16out_fptr = &ihevc_inter_pred_chroma_vert_w16inp_w16out_a9q;
    359     ps_enc_ctxt->s_func_selector.ihevc_inter_pred_chroma_vert_w16out_fptr = &ihevc_inter_pred_chroma_vert_w16out_a9q;
    360     ps_enc_ctxt->s_func_selector.ihevc_inter_pred_luma_horz_fptr = &ihevc_inter_pred_luma_horz_a9q;
    361     ps_enc_ctxt->s_func_selector.ihevc_inter_pred_luma_vert_fptr = &ihevc_inter_pred_luma_vert_a9q;
    362     ps_enc_ctxt->s_func_selector.ihevc_inter_pred_luma_vert_w16out_fptr = &ihevc_inter_pred_luma_vert_w16out_a9q;
    363     ps_enc_ctxt->s_func_selector.ihevc_inter_pred_luma_vert_w16inp_fptr = &ihevc_inter_pred_luma_vert_w16inp_a9q;
    364     ps_enc_ctxt->s_func_selector.ihevc_inter_pred_luma_copy_fptr = &ihevc_inter_pred_luma_copy_a9q;
    365     ps_enc_ctxt->s_func_selector.ihevc_inter_pred_luma_copy_w16out_fptr = &ihevc_inter_pred_luma_copy_w16out_a9q;
    366     ps_enc_ctxt->s_func_selector.ihevc_inter_pred_luma_horz_w16out_fptr = &ihevc_inter_pred_luma_horz_w16out_a9q;
    367     ps_enc_ctxt->s_func_selector.ihevc_inter_pred_luma_vert_w16inp_w16out_fptr = &ihevc_inter_pred_luma_vert_w16inp_w16out_a9q;
    368     ps_enc_ctxt->s_func_selector.ihevc_intra_pred_chroma_ref_substitution_fptr = &ihevc_intra_pred_chroma_ref_substitution;
    369     ps_enc_ctxt->s_func_selector.ihevc_intra_pred_luma_ref_substitution_fptr = &ihevc_intra_pred_luma_ref_substitution_a9q;
    370     ps_enc_ctxt->s_func_selector.ihevc_intra_pred_ref_filtering_fptr = &ihevc_intra_pred_ref_filtering;
    371     ps_enc_ctxt->s_func_selector.ihevc_intra_pred_chroma_dc_fptr = &ihevc_intra_pred_chroma_dc_a9q;
    372     ps_enc_ctxt->s_func_selector.ihevc_intra_pred_chroma_horz_fptr = &ihevc_intra_pred_chroma_horz_a9q;
    373     ps_enc_ctxt->s_func_selector.ihevc_intra_pred_chroma_mode2_fptr = &ihevc_intra_pred_chroma_mode2_a9q;
    374     ps_enc_ctxt->s_func_selector.ihevc_intra_pred_chroma_mode_18_34_fptr = &ihevc_intra_pred_chroma_mode_18_34_a9q;
    375     ps_enc_ctxt->s_func_selector.ihevc_intra_pred_chroma_mode_27_to_33_fptr = &ihevc_intra_pred_chroma_mode_27_to_33_a9q;
    376     ps_enc_ctxt->s_func_selector.ihevc_intra_pred_chroma_mode_3_to_9_fptr = &ihevc_intra_pred_chroma_mode_3_to_9_a9q;
    377     ps_enc_ctxt->s_func_selector.ihevc_intra_pred_chroma_planar_fptr = &ihevc_intra_pred_chroma_planar_a9q;
    378     ps_enc_ctxt->s_func_selector.ihevc_intra_pred_chroma_ver_fptr = &ihevc_intra_pred_chroma_ver_a9q;
    379     ps_enc_ctxt->s_func_selector.ihevc_intra_pred_chroma_mode_11_to_17_fptr = &ihevc_intra_pred_chroma_mode_11_to_17_a9q;
    380     ps_enc_ctxt->s_func_selector.ihevc_intra_pred_chroma_mode_19_to_25_fptr = &ihevc_intra_pred_chroma_mode_19_to_25_a9q;
    381     ps_enc_ctxt->s_func_selector.ihevc_intra_pred_luma_mode_11_to_17_fptr = &ihevc_intra_pred_luma_mode_11_to_17_a9q;
    382     ps_enc_ctxt->s_func_selector.ihevc_intra_pred_luma_mode_19_to_25_fptr = &ihevc_intra_pred_luma_mode_19_to_25_a9q;
    383     ps_enc_ctxt->s_func_selector.ihevc_intra_pred_luma_dc_fptr = &ihevc_intra_pred_luma_dc_a9q;
    384     ps_enc_ctxt->s_func_selector.ihevc_intra_pred_luma_horz_fptr = &ihevc_intra_pred_luma_horz_a9q;
    385     ps_enc_ctxt->s_func_selector.ihevc_intra_pred_luma_mode2_fptr = &ihevc_intra_pred_luma_mode2_a9q;
    386     ps_enc_ctxt->s_func_selector.ihevc_intra_pred_luma_mode_18_34_fptr = &ihevc_intra_pred_luma_mode_18_34_a9q;
    387     ps_enc_ctxt->s_func_selector.ihevc_intra_pred_luma_mode_27_to_33_fptr = &ihevc_intra_pred_luma_mode_27_to_33_a9q;
    388     ps_enc_ctxt->s_func_selector.ihevc_intra_pred_luma_mode_3_to_9_fptr = &ihevc_intra_pred_luma_mode_3_to_9_a9q;
    389     ps_enc_ctxt->s_func_selector.ihevc_intra_pred_luma_planar_fptr = &ihevc_intra_pred_luma_planar_a9q;
    390     ps_enc_ctxt->s_func_selector.ihevc_intra_pred_luma_ver_fptr = &ihevc_intra_pred_luma_ver_a9q;
    391 
    392     ps_enc_ctxt->s_func_selector.ihevc_itrans_recon_4x4_ttype1_fptr = &ihevc_itrans_recon_4x4_ttype1_a9q;
    393     ps_enc_ctxt->s_func_selector.ihevc_itrans_recon_4x4_fptr = &ihevc_itrans_recon_4x4_a9q;
    394     ps_enc_ctxt->s_func_selector.ihevc_itrans_recon_8x8_fptr = &ihevc_itrans_recon_8x8_a9q;
    395     ps_enc_ctxt->s_func_selector.ihevc_itrans_recon_16x16_fptr = &ihevc_itrans_recon_16x16_a9q;
    396     ps_enc_ctxt->s_func_selector.ihevc_itrans_recon_32x32_fptr = &ihevc_itrans_recon_32x32;
    397 
    398     ps_enc_ctxt->s_func_selector.ihevc_memcpy_mul_8_fptr = &ihevc_memcpy_mul_8_a9q;
    399     ps_enc_ctxt->s_func_selector.ihevc_memcpy_fptr = &ihevc_memcpy_a9q;
    400     ps_enc_ctxt->s_func_selector.ihevc_memset_mul_8_fptr = &ihevc_memset_mul_8_a9q;
    401     ps_enc_ctxt->s_func_selector.ihevc_memset_fptr = &ihevc_memset_a9q;
    402     ps_enc_ctxt->s_func_selector.ihevc_memset_16bit_mul_8_fptr = &ihevc_memset_16bit_mul_8_a9q;
    403     ps_enc_ctxt->s_func_selector.ihevc_memset_16bit_fptr = &ihevc_memset_16bit_a9q;
    404 
    405     ps_enc_ctxt->s_func_selector.ihevc_weighted_pred_bi_fptr = &ihevc_weighted_pred_bi_a9q;
    406     ps_enc_ctxt->s_func_selector.ihevc_weighted_pred_bi_default_fptr = &ihevc_weighted_pred_bi_default_a9q;
    407     ps_enc_ctxt->s_func_selector.ihevc_weighted_pred_uni_fptr = &ihevc_weighted_pred_uni_a9q;
    408     ps_enc_ctxt->s_func_selector.ihevc_weighted_pred_chroma_bi_fptr = &ihevc_weighted_pred_chroma_bi;
    409     ps_enc_ctxt->s_func_selector.ihevc_weighted_pred_chroma_bi_default_fptr = &ihevc_weighted_pred_chroma_bi_default;
    410     ps_enc_ctxt->s_func_selector.ihevc_weighted_pred_chroma_uni_fptr = &ihevc_weighted_pred_chroma_uni;
    411 
    412     ps_enc_ctxt->s_func_selector.ihevc_resi_trans_4x4_ttype1_fptr = &ihevc_resi_trans_4x4_ttype1_a9q;
    413     ps_enc_ctxt->s_func_selector.ihevc_resi_trans_4x4_fptr = &ihevc_resi_trans_4x4_a9q;
    414     ps_enc_ctxt->s_func_selector.ihevc_resi_trans_8x8_fptr = &ihevc_resi_trans_8x8_a9q;
    415     ps_enc_ctxt->s_func_selector.ihevc_resi_trans_16x16_fptr = &ihevc_resi_trans_16x16_a9q;
    416     ps_enc_ctxt->s_func_selector.ihevc_resi_trans_32x32_fptr = &ihevc_resi_trans_32x32_a9q;
    417 
    418     ps_enc_ctxt->s_func_selector.ihevc_quant_iquant_ssd_flat_scale_mat_fptr = &ihevc_quant_iquant_ssd_flat_scale_mat_neon;
    419     ps_enc_ctxt->s_func_selector.ihevc_q_iq_ssd_flat_scale_mat_var_rnd_fact_fptr = &ihevc_q_iq_ssd_flat_scale_mat_var_rnd_fact_neon;
    420 
    421     ps_enc_ctxt->s_func_selector.ihevc_sao_edge_offset_class0_fptr = &ihevc_sao_edge_offset_class0_a9q;
    422     ps_enc_ctxt->s_func_selector.ihevc_sao_edge_offset_class1_fptr = &ihevc_sao_edge_offset_class1_a9q;
    423     ps_enc_ctxt->s_func_selector.ihevc_sao_edge_offset_class2_fptr = &ihevc_sao_edge_offset_class2_a9q;
    424     ps_enc_ctxt->s_func_selector.ihevc_sao_edge_offset_class3_fptr = &ihevc_sao_edge_offset_class3_a9q;
    425 
    426     ps_enc_ctxt->s_func_selector.ihevc_sao_edge_offset_class0_chroma_fptr = &ihevc_sao_edge_offset_class0_chroma_a9q;
    427     ps_enc_ctxt->s_func_selector.ihevc_sao_edge_offset_class1_chroma_fptr = &ihevc_sao_edge_offset_class1_chroma_a9q;
    428     ps_enc_ctxt->s_func_selector.ihevc_sao_edge_offset_class2_chroma_fptr = &ihevc_sao_edge_offset_class2_chroma_a9q;
    429     ps_enc_ctxt->s_func_selector.ihevc_sao_edge_offset_class3_chroma_fptr = &ihevc_sao_edge_offset_class3_chroma_a9q;
    430 }
    431 #endif
    432 #endif
    433 // clang-format on
    434 
    435 /*!
    436 ******************************************************************************
    437 * \if Function name : ihevce_init_function_ptr \endif
    438 *
    439 * \brief
    440 *    Function pointer initialization of encoder context struct
    441 *
    442 *****************************************************************************
    443 */
    444 void ihevce_init_function_ptr(void *pv_enc_ctxt, IV_ARCH_T e_processor_arch)
    445 {
    446     (void)e_processor_arch;
    447     ihevce_init_function_ptr_generic(pv_enc_ctxt);
    448 #ifdef ENABLE_NEON
    449     switch(e_processor_arch)
    450     {
    451 #ifdef ARMV8
    452     case ARCH_ARM_V8_NEON:
    453         ihevce_init_function_ptr_av8(pv_enc_ctxt);
    454         break;
    455 #else
    456     case ARCH_ARM_A9Q:
    457         ihevce_init_function_ptr_a9q(pv_enc_ctxt);
    458         break;
    459 #endif
    460     default:
    461         break;
    462     }
    463 #endif
    464 }
    465