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

#include <djv_iw44decoder.h>

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

Public Types

enum  SliceCallbackResult { continueDecoding = 0, quitDecoding }
 
typedef SliceCallbackResult(* SliceCallback )(IW44Decoder *inIW44Decoder, size_t inChunkIndex, size_t inSlicesInChunk, size_t inBytesInChunk, void *inContext)
 

Public Member Functions

virtual bool decode (Stream *inStream)=0
 
virtual bool decode (const Chunk *inChunk)=0
 
virtual bool isNextIW44Data (Stream *inStream) const =0
 
virtual bool isNextIW44Data (const Chunk *inChunk) const =0
 
virtual bool isReadyToRender () const =0
 
virtual size_t getNumDecodedChunks () const =0
 
virtual size_t getWidth () const =0
 
virtual size_t getHeight () const =0
 
virtual bool isColorImage () const =0
 
virtual void render (u8 *outImagePtr, ssize_t inRowStride, Photometric inImagePm, size_t inSubsample=1, const Rect *inSubRect=NULL) const =0
 
virtual void render (u8 *outImagePtr, ssize_t inRowStride, Photometric inImagePm, const Rect &inRect, size_t inRescaledWidth=0, size_t inRescaledHeight=0, Rotation inRotation=rot0, bool inUseFastScaling=false) const =0
 
virtual void setProgressiveDecoding (bool inProgressive)=0
 
virtual bool addChunk (const Chunk *inChunk)=0
 
virtual size_t decodeProgressively (size_t inNumSlices)=0
 
virtual bool isDecodeCompleted () const =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< IW44Decodercreate (SliceCallback inSliceCallback=NULL, void *inSliceCallbackContext=NULL)
 
- Static Public Member Functions inherited from Celartem::Referable
static void dumpDbgAllRefCount ()
 

Detailed Description

This class decompresses color or grayscale images with the IW44 wavelet transformation and ZPCoder.

Member Typedef Documentation

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

Definition for the callback function which is called after decoding each slice.
The main purpose of the callback are to decide the end of decoding processes. You can optionally call render methods in this function to get the decoding image (which is not yet completely loaded).
Be sure that if you quit decoding in middle of a chunk, slices and chunks follows that chunk are simply discarded and you cannot restart the decoding from that point.

Parameters
inIW44DecoderThe instance of IW44Decoder.
inChunkIndexThe index of the current chunk beeing decoded.
The index of the first chunk is 0.
inSlicesInChunkThe number of slices already decoded in the current chunk.
At the first call to this function, this is 1.
inBytesInChunkThe size of the data already decoded in the current chunk.
inContextPointer to user defined context data.
Returns
One of the SliceCallbackResult enumeration which decides whether decode process will continue or not.

Member Enumeration Documentation

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

Enumerator
continueDecoding 

Continue decoding until the end of the chunk.

quitDecoding 

Quit decoding processes.

Member Function Documentation

virtual bool Celartem::DjVu::IW44Decoder::addChunk ( const Chunk inChunk)
pure virtual

Add the chunk.
You must feed the chunk in the decoded (IFF chunk) order.
To decode the chunk, you need to call or .

Parameters
inChunkThe chunk which contains **44 data.
Returns
Return true if the chunk is next to last added chunk otherwise false.
static AutoPtr<IW44Decoder> Celartem::DjVu::IW44Decoder::create ( SliceCallback  inSliceCallback = NULL,
void *  inSliceCallbackContext = NULL 
)
static

Create a new IW44Decoder instance that decodes the image from encoded data by IW44 encoders.

Parameters
inSliceCallbackThe pointer to a callback function which will be called right after decoding each slice.
inSliceCallbackContextThe pointer to a user defined context data. It is given to the callback specified as inSliceCallback.
Returns
Pointer to the newly created IW44Decoder instance.
virtual bool Celartem::DjVu::IW44Decoder::decode ( Stream inStream)
pure virtual

Decode the image from the stream.
You must feed the stream in the decoded order.
This method is for advanced purpose and you had better use decode(const Chunk*) in normal case.
Unlike other classes, this method is intended to be called repeatedly during decoding a IW44 encoded image.

Parameters
inStreamThe stream to read from.
Returns
Return false when a SliceCallback callback function is specified and it returns quitDecoding. After that, you cannot call decode to gain more quality for the resulting image.
virtual bool Celartem::DjVu::IW44Decoder::decode ( const Chunk inChunk)
pure virtual

Decode the image in the chunk.
You must feed the chunk in the decoded (IFF chunk) order.
Unlike other classes, this method is intended to be called repeatedly during decoding a IW44 encoded image.

Parameters
inChunkThe chunk which contains **44 data.
Returns
Return false when a SliceCallback callback function is specified and it returns quitDecoding. After that, you cannot call decode to gain more quality for the resulting image.
virtual size_t Celartem::DjVu::IW44Decoder::decodeProgressively ( size_t  inNumSlices)
pure virtual

