Bug 2537 - TIFFReadScanline produces different output from TIFFRGBA variants
: TIFFReadScanline produces different output from TIFFRGBA variants
Status: RESOLVED LATER
: libtiff
default
: unspecified
: PC Linux
: P2 normal
: ---
Assigned To:
:
:
: migrated_to_gitlab
:
:
  Show dependency treegraph
 
Reported: 2016-03-18 01:19 by
Modified: 2019-10-01 14:20 (History)


Attachments
test case (2.39 KB, application/gzip)
2016-03-18 01:19, jzern@google.com
Details
image diff (819 bytes, image/png)
2016-03-18 01:20, jzern@google.com
Details


Note

You need to log in before you can comment on or make changes to this bug.


Description From 2016-03-18 01:19:37
Created an attachment (id=645) [details]
test case

Versions tested: 4.0.3 & 4.0.6 via x86-64 Linux distros, 3.9.5 (32-bit) & 4.0.6
from source under Linux and 4.0.5 on OS X while double checking the test cases.

TIFFReadScanline() produces what appears to be the correct output. It also
agrees with ffmpeg-N-78600-g7ad6a21 and ImageMagick-6.7.7-10 output.

Test cases based on the sample code within the tiff manual attached.

Related bug [1].

$ tar -xzf test_case.tar.gz
$ cd test_case
$ make
$ mkdir output
$ for t in test_case_rgbaimage test_case_rgbaimage2 test_case_scanline; do \
  ./$t old_logo.tiff > output/$t.pam; done
$ cmp -b output/test_case_rgbaimage.pam output/test_case_rgbaimage2.pam
$ cmp -b output/test_case_rgbaimage.pam output/test_case_scanline.pam
output/test_case_rgbaimage.pam output/test_case_scanline.pam differ:
byte 68, line 8 is   4 ^D  17 ^O

[1] https://bugs.chromium.org/p/webp/issues/detail?id=292
------- Comment #1 From 2016-03-18 01:20:41 -------
Created an attachment (id=646) [details]
image diff

Output from:
$ compare output/test_case_rgbaimage.pam output/test_case_scanline.pam
------- Comment #2 From 2016-03-18 01:26:48 -------
I forgot to mention that I was seeing 'Connection refused' when trying to cvs
login so I wasn't able to test the latest code.
------- Comment #3 From 2017-08-16 03:27:19 -------
tiffinfo test_case/old_logo.tiff shows that the alpha channel of this file is a
unassociated alpha channel (ie the R,G,B components are not premultiplied with
the alpha value). The TIFFRGBA API then goes in the putRGBUAcontig8bittile()
function that do the multiplication of the R,G,B components by the alpha value.
This seems to be done on purpose

The only related entry I can find in the changelog is the following one, but
apparently that behaviour must be even older:

{{{
2006-04-11  Joris Van Damme  <joris.at.lebbeke@skynet.be>

        * libtiff/tif_getimage.c: Revision of all RGB(A) put routines
        - Conversion of unassociated alpha to associated alpha now done with
          more performant LUT, and calculation more correct
        - Conversion of 16bit data to 8bit data now done with
          more performant LUT, and calculation more correct
        - Bugfix of handling of 16bit RGB with unassociated alpha
}}}

So probably this is mostly a documentation issue
------- Comment #4 From 2019-10-01 14:20:13 -------
Bugzilla is no longer used for tracking libtiff issues. Remaining open tickets,
such as this one, have been migrated to the libtiff GitLab instance at
https://gitlab.com/libtiff/libtiff/issues .

The migrated tickets have their summary prefixed with [BZ#XXXX] where XXXX is
the initial Bugzilla issue number.