1 /******************************************************************************
2 *
3 * Copyright (C) 2012 Ittiam Systems Pvt Ltd, Bangalore
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 /**
19 *******************************************************************************
20 * @file
21 *  ihevcd_function_selector.c
22 *
23 * @brief
24 *  Contains functions to initialize function pointers used in hevc
25 *
26 * @author
27 *  Naveen
28 *
29 * @par List of Functions:
30 * @remarks
31 *  None
32 *
33 *******************************************************************************
34 */
35 /*****************************************************************************/
36 /* File Includes                                                             */
37 /*****************************************************************************/
38 #include <stdio.h>
39 #include <stddef.h>
40 #include <stdlib.h>
41 #include <string.h>
42 
43 #include "ihevc_typedefs.h"
44 #include "iv.h"
45 #include "ivd.h"
46 #include "ihevc_defs.h"
47 #include "ihevc_debug.h"
48 #include "ihevc_structs.h"
49 #include "ihevc_macros.h"
50 #include "ihevc_platform_macros.h"
51 #include "ihevc_cabac_tables.h"
52 #include "ihevc_disp_mgr.h"
53 #include "ihevc_buf_mgr.h"
54 #include "ihevc_dpb_mgr.h"
55 #include "ihevc_error.h"
56 
57 #include "ihevcd_defs.h"
58 #include "ihevcd_function_selector.h"
59 #include "ihevcd_structs.h"
60 
61 void ihevcd_init_function_ptr_neonintr(codec_t *ps_codec);
62 void ihevcd_init_function_ptr_noneon(codec_t *ps_codec);
63 void ihevcd_init_function_ptr_a9q(codec_t *ps_codec);
64 void ihevcd_init_function_ptr_av8(codec_t *ps_codec);
ihevcd_init_function_ptr(void * pv_codec)65 void ihevcd_init_function_ptr(void *pv_codec)
66 {
67     codec_t *ps_codec = (codec_t *)pv_codec;
68 
69 #ifndef ARMV8
70     switch(ps_codec->e_processor_arch)
71     {
72 #ifndef DISABLE_NEONINTR
73         case ARCH_ARM_NEONINTR:
74             ihevcd_init_function_ptr_neonintr(ps_codec);
75             break;
76 #endif
77         case ARCH_ARM_NONEON:
78             ihevcd_init_function_ptr_noneon(ps_codec);
79             break;
80         default:
81         case ARCH_ARM_A5:
82         case ARCH_ARM_A7:
83         case ARCH_ARM_A9:
84         case ARCH_ARM_A15:
85         case ARCH_ARM_A9Q:
86 #ifndef DISABLE_NEON
87             ihevcd_init_function_ptr_a9q(ps_codec);
88 #else
89             ihevcd_init_function_ptr_noneon(ps_codec);
90 #endif
91             break;
92     }
93     switch(ps_codec->e_processor_soc)
94     {
95 
96         case SOC_HISI_37X:
97 #ifndef DISABLE_NEON
98             ps_codec->s_func_selector.ihevcd_fmt_conv_420sp_to_420sp_fptr               =  &ihevcd_fmt_conv_420sp_to_420sp_a9q;
99 #endif
100             break;
101         case SOC_GENERIC:
102         default:
103             break;
104     }
105 #else
106     switch(ps_codec->e_processor_arch)
107     {
108         case ARCH_ARM_NONEON:
109             ihevcd_init_function_ptr_noneon(ps_codec);
110             break;
111         case ARCH_ARMV8_GENERIC:
112         default:
113             ihevcd_init_function_ptr_av8(ps_codec);
114             break;
115     }
116 #endif
117 }
118 
ihevcd_init_arch(void * pv_codec)119 void ihevcd_init_arch(void *pv_codec)
120 {
121     codec_t *ps_codec = (codec_t *)pv_codec;
122 #ifdef DEFAULT_ARCH
123 #if DEFAULT_ARCH == D_ARCH_ARM_NONEON
124     ps_codec->e_processor_arch = ARCH_ARM_NONEON;
125 #elif DEFAULT_ARCH == D_ARCH_ARMV8_GENERIC
126     ps_codec->e_processor_arch = ARCH_ARMV8_GENERIC;
127 #elif DEFAULT_ARCH == D_ARCH_ARM_NEONINTR
128     ps_codec->e_processor_arch = ARCH_ARM_NEONINTR;
129 #else
130     ps_codec->e_processor_arch = ARCH_ARM_A9Q;
131 #endif
132 #else
133     ps_codec->e_processor_arch = ARCH_ARM_A9Q;
134 #endif
135 }
136