mirror of
https://invent.kde.org/frameworks/kimageformats.git
synced 2025-05-28 00:30:23 -04:00
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:
parent
9f05ecb523
commit
92a1752c1f
BIN
autotests/read/jxl/rgb_lossless_noprof.jxl
Normal file
BIN
autotests/read/jxl/rgb_lossless_noprof.jxl
Normal file
Binary file not shown.
BIN
autotests/read/jxl/rgb_lossless_noprof.png
Normal file
BIN
autotests/read/jxl/rgb_lossless_noprof.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 829 KiB |
@ -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) {
|
||||
|
@ -51,7 +51,7 @@ private:
|
||||
bool countALLFrames();
|
||||
bool decode_one_frame();
|
||||
bool rewind();
|
||||
bool decodeBoxes();
|
||||
bool decodeBoxes(JxlDecoderStatus &status);
|
||||
|
||||
enum ParseJpegXLState {
|
||||
ParseJpegXLError = -1,
|
||||
|
Loading…
Reference in New Issue
Block a user