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

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

Issue 1268513003: Revert of Optimize RGB16 blitH functions with NEON for ARM platform. (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/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);
34 #else 30 #else
35 // if we don't have neon, then our black blitter is worth the extra code 31 // if we don't have neon, then our black blitter is worth the extra code
36 #define USE_BLACK_BLITTER 32 #define USE_BLACK_BLITTER
37 #endif 33 #endif
38 34
39 void sk_dither_memset16(uint16_t dst[], uint16_t value, uint16_t other, 35 void sk_dither_memset16(uint16_t dst[], uint16_t value, uint16_t other,
40 int count) { 36 int count) {
41 if (count > 0) { 37 if (count > 0) {
42 // see if we need to write one short before we can cast to an 4byte ptr 38 // see if we need to write one short before we can cast to an 4byte ptr
43 // (we do this subtract rather than (unsigned)dst so we don't get warnin gs 39 // (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
335 ditherColor, count); 331 ditherColor, count);
336 } else { 332 } else {
337 sk_memset16(device, srcColor, count); 333 sk_memset16(device, srcColor, count);
338 } 334 }
339 } else { 335 } else {
340 // TODO: respect fDoDither 336 // TODO: respect fDoDither
341 unsigned scale5 = SkAlpha255To256(aa) >> 3; 337 unsigned scale5 = SkAlpha255To256(aa) >> 3;
342 uint32_t src32 = srcExpanded * scale5; 338 uint32_t src32 = srcExpanded * scale5;
343 scale5 = 32 - scale5; // now we can use it on the device 339 scale5 = 32 - scale5; // now we can use it on the device
344 int n = count; 340 int n = count;
345 #if SK_ARM_NEON_IS_ALWAYS && defined(SK_CPU_LENDIAN)
346 SkRGB16BlitterBlitH_neon(device, n, scale5, src32);
347 #else
348 do { 341 do {
349 uint32_t dst32 = SkExpand_rgb_16(*device) * scale5; 342 uint32_t dst32 = SkExpand_rgb_16(*device) * scale5;
350 *device++ = SkCompact_rgb_16((src32 + dst32) >> 5); 343 *device++ = SkCompact_rgb_16((src32 + dst32) >> 5);
351 } while (--n != 0); 344 } while (--n != 0);
352 #endif
353 goto DONE; 345 goto DONE;
354 } 346 }
355 } 347 }
356 device += count; 348 device += count;
357 349
358 DONE: 350 DONE:
359 // if we have no dithering, this will always fail 351 // if we have no dithering, this will always fail
360 if (count & ditherInt) { 352 if (count & ditherInt) {
361 SkTSwap(ditherColor, srcColor); 353 SkTSwap(ditherColor, srcColor);
362 } 354 }
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after
602 return; 594 return;
603 } 595 }
604 runs += count; 596 runs += count;
605 597
606 unsigned aa = antialias[0]; 598 unsigned aa = antialias[0];
607 antialias += count; 599 antialias += count;
608 if (aa) { 600 if (aa) {
609 unsigned scale5 = SkAlpha255To256(aa) * scale >> (8 + 3); 601 unsigned scale5 = SkAlpha255To256(aa) * scale >> (8 + 3);
610 uint32_t src32 = srcExpanded * scale5; 602 uint32_t src32 = srcExpanded * scale5;
611 scale5 = 32 - scale5; 603 scale5 = 32 - scale5;
612 #if SK_ARM_NEON_IS_ALWAYS && defined(SK_CPU_LENDIAN)
613 SkRGB16BlitterBlitH_neon(device, count, scale5, src32);
614 #else
615 do { 604 do {
616 uint32_t dst32 = SkExpand_rgb_16(*device) * scale5; 605 uint32_t dst32 = SkExpand_rgb_16(*device) * scale5;
617 *device++ = SkCompact_rgb_16((src32 + dst32) >> 5); 606 *device++ = SkCompact_rgb_16((src32 + dst32) >> 5);
618 } while (--count != 0); 607 } while (--count != 0);
619 #endif
620 continue; 608 continue;
621 } 609 }
622 device += count; 610 device += count;
623 } 611 }
624 } 612 }
625 613
626 static inline void blend_8_pixels(U8CPU bw, uint16_t dst[], unsigned dst_scale, 614 static inline void blend_8_pixels(U8CPU bw, uint16_t dst[], unsigned dst_scale,
627 U16CPU srcColor) { 615 U16CPU srcColor) {
628 if (bw & 0x80) dst[0] = srcColor + SkAlphaMulRGB16(dst[0], dst_scale); 616 if (bw & 0x80) dst[0] = srcColor + SkAlphaMulRGB16(dst[0], dst_scale);
629 if (bw & 0x40) dst[1] = srcColor + SkAlphaMulRGB16(dst[1], dst_scale); 617 if (bw & 0x40) dst[1] = srcColor + SkAlphaMulRGB16(dst[1], dst_scale);
(...skipping 445 matching lines...) Expand 10 before | Expand all | Expand 10 after
1075 #endif 1063 #endif
1076 } else if (0xFF == SkColorGetA(color)) { 1064 } else if (0xFF == SkColorGetA(color)) {
1077 blitter = allocator->createT<SkRGB16_Opaque_Blitter>(device, paint); 1065 blitter = allocator->createT<SkRGB16_Opaque_Blitter>(device, paint);
1078 } else { 1066 } else {
1079 blitter = allocator->createT<SkRGB16_Blitter>(device, paint); 1067 blitter = allocator->createT<SkRGB16_Blitter>(device, paint);
1080 } 1068 }
1081 } 1069 }
1082 1070
1083 return blitter; 1071 return blitter;
1084 } 1072 }
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