OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2009 The Android Open Source Project | 3 * Copyright 2009 The Android Open Source Project |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 | 8 |
9 | 9 |
10 #include <emmintrin.h> | 10 #include <emmintrin.h> |
11 #include "SkBitmapProcState_opts_SSE2.h" | 11 #include "SkBitmapProcState_opts_SSE2.h" |
| 12 #include "SkPaint.h" |
12 #include "SkUtils.h" | 13 #include "SkUtils.h" |
13 | 14 |
14 void S32_opaque_D32_filter_DX_SSE2(const SkBitmapProcState& s, | 15 void S32_opaque_D32_filter_DX_SSE2(const SkBitmapProcState& s, |
15 const uint32_t* xy, | 16 const uint32_t* xy, |
16 int count, uint32_t* colors) { | 17 int count, uint32_t* colors) { |
17 SkASSERT(count > 0 && colors != NULL); | 18 SkASSERT(count > 0 && colors != NULL); |
18 SkASSERT(s.fFilterQuality != SkBitmapProcState::kNone_BitmapFilter); | 19 SkASSERT(s.fFilterLevel != SkPaint::kNone_FilterLevel); |
19 SkASSERT(s.fBitmap->config() == SkBitmap::kARGB_8888_Config); | 20 SkASSERT(s.fBitmap->config() == SkBitmap::kARGB_8888_Config); |
20 SkASSERT(s.fAlphaScale == 256); | 21 SkASSERT(s.fAlphaScale == 256); |
21 | 22 |
22 const char* srcAddr = static_cast<const char*>(s.fBitmap->getPixels()); | 23 const char* srcAddr = static_cast<const char*>(s.fBitmap->getPixels()); |
23 size_t rb = s.fBitmap->rowBytes(); | 24 size_t rb = s.fBitmap->rowBytes(); |
24 uint32_t XY = *xy++; | 25 uint32_t XY = *xy++; |
25 unsigned y0 = XY >> 14; | 26 unsigned y0 = XY >> 14; |
26 const uint32_t* row0 = reinterpret_cast<const uint32_t*>(srcAddr + (y0 >> 4)
* rb); | 27 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); | 28 const uint32_t* row1 = reinterpret_cast<const uint32_t*>(srcAddr + (XY & 0x3
FFF) * rb); |
28 unsigned subY = y0 & 0xF; | 29 unsigned subY = y0 & 0xF; |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 | 115 |
115 // Extract low int and store. | 116 // Extract low int and store. |
116 *colors++ = _mm_cvtsi128_si32(sum); | 117 *colors++ = _mm_cvtsi128_si32(sum); |
117 } while (--count > 0); | 118 } while (--count > 0); |
118 } | 119 } |
119 | 120 |
120 void S32_alpha_D32_filter_DX_SSE2(const SkBitmapProcState& s, | 121 void S32_alpha_D32_filter_DX_SSE2(const SkBitmapProcState& s, |
121 const uint32_t* xy, | 122 const uint32_t* xy, |
122 int count, uint32_t* colors) { | 123 int count, uint32_t* colors) { |
123 SkASSERT(count > 0 && colors != NULL); | 124 SkASSERT(count > 0 && colors != NULL); |
124 SkASSERT(s.fFilterQuality != SkBitmapProcState::kNone_BitmapFilter); | 125 SkASSERT(s.fFilterLevel != SkPaint::kNone_FilterLevel); |
125 SkASSERT(s.fBitmap->config() == SkBitmap::kARGB_8888_Config); | 126 SkASSERT(s.fBitmap->config() == SkBitmap::kARGB_8888_Config); |
126 SkASSERT(s.fAlphaScale < 256); | 127 SkASSERT(s.fAlphaScale < 256); |
127 | 128 |
128 const char* srcAddr = static_cast<const char*>(s.fBitmap->getPixels()); | 129 const char* srcAddr = static_cast<const char*>(s.fBitmap->getPixels()); |
129 size_t rb = s.fBitmap->rowBytes(); | 130 size_t rb = s.fBitmap->rowBytes(); |
130 uint32_t XY = *xy++; | 131 uint32_t XY = *xy++; |
131 unsigned y0 = XY >> 14; | 132 unsigned y0 = XY >> 14; |
132 const uint32_t* row0 = reinterpret_cast<const uint32_t*>(srcAddr + (y0 >> 4)
* rb); | 133 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); | 134 const uint32_t* row1 = reinterpret_cast<const uint32_t*>(srcAddr + (XY & 0x3
FFF) * rb); |
134 unsigned subY = y0 & 0xF; | 135 unsigned subY = y0 & 0xF; |
(...skipping 499 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
634 } | 635 } |
635 | 636 |
636 /* SSE version of S32_D16_filter_DX_SSE2 | 637 /* SSE version of S32_D16_filter_DX_SSE2 |
637 * Definition is in section of "D16 functions for SRC == 8888" in SkBitmapProcS
tate.cpp | 638 * 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 | 639 * It combines S32_opaque_D32_filter_DX_SSE2 and SkPixel32ToPixel16 |
639 */ | 640 */ |
640 void S32_D16_filter_DX_SSE2(const SkBitmapProcState& s, | 641 void S32_D16_filter_DX_SSE2(const SkBitmapProcState& s, |
641 const uint32_t* xy, | 642 const uint32_t* xy, |
642 int count, uint16_t* colors) { | 643 int count, uint16_t* colors) { |
643 SkASSERT(count > 0 && colors != NULL); | 644 SkASSERT(count > 0 && colors != NULL); |
644 SkASSERT(s.fFilterQuality != SkBitmapProcState::kNone_BitmapFilter); | 645 SkASSERT(s.fFilterLevel != SkPaint::kNone_FilterLevel); |
645 SkASSERT(s.fBitmap->config() == SkBitmap::kARGB_8888_Config); | 646 SkASSERT(s.fBitmap->config() == SkBitmap::kARGB_8888_Config); |
646 SkASSERT(s.fBitmap->isOpaque()); | 647 SkASSERT(s.fBitmap->isOpaque()); |
647 | 648 |
648 SkPMColor dstColor; | 649 SkPMColor dstColor; |
649 const char* srcAddr = static_cast<const char*>(s.fBitmap->getPixels()); | 650 const char* srcAddr = static_cast<const char*>(s.fBitmap->getPixels()); |
650 size_t rb = s.fBitmap->rowBytes(); | 651 size_t rb = s.fBitmap->rowBytes(); |
651 uint32_t XY = *xy++; | 652 uint32_t XY = *xy++; |
652 unsigned y0 = XY >> 14; | 653 unsigned y0 = XY >> 14; |
653 const uint32_t* row0 = reinterpret_cast<const uint32_t*>(srcAddr + (y0 >> 4)
* rb); | 654 const uint32_t* row0 = reinterpret_cast<const uint32_t*>(srcAddr + (y0 >> 4)
* rb); |
654 const uint32_t* row1 = reinterpret_cast<const uint32_t*>(srcAddr + (XY & 0x3
FFF) * rb); | 655 const uint32_t* row1 = reinterpret_cast<const uint32_t*>(srcAddr + (XY & 0x3
FFF) * rb); |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
756 unsigned g = (g32 & ((1<<6) -1)) << 5; | 757 unsigned g = (g32 & ((1<<6) -1)) << 5; |
757 | 758 |
758 _m_temp2 = _mm_srli_epi32(_m_temp2, 9); | 759 _m_temp2 = _mm_srli_epi32(_m_temp2, 9); |
759 unsigned int b32 = _mm_cvtsi128_si32(_m_temp2); | 760 unsigned int b32 = _mm_cvtsi128_si32(_m_temp2); |
760 unsigned b = (b32 & ((1<<5) -1)); | 761 unsigned b = (b32 & ((1<<5) -1)); |
761 | 762 |
762 *colors++ = r | g | b; | 763 *colors++ = r | g | b; |
763 | 764 |
764 } while (--count > 0); | 765 } while (--count > 0); |
765 } | 766 } |
OLD | NEW |