aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorJay Berkenbilt <ejb@ql.org>2017-08-19 01:52:53 +0200
committerJay Berkenbilt <ejb@ql.org>2017-08-21 23:44:02 +0200
commitae90d2c485318beb8b4b938d09ffaf5c6f0a5e21 (patch)
tree3d8bd3f2b0337693621b3ed97d1a906dbf3298b7 /include
parent39ab004336188e53022f5345062e61639744335d (diff)
downloadqpdf-ae90d2c485318beb8b4b938d09ffaf5c6f0a5e21.tar.zst
Implement Pl_DCT pipeline
Additional testing is added in later commits to be supported by additional changes in the library.
Diffstat (limited to 'include')
-rw-r--r--include/qpdf/Pl_DCT.hh70
1 files changed, 70 insertions, 0 deletions
diff --git a/include/qpdf/Pl_DCT.hh b/include/qpdf/Pl_DCT.hh
new file mode 100644
index 00000000..b7415394
--- /dev/null
+++ b/include/qpdf/Pl_DCT.hh
@@ -0,0 +1,70 @@
+// Copyright (c) 2005-2015 Jay Berkenbilt
+//
+// This file is part of qpdf. This software may be distributed under
+// the terms of version 2 of the Artistic License which may be found
+// in the source distribution. It is provided "as is" without express
+// or implied warranty.
+
+#ifndef __PL_DCT_HH__
+#define __PL_DCT_HH__
+
+#include <qpdf/Pipeline.hh>
+#include <qpdf/Pl_Buffer.hh>
+#include <jpeglib.h>
+
+class Pl_DCT: public Pipeline
+{
+ public:
+ // Constructor for decompressing image data
+ QPDF_DLL
+ Pl_DCT(char const* identifier, Pipeline* next);
+
+ class CompressConfig
+ {
+ public:
+ CompressConfig()
+ {
+ }
+ virtual ~CompressConfig()
+ {
+ }
+ virtual void apply(jpeg_compress_struct*) = 0;
+ };
+
+ // Constructor for compressing image data
+ QPDF_DLL
+ Pl_DCT(char const* identifier, Pipeline* next,
+ JDIMENSION image_width,
+ JDIMENSION image_height,
+ int components,
+ J_COLOR_SPACE color_space,
+ CompressConfig* config_callback = 0);
+
+ QPDF_DLL
+ virtual ~Pl_DCT();
+
+ QPDF_DLL
+ virtual void write(unsigned char* data, size_t len);
+ QPDF_DLL
+ virtual void finish();
+
+ private:
+ void compress(void* cinfo, PointerHolder<Buffer>);
+ void decompress(void* cinfo, PointerHolder<Buffer>);
+
+ enum action_e { a_compress, a_decompress };
+
+ action_e action;
+ Pl_Buffer buf;
+
+ // Used for compression
+ JDIMENSION image_width;
+ JDIMENSION image_height;
+ int components;
+ J_COLOR_SPACE color_space;
+
+ CompressConfig* config_callback;
+
+};
+
+#endif // __PL_DCT_HH__