In Pl_TIFFPredictor avoid repeated calls to getNext

This commit is contained in:
m-holger 2024-01-22 00:32:15 +00:00
parent 73dec35209
commit 2e8b5f290c
2 changed files with 5 additions and 3 deletions

View File

@ -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();
}

View File

@ -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