feat(process): expose the demosaic algorithm - #1032
Merged
Merged
Conversation
The CFA interpolation was decided by hardcoded branches: AHD for a mosaiced sensor, LINEAR for anything already de-mosaiced, and a separate fast rule in the preview path. Both choices are now the user's, picked separately for the preview and for export, in a new Demosaic panel under Calibration. Auto keeps the old behaviour on both paths and is the default, so an existing edit renders identically (verified byte-identical against AHD on a Bayer NEF). The dropdown is built from rawpy's isSupported at runtime, so a libraw without the GPL demosaic packs never offers a value it cannot run, and an unrecognised persisted value resolves back to Auto. A source with no CFA still decodes LINEAR whatever is selected. An explicit preview algorithm drops half_size: libraw bins 2x2 quads and never reaches the interpolator, so the fast path would ignore the choice. Cache keys the change had to reach: PreviewCacheKey, source_token (the preview field only, or an export-only change would re-decode the open frame), _source_cache_key and the export detect_key.
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.
Closes #1030.
The CFA interpolation was decided by hardcoded branches. It is now a user choice, made separately for the preview and for export, in a new Demosaic panel under Calibration.
What it does
DemosaicMode(Auto,Linear,VNG,PPG,AHD,DCB,DHT,AAHD) and two stickyProcessConfigfields,demosaic_previewanddemosaic_export, both defaulting toAuto.Autois exactly the old behaviour on each path: a half-size LINEAR decode on screen, AHD for export. An existing edit renders identically, verified byte-identical against AHD on a Bayer NEF.isSupportedat runtime, so a libraw built without the GPL demosaic packs never offers a value it cannot run. An unrecognised persisted value resolves back toAuto.NonStandardFileWrapper.postprocessignoresdemosaic_algorithmoutright.Notes
half_size. Libraw bins 2x2 quads and never reaches the interpolator, so the fast path would silently ignore the choice. The panel hint says Auto and Linear are the fastest for the preview.get_best_demosaic_algorithm(raw, mode)stays the single resolver; every decode site routes through it rather than re-deriving the rule.PreviewCacheKey,source_token(the preview field only, or an export-only change would re-decode the open frame),ImageProcessor._source_cache_key, and the exportdetect_key.Left alone deliberately: thumbnails, autodetect and capture metering. They feed classifiers and contact-sheet tiles, and wiring thumbnails in would force a cache-version bump for no visible gain.
Verification
make lint,make typeand 5365 tests green. On a real Bayer NEF: exportAutois byte-identical to AHD, DHT and VNG differ; the preview differs under VNG at the same output size.Docs: new
USER_GUIDE§4.2 with itspanel:demosaicmarker (4.2 to 4.4 renumbered, references updated) and thePIPELINE.mddecode bullet.