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

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

Issue 1229673008: Optimize RGB16 blitH functions with NEON for ARM platform. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 5 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
« src/core/SkBlitter_RGB16.cpp ('K') | « src/core/SkBlitter_RGB16.cpp ('k') | no next file » | 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 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
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 }
OLDNEW
« src/core/SkBlitter_RGB16.cpp ('K') | « src/core/SkBlitter_RGB16.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698