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 61void ihevcd_init_function_ptr(void *pv_codec) 62{ 63 codec_t *ps_codec = (codec_t *)pv_codec; 64 switch(ps_codec->e_processor_arch) 65 { 66 case ARCH_X86_GENERIC: 67 ihevcd_init_function_ptr_generic(pv_codec); 68 break; 69 case ARCH_X86_SSSE3: 70 ihevcd_init_function_ptr_ssse3(pv_codec); 71 break; 72 case ARCH_X86_SSE42: 73 ihevcd_init_function_ptr_sse42(pv_codec); 74 break; 75 case ARCH_X86_AVX2: 76#ifndef DISABLE_AVX2 77 ihevcd_init_function_ptr_avx2(pv_codec); 78#else 79 ihevcd_init_function_ptr_sse42(pv_codec); 80#endif 81 break; 82 default: 83 ihevcd_init_function_ptr_ssse3(pv_codec); 84 break; 85 } 86} 87 88void ihevcd_init_arch(void *pv_codec) 89{ 90 codec_t *ps_codec = (codec_t *)pv_codec; 91 92#ifdef DEFAULT_ARCH 93#if DEFAULT_ARCH == D_ARCH_X86_GENERIC 94 ps_codec->e_processor_arch = ARCH_X86_GENERIC; 95#elif DEFAULT_ARCH == D_ARCH_X86_SSE42 96 ps_codec->e_processor_arch = ARCH_X86_SSE42; 97#elif DEFAULT_ARCH == D_ARCH_X86_AVX2 98 ps_codec->e_processor_arch = ARCH_X86_AVX2; 99#else 100 ps_codec->e_processor_arch = ARCH_X86_SSSE3; 101#endif 102#else 103 ps_codec->e_processor_arch = ARCH_X86_SSSE3; 104#endif 105} 106