Opened 15 years ago

Closed 15 years ago

#1144 closed Patches (fixed)

GIL 2.1 PNG IO fix for endianness problem with bit_depth == 16.

Reported by: William Gallafent <william@…> Owned by:
Milestone: To Be Determined Component: None
Version: Boost 1.34.0 Severity: Problem
Keywords: GIL Cc:

Description

When loading or saving PNGs with bit depth 16 on a little endian architecture, the bytes in each channel were not being swapped to match PNG's big endian byte ordering. This patch switches this byte-swapping on in LibPNG when loading and saving PNGs of bit-depth 16 on a little-endian architecture.

Patch is against GIL 2.1 release, but I submit it here rather than in the GIL sourceforge, since I gather GIL is now in Boost, as of the next Boost release! Let me know if this is not the right place for this patch. I note that there is no GIL component in this Trac yet, so I left that set to none.

Attachments (1)

gilPngEndian.patch (1.5 KB ) - added by William Gallafent <william@…> 15 years ago.
Swap bytes when doing bit-depth 16 PNG IO on little-endian architectures.

Download all attachments as: .zip

Change History (5)

by William Gallafent <william@…>, 15 years ago

Attachment: gilPngEndian.patch added

Swap bytes when doing bit-depth 16 PNG IO on little-endian architectures.

comment:1 by Marshall Clow, 15 years ago

Marshall sez: I think this bug was fixed in revision 38705.

comment:2 by william@…, 15 years ago

Yes, with a run-time rather than compile-time check ... fair enough.

in reply to:  2 comment:3 by Hailin Jin, 15 years ago

Run-time detection is better in this case:

  1. an extra check is a not performance issue at all here.
  2. run-time detection can work on architectures that can change endian-ness on the fly.

comment:4 by Hailin Jin, 15 years ago

Resolution: fixed
Status: newclosed

It is fixed

Note: See TracTickets for help on using tickets.