ImfSimd.h 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. ///////////////////////////////////////////////////////////////////////////
  2. //
  3. // Copyright (c) 2012, Autodesk, Inc.
  4. //
  5. // All rights reserved.
  6. //
  7. // Implementation of IIF-specific file format and speed optimizations
  8. // provided by Innobec Technologies inc on behalf of Autodesk.
  9. //
  10. // Redistribution and use in source and binary forms, with or without
  11. // modification, are permitted provided that the following conditions are
  12. // met:
  13. // * Redistributions of source code must retain the above copyright
  14. // notice, this list of conditions and the following disclaimer.
  15. // * Redistributions in binary form must reproduce the above
  16. // copyright notice, this list of conditions and the following disclaimer
  17. // in the documentation and/or other materials provided with the
  18. // distribution.
  19. // * Neither the name of Industrial Light & Magic nor the names of
  20. // its contributors may be used to endorse or promote products derived
  21. // from this software without specific prior written permission.
  22. //
  23. // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  24. // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  25. // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  26. // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  27. // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  28. // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  29. // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  30. // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  31. // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  32. // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  33. // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  34. //
  35. ///////////////////////////////////////////////////////////////////////////
  36. #ifndef INCLUDED_IMF_SIMD_H
  37. #define INCLUDED_IMF_SIMD_H
  38. //
  39. // Compile time SSE detection:
  40. // IMF_HAVE_SSE2 - Defined if it's safe to compile SSE2 optimizations
  41. // IMF_HAVE_SSE4_1 - Defined if it's safe to compile SSE4.1 optimizations
  42. //
  43. // GCC and Visual Studio SSE2 compiler flags
  44. #if defined __SSE2__ || (defined(_M_X64) || _M_IX86_FP == 2)
  45. #define IMF_HAVE_SSE2 1
  46. #endif
  47. #if defined __SSE4_1__
  48. #define IMF_HAVE_SSE4_1 1
  49. #endif
  50. extern "C"
  51. {
  52. #ifdef IMF_HAVE_SSE2
  53. #include <emmintrin.h>
  54. #include <mmintrin.h>
  55. #endif
  56. #ifdef IMF_HAVE_SSE4_1
  57. #include <smmintrin.h>
  58. #endif
  59. }
  60. #endif