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