OLD | NEW |
1 #ifndef SkColor_opts_neon_DEFINED | 1 #ifndef SkColor_opts_neon_DEFINED |
2 #define SkColor_opts_neon_DEFINED | 2 #define SkColor_opts_neon_DEFINED |
3 | 3 |
4 #include "SkTypes.h" | 4 #include "SkTypes.h" |
| 5 #include "SkColorPriv.h" |
5 | 6 |
6 #include <arm_neon.h> | 7 #include <arm_neon.h> |
7 | 8 |
8 #define NEON_A (SK_A32_SHIFT / 8) | 9 #define NEON_A (SK_A32_SHIFT / 8) |
9 #define NEON_R (SK_R32_SHIFT / 8) | 10 #define NEON_R (SK_R32_SHIFT / 8) |
10 #define NEON_G (SK_G32_SHIFT / 8) | 11 #define NEON_G (SK_G32_SHIFT / 8) |
11 #define NEON_B (SK_B32_SHIFT / 8) | 12 #define NEON_B (SK_B32_SHIFT / 8) |
12 | 13 |
13 static inline uint16x8_t SkAlpha255To256_neon8(uint8x8_t alpha) { | 14 static inline uint16x8_t SkAlpha255To256_neon8(uint8x8_t alpha) { |
14 return vaddw_u8(vdupq_n_u16(1), alpha); | 15 return vaddw_u8(vdupq_n_u16(1), alpha); |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 | 59 |
59 uint16x8_t ret; | 60 uint16x8_t ret; |
60 | 61 |
61 ret = vshll_n_u8(vsrc.val[NEON_R], 8); | 62 ret = vshll_n_u8(vsrc.val[NEON_R], 8); |
62 ret = vsriq_n_u16(ret, vshll_n_u8(vsrc.val[NEON_G], 8), SK_R16_BITS); | 63 ret = vsriq_n_u16(ret, vshll_n_u8(vsrc.val[NEON_G], 8), SK_R16_BITS); |
63 ret = vsriq_n_u16(ret, vshll_n_u8(vsrc.val[NEON_B], 8), SK_R16_BITS + SK_G16
_BITS); | 64 ret = vsriq_n_u16(ret, vshll_n_u8(vsrc.val[NEON_B], 8), SK_R16_BITS + SK_G16
_BITS); |
64 | 65 |
65 return ret; | 66 return ret; |
66 } | 67 } |
67 | 68 |
| 69 /* This function blends 8 pixels of the same channel in the exact same way as |
| 70 * SkBlend32. |
| 71 */ |
| 72 static inline uint8x8_t SkBlend32_neon8(uint8x8_t src, uint8x8_t dst, uint16x8_t
scale) { |
| 73 int16x8_t src_wide, dst_wide; |
| 74 |
| 75 src_wide = vreinterpretq_s16_u16(vmovl_u8(src)); |
| 76 dst_wide = vreinterpretq_s16_u16(vmovl_u8(dst)); |
| 77 |
| 78 src_wide = (src_wide - dst_wide) * vreinterpretq_s16_u16(scale); |
| 79 |
| 80 dst_wide += vshrq_n_s16(src_wide, 5); |
| 81 |
| 82 return vmovn_u16(vreinterpretq_u16_s16(dst_wide)); |
| 83 } |
| 84 |
68 #endif /* #ifndef SkColor_opts_neon_DEFINED */ | 85 #endif /* #ifndef SkColor_opts_neon_DEFINED */ |
OLD | NEW |