Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright 2014 The Android Open Source Project | 2 * Copyright 2014 The Android Open Source Project |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #include "SkBitmap.h" | 8 #include "SkBitmap.h" |
| 9 #include "SkBlurImage_opts_SSE4.h" | 9 #include "SkBlurImage_opts_SSE4.h" |
| 10 #include "SkColorPriv.h" | 10 #include "SkColorPriv.h" |
| 11 #include "SkRect.h" | 11 #include "SkRect.h" |
| 12 | 12 |
| 13 /* With the exception of the Android framework we always build the SSE4 function s | 13 #define SK_CPU_SSE_LEVEL_SSE1 10 |
| 14 * and enable the caller to determine SSE4 support. However, for the Android fr amework, | 14 #define SK_CPU_SSE_LEVEL_SSE2 20 |
| 15 * if the device does not support SSE4x then the compiler will not supply the re quired | 15 #define SK_CPU_SSE_LEVEL_SSE3 30 |
| 16 * -msse4* option needed to build this file, so instead we provide a stub implem entation. | 16 #define SK_CPU_SSE_LEVEL_SSSE3 31 |
| 17 #define SK_CPU_SSE_LEVEL_SSE41 41 | |
| 18 #define SK_CPU_SSE_LEVEL_SSE42 42 | |
| 19 | |
| 20 #if SK_CPU_SSE_LEVEL == SK_CPU_SSE_LEVEL_SSE41 | |
| 21 #error SK_CPU_SSE_LEVEL_SSE41 | |
|
hal.canary
2014/07/21 19:48:28
delete line 21
| |
| 22 #elif SK_CPU_SSE_LEVEL == SK_CPU_SSE_LEVEL_SSSE3 | |
| 23 #error SK_CPU_SSE_LEVEL_SSSE3 | |
| 24 #elif SK_CPU_SSE_LEVEL == SK_CPU_SSE_LEVEL_SSE3 | |
| 25 #error SK_CPU_SSE_LEVEL_SSE3 | |
| 26 #elif SK_CPU_SSE_LEVEL == SK_CPU_SSE_LEVEL_SSE2 | |
| 27 #error SK_CPU_SSE_LEVEL_SSE2 | |
| 28 #elif SK_CPU_SSE_LEVEL == SK_CPU_SSE_LEVEL_SSE1 | |
| 29 #error SK_CPU_SSE_LEVEL_SSE1 | |
| 30 #elif !defined(SK_CPU_SSE_LEVEL) | |
| 31 #error no level | |
| 32 #endif | |
| 33 | |
| 34 /* With the exception of the compilers that don't support it, we always build th e | |
| 35 * SSE4 functions and enable the caller to determine SSE4 support. However for | |
| 36 * compilers that do not support SSE4x we provide a stub implementation. | |
| 17 */ | 37 */ |
| 18 #if !defined(SK_BUILD_FOR_ANDROID_FRAMEWORK) || SK_CPU_SSE_LEVEL >= SK_CPU_SSE_L EVEL_SSE41 | 38 #if SK_CPU_SSE_LEVEL >= SK_CPU_SSE_LEVEL_SSE41 |
| 19 | 39 |
| 20 #include <smmintrin.h> | 40 #include <smmintrin.h> |
| 21 | 41 |
| 22 namespace { | 42 namespace { |
| 23 enum BlurDirection { | 43 enum BlurDirection { |
| 24 kX, kY | 44 kX, kY |
| 25 }; | 45 }; |
| 26 | 46 |
| 27 /* Helper function to spread the components of a 32-bit integer into the | 47 /* Helper function to spread the components of a 32-bit integer into the |
| 28 * lower 8 bits of each 32-bit element of an SSE register. | 48 * lower 8 bits of each 32-bit element of an SSE register. |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 103 SkBoxBlurProc* boxBlurY, | 123 SkBoxBlurProc* boxBlurY, |
| 104 SkBoxBlurProc* boxBlurXY, | 124 SkBoxBlurProc* boxBlurXY, |
| 105 SkBoxBlurProc* boxBlurYX) { | 125 SkBoxBlurProc* boxBlurYX) { |
| 106 *boxBlurX = SkBoxBlur_SSE4<kX, kX>; | 126 *boxBlurX = SkBoxBlur_SSE4<kX, kX>; |
| 107 *boxBlurY = SkBoxBlur_SSE4<kY, kY>; | 127 *boxBlurY = SkBoxBlur_SSE4<kY, kY>; |
| 108 *boxBlurXY = SkBoxBlur_SSE4<kX, kY>; | 128 *boxBlurXY = SkBoxBlur_SSE4<kX, kY>; |
| 109 *boxBlurYX = SkBoxBlur_SSE4<kY, kX>; | 129 *boxBlurYX = SkBoxBlur_SSE4<kY, kX>; |
| 110 return true; | 130 return true; |
| 111 } | 131 } |
| 112 | 132 |
| 113 #else // !defined(SK_BUILD_FOR_ANDROID_FRAMEWORK) || SK_CPU_SSE_LEVEL >= SK_CPU_ SSE_LEVEL_SSE41 | 133 #else // SK_CPU_SSE_LEVEL >= SK_CPU_SSE_LEVEL_SSE41 |
| 114 | 134 |
| 115 bool SkBoxBlurGetPlatformProcs_SSE4(SkBoxBlurProc* boxBlurX, | 135 bool SkBoxBlurGetPlatformProcs_SSE4(SkBoxBlurProc* boxBlurX, |
| 116 SkBoxBlurProc* boxBlurY, | 136 SkBoxBlurProc* boxBlurY, |
| 117 SkBoxBlurProc* boxBlurXY, | 137 SkBoxBlurProc* boxBlurXY, |
| 118 SkBoxBlurProc* boxBlurYX) { | 138 SkBoxBlurProc* boxBlurYX) { |
| 119 sk_throw(); | 139 sk_throw(); |
| 120 return false; | 140 return false; |
| 121 } | 141 } |
| 122 | 142 |
| 123 | 143 |
| 124 #endif | 144 #endif |
| OLD | NEW |