Bug 215752

Summary: Endianness bug saving 16 bits images [patch]
Product: [Applications] digikam Reporter: pochini
Component: DImg-CoreAssignee: Digikam Developers <digikam-bugs-null>
Status: RESOLVED FIXED    
Severity: normal CC: caulier.gilles, marcel.wiesweg, pochini
Priority: NOR    
Version: 1.0.0   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Linux   
Latest Commit: Version Fixed In: 1.0.0
Attachments: Fix 16 bits PNG output on big-endian architectures.
16 bits PNG loader fix

Description pochini 2009-11-22 22:39:28 UTC
Version:           1.0.0-beta6 (using KDE 4.3.3)
Compiler:          gcc (GCC) 4.1.2 (Gentoo 4.1.2 p1.0.2)  powerpc
OS:                Linux
Installed from:    Compiled From Sources

On big-endian archs digikam does not save 16 bits images properly. Saving completes without errors, but when the image is loaded with any other program it looks scrabled.
Comment 1 pochini 2009-11-26 00:45:28 UTC
Created attachment 38590 [details]
Fix 16 bits PNG output on big-endian architectures.

The attached patch fixes the bug I reported. It doesn't affect little-endian machines.
Comment 2 Marcel Wiesweg 2009-12-20 16:25:20 UTC
pochini, do you have an explanation why the loop after loading in pngloader.cpp, 449-461, works on big endian? Isn't it swapping from network byte order to little endian?
Comment 3 Marcel Wiesweg 2009-12-20 16:31:59 UTC
SVN commit 1064297 by mwiesweg:

Fix PNG saving on big endian,
patch from  pochini@shiny.it

BUG: 215752

 M  +2 -1      NEWS  
 M  +44 -31    libs/dimg/loaders/pngloader.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1064297
Comment 4 pochini 2009-12-20 22:22:07 UTC
Created attachment 39198 [details]
16 bits PNG loader fix
Comment 5 pochini 2009-12-20 22:25:10 UTC
(In reply to comment #2)
> pochini, do you have an explanation why the loop after loading in
> pngloader.cpp, 449-461, works on big endian? Isn't it swapping from network
> byte order to little endian?

Yes... it doesn't work. Sorry, I didn't test 16 bits PNG loading. I've just uploaded a patch that fixes it too.
Comment 6 Marcel Wiesweg 2009-12-21 20:39:41 UTC
SVN commit 1064788 by mwiesweg:

Fix 16bit PNG loading on Big Endian,
thanks to pochini@shiny.it

CCBUG: 215752

 M  +17 -14    pngloader.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1064788