diff --git a/autotests/read/jxl/rgb_lossless_noprof.jxl b/autotests/read/jxl/rgb_lossless_noprof.jxl new file mode 100644 index 0000000..c966ec1 Binary files /dev/null and b/autotests/read/jxl/rgb_lossless_noprof.jxl differ diff --git a/autotests/read/jxl/rgb_lossless_noprof.png b/autotests/read/jxl/rgb_lossless_noprof.png new file mode 100644 index 0000000..726703a Binary files /dev/null and b/autotests/read/jxl/rgb_lossless_noprof.png differ diff --git a/src/imageformats/jxl.cpp b/src/imageformats/jxl.cpp index ab5c41b..0274ce0 100644 --- a/src/imageformats/jxl.cpp +++ b/src/imageformats/jxl.cpp @@ -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) { diff --git a/src/imageformats/jxl_p.h b/src/imageformats/jxl_p.h index 7cffafb..7648e0c 100644 --- a/src/imageformats/jxl_p.h +++ b/src/imageformats/jxl_p.h @@ -51,7 +51,7 @@ private: bool countALLFrames(); bool decode_one_frame(); bool rewind(); - bool decodeBoxes(); + bool decodeBoxes(JxlDecoderStatus &status); enum ParseJpegXLState { ParseJpegXLError = -1,