#include <djv_djvuencoder.h>
Classes | |
class | Helper |
struct | Params |
Public Types | |
enum | DictionaryType { dtNoSharedDict = 0, dtUseSharedDict = 1 } |
enum | EncodeMode { em3Layer = 0, emFG44 = 0, em2Layer = 1, emColorJB2 = 1, emPicture = 2, emBitonal = 3, emAuto = 4, emFG44ColorJB2 = 5 } |
enum | EncodeFlags { efNoMaskDilation = 1, efWriteAppInfo = 2, efSegmentForBitonal = 4, efForceSegmentation = 8, efFgMaskErosion = 16 } |
enum | BitonalEncodingMethod { bemJB2 = 0, bemMMR = 1, bemJBIG2 = 2 } |
enum | PictureEncodingMethod { pemIW44 = 0, pemJPEG = 1, pemJPX = 2 } |
enum | EmptyMaskProcess { mepBitonalOrPicture = 0, mepPicture = 1, mepBitonalOrSegmentation = 2, mepSegmentation = 3 } |
Public Member Functions | |
virtual void | startParallel (size_t inPagesInParallel)=0 |
virtual void | addPage (const u8 *CEL_RESTRICT inImagePtr, ssize_t inImageRowStride, Photometric inImagePm, size_t inWidth, size_t inHeight, size_t inDPI, const Params *inParams=NULL, const u8 *CEL_RESTRICT inMaskPtr=NULL, ssize_t inMaskRowStride=0, MaskType inMaskType=mtUnpacked, size_t inPageIndex=0, JB2Encoder::OptimizationCallback inCallback=NULL, void *inContext=0)=0 |
virtual void | appendChunkToLastPage (Chunk *inChunk)=0 |
virtual size_t | getQueuedPageCount () const =0 |
virtual size_t | getFullPageCount () const =0 |
virtual AutoPtr< Chunk > | finalizeSession (JB2Encoder::OptimizationCallback inCallback=NULL, void *inContext=0)=0 |
virtual void | reset ()=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< DjVuEncoder > | create (DictionaryType inUseDictionary=dtUseSharedDict, size_t inAutoDictFlushFreq=20, const Params *inParams=NULL, Helper *inHelper=NULL) |
static AutoPtr< DjVuEncoder > | create (const Params &inParams, Helper *inHelper=NULL) |
static AutoPtr< DjVuEncoder > | create (const Profile *inProfile, Helper *inHelper=NULL) |
Static Public Member Functions inherited from Celartem::Referable | |
static void | dumpDbgAllRefCount () |
DjVuEncoder encodes DjVu files.
This enumeration is used to determine whether DjVuEncoder uses shared dictionary or not.
Enumerator | |
---|---|
dtNoSharedDict |
Never use shared dictionary. |
dtUseSharedDict |
Use shared dictionary. |
This enumeration is used to specify how to process the image when the mask is empty.
This enumeration is used to specify additional conditions.
Enumerator | |
---|---|
efNoMaskDilation |
Never to dilate mask for background subsampling. |
efWriteAppInfo |
Write Application Info to the encoded DjVu file. |
efSegmentForBitonal |
Use segmentation rather than simple thresholding for emBitonal. |
efForceSegmentation |
Force segmentation even if mask is explictly specified. |
efFgMaskErosion |
Erode mask for foreground subsampling. |
This enumeration is used to determine what kind of encoding is used to encode the page.
Enumerator | |
---|---|
em3Layer |
3-Layer image encoding. |
emFG44 |
FG44; IW44 variant optimized for Foreground compression.
|
em2Layer |
Mask-palette combination, a.k.a. 2 layer. (Using Color JB2) |
emColorJB2 |
Color JB2; JB2 mask with palette.
|
emPicture |
BG44; IW44 variant optimized for picture compression. (No image separation) |
emBitonal |
Black and White JB2; No color is preserved. |
emAuto |
Automatic mode.
|
emFG44ColorJB2 |
Emit both FG44 and FGbz; the application should remove one of them. |
|
pure virtual |
Add a page to encode queue.
This function accepts an image and its separation mask.
inImagePtr | Pointer to the first line of the input image. If you want to encode bitonal image, this can be NULL and inMaskPtr should be a valid mask. |
inRowStride | The row-stride of the image specified by inImagePtr. It can be negative if the image is bottom-up. |
inImagePm | The photometric (type) of the image. It should be one of Photometric. If this value is pmInvalid, inImagePtr is ignored and inMaskPtr should be a valid mask. |
inWidth | The width of the image. |
inHeight | The height of the image. |
inDPI | The resolution of the image in [pixel/inch]. |
inParams | [Advanced Users Only] Optional parameters which configures the DjVu encoder settings. With this option, you can configure the quality and the size of encoded result. For more information, see Params. |
inMaskPtr | [Optional] Pointer to the first line of the mask image. In this mask, 0 means the foreground (black) and 1 (0xff for unpacked case) does the background (white). |
inMaskRowStride | [Optional] The row-stride of the image specified by inMaskPtr. It can be negative if the mask is bottom-up. It is ignored if inMaskPtr is NULL . |
inMaskType | [Optional] The type of the mask. This should be one of MaskType enumeration. It is ignored if inMaskPtr is NULL . |
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. |
inCallback | Callback function called during optimizing JB2 shapes. |
inContext | Context for the callback. |
|
pure virtual |
|
static |
Initialize a new DjVuEncoder instance.
inUseDictionary | Determines whether it uses shared dictionary or not. This should be one of DictionaryType enumeration values. If this value is dtNoSharedDict, inAutoDictFlushFreq is ignored. The default is dtUseSharedDict. The parameter overrides the value specified in inParams. |
inAutoDictFlushFreq | Determines how many pages share a dictionary; in other words, this is the frequency of the flushing the dictionary. DjVuEncoder instance automatically flushes the dictionary if the number of pages specified by inAutoDictFlushFreq is encoded. If 0 is specified, the automatic flush feature is disabled and you should call finalizeSession manually. Even with inAutoDictFlushFreq value not equal to 0, you can manually call finalizeSession and then the dictionary is flushed immediately regardless of inAutoDictFlushFreq value. The parameter overrides the value specified in inParams. |
inParams | Parameters for page encoding. This can be NULL and then the default parameters are used.The parameters can be overwritten lately by explict parameter to each addPage call. |
inHelper | Optional parameter to specify encoder helper. |
|
static |
Initialize a new DjVuEncoder instance.
inParams | Parameters for page encoding. The parameters can be overwritten lately by explict parameter to each addPage call. |
inHelper | Optional parameter to specify encoder helper. |
|
static |
Initialize a new DjVuEncoder instance.
inProfile | Pointer to a Profile instance with which DjVuEncoder instance will be initialized. |
inHelper | Optional parameter to specify encoder helper. |
|
pure virtual |
This method finalizes the current encoding session.\n If the encoding uses dictionary, the dictionary is finalized on this call.\n This method can be called any times. This method always returns the pages encoded by any previous encoding sessions.\n If you want to reset all the queued pages, call \ref reset.
inCallback | Callback function called during optimizing JB2 shapes. |
inContext | Context for the callback. |
|
pure virtual |
This method returns the number of pages which is already encoded.
|
pure virtual |
This method returns the number of pages which is queued by addPage and still in the encoder queue.
|
pure virtual |
Reset all the internal status.
All the pages encoded is purged.
|
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. finalizeSession function should be called after all the threads (addPage call) finished.
Please note that auto-dict-flush is disabled for parallel conversion and you should explicitly call finalizeSession function after the conversion.
inPagesInParallel | How many pages are encoded in parallel using threads. |