compare_row.h 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. /*
  2. * Copyright 2013 The LibYuv Project Authors. All rights reserved.
  3. *
  4. * Use of this source code is governed by a BSD-style license
  5. * that can be found in the LICENSE file in the root of the source
  6. * tree. An additional intellectual property rights grant can be found
  7. * in the file PATENTS. All contributing project authors may
  8. * be found in the AUTHORS file in the root of the source tree.
  9. */
  10. #ifndef INCLUDE_LIBYUV_COMPARE_ROW_H_ // NOLINT
  11. #define INCLUDE_LIBYUV_COMPARE_ROW_H_
  12. #include "libyuv/basic_types.h"
  13. #ifdef __cplusplus
  14. namespace libyuv {
  15. extern "C" {
  16. #endif
  17. #if defined(__pnacl__) || defined(__CLR_VER) || \
  18. (defined(__i386__) && !defined(__SSE2__))
  19. #define LIBYUV_DISABLE_X86
  20. #endif
  21. // Visual C 2012 required for AVX2.
  22. #if defined(_M_IX86) && !defined(__clang__) && \
  23. defined(_MSC_VER) && _MSC_VER >= 1700
  24. #define VISUALC_HAS_AVX2 1
  25. #endif // VisualStudio >= 2012
  26. // clang >= 3.4.0 required for AVX2.
  27. #if defined(__clang__) && (defined(__x86_64__) || defined(__i386__))
  28. #if (__clang_major__ > 3) || (__clang_major__ == 3 && (__clang_minor__ >= 4))
  29. #define CLANG_HAS_AVX2 1
  30. #endif // clang >= 3.4
  31. #endif // __clang__
  32. #if !defined(LIBYUV_DISABLE_X86) && \
  33. defined(_M_IX86) && (defined(VISUALC_HAS_AVX2) || defined(CLANG_HAS_AVX2))
  34. #define HAS_HASHDJB2_AVX2
  35. #endif
  36. // The following are available for Visual C and GCC:
  37. #if !defined(LIBYUV_DISABLE_X86) && \
  38. (defined(__x86_64__) || (defined(__i386__) || defined(_M_IX86)))
  39. #define HAS_HASHDJB2_SSE41
  40. #define HAS_SUMSQUAREERROR_SSE2
  41. #endif
  42. // The following are available for Visual C and clangcl 32 bit:
  43. #if !defined(LIBYUV_DISABLE_X86) && defined(_M_IX86) && \
  44. (defined(VISUALC_HAS_AVX2) || defined(CLANG_HAS_AVX2))
  45. #define HAS_HASHDJB2_AVX2
  46. #define HAS_SUMSQUAREERROR_AVX2
  47. #endif
  48. // The following are available for Neon:
  49. #if !defined(LIBYUV_DISABLE_NEON) && \
  50. (defined(__ARM_NEON__) || defined(LIBYUV_NEON) || defined(__aarch64__))
  51. #define HAS_SUMSQUAREERROR_NEON
  52. #endif
  53. uint32 SumSquareError_C(const uint8* src_a, const uint8* src_b, int count);
  54. uint32 SumSquareError_SSE2(const uint8* src_a, const uint8* src_b, int count);
  55. uint32 SumSquareError_AVX2(const uint8* src_a, const uint8* src_b, int count);
  56. uint32 SumSquareError_NEON(const uint8* src_a, const uint8* src_b, int count);
  57. uint32 HashDjb2_C(const uint8* src, int count, uint32 seed);
  58. uint32 HashDjb2_SSE41(const uint8* src, int count, uint32 seed);
  59. uint32 HashDjb2_AVX2(const uint8* src, int count, uint32 seed);
  60. #ifdef __cplusplus
  61. } // extern "C"
  62. } // namespace libyuv
  63. #endif
  64. #endif // INCLUDE_LIBYUV_COMPARE_ROW_H_ NOLINT