Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Demosaiced DNGs fail to load since commit 831a9bbd #6996

Open
Entropy512 opened this issue Mar 17, 2024 · 1 comment · May be fixed by #6997
Open

Demosaiced DNGs fail to load since commit 831a9bbd #6996

Entropy512 opened this issue Mar 17, 2024 · 1 comment · May be fixed by #6997
Milestone

Comments

@Entropy512
Copy link
Contributor

Entropy512 commented Mar 17, 2024

I have some demosaiced (aka Linear RAW) DNGs created by a rather oddball camera (I don't own it, but have put some effort into reverse engineering/supporting it).

One example is at https://filebin.net/a8zb1jja5rwb8dk5

These cause the asserts from 831a9bb to fail because rawdata.getWidth() returns a width that is three times the image width since it has three samples per pixel

Is the value of DNG samplesPerPixel readily available where these asserts are?

Alternatively, maybe asserting (rawData.getWidth() % W) == 0 would work here, under the assumption that getWidth() won't ever be exactly zero if getHeight is nonzero?

Entropy512 added a commit to Entropy512/RawTherapee that referenced this issue Mar 17, 2024
Demosaiced DNGs (aka LinearRAW PhotometricInterpretation) have 3 samples per pixel, so rawData.getWidth() returns triple the width
Only throw an assert if getWidth is not a multiple of W.  This new implementation assumes that getWidth() will never be zero
when getHeight() is nonzero

Fixes Beep6581#6996
@Lawrence37
Copy link
Collaborator

copyOriginalPixels is where rawData gets resized. If ri->getSensorType() == ST_BAYER || ri->getSensorType() == ST_FUJI_XTRANS || ri->get_colors() == 1, then its height and width are H and W. Otherwise, they are H and 3 * W.

@Lawrence37 Lawrence37 added this to the v5.11 milestone Mar 17, 2024
Entropy512 added a commit to Entropy512/RawTherapee that referenced this issue Mar 18, 2024
Uses a new function checkRawDataDimensions as suggested/written by @Lawrence37 to verify that image dimensions are correct.

Fixes Beep6581#6996
Entropy512 added a commit to Entropy512/RawTherapee that referenced this issue Apr 29, 2024
Uses a new function checkRawDataDimensions as suggested/written by @Lawrence37 to verify that image dimensions are correct.

Fixes Beep6581#6996
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants