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

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: 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 | « 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 width,
338 unsigned scale,
339 uint32_t src32) {
340 if (width >= 8) {
341 // prepare constants
342 uint16x8_t vdev = vdupq_n_u16(0);
343 uint16x8_t vmaskq_g16 = vdupq_n_u16(SK_G16_MASK_IN_PLACE);
344 uint16x8_t vmaskq_ng16 = vdupq_n_u16(~SK_G16_MASK_IN_PLACE);
345 uint32x4_t vsrc32 = vdupq_n_u32(src32);
346 uint32x4_t vscale5 = vdupq_n_u32((uint32_t)scale);
347
348 while (width >= 8) {
349 vdev = vld1q_u16(device);
350
351 // Expand_rgb_16
352 uint16x8x2_t vdst = vzipq_u16((vdev & vmaskq_ng16), (vdev & vmaskq_g 16));
353 uint32x4_t vdst32_lo = vmulq_u32(vreinterpretq_u32_u16(vdst.val[0]), vscale5);
354 uint32x4_t vdst32_hi = vmulq_u32(vreinterpretq_u32_u16(vdst.val[1]), vscale5);
355
356 // Compact_rgb_16
357 vdst32_lo = vaddq_u32(vdst32_lo, vsrc32);
358 vdst32_hi = vaddq_u32(vdst32_hi, vsrc32);
359 vdst32_lo = vshrq_n_u32(vdst32_lo, 5);
360 vdst32_hi = vshrq_n_u32(vdst32_hi, 5);
361
362 uint16x4_t vtmp_lo = vmovn_u32(vdst32_lo) & vget_low_u16(vmaskq_ng16 );
363 uint16x4_t vtmp_hi = vshrn_n_u32(vdst32_lo, 16) & vget_low_u16(vmask q_g16);
364 uint16x4_t vdst16_lo = vorr_u16(vtmp_lo, vtmp_hi);
365 vtmp_lo = vmovn_u32(vdst32_hi) & vget_low_u16(vmaskq_ng16);
366 vtmp_hi = vshrn_n_u32(vdst32_hi, 16) & vget_low_u16(vmaskq_g16);
367 uint16x4_t vdst16_hi = vorr_u16(vtmp_lo, vtmp_hi);
368
369 vst1q_u16(device, vcombine_u16(vdst16_lo, vdst16_hi));
370 device += 8;
371 width -= 8;
372 }
373 }
374 while (width != 0) {
375 uint32_t dst32 = SkExpand_rgb_16(*device) * scale;
376 *device++ = SkCompact_rgb_16((src32 + dst32) >> 5);
377 width--;
378 }
379 }
OLDNEW
« no previous file with comments | « src/core/SkBlitter_RGB16.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698