jxl: Disable color conversion for animations

Partial backport from master
This commit is contained in:
Daniel Novomeský 2024-12-02 18:41:10 +01:00
parent 1e47a751df
commit df82311a10

View File

@ -228,7 +228,7 @@ bool QJpegXLHandler::countALLFrames()
} }
JxlColorEncoding color_encoding; JxlColorEncoding color_encoding;
if (m_basicinfo.uses_original_profile == JXL_FALSE) { if (m_basicinfo.uses_original_profile == JXL_FALSE && m_basicinfo.have_animation == JXL_FALSE) {
JxlColorEncodingSetToSRGB(&color_encoding, JXL_FALSE); JxlColorEncodingSetToSRGB(&color_encoding, JXL_FALSE);
JxlDecoderSetPreferredColorProfile(m_decoder, &color_encoding); JxlDecoderSetPreferredColorProfile(m_decoder, &color_encoding);
} }
@ -960,13 +960,7 @@ bool QJpegXLHandler::rewind()
JxlDecoderCloseInput(m_decoder); JxlDecoderCloseInput(m_decoder);
if (m_basicinfo.uses_original_profile) { if (m_basicinfo.uses_original_profile == JXL_FALSE && m_basicinfo.have_animation == JXL_FALSE) {
if (JxlDecoderSubscribeEvents(m_decoder, JXL_DEC_FULL_IMAGE) != JXL_DEC_SUCCESS) {
qWarning("ERROR: JxlDecoderSubscribeEvents failed");
m_parseState = ParseJpegXLError;
return false;
}
} else {
if (JxlDecoderSubscribeEvents(m_decoder, JXL_DEC_COLOR_ENCODING | JXL_DEC_FULL_IMAGE) != JXL_DEC_SUCCESS) { if (JxlDecoderSubscribeEvents(m_decoder, JXL_DEC_COLOR_ENCODING | JXL_DEC_FULL_IMAGE) != JXL_DEC_SUCCESS) {
qWarning("ERROR: JxlDecoderSubscribeEvents failed"); qWarning("ERROR: JxlDecoderSubscribeEvents failed");
m_parseState = ParseJpegXLError; m_parseState = ParseJpegXLError;
@ -983,6 +977,12 @@ bool QJpegXLHandler::rewind()
JxlColorEncoding color_encoding; JxlColorEncoding color_encoding;
JxlColorEncodingSetToSRGB(&color_encoding, JXL_FALSE); JxlColorEncodingSetToSRGB(&color_encoding, JXL_FALSE);
JxlDecoderSetPreferredColorProfile(m_decoder, &color_encoding); JxlDecoderSetPreferredColorProfile(m_decoder, &color_encoding);
} else {
if (JxlDecoderSubscribeEvents(m_decoder, JXL_DEC_FULL_IMAGE) != JXL_DEC_SUCCESS) {
qWarning("ERROR: JxlDecoderSubscribeEvents failed");
m_parseState = ParseJpegXLError;
return false;
}
} }
return true; return true;