Add lossless JPEG compression for raw denoise DNG output#21448
Draft
andriiryzhkov wants to merge 2 commits into
Draft
Add lossless JPEG compression for raw denoise DNG output#21448andriiryzhkov wants to merge 2 commits into
andriiryzhkov wants to merge 2 commits into
Conversation
Collaborator
Author
|
Moving to draft — the implementation hits a Linux distribution problem I didn't catch before.
Path options:
Parking the PR until I have a clearer answer. |
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.
Sibling to #21435 (TIFF compression for denoise/upscale). That PR handles the TIFF outputs; this one does the equivalent for raw denoise, which writes DNG.
The naïve fix –
COMPRESSION_JPEG+ tile writes – doesn't work: libtiff's JPEG codec hard-rejects 16-bit. So I encode each 256×256 tile with libjpeg-turbo (which does support 16-bit lossless), tell libtiffCOMPRESSION_ADOBE_DEFLATEso it accepts the setup, hand it the JPEG bytes viaTIFFWriteRawTile()(libtiff stores opaque bytes without invoking its codec), then post-patch the Compression tag from 8 → 7 in the closed file. The on-disk data is genuine lossless JPEG; the deflate codec is never actually invoked. Documented in detail at the top ofsrc/imageio/imageio_dng.c.A new
compressioncombo in the raw-denoise output panel (uncompressed / lossless JPEG, default lossless) mirrors the TIFF combo from #21435.File size on a noisy ISO 6400 Canon R7: ~50 MB → ~41 MB. Cleaner sources compress better.