2012.06.28 09:23 "[Tiff] tiff 4.0.2 raw_decode test failing on ppc64", by Dinar Valeev

2012.07.03 18:09 "Re: [Tiff] tiff 4.0.2 raw_decode test failing on ppc64", by Dinar Valeev

On Tue, Jul 3, 2012 at 7:53 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:

> Dinar Valeev <dinarv@gmail.com> writes:

rgba part of the raw_decode test fails on ppc64 machine:

I received a patch for this, uncredited but apparently originating somewhere in opensuse:

Yes. We have a fix for that in openSUSE https://build.opensuse.org/package/view_file?file=tiff-bigendian.patch&package=tiff&project=openSUSE%3AFactory&rev=5d26c6b139d9968312f675be2200e70b

It would be great if patch would be accepted upstream.

diff -up tiff-4.0.2/test/raw_decode.c.bigendian tiff-4.0.2/test/raw_decode.c

--- tiff-4.0.2/test/raw_decode.c.bigendian       15:27:37.168543695 +0200      2012-07-03

+++ tiff-4.0.2/test/raw_decode.c         15:28:47.795051599 +0200        2012-07-03

@@ -85,9 +85,9 @@ static int check_rgb_pixel( int pixel, i
int check_rgba_pixel( int pixel, int red, int green, int blue, int alpha, unsigned char *buffer ) {  static
RGBA images are upside down - adjust for normal ordering */        /*

       int adjusted_pixel = pixel % 128 + (127 - (pixel/128)) * 128;
-        char *rgba = buffer + 4 * adjusted_pixel;       unsigned

+        int *rgba = (unsigned int*)(buffer + 4 * adjusted_pixel);       unsigned

-        rgba[0] == red && rgba[1] == green && rgba[2] == blue && rgba[3] == alpha ) {       if(
+        TIFFGetR(*rgba) == red && TIFFGetG(*rgba) == green && TIFFGetB(*rgba) == blue && TIFFGetA(*rgba) == alpha ) {      if(

>                return 0;
>        }

Now, this patch is crummy --- for one thing it ought to correct the fprintf call just below here. I think it's on the right track: the  But result of TIFFReadRGBAImage is documented to be accessed via these macros not directly. anyone think this is not an appropriate fix  Does approach?

>                        regards, tom lane