Line | Source | Count |
1 | | - |
2 | | - |
3 | | - |
4 | | - |
5 | | - |
6 | bool convert_ARGB_to_ARGB_PM_inplace_sse2(QImageData *data, Qt::ImageConversionFlags) | - |
7 | { | - |
8 | ((!(data->format == QImage::Format_ARGB32 || data->format == QImage::Format_RGBA8888)) ? qt_assert("data->format == QImage::Format_ARGB32 || data->format == QImage::Format_RGBA8888",__FILE__,52) : qt_noop()); | - |
9 | | - |
10 | | - |
11 | const int spare = data->width & 3; | - |
12 | | - |
13 | const int pad = (data->bytes_per_line >> 2) - data->width; | - |
14 | const int iter = data->width >> 2; | - |
15 | int height = data->height; | - |
16 | | - |
17 | const __m128i alphaMask = _mm_set1_epi32(0xff000000); | - |
18 | const __m128i nullVector = _mm_setzero_si128(); | - |
19 | const __m128i half = _mm_set1_epi16(0x80); | - |
20 | const __m128i colorMask = _mm_set1_epi32(0x00ff00ff); | - |
21 | | - |
22 | __m128i *d = reinterpret_cast<__m128i*>(data->data); | - |
23 | while (height--TRUE | never evaluated | FALSE | never evaluated |
) { | 0 |
24 | const __m128i *end = d + iter; | - |
25 | | - |
26 | for (; d != endTRUE | never evaluated | FALSE | never evaluated |
; ++d) { | 0 |
27 | const __m128i srcVector = _mm_loadu_si128(d); | - |
28 | const __m128i srcVectorAlpha = _mm_and_si128(srcVector, alphaMask); | - |
29 | if (_mm_movemask_epi8(_mm_cmpeq_epi32(srcVectorAlpha, alphaMask)) == 0xffffTRUE | never evaluated | FALSE | never evaluated |
) { | 0 |
30 | | - |
31 | } never executed: end of block else if (_mm_movemask_epi8(_mm_cmpeq_epi32(srcVectorAlpha, nullVector)) == 0xffffTRUE | never evaluated | FALSE | never evaluated |
) { | 0 |
32 | | - |
33 | _mm_storeu_si128(d, nullVector); | - |
34 | } never executed: end of block else { | 0 |
35 | __m128i alphaChannel = _mm_srli_epi32(srcVector, 24); | - |
36 | alphaChannel = _mm_or_si128(alphaChannel, _mm_slli_epi32(alphaChannel, 16)); | - |
37 | | - |
38 | __m128i result; | - |
39 | { __m128i pixelVectorAG = _mm_srli_epi16(srcVector, 8); __m128i pixelVectorRB = _mm_and_si128(srcVector, 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); result = _mm_or_si128(pixelVectorAG, pixelVectorRB); }; | - |
40 | result = _mm_or_si128(_mm_andnot_si128(alphaMask, result), srcVectorAlpha); | - |
41 | _mm_storeu_si128(d, result); | - |
42 | } never executed: end of block | 0 |
43 | } | - |
44 | | - |
45 | QRgb *p = reinterpret_cast<QRgb*>(d); | - |
46 | QRgb *pe = p+spare; | - |
47 | for (; p != peTRUE | never evaluated | FALSE | never evaluated |
; ++p) { | 0 |
48 | if (*TRUE | never evaluated | FALSE | never evaluated |
p < 0x00ffffffTRUE | never evaluated | FALSE | never evaluated |
) | 0 |
49 | * never executed: *p = 0; p = 0;never executed: *p = 0; | 0 |
50 | else if (*TRUE | never evaluated | FALSE | never evaluated |
p < 0xff000000TRUE | never evaluated | FALSE | never evaluated |
) | 0 |
51 | * never executed: *p = qPremultiply(*p); p = qPremultiply(*p);never executed: *p = qPremultiply(*p); | 0 |
52 | } never executed: end of block | 0 |
53 | | - |
54 | d = reinterpret_cast<__m128i*>(p+pad); | - |
55 | } never executed: end of block | 0 |
56 | | - |
57 | if (data->format == QImage::Format_ARGB32TRUE | never evaluated | FALSE | never evaluated |
) | 0 |
58 | data->format = QImage::Format_ARGB32_Premultiplied; never executed: data->format = QImage::Format_ARGB32_Premultiplied; | 0 |
59 | else | - |
60 | data->format = QImage::Format_RGBA8888_Premultiplied; never executed: data->format = QImage::Format_RGBA8888_Premultiplied; | 0 |
61 | return never executed: return true; true;never executed: return true; | 0 |
62 | } | - |
63 | | - |
64 | | - |
| | |