home *** CD-ROM | disk | FTP | other *** search
/ mail.altrad.com / 2015.02.mail.altrad.com.tar / mail.altrad.com / TEST / vlc-2-0-5-win32.exe / sdk / include / vlc / plugins / vlc_cpu.h < prev    next >
C/C++ Source or Header  |  2012-12-12  |  3KB  |  114 lines

  1. /*****************************************************************************
  2.  * vlc_cpu.h: CPU capabilities
  3.  *****************************************************************************
  4.  * Copyright (C) 1998-2009 VLC authors and VideoLAN
  5.  *
  6.  * This program is free software; you can redistribute it and/or modify it
  7.  * under the terms of the GNU Lesser General Public License as published by
  8.  * the Free Software Foundation; either version 2.1 of the License, or
  9.  * (at your option) any later version.
  10.  *
  11.  * This program is distributed in the hope that it will be useful,
  12.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14.  * GNU Lesser General Public License for more details.
  15.  *
  16.  * You should have received a copy of the GNU Lesser General Public License
  17.  * along with this program; if not, write to the Free Software Foundation,
  18.  * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  19.  *****************************************************************************/
  20.  
  21. /**
  22.  * \file
  23.  * This file provides CPU-specific optimization flags.
  24.  */
  25.  
  26. #ifndef VLC_CPU_H
  27. # define VLC_CPU_H 1
  28.  
  29. # if defined (__i386__) || defined (__x86_64__)
  30. #  define CPU_CAPABILITY_MMX     (1<<3)
  31. #  define CPU_CAPABILITY_3DNOW   (1<<4)
  32. #  define CPU_CAPABILITY_MMXEXT  (1<<5)
  33. #  define CPU_CAPABILITY_SSE     (1<<6)
  34. #  define CPU_CAPABILITY_SSE2    (1<<7)
  35. #  define CPU_CAPABILITY_SSE3    (1<<8)
  36. #  define CPU_CAPABILITY_SSSE3   (1<<9)
  37. #  define CPU_CAPABILITY_SSE4_1  (1<<10)
  38. #  define CPU_CAPABILITY_SSE4_2  (1<<11)
  39. #  define CPU_CAPABILITY_SSE4A   (1<<12)
  40.  
  41. # if defined (__MMX__)
  42. #  define VLC_MMX
  43. # elif VLC_GCC_VERSION(4, 4)
  44. #  define VLC_MMX __attribute__ ((__target__ ("mmx")))
  45. # else
  46. #  define VLC_MMX VLC_MMX_is_not_implemented_on_this_compiler
  47. # endif
  48.  
  49. # if defined (__SSE__)
  50. #  define VLC_SSE
  51. # elif VLC_GCC_VERSION(4, 4)
  52. #  define VLC_SSE __attribute__ ((__target__ ("sse")))
  53. # else
  54. #  define VLC_SSE VLC_SSE_is_not_implemented_on_this_compiler
  55. # endif
  56.  
  57. # else
  58. #  define CPU_CAPABILITY_MMX     (0)
  59. #  define CPU_CAPABILITY_3DNOW   (0)
  60. #  define CPU_CAPABILITY_MMXEXT  (0)
  61. #  define CPU_CAPABILITY_SSE     (0)
  62. #  define CPU_CAPABILITY_SSE2    (0)
  63. #  define CPU_CAPABILITY_SSE3    (0)
  64. #  define CPU_CAPABILITY_SSSE3   (0)
  65. #  define CPU_CAPABILITY_SSE4_1  (0)
  66. #  define CPU_CAPABILITY_SSE4_2  (0)
  67. #  define CPU_CAPABILITY_SSE4A   (0)
  68. # endif
  69.  
  70. # if defined (__ppc__) || defined (__ppc64__) || defined (__powerpc__)
  71. #  define CPU_CAPABILITY_ALTIVEC (1<<16)
  72. # else
  73. #  define CPU_CAPABILITY_ALTIVEC (0)
  74. # endif
  75.  
  76. # if defined (__arm__)
  77. #  define CPU_CAPABILITY_NEON    (1<<24)
  78. # else
  79. #  define CPU_CAPABILITY_NEON    (0)
  80. # endif
  81.  
  82. VLC_API unsigned vlc_CPU( void );
  83.  
  84. /** Are floating point operations fast?
  85.  * If this bit is not set, you should try to use fixed-point instead.
  86.  */
  87. # if defined (__i386__) || defined (__x86_64__)
  88. #  define HAVE_FPU 1
  89.  
  90. # elif defined (__powerpc__) || defined (__ppc__) || defined (__ppc64__)
  91. #  define HAVE_FPU 1
  92.  
  93. # elif defined (__arm__)
  94. #  if defined (__VFP_FP__) && !defined (__SOFTFP__)
  95. #   define HAVE_FPU 1
  96. #  else
  97. #   define HAVE_FPU 0
  98. #  endif
  99.  
  100. # elif defined (__sparc__)
  101. #  define HAVE_FPU 1
  102.  
  103. # else
  104. #  define HAVE_FPU 0
  105.  
  106. # endif
  107.  
  108. typedef void *(*vlc_memcpy_t) (void *tgt, const void *src, size_t n);
  109.  
  110. VLC_API void vlc_fastmem_register(vlc_memcpy_t cpy);
  111.  
  112. #endif /* !VLC_CPU_H */
  113.  
  114.