Commit ec0087e3ce2ae7554098b3506378ca3eb9d87795
1 parent
53971d50
Support TIFF Predictor (fixes #171)
Showing
6 changed files
with
38 additions
and
9 deletions
ChangeLog
libqpdf/QPDF_Stream.cc
| ... | ... | @@ -4,6 +4,7 @@ |
| 4 | 4 | #include <qpdf/Pipeline.hh> |
| 5 | 5 | #include <qpdf/Pl_Flate.hh> |
| 6 | 6 | #include <qpdf/Pl_PNGFilter.hh> |
| 7 | +#include <qpdf/Pl_TIFFPredictor.hh> | |
| 7 | 8 | #include <qpdf/Pl_RC4.hh> |
| 8 | 9 | #include <qpdf/Pl_Buffer.hh> |
| 9 | 10 | #include <qpdf/Pl_ASCII85Decoder.hh> |
| ... | ... | @@ -133,7 +134,7 @@ QPDF_Stream::understandDecodeParams( |
| 133 | 134 | if (predictor_obj.isInteger()) |
| 134 | 135 | { |
| 135 | 136 | predictor = predictor_obj.getIntValue(); |
| 136 | - if (! ((predictor == 1) || | |
| 137 | + if (! ((predictor == 1) || (predictor == 2) || | |
| 137 | 138 | ((predictor >= 10) && (predictor <= 15)))) |
| 138 | 139 | { |
| 139 | 140 | filterable = false; |
| ... | ... | @@ -459,14 +460,24 @@ QPDF_Stream::pipeStreamData(Pipeline* pipeline, |
| 459 | 460 | { |
| 460 | 461 | std::string const& filter = *iter; |
| 461 | 462 | |
| 462 | - if (((filter == "/FlateDecode") || (filter == "/LZWDecode")) && | |
| 463 | - ((predictor >= 10) && (predictor <= 15))) | |
| 463 | + if ((filter == "/FlateDecode") || (filter == "/LZWDecode")) | |
| 464 | 464 | { |
| 465 | - QTC::TC("qpdf", "QPDF_Stream PNG filter"); | |
| 466 | - pipeline = new Pl_PNGFilter( | |
| 467 | - "png decode", pipeline, Pl_PNGFilter::a_decode, | |
| 468 | - columns, colors, bits_per_component); | |
| 469 | - to_delete.push_back(pipeline); | |
| 465 | + if ((predictor >= 10) && (predictor <= 15)) | |
| 466 | + { | |
| 467 | + QTC::TC("qpdf", "QPDF_Stream PNG filter"); | |
| 468 | + pipeline = new Pl_PNGFilter( | |
| 469 | + "png decode", pipeline, Pl_PNGFilter::a_decode, | |
| 470 | + columns, colors, bits_per_component); | |
| 471 | + to_delete.push_back(pipeline); | |
| 472 | + } | |
| 473 | + else if (predictor == 2) | |
| 474 | + { | |
| 475 | + QTC::TC("qpdf", "QPDF_Stream TIFF predictor"); | |
| 476 | + pipeline = new Pl_TIFFPredictor( | |
| 477 | + "tiff decode", pipeline, Pl_TIFFPredictor::a_decode, | |
| 478 | + columns, colors, bits_per_component); | |
| 479 | + to_delete.push_back(pipeline); | |
| 480 | + } | |
| 470 | 481 | } |
| 471 | 482 | |
| 472 | 483 | if (filter == "/Crypt") | ... | ... |
qpdf/qpdf.testcov
qpdf/qtest/qpdf.test
| ... | ... | @@ -240,7 +240,7 @@ foreach my $d (@bug_tests) |
| 240 | 240 | show_ntests(); |
| 241 | 241 | # ---------- |
| 242 | 242 | $td->notify("--- Miscellaneous Tests ---"); |
| 243 | -$n_tests += 86; | |
| 243 | +$n_tests += 87; | |
| 244 | 244 | |
| 245 | 245 | $td->runtest("qpdf version", |
| 246 | 246 | {$td->COMMAND => "qpdf --version"}, |
| ... | ... | @@ -684,6 +684,12 @@ $td->runtest("short /O or /U", |
| 684 | 684 | $td->EXIT_STATUS => 0}, |
| 685 | 685 | $td->NORMALIZE_NEWLINES); |
| 686 | 686 | |
| 687 | +$td->runtest("stream with tiff predictor", | |
| 688 | + {$td->COMMAND => "qpdf --check tiff-predictor.pdf"}, | |
| 689 | + {$td->FILE => "tiff-predictor.out", | |
| 690 | + $td->EXIT_STATUS => 0}, | |
| 691 | + $td->NORMALIZE_NEWLINES); | |
| 692 | + | |
| 687 | 693 | show_ntests(); |
| 688 | 694 | # ---------- |
| 689 | 695 | $td->notify("--- Newline before endstream ---"); | ... | ... |
qpdf/qtest/qpdf/tiff-predictor.out
0 → 100644
qpdf/qtest/qpdf/tiff-predictor.pdf
0 → 100644
No preview for this file type