Commit 2e8b5f290c03bd4cd67f9240cb1fff3122e0b12c

Authored by m-holger
1 parent 73dec352

In Pl_TIFFPredictor avoid repeated calls to getNext

libqpdf/Pl_TIFFPredictor.cc
@@ -19,7 +19,8 @@ Pl_TIFFPredictor::Pl_TIFFPredictor( @@ -19,7 +19,8 @@ Pl_TIFFPredictor::Pl_TIFFPredictor(
19 action(action), 19 action(action),
20 columns(columns), 20 columns(columns),
21 samples_per_pixel(samples_per_pixel), 21 samples_per_pixel(samples_per_pixel),
22 - bits_per_sample(bits_per_sample) 22 + bits_per_sample(bits_per_sample),
  23 + p_next(getNext())
23 { 24 {
24 if (samples_per_pixel < 1) { 25 if (samples_per_pixel < 1) {
25 throw std::runtime_error("TIFFPredictor created with invalid samples_per_pixel"); 26 throw std::runtime_error("TIFFPredictor created with invalid samples_per_pixel");
@@ -58,7 +59,7 @@ void @@ -58,7 +59,7 @@ void
58 Pl_TIFFPredictor::processRow() 59 Pl_TIFFPredictor::processRow()
59 { 60 {
60 QTC::TC("libtests", "Pl_TIFFPredictor processRow", (action == a_decode ? 0 : 1)); 61 QTC::TC("libtests", "Pl_TIFFPredictor processRow", (action == a_decode ? 0 : 1));
61 - BitWriter bw(this->getNext()); 62 + BitWriter bw(p_next);
62 BitStream in(this->cur_row.data(), this->bytes_per_row); 63 BitStream in(this->cur_row.data(), this->bytes_per_row);
63 std::vector<long long> prev; 64 std::vector<long long> prev;
64 for (unsigned int i = 0; i < this->samples_per_pixel; ++i) { 65 for (unsigned int i = 0; i < this->samples_per_pixel; ++i) {
@@ -92,5 +93,5 @@ Pl_TIFFPredictor::finish() @@ -92,5 +93,5 @@ Pl_TIFFPredictor::finish()
92 processRow(); 93 processRow();
93 } 94 }
94 cur_row.clear(); 95 cur_row.clear();
95 - getNext()->finish(); 96 + p_next->finish();
96 } 97 }
libqpdf/qpdf/Pl_TIFFPredictor.hh
@@ -34,6 +34,7 @@ class Pl_TIFFPredictor: public Pipeline @@ -34,6 +34,7 @@ class Pl_TIFFPredictor: public Pipeline
34 unsigned int samples_per_pixel; 34 unsigned int samples_per_pixel;
35 unsigned int bits_per_sample; 35 unsigned int bits_per_sample;
36 std::vector<unsigned char> cur_row; 36 std::vector<unsigned char> cur_row;
  37 + Pipeline* p_next;
37 }; 38 };
38 39
39 #endif // PL_TIFFPREDICTOR_HH 40 #endif // PL_TIFFPREDICTOR_HH