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:
parent
b23f5621d7
commit
feb6711a79
@ -4826,7 +4826,7 @@ void QImage::applyColorTransform(const QColorTransform &transform)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if QT_CONFIG(thread) && !defined(Q_OS_WASM)
|
#if QT_CONFIG(thread) && !defined(Q_OS_WASM)
|
||||||
int segments = sizeInBytes() / (1<<16);
|
int segments = (qsizetype(width()) * height()) >> 16;
|
||||||
segments = std::min(segments, height());
|
segments = std::min(segments, height());
|
||||||
QThreadPool *threadPool = QThreadPool::globalInstance();
|
QThreadPool *threadPool = QThreadPool::globalInstance();
|
||||||
if (segments > 1 && threadPool && !threadPool->contains(QThread::currentThread())) {
|
if (segments > 1 && threadPool && !threadPool->contains(QThread::currentThread())) {
|
||||||
|
@ -234,7 +234,7 @@ void convert_generic(QImageData *dest, const QImageData *src, Qt::ImageConversio
|
|||||||
};
|
};
|
||||||
|
|
||||||
#ifdef QT_USE_THREAD_PARALLEL_IMAGE_CONVERSIONS
|
#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);
|
segments = std::min(segments, src->height);
|
||||||
|
|
||||||
QThreadPool *threadPool = QThreadPool::globalInstance();
|
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
|
#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);
|
segments = std::min(segments, src->height);
|
||||||
|
|
||||||
QThreadPool *threadPool = QThreadPool::globalInstance();
|
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
|
#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);
|
segments = std::min(segments, data->height);
|
||||||
QThreadPool *threadPool = QThreadPool::globalInstance();
|
QThreadPool *threadPool = QThreadPool::globalInstance();
|
||||||
if (segments > 1 && threadPool && !threadPool->contains(QThread::currentThread())) {
|
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
|
#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);
|
segments = std::min(segments, data->height);
|
||||||
QThreadPool *threadPool = QThreadPool::globalInstance();
|
QThreadPool *threadPool = QThreadPool::globalInstance();
|
||||||
if (segments > 1 && threadPool && !threadPool->contains(QThread::currentThread())) {
|
if (segments > 1 && threadPool && !threadPool->contains(QThread::currentThread())) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user