ih264e_function_selector.c revision a2b49e5f0574dee76f81507f288143d83a4b7c1a
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*
34* @remarks
35*  None
36*
37*******************************************************************************
38*/
39
40
41/*****************************************************************************/
42/* File Includes                                                             */
43/*****************************************************************************/
44
45/* System Include Files */
46#include <stdio.h>
47#include <stddef.h>
48#include <stdlib.h>
49#include <string.h>
50
51/* User Include Files */
52#include "ih264_typedefs.h"
53#include "iv2.h"
54#include "ive2.h"
55#include "ih264_defs.h"
56#include "ih264_size_defs.h"
57#include "ih264e_defs.h"
58#include "ih264e_error.h"
59#include "ih264e_bitstream.h"
60#include "ime_distortion_metrics.h"
61#include "ime_structs.h"
62#include "ih264_defs.h"
63#include "ih264_error.h"
64#include "ih264_structs.h"
65#include "ih264_trans_quant_itrans_iquant.h"
66#include "ih264_inter_pred_filters.h"
67#include "ih264_mem_fns.h"
68#include "ih264_padding.h"
69#include "ih264_intra_pred_filters.h"
70#include "ih264_deblk_edge_filters.h"
71
72#include "ih264_macros.h"
73#include "ih264_platform_macros.h"
74#include "ih264e_defs.h"
75#include "irc_cntrl_param.h"
76#include "irc_frame_info_collector.h"
77#include "ih264e_rate_control.h"
78#include "ih264e_structs.h"
79#include "ih264e_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*/
99void ih264e_init_function_ptr(void *pv_codec)
100{
101    codec_t *ps_codec = (codec_t *)pv_codec;
102    ih264e_init_function_ptr_generic(ps_codec);
103    switch(ps_codec->s_cfg.e_arch)
104    {
105#if defined(ARMV8)
106        case ARCH_ARM_A53:
107        case ARCH_ARM_A57:
108        case ARCH_ARM_V8_NEON:
109        default:
110            ih264e_init_function_ptr_neon_av8(ps_codec);
111            break;
112#elif !defined(DISABLE_NEON)
113        case ARCH_ARM_A9Q:
114        case ARCH_ARM_A9A:
115        case ARCH_ARM_A9:
116        case ARCH_ARM_A7:
117        case ARCH_ARM_A5:
118        case ARCH_ARM_A15:
119        default:
120            ih264e_init_function_ptr_neon_a9q(ps_codec);
121            break;
122#else
123        default:
124#endif
125        case ARCH_ARM_NONEON:
126            break;
127    }
128}
129
130/**
131*******************************************************************************
132*
133* @brief Determine the architecture of the encoder executing environment
134*
135* @par Description: This routine returns the architecture of the enviro-
136* ment in which the current encoder is being tested
137*
138* @param[in] void
139*
140* @returns  IV_ARCH_T
141*  architecture
142*
143* @remarks none
144*
145*******************************************************************************
146*/
147IV_ARCH_T ih264e_default_arch(void)
148{
149#if defined(ARMV8)
150    return ARCH_ARM_V8_NEON;
151#elif !defined(DISABLE_NEON)
152    return ARCH_ARM_A9Q;
153#else
154    return ARCH_ARM_NONEON;
155#endif
156}
157