[AI] Fix raw denoise output corrupted DNG / process crash on some libtiff builds#20898
Merged
TurboGit merged 2 commits intodarktable-org:masterfrom Apr 29, 2026
Merged
Conversation
Contributor
|
@andriiryzhkov unfortunately this didn't fix the issue, this is the current output: As I mentioned I am running libtiff-4 in version 4.5.1, which one are you using on your machine? |
Contributor
Author
|
Do you have the same error on nightly build? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes two symptoms reported in #20854 (comment):
Entry 0x828d not found)ThrowLoggedExceptionassertion in ImageMagick) on some images, in both CPU and MIGraphX modesBoth trace to libtiff CFA / DNG extension tag info handling on the SubIFD in the canonical Adobe layout (IFD0 = JPEG preview, SubIFD0 = raw payload) introduced in #20854.
Fixes
1. Re-initialize SubIFD tag info. After
TIFFWriteDirectory(IFD0), some libtiff packagings drop the registered field info for CFA / DNG extension tags. The nextTIFFSetField(TIFFTAG_CFAREPEATPATTERNDIM, ...)then silently fails - producing a DNG without the CFA pattern that rawspeed can't decode. One-line fix: callTIFFCreateDirectory(tif)between IFD0 commit and SubIFD population. Applied in bothdt_imageio_dng_write_cfa_bayeranddt_imageio_dng_write_linear. No-op on libtiff builds that already retained the tag info.2. Install our own libtiff error/warning handlers. When the unknown-tag error fires on systems where ImageMagick has installed itself as the global libtiff error handler, ImageMagick's
TIFFReadErrorscallsThrowLoggedException(NULL, ...)and aborts. Same pattern asimageio_tiff.calready uses: handlers log to stderr and never abort, overriding whatever else is in the process.