Line | Source | Count |
1 | | - |
2 | | - |
3 | | - |
4 | | - |
5 | | - |
6 | | - |
7 | | - |
8 | | - |
9 | | - |
10 | | - |
11 | | - |
12 | | - |
13 | | - |
14 | | - |
15 | | - |
16 | | - |
17 | | - |
18 | | - |
19 | | - |
20 | | - |
21 | | - |
22 | | - |
23 | | - |
24 | | - |
25 | | - |
26 | | - |
27 | | - |
28 | | - |
29 | | - |
30 | | - |
31 | | - |
32 | | - |
33 | | - |
34 | | - |
35 | | - |
36 | | - |
37 | | - |
38 | | - |
39 | | - |
40 | #include <qimage.h> | - |
41 | #include <private/qimage_p.h> | - |
42 | #include <private/qsimd_p.h> | - |
43 | | - |
44 | #ifdef QT_COMPILER_SUPPORTS_SSSE3 | - |
45 | | - |
46 | QT_BEGIN_NAMESPACE | - |
47 | | - |
48 | | - |
49 | | - |
50 | | - |
51 | Q_GUI_EXPORT void QT_FASTCALL qt_convert_rgb888_to_rgb32_ssse3(quint32 *dst, const uchar *src, int len) | - |
52 | { | - |
53 | quint32 *const end = dst + len; | - |
54 | | - |
55 | | - |
56 | | - |
57 | const int offsetToAlignOn16Bytes = (4 - ((reinterpret_cast<quintptr>(dst) >> 2) & 0x3)) & 0x3; | - |
58 | const int prologLength = qMin(len, offsetToAlignOn16Bytes); | - |
59 | | - |
60 | for (int i = 0; i < prologLength; ++i) {TRUE | never evaluated | FALSE | never evaluated |
| 0 |
61 | *dst++ = qRgb(src[0], src[1], src[2]); | - |
62 | src += 3; | - |
63 | } never executed: end of block | 0 |
64 | | - |
65 | | - |
66 | const __m128i shuffleMask = _mm_set_epi8(char(0xff), 9, 10, 11, char(0xff), 6, 7, 8, char(0xff), 3, 4, 5, char(0xff), 0, 1, 2); | - |
67 | | - |
68 | | - |
69 | const __m128i shuffleMaskEnd = _mm_set_epi8(char(0xff), 13, 14, 15, char(0xff), 10, 11, 12, char(0xff), 7, 8, 9, char(0xff), 4, 5, 6); | - |
70 | | - |
71 | | - |
72 | const __m128i alphaMask = _mm_set1_epi32(0xff000000); | - |
73 | | - |
74 | const __m128i *inVectorPtr = (const __m128i *)src; | - |
75 | __m128i *dstVectorPtr = (__m128i *)dst; | - |
76 | | - |
77 | const int simdRoundCount = (len - prologLength) / 16; | - |
78 | for (int i = 0; i < simdRoundCount; ++i) {TRUE | never evaluated | FALSE | never evaluated |
| 0 |
79 | | - |
80 | | - |
81 | | - |
82 | | - |
83 | | - |
84 | | - |
85 | | - |
86 | | - |
87 | | - |
88 | | - |
89 | __m128i firstSrcVector = _mm_lddqu_si128(inVectorPtr); | - |
90 | __m128i outputVector = _mm_shuffle_epi8(firstSrcVector, shuffleMask); | - |
91 | _mm_store_si128(dstVectorPtr, _mm_or_si128(outputVector, alphaMask)); | - |
92 | ++inVectorPtr; | - |
93 | ++dstVectorPtr; | - |
94 | | - |
95 | | - |
96 | | - |
97 | __m128i secondSrcVector = _mm_lddqu_si128(inVectorPtr); | - |
98 | __m128i srcVector = _mm_alignr_epi8(secondSrcVector, firstSrcVector, 12); | - |
99 | outputVector = _mm_shuffle_epi8(srcVector, shuffleMask); | - |
100 | _mm_store_si128(dstVectorPtr, _mm_or_si128(outputVector, alphaMask)); | - |
101 | ++inVectorPtr; | - |
102 | ++dstVectorPtr; | - |
103 | firstSrcVector = secondSrcVector; | - |
104 | | - |
105 | | - |
106 | secondSrcVector = _mm_lddqu_si128(inVectorPtr); | - |
107 | srcVector = _mm_alignr_epi8(secondSrcVector, firstSrcVector, 8); | - |
108 | outputVector = _mm_shuffle_epi8(srcVector, shuffleMask); | - |
109 | _mm_store_si128(dstVectorPtr, _mm_or_si128(outputVector, alphaMask)); | - |
110 | ++inVectorPtr; | - |
111 | ++dstVectorPtr; | - |
112 | | - |
113 | | - |
114 | | - |
115 | outputVector = _mm_shuffle_epi8(secondSrcVector, shuffleMaskEnd); | - |
116 | _mm_store_si128(dstVectorPtr, _mm_or_si128(outputVector, alphaMask)); | - |
117 | ++dstVectorPtr; | - |
118 | } never executed: end of block | 0 |
119 | src = (const uchar *)inVectorPtr; | - |
120 | dst = (quint32 *)dstVectorPtr; | - |
121 | | - |
122 | while (dst != end) {TRUE | never evaluated | FALSE | never evaluated |
| 0 |
123 | *dst++ = qRgb(src[0], src[1], src[2]); | - |
124 | src += 3; | - |
125 | } never executed: end of block | 0 |
126 | } never executed: end of block | 0 |
127 | | - |
128 | void convert_RGB888_to_RGB32_ssse3(QImageData *dest, const QImageData *src, Qt::ImageConversionFlags) | - |
129 | { | - |
130 | Q_ASSERT(src->format == QImage::Format_RGB888); | - |
131 | Q_ASSERT(dest->format == QImage::Format_RGB32 || dest->format == QImage::Format_ARGB32 || dest->format == QImage::Format_ARGB32_Premultiplied); | - |
132 | Q_ASSERT(src->width == dest->width); | - |
133 | Q_ASSERT(src->height == dest->height); | - |
134 | | - |
135 | const uchar *src_data = (uchar *) src->data; | - |
136 | quint32 *dest_data = (quint32 *) dest->data; | - |
137 | | - |
138 | for (int i = 0; i < src->height; ++i) {TRUE | never evaluated | FALSE | never evaluated |
| 0 |
139 | qt_convert_rgb888_to_rgb32_ssse3(dest_data, src_data, src->width); | - |
140 | src_data += src->bytes_per_line; | - |
141 | dest_data = (quint32 *)((uchar*)dest_data + dest->bytes_per_line); | - |
142 | } never executed: end of block | 0 |
143 | } never executed: end of block | 0 |
144 | | - |
145 | QT_END_NAMESPACE | - |
146 | | - |
147 | #endif // QT_COMPILER_SUPPORTS_SSSE3 | - |
| | |