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 #ifndef SkBlurImageFilter_opts_DEFINED | 8 #ifndef SkBlurImageFilter_opts_DEFINED |
9 #define SkBlurImageFilter_opts_DEFINED | 9 #define SkBlurImageFilter_opts_DEFINED |
10 | 10 |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 vst1_lane_u32(dptr + width, px2, 1); \ | 81 vst1_lane_u32(dptr + width, px2, 1); \ |
82 } else { \ | 82 } else { \ |
83 vst1_u8((uint8_t*)dptr, vmovn_u16(resultPixels)); \ | 83 vst1_u8((uint8_t*)dptr, vmovn_u16(resultPixels)); \ |
84 } | 84 } |
85 | 85 |
86 #define INCREMENT_SUMS_DOUBLE(p) sum = vaddw_u8(sum, load_2_pixels(p)) | 86 #define INCREMENT_SUMS_DOUBLE(p) sum = vaddw_u8(sum, load_2_pixels(p)) |
87 #define DECREMENT_SUMS_DOUBLE(p) sum = vsubw_u8(sum, load_2_pixels(p)) | 87 #define DECREMENT_SUMS_DOUBLE(p) sum = vsubw_u8(sum, load_2_pixels(p)) |
88 | 88 |
89 // Fast path for kernel sizes between 2 and 127, working on two rows at a time. | 89 // Fast path for kernel sizes between 2 and 127, working on two rows at a time. |
90 template<BlurDirection srcDirection, BlurDirection dstDirection> | 90 template<BlurDirection srcDirection, BlurDirection dstDirection> |
91 int box_blur_double(const SkPMColor** src, int srcStride, const SkIRect& srcBoun
ds, SkPMColor** dst, int kernelSize, | 91 static int box_blur_double(const SkPMColor** src, int srcStride, const SkIRect&
srcBounds, |
92 int leftOffset, int rightOffset, int width, int height) { | 92 SkPMColor** dst, int kernelSize, |
| 93 int leftOffset, int rightOffset, int width, int heigh
t) { |
93 // Load 2 pixels from adjacent rows. | 94 // Load 2 pixels from adjacent rows. |
94 auto load_2_pixels = [&](const SkPMColor* s) { | 95 auto load_2_pixels = [&](const SkPMColor* s) { |
95 if (srcDirection == BlurDirection::kX) { | 96 if (srcDirection == BlurDirection::kX) { |
96 // 10% faster by adding these 2 prefetches | 97 // 10% faster by adding these 2 prefetches |
97 SK_PREFETCH(s + 16); | 98 SK_PREFETCH(s + 16); |
98 SK_PREFETCH(s + 16 + srcStride); | 99 SK_PREFETCH(s + 16 + srcStride); |
99 auto one = vld1_lane_u32(s + 0, vdup_n_u32(0), 0), | 100 auto one = vld1_lane_u32(s + 0, vdup_n_u32(0), 0), |
100 two = vld1_lane_u32(s + srcStride, one, 1); | 101 two = vld1_lane_u32(s + srcStride, one, 1); |
101 return vreinterpret_u8_u32(two); | 102 return vreinterpret_u8_u32(two); |
102 } else { | 103 } else { |
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
313 } | 314 } |
314 } | 315 } |
315 | 316 |
316 static auto box_blur_xx = &box_blur<BlurDirection::kX, BlurDirection::kX>, | 317 static auto box_blur_xx = &box_blur<BlurDirection::kX, BlurDirection::kX>, |
317 box_blur_xy = &box_blur<BlurDirection::kX, BlurDirection::kY>, | 318 box_blur_xy = &box_blur<BlurDirection::kX, BlurDirection::kY>, |
318 box_blur_yx = &box_blur<BlurDirection::kY, BlurDirection::kX>; | 319 box_blur_yx = &box_blur<BlurDirection::kY, BlurDirection::kX>; |
319 | 320 |
320 } // namespace SK_OPTS_NS | 321 } // namespace SK_OPTS_NS |
321 | 322 |
322 #endif | 323 #endif |
OLD | NEW |