xref: /aosp_15_r20/external/libavc/encoder/x86/svc/isvce_function_selector.c (revision 495ae853bb871d1e5a258cb02c2cc13cde8ddb9a)
1 /******************************************************************************
2  *
3  * Copyright (C) 2022 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 *  isvce_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 *
34 * @remarks
35 *  None
36 *
37 *******************************************************************************
38 */
39 
40 /*****************************************************************************/
41 /* File Includes                                                             */
42 /*****************************************************************************/
43 
44 /* System Include Files */
45 #include <stdio.h>
46 #include <stddef.h>
47 #include <stdlib.h>
48 #include <string.h>
49 
50 /* User Include Files */
51 #include "ih264_typedefs.h"
52 #include "iv2.h"
53 #include "ive2.h"
54 #include "isvc_defs.h"
55 #include "ih264_size_defs.h"
56 #include "isvce_defs.h"
57 #include "ih264e_error.h"
58 #include "ih264e_bitstream.h"
59 #include "ime_distortion_metrics.h"
60 #include "ime_defs.h"
61 #include "ime_structs.h"
62 #include "ih264_error.h"
63 #include "isvc_structs.h"
64 #include "isvc_trans_quant_itrans_iquant.h"
65 #include "isvc_inter_pred_filters.h"
66 #include "isvc_mem_fns.h"
67 #include "ih264_padding.h"
68 #include "ih264_intra_pred_filters.h"
69 #include "ih264_deblk_edge_filters.h"
70 #include "isvc_cabac_tables.h"
71 #include "isvc_macros.h"
72 #include "ih264_platform_macros.h"
73 #include "irc_cntrl_param.h"
74 #include "irc_frame_info_collector.h"
75 #include "isvce_rate_control.h"
76 #include "isvce_cabac_structs.h"
77 #include "isvce_structs.h"
78 #include "isvce_cabac.h"
79 #include "isvce_platform_macros.h"
80 
81 /**
82 *******************************************************************************
83 *
84 * @brief Initialize the intra/inter/transform/deblk function pointers of
85 * codec context
86 *
87 * @par Description: the current routine initializes the function pointers of
88 * codec context basing on the architecture in use
89 *
90 * @param[in] ps_codec
91 *  Codec context pointer
92 *
93 * @returns  none
94 *
95 * @remarks none
96 *
97 *******************************************************************************
98 */
isvce_init_function_ptr(isvce_codec_t * ps_codec)99 void isvce_init_function_ptr(isvce_codec_t *ps_codec)
100 {
101     isvce_init_function_ptr_generic(ps_codec);
102 
103     switch(ps_codec->s_cfg.e_arch)
104     {
105         case ARCH_X86_GENERIC:
106             isvce_init_function_ptr_generic(ps_codec);
107             break;
108         case ARCH_X86_SSSE3:
109             isvce_init_function_ptr_ssse3(ps_codec);
110             break;
111         case ARCH_X86_SSE42:
112         default:
113             isvce_init_function_ptr_ssse3(ps_codec);
114             isvce_init_function_ptr_sse42(ps_codec);
115             break;
116     }
117 }
118 
119 /**
120 *******************************************************************************
121 *
122 * @brief Determine the architecture of the encoder executing environment
123 *
124 * @par Description: This routine returns the architecture of the enviro-
125 * ment in which the current encoder is being tested
126 *
127 * @param[in] void
128 *
129 * @returns  IV_ARCH_T
130 *  architecture
131 *
132 * @remarks none
133 *
134 *******************************************************************************
135 */
isvce_default_arch(void)136 IV_ARCH_T isvce_default_arch(void) { return ARCH_X86_SSE42; }
137