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

Andreas Lehmkühler reassigned PDFBOX-2127:
------------------------------------------

    Assignee: Andreas Lehmkühler

> Optimize calls of getPixel in SampledImageReader and PDImageXObject
> -------------------------------------------------------------------
>
>                 Key: PDFBOX-2127
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-2127
>             Project: PDFBox
>          Issue Type: Improvement
>    Affects Versions: 2.0.0
>            Reporter: Petr Slaby
>            Assignee: Andreas Lehmkühler
>         Attachments: 000048.pdf, GetPixel.patch
>
>
> When calling Raster#getPixel() in a loop, it is a good practice to make sure 
> that the result array is allocated only once. 
> SampledImageReader#getStencilImage() and PDImageXObject#applyMask() fail to 
> do that. When rendering the attached example, this results in allocating 24 
> 053 760 arrays containing 3 floats, which is about 0.5GB of data if my math 
> is right. Also, I have noticed that SampledImageReader#getStencilImage() 
> reads and sets the same data w/o modification if alpha of a pixel != 255. 
> After applying the attached patch, rendering time of the document drops from 
> 8.5s to 7.4s. Not as much as I have expected - array allocation and the 
> garbage collector seem to be fast - but still...
> Note: Rendering of the document is wrong, it does not find some of its fonts, 
> but that is irrelevant for this issue.



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to