Coverage Report

Created: 2025-07-16 07:53

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