summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@theqtcompany.com>2015-02-19 11:20:52 +0100
committerAllan Sandfeld Jensen <allan.jensen@theqtcompany.com>2015-03-03 13:38:17 +0000
commit59f168c5e5eec7ac247e6154a65f85a7ccc6e7ad (patch)
tree6c80267788ca979465fe7ea3cb921947c05a4476 /tests
parentbfb92c03e0d8e7a3a65b64d1f2f5b89f442e2b8a (diff)
Optimize fallback RGB888 to RGB32 conversion
Improves the conversion from RGB888 to RGB32 on platforms without SIMD versions. This includes the fallback used on non-neon ARM devices. Besides image conversion the routine is also used for decoding JPEG. On x86 this version is within 0.7x of the speed of the SSSE3 version. Change-Id: Id131994d7c3c4f879d89e80f9d6c435bb5535ed7 Reviewed-by: Gunnar Sletta <gunnar@sletta.org>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/gui/image/qimage/tst_qimage.cpp7
-rw-r--r--tests/benchmarks/gui/image/qimageconversion/tst_qimageconversion.cpp24
2 files changed, 29 insertions, 2 deletions
diff --git a/tests/auto/gui/image/qimage/tst_qimage.cpp b/tests/auto/gui/image/qimage/tst_qimage.cpp
index 7d2d009213..decd4ef931 100644
--- a/tests/auto/gui/image/qimage/tst_qimage.cpp
+++ b/tests/auto/gui/image/qimage/tst_qimage.cpp
@@ -734,6 +734,13 @@ void tst_QImage::convertToFormat_data()
QTest::newRow("blue rgb888 -> argb32") << int(QImage::Format_RGB888) << 0xff0000ff
<< int(QImage::Format_ARGB32) << 0xff0000ff;
+ QTest::newRow("red rgb888 -> rgbx8888") << int(QImage::Format_RGB888) << 0xffff0000
+ << int(QImage::Format_RGBX8888) << 0xffff0000;
+ QTest::newRow("green rgb888 -> rgbx8888") << int(QImage::Format_RGB888) << 0xff00ff00
+ << int(QImage::Format_RGBX8888) << 0xff00ff00;
+ QTest::newRow("blue rgb888 -> rgbx8888") << int(QImage::Format_RGB888) << 0xff0000ff
+ << int(QImage::Format_RGBX8888) << 0xff0000ff;
+
QTest::newRow("semired argb32 -> rgb888") << int(QImage::Format_ARGB32) << 0x7fff0000u
<< int(QImage::Format_RGB888) << 0xffff0000;
QTest::newRow("semigreen argb32 -> rgb888") << int(QImage::Format_ARGB32) << 0x7f00ff00u
diff --git a/tests/benchmarks/gui/image/qimageconversion/tst_qimageconversion.cpp b/tests/benchmarks/gui/image/qimageconversion/tst_qimageconversion.cpp
index d4834a04e2..2d4a453b58 100644
--- a/tests/benchmarks/gui/image/qimageconversion/tst_qimageconversion.cpp
+++ b/tests/benchmarks/gui/image/qimageconversion/tst_qimageconversion.cpp
@@ -43,6 +43,9 @@ private slots:
void convertRgb888ToRgb32_data();
void convertRgb888ToRgb32();
+ void convertRgb888ToRgbx8888_data();
+ void convertRgb888ToRgbx8888();
+
void convertRgb32ToRgb888_data();
void convertRgb32ToRgb888();
@@ -74,8 +77,8 @@ void tst_QImageConversion::convertRgb888ToRgb32_data()
// 16 pixels, minimum for the SSSE3 implementation
QTest::newRow("width: 16px; height: 5000px;") << generateImageRgb888(16, 5000);
- // 50 pixels, more realistic use case
- QTest::newRow("width: 50px; height: 5000px;") << generateImageRgb888(50, 5000);
+ // 200 pixels, more realistic use case
+ QTest::newRow("width: 200px; height: 5000px;") << generateImageRgb888(200, 5000);
// 2000 pixels -> typical values for pictures
QTest::newRow("width: 2000px; height: 2000px;") << generateImageRgb888(2000, 2000);
@@ -93,6 +96,23 @@ void tst_QImageConversion::convertRgb888ToRgb32()
}
}
+void tst_QImageConversion::convertRgb888ToRgbx8888_data()
+{
+ convertRgb888ToRgb32_data();
+}
+
+void tst_QImageConversion::convertRgb888ToRgbx8888()
+{
+ QFETCH(QImage, inputImage);
+
+ QBENCHMARK {
+ volatile QImage output = inputImage.convertToFormat(QImage::Format_RGBX8888);
+ // we need the volatile and the following to make sure the compiler does not do
+ // anything stupid :)
+ (void)output;
+ }
+}
+
void tst_QImageConversion::convertRgb32ToRgb888_data()
{
QTest::addColumn<QImage>("inputImage");