aboutsummaryrefslogtreecommitdiffstats
path: root/libqpdf
diff options
context:
space:
mode:
authorm-holger <m-holger@kubitscheck.org>2024-01-22 01:32:15 +0100
committerm-holger <m-holger@kubitscheck.org>2024-01-26 21:46:38 +0100
commit2e8b5f290c03bd4cd67f9240cb1fff3122e0b12c (patch)
treeb41208df8a16a38a74aa7a772e0adefd94965f14 /libqpdf
parent73dec35209cfcdb83a3cb08c6c47734a9291ec1f (diff)
downloadqpdf-2e8b5f290c03bd4cd67f9240cb1fff3122e0b12c.tar.zst
In Pl_TIFFPredictor avoid repeated calls to getNext
Diffstat (limited to 'libqpdf')
-rw-r--r--libqpdf/Pl_TIFFPredictor.cc7
-rw-r--r--libqpdf/qpdf/Pl_TIFFPredictor.hh1
2 files changed, 5 insertions, 3 deletions
diff --git a/libqpdf/Pl_TIFFPredictor.cc b/libqpdf/Pl_TIFFPredictor.cc
index 7535d38f..5454cfe6 100644
--- a/libqpdf/Pl_TIFFPredictor.cc
+++ b/libqpdf/Pl_TIFFPredictor.cc
@@ -19,7 +19,8 @@ Pl_TIFFPredictor::Pl_TIFFPredictor(
action(action),
columns(columns),
samples_per_pixel(samples_per_pixel),
- bits_per_sample(bits_per_sample)
+ bits_per_sample(bits_per_sample),
+ p_next(getNext())
{
if (samples_per_pixel < 1) {
throw std::runtime_error("TIFFPredictor created with invalid samples_per_pixel");
@@ -58,7 +59,7 @@ void
Pl_TIFFPredictor::processRow()
{
QTC::TC("libtests", "Pl_TIFFPredictor processRow", (action == a_decode ? 0 : 1));
- BitWriter bw(this->getNext());
+ BitWriter bw(p_next);
BitStream in(this->cur_row.data(), this->bytes_per_row);
std::vector<long long> prev;
for (unsigned int i = 0; i < this->samples_per_pixel; ++i) {
@@ -92,5 +93,5 @@ Pl_TIFFPredictor::finish()
processRow();
}
cur_row.clear();
- getNext()->finish();
+ p_next->finish();
}
diff --git a/libqpdf/qpdf/Pl_TIFFPredictor.hh b/libqpdf/qpdf/Pl_TIFFPredictor.hh
index ba429734..6557e15c 100644
--- a/libqpdf/qpdf/Pl_TIFFPredictor.hh
+++ b/libqpdf/qpdf/Pl_TIFFPredictor.hh
@@ -34,6 +34,7 @@ class Pl_TIFFPredictor: public Pipeline
unsigned int samples_per_pixel;
unsigned int bits_per_sample;
std::vector<unsigned char> cur_row;
+ Pipeline* p_next;
};
#endif // PL_TIFFPREDICTOR_HH