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

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

Issue 22351006: ARM Skia NEON patches - 21 - new NEON S32_D565_Opaque (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Address review comments + remove dependency Created 7 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | src/opts/SkColor_opts_neon.h » ('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 2012 The Android Open Source Project 2 * Copyright 2012 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 "SkBlitRow_opts_arm_neon.h" 8 #include "SkBlitRow_opts_arm_neon.h"
9 9
10 #include "SkBlitMask.h" 10 #include "SkBlitMask.h"
11 #include "SkBlitRow.h" 11 #include "SkBlitRow.h"
12 #include "SkColorPriv.h" 12 #include "SkColorPriv.h"
13 #include "SkDither.h" 13 #include "SkDither.h"
14 #include "SkMathPriv.h" 14 #include "SkMathPriv.h"
15 #include "SkUtils.h" 15 #include "SkUtils.h"
16 16
17 #include "SkCachePreload_arm.h" 17 #include "SkCachePreload_arm.h"
18 #include "SkColor_opts_neon.h"
19 #include <arm_neon.h>
18 20
19 #include <arm_neon.h> 21 void S32_D565_Opaque_neon(uint16_t* SK_RESTRICT dst,
22 const SkPMColor* SK_RESTRICT src, int count,
23 U8CPU alpha, int /*x*/, int /*y*/) {
24 SkASSERT(255 == alpha);
25
26 while (count >= 8) {
27 uint8x8x4_t vsrc;
28 uint16x8_t vdst;
29
30 // Load
31 vsrc = vld4_u8((uint8_t*)src);
32
33 // Convert src to 565
34 vdst = vshll_n_u8(vsrc.val[NEON_R], 8);
35 vdst = vsriq_n_u16(vdst, vshll_n_u8(vsrc.val[NEON_G], 8), 5);
36 vdst = vsriq_n_u16(vdst, vshll_n_u8(vsrc.val[NEON_B], 8), 5+6);
37
38 // Store
39 vst1q_u16(dst, vdst);
40
41 // Prepare next iteration
42 dst += 8;
43 src += 8;
44 count -= 8;
45 };
46
47 // Leftovers
48 while (count > 0) {
49 SkPMColor c = *src++;
50 SkPMColorAssert(c);
51 *dst = SkPixel32ToPixel16_ToU16(c);
52 dst++;
53 count--;
54 };
55 }
20 56
21 void S32A_D565_Opaque_neon(uint16_t* SK_RESTRICT dst, 57 void S32A_D565_Opaque_neon(uint16_t* SK_RESTRICT dst,
22 const SkPMColor* SK_RESTRICT src, int count, 58 const SkPMColor* SK_RESTRICT src, int count,
23 U8CPU alpha, int /*x*/, int /*y*/) { 59 U8CPU alpha, int /*x*/, int /*y*/) {
24 SkASSERT(255 == alpha); 60 SkASSERT(255 == alpha);
25 61
26 if (count >= 8) { 62 if (count >= 8) {
27 uint16_t* SK_RESTRICT keep_dst = 0; 63 uint16_t* SK_RESTRICT keep_dst = 0;
28 64
29 asm volatile ( 65 asm volatile (
(...skipping 1293 matching lines...) Expand 10 before | Expand all | Expand 10 after
1323 dst += 1; 1359 dst += 1;
1324 count--; 1360 count--;
1325 } 1361 }
1326 } 1362 }
1327 } 1363 }
1328 1364
1329 /////////////////////////////////////////////////////////////////////////////// 1365 ///////////////////////////////////////////////////////////////////////////////
1330 1366
1331 const SkBlitRow::Proc sk_blitrow_platform_565_procs_arm_neon[] = { 1367 const SkBlitRow::Proc sk_blitrow_platform_565_procs_arm_neon[] = {
1332 // no dither 1368 // no dither
1333 // NOTE: For the two functions below, we don't have a special version 1369 // NOTE: For the S32_D565_Blend function below, we don't have a special
1334 // that assumes that each source pixel is opaque. But our S32A is 1370 // version that assumes that each source pixel is opaque. But our
1335 // still faster than the default, so use it. 1371 // S32A is still faster than the default, so use it.
1336 S32A_D565_Opaque_neon, // really S32_D565_Opaque 1372 S32_D565_Opaque_neon,
1337 S32A_D565_Blend_neon, // really S32_D565_Blend 1373 S32A_D565_Blend_neon, // really S32_D565_Blend
1338 S32A_D565_Opaque_neon, 1374 S32A_D565_Opaque_neon,
1339 S32A_D565_Blend_neon, 1375 S32A_D565_Blend_neon,
1340 1376
1341 // dither 1377 // dither
1342 S32_D565_Opaque_Dither_neon, 1378 S32_D565_Opaque_Dither_neon,
1343 S32_D565_Blend_Dither_neon, 1379 S32_D565_Blend_Dither_neon,
1344 S32A_D565_Opaque_Dither_neon, 1380 S32A_D565_Opaque_Dither_neon,
1345 NULL, // S32A_D565_Blend_Dither 1381 NULL, // S32A_D565_Blend_Dither
1346 }; 1382 };
(...skipping 11 matching lines...) Expand all
1358 * case where we do not inspect the src alpha. 1394 * case where we do not inspect the src alpha.
1359 */ 1395 */
1360 #if SK_A32_SHIFT == 24 1396 #if SK_A32_SHIFT == 24
1361 // This proc assumes the alpha value occupies bits 24-32 of each SkPMColor 1397 // This proc assumes the alpha value occupies bits 24-32 of each SkPMColor
1362 S32A_Opaque_BlitRow32_neon_src_alpha, // S32A_Opaque, 1398 S32A_Opaque_BlitRow32_neon_src_alpha, // S32A_Opaque,
1363 #else 1399 #else
1364 S32A_Opaque_BlitRow32_neon, // S32A_Opaque, 1400 S32A_Opaque_BlitRow32_neon, // S32A_Opaque,
1365 #endif 1401 #endif
1366 S32A_Blend_BlitRow32_neon // S32A_Blend 1402 S32A_Blend_BlitRow32_neon // S32A_Blend
1367 }; 1403 };
OLDNEW
« no previous file with comments | « no previous file | src/opts/SkColor_opts_neon.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698