qimagescale_sse4.cpp

Absolute File Name:/home/qt/qt5_coco/qt5/qtbase/src/gui/painting/qimagescale_sse4.cpp
Switch to Source codePreprocessed file
LineSourceCount
1-
2-
3-
4-
5-
6using namespace QImageScale;-
7-
8inline static __m128i qt_qimageScaleAARGBA_helper(const unsigned int *pix, int xyap, int Cxy, int step, const __m128i vxyap, const __m128i vCxy)-
9{-
10 __m128i vpix = _mm_cvtepu8_epi32(_mm_cvtsi32_si128(*pix));-
11 __m128i vx = _mm_mullo_epi32(vpix, vxyap);-
12 int i;-
13 for (i = (1 << 14) - xyap; i > Cxy
i > CxyDescription
TRUEnever evaluated
FALSEnever evaluated
; i -= Cxy) {
0
14 pix += step;-
15 vpix = _mm_cvtepu8_epi32(_mm_cvtsi32_si128(*pix));-
16 vx = _mm_add_epi32(vx, _mm_mullo_epi32(vpix, vCxy));-
17 }
never executed: end of block
0
18 pix += step;-
19 vpix = _mm_cvtepu8_epi32(_mm_cvtsi32_si128(*pix));-
20 vx = _mm_add_epi32(vx, _mm_mullo_epi32(vpix, _mm_set1_epi32(i)));-
21 return
never executed: return vx;
vx;
never executed: return vx;
0
22}-
23-
24template<bool RGB>-
25void qt_qimageScaleAARGBA_up_x_down_y_sse4(QImageScaleInfo *isi, unsigned int *dest,-
26 int dw, int dh, int dow, int sow)-
27{-
28 const unsigned int **ypoints = isi->ypoints;-
29 int *xpoints = isi->xpoints;-
30 int *xapoints = isi->xapoints;-
31 int *yapoints = isi->yapoints;-
32-
33 const __m128i v256 = _mm_set1_epi32(256);-
34-
35-
36 for (int y = 0; y < dh
y < dhDescription
TRUEnever evaluated
FALSEnever evaluated
; y++) {
0
37 int Cy = yapoints[y] >> 16;-
38 int yap = yapoints[y] & 0xffff;-
39 const __m128i vCy = _mm_set1_epi32(Cy);-
40 const __m128i vyap = _mm_set1_epi32(yap);-
41-
42 unsigned int *dptr = dest + (y * dow);-
43 for (int x = 0; x < dw
x < dwDescription
TRUEnever evaluated
FALSEnever evaluated
; x++) {
0
44 const unsigned int *sptr = ypoints[y] + xpoints[x];-
45 __m128i vx = qt_qimageScaleAARGBA_helper(sptr, yap, Cy, sow, vyap, vCy);-
46-
47 int xap = xapoints[x];-
48 if (xap > 0
xap > 0Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
49 const __m128i vxap = _mm_set1_epi32(xap);-
50 const __m128i vinvxap = _mm_sub_epi32(v256, vxap);-
51 __m128i vr = qt_qimageScaleAARGBA_helper(sptr + 1, yap, Cy, sow, vyap, vCy);-
52-
53 vx = _mm_mullo_epi32(vx, vinvxap);-
54 vr = _mm_mullo_epi32(vr, vxap);-
55 vx = _mm_add_epi32(vx, vr);-
56 vx = _mm_srli_epi32(vx, 8);-
57 }
never executed: end of block
0
58 vx = _mm_srli_epi32(vx, 14);-
59 vx = _mm_packus_epi32(vx, _mm_setzero_si128());-
60 vx = _mm_packus_epi16(vx, _mm_setzero_si128());-
61 *dptr = _mm_cvtsi128_si32(vx);-
62 if (RGB
RGBDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
63 *
never executed: *dptr |= 0xff000000;
dptr |= 0xff000000;
never executed: *dptr |= 0xff000000;
0
64 dptr++;-
65 }
never executed: end of block
0
66 }
never executed: end of block
0
67}
never executed: end of block
0
68-
69template<bool RGB>-
70void qt_qimageScaleAARGBA_down_x_up_y_sse4(QImageScaleInfo *isi, unsigned int *dest,-
71 int dw, int dh, int dow, int sow)-
72{-
73 const unsigned int **ypoints = isi->ypoints;-
74 int *xpoints = isi->xpoints;-
75 int *xapoints = isi->xapoints;-
76 int *yapoints = isi->yapoints;-
77-
78 const __m128i v256 = _mm_set1_epi32(256);-
79-
80-
81 for (int y = 0; y < dh
y < dhDescription
TRUEnever evaluated
FALSEnever evaluated
; y++) {
0
82 unsigned int *dptr = dest + (y * dow);-
83 for (int x = 0; x < dw
x < dwDescription
TRUEnever evaluated
FALSEnever evaluated
; x++) {
0
84 int Cx = xapoints[x] >> 16;-
85 int xap = xapoints[x] & 0xffff;-
86 const __m128i vCx = _mm_set1_epi32(Cx);-
87 const __m128i vxap = _mm_set1_epi32(xap);-
88-
89 const unsigned int *sptr = ypoints[y] + xpoints[x];-
90 __m128i vx = qt_qimageScaleAARGBA_helper(sptr, xap, Cx, 1, vxap, vCx);-
91-
92 int yap = yapoints[y];-
93 if (yap > 0
yap > 0Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
94 const __m128i vyap = _mm_set1_epi32(yap);-
95 const __m128i vinvyap = _mm_sub_epi32(v256, vyap);-
96 __m128i vr = qt_qimageScaleAARGBA_helper(sptr + sow, xap, Cx, 1, vxap, vCx);-
97-
98 vx = _mm_mullo_epi32(vx, vinvyap);-
99 vr = _mm_mullo_epi32(vr, vyap);-
100 vx = _mm_add_epi32(vx, vr);-
101 vx = _mm_srli_epi32(vx, 8);-
102 }
never executed: end of block
0
103 vx = _mm_srli_epi32(vx, 14);-
104 vx = _mm_packus_epi32(vx, _mm_setzero_si128());-
105 vx = _mm_packus_epi16(vx, _mm_setzero_si128());-
106 *dptr = _mm_cvtsi128_si32(vx);-
107 if (RGB
RGBDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
108 *
never executed: *dptr |= 0xff000000;
dptr |= 0xff000000;
never executed: *dptr |= 0xff000000;
0
109 dptr++;-
110 }
never executed: end of block
0
111 }
never executed: end of block
0
112}
never executed: end of block
0
113-
114template<bool RGB>-
115void qt_qimageScaleAARGBA_down_xy_sse4(QImageScaleInfo *isi, unsigned int *dest,-
116 int dw, int dh, int dow, int sow)-
117{-
118 const unsigned int **ypoints = isi->ypoints;-
119 int *xpoints = isi->xpoints;-
120 int *xapoints = isi->xapoints;-
121 int *yapoints = isi->yapoints;-
122-
123 for (int y = 0; y < dh
y < dhDescription
TRUEnever evaluated
FALSEnever evaluated
; y++) {
0
124 int Cy = yapoints[y] >> 16;-
125 int yap = yapoints[y] & 0xffff;-
126 const __m128i vCy = _mm_set1_epi32(Cy);-
127 const __m128i vyap = _mm_set1_epi32(yap);-
128-
129 unsigned int *dptr = dest + (y * dow);-
130 for (int x = 0; x < dw
x < dwDescription
TRUEnever evaluated
FALSEnever evaluated
; x++) {
0
131 const int Cx = xapoints[x] >> 16;-
132 const int xap = xapoints[x] & 0xffff;-
133 const __m128i vCx = _mm_set1_epi32(Cx);-
134 const __m128i vxap = _mm_set1_epi32(xap);-
135-
136 const unsigned int *sptr = ypoints[y] + xpoints[x];-
137 __m128i vx = qt_qimageScaleAARGBA_helper(sptr, xap, Cx, 1, vxap, vCx);-
138 __m128i vr = _mm_mullo_epi32(_mm_srli_epi32(vx, 4), vyap);-
139-
140 int j;-
141 for (j = (1 << 14) - yap; j > Cy
j > CyDescription
TRUEnever evaluated
FALSEnever evaluated
; j -= Cy) {
0
142 sptr += sow;-
143 vx = qt_qimageScaleAARGBA_helper(sptr, xap, Cx, 1, vxap, vCx);-
144 vr = _mm_add_epi32(vr, _mm_mullo_epi32(_mm_srli_epi32(vx, 4), vCy));-
145 }
never executed: end of block
0
146 sptr += sow;-
147 vx = qt_qimageScaleAARGBA_helper(sptr, xap, Cx, 1, vxap, vCx);-
148 vr = _mm_add_epi32(vr, _mm_mullo_epi32(_mm_srli_epi32(vx, 4), _mm_set1_epi32(j)));-
149-
150 vr = _mm_srli_epi32(vr, 24);-
151 vr = _mm_packus_epi32(vr, _mm_setzero_si128());-
152 vr = _mm_packus_epi16(vr, _mm_setzero_si128());-
153 *dptr = _mm_cvtsi128_si32(vr);-
154 if (RGB
RGBDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
155 *
never executed: *dptr |= 0xff000000;
dptr |= 0xff000000;
never executed: *dptr |= 0xff000000;
0
156 dptr++;-
157 }
never executed: end of block
0
158 }
never executed: end of block
0
159}
never executed: end of block
0
160-
161template void qt_qimageScaleAARGBA_up_x_down_y_sse4<false>(QImageScaleInfo *isi, unsigned int *dest,-
162 int dw, int dh, int dow, int sow);-
163-
164template void qt_qimageScaleAARGBA_up_x_down_y_sse4<true>(QImageScaleInfo *isi, unsigned int *dest,-
165 int dw, int dh, int dow, int sow);-
166-
167template void qt_qimageScaleAARGBA_down_x_up_y_sse4<false>(QImageScaleInfo *isi, unsigned int *dest,-
168 int dw, int dh, int dow, int sow);-
169-
170template void qt_qimageScaleAARGBA_down_x_up_y_sse4<true>(QImageScaleInfo *isi, unsigned int *dest,-
171 int dw, int dh, int dow, int sow);-
172-
173template void qt_qimageScaleAARGBA_down_xy_sse4<false>(QImageScaleInfo *isi, unsigned int *dest,-
174 int dw, int dh, int dow, int sow);-
175-
176template void qt_qimageScaleAARGBA_down_xy_sse4<true>(QImageScaleInfo *isi, unsigned int *dest,-
177 int dw, int dh, int dow, int sow);-
178-
179-
Switch to Source codePreprocessed file

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