JXL: load error with some lossless file

When loading lossless JXL images without ICC profile, the parser failed.
The problem was caused by Boxes being enabled (MR !250). The parser should probably be revised to be more flexible.

CCBUG: 496350
This commit is contained in:
Mirco Miranda 2024-11-20 16:34:00 +00:00 committed by Albert Astals Cid
parent 9f05ecb523
commit 92a1752c1f
4 changed files with 9 additions and 6 deletions

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 829 KiB

View File

@ -203,7 +203,7 @@ bool QJpegXLHandler::ensureDecoder()
return false;
}
if (!decodeBoxes()) {
if (!decodeBoxes(status)) {
return false;
}
@ -236,7 +236,11 @@ bool QJpegXLHandler::countALLFrames()
return false;
}
JxlDecoderStatus status = JxlDecoderProcessInput(m_decoder);
JxlDecoderStatus status;
if (!decodeBoxes(status)) {
return false;
}
if (status != JXL_DEC_COLOR_ENCODING) {
qWarning("Unexpected event %d instead of JXL_DEC_COLOR_ENCODING", status);
m_parseState = ParseJpegXLError;
@ -401,7 +405,7 @@ bool QJpegXLHandler::countALLFrames()
}
#ifndef JXL_DECODE_BOXES_DISABLED
if (!decodeBoxes()) {
if (!decodeBoxes(status)) {
return false;
}
#endif
@ -1162,9 +1166,8 @@ bool QJpegXLHandler::rewind()
return true;
}
bool QJpegXLHandler::decodeBoxes()
bool QJpegXLHandler::decodeBoxes(JxlDecoderStatus &status)
{
JxlDecoderStatus status;
do { // decode metadata
status = JxlDecoderProcessInput(m_decoder);
if (status == JXL_DEC_BOX) {

View File

@ -51,7 +51,7 @@ private:
bool countALLFrames();
bool decode_one_frame();
bool rewind();
bool decodeBoxes();
bool decodeBoxes(JxlDecoderStatus &status);
enum ParseJpegXLState {
ParseJpegXLError = -1,