43 #include <private/qimage_p.h> 44 #include <private/qsimd_p.h> 59 const int offsetToAlignOn16Bytes = (4 - ((
reinterpret_cast<quintptr>(dst) >> 2) & 0x3)) & 0x3;
60 const int prologLength =
qMin(len, offsetToAlignOn16Bytes);
62 for (
int i = 0; i < prologLength; ++i) {
63 *dst++ =
qRgb(src[0], src[1], src[2]);
68 const __m128i shuffleMask = _mm_set_epi8(0xff, 9, 10, 11, 0xff, 6, 7, 8, 0xff, 3, 4, 5, 0xff, 0, 1, 2);
71 const __m128i shuffleMaskEnd = _mm_set_epi8(0xff, 13, 14, 15, 0xff, 10, 11, 12, 0xff, 7, 8, 9, 0xff, 4, 5, 6);
74 const __m128i alphaMask = _mm_set1_epi32(0xff000000);
76 __m128i *inVectorPtr = (__m128i *)src;
77 __m128i *dstVectorPtr = (__m128i *)dst;
79 const int simdRoundCount = (len - prologLength) / 16;
80 for (
int i = 0; i < simdRoundCount; ++i) {
91 __m128i firstSrcVector = _mm_lddqu_si128(inVectorPtr);
92 __m128i outputVector = _mm_shuffle_epi8(firstSrcVector, shuffleMask);
93 _mm_store_si128(dstVectorPtr, _mm_or_si128(outputVector, alphaMask));
99 __m128i secondSrcVector = _mm_lddqu_si128(inVectorPtr);
100 __m128i srcVector = _mm_alignr_epi8(secondSrcVector, firstSrcVector, 12);
101 outputVector = _mm_shuffle_epi8(srcVector, shuffleMask);
102 _mm_store_si128(dstVectorPtr, _mm_or_si128(outputVector, alphaMask));
105 firstSrcVector = secondSrcVector;
108 secondSrcVector = _mm_lddqu_si128(inVectorPtr);
109 srcVector = _mm_alignr_epi8(secondSrcVector, firstSrcVector, 8);
110 outputVector = _mm_shuffle_epi8(srcVector, shuffleMask);
111 _mm_store_si128(dstVectorPtr, _mm_or_si128(outputVector, alphaMask));
117 outputVector = _mm_shuffle_epi8(secondSrcVector, shuffleMaskEnd);
118 _mm_store_si128(dstVectorPtr, _mm_or_si128(outputVector, alphaMask));
121 src = (
uchar *)inVectorPtr;
125 *dst++ =
qRgb(src[0], src[1], src[2]);
130 void convert_RGB888_to_RGB32_ssse3(
QImageData *dest,
const QImageData *src, Qt::ImageConversionFlags)
140 for (
int i = 0; i < src->
height; ++i) {
141 qt_convert_rgb888_to_rgb32_ssse3(dest_data, src_data, src->
width);
149 #endif // QT_HAVE_SSSE3
QIntegerForSizeof< void * >::Unsigned quintptr
Q_DECL_CONSTEXPR const T & qMin(const T &a, const T &b)
#define QT_END_NAMESPACE
This macro expands to.
#define QT_BEGIN_NAMESPACE
This macro expands to.
QRgb qRgb(int r, int g, int b)
Returns the ARGB quadruplet (255, {r}, {g}, {b}).
static const KeyPair *const end