OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 Google Inc. |
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 "SkBlitMask.h" | 8 #include "SkBlitMask.h" |
9 #include "SkColor_opts_neon.h" | 9 #include "SkColor_opts_neon.h" |
10 | 10 |
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
325 while (height != 0){ | 325 while (height != 0){ |
326 uint32_t dst32 = SkExpand_rgb_16(*device) * scale; | 326 uint32_t dst32 = SkExpand_rgb_16(*device) * scale; |
327 *device = SkCompact_rgb_16((src32 + dst32) >> 5); | 327 *device = SkCompact_rgb_16((src32 + dst32) >> 5); |
328 device = (uint16_t*)((char*)device + deviceRB); | 328 device = (uint16_t*)((char*)device + deviceRB); |
329 height--; | 329 height--; |
330 } | 330 } |
331 } | 331 } |
332 | 332 |
333 #undef LOAD_LANE_16 | 333 #undef LOAD_LANE_16 |
334 #undef STORE_LANE_16 | 334 #undef STORE_LANE_16 |
335 | |
336 void SkRGB16BlitterBlitH_neon(uint16_t* device, | |
337 int height, | |
mtklein
2015/07/29 14:07:11
Let's call this width or count or n? height is ra
yang.zhang
2015/07/30 05:35:34
Done.
| |
338 unsigned scale, | |
339 uint32_t src32) { | |
340 if (height >= 8) | |
341 { | |
342 // prepare constants | |
343 uint16x8_t vdev = vdupq_n_u16(0); | |
344 uint16x8_t vmaskq_g16 = vdupq_n_u16(SK_G16_MASK_IN_PLACE); | |
345 uint16x8_t vmaskq_ng16 = vdupq_n_u16(~SK_G16_MASK_IN_PLACE); | |
346 uint32x4_t vsrc32 = vdupq_n_u32(src32); | |
347 uint32x4_t vscale5 = vdupq_n_u32((uint32_t)scale); | |
348 | |
349 while (height >= 8){ | |
350 vdev = vld1q_u16(device); | |
351 | |
352 // Expand_rgb_16 | |
353 uint16x8x2_t vdst = vzipq_u16((vdev & vmaskq_ng16), (vdev & vmaskq_g 16)); | |
354 uint32x4_t vdst32_lo = vmulq_u32(vreinterpretq_u32_u16(vdst.val[0]), vscale5); | |
355 uint32x4_t vdst32_hi = vmulq_u32(vreinterpretq_u32_u16(vdst.val[1]), vscale5); | |
356 | |
357 // Compact_rgb_16 | |
358 vdst32_lo = vaddq_u32(vdst32_lo, vsrc32); | |
359 vdst32_hi = vaddq_u32(vdst32_hi, vsrc32); | |
360 vdst32_lo = vshrq_n_u32(vdst32_lo, 5); | |
361 vdst32_hi = vshrq_n_u32(vdst32_hi, 5); | |
362 | |
363 uint16x4_t vtmp_lo = vmovn_u32(vdst32_lo) & vget_low_u16(vmaskq_ng16 ); | |
364 uint16x4_t vtmp_hi = vshrn_n_u32(vdst32_lo, 16) & vget_low_u16(vmask q_g16); | |
365 uint16x4_t vdst16_lo = vorr_u16(vtmp_lo, vtmp_hi); | |
366 vtmp_lo = vmovn_u32(vdst32_hi) & vget_low_u16(vmaskq_ng16); | |
367 vtmp_hi = vshrn_n_u32(vdst32_hi, 16) & vget_low_u16(vmaskq_g16); | |
368 uint16x4_t vdst16_hi = vorr_u16(vtmp_lo, vtmp_hi); | |
369 | |
370 vst1q_u16(device, vcombine_u16(vdst16_lo, vdst16_hi)); | |
371 device += 8; | |
372 height -= 8; | |
373 } | |
374 } | |
375 while (height != 0){ | |
376 uint32_t dst32 = SkExpand_rgb_16(*device) * scale; | |
377 *device++ = SkCompact_rgb_16((src32 + dst32) >> 5); | |
378 height--; | |
379 } | |
380 } | |
OLD | NEW |