Home | History | Annotate | Download | only in arm
      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_defs.h"
     62 #include "ime_structs.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 #include "ih264_cabac_tables.h"
     72 #include "ih264_macros.h"
     73 #include "ih264_platform_macros.h"
     74 #include "irc_cntrl_param.h"
     75 #include "irc_frame_info_collector.h"
     76 #include "ih264e_rate_control.h"
     77 #include "ih264e_cabac_structs.h"
     78 #include "ih264e_structs.h"
     79 #include "ih264e_cabac.h"
     80 #include "ih264e_platform_macros.h"
     81 
     82 /**
     83 *******************************************************************************
     84 *
     85 * @brief Initialize the intra/inter/transform/deblk function pointers of
     86 * codec context
     87 *
     88 * @par Description: the current routine initializes the function pointers of
     89 * codec context basing on the architecture in use
     90 *
     91 * @param[in] ps_codec
     92 *  Codec context pointer
     93 *
     94 * @returns  none
     95 *
     96 * @remarks none
     97 *
     98 *******************************************************************************
     99 */
    100 void ih264e_init_function_ptr(void *pv_codec)
    101 {
    102     codec_t *ps_codec = (codec_t *)pv_codec;
    103     ih264e_init_function_ptr_generic(ps_codec);
    104     switch(ps_codec->s_cfg.e_arch)
    105     {
    106 #if defined(ARMV8)
    107         case ARCH_ARM_A53:
    108         case ARCH_ARM_A57:
    109         case ARCH_ARM_V8_NEON:
    110         default:
    111             ih264e_init_function_ptr_neon_av8(ps_codec);
    112             break;
    113 #elif !defined(DISABLE_NEON)
    114         case ARCH_ARM_A9Q:
    115         case ARCH_ARM_A9A:
    116         case ARCH_ARM_A9:
    117         case ARCH_ARM_A7:
    118         case ARCH_ARM_A5:
    119         case ARCH_ARM_A15:
    120         default:
    121             ih264e_init_function_ptr_neon_a9q(ps_codec);
    122             break;
    123 #else
    124         default:
    125 #endif
    126         case ARCH_ARM_NONEON:
    127             break;
    128     }
    129 }
    130 
    131 /**
    132 *******************************************************************************
    133 *
    134 * @brief Determine the architecture of the encoder executing environment
    135 *
    136 * @par Description: This routine returns the architecture of the enviro-
    137 * ment in which the current encoder is being tested
    138 *
    139 * @param[in] void
    140 *
    141 * @returns  IV_ARCH_T
    142 *  architecture
    143 *
    144 * @remarks none
    145 *
    146 *******************************************************************************
    147 */
    148 IV_ARCH_T ih264e_default_arch(void)
    149 {
    150 #if defined(ARMV8)
    151     return ARCH_ARM_V8_NEON;
    152 #elif !defined(DISABLE_NEON)
    153     return ARCH_ARM_A9Q;
    154 #else
    155     return ARCH_ARM_NONEON;
    156 #endif
    157 }
    158