mirror of
https://github.com/qpdf/qpdf.git
synced 2024-12-22 02:49:00 +00:00
Support TIFF Predictor (fixes #171)
This commit is contained in:
parent
53971d50be
commit
ec0087e3ce
@ -1,3 +1,8 @@
|
||||
2018-01-13 Jay Berkenbilt <ejb@ql.org>
|
||||
|
||||
* Add support for TIFF predictor for LZW and Flate streams. Now
|
||||
all predictor functions are supported.
|
||||
|
||||
2017-12-25 Jay Berkenbilt <ejb@ql.org>
|
||||
|
||||
* Clarify documentation around options that control parsing but
|
||||
|
@ -4,6 +4,7 @@
|
||||
#include <qpdf/Pipeline.hh>
|
||||
#include <qpdf/Pl_Flate.hh>
|
||||
#include <qpdf/Pl_PNGFilter.hh>
|
||||
#include <qpdf/Pl_TIFFPredictor.hh>
|
||||
#include <qpdf/Pl_RC4.hh>
|
||||
#include <qpdf/Pl_Buffer.hh>
|
||||
#include <qpdf/Pl_ASCII85Decoder.hh>
|
||||
@ -133,7 +134,7 @@ QPDF_Stream::understandDecodeParams(
|
||||
if (predictor_obj.isInteger())
|
||||
{
|
||||
predictor = predictor_obj.getIntValue();
|
||||
if (! ((predictor == 1) ||
|
||||
if (! ((predictor == 1) || (predictor == 2) ||
|
||||
((predictor >= 10) && (predictor <= 15))))
|
||||
{
|
||||
filterable = false;
|
||||
@ -459,14 +460,24 @@ QPDF_Stream::pipeStreamData(Pipeline* pipeline,
|
||||
{
|
||||
std::string const& filter = *iter;
|
||||
|
||||
if (((filter == "/FlateDecode") || (filter == "/LZWDecode")) &&
|
||||
((predictor >= 10) && (predictor <= 15)))
|
||||
if ((filter == "/FlateDecode") || (filter == "/LZWDecode"))
|
||||
{
|
||||
QTC::TC("qpdf", "QPDF_Stream PNG filter");
|
||||
pipeline = new Pl_PNGFilter(
|
||||
"png decode", pipeline, Pl_PNGFilter::a_decode,
|
||||
columns, colors, bits_per_component);
|
||||
to_delete.push_back(pipeline);
|
||||
if ((predictor >= 10) && (predictor <= 15))
|
||||
{
|
||||
QTC::TC("qpdf", "QPDF_Stream PNG filter");
|
||||
pipeline = new Pl_PNGFilter(
|
||||
"png decode", pipeline, Pl_PNGFilter::a_decode,
|
||||
columns, colors, bits_per_component);
|
||||
to_delete.push_back(pipeline);
|
||||
}
|
||||
else if (predictor == 2)
|
||||
{
|
||||
QTC::TC("qpdf", "QPDF_Stream TIFF predictor");
|
||||
pipeline = new Pl_TIFFPredictor(
|
||||
"tiff decode", pipeline, Pl_TIFFPredictor::a_decode,
|
||||
columns, colors, bits_per_component);
|
||||
to_delete.push_back(pipeline);
|
||||
}
|
||||
}
|
||||
|
||||
if (filter == "/Crypt")
|
||||
|
@ -301,3 +301,4 @@ qpdf-c called qpdf_set_decode_level 0
|
||||
qpdf-c called qpdf_set_compress_streams 0
|
||||
qpdf-c called qpdf_set_preserve_unreferenced_objects 0
|
||||
qpdf-c called qpdf_set_newline_before_endstream 0
|
||||
QPDF_Stream TIFF predictor 0
|
||||
|
@ -240,7 +240,7 @@ foreach my $d (@bug_tests)
|
||||
show_ntests();
|
||||
# ----------
|
||||
$td->notify("--- Miscellaneous Tests ---");
|
||||
$n_tests += 86;
|
||||
$n_tests += 87;
|
||||
|
||||
$td->runtest("qpdf version",
|
||||
{$td->COMMAND => "qpdf --version"},
|
||||
@ -684,6 +684,12 @@ $td->runtest("short /O or /U",
|
||||
$td->EXIT_STATUS => 0},
|
||||
$td->NORMALIZE_NEWLINES);
|
||||
|
||||
$td->runtest("stream with tiff predictor",
|
||||
{$td->COMMAND => "qpdf --check tiff-predictor.pdf"},
|
||||
{$td->FILE => "tiff-predictor.out",
|
||||
$td->EXIT_STATUS => 0},
|
||||
$td->NORMALIZE_NEWLINES);
|
||||
|
||||
show_ntests();
|
||||
# ----------
|
||||
$td->notify("--- Newline before endstream ---");
|
||||
|
6
qpdf/qtest/qpdf/tiff-predictor.out
Normal file
6
qpdf/qtest/qpdf/tiff-predictor.out
Normal file
@ -0,0 +1,6 @@
|
||||
checking tiff-predictor.pdf
|
||||
PDF Version: 1.5
|
||||
File is not encrypted
|
||||
File is not linearized
|
||||
No syntax or stream encoding errors found; the file may still contain
|
||||
errors that qpdf cannot detect
|
BIN
qpdf/qtest/qpdf/tiff-predictor.pdf
Normal file
BIN
qpdf/qtest/qpdf/tiff-predictor.pdf
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user