/src/qtbase/src/gui/painting/qpixellayout.cpp
Line | Count | Source |
1 | | // Copyright (C) 2021 The Qt Company Ltd. |
2 | | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only |
3 | | // Qt-Security score:significant reason:default |
4 | | |
5 | | #include <qglobal.h> |
6 | | |
7 | | #include "qdrawhelper_p.h" |
8 | | #include "qpixellayout_p.h" |
9 | | #include "qrgba64_p.h" |
10 | | #include <QtCore/private/qsimd_p.h> |
11 | | #include <QtGui/private/qcmyk_p.h> |
12 | | |
13 | | QT_BEGIN_NAMESPACE |
14 | | |
15 | | template<QImage::Format> constexpr uint redWidth(); |
16 | | template<QImage::Format> constexpr uint redShift(); |
17 | | template<QImage::Format> constexpr uint greenWidth(); |
18 | | template<QImage::Format> constexpr uint greenShift(); |
19 | | template<QImage::Format> constexpr uint blueWidth(); |
20 | | template<QImage::Format> constexpr uint blueShift(); |
21 | | template<QImage::Format> constexpr uint alphaWidth(); |
22 | | template<QImage::Format> constexpr uint alphaShift(); |
23 | | |
24 | 0 | template<> constexpr uint redWidth<QImage::Format_RGB32>() { return 8; } |
25 | 0 | template<> constexpr uint redWidth<QImage::Format_ARGB32>() { return 8; } |
26 | 0 | template<> constexpr uint redWidth<QImage::Format_ARGB32_Premultiplied>() { return 8; } |
27 | 0 | template<> constexpr uint redWidth<QImage::Format_RGB16>() { return 5; } |
28 | 0 | template<> constexpr uint redWidth<QImage::Format_RGB444>() { return 4; } |
29 | 0 | template<> constexpr uint redWidth<QImage::Format_RGB555>() { return 5; } |
30 | 0 | template<> constexpr uint redWidth<QImage::Format_RGB666>() { return 6; } |
31 | 0 | template<> constexpr uint redWidth<QImage::Format_RGB888>() { return 8; } |
32 | 0 | template<> constexpr uint redWidth<QImage::Format_BGR888>() { return 8; } |
33 | 0 | template<> constexpr uint redWidth<QImage::Format_ARGB4444_Premultiplied>() { return 4; } |
34 | 0 | template<> constexpr uint redWidth<QImage::Format_ARGB8555_Premultiplied>() { return 5; } |
35 | 0 | template<> constexpr uint redWidth<QImage::Format_ARGB8565_Premultiplied>() { return 5; } |
36 | 0 | template<> constexpr uint redWidth<QImage::Format_ARGB6666_Premultiplied>() { return 6; } |
37 | 0 | template<> constexpr uint redWidth<QImage::Format_RGBX8888>() { return 8; } |
38 | 0 | template<> constexpr uint redWidth<QImage::Format_RGBA8888>() { return 8; } |
39 | 0 | template<> constexpr uint redWidth<QImage::Format_RGBA8888_Premultiplied>() { return 8; } |
40 | | |
41 | 0 | template<> constexpr uint redShift<QImage::Format_RGB32>() { return 16; } |
42 | 0 | template<> constexpr uint redShift<QImage::Format_ARGB32>() { return 16; } |
43 | 0 | template<> constexpr uint redShift<QImage::Format_ARGB32_Premultiplied>() { return 16; } |
44 | 0 | template<> constexpr uint redShift<QImage::Format_RGB16>() { return 11; } |
45 | 0 | template<> constexpr uint redShift<QImage::Format_RGB444>() { return 8; } |
46 | 0 | template<> constexpr uint redShift<QImage::Format_RGB555>() { return 10; } |
47 | 0 | template<> constexpr uint redShift<QImage::Format_RGB666>() { return 12; } |
48 | 0 | template<> constexpr uint redShift<QImage::Format_RGB888>() { return 16; } |
49 | 0 | template<> constexpr uint redShift<QImage::Format_BGR888>() { return 0; } |
50 | 0 | template<> constexpr uint redShift<QImage::Format_ARGB4444_Premultiplied>() { return 8; } |
51 | 0 | template<> constexpr uint redShift<QImage::Format_ARGB8555_Premultiplied>() { return 18; } |
52 | 0 | template<> constexpr uint redShift<QImage::Format_ARGB8565_Premultiplied>() { return 19; } |
53 | 0 | template<> constexpr uint redShift<QImage::Format_ARGB6666_Premultiplied>() { return 12; } |
54 | | #if Q_BYTE_ORDER == Q_BIG_ENDIAN |
55 | | template<> constexpr uint redShift<QImage::Format_RGBX8888>() { return 24; } |
56 | | template<> constexpr uint redShift<QImage::Format_RGBA8888>() { return 24; } |
57 | | template<> constexpr uint redShift<QImage::Format_RGBA8888_Premultiplied>() { return 24; } |
58 | | #else |
59 | 0 | template<> constexpr uint redShift<QImage::Format_RGBX8888>() { return 0; } |
60 | 0 | template<> constexpr uint redShift<QImage::Format_RGBA8888>() { return 0; } |
61 | 0 | template<> constexpr uint redShift<QImage::Format_RGBA8888_Premultiplied>() { return 0; } |
62 | | #endif |
63 | 0 | template<> constexpr uint greenWidth<QImage::Format_RGB32>() { return 8; } |
64 | 0 | template<> constexpr uint greenWidth<QImage::Format_ARGB32>() { return 8; } |
65 | 0 | template<> constexpr uint greenWidth<QImage::Format_ARGB32_Premultiplied>() { return 8; } |
66 | 0 | template<> constexpr uint greenWidth<QImage::Format_RGB16>() { return 6; } |
67 | 0 | template<> constexpr uint greenWidth<QImage::Format_RGB444>() { return 4; } |
68 | 0 | template<> constexpr uint greenWidth<QImage::Format_RGB555>() { return 5; } |
69 | 0 | template<> constexpr uint greenWidth<QImage::Format_RGB666>() { return 6; } |
70 | 0 | template<> constexpr uint greenWidth<QImage::Format_RGB888>() { return 8; } |
71 | 0 | template<> constexpr uint greenWidth<QImage::Format_BGR888>() { return 8; } |
72 | 0 | template<> constexpr uint greenWidth<QImage::Format_ARGB4444_Premultiplied>() { return 4; } |
73 | 0 | template<> constexpr uint greenWidth<QImage::Format_ARGB8555_Premultiplied>() { return 5; } |
74 | 0 | template<> constexpr uint greenWidth<QImage::Format_ARGB8565_Premultiplied>() { return 6; } |
75 | 0 | template<> constexpr uint greenWidth<QImage::Format_ARGB6666_Premultiplied>() { return 6; } |
76 | 0 | template<> constexpr uint greenWidth<QImage::Format_RGBX8888>() { return 8; } |
77 | 0 | template<> constexpr uint greenWidth<QImage::Format_RGBA8888>() { return 8; } |
78 | 0 | template<> constexpr uint greenWidth<QImage::Format_RGBA8888_Premultiplied>() { return 8; } |
79 | | |
80 | 0 | template<> constexpr uint greenShift<QImage::Format_RGB32>() { return 8; } |
81 | 0 | template<> constexpr uint greenShift<QImage::Format_ARGB32>() { return 8; } |
82 | 0 | template<> constexpr uint greenShift<QImage::Format_ARGB32_Premultiplied>() { return 8; } |
83 | 0 | template<> constexpr uint greenShift<QImage::Format_RGB16>() { return 5; } |
84 | 0 | template<> constexpr uint greenShift<QImage::Format_RGB444>() { return 4; } |
85 | 0 | template<> constexpr uint greenShift<QImage::Format_RGB555>() { return 5; } |
86 | 0 | template<> constexpr uint greenShift<QImage::Format_RGB666>() { return 6; } |
87 | 0 | template<> constexpr uint greenShift<QImage::Format_RGB888>() { return 8; } |
88 | 0 | template<> constexpr uint greenShift<QImage::Format_BGR888>() { return 8; } |
89 | 0 | template<> constexpr uint greenShift<QImage::Format_ARGB4444_Premultiplied>() { return 4; } |
90 | 0 | template<> constexpr uint greenShift<QImage::Format_ARGB8555_Premultiplied>() { return 13; } |
91 | 0 | template<> constexpr uint greenShift<QImage::Format_ARGB8565_Premultiplied>() { return 13; } |
92 | 0 | template<> constexpr uint greenShift<QImage::Format_ARGB6666_Premultiplied>() { return 6; } |
93 | | #if Q_BYTE_ORDER == Q_BIG_ENDIAN |
94 | | template<> constexpr uint greenShift<QImage::Format_RGBX8888>() { return 16; } |
95 | | template<> constexpr uint greenShift<QImage::Format_RGBA8888>() { return 16; } |
96 | | template<> constexpr uint greenShift<QImage::Format_RGBA8888_Premultiplied>() { return 16; } |
97 | | #else |
98 | 0 | template<> constexpr uint greenShift<QImage::Format_RGBX8888>() { return 8; } |
99 | 0 | template<> constexpr uint greenShift<QImage::Format_RGBA8888>() { return 8; } |
100 | 0 | template<> constexpr uint greenShift<QImage::Format_RGBA8888_Premultiplied>() { return 8; } |
101 | | #endif |
102 | 0 | template<> constexpr uint blueWidth<QImage::Format_RGB32>() { return 8; } |
103 | 0 | template<> constexpr uint blueWidth<QImage::Format_ARGB32>() { return 8; } |
104 | 0 | template<> constexpr uint blueWidth<QImage::Format_ARGB32_Premultiplied>() { return 8; } |
105 | 0 | template<> constexpr uint blueWidth<QImage::Format_RGB16>() { return 5; } |
106 | 0 | template<> constexpr uint blueWidth<QImage::Format_RGB444>() { return 4; } |
107 | 0 | template<> constexpr uint blueWidth<QImage::Format_RGB555>() { return 5; } |
108 | 0 | template<> constexpr uint blueWidth<QImage::Format_RGB666>() { return 6; } |
109 | 0 | template<> constexpr uint blueWidth<QImage::Format_RGB888>() { return 8; } |
110 | 0 | template<> constexpr uint blueWidth<QImage::Format_BGR888>() { return 8; } |
111 | 0 | template<> constexpr uint blueWidth<QImage::Format_ARGB4444_Premultiplied>() { return 4; } |
112 | 0 | template<> constexpr uint blueWidth<QImage::Format_ARGB8555_Premultiplied>() { return 5; } |
113 | 0 | template<> constexpr uint blueWidth<QImage::Format_ARGB8565_Premultiplied>() { return 5; } |
114 | 0 | template<> constexpr uint blueWidth<QImage::Format_ARGB6666_Premultiplied>() { return 6; } |
115 | 0 | template<> constexpr uint blueWidth<QImage::Format_RGBX8888>() { return 8; } |
116 | 0 | template<> constexpr uint blueWidth<QImage::Format_RGBA8888>() { return 8; } |
117 | 0 | template<> constexpr uint blueWidth<QImage::Format_RGBA8888_Premultiplied>() { return 8; } |
118 | | |
119 | 0 | template<> constexpr uint blueShift<QImage::Format_RGB32>() { return 0; } |
120 | 0 | template<> constexpr uint blueShift<QImage::Format_ARGB32>() { return 0; } |
121 | 0 | template<> constexpr uint blueShift<QImage::Format_ARGB32_Premultiplied>() { return 0; } |
122 | 0 | template<> constexpr uint blueShift<QImage::Format_RGB16>() { return 0; } |
123 | 0 | template<> constexpr uint blueShift<QImage::Format_RGB444>() { return 0; } |
124 | 0 | template<> constexpr uint blueShift<QImage::Format_RGB555>() { return 0; } |
125 | 0 | template<> constexpr uint blueShift<QImage::Format_RGB666>() { return 0; } |
126 | 0 | template<> constexpr uint blueShift<QImage::Format_RGB888>() { return 0; } |
127 | 0 | template<> constexpr uint blueShift<QImage::Format_BGR888>() { return 16; } |
128 | 0 | template<> constexpr uint blueShift<QImage::Format_ARGB4444_Premultiplied>() { return 0; } |
129 | 0 | template<> constexpr uint blueShift<QImage::Format_ARGB8555_Premultiplied>() { return 8; } |
130 | 0 | template<> constexpr uint blueShift<QImage::Format_ARGB8565_Premultiplied>() { return 8; } |
131 | 0 | template<> constexpr uint blueShift<QImage::Format_ARGB6666_Premultiplied>() { return 0; } |
132 | | #if Q_BYTE_ORDER == Q_BIG_ENDIAN |
133 | | template<> constexpr uint blueShift<QImage::Format_RGBX8888>() { return 8; } |
134 | | template<> constexpr uint blueShift<QImage::Format_RGBA8888>() { return 8; } |
135 | | template<> constexpr uint blueShift<QImage::Format_RGBA8888_Premultiplied>() { return 8; } |
136 | | #else |
137 | 0 | template<> constexpr uint blueShift<QImage::Format_RGBX8888>() { return 16; } |
138 | 0 | template<> constexpr uint blueShift<QImage::Format_RGBA8888>() { return 16; } |
139 | 0 | template<> constexpr uint blueShift<QImage::Format_RGBA8888_Premultiplied>() { return 16; } |
140 | | #endif |
141 | 0 | template<> constexpr uint alphaWidth<QImage::Format_RGB32>() { return 0; } |
142 | 0 | template<> constexpr uint alphaWidth<QImage::Format_ARGB32>() { return 8; } |
143 | 0 | template<> constexpr uint alphaWidth<QImage::Format_ARGB32_Premultiplied>() { return 8; } |
144 | 0 | template<> constexpr uint alphaWidth<QImage::Format_RGB16>() { return 0; } |
145 | 0 | template<> constexpr uint alphaWidth<QImage::Format_RGB444>() { return 0; } |
146 | 0 | template<> constexpr uint alphaWidth<QImage::Format_RGB555>() { return 0; } |
147 | 0 | template<> constexpr uint alphaWidth<QImage::Format_RGB666>() { return 0; } |
148 | 0 | template<> constexpr uint alphaWidth<QImage::Format_RGB888>() { return 0; } |
149 | 0 | template<> constexpr uint alphaWidth<QImage::Format_BGR888>() { return 0; } |
150 | 0 | template<> constexpr uint alphaWidth<QImage::Format_ARGB4444_Premultiplied>() { return 4; } |
151 | 0 | template<> constexpr uint alphaWidth<QImage::Format_ARGB8555_Premultiplied>() { return 8; } |
152 | 0 | template<> constexpr uint alphaWidth<QImage::Format_ARGB8565_Premultiplied>() { return 8; } |
153 | 0 | template<> constexpr uint alphaWidth<QImage::Format_ARGB6666_Premultiplied>() { return 6; } |
154 | 0 | template<> constexpr uint alphaWidth<QImage::Format_RGBX8888>() { return 0; } |
155 | 0 | template<> constexpr uint alphaWidth<QImage::Format_RGBA8888>() { return 8; } |
156 | 0 | template<> constexpr uint alphaWidth<QImage::Format_RGBA8888_Premultiplied>() { return 8; } |
157 | | |
158 | 0 | template<> constexpr uint alphaShift<QImage::Format_RGB32>() { return 24; } |
159 | 0 | template<> constexpr uint alphaShift<QImage::Format_ARGB32>() { return 24; } |
160 | 0 | template<> constexpr uint alphaShift<QImage::Format_ARGB32_Premultiplied>() { return 24; } |
161 | 0 | template<> constexpr uint alphaShift<QImage::Format_RGB16>() { return 0; } |
162 | 0 | template<> constexpr uint alphaShift<QImage::Format_RGB444>() { return 0; } |
163 | 0 | template<> constexpr uint alphaShift<QImage::Format_RGB555>() { return 0; } |
164 | 0 | template<> constexpr uint alphaShift<QImage::Format_RGB666>() { return 0; } |
165 | 0 | template<> constexpr uint alphaShift<QImage::Format_RGB888>() { return 0; } |
166 | 0 | template<> constexpr uint alphaShift<QImage::Format_BGR888>() { return 0; } |
167 | 0 | template<> constexpr uint alphaShift<QImage::Format_ARGB4444_Premultiplied>() { return 12; } |
168 | 0 | template<> constexpr uint alphaShift<QImage::Format_ARGB8555_Premultiplied>() { return 0; } |
169 | 0 | template<> constexpr uint alphaShift<QImage::Format_ARGB8565_Premultiplied>() { return 0; } |
170 | 0 | template<> constexpr uint alphaShift<QImage::Format_ARGB6666_Premultiplied>() { return 18; } |
171 | | #if Q_BYTE_ORDER == Q_BIG_ENDIAN |
172 | | template<> constexpr uint alphaShift<QImage::Format_RGBX8888>() { return 0; } |
173 | | template<> constexpr uint alphaShift<QImage::Format_RGBA8888>() { return 0; } |
174 | | template<> constexpr uint alphaShift<QImage::Format_RGBA8888_Premultiplied>() { return 0; } |
175 | | #else |
176 | 0 | template<> constexpr uint alphaShift<QImage::Format_RGBX8888>() { return 24; } |
177 | 0 | template<> constexpr uint alphaShift<QImage::Format_RGBA8888>() { return 24; } |
178 | 0 | template<> constexpr uint alphaShift<QImage::Format_RGBA8888_Premultiplied>() { return 24; } |
179 | | #endif |
180 | | |
181 | | template<QImage::Format> constexpr QPixelLayout::BPP bitsPerPixel(); |
182 | 0 | template<> constexpr QPixelLayout::BPP bitsPerPixel<QImage::Format_RGB32>() { return QPixelLayout::BPP32; } |
183 | 0 | template<> constexpr QPixelLayout::BPP bitsPerPixel<QImage::Format_ARGB32>() { return QPixelLayout::BPP32; } |
184 | 0 | template<> constexpr QPixelLayout::BPP bitsPerPixel<QImage::Format_ARGB32_Premultiplied>() { return QPixelLayout::BPP32; } |
185 | 0 | template<> constexpr QPixelLayout::BPP bitsPerPixel<QImage::Format_RGB16>() { return QPixelLayout::BPP16; } |
186 | 0 | template<> constexpr QPixelLayout::BPP bitsPerPixel<QImage::Format_RGB444>() { return QPixelLayout::BPP16; } |
187 | 0 | template<> constexpr QPixelLayout::BPP bitsPerPixel<QImage::Format_RGB555>() { return QPixelLayout::BPP16; } |
188 | 0 | template<> constexpr QPixelLayout::BPP bitsPerPixel<QImage::Format_RGB666>() { return QPixelLayout::BPP24; } |
189 | 0 | template<> constexpr QPixelLayout::BPP bitsPerPixel<QImage::Format_RGB888>() { return QPixelLayout::BPP24; } |
190 | 0 | template<> constexpr QPixelLayout::BPP bitsPerPixel<QImage::Format_BGR888>() { return QPixelLayout::BPP24; } |
191 | 0 | template<> constexpr QPixelLayout::BPP bitsPerPixel<QImage::Format_ARGB4444_Premultiplied>() { return QPixelLayout::BPP16; } |
192 | 0 | template<> constexpr QPixelLayout::BPP bitsPerPixel<QImage::Format_ARGB8555_Premultiplied>() { return QPixelLayout::BPP24; } |
193 | 0 | template<> constexpr QPixelLayout::BPP bitsPerPixel<QImage::Format_ARGB8565_Premultiplied>() { return QPixelLayout::BPP24; } |
194 | 0 | template<> constexpr QPixelLayout::BPP bitsPerPixel<QImage::Format_ARGB6666_Premultiplied>() { return QPixelLayout::BPP24; } |
195 | 0 | template<> constexpr QPixelLayout::BPP bitsPerPixel<QImage::Format_RGBX8888>() { return QPixelLayout::BPP32; } |
196 | 0 | template<> constexpr QPixelLayout::BPP bitsPerPixel<QImage::Format_RGBA8888>() { return QPixelLayout::BPP32; } |
197 | 0 | template<> constexpr QPixelLayout::BPP bitsPerPixel<QImage::Format_RGBA8888_Premultiplied>() { return QPixelLayout::BPP32; } |
198 | | |
199 | | template <QPixelLayout::BPP width> static |
200 | | void QT_FASTCALL storePixel(uchar *dest, int index, uint pixel); |
201 | | |
202 | | template <> |
203 | | inline void QT_FASTCALL storePixel<QPixelLayout::BPP16>(uchar *dest, int index, uint pixel) |
204 | 0 | { |
205 | 0 | reinterpret_cast<quint16 *>(dest)[index] = quint16(pixel); |
206 | 0 | } |
207 | | |
208 | | template <> |
209 | | inline void QT_FASTCALL storePixel<QPixelLayout::BPP24>(uchar *dest, int index, uint pixel) |
210 | 0 | { |
211 | 0 | reinterpret_cast<quint24 *>(dest)[index] = quint24(pixel); |
212 | 0 | } |
213 | | |
214 | | template <QPixelLayout::BPP bpp> static |
215 | | inline uint QT_FASTCALL fetchPixel(const uchar *, int) |
216 | | { |
217 | | Q_UNREACHABLE_RETURN(0); |
218 | | } |
219 | | |
220 | | template <> |
221 | | inline uint QT_FASTCALL fetchPixel<QPixelLayout::BPP1LSB>(const uchar *src, int index) |
222 | 0 | { |
223 | 0 | return (src[index >> 3] >> (index & 7)) & 1; |
224 | 0 | } |
225 | | |
226 | | template <> |
227 | | inline uint QT_FASTCALL fetchPixel<QPixelLayout::BPP1MSB>(const uchar *src, int index) |
228 | 0 | { |
229 | 0 | return (src[index >> 3] >> (~index & 7)) & 1; |
230 | 0 | } |
231 | | |
232 | | template <> |
233 | | inline uint QT_FASTCALL fetchPixel<QPixelLayout::BPP8>(const uchar *src, int index) |
234 | 0 | { |
235 | 0 | return src[index]; |
236 | 0 | } |
237 | | |
238 | | template <> |
239 | | inline uint QT_FASTCALL fetchPixel<QPixelLayout::BPP16>(const uchar *src, int index) |
240 | 0 | { |
241 | 0 | return reinterpret_cast<const quint16 *>(src)[index]; |
242 | 0 | } |
243 | | |
244 | | template <> |
245 | | inline uint QT_FASTCALL fetchPixel<QPixelLayout::BPP24>(const uchar *src, int index) |
246 | 0 | { |
247 | 0 | return reinterpret_cast<const quint24 *>(src)[index]; |
248 | 0 | } |
249 | | |
250 | | template <> |
251 | | inline uint QT_FASTCALL fetchPixel<QPixelLayout::BPP32>(const uchar *src, int index) |
252 | 0 | { |
253 | 0 | return reinterpret_cast<const uint *>(src)[index]; |
254 | 0 | } |
255 | | |
256 | | template <> |
257 | | [[maybe_unused]] |
258 | | inline uint QT_FASTCALL fetchPixel<QPixelLayout::BPP64>(const uchar *src, int index) |
259 | 0 | { |
260 | 0 | // We have to do the conversion in fetch to fit into a 32bit uint |
261 | 0 | QRgba64 c = reinterpret_cast<const QRgba64 *>(src)[index]; |
262 | 0 | return c.toArgb32(); |
263 | 0 | } |
264 | | |
265 | | template <> |
266 | | [[maybe_unused]] |
267 | | inline uint QT_FASTCALL fetchPixel<QPixelLayout::BPP16FPx4>(const uchar *src, int index) |
268 | 0 | { |
269 | 0 | // We have to do the conversion in fetch to fit into a 32bit uint |
270 | 0 | QRgbaFloat16 c = reinterpret_cast<const QRgbaFloat16 *>(src)[index]; |
271 | 0 | return c.toArgb32(); |
272 | 0 | } |
273 | | |
274 | | template <> |
275 | | [[maybe_unused]] |
276 | | inline uint QT_FASTCALL fetchPixel<QPixelLayout::BPP32FPx4>(const uchar *src, int index) |
277 | 0 | { |
278 | 0 | // We have to do the conversion in fetch to fit into a 32bit uint |
279 | 0 | QRgbaFloat32 c = reinterpret_cast<const QRgbaFloat32 *>(src)[index]; |
280 | 0 | return c.toArgb32(); |
281 | 0 | } |
282 | | |
283 | | template<QImage::Format Format> |
284 | | static inline uint convertPixelToRGB32(uint s) |
285 | 0 | { |
286 | 0 | constexpr uint redMask = ((1 << redWidth<Format>()) - 1); |
287 | 0 | constexpr uint greenMask = ((1 << greenWidth<Format>()) - 1); |
288 | 0 | constexpr uint blueMask = ((1 << blueWidth<Format>()) - 1); |
289 | |
|
290 | 0 | constexpr uchar redLeftShift = 8 - redWidth<Format>(); |
291 | 0 | constexpr uchar greenLeftShift = 8 - greenWidth<Format>(); |
292 | 0 | constexpr uchar blueLeftShift = 8 - blueWidth<Format>(); |
293 | |
|
294 | 0 | constexpr uchar redRightShift = 2 * redWidth<Format>() - 8; |
295 | 0 | constexpr uchar greenRightShift = 2 * greenWidth<Format>() - 8; |
296 | 0 | constexpr uchar blueRightShift = 2 * blueWidth<Format>() - 8; |
297 | |
|
298 | 0 | uint red = (s >> redShift<Format>()) & redMask; |
299 | 0 | uint green = (s >> greenShift<Format>()) & greenMask; |
300 | 0 | uint blue = (s >> blueShift<Format>()) & blueMask; |
301 | |
|
302 | 0 | red = ((red << redLeftShift) | (red >> redRightShift)) << 16; |
303 | 0 | green = ((green << greenLeftShift) | (green >> greenRightShift)) << 8; |
304 | 0 | blue = (blue << blueLeftShift) | (blue >> blueRightShift); |
305 | 0 | return 0xff000000 | red | green | blue; |
306 | 0 | } Unexecuted instantiation: qpixellayout.cpp:unsigned int convertPixelToRGB32<(QImage::Format)7>(unsigned int) Unexecuted instantiation: qpixellayout.cpp:unsigned int convertPixelToRGB32<(QImage::Format)8>(unsigned int) Unexecuted instantiation: qpixellayout.cpp:unsigned int convertPixelToRGB32<(QImage::Format)9>(unsigned int) Unexecuted instantiation: qpixellayout.cpp:unsigned int convertPixelToRGB32<(QImage::Format)10>(unsigned int) Unexecuted instantiation: qpixellayout.cpp:unsigned int convertPixelToRGB32<(QImage::Format)11>(unsigned int) Unexecuted instantiation: qpixellayout.cpp:unsigned int convertPixelToRGB32<(QImage::Format)12>(unsigned int) Unexecuted instantiation: qpixellayout.cpp:unsigned int convertPixelToRGB32<(QImage::Format)13>(unsigned int) Unexecuted instantiation: qpixellayout.cpp:unsigned int convertPixelToRGB32<(QImage::Format)14>(unsigned int) Unexecuted instantiation: qpixellayout.cpp:unsigned int convertPixelToRGB32<(QImage::Format)15>(unsigned int) Unexecuted instantiation: qpixellayout.cpp:unsigned int convertPixelToRGB32<(QImage::Format)29>(unsigned int) Unexecuted instantiation: qpixellayout.cpp:unsigned int convertPixelToRGB32<(QImage::Format)4>(unsigned int) Unexecuted instantiation: qpixellayout.cpp:unsigned int convertPixelToRGB32<(QImage::Format)16>(unsigned int) |
307 | | |
308 | | template<QImage::Format Format> |
309 | | static void QT_FASTCALL convertToRGB32(uint *buffer, int count, const QList<QRgb> *) |
310 | 0 | { |
311 | 0 | for (int i = 0; i < count; ++i) |
312 | 0 | buffer[i] = convertPixelToRGB32<Format>(buffer[i]); |
313 | 0 | } Unexecuted instantiation: qpixellayout.cpp:void convertToRGB32<(QImage::Format)7>(unsigned int*, int, QList<unsigned int> const*) Unexecuted instantiation: qpixellayout.cpp:void convertToRGB32<(QImage::Format)9>(unsigned int*, int, QList<unsigned int> const*) Unexecuted instantiation: qpixellayout.cpp:void convertToRGB32<(QImage::Format)11>(unsigned int*, int, QList<unsigned int> const*) Unexecuted instantiation: qpixellayout.cpp:void convertToRGB32<(QImage::Format)13>(unsigned int*, int, QList<unsigned int> const*) Unexecuted instantiation: qpixellayout.cpp:void convertToRGB32<(QImage::Format)14>(unsigned int*, int, QList<unsigned int> const*) Unexecuted instantiation: qpixellayout.cpp:void convertToRGB32<(QImage::Format)29>(unsigned int*, int, QList<unsigned int> const*) |
314 | | |
315 | | #if defined(__SSE2__) && !defined(__SSSE3__) && QT_COMPILER_SUPPORTS_SSSE3 |
316 | | extern const uint * QT_FASTCALL fetchPixelsBPP24_ssse3(uint *dest, const uchar*src, int index, int count); |
317 | | #elif defined QT_COMPILER_SUPPORTS_LSX |
318 | | // from qdrawhelper_lsx.cpp |
319 | | extern const uint * QT_FASTCALL fetchPixelsBPP24_lsx(uint *dest, const uchar *src, int index, int count); |
320 | | #endif |
321 | | |
322 | | template<QImage::Format Format> |
323 | | static const uint *QT_FASTCALL fetchRGBToRGB32(uint *buffer, const uchar *src, int index, int count, |
324 | | const QList<QRgb> *, QDitherInfo *) |
325 | 0 | { |
326 | 0 | constexpr QPixelLayout::BPP BPP = bitsPerPixel<Format>(); |
327 | 0 | #if defined(__SSE2__) && !defined(__SSSE3__) && QT_COMPILER_SUPPORTS_SSSE3 |
328 | 0 | if (BPP == QPixelLayout::BPP24 && qCpuHasFeature(SSSE3)) { |
329 | | // With SSE2 can convertToRGB32 be vectorized, but it takes SSSE3 |
330 | | // to vectorize the deforested version below. |
331 | 0 | fetchPixelsBPP24_ssse3(buffer, src, index, count); |
332 | 0 | convertToRGB32<Format>(buffer, count, nullptr); |
333 | 0 | return buffer; |
334 | 0 | } |
335 | | #elif defined QT_COMPILER_SUPPORTS_LSX |
336 | | if (BPP == QPixelLayout::BPP24 && qCpuHasFeature(LSX)) { |
337 | | fetchPixelsBPP24_lsx(buffer, src, index, count); |
338 | | convertToRGB32<Format>(buffer, count, nullptr); |
339 | | return buffer; |
340 | | } |
341 | | #endif |
342 | 0 | for (int i = 0; i < count; ++i) |
343 | 0 | buffer[i] = convertPixelToRGB32<Format>(fetchPixel<BPP>(src, index + i)); |
344 | 0 | return buffer; |
345 | 0 | } Unexecuted instantiation: qpixellayout.cpp:unsigned int const* fetchRGBToRGB32<(QImage::Format)7>(unsigned int*, unsigned char const*, int, int, QList<unsigned int> const*, QDitherInfo*) Unexecuted instantiation: qpixellayout.cpp:unsigned int const* fetchRGBToRGB32<(QImage::Format)9>(unsigned int*, unsigned char const*, int, int, QList<unsigned int> const*, QDitherInfo*) Unexecuted instantiation: qpixellayout.cpp:unsigned int const* fetchRGBToRGB32<(QImage::Format)11>(unsigned int*, unsigned char const*, int, int, QList<unsigned int> const*, QDitherInfo*) Unexecuted instantiation: qpixellayout.cpp:unsigned int const* fetchRGBToRGB32<(QImage::Format)13>(unsigned int*, unsigned char const*, int, int, QList<unsigned int> const*, QDitherInfo*) Unexecuted instantiation: qpixellayout.cpp:unsigned int const* fetchRGBToRGB32<(QImage::Format)14>(unsigned int*, unsigned char const*, int, int, QList<unsigned int> const*, QDitherInfo*) Unexecuted instantiation: qpixellayout.cpp:unsigned int const* fetchRGBToRGB32<(QImage::Format)29>(unsigned int*, unsigned char const*, int, int, QList<unsigned int> const*, QDitherInfo*) |
346 | | |
347 | | template<QImage::Format Format> |
348 | | static inline QRgba64 convertPixelToRGB64(uint s) |
349 | 0 | { |
350 | 0 | return QRgba64::fromArgb32(convertPixelToRGB32<Format>(s)); |
351 | 0 | } Unexecuted instantiation: qpixellayout.cpp:QRgba64 convertPixelToRGB64<(QImage::Format)7>(unsigned int) Unexecuted instantiation: qpixellayout.cpp:QRgba64 convertPixelToRGB64<(QImage::Format)8>(unsigned int) Unexecuted instantiation: qpixellayout.cpp:QRgba64 convertPixelToRGB64<(QImage::Format)9>(unsigned int) Unexecuted instantiation: qpixellayout.cpp:QRgba64 convertPixelToRGB64<(QImage::Format)10>(unsigned int) Unexecuted instantiation: qpixellayout.cpp:QRgba64 convertPixelToRGB64<(QImage::Format)11>(unsigned int) Unexecuted instantiation: qpixellayout.cpp:QRgba64 convertPixelToRGB64<(QImage::Format)12>(unsigned int) Unexecuted instantiation: qpixellayout.cpp:QRgba64 convertPixelToRGB64<(QImage::Format)13>(unsigned int) Unexecuted instantiation: qpixellayout.cpp:QRgba64 convertPixelToRGB64<(QImage::Format)14>(unsigned int) Unexecuted instantiation: qpixellayout.cpp:QRgba64 convertPixelToRGB64<(QImage::Format)15>(unsigned int) Unexecuted instantiation: qpixellayout.cpp:QRgba64 convertPixelToRGB64<(QImage::Format)29>(unsigned int) |
352 | | |
353 | | template<QImage::Format Format> |
354 | | static const QRgba64 *QT_FASTCALL convertToRGB64(QRgba64 *buffer, const uint *src, int count, |
355 | | const QList<QRgb> *, QDitherInfo *) |
356 | 0 | { |
357 | 0 | for (int i = 0; i < count; ++i) |
358 | 0 | buffer[i] = convertPixelToRGB64<Format>(src[i]); |
359 | 0 | return buffer; |
360 | 0 | } Unexecuted instantiation: qpixellayout.cpp:QRgba64 const* convertToRGB64<(QImage::Format)7>(QRgba64*, unsigned int const*, int, QList<unsigned int> const*, QDitherInfo*) Unexecuted instantiation: qpixellayout.cpp:QRgba64 const* convertToRGB64<(QImage::Format)9>(QRgba64*, unsigned int const*, int, QList<unsigned int> const*, QDitherInfo*) Unexecuted instantiation: qpixellayout.cpp:QRgba64 const* convertToRGB64<(QImage::Format)11>(QRgba64*, unsigned int const*, int, QList<unsigned int> const*, QDitherInfo*) Unexecuted instantiation: qpixellayout.cpp:QRgba64 const* convertToRGB64<(QImage::Format)13>(QRgba64*, unsigned int const*, int, QList<unsigned int> const*, QDitherInfo*) Unexecuted instantiation: qpixellayout.cpp:QRgba64 const* convertToRGB64<(QImage::Format)14>(QRgba64*, unsigned int const*, int, QList<unsigned int> const*, QDitherInfo*) Unexecuted instantiation: qpixellayout.cpp:QRgba64 const* convertToRGB64<(QImage::Format)29>(QRgba64*, unsigned int const*, int, QList<unsigned int> const*, QDitherInfo*) |
361 | | |
362 | | template<QImage::Format Format> |
363 | | static const QRgba64 *QT_FASTCALL fetchRGBToRGB64(QRgba64 *buffer, const uchar *src, int index, int count, |
364 | | const QList<QRgb> *, QDitherInfo *) |
365 | 0 | { |
366 | 0 | for (int i = 0; i < count; ++i) |
367 | 0 | buffer[i] = convertPixelToRGB64<Format>(fetchPixel<bitsPerPixel<Format>()>(src, index + i)); |
368 | 0 | return buffer; |
369 | 0 | } Unexecuted instantiation: qpixellayout.cpp:QRgba64 const* fetchRGBToRGB64<(QImage::Format)7>(QRgba64*, unsigned char const*, int, int, QList<unsigned int> const*, QDitherInfo*) Unexecuted instantiation: qpixellayout.cpp:QRgba64 const* fetchRGBToRGB64<(QImage::Format)9>(QRgba64*, unsigned char const*, int, int, QList<unsigned int> const*, QDitherInfo*) Unexecuted instantiation: qpixellayout.cpp:QRgba64 const* fetchRGBToRGB64<(QImage::Format)11>(QRgba64*, unsigned char const*, int, int, QList<unsigned int> const*, QDitherInfo*) Unexecuted instantiation: qpixellayout.cpp:QRgba64 const* fetchRGBToRGB64<(QImage::Format)13>(QRgba64*, unsigned char const*, int, int, QList<unsigned int> const*, QDitherInfo*) Unexecuted instantiation: qpixellayout.cpp:QRgba64 const* fetchRGBToRGB64<(QImage::Format)14>(QRgba64*, unsigned char const*, int, int, QList<unsigned int> const*, QDitherInfo*) Unexecuted instantiation: qpixellayout.cpp:QRgba64 const* fetchRGBToRGB64<(QImage::Format)29>(QRgba64*, unsigned char const*, int, int, QList<unsigned int> const*, QDitherInfo*) |
370 | | |
371 | | template<QImage::Format Format> |
372 | | Q_ALWAYS_INLINE static QRgbaFloat32 convertPixelToRGB32F(uint s) |
373 | 0 | { |
374 | 0 | return QRgbaFloat32::fromArgb32(convertPixelToRGB32<Format>(s)); |
375 | 0 | } Unexecuted instantiation: qpixellayout.cpp:QRgbaFloat<float> convertPixelToRGB32F<(QImage::Format)4>(unsigned int) Unexecuted instantiation: qpixellayout.cpp:QRgbaFloat<float> convertPixelToRGB32F<(QImage::Format)7>(unsigned int) Unexecuted instantiation: qpixellayout.cpp:QRgbaFloat<float> convertPixelToRGB32F<(QImage::Format)9>(unsigned int) Unexecuted instantiation: qpixellayout.cpp:QRgbaFloat<float> convertPixelToRGB32F<(QImage::Format)11>(unsigned int) Unexecuted instantiation: qpixellayout.cpp:QRgbaFloat<float> convertPixelToRGB32F<(QImage::Format)13>(unsigned int) Unexecuted instantiation: qpixellayout.cpp:QRgbaFloat<float> convertPixelToRGB32F<(QImage::Format)14>(unsigned int) Unexecuted instantiation: qpixellayout.cpp:QRgbaFloat<float> convertPixelToRGB32F<(QImage::Format)16>(unsigned int) Unexecuted instantiation: qpixellayout.cpp:QRgbaFloat<float> convertPixelToRGB32F<(QImage::Format)29>(unsigned int) |
376 | | |
377 | | template<QImage::Format Format> |
378 | | static const QRgbaFloat32 *QT_FASTCALL fetchRGBToRGB32F(QRgbaFloat32 *buffer, const uchar *src, int index, int count, |
379 | | const QList<QRgb> *, QDitherInfo *) |
380 | 0 | { |
381 | 0 | for (int i = 0; i < count; ++i) |
382 | 0 | buffer[i] = convertPixelToRGB32F<Format>(fetchPixel<bitsPerPixel<Format>()>(src, index + i)); |
383 | 0 | return buffer; |
384 | 0 | } Unexecuted instantiation: qpixellayout.cpp:QRgbaFloat<float> const* fetchRGBToRGB32F<(QImage::Format)4>(QRgbaFloat<float>*, unsigned char const*, int, int, QList<unsigned int> const*, QDitherInfo*) Unexecuted instantiation: qpixellayout.cpp:QRgbaFloat<float> const* fetchRGBToRGB32F<(QImage::Format)7>(QRgbaFloat<float>*, unsigned char const*, int, int, QList<unsigned int> const*, QDitherInfo*) Unexecuted instantiation: qpixellayout.cpp:QRgbaFloat<float> const* fetchRGBToRGB32F<(QImage::Format)9>(QRgbaFloat<float>*, unsigned char const*, int, int, QList<unsigned int> const*, QDitherInfo*) Unexecuted instantiation: qpixellayout.cpp:QRgbaFloat<float> const* fetchRGBToRGB32F<(QImage::Format)11>(QRgbaFloat<float>*, unsigned char const*, int, int, QList<unsigned int> const*, QDitherInfo*) Unexecuted instantiation: qpixellayout.cpp:QRgbaFloat<float> const* fetchRGBToRGB32F<(QImage::Format)13>(QRgbaFloat<float>*, unsigned char const*, int, int, QList<unsigned int> const*, QDitherInfo*) Unexecuted instantiation: qpixellayout.cpp:QRgbaFloat<float> const* fetchRGBToRGB32F<(QImage::Format)14>(QRgbaFloat<float>*, unsigned char const*, int, int, QList<unsigned int> const*, QDitherInfo*) Unexecuted instantiation: qpixellayout.cpp:QRgbaFloat<float> const* fetchRGBToRGB32F<(QImage::Format)16>(QRgbaFloat<float>*, unsigned char const*, int, int, QList<unsigned int> const*, QDitherInfo*) Unexecuted instantiation: qpixellayout.cpp:QRgbaFloat<float> const* fetchRGBToRGB32F<(QImage::Format)29>(QRgbaFloat<float>*, unsigned char const*, int, int, QList<unsigned int> const*, QDitherInfo*) |
385 | | |
386 | | template<QImage::Format Format> |
387 | | static inline uint convertPixelToARGB32PM(uint s) |
388 | 0 | { |
389 | 0 | constexpr uint alphaMask = ((1 << alphaWidth<Format>()) - 1); |
390 | 0 | constexpr uint redMask = ((1 << redWidth<Format>()) - 1); |
391 | 0 | constexpr uint greenMask = ((1 << greenWidth<Format>()) - 1); |
392 | 0 | constexpr uint blueMask = ((1 << blueWidth<Format>()) - 1); |
393 | |
|
394 | 0 | constexpr uchar alphaLeftShift = 8 - alphaWidth<Format>(); |
395 | 0 | constexpr uchar redLeftShift = 8 - redWidth<Format>(); |
396 | 0 | constexpr uchar greenLeftShift = 8 - greenWidth<Format>(); |
397 | 0 | constexpr uchar blueLeftShift = 8 - blueWidth<Format>(); |
398 | |
|
399 | 0 | constexpr uchar alphaRightShift = 2 * alphaWidth<Format>() - 8; |
400 | 0 | constexpr uchar redRightShift = 2 * redWidth<Format>() - 8; |
401 | 0 | constexpr uchar greenRightShift = 2 * greenWidth<Format>() - 8; |
402 | 0 | constexpr uchar blueRightShift = 2 * blueWidth<Format>() - 8; |
403 | |
|
404 | 0 | constexpr bool mustMin = (alphaWidth<Format>() != redWidth<Format>()) || |
405 | 0 | (alphaWidth<Format>() != greenWidth<Format>()) || |
406 | 0 | (alphaWidth<Format>() != blueWidth<Format>()); |
407 | |
|
408 | 0 | uint alpha = (s >> alphaShift<Format>()) & alphaMask; |
409 | 0 | uint red = (s >> redShift<Format>()) & redMask; |
410 | 0 | uint green = (s >> greenShift<Format>()) & greenMask; |
411 | 0 | uint blue = (s >> blueShift<Format>()) & blueMask; |
412 | |
|
413 | 0 | alpha = (alpha << alphaLeftShift) | (alpha >> alphaRightShift); |
414 | 0 | red = (red << redLeftShift) | (red >> redRightShift); |
415 | 0 | green = (green << greenLeftShift) | (green >> greenRightShift); |
416 | 0 | blue = (blue << blueLeftShift) | (blue >> blueRightShift); |
417 | |
|
418 | 0 | if (mustMin) { |
419 | 0 | red = qMin(alpha, red); |
420 | 0 | green = qMin(alpha, green); |
421 | 0 | blue = qMin(alpha, blue); |
422 | 0 | } |
423 | |
|
424 | 0 | return (alpha << 24) | (red << 16) | (green << 8) | blue; |
425 | 0 | } Unexecuted instantiation: qpixellayout.cpp:unsigned int convertPixelToARGB32PM<(QImage::Format)8>(unsigned int) Unexecuted instantiation: qpixellayout.cpp:unsigned int convertPixelToARGB32PM<(QImage::Format)10>(unsigned int) Unexecuted instantiation: qpixellayout.cpp:unsigned int convertPixelToARGB32PM<(QImage::Format)12>(unsigned int) Unexecuted instantiation: qpixellayout.cpp:unsigned int convertPixelToARGB32PM<(QImage::Format)15>(unsigned int) Unexecuted instantiation: qpixellayout.cpp:unsigned int convertPixelToARGB32PM<(QImage::Format)5>(unsigned int) Unexecuted instantiation: qpixellayout.cpp:unsigned int convertPixelToARGB32PM<(QImage::Format)6>(unsigned int) Unexecuted instantiation: qpixellayout.cpp:unsigned int convertPixelToARGB32PM<(QImage::Format)17>(unsigned int) Unexecuted instantiation: qpixellayout.cpp:unsigned int convertPixelToARGB32PM<(QImage::Format)18>(unsigned int) |
426 | | |
427 | | template<QImage::Format Format> |
428 | | static void QT_FASTCALL convertARGBPMToARGB32PM(uint *buffer, int count, const QList<QRgb> *) |
429 | 0 | { |
430 | 0 | for (int i = 0; i < count; ++i) |
431 | 0 | buffer[i] = convertPixelToARGB32PM<Format>(buffer[i]); |
432 | 0 | } Unexecuted instantiation: qpixellayout.cpp:void convertARGBPMToARGB32PM<(QImage::Format)8>(unsigned int*, int, QList<unsigned int> const*) Unexecuted instantiation: qpixellayout.cpp:void convertARGBPMToARGB32PM<(QImage::Format)10>(unsigned int*, int, QList<unsigned int> const*) Unexecuted instantiation: qpixellayout.cpp:void convertARGBPMToARGB32PM<(QImage::Format)12>(unsigned int*, int, QList<unsigned int> const*) Unexecuted instantiation: qpixellayout.cpp:void convertARGBPMToARGB32PM<(QImage::Format)15>(unsigned int*, int, QList<unsigned int> const*) |
433 | | |
434 | | template<QImage::Format Format> |
435 | | static const uint *QT_FASTCALL fetchARGBPMToARGB32PM(uint *buffer, const uchar *src, int index, int count, |
436 | | const QList<QRgb> *, QDitherInfo *) |
437 | 0 | { |
438 | 0 | constexpr QPixelLayout::BPP BPP = bitsPerPixel<Format>(); |
439 | 0 | #if defined(__SSE2__) && !defined(__SSSE3__) && QT_COMPILER_SUPPORTS_SSSE3 |
440 | 0 | if (BPP == QPixelLayout::BPP24 && qCpuHasFeature(SSSE3)) { |
441 | | // With SSE2 can convertToRGB32 be vectorized, but it takes SSSE3 |
442 | | // to vectorize the deforested version below. |
443 | 0 | fetchPixelsBPP24_ssse3(buffer, src, index, count); |
444 | 0 | convertARGBPMToARGB32PM<Format>(buffer, count, nullptr); |
445 | 0 | return buffer; |
446 | 0 | } |
447 | | #elif defined QT_COMPILER_SUPPORTS_LSX |
448 | | if (BPP == QPixelLayout::BPP24 && qCpuHasFeature(LSX)) { |
449 | | fetchPixelsBPP24_lsx(buffer, src, index, count); |
450 | | convertARGBPMToARGB32PM<Format>(buffer, count, nullptr); |
451 | | return buffer; |
452 | | } |
453 | | #endif |
454 | 0 | for (int i = 0; i < count; ++i) |
455 | 0 | buffer[i] = convertPixelToARGB32PM<Format>(fetchPixel<BPP>(src, index + i)); |
456 | 0 | return buffer; |
457 | 0 | } Unexecuted instantiation: qpixellayout.cpp:unsigned int const* fetchARGBPMToARGB32PM<(QImage::Format)8>(unsigned int*, unsigned char const*, int, int, QList<unsigned int> const*, QDitherInfo*) Unexecuted instantiation: qpixellayout.cpp:unsigned int const* fetchARGBPMToARGB32PM<(QImage::Format)10>(unsigned int*, unsigned char const*, int, int, QList<unsigned int> const*, QDitherInfo*) Unexecuted instantiation: qpixellayout.cpp:unsigned int const* fetchARGBPMToARGB32PM<(QImage::Format)12>(unsigned int*, unsigned char const*, int, int, QList<unsigned int> const*, QDitherInfo*) Unexecuted instantiation: qpixellayout.cpp:unsigned int const* fetchARGBPMToARGB32PM<(QImage::Format)15>(unsigned int*, unsigned char const*, int, int, QList<unsigned int> const*, QDitherInfo*) |
458 | | |
459 | | template<QImage::Format Format> |
460 | | static inline QRgba64 convertPixelToRGBA64PM(uint s) |
461 | 0 | { |
462 | 0 | return QRgba64::fromArgb32(convertPixelToARGB32PM<Format>(s)); |
463 | 0 | } Unexecuted instantiation: qpixellayout.cpp:QRgba64 convertPixelToRGBA64PM<(QImage::Format)8>(unsigned int) Unexecuted instantiation: qpixellayout.cpp:QRgba64 convertPixelToRGBA64PM<(QImage::Format)10>(unsigned int) Unexecuted instantiation: qpixellayout.cpp:QRgba64 convertPixelToRGBA64PM<(QImage::Format)12>(unsigned int) Unexecuted instantiation: qpixellayout.cpp:QRgba64 convertPixelToRGBA64PM<(QImage::Format)15>(unsigned int) |
464 | | |
465 | | template<QImage::Format Format> |
466 | | static const QRgba64 *QT_FASTCALL convertARGBPMToRGBA64PM(QRgba64 *buffer, const uint *src, int count, |
467 | | const QList<QRgb> *, QDitherInfo *) |
468 | 0 | { |
469 | 0 | for (int i = 0; i < count; ++i) |
470 | 0 | buffer[i] = convertPixelToRGB64<Format>(src[i]); |
471 | 0 | return buffer; |
472 | 0 | } Unexecuted instantiation: qpixellayout.cpp:QRgba64 const* convertARGBPMToRGBA64PM<(QImage::Format)8>(QRgba64*, unsigned int const*, int, QList<unsigned int> const*, QDitherInfo*) Unexecuted instantiation: qpixellayout.cpp:QRgba64 const* convertARGBPMToRGBA64PM<(QImage::Format)10>(QRgba64*, unsigned int const*, int, QList<unsigned int> const*, QDitherInfo*) Unexecuted instantiation: qpixellayout.cpp:QRgba64 const* convertARGBPMToRGBA64PM<(QImage::Format)12>(QRgba64*, unsigned int const*, int, QList<unsigned int> const*, QDitherInfo*) Unexecuted instantiation: qpixellayout.cpp:QRgba64 const* convertARGBPMToRGBA64PM<(QImage::Format)15>(QRgba64*, unsigned int const*, int, QList<unsigned int> const*, QDitherInfo*) |
473 | | |
474 | | template<QImage::Format Format> |
475 | | static const QRgba64 *QT_FASTCALL fetchARGBPMToRGBA64PM(QRgba64 *buffer, const uchar *src, int index, int count, |
476 | | const QList<QRgb> *, QDitherInfo *) |
477 | 0 | { |
478 | 0 | constexpr QPixelLayout::BPP bpp = bitsPerPixel<Format>(); |
479 | 0 | for (int i = 0; i < count; ++i) |
480 | 0 | buffer[i] = convertPixelToRGBA64PM<Format>(fetchPixel<bpp>(src, index + i)); |
481 | 0 | return buffer; |
482 | 0 | } Unexecuted instantiation: qpixellayout.cpp:QRgba64 const* fetchARGBPMToRGBA64PM<(QImage::Format)8>(QRgba64*, unsigned char const*, int, int, QList<unsigned int> const*, QDitherInfo*) Unexecuted instantiation: qpixellayout.cpp:QRgba64 const* fetchARGBPMToRGBA64PM<(QImage::Format)10>(QRgba64*, unsigned char const*, int, int, QList<unsigned int> const*, QDitherInfo*) Unexecuted instantiation: qpixellayout.cpp:QRgba64 const* fetchARGBPMToRGBA64PM<(QImage::Format)12>(QRgba64*, unsigned char const*, int, int, QList<unsigned int> const*, QDitherInfo*) Unexecuted instantiation: qpixellayout.cpp:QRgba64 const* fetchARGBPMToRGBA64PM<(QImage::Format)15>(QRgba64*, unsigned char const*, int, int, QList<unsigned int> const*, QDitherInfo*) |
483 | | |
484 | | template<QImage::Format Format> |
485 | | Q_ALWAYS_INLINE static QRgbaFloat32 convertPixelToRGBA32F(uint s) |
486 | 0 | { |
487 | 0 | return QRgbaFloat32::fromArgb32(convertPixelToARGB32PM<Format>(s)); |
488 | 0 | } Unexecuted instantiation: qpixellayout.cpp:QRgbaFloat<float> convertPixelToRGBA32F<(QImage::Format)5>(unsigned int) Unexecuted instantiation: qpixellayout.cpp:QRgbaFloat<float> convertPixelToRGBA32F<(QImage::Format)6>(unsigned int) Unexecuted instantiation: qpixellayout.cpp:QRgbaFloat<float> convertPixelToRGBA32F<(QImage::Format)8>(unsigned int) Unexecuted instantiation: qpixellayout.cpp:QRgbaFloat<float> convertPixelToRGBA32F<(QImage::Format)10>(unsigned int) Unexecuted instantiation: qpixellayout.cpp:QRgbaFloat<float> convertPixelToRGBA32F<(QImage::Format)12>(unsigned int) Unexecuted instantiation: qpixellayout.cpp:QRgbaFloat<float> convertPixelToRGBA32F<(QImage::Format)15>(unsigned int) Unexecuted instantiation: qpixellayout.cpp:QRgbaFloat<float> convertPixelToRGBA32F<(QImage::Format)17>(unsigned int) Unexecuted instantiation: qpixellayout.cpp:QRgbaFloat<float> convertPixelToRGBA32F<(QImage::Format)18>(unsigned int) |
489 | | |
490 | | template<QImage::Format Format> |
491 | | static const QRgbaFloat32 *QT_FASTCALL fetchARGBPMToRGBA32F(QRgbaFloat32 *buffer, const uchar *src, int index, int count, |
492 | | const QList<QRgb> *, QDitherInfo *) |
493 | 0 | { |
494 | 0 | constexpr QPixelLayout::BPP bpp = bitsPerPixel<Format>(); |
495 | 0 | for (int i = 0; i < count; ++i) |
496 | 0 | buffer[i] = convertPixelToRGBA32F<Format>(fetchPixel<bpp>(src, index + i)); |
497 | 0 | return buffer; |
498 | 0 | } Unexecuted instantiation: qpixellayout.cpp:QRgbaFloat<float> const* fetchARGBPMToRGBA32F<(QImage::Format)6>(QRgbaFloat<float>*, unsigned char const*, int, int, QList<unsigned int> const*, QDitherInfo*) Unexecuted instantiation: qpixellayout.cpp:QRgbaFloat<float> const* fetchARGBPMToRGBA32F<(QImage::Format)18>(QRgbaFloat<float>*, unsigned char const*, int, int, QList<unsigned int> const*, QDitherInfo*) |
499 | | |
500 | | template<QImage::Format Format> |
501 | | static const QRgbaFloat32 *QT_FASTCALL fetchARGBToRGBA32F(QRgbaFloat32 *buffer, const uchar *src, int index, int count, |
502 | | const QList<QRgb> *, QDitherInfo *) |
503 | 0 | { |
504 | 0 | constexpr QPixelLayout::BPP bpp = bitsPerPixel<Format>(); |
505 | 0 | for (int i = 0; i < count; ++i) |
506 | 0 | buffer[i] = convertPixelToRGBA32F<Format>(fetchPixel<bpp>(src, index + i)).premultiplied(); |
507 | 0 | return buffer; |
508 | 0 | } Unexecuted instantiation: qpixellayout.cpp:QRgbaFloat<float> const* fetchARGBToRGBA32F<(QImage::Format)5>(QRgbaFloat<float>*, unsigned char const*, int, int, QList<unsigned int> const*, QDitherInfo*) Unexecuted instantiation: qpixellayout.cpp:QRgbaFloat<float> const* fetchARGBToRGBA32F<(QImage::Format)8>(QRgbaFloat<float>*, unsigned char const*, int, int, QList<unsigned int> const*, QDitherInfo*) Unexecuted instantiation: qpixellayout.cpp:QRgbaFloat<float> const* fetchARGBToRGBA32F<(QImage::Format)10>(QRgbaFloat<float>*, unsigned char const*, int, int, QList<unsigned int> const*, QDitherInfo*) Unexecuted instantiation: qpixellayout.cpp:QRgbaFloat<float> const* fetchARGBToRGBA32F<(QImage::Format)12>(QRgbaFloat<float>*, unsigned char const*, int, int, QList<unsigned int> const*, QDitherInfo*) Unexecuted instantiation: qpixellayout.cpp:QRgbaFloat<float> const* fetchARGBToRGBA32F<(QImage::Format)15>(QRgbaFloat<float>*, unsigned char const*, int, int, QList<unsigned int> const*, QDitherInfo*) Unexecuted instantiation: qpixellayout.cpp:QRgbaFloat<float> const* fetchARGBToRGBA32F<(QImage::Format)17>(QRgbaFloat<float>*, unsigned char const*, int, int, QList<unsigned int> const*, QDitherInfo*) |
509 | | |
510 | | template<QImage::Format Format, bool fromRGB> |
511 | | static void QT_FASTCALL storeRGBFromARGB32PM(uchar *dest, const uint *src, int index, int count, |
512 | | const QList<QRgb> *, QDitherInfo *dither) |
513 | 0 | { |
514 | 0 | constexpr uchar rWidth = redWidth<Format>(); |
515 | 0 | constexpr uchar gWidth = greenWidth<Format>(); |
516 | 0 | constexpr uchar bWidth = blueWidth<Format>(); |
517 | 0 | constexpr QPixelLayout::BPP BPP = bitsPerPixel<Format>(); |
518 | | |
519 | | // RGB32 -> RGB888 is not a precision loss. |
520 | 0 | if (!dither || (rWidth == 8 && gWidth == 8 && bWidth == 8)) { |
521 | 0 | constexpr uint rMask = (1 << redWidth<Format>()) - 1; |
522 | 0 | constexpr uint gMask = (1 << greenWidth<Format>()) - 1; |
523 | 0 | constexpr uint bMask = (1 << blueWidth<Format>()) - 1; |
524 | 0 | constexpr uchar rRightShift = 24 - redWidth<Format>(); |
525 | 0 | constexpr uchar gRightShift = 16 - greenWidth<Format>(); |
526 | 0 | constexpr uchar bRightShift = 8 - blueWidth<Format>(); |
527 | |
|
528 | 0 | for (int i = 0; i < count; ++i) { |
529 | 0 | const uint c = fromRGB ? src[i] : qUnpremultiply(src[i]); |
530 | 0 | const uint r = ((c >> rRightShift) & rMask) << redShift<Format>(); |
531 | 0 | const uint g = ((c >> gRightShift) & gMask) << greenShift<Format>(); |
532 | 0 | const uint b = ((c >> bRightShift) & bMask) << blueShift<Format>(); |
533 | 0 | storePixel<BPP>(dest, index + i, r | g | b); |
534 | 0 | }; |
535 | 0 | } else { |
536 | | // We do ordered dither by using a rounding conversion, but instead of |
537 | | // adding half of input precision, we add the adjusted result from the |
538 | | // bayer matrix before narrowing. |
539 | | // Note: Rounding conversion in itself is different from the naive |
540 | | // conversion we do above for non-dithering. |
541 | 0 | const uint *bayer_line = qt_bayer_matrix[dither->y & 15]; |
542 | 0 | for (int i = 0; i < count; ++i) { |
543 | 0 | const uint c = fromRGB ? src[i] : qUnpremultiply(src[i]); |
544 | 0 | const int d = bayer_line[(dither->x + i) & 15]; |
545 | 0 | const int dr = d - ((d + 1) >> rWidth); |
546 | 0 | const int dg = d - ((d + 1) >> gWidth); |
547 | 0 | const int db = d - ((d + 1) >> bWidth); |
548 | 0 | int r = qRed(c); |
549 | 0 | int g = qGreen(c); |
550 | 0 | int b = qBlue(c); |
551 | 0 | r = (r + ((dr - r) >> rWidth) + 1) >> (8 - rWidth); |
552 | 0 | g = (g + ((dg - g) >> gWidth) + 1) >> (8 - gWidth); |
553 | 0 | b = (b + ((db - b) >> bWidth) + 1) >> (8 - bWidth); |
554 | 0 | const uint s = (r << redShift<Format>()) |
555 | 0 | | (g << greenShift<Format>()) |
556 | 0 | | (b << blueShift<Format>()); |
557 | 0 | storePixel<BPP>(dest, index + i, s); |
558 | 0 | } |
559 | 0 | } |
560 | 0 | } Unexecuted instantiation: qpixellayout.cpp:void storeRGBFromARGB32PM<(QImage::Format)7, false>(unsigned char*, unsigned int const*, int, int, QList<unsigned int> const*, QDitherInfo*) Unexecuted instantiation: qpixellayout.cpp:void storeRGBFromARGB32PM<(QImage::Format)7, true>(unsigned char*, unsigned int const*, int, int, QList<unsigned int> const*, QDitherInfo*) Unexecuted instantiation: qpixellayout.cpp:void storeRGBFromARGB32PM<(QImage::Format)9, false>(unsigned char*, unsigned int const*, int, int, QList<unsigned int> const*, QDitherInfo*) Unexecuted instantiation: qpixellayout.cpp:void storeRGBFromARGB32PM<(QImage::Format)9, true>(unsigned char*, unsigned int const*, int, int, QList<unsigned int> const*, QDitherInfo*) Unexecuted instantiation: qpixellayout.cpp:void storeRGBFromARGB32PM<(QImage::Format)11, false>(unsigned char*, unsigned int const*, int, int, QList<unsigned int> const*, QDitherInfo*) Unexecuted instantiation: qpixellayout.cpp:void storeRGBFromARGB32PM<(QImage::Format)11, true>(unsigned char*, unsigned int const*, int, int, QList<unsigned int> const*, QDitherInfo*) Unexecuted instantiation: qpixellayout.cpp:void storeRGBFromARGB32PM<(QImage::Format)13, false>(unsigned char*, unsigned int const*, int, int, QList<unsigned int> const*, QDitherInfo*) Unexecuted instantiation: qpixellayout.cpp:void storeRGBFromARGB32PM<(QImage::Format)13, true>(unsigned char*, unsigned int const*, int, int, QList<unsigned int> const*, QDitherInfo*) Unexecuted instantiation: qpixellayout.cpp:void storeRGBFromARGB32PM<(QImage::Format)14, false>(unsigned char*, unsigned int const*, int, int, QList<unsigned int> const*, QDitherInfo*) Unexecuted instantiation: qpixellayout.cpp:void storeRGBFromARGB32PM<(QImage::Format)14, true>(unsigned char*, unsigned int const*, int, int, QList<unsigned int> const*, QDitherInfo*) Unexecuted instantiation: qpixellayout.cpp:void storeRGBFromARGB32PM<(QImage::Format)29, false>(unsigned char*, unsigned int const*, int, int, QList<unsigned int> const*, QDitherInfo*) Unexecuted instantiation: qpixellayout.cpp:void storeRGBFromARGB32PM<(QImage::Format)29, true>(unsigned char*, unsigned int const*, int, int, QList<unsigned int> const*, QDitherInfo*) |
561 | | |
562 | | template<QImage::Format Format, bool fromRGB> |
563 | | static void QT_FASTCALL storeARGBPMFromARGB32PM(uchar *dest, const uint *src, int index, int count, |
564 | | const QList<QRgb> *, QDitherInfo *dither) |
565 | 0 | { |
566 | 0 | constexpr QPixelLayout::BPP BPP = bitsPerPixel<Format>(); |
567 | 0 | if (!dither) { |
568 | 0 | constexpr uint aMask = (1 << alphaWidth<Format>()) - 1; |
569 | 0 | constexpr uint rMask = (1 << redWidth<Format>()) - 1; |
570 | 0 | constexpr uint gMask = (1 << greenWidth<Format>()) - 1; |
571 | 0 | constexpr uint bMask = (1 << blueWidth<Format>()) - 1; |
572 | |
|
573 | 0 | constexpr uchar aRightShift = 32 - alphaWidth<Format>(); |
574 | 0 | constexpr uchar rRightShift = 24 - redWidth<Format>(); |
575 | 0 | constexpr uchar gRightShift = 16 - greenWidth<Format>(); |
576 | 0 | constexpr uchar bRightShift = 8 - blueWidth<Format>(); |
577 | |
|
578 | 0 | constexpr uint aOpaque = aMask << alphaShift<Format>(); |
579 | 0 | for (int i = 0; i < count; ++i) { |
580 | 0 | const uint c = src[i]; |
581 | 0 | const uint a = fromRGB ? aOpaque : (((c >> aRightShift) & aMask) << alphaShift<Format>()); |
582 | 0 | const uint r = ((c >> rRightShift) & rMask) << redShift<Format>(); |
583 | 0 | const uint g = ((c >> gRightShift) & gMask) << greenShift<Format>(); |
584 | 0 | const uint b = ((c >> bRightShift) & bMask) << blueShift<Format>(); |
585 | 0 | storePixel<BPP>(dest, index + i, a | r | g | b); |
586 | 0 | }; |
587 | 0 | } else { |
588 | 0 | constexpr uchar aWidth = alphaWidth<Format>(); |
589 | 0 | constexpr uchar rWidth = redWidth<Format>(); |
590 | 0 | constexpr uchar gWidth = greenWidth<Format>(); |
591 | 0 | constexpr uchar bWidth = blueWidth<Format>(); |
592 | |
|
593 | 0 | const uint *bayer_line = qt_bayer_matrix[dither->y & 15]; |
594 | 0 | for (int i = 0; i < count; ++i) { |
595 | 0 | const uint c = src[i]; |
596 | 0 | const int d = bayer_line[(dither->x + i) & 15]; |
597 | 0 | const int da = d - ((d + 1) >> aWidth); |
598 | 0 | const int dr = d - ((d + 1) >> rWidth); |
599 | 0 | const int dg = d - ((d + 1) >> gWidth); |
600 | 0 | const int db = d - ((d + 1) >> bWidth); |
601 | 0 | int a = qAlpha(c); |
602 | 0 | int r = qRed(c); |
603 | 0 | int g = qGreen(c); |
604 | 0 | int b = qBlue(c); |
605 | 0 | if (fromRGB) |
606 | 0 | a = (1 << aWidth) - 1; |
607 | 0 | else |
608 | 0 | a = (a + ((da - a) >> aWidth) + 1) >> (8 - aWidth); |
609 | 0 | r = (r + ((dr - r) >> rWidth) + 1) >> (8 - rWidth); |
610 | 0 | g = (g + ((dg - g) >> gWidth) + 1) >> (8 - gWidth); |
611 | 0 | b = (b + ((db - b) >> bWidth) + 1) >> (8 - bWidth); |
612 | 0 | uint s = (a << alphaShift<Format>()) |
613 | 0 | | (r << redShift<Format>()) |
614 | 0 | | (g << greenShift<Format>()) |
615 | 0 | | (b << blueShift<Format>()); |
616 | 0 | storePixel<BPP>(dest, index + i, s); |
617 | 0 | } |
618 | 0 | } |
619 | 0 | } Unexecuted instantiation: qpixellayout.cpp:void storeARGBPMFromARGB32PM<(QImage::Format)8, false>(unsigned char*, unsigned int const*, int, int, QList<unsigned int> const*, QDitherInfo*) Unexecuted instantiation: qpixellayout.cpp:void storeARGBPMFromARGB32PM<(QImage::Format)8, true>(unsigned char*, unsigned int const*, int, int, QList<unsigned int> const*, QDitherInfo*) Unexecuted instantiation: qpixellayout.cpp:void storeARGBPMFromARGB32PM<(QImage::Format)10, false>(unsigned char*, unsigned int const*, int, int, QList<unsigned int> const*, QDitherInfo*) Unexecuted instantiation: qpixellayout.cpp:void storeARGBPMFromARGB32PM<(QImage::Format)10, true>(unsigned char*, unsigned int const*, int, int, QList<unsigned int> const*, QDitherInfo*) Unexecuted instantiation: qpixellayout.cpp:void storeARGBPMFromARGB32PM<(QImage::Format)12, false>(unsigned char*, unsigned int const*, int, int, QList<unsigned int> const*, QDitherInfo*) Unexecuted instantiation: qpixellayout.cpp:void storeARGBPMFromARGB32PM<(QImage::Format)12, true>(unsigned char*, unsigned int const*, int, int, QList<unsigned int> const*, QDitherInfo*) Unexecuted instantiation: qpixellayout.cpp:void storeARGBPMFromARGB32PM<(QImage::Format)15, false>(unsigned char*, unsigned int const*, int, int, QList<unsigned int> const*, QDitherInfo*) Unexecuted instantiation: qpixellayout.cpp:void storeARGBPMFromARGB32PM<(QImage::Format)15, true>(unsigned char*, unsigned int const*, int, int, QList<unsigned int> const*, QDitherInfo*) |
620 | | |
621 | | template<QImage::Format Format> |
622 | | static void QT_FASTCALL rbSwap(uchar *dst, const uchar *src, int count) |
623 | 0 | { |
624 | 0 | constexpr uchar aWidth = alphaWidth<Format>(); |
625 | 0 | constexpr uchar aShift = alphaShift<Format>(); |
626 | 0 | constexpr uchar rWidth = redWidth<Format>(); |
627 | 0 | constexpr uchar rShift = redShift<Format>(); |
628 | 0 | constexpr uchar gWidth = greenWidth<Format>(); |
629 | 0 | constexpr uchar gShift = greenShift<Format>(); |
630 | 0 | constexpr uchar bWidth = blueWidth<Format>(); |
631 | 0 | constexpr uchar bShift = blueShift<Format>(); |
632 | 0 | static_assert(rWidth == bWidth); |
633 | 0 | constexpr uint redBlueMask = (1 << rWidth) - 1; |
634 | 0 | constexpr uint alphaGreenMask = (((1 << aWidth) - 1) << aShift) |
635 | 0 | | (((1 << gWidth) - 1) << gShift); |
636 | 0 | constexpr QPixelLayout::BPP bpp = bitsPerPixel<Format>(); |
637 | |
|
638 | 0 | for (int i = 0; i < count; ++i) { |
639 | 0 | const uint c = fetchPixel<bpp>(src, i); |
640 | 0 | const uint r = (c >> rShift) & redBlueMask; |
641 | 0 | const uint b = (c >> bShift) & redBlueMask; |
642 | 0 | const uint t = (c & alphaGreenMask) |
643 | 0 | | (r << bShift) |
644 | 0 | | (b << rShift); |
645 | 0 | storePixel<bpp>(dst, i, t); |
646 | 0 | } |
647 | 0 | } Unexecuted instantiation: qpixellayout.cpp:void rbSwap<(QImage::Format)7>(unsigned char*, unsigned char const*, int) Unexecuted instantiation: qpixellayout.cpp:void rbSwap<(QImage::Format)8>(unsigned char*, unsigned char const*, int) Unexecuted instantiation: qpixellayout.cpp:void rbSwap<(QImage::Format)9>(unsigned char*, unsigned char const*, int) Unexecuted instantiation: qpixellayout.cpp:void rbSwap<(QImage::Format)10>(unsigned char*, unsigned char const*, int) Unexecuted instantiation: qpixellayout.cpp:void rbSwap<(QImage::Format)11>(unsigned char*, unsigned char const*, int) Unexecuted instantiation: qpixellayout.cpp:void rbSwap<(QImage::Format)12>(unsigned char*, unsigned char const*, int) Unexecuted instantiation: qpixellayout.cpp:void rbSwap<(QImage::Format)13>(unsigned char*, unsigned char const*, int) Unexecuted instantiation: qpixellayout.cpp:void rbSwap<(QImage::Format)14>(unsigned char*, unsigned char const*, int) Unexecuted instantiation: qpixellayout.cpp:void rbSwap<(QImage::Format)15>(unsigned char*, unsigned char const*, int) Unexecuted instantiation: qpixellayout.cpp:void rbSwap<(QImage::Format)29>(unsigned char*, unsigned char const*, int) |
648 | | |
649 | | static void QT_FASTCALL rbSwap_rgb32(uchar *d, const uchar *s, int count) |
650 | 0 | { |
651 | 0 | const uint *src = reinterpret_cast<const uint *>(s); |
652 | 0 | uint *dest = reinterpret_cast<uint *>(d); |
653 | 0 | for (int i = 0; i < count; ++i) { |
654 | 0 | const uint c = src[i]; |
655 | 0 | const uint ag = c & 0xff00ff00; |
656 | 0 | const uint rb = c & 0x00ff00ff; |
657 | 0 | dest[i] = ag | (rb << 16) | (rb >> 16); |
658 | 0 | } |
659 | 0 | } |
660 | | |
661 | | #if Q_BYTE_ORDER == Q_LITTLE_ENDIAN |
662 | | template<> |
663 | | void QT_FASTCALL rbSwap<QImage::Format_RGBA8888>(uchar *d, const uchar *s, int count) |
664 | 0 | { |
665 | 0 | return rbSwap_rgb32(d, s, count); |
666 | 0 | } |
667 | | #else |
668 | | template<> |
669 | | void QT_FASTCALL rbSwap<QImage::Format_RGBA8888>(uchar *d, const uchar *s, int count) |
670 | | { |
671 | | const uint *src = reinterpret_cast<const uint *>(s); |
672 | | uint *dest = reinterpret_cast<uint *>(d); |
673 | | for (int i = 0; i < count; ++i) { |
674 | | const uint c = src[i]; |
675 | | const uint rb = c & 0xff00ff00; |
676 | | const uint ga = c & 0x00ff00ff; |
677 | | dest[i] = ga | (rb << 16) | (rb >> 16); |
678 | | } |
679 | | } |
680 | | #endif |
681 | | |
682 | | static void QT_FASTCALL rbSwap_rgb30(uchar *d, const uchar *s, int count) |
683 | 0 | { |
684 | 0 | const uint *src = reinterpret_cast<const uint *>(s); |
685 | 0 | uint *dest = reinterpret_cast<uint *>(d); |
686 | 0 | UNALIASED_CONVERSION_LOOP(dest, src, count, qRgbSwapRgb30); |
687 | 0 | } |
688 | | |
689 | | static void QT_FASTCALL rbSwap_4x16(uchar *d, const uchar *s, int count) |
690 | 0 | { |
691 | 0 | const ushort *src = reinterpret_cast<const ushort *>(s); |
692 | 0 | ushort *dest = reinterpret_cast<ushort *>(d); |
693 | 0 | if (src != dest) { |
694 | 0 | for (int i = 0; i < count; ++i) { |
695 | 0 | dest[i * 4 + 0] = src[i * 4 + 2]; |
696 | 0 | dest[i * 4 + 1] = src[i * 4 + 1]; |
697 | 0 | dest[i * 4 + 2] = src[i * 4 + 0]; |
698 | 0 | dest[i * 4 + 3] = src[i * 4 + 3]; |
699 | 0 | } |
700 | 0 | } else { |
701 | 0 | for (int i = 0; i < count; ++i) { |
702 | 0 | const ushort r = src[i * 4 + 0]; |
703 | 0 | const ushort b = src[i * 4 + 2]; |
704 | 0 | dest[i * 4 + 0] = b; |
705 | 0 | dest[i * 4 + 2] = r; |
706 | 0 | } |
707 | 0 | } |
708 | 0 | } |
709 | | |
710 | | static void QT_FASTCALL rbSwap_4x32(uchar *d, const uchar *s, int count) |
711 | 0 | { |
712 | 0 | const uint *src = reinterpret_cast<const uint *>(s); |
713 | 0 | uint *dest = reinterpret_cast<uint *>(d); |
714 | 0 | if (src != dest) { |
715 | 0 | for (int i = 0; i < count; ++i) { |
716 | 0 | dest[i * 4 + 0] = src[i * 4 + 2]; |
717 | 0 | dest[i * 4 + 1] = src[i * 4 + 1]; |
718 | 0 | dest[i * 4 + 2] = src[i * 4 + 0]; |
719 | 0 | dest[i * 4 + 3] = src[i * 4 + 3]; |
720 | 0 | } |
721 | 0 | } else { |
722 | 0 | for (int i = 0; i < count; ++i) { |
723 | 0 | const uint r = src[i * 4 + 0]; |
724 | 0 | const uint b = src[i * 4 + 2]; |
725 | 0 | dest[i * 4 + 0] = b; |
726 | 0 | dest[i * 4 + 2] = r; |
727 | 0 | } |
728 | 0 | } |
729 | 0 | } |
730 | | |
731 | | template<QImage::Format Format> constexpr static inline QPixelLayout pixelLayoutRGB() |
732 | 0 | { |
733 | 0 | return QPixelLayout{ |
734 | 0 | false, |
735 | 0 | false, |
736 | 0 | bitsPerPixel<Format>(), |
737 | 0 | rbSwap<Format>, |
738 | 0 | convertToRGB32<Format>, |
739 | 0 | convertToRGB64<Format>, |
740 | 0 | fetchRGBToRGB32<Format>, |
741 | 0 | fetchRGBToRGB64<Format>, |
742 | 0 | storeRGBFromARGB32PM<Format, false>, |
743 | 0 | storeRGBFromARGB32PM<Format, true> |
744 | 0 | }; |
745 | 0 | } Unexecuted instantiation: qpixellayout.cpp:QPixelLayout pixelLayoutRGB<(QImage::Format)7>() Unexecuted instantiation: qpixellayout.cpp:QPixelLayout pixelLayoutRGB<(QImage::Format)9>() Unexecuted instantiation: qpixellayout.cpp:QPixelLayout pixelLayoutRGB<(QImage::Format)11>() Unexecuted instantiation: qpixellayout.cpp:QPixelLayout pixelLayoutRGB<(QImage::Format)13>() Unexecuted instantiation: qpixellayout.cpp:QPixelLayout pixelLayoutRGB<(QImage::Format)14>() Unexecuted instantiation: qpixellayout.cpp:QPixelLayout pixelLayoutRGB<(QImage::Format)29>() |
746 | | |
747 | | template<QImage::Format Format> constexpr static inline QPixelLayout pixelLayoutARGBPM() |
748 | 0 | { |
749 | 0 | return QPixelLayout{ |
750 | 0 | true, |
751 | 0 | true, |
752 | 0 | bitsPerPixel<Format>(), |
753 | 0 | rbSwap<Format>, |
754 | 0 | convertARGBPMToARGB32PM<Format>, |
755 | 0 | convertARGBPMToRGBA64PM<Format>, |
756 | 0 | fetchARGBPMToARGB32PM<Format>, |
757 | 0 | fetchARGBPMToRGBA64PM<Format>, |
758 | 0 | storeARGBPMFromARGB32PM<Format, false>, |
759 | 0 | storeARGBPMFromARGB32PM<Format, true> |
760 | 0 | }; |
761 | 0 | } Unexecuted instantiation: qpixellayout.cpp:QPixelLayout pixelLayoutARGBPM<(QImage::Format)8>() Unexecuted instantiation: qpixellayout.cpp:QPixelLayout pixelLayoutARGBPM<(QImage::Format)10>() Unexecuted instantiation: qpixellayout.cpp:QPixelLayout pixelLayoutARGBPM<(QImage::Format)12>() Unexecuted instantiation: qpixellayout.cpp:QPixelLayout pixelLayoutARGBPM<(QImage::Format)15>() |
762 | | |
763 | | static void QT_FASTCALL convertIndexedToARGB32PM(uint *buffer, int count, const QList<QRgb> *clut) |
764 | 0 | { |
765 | 0 | for (int i = 0; i < count; ++i) |
766 | 0 | buffer[i] = qPremultiply(clut->at(buffer[i])); |
767 | 0 | } |
768 | | |
769 | | template<QPixelLayout::BPP BPP> |
770 | | static const uint *QT_FASTCALL fetchIndexedToARGB32PM(uint *buffer, const uchar *src, int index, int count, |
771 | | const QList<QRgb> *clut, QDitherInfo *) |
772 | 0 | { |
773 | 0 | for (int i = 0; i < count; ++i) { |
774 | 0 | const uint s = fetchPixel<BPP>(src, index + i); |
775 | 0 | buffer[i] = qPremultiply(clut->at(s)); |
776 | 0 | } |
777 | 0 | return buffer; |
778 | 0 | } Unexecuted instantiation: qpixellayout.cpp:unsigned int const* fetchIndexedToARGB32PM<(QPixelLayout::BPP)1>(unsigned int*, unsigned char const*, int, int, QList<unsigned int> const*, QDitherInfo*) Unexecuted instantiation: qpixellayout.cpp:unsigned int const* fetchIndexedToARGB32PM<(QPixelLayout::BPP)2>(unsigned int*, unsigned char const*, int, int, QList<unsigned int> const*, QDitherInfo*) Unexecuted instantiation: qpixellayout.cpp:unsigned int const* fetchIndexedToARGB32PM<(QPixelLayout::BPP)3>(unsigned int*, unsigned char const*, int, int, QList<unsigned int> const*, QDitherInfo*) |
779 | | |
780 | | template<QPixelLayout::BPP BPP> |
781 | | static const QRgba64 *QT_FASTCALL fetchIndexedToRGBA64PM(QRgba64 *buffer, const uchar *src, int index, int count, |
782 | | const QList<QRgb> *clut, QDitherInfo *) |
783 | 0 | { |
784 | 0 | for (int i = 0; i < count; ++i) { |
785 | 0 | const uint s = fetchPixel<BPP>(src, index + i); |
786 | 0 | buffer[i] = QRgba64::fromArgb32(clut->at(s)).premultiplied(); |
787 | 0 | } |
788 | 0 | return buffer; |
789 | 0 | } Unexecuted instantiation: qpixellayout.cpp:QRgba64 const* fetchIndexedToRGBA64PM<(QPixelLayout::BPP)1>(QRgba64*, unsigned char const*, int, int, QList<unsigned int> const*, QDitherInfo*) Unexecuted instantiation: qpixellayout.cpp:QRgba64 const* fetchIndexedToRGBA64PM<(QPixelLayout::BPP)2>(QRgba64*, unsigned char const*, int, int, QList<unsigned int> const*, QDitherInfo*) Unexecuted instantiation: qpixellayout.cpp:QRgba64 const* fetchIndexedToRGBA64PM<(QPixelLayout::BPP)3>(QRgba64*, unsigned char const*, int, int, QList<unsigned int> const*, QDitherInfo*) |
790 | | |
791 | | template<QPixelLayout::BPP BPP> |
792 | | static const QRgbaFloat32 *QT_FASTCALL fetchIndexedToRGBA32F(QRgbaFloat32 *buffer, const uchar *src, int index, int count, |
793 | | const QList<QRgb> *clut, QDitherInfo *) |
794 | 0 | { |
795 | 0 | for (int i = 0; i < count; ++i) { |
796 | 0 | const uint s = fetchPixel<BPP>(src, index + i); |
797 | 0 | buffer[i] = QRgbaFloat32::fromArgb32(clut->at(s)).premultiplied(); |
798 | 0 | } |
799 | 0 | return buffer; |
800 | 0 | } Unexecuted instantiation: qpixellayout.cpp:QRgbaFloat<float> const* fetchIndexedToRGBA32F<(QPixelLayout::BPP)1>(QRgbaFloat<float>*, unsigned char const*, int, int, QList<unsigned int> const*, QDitherInfo*) Unexecuted instantiation: qpixellayout.cpp:QRgbaFloat<float> const* fetchIndexedToRGBA32F<(QPixelLayout::BPP)2>(QRgbaFloat<float>*, unsigned char const*, int, int, QList<unsigned int> const*, QDitherInfo*) Unexecuted instantiation: qpixellayout.cpp:QRgbaFloat<float> const* fetchIndexedToRGBA32F<(QPixelLayout::BPP)3>(QRgbaFloat<float>*, unsigned char const*, int, int, QList<unsigned int> const*, QDitherInfo*) |
801 | | |
802 | | template<typename QRgba> |
803 | | static const QRgba *QT_FASTCALL convertIndexedTo(QRgba *buffer, const uint *src, int count, |
804 | | const QList<QRgb> *clut, QDitherInfo *) |
805 | 0 | { |
806 | 0 | for (int i = 0; i < count; ++i) |
807 | 0 | buffer[i] = QRgba::fromArgb32(clut->at(src[i])).premultiplied(); |
808 | 0 | return buffer; |
809 | 0 | } Unexecuted instantiation: qpixellayout.cpp:QRgba64 const* convertIndexedTo<QRgba64>(QRgba64*, unsigned int const*, int, QList<unsigned int> const*, QDitherInfo*) Unexecuted instantiation: qpixellayout.cpp:QRgbaFloat<float> const* convertIndexedTo<QRgbaFloat<float> >(QRgbaFloat<float>*, unsigned int const*, int, QList<unsigned int> const*, QDitherInfo*) |
810 | | |
811 | | static void QT_FASTCALL convertPassThrough(uint *, int, const QList<QRgb> *) |
812 | 0 | { |
813 | 0 | } |
814 | | |
815 | | static const uint *QT_FASTCALL fetchPassThrough(uint *, const uchar *src, int index, int, |
816 | | const QList<QRgb> *, QDitherInfo *) |
817 | 0 | { |
818 | 0 | return reinterpret_cast<const uint *>(src) + index; |
819 | 0 | } |
820 | | |
821 | | static const QRgba64 *QT_FASTCALL fetchPassThrough64(QRgba64 *, const uchar *src, int index, int, |
822 | | const QList<QRgb> *, QDitherInfo *) |
823 | 0 | { |
824 | 0 | return reinterpret_cast<const QRgba64 *>(src) + index; |
825 | 0 | } |
826 | | |
827 | | static void QT_FASTCALL storePassThrough(uchar *dest, const uint *src, int index, int count, |
828 | | const QList<QRgb> *, QDitherInfo *) |
829 | 0 | { |
830 | 0 | uint *d = reinterpret_cast<uint *>(dest) + index; |
831 | 0 | if (d != src) |
832 | 0 | memcpy(d, src, count * sizeof(uint)); |
833 | 0 | } |
834 | | |
835 | | static void QT_FASTCALL convertARGB32ToARGB32PM(uint *buffer, int count, const QList<QRgb> *) |
836 | 0 | { |
837 | 0 | qt_convertARGB32ToARGB32PM(buffer, buffer, count); |
838 | 0 | } |
839 | | |
840 | | static const uint *QT_FASTCALL fetchARGB32ToARGB32PM(uint *buffer, const uchar *src, int index, int count, |
841 | | const QList<QRgb> *, QDitherInfo *) |
842 | 0 | { |
843 | 0 | return qt_convertARGB32ToARGB32PM(buffer, reinterpret_cast<const uint *>(src) + index, count); |
844 | 0 | } |
845 | | |
846 | | static void QT_FASTCALL convertRGBA8888PMToARGB32PM(uint *buffer, int count, const QList<QRgb> *) |
847 | 0 | { |
848 | 0 | for (int i = 0; i < count; ++i) |
849 | 0 | buffer[i] = RGBA2ARGB(buffer[i]); |
850 | 0 | } |
851 | | |
852 | | static const uint *QT_FASTCALL fetchRGBA8888PMToARGB32PM(uint *buffer, const uchar *src, int index, int count, |
853 | | const QList<QRgb> *, QDitherInfo *) |
854 | 0 | { |
855 | 0 | const uint *s = reinterpret_cast<const uint *>(src) + index; |
856 | 0 | UNALIASED_CONVERSION_LOOP(buffer, s, count, RGBA2ARGB); |
857 | 0 | return buffer; |
858 | 0 | } |
859 | | |
860 | | static void QT_FASTCALL convertRGBA8888ToARGB32PM(uint *buffer, int count, const QList<QRgb> *) |
861 | 0 | { |
862 | 0 | qt_convertRGBA8888ToARGB32PM(buffer, buffer, count); |
863 | 0 | } |
864 | | |
865 | | static const uint *QT_FASTCALL fetchRGBA8888ToARGB32PM(uint *buffer, const uchar *src, int index, int count, |
866 | | const QList<QRgb> *, QDitherInfo *) |
867 | 0 | { |
868 | 0 | return qt_convertRGBA8888ToARGB32PM(buffer, reinterpret_cast<const uint *>(src) + index, count); |
869 | 0 | } |
870 | | |
871 | | static void QT_FASTCALL convertAlpha8ToRGB32(uint *buffer, int count, const QList<QRgb> *) |
872 | 0 | { |
873 | 0 | for (int i = 0; i < count; ++i) |
874 | 0 | buffer[i] = qRgba(0, 0, 0, buffer[i]); |
875 | 0 | } |
876 | | |
877 | | static const uint *QT_FASTCALL fetchAlpha8ToRGB32(uint *buffer, const uchar *src, int index, int count, |
878 | | const QList<QRgb> *, QDitherInfo *) |
879 | 0 | { |
880 | 0 | for (int i = 0; i < count; ++i) |
881 | 0 | buffer[i] = qRgba(0, 0, 0, src[index + i]); |
882 | 0 | return buffer; |
883 | 0 | } |
884 | | |
885 | | template<typename QRgba> |
886 | | static const QRgba *QT_FASTCALL convertAlpha8To(QRgba *buffer, const uint *src, int count, |
887 | | const QList<QRgb> *, QDitherInfo *) |
888 | 0 | { |
889 | 0 | for (int i = 0; i < count; ++i) |
890 | 0 | buffer[i] = QRgba::fromRgba(0, 0, 0, src[i]); |
891 | 0 | return buffer; |
892 | 0 | } Unexecuted instantiation: qpixellayout.cpp:QRgba64 const* convertAlpha8To<QRgba64>(QRgba64*, unsigned int const*, int, QList<unsigned int> const*, QDitherInfo*) Unexecuted instantiation: qpixellayout.cpp:QRgbaFloat<float> const* convertAlpha8To<QRgbaFloat<float> >(QRgbaFloat<float>*, unsigned int const*, int, QList<unsigned int> const*, QDitherInfo*) |
893 | | |
894 | | template<typename QRgba> |
895 | | static const QRgba *QT_FASTCALL fetchAlpha8To(QRgba *buffer, const uchar *src, int index, int count, |
896 | | const QList<QRgb> *, QDitherInfo *) |
897 | 0 | { |
898 | 0 | for (int i = 0; i < count; ++i) |
899 | 0 | buffer[i] = QRgba::fromRgba(0, 0, 0, src[index + i]); |
900 | 0 | return buffer; |
901 | 0 | } Unexecuted instantiation: qpixellayout.cpp:QRgba64 const* fetchAlpha8To<QRgba64>(QRgba64*, unsigned char const*, int, int, QList<unsigned int> const*, QDitherInfo*) Unexecuted instantiation: qpixellayout.cpp:QRgbaFloat<float> const* fetchAlpha8To<QRgbaFloat<float> >(QRgbaFloat<float>*, unsigned char const*, int, int, QList<unsigned int> const*, QDitherInfo*) |
902 | | |
903 | | static void QT_FASTCALL convertGrayscale8ToRGB32(uint *buffer, int count, const QList<QRgb> *) |
904 | 0 | { |
905 | 0 | for (int i = 0; i < count; ++i) { |
906 | 0 | const uint s = buffer[i]; |
907 | 0 | buffer[i] = qRgb(s, s, s); |
908 | 0 | } |
909 | 0 | } |
910 | | |
911 | | static const uint *QT_FASTCALL fetchGrayscale8ToRGB32(uint *buffer, const uchar *src, int index, int count, |
912 | | const QList<QRgb> *, QDitherInfo *) |
913 | 0 | { |
914 | 0 | for (int i = 0; i < count; ++i) { |
915 | 0 | const uint s = src[index + i]; |
916 | 0 | buffer[i] = qRgb(s, s, s); |
917 | 0 | } |
918 | 0 | return buffer; |
919 | 0 | } |
920 | | |
921 | | template<typename QRgba> |
922 | | static const QRgba *QT_FASTCALL convertGrayscale8To(QRgba *buffer, const uint *src, int count, |
923 | | const QList<QRgb> *, QDitherInfo *) |
924 | 0 | { |
925 | 0 | for (int i = 0; i < count; ++i) |
926 | 0 | buffer[i] = QRgba::fromRgba(src[i], src[i], src[i], 255); |
927 | 0 | return buffer; |
928 | 0 | } Unexecuted instantiation: qpixellayout.cpp:QRgba64 const* convertGrayscale8To<QRgba64>(QRgba64*, unsigned int const*, int, QList<unsigned int> const*, QDitherInfo*) Unexecuted instantiation: qpixellayout.cpp:QRgbaFloat<float> const* convertGrayscale8To<QRgbaFloat<float> >(QRgbaFloat<float>*, unsigned int const*, int, QList<unsigned int> const*, QDitherInfo*) |
929 | | |
930 | | template<typename QRgba> |
931 | | static const QRgba *QT_FASTCALL fetchGrayscale8To(QRgba *buffer, const uchar *src, int index, int count, |
932 | | const QList<QRgb> *, QDitherInfo *) |
933 | 0 | { |
934 | 0 | for (int i = 0; i < count; ++i) { |
935 | 0 | const uint s = src[index + i]; |
936 | 0 | buffer[i] = QRgba::fromRgba(s, s, s, 255); |
937 | 0 | } |
938 | 0 | return buffer; |
939 | 0 | } Unexecuted instantiation: qpixellayout.cpp:QRgba64 const* fetchGrayscale8To<QRgba64>(QRgba64*, unsigned char const*, int, int, QList<unsigned int> const*, QDitherInfo*) Unexecuted instantiation: qpixellayout.cpp:QRgbaFloat<float> const* fetchGrayscale8To<QRgbaFloat<float> >(QRgbaFloat<float>*, unsigned char const*, int, int, QList<unsigned int> const*, QDitherInfo*) |
940 | | |
941 | | static void QT_FASTCALL convertGrayscale16ToRGB32(uint *buffer, int count, const QList<QRgb> *) |
942 | 0 | { |
943 | 0 | for (int i = 0; i < count; ++i) { |
944 | 0 | const uint x = qt_div_257(buffer[i]); |
945 | 0 | buffer[i] = qRgb(x, x, x); |
946 | 0 | } |
947 | 0 | } |
948 | | static const uint *QT_FASTCALL fetchGrayscale16ToRGB32(uint *buffer, const uchar *src, int index, int count, |
949 | | const QList<QRgb> *, QDitherInfo *) |
950 | 0 | { |
951 | 0 | const unsigned short *s = reinterpret_cast<const unsigned short *>(src) + index; |
952 | 0 | for (int i = 0; i < count; ++i) { |
953 | 0 | const uint x = qt_div_257(s[i]); |
954 | 0 | buffer[i] = qRgb(x, x, x); |
955 | 0 | } |
956 | 0 | return buffer; |
957 | 0 | } |
958 | | |
959 | | template<typename QRgba> |
960 | | static const QRgba *QT_FASTCALL convertGrayscale16To(QRgba *buffer, const uint *src, int count, |
961 | | const QList<QRgb> *, QDitherInfo *) |
962 | 0 | { |
963 | 0 | for (int i = 0; i < count; ++i) |
964 | 0 | buffer[i] = QRgba::fromRgba64(src[i], src[i], src[i], 65535); |
965 | 0 | return buffer; |
966 | 0 | } Unexecuted instantiation: qpixellayout.cpp:QRgba64 const* convertGrayscale16To<QRgba64>(QRgba64*, unsigned int const*, int, QList<unsigned int> const*, QDitherInfo*) Unexecuted instantiation: qpixellayout.cpp:QRgbaFloat<float> const* convertGrayscale16To<QRgbaFloat<float> >(QRgbaFloat<float>*, unsigned int const*, int, QList<unsigned int> const*, QDitherInfo*) |
967 | | |
968 | | template<typename QRgba> |
969 | | static const QRgba *QT_FASTCALL fetchGrayscale16To(QRgba *buffer, const uchar *src, int index, int count, |
970 | | const QList<QRgb> *, QDitherInfo *) |
971 | 0 | { |
972 | 0 | const unsigned short *s = reinterpret_cast<const unsigned short *>(src) + index; |
973 | 0 | for (int i = 0; i < count; ++i) { |
974 | 0 | buffer[i] = QRgba::fromRgba64(s[i], s[i], s[i], 65535); |
975 | 0 | } |
976 | 0 | return buffer; |
977 | 0 | } Unexecuted instantiation: qpixellayout.cpp:QRgba64 const* fetchGrayscale16To<QRgba64>(QRgba64*, unsigned char const*, int, int, QList<unsigned int> const*, QDitherInfo*) Unexecuted instantiation: qpixellayout.cpp:QRgbaFloat<float> const* fetchGrayscale16To<QRgbaFloat<float> >(QRgbaFloat<float>*, unsigned char const*, int, int, QList<unsigned int> const*, QDitherInfo*) |
978 | | |
979 | | static void QT_FASTCALL storeARGB32FromARGB32PM(uchar *dest, const uint *src, int index, int count, |
980 | | const QList<QRgb> *, QDitherInfo *) |
981 | 0 | { |
982 | 0 | uint *d = reinterpret_cast<uint *>(dest) + index; |
983 | 0 | UNALIASED_CONVERSION_LOOP(d, src, count, [](uint c) { return qUnpremultiply(c); }); |
984 | 0 | } |
985 | | |
986 | | static void QT_FASTCALL storeRGBA8888PMFromARGB32PM(uchar *dest, const uint *src, int index, int count, |
987 | | const QList<QRgb> *, QDitherInfo *) |
988 | 0 | { |
989 | 0 | uint *d = reinterpret_cast<uint *>(dest) + index; |
990 | 0 | UNALIASED_CONVERSION_LOOP(d, src, count, ARGB2RGBA); |
991 | 0 | } |
992 | | |
993 | | #ifdef __SSE2__ |
994 | | template<bool RGBA, bool maskAlpha> |
995 | | static inline void qConvertARGB32PMToRGBA64PM_sse2(QRgba64 *buffer, const uint *src, int count) |
996 | 0 | { |
997 | 0 | if (count <= 0) |
998 | 0 | return; |
999 | | |
1000 | 0 | const __m128i amask = _mm_set1_epi32(0xff000000); |
1001 | 0 | int i = 0; |
1002 | 0 | for (; ((uintptr_t)buffer & 0xf) && i < count; ++i) { |
1003 | 0 | uint s = *src++; |
1004 | 0 | if (maskAlpha) |
1005 | 0 | s = s | 0xff000000; |
1006 | 0 | if (RGBA) |
1007 | 0 | s = RGBA2ARGB(s); |
1008 | 0 | *buffer++ = QRgba64::fromArgb32(s); |
1009 | 0 | } |
1010 | 0 | for (; i < count-3; i += 4) { |
1011 | 0 | __m128i vs = _mm_loadu_si128((const __m128i*)src); |
1012 | 0 | if (maskAlpha) |
1013 | 0 | vs = _mm_or_si128(vs, amask); |
1014 | 0 | src += 4; |
1015 | 0 | __m128i v1 = _mm_unpacklo_epi8(vs, vs); |
1016 | 0 | __m128i v2 = _mm_unpackhi_epi8(vs, vs); |
1017 | 0 | if (!RGBA) { |
1018 | 0 | v1 = _mm_shufflelo_epi16(v1, _MM_SHUFFLE(3, 0, 1, 2)); |
1019 | 0 | v2 = _mm_shufflelo_epi16(v2, _MM_SHUFFLE(3, 0, 1, 2)); |
1020 | 0 | v1 = _mm_shufflehi_epi16(v1, _MM_SHUFFLE(3, 0, 1, 2)); |
1021 | 0 | v2 = _mm_shufflehi_epi16(v2, _MM_SHUFFLE(3, 0, 1, 2)); |
1022 | 0 | } |
1023 | 0 | _mm_store_si128((__m128i*)(buffer), v1); |
1024 | 0 | buffer += 2; |
1025 | 0 | _mm_store_si128((__m128i*)(buffer), v2); |
1026 | 0 | buffer += 2; |
1027 | 0 | } |
1028 | |
|
1029 | 0 | SIMD_EPILOGUE(i, count, 3) { |
1030 | 0 | uint s = *src++; |
1031 | 0 | if (maskAlpha) |
1032 | 0 | s = s | 0xff000000; |
1033 | 0 | if (RGBA) |
1034 | 0 | s = RGBA2ARGB(s); |
1035 | 0 | *buffer++ = QRgba64::fromArgb32(s); |
1036 | 0 | } |
1037 | 0 | } Unexecuted instantiation: qpixellayout.cpp:void qConvertARGB32PMToRGBA64PM_sse2<false, true>(QRgba64*, unsigned int const*, int) Unexecuted instantiation: qpixellayout.cpp:void qConvertARGB32PMToRGBA64PM_sse2<false, false>(QRgba64*, unsigned int const*, int) Unexecuted instantiation: qpixellayout.cpp:void qConvertARGB32PMToRGBA64PM_sse2<true, false>(QRgba64*, unsigned int const*, int) |
1038 | | |
1039 | | template<QtPixelOrder PixelOrder> |
1040 | | static inline void qConvertRGBA64PMToA2RGB30PM_sse2(uint *dest, const QRgba64 *buffer, int count) |
1041 | 0 | { |
1042 | 0 | const __m128i gmask = _mm_set1_epi32(0x000ffc00); |
1043 | 0 | const __m128i cmask = _mm_set1_epi32(0x000003ff); |
1044 | 0 | int i = 0; |
1045 | 0 | __m128i vr, vg, vb, va; |
1046 | 0 | for (; i < count && uintptr_t(buffer) & 0xF; ++i) { |
1047 | 0 | *dest++ = qConvertRgb64ToRgb30<PixelOrder>(*buffer++); |
1048 | 0 | } |
1049 | |
|
1050 | 0 | for (; i < count-15; i += 16) { |
1051 | | // Repremultiplying is really expensive and hard to do in SIMD without AVX2, |
1052 | | // so we try to avoid it by checking if it is needed 16 samples at a time. |
1053 | 0 | __m128i vOr = _mm_set1_epi32(0); |
1054 | 0 | __m128i vAnd = _mm_set1_epi32(0xffffffff); |
1055 | 0 | for (int j = 0; j < 16; j += 2) { |
1056 | 0 | __m128i vs = _mm_load_si128((const __m128i*)(buffer + j)); |
1057 | 0 | vOr = _mm_or_si128(vOr, vs); |
1058 | 0 | vAnd = _mm_and_si128(vAnd, vs); |
1059 | 0 | } |
1060 | 0 | const quint16 orAlpha = ((uint)_mm_extract_epi16(vOr, 3)) | ((uint)_mm_extract_epi16(vOr, 7)); |
1061 | 0 | const quint16 andAlpha = ((uint)_mm_extract_epi16(vAnd, 3)) & ((uint)_mm_extract_epi16(vAnd, 7)); |
1062 | |
|
1063 | 0 | if (andAlpha == 0xffff) { |
1064 | 0 | for (int j = 0; j < 16; j += 2) { |
1065 | 0 | __m128i vs = _mm_load_si128((const __m128i*)buffer); |
1066 | 0 | buffer += 2; |
1067 | 0 | vr = _mm_srli_epi64(vs, 6); |
1068 | 0 | vg = _mm_srli_epi64(vs, 16 + 6 - 10); |
1069 | 0 | vb = _mm_srli_epi64(vs, 32 + 6); |
1070 | 0 | vr = _mm_and_si128(vr, cmask); |
1071 | 0 | vg = _mm_and_si128(vg, gmask); |
1072 | 0 | vb = _mm_and_si128(vb, cmask); |
1073 | 0 | va = _mm_srli_epi64(vs, 48 + 14); |
1074 | 0 | if (PixelOrder == PixelOrderRGB) |
1075 | 0 | vr = _mm_slli_epi32(vr, 20); |
1076 | 0 | else |
1077 | 0 | vb = _mm_slli_epi32(vb, 20); |
1078 | 0 | va = _mm_slli_epi32(va, 30); |
1079 | 0 | __m128i vd = _mm_or_si128(_mm_or_si128(vr, vg), _mm_or_si128(vb, va)); |
1080 | 0 | vd = _mm_shuffle_epi32(vd, _MM_SHUFFLE(3, 1, 2, 0)); |
1081 | 0 | _mm_storel_epi64((__m128i*)dest, vd); |
1082 | 0 | dest += 2; |
1083 | 0 | } |
1084 | 0 | } else if (orAlpha == 0) { |
1085 | 0 | for (int j = 0; j < 16; ++j) { |
1086 | 0 | *dest++ = 0; |
1087 | 0 | buffer++; |
1088 | 0 | } |
1089 | 0 | } else { |
1090 | 0 | for (int j = 0; j < 16; ++j) |
1091 | 0 | *dest++ = qConvertRgb64ToRgb30<PixelOrder>(*buffer++); |
1092 | 0 | } |
1093 | 0 | } |
1094 | |
|
1095 | 0 | SIMD_EPILOGUE(i, count, 15) |
1096 | 0 | *dest++ = qConvertRgb64ToRgb30<PixelOrder>(*buffer++); |
1097 | 0 | } Unexecuted instantiation: qpixellayout.cpp:void qConvertRGBA64PMToA2RGB30PM_sse2<(QtPixelOrder)1>(unsigned int*, QRgba64 const*, int) Unexecuted instantiation: qpixellayout.cpp:void qConvertRGBA64PMToA2RGB30PM_sse2<(QtPixelOrder)0>(unsigned int*, QRgba64 const*, int) |
1098 | | #elif defined(__ARM_NEON__) |
1099 | | template<bool RGBA, bool maskAlpha> |
1100 | | static inline void qConvertARGB32PMToRGBA64PM_neon(QRgba64 *buffer, const uint *src, int count) |
1101 | | { |
1102 | | if (count <= 0) |
1103 | | return; |
1104 | | |
1105 | | const uint32x4_t amask = vdupq_n_u32(0xff000000); |
1106 | | #if defined(Q_PROCESSOR_ARM_64) |
1107 | | const uint8x16_t rgbaMask = qvsetq_n_u8(2, 1, 0, 3, 6, 5, 4, 7, 10, 9, 8, 11, 14, 13, 12, 15); |
1108 | | #else |
1109 | | const uint8x8_t rgbaMask = qvset_n_u8(2, 1, 0, 3, 6, 5, 4, 7); |
1110 | | #endif |
1111 | | int i = 0; |
1112 | | for (; i < count-3; i += 4) { |
1113 | | uint32x4_t vs32 = vld1q_u32(src); |
1114 | | src += 4; |
1115 | | if (maskAlpha) |
1116 | | vs32 = vorrq_u32(vs32, amask); |
1117 | | uint8x16_t vs8 = vreinterpretq_u8_u32(vs32); |
1118 | | if (!RGBA) { |
1119 | | #if defined(Q_PROCESSOR_ARM_64) |
1120 | | vs8 = vqtbl1q_u8(vs8, rgbaMask); |
1121 | | #else |
1122 | | // no vqtbl1q_u8 |
1123 | | const uint8x8_t vlo = vtbl1_u8(vget_low_u8(vs8), rgbaMask); |
1124 | | const uint8x8_t vhi = vtbl1_u8(vget_high_u8(vs8), rgbaMask); |
1125 | | vs8 = vcombine_u8(vlo, vhi); |
1126 | | #endif |
1127 | | } |
1128 | | uint8x16x2_t v = vzipq_u8(vs8, vs8); |
1129 | | |
1130 | | vst1q_u16((uint16_t *)buffer, vreinterpretq_u16_u8(v.val[0])); |
1131 | | buffer += 2; |
1132 | | vst1q_u16((uint16_t *)buffer, vreinterpretq_u16_u8(v.val[1])); |
1133 | | buffer += 2; |
1134 | | } |
1135 | | |
1136 | | SIMD_EPILOGUE(i, count, 3) { |
1137 | | uint s = *src++; |
1138 | | if (maskAlpha) |
1139 | | s = s | 0xff000000; |
1140 | | if (RGBA) |
1141 | | s = RGBA2ARGB(s); |
1142 | | *buffer++ = QRgba64::fromArgb32(s); |
1143 | | } |
1144 | | } |
1145 | | #elif defined __loongarch_sx |
1146 | | template<bool RGBA, bool maskAlpha> |
1147 | | static inline void qConvertARGB32PMToRGBA64PM_lsx(QRgba64 *buffer, const uint *src, int count) |
1148 | | { |
1149 | | if (count <= 0) |
1150 | | return; |
1151 | | |
1152 | | const __m128i amask = __lsx_vreplgr2vr_w(0xff000000); |
1153 | | const __m128i shuffleMask = (__m128i)(v8i16){2, 1, 0, 3, 6, 5, 4, 7}; |
1154 | | int i = 0; |
1155 | | for (; ((uintptr_t)buffer & 0xf) && i < count; ++i) { |
1156 | | uint s = *src++; |
1157 | | if (maskAlpha) |
1158 | | s = s | 0xff000000; |
1159 | | if (RGBA) |
1160 | | s = RGBA2ARGB(s); |
1161 | | *buffer++ = QRgba64::fromArgb32(s); |
1162 | | } |
1163 | | for (; i < count-3; i += 4) { |
1164 | | __m128i vs = __lsx_vld((const __m128i*)src, 0); |
1165 | | if (maskAlpha) |
1166 | | vs = __lsx_vor_v(vs, amask); |
1167 | | src += 4; |
1168 | | __m128i v1 = __lsx_vilvl_b(vs, vs); |
1169 | | __m128i v2 = __lsx_vilvh_b(vs, vs); |
1170 | | if (!RGBA) { |
1171 | | v1 = __lsx_vshuf_h(shuffleMask, v1, v1); |
1172 | | v2 = __lsx_vshuf_h(shuffleMask, v2, v2); |
1173 | | } |
1174 | | __lsx_vst(v1, buffer, 0); |
1175 | | buffer += 2; |
1176 | | __lsx_vst(v2, buffer, 0); |
1177 | | buffer += 2; |
1178 | | } |
1179 | | |
1180 | | SIMD_EPILOGUE(i, count, 3) { |
1181 | | uint s = *src++; |
1182 | | if (maskAlpha) |
1183 | | s = s | 0xff000000; |
1184 | | if (RGBA) |
1185 | | s = RGBA2ARGB(s); |
1186 | | *buffer++ = QRgba64::fromArgb32(s); |
1187 | | } |
1188 | | } |
1189 | | |
1190 | | template<QtPixelOrder PixelOrder> |
1191 | | static inline void qConvertRGBA64PMToA2RGB30PM_lsx(uint *dest, const QRgba64 *buffer, int count) |
1192 | | { |
1193 | | const __m128i gmask = __lsx_vreplgr2vr_w(0x000ffc00); |
1194 | | const __m128i cmask = __lsx_vreplgr2vr_w(0x000003ff); |
1195 | | int i = 0; |
1196 | | __m128i vr, vg, vb, va; |
1197 | | for (; i < count && uintptr_t(buffer) & 0xF; ++i) { |
1198 | | *dest++ = qConvertRgb64ToRgb30<PixelOrder>(*buffer++); |
1199 | | } |
1200 | | |
1201 | | for (; i < count-15; i += 16) { |
1202 | | __m128i vOr = __lsx_vreplgr2vr_w(0); |
1203 | | __m128i vAnd = __lsx_vreplgr2vr_w(0xffffffff); |
1204 | | for (int j = 0; j < 16; j += 2) { |
1205 | | __m128i vs = __lsx_vld((const __m128i*)(buffer + j), 0); |
1206 | | vOr = __lsx_vor_v(vOr, vs); |
1207 | | vAnd = __lsx_vand_v(vAnd, vs); |
1208 | | } |
1209 | | const quint16 orAlpha = ((uint)__lsx_vpickve2gr_h(vOr, 3)) | ((uint)__lsx_vpickve2gr_h(vOr, 7)); |
1210 | | const quint16 andAlpha = ((uint)__lsx_vpickve2gr_h(vAnd, 3)) & ((uint)__lsx_vpickve2gr_h(vAnd, 7)); |
1211 | | |
1212 | | if (andAlpha == 0xffff) { |
1213 | | for (int j = 0; j < 16; j += 2) { |
1214 | | __m128i vs = __lsx_vld((const __m128i*)buffer, 0); |
1215 | | buffer += 2; |
1216 | | vr = __lsx_vsrli_d(vs, 6); |
1217 | | vg = __lsx_vsrli_d(vs, 16 + 6 - 10); |
1218 | | vb = __lsx_vsrli_d(vs, 32 + 6); |
1219 | | vr = __lsx_vand_v(vr, cmask); |
1220 | | vg = __lsx_vand_v(vg, gmask); |
1221 | | vb = __lsx_vand_v(vb, cmask); |
1222 | | va = __lsx_vsrli_d(vs, 48 + 14); |
1223 | | if (PixelOrder == PixelOrderRGB) |
1224 | | vr = __lsx_vslli_w(vr, 20); |
1225 | | else |
1226 | | vb = __lsx_vslli_w(vb, 20); |
1227 | | va = __lsx_vslli_w(va, 30); |
1228 | | __m128i vd = __lsx_vor_v(__lsx_vor_v(vr, vg), __lsx_vor_v(vb, va)); |
1229 | | vd = __lsx_vshuf4i_w(vd, 0b11011000); |
1230 | | __lsx_vstelm_d(vd, dest, 0, 0); |
1231 | | dest += 2; |
1232 | | } |
1233 | | } else if (orAlpha == 0) { |
1234 | | for (int j = 0; j < 16; ++j) { |
1235 | | *dest++ = 0; |
1236 | | buffer++; |
1237 | | } |
1238 | | } else { |
1239 | | for (int j = 0; j < 16; ++j) |
1240 | | *dest++ = qConvertRgb64ToRgb30<PixelOrder>(*buffer++); |
1241 | | } |
1242 | | } |
1243 | | |
1244 | | SIMD_EPILOGUE(i, count, 15) |
1245 | | *dest++ = qConvertRgb64ToRgb30<PixelOrder>(*buffer++); |
1246 | | } |
1247 | | #endif |
1248 | | |
1249 | | static const QRgba64 *QT_FASTCALL convertRGB32ToRGB64(QRgba64 *buffer, const uint *src, int count, |
1250 | | const QList<QRgb> *, QDitherInfo *) |
1251 | 0 | { |
1252 | 0 | #ifdef __SSE2__ |
1253 | 0 | qConvertARGB32PMToRGBA64PM_sse2<false, true>(buffer, src, count); |
1254 | | #elif defined(__ARM_NEON__) |
1255 | | qConvertARGB32PMToRGBA64PM_neon<false, true>(buffer, src, count); |
1256 | | #elif defined(__loongarch_sx) |
1257 | | qConvertARGB32PMToRGBA64PM_lsx<false, true>(buffer, src, count); |
1258 | | #else |
1259 | | for (int i = 0; i < count; ++i) |
1260 | | buffer[i] = QRgba64::fromArgb32(0xff000000 | src[i]); |
1261 | | #endif |
1262 | 0 | return buffer; |
1263 | 0 | } |
1264 | | |
1265 | | static const QRgba64 *QT_FASTCALL fetchRGB32ToRGB64(QRgba64 *buffer, const uchar *src, int index, int count, |
1266 | | const QList<QRgb> *, QDitherInfo *) |
1267 | 0 | { |
1268 | 0 | return convertRGB32ToRGB64(buffer, reinterpret_cast<const uint *>(src) + index, count, nullptr, nullptr); |
1269 | 0 | } |
1270 | | |
1271 | | static const QRgba64 *QT_FASTCALL convertARGB32ToRGBA64PM(QRgba64 *buffer, const uint *src, int count, |
1272 | | const QList<QRgb> *, QDitherInfo *) |
1273 | 0 | { |
1274 | 0 | for (int i = 0; i < count; ++i) |
1275 | 0 | buffer[i] = QRgba64::fromArgb32(src[i]).premultiplied(); |
1276 | 0 | return buffer; |
1277 | 0 | } |
1278 | | |
1279 | | static const QRgba64 *QT_FASTCALL fetchARGB32ToRGBA64PM(QRgba64 *buffer, const uchar *src, int index, int count, |
1280 | | const QList<QRgb> *, QDitherInfo *) |
1281 | 0 | { |
1282 | 0 | return convertARGB32ToRGBA64PM(buffer, reinterpret_cast<const uint *>(src) + index, count, nullptr, nullptr); |
1283 | 0 | } |
1284 | | |
1285 | | static const QRgba64 *QT_FASTCALL convertARGB32PMToRGBA64PM(QRgba64 *buffer, const uint *src, int count, |
1286 | | const QList<QRgb> *, QDitherInfo *) |
1287 | 0 | { |
1288 | 0 | #ifdef __SSE2__ |
1289 | 0 | qConvertARGB32PMToRGBA64PM_sse2<false, false>(buffer, src, count); |
1290 | | #elif defined(__ARM_NEON__) |
1291 | | qConvertARGB32PMToRGBA64PM_neon<false, false>(buffer, src, count); |
1292 | | #elif defined(__loongarch_sx) |
1293 | | qConvertARGB32PMToRGBA64PM_lsx<false, false>(buffer, src, count); |
1294 | | #else |
1295 | | for (int i = 0; i < count; ++i) |
1296 | | buffer[i] = QRgba64::fromArgb32(src[i]); |
1297 | | #endif |
1298 | 0 | return buffer; |
1299 | 0 | } |
1300 | | |
1301 | | static const QRgba64 *QT_FASTCALL fetchARGB32PMToRGBA64PM(QRgba64 *buffer, const uchar *src, int index, int count, |
1302 | | const QList<QRgb> *, QDitherInfo *) |
1303 | 0 | { |
1304 | 0 | return convertARGB32PMToRGBA64PM(buffer, reinterpret_cast<const uint *>(src) + index, count, nullptr, nullptr); |
1305 | 0 | } |
1306 | | |
1307 | | static const QRgba64 *QT_FASTCALL fetchRGBA64ToRGBA64PM(QRgba64 *buffer, const uchar *src, int index, int count, |
1308 | | const QList<QRgb> *, QDitherInfo *) |
1309 | 0 | { |
1310 | 0 | const QRgba64 *s = reinterpret_cast<const QRgba64 *>(src) + index; |
1311 | 0 | #ifdef __SSE2__ |
1312 | 0 | for (int i = 0; i < count; ++i) { |
1313 | 0 | const auto a = s[i].alpha(); |
1314 | 0 | __m128i vs = _mm_loadl_epi64((const __m128i *)(s + i)); |
1315 | 0 | __m128i va = _mm_shufflelo_epi16(vs, _MM_SHUFFLE(3, 3, 3, 3)); |
1316 | 0 | vs = multiplyAlpha65535(vs, va); |
1317 | 0 | _mm_storel_epi64((__m128i *)(buffer + i), vs); |
1318 | 0 | buffer[i].setAlpha(a); |
1319 | 0 | } |
1320 | | #else |
1321 | | for (int i = 0; i < count; ++i) |
1322 | | buffer[i] = QRgba64::fromRgba64(s[i]).premultiplied(); |
1323 | | #endif |
1324 | 0 | return buffer; |
1325 | 0 | } |
1326 | | |
1327 | | static const QRgba64 *QT_FASTCALL convertRGBA8888ToRGBA64PM(QRgba64 *buffer, const uint *src, int count, |
1328 | | const QList<QRgb> *, QDitherInfo *) |
1329 | 0 | { |
1330 | 0 | for (int i = 0; i < count; ++i) |
1331 | 0 | buffer[i] = QRgba64::fromArgb32(RGBA2ARGB(src[i])).premultiplied(); |
1332 | 0 | return buffer; |
1333 | 0 | } |
1334 | | |
1335 | | static const QRgba64 *QT_FASTCALL fetchRGBA8888ToRGBA64PM(QRgba64 *buffer, const uchar *src, int index, int count, |
1336 | | const QList<QRgb> *, QDitherInfo *) |
1337 | 0 | { |
1338 | 0 | return convertRGBA8888ToRGBA64PM(buffer, reinterpret_cast<const uint *>(src) + index, count, nullptr, nullptr); |
1339 | 0 | } |
1340 | | |
1341 | | static const QRgba64 *QT_FASTCALL convertRGBA8888PMToRGBA64PM(QRgba64 *buffer, const uint *src, int count, |
1342 | | const QList<QRgb> *, QDitherInfo *) |
1343 | 0 | { |
1344 | 0 | #ifdef __SSE2__ |
1345 | 0 | qConvertARGB32PMToRGBA64PM_sse2<true, false>(buffer, src, count); |
1346 | | #elif defined(__ARM_NEON__) |
1347 | | qConvertARGB32PMToRGBA64PM_neon<true, false>(buffer, src, count); |
1348 | | #elif defined(__loongarch_sx) |
1349 | | qConvertARGB32PMToRGBA64PM_lsx<true, false>(buffer, src, count); |
1350 | | #else |
1351 | | for (int i = 0; i < count; ++i) |
1352 | | buffer[i] = QRgba64::fromArgb32(RGBA2ARGB(src[i])); |
1353 | | #endif |
1354 | 0 | return buffer; |
1355 | 0 | } |
1356 | | |
1357 | | static const QRgba64 *QT_FASTCALL fetchRGBA8888PMToRGBA64PM(QRgba64 *buffer, const uchar *src, int index, int count, |
1358 | | const QList<QRgb> *, QDitherInfo *) |
1359 | 0 | { |
1360 | 0 | return convertRGBA8888PMToRGBA64PM(buffer, reinterpret_cast<const uint *>(src) + index, count, nullptr, nullptr); |
1361 | 0 | } |
1362 | | |
1363 | | static void QT_FASTCALL storeRGBA8888FromARGB32PM(uchar *dest, const uint *src, int index, int count, |
1364 | | const QList<QRgb> *, QDitherInfo *) |
1365 | 0 | { |
1366 | 0 | uint *d = reinterpret_cast<uint *>(dest) + index; |
1367 | 0 | UNALIASED_CONVERSION_LOOP(d, src, count, [](uint c) { return ARGB2RGBA(qUnpremultiply(c)); }); |
1368 | 0 | } |
1369 | | |
1370 | | static void QT_FASTCALL storeRGBXFromRGB32(uchar *dest, const uint *src, int index, int count, |
1371 | | const QList<QRgb> *, QDitherInfo *) |
1372 | 0 | { |
1373 | 0 | uint *d = reinterpret_cast<uint *>(dest) + index; |
1374 | 0 | UNALIASED_CONVERSION_LOOP(d, src, count, [](uint c) { return ARGB2RGBA(0xff000000 | c); }); |
1375 | 0 | } |
1376 | | |
1377 | | static void QT_FASTCALL storeRGBXFromARGB32PM(uchar *dest, const uint *src, int index, int count, |
1378 | | const QList<QRgb> *, QDitherInfo *) |
1379 | 0 | { |
1380 | 0 | uint *d = reinterpret_cast<uint *>(dest) + index; |
1381 | 0 | UNALIASED_CONVERSION_LOOP(d, src, count, [](uint c) { return ARGB2RGBA(0xff000000 | qUnpremultiply(c)); }); |
1382 | 0 | } |
1383 | | |
1384 | | template<QtPixelOrder PixelOrder> |
1385 | | static void QT_FASTCALL convertA2RGB30PMToARGB32PM(uint *buffer, int count, const QList<QRgb> *) |
1386 | 0 | { |
1387 | 0 | for (int i = 0; i < count; ++i) |
1388 | 0 | buffer[i] = qConvertA2rgb30ToArgb32<PixelOrder>(buffer[i]); |
1389 | 0 | } Unexecuted instantiation: qpixellayout.cpp:void convertA2RGB30PMToARGB32PM<(QtPixelOrder)1>(unsigned int*, int, QList<unsigned int> const*) Unexecuted instantiation: qpixellayout.cpp:void convertA2RGB30PMToARGB32PM<(QtPixelOrder)0>(unsigned int*, int, QList<unsigned int> const*) |
1390 | | |
1391 | | template<QtPixelOrder PixelOrder> |
1392 | | static const uint *QT_FASTCALL fetchA2RGB30PMToARGB32PM(uint *buffer, const uchar *s, int index, int count, |
1393 | | const QList<QRgb> *, QDitherInfo *dither) |
1394 | 0 | { |
1395 | 0 | const uint *src = reinterpret_cast<const uint *>(s) + index; |
1396 | 0 | if (!dither) { |
1397 | 0 | UNALIASED_CONVERSION_LOOP(buffer, src, count, qConvertA2rgb30ToArgb32<PixelOrder>); |
1398 | 0 | } else { |
1399 | 0 | for (int i = 0; i < count; ++i) { |
1400 | 0 | const uint c = src[i]; |
1401 | 0 | short d10 = (qt_bayer_matrix[dither->y & 15][(dither->x + i) & 15] << 2); |
1402 | 0 | short a10 = (c >> 30) * 0x155; |
1403 | 0 | short r10 = ((c >> 20) & 0x3ff); |
1404 | 0 | short g10 = ((c >> 10) & 0x3ff); |
1405 | 0 | short b10 = (c & 0x3ff); |
1406 | 0 | if (PixelOrder == PixelOrderBGR) |
1407 | 0 | std::swap(r10, b10); |
1408 | 0 | short a8 = (a10 + ((d10 - a10) >> 8)) >> 2; |
1409 | 0 | short r8 = (r10 + ((d10 - r10) >> 8)) >> 2; |
1410 | 0 | short g8 = (g10 + ((d10 - g10) >> 8)) >> 2; |
1411 | 0 | short b8 = (b10 + ((d10 - b10) >> 8)) >> 2; |
1412 | 0 | buffer[i] = qRgba(r8, g8, b8, a8); |
1413 | 0 | } |
1414 | 0 | } |
1415 | 0 | return buffer; |
1416 | 0 | } Unexecuted instantiation: qpixellayout.cpp:unsigned int const* fetchA2RGB30PMToARGB32PM<(QtPixelOrder)1>(unsigned int*, unsigned char const*, int, int, QList<unsigned int> const*, QDitherInfo*) Unexecuted instantiation: qpixellayout.cpp:unsigned int const* fetchA2RGB30PMToARGB32PM<(QtPixelOrder)0>(unsigned int*, unsigned char const*, int, int, QList<unsigned int> const*, QDitherInfo*) |
1417 | | |
1418 | | #ifdef __SSE2__ |
1419 | | template<QtPixelOrder PixelOrder> |
1420 | | static inline void qConvertA2RGB30PMToRGBA64PM_sse2(QRgba64 *buffer, const uint *src, int count) |
1421 | 0 | { |
1422 | 0 | if (count <= 0) |
1423 | 0 | return; |
1424 | | |
1425 | 0 | const __m128i rmask = _mm_set1_epi32(0x3ff00000); |
1426 | 0 | const __m128i gmask = _mm_set1_epi32(0x000ffc00); |
1427 | 0 | const __m128i bmask = _mm_set1_epi32(0x000003ff); |
1428 | 0 | const __m128i afactor = _mm_set1_epi16(0x5555); |
1429 | 0 | int i = 0; |
1430 | |
|
1431 | 0 | for (; ((uintptr_t)buffer & 0xf) && i < count; ++i) |
1432 | 0 | *buffer++ = qConvertA2rgb30ToRgb64<PixelOrder>(*src++); |
1433 | |
|
1434 | 0 | for (; i < count-3; i += 4) { |
1435 | 0 | __m128i vs = _mm_loadu_si128((const __m128i*)src); |
1436 | 0 | src += 4; |
1437 | 0 | __m128i va = _mm_srli_epi32(vs, 30); |
1438 | 0 | __m128i vr = _mm_and_si128(vs, rmask); |
1439 | 0 | __m128i vb = _mm_and_si128(vs, bmask); |
1440 | 0 | __m128i vg = _mm_and_si128(vs, gmask); |
1441 | 0 | va = _mm_mullo_epi16(va, afactor); |
1442 | 0 | vr = _mm_or_si128(_mm_srli_epi32(vr, 14), _mm_srli_epi32(vr, 24)); |
1443 | 0 | vg = _mm_or_si128(_mm_srli_epi32(vg, 4), _mm_srli_epi32(vg, 14)); |
1444 | 0 | vb = _mm_or_si128(_mm_slli_epi32(vb, 6), _mm_srli_epi32(vb, 4)); |
1445 | 0 | __m128i vrb; |
1446 | 0 | if (PixelOrder == PixelOrderRGB) |
1447 | 0 | vrb = _mm_or_si128(vr, _mm_slli_si128(vb, 2)); |
1448 | 0 | else |
1449 | 0 | vrb = _mm_or_si128(vb, _mm_slli_si128(vr, 2)); |
1450 | 0 | __m128i vga = _mm_or_si128(vg, _mm_slli_si128(va, 2)); |
1451 | 0 | _mm_store_si128((__m128i*)(buffer), _mm_unpacklo_epi16(vrb, vga)); |
1452 | 0 | buffer += 2; |
1453 | 0 | _mm_store_si128((__m128i*)(buffer), _mm_unpackhi_epi16(vrb, vga)); |
1454 | 0 | buffer += 2; |
1455 | 0 | } |
1456 | |
|
1457 | 0 | SIMD_EPILOGUE(i, count, 3) |
1458 | 0 | *buffer++ = qConvertA2rgb30ToRgb64<PixelOrder>(*src++); |
1459 | 0 | } Unexecuted instantiation: qpixellayout.cpp:void qConvertA2RGB30PMToRGBA64PM_sse2<(QtPixelOrder)1>(QRgba64*, unsigned int const*, int) Unexecuted instantiation: qpixellayout.cpp:void qConvertA2RGB30PMToRGBA64PM_sse2<(QtPixelOrder)0>(QRgba64*, unsigned int const*, int) |
1460 | | #elif defined(__loongarch_sx) |
1461 | | template<QtPixelOrder PixelOrder> |
1462 | | static inline void qConvertA2RGB30PMToRGBA64PM_lsx(QRgba64 *buffer, const uint *src, int count) |
1463 | | { |
1464 | | if (count <= 0) |
1465 | | return; |
1466 | | |
1467 | | const __m128i rmask = __lsx_vreplgr2vr_w(0x3ff00000); |
1468 | | const __m128i gmask = __lsx_vreplgr2vr_w(0x000ffc00); |
1469 | | const __m128i bmask = __lsx_vreplgr2vr_w(0x000003ff); |
1470 | | const __m128i afactor = __lsx_vreplgr2vr_h(0x5555); |
1471 | | int i = 0; |
1472 | | |
1473 | | for (; ((uintptr_t)buffer & 0xf) && i < count; ++i) |
1474 | | *buffer++ = qConvertA2rgb30ToRgb64<PixelOrder>(*src++); |
1475 | | |
1476 | | for (; i < count-3; i += 4) { |
1477 | | __m128i vs = __lsx_vld((const __m128i*)src, 0); |
1478 | | src += 4; |
1479 | | __m128i va = __lsx_vsrli_w(vs, 30); |
1480 | | __m128i vr = __lsx_vand_v(vs, rmask); |
1481 | | __m128i vb = __lsx_vand_v(vs, bmask); |
1482 | | __m128i vg = __lsx_vand_v(vs, gmask); |
1483 | | va = __lsx_vmul_h(va, afactor); |
1484 | | vr = __lsx_vor_v(__lsx_vsrli_w(vr, 14), __lsx_vsrli_w(vr, 24)); |
1485 | | vg = __lsx_vor_v(__lsx_vsrli_w(vg, 4), __lsx_vsrli_w(vg, 14)); |
1486 | | vb = __lsx_vor_v(__lsx_vslli_w(vb, 6), __lsx_vsrli_w(vb, 4)); |
1487 | | __m128i vrb; |
1488 | | if (PixelOrder == PixelOrderRGB) |
1489 | | vrb = __lsx_vor_v(vr, __lsx_vbsll_v(vb, 2)); |
1490 | | else |
1491 | | vrb = __lsx_vor_v(vb, __lsx_vbsll_v(vr, 2)); |
1492 | | __m128i vga = __lsx_vor_v(vg, __lsx_vbsll_v(va, 2)); |
1493 | | __lsx_vst(__lsx_vilvl_h(vga, vrb), buffer, 0); |
1494 | | buffer += 2; |
1495 | | __lsx_vst(__lsx_vilvh_h(vga, vrb), buffer, 0); |
1496 | | buffer += 2; |
1497 | | } |
1498 | | |
1499 | | SIMD_EPILOGUE(i, count, 3) |
1500 | | *buffer++ = qConvertA2rgb30ToRgb64<PixelOrder>(*src++); |
1501 | | } |
1502 | | #endif |
1503 | | |
1504 | | template<QtPixelOrder PixelOrder> |
1505 | | static const QRgba64 *QT_FASTCALL convertA2RGB30PMToRGBA64PM(QRgba64 *buffer, const uint *src, int count, |
1506 | | const QList<QRgb> *, QDitherInfo *) |
1507 | 0 | { |
1508 | 0 | #ifdef __SSE2__ |
1509 | 0 | qConvertA2RGB30PMToRGBA64PM_sse2<PixelOrder>(buffer, src, count); |
1510 | | #elif defined (__loongarch_sx) |
1511 | | qConvertA2RGB30PMToRGBA64PM_lsx<PixelOrder>(buffer, src, count); |
1512 | | #else |
1513 | | for (int i = 0; i < count; ++i) |
1514 | | buffer[i] = qConvertA2rgb30ToRgb64<PixelOrder>(src[i]); |
1515 | | #endif |
1516 | 0 | return buffer; |
1517 | 0 | } Unexecuted instantiation: qpixellayout.cpp:QRgba64 const* convertA2RGB30PMToRGBA64PM<(QtPixelOrder)1>(QRgba64*, unsigned int const*, int, QList<unsigned int> const*, QDitherInfo*) Unexecuted instantiation: qpixellayout.cpp:QRgba64 const* convertA2RGB30PMToRGBA64PM<(QtPixelOrder)0>(QRgba64*, unsigned int const*, int, QList<unsigned int> const*, QDitherInfo*) |
1518 | | |
1519 | | template<QtPixelOrder PixelOrder> |
1520 | | static const QRgba64 *QT_FASTCALL fetchA2RGB30PMToRGBA64PM(QRgba64 *buffer, const uchar *src, int index, int count, |
1521 | | const QList<QRgb> *, QDitherInfo *) |
1522 | 0 | { |
1523 | 0 | return convertA2RGB30PMToRGBA64PM<PixelOrder>(buffer, reinterpret_cast<const uint *>(src) + index, count, nullptr, nullptr); |
1524 | 0 | } Unexecuted instantiation: qpixellayout.cpp:QRgba64 const* fetchA2RGB30PMToRGBA64PM<(QtPixelOrder)1>(QRgba64*, unsigned char const*, int, int, QList<unsigned int> const*, QDitherInfo*) Unexecuted instantiation: qpixellayout.cpp:QRgba64 const* fetchA2RGB30PMToRGBA64PM<(QtPixelOrder)0>(QRgba64*, unsigned char const*, int, int, QList<unsigned int> const*, QDitherInfo*) |
1525 | | |
1526 | | template<enum QtPixelOrder> inline QRgbaFloat32 qConvertA2rgb30ToRgbaFP(uint rgb); |
1527 | | |
1528 | | template<> |
1529 | | inline QRgbaFloat32 qConvertA2rgb30ToRgbaFP<PixelOrderBGR>(uint rgb) |
1530 | 0 | { |
1531 | 0 | float alpha = (rgb >> 30) * (1.f/3.f); |
1532 | 0 | float blue = ((rgb >> 20) & 0x3ff) * (1.f/1023.f); |
1533 | 0 | float green = ((rgb >> 10) & 0x3ff) * (1.f/1023.f); |
1534 | 0 | float red = (rgb & 0x3ff) * (1.f/1023.f); |
1535 | 0 | return QRgbaFloat32{ red, green, blue, alpha }; |
1536 | 0 | } |
1537 | | |
1538 | | template<> |
1539 | | inline QRgbaFloat32 qConvertA2rgb30ToRgbaFP<PixelOrderRGB>(uint rgb) |
1540 | 0 | { |
1541 | 0 | float alpha = (rgb >> 30) * (1.f/3.f); |
1542 | 0 | float red = ((rgb >> 20) & 0x3ff) * (1.f/1023.f); |
1543 | 0 | float green = ((rgb >> 10) & 0x3ff) * (1.f/1023.f); |
1544 | 0 | float blue = (rgb & 0x3ff) * (1.f/1023.f); |
1545 | 0 | return QRgbaFloat32{ red, green, blue, alpha }; |
1546 | 0 | } |
1547 | | |
1548 | | template<QtPixelOrder PixelOrder> |
1549 | | static const QRgbaFloat32 *QT_FASTCALL convertA2RGB30PMToRGBA32F(QRgbaFloat32 *buffer, const uint *src, int count, |
1550 | | const QList<QRgb> *, QDitherInfo *) |
1551 | 0 | { |
1552 | 0 | for (int i = 0; i < count; ++i) |
1553 | 0 | buffer[i] = qConvertA2rgb30ToRgbaFP<PixelOrder>(src[i]); |
1554 | 0 | return buffer; |
1555 | 0 | } Unexecuted instantiation: qpixellayout.cpp:QRgbaFloat<float> const* convertA2RGB30PMToRGBA32F<(QtPixelOrder)1>(QRgbaFloat<float>*, unsigned int const*, int, QList<unsigned int> const*, QDitherInfo*) Unexecuted instantiation: qpixellayout.cpp:QRgbaFloat<float> const* convertA2RGB30PMToRGBA32F<(QtPixelOrder)0>(QRgbaFloat<float>*, unsigned int const*, int, QList<unsigned int> const*, QDitherInfo*) |
1556 | | |
1557 | | template<QtPixelOrder PixelOrder> |
1558 | | static const QRgbaFloat32 *QT_FASTCALL fetchRGB30ToRGBA32F(QRgbaFloat32 *buffer, const uchar *src, int index, int count, |
1559 | | const QList<QRgb> *, QDitherInfo *) |
1560 | 0 | { |
1561 | 0 | return convertA2RGB30PMToRGBA32F<PixelOrder>(buffer, reinterpret_cast<const uint *>(src) + index, count, nullptr, nullptr); |
1562 | 0 | } Unexecuted instantiation: qpixellayout.cpp:QRgbaFloat<float> const* fetchRGB30ToRGBA32F<(QtPixelOrder)1>(QRgbaFloat<float>*, unsigned char const*, int, int, QList<unsigned int> const*, QDitherInfo*) Unexecuted instantiation: qpixellayout.cpp:QRgbaFloat<float> const* fetchRGB30ToRGBA32F<(QtPixelOrder)0>(QRgbaFloat<float>*, unsigned char const*, int, int, QList<unsigned int> const*, QDitherInfo*) |
1563 | | |
1564 | | template<QtPixelOrder PixelOrder> |
1565 | | static void QT_FASTCALL storeA2RGB30PMFromARGB32PM(uchar *dest, const uint *src, int index, int count, |
1566 | | const QList<QRgb> *, QDitherInfo *) |
1567 | 0 | { |
1568 | 0 | uint *d = reinterpret_cast<uint *>(dest) + index; |
1569 | 0 | UNALIASED_CONVERSION_LOOP(d, src, count, qConvertArgb32ToA2rgb30<PixelOrder>); |
1570 | 0 | } Unexecuted instantiation: qpixellayout.cpp:void storeA2RGB30PMFromARGB32PM<(QtPixelOrder)1>(unsigned char*, unsigned int const*, int, int, QList<unsigned int> const*, QDitherInfo*) Unexecuted instantiation: qpixellayout.cpp:void storeA2RGB30PMFromARGB32PM<(QtPixelOrder)0>(unsigned char*, unsigned int const*, int, int, QList<unsigned int> const*, QDitherInfo*) |
1571 | | |
1572 | | template<QtPixelOrder PixelOrder> |
1573 | | static void QT_FASTCALL storeRGB30FromRGB32(uchar *dest, const uint *src, int index, int count, |
1574 | | const QList<QRgb> *, QDitherInfo *) |
1575 | 0 | { |
1576 | 0 | uint *d = reinterpret_cast<uint *>(dest) + index; |
1577 | 0 | UNALIASED_CONVERSION_LOOP(d, src, count, qConvertRgb32ToRgb30<PixelOrder>); |
1578 | 0 | } Unexecuted instantiation: qpixellayout.cpp:void storeRGB30FromRGB32<(QtPixelOrder)1>(unsigned char*, unsigned int const*, int, int, QList<unsigned int> const*, QDitherInfo*) Unexecuted instantiation: qpixellayout.cpp:void storeRGB30FromRGB32<(QtPixelOrder)0>(unsigned char*, unsigned int const*, int, int, QList<unsigned int> const*, QDitherInfo*) |
1579 | | |
1580 | | template<QtPixelOrder PixelOrder> |
1581 | | static void QT_FASTCALL storeRGB30FromARGB32PM(uchar *dest, const uint *src, int index, int count, |
1582 | | const QList<QRgb> *, QDitherInfo *) |
1583 | 0 | { |
1584 | 0 | uint *d = reinterpret_cast<uint *>(dest) + index; |
1585 | 0 | UNALIASED_CONVERSION_LOOP(d, src, count, qConvertRgb32ToRgb30<PixelOrder>); |
1586 | 0 | } Unexecuted instantiation: qpixellayout.cpp:void storeRGB30FromARGB32PM<(QtPixelOrder)1>(unsigned char*, unsigned int const*, int, int, QList<unsigned int> const*, QDitherInfo*) Unexecuted instantiation: qpixellayout.cpp:void storeRGB30FromARGB32PM<(QtPixelOrder)0>(unsigned char*, unsigned int const*, int, int, QList<unsigned int> const*, QDitherInfo*) |
1587 | | |
1588 | | template<bool RGBA> |
1589 | | void qt_convertRGBA64ToARGB32(uint *dst, const QRgba64 *src, int count) |
1590 | 0 | { |
1591 | 0 | int i = 0; |
1592 | 0 | #ifdef __SSE2__ |
1593 | 0 | if (((uintptr_t)dst & 0x7) && count > 0) { |
1594 | 0 | uint s = (*src++).toArgb32(); |
1595 | 0 | if (RGBA) |
1596 | 0 | s = ARGB2RGBA(s); |
1597 | 0 | *dst++ = s; |
1598 | 0 | i++; |
1599 | 0 | } |
1600 | 0 | const __m128i vhalf = _mm_set1_epi32(0x80); |
1601 | 0 | const __m128i vzero = _mm_setzero_si128(); |
1602 | 0 | for (; i < count-1; i += 2) { |
1603 | 0 | __m128i vs = _mm_loadu_si128((const __m128i*)src); |
1604 | 0 | src += 2; |
1605 | 0 | if (!RGBA) { |
1606 | 0 | vs = _mm_shufflelo_epi16(vs, _MM_SHUFFLE(3, 0, 1, 2)); |
1607 | 0 | vs = _mm_shufflehi_epi16(vs, _MM_SHUFFLE(3, 0, 1, 2)); |
1608 | 0 | } |
1609 | 0 | __m128i v1 = _mm_unpacklo_epi16(vs, vzero); |
1610 | 0 | __m128i v2 = _mm_unpackhi_epi16(vs, vzero); |
1611 | 0 | v1 = _mm_add_epi32(v1, vhalf); |
1612 | 0 | v2 = _mm_add_epi32(v2, vhalf); |
1613 | 0 | v1 = _mm_sub_epi32(v1, _mm_srli_epi32(v1, 8)); |
1614 | 0 | v2 = _mm_sub_epi32(v2, _mm_srli_epi32(v2, 8)); |
1615 | 0 | v1 = _mm_srli_epi32(v1, 8); |
1616 | 0 | v2 = _mm_srli_epi32(v2, 8); |
1617 | 0 | v1 = _mm_packs_epi32(v1, v2); |
1618 | 0 | v1 = _mm_packus_epi16(v1, vzero); |
1619 | 0 | _mm_storel_epi64((__m128i*)(dst), v1); |
1620 | 0 | dst += 2; |
1621 | 0 | } |
1622 | | #elif defined(__loongarch_sx) |
1623 | | if (((uintptr_t)dst & 0x7) && count > 0) { |
1624 | | uint s = (*src++).toArgb32(); |
1625 | | if (RGBA) |
1626 | | s = ARGB2RGBA(s); |
1627 | | *dst++ = s; |
1628 | | i++; |
1629 | | } |
1630 | | const __m128i vhalf = __lsx_vreplgr2vr_w(0x80); |
1631 | | const __m128i vzero = __lsx_vldi(0); |
1632 | | const __m128i shuffleMask = (__m128i)(v8i16){2, 1, 0, 3, 6, 5, 4, 7}; |
1633 | | for (; i < count-1; i += 2) { |
1634 | | __m128i vs = __lsx_vld((const __m128i*)src, 0); |
1635 | | src += 2; |
1636 | | if (!RGBA) { |
1637 | | vs = __lsx_vshuf_h(shuffleMask, vzero, vs); |
1638 | | } |
1639 | | __m128i v1 = __lsx_vilvl_h(vzero, vs); |
1640 | | __m128i v2 = __lsx_vilvh_h(vzero, vs); |
1641 | | v1 = __lsx_vadd_w(v1, vhalf); |
1642 | | v2 = __lsx_vadd_w(v2, vhalf); |
1643 | | v1 = __lsx_vsub_w(v1, __lsx_vsrli_w(v1, 8)); |
1644 | | v2 = __lsx_vsub_w(v2, __lsx_vsrli_w(v2, 8)); |
1645 | | v1 = __lsx_vsrli_w(v1, 8); |
1646 | | v2 = __lsx_vsrli_w(v2, 8); |
1647 | | v1 = __lsx_vpickev_h(__lsx_vsat_w(v2, 15), __lsx_vsat_w(v1, 15)); |
1648 | | v1 = __lsx_vmaxi_h(v1, 0); |
1649 | | v1 = __lsx_vpickev_b(vzero, __lsx_vsat_hu(v1, 7)); |
1650 | | __lsx_vstelm_d(v1, dst, 0, 0); |
1651 | | dst += 2; |
1652 | | } |
1653 | | #endif |
1654 | 0 | for (; i < count; i++) { |
1655 | 0 | uint s = (*src++).toArgb32(); |
1656 | 0 | if (RGBA) |
1657 | 0 | s = ARGB2RGBA(s); |
1658 | 0 | *dst++ = s; |
1659 | 0 | } |
1660 | 0 | } Unexecuted instantiation: void qt_convertRGBA64ToARGB32<false>(unsigned int*, QRgba64 const*, int) Unexecuted instantiation: void qt_convertRGBA64ToARGB32<true>(unsigned int*, QRgba64 const*, int) |
1661 | | template void qt_convertRGBA64ToARGB32<false>(uint *dst, const QRgba64 *src, int count); |
1662 | | template void qt_convertRGBA64ToARGB32<true>(uint *dst, const QRgba64 *src, int count); |
1663 | | |
1664 | | |
1665 | | static void QT_FASTCALL storeAlpha8FromARGB32PM(uchar *dest, const uint *src, int index, int count, |
1666 | | const QList<QRgb> *, QDitherInfo *) |
1667 | 0 | { |
1668 | 0 | for (int i = 0; i < count; ++i) |
1669 | 0 | dest[index + i] = qAlpha(src[i]); |
1670 | 0 | } |
1671 | | |
1672 | | static void QT_FASTCALL storeGrayscale8FromRGB32(uchar *dest, const uint *src, int index, int count, |
1673 | | const QList<QRgb> *, QDitherInfo *) |
1674 | 0 | { |
1675 | 0 | for (int i = 0; i < count; ++i) |
1676 | 0 | dest[index + i] = qGray(src[i]); |
1677 | 0 | } |
1678 | | |
1679 | | static void QT_FASTCALL storeGrayscale8FromARGB32PM(uchar *dest, const uint *src, int index, int count, |
1680 | | const QList<QRgb> *, QDitherInfo *) |
1681 | 0 | { |
1682 | 0 | for (int i = 0; i < count; ++i) |
1683 | 0 | dest[index + i] = qGray(qUnpremultiply(src[i])); |
1684 | 0 | } |
1685 | | |
1686 | | static void QT_FASTCALL storeGrayscale16FromRGB32(uchar *dest, const uint *src, int index, int count, |
1687 | | const QList<QRgb> *, QDitherInfo *) |
1688 | 0 | { |
1689 | 0 | unsigned short *d = reinterpret_cast<unsigned short *>(dest) + index; |
1690 | 0 | for (int i = 0; i < count; ++i) |
1691 | 0 | d[i] = qGray(src[i]) * 257; |
1692 | 0 | } |
1693 | | |
1694 | | static void QT_FASTCALL storeGrayscale16FromARGB32PM(uchar *dest, const uint *src, int index, int count, |
1695 | | const QList<QRgb> *, QDitherInfo *) |
1696 | 0 | { |
1697 | 0 | unsigned short *d = reinterpret_cast<unsigned short *>(dest) + index; |
1698 | 0 | for (int i = 0; i < count; ++i) |
1699 | 0 | d[i] = qGray(qUnpremultiply(src[i])) * 257; |
1700 | 0 | } |
1701 | | |
1702 | | static const uint *QT_FASTCALL fetchRGB64ToRGB32(uint *buffer, const uchar *src, int index, int count, |
1703 | | const QList<QRgb> *, QDitherInfo *) |
1704 | 0 | { |
1705 | 0 | const QRgba64 *s = reinterpret_cast<const QRgba64 *>(src) + index; |
1706 | 0 | for (int i = 0; i < count; ++i) |
1707 | 0 | buffer[i] = toArgb32(s[i]); |
1708 | 0 | return buffer; |
1709 | 0 | } |
1710 | | |
1711 | | static void QT_FASTCALL storeRGB64FromRGB32(uchar *dest, const uint *src, int index, int count, |
1712 | | const QList<QRgb> *, QDitherInfo *) |
1713 | 0 | { |
1714 | 0 | QRgba64 *d = reinterpret_cast<QRgba64 *>(dest) + index; |
1715 | 0 | for (int i = 0; i < count; ++i) |
1716 | 0 | d[i] = QRgba64::fromArgb32(src[i] | 0xff000000); |
1717 | 0 | } |
1718 | | |
1719 | | static const uint *QT_FASTCALL fetchRGBA64ToARGB32PM(uint *buffer, const uchar *src, int index, int count, |
1720 | | const QList<QRgb> *, QDitherInfo *) |
1721 | 0 | { |
1722 | 0 | const QRgba64 *s = reinterpret_cast<const QRgba64 *>(src) + index; |
1723 | 0 | for (int i = 0; i < count; ++i) |
1724 | 0 | buffer[i] = toArgb32(s[i].premultiplied()); |
1725 | 0 | return buffer; |
1726 | 0 | } |
1727 | | |
1728 | | template<bool Mask> |
1729 | | static void QT_FASTCALL storeRGBA64FromARGB32PM(uchar *dest, const uint *src, int index, int count, |
1730 | | const QList<QRgb> *, QDitherInfo *) |
1731 | 0 | { |
1732 | 0 | QRgba64 *d = reinterpret_cast<QRgba64 *>(dest) + index; |
1733 | 0 | for (int i = 0; i < count; ++i) { |
1734 | 0 | d[i] = QRgba64::fromArgb32(src[i]).unpremultiplied(); |
1735 | 0 | if (Mask) |
1736 | 0 | d[i].setAlpha(65535); |
1737 | 0 | } |
1738 | 0 | } Unexecuted instantiation: qpixellayout.cpp:void storeRGBA64FromARGB32PM<true>(unsigned char*, unsigned int const*, int, int, QList<unsigned int> const*, QDitherInfo*) Unexecuted instantiation: qpixellayout.cpp:void storeRGBA64FromARGB32PM<false>(unsigned char*, unsigned int const*, int, int, QList<unsigned int> const*, QDitherInfo*) |
1739 | | |
1740 | | static void QT_FASTCALL storeRGBA64FromARGB32(uchar *dest, const uint *src, int index, int count, |
1741 | | const QList<QRgb> *, QDitherInfo *) |
1742 | 0 | { |
1743 | 0 | QRgba64 *d = reinterpret_cast<QRgba64 *>(dest) + index; |
1744 | 0 | for (int i = 0; i < count; ++i) |
1745 | 0 | d[i] = QRgba64::fromArgb32(src[i]); |
1746 | 0 | } |
1747 | | |
1748 | | static const uint *QT_FASTCALL fetchRGB16FToRGB32(uint *buffer, const uchar *src, int index, int count, |
1749 | | const QList<QRgb> *, QDitherInfo *) |
1750 | 0 | { |
1751 | 0 | const QRgbaFloat16 *s = reinterpret_cast<const QRgbaFloat16 *>(src) + index; |
1752 | 0 | for (int i = 0; i < count; ++i) |
1753 | 0 | buffer[i] = s[i].toArgb32(); |
1754 | 0 | return buffer; |
1755 | 0 | } |
1756 | | |
1757 | | static void QT_FASTCALL storeRGB16FFromRGB32(uchar *dest, const uint *src, int index, int count, |
1758 | | const QList<QRgb> *, QDitherInfo *) |
1759 | 0 | { |
1760 | 0 | QRgbaFloat16 *d = reinterpret_cast<QRgbaFloat16 *>(dest) + index; |
1761 | 0 | for (int i = 0; i < count; ++i) |
1762 | 0 | d[i] = QRgbaFloat16::fromArgb32(src[i] | 0xff000000); |
1763 | 0 | } |
1764 | | |
1765 | | static const uint *QT_FASTCALL fetchRGBA16FToARGB32PM(uint *buffer, const uchar *src, int index, int count, |
1766 | | const QList<QRgb> *, QDitherInfo *) |
1767 | 0 | { |
1768 | 0 | const QRgbaFloat16 *s = reinterpret_cast<const QRgbaFloat16 *>(src) + index; |
1769 | 0 | for (int i = 0; i < count; ++i) |
1770 | 0 | buffer[i] = s[i].premultiplied().toArgb32(); |
1771 | 0 | return buffer; |
1772 | 0 | } |
1773 | | |
1774 | | static const QRgba64 *QT_FASTCALL fetchRGBA16FToRGBA64PM(QRgba64 *buffer, const uchar *src, int index, int count, |
1775 | | const QList<QRgb> *, QDitherInfo *) |
1776 | 0 | { |
1777 | 0 | const QRgbaFloat16 *s = reinterpret_cast<const QRgbaFloat16 *>(src) + index; |
1778 | 0 | for (int i = 0; i < count; ++i) { |
1779 | 0 | QRgbaFloat16 c = s[i].premultiplied(); |
1780 | 0 | buffer[i] = QRgba64::fromRgba64(c.red16(), c.green16(), c.blue16(), c.alpha16()); |
1781 | 0 | } |
1782 | 0 | return buffer; |
1783 | 0 | } |
1784 | | |
1785 | | static void QT_FASTCALL storeRGBA16FFromARGB32PM(uchar *dest, const uint *src, int index, int count, |
1786 | | const QList<QRgb> *, QDitherInfo *) |
1787 | 0 | { |
1788 | 0 | QRgbaFloat16 *d = reinterpret_cast<QRgbaFloat16 *>(dest) + index; |
1789 | 0 | for (int i = 0; i < count; ++i) |
1790 | 0 | d[i] = QRgbaFloat16::fromArgb32(src[i]).unpremultiplied(); |
1791 | 0 | } |
1792 | | |
1793 | | static const QRgba64 *QT_FASTCALL fetchRGBA16FPMToRGBA64PM(QRgba64 *buffer, const uchar *src, int index, int count, |
1794 | | const QList<QRgb> *, QDitherInfo *) |
1795 | 0 | { |
1796 | 0 | const QRgbaFloat16 *s = reinterpret_cast<const QRgbaFloat16 *>(src) + index; |
1797 | 0 | for (int i = 0; i < count; ++i) { |
1798 | 0 | QRgbaFloat16 c = s[i]; |
1799 | 0 | buffer[i] = QRgba64::fromRgba64(c.red16(), c.green16(), c.blue16(), c.alpha16()); |
1800 | 0 | } |
1801 | 0 | return buffer; |
1802 | 0 | } |
1803 | | |
1804 | | static const uint *QT_FASTCALL fetchRGB32FToRGB32(uint *buffer, const uchar *src, int index, int count, |
1805 | | const QList<QRgb> *, QDitherInfo *) |
1806 | 0 | { |
1807 | 0 | const QRgbaFloat32 *s = reinterpret_cast<const QRgbaFloat32 *>(src) + index; |
1808 | 0 | for (int i = 0; i < count; ++i) |
1809 | 0 | buffer[i] = s[i].toArgb32(); |
1810 | 0 | return buffer; |
1811 | 0 | } |
1812 | | |
1813 | | static void QT_FASTCALL storeRGB32FFromRGB32(uchar *dest, const uint *src, int index, int count, |
1814 | | const QList<QRgb> *, QDitherInfo *) |
1815 | 0 | { |
1816 | 0 | QRgbaFloat32 *d = reinterpret_cast<QRgbaFloat32 *>(dest) + index; |
1817 | 0 | for (int i = 0; i < count; ++i) |
1818 | 0 | d[i] = QRgbaFloat32::fromArgb32(src[i] | 0xff000000); |
1819 | 0 | } |
1820 | | |
1821 | | static const uint *QT_FASTCALL fetchRGBA32FToARGB32PM(uint *buffer, const uchar *src, int index, int count, |
1822 | | const QList<QRgb> *, QDitherInfo *) |
1823 | 0 | { |
1824 | 0 | const QRgbaFloat32 *s = reinterpret_cast<const QRgbaFloat32 *>(src) + index; |
1825 | 0 | for (int i = 0; i < count; ++i) |
1826 | 0 | buffer[i] = s[i].premultiplied().toArgb32(); |
1827 | 0 | return buffer; |
1828 | 0 | } |
1829 | | |
1830 | | static const QRgba64 *QT_FASTCALL fetchRGBA32FToRGBA64PM(QRgba64 *buffer, const uchar *src, int index, int count, |
1831 | | const QList<QRgb> *, QDitherInfo *) |
1832 | 0 | { |
1833 | 0 | const QRgbaFloat32 *s = reinterpret_cast<const QRgbaFloat32 *>(src) + index; |
1834 | 0 | for (int i = 0; i < count; ++i) { |
1835 | 0 | QRgbaFloat32 c = s[i].premultiplied(); |
1836 | 0 | buffer[i] = QRgba64::fromRgba64(c.red16(), c.green16(), c.blue16(), c.alpha16()); |
1837 | 0 | } |
1838 | 0 | return buffer; |
1839 | 0 | } |
1840 | | |
1841 | | static void QT_FASTCALL storeRGBA32FFromARGB32PM(uchar *dest, const uint *src, int index, int count, |
1842 | | const QList<QRgb> *, QDitherInfo *) |
1843 | 0 | { |
1844 | 0 | QRgbaFloat32 *d = reinterpret_cast<QRgbaFloat32 *>(dest) + index; |
1845 | 0 | for (int i = 0; i < count; ++i) |
1846 | 0 | d[i] = QRgbaFloat32::fromArgb32(src[i]).unpremultiplied(); |
1847 | 0 | } |
1848 | | |
1849 | | static const QRgba64 *QT_FASTCALL fetchRGBA32FPMToRGBA64PM(QRgba64 *buffer, const uchar *src, int index, int count, |
1850 | | const QList<QRgb> *, QDitherInfo *) |
1851 | 0 | { |
1852 | 0 | const QRgbaFloat32 *s = reinterpret_cast<const QRgbaFloat32 *>(src) + index; |
1853 | 0 | for (int i = 0; i < count; ++i) { |
1854 | 0 | QRgbaFloat32 c = s[i]; |
1855 | 0 | buffer[i] = QRgba64::fromRgba64(c.red16(), c.green16(), c.blue16(), c.alpha16()); |
1856 | 0 | } |
1857 | 0 | return buffer; |
1858 | 0 | } |
1859 | | |
1860 | | inline const uint *qt_convertCMYK8888ToARGB32PM(uint *buffer, const uint *src, int count) |
1861 | 0 | { |
1862 | 0 | UNALIASED_CONVERSION_LOOP(buffer, src, count, [](uint s) { |
1863 | 0 | const QColor color = QCmyk32::fromCmyk32(s).toColor(); |
1864 | 0 | return color.rgba(); |
1865 | 0 | }); |
1866 | 0 | return buffer; |
1867 | 0 | } |
1868 | | |
1869 | | static void QT_FASTCALL convertCMYK8888ToARGB32PM(uint *buffer, int count, const QList<QRgb> *) |
1870 | 0 | { |
1871 | 0 | qt_convertCMYK8888ToARGB32PM(buffer, buffer, count); |
1872 | 0 | } |
1873 | | |
1874 | | static const QRgba64 *QT_FASTCALL convertCMYK8888ToToRGBA64PM(QRgba64 *buffer, const uint *src, int count, |
1875 | | const QList<QRgb> *, QDitherInfo *) |
1876 | 0 | { |
1877 | 0 | for (int i = 0; i < count; ++i) |
1878 | 0 | buffer[i] = QCmyk32::fromCmyk32(src[i]).toColor().rgba64(); |
1879 | 0 | return buffer; |
1880 | 0 | } |
1881 | | |
1882 | | static const uint *QT_FASTCALL fetchCMYK8888ToARGB32PM(uint *buffer, const uchar *src, int index, int count, |
1883 | | const QList<QRgb> *, QDitherInfo *) |
1884 | 0 | { |
1885 | 0 | const uint *s = reinterpret_cast<const uint *>(src) + index; |
1886 | 0 | for (int i = 0; i < count; ++i) |
1887 | 0 | buffer[i] = QCmyk32::fromCmyk32(s[i]).toColor().rgba(); |
1888 | 0 | return buffer; |
1889 | 0 | } |
1890 | | |
1891 | | static const QRgba64 *QT_FASTCALL fetchCMYK8888ToRGBA64PM(QRgba64 *buffer, const uchar *src, int index, int count, |
1892 | | const QList<QRgb> *, QDitherInfo *) |
1893 | 0 | { |
1894 | 0 | const uint *s = reinterpret_cast<const uint *>(src) + index; |
1895 | 0 | for (int i = 0; i < count; ++i) |
1896 | 0 | buffer[i] = QCmyk32::fromCmyk32(s[i]).toColor().rgba64(); |
1897 | 0 | return buffer; |
1898 | 0 | } |
1899 | | |
1900 | | static void QT_FASTCALL storeCMYK8888FromARGB32PM(uchar *dest, const uint *src, int index, int count, |
1901 | | const QList<QRgb> *, QDitherInfo *) |
1902 | 0 | { |
1903 | 0 | uint *d = reinterpret_cast<uint *>(dest) + index; |
1904 | 0 | for (int i = 0; i < count; ++i) { |
1905 | 0 | QColor c = qUnpremultiply(src[i]); |
1906 | 0 | d[i] = QCmyk32::fromColor(c).toUint(); |
1907 | 0 | } |
1908 | 0 | } |
1909 | | |
1910 | | static void QT_FASTCALL storeCMYK8888FromRGB32(uchar *dest, const uint *src, int index, int count, |
1911 | | const QList<QRgb> *, QDitherInfo *) |
1912 | 0 | { |
1913 | 0 | uint *d = reinterpret_cast<uint *>(dest) + index; |
1914 | 0 | for (int i = 0; i < count; ++i) { |
1915 | 0 | QColor c = src[i]; |
1916 | 0 | d[i] = QCmyk32::fromColor(c).toUint(); |
1917 | 0 | } |
1918 | 0 | } |
1919 | | |
1920 | | // Note: |
1921 | | // convertToArgb32() assumes that no color channel is less than 4 bits. |
1922 | | // storeRGBFromARGB32PM() assumes that no color channel is more than 8 bits. |
1923 | | // QImage::rgbSwapped() assumes that the red and blue color channels have the same number of bits. |
1924 | | QPixelLayout qPixelLayouts[] = { |
1925 | | { false, false, QPixelLayout::BPPNone, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr }, // Format_Invalid |
1926 | | { false, false, QPixelLayout::BPP1MSB, nullptr, |
1927 | | convertIndexedToARGB32PM, convertIndexedTo<QRgba64>, |
1928 | | fetchIndexedToARGB32PM<QPixelLayout::BPP1MSB>, fetchIndexedToRGBA64PM<QPixelLayout::BPP1MSB>, |
1929 | | nullptr, nullptr }, // Format_Mono |
1930 | | { false, false, QPixelLayout::BPP1LSB, nullptr, |
1931 | | convertIndexedToARGB32PM, convertIndexedTo<QRgba64>, |
1932 | | fetchIndexedToARGB32PM<QPixelLayout::BPP1LSB>, fetchIndexedToRGBA64PM<QPixelLayout::BPP1LSB>, |
1933 | | nullptr, nullptr }, // Format_MonoLSB |
1934 | | { false, false, QPixelLayout::BPP8, nullptr, |
1935 | | convertIndexedToARGB32PM, convertIndexedTo<QRgba64>, |
1936 | | fetchIndexedToARGB32PM<QPixelLayout::BPP8>, fetchIndexedToRGBA64PM<QPixelLayout::BPP8>, |
1937 | | nullptr, nullptr }, // Format_Indexed8 |
1938 | | // Technically using convertPassThrough to convert from ARGB32PM to RGB32 is wrong, |
1939 | | // but everywhere this generic conversion would be wrong is currently overloaded. |
1940 | | { false, false, QPixelLayout::BPP32, rbSwap_rgb32, convertPassThrough, |
1941 | | convertRGB32ToRGB64, fetchPassThrough, fetchRGB32ToRGB64, storePassThrough, storePassThrough }, // Format_RGB32 |
1942 | | { true, false, QPixelLayout::BPP32, rbSwap_rgb32, convertARGB32ToARGB32PM, |
1943 | | convertARGB32ToRGBA64PM, fetchARGB32ToARGB32PM, fetchARGB32ToRGBA64PM, storeARGB32FromARGB32PM, storePassThrough }, // Format_ARGB32 |
1944 | | { true, true, QPixelLayout::BPP32, rbSwap_rgb32, convertPassThrough, |
1945 | | convertARGB32PMToRGBA64PM, fetchPassThrough, fetchARGB32PMToRGBA64PM, storePassThrough, storePassThrough }, // Format_ARGB32_Premultiplied |
1946 | | pixelLayoutRGB<QImage::Format_RGB16>(), |
1947 | | pixelLayoutARGBPM<QImage::Format_ARGB8565_Premultiplied>(), |
1948 | | pixelLayoutRGB<QImage::Format_RGB666>(), |
1949 | | pixelLayoutARGBPM<QImage::Format_ARGB6666_Premultiplied>(), |
1950 | | pixelLayoutRGB<QImage::Format_RGB555>(), |
1951 | | pixelLayoutARGBPM<QImage::Format_ARGB8555_Premultiplied>(), |
1952 | | pixelLayoutRGB<QImage::Format_RGB888>(), |
1953 | | pixelLayoutRGB<QImage::Format_RGB444>(), |
1954 | | pixelLayoutARGBPM<QImage::Format_ARGB4444_Premultiplied>(), |
1955 | | { false, false, QPixelLayout::BPP32, rbSwap<QImage::Format_RGBA8888>, convertRGBA8888PMToARGB32PM, |
1956 | | convertRGBA8888PMToRGBA64PM, fetchRGBA8888PMToARGB32PM, fetchRGBA8888PMToRGBA64PM, storeRGBXFromARGB32PM, storeRGBXFromRGB32 }, // Format_RGBX8888 |
1957 | | { true, false, QPixelLayout::BPP32, rbSwap<QImage::Format_RGBA8888>, convertRGBA8888ToARGB32PM, |
1958 | | convertRGBA8888ToRGBA64PM, fetchRGBA8888ToARGB32PM, fetchRGBA8888ToRGBA64PM, storeRGBA8888FromARGB32PM, storeRGBXFromRGB32 }, // Format_RGBA8888 |
1959 | | { true, true, QPixelLayout::BPP32, rbSwap<QImage::Format_RGBA8888>, convertRGBA8888PMToARGB32PM, |
1960 | | convertRGBA8888PMToRGBA64PM, fetchRGBA8888PMToARGB32PM, fetchRGBA8888PMToRGBA64PM, storeRGBA8888PMFromARGB32PM, storeRGBXFromRGB32 }, // Format_RGBA8888_Premultiplied |
1961 | | { false, false, QPixelLayout::BPP32, rbSwap_rgb30, |
1962 | | convertA2RGB30PMToARGB32PM<PixelOrderBGR>, |
1963 | | convertA2RGB30PMToRGBA64PM<PixelOrderBGR>, |
1964 | | fetchA2RGB30PMToARGB32PM<PixelOrderBGR>, |
1965 | | fetchA2RGB30PMToRGBA64PM<PixelOrderBGR>, |
1966 | | storeRGB30FromARGB32PM<PixelOrderBGR>, |
1967 | | storeRGB30FromRGB32<PixelOrderBGR> |
1968 | | }, // Format_BGR30 |
1969 | | { true, true, QPixelLayout::BPP32, rbSwap_rgb30, |
1970 | | convertA2RGB30PMToARGB32PM<PixelOrderBGR>, |
1971 | | convertA2RGB30PMToRGBA64PM<PixelOrderBGR>, |
1972 | | fetchA2RGB30PMToARGB32PM<PixelOrderBGR>, |
1973 | | fetchA2RGB30PMToRGBA64PM<PixelOrderBGR>, |
1974 | | storeA2RGB30PMFromARGB32PM<PixelOrderBGR>, |
1975 | | storeRGB30FromRGB32<PixelOrderBGR> |
1976 | | }, // Format_A2BGR30_Premultiplied |
1977 | | { false, false, QPixelLayout::BPP32, rbSwap_rgb30, |
1978 | | convertA2RGB30PMToARGB32PM<PixelOrderRGB>, |
1979 | | convertA2RGB30PMToRGBA64PM<PixelOrderRGB>, |
1980 | | fetchA2RGB30PMToARGB32PM<PixelOrderRGB>, |
1981 | | fetchA2RGB30PMToRGBA64PM<PixelOrderRGB>, |
1982 | | storeRGB30FromARGB32PM<PixelOrderRGB>, |
1983 | | storeRGB30FromRGB32<PixelOrderRGB> |
1984 | | }, // Format_RGB30 |
1985 | | { true, true, QPixelLayout::BPP32, rbSwap_rgb30, |
1986 | | convertA2RGB30PMToARGB32PM<PixelOrderRGB>, |
1987 | | convertA2RGB30PMToRGBA64PM<PixelOrderRGB>, |
1988 | | fetchA2RGB30PMToARGB32PM<PixelOrderRGB>, |
1989 | | fetchA2RGB30PMToRGBA64PM<PixelOrderRGB>, |
1990 | | storeA2RGB30PMFromARGB32PM<PixelOrderRGB>, |
1991 | | storeRGB30FromRGB32<PixelOrderRGB> |
1992 | | }, // Format_A2RGB30_Premultiplied |
1993 | | { true, true, QPixelLayout::BPP8, nullptr, |
1994 | | convertAlpha8ToRGB32, convertAlpha8To<QRgba64>, |
1995 | | fetchAlpha8ToRGB32, fetchAlpha8To<QRgba64>, |
1996 | | storeAlpha8FromARGB32PM, nullptr }, // Format_Alpha8 |
1997 | | { false, false, QPixelLayout::BPP8, nullptr, |
1998 | | convertGrayscale8ToRGB32, convertGrayscale8To<QRgba64>, |
1999 | | fetchGrayscale8ToRGB32, fetchGrayscale8To<QRgba64>, |
2000 | | storeGrayscale8FromARGB32PM, storeGrayscale8FromRGB32 }, // Format_Grayscale8 |
2001 | | { false, false, QPixelLayout::BPP64, rbSwap_4x16, |
2002 | | convertPassThrough, nullptr, |
2003 | | fetchRGB64ToRGB32, fetchPassThrough64, |
2004 | | storeRGBA64FromARGB32PM<true>, storeRGB64FromRGB32 }, // Format_RGBX64 |
2005 | | { true, false, QPixelLayout::BPP64, rbSwap_4x16, |
2006 | | convertARGB32ToARGB32PM, nullptr, |
2007 | | fetchRGBA64ToARGB32PM, fetchRGBA64ToRGBA64PM, |
2008 | | storeRGBA64FromARGB32PM<false>, storeRGB64FromRGB32 }, // Format_RGBA64 |
2009 | | { true, true, QPixelLayout::BPP64, rbSwap_4x16, |
2010 | | convertPassThrough, nullptr, |
2011 | | fetchRGB64ToRGB32, fetchPassThrough64, |
2012 | | storeRGBA64FromARGB32, storeRGB64FromRGB32 }, // Format_RGBA64_Premultiplied |
2013 | | { false, false, QPixelLayout::BPP16, nullptr, |
2014 | | convertGrayscale16ToRGB32, convertGrayscale16To<QRgba64>, |
2015 | | fetchGrayscale16ToRGB32, fetchGrayscale16To<QRgba64>, |
2016 | | storeGrayscale16FromARGB32PM, storeGrayscale16FromRGB32 }, // Format_Grayscale16 |
2017 | | pixelLayoutRGB<QImage::Format_BGR888>(), |
2018 | | { false, false, QPixelLayout::BPP16FPx4, rbSwap_4x16, |
2019 | | convertPassThrough, nullptr, |
2020 | | fetchRGB16FToRGB32, fetchRGBA16FPMToRGBA64PM, |
2021 | | storeRGB16FFromRGB32, storeRGB16FFromRGB32 }, // Format_RGBX16FPx4 |
2022 | | { true, false, QPixelLayout::BPP16FPx4, rbSwap_4x16, |
2023 | | convertARGB32ToARGB32PM, nullptr, |
2024 | | fetchRGBA16FToARGB32PM, fetchRGBA16FToRGBA64PM, |
2025 | | storeRGBA16FFromARGB32PM, storeRGB16FFromRGB32 }, // Format_RGBA16FPx4 |
2026 | | { true, true, QPixelLayout::BPP16FPx4, rbSwap_4x16, |
2027 | | convertPassThrough, nullptr, |
2028 | | fetchRGB16FToRGB32, fetchRGBA16FPMToRGBA64PM, |
2029 | | storeRGB16FFromRGB32, storeRGB16FFromRGB32 }, // Format_RGBA16FPx4_Premultiplied |
2030 | | { false, false, QPixelLayout::BPP32FPx4, rbSwap_4x32, |
2031 | | convertPassThrough, nullptr, |
2032 | | fetchRGB32FToRGB32, fetchRGBA32FPMToRGBA64PM, |
2033 | | storeRGB32FFromRGB32, storeRGB32FFromRGB32 }, // Format_RGBX32FPx4 |
2034 | | { true, false, QPixelLayout::BPP32FPx4, rbSwap_4x32, |
2035 | | convertARGB32ToARGB32PM, nullptr, |
2036 | | fetchRGBA32FToARGB32PM, fetchRGBA32FToRGBA64PM, |
2037 | | storeRGBA32FFromARGB32PM, storeRGB32FFromRGB32 }, // Format_RGBA32FPx4 |
2038 | | { true, true, QPixelLayout::BPP32FPx4, rbSwap_4x32, |
2039 | | convertPassThrough, nullptr, |
2040 | | fetchRGB32FToRGB32, fetchRGBA32FPMToRGBA64PM, |
2041 | | storeRGB32FFromRGB32, storeRGB32FFromRGB32 }, // Format_RGBA32FPx4_Premultiplied |
2042 | | { false, false, QPixelLayout::BPP32, nullptr, |
2043 | | convertCMYK8888ToARGB32PM, convertCMYK8888ToToRGBA64PM, |
2044 | | fetchCMYK8888ToARGB32PM, fetchCMYK8888ToRGBA64PM, |
2045 | | storeCMYK8888FromARGB32PM, storeCMYK8888FromRGB32 }, // Format_CMYK8888 |
2046 | | }; |
2047 | | |
2048 | | static_assert(std::size(qPixelLayouts) == QImage::NImageFormats); |
2049 | | |
2050 | | static void QT_FASTCALL convertFromRgb64(uint *dest, const QRgba64 *src, int length) |
2051 | 0 | { |
2052 | 0 | for (int i = 0; i < length; ++i) { |
2053 | 0 | dest[i] = toArgb32(src[i]); |
2054 | 0 | } |
2055 | 0 | } |
2056 | | |
2057 | | template<QImage::Format format> |
2058 | | static void QT_FASTCALL storeGenericFromRGBA64PM(uchar *dest, const QRgba64 *src, int index, int count, |
2059 | | const QList<QRgb> *clut, QDitherInfo *dither) |
2060 | 0 | { |
2061 | 0 | Q_DECL_UNINITIALIZED uint buffer[BufferSize]; |
2062 | 0 | convertFromRgb64(buffer, src, count); |
2063 | 0 | qPixelLayouts[format].storeFromARGB32PM(dest, buffer, index, count, clut, dither); |
2064 | 0 | } Unexecuted instantiation: qpixellayout.cpp:void storeGenericFromRGBA64PM<(QImage::Format)4>(unsigned char*, QRgba64 const*, int, int, QList<unsigned int> const*, QDitherInfo*) Unexecuted instantiation: qpixellayout.cpp:void storeGenericFromRGBA64PM<(QImage::Format)6>(unsigned char*, QRgba64 const*, int, int, QList<unsigned int> const*, QDitherInfo*) Unexecuted instantiation: qpixellayout.cpp:void storeGenericFromRGBA64PM<(QImage::Format)7>(unsigned char*, QRgba64 const*, int, int, QList<unsigned int> const*, QDitherInfo*) Unexecuted instantiation: qpixellayout.cpp:void storeGenericFromRGBA64PM<(QImage::Format)8>(unsigned char*, QRgba64 const*, int, int, QList<unsigned int> const*, QDitherInfo*) Unexecuted instantiation: qpixellayout.cpp:void storeGenericFromRGBA64PM<(QImage::Format)9>(unsigned char*, QRgba64 const*, int, int, QList<unsigned int> const*, QDitherInfo*) Unexecuted instantiation: qpixellayout.cpp:void storeGenericFromRGBA64PM<(QImage::Format)10>(unsigned char*, QRgba64 const*, int, int, QList<unsigned int> const*, QDitherInfo*) Unexecuted instantiation: qpixellayout.cpp:void storeGenericFromRGBA64PM<(QImage::Format)11>(unsigned char*, QRgba64 const*, int, int, QList<unsigned int> const*, QDitherInfo*) Unexecuted instantiation: qpixellayout.cpp:void storeGenericFromRGBA64PM<(QImage::Format)12>(unsigned char*, QRgba64 const*, int, int, QList<unsigned int> const*, QDitherInfo*) Unexecuted instantiation: qpixellayout.cpp:void storeGenericFromRGBA64PM<(QImage::Format)13>(unsigned char*, QRgba64 const*, int, int, QList<unsigned int> const*, QDitherInfo*) Unexecuted instantiation: qpixellayout.cpp:void storeGenericFromRGBA64PM<(QImage::Format)14>(unsigned char*, QRgba64 const*, int, int, QList<unsigned int> const*, QDitherInfo*) Unexecuted instantiation: qpixellayout.cpp:void storeGenericFromRGBA64PM<(QImage::Format)15>(unsigned char*, QRgba64 const*, int, int, QList<unsigned int> const*, QDitherInfo*) Unexecuted instantiation: qpixellayout.cpp:void storeGenericFromRGBA64PM<(QImage::Format)16>(unsigned char*, QRgba64 const*, int, int, QList<unsigned int> const*, QDitherInfo*) Unexecuted instantiation: qpixellayout.cpp:void storeGenericFromRGBA64PM<(QImage::Format)18>(unsigned char*, QRgba64 const*, int, int, QList<unsigned int> const*, QDitherInfo*) Unexecuted instantiation: qpixellayout.cpp:void storeGenericFromRGBA64PM<(QImage::Format)23>(unsigned char*, QRgba64 const*, int, int, QList<unsigned int> const*, QDitherInfo*) Unexecuted instantiation: qpixellayout.cpp:void storeGenericFromRGBA64PM<(QImage::Format)24>(unsigned char*, QRgba64 const*, int, int, QList<unsigned int> const*, QDitherInfo*) Unexecuted instantiation: qpixellayout.cpp:void storeGenericFromRGBA64PM<(QImage::Format)29>(unsigned char*, QRgba64 const*, int, int, QList<unsigned int> const*, QDitherInfo*) |
2065 | | |
2066 | | static void QT_FASTCALL storeARGB32FromRGBA64PM(uchar *dest, const QRgba64 *src, int index, int count, |
2067 | | const QList<QRgb> *, QDitherInfo *) |
2068 | 0 | { |
2069 | 0 | uint *d = (uint*)dest + index; |
2070 | 0 | for (int i = 0; i < count; ++i) |
2071 | 0 | d[i] = toArgb32(src[i].unpremultiplied()); |
2072 | 0 | } |
2073 | | |
2074 | | static void QT_FASTCALL storeRGBA8888FromRGBA64PM(uchar *dest, const QRgba64 *src, int index, int count, |
2075 | | const QList<QRgb> *, QDitherInfo *) |
2076 | 0 | { |
2077 | 0 | uint *d = (uint*)dest + index; |
2078 | 0 | for (int i = 0; i < count; ++i) |
2079 | 0 | d[i] = toRgba8888(src[i].unpremultiplied()); |
2080 | 0 | } |
2081 | | |
2082 | | template<QtPixelOrder PixelOrder> |
2083 | | static void QT_FASTCALL storeRGB30FromRGBA64PM(uchar *dest, const QRgba64 *src, int index, int count, |
2084 | | const QList<QRgb> *, QDitherInfo *) |
2085 | 0 | { |
2086 | 0 | uint *d = (uint*)dest + index; |
2087 | 0 | #ifdef __SSE2__ |
2088 | 0 | qConvertRGBA64PMToA2RGB30PM_sse2<PixelOrder>(d, src, count); |
2089 | | #elif defined (__loongarch_sx) |
2090 | | qConvertRGBA64PMToA2RGB30PM_lsx<PixelOrder>(d, src, count); |
2091 | | #else |
2092 | | for (int i = 0; i < count; ++i) |
2093 | | d[i] = qConvertRgb64ToRgb30<PixelOrder>(src[i]); |
2094 | | #endif |
2095 | 0 | } Unexecuted instantiation: qpixellayout.cpp:void storeRGB30FromRGBA64PM<(QtPixelOrder)1>(unsigned char*, QRgba64 const*, int, int, QList<unsigned int> const*, QDitherInfo*) Unexecuted instantiation: qpixellayout.cpp:void storeRGB30FromRGBA64PM<(QtPixelOrder)0>(unsigned char*, QRgba64 const*, int, int, QList<unsigned int> const*, QDitherInfo*) |
2096 | | |
2097 | | static void QT_FASTCALL storeRGBX64FromRGBA64PM(uchar *dest, const QRgba64 *src, int index, int count, |
2098 | | const QList<QRgb> *, QDitherInfo *) |
2099 | 0 | { |
2100 | 0 | QRgba64 *d = reinterpret_cast<QRgba64*>(dest) + index; |
2101 | 0 | for (int i = 0; i < count; ++i) { |
2102 | 0 | d[i] = src[i].unpremultiplied(); |
2103 | 0 | d[i].setAlpha(65535); |
2104 | 0 | } |
2105 | 0 | } |
2106 | | |
2107 | | static void QT_FASTCALL storeRGBA64FromRGBA64PM(uchar *dest, const QRgba64 *src, int index, int count, |
2108 | | const QList<QRgb> *, QDitherInfo *) |
2109 | 0 | { |
2110 | 0 | QRgba64 *d = reinterpret_cast<QRgba64*>(dest) + index; |
2111 | 0 | for (int i = 0; i < count; ++i) |
2112 | 0 | d[i] = src[i].unpremultiplied(); |
2113 | 0 | } |
2114 | | |
2115 | | static void QT_FASTCALL storeRGBA64PMFromRGBA64PM(uchar *dest, const QRgba64 *src, int index, int count, |
2116 | | const QList<QRgb> *, QDitherInfo *) |
2117 | 0 | { |
2118 | 0 | QRgba64 *d = reinterpret_cast<QRgba64*>(dest) + index; |
2119 | 0 | if (d != src) |
2120 | 0 | memcpy(d, src, count * sizeof(QRgba64)); |
2121 | 0 | } |
2122 | | |
2123 | | static void QT_FASTCALL storeGray16FromRGBA64PM(uchar *dest, const QRgba64 *src, int index, int count, |
2124 | | const QList<QRgb> *, QDitherInfo *) |
2125 | 0 | { |
2126 | 0 | quint16 *d = reinterpret_cast<quint16*>(dest) + index; |
2127 | 0 | for (int i = 0; i < count; ++i) { |
2128 | 0 | QRgba64 s = src[i].unpremultiplied(); |
2129 | 0 | d[i] = qGray(s.red(), s.green(), s.blue()); |
2130 | 0 | } |
2131 | 0 | } |
2132 | | |
2133 | | static void QT_FASTCALL storeRGBX16FFromRGBA64PM(uchar *dest, const QRgba64 *src, int index, int count, |
2134 | | const QList<QRgb> *, QDitherInfo *) |
2135 | 0 | { |
2136 | 0 | QRgbaFloat16 *d = reinterpret_cast<QRgbaFloat16 *>(dest) + index; |
2137 | 0 | for (int i = 0; i < count; ++i) { |
2138 | 0 | d[i] = qConvertRgb64ToRgbaF16(src[i]).unpremultiplied(); |
2139 | 0 | d[i].setAlpha(1.0); |
2140 | 0 | } |
2141 | 0 | } |
2142 | | |
2143 | | static void QT_FASTCALL storeRGBA16FFromRGBA64PM(uchar *dest, const QRgba64 *src, int index, int count, |
2144 | | const QList<QRgb> *, QDitherInfo *) |
2145 | 0 | { |
2146 | 0 | QRgbaFloat16 *d = reinterpret_cast<QRgbaFloat16 *>(dest) + index; |
2147 | 0 | for (int i = 0; i < count; ++i) |
2148 | 0 | d[i] = qConvertRgb64ToRgbaF16(src[i]).unpremultiplied(); |
2149 | 0 | } |
2150 | | |
2151 | | static void QT_FASTCALL storeRGBA16FPMFromRGBA64PM(uchar *dest, const QRgba64 *src, int index, int count, |
2152 | | const QList<QRgb> *, QDitherInfo *) |
2153 | 0 | { |
2154 | 0 | QRgbaFloat16 *d = reinterpret_cast<QRgbaFloat16 *>(dest) + index; |
2155 | 0 | for (int i = 0; i < count; ++i) |
2156 | 0 | d[i] = qConvertRgb64ToRgbaF16(src[i]); |
2157 | 0 | } |
2158 | | |
2159 | | static void QT_FASTCALL storeRGBX32FFromRGBA64PM(uchar *dest, const QRgba64 *src, int index, int count, |
2160 | | const QList<QRgb> *, QDitherInfo *) |
2161 | 0 | { |
2162 | 0 | QRgbaFloat32 *d = reinterpret_cast<QRgbaFloat32 *>(dest) + index; |
2163 | 0 | for (int i = 0; i < count; ++i) { |
2164 | 0 | d[i] = qConvertRgb64ToRgbaF32(src[i]).unpremultiplied(); |
2165 | 0 | d[i].setAlpha(1.0); |
2166 | 0 | } |
2167 | 0 | } |
2168 | | |
2169 | | static void QT_FASTCALL storeRGBA32FFromRGBA64PM(uchar *dest, const QRgba64 *src, int index, int count, |
2170 | | const QList<QRgb> *, QDitherInfo *) |
2171 | 0 | { |
2172 | 0 | QRgbaFloat32 *d = reinterpret_cast<QRgbaFloat32 *>(dest) + index; |
2173 | 0 | for (int i = 0; i < count; ++i) |
2174 | 0 | d[i] = qConvertRgb64ToRgbaF32(src[i]).unpremultiplied(); |
2175 | 0 | } |
2176 | | |
2177 | | static void QT_FASTCALL storeRGBA32FPMFromRGBA64PM(uchar *dest, const QRgba64 *src, int index, int count, |
2178 | | const QList<QRgb> *, QDitherInfo *) |
2179 | 0 | { |
2180 | 0 | QRgbaFloat32 *d = reinterpret_cast<QRgbaFloat32 *>(dest) + index; |
2181 | 0 | for (int i = 0; i < count; ++i) |
2182 | 0 | d[i] = qConvertRgb64ToRgbaF32(src[i]); |
2183 | 0 | } |
2184 | | |
2185 | | static void QT_FASTCALL storeCMYKFromRGBA64PM(uchar *dest, const QRgba64 *src, int index, int count, |
2186 | | const QList<QRgb> *, QDitherInfo *) |
2187 | 0 | { |
2188 | 0 | uint *d = reinterpret_cast<uint *>(dest) + index; |
2189 | 0 | for (int i = 0; i < count; ++i) |
2190 | 0 | d[i] = QCmyk32::fromColor(QColor(src[i])).toUint(); |
2191 | 0 | } |
2192 | | |
2193 | | ConvertAndStorePixelsFunc64 qStoreFromRGBA64PM[] = { |
2194 | | nullptr, |
2195 | | nullptr, |
2196 | | nullptr, |
2197 | | nullptr, |
2198 | | storeGenericFromRGBA64PM<QImage::Format_RGB32>, |
2199 | | storeARGB32FromRGBA64PM, |
2200 | | storeGenericFromRGBA64PM<QImage::Format_ARGB32_Premultiplied>, |
2201 | | storeGenericFromRGBA64PM<QImage::Format_RGB16>, |
2202 | | storeGenericFromRGBA64PM<QImage::Format_ARGB8565_Premultiplied>, |
2203 | | storeGenericFromRGBA64PM<QImage::Format_RGB666>, |
2204 | | storeGenericFromRGBA64PM<QImage::Format_ARGB6666_Premultiplied>, |
2205 | | storeGenericFromRGBA64PM<QImage::Format_RGB555>, |
2206 | | storeGenericFromRGBA64PM<QImage::Format_ARGB8555_Premultiplied>, |
2207 | | storeGenericFromRGBA64PM<QImage::Format_RGB888>, |
2208 | | storeGenericFromRGBA64PM<QImage::Format_RGB444>, |
2209 | | storeGenericFromRGBA64PM<QImage::Format_ARGB4444_Premultiplied>, |
2210 | | storeGenericFromRGBA64PM<QImage::Format_RGBX8888>, |
2211 | | storeRGBA8888FromRGBA64PM, |
2212 | | storeGenericFromRGBA64PM<QImage::Format_RGBA8888_Premultiplied>, |
2213 | | storeRGB30FromRGBA64PM<PixelOrderBGR>, |
2214 | | storeRGB30FromRGBA64PM<PixelOrderBGR>, |
2215 | | storeRGB30FromRGBA64PM<PixelOrderRGB>, |
2216 | | storeRGB30FromRGBA64PM<PixelOrderRGB>, |
2217 | | storeGenericFromRGBA64PM<QImage::Format_Alpha8>, |
2218 | | storeGenericFromRGBA64PM<QImage::Format_Grayscale8>, |
2219 | | storeRGBX64FromRGBA64PM, |
2220 | | storeRGBA64FromRGBA64PM, |
2221 | | storeRGBA64PMFromRGBA64PM, |
2222 | | storeGray16FromRGBA64PM, |
2223 | | storeGenericFromRGBA64PM<QImage::Format_BGR888>, |
2224 | | storeRGBX16FFromRGBA64PM, |
2225 | | storeRGBA16FFromRGBA64PM, |
2226 | | storeRGBA16FPMFromRGBA64PM, |
2227 | | storeRGBX32FFromRGBA64PM, |
2228 | | storeRGBA32FFromRGBA64PM, |
2229 | | storeRGBA32FPMFromRGBA64PM, |
2230 | | storeCMYKFromRGBA64PM, |
2231 | | }; |
2232 | | |
2233 | | static_assert(std::size(qStoreFromRGBA64PM) == QImage::NImageFormats); |
2234 | | |
2235 | | #if QT_CONFIG(raster_fp) |
2236 | | static void QT_FASTCALL convertToRgbaF32(QRgbaFloat32 *dest, const uint *src, int length) |
2237 | 0 | { |
2238 | 0 | for (int i = 0; i < length; ++i) |
2239 | 0 | dest[i] = QRgbaFloat32::fromArgb32(src[i]); |
2240 | 0 | } |
2241 | | |
2242 | | template<QImage::Format format> |
2243 | | static const QRgbaFloat32 * QT_FASTCALL convertGenericToRGBA32F(QRgbaFloat32 *buffer, const uint *src, int count, |
2244 | | const QList<QRgb> *clut, QDitherInfo *) |
2245 | 0 | { |
2246 | 0 | Q_DECL_UNINITIALIZED uint buffer32[BufferSize]; |
2247 | 0 | memcpy(buffer32, src, count * sizeof(uint)); |
2248 | 0 | qPixelLayouts[format].convertToARGB32PM(buffer32, count, clut); |
2249 | 0 | convertToRgbaF32(buffer, buffer32, count); |
2250 | 0 | return buffer; |
2251 | 0 | } Unexecuted instantiation: qpixellayout.cpp:QRgbaFloat<float> const* convertGenericToRGBA32F<(QImage::Format)4>(QRgbaFloat<float>*, unsigned int const*, int, QList<unsigned int> const*, QDitherInfo*) Unexecuted instantiation: qpixellayout.cpp:QRgbaFloat<float> const* convertGenericToRGBA32F<(QImage::Format)6>(QRgbaFloat<float>*, unsigned int const*, int, QList<unsigned int> const*, QDitherInfo*) Unexecuted instantiation: qpixellayout.cpp:QRgbaFloat<float> const* convertGenericToRGBA32F<(QImage::Format)7>(QRgbaFloat<float>*, unsigned int const*, int, QList<unsigned int> const*, QDitherInfo*) Unexecuted instantiation: qpixellayout.cpp:QRgbaFloat<float> const* convertGenericToRGBA32F<(QImage::Format)8>(QRgbaFloat<float>*, unsigned int const*, int, QList<unsigned int> const*, QDitherInfo*) Unexecuted instantiation: qpixellayout.cpp:QRgbaFloat<float> const* convertGenericToRGBA32F<(QImage::Format)9>(QRgbaFloat<float>*, unsigned int const*, int, QList<unsigned int> const*, QDitherInfo*) Unexecuted instantiation: qpixellayout.cpp:QRgbaFloat<float> const* convertGenericToRGBA32F<(QImage::Format)10>(QRgbaFloat<float>*, unsigned int const*, int, QList<unsigned int> const*, QDitherInfo*) Unexecuted instantiation: qpixellayout.cpp:QRgbaFloat<float> const* convertGenericToRGBA32F<(QImage::Format)11>(QRgbaFloat<float>*, unsigned int const*, int, QList<unsigned int> const*, QDitherInfo*) Unexecuted instantiation: qpixellayout.cpp:QRgbaFloat<float> const* convertGenericToRGBA32F<(QImage::Format)12>(QRgbaFloat<float>*, unsigned int const*, int, QList<unsigned int> const*, QDitherInfo*) Unexecuted instantiation: qpixellayout.cpp:QRgbaFloat<float> const* convertGenericToRGBA32F<(QImage::Format)13>(QRgbaFloat<float>*, unsigned int const*, int, QList<unsigned int> const*, QDitherInfo*) Unexecuted instantiation: qpixellayout.cpp:QRgbaFloat<float> const* convertGenericToRGBA32F<(QImage::Format)14>(QRgbaFloat<float>*, unsigned int const*, int, QList<unsigned int> const*, QDitherInfo*) Unexecuted instantiation: qpixellayout.cpp:QRgbaFloat<float> const* convertGenericToRGBA32F<(QImage::Format)15>(QRgbaFloat<float>*, unsigned int const*, int, QList<unsigned int> const*, QDitherInfo*) Unexecuted instantiation: qpixellayout.cpp:QRgbaFloat<float> const* convertGenericToRGBA32F<(QImage::Format)16>(QRgbaFloat<float>*, unsigned int const*, int, QList<unsigned int> const*, QDitherInfo*) Unexecuted instantiation: qpixellayout.cpp:QRgbaFloat<float> const* convertGenericToRGBA32F<(QImage::Format)18>(QRgbaFloat<float>*, unsigned int const*, int, QList<unsigned int> const*, QDitherInfo*) Unexecuted instantiation: qpixellayout.cpp:QRgbaFloat<float> const* convertGenericToRGBA32F<(QImage::Format)29>(QRgbaFloat<float>*, unsigned int const*, int, QList<unsigned int> const*, QDitherInfo*) |
2252 | | |
2253 | | static const QRgbaFloat32 * QT_FASTCALL convertARGB32ToRGBA32F(QRgbaFloat32 *buffer, const uint *src, int count, |
2254 | | const QList<QRgb> *, QDitherInfo *) |
2255 | 0 | { |
2256 | 0 | for (int i = 0; i < count; ++i) |
2257 | 0 | buffer[i] = QRgbaFloat32::fromArgb32(src[i]).premultiplied(); |
2258 | 0 | return buffer; |
2259 | 0 | } |
2260 | | |
2261 | | static const QRgbaFloat32 * QT_FASTCALL convertRGBA8888ToRGBA32F(QRgbaFloat32 *buffer, const uint *src, int count, |
2262 | | const QList<QRgb> *, QDitherInfo *) |
2263 | 0 | { |
2264 | 0 | for (int i = 0; i < count; ++i) |
2265 | 0 | buffer[i] = QRgbaFloat32::fromArgb32(RGBA2ARGB(src[i])).premultiplied(); |
2266 | 0 | return buffer; |
2267 | 0 | } |
2268 | | |
2269 | | template<QtPixelOrder PixelOrder> |
2270 | | static const QRgbaFloat32 * QT_FASTCALL convertRGB30ToRGBA32F(QRgbaFloat32 *buffer, const uint *src, int count, |
2271 | | const QList<QRgb> *, QDitherInfo *) |
2272 | 0 | { |
2273 | 0 | for (int i = 0; i < count; ++i) { |
2274 | 0 | QRgba64 s = qConvertA2rgb30ToRgb64<PixelOrder>(src[i]); |
2275 | 0 | buffer[i] = QRgbaFloat32::fromRgba64(s.red(), s.green(), s.blue(), s.alpha()); |
2276 | 0 | } |
2277 | 0 | return buffer; |
2278 | 0 | } Unexecuted instantiation: qpixellayout.cpp:QRgbaFloat<float> const* convertRGB30ToRGBA32F<(QtPixelOrder)1>(QRgbaFloat<float>*, unsigned int const*, int, QList<unsigned int> const*, QDitherInfo*) Unexecuted instantiation: qpixellayout.cpp:QRgbaFloat<float> const* convertRGB30ToRGBA32F<(QtPixelOrder)0>(QRgbaFloat<float>*, unsigned int const*, int, QList<unsigned int> const*, QDitherInfo*) |
2279 | | |
2280 | | static const QRgbaFloat32 * QT_FASTCALL convertCMYKToRGBA32F(QRgbaFloat32 *buffer, const uint *src, int count, |
2281 | | const QList<QRgb> *, QDitherInfo *) |
2282 | 0 | { |
2283 | 0 | for (int i = 0; i < count; ++i) |
2284 | 0 | buffer[i] = QRgbaFloat32::fromArgb32(QCmyk32::fromCmyk32(src[i]).toColor().rgba()); |
2285 | |
|
2286 | 0 | return buffer; |
2287 | 0 | } |
2288 | | |
2289 | | ConvertToFPFunc qConvertToRGBA32F[] = { |
2290 | | nullptr, |
2291 | | convertIndexedTo<QRgbaFloat32>, |
2292 | | convertIndexedTo<QRgbaFloat32>, |
2293 | | convertIndexedTo<QRgbaFloat32>, |
2294 | | convertGenericToRGBA32F<QImage::Format_RGB32>, |
2295 | | convertARGB32ToRGBA32F, |
2296 | | convertGenericToRGBA32F<QImage::Format_ARGB32_Premultiplied>, |
2297 | | convertGenericToRGBA32F<QImage::Format_RGB16>, |
2298 | | convertGenericToRGBA32F<QImage::Format_ARGB8565_Premultiplied>, |
2299 | | convertGenericToRGBA32F<QImage::Format_RGB666>, |
2300 | | convertGenericToRGBA32F<QImage::Format_ARGB6666_Premultiplied>, |
2301 | | convertGenericToRGBA32F<QImage::Format_RGB555>, |
2302 | | convertGenericToRGBA32F<QImage::Format_ARGB8555_Premultiplied>, |
2303 | | convertGenericToRGBA32F<QImage::Format_RGB888>, |
2304 | | convertGenericToRGBA32F<QImage::Format_RGB444>, |
2305 | | convertGenericToRGBA32F<QImage::Format_ARGB4444_Premultiplied>, |
2306 | | convertGenericToRGBA32F<QImage::Format_RGBX8888>, |
2307 | | convertRGBA8888ToRGBA32F, |
2308 | | convertGenericToRGBA32F<QImage::Format_RGBA8888_Premultiplied>, |
2309 | | convertRGB30ToRGBA32F<PixelOrderBGR>, |
2310 | | convertRGB30ToRGBA32F<PixelOrderBGR>, |
2311 | | convertRGB30ToRGBA32F<PixelOrderRGB>, |
2312 | | convertRGB30ToRGBA32F<PixelOrderRGB>, |
2313 | | convertAlpha8To<QRgbaFloat32>, |
2314 | | convertGrayscale8To<QRgbaFloat32>, |
2315 | | nullptr, |
2316 | | nullptr, |
2317 | | nullptr, |
2318 | | convertGrayscale16To<QRgbaFloat32>, |
2319 | | convertGenericToRGBA32F<QImage::Format_BGR888>, |
2320 | | nullptr, |
2321 | | nullptr, |
2322 | | nullptr, |
2323 | | nullptr, |
2324 | | nullptr, |
2325 | | nullptr, |
2326 | | convertCMYKToRGBA32F, |
2327 | | }; |
2328 | | |
2329 | | static_assert(std::size(qConvertToRGBA32F) == QImage::NImageFormats); |
2330 | | |
2331 | | static const QRgbaFloat32 *QT_FASTCALL fetchRGBX64ToRGBA32F(QRgbaFloat32 *buffer, const uchar *src, int index, int count, |
2332 | | const QList<QRgb> *, QDitherInfo *) |
2333 | 0 | { |
2334 | 0 | const QRgba64 *s = reinterpret_cast<const QRgba64 *>(src) + index; |
2335 | 0 | for (int i = 0; i < count; ++i) { |
2336 | 0 | QRgba64 c = s[i]; |
2337 | 0 | buffer[i] = QRgbaFloat32::fromRgba64(c.red(), c.green(), c.blue(), 65535); |
2338 | 0 | } |
2339 | 0 | return buffer; |
2340 | 0 | } |
2341 | | |
2342 | | static const QRgbaFloat32 *QT_FASTCALL fetchRGBA64ToRGBA32F(QRgbaFloat32 *buffer, const uchar *src, int index, int count, |
2343 | | const QList<QRgb> *, QDitherInfo *) |
2344 | 0 | { |
2345 | 0 | const QRgba64 *s = reinterpret_cast<const QRgba64 *>(src) + index; |
2346 | 0 | for (int i = 0; i < count; ++i) |
2347 | 0 | buffer[i] = qConvertRgb64ToRgbaF32(s[i]).premultiplied(); |
2348 | 0 | return buffer; |
2349 | 0 | } |
2350 | | |
2351 | | static const QRgbaFloat32 *QT_FASTCALL fetchRGBA64PMToRGBA32F(QRgbaFloat32 *buffer, const uchar *src, int index, int count, |
2352 | | const QList<QRgb> *, QDitherInfo *) |
2353 | 0 | { |
2354 | 0 | const QRgba64 *s = reinterpret_cast<const QRgba64 *>(src) + index; |
2355 | 0 | for (int i = 0; i < count; ++i) |
2356 | 0 | buffer[i] = qConvertRgb64ToRgbaF32(s[i]); |
2357 | 0 | return buffer; |
2358 | 0 | } |
2359 | | |
2360 | | static const QRgbaFloat32 *QT_FASTCALL fetchRGBA16FToRGBA32F(QRgbaFloat32 *buffer, const uchar *src, int index, int count, |
2361 | | const QList<QRgb> *, QDitherInfo *) |
2362 | 0 | { |
2363 | 0 | const QRgbaFloat16 *s = reinterpret_cast<const QRgbaFloat16 *>(src) + index; |
2364 | 0 | for (int i = 0; i < count; ++i) { |
2365 | 0 | auto c = s[i].premultiplied(); |
2366 | 0 | buffer[i] = QRgbaFloat32 { c.r, c.g, c.b, c.a}; |
2367 | 0 | } |
2368 | 0 | return buffer; |
2369 | 0 | } |
2370 | | |
2371 | | static const QRgbaFloat32 *QT_FASTCALL fetchRGBA16F(QRgbaFloat32 *buffer, const uchar *src, int index, int count, |
2372 | | const QList<QRgb> *, QDitherInfo *) |
2373 | 0 | { |
2374 | 0 | const QRgbaFloat16 *s = reinterpret_cast<const QRgbaFloat16 *>(src) + index; |
2375 | 0 | qFloatFromFloat16((float *)buffer, (const qfloat16 *)s, count * 4); |
2376 | 0 | return buffer; |
2377 | 0 | } |
2378 | | |
2379 | | static const QRgbaFloat32 *QT_FASTCALL fetchRGBA32FToRGBA32F(QRgbaFloat32 *buffer, const uchar *src, int index, int count, |
2380 | | const QList<QRgb> *, QDitherInfo *) |
2381 | 0 | { |
2382 | 0 | const QRgbaFloat32 *s = reinterpret_cast<const QRgbaFloat32 *>(src) + index; |
2383 | 0 | for (int i = 0; i < count; ++i) |
2384 | 0 | buffer[i] = s[i].premultiplied(); |
2385 | 0 | return buffer; |
2386 | 0 | } |
2387 | | |
2388 | | static const QRgbaFloat32 *QT_FASTCALL fetchRGBA32F(QRgbaFloat32 *, const uchar *src, int index, int, |
2389 | | const QList<QRgb> *, QDitherInfo *) |
2390 | 0 | { |
2391 | 0 | const QRgbaFloat32 *s = reinterpret_cast<const QRgbaFloat32 *>(src) + index; |
2392 | 0 | return s; |
2393 | 0 | } |
2394 | | |
2395 | | static const QRgbaFloat32 *QT_FASTCALL fetchCMYKToRGBA32F(QRgbaFloat32 *buffer, const uchar *src, int index, int count, |
2396 | | const QList<QRgb> *, QDitherInfo *) |
2397 | 0 | { |
2398 | 0 | const uint *s = reinterpret_cast<const uint *>(src) + index; |
2399 | 0 | for (int i = 0; i < count; ++i) |
2400 | 0 | buffer[i] = QRgbaFloat32::fromArgb32(QCmyk32::fromCmyk32(s[i]).toColor().rgba()); |
2401 | |
|
2402 | 0 | return buffer; |
2403 | 0 | } |
2404 | | |
2405 | | FetchAndConvertPixelsFuncFP qFetchToRGBA32F[] = { |
2406 | | nullptr, |
2407 | | fetchIndexedToRGBA32F<QPixelLayout::BPP1MSB>, |
2408 | | fetchIndexedToRGBA32F<QPixelLayout::BPP1LSB>, |
2409 | | fetchIndexedToRGBA32F<QPixelLayout::BPP8>, |
2410 | | fetchRGBToRGB32F<QImage::Format_RGB32>, |
2411 | | fetchARGBToRGBA32F<QImage::Format_ARGB32>, |
2412 | | fetchARGBPMToRGBA32F<QImage::Format_ARGB32_Premultiplied>, |
2413 | | fetchRGBToRGB32F<QImage::Format_RGB16>, |
2414 | | fetchARGBToRGBA32F<QImage::Format_ARGB8565_Premultiplied>, |
2415 | | fetchRGBToRGB32F<QImage::Format_RGB666>, |
2416 | | fetchARGBToRGBA32F<QImage::Format_ARGB6666_Premultiplied>, |
2417 | | fetchRGBToRGB32F<QImage::Format_RGB555>, |
2418 | | fetchARGBToRGBA32F<QImage::Format_ARGB8555_Premultiplied>, |
2419 | | fetchRGBToRGB32F<QImage::Format_RGB888>, |
2420 | | fetchRGBToRGB32F<QImage::Format_RGB444>, |
2421 | | fetchARGBToRGBA32F<QImage::Format_ARGB4444_Premultiplied>, |
2422 | | fetchRGBToRGB32F<QImage::Format_RGBX8888>, |
2423 | | fetchARGBToRGBA32F<QImage::Format_RGBA8888>, |
2424 | | fetchARGBPMToRGBA32F<QImage::Format_RGBA8888_Premultiplied>, |
2425 | | fetchRGB30ToRGBA32F<PixelOrderBGR>, |
2426 | | fetchRGB30ToRGBA32F<PixelOrderBGR>, |
2427 | | fetchRGB30ToRGBA32F<PixelOrderRGB>, |
2428 | | fetchRGB30ToRGBA32F<PixelOrderRGB>, |
2429 | | fetchAlpha8To<QRgbaFloat32>, |
2430 | | fetchGrayscale8To<QRgbaFloat32>, |
2431 | | fetchRGBX64ToRGBA32F, |
2432 | | fetchRGBA64ToRGBA32F, |
2433 | | fetchRGBA64PMToRGBA32F, |
2434 | | fetchGrayscale16To<QRgbaFloat32>, |
2435 | | fetchRGBToRGB32F<QImage::Format_BGR888>, |
2436 | | fetchRGBA16F, |
2437 | | fetchRGBA16FToRGBA32F, |
2438 | | fetchRGBA16F, |
2439 | | fetchRGBA32F, |
2440 | | fetchRGBA32FToRGBA32F, |
2441 | | fetchRGBA32F, |
2442 | | fetchCMYKToRGBA32F, |
2443 | | }; |
2444 | | |
2445 | | static_assert(std::size(qFetchToRGBA32F) == QImage::NImageFormats); |
2446 | | |
2447 | | static void QT_FASTCALL convertFromRgba32f(uint *dest, const QRgbaFloat32 *src, int length) |
2448 | 0 | { |
2449 | 0 | for (int i = 0; i < length; ++i) |
2450 | 0 | dest[i] = src[i].toArgb32(); |
2451 | 0 | } |
2452 | | |
2453 | | template<QImage::Format format> |
2454 | | static void QT_FASTCALL storeGenericFromRGBA32F(uchar *dest, const QRgbaFloat32 *src, int index, int count, |
2455 | | const QList<QRgb> *clut, QDitherInfo *dither) |
2456 | 0 | { |
2457 | 0 | Q_DECL_UNINITIALIZED uint buffer[BufferSize]; |
2458 | 0 | convertFromRgba32f(buffer, src, count); |
2459 | 0 | qPixelLayouts[format].storeFromARGB32PM(dest, buffer, index, count, clut, dither); |
2460 | 0 | } Unexecuted instantiation: qpixellayout.cpp:void storeGenericFromRGBA32F<(QImage::Format)4>(unsigned char*, QRgbaFloat<float> const*, int, int, QList<unsigned int> const*, QDitherInfo*) Unexecuted instantiation: qpixellayout.cpp:void storeGenericFromRGBA32F<(QImage::Format)6>(unsigned char*, QRgbaFloat<float> const*, int, int, QList<unsigned int> const*, QDitherInfo*) Unexecuted instantiation: qpixellayout.cpp:void storeGenericFromRGBA32F<(QImage::Format)7>(unsigned char*, QRgbaFloat<float> const*, int, int, QList<unsigned int> const*, QDitherInfo*) Unexecuted instantiation: qpixellayout.cpp:void storeGenericFromRGBA32F<(QImage::Format)8>(unsigned char*, QRgbaFloat<float> const*, int, int, QList<unsigned int> const*, QDitherInfo*) Unexecuted instantiation: qpixellayout.cpp:void storeGenericFromRGBA32F<(QImage::Format)9>(unsigned char*, QRgbaFloat<float> const*, int, int, QList<unsigned int> const*, QDitherInfo*) Unexecuted instantiation: qpixellayout.cpp:void storeGenericFromRGBA32F<(QImage::Format)10>(unsigned char*, QRgbaFloat<float> const*, int, int, QList<unsigned int> const*, QDitherInfo*) Unexecuted instantiation: qpixellayout.cpp:void storeGenericFromRGBA32F<(QImage::Format)11>(unsigned char*, QRgbaFloat<float> const*, int, int, QList<unsigned int> const*, QDitherInfo*) Unexecuted instantiation: qpixellayout.cpp:void storeGenericFromRGBA32F<(QImage::Format)12>(unsigned char*, QRgbaFloat<float> const*, int, int, QList<unsigned int> const*, QDitherInfo*) Unexecuted instantiation: qpixellayout.cpp:void storeGenericFromRGBA32F<(QImage::Format)13>(unsigned char*, QRgbaFloat<float> const*, int, int, QList<unsigned int> const*, QDitherInfo*) Unexecuted instantiation: qpixellayout.cpp:void storeGenericFromRGBA32F<(QImage::Format)14>(unsigned char*, QRgbaFloat<float> const*, int, int, QList<unsigned int> const*, QDitherInfo*) Unexecuted instantiation: qpixellayout.cpp:void storeGenericFromRGBA32F<(QImage::Format)15>(unsigned char*, QRgbaFloat<float> const*, int, int, QList<unsigned int> const*, QDitherInfo*) Unexecuted instantiation: qpixellayout.cpp:void storeGenericFromRGBA32F<(QImage::Format)16>(unsigned char*, QRgbaFloat<float> const*, int, int, QList<unsigned int> const*, QDitherInfo*) Unexecuted instantiation: qpixellayout.cpp:void storeGenericFromRGBA32F<(QImage::Format)18>(unsigned char*, QRgbaFloat<float> const*, int, int, QList<unsigned int> const*, QDitherInfo*) Unexecuted instantiation: qpixellayout.cpp:void storeGenericFromRGBA32F<(QImage::Format)23>(unsigned char*, QRgbaFloat<float> const*, int, int, QList<unsigned int> const*, QDitherInfo*) Unexecuted instantiation: qpixellayout.cpp:void storeGenericFromRGBA32F<(QImage::Format)24>(unsigned char*, QRgbaFloat<float> const*, int, int, QList<unsigned int> const*, QDitherInfo*) Unexecuted instantiation: qpixellayout.cpp:void storeGenericFromRGBA32F<(QImage::Format)29>(unsigned char*, QRgbaFloat<float> const*, int, int, QList<unsigned int> const*, QDitherInfo*) |
2461 | | |
2462 | | static void QT_FASTCALL storeARGB32FromRGBA32F(uchar *dest, const QRgbaFloat32 *src, int index, int count, |
2463 | | const QList<QRgb> *, QDitherInfo *) |
2464 | 0 | { |
2465 | 0 | uint *d = (uint*)dest + index; |
2466 | 0 | for (int i = 0; i < count; ++i) |
2467 | 0 | d[i] = src[i].unpremultiplied().toArgb32(); |
2468 | 0 | } |
2469 | | |
2470 | | static void QT_FASTCALL storeRGBA8888FromRGBA32F(uchar *dest, const QRgbaFloat32 *src, int index, int count, |
2471 | | const QList<QRgb> *, QDitherInfo *) |
2472 | 0 | { |
2473 | 0 | uint *d = (uint*)dest + index; |
2474 | 0 | for (int i = 0; i < count; ++i) |
2475 | 0 | d[i] = ARGB2RGBA(src[i].unpremultiplied().toArgb32()); |
2476 | 0 | } |
2477 | | |
2478 | | template<QtPixelOrder PixelOrder> |
2479 | | static void QT_FASTCALL storeRGB30FromRGBA32F(uchar *dest, const QRgbaFloat32 *src, int index, int count, |
2480 | | const QList<QRgb> *, QDitherInfo *) |
2481 | 0 | { |
2482 | 0 | uint *d = (uint*)dest + index; |
2483 | 0 | for (int i = 0; i < count; ++i) { |
2484 | 0 | const auto s = src[i]; |
2485 | 0 | d[i] = qConvertRgb64ToRgb30<PixelOrder>(QRgba64::fromRgba64(s.red16(), s.green16(), s.blue16(), s.alpha16())); |
2486 | 0 | } |
2487 | 0 | } Unexecuted instantiation: qpixellayout.cpp:void storeRGB30FromRGBA32F<(QtPixelOrder)1>(unsigned char*, QRgbaFloat<float> const*, int, int, QList<unsigned int> const*, QDitherInfo*) Unexecuted instantiation: qpixellayout.cpp:void storeRGB30FromRGBA32F<(QtPixelOrder)0>(unsigned char*, QRgbaFloat<float> const*, int, int, QList<unsigned int> const*, QDitherInfo*) |
2488 | | |
2489 | | static void QT_FASTCALL storeRGBX64FromRGBA32F(uchar *dest, const QRgbaFloat32 *src, int index, int count, |
2490 | | const QList<QRgb> *, QDitherInfo *) |
2491 | 0 | { |
2492 | 0 | QRgba64 *d = reinterpret_cast<QRgba64 *>(dest) + index; |
2493 | 0 | for (int i = 0; i < count; ++i) { |
2494 | 0 | const auto s = src[i].unpremultiplied(); |
2495 | 0 | d[i] = QRgba64::fromRgba64(s.red16(), s.green16(), s.blue16(), 65535); |
2496 | 0 | } |
2497 | 0 | } |
2498 | | |
2499 | | static void QT_FASTCALL storeRGBA64FromRGBA32F(uchar *dest, const QRgbaFloat32 *src, int index, int count, |
2500 | | const QList<QRgb> *, QDitherInfo *) |
2501 | 0 | { |
2502 | 0 | QRgba64 *d = reinterpret_cast<QRgba64 *>(dest) + index; |
2503 | 0 | for (int i = 0; i < count; ++i) { |
2504 | 0 | const auto s = src[i].unpremultiplied(); |
2505 | 0 | d[i] = QRgba64::fromRgba64(s.red16(), s.green16(), s.blue16(), s.alpha16()); |
2506 | 0 | } |
2507 | 0 | } |
2508 | | |
2509 | | static void QT_FASTCALL storeRGBA64PMFromRGBA32F(uchar *dest, const QRgbaFloat32 *src, int index, int count, |
2510 | | const QList<QRgb> *, QDitherInfo *) |
2511 | 0 | { |
2512 | 0 | QRgba64 *d = reinterpret_cast<QRgba64 *>(dest) + index; |
2513 | 0 | for (int i = 0; i < count; ++i) |
2514 | 0 | d[i] = QRgba64::fromRgba64(src[i].red16(), src[i].green16(), src[i].blue16(), src[i].alpha16()); |
2515 | 0 | } |
2516 | | |
2517 | | static void QT_FASTCALL storeGray16FromRGBA32F(uchar *dest, const QRgbaFloat32 *src, int index, int count, |
2518 | | const QList<QRgb> *, QDitherInfo *) |
2519 | 0 | { |
2520 | 0 | quint16 *d = reinterpret_cast<quint16 *>(dest) + index; |
2521 | 0 | for (int i = 0; i < count; ++i) { |
2522 | 0 | auto s = src[i].unpremultiplied(); |
2523 | 0 | d[i] = qGray(s.red16(), s.green16(), s.blue16()); |
2524 | 0 | } |
2525 | 0 | } |
2526 | | |
2527 | | static void QT_FASTCALL storeRGBX16FFromRGBA32F(uchar *dest, const QRgbaFloat32 *src, int index, int count, |
2528 | | const QList<QRgb> *, QDitherInfo *) |
2529 | 0 | { |
2530 | 0 | QRgbaFloat16 *d = reinterpret_cast<QRgbaFloat16 *>(dest) + index; |
2531 | 0 | for (int i = 0; i < count; ++i) { |
2532 | 0 | auto s = src[i].unpremultiplied(); |
2533 | 0 | d[i] = QRgbaFloat16{ qfloat16(s.r), qfloat16(s.g), qfloat16(s.b), qfloat16(1.0f) }; |
2534 | 0 | } |
2535 | 0 | } |
2536 | | |
2537 | | static void QT_FASTCALL storeRGBA16FFromRGBA32F(uchar *dest, const QRgbaFloat32 *src, int index, int count, |
2538 | | const QList<QRgb> *, QDitherInfo *) |
2539 | 0 | { |
2540 | 0 | QRgbaFloat16 *d = reinterpret_cast<QRgbaFloat16 *>(dest) + index; |
2541 | 0 | for (int i = 0; i < count; ++i) { |
2542 | 0 | auto s = src[i].unpremultiplied(); |
2543 | 0 | d[i] = QRgbaFloat16{ qfloat16(s.r), qfloat16(s.g), qfloat16(s.b), qfloat16(s.a) }; |
2544 | 0 | } |
2545 | 0 | } |
2546 | | |
2547 | | static void QT_FASTCALL storeRGBA16FPMFromRGBA32F(uchar *dest, const QRgbaFloat32 *src, int index, int count, |
2548 | | const QList<QRgb> *, QDitherInfo *) |
2549 | 0 | { |
2550 | 0 | QRgbaFloat16 *d = reinterpret_cast<QRgbaFloat16 *>(dest) + index; |
2551 | 0 | qFloatToFloat16((qfloat16 *)d, (const float *)src, count * 4); |
2552 | 0 | } |
2553 | | |
2554 | | static void QT_FASTCALL storeRGBX32FFromRGBA32F(uchar *dest, const QRgbaFloat32 *src, int index, int count, |
2555 | | const QList<QRgb> *, QDitherInfo *) |
2556 | 0 | { |
2557 | 0 | QRgbaFloat32 *d = reinterpret_cast<QRgbaFloat32 *>(dest) + index; |
2558 | 0 | for (int i = 0; i < count; ++i) { |
2559 | 0 | auto s = src[i].unpremultiplied(); |
2560 | 0 | s.a = 1.0f; |
2561 | 0 | d[i] = s; |
2562 | 0 | } |
2563 | 0 | } |
2564 | | |
2565 | | static void QT_FASTCALL storeRGBA32FFromRGBA32F(uchar *dest, const QRgbaFloat32 *src, int index, int count, |
2566 | | const QList<QRgb> *, QDitherInfo *) |
2567 | 0 | { |
2568 | 0 | QRgbaFloat32 *d = reinterpret_cast<QRgbaFloat32 *>(dest) + index; |
2569 | 0 | for (int i = 0; i < count; ++i) |
2570 | 0 | d[i] = src[i].unpremultiplied(); |
2571 | 0 | } |
2572 | | |
2573 | | static void QT_FASTCALL storeRGBA32FPMFromRGBA32F(uchar *dest, const QRgbaFloat32 *src, int index, int count, |
2574 | | const QList<QRgb> *, QDitherInfo *) |
2575 | 0 | { |
2576 | 0 | QRgbaFloat32 *d = reinterpret_cast<QRgbaFloat32 *>(dest) + index; |
2577 | 0 | if (d != src) { |
2578 | 0 | for (int i = 0; i < count; ++i) |
2579 | 0 | d[i] = src[i]; |
2580 | 0 | } |
2581 | 0 | } |
2582 | | |
2583 | | static void QT_FASTCALL storeCMYKFromRGBA32F(uchar *dest, const QRgbaFloat32 *src, int index, int count, |
2584 | | const QList<QRgb> *, QDitherInfo *) |
2585 | 0 | { |
2586 | 0 | uint *d = reinterpret_cast<uint *>(dest) + index; |
2587 | 0 | for (int i = 0; i < count; ++i) { |
2588 | | // Yikes, this really needs enablers in QColor and friends |
2589 | 0 | d[i] = QCmyk32::fromColor(QColor(src[i].toArgb32())).toUint(); |
2590 | 0 | } |
2591 | 0 | } |
2592 | | |
2593 | | ConvertAndStorePixelsFuncFP qStoreFromRGBA32F[] = { |
2594 | | nullptr, |
2595 | | nullptr, |
2596 | | nullptr, |
2597 | | nullptr, |
2598 | | storeGenericFromRGBA32F<QImage::Format_RGB32>, |
2599 | | storeARGB32FromRGBA32F, |
2600 | | storeGenericFromRGBA32F<QImage::Format_ARGB32_Premultiplied>, |
2601 | | storeGenericFromRGBA32F<QImage::Format_RGB16>, |
2602 | | storeGenericFromRGBA32F<QImage::Format_ARGB8565_Premultiplied>, |
2603 | | storeGenericFromRGBA32F<QImage::Format_RGB666>, |
2604 | | storeGenericFromRGBA32F<QImage::Format_ARGB6666_Premultiplied>, |
2605 | | storeGenericFromRGBA32F<QImage::Format_RGB555>, |
2606 | | storeGenericFromRGBA32F<QImage::Format_ARGB8555_Premultiplied>, |
2607 | | storeGenericFromRGBA32F<QImage::Format_RGB888>, |
2608 | | storeGenericFromRGBA32F<QImage::Format_RGB444>, |
2609 | | storeGenericFromRGBA32F<QImage::Format_ARGB4444_Premultiplied>, |
2610 | | storeGenericFromRGBA32F<QImage::Format_RGBX8888>, |
2611 | | storeRGBA8888FromRGBA32F, |
2612 | | storeGenericFromRGBA32F<QImage::Format_RGBA8888_Premultiplied>, |
2613 | | storeRGB30FromRGBA32F<PixelOrderBGR>, |
2614 | | storeRGB30FromRGBA32F<PixelOrderBGR>, |
2615 | | storeRGB30FromRGBA32F<PixelOrderRGB>, |
2616 | | storeRGB30FromRGBA32F<PixelOrderRGB>, |
2617 | | storeGenericFromRGBA32F<QImage::Format_Alpha8>, |
2618 | | storeGenericFromRGBA32F<QImage::Format_Grayscale8>, |
2619 | | storeRGBX64FromRGBA32F, |
2620 | | storeRGBA64FromRGBA32F, |
2621 | | storeRGBA64PMFromRGBA32F, |
2622 | | storeGray16FromRGBA32F, |
2623 | | storeGenericFromRGBA32F<QImage::Format_BGR888>, |
2624 | | storeRGBX16FFromRGBA32F, |
2625 | | storeRGBA16FFromRGBA32F, |
2626 | | storeRGBA16FPMFromRGBA32F, |
2627 | | storeRGBX32FFromRGBA32F, |
2628 | | storeRGBA32FFromRGBA32F, |
2629 | | storeRGBA32FPMFromRGBA32F, |
2630 | | storeCMYKFromRGBA32F, |
2631 | | }; |
2632 | | |
2633 | | static_assert(std::size(qStoreFromRGBA32F) == QImage::NImageFormats); |
2634 | | |
2635 | | #endif // QT_CONFIG(raster_fp) |
2636 | | |
2637 | | QT_END_NAMESPACE |