Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1198)

Side by Side Diff: src/opts/SkBitmapProcState_opts_arm.cpp

Issue 1277953002: Purge non-NEON ARM code. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | src/opts/SkBlitRow_opts_arm.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2009 The Android Open Source Project 2 * Copyright 2009 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 8
9 #include "SkBitmapScaler.h" 9 #include "SkBitmapScaler.h"
10 #include "SkBitmapProcState.h" 10 #include "SkBitmapProcState.h"
11 #include "SkColorPriv.h" 11 #include "SkColorPriv.h"
12 #include "SkPaint.h" 12 #include "SkPaint.h"
13 #include "SkTypes.h" 13 #include "SkTypes.h"
14 #include "SkUtils.h" 14 #include "SkUtils.h"
15 #include "SkUtilsArm.h" 15 #include "SkUtilsArm.h"
16 16
17 #include "SkConvolver.h" 17 #include "SkConvolver.h"
18 18
19 #if !defined(SK_CPU_ARM64) && SK_ARM_ARCH >= 6 && !defined(SK_CPU_BENDIAN) 19 void SkBitmapProcState::platformProcs() { }
20 void SI8_D16_nofilter_DX_arm(
21 const SkBitmapProcState& s,
22 const uint32_t* SK_RESTRICT xy,
23 int count,
24 uint16_t* SK_RESTRICT colors) SK_ATTRIBUTE_OPTIMIZE_O1;
25
26 void SI8_D16_nofilter_DX_arm(const SkBitmapProcState& s,
27 const uint32_t* SK_RESTRICT xy,
28 int count, uint16_t* SK_RESTRICT colors) {
29 SkASSERT(count > 0 && colors != NULL);
30 SkASSERT(s.fInvType <= (SkMatrix::kTranslate_Mask | SkMatrix::kScale_Mask));
31 SkASSERT(kNone_SkFilterQuality == s.fFilterLevel);
32
33 const uint16_t* SK_RESTRICT table = s.fPixmap.ctable()->read16BitCache();
34 const uint8_t* SK_RESTRICT srcAddr = (const uint8_t*)s.fPixmap.addr();
35
36 // buffer is y32, x16, x16, x16, x16, x16
37 // bump srcAddr to the proper row, since we're told Y never changes
38 SkASSERT((unsigned)xy[0] < (unsigned)s.fPixmap.height());
39 srcAddr = (const uint8_t*)((const char*)srcAddr + xy[0] * s.fPixmap.rowBytes ());
40
41 uint8_t src;
42
43 if (1 == s.fPixmap.width()) {
44 src = srcAddr[0];
45 uint16_t dstValue = table[src];
46 sk_memset16(colors, dstValue, count);
47 } else {
48 int i;
49 int count8 = count >> 3;
50 const uint16_t* SK_RESTRICT xx = (const uint16_t*)(xy + 1);
51
52 asm volatile (
53 "cmp %[count8], #0 \n\t" // compare loop co unter with 0
54 "beq 2f \n\t" // if loop counter == 0, exit
55 "1: \n\t"
56 "ldmia %[xx]!, {r5, r7, r9, r11} \n\t" // load ptrs to pi xels 0-7
57 "subs %[count8], %[count8], #1 \n\t" // decrement loop counter
58 "uxth r4, r5 \n\t" // extract ptr 0
59 "mov r5, r5, lsr #16 \n\t" // extract ptr 1
60 "uxth r6, r7 \n\t" // extract ptr 2
61 "mov r7, r7, lsr #16 \n\t" // extract ptr 3
62 "ldrb r4, [%[srcAddr], r4] \n\t" // load pixel 0 fr om image
63 "uxth r8, r9 \n\t" // extract ptr 4
64 "ldrb r5, [%[srcAddr], r5] \n\t" // load pixel 1 fr om image
65 "mov r9, r9, lsr #16 \n\t" // extract ptr 5
66 "ldrb r6, [%[srcAddr], r6] \n\t" // load pixel 2 fr om image
67 "uxth r10, r11 \n\t" // extract ptr 6
68 "ldrb r7, [%[srcAddr], r7] \n\t" // load pixel 3 fr om image
69 "mov r11, r11, lsr #16 \n\t" // extract ptr 7
70 "ldrb r8, [%[srcAddr], r8] \n\t" // load pixel 4 fr om image
71 "add r4, r4, r4 \n\t" // double pixel 0 for RGB565 lookup
72 "ldrb r9, [%[srcAddr], r9] \n\t" // load pixel 5 fr om image
73 "add r5, r5, r5 \n\t" // double pixel 1 for RGB565 lookup
74 "ldrb r10, [%[srcAddr], r10] \n\t" // load pixel 6 fr om image
75 "add r6, r6, r6 \n\t" // double pixel 2 for RGB565 lookup
76 "ldrb r11, [%[srcAddr], r11] \n\t" // load pixel 7 fr om image
77 "add r7, r7, r7 \n\t" // double pixel 3 for RGB565 lookup
78 "ldrh r4, [%[table], r4] \n\t" // load pixel 0 RG B565 from colmap
79 "add r8, r8, r8 \n\t" // double pixel 4 for RGB565 lookup
80 "ldrh r5, [%[table], r5] \n\t" // load pixel 1 RG B565 from colmap
81 "add r9, r9, r9 \n\t" // double pixel 5 for RGB565 lookup
82 "ldrh r6, [%[table], r6] \n\t" // load pixel 2 RG B565 from colmap
83 "add r10, r10, r10 \n\t" // double pixel 6 for RGB565 lookup
84 "ldrh r7, [%[table], r7] \n\t" // load pixel 3 RG B565 from colmap
85 "add r11, r11, r11 \n\t" // double pixel 7 for RGB565 lookup
86 "ldrh r8, [%[table], r8] \n\t" // load pixel 4 RG B565 from colmap
87 "ldrh r9, [%[table], r9] \n\t" // load pixel 5 RG B565 from colmap
88 "ldrh r10, [%[table], r10] \n\t" // load pixel 6 RG B565 from colmap
89 "ldrh r11, [%[table], r11] \n\t" // load pixel 7 RG B565 from colmap
90 "pkhbt r5, r4, r5, lsl #16 \n\t" // pack pixels 0 a nd 1
91 "pkhbt r6, r6, r7, lsl #16 \n\t" // pack pixels 2 a nd 3
92 "pkhbt r8, r8, r9, lsl #16 \n\t" // pack pixels 4 a nd 5
93 "pkhbt r10, r10, r11, lsl #16 \n\t" // pack pixels 6 a nd 7
94 "stmia %[colors]!, {r5, r6, r8, r10} \n\t" // store last 8 pi xels
95 "bgt 1b \n\t" // loop if counter > 0
96 "2: \n\t"
97 : [xx] "+r" (xx), [count8] "+r" (count8), [colors] "+r" (colors)
98 : [table] "r" (table), [srcAddr] "r" (srcAddr)
99 : "memory", "cc", "r4", "r5", "r6", "r7", "r8", "r9", "r10", "r11"
100 );
101
102 for (i = (count & 7); i > 0; --i) {
103 src = srcAddr[*xx++]; *colors++ = table[src];
104 }
105 }
106 }
107
108 void SI8_opaque_D32_nofilter_DX_arm(
109 const SkBitmapProcState& s,
110 const uint32_t* SK_RESTRICT xy,
111 int count,
112 SkPMColor* SK_RESTRICT colors) SK_ATTRIBUTE_OPTIMIZE_O1;
113
114 void SI8_opaque_D32_nofilter_DX_arm(const SkBitmapProcState& s,
115 const uint32_t* SK_RESTRICT xy,
116 int count, SkPMColor* SK_RESTRICT colors) {
117 SkASSERT(count > 0 && colors != NULL);
118 SkASSERT(s.fInvType <= (SkMatrix::kTranslate_Mask | SkMatrix::kScale_Mask));
119 SkASSERT(kNone_SkFilterQuality == s.fFilterLevel);
120
121 const SkPMColor* SK_RESTRICT table = s.fPixmap.ctable()->readColors();
122 const uint8_t* SK_RESTRICT srcAddr = (const uint8_t*)s.fPixmap.addr();
123
124 // buffer is y32, x16, x16, x16, x16, x16
125 // bump srcAddr to the proper row, since we're told Y never changes
126 SkASSERT((unsigned)xy[0] < (unsigned)s.fPixmap.height());
127 srcAddr = (const uint8_t*)((const char*)srcAddr + xy[0] * s.fPixmap.rowBytes ());
128
129 if (1 == s.fPixmap.width()) {
130 uint8_t src = srcAddr[0];
131 SkPMColor dstValue = table[src];
132 sk_memset32(colors, dstValue, count);
133 } else {
134 const uint16_t* xx = (const uint16_t*)(xy + 1);
135
136 asm volatile (
137 "subs %[count], %[count], #8 \n\t" // decrement count by 8, set flags
138 "blt 2f \n\t" // if count < 0, b ranch to singles
139 "1: \n\t" // eights loop
140 "ldmia %[xx]!, {r5, r7, r9, r11} \n\t" // load ptrs to pi xels 0-7
141 "uxth r4, r5 \n\t" // extract ptr 0
142 "mov r5, r5, lsr #16 \n\t" // extract ptr 1
143 "uxth r6, r7 \n\t" // extract ptr 2
144 "mov r7, r7, lsr #16 \n\t" // extract ptr 3
145 "ldrb r4, [%[srcAddr], r4] \n\t" // load pixel 0 fr om image
146 "uxth r8, r9 \n\t" // extract ptr 4
147 "ldrb r5, [%[srcAddr], r5] \n\t" // load pixel 1 fr om image
148 "mov r9, r9, lsr #16 \n\t" // extract ptr 5
149 "ldrb r6, [%[srcAddr], r6] \n\t" // load pixel 2 fr om image
150 "uxth r10, r11 \n\t" // extract ptr 6
151 "ldrb r7, [%[srcAddr], r7] \n\t" // load pixel 3 fr om image
152 "mov r11, r11, lsr #16 \n\t" // extract ptr 7
153 "ldrb r8, [%[srcAddr], r8] \n\t" // load pixel 4 fr om image
154 "ldrb r9, [%[srcAddr], r9] \n\t" // load pixel 5 fr om image
155 "ldrb r10, [%[srcAddr], r10] \n\t" // load pixel 6 fr om image
156 "ldrb r11, [%[srcAddr], r11] \n\t" // load pixel 7 fr om image
157 "ldr r4, [%[table], r4, lsl #2] \n\t" // load pixel 0 Sk PMColor from colmap
158 "ldr r5, [%[table], r5, lsl #2] \n\t" // load pixel 1 Sk PMColor from colmap
159 "ldr r6, [%[table], r6, lsl #2] \n\t" // load pixel 2 Sk PMColor from colmap
160 "ldr r7, [%[table], r7, lsl #2] \n\t" // load pixel 3 Sk PMColor from colmap
161 "ldr r8, [%[table], r8, lsl #2] \n\t" // load pixel 4 Sk PMColor from colmap
162 "ldr r9, [%[table], r9, lsl #2] \n\t" // load pixel 5 Sk PMColor from colmap
163 "ldr r10, [%[table], r10, lsl #2] \n\t" // load pixel 6 Sk PMColor from colmap
164 "ldr r11, [%[table], r11, lsl #2] \n\t" // load pixel 7 Sk PMColor from colmap
165 "subs %[count], %[count], #8 \n\t" // decrement loop counter
166 "stmia %[colors]!, {r4-r11} \n\t" // store 8 pixels
167 "bge 1b \n\t" // loop if counter >= 0
168 "2: \n\t"
169 "adds %[count], %[count], #8 \n\t" // fix up counter, set flags
170 "beq 4f \n\t" // if count == 0, branch to exit
171 "3: \n\t" // singles loop
172 "ldrh r4, [%[xx]], #2 \n\t" // load pixel ptr
173 "subs %[count], %[count], #1 \n\t" // decrement loop counter
174 "ldrb r5, [%[srcAddr], r4] \n\t" // load pixel from image
175 "ldr r6, [%[table], r5, lsl #2] \n\t" // load SkPMColor from colmap
176 "str r6, [%[colors]], #4 \n\t" // store pixel, up date ptr
177 "bne 3b \n\t" // loop if counter != 0
178 "4: \n\t" // exit
179 : [xx] "+r" (xx), [count] "+r" (count), [colors] "+r" (colors)
180 : [table] "r" (table), [srcAddr] "r" (srcAddr)
181 : "memory", "cc", "r4", "r5", "r6", "r7", "r8", "r9", "r10", "r11"
182 );
183 }
184 }
185 #endif // !defined(SK_CPU_ARM64) && SK_ARM_ARCH >= 6 && !defined(SK_CPU_BENDIAN)
186 20
187 /////////////////////////////////////////////////////////////////////////////// 21 ///////////////////////////////////////////////////////////////////////////////
188 22
189 /* If we replace a sampleproc, then we null-out the associated shaderproc,
190 otherwise the shader won't even look at the matrix/sampler
191 */
192 void SkBitmapProcState::platformProcs() {
193 #if !defined(SK_CPU_ARM64) && SK_ARM_ARCH >= 6 && !defined(SK_CPU_BENDIAN)
194 bool isOpaque = 256 == fAlphaScale;
195 bool justDx = false;
196
197 if (fInvType <= (SkMatrix::kTranslate_Mask | SkMatrix::kScale_Mask)) {
198 justDx = true;
199 }
200
201 switch (fPixmap.colorType()) {
202 case kIndex_8_SkColorType:
203 if (justDx && kNone_SkFilterQuality == fFilterLevel) {
204 #if 0 /* crashing on android device */
205 fSampleProc16 = SI8_D16_nofilter_DX_arm;
206 fShaderProc16 = NULL;
207 #endif
208 if (isOpaque) {
209 // this one is only very slighty faster than the C version
210 fSampleProc32 = SI8_opaque_D32_nofilter_DX_arm;
211 fShaderProc32 = NULL;
212 }
213 }
214 break;
215 default:
216 break;
217 }
218 #endif
219 }
220
221 ///////////////////////////////////////////////////////////////////////////////
222
223 extern void platformConvolutionProcs_arm_neon(SkConvolutionProcs* procs); 23 extern void platformConvolutionProcs_arm_neon(SkConvolutionProcs* procs);
224 24
225 void platformConvolutionProcs_arm(SkConvolutionProcs* procs) { 25 void platformConvolutionProcs_arm(SkConvolutionProcs* procs) {
226 } 26 }
227 27
228 void SkBitmapScaler::PlatformConvolutionProcs(SkConvolutionProcs* procs) { 28 void SkBitmapScaler::PlatformConvolutionProcs(SkConvolutionProcs* procs) {
229 SK_ARM_NEON_WRAP(platformConvolutionProcs_arm)(procs); 29 SK_ARM_NEON_WRAP(platformConvolutionProcs_arm)(procs);
230 } 30 }
OLDNEW
« no previous file with comments | « no previous file | src/opts/SkBlitRow_opts_arm.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698