kviewshell
MMRDecoder.h File Reference
#include "GSmartPointer.h"
Go to the source code of this file.
Classes | |
class | MMRDecoder |
Class for G4/MMR decoding. More... | |
Defines | |
MMRDecoder.h | |
Files #"MMRDecoder.h"# and #"MMRDecoder.cpp"# implement a CCITT-G4/MMR decoder suitable for use in DjVu. The main entry point is function {MMRDecoder::decode}. The foreground mask layer of a DjVu file is usually encoded with a #"Sjbz"# chunk containing JB2 encoded data (cf. {JB2Image.h}). Alternatively, the qmask layer may be encoded with a #"Smmr"# chunk containing a small header followed by MMR encoded data. This encoding scheme produces significantly larger files. On the other hand, many scanners a printers talk MMR using very efficient hardware components. This is the reason behind the introduction of #"Smmr"# chunks. The Smmr# chunk starts by a header containing the following data: {verbatim} BYTE*3 : 'M' 'M' 'R' BYTE : 0xb000000<s> INT16 : <width> (MSB first) INT16 : <height> (MSB first) {verbatim} The header is followed by the encoded data. Bit 0 of the fourth header byte (##) is similar to TIFF's ``min-is-black'' tag. This bit is set for a reverse video image. The encoded data can be in either ``regular'' MMR form or ``striped'' MMR form. This is indicated by bit 1 of the fourth header byte (#<s>#). This bit is set to indicate ``striped'' data. The ``regular'' data format consists of ordinary MMR encoded data. The ``striped'' data format consists of one sixteen bit integer (msb first) containing the number of rows per stripe, followed by data for each stripe as follows. {verbatim} INT16 : <rowsperstripe> (MSB first) INT32 : <nbytes1> BYTE*<nbytes1> : <mmrdata1> INT32 : <nbytes2> BYTE*<nbytes2> : <mmrdata2> ... {verbatim} Static function {MMRDecoder::decode_header} decodes the header. You can then create a {MMRDecoder} object with the flags inverted# and striped# as obtained when decoding the header. One can also decode raw MMR data by simply initialising a {MMRDecoder} object with flag striped# unset. Each call to {MMRDecoder::scanruns}, {MMRDecoder::scanrle} or {MMRDecoder::scanline} will then decode a row of the MMR encoded image. Function {MMRDecoder::decode} is a convenience function for decoding the contents of a #"Smmr"# chunk. It returns a {JB2Image} divided into manageable blocks in order to provide the zooming and panning features implemented by class {JB2Image}.
CCITT-G4/MMR decoder. | |
#define | MMRDECODER_HAS_SCANRLE 1 |
#define | MMRDECODER_HAS_SCANRUNS 1 |
Define Documentation
#define MMRDECODER_HAS_SCANRLE 1 |
Definition at line 143 of file MMRDecoder.h.
#define MMRDECODER_HAS_SCANRUNS 1 |
Definition at line 142 of file MMRDecoder.h.