vlc_cpu.h 2.75 KB
 Rémi Denis-Courmont committed Sep 22, 2009 1 2 3 ``````/***************************************************************************** * vlc_cpu.h: CPU capabilities ***************************************************************************** `````` Jean-Baptiste Kempf committed Nov 27, 2011 4 `````` * Copyright (C) 1998-2009 VLC authors and VideoLAN `````` Rémi Denis-Courmont committed Sep 22, 2009 5 `````` * `````` Jean-Baptiste Kempf committed Nov 27, 2011 6 7 8 `````` * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 2.1 of the License, or `````` Rémi Denis-Courmont committed Sep 22, 2009 9 10 11 12 `````` * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of `````` Jean-Baptiste Kempf committed Nov 27, 2011 13 14 `````` * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. `````` Rémi Denis-Courmont committed Sep 22, 2009 15 `````` * `````` Jean-Baptiste Kempf committed Nov 27, 2011 16 17 18 `````` * You should have received a copy of the GNU Lesser General Public License * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. `````` Rémi Denis-Courmont committed Sep 22, 2009 19 20 21 22 `````` *****************************************************************************/ /** * \file `````` Rémi Denis-Courmont committed Aug 01, 2012 23 `````` * This file provides CPU features detection. `````` Rémi Denis-Courmont committed Sep 22, 2009 24 25 26 27 28 `````` */ #ifndef VLC_CPU_H # define VLC_CPU_H 1 `````` Rémi Denis-Courmont committed Aug 01, 2012 29 30 ``````VLC_API unsigned vlc_CPU(void); `````` Rémi Denis-Courmont committed Sep 22, 2009 31 ``````# if defined (__i386__) || defined (__x86_64__) `````` Rémi Denis-Courmont committed Aug 01, 2012 32 ``````# define HAVE_FPU 1 `````` Rémi Denis-Courmont committed Sep 22, 2009 33 34 35 36 37 38 39 ``````# define CPU_CAPABILITY_MMX (1<<3) # define CPU_CAPABILITY_3DNOW (1<<4) # define CPU_CAPABILITY_MMXEXT (1<<5) # define CPU_CAPABILITY_SSE (1<<6) # define CPU_CAPABILITY_SSE2 (1<<7) # define CPU_CAPABILITY_SSE3 (1<<8) # define CPU_CAPABILITY_SSSE3 (1<<9) `````` Laurent Aimar committed Nov 24, 2009 40 41 42 ``````# define CPU_CAPABILITY_SSE4_1 (1<<10) # define CPU_CAPABILITY_SSE4_2 (1<<11) # define CPU_CAPABILITY_SSE4A (1<<12) `````` Rémi Denis-Courmont committed Nov 24, 2011 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 `````` # if defined (__MMX__) # define VLC_MMX # elif VLC_GCC_VERSION(4, 4) # define VLC_MMX __attribute__ ((__target__ ("mmx"))) # else # define VLC_MMX VLC_MMX_is_not_implemented_on_this_compiler # endif # if defined (__SSE__) # define VLC_SSE # elif VLC_GCC_VERSION(4, 4) # define VLC_SSE __attribute__ ((__target__ ("sse"))) # else # define VLC_SSE VLC_SSE_is_not_implemented_on_this_compiler # endif `````` Rémi Denis-Courmont committed Aug 01, 2012 60 ``````# elif defined (__ppc__) || defined (__ppc64__) || defined (__powerpc__) `````` Rémi Denis-Courmont committed Oct 19, 2009 61 ``````# define HAVE_FPU 1 `````` Rémi Denis-Courmont committed Aug 01, 2012 62 ``````# define CPU_CAPABILITY_ALTIVEC (1<<16) `````` Rémi Denis-Courmont committed Oct 19, 2009 63 64 `````` # elif defined (__arm__) `````` Rémi Denis-Courmont committed Jan 26, 2012 65 66 67 68 69 ``````# if defined (__VFP_FP__) && !defined (__SOFTFP__) # define HAVE_FPU 1 # else # define HAVE_FPU 0 # endif `````` Rémi Denis-Courmont committed Aug 02, 2012 70 71 72 73 74 75 76 ``````# define VLC_CPU_ARM_NEON 2 # ifdef __ARM_NEON__ # define vlc_CPU_ARM_NEON() (1) # else # define vlc_CPU_ARM_NEON() ((vlc_CPU() & VLC_CPU_ARM_NEON) != 0) # endif `````` Rémi Denis-Courmont committed Oct 19, 2009 77 78 79 80 81 `````` # elif defined (__sparc__) # define HAVE_FPU 1 # else `````` Rémi Denis-Courmont committed Aug 01, 2012 82 83 84 85 86 ``````/** * Are single precision floating point operations "fast"? * If this preprocessor constant is zero, floating point should be avoided * (especially relevant for audio codecs). */ `````` Rémi Denis-Courmont committed Oct 19, 2009 87 88 89 ``````# define HAVE_FPU 0 # endif `````` Rémi Denis-Courmont committed Sep 22, 2009 90 91 `````` #endif /* !VLC_CPU_H */``````