OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2009 The Android Open Source Project | 2 * Copyright 2009 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 <emmintrin.h> | 8 #include <emmintrin.h> |
9 #include "SkBitmapProcState_opts_SSE2.h" | 9 #include "SkBitmapProcState_opts_SSE2.h" |
10 #include "SkColorPriv.h" | 10 #include "SkColorPriv.h" |
11 #include "SkPaint.h" | 11 #include "SkPaint.h" |
12 #include "SkUtils.h" | 12 #include "SkUtils.h" |
13 | 13 |
14 void S32_opaque_D32_filter_DX_SSE2(const SkBitmapProcState& s, | 14 void S32_opaque_D32_filter_DX_SSE2(const SkBitmapProcState& s, |
15 const uint32_t* xy, | 15 const uint32_t* xy, |
16 int count, uint32_t* colors) { | 16 int count, uint32_t* colors) { |
17 SkASSERT(count > 0 && colors != NULL); | 17 SkASSERT(count > 0 && colors != nullptr); |
18 SkASSERT(s.fFilterLevel != kNone_SkFilterQuality); | 18 SkASSERT(s.fFilterLevel != kNone_SkFilterQuality); |
19 SkASSERT(kN32_SkColorType == s.fPixmap.colorType()); | 19 SkASSERT(kN32_SkColorType == s.fPixmap.colorType()); |
20 SkASSERT(s.fAlphaScale == 256); | 20 SkASSERT(s.fAlphaScale == 256); |
21 | 21 |
22 const char* srcAddr = static_cast<const char*>(s.fPixmap.addr()); | 22 const char* srcAddr = static_cast<const char*>(s.fPixmap.addr()); |
23 size_t rb = s.fPixmap.rowBytes(); | 23 size_t rb = s.fPixmap.rowBytes(); |
24 uint32_t XY = *xy++; | 24 uint32_t XY = *xy++; |
25 unsigned y0 = XY >> 14; | 25 unsigned y0 = XY >> 14; |
26 const uint32_t* row0 = reinterpret_cast<const uint32_t*>(srcAddr + (y0 >> 4)
* rb); | 26 const uint32_t* row0 = reinterpret_cast<const uint32_t*>(srcAddr + (y0 >> 4)
* rb); |
27 const uint32_t* row1 = reinterpret_cast<const uint32_t*>(srcAddr + (XY & 0x3
FFF) * rb); | 27 const uint32_t* row1 = reinterpret_cast<const uint32_t*>(srcAddr + (XY & 0x3
FFF) * rb); |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 sum = _mm_packus_epi16(sum, zero); | 113 sum = _mm_packus_epi16(sum, zero); |
114 | 114 |
115 // Extract low int and store. | 115 // Extract low int and store. |
116 *colors++ = _mm_cvtsi128_si32(sum); | 116 *colors++ = _mm_cvtsi128_si32(sum); |
117 } while (--count > 0); | 117 } while (--count > 0); |
118 } | 118 } |
119 | 119 |
120 void S32_alpha_D32_filter_DX_SSE2(const SkBitmapProcState& s, | 120 void S32_alpha_D32_filter_DX_SSE2(const SkBitmapProcState& s, |
121 const uint32_t* xy, | 121 const uint32_t* xy, |
122 int count, uint32_t* colors) { | 122 int count, uint32_t* colors) { |
123 SkASSERT(count > 0 && colors != NULL); | 123 SkASSERT(count > 0 && colors != nullptr); |
124 SkASSERT(s.fFilterLevel != kNone_SkFilterQuality); | 124 SkASSERT(s.fFilterLevel != kNone_SkFilterQuality); |
125 SkASSERT(kN32_SkColorType == s.fPixmap.colorType()); | 125 SkASSERT(kN32_SkColorType == s.fPixmap.colorType()); |
126 SkASSERT(s.fAlphaScale < 256); | 126 SkASSERT(s.fAlphaScale < 256); |
127 | 127 |
128 const char* srcAddr = static_cast<const char*>(s.fPixmap.addr()); | 128 const char* srcAddr = static_cast<const char*>(s.fPixmap.addr()); |
129 size_t rb = s.fPixmap.rowBytes(); | 129 size_t rb = s.fPixmap.rowBytes(); |
130 uint32_t XY = *xy++; | 130 uint32_t XY = *xy++; |
131 unsigned y0 = XY >> 14; | 131 unsigned y0 = XY >> 14; |
132 const uint32_t* row0 = reinterpret_cast<const uint32_t*>(srcAddr + (y0 >> 4)
* rb); | 132 const uint32_t* row0 = reinterpret_cast<const uint32_t*>(srcAddr + (y0 >> 4)
* rb); |
133 const uint32_t* row1 = reinterpret_cast<const uint32_t*>(srcAddr + (XY & 0x3
FFF) * rb); | 133 const uint32_t* row1 = reinterpret_cast<const uint32_t*>(srcAddr + (XY & 0x3
FFF) * rb); |
(...skipping 499 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
633 } | 633 } |
634 } | 634 } |
635 | 635 |
636 /* SSE version of S32_D16_filter_DX_SSE2 | 636 /* SSE version of S32_D16_filter_DX_SSE2 |
637 * Definition is in section of "D16 functions for SRC == 8888" in SkBitmapProcS
tate.cpp | 637 * Definition is in section of "D16 functions for SRC == 8888" in SkBitmapProcS
tate.cpp |
638 * It combines S32_opaque_D32_filter_DX_SSE2 and SkPixel32ToPixel16 | 638 * It combines S32_opaque_D32_filter_DX_SSE2 and SkPixel32ToPixel16 |
639 */ | 639 */ |
640 void S32_D16_filter_DX_SSE2(const SkBitmapProcState& s, | 640 void S32_D16_filter_DX_SSE2(const SkBitmapProcState& s, |
641 const uint32_t* xy, | 641 const uint32_t* xy, |
642 int count, uint16_t* colors) { | 642 int count, uint16_t* colors) { |
643 SkASSERT(count > 0 && colors != NULL); | 643 SkASSERT(count > 0 && colors != nullptr); |
644 SkASSERT(s.fFilterLevel != kNone_SkFilterQuality); | 644 SkASSERT(s.fFilterLevel != kNone_SkFilterQuality); |
645 SkASSERT(kN32_SkColorType == s.fPixmap.colorType()); | 645 SkASSERT(kN32_SkColorType == s.fPixmap.colorType()); |
646 SkASSERT(s.fPixmap.isOpaque()); | 646 SkASSERT(s.fPixmap.isOpaque()); |
647 | 647 |
648 SkPMColor dstColor; | 648 SkPMColor dstColor; |
649 const char* srcAddr = static_cast<const char*>(s.fPixmap.addr()); | 649 const char* srcAddr = static_cast<const char*>(s.fPixmap.addr()); |
650 size_t rb = s.fPixmap.rowBytes(); | 650 size_t rb = s.fPixmap.rowBytes(); |
651 uint32_t XY = *xy++; | 651 uint32_t XY = *xy++; |
652 unsigned y0 = XY >> 14; | 652 unsigned y0 = XY >> 14; |
653 const uint32_t* row0 = reinterpret_cast<const uint32_t*>(srcAddr + (y0 >> 4)
* rb); | 653 const uint32_t* row0 = reinterpret_cast<const uint32_t*>(srcAddr + (y0 >> 4)
* rb); |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
739 | 739 |
740 // Pack lower 4 16 bit values of sum into lower 4 bytes. | 740 // Pack lower 4 16 bit values of sum into lower 4 bytes. |
741 sum = _mm_packus_epi16(sum, zero); | 741 sum = _mm_packus_epi16(sum, zero); |
742 | 742 |
743 // Extract low int and store. | 743 // Extract low int and store. |
744 dstColor = _mm_cvtsi128_si32(sum); | 744 dstColor = _mm_cvtsi128_si32(sum); |
745 | 745 |
746 *colors++ = SkPixel32ToPixel16(dstColor); | 746 *colors++ = SkPixel32ToPixel16(dstColor); |
747 } while (--count > 0); | 747 } while (--count > 0); |
748 } | 748 } |
OLD | NEW |