Decode IW44 chunk partially. This method may decode series of chunks at a time.

Parameters
inNumSlicesThe number of slices to be decoded on this call.
It can be larger than the actual number of slices in the series of chunks; ultimately, set it to SIZE_MAX to decode all the slices of available chunks at once.
Returns
The number of total slices decoded so far.
virtual size_t Celartem::DjVu::IW44Decoder::getHeight ( ) const
pure virtual

Get the height of the resulting image.
Untill isReadyToRender returns true the result of this method is not valid.

Returns
The height of the image in pixels.
virtual size_t Celartem::DjVu::IW44Decoder::getNumDecodedChunks ( ) const
pure virtual

Get the number of IW44 chunks already decoded.
This is not the "number of slices" but the number of "chunks", which is actually same to the number of calls to decode methods.

Returns
The number of decoded chunks.
virtual size_t Celartem::DjVu::IW44Decoder::getWidth ( ) const
pure virtual

Get the width of the resulting image.
Untill isReadyToRender returns true, the result of this method is not valid.

Returns
The width of the image in pixels.
virtual bool Celartem::DjVu::IW44Decoder::isColorImage ( ) const
pure virtual

Determine whether the resulting image is color or grayscale.
Untill isReadyToRender returns true the result of this method is not valid.

Returns
true if the image is color, otherwise false.
virtual bool Celartem::DjVu::IW44Decoder::isDecodeCompleted ( ) const
pure virtual

Determine whether or not the decoder decoded all of the chunks added by addChunk method.

Returns
true if all the chunks are completely decoded; otherwise false.
virtual bool Celartem::DjVu::IW44Decoder::isNextIW44Data ( Stream inStream) const
pure virtual

Determine whether the specified stream contains the next IW44 data, which should be processed by decode method.

Parameters
inStreamThe stream to read from.
Returns
Return true if the stream contains the next data.
virtual bool Celartem::DjVu::IW44Decoder::isNextIW44Data ( const Chunk inChunk) const
pure virtual

Determine whether the specified chunk contains the next IW44 data, which should be processed by decode method.

Parameters
inChunkThe chunk which contains **44 data.
Returns
Return true if the chunk contains the next data.
virtual bool Celartem::DjVu::IW44Decoder::isReadyToRender ( ) const
pure virtual

Determine whether the encoder instance is ready to render image.
This method returns true after the first call of decode method or even in the first time of SliceCallback callback function is called. Otherwise this method return false.

virtual void Celartem::DjVu::IW44Decoder::render ( u8 outImagePtr,
ssize_t  inRowStride,
Photometric  inImagePm,
size_t  inSubsample = 1,
const Rect inSubRect = NULL 
) const
pure virtual

Render the resulting image onto the specified buffer. You may get incomplete rendered result if some of **44 chunks are not loaded.

Parameters
outImagePtrThe pointer to the first line of the buffer.
inRowStrideThe row-stride for the image on the buffer.
inImagePmThe photometric of destination image. You can specify any of the Photometric enumeration values even if it does not match to the one of the original image.
inSubsampleThe subsampling ratio. It must be one of the values between 1 to 32. The default is 1, which means the original scale.
inSubRectThe pointer to the Rect instance that indicates the portion to be extracted in pixels of the subsampled image. If it is NULL, this method returns whole the image.
virtual void Celartem::DjVu::IW44Decoder::render ( u8 outImagePtr,
ssize_t  inRowStride,
Photometric  inImagePm,
const Rect inRect,
size_t  inRescaledWidth = 0,
size_t  inRescaledHeight = 0,
Rotation  inRotation = rot0,
bool  inUseFastScaling = false 
) const
pure virtual

Render the resulting image onto the specified buffer. You may get incomplete rendered result if some of **44 chunks are not loaded.

Parameters
outImagePtrThe pointer to the first line of the buffer.
inRowStrideThe row-stride for the image on the buffer.
inImagePmThe photometric of destination image. You can specify any of the Photometric enumeration values even if it does not match to the one of the original image.
inRectRectangle to draw in the rescaled image coordination.
inRescaledWidthThe virtual width of the rescaled page image.
This method renders page image as if it had this width. If 0 is specified, the rendered image is same size to the original page size.
inRescaledHeightThe virtual height of the rescaled page image.
This method renders page image as if it had this height. If 0 is specified, the rendered image is same size to the original page size.
inRotationThe rotation of the image.
inUseFastScalingDetermine whether to use faster scaling or not.
The default is not to use faster scaling.
virtual void Celartem::DjVu::IW44Decoder::setProgressiveDecoding ( bool  inProgressive)
pure virtual

Enable/disable progressive decoding mode.

Parameters
inProgressiveWhether or not to decode IW44 chunks in progressive mode.

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