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

Leica M10 support (0.3% of my images can't be loaded) #11695

Closed
17mono opened this issue Apr 30, 2022 · 14 comments
Closed

Leica M10 support (0.3% of my images can't be loaded) #11695

17mono opened this issue Apr 30, 2022 · 14 comments
Assignees
Labels
bug: upstream he bug needs a fix outside of the scope of darktable, in an external lib or in a driver scope: camera support adding WB and raw support for new cameras

Comments

@17mono
Copy link

17mono commented Apr 30, 2022

👋 Hi, Darktable already works perfectly fine with almost all of the Leica M10 DNG files I've imported so far, but about 0.3% of my images can't be loaded at all. It says:

darktable could not load 'L1007566.DNG'; switching to lighttable now.

I'm using:

  • Darktable 3.8.1
  • Ubuntu 20.04.4 LTS
  • Leica M10 Firmware 2.7.5

I've uploaded two samples to https://raw.pixls.us:

  • L1008407.DNG (brick wall): Can be loaded and edited successfully
  • L1007566.DNG (birds & moon): This is one of the odd files that can't be loaded

Reimporting the problematic files does not help. They can be opened with other programs, so they are probably not corrupted.

Please let me know if you need more information / samples.

@17mono 17mono added the scope: camera support adding WB and raw support for new cameras label Apr 30, 2022
@jenshannoschwalm
Copy link
Collaborator

The problematic file is not in the database. Please share it otherwise.

@17mono
Copy link
Author

17mono commented May 4, 2022

L1007566.zip

@kmilos
Copy link
Contributor

kmilos commented May 5, 2022

From the log:

[rawspeed] (L1007566.DNG) void rawspeed::AbstractDngDecompressor::decompress() const, line 217: Too many errors encountered. Giving up. First Error:
rawspeed::Buffer::size_type rawspeed::ByteStream::check(rawspeed::Buffer::size_type) const, line 59: Out of bounds access in ByteStream 

Next is to check the w/ debug build what's going on, whether the file is really corrupt or something else...

@kmilos
Copy link
Contributor

kmilos commented May 5, 2022

Loading fails because rawspeed can't find the JPEG EOI marker, and it can't find it because the DNG StripByteCounts is wrong (it is too small; the EOI marker does exist, but not within the file announced StripByteCounts).

So the file, is in fact, corrupt/invalid strictly speaking. If I edit the StripByteCounts to include the EOI marker, the file loads in dt just fine.

Other software works because it probably does no such strict checking, which in fact is not an advantage (i.e. can be seen as a security vulnerability).

@jenshannoschwalm
Copy link
Collaborator

So either a rotten card, a problem of the connection to you pc or a firmware issue for Leica to report there.

Would be interested how you import the images. Copy first to your hard disk and import or directly importing from your camera?

@17mono
Copy link
Author

17mono commented May 6, 2022

I'll try to reproduce the problem with other SD cards, maybe it really was a faulty card.

I use a card reader, but my process is finicky because my card reader doesn't work with Ubuntu. I have to copy the files from the SD card to a USB flash drive using Mac OS first, then switch to Ubuntu and use "copy & import" in darktable to import the files from the USB drive. Many possible sources of error here, I know.

At one time I tried copying a problematic file from the SD card for a second time (to find out if it had just been a one-off error during file transfer), but darktable was still unable to open it.

By the way: The problematic file can be converted successfully using Adobe DNG Converter, and the converted DNG can be opened in darktable. Not sure what that says about possible file corruption, though.

Would it be pragmatic for darktable to tolerate invalid StripByteCounts (maybe with a warning), or would that be too much of a security issue?

@kmilos
Copy link
Contributor

kmilos commented May 9, 2022

IMHO, I think your time is better spent trying to figure out why these files are in this state in the first place, and if eventually something needs to be flagged to the camera vendor.

As mentioned, there is workaround available - they decode just fine once you correct the StripByteCounts on these 0.3%.

@kmilos
Copy link
Contributor

kmilos commented May 9, 2022

Sure. It is way off, 23442499 instead of 23564132 for this file, very strange...

L1007566_fixed.zip

@kmilos
Copy link
Contributor

kmilos commented May 9, 2022

Funny that (3 bytes) change does not decode in ffmpeg anymore, because before that it was skeeping (?) 2992x3992 and 1440x960 (1440x960 it could not even see before)

It fails with Pixel format 0x21111100 bits:8 is not implemented.

Does it also fail the same way w/ the working Leica M10 sample?

Are you sure you are not reading some kind of preview, jpeg/tiff thumbnail?

Rawspeed doesn't read previews/thumbnails.

@ghost
Copy link

ghost commented Oct 15, 2022

I am experiencing similar (the same?) issues with a Leica M240 with firmware version 2.0.5.0 on darktable 3.8.1 at roughly the same rate, across multiple SD cards, and SD card readers (confirmed that the checksums are identical between readers).

[rawspeed] (L1008551.DNG) void rawspeed::AbstractDngDecompressor::decompress() const, line 217: Too many errors encountered. Giving up. First Error:
const uint8_t* rawspeed::Buffer::getData(rawspeed::Buffer::size_type, rawspeed::Buffer::size_type) const, line 173: Buffer overflow: image file may be truncated
[dt_imageio_export_with_flags] mipmap allocation for `unused' failed

@ghost
Copy link

ghost commented Oct 19, 2022 via email

@ghost
Copy link

ghost commented Oct 25, 2022 via email

@victoryforce
Copy link
Collaborator

Shot 251 images yesterday with the 2.1.0.0 firmware and they could all be loaded without issues. As a reference, for my previous two cards I had 2/245 and 2/388 images that could not be loaded properly

In other words, it looks like a bug in previous Leica firmwares that caused incorrect files to be created under certain (rare, thankfully) conditions. It's good that Leica fixed it, but it's bad that the reason is not a failure of a specific card or card reader, and therefore other users of buggy versions of the firmware also have this problem.

In any case, this is not a darktable issue, since the decision to discard the file or try to be forgiving of data errors that can be corrected (as Adobe DNG Converter does) is rawspeed's business. So this issue should be closed IMO.

@jenshannoschwalm jenshannoschwalm added the bug: upstream he bug needs a fix outside of the scope of darktable, in an external lib or in a driver label May 6, 2024
@jenshannoschwalm
Copy link
Collaborator

Absolutely, closing this as not a dt issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug: upstream he bug needs a fix outside of the scope of darktable, in an external lib or in a driver scope: camera support adding WB and raw support for new cameras
Projects
None yet
Development

No branches or pull requests

7 participants
@LebedevRI @kmilos @victoryforce @jenshannoschwalm @17mono and others