lin
2025-03-21 36aaa54056c4f4e150f6ee0636610d9a68470a08
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
/******************************************************************************
 *
 * Copyright (C) 2018 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at:
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 *****************************************************************************
 * Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
*/
/**
*******************************************************************************
* @file
*  hme_function_selector.c
*
* @brief
*  Contains functions to initialize function pointers used in hevc me
*
* @author
*  ittiam
*
* @par List of Functions:
*
*
* @remarks
*  None
*
*******************************************************************************
*/
/*****************************************************************************/
/* File Includes                                                             */
/*****************************************************************************/
/* System include files */
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
 
/* User include files */
#include "ihevc_typedefs.h"
#include "itt_video_api.h"
#include "ihevc_chroma_itrans_recon.h"
#include "ihevc_chroma_intra_pred.h"
#include "ihevc_debug.h"
#include "ihevc_deblk.h"
#include "ihevc_defs.h"
#include "ihevc_itrans_recon.h"
#include "ihevc_intra_pred.h"
#include "ihevc_inter_pred.h"
#include "ihevc_macros.h"
#include "ihevc_mem_fns.h"
#include "ihevc_padding.h"
#include "ihevc_quant_iquant_ssd.h"
#include "ihevc_resi_trans.h"
#include "ihevc_sao.h"
#include "ihevc_structs.h"
#include "ihevc_weighted_pred.h"
 
#include "rc_cntrl_param.h"
#include "rc_frame_info_collector.h"
#include "rc_look_ahead_params.h"
 
#include "ihevce_api.h"
#include "ihevce_defs.h"
#include "ihevce_lap_enc_structs.h"
#include "ihevce_multi_thrd_structs.h"
#include "ihevce_function_selector.h"
#include "ihevce_me_common_defs.h"
#include "ihevce_enc_structs.h"
#include "ihevce_had_satd.h"
#include "ihevce_cmn_utils_instr_set_router.h"
#include "ihevce_global_tables.h"
 
#include "hme_datatype.h"
#include "hme_common_defs.h"
#include "hme_common_utils.h"
#include "hme_interface.h"
#include "hme_defs.h"
#include "hme_err_compute.h"
#include "hme_globals.h"
 
#include "ihevce_me_instr_set_router.h"
 
/*****************************************************************************/
/* Extern Function Declarations                                              */
/*****************************************************************************/
 
// clang-format off
 
#ifdef ENABLE_NEON
FT_CALC_SATD_AND_RESULT hme_evalsatd_update_1_best_result_pt_pu_16x16_neon;
#endif
 
/*****************************************************************************/
/* Function Definitions                                                      */
/*****************************************************************************/
 
 
#ifdef ENABLE_NEON
void hme_init_function_ptr_neon(void *pv_me_context)
{
    me_master_ctxt_t *pv_me_ctxt = (me_master_ctxt_t *)pv_me_context;
 
    // clang-format off
    pv_me_ctxt->s_func_selector.pf_had_8x8_using_4_4x4_r = &ihevce_had_8x8_using_4_4x4_r_neon;
    pv_me_ctxt->s_func_selector.pf_had_16x16_r = &ihevce_had_16x16_r_neon;
    pv_me_ctxt->s_func_selector.pf_compute_32x32HAD_using_16x16 = &ihevce_compute_32x32HAD_using_16x16_neon;
    pv_me_ctxt->s_func_selector.pf_evalsatd_update_1_best_result_pt_pu_16x16_num_part_eq_1 = hme_evalsatd_update_1_best_result_pt_pu_16x16_neon;
    pv_me_ctxt->s_func_selector.pf_evalsatd_update_1_best_result_pt_pu_16x16_num_part_lt_9 = hme_evalsatd_update_1_best_result_pt_pu_16x16_neon;
    pv_me_ctxt->s_func_selector.pf_evalsatd_update_1_best_result_pt_pu_16x16_num_part_lt_17 = hme_evalsatd_update_1_best_result_pt_pu_16x16_neon;
    // clang-format on
}
#endif
 
void hme_init_function_ptr_generic(void *pv_me_context)
{
    me_master_ctxt_t *pv_me_ctxt = (me_master_ctxt_t *)pv_me_context;
 
    // clang-format off
    pv_me_ctxt->s_func_selector.pf_had_8x8_using_4_4x4_r = &ihevce_had_8x8_using_4_4x4_r;
    pv_me_ctxt->s_func_selector.pf_had_16x16_r = &ihevce_had_16x16_r;
    pv_me_ctxt->s_func_selector.pf_compute_32x32HAD_using_16x16 = &ihevce_compute_32x32HAD_using_16x16;
    pv_me_ctxt->s_func_selector.pf_evalsatd_update_1_best_result_pt_pu_16x16_num_part_eq_1 = hme_evalsatd_update_1_best_result_pt_pu_16x16;
    pv_me_ctxt->s_func_selector.pf_evalsatd_update_1_best_result_pt_pu_16x16_num_part_lt_9 = hme_evalsatd_update_1_best_result_pt_pu_16x16;
    pv_me_ctxt->s_func_selector.pf_evalsatd_update_1_best_result_pt_pu_16x16_num_part_lt_17 = hme_evalsatd_update_1_best_result_pt_pu_16x16;
    // clang-format on
}
 
void hme_init_function_ptr(void *pv_me_context, IV_ARCH_T e_processor_arch)
{
    switch(e_processor_arch)
    {
#ifdef ENABLE_NEON
    case ARCH_ARM_A9Q:
    case ARCH_ARM_V8_NEON:
        hme_init_function_ptr_neon(pv_me_context);
        break;
#endif
    default:
        hme_init_function_ptr_generic(pv_me_context);
        break;
    }
}