Line | Source Code | Coverage |
---|
1 | | - |
2 | | - |
3 | | - |
4 | | - |
5 | | - |
6 | bool convert_ARGB_to_ARGB_PM_inplace_avx(QImageData *data, Qt::ImageConversionFlags) | - |
7 | { | - |
8 | 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--) { evaluated: height-- yes Evaluation Count:656 | yes Evaluation Count:13 |
| 13-656 |
24 | const __m128i *end = d + iter; | - |
25 | | - |
26 | for (; d != end; ++d) { evaluated: d != end yes Evaluation Count:16960 | yes Evaluation Count:656 |
| 656-16960 |
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)) == 0xffff) { evaluated: _mm_movemask_epi8(_mm_cmpeq_epi32(srcVectorAlpha, alphaMask)) == 0xffff yes Evaluation Count:2390 | yes Evaluation Count:14570 |
| 2390-14570 |
30 | | - |
31 | } else if (_mm_movemask_epi8(_mm_cmpeq_epi32(srcVectorAlpha, nullVector)) == 0xffff) { executed: } Execution Count:2390 evaluated: _mm_movemask_epi8(_mm_cmpeq_epi32(srcVectorAlpha, nullVector)) == 0xffff yes Evaluation Count:1786 | yes Evaluation Count:12784 |
| 1786-12784 |
32 | | - |
33 | _mm_storeu_si128(d, nullVector); | - |
34 | } else { executed: } Execution Count:1786 | 1786 |
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 | } executed: } Execution Count:12784 | 12784 |
43 | } | - |
44 | | - |
45 | QRgb *p = reinterpret_cast<QRgb*>(d); | - |
46 | QRgb *pe = p+spare; | - |
47 | for (; p != pe; ++p) { partially evaluated: p != pe no Evaluation Count:0 | yes Evaluation Count:656 |
| 0-656 |
48 | if (*p < 0x00ffffff) never evaluated: *p < 0x00ffffff | 0 |
49 | *p = 0; | 0 |
50 | else if (*p < 0xff000000) never evaluated: *p < 0xff000000 | 0 |
51 | *p = PREMUL(*p); never executed: *p = PREMUL(*p); | 0 |
52 | } | - |
53 | | - |
54 | d = reinterpret_cast<__m128i*>(p+pad); | - |
55 | } executed: } Execution Count:656 | 656 |
56 | | - |
57 | data->format = QImage::Format_ARGB32_Premultiplied; | - |
58 | return true; executed: return true; Execution Count:13 | 13 |
59 | } | - |
60 | | - |
61 | | - |
62 | | - |
| | |