Ticket #357 (closed defect: fixed)

Opened 14 months ago

Last modified 8 months ago

Distorted / Shifted colors on PPC Mac OSX

Reported by: springmeyer Owned by: artem
Priority: normal Milestone: 0.7.0
Component: Core Library Version: 0.6.0
Severity: Normal Keywords:
Cc: Patch Needs Improvement: no
Needs Docmentation: no Has Patch?: no
Design Decision Needed: no

Description

was able to get an image rendered with trunk on PPC arch. Certain colors get distinctly shifted. See attached examples for the same XML on both intel and ppc.

Attachments

intel.png (43.8 kB) - added by springmeyer 14 months ago.
Image rendered in i386 arch
ppc.png (50.4 kB) - added by springmeyer 14 months ago.
messed up render on PPC/leopard and Mapnik trunk
mapnik-rgba-endian.patch (0.6 kB) - added by jburgess777 14 months ago.
swap byte order during set/get rgba value
mapnik-rgba-endian2.patch (1.2 kB) - added by jburgess777 14 months ago.
second attempt, OSX does not have the htole32 macros
mapnik-rgba-endian3.patch (1.5 kB) - added by springmeyer 14 months ago.
works for background, not labels

Change History

Changed 14 months ago by springmeyer

Image rendered in i386 arch

Changed 14 months ago by springmeyer


Image rendered in i386 arch

Changed 14 months ago by springmeyer

messed up render on PPC/leopard and Mapnik trunk

Changed 14 months ago by springmeyer


messed up render on PPC/leopard and Mapnik trunk

Changed 14 months ago by springmeyer

Changed 14 months ago by jburgess777

swap byte order during set/get rgba value

Changed 14 months ago by jburgess777

Could you try out the mapnik-rgba-endian.patch on PPC?

I think the issue is that most the color handling code assume little endian (i.e. Red component is agbr_ & 0xff). The code is mostly self-consistent in this assumption, but the routines which access the raw RGBA values directly need byte swapping on big endian arches.

Changed 14 months ago by jburgess777

second attempt, OSX does not have the htole32 macros

Changed 14 months ago by springmeyer

works for background, not labels

Changed 14 months ago by springmeyer

mapnik-rgba-endian3.patch works for the background color but does not catch the labels. hmmm

Changed 14 months ago by jburgess777

The label rendering goes via: render_halo() & render_bitmap() which calls blendPixel() which then manipulates the raw data in the Image32 pixmap.

I think someone needs to take a look at how the pixmap data is handled inside Mapnik. In an ideal world we would perform the byte swapping in a single place but is is not clear to me where that should be.

Changed 13 months ago by artem

  • milestone changed from 0.6.1 to 0.6.2

Starting from r1218 mapnik::color's internal storage has changed. We store individual color components rather then one int32_t. Overall this makes it a bit easier to work with diffrent byte orders etc. Moving to 0.6.2 as it needs some more work.

Changed 9 months ago by springmeyer

r1218 is nice, but needs the global header so that MAPNIK_BIG_ENDIAN is defined properly. added in r1352

Changed 9 months ago by springmeyer

... appears that 'blendPixel2()', 'set_rectangle_alpha', 'set_rectangle_alpha2', and 'merge_rectangle' all need support for BIG_ENDIAN as well as png256 and jpeg output.

Changed 9 months ago by springmeyer

r1353 adds support to 'blendpixel2'

Changed 9 months ago by springmeyer

r1354 fixes problem writing to png256

Changed 9 months ago by springmeyer

r1355 fixes writing to jpeg

Changed 9 months ago by springmeyer

r1357 fixes an issue that looks to be restricted to big endian systems, whereby when no alpha channel is used rgb(0,0,0) is not placed and effectively becomes fully transparent.

Changed 9 months ago by springmeyer

bilinear8 scaling also looks like it needs endian awareness, but I'll leave that for another day.

If anyone has ideas about handling these byte order issues more centrally, please advise.

Changed 8 months ago by springmeyer

  • status changed from new to closed
  • resolution set to fixed

If anyone has comments on improving this, reopen, but given current work detailed above big endian colors and rendering are working nicely for most usecases.

Note: See TracTickets for help on using tickets.