Classes | Public Member Functions | Static Public Member Functions

Celartem::DjVu::JB2Encoder Class Reference

#include <djv_jb2encoder.h>

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

List of all members.

Classes

struct  Params

Public Member Functions

virtual void startParallel (size_t inPagesInParallel)=0
virtual void addPage (const u8 *inMaskPtr, ssize_t inMaskRowStride, MaskType inMaskType, size_t inWidth, size_t inHeight, const u8 *inImagePtr=NULL, ssize_t inImageRowStride=0, Photometric inImagePm=pmRGB8, const Params *inParams=NULL, size_t inPageIndex=0)=0
virtual size_t getPageCount () const =0
virtual void finalize (JB2Page::Array &outPages)=0

Static Public Member Functions

static AutoPtr< JB2Encodercreate (const Params *inParams=NULL, bool inUseDictionary=true)

Detailed Description

This class provides a way to encode images with JB2 encoding.
This interface is provided for advanced purpose and you had better use DjVuEncoder for the normal purpose.
This class generates the data of the following chunks:


Member Function Documentation

virtual void Celartem::DjVu::JB2Encoder::addPage ( const u8 inMaskPtr,
ssize_t  inMaskRowStride,
MaskType  inMaskType,
size_t  inWidth,
size_t  inHeight,
const u8 inImagePtr = NULL,
ssize_t  inImageRowStride = 0,
Photometric  inImagePm = pmRGB8,
const Params inParams = NULL,
size_t  inPageIndex = 0 
) [pure virtual]

Add a page to JB2Encoder work area.
This method only stores the specified image into the internal work area and returns immediately.
This method should not be called after calling one of encodeDjbz, encodeSjbz and encodeFGbz.

Parameters:
inMaskPtr The pointer to the "first line" of the image mask.
The following formula correctly calculate the pointer to each line:

mask[n] = inMaskPtr + inMaskRowStride * n;

The image should be accessible until the encoding finishes.
In this mask, 0 means the foreground and 1 (0xff for unpacked case) does the background.
inMaskRowStride The row-stride in bytes of the mask specified by inMask. It can be negative if the image is bottom-up.
inMaskType The type of the mask. It should be one of MaskType enumeration.
inWidth The width of the image specified by inImagePtr and inMaskPtr.
inHeight The height of the image specified by inImagePtr and inMaskPtr.
inImagePtr The pointer to the "first line" of the image.
The following formula correctly calculate the pointer to each line:

line[n] = inImagePtr + inImageRowStride * n;

The image should be accessible until the encoding finishes.
It can be NULL if the image is bi-tonal (black and white 1bit) or the color of the foreground is encoded by other method (i.e. FG44).
inImageRowStride The row-stride in bytes of the image specified by inImagePtr. It can be negative if the image is bottom-up.
It can be 0 if the image is bi-tonal (black and white 1bit).
inImagePm The photometric of the image specified by inImagePtr. It is ignored if inImagePtr is NULL.
inParams Parameters fof JB2 encoding.
inPageIndex For parallel page conversion, this specifies the index of the page (0-based index of the page) to encode on this call; otherwise this parameter is ignored.
static AutoPtr<JB2Encoder> Celartem::DjVu::JB2Encoder::create ( const Params inParams = NULL,
bool  inUseDictionary = true 
) [static]

Create a new instance of JB2Encoder.

Parameters:
inParams Parameters fof JB2 encoding. This can be NULL and the default parameters are used.
These parameters can be overwritten lately by the parameters explicitly passed to each addPage call.
inUseDictionary Whether to use dictionary or not for the JB2 page encoding.
Returns:
Pointer to the newly created JB2Encoder instance.
virtual void Celartem::DjVu::JB2Encoder::finalize ( JB2Page::Array outPages  )  [pure virtual]

Finalize JB2 encoding.
After calling this method, the JB2Encoder instance is clears all the internal data and it can be reused to encode other pages.

Parameters:
outPages Returns array of pages encoded.
virtual size_t Celartem::DjVu::JB2Encoder::getPageCount (  )  const [pure virtual]

Get the number of pages added to this JB2Encoder instance.

Returns:
The number of pages in the JB2Encoder instance.
See also:
encodeSjbz, encodeFGbz
virtual void Celartem::DjVu::JB2Encoder::startParallel ( size_t  inPagesInParallel  )  [pure virtual]

Starts parallel page conversion.
Pages can be converted concurrently with threads if starts with this function.
After call of this function, addPage function can be called concurrently in threads. finalize function should be called after all the threads (addPage call) finished.

Parameters:
inPagesInParallel How many pages are encoded in parallel using threads.

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

This document is made with doxygen 1.7.1 at Thu Feb 17 2011 15:40:20.
Caminova Logo