mirror of
https://invent.kde.org/frameworks/kimageformats.git
synced 2025-06-03 17:08:08 -04:00
avif: adjust for libavif breaking change in YUV<->RGB conversion
This commit is contained in:
parent
feb6d9b20f
commit
9ac923ad09
@ -336,7 +336,7 @@ bool QAVIFHandler::decode_one_frame()
|
|||||||
rgb.format = AVIF_RGB_FORMAT_ARGB;
|
rgb.format = AVIF_RGB_FORMAT_ARGB;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if AVIF_VERSION >= 80400
|
#if (AVIF_VERSION >= 80400) && (AVIF_VERSION <= 100100)
|
||||||
if (m_decoder->imageCount > 1) {
|
if (m_decoder->imageCount > 1) {
|
||||||
/* accelerate animated AVIF */
|
/* accelerate animated AVIF */
|
||||||
rgb.chromaUpsampling = AVIF_CHROMA_UPSAMPLING_FASTEST;
|
rgb.chromaUpsampling = AVIF_CHROMA_UPSAMPLING_FASTEST;
|
||||||
@ -351,7 +351,12 @@ bool QAVIFHandler::decode_one_frame()
|
|||||||
rgb.rowBytes = result.bytesPerLine();
|
rgb.rowBytes = result.bytesPerLine();
|
||||||
rgb.pixels = result.bits();
|
rgb.pixels = result.bits();
|
||||||
|
|
||||||
|
#if AVIF_VERSION >= 100101
|
||||||
|
// use faster decoding for animations
|
||||||
|
avifResult res = avifImageYUVToRGB(m_decoder->image, &rgb, (m_decoder->imageCount > 1) ? AVIF_CHROMA_UPSAMPLING_NEAREST : AVIF_YUV_TO_RGB_DEFAULT);
|
||||||
|
#else
|
||||||
avifResult res = avifImageYUVToRGB(m_decoder->image, &rgb);
|
avifResult res = avifImageYUVToRGB(m_decoder->image, &rgb);
|
||||||
|
#endif
|
||||||
if (res != AVIF_RESULT_OK) {
|
if (res != AVIF_RESULT_OK) {
|
||||||
qWarning("ERROR in avifImageYUVToRGB: %s", avifResultToString(res));
|
qWarning("ERROR in avifImageYUVToRGB: %s", avifResultToString(res));
|
||||||
return false;
|
return false;
|
||||||
@ -777,7 +782,11 @@ bool QAVIFHandler::write(const QImage &image)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if AVIF_VERSION >= 100101
|
||||||
|
res = avifImageRGBToYUV(avif, &rgb, AVIF_RGB_TO_YUV_DEFAULT);
|
||||||
|
#else
|
||||||
res = avifImageRGBToYUV(avif, &rgb);
|
res = avifImageRGBToYUV(avif, &rgb);
|
||||||
|
#endif
|
||||||
if (res != AVIF_RESULT_OK) {
|
if (res != AVIF_RESULT_OK) {
|
||||||
qWarning("ERROR in avifImageRGBToYUV: %s", avifResultToString(res));
|
qWarning("ERROR in avifImageRGBToYUV: %s", avifResultToString(res));
|
||||||
return false;
|
return false;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user