Skip to content

Commit 0f7f120

Browse files
committed
DngDecoder: detect JPEG XL chunks
1 parent 6eac455 commit 0f7f120

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

src/librawspeed/decoders/DngDecoder.cpp

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,9 @@ void DngDecoder::dropUnsuportedChunks(std::vector<const TiffIFD*>* data) {
119119
case 9: // VC-5 as used by GoPro
120120
#ifdef HAVE_JPEG
121121
case 0x884c: // lossy JPEG
122+
#endif
123+
#ifdef HAVE_JXL
124+
case 0xcd42: // JPEG XL
122125
#endif
123126
// no change, if supported, then is still supported.
124127
break;
@@ -140,6 +143,15 @@ void DngDecoder::dropUnsuportedChunks(std::vector<const TiffIFD*>* data) {
140143
"chunk, but the jpeg support was "
141144
"disabled at build!");
142145
[[clang::fallthrough]];
146+
#endif
147+
#ifndef HAVE_JXL
148+
case 0xcd42: // JPEG XL
149+
#pragma message \
150+
"JPEG XL is not present! JPEG XL compression will not be supported!"
151+
writeLog(DEBUG_PRIO::WARNING, "DNG Decoder: found JPEG XL encoded "
152+
"chunk, but the jpeg xl support was "
153+
"disabled at build!");
154+
[[clang::fallthrough]];
143155
#endif
144156
default:
145157
supported = false;
@@ -362,10 +374,11 @@ void DngDecoder::decodeData(const TiffIFD* raw, uint32_t sample_format) const {
362374
if (compression == 8 && sample_format != 3) {
363375
ThrowRDE("Only float format is supported for "
364376
"deflate-compressed data.");
365-
} else if ((compression == 7 || compression == 0x884c) &&
377+
} else if ((compression == 7 || compression == 0x884c ||
378+
compression == 0xcd42) &&
366379
sample_format != 1) {
367380
ThrowRDE("Only 16 bit unsigned data supported for "
368-
"JPEG-compressed data.");
381+
"JPEG or JPEG XL compressed data.");
369382
}
370383

371384
uint32_t predictor = ~0U;

0 commit comments

Comments
 (0)