OpenCoverage

qdrawhelper_sse2.cpp

Absolute File Name:/home/qt/qt5_coco/qt5/qtbase/src/gui/painting/qdrawhelper_sse2.cpp
Switch to Source codePreprocessed file
LineSourceCount
1-
2-
3-
4-
5-
6-
7-
8-
9void qt_blend_argb32_on_argb32_sse2(uchar *destPixels, int dbpl,-
10 const uchar *srcPixels, int sbpl,-
11 int w, int h,-
12 int const_alpha)-
13{-
14 const quint32 *src = (const quint32 *) srcPixels;-
15 quint32 *dst = (quint32 *) destPixels;-
16 if (const_alpha == 256
const_alpha == 256Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
17 const __m128i alphaMask = _mm_set1_epi32(0xff000000);-
18 const __m128i nullVector = _mm_set1_epi32(0);-
19 const __m128i half = _mm_set1_epi16(0x80);-
20 const __m128i one = _mm_set1_epi16(0xff);-
21 const __m128i colorMask = _mm_set1_epi32(0x00ff00ff);-
22 for (int y = 0; y < h
y < hDescription
TRUEnever evaluated
FALSEnever evaluated
; ++y) {
0
23 { int x = 0; for (; x < static_cast<int>(qMin(static_cast<quintptr>(w), ((4 - ((reinterpret_cast<quintptr>(dst) >> 2) & 0x3)) & 0x3)))
x < static_cas...0x3)) & 0x3)))Description
TRUEnever evaluated
FALSEnever evaluated
; ++x) { uint s = src[x]; if (s >= 0xff000000
s >= 0xff000000Description
TRUEnever evaluated
FALSEnever evaluated
) dst[x] = s;
never executed: dst[x] = s;
else if (s != 0
s != 0Description
TRUEnever evaluated
FALSEnever evaluated
) dst[x] = s + BYTE_MUL(dst[x], qAlpha(~s));
never executed: dst[x] = s + BYTE_MUL(dst[x], qAlpha(~s));
}
never executed: end of block
for (; x < w-3
x < w-3Description
TRUEnever evaluated
FALSEnever evaluated
; x += 4) { const __m128i srcVector = _mm_loadu_si128((const __m128i *)&src[x]); { const __m128i srcVectorAlpha = _mm_and_si128(srcVector, alphaMask); if (_mm_movemask_epi8(_mm_cmpeq_epi32(srcVectorAlpha, alphaMask)) == 0xffff
_mm_movemask_e...sk)) == 0xffffDescription
TRUEnever evaluated
FALSEnever evaluated
) { _mm_store_si128((__m128i *)&dst[x], srcVector); }
never executed: end of block
else if (_mm_movemask_epi8(_mm_cmpeq_epi32(srcVectorAlpha, nullVector)) != 0xffff
_mm_movemask_e...or)) != 0xffffDescription
TRUEnever evaluated
FALSEnever evaluated
) { __m128i alphaChannel = _mm_srli_epi32(srcVector, 24); alphaChannel = _mm_or_si128(alphaChannel, _mm_slli_epi32(alphaChannel, 16)); alphaChannel = _mm_sub_epi16(one, alphaChannel); const __m128i dstVector = _mm_load_si128((__m128i *)&dst[x]); __m128i destMultipliedByOneMinusAlpha; { __m128i pixelVectorAG = _mm_srli_epi16(dstVector, 8); __m128i pixelVectorRB = _mm_and_si128(dstVector, colorMask); pixelVectorAG = _mm_mullo_epi16(pixelVectorAG, alphaChannel); pixelVectorRB = _mm_mullo_epi16(pixelVectorRB, alphaChannel); pixelVectorRB = _mm_add_epi16(pixelVectorRB, _mm_srli_epi16(pixelVectorRB, 8)); pixelVectorRB = _mm_add_epi16(pixelVectorRB, half); pixelVectorAG = _mm_add_epi16(pixelVectorAG, _mm_srli_epi16(pixelVectorAG, 8)); pixelVectorAG = _mm_add_epi16(pixelVectorAG, half); pixelVectorRB = _mm_srli_epi16(pixelVectorRB, 8); pixelVectorAG = _mm_andnot_si128(colorMask, pixelVectorAG); destMultipliedByOneMinusAlpha = _mm_or_si128(pixelVectorAG, pixelVectorRB); }; const __m128i result = _mm_add_epi8(srcVector, destMultipliedByOneMinusAlpha); _mm_store_si128((__m128i *)&dst[x], result); }
never executed: end of block
} }
never executed: end of block
for (; x < w
x < wDescription
TRUEnever evaluated
FALSEnever evaluated
; ++x) { uint s = src[x]; if (s >= 0xff000000
s >= 0xff000000Description
TRUEnever evaluated
FALSEnever evaluated
) dst[x] = s;
never executed: dst[x] = s;
else if (s != 0
s != 0Description
TRUEnever evaluated
FALSEnever evaluated
) dst[x] = s + BYTE_MUL(dst[x], qAlpha(~s));
never executed: dst[x] = s + BYTE_MUL(dst[x], qAlpha(~s));
}
never executed: end of block
};
0
24 dst = (quint32 *)(((uchar *) dst) + dbpl);-
25 src = (const quint32 *)(((const uchar *) src) + sbpl);-
26 }
never executed: end of block
0
27 }
never executed: end of block
else if (const_alpha != 0
const_alpha != 0Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
28-
29-
30-
31 const_alpha = (const_alpha * 255) >> 8;-
32 const __m128i nullVector = _mm_set1_epi32(0);-
33 const __m128i half = _mm_set1_epi16(0x80);-
34 const __m128i one = _mm_set1_epi16(0xff);-
35 const __m128i colorMask = _mm_set1_epi32(0x00ff00ff);-
36 const __m128i constAlphaVector = _mm_set1_epi16(const_alpha);-
37 for (int y = 0; y < h
y < hDescription
TRUEnever evaluated
FALSEnever evaluated
; ++y) {
0
38 { int x = 0; for (; x < static_cast<int>(qMin(static_cast<quintptr>(w), ((4 - ((reinterpret_cast<quintptr>(dst) >> 2) & 0x3)) & 0x3)))
x < static_cas...0x3)) & 0x3)))Description
TRUEnever evaluated
FALSEnever evaluated
; ++x) { quint32 s = src[x]; if (s != 0
s != 0Description
TRUEnever evaluated
FALSEnever evaluated
) { s = BYTE_MUL(s, const_alpha); dst[x] = s + BYTE_MUL(dst[x], qAlpha(~s)); }
never executed: end of block
}
never executed: end of block
for (; x < w-3
x < w-3Description
TRUEnever evaluated
FALSEnever evaluated
; x += 4) { __m128i srcVector = _mm_loadu_si128((const __m128i *)&src[x]); if (_mm_movemask_epi8(_mm_cmpeq_epi32(srcVector, nullVector)) != 0xffff
_mm_movemask_e...or)) != 0xffffDescription
TRUEnever evaluated
FALSEnever evaluated
) { { __m128i pixelVectorAG = _mm_srli_epi16(srcVector, 8); __m128i pixelVectorRB = _mm_and_si128(srcVector, colorMask); pixelVectorAG = _mm_mullo_epi16(pixelVectorAG, constAlphaVector); pixelVectorRB = _mm_mullo_epi16(pixelVectorRB, constAlphaVector); pixelVectorRB = _mm_add_epi16(pixelVectorRB, _mm_srli_epi16(pixelVectorRB, 8)); pixelVectorRB = _mm_add_epi16(pixelVectorRB, half); pixelVectorAG = _mm_add_epi16(pixelVectorAG, _mm_srli_epi16(pixelVectorAG, 8)); pixelVectorAG = _mm_add_epi16(pixelVectorAG, half); pixelVectorRB = _mm_srli_epi16(pixelVectorRB, 8); pixelVectorAG = _mm_andnot_si128(colorMask, pixelVectorAG); srcVector = _mm_or_si128(pixelVectorAG, pixelVectorRB); }; __m128i alphaChannel = _mm_srli_epi32(srcVector, 24); alphaChannel = _mm_or_si128(alphaChannel, _mm_slli_epi32(alphaChannel, 16)); alphaChannel = _mm_sub_epi16(one, alphaChannel); const __m128i dstVector = _mm_load_si128((__m128i *)&dst[x]); __m128i destMultipliedByOneMinusAlpha; { __m128i pixelVectorAG = _mm_srli_epi16(dstVector, 8); __m128i pixelVectorRB = _mm_and_si128(dstVector, colorMask); pixelVectorAG = _mm_mullo_epi16(pixelVectorAG, alphaChannel); pixelVectorRB = _mm_mullo_epi16(pixelVectorRB, alphaChannel); pixelVectorRB = _mm_add_epi16(pixelVectorRB, _mm_srli_epi16(pixelVectorRB, 8)); pixelVectorRB = _mm_add_epi16(pixelVectorRB, half); pixelVectorAG = _mm_add_epi16(pixelVectorAG, _mm_srli_epi16(pixelVectorAG, 8)); pixelVectorAG = _mm_add_epi16(pixelVectorAG, half); pixelVectorRB = _mm_srli_epi16(pixelVectorRB, 8); pixelVectorAG = _mm_andnot_si128(colorMask, pixelVectorAG); destMultipliedByOneMinusAlpha = _mm_or_si128(pixelVectorAG, pixelVectorRB); }; const __m128i result = _mm_add_epi8(srcVector, destMultipliedByOneMinusAlpha); _mm_store_si128((__m128i *)&dst[x], result); }
never executed: end of block
}
never executed: end of block
for (; x < w
x < wDescription
TRUEnever evaluated
FALSEnever evaluated
; ++x) { quint32 s = src[x]; if (s != 0
s != 0Description
TRUEnever evaluated
FALSEnever evaluated
) { s = BYTE_MUL(s, const_alpha); dst[x] = s + BYTE_MUL(dst[x], qAlpha(~s)); }
never executed: end of block
}
never executed: end of block
}
0
39 dst = (quint32 *)(((uchar *) dst) + dbpl);-
40 src = (const quint32 *)(((const uchar *) src) + sbpl);-
41 }
never executed: end of block
0
42 }
never executed: end of block
0
43}
never executed: end of block
0
44-
45-
46-
47void qt_blend_rgb32_on_rgb32(uchar *destPixels, int dbpl,-
48 const uchar *srcPixels, int sbpl,-
49 int w, int h,-
50 int const_alpha);-
51-
52void qt_blend_rgb32_on_rgb32_sse2(uchar *destPixels, int dbpl,-
53 const uchar *srcPixels, int sbpl,-
54 int w, int h,-
55 int const_alpha)-
56{-
57 const quint32 *src = (const quint32 *) srcPixels;-
58 quint32 *dst = (quint32 *) destPixels;-
59 if (const_alpha != 256
const_alpha != 256Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
60 if (const_alpha != 0
const_alpha != 0Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
61 const __m128i nullVector = _mm_set1_epi32(0);-
62 const __m128i half = _mm_set1_epi16(0x80);-
63 const __m128i colorMask = _mm_set1_epi32(0x00ff00ff);-
64-
65 const_alpha = (const_alpha * 255) >> 8;-
66 int one_minus_const_alpha = 255 - const_alpha;-
67 const __m128i constAlphaVector = _mm_set1_epi16(const_alpha);-
68 const __m128i oneMinusConstAlpha = _mm_set1_epi16(one_minus_const_alpha);-
69 for (int y = 0; y < h
y < hDescription
TRUEnever evaluated
FALSEnever evaluated
; ++y) {
0
70 int x = 0;-
71-
72-
73 for (; x < static_cast<int>(qMin(static_cast<quintptr>(w), ((4 - ((reinterpret_cast<quintptr>(dst) >> 2) & 0x3)) & 0x3)))
x < static_cas...0x3)) & 0x3)))Description
TRUEnever evaluated
FALSEnever evaluated
; ++x) {
0
74 dst[x] = INTERPOLATE_PIXEL_255(src[x], const_alpha, dst[x], one_minus_const_alpha);-
75 }
never executed: end of block
0
76-
77 for (; x < w-3
x < w-3Description
TRUEnever evaluated
FALSEnever evaluated
; x += 4) {
0
78 __m128i srcVector = _mm_loadu_si128((const __m128i *)&src[x]);-
79 if (_mm_movemask_epi8(_mm_cmpeq_epi32(srcVector, nullVector)) != 0xffff
_mm_movemask_e...or)) != 0xffffDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
80 const __m128i dstVector = _mm_load_si128((__m128i *)&dst[x]);-
81 __m128i result;-
82 { __m128i srcVectorAG = _mm_srli_epi16(srcVector, 8); __m128i dstVectorAG = _mm_srli_epi16(dstVector, 8); __m128i srcVectorAGalpha = _mm_mullo_epi16(srcVectorAG, constAlphaVector); __m128i dstVectorAGoneMinusAlphalpha = _mm_mullo_epi16(dstVectorAG, oneMinusConstAlpha); __m128i finalAG = _mm_add_epi16(srcVectorAGalpha, dstVectorAGoneMinusAlphalpha); finalAG = _mm_add_epi16(finalAG, _mm_srli_epi16(finalAG, 8)); finalAG = _mm_add_epi16(finalAG, half); finalAG = _mm_andnot_si128(colorMask, finalAG); __m128i srcVectorRB = _mm_and_si128(srcVector, colorMask); __m128i dstVectorRB = _mm_and_si128(dstVector, colorMask); __m128i srcVectorRBalpha = _mm_mullo_epi16(srcVectorRB, constAlphaVector); __m128i dstVectorRBoneMinusAlphalpha = _mm_mullo_epi16(dstVectorRB, oneMinusConstAlpha); __m128i finalRB = _mm_add_epi16(srcVectorRBalpha, dstVectorRBoneMinusAlphalpha); finalRB = _mm_add_epi16(finalRB, _mm_srli_epi16(finalRB, 8)); finalRB = _mm_add_epi16(finalRB, half); finalRB = _mm_srli_epi16(finalRB, 8); result = _mm_or_si128(finalAG, finalRB); };-
83 _mm_store_si128((__m128i *)&dst[x], result);-
84 }
never executed: end of block
0
85 }
never executed: end of block
0
86 for (; x<w
x<wDescription
TRUEnever evaluated
FALSEnever evaluated
; ++x) {
0
87 dst[x] = INTERPOLATE_PIXEL_255(src[x], const_alpha, dst[x], one_minus_const_alpha);-
88 }
never executed: end of block
0
89 dst = (quint32 *)(((uchar *) dst) + dbpl);-
90 src = (const quint32 *)(((const uchar *) src) + sbpl);-
91 }
never executed: end of block
0
92 }
never executed: end of block
0
93 }
never executed: end of block
else {
0
94 qt_blend_rgb32_on_rgb32(destPixels, dbpl, srcPixels, sbpl, w, h, const_alpha);-
95 }
never executed: end of block
0
96}-
97-
98void comp_func_SourceOver_sse2(uint *destPixels, const uint *srcPixels, int length, uint const_alpha)-
99{-
100 ((!(const_alpha < 256)) ? qt_assert("const_alpha < 256",__FILE__,143) : qt_noop());-
101-
102 const quint32 *src = (const quint32 *) srcPixels;-
103 quint32 *dst = (quint32 *) destPixels;-
104-
105 const __m128i nullVector = _mm_set1_epi32(0);-
106 const __m128i half = _mm_set1_epi16(0x80);-
107 const __m128i one = _mm_set1_epi16(0xff);-
108 const __m128i colorMask = _mm_set1_epi32(0x00ff00ff);-
109 if (const_alpha == 255
const_alpha == 255Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
110 const __m128i alphaMask = _mm_set1_epi32(0xff000000);-
111 { int x = 0; for (; x < static_cast<int>(qMin(static_cast<quintptr>(length), ((4 - ((reinterpret_cast<quintptr>(dst) >> 2) & 0x3)) & 0x3)))
x < static_cas...0x3)) & 0x3)))Description
TRUEnever evaluated
FALSEnever evaluated
; ++x) { uint s = src[x]; if (s >= 0xff000000
s >= 0xff000000Description
TRUEnever evaluated
FALSEnever evaluated
) dst[x] = s;
never executed: dst[x] = s;
else if (s != 0
s != 0Description
TRUEnever evaluated
FALSEnever evaluated
) dst[x] = s + BYTE_MUL(dst[x], qAlpha(~s));
never executed: dst[x] = s + BYTE_MUL(dst[x], qAlpha(~s));
}
never executed: end of block
for (; x < length-3
x < length-3Description
TRUEnever evaluated
FALSEnever evaluated
; x += 4) { const __m128i srcVector = _mm_loadu_si128((const __m128i *)&src[x]); { const __m128i srcVectorAlpha = _mm_and_si128(srcVector, alphaMask); if (_mm_movemask_epi8(_mm_cmpeq_epi32(srcVectorAlpha, alphaMask)) == 0xffff
_mm_movemask_e...sk)) == 0xffffDescription
TRUEnever evaluated
FALSEnever evaluated
) { _mm_store_si128((__m128i *)&dst[x], srcVector); }
never executed: end of block
else if (_mm_movemask_epi8(_mm_cmpeq_epi32(srcVectorAlpha, nullVector)) != 0xffff
_mm_movemask_e...or)) != 0xffffDescription
TRUEnever evaluated
FALSEnever evaluated
) { __m128i alphaChannel = _mm_srli_epi32(srcVector, 24); alphaChannel = _mm_or_si128(alphaChannel, _mm_slli_epi32(alphaChannel, 16)); alphaChannel = _mm_sub_epi16(one, alphaChannel); const __m128i dstVector = _mm_load_si128((__m128i *)&dst[x]); __m128i destMultipliedByOneMinusAlpha; { __m128i pixelVectorAG = _mm_srli_epi16(dstVector, 8); __m128i pixelVectorRB = _mm_and_si128(dstVector, colorMask); pixelVectorAG = _mm_mullo_epi16(pixelVectorAG, alphaChannel); pixelVectorRB = _mm_mullo_epi16(pixelVectorRB, alphaChannel); pixelVectorRB = _mm_add_epi16(pixelVectorRB, _mm_srli_epi16(pixelVectorRB, 8)); pixelVectorRB = _mm_add_epi16(pixelVectorRB, half); pixelVectorAG = _mm_add_epi16(pixelVectorAG, _mm_srli_epi16(pixelVectorAG, 8)); pixelVectorAG = _mm_add_epi16(pixelVectorAG, half); pixelVectorRB = _mm_srli_epi16(pixelVectorRB, 8); pixelVectorAG = _mm_andnot_si128(colorMask, pixelVectorAG); destMultipliedByOneMinusAlpha = _mm_or_si128(pixelVectorAG, pixelVectorRB); }; const __m128i result = _mm_add_epi8(srcVector, destMultipliedByOneMinusAlpha); _mm_store_si128((__m128i *)&dst[x], result); }
never executed: end of block
} }
never executed: end of block
for (; x < length
x < lengthDescription
TRUEnever evaluated
FALSEnever evaluated
; ++x) { uint s = src[x]; if (s >= 0xff000000
s >= 0xff000000Description
TRUEnever evaluated
FALSEnever evaluated
) dst[x] = s;
never executed: dst[x] = s;
else if (s != 0
s != 0Description
TRUEnever evaluated
FALSEnever evaluated
) dst[x] = s + BYTE_MUL(dst[x], qAlpha(~s));
never executed: dst[x] = s + BYTE_MUL(dst[x], qAlpha(~s));
}
never executed: end of block
};
0
112 }
never executed: end of block
else {
0
113 const __m128i constAlphaVector = _mm_set1_epi16(const_alpha);-
114 { int x = 0; for (; x < static_cast<int>(qMin(static_cast<quintptr>(length), ((4 - ((reinterpret_cast<quintptr>(dst) >> 2) & 0x3)) & 0x3)))
x < static_cas...0x3)) & 0x3)))Description
TRUEnever evaluated
FALSEnever evaluated
; ++x) { quint32 s = src[x]; if (s != 0
s != 0Description
TRUEnever evaluated
FALSEnever evaluated
) { s = BYTE_MUL(s, const_alpha); dst[x] = s + BYTE_MUL(dst[x], qAlpha(~s)); }
never executed: end of block
}
never executed: end of block
for (; x < length-3
x < length-3Description
TRUEnever evaluated
FALSEnever evaluated
; x += 4) { __m128i srcVector = _mm_loadu_si128((const __m128i *)&src[x]); if (_mm_movemask_epi8(_mm_cmpeq_epi32(srcVector, nullVector)) != 0xffff
_mm_movemask_e...or)) != 0xffffDescription
TRUEnever evaluated
FALSEnever evaluated
) { { __m128i pixelVectorAG = _mm_srli_epi16(srcVector, 8); __m128i pixelVectorRB = _mm_and_si128(srcVector, colorMask); pixelVectorAG = _mm_mullo_epi16(pixelVectorAG, constAlphaVector); pixelVectorRB = _mm_mullo_epi16(pixelVectorRB, constAlphaVector); pixelVectorRB = _mm_add_epi16(pixelVectorRB, _mm_srli_epi16(pixelVectorRB, 8)); pixelVectorRB = _mm_add_epi16(pixelVectorRB, half); pixelVectorAG = _mm_add_epi16(pixelVectorAG, _mm_srli_epi16(pixelVectorAG, 8)); pixelVectorAG = _mm_add_epi16(pixelVectorAG, half); pixelVectorRB = _mm_srli_epi16(pixelVectorRB, 8); pixelVectorAG = _mm_andnot_si128(colorMask, pixelVectorAG); srcVector = _mm_or_si128(pixelVectorAG, pixelVectorRB); }; __m128i alphaChannel = _mm_srli_epi32(srcVector, 24); alphaChannel = _mm_or_si128(alphaChannel, _mm_slli_epi32(alphaChannel, 16)); alphaChannel = _mm_sub_epi16(one, alphaChannel); const __m128i dstVector = _mm_load_si128((__m128i *)&dst[x]); __m128i destMultipliedByOneMinusAlpha; { __m128i pixelVectorAG = _mm_srli_epi16(dstVector, 8); __m128i pixelVectorRB = _mm_and_si128(dstVector, colorMask); pixelVectorAG = _mm_mullo_epi16(pixelVectorAG, alphaChannel); pixelVectorRB = _mm_mullo_epi16(pixelVectorRB, alphaChannel); pixelVectorRB = _mm_add_epi16(pixelVectorRB, _mm_srli_epi16(pixelVectorRB, 8)); pixelVectorRB = _mm_add_epi16(pixelVectorRB, half); pixelVectorAG = _mm_add_epi16(pixelVectorAG, _mm_srli_epi16(pixelVectorAG, 8)); pixelVectorAG = _mm_add_epi16(pixelVectorAG, half); pixelVectorRB = _mm_srli_epi16(pixelVectorRB, 8); pixelVectorAG = _mm_andnot_si128(colorMask, pixelVectorAG); destMultipliedByOneMinusAlpha = _mm_or_si128(pixelVectorAG, pixelVectorRB); }; const __m128i result = _mm_add_epi8(srcVector, destMultipliedByOneMinusAlpha); _mm_store_si128((__m128i *)&dst[x], result); }
never executed: end of block
}
never executed: end of block
for (; x < length
x < lengthDescription
TRUEnever evaluated
FALSEnever evaluated
; ++x) { quint32 s = src[x]; if (s != 0
s != 0Description
TRUEnever evaluated
FALSEnever evaluated
) { s = BYTE_MUL(s, const_alpha); dst[x] = s + BYTE_MUL(dst[x], qAlpha(~s)); }
never executed: end of block
}
never executed: end of block
};
0
115 }
never executed: end of block
0
116}-
117-
118void comp_func_Plus_sse2(uint *dst, const uint *src, int length, uint const_alpha)-
119{-
120 int x = 0;-
121-
122 if (const_alpha == 255
const_alpha == 255Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
123-
124 for (; x < static_cast<int>(qMin(static_cast<quintptr>(length), ((4 - ((reinterpret_cast<quintptr>(dst) >> 2) & 0x3)) & 0x3)))
x < static_cas...0x3)) & 0x3)))Description
TRUEnever evaluated
FALSEnever evaluated
; ++x)
0
125 dst[x] = comp_func_Plus_one_pixel(dst[x], src[x]);
never executed: dst[x] = comp_func_Plus_one_pixel(dst[x], src[x]);
0
126-
127-
128 for (; x < length - 3
x < length - 3Description
TRUEnever evaluated
FALSEnever evaluated
; x += 4) {
0
129 const __m128i srcVector = _mm_loadu_si128((const __m128i *)&src[x]);-
130 const __m128i dstVector = _mm_load_si128((__m128i *)&dst[x]);-
131-
132 const __m128i result = _mm_adds_epu8(srcVector, dstVector);-
133 _mm_store_si128((__m128i *)&dst[x], result);-
134 }
never executed: end of block
0
135-
136-
137 for (; x < length
x < lengthDescription
TRUEnever evaluated
FALSEnever evaluated
; ++x)
0
138 dst[x] = comp_func_Plus_one_pixel(dst[x], src[x]);
never executed: dst[x] = comp_func_Plus_one_pixel(dst[x], src[x]);
0
139 }
never executed: end of block
else {
0
140 const int one_minus_const_alpha = 255 - const_alpha;-
141 const __m128i constAlphaVector = _mm_set1_epi16(const_alpha);-
142 const __m128i oneMinusConstAlpha = _mm_set1_epi16(one_minus_const_alpha);-
143-
144-
145 for (; x < static_cast<int>(qMin(static_cast<quintptr>(length), ((4 - ((reinterpret_cast<quintptr>(dst) >> 2) & 0x3)) & 0x3)))
x < static_cas...0x3)) & 0x3)))Description
TRUEnever evaluated
FALSEnever evaluated
; ++x)
0
146 dst[x] = comp_func_Plus_one_pixel_const_alpha(dst[x], src[x], const_alpha, one_minus_const_alpha);
never executed: dst[x] = comp_func_Plus_one_pixel_const_alpha(dst[x], src[x], const_alpha, one_minus_const_alpha);
0
147-
148 const __m128i half = _mm_set1_epi16(0x80);-
149 const __m128i colorMask = _mm_set1_epi32(0x00ff00ff);-
150-
151 for (; x < length - 3
x < length - 3Description
TRUEnever evaluated
FALSEnever evaluated
; x += 4) {
0
152 const __m128i srcVector = _mm_loadu_si128((const __m128i *)&src[x]);-
153 const __m128i dstVector = _mm_load_si128((__m128i *)&dst[x]);-
154-
155 __m128i result = _mm_adds_epu8(srcVector, dstVector);-
156 { __m128i srcVectorAG = _mm_srli_epi16(result, 8); __m128i dstVectorAG = _mm_srli_epi16(dstVector, 8); __m128i srcVectorAGalpha = _mm_mullo_epi16(srcVectorAG, constAlphaVector); __m128i dstVectorAGoneMinusAlphalpha = _mm_mullo_epi16(dstVectorAG, oneMinusConstAlpha); __m128i finalAG = _mm_add_epi16(srcVectorAGalpha, dstVectorAGoneMinusAlphalpha); finalAG = _mm_add_epi16(finalAG, _mm_srli_epi16(finalAG, 8)); finalAG = _mm_add_epi16(finalAG, half); finalAG = _mm_andnot_si128(colorMask, finalAG); __m128i srcVectorRB = _mm_and_si128(result, colorMask); __m128i dstVectorRB = _mm_and_si128(dstVector, colorMask); __m128i srcVectorRBalpha = _mm_mullo_epi16(srcVectorRB, constAlphaVector); __m128i dstVectorRBoneMinusAlphalpha = _mm_mullo_epi16(dstVectorRB, oneMinusConstAlpha); __m128i finalRB = _mm_add_epi16(srcVectorRBalpha, dstVectorRBoneMinusAlphalpha); finalRB = _mm_add_epi16(finalRB, _mm_srli_epi16(finalRB, 8)); finalRB = _mm_add_epi16(finalRB, half); finalRB = _mm_srli_epi16(finalRB, 8); result = _mm_or_si128(finalAG, finalRB); }-
157 _mm_store_si128((__m128i *)&dst[x], result);-
158 }
never executed: end of block
0
159-
160-
161 for (; x < length
x < lengthDescription
TRUEnever evaluated
FALSEnever evaluated
; ++x)
0
162 dst[x] = comp_func_Plus_one_pixel_const_alpha(dst[x], src[x], const_alpha, one_minus_const_alpha);
never executed: dst[x] = comp_func_Plus_one_pixel_const_alpha(dst[x], src[x], const_alpha, one_minus_const_alpha);
0
163 }
never executed: end of block
0
164}-
165-
166void comp_func_Source_sse2(uint *dst, const uint *src, int length, uint const_alpha)-
167{-
168 if (const_alpha == 255
const_alpha == 255Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
169 ::memcpy(dst, src, length * sizeof(uint));-
170 }
never executed: end of block
else {
0
171 const int ialpha = 255 - const_alpha;-
172-
173 int x = 0;-
174-
175-
176 for (; x < static_cast<int>(qMin(static_cast<quintptr>(length), ((4 - ((reinterpret_cast<quintptr>(dst) >> 2) & 0x3)) & 0x3)))
x < static_cas...0x3)) & 0x3)))Description
TRUEnever evaluated
FALSEnever evaluated
; ++x)
0
177 dst[x] = INTERPOLATE_PIXEL_255(src[x], const_alpha, dst[x], ialpha);
never executed: dst[x] = INTERPOLATE_PIXEL_255(src[x], const_alpha, dst[x], ialpha);
0
178-
179-
180 const __m128i half = _mm_set1_epi16(0x80);-
181 const __m128i colorMask = _mm_set1_epi32(0x00ff00ff);-
182 const __m128i constAlphaVector = _mm_set1_epi16(const_alpha);-
183 const __m128i oneMinusConstAlpha = _mm_set1_epi16(ialpha);-
184 for (; x < length - 3
x < length - 3Description
TRUEnever evaluated
FALSEnever evaluated
; x += 4) {
0
185 const __m128i srcVector = _mm_loadu_si128((const __m128i *)&src[x]);-
186 __m128i dstVector = _mm_load_si128((__m128i *)&dst[x]);-
187 { __m128i srcVectorAG = _mm_srli_epi16(srcVector, 8); __m128i dstVectorAG = _mm_srli_epi16(dstVector, 8); __m128i srcVectorAGalpha = _mm_mullo_epi16(srcVectorAG, constAlphaVector); __m128i dstVectorAGoneMinusAlphalpha = _mm_mullo_epi16(dstVectorAG, oneMinusConstAlpha); __m128i finalAG = _mm_add_epi16(srcVectorAGalpha, dstVectorAGoneMinusAlphalpha); finalAG = _mm_add_epi16(finalAG, _mm_srli_epi16(finalAG, 8)); finalAG = _mm_add_epi16(finalAG, half); finalAG = _mm_andnot_si128(colorMask, finalAG); __m128i srcVectorRB = _mm_and_si128(srcVector, colorMask); __m128i dstVectorRB = _mm_and_si128(dstVector, colorMask); __m128i srcVectorRBalpha = _mm_mullo_epi16(srcVectorRB, constAlphaVector); __m128i dstVectorRBoneMinusAlphalpha = _mm_mullo_epi16(dstVectorRB, oneMinusConstAlpha); __m128i finalRB = _mm_add_epi16(srcVectorRBalpha, dstVectorRBoneMinusAlphalpha); finalRB = _mm_add_epi16(finalRB, _mm_srli_epi16(finalRB, 8)); finalRB = _mm_add_epi16(finalRB, half); finalRB = _mm_srli_epi16(finalRB, 8); dstVector = _mm_or_si128(finalAG, finalRB); }-
188 _mm_store_si128((__m128i *)&dst[x], dstVector);-
189 }
never executed: end of block
0
190-
191-
192 for (; x < length
x < lengthDescription
TRUEnever evaluated
FALSEnever evaluated
; ++x)
0
193 dst[x] = INTERPOLATE_PIXEL_255(src[x], const_alpha, dst[x], ialpha);
never executed: dst[x] = INTERPOLATE_PIXEL_255(src[x], const_alpha, dst[x], ialpha);
0
194 }
never executed: end of block
0
195}-
196-
197void qt_memfill32(quint32 *dest, quint32 value, int count)-
198{-
199 if (count < 7
count < 7Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
200 switch (count) {-
201 case
never executed: case 6:
6:
never executed: case 6:
*dest++ = value;
0
202 case
never executed: case 5:
5:
never executed: case 5:
code before this statement never executed: case 5:
*dest++ = value;
0
203 case
never executed: case 4:
4:
never executed: case 4:
code before this statement never executed: case 4:
*dest++ = value;
0
204 case
never executed: case 3:
3:
never executed: case 3:
code before this statement never executed: case 3:
*dest++ = value;
0
205 case
never executed: case 2:
2:
never executed: case 2:
code before this statement never executed: case 2:
*dest++ = value;
0
206 case
never executed: case 1:
1:
never executed: case 1:
code before this statement never executed: case 1:
*dest = value;
0
207 }
never executed: end of block
0
208 return;
never executed: return;
0
209 };-
210-
211 const int align = (quintptr)(dest) & 0xf;-
212 switch (align) {-
213 case
never executed: case 4:
4:
never executed: case 4:
*dest++ = value; --count;
0
214 case
never executed: case 8:
8:
never executed: case 8:
code before this statement never executed: case 8:
*dest++ = value; --count;
0
215 case
never executed: case 12:
12:
never executed: case 12:
code before this statement never executed: case 12:
*dest++ = value; --count;
0
216 }
never executed: end of block
0
217-
218 const int rest = count & 0x3;-
219 if (rest
restDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
220 switch (rest) {-
221 case
never executed: case 3:
3:
never executed: case 3:
dest[count - 3] = value;
0
222 case
never executed: case 2:
2:
never executed: case 2:
code before this statement never executed: case 2:
dest[count - 2] = value;
0
223 case
never executed: case 1:
1:
never executed: case 1:
code before this statement never executed: case 1:
dest[count - 1] = value;
0
224 }
never executed: end of block
0
225 }
never executed: end of block
0
226-
227 int count128 = count / 4;-
228 __m128i *dst128 = reinterpret_cast<__m128i*>(dest);-
229 __m128i *end128 = dst128 + count128;-
230 const __m128i value128 = _mm_set_epi32(value, value, value, value);-
231-
232 while (dst128 + 3 < end128
dst128 + 3 < end128Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
233 _mm_stream_si128(dst128 + 0, value128);-
234 _mm_stream_si128(dst128 + 1, value128);-
235 _mm_stream_si128(dst128 + 2, value128);-
236 _mm_stream_si128(dst128 + 3, value128);-
237 dst128 += 4;-
238 }
never executed: end of block
0
239-
240 switch (count128 & 0x3) {-
241 case
never executed: case 3:
3:
never executed: case 3:
_mm_stream_si128(dst128++, value128);
0
242 case
never executed: case 2:
2:
never executed: case 2:
code before this statement never executed: case 2:
_mm_stream_si128(dst128++, value128);
0
243 case
never executed: case 1:
1:
never executed: case 1:
code before this statement never executed: case 1:
_mm_stream_si128(dst128++, value128);
0
244 }
never executed: end of block
0
245}
never executed: end of block
0
246-
247void comp_func_solid_SourceOver_sse2(uint *destPixels, int length, uint color, uint const_alpha)-
248{-
249 if ((
(const_alpha &...color)) == 255Description
TRUEnever evaluated
FALSEnever evaluated
const_alpha & qAlpha(color)) == 255
(const_alpha &...color)) == 255Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
250 qt_memfill32(destPixels, color, length);-
251 }
never executed: end of block
else {
0
252 if (const_alpha != 255
const_alpha != 255Description
TRUEnever evaluated
FALSEnever evaluated
)
0
253 color = BYTE_MUL(color, const_alpha);
never executed: color = BYTE_MUL(color, const_alpha);
0
254-
255 const quint32 minusAlphaOfColor = qAlpha(~color);-
256 int x = 0;-
257-
258 quint32 *dst = (quint32 *) destPixels;-
259 const __m128i colorVector = _mm_set1_epi32(color);-
260 const __m128i colorMask = _mm_set1_epi32(0x00ff00ff);-
261 const __m128i half = _mm_set1_epi16(0x80);-
262 const __m128i minusAlphaOfColorVector = _mm_set1_epi16(minusAlphaOfColor);-
263-
264 for (; x < static_cast<int>(qMin(static_cast<quintptr>(length), ((4 - ((reinterpret_cast<quintptr>(dst) >> 2) & 0x3)) & 0x3)))
x < static_cas...0x3)) & 0x3)))Description
TRUEnever evaluated
FALSEnever evaluated
; ++x)
0
265 destPixels[x] = color + BYTE_MUL(destPixels[x], minusAlphaOfColor);
never executed: destPixels[x] = color + BYTE_MUL(destPixels[x], minusAlphaOfColor);
0
266-
267 for (; x < length-3
x < length-3Description
TRUEnever evaluated
FALSEnever evaluated
; x += 4) {
0
268 __m128i dstVector = _mm_load_si128((__m128i *)&dst[x]);-
269 { __m128i pixelVectorAG = _mm_srli_epi16(dstVector, 8); __m128i pixelVectorRB = _mm_and_si128(dstVector, colorMask); pixelVectorAG = _mm_mullo_epi16(pixelVectorAG, minusAlphaOfColorVector); pixelVectorRB = _mm_mullo_epi16(pixelVectorRB, minusAlphaOfColorVector); pixelVectorRB = _mm_add_epi16(pixelVectorRB, _mm_srli_epi16(pixelVectorRB, 8)); pixelVectorRB = _mm_add_epi16(pixelVectorRB, half); pixelVectorAG = _mm_add_epi16(pixelVectorAG, _mm_srli_epi16(pixelVectorAG, 8)); pixelVectorAG = _mm_add_epi16(pixelVectorAG, half); pixelVectorRB = _mm_srli_epi16(pixelVectorRB, 8); pixelVectorAG = _mm_andnot_si128(colorMask, pixelVectorAG); dstVector = _mm_or_si128(pixelVectorAG, pixelVectorRB); };-
270 dstVector = _mm_add_epi8(colorVector, dstVector);-
271 _mm_store_si128((__m128i *)&dst[x], dstVector);-
272 }
never executed: end of block
0
273 for (;x < length
x < lengthDescription
TRUEnever evaluated
FALSEnever evaluated
; ++x)
0
274 destPixels[x] = color + BYTE_MUL(destPixels[x], minusAlphaOfColor);
never executed: destPixels[x] = color + BYTE_MUL(destPixels[x], minusAlphaOfColor);
0
275 }
never executed: end of block
0
276}-
277-
278void qt_memfill16(quint16 *dest, quint16 value, int count)-
279{-
280 if (count < 3
count < 3Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
281 switch (count) {-
282 case
never executed: case 2:
2:
never executed: case 2:
*dest++ = value;
0
283 case
never executed: case 1:
1:
never executed: case 1:
code before this statement never executed: case 1:
*dest = value;
0
284 }
never executed: end of block
0
285 return;
never executed: return;
0
286 }-
287-
288 const int align = (quintptr)(dest) & 0x3;-
289 switch (align) {-
290 case
never executed: case 2:
2:
never executed: case 2:
*dest++ = value; --count;
0
291 }
never executed: end of block
0
292-
293 const quint32 value32 = (value << 16) | value;-
294 qt_memfill32(reinterpret_cast<quint32*>(dest), value32, count / 2);-
295-
296 if (count & 0x1
count & 0x1Description
TRUEnever evaluated
FALSEnever evaluated
)
0
297 dest[count - 1] = value;
never executed: dest[count - 1] = value;
0
298}
never executed: end of block
0
299-
300void qt_bitmapblit32_sse2_base(QRasterBuffer *rasterBuffer, int x, int y,-
301 quint32 color,-
302 const uchar *src, int width, int height, int stride)-
303{-
304 quint32 *dest = reinterpret_cast<quint32*>(rasterBuffer->scanLine(y)) + x;-
305 const int destStride = rasterBuffer->bytesPerLine() / sizeof(quint32);-
306-
307 const __m128i c128 = _mm_set1_epi32(color);-
308 const __m128i maskmask1 = _mm_set_epi32(0x10101010, 0x20202020,-
309 0x40404040, 0x80808080);-
310 const __m128i maskadd1 = _mm_set_epi32(0x70707070, 0x60606060,-
311 0x40404040, 0x00000000);-
312-
313 if (width > 4
width > 4Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
314 const __m128i maskmask2 = _mm_set_epi32(0x01010101, 0x02020202,-
315 0x04040404, 0x08080808);-
316 const __m128i maskadd2 = _mm_set_epi32(0x7f7f7f7f, 0x7e7e7e7e,-
317 0x7c7c7c7c, 0x78787878);-
318 while (height--
height--Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
319 for (int x = 0; x < width
x < widthDescription
TRUEnever evaluated
FALSEnever evaluated
; x += 8) {
0
320 const quint8 s = src[x >> 3];-
321 if (!s
!sDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
322 continue;
never executed: continue;
0
323 __m128i mask1 = _mm_set1_epi8(s);-
324 __m128i mask2 = mask1;-
325-
326 mask1 = _mm_and_si128(mask1, maskmask1);-
327 mask1 = _mm_add_epi8(mask1, maskadd1);-
328 _mm_maskmoveu_si128(c128, mask1, (char*)(dest + x));-
329 mask2 = _mm_and_si128(mask2, maskmask2);-
330 mask2 = _mm_add_epi8(mask2, maskadd2);-
331 _mm_maskmoveu_si128(c128, mask2, (char*)(dest + x + 4));-
332 }
never executed: end of block
0
333 dest += destStride;-
334 src += stride;-
335 }
never executed: end of block
0
336 }
never executed: end of block
else {
0
337 while (height--
height--Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
338 const quint8 s = *src;-
339 if (s
sDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
340 __m128i mask1 = _mm_set1_epi8(s);-
341 mask1 = _mm_and_si128(mask1, maskmask1);-
342 mask1 = _mm_add_epi8(mask1, maskadd1);-
343 _mm_maskmoveu_si128(c128, mask1, (char*)(dest));-
344 }
never executed: end of block
0
345 dest += destStride;-
346 src += stride;-
347 }
never executed: end of block
0
348 }
never executed: end of block
0
349}-
350-
351void qt_bitmapblit32_sse2(QRasterBuffer *rasterBuffer, int x, int y,-
352 const QRgba64 &color,-
353 const uchar *src, int width, int height, int stride)-
354{-
355 qt_bitmapblit32_sse2_base(rasterBuffer, x, y, color.toArgb32(), src, width, height, stride);-
356}
never executed: end of block
0
357-
358void qt_bitmapblit8888_sse2(QRasterBuffer *rasterBuffer, int x, int y,-
359 const QRgba64 &color,-
360 const uchar *src, int width, int height, int stride)-
361{-
362 qt_bitmapblit32_sse2_base(rasterBuffer, x, y, ARGB2RGBA(color.toArgb32()), src, width, height, stride);-
363}
never executed: end of block
0
364-
365void qt_bitmapblit16_sse2(QRasterBuffer *rasterBuffer, int x, int y,-
366 const QRgba64 &color,-
367 const uchar *src, int width, int height, int stride)-
368{-
369 const quint16 c = qConvertRgb32To16(color.toArgb32());-
370 quint16 *dest = reinterpret_cast<quint16*>(rasterBuffer->scanLine(y)) + x;-
371 const int destStride = rasterBuffer->bytesPerLine() / sizeof(quint16);-
372-
373 const __m128i c128 = _mm_set1_epi16(c);-
374-
375 const __m128i maskmask = _mm_set_epi16(0x0101, 0x0202, 0x0404, 0x0808,-
376 0x1010, 0x2020, 0x4040, 0x8080);-
377 const __m128i maskadd = _mm_set_epi16(0x7f7f, 0x7e7e, 0x7c7c, 0x7878,-
378 0x7070, 0x6060, 0x4040, 0x0000);-
379-
380 while (height--
height--Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
381 for (int x = 0; x < width
x < widthDescription
TRUEnever evaluated
FALSEnever evaluated
; x += 8) {
0
382 const quint8 s = src[x >> 3];-
383 if (!s
!sDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
384 continue;
never executed: continue;
0
385 __m128i mask = _mm_set1_epi8(s);-
386 mask = _mm_and_si128(mask, maskmask);-
387 mask = _mm_add_epi8(mask, maskadd);-
388 _mm_maskmoveu_si128(c128, mask, (char*)(dest + x));-
389 }
never executed: end of block
0
390 dest += destStride;-
391 src += stride;-
392 }
never executed: end of block
0
393}
never executed: end of block
0
394-
395class QSimdSse2-
396{-
397public:-
398 typedef __m128i Int32x4;-
399 typedef __m128 Float32x4;-
400-
401 union Vect_buffer_i { Int32x4 v; int i[4]; };-
402 union Vect_buffer_f { Float32x4 v; float f[4]; };-
403-
404 static inline Float32x4 v_dup(float x) { return
never executed: return _mm_set1_ps(x);
_mm_set1_ps(x);
never executed: return _mm_set1_ps(x);
}
0
405 static inline Float32x4 v_dup(double x) { return
never executed: return _mm_set1_ps(x);
_mm_set1_ps(x);
never executed: return _mm_set1_ps(x);
}
0
406 static inline Int32x4 v_dup(int x) { return
never executed: return _mm_set1_epi32(x);
_mm_set1_epi32(x);
never executed: return _mm_set1_epi32(x);
}
0
407 static inline Int32x4 v_dup(uint x) { return
never executed: return _mm_set1_epi32(x);
_mm_set1_epi32(x);
never executed: return _mm_set1_epi32(x);
}
0
408-
409 static inline Float32x4 v_add(Float32x4 a, Float32x4 b) { return
never executed: return _mm_add_ps(a, b);
_mm_add_ps(a, b);
never executed: return _mm_add_ps(a, b);
}
0
410 static inline Int32x4 v_add(Int32x4 a, Int32x4 b) { return
never executed: return _mm_add_epi32(a, b);
_mm_add_epi32(a, b);
never executed: return _mm_add_epi32(a, b);
}
0
411-
412 static inline Float32x4 v_max(Float32x4 a, Float32x4 b) { return
never executed: return _mm_max_ps(a, b);
_mm_max_ps(a, b);
never executed: return _mm_max_ps(a, b);
}
0
413 static inline Float32x4 v_min(Float32x4 a, Float32x4 b) { return
never executed: return _mm_min_ps(a, b);
_mm_min_ps(a, b);
never executed: return _mm_min_ps(a, b);
}
0
414 static inline Int32x4 v_min_16(Int32x4 a, Int32x4 b) { return
never executed: return _mm_min_epi16(a, b);
_mm_min_epi16(a, b);
never executed: return _mm_min_epi16(a, b);
}
0
415-
416 static inline Int32x4 v_and(Int32x4 a, Int32x4 b) { return
never executed: return _mm_and_si128(a, b);
_mm_and_si128(a, b);
never executed: return _mm_and_si128(a, b);
}
0
417-
418 static inline Float32x4 v_sub(Float32x4 a, Float32x4 b) { return
never executed: return _mm_sub_ps(a, b);
_mm_sub_ps(a, b);
never executed: return _mm_sub_ps(a, b);
}
0
419 static inline Int32x4 v_sub(Int32x4 a, Int32x4 b) { return
never executed: return _mm_sub_epi32(a, b);
_mm_sub_epi32(a, b);
never executed: return _mm_sub_epi32(a, b);
}
0
420-
421 static inline Float32x4 v_mul(Float32x4 a, Float32x4 b) { return
never executed: return _mm_mul_ps(a, b);
_mm_mul_ps(a, b);
never executed: return _mm_mul_ps(a, b);
}
0
422-
423 static inline Float32x4 v_sqrt(Float32x4 x) { return
never executed: return _mm_sqrt_ps(x);
_mm_sqrt_ps(x);
never executed: return _mm_sqrt_ps(x);
}
0
424-
425 static inline Int32x4 v_toInt(Float32x4 x) { return
never executed: return _mm_cvttps_epi32(x);
_mm_cvttps_epi32(x);
never executed: return _mm_cvttps_epi32(x);
}
0
426-
427 static inline Int32x4 v_greaterOrEqual(Float32x4 a, Float32x4 b) { return
never executed: return _mm_castps_si128(_mm_cmpgt_ps(a, b));
_mm_castps_si128(_mm_cmpgt_ps(a, b));
never executed: return _mm_castps_si128(_mm_cmpgt_ps(a, b));
}
0
428};-
429-
430const uint * qt_fetch_radial_gradient_sse2(uint *buffer, const Operator *op, const QSpanData *data,-
431 int y, int x, int length)-
432{-
433 return
never executed: return qt_fetch_radial_gradient_template<QRadialFetchSimd<QSimdSse2>,uint>(buffer, op, data, y, x, length);
qt_fetch_radial_gradient_template<QRadialFetchSimd<QSimdSse2>,uint>(buffer, op, data, y, x, length);
never executed: return qt_fetch_radial_gradient_template<QRadialFetchSimd<QSimdSse2>,uint>(buffer, op, data, y, x, length);
0
434}-
435-
436void qt_scale_image_argb32_on_argb32_sse2(uchar *destPixels, int dbpl,-
437 const uchar *srcPixels, int sbpl, int srch,-
438 const QRectF &targetRect,-
439 const QRectF &sourceRect,-
440 const QRect &clip,-
441 int const_alpha)-
442{-
443 if (const_alpha != 256
const_alpha != 256Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
444-
445 extern void qt_scale_image_argb32_on_argb32(uchar *destPixels, int dbpl,-
446 const uchar *srcPixels, int sbpl, int srch,-
447 const QRectF &targetRect,-
448 const QRectF &sourceRect,-
449 const QRect &clip,-
450 int const_alpha);-
451 return
never executed: return qt_scale_image_argb32_on_argb32(destPixels, dbpl, srcPixels, sbpl, srch, targetRect, sourceRect, clip, const_alpha);
qt_scale_image_argb32_on_argb32(destPixels, dbpl, srcPixels, sbpl, srch, targetRect, sourceRect, clip, const_alpha);
never executed: return qt_scale_image_argb32_on_argb32(destPixels, dbpl, srcPixels, sbpl, srch, targetRect, sourceRect, clip, const_alpha);
0
452 }-
453-
454 qreal sx = targetRect.width() / (qreal) sourceRect.width();-
455 qreal sy = targetRect.height() / (qreal) sourceRect.height();-
456-
457 int ix = 0x00010000 / sx;-
458 int iy = 0x00010000 / sy;-
459-
460 int cx1 = clip.x();-
461 int cx2 = clip.x() + clip.width();-
462 int cy1 = clip.top();-
463 int cy2 = clip.y() + clip.height();-
464-
465 int tx1 = qRound(targetRect.left());-
466 int tx2 = qRound(targetRect.right());-
467 int ty1 = qRound(targetRect.top());-
468 int ty2 = qRound(targetRect.bottom());-
469-
470 if (tx2 < tx1
tx2 < tx1Description
TRUEnever evaluated
FALSEnever evaluated
)
0
471 qSwap(tx2, tx1);
never executed: qSwap(tx2, tx1);
0
472 if (ty2 < ty1
ty2 < ty1Description
TRUEnever evaluated
FALSEnever evaluated
)
0
473 qSwap(ty2, ty1);
never executed: qSwap(ty2, ty1);
0
474-
475 if (tx1 < cx1
tx1 < cx1Description
TRUEnever evaluated
FALSEnever evaluated
)
0
476 tx1 = cx1;
never executed: tx1 = cx1;
0
477 if (tx2 >= cx2
tx2 >= cx2Description
TRUEnever evaluated
FALSEnever evaluated
)
0
478 tx2 = cx2;
never executed: tx2 = cx2;
0
479-
480 if (tx1 >= tx2
tx1 >= tx2Description
TRUEnever evaluated
FALSEnever evaluated
)
0
481 return;
never executed: return;
0
482-
483 if (ty1 < cy1
ty1 < cy1Description
TRUEnever evaluated
FALSEnever evaluated
)
0
484 ty1 = cy1;
never executed: ty1 = cy1;
0
485 if (ty2 >= cy2
ty2 >= cy2Description
TRUEnever evaluated
FALSEnever evaluated
)
0
486 ty2 = cy2;
never executed: ty2 = cy2;
0
487 if (ty1 >= ty2
ty1 >= ty2Description
TRUEnever evaluated
FALSEnever evaluated
)
0
488 return;
never executed: return;
0
489-
490 int h = ty2 - ty1;-
491 int w = tx2 - tx1;-
492-
493 quint32 basex;-
494 quint32 srcy;-
495-
496 if (sx < 0
sx < 0Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
497 int dstx = qFloor((tx1 + qreal(0.5) - targetRect.right()) * ix) + 1;-
498 basex = quint32(sourceRect.right() * 65536) + dstx;-
499 }
never executed: end of block
else {
0
500 int dstx = qCeil((tx1 + qreal(0.5) - targetRect.left()) * ix) - 1;-
501 basex = quint32(sourceRect.left() * 65536) + dstx;-
502 }
never executed: end of block
0
503 if (sy < 0
sy < 0Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
504 int dsty = qFloor((ty1 + qreal(0.5) - targetRect.bottom()) * iy) + 1;-
505 srcy = quint32(sourceRect.bottom() * 65536) + dsty;-
506 }
never executed: end of block
else {
0
507 int dsty = qCeil((ty1 + qreal(0.5) - targetRect.top()) * iy) - 1;-
508 srcy = quint32(sourceRect.top() * 65536) + dsty;-
509 }
never executed: end of block
0
510-
511 quint32 *dst = ((quint32 *) (destPixels + ty1 * dbpl)) + tx1;-
512-
513 const __m128i nullVector = _mm_set1_epi32(0);-
514 const __m128i half = _mm_set1_epi16(0x80);-
515 const __m128i one = _mm_set1_epi16(0xff);-
516 const __m128i colorMask = _mm_set1_epi32(0x00ff00ff);-
517 const __m128i alphaMask = _mm_set1_epi32(0xff000000);-
518 const __m128i ixVector = _mm_set1_epi32(4*ix);-
519-
520-
521-
522 int yend = (srcy + iy * (h - 1)) >> 16;-
523 if (yend < 0
yend < 0Description
TRUEnever evaluated
FALSEnever evaluated
|| yend >= srch
yend >= srchDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
524 --
never executed: --h;
h;
never executed: --h;
0
525 int xend = (basex + ix * (w - 1)) >> 16;-
526 if (xend < 0
xend < 0Description
TRUEnever evaluated
FALSEnever evaluated
|| xend >= (int)(sbpl/sizeof(quint32))
xend >= (int)(...zeof(quint32))Description
TRUEnever evaluated
FALSEnever evaluated
)
0
527 --
never executed: --w;
w;
never executed: --w;
0
528-
529 while (h--
h--Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
530 const uint *src = (const quint32 *) (srcPixels + (srcy >> 16) * sbpl);-
531 int srcx = basex;-
532 int x = 0;-
533-
534 for (; x < static_cast<int>(qMin(static_cast<quintptr>(w), ((4 - ((reinterpret_cast<quintptr>(dst) >> 2) & 0x3)) & 0x3)))
x < static_cas...0x3)) & 0x3)))Description
TRUEnever evaluated
FALSEnever evaluated
; ++x) {
0
535 uint s = src[srcx >> 16];-
536 dst[x] = s + BYTE_MUL(dst[x], qAlpha(~s));-
537 srcx += ix;-
538 }
never executed: end of block
0
539-
540 __m128i srcxVector = _mm_set_epi32(srcx, srcx + ix, srcx + ix + ix, srcx + ix + ix + ix);-
541-
542 for (; x<w - 3
x<w - 3Description
TRUEnever evaluated
FALSEnever evaluated
; x += 4) {
0
543 union Vect_buffer { __m128i vect; quint32 i[4]; };-
544 Vect_buffer addr;-
545 addr.vect = _mm_srli_epi32(srcxVector, 16);-
546 srcxVector = _mm_add_epi32(srcxVector, ixVector);-
547-
548 const __m128i srcVector = _mm_set_epi32(src[addr.i[0]], src[addr.i[1]], src[addr.i[2]], src[addr.i[3]]);-
549 { const __m128i srcVectorAlpha = _mm_and_si128(srcVector, alphaMask); if (_mm_movemask_epi8(_mm_cmpeq_epi32(srcVectorAlpha, alphaMask)) == 0xffff
_mm_movemask_e...sk)) == 0xffffDescription
TRUEnever evaluated
FALSEnever evaluated
) { _mm_store_si128((__m128i *)&dst[x], srcVector); }
never executed: end of block
else if (_mm_movemask_epi8(_mm_cmpeq_epi32(srcVectorAlpha, nullVector)) != 0xffff
_mm_movemask_e...or)) != 0xffffDescription
TRUEnever evaluated
FALSEnever evaluated
) { __m128i alphaChannel = _mm_srli_epi32(srcVector, 24); alphaChannel = _mm_or_si128(alphaChannel, _mm_slli_epi32(alphaChannel, 16)); alphaChannel = _mm_sub_epi16(one, alphaChannel); const __m128i dstVector = _mm_load_si128((__m128i *)&dst[x]); __m128i destMultipliedByOneMinusAlpha; { __m128i pixelVectorAG = _mm_srli_epi16(dstVector, 8); __m128i pixelVectorRB = _mm_and_si128(dstVector, colorMask); pixelVectorAG = _mm_mullo_epi16(pixelVectorAG, alphaChannel); pixelVectorRB = _mm_mullo_epi16(pixelVectorRB, alphaChannel); pixelVectorRB = _mm_add_epi16(pixelVectorRB, _mm_srli_epi16(pixelVectorRB, 8)); pixelVectorRB = _mm_add_epi16(pixelVectorRB, half); pixelVectorAG = _mm_add_epi16(pixelVectorAG, _mm_srli_epi16(pixelVectorAG, 8)); pixelVectorAG = _mm_add_epi16(pixelVectorAG, half); pixelVectorRB = _mm_srli_epi16(pixelVectorRB, 8); pixelVectorAG = _mm_andnot_si128(colorMask, pixelVectorAG); destMultipliedByOneMinusAlpha = _mm_or_si128(pixelVectorAG, pixelVectorRB); }; const __m128i result = _mm_add_epi8(srcVector, destMultipliedByOneMinusAlpha); _mm_store_si128((__m128i *)&dst[x], result); }
never executed: end of block
};
0
550 }
never executed: end of block
0
551-
552 for (; x<w
x<wDescription
TRUEnever evaluated
FALSEnever evaluated
; x++) {
0
553 uint s = src[(basex + x*ix) >> 16];-
554 dst[x] = s + BYTE_MUL(dst[x], qAlpha(~s));-
555 }
never executed: end of block
0
556 dst = (quint32 *)(((uchar *) dst) + dbpl);-
557 srcy += iy;-
558 }
never executed: end of block
0
559}
never executed: end of block
0
560-
561-
562-
Switch to Source codePreprocessed file

Generated by Squish Coco Non-Commercial 4.3.0-BETA-master-30-08-2018-4cb69e9