[
https://issues.apache.org/jira/browse/PDFBOX-2258?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14088209#comment-14088209
]
John Hewson edited comment on PDFBOX-2258 at 8/6/14 8:34 PM:
-------------------------------------------------------------
Perhaps. The raster which is being written to is TYPE_INT_ARGB, we need to
write the alpha value into the first byte. The source raster is either an RGB
or an ARGB image depending on whether or not color masking is also used. The
color alpha can be only 0 or 255. The source raster can be of TYPE_BYTE,
TYPE_INT_RGB, or TYPE_INT_ARGB but I'm not sure that is guaranteed.
You could probably write an optimised code path for a specific image format,
such as is done in getRGBImage() where we call from8bit, from1Bit for 95% of
images. Also when you profile code like this, make sure to profile the AWT
classes too, something like g.fillRect could be slow and you'll never know
otherwise.
If you have a specific file which is slow, feel free to upload it.
was (Author: jahewson):
Perhaps, the raster which is being written to is TYPE_INT_ARGB, we need to
write the alpha value into the first byte. The source raster is either an RGB
or an ARGB image depending on whether or not color masking is also used. The
color mask is alpha can be only 0 or 255. The source raster can be of
TYPE_BYTE, TYPE_INT_RGB, or TYPE_INT_ARGB but I'm not sure that is guaranteed.
You could probably write an optimised code path for a specific image format,
such as is done in getRGBImage() where we call from8bit, from1Bit for 95% of
images. Also when you profile code like this, make sure to profile the AWT
classes too, something like g.fillRect could be slow and you'll never know
otherwise.
If you have a specific file which is slow, feel free to upload it.
> Speed up SampledImageReader#getStencilImage()
> ---------------------------------------------
>
> Key: PDFBOX-2258
> URL: https://issues.apache.org/jira/browse/PDFBOX-2258
> Project: PDFBox
> Issue Type: Wish
> Components: Rendering
> Affects Versions: 2.0.0
> Reporter: simon steiner
>
> PDF from PDFBOX-1437
> java -jar ~/pdfbox_th/app/target/pdfbox-app-2.0.0-SNAPSHOT.jar PDFToImage
> AA.pdf
> org.apache.pdfbox.pdmodel.graphics.color.PDDeviceGray.toRGBImage()
> 31.69913 11,472 ms (31.7%) 11,472 ms
> org.apache.pdfbox.pdmodel.graphics.image.SampledImageReader.getStencilImage()
> 29.439924 10,654 ms (29.4%) 10,654 ms
> is there some alternative to
> for (int y = 0; y < height; y++)
> {
> for (int x = 0; x < width; x++)
> {
> op
> }
> }
--
This message was sent by Atlassian JIRA
(v6.2#6252)