class IW44Image: public GPEnabled

IW44 encoded gray-level and color images.

Inheritance:


Public Classes

[more]enum CRCBMode
Chrominance processing selector.

Public Methods

[more]static GP<IW44Image> create_decode(const bool color=true)
Null constructor.
[more]static GP<IW44Image> create_encode(const bool color=true)
Null constructor.
[more]static GP<IW44Image> create(const GBitmap &bm, const GP<GBitmap> mask=0)
Initializes an IWBitmap with image bm.
[more]static GP<IW44Image> create(const GPixmap &bm, const GP<GBitmap> mask=0, CRCBMode crcbmode=CRCBnormal)
Initializes an IWPixmap with color image bm.
[more]int get_width(void) const
Returns the width of the IWBitmap image.
[more]int get_height(void) const
Returns the height of the IWBitmap image.
[more]virtual GP<GBitmap> get_bitmap(void)
Reconstructs the complete image.
[more]virtual GP<GBitmap> get_bitmap(int subsample, const GRect &rect)
Reconstructs a segment of the image at a given scale.
[more]virtual GP<GPixmap> get_pixmap(void)
Reconstructs the complete image.
[more]virtual GP<GPixmap> get_pixmap(int subsample, const GRect &rect)
Reconstructs a segment of the image at a given scale.
[more]virtual unsigned int get_memory_usage(void) const
Returns the amount of memory used by the wavelet coefficients.
[more]virtual int get_percent_memory(void) const
Returns the filling ratio of the internal data structure.
[more]virtual int encode_chunk(ByteStream &bs, const IWEncoderParms &parms)
Encodes one data chunk into ByteStream bs.
[more]virtual void encode_iff(IFFByteStream &iff, int nchunks, const IWEncoderParms *parms)
Writes a gray level image into DjVu IW44 file.
[more]virtual int decode_chunk(ByteStream &bs)
Decodes one data chunk from ByteStream bs.
[more]virtual void decode_iff(IFFByteStream &iff, int maxchunks=999)
This function enters a composite chunk (identifier FORM:BM44, or FORM:PM44), and decodes a maximum of maxchunks data chunks (identifier BM44).
[more]virtual void close_codec(void)
Resets the encoder/decoder state.
[more]virtual int get_serial(void)
Returns the chunk serial number.
[more]virtual int parm_crcbdelay(const int parm)
Sets the chrominance delay parameter.
[more]virtual void parm_dbfrac(float frac)
Sets the dbfrac parameter.


Inherited from GPEnabled:

Public Methods

oGPEnabled& operator=(const GPEnabled & obj)
oint get_count(void) const

Protected Fields

ovolatile int count


Documentation

IW44 encoded gray-level and color images. This class acts as a base for images represented as a collection of IW44 wavelet coefficients. The coefficients are stored in a memory efficient data structure. Member function get_bitmap renders an arbitrary segment of the image into a GBitmap. Member functions decode_iff and encode_iff read and write DjVu IW44 files (see IW44Image.h). Both the copy constructor and the copy operator are declared as private members. It is therefore not possible to make multiple copies of instances of this class.
oenum CRCBMode
Chrominance processing selector. The following constants may be used as argument to the following IWPixmap constructor to indicate how the chrominance information should be processed. There are four possible values:
CRCBnone:
The wavelet transform will discard the chrominance information and only keep the luminance. The image will show in shades of gray.
CRCBhalf:
The wavelet transform will process the chrominance at only half the image resolution. This option creates smaller files but may create artifacts in highly colored images.
CRCBnormal:
The wavelet transform will process the chrominance at full resolution. This is the default.
CRCBfull:
The wavelet transform will process the chrominance at full resolution. This option also disables the chrominance encoding delay (see parm_crcbdelay) which usually reduces the bitrate associated with the chrominance information.

ostatic GP<IW44Image> create_decode(const bool color=true)
Null constructor. Constructs an empty IW44Image object. This object does not contain anything meaningful. You must call function init, decode_iff or decode_chunk to populate the wavelet coefficient data structure. You may not use encode_iff or encode_chunk.

ostatic GP<IW44Image> create_encode(const bool color=true)
Null constructor. Constructs an empty IW44Image object. This object does not contain anything meaningful. You must call function init, decode_iff or decode_chunk to populate the wavelet coefficient data structure. You may then use encode_iff and encode_chunk.

ostatic GP<IW44Image> create(const GBitmap &bm, const GP<GBitmap> mask=0)
Initializes an IWBitmap with image bm. This constructor performs the wavelet decomposition of image bm and records the corresponding wavelet coefficient. Argument mask is an optional bilevel image specifying the masked pixels (see IW44Image.h).

