Segment qimage conversion block irrelevant of depth

Always try segments from 64k to 128k pixels, this matches
qimagescale logic, and gives a one percent speedup locally.

Change-Id: I3ef468eac9dca4b84f04850e970f3d15a4f16255
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
This commit is contained in:
Allan Sandfeld Jensen 2021-02-01 10:24:35 +01:00
parent b23f5621d7
commit feb6711a79
2 changed files with 5 additions and 5 deletions

View File

@ -4826,7 +4826,7 @@ void QImage::applyColorTransform(const QColorTransform &transform)
}
#if QT_CONFIG(thread) && !defined(Q_OS_WASM)
int segments = sizeInBytes() / (1<<16);
int segments = (qsizetype(width()) * height()) >> 16;
segments = std::min(segments, height());
QThreadPool *threadPool = QThreadPool::globalInstance();
if (segments > 1 && threadPool && !threadPool->contains(QThread::currentThread())) {

View File

@ -234,7 +234,7 @@ void convert_generic(QImageData *dest, const QImageData *src, Qt::ImageConversio
};
#ifdef QT_USE_THREAD_PARALLEL_IMAGE_CONVERSIONS
int segments = src->nbytes / (1<<16);
int segments = (qsizetype(src->width) * src->height) >> 16;
segments = std::min(segments, src->height);
QThreadPool *threadPool = QThreadPool::globalInstance();
@ -289,7 +289,7 @@ void convert_generic_over_rgb64(QImageData *dest, const QImageData *src, Qt::Ima
}
};
#ifdef QT_USE_THREAD_PARALLEL_IMAGE_CONVERSIONS
int segments = src->nbytes / (1<<16);
int segments = (qsizetype(src->width) * src->height) >> 16;
segments = std::min(segments, src->height);
QThreadPool *threadPool = QThreadPool::globalInstance();
@ -396,7 +396,7 @@ bool convert_generic_inplace(QImageData *data, QImage::Format dst_format, Qt::Im
}
};
#ifdef QT_USE_THREAD_PARALLEL_IMAGE_CONVERSIONS
int segments = data->nbytes / (1<<16);
int segments = (qsizetype(data->width) * data->height) >> 16;
segments = std::min(segments, data->height);
QThreadPool *threadPool = QThreadPool::globalInstance();
if (segments > 1 && threadPool && !threadPool->contains(QThread::currentThread())) {
@ -490,7 +490,7 @@ bool convert_generic_inplace_over_rgb64(QImageData *data, QImage::Format dst_for
}
};
#ifdef QT_USE_THREAD_PARALLEL_IMAGE_CONVERSIONS
int segments = data->nbytes / (1<<16);
int segments = (qsizetype(data->width) * data->height) >> 16;
segments = std::min(segments, data->height);
QThreadPool *threadPool = QThreadPool::globalInstance();
if (segments > 1 && threadPool && !threadPool->contains(QThread::currentThread())) {