Compressor.h
/* Generic compressor class - extended by JPEG and PNG Compressor classes
Copyright (C) 2017-2018 Ruven Pillay
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _COMPRESSOR_H
#define _COMPRESSOR_H
#include <string>
#include "RawTile.h"
class Compressor {
protected:
int Q;
std::string icc;
std::string xmp;
virtual void writeICCProfile() {};
virtual void writeXMPMetadata() {};
public:
virtual ~Compressor() {};
inline int getQuality() { return Q; }
inline void setICCProfile( const std::string& profile ){ icc = profile; }
inline void setXMPMetadata( const std::string& x ){ xmp = x; }
virtual unsigned int getHeaderSize() { return 0; };
virtual unsigned char* getHeader() { return NULL; };
virtual void InitCompression( const RawTile& rawtile, unsigned int strip_height ) {};
virtual unsigned int CompressStrip( unsigned char* s, unsigned char* o, unsigned int tile_height ) { return 0; };
virtual unsigned int Finish( unsigned char* output ) { return 0; };
virtual unsigned int Compress( RawTile& t ) { return 0; };
virtual void addXMPMetadata( const std::string& m ) {};
virtual const char* getMimeType() { return "image/example"; };
virtual const char* getSuffix() { return "img"; };
};
#endif
Compressor
Base class for IIP output images.
Definition Compressor.h:32
Compressor::CompressStrip
virtual unsigned int CompressStrip(unsigned char *s, unsigned char *o, unsigned int tile_height)
Compress a strip of image data.
Definition Compressor.h:97
Compressor::xmp
std::string xmp
XMP metadata.
Definition Compressor.h:43
Compressor::writeICCProfile
virtual void writeICCProfile()
Write ICC profile.
Definition Compressor.h:46
Compressor::writeXMPMetadata
virtual void writeXMPMetadata()
Write XMP metadata.
Definition Compressor.h:49
Compressor::getQuality
int getQuality()
Get the current quality level.
Definition Compressor.h:58
Compressor::icc
std::string icc
ICC Profile.
Definition Compressor.h:40
Compressor::Q
int Q
Quality level.
Definition Compressor.h:37
Compressor::Finish
virtual unsigned int Finish(unsigned char *output)
Finish the strip based compression and free memory.
Definition Compressor.h:104
Compressor::getMimeType
virtual const char * getMimeType()
Get mime type.
Definition Compressor.h:121
Compressor::InitCompression
virtual void InitCompression(const RawTile &rawtile, unsigned int strip_height)
Initialise strip based compression.
Definition Compressor.h:88
Compressor::getHeaderSize
virtual unsigned int getHeaderSize()
Return the image header size.
Definition Compressor.h:73
Compressor::setICCProfile
void setICCProfile(const std::string &profile)
Set the ICC profile.
Definition Compressor.h:63
Compressor::getHeader
virtual unsigned char * getHeader()
Return a pointer to the image header itself.
Definition Compressor.h:78
Compressor::Compress
virtual unsigned int Compress(RawTile &t)
Compress an entire buffer of image data at once in one command.
Definition Compressor.h:111
Compressor::addXMPMetadata
virtual void addXMPMetadata(const std::string &m)
Add metadata to the image header.
Definition Compressor.h:116
Compressor::setXMPMetadata
void setXMPMetadata(const std::string &x)
Set XMP metadata.
Definition Compressor.h:68
Compressor::getSuffix
virtual const char * getSuffix()
Get file suffix.
Definition Compressor.h:126
RawTile
Class to represent a single image tile.
Definition RawTile.h:45