OLD | NEW |
1 // Copyright 2011 Google Inc. All Rights Reserved. | 1 // Copyright 2011 Google Inc. All Rights Reserved. |
2 // | 2 // |
3 // Use of this source code is governed by a BSD-style license | 3 // Use of this source code is governed by a BSD-style license |
4 // that can be found in the COPYING file in the root of the source | 4 // that can be found in the COPYING file in the root of the source |
5 // tree. An additional intellectual property rights grant can be found | 5 // tree. An additional intellectual property rights grant can be found |
6 // in the file PATENTS. All contributing project authors may | 6 // in the file PATENTS. All contributing project authors may |
7 // be found in the AUTHORS file in the root of the source tree. | 7 // be found in the AUTHORS file in the root of the source tree. |
8 // ----------------------------------------------------------------------------- | 8 // ----------------------------------------------------------------------------- |
9 // | 9 // |
10 // Speed-critical functions. | 10 // Speed-critical functions. |
(...skipping 18 matching lines...) Expand all Loading... |
29 | 29 |
30 #if defined(__GNUC__) | 30 #if defined(__GNUC__) |
31 # define LOCAL_GCC_VERSION ((__GNUC__ << 8) | __GNUC_MINOR__) | 31 # define LOCAL_GCC_VERSION ((__GNUC__ << 8) | __GNUC_MINOR__) |
32 # define LOCAL_GCC_PREREQ(maj, min) \ | 32 # define LOCAL_GCC_PREREQ(maj, min) \ |
33 (LOCAL_GCC_VERSION >= (((maj) << 8) | (min))) | 33 (LOCAL_GCC_VERSION >= (((maj) << 8) | (min))) |
34 #else | 34 #else |
35 # define LOCAL_GCC_VERSION 0 | 35 # define LOCAL_GCC_VERSION 0 |
36 # define LOCAL_GCC_PREREQ(maj, min) 0 | 36 # define LOCAL_GCC_PREREQ(maj, min) 0 |
37 #endif | 37 #endif |
38 | 38 |
39 #ifdef __clang__ | 39 #ifndef __has_builtin |
40 # define LOCAL_CLANG_VERSION ((__clang_major__ << 8) | __clang_minor__) | 40 # define __has_builtin(x) 0 |
41 # define LOCAL_CLANG_PREREQ(maj, min) \ | 41 #endif |
42 (LOCAL_CLANG_VERSION >= (((maj) << 8) | (min))) | |
43 #else | |
44 # define LOCAL_CLANG_VERSION 0 | |
45 # define LOCAL_CLANG_PREREQ(maj, min) 0 | |
46 #endif // __clang__ | |
47 | 42 |
48 #if defined(_MSC_VER) && _MSC_VER > 1310 && \ | 43 #if defined(_MSC_VER) && _MSC_VER > 1310 && \ |
49 (defined(_M_X64) || defined(_M_IX86)) | 44 (defined(_M_X64) || defined(_M_IX86)) |
50 #define WEBP_MSC_SSE2 // Visual C++ SSE2 targets | 45 #define WEBP_MSC_SSE2 // Visual C++ SSE2 targets |
51 #endif | 46 #endif |
52 | 47 |
53 // WEBP_HAVE_* are used to indicate the presence of the instruction set in dsp | 48 // WEBP_HAVE_* are used to indicate the presence of the instruction set in dsp |
54 // files without intrinsics, allowing the corresponding Init() to be called. | 49 // files without intrinsics, allowing the corresponding Init() to be called. |
55 // Files containing intrinsics will need to be built targeting the instruction | 50 // Files containing intrinsics will need to be built targeting the instruction |
56 // set so should succeed on one of the earlier tests. | 51 // set so should succeed on one of the earlier tests. |
57 #if defined(__SSE2__) || defined(WEBP_MSC_SSE2) || defined(WEBP_HAVE_SSE2) | 52 #if defined(__SSE2__) || defined(WEBP_MSC_SSE2) || defined(WEBP_HAVE_SSE2) |
58 #define WEBP_USE_SSE2 | 53 #define WEBP_USE_SSE2 |
59 #endif | 54 #endif |
60 | 55 |
61 #if defined(__AVX2__) || defined(WEBP_HAVE_AVX2) | 56 #if defined(__AVX2__) || defined(WEBP_HAVE_AVX2) |
62 #define WEBP_USE_AVX2 | 57 #define WEBP_USE_AVX2 |
63 #endif | 58 #endif |
64 | 59 |
65 #if defined(__ANDROID__) && defined(__ARM_ARCH_7A__) | 60 #if defined(__ANDROID__) && defined(__ARM_ARCH_7A__) |
66 #define WEBP_ANDROID_NEON // Android targets that might support NEON | 61 #define WEBP_ANDROID_NEON // Android targets that might support NEON |
67 #endif | 62 #endif |
68 | 63 |
69 // The intrinsics currently cause compiler errors with arm-nacl-gcc and the | 64 // The intrinsics currently cause compiler errors with arm-nacl-gcc and the |
70 // inline assembly would need to be modified for use with Native Client. | 65 // inline assembly would need to be modified for use with Native Client. |
71 #if (defined(__ARM_NEON__) || defined(WEBP_ANDROID_NEON) || \ | 66 #if (defined(__ARM_NEON__) || defined(WEBP_ANDROID_NEON) || \ |
72 defined(__aarch64__)) && !defined(__native_client__) | 67 defined(__aarch64__)) && !defined(__native_client__) |
73 #define WEBP_USE_NEON | 68 #define WEBP_USE_NEON |
74 #endif | 69 #endif |
75 | 70 |
76 #if defined(__mips__) && !defined(__mips64) && (__mips_isa_rev < 6) | 71 #if defined(__mips__) && !defined(__mips64) && \ |
| 72 defined(__mips_isa_rev) && (__mips_isa_rev >= 1) && (__mips_isa_rev < 6) |
77 #define WEBP_USE_MIPS32 | 73 #define WEBP_USE_MIPS32 |
78 #if (__mips_isa_rev >= 2) | 74 #if (__mips_isa_rev >= 2) |
79 #define WEBP_USE_MIPS32_R2 | 75 #define WEBP_USE_MIPS32_R2 |
80 #endif | 76 #endif |
81 #endif | 77 #endif |
82 | 78 |
83 typedef enum { | 79 typedef enum { |
84 kSSE2, | 80 kSSE2, |
85 kSSE3, | 81 kSSE3, |
86 kAVX, | 82 kAVX, |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
287 int width, int num_rows, int inverse); | 283 int width, int num_rows, int inverse); |
288 | 284 |
289 // To be called first before using the above. | 285 // To be called first before using the above. |
290 void WebPInitAlphaProcessing(void); | 286 void WebPInitAlphaProcessing(void); |
291 | 287 |
292 #ifdef __cplusplus | 288 #ifdef __cplusplus |
293 } // extern "C" | 289 } // extern "C" |
294 #endif | 290 #endif |
295 | 291 |
296 #endif /* WEBP_DSP_DSP_H_ */ | 292 #endif /* WEBP_DSP_DSP_H_ */ |
OLD | NEW |