mirror of
https://github.com/qpdf/qpdf.git
synced 2024-12-22 19:08:59 +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>
|
2017-12-25 Jay Berkenbilt <ejb@ql.org>
|
||||||
|
|
||||||
* Clarify documentation around options that control parsing but
|
* Clarify documentation around options that control parsing but
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
#include <qpdf/Pipeline.hh>
|
#include <qpdf/Pipeline.hh>
|
||||||
#include <qpdf/Pl_Flate.hh>
|
#include <qpdf/Pl_Flate.hh>
|
||||||
#include <qpdf/Pl_PNGFilter.hh>
|
#include <qpdf/Pl_PNGFilter.hh>
|
||||||
|
#include <qpdf/Pl_TIFFPredictor.hh>
|
||||||
#include <qpdf/Pl_RC4.hh>
|
#include <qpdf/Pl_RC4.hh>
|
||||||
#include <qpdf/Pl_Buffer.hh>
|
#include <qpdf/Pl_Buffer.hh>
|
||||||
#include <qpdf/Pl_ASCII85Decoder.hh>
|
#include <qpdf/Pl_ASCII85Decoder.hh>
|
||||||
@ -133,7 +134,7 @@ QPDF_Stream::understandDecodeParams(
|
|||||||
if (predictor_obj.isInteger())
|
if (predictor_obj.isInteger())
|
||||||
{
|
{
|
||||||
predictor = predictor_obj.getIntValue();
|
predictor = predictor_obj.getIntValue();
|
||||||
if (! ((predictor == 1) ||
|
if (! ((predictor == 1) || (predictor == 2) ||
|
||||||
((predictor >= 10) && (predictor <= 15))))
|
((predictor >= 10) && (predictor <= 15))))
|
||||||
{
|
{
|
||||||
filterable = false;
|
filterable = false;
|
||||||
@ -459,8 +460,9 @@ QPDF_Stream::pipeStreamData(Pipeline* pipeline,
|
|||||||
{
|
{
|
||||||
std::string const& filter = *iter;
|
std::string const& filter = *iter;
|
||||||
|
|
||||||
if (((filter == "/FlateDecode") || (filter == "/LZWDecode")) &&
|
if ((filter == "/FlateDecode") || (filter == "/LZWDecode"))
|
||||||
((predictor >= 10) && (predictor <= 15)))
|
{
|
||||||
|
if ((predictor >= 10) && (predictor <= 15))
|
||||||
{
|
{
|
||||||
QTC::TC("qpdf", "QPDF_Stream PNG filter");
|
QTC::TC("qpdf", "QPDF_Stream PNG filter");
|
||||||
pipeline = new Pl_PNGFilter(
|
pipeline = new Pl_PNGFilter(
|
||||||
@ -468,6 +470,15 @@ QPDF_Stream::pipeStreamData(Pipeline* pipeline,
|
|||||||
columns, colors, bits_per_component);
|
columns, colors, bits_per_component);
|
||||||
to_delete.push_back(pipeline);
|
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")
|
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_compress_streams 0
|
||||||
qpdf-c called qpdf_set_preserve_unreferenced_objects 0
|
qpdf-c called qpdf_set_preserve_unreferenced_objects 0
|
||||||
qpdf-c called qpdf_set_newline_before_endstream 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();
|
show_ntests();
|
||||||
# ----------
|
# ----------
|
||||||
$td->notify("--- Miscellaneous Tests ---");
|
$td->notify("--- Miscellaneous Tests ---");
|
||||||
$n_tests += 86;
|
$n_tests += 87;
|
||||||
|
|
||||||
$td->runtest("qpdf version",
|
$td->runtest("qpdf version",
|
||||||
{$td->COMMAND => "qpdf --version"},
|
{$td->COMMAND => "qpdf --version"},
|
||||||
@ -684,6 +684,12 @@ $td->runtest("short /O or /U",
|
|||||||
$td->EXIT_STATUS => 0},
|
$td->EXIT_STATUS => 0},
|
||||||
$td->NORMALIZE_NEWLINES);
|
$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();
|
show_ntests();
|
||||||
# ----------
|
# ----------
|
||||||
$td->notify("--- Newline before endstream ---");
|
$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