[ 
https://issues.apache.org/jira/browse/PDFBOX-3297?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15220085#comment-15220085
 ] 

Tilman Hausherr edited comment on PDFBOX-3297 at 3/31/16 5:05 PM:
------------------------------------------------------------------

The cause is an inefficient implementation in the type 3 function ("stitching 
function"). It decides what child function to call based on the input. However 
the PDFunction objects are newly created in each eval() call, i.e. for every 
pixel. One of the child functions is a type 0 function, which has a stream of 
samples that has to be uncompressed, read bitwise, etc. After improving the 
code so that the PDFunction objects are created only once, thus rendering is 
"much less slower".

The slowness you have now is due to the type 4 shading (Gouraud shading). That 
one involves a lot of processing... I've seen an algorithm that is more 
efficient in PDF.js, but it has a bug, so we won't use it yet.

The next problem is the "?" shown in rendering. For some reason the space is 
rendered as the missing glyph, I am opening a new issue for that one later.


was (Author: tilman):
The cause is an inefficient implementation in the type 3 function ("stitching 
function"). It decides what child function to call based on the input. However 
the PDFunction objects are newly created in each eval() call, i.e. for every 
pixel. One of the child functions is a type 0 function, which has a stream of 
samples that has to be uncompressed, read bitwise, etc. After improving the 
code so that the PDFunction objects are created only once, this rendering is 
"much less slower".

The slowness you have now is due to the type 4 shading (Gouraud shading). That 
one involves a lot of processing... I've seen an algorithm that is more 
efficient in PDF.js, but it has a bug, so we won't use it yet.

The next problem is the "?" shown in rendering. For some reason the space is 
rendered as the missing glyph, I am opening a new issue for that one later.

> Infinite loop
> -------------
>
>                 Key: PDFBOX-3297
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-3297
>             Project: PDFBox
>          Issue Type: Bug
>          Components: Rendering
>    Affects Versions: 1.8.11, 1.8.12, 2.0.0, 2.0.1, 2.1.0
>            Reporter: Cheng Chen
>            Assignee: Tilman Hausherr
>         Attachments: infinite_loop.pdf
>
>
> For this PDF file attached, this function will hang:
> public void testNewVersion() throws IOException {
>         PDDocument doc = 
> PDDocument.load(PdfVerificationTest.class.getClassLoader().getResource("infinite_loop.pdf").openStream());
>        PDFRenderer pdfRenderer = new PDFRenderer(doc);
>        for(int i=1;i<doc.getNumberOfPages();i++) {
>             pdfRenderer.renderImageWithDPI(i, 300, ImageType.RGB);
>       }
>     }



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to