diff options
author | Martin Kretzschmar <mkretzschmar@src.gnome.org> | 2003-03-31 21:08:43 (GMT) |
---|---|---|
committer | Martin Kretzschmar <mkretzschmar@src.gnome.org> | 2003-03-31 21:08:43 (GMT) |
commit | 64676031423465996e83c4a685290f0c3d97a249 (patch) | |
tree | cef578bc8c300722abb3fe1693181e68895a94a7 /pdf/xpdf/Stream.h | |
parent | 28c37dbcf87665a4ccec58bef9ef8ff0697022dd (diff) |
kill traces of ltk, incorporate new sources
* xpdf/Makefile.am: kill traces of ltk, incorporate new sources
* Makefile.am, configure.in: don't build the ltk subdir
* ANNOUNCE, CHANGES, ChangeLog, README, aconf-dj.h, aconf-win32.h,
dj_make.bat, ms_make.bat, vms_make.com: update
* xpdf/LTKOutputDev.cc, xpdf/LTKOutputDev.h, xpdf/postscript.xbm,
xpdf/xpdf-flip.ltk, xpdf/xpdf-ltk.h, xpdf/xpdf-top.ltk,
xpdf/xpdf.ltk: remove.
* xpdf/Annot.cc, xpdf/Annot.h, xpdf/Array.cc, xpdf/Array.h,
xpdf/BuiltinFont.cc, xpdf/BuiltinFont.h,
xpdf/BuiltinFontTables.cc, xpdf/CMap.cc, xpdf/CMap.h,
xpdf/Catalog.cc, xpdf/Catalog.h, xpdf/CharCodeToUnicode.cc,
xpdf/CharCodeToUnicode.h, xpdf/Decrypt.cc, xpdf/Decrypt.h,
xpdf/Dict.cc, xpdf/Dict.h, xpdf/Error.cc, xpdf/Error.h,
xpdf/FTFont.cc, xpdf/FTFont.h, xpdf/FontFile.cc, xpdf/FontFile.h,
xpdf/Function.cc, xpdf/Function.h, xpdf/Gfx.cc, xpdf/Gfx.h,
xpdf/GfxFont.cc, xpdf/GfxFont.h, xpdf/GfxState.cc,
xpdf/GfxState.h, xpdf/GlobalParams.cc, xpdf/GlobalParams.h,
xpdf/ImageOutputDev.cc, xpdf/ImageOutputDev.h, xpdf/Lexer.cc,
xpdf/Lexer.h, xpdf/Link.cc, xpdf/Link.h, xpdf/NameToCharCode.cc,
xpdf/NameToCharCode.h, xpdf/NameToUnicodeTable.h, xpdf/Object.cc,
xpdf/Object.h, xpdf/OutputDev.cc, xpdf/OutputDev.h,
xpdf/PBMOutputDev.cc, xpdf/PBMOutputDev.h, xpdf/PDFDoc.cc,
xpdf/PDFDoc.h, xpdf/PSOutputDev.cc, xpdf/PSOutputDev.h,
xpdf/PSTokenizer.cc, xpdf/PSTokenizer.h, xpdf/Page.cc,
xpdf/Page.h, xpdf/Parser.cc, xpdf/Parser.h, xpdf/SFont.cc,
xpdf/SFont.h, xpdf/Stream.cc, xpdf/Stream.h, xpdf/T1Font.cc,
xpdf/T1Font.h, xpdf/TTFont.cc, xpdf/TTFont.h,
xpdf/TextOutputDev.cc, xpdf/TextOutputDev.h, xpdf/UnicodeMap.cc,
xpdf/UnicodeMap.h, xpdf/XOutputDev.cc, xpdf/XOutputDev.h,
xpdf/XRef.cc, xpdf/XRef.h, xpdf/config.h, xpdf/pdffonts.cc,
xpdf/pdfimages.cc, xpdf/pdfinfo.cc, xpdf/pdftopbm.cc,
xpdf/pdftops.cc, xpdf/pdftotext.cc, xpdf/vms_make.com,
xpdf/xpdf.cc: update.
* goo/GHash.cc, goo/GHash.h, goo/GList.cc, goo/GList.h,
goo/GString.cc, goo/GString.h: mostly Mac OS X gcc fixage.
* doc/pdffonts.1, doc/pdffonts.cat, doc/pdffonts.hlp,
doc/pdfimages.1, doc/pdfimages.cat, doc/pdfimages.hlp,
doc/pdfinfo.1, doc/pdfinfo.cat, doc/pdfinfo.hlp, doc/pdftopbm.1,
doc/pdftopbm.cat, doc/pdftopbm.hlp, doc/pdftops.1,
doc/pdftops.cat, doc/pdftops.hlp, doc/pdftotext.1,
doc/pdftotext.cat, doc/pdftotext.hlp, doc/xpdf.1, doc/xpdf.cat,
doc/xpdf.hlp, doc/xpdfrc.5, doc/xpdfrc.cat, doc/xpdfrc.hlp:
update docs.
Diffstat (limited to 'pdf/xpdf/Stream.h')
-rw-r--r-- | pdf/xpdf/Stream.h | 86 |
1 files changed, 61 insertions, 25 deletions
diff --git a/pdf/xpdf/Stream.h b/pdf/xpdf/Stream.h index 3319dcc..b0a0c26 100644 --- a/pdf/xpdf/Stream.h +++ b/pdf/xpdf/Stream.h @@ -9,7 +9,9 @@ #ifndef STREAM_H #define STREAM_H -#ifdef __GNUC__ +#include <aconf.h> + +#ifdef USE_GCC_PRAGMAS #pragma interface #endif @@ -33,6 +35,7 @@ enum StreamKind { strCCITTFax, strDCT, strFlate, + strJBIG2, strWeird // internal-use stream types }; @@ -190,6 +193,10 @@ public: // at least nComps elements. Returns false at end of file. GBool getPixel(Guchar *pix); + // Returns a pointer to the next line of pixels. Returns NULL at + // end of file. + Guchar *getLine(); + // Skip an entire line from the image. void skipLine(); @@ -419,18 +426,26 @@ private: StreamPredictor *pred; // predictor int early; // early parameter - FILE *zPipe; // uncompress pipe - GString *zName; // .Z file name + GBool eof; // true if at eof int inputBuf; // input buffer int inputBits; // number of bits in input buffer - int inCodeBits; // size of input code - char buf[256]; // buffer - char *bufPtr; // next char to read - char *bufEnd; // end of buffer - - void dumpFile(FILE *f); + struct { // decoding table + int length; + int head; + Guchar tail; + } table[4097]; + int nextCode; // next code to be used + int nextBits; // number of bits in next code word + int prevCode; // previous code used in stream + int newChar; // next char to be added to table + Guchar seqBuf[4097]; // buffer for current sequence + int seqLength; // length of current sequence + int seqIndex; // index into current sequence + GBool first; // first code after a table clear + + GBool processNextCode(); + void clearTable(); int getCode(); - GBool fillBuf(); }; //------------------------------------------------------------------------ @@ -517,13 +532,21 @@ private: // DCT component info struct DCTCompInfo { int id; // component ID - GBool inScan; // is this component in the current scan? int hSample, vSample; // horiz/vert sampling resolutions int quantTable; // quantization table number - int dcHuffTable, acHuffTable; // Huffman table numbers int prevDC; // DC coefficient accumulator }; +struct DCTScanInfo { + GBool comp[4]; // comp[i] is set if component i is + // included in this scan + int numComps; // number of components in the scan + int dcHuffTable[4]; // DC Huffman table numbers + int acHuffTable[4]; // AC Huffman table numbers + int firstCoeff, lastCoeff; // first and last DCT coefficient + int ah, al; // successive approximation parameters +}; + // DCT Huffman decoding table struct DCTHuffTable { Guchar firstSym[17]; // first symbol for this bit length @@ -547,9 +570,13 @@ public: private: + GBool progressive; // set if in progressive mode + GBool interleaved; // set if in interleaved mode int width, height; // image size int mcuWidth, mcuHeight; // size of min coding unit, in data units + int bufWidth, bufHeight; // frameBuf size DCTCompInfo compInfo[4]; // info for each component + DCTScanInfo scanInfo; // info for the current scan int numComps; // number of components in image int colorXform; // need YCbCr-to-RGB transform? GBool gotAdobeMarker; // set if APP14 Adobe marker was present @@ -560,22 +587,33 @@ private: DCTHuffTable acHuffTables[4]; // AC Huffman tables int numDCHuffTables; // number of DC Huffman tables int numACHuffTables; // number of AC Huffman tables - Guchar *rowBuf[4][32]; // buffer for one MCU + Guchar *rowBuf[4][32]; // buffer for one MCU (non-progressive mode) + int *frameBuf[4]; // buffer for frame (progressive mode) int comp, x, y, dy; // current position within image/MCU int restartCtr; // MCUs left until restart int restartMarker; // next restart marker + int eobRun; // number of EOBs left in the current run int inputBuf; // input buffer for variable length codes int inputBits; // number of valid bits in input buffer void restart(); GBool readMCURow(); - GBool readDataUnit(DCTHuffTable *dcHuffTable, DCTHuffTable *acHuffTable, - Guchar quantTable[64], int *prevDC, Guchar data[64]); + void readScan(); + GBool readDataUnit(DCTHuffTable *dcHuffTable, + DCTHuffTable *acHuffTable, + int *prevDC, int data[64]); + GBool readProgressiveDataUnit(DCTHuffTable *dcHuffTable, + DCTHuffTable *acHuffTable, + int *prevDC, int data[64]); + void decodeImage(); + void transformDataUnit(Guchar *quantTable, + int dataIn[64], Guchar dataOut[64]); int readHuffSym(DCTHuffTable *table); int readAmp(int size); int readBit(); GBool readHeader(); - GBool readFrameInfo(); + GBool readBaselineSOF(); + GBool readProgressiveSOF(); GBool readScanInfo(); GBool readQuantTables(); GBool readHuffmanTables(); @@ -599,15 +637,13 @@ private: // Huffman code table entry struct FlateCode { - int len; // code length in bits - int code; // code word - int val; // value represented by this code + Gushort len; // code length, in bits + Gushort val; // value represented by this code }; -// Huffman code table struct FlateHuffmanTab { - int start[flateMaxHuffman+2]; // indexes of first code of each length - FlateCode *codes; // codes, sorted by length and code word + FlateCode *codes; + int maxLen; }; // Decoding info for length and distance code words @@ -638,8 +674,8 @@ private: int remain; // number valid bytes in output buffer int codeBuf; // input buffer int codeSize; // number of bits in input buffer - FlateCode // literal and distance codes - allCodes[flateMaxLitCodes + flateMaxDistCodes]; + int // literal and distance code lengths + codeLengths[flateMaxLitCodes + flateMaxDistCodes]; FlateHuffmanTab litCodeTab; // literal code table FlateHuffmanTab distCodeTab; // distance code table GBool compressedBlock; // set if reading a compressed block @@ -658,7 +694,7 @@ private: GBool startBlock(); void loadFixedCodes(); GBool readDynamicCodes(); - void compHuffmanCodes(FlateHuffmanTab *tab, int n); + void compHuffmanCodes(int *lengths, int n, FlateHuffmanTab *tab); int getHuffmanCodeWord(FlateHuffmanTab *tab); int getCodeWord(int bits); }; |