ostatic GP<IW44Image> create(const GPixmap &bm, const GP<GBitmap> mask=0, CRCBMode crcbmode=CRCBnormal)
Initializes an IWPixmap with color image bm. This constructor performs the wavelet decomposition of image bm and records the corresponding wavelet coefficient. Argument mask is an optional bilevel image specifying the masked pixels (see IW44Image.h). Argument crcbmode specifies how the chrominance information should be encoded (see CRCBMode).

oint get_width(void) const
Returns the width of the IWBitmap image.

oint get_height(void) const
Returns the height of the IWBitmap image.

ovirtual GP<GBitmap> get_bitmap(void)
Reconstructs the complete image. The reconstructed image is then returned as a GBitmap object.

ovirtual GP<GBitmap> get_bitmap(int subsample, const GRect &rect)
Reconstructs a segment of the image at a given scale. The subsampling ratio subsample must be a power of two between 1 and 32. Argument rect specifies which segment of the subsampled image should be reconstructed. The reconstructed image is returned as a GBitmap object whose size is equal to the size of the rectangle rect.

ovirtual GP<GPixmap> get_pixmap(void)
Reconstructs the complete image. The reconstructed image is then returned as a GPixmap object.

ovirtual GP<GPixmap> get_pixmap(int subsample, const GRect &rect)
Reconstructs a segment of the image at a given scale. The subsampling ratio subsample must be a power of two between 1 and 32. Argument rect specifies which segment of the subsampled image should be reconstructed. The reconstructed image is returned as a GPixmap object whose size is equal to the size of the rectangle rect.

ovirtual unsigned int get_memory_usage(void) const
Returns the amount of memory used by the wavelet coefficients. This amount of memory is expressed in bytes.

ovirtual int get_percent_memory(void) const
Returns the filling ratio of the internal data structure. Wavelet coefficients are stored in a sparse array. This function tells what percentage of bins have been effectively allocated.

ovirtual int encode_chunk(ByteStream &bs, const IWEncoderParms &parms)
Encodes one data chunk into ByteStream bs. Parameter parms controls how much data is generated. The chunk data is written to ByteStream bs with no IFF header. Successive calls to successive chunks. You must call close_codec after encoding the last chunk of a file.

ovirtual void encode_iff(IFFByteStream &iff, int nchunks, const IWEncoderParms *parms)
Writes a gray level image into DjVu IW44 file. This function creates a composite chunk (identifier FORM:BM44 or FORM:PM44) composed of nchunks chunks (identifier BM44 or PM44). Data for each chunk is generated with array parms.

ovirtual int decode_chunk(ByteStream &bs)
Decodes one data chunk from ByteStream bs. Successive calls to decode_chunk decode successive chunks. You must call close_codec after decoding the last chunk of a file. Note that function get_bitmap and decode_chunk may be called simultaneously from two execution threads.

ovirtual void decode_iff(IFFByteStream &iff, int maxchunks=999)
This function enters a composite chunk (identifier FORM:BM44, or FORM:PM44), and decodes a maximum of maxchunks data chunks (identifier BM44). Data for each chunk is processed using the function decode_chunk.

ovirtual void close_codec(void)
Resets the encoder/decoder state. The first call to decode_chunk or

close_codec must be called after processing the last chunk in order to reset the coder and release the associated memory.

ovirtual int get_serial(void)
Returns the chunk serial number. This function returns the serial number of the last chunk encoded with decode_chunk. The first chunk always has serial number 1. Successive chunks have increasing serial numbers. Value 0 is returned if this function is called before calling after calling close_codec.

ovirtual int parm_crcbdelay(const int parm)
Sets the chrominance delay parameter. This function can be called before encoding the first color IW44 data chunk. Parameter parm is an encoding delay which reduces the bitrate associated with the chrominance information. The default chrominance encoding delay is 10.

ovirtual void parm_dbfrac(float frac)
Sets the dbfrac parameter. This function can be called before encoding the first IW44 data chunk. Parameter frac modifies the decibel estimation algorithm in such a way that the decibel target only pertains to the average error of the fraction frac of the most misrepresented 32x32 pixel blocks. Setting arguments frac to 1.0 restores the normal behavior.


This class has no child classes.

Alphabetic index HTML hierarchy of classes or Java


DjVu is a trademark of LizardTech, Inc.
All other products mentioned are registered trademarks or trademarks of their respective companies.