iipsrv  1.0
JPEGCompressor Class Reference

Wrapper class to the IJG JPEG library. More...

#include <JPEGCompressor.h>

Public Member Functions

 JPEGCompressor (int quality)
 Constructor. More...
 
void setQuality (int factor)
 Set the compression quality. More...
 
int getQuality ()
 Get the current quality level.
 
void InitCompression (const RawTile &rawtile, unsigned int strip_height) throw (std::string)
 Initialise strip based compression. More...
 
unsigned int CompressStrip (unsigned char *s, unsigned char *o, unsigned int tile_height) throw (std::string)
 Compress a strip of image data. More...
 
unsigned int Finish (unsigned char *output) throw (std::string)
 Finish the strip based compression and free memory. More...
 
int Compress (RawTile &t) throw (std::string)
 Compress an entire buffer of image data at once in one command. More...
 
void addMetadata (const std::string &m)
 Add metadata to the JPEG header. More...
 
unsigned int getHeaderSize ()
 Return the JPEG header size.
 
unsigned char * getHeader ()
 Return a pointer to the header itself.
 

Detailed Description

Wrapper class to the IJG JPEG library.

Constructor & Destructor Documentation

◆ JPEGCompressor()

JPEGCompressor::JPEGCompressor ( int  quality)
inline

Constructor.

Parameters
qualityJPEG Quality factor (0-100)

Member Function Documentation

◆ addMetadata()

void JPEGCompressor::addMetadata ( const std::string &  m)

Add metadata to the JPEG header.

Parameters
mmetadata

Referenced by getQuality().

◆ Compress()

int JPEGCompressor::Compress ( RawTile t)
throw (std::string
)

Compress an entire buffer of image data at once in one command.

Parameters
ttile of image data

Referenced by getQuality().

◆ CompressStrip()

unsigned int JPEGCompressor::CompressStrip ( unsigned char *  s,
unsigned char *  o,
unsigned int  tile_height 
)
throw (std::string
)

Compress a strip of image data.

Parameters
ssource image data
ooutput buffer
tile_heightpixel height of the tile we are compressing

Referenced by getQuality().

◆ Finish()

unsigned int JPEGCompressor::Finish ( unsigned char *  output)
throw (std::string
)

Finish the strip based compression and free memory.

Parameters
outputoutput buffer
Returns
size of output generated

Referenced by getQuality().

◆ InitCompression()

void JPEGCompressor::InitCompression ( const RawTile rawtile,
unsigned int  strip_height 
)
throw (std::string
)

Initialise strip based compression.

If we are doing a strip based encoding, we need to first initialise with InitCompression, then compress a single strip at a time using CompressStrip and finally clean up using Finish

Parameters
rawtiletile containing the image to be compressed
strip_heightpixel height of the strip we want to compress
Returns
header size

Referenced by getQuality().

◆ setQuality()

void JPEGCompressor::setQuality ( int  factor)
inline

Set the compression quality.

Parameters
factorQuality factor (0-100)

The documentation for this class was generated from the following file: