aboutsummaryrefslogtreecommitdiffstats
path: root/libqpdf/qpdf/Pl_TIFFPredictor.hh
diff options
context:
space:
mode:
authorJay Berkenbilt <ejb@ql.org>2018-01-13 20:15:20 +0100
committerJay Berkenbilt <ejb@ql.org>2018-01-14 01:49:42 +0100
commit53971d50be39448c980d842a1fe1f525b4cee597 (patch)
tree4a8ddcfcecd26d7cc1713e74ecf06d842ef163f6 /libqpdf/qpdf/Pl_TIFFPredictor.hh
parentd9c90497089ae5cf00891d6febfa7f486f021833 (diff)
downloadqpdf-53971d50be39448c980d842a1fe1f525b4cee597.tar.zst
Add Pl_TIFFPredictor
Diffstat (limited to 'libqpdf/qpdf/Pl_TIFFPredictor.hh')
-rw-r--r--libqpdf/qpdf/Pl_TIFFPredictor.hh39
1 files changed, 39 insertions, 0 deletions
diff --git a/libqpdf/qpdf/Pl_TIFFPredictor.hh b/libqpdf/qpdf/Pl_TIFFPredictor.hh
new file mode 100644
index 00000000..235068ee
--- /dev/null
+++ b/libqpdf/qpdf/Pl_TIFFPredictor.hh
@@ -0,0 +1,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;
+ unsigned char* cur_row;
+ size_t pos;
+};
+
+#endif // __PL_TIFFPREDICTOR_HH__