OLD | NEW |
| (Empty) |
1 /*************************************************************************** | |
2 * Copyright (c) 2010, Code Aurora Forum. All rights reserved. | |
3 * Copyright 2006-2010, The Android Open Source Project | |
4 * | |
5 * Use of this source code is governed by a BSD-style license that can be | |
6 * found in the LICENSE file. | |
7 ***************************************************************************/ | |
8 | |
9 /* Changes: | |
10 * 2011-04-01 ARM | |
11 * Merged the functions from src/opts/opts_check_arm_neon.cpp | |
12 * Modified to return ARM version of memset16 and memset32 if no neon | |
13 * available in the core | |
14 */ | |
15 | |
16 #include "SkBlitRow.h" | |
17 #include "SkUtils.h" | |
18 | |
19 #include "SkUtilsArm.h" | |
20 #include "SkMorphology_opts.h" | |
21 #include "SkMorphology_opts_neon.h" | |
22 #include "SkBlurImage_opts_neon.h" | |
23 | |
24 #if defined(SK_CPU_LENDIAN) && !SK_ARM_NEON_IS_NONE | |
25 extern "C" void memset16_neon(uint16_t dst[], uint16_t value, int count); | |
26 extern "C" void memset32_neon(uint32_t dst[], uint32_t value, int count); | |
27 #endif | |
28 | |
29 #if defined(SK_CPU_LENDIAN) | |
30 extern "C" void arm_memset16(uint16_t* dst, uint16_t value, int count); | |
31 extern "C" void arm_memset32(uint32_t* dst, uint32_t value, int count); | |
32 #endif | |
33 | |
34 SkMemset16Proc SkMemset16GetPlatformProc() { | |
35 // FIXME: memset.arm.S is using syntax incompatible with XCode | |
36 #if !defined(SK_CPU_LENDIAN) || defined(SK_BUILD_FOR_IOS) | |
37 return NULL; | |
38 #elif SK_ARM_NEON_IS_DYNAMIC | |
39 if (sk_cpu_arm_has_neon()) { | |
40 return memset16_neon; | |
41 } else { | |
42 return arm_memset16; | |
43 } | |
44 #elif SK_ARM_NEON_IS_ALWAYS | |
45 return memset16_neon; | |
46 #else | |
47 return arm_memset16; | |
48 #endif | |
49 } | |
50 | |
51 SkMemset32Proc SkMemset32GetPlatformProc() { | |
52 // FIXME: memset.arm.S is using syntax incompatible with XCode | |
53 #if !defined(SK_CPU_LENDIAN) || defined(SK_BUILD_FOR_IOS) | |
54 return NULL; | |
55 #elif SK_ARM_NEON_IS_DYNAMIC | |
56 if (sk_cpu_arm_has_neon()) { | |
57 return memset32_neon; | |
58 } else { | |
59 return arm_memset32; | |
60 } | |
61 #elif SK_ARM_NEON_IS_ALWAYS | |
62 return memset32_neon; | |
63 #else | |
64 return arm_memset32; | |
65 #endif | |
66 } | |
67 | |
68 SkBlitRow::ColorRectProc PlatformColorRectProcFactory() { | |
69 return NULL; | |
70 } | |
71 | |
72 SkMorphologyImageFilter::Proc SkMorphologyGetPlatformProc(SkMorphologyProcType t
ype) { | |
73 #if SK_ARM_NEON_IS_NONE | |
74 return NULL; | |
75 #else | |
76 #if SK_ARM_NEON_IS_DYNAMIC | |
77 if (!sk_cpu_arm_has_neon()) { | |
78 return NULL; | |
79 } | |
80 #endif | |
81 switch (type) { | |
82 case kDilateX_SkMorphologyProcType: | |
83 return SkDilateX_neon; | |
84 case kDilateY_SkMorphologyProcType: | |
85 return SkDilateY_neon; | |
86 case kErodeX_SkMorphologyProcType: | |
87 return SkErodeX_neon; | |
88 case kErodeY_SkMorphologyProcType: | |
89 return SkErodeY_neon; | |
90 default: | |
91 return NULL; | |
92 } | |
93 #endif | |
94 } | |
95 | |
96 bool SkBoxBlurGetPlatformProcs(SkBoxBlurProc* boxBlurX, | |
97 SkBoxBlurProc* boxBlurY, | |
98 SkBoxBlurProc* boxBlurXY, | |
99 SkBoxBlurProc* boxBlurYX) { | |
100 #if SK_ARM_NEON_IS_NONE | |
101 return false; | |
102 #else | |
103 #if SK_ARM_NEON_IS_DYNAMIC | |
104 if (!sk_cpu_arm_has_neon()) { | |
105 return false; | |
106 } | |
107 #endif | |
108 return SkBoxBlurGetPlatformProcs_NEON(boxBlurX, boxBlurY, boxBlurXY, boxBlur
YX); | |
109 #endif | |
110 } | |
OLD | NEW |