Coverage Report

Created: 2025-07-11 06:43

/src/libhevc/encoder/hme_function_selector.c
Line
Count
Source (jump to first uncovered line)
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
*  hme_function_selector.c
24
*
25
* @brief
26
*  Contains functions to initialize function pointers used in hevc me
27
*
28
* @author
29
*  ittiam
30
*
31
* @par List of Functions:
32
*
33
*
34
* @remarks
35
*  None
36
*
37
*******************************************************************************
38
*/
39
/*****************************************************************************/
40
/* File Includes                                                             */
41
/*****************************************************************************/
42
/* System include files */
43
#include <stdio.h>
44
#include <stdlib.h>
45
#include <assert.h>
46
47
/* User include files */
48
#include "ihevc_typedefs.h"
49
#include "itt_video_api.h"
50
#include "ihevc_chroma_itrans_recon.h"
51
#include "ihevc_chroma_intra_pred.h"
52
#include "ihevc_debug.h"
53
#include "ihevc_deblk.h"
54
#include "ihevc_defs.h"
55
#include "ihevc_itrans_recon.h"
56
#include "ihevc_intra_pred.h"
57
#include "ihevc_inter_pred.h"
58
#include "ihevc_macros.h"
59
#include "ihevc_mem_fns.h"
60
#include "ihevc_padding.h"
61
#include "ihevc_quant_iquant_ssd.h"
62
#include "ihevc_resi_trans.h"
63
#include "ihevc_sao.h"
64
#include "ihevc_structs.h"
65
#include "ihevc_weighted_pred.h"
66
67
#include "rc_cntrl_param.h"
68
#include "rc_frame_info_collector.h"
69
#include "rc_look_ahead_params.h"
70
71
#include "ihevce_api.h"
72
#include "ihevce_defs.h"
73
#include "ihevce_lap_enc_structs.h"
74
#include "ihevce_multi_thrd_structs.h"
75
#include "ihevce_function_selector.h"
76
#include "ihevce_me_common_defs.h"
77
#include "ihevce_enc_structs.h"
78
#include "ihevce_had_satd.h"
79
#include "ihevce_cmn_utils_instr_set_router.h"
80
#include "ihevce_global_tables.h"
81
82
#include "hme_datatype.h"
83
#include "hme_common_defs.h"
84
#include "hme_common_utils.h"
85
#include "hme_interface.h"
86
#include "hme_defs.h"
87
#include "hme_err_compute.h"
88
#include "hme_globals.h"
89
90
#include "ihevce_me_instr_set_router.h"
91
92
/*****************************************************************************/
93
/* Extern Function Declarations                                              */
94
/*****************************************************************************/
95
96
// clang-format off
97
98
#ifdef ENABLE_NEON
99
FT_CALC_SATD_AND_RESULT hme_evalsatd_update_1_best_result_pt_pu_16x16_neon;
100
#endif
101
102
/*****************************************************************************/
103
/* Function Definitions                                                      */
104
/*****************************************************************************/
105
106
107
#ifdef ENABLE_NEON
108
void hme_init_function_ptr_neon(void *pv_me_context)
109
{
110
    me_master_ctxt_t *pv_me_ctxt = (me_master_ctxt_t *)pv_me_context;
111
112
    // clang-format off
113
    pv_me_ctxt->s_func_selector.pf_had_8x8_using_4_4x4_r = &ihevce_had_8x8_using_4_4x4_r_neon;
114
    pv_me_ctxt->s_func_selector.pf_had_16x16_r = &ihevce_had_16x16_r_neon;
115
    pv_me_ctxt->s_func_selector.pf_compute_32x32HAD_using_16x16 = &ihevce_compute_32x32HAD_using_16x16_neon;
116
    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;
117
    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;
118
    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;
119
    // clang-format on
120
}
121
#endif
122
123
void hme_init_function_ptr_generic(void *pv_me_context)
124
8.92k
{
125
8.92k
    me_master_ctxt_t *pv_me_ctxt = (me_master_ctxt_t *)pv_me_context;
126
127
    // clang-format off
128
8.92k
    pv_me_ctxt->s_func_selector.pf_had_8x8_using_4_4x4_r = &ihevce_had_8x8_using_4_4x4_r;
129
8.92k
    pv_me_ctxt->s_func_selector.pf_had_16x16_r = &ihevce_had_16x16_r;
130
8.92k
    pv_me_ctxt->s_func_selector.pf_compute_32x32HAD_using_16x16 = &ihevce_compute_32x32HAD_using_16x16;
131
8.92k
    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;
132
8.92k
    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;
133
8.92k
    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;
134
    // clang-format on
135
8.92k
}
136
137
void hme_init_function_ptr(void *pv_me_context, IV_ARCH_T e_processor_arch)
138
8.92k
{
139
8.92k
    switch(e_processor_arch)
140
8.92k
    {
141
#ifdef ENABLE_NEON
142
    case ARCH_ARM_A9Q:
143
    case ARCH_ARM_V8_NEON:
144
        hme_init_function_ptr_neon(pv_me_context);
145
        break;
146
#endif
147
8.92k
    default:
148
8.92k
        hme_init_function_ptr_generic(pv_me_context);
149
8.92k
        break;
150
8.92k
    }
151
8.92k
}