OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2012 The Android Open Source Project | 2 * Copyright 2012 The Android Open Source Project |
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 "SkBitmapProcState_opts_SSSE3.h" | 8 #include "SkBitmapProcState_opts_SSSE3.h" |
9 #include "SkPaint.h" | 9 #include "SkPaint.h" |
10 #include "SkUtils.h" | 10 #include "SkUtils.h" |
(...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
418 8, 8, 8, 8, | 418 8, 8, 8, 8, |
419 4, 4, 4, 4, | 419 4, 4, 4, 4, |
420 0, 0, 0, 0); | 420 0, 0, 0, 0); |
421 const __m128i mask_3FFF = _mm_set1_epi32(0x3FFF); | 421 const __m128i mask_3FFF = _mm_set1_epi32(0x3FFF); |
422 const __m128i mask_000F = _mm_set1_epi32(0x000F); | 422 const __m128i mask_000F = _mm_set1_epi32(0x000F); |
423 const __m128i sixteen_8bit = _mm_set1_epi8(16); | 423 const __m128i sixteen_8bit = _mm_set1_epi8(16); |
424 // (0, 0, 0, 0, 0, 0, 0, 0) | 424 // (0, 0, 0, 0, 0, 0, 0, 0) |
425 const __m128i zero = _mm_setzero_si128(); | 425 const __m128i zero = _mm_setzero_si128(); |
426 | 426 |
427 __m128i alpha = _mm_setzero_si128(); | 427 __m128i alpha = _mm_setzero_si128(); |
428 if (has_alpha) | 428 if (has_alpha) { |
429 // 8x(alpha) | 429 // 8x(alpha) |
430 alpha = _mm_set1_epi16(s.fAlphaScale); | 430 alpha = _mm_set1_epi16(s.fAlphaScale); |
| 431 } |
431 | 432 |
432 if (sub_y == 0) { | 433 if (sub_y == 0) { |
433 // Unroll 4x, interleave bytes, use pmaddubsw (all_x is small) | 434 // Unroll 4x, interleave bytes, use pmaddubsw (all_x is small) |
434 while (count > 3) { | 435 while (count > 3) { |
435 count -= 4; | 436 count -= 4; |
436 | 437 |
437 int x0[4]; | 438 int x0[4]; |
438 int x1[4]; | 439 int x1[4]; |
439 __m128i all_x, sixteen_minus_x; | 440 __m128i all_x, sixteen_minus_x; |
440 PrepareConstantsTwoPixelPairs(xy, mask_3FFF, mask_000F, | 441 PrepareConstantsTwoPixelPairs(xy, mask_3FFF, mask_000F, |
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
698 | 699 |
699 sum0 = ScaleFourPixels<has_alpha, 8>(&sum0, alpha); | 700 sum0 = ScaleFourPixels<has_alpha, 8>(&sum0, alpha); |
700 | 701 |
701 // Pack lower 4 16 bit values of sum into lower 4 bytes. | 702 // Pack lower 4 16 bit values of sum into lower 4 bytes. |
702 sum0 = _mm_packus_epi16(sum0, _mm_setzero_si128()); | 703 sum0 = _mm_packus_epi16(sum0, _mm_setzero_si128()); |
703 | 704 |
704 // Extract low int and store. | 705 // Extract low int and store. |
705 *colors++ = _mm_cvtsi128_si32(sum0); | 706 *colors++ = _mm_cvtsi128_si32(sum0); |
706 } | 707 } |
707 } | 708 } |
708 } // namepace | 709 } // namespace |
709 | 710 |
710 void S32_opaque_D32_filter_DX_SSSE3(const SkBitmapProcState& s, | 711 void S32_opaque_D32_filter_DX_SSSE3(const SkBitmapProcState& s, |
711 const uint32_t* xy, | 712 const uint32_t* xy, |
712 int count, uint32_t* colors) { | 713 int count, uint32_t* colors) { |
713 S32_generic_D32_filter_DX_SSSE3<false>(s, xy, count, colors); | 714 S32_generic_D32_filter_DX_SSSE3<false>(s, xy, count, colors); |
714 } | 715 } |
715 | 716 |
716 void S32_alpha_D32_filter_DX_SSSE3(const SkBitmapProcState& s, | 717 void S32_alpha_D32_filter_DX_SSSE3(const SkBitmapProcState& s, |
717 const uint32_t* xy, | 718 const uint32_t* xy, |
718 int count, uint32_t* colors) { | 719 int count, uint32_t* colors) { |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
751 sk_throw(); | 752 sk_throw(); |
752 } | 753 } |
753 | 754 |
754 void S32_alpha_D32_filter_DXDY_SSSE3(const SkBitmapProcState& s, | 755 void S32_alpha_D32_filter_DXDY_SSSE3(const SkBitmapProcState& s, |
755 const uint32_t* xy, | 756 const uint32_t* xy, |
756 int count, uint32_t* colors) { | 757 int count, uint32_t* colors) { |
757 sk_throw(); | 758 sk_throw(); |
758 } | 759 } |
759 | 760 |
760 #endif | 761 #endif |
OLD | NEW |