Classes | Public Types | Public Member Functions | Static Public Member Functions | List of all members
Celartem::DjVu::IW44Encoder Class Referenceabstract

#include <djv_iw44encoder.h>

Inheritance diagram for Celartem::DjVu::IW44Encoder:
Inheritance graph
[legend]

Classes

struct  ChunkConfig
 
struct  Params
 

Public Types

enum  Intent {
  IW44 = 0, BG44, FG44, PM44,
  BM44, TH44
}
 
enum  CBCRMode { cbcrNone = 0, cbcrHalf, cbcrNormal }
 
enum  CBCRDelay { cbcrDelayAuto = 0xFF }
 This enumeration defines cbcrDelayAuto. More...
 
enum  SliceCallbackResult { continueEncoding = 0, endChunk, quitEncoding }
 
typedef SliceCallbackResult(* SliceCallback )(IW44Encoder *inIW44Encoder, size_t inChunkIndex, size_t inSlicesInChunk, size_t inBytesInChunk, void *inContext)
 

Public Member Functions

virtual bool encode (Stream *inStream, size_t *outSizeWritten=NULL)=0
 
virtual AutoPtr< ChunkencodeIW44Chunk ()=0
 
virtual float calculateMSE ()=0
 
- Public Member Functions inherited from Celartem::Referable
 Referable ()
 
void addRef () const
 
void releaseRef () const
 
size_t getReferenceCount () const
 

Static Public Member Functions

static AutoPtr< IW44Encodercreate (const u8 *inImagePtr, ssize_t inRowStride, Photometric inImagePm, size_t inWidth, size_t inHeight, const Params &inParams)
 
- Static Public Member Functions inherited from Celartem::Referable
static void dumpDbgAllRefCount ()
 

Detailed Description

This class compresses color or grayscale images using IW44 wavelet transformation and ZPCoder.
This interface is provided for advanced purpose and you had better use DjVuEncoder for the normal purpose.

Member Typedef Documentation

typedef SliceCallbackResult(* Celartem::DjVu::IW44Encoder::SliceCallback)(IW44Encoder *inIW44Encoder, size_t inChunkIndex, size_t inSlicesInChunk, size_t inBytesInChunk, void *inContext)

This function type defines callback functions being called after each slice encoding iteration. Main purpose of those callbacks are to descide the end of chunks and the end of encoding processes.

Parameters
inIW44EncoderThe instance of IW44Encoder.
inChunkIndexThe index of the current chunk beeing encoded. The index of the first chunk is 0.
inSlicesInChunkThe number of slices already encoded in the current chunk. It starts with 1.
inBytesInChunkThe size of the data already encoded in the current chunk.
inContextThe pointer to user defined context data.
Returns
The return value determines whether to stop/continue encoding process.

Member Enumeration Documentation

This enumeration defines cbcrDelayAuto.

Enumerator
cbcrDelayAuto 

Make IW44Encoder determine the value of chrominance delay counter.

This enumeration controls how to process the chrominance of the input image. It affects the quality of the resulting image.

Enumerator
cbcrNone 

The wavelet transformation will discard the chrominance (Cb/Cr) information and only keep the luminance (Y) and the image will be gray-scale.

cbcrHalf 

The wavelet transformation will process the chrominance (Cb/Cr) at only half of the image resolution. This option creates smaller data than cbcrNormal but may create artifacts in highly colored images.

cbcrNormal 

The wavelet transformation will process the chrominance (Cb/Cr) at full resolution. This is the default.

This enumeration is used by IW44Encoder::create to choose the intention of encoding. It controls the quality and the layout of the resulting IW44 encoded image data.

Enumerator
IW44 

Encode the image for general purpose.

BG44 

Encode the image for Background layer.

FG44 

Encode the image for Foreground layer.

PM44 

Encode the image for Color IW44 file.

BM44 

Encode the image for Grayscale IW44 file.

TH44 

Encode the image for Thumbnails.

This enumeration is used for the return values of SliceCallback callback functions.

Enumerator
continueEncoding 

Continue encoding.

endChunk 

End the current chunk with the current slice.

quitEncoding 

Quit encoding processes. If this value is returnd from a callback function, slices in this encoding iteration will be discarded, then encode or encodeChunk returns false.

Member Function Documentation

virtual float Celartem::DjVu::IW44Encoder::calculateMSE ( )
pure virtual

Calculates MSE (Mean Squared Error) of wavelet coefficients at a point in encoding process. Wavelet coefficients can be from -128 to 127.

Returns
Returns MSE.
static AutoPtr<IW44Encoder> Celartem::DjVu::IW44Encoder::create ( const u8 inImagePtr,
ssize_t  inRowStride,
Photometric  inImagePm,
size_t  inWidth,
size_t  inHeight,
const Params inParams 
)
static

Create a new IW44Encoder instance that encodes the image specfied by RAW pointer of the buffer. The buffer should be accessible during the lifetime of the returned IW44Encoder instance; in other words, you should be aware of the lifetime of the buffer. The image of the buffer is assumed to be a top-down image if the row-stride has positive value.
The number of chunks and the number of slices in each chunks depend on inIntent and inQuality.

Parameters
inImagePtrThe pointer to the first line in the RAW data.
inRowStrideThe row-stride of the RAW data.
inImagePmThe photometric of srouce image. This is one of the Photometric enumeration values.
inWidthThe width of the image.
inHeightThe height of the image.
inParamsThe parameters to configure IW44 encoding.
Returns
Pointer to the newly created IW44Encoder instance.
virtual bool Celartem::DjVu::IW44Encoder::encode ( Stream inStream,
size_t *  outSizeWritten = NULL 
)
pure virtual

Encode the image into a stream. IW44Encoder may cut it's data into pieces for the convenience at a time of decoding. You should call this function repeatedly untill it return false. When this function return false, it writes nothing in the inStream. If you want DjVu's **44 chunks, you can use encodeIW44Chunk function instead of this function.

The following code illustrates the normal usage of this function.

for(;;)
{
...
if(!iw44->encode(stream))
break;
...
}

The output of this function doesn't contain IFF header. You should use Chunk class to output any IFF related structures.

See Also
IW44Encoder::getCount, Chunk
Parameters
inStreamThe stream to write on.
outSizeWrittenThe number of bytes written by this call. It can be NULL.
Returns
Return false when the instance of IW44Encoder regards no more chunk is needed. Otherwise return true.
virtual AutoPtr<Chunk> Celartem::DjVu::IW44Encoder::encodeIW44Chunk ( )
pure virtual

Encode the instance to the DjVu's **44 chunk.

Returns
A Chunk which contains **44 data. It may be NULL if no more chunks to encode.

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

Cuminas DjVu SDK 3.0.33103
This document is made with doxygen 1.8.5 at Sun Dec 15 2013 19:38:07.
Cuminas Logo