#include <djv_iw44encoder.h>
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< Chunk > | encodeIW44Chunk ()=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< IW44Encoder > | create (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 () |
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.
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.
inIW44Encoder | The instance of IW44Encoder. |
inChunkIndex | The index of the current chunk beeing encoded. The index of the first chunk is 0. |
inSlicesInChunk | The number of slices already encoded in the current chunk. It starts with 1. |
inBytesInChunk | The size of the data already encoded in the current chunk. |
inContext | The pointer to user defined context data. |
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.
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. |
|
pure virtual |
Calculates MSE (Mean Squared Error) of wavelet coefficients at a point in encoding process. Wavelet coefficients can be from -128 to 127.
|
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.
inImagePtr | The pointer to the first line in the RAW data. |
inRowStride | The row-stride of the RAW data. |
inImagePm | The photometric of srouce image. This is one of the Photometric enumeration values. |
inWidth | The width of the image. |
inHeight | The height of the image. |
inParams | The parameters to configure IW44 encoding. |
|
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.
The output of this function doesn't contain IFF header. You should use Chunk class to output any IFF related structures.
inStream | The stream to write on. |
outSizeWritten | The number of bytes written by this call. It can be NULL . |
Encode the instance to the DjVu's **44
chunk.
**44
data. It may be NULL
if no more chunks to encode.