summaryrefslogtreecommitdiffstats
path: root/libqpdf/qpdf/Pl_TIFFPredictor.hh
blob: 484f4df49c8b511ce0754e47c11468ff79eff23e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#ifndef PL_TIFFPREDICTOR_HH
#define PL_TIFFPREDICTOR_HH

// This pipeline reverses the application of a TIFF predictor as
// described in the TIFF specification.

#include <qpdf/Pipeline.hh>

class Pl_TIFFPredictor: public Pipeline
{
  public:
    enum action_e { a_encode, a_decode };

    QPDF_DLL
    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);
    QPDF_DLL
    virtual ~Pl_TIFFPredictor();

    QPDF_DLL
    virtual void write(unsigned char* data, size_t len);
    QPDF_DLL
    virtual void finish();

  private:
    void processRow();

    action_e action;
    unsigned int columns;
    unsigned int bytes_per_row;
    unsigned int samples_per_pixel;
    unsigned int bits_per_sample;
    PointerHolder<unsigned char> cur_row;
    size_t pos;
};

#endif // PL_TIFFPREDICTOR_HH