[ 
https://issues.apache.org/jira/browse/SANSELAN-75?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Gary Lucas updated SANSELAN-75:
-------------------------------

    Attachment: IndexColorPalette.tif
                Tracker_Item_75_23_Apr_2012.patch

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: https://issues.apache.org/jira/browse/SANSELAN-75
>             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: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to