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

Side by Side Diff: src/core/SkBlitter_RGB16.cpp

Issue 1229673008: Optimize RGB16 blitH functions with NEON for ARM platform. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Rename the varible 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/SkBlitMask_opts_arm_neon.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 2006 The Android Open Source Project 2 * Copyright 2006 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.h" 8 #include "SkBlitRow.h"
9 #include "SkCoreBlitters.h" 9 #include "SkCoreBlitters.h"
10 #include "SkColorPriv.h" 10 #include "SkColorPriv.h"
11 #include "SkDither.h" 11 #include "SkDither.h"
12 #include "SkShader.h" 12 #include "SkShader.h"
13 #include "SkUtils.h" 13 #include "SkUtils.h"
14 #include "SkUtilsArm.h" 14 #include "SkUtilsArm.h"
15 #include "SkXfermode.h" 15 #include "SkXfermode.h"
16 16
17 #if SK_MIPS_HAS_DSP 17 #if SK_MIPS_HAS_DSP
18 extern void blitmask_d565_opaque_mips(int width, int height, uint16_t* device, 18 extern void blitmask_d565_opaque_mips(int width, int height, uint16_t* device,
19 unsigned deviceRB, const uint8_t* alpha, 19 unsigned deviceRB, const uint8_t* alpha,
20 uint32_t expanded32, unsigned maskRB); 20 uint32_t expanded32, unsigned maskRB);
21 #endif 21 #endif
22 22
23 #if SK_ARM_NEON_IS_ALWAYS && defined(SK_CPU_LENDIAN) 23 #if SK_ARM_NEON_IS_ALWAYS && defined(SK_CPU_LENDIAN)
24 #include <arm_neon.h> 24 #include <arm_neon.h>
25 extern void SkRGB16BlitterBlitV_neon(uint16_t* device, 25 extern void SkRGB16BlitterBlitV_neon(uint16_t* device,
26 int height, 26 int height,
27 size_t deviceRB, 27 size_t deviceRB,
28 unsigned scale, 28 unsigned scale,
29 uint32_t src32); 29 uint32_t src32);
30 extern void SkRGB16BlitterBlitH_neon(uint16_t* device,
31 int width,
32 unsigned scale,
33 uint32_t src32);
30 #else 34 #else
31 // if we don't have neon, then our black blitter is worth the extra code 35 // if we don't have neon, then our black blitter is worth the extra code
32 #define USE_BLACK_BLITTER 36 #define USE_BLACK_BLITTER
33 #endif 37 #endif
34 38
35 void sk_dither_memset16(uint16_t dst[], uint16_t value, uint16_t other, 39 void sk_dither_memset16(uint16_t dst[], uint16_t value, uint16_t other,
36 int count) { 40 int count) {
37 if (count > 0) { 41 if (count > 0) {
38 // see if we need to write one short before we can cast to an 4byte ptr 42 // see if we need to write one short before we can cast to an 4byte ptr
39 // (we do this subtract rather than (unsigned)dst so we don't get warnin gs 43 // (we do this subtract rather than (unsigned)dst so we don't get warnin gs
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after
331 ditherColor, count); 335 ditherColor, count);
332 } else { 336 } else {
333 sk_memset16(device, srcColor, count); 337 sk_memset16(device, srcColor, count);
334 } 338 }
335 } else { 339 } else {
336 // TODO: respect fDoDither 340 // TODO: respect fDoDither
337 unsigned scale5 = SkAlpha255To256(aa) >> 3; 341 unsigned scale5 = SkAlpha255To256(aa) >> 3;
338 uint32_t src32 = srcExpanded * scale5; 342 uint32_t src32 = srcExpanded * scale5;
339 scale5 = 32 - scale5; // now we can use it on the device 343 scale5 = 32 - scale5; // now we can use it on the device
340 int n = count; 344 int n = count;
345 #if SK_ARM_NEON_IS_ALWAYS && defined(SK_CPU_LENDIAN)
346 SkRGB16BlitterBlitH_neon(device, n, scale5, src32);
347 #else
341 do { 348 do {
342 uint32_t dst32 = SkExpand_rgb_16(*device) * scale5; 349 uint32_t dst32 = SkExpand_rgb_16(*device) * scale5;
343 *device++ = SkCompact_rgb_16((src32 + dst32) >> 5); 350 *device++ = SkCompact_rgb_16((src32 + dst32) >> 5);
344 } while (--n != 0); 351 } while (--n != 0);
352 #endif
345 goto DONE; 353 goto DONE;
346 } 354 }
347 } 355 }
348 device += count; 356 device += count;
349 357
350 DONE: 358 DONE:
351 // if we have no dithering, this will always fail 359 // if we have no dithering, this will always fail
352 if (count & ditherInt) { 360 if (count & ditherInt) {
353 SkTSwap(ditherColor, srcColor); 361 SkTSwap(ditherColor, srcColor);
354 } 362 }
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after
594 return; 602 return;
595 } 603 }
596 runs += count; 604 runs += count;
597 605
598 unsigned aa = antialias[0]; 606 unsigned aa = antialias[0];
599 antialias += count; 607 antialias += count;
600 if (aa) { 608 if (aa) {
601 unsigned scale5 = SkAlpha255To256(aa) * scale >> (8 + 3); 609 unsigned scale5 = SkAlpha255To256(aa) * scale >> (8 + 3);
602 uint32_t src32 = srcExpanded * scale5; 610 uint32_t src32 = srcExpanded * scale5;
603 scale5 = 32 - scale5; 611 scale5 = 32 - scale5;
612 #if SK_ARM_NEON_IS_ALWAYS && defined(SK_CPU_LENDIAN)
613 SkRGB16BlitterBlitH_neon(device, count, scale5, src32);
614 #else
604 do { 615 do {
605 uint32_t dst32 = SkExpand_rgb_16(*device) * scale5; 616 uint32_t dst32 = SkExpand_rgb_16(*device) * scale5;
606 *device++ = SkCompact_rgb_16((src32 + dst32) >> 5); 617 *device++ = SkCompact_rgb_16((src32 + dst32) >> 5);
607 } while (--count != 0); 618 } while (--count != 0);
619 #endif
608 continue; 620 continue;
609 } 621 }
610 device += count; 622 device += count;
611 } 623 }
612 } 624 }
613 625
614 static inline void blend_8_pixels(U8CPU bw, uint16_t dst[], unsigned dst_scale, 626 static inline void blend_8_pixels(U8CPU bw, uint16_t dst[], unsigned dst_scale,
615 U16CPU srcColor) { 627 U16CPU srcColor) {
616 if (bw & 0x80) dst[0] = srcColor + SkAlphaMulRGB16(dst[0], dst_scale); 628 if (bw & 0x80) dst[0] = srcColor + SkAlphaMulRGB16(dst[0], dst_scale);
617 if (bw & 0x40) dst[1] = srcColor + SkAlphaMulRGB16(dst[1], dst_scale); 629 if (bw & 0x40) dst[1] = srcColor + SkAlphaMulRGB16(dst[1], dst_scale);
(...skipping 445 matching lines...) Expand 10 before | Expand all | Expand 10 after
1063 #endif 1075 #endif
1064 } else if (0xFF == SkColorGetA(color)) { 1076 } else if (0xFF == SkColorGetA(color)) {
1065 blitter = allocator->createT<SkRGB16_Opaque_Blitter>(device, paint); 1077 blitter = allocator->createT<SkRGB16_Opaque_Blitter>(device, paint);
1066 } else { 1078 } else {
1067 blitter = allocator->createT<SkRGB16_Blitter>(device, paint); 1079 blitter = allocator->createT<SkRGB16_Blitter>(device, paint);
1068 } 1080 }
1069 } 1081 }
1070 1082
1071 return blitter; 1083 return blitter;
1072 } 1084 }
OLDNEW
« no previous file with comments | « no previous file | src/opts/SkBlitMask_opts_arm_neon.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698