2018-08-12 18:07:22 +00:00
|
|
|
#ifndef PL_TIFFPREDICTOR_HH
|
|
|
|
#define PL_TIFFPREDICTOR_HH
|
2018-01-13 19:15:20 +00:00
|
|
|
|
|
|
|
// This pipeline reverses the application of a TIFF predictor as described in the TIFF
|
|
|
|
// specification.
|
|
|
|
|
|
|
|
#include <qpdf/Pipeline.hh>
|
|
|
|
|
2024-02-04 21:11:53 +00:00
|
|
|
#include <vector>
|
2024-01-21 17:19:40 +00:00
|
|
|
|
2018-01-13 19:15:20 +00:00
|
|
|
class Pl_TIFFPredictor: public Pipeline
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
enum action_e { a_encode, a_decode };
|
|
|
|
|
|
|
|
Pl_TIFFPredictor(
|
|
|
|
char const* identifier,
|
|
|
|
Pipeline* next,
|
|
|
|
action_e action,
|
|
|
|
unsigned int columns,
|
|
|
|
unsigned int samples_per_pixel = 1,
|
|
|
|
unsigned int bits_per_sample = 8);
|
2023-05-20 13:25:46 +00:00
|
|
|
~Pl_TIFFPredictor() override = default;
|
2018-01-13 19:15:20 +00:00
|
|
|
|
2023-05-20 13:25:46 +00:00
|
|
|
void write(unsigned char const* data, size_t len) override;
|
|
|
|
void finish() override;
|
2018-01-13 19:15:20 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
void processRow();
|
|
|
|
|
|
|
|
action_e action;
|
|
|
|
unsigned int columns;
|
|
|
|
unsigned int bytes_per_row;
|
|
|
|
unsigned int samples_per_pixel;
|
|
|
|
unsigned int bits_per_sample;
|
2024-01-21 17:19:40 +00:00
|
|
|
std::vector<unsigned char> cur_row;
|
2024-01-26 19:13:34 +00:00
|
|
|
std::vector<long long> previous;
|
2024-01-27 17:03:32 +00:00
|
|
|
std::vector<unsigned char> out;
|
2024-01-22 00:32:15 +00:00
|
|
|
Pipeline* p_next;
|
2018-01-13 19:15:20 +00:00
|
|
|
};
|
|
|
|
|
2018-08-12 18:07:22 +00:00
|
|
|
#endif // PL_TIFFPREDICTOR_HH
|