Summary: | Endianness bug loading 16 bits raw images | ||
---|---|---|---|
Product: | [Applications] digikam | Reporter: | pochini |
Component: | Plugin-DImg-RAW | Assignee: | Digikam Developers <digikam-bugs-null> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | caulier.gilles, pochini |
Priority: | NOR | ||
Version: | 1.0.0 | ||
Target Milestone: | --- | ||
Platform: | Compiled Sources | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: | 1.0.0 | |
Sentry Crash Report: |
Description
pochini
2009-11-22 21:46:20 UTC
Yes, it's libkdcraw as well... Gilles Caulier probably in this loop: http://lxr.kde.org/source/KDE/kdegraphics/libs/libkdcraw/libkdcraw/kdcraw.cpp#323 Thanks for the link. Uhm... no, digikam does not use KDcraw::extractRAWData(). It uses KDcraw::loadFromDcraw() instead, which then calls dcraw_make_mem_image() (http://lxr.kde.org/source/KDE/kdegraphics/libs/libkdcraw/libkdcraw/kdcraw.cpp#679). LibRaw docs do not mention the format of the data, but in LibRaw-0.8.4/samples/mem_image.cpp there is a comment that says: "data in img->data is not converted to network byte order. So, we should swap values on some architectures for dcraw compatibility". I think we should fix digikam. If we change libkdcraw we may break some other apps which already convert the data. I propose another patch that fixes the bug and does not break anything, except, perhaps, big-endian machines with KDCRAW_VERSION<0x000400 (I didn't test). Little-endian archs are not affected. --- digikam-1.0.0-beta6/libs/dimg/loaders/rawloader.cpp__orig 2009-11-24 21:51:58.000000000 +0100 +++ digikam-1.0.0-beta6/libs/dimg/loaders/rawloader.cpp 2009-11-24 22:03:02.000000000 +0100 @@ -177,7 +177,7 @@ bool RAWLoader::loadedFromDcraw(QByteArr for (int w = 0; w < width; ++w) { -#if KDCRAW_VERSION < 0x000400 +#if (KDCRAW_VERSION < 0x000400) ^ (Q_BYTE_ORDER == Q_BIG_ENDIAN) dst[0] = (unsigned short)((src[4]*256 + src[5]) * fac); // Blue dst[1] = (unsigned short)((src[2]*256 + src[3]) * fac); // Green dst[2] = (unsigned short)((src[0]*256 + src[1]) * fac); // Red SVN commit 1064293 by mwiesweg: Fix 16bit raw loading on big endian. Patch from pochini@shiny.it slightly modified. BUG: 215743 M +2 -1 NEWS M +18 -9 libs/dimg/loaders/rawloader.cpp WebSVN link: http://websvn.kde.org/?view=rev&revision=1064293 |