#include <djv_jb2encoder.h>

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< JB2Encoder > | create (const Params *inParams=NULL, bool inUseDictionary=true) |
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:
Sjbz Djbz Sjbz.FGbz | 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.
| 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.
| 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. |
| 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.
| 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.
| 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.
| inPagesInParallel | How many pages are encoded in parallel using threads. |