6#include <private/qsimd_p.h>
8#if QT_CONFIG(thread) && !defined(Q_OS_WASM)
11#include <private/qthreadpool_p.h>
14#if defined(__ARM_NEON__)
23#if QT_CONFIG(thread) && !defined(Q_OS_WASM)
32 threadPool->
start([&,
y, yn]() {
33 scaleSection(
y,
y + yn);
47 uint32x2_t vpix32 = vmov_n_u32(*
pix);
48 uint16x4_t vpix16 = vget_low_u16(vmovl_u8(vreinterpret_u8_u32(vpix32)));
49 uint32x4_t vx = vmull_n_u16(vpix16, xyap);
51 for (
i = (1 << 14) - xyap;
i > Cxy;
i -= Cxy) {
53 vpix32 = vmov_n_u32(*
pix);
54 vpix16 = vget_low_u16(vmovl_u8(vreinterpret_u8_u32(vpix32)));
55 vx = vaddq_u32(vx, vmull_n_u16(vpix16, Cxy));
58 vpix32 = vmov_n_u32(*
pix);
59 vpix16 = vget_low_u16(vmovl_u8(vreinterpret_u8_u32(vpix32)));
60 vx = vaddq_u32(vx, vmull_n_u16(vpix16,
i));
65void qt_qimageScaleAARGBA_up_x_down_y_neon(
QImageScaleInfo *isi,
unsigned int *dest,
66 int dw,
int dh,
int dow,
int sow)
68 const unsigned int **ypoints = isi->
ypoints;
74 auto scaleSection = [&] (
int yStart,
int yEnd) {
75 for (
int y = yStart;
y < yEnd; ++
y) {
76 int Cy = yapoints[
y] >> 16;
77 int yap = yapoints[
y] & 0xffff;
79 unsigned int *dptr = dest + (
y * dow);
80 for (
int x = 0;
x < dw;
x++) {
81 const unsigned int *sptr = ypoints[
y] + xpoints[
x];
84 int xap = xapoints[
x];
88 vx = vmulq_n_u32(vx, 256 - xap);
89 vr = vmulq_n_u32(vr, xap);
90 vx = vaddq_u32(vx, vr);
91 vx = vshrq_n_u32(vx, 8);
93 vx = vshrq_n_u32(vx, 14);
94 const uint16x4_t vx16 = vmovn_u32(vx);
95 const uint8x8_t vx8 = vmovn_u16(vcombine_u16(vx16, vx16));
96 *dptr = vget_lane_u32(vreinterpret_u32_u8(vx8), 0);
107void qt_qimageScaleAARGBA_down_x_up_y_neon(
QImageScaleInfo *isi,
unsigned int *dest,
108 int dw,
int dh,
int dow,
int sow)
110 const unsigned int **ypoints = isi->
ypoints;
116 auto scaleSection = [&] (
int yStart,
int yEnd) {
117 for (
int y = yStart;
y < yEnd; ++
y) {
118 unsigned int *dptr = dest + (
y * dow);
119 for (
int x = 0;
x < dw;
x++) {
120 int Cx = xapoints[
x] >> 16;
121 int xap = xapoints[
x] & 0xffff;
123 const unsigned int *sptr = ypoints[
y] + xpoints[
x];
126 int yap = yapoints[
y];
130 vx = vmulq_n_u32(vx, 256 - yap);
131 vr = vmulq_n_u32(vr, yap);
132 vx = vaddq_u32(vx, vr);
133 vx = vshrq_n_u32(vx, 8);
135 vx = vshrq_n_u32(vx, 14);
136 const uint16x4_t vx16 = vmovn_u32(vx);
137 const uint8x8_t vx8 = vmovn_u16(vcombine_u16(vx16, vx16));
138 *dptr = vget_lane_u32(vreinterpret_u32_u8(vx8), 0);
149void qt_qimageScaleAARGBA_down_xy_neon(
QImageScaleInfo *isi,
unsigned int *dest,
150 int dw,
int dh,
int dow,
int sow)
152 const unsigned int **ypoints = isi->
ypoints;
157 auto scaleSection = [&] (
int yStart,
int yEnd) {
158 for (
int y = yStart;
y < yEnd; ++
y) {
159 int Cy = yapoints[
y] >> 16;
160 int yap = yapoints[
y] & 0xffff;
162 unsigned int *dptr = dest + (
y * dow);
163 for (
int x = 0;
x < dw;
x++) {
164 const int Cx = xapoints[
x] >> 16;
165 const int xap = xapoints[
x] & 0xffff;
167 const unsigned int *sptr = ypoints[
y] + xpoints[
x];
169 vx = vshrq_n_u32(vx, 4);
170 uint32x4_t vr = vmulq_n_u32(vx, yap);
173 for (
j = (1 << 14) - yap;
j > Cy;
j -= Cy) {
176 vx = vshrq_n_u32(vx, 4);
177 vx = vmulq_n_u32(vx, Cy);
178 vr = vaddq_u32(vr, vx);
182 vx = vshrq_n_u32(vx, 4);
183 vx = vmulq_n_u32(vx,
j);
184 vr = vaddq_u32(vr, vx);
186 vx = vshrq_n_u32(vr, 24);
187 const uint16x4_t vx16 = vmovn_u32(vx);
188 const uint8x8_t vx8 = vmovn_u16(vcombine_u16(vx16, vx16));
189 *dptr = vget_lane_u32(vreinterpret_u32_u8(vx8), 0);
199template void qt_qimageScaleAARGBA_up_x_down_y_neon<false>(
QImageScaleInfo *isi,
unsigned int *dest,
200 int dw,
int dh,
int dow,
int sow);
202template void qt_qimageScaleAARGBA_up_x_down_y_neon<true>(
QImageScaleInfo *isi,
unsigned int *dest,
203 int dw,
int dh,
int dow,
int sow);
205template void qt_qimageScaleAARGBA_down_x_up_y_neon<false>(
QImageScaleInfo *isi,
unsigned int *dest,
206 int dw,
int dh,
int dow,
int sow);
208template void qt_qimageScaleAARGBA_down_x_up_y_neon<true>(
QImageScaleInfo *isi,
unsigned int *dest,
209 int dw,
int dh,
int dow,
int sow);
211template void qt_qimageScaleAARGBA_down_xy_neon<false>(
QImageScaleInfo *isi,
unsigned int *dest,
212 int dw,
int dh,
int dow,
int sow);
214template void qt_qimageScaleAARGBA_down_xy_neon<true>(
QImageScaleInfo *isi,
unsigned int *dest,
215 int dw,
int dh,
int dow,
int sow);
void acquire(int n=1)
Tries to acquire n resources guarded by the semaphore.
void release(int n=1)
Releases n resources guarded by the semaphore.
static QThreadPool * qtGuiInstance()
Returns the QThreadPool instance for Qt Gui.
void start(QRunnable *runnable, int priority=0)
Reserves a thread and uses it to run runnable, unless this thread will make the current thread count ...
bool contains(const QThread *thread) const
static QThread * currentThread()
Combined button and popup list for selecting options.
static void multithread_pixels_function(QImageScaleInfo *isi, int dh, const T &scaleSection)
static void qt_qimageScaleAARGBA_helper(const unsigned int *pix, int xyap, int Cxy, int step, int &r, int &g, int &b, int &a)
GLint GLint GLint GLint GLint x
[0]
const unsigned int ** ypoints