Commit 308930150027f90aa48d9873f3f11d0a89dd98b7
Committed by
GitHub
Merge pull request #1546 from jbarlow83/feature/do-check-optimization
Avoid unnecessary re-compression in QPDFJob::doCheck
Showing
1 changed file
with
5 additions
and
0 deletions
libqpdf/QPDFJob.cc
| @@ -793,6 +793,11 @@ QPDFJob::doCheck(QPDF& pdf) | @@ -793,6 +793,11 @@ QPDFJob::doCheck(QPDF& pdf) | ||
| 793 | Pl_Discard discard; | 793 | Pl_Discard discard; |
| 794 | w.setOutputPipeline(&discard); | 794 | w.setOutputPipeline(&discard); |
| 795 | w.setDecodeLevel(qpdf_dl_all); | 795 | w.setDecodeLevel(qpdf_dl_all); |
| 796 | + // Disable compression of streams, since we only need to confirm we can decode them. This | ||
| 797 | + // avoids JPEG DCT -> Flate recompression of all images. | ||
| 798 | + w.setCompressStreams(false); | ||
| 799 | + // Also disable recompression of Flate streams since are only checking. | ||
| 800 | + w.setRecompressFlate(false); | ||
| 796 | w.write(); | 801 | w.write(); |
| 797 | 802 | ||
| 798 | // Parse all content streams | 803 | // Parse all content streams |