Optimize non-native bilinear transforms

Reading directly from an array instead of calling a function pointer
is much faster.

Change-Id: I833b33448bad064d6f38d2f9ff44138d90206822
Reviewed-by: Gunnar Sletta <gunnar@sletta.org>
This commit is contained in:
Allan Sandfeld Jensen 2015-04-13 11:48:00 +02:00 committed by Joerg Bornemann
parent d4bc56cb42
commit 528279febe

View File

@ -1931,10 +1931,17 @@ static const uint *QT_FASTCALL fetchTransformedBilinear(uint *buffer, const Oper
int x2; int x2;
fetchTransformedBilinear_pixelBounds<blendType>(image_width, image_x1, image_x2, x1, x2); fetchTransformedBilinear_pixelBounds<blendType>(image_width, image_x1, image_x2, x1, x2);
buf1[i * 2 + 0] = fetch(s1, x1); if (layout->bpp == QPixelLayout::BPP32) {
buf1[i * 2 + 1] = fetch(s1, x2); buf1[i * 2 + 0] = ((const uint*)s1)[x1];
buf2[i * 2 + 0] = fetch(s2, x1); buf1[i * 2 + 1] = ((const uint*)s1)[x2];
buf2[i * 2 + 1] = fetch(s2, x2); buf2[i * 2 + 0] = ((const uint*)s2)[x1];
buf2[i * 2 + 1] = ((const uint*)s2)[x2];
} else {
buf1[i * 2 + 0] = fetch(s1, x1);
buf1[i * 2 + 1] = fetch(s1, x2);
buf2[i * 2 + 0] = fetch(s2, x1);
buf2[i * 2 + 1] = fetch(s2, x2);
}
fx += fdx; fx += fdx;
} }
@ -1989,10 +1996,17 @@ static const uint *QT_FASTCALL fetchTransformedBilinear(uint *buffer, const Oper
const uchar *s1 = data->texture.scanLine(y1); const uchar *s1 = data->texture.scanLine(y1);
const uchar *s2 = data->texture.scanLine(y2); const uchar *s2 = data->texture.scanLine(y2);
buf1[i * 2 + 0] = fetch(s1, x1); if (layout->bpp == QPixelLayout::BPP32) {
buf1[i * 2 + 1] = fetch(s1, x2); buf1[i * 2 + 0] = ((const uint*)s1)[x1];
buf2[i * 2 + 0] = fetch(s2, x1); buf1[i * 2 + 1] = ((const uint*)s1)[x2];
buf2[i * 2 + 1] = fetch(s2, x2); buf2[i * 2 + 0] = ((const uint*)s2)[x1];
buf2[i * 2 + 1] = ((const uint*)s2)[x2];
} else {
buf1[i * 2 + 0] = fetch(s1, x1);
buf1[i * 2 + 1] = fetch(s1, x2);
buf2[i * 2 + 0] = fetch(s2, x1);
buf2[i * 2 + 1] = fetch(s2, x2);
}
fx += fdx; fx += fdx;
fy += fdy; fy += fdy;
@ -2074,10 +2088,17 @@ static const uint *QT_FASTCALL fetchTransformedBilinear(uint *buffer, const Oper
const uchar *s1 = data->texture.scanLine(y1); const uchar *s1 = data->texture.scanLine(y1);
const uchar *s2 = data->texture.scanLine(y2); const uchar *s2 = data->texture.scanLine(y2);
buf1[i * 2 + 0] = fetch(s1, x1); if (layout->bpp == QPixelLayout::BPP32) {
buf1[i * 2 + 1] = fetch(s1, x2); buf1[i * 2 + 0] = ((const uint*)s1)[x1];
buf2[i * 2 + 0] = fetch(s2, x1); buf1[i * 2 + 1] = ((const uint*)s1)[x2];
buf2[i * 2 + 1] = fetch(s2, x2); buf2[i * 2 + 0] = ((const uint*)s2)[x1];
buf2[i * 2 + 1] = ((const uint*)s2)[x2];
} else {
buf1[i * 2 + 0] = fetch(s1, x1);
buf1[i * 2 + 1] = fetch(s1, x2);
buf2[i * 2 + 0] = fetch(s2, x1);
buf2[i * 2 + 1] = fetch(s2, x2);
}
fx += fdx; fx += fdx;
fy += fdy; fy += fdy;