Bug 269846 - TIFF loader is broken on big-endian architectures [PATCH]
Summary: TIFF loader is broken on big-endian architectures [PATCH]
Status: RESOLVED FIXED
Alias: None
Product: digikam
Classification: Applications
Component: Plugin-DImg-TIFF (show other bugs)
Version: 2.0.0
Platform: Compiled Sources Linux
: NOR normal
Target Milestone: ---
Assignee: Digikam Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-03-31 22:18 UTC by pochini
Modified: 2017-07-30 16:28 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In: 3.0


Attachments
Fix TIFF loader on big-endian architectures (8.27 KB, patch)
2011-03-31 22:18 UTC, pochini
Details

Note You need to log in before you can comment on or make changes to this bug.
Description pochini 2011-03-31 22:18:15 UTC
Created attachment 58481 [details]
Fix TIFF loader on big-endian architectures

Version:           2.0.0 (using KDE 4.5.2) 
OS:                Linux

In the TIFF loader all those if-QSysInfo::ByteOrder in the 16 bits color path are wrong because the order of color components is always the same for any architecture. I removed all of them and I left the "else" code paths only.

NOTE: I was able to test only the 3-samples-per-pixel PLANARCONFIG_CONTIG part of the code because I haven't images in other formats.

The 8 bits image loader is fine.

The saver is also buggy, but the bugs cancel each other when !imageHasAlpha(). There are also other issues I will investigate (and try to fix) later.
The attached patch fixes the loader only. I wrote and tested it for 1.8.0 and forward ported it to the latest GIT version.

Reproducible: Always
Comment 1 caulier.gilles 2011-04-01 11:31:10 UTC
Thanks a lots for your patch.

Please take a look in my reprository, where a lots of different tiff files are available to test :

http://digikam3rdparty.free.fr/TEST_IMAGES/TIFF/

I'm waiting your future improved patch...

Gilles Caulier
Comment 2 caulier.gilles 2011-12-12 20:19:42 UTC
Pochini,

Do you see my Comment #1 ?

Gilles Caulier
Comment 3 pochini 2011-12-13 21:38:52 UTC
No, the message was buried in the mess of my mailbox.
However I continued development. I got stuck with a problem when saving images. In some cases the saved image is corrupted. I know how to reproduce it, but I wasn't able to figure out why it happens. I also tried to debug libtiff without luck. I'll try again...
Comment 4 Marcel Wiesweg 2012-09-29 13:08:51 UTC
Git commit b27eae029207187882ae094e94158abfd903d379 by Marcel Wiesweg.
Committed on 29/09/2012 at 15:07.
Pushed by mwiesweg into branch 'master'.

Apply patch by pochini@shiny.it to fix TIFF loading on big endian, and attempt to fix saving as well
by using ushort instead of messing with single bytes. Untested due to lack of hardware to test.
FIXED-IN: 3.0

M  +59   -148  libs/dimg/loaders/tiffloader.cpp

http://commits.kde.org/digikam/b27eae029207187882ae094e94158abfd903d379