iipsrv 1.1
iipsrv is an advanced high-performance feature-rich image server for web-based streamed viewing and zooming of ultra high-resolution images
Compressor.h
1/* Generic compressor class - extended by JPEG and PNG Compressor classes
2
3 Copyright (C) 2017-2018 Ruven Pillay
4
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 3 of the License, or
8 (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software Foundation,
17 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
18*/
19
20
21#ifndef _COMPRESSOR_H
22#define _COMPRESSOR_H
23
24
25
26#include <string>
27#include "RawTile.h"
28
29
30
33
34 protected:
35
37 int Q;
38
40 std::string icc;
41
43 std::string xmp;
44
46 virtual void writeICCProfile() {};
47
49 virtual void writeXMPMetadata() {};
50
51
52 public:
53
54 virtual ~Compressor() {};
55
56
58 inline int getQuality() { return Q; }
59
60
62
63 inline void setICCProfile( const std::string& profile ){ icc = profile; }
64
65
67
68 inline void setXMPMetadata( const std::string& x ){ xmp = x; }
69
70
72
73 virtual unsigned int getHeaderSize() { return 0; };
74
75
77
78 virtual unsigned char* getHeader() { return NULL; };
79
80
82
88 virtual void InitCompression( const RawTile& rawtile, unsigned int strip_height ) {};
89
90
92
97 virtual unsigned int CompressStrip( unsigned char* s, unsigned char* o, unsigned int tile_height ) { return 0; };
98
99
101
104 virtual unsigned int Finish( unsigned char* output ) { return 0; };
105
106
108
111 virtual unsigned int Compress( RawTile& t ) { return 0; };
112
113
115
116 virtual void addXMPMetadata( const std::string& m ) {};
117
118
120
121 virtual const char* getMimeType() { return "image/example"; };
122
123
125
126 virtual const char* getSuffix() { return "img"; };
127
128};
129
130#endif
Base class for IIP output images.
Definition Compressor.h:32
virtual unsigned int CompressStrip(unsigned char *s, unsigned char *o, unsigned int tile_height)
Compress a strip of image data.
Definition Compressor.h:97
std::string xmp
XMP metadata.
Definition Compressor.h:43
virtual void writeICCProfile()
Write ICC profile.
Definition Compressor.h:46
virtual void writeXMPMetadata()
Write XMP metadata.
Definition Compressor.h:49
int getQuality()
Get the current quality level.
Definition Compressor.h:58
std::string icc
ICC Profile.
Definition Compressor.h:40
int Q
Quality level.
Definition Compressor.h:37
virtual unsigned int Finish(unsigned char *output)
Finish the strip based compression and free memory.
Definition Compressor.h:104
virtual const char * getMimeType()
Get mime type.
Definition Compressor.h:121
virtual void InitCompression(const RawTile &rawtile, unsigned int strip_height)
Initialise strip based compression.
Definition Compressor.h:88
virtual unsigned int getHeaderSize()
Return the image header size.
Definition Compressor.h:73
void setICCProfile(const std::string &profile)
Set the ICC profile.
Definition Compressor.h:63
virtual unsigned char * getHeader()
Return a pointer to the image header itself.
Definition Compressor.h:78
virtual unsigned int Compress(RawTile &t)
Compress an entire buffer of image data at once in one command.
Definition Compressor.h:111
virtual void addXMPMetadata(const std::string &m)
Add metadata to the image header.
Definition Compressor.h:116
void setXMPMetadata(const std::string &x)
Set XMP metadata.
Definition Compressor.h:68
virtual const char * getSuffix()
Get file suffix.
Definition Compressor.h:126
Class to represent a single image tile.
Definition RawTile.h:45