commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Gary Lucas (JIRA)" <>
Subject [jira] [Updated] (SANSELAN-75) Improve speed of TIFF Index-Color Palette
Date Mon, 23 Apr 2012 12:37:35 GMT


Gary Lucas updated SANSELAN-75:

    Attachment: IndexColorPalette.tif

The attached patch addresses the issue.  Since there are no TIFF format files of the relevant
type in the Sanselan test suite, I am also attaching one.
> Improve speed of TIFF Index-Color Palette 
> ------------------------------------------
>                 Key: SANSELAN-75
>                 URL:
>             Project: Commons Sanselan
>          Issue Type: Improvement
>          Components: Format: TIFF
>            Reporter: Gary Lucas
>         Attachments: IndexColorPalette.tif, Tracker_Item_75_23_Apr_2012.patch
>   Original Estimate: 0h
>  Remaining Estimate: 0h
> TIFF supports an 8-bit-per-pixel, "indexed color" model in which the values in the source
data give indices into a fixed palette of color settings. Unpacking data in this format requires
two steps:  (1) reading and unpacking the palette in the source file, (2) performing a look-up
operation for each pixel to map the index value to a color.  A similar approach was used in
the original GIF specification and, checking wikipedia, it appears that it is also supported
by PNG and BMP.  TIFF files in this format are used extensively in mapping and Geographic
Information System implementation.
> The current inplementation of the PhotometicInterpreterPalette for TIFF files has an
inefficiency in that it performs the unpacking operation from step one each time a new pixel
is read. Thus, if a file contains three million red pixels, the byte-manipulation for the
color red is repeated three million times.  It would be more efficient for the PhotometricInterpreterPalette
class to perform the unpacking operation once, in its constructor. Since there are a maximum
of 256 colors in an 8-bit palette, this approach would require moderate use of memory.
> In time tests this approach reduced the reading time for a large TIFF file by about 13
percent (for details on the timing procedures, see Tracker Item 58):
> Unmodified Code:   1204.9 ms.
> After change:   1049.7 ms.

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:!default.jspa
For more information on JIRA, see:


View raw message