Add support for embedded lens corrections in RawNIND/AI-denoised DNGs#21507
Add support for embedded lens corrections in RawNIND/AI-denoised DNGs#21507trougnouf wants to merge 1 commit into
Conversation
Implement serialization of DNG OpcodeList2 and OpcodeList3 to preserve embedded lens correction data (warp rectilinear, vignette radial, gain maps) when writing DNG files. Key changes: - Add dt_dng_opcode_serialize_opcode_list_2() and _3() functions to serialize correction data from dt_image_t to DNG opcode list format - Add _write_dng_opcode_lists() helper in imageio_dng.c to write opcode lists to TIFF directories using libtiff's TIFFTAG_OPCODELIST2/3 tags - Modify dt_imageio_dng_write_cfa_bayer() and dt_imageio_dng_write_linear() to call _write_dng_opcode_lists() and preserve correction data - Add fallback definitions for TIFFTAG_OPCODELIST* tags for older libtiff This ensures that when RawNIND/AI-denoise creates a DNG file from a source image that has embedded lens corrections (e.g., from a DNG with OpcodeList3), those corrections are preserved in the output DNG and will be automatically applied when the denoised DNG is re-imported into darktable. Fixes: darktable-org#21504 Generated by Mistral Vibe. Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
bec5527 to
7784061
Compare
|
Re-tested after ensuring that it compiles on the CI, it still allows for embedded lens corrections :) |
Testing note: Sony ARWs are already handled by #21449 (which sets To exercise this PR's actual code path, source needs to be a file where |
|
Sorry about that, I should have tested the master branch first! |
|
No problems, and thank you for the contribution. The underlying change is still valid and worth landing. Though it focuses on DNG-source workflows in neural restore module. |
I confirm that the current master branch supports embedded lens corrections on both the Sony A7C and (X-Trans) Fujifilm X-E2.
Should I not close this PR then? |
Keep it. |
Implement serialization of DNG OpcodeList2 and OpcodeList3 to preserve embedded lens correction data (warp rectilinear, vignette radial, gain maps) when writing DNG files.
Key changes:
This ensures that when RawNIND/AI-denoise creates a DNG file from a source image that has embedded lens corrections (e.g., from a DNG with OpcodeList3), those corrections are preserved in the output DNG and will be automatically applied when the denoised DNG is re-imported into darktable.
Fixes #21504
Generated by Mistral Vibe.
This was entirely vibe coded. I tested it on a Sony A7C ARW picture on Arch Linux and it worked well; there is a distinct geometry and vignetting difference between no lens correction, lensfun, and embedded.