xref: /aosp_15_r20/external/libavc/encoder/arm/ih264e_function_selector.c (revision 495ae853bb871d1e5a258cb02c2cc13cde8ddb9a)
1 /******************************************************************************
2  *
3  * Copyright (C) 2015 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 *******************************************************************************
23 * @file
24 *  ih264e_function_selector.c
25 *
26 * @brief
27 *  Contains functions to initialize function pointers used in h264
28 *
29 * @author
30 *  ittiam
31 *
32 * @par List of Functions:
33 *  - ih264e_init_function_ptr
34 *  - ih264e_default_arch
35 *
36 * @remarks
37 *  none
38 *
39 *******************************************************************************
40 */
41 
42 
43 /*****************************************************************************/
44 /* File Includes                                                             */
45 /*****************************************************************************/
46 
47 /* System Include Files */
48 #include <stdio.h>
49 #include <stddef.h>
50 #include <stdlib.h>
51 #include <string.h>
52 
53 /* User Include Files */
54 #include "ih264_typedefs.h"
55 #include "iv2.h"
56 #include "ive2.h"
57 
58 #include "ih264_macros.h"
59 #include "ih264_error.h"
60 #include "ih264_defs.h"
61 #include "ih264_mem_fns.h"
62 #include "ih264_padding.h"
63 #include "ih264_structs.h"
64 #include "ih264_size_defs.h"
65 #include "ih264_trans_quant_itrans_iquant.h"
66 #include "ih264_inter_pred_filters.h"
67 #include "ih264_intra_pred_filters.h"
68 #include "ih264_deblk_edge_filters.h"
69 #include "ih264_cabac_tables.h"
70 #include "ih264_platform_macros.h"
71 
72 #include "ime_defs.h"
73 #include "ime_distortion_metrics.h"
74 #include "ime_structs.h"
75 
76 #include "irc_cntrl_param.h"
77 #include "irc_frame_info_collector.h"
78 
79 #include "ih264e_error.h"
80 #include "ih264e_defs.h"
81 #include "ih264e_rate_control.h"
82 #include "ih264e_bitstream.h"
83 #include "ih264e_cabac_structs.h"
84 #include "ih264e_structs.h"
85 #include "ih264e_cabac.h"
86 #include "ih264e_platform_macros.h"
87 
88 
89 /*****************************************************************************/
90 /* Function Definitions                                                      */
91 /*****************************************************************************/
92 
93 /**
94 *******************************************************************************
95 *
96 * @brief Initialize the intra/inter/transform/deblk/entropy function pointers
97 *
98 * @par Description: the current routine initializes the function pointers of
99 * codec context basing on the architecture in use
100 *
101 * @param[in] ps_codec
102 *  Codec context pointer
103 *
104 * @returns  none
105 *
106 * @remarks none
107 *
108 *******************************************************************************
109 */
ih264e_init_function_ptr(void * pv_codec)110 void ih264e_init_function_ptr(void *pv_codec)
111 {
112     codec_t *ps_codec = (codec_t *)pv_codec;
113 
114     ih264e_init_function_ptr_generic(ps_codec);
115     switch(ps_codec->s_cfg.e_arch)
116     {
117 #if defined(ARMV8)
118         case ARCH_ARM_A53:
119         case ARCH_ARM_A57:
120         case ARCH_ARM_V8_NEON:
121         default:
122 #ifdef DARWIN
123             ih264e_init_function_ptr_generic(ps_codec);
124             break;
125 #else
126             ih264e_init_function_ptr_neon_av8(ps_codec);
127             break;
128 #endif
129 #elif !defined(DISABLE_NEON)
130         case ARCH_ARM_A9Q:
131         case ARCH_ARM_A9A:
132         case ARCH_ARM_A9:
133         case ARCH_ARM_A7:
134         case ARCH_ARM_A5:
135         case ARCH_ARM_A15:
136         default:
137             ih264e_init_function_ptr_neon_a9q(ps_codec);
138             break;
139 #else
140         default:
141 #endif
142         case ARCH_ARM_NONEON:
143             break;
144     }
145 }
146 
147 /**
148 *******************************************************************************
149 *
150 * @brief Determine the architecture of the encoder executing environment
151 *
152 * @par Description: This routine returns the architecture of the enviro-
153 * ment in which the current encoder is being tested
154 *
155 * @param[in] void
156 *
157 * @returns  IV_ARCH_T
158 *  architecture
159 *
160 * @remarks none
161 *
162 *******************************************************************************
163 */
ih264e_default_arch(void)164 IV_ARCH_T ih264e_default_arch(void)
165 {
166 #if defined(ARMV8)
167     return ARCH_ARM_V8_NEON;
168 #elif !defined(DISABLE_NEON)
169     return ARCH_ARM_A9Q;
170 #else
171     return ARCH_ARM_NONEON;
172 #endif
173 }
174