filters

JBIG2Stream.h

00001 //========================================================================
00002 //
00003 // JBIG2Stream.h
00004 //
00005 // Copyright 2002 Glyph & Cog, LLC
00006 //
00007 //========================================================================
00008 
00009 #ifndef JBIG2STREAM_H
00010 #define JBIG2STREAM_H
00011 
00012 #include <aconf.h>
00013 
00014 #ifdef USE_GCC_PRAGMAS
00015 #pragma interface
00016 #endif
00017 
00018 #include "gtypes.h"
00019 #include "Object.h"
00020 #include "Stream.h"
00021 
00022 class GList;
00023 class JBIG2Segment;
00024 class JBIG2Bitmap;
00025 class JBIG2ArithmeticDecoder;
00026 class JBIG2ArithmeticDecoderStats;
00027 class JBIG2HuffmanDecoder;
00028 struct JBIG2HuffmanTable;
00029 class JBIG2MMRDecoder;
00030 
00031 //------------------------------------------------------------------------
00032 
00033 class JBIG2Stream: public FilterStream {
00034 public:
00035 
00036   JBIG2Stream(Stream *strA, Object *globalsStream);
00037   virtual ~JBIG2Stream();
00038   virtual StreamKind getKind() { return strJBIG2; }
00039   virtual void reset();
00040   virtual int getChar();
00041   virtual int lookChar();
00042   virtual GString *getPSFilter(const char *indent);
00043   virtual GBool isBinary(GBool last = gTrue);
00044 
00045 private:
00046 
00047   void readSegments();
00048   void readSymbolDictSeg(Guint segNum, Guint length,
00049              Guint *refSegs, Guint nRefSegs);
00050   void readTextRegionSeg(Guint segNum, GBool imm,
00051              GBool lossless, Guint length,
00052              Guint *refSegs, Guint nRefSegs);
00053   JBIG2Bitmap *readTextRegion(GBool huff, GBool refine,
00054                   int w, int h,
00055                   Guint numInstances,
00056                   Guint logStrips,
00057                   int numSyms,
00058                   JBIG2HuffmanTable *symCodeTab,
00059                   Guint symCodeLen,
00060                   JBIG2Bitmap **syms,
00061                   Guint defPixel, Guint combOp,
00062                   Guint transposed, Guint refCorner,
00063                   Guint sOffset,
00064                   JBIG2HuffmanTable *huffFSTable,
00065                   JBIG2HuffmanTable *huffDSTable,
00066                   JBIG2HuffmanTable *huffDTTable,
00067                   JBIG2HuffmanTable *huffRDWTable,
00068                   JBIG2HuffmanTable *huffRDHTable,
00069                   JBIG2HuffmanTable *huffRDXTable,
00070                   JBIG2HuffmanTable *huffRDYTable,
00071                   JBIG2HuffmanTable *huffRSizeTable,
00072                   Guint templ,
00073                   int *atx, int *aty);
00074   void readPatternDictSeg(Guint segNum, Guint length);
00075   void readHalftoneRegionSeg(Guint segNum, GBool imm,
00076                  GBool lossless, Guint length,
00077                  Guint *refSegs, Guint nRefSegs);
00078   void readGenericRegionSeg(Guint segNum, GBool imm,
00079                 GBool lossless, Guint length);
00080   JBIG2Bitmap *readGenericBitmap(GBool mmr, int w, int h,
00081                  int templ, GBool tpgdOn,
00082                  GBool useSkip, JBIG2Bitmap *skip,
00083                  int *atx, int *aty,
00084                  int mmrDataLength);
00085   void readGenericRefinementRegionSeg(Guint segNum, GBool imm,
00086                       GBool lossless, Guint length,
00087                       Guint *refSegs,
00088                       Guint nRefSegs);
00089   JBIG2Bitmap *readGenericRefinementRegion(int w, int h,
00090                        int templ, GBool tpgrOn,
00091                        JBIG2Bitmap *refBitmap,
00092                        int refDX, int refDY,
00093                        int *atx, int *aty);
00094   void readPageInfoSeg(Guint length);
00095   void readEndOfStripeSeg(Guint length);
00096   void readProfilesSeg(Guint length);
00097   void readCodeTableSeg(Guint segNum, Guint length);
00098   void readExtensionSeg(Guint length);
00099   JBIG2Segment *findSegment(Guint segNum);
00100   void discardSegment(Guint segNum);
00101   void resetGenericStats(Guint templ,
00102                    JBIG2ArithmeticDecoderStats *prevStats);
00103   void resetRefinementStats(Guint templ,
00104                       JBIG2ArithmeticDecoderStats *prevStats);
00105   void resetIntStats(int symCodeLen);
00106   GBool readUByte(Guint *x);
00107   GBool readByte(int *x);
00108   GBool readUWord(Guint *x);
00109   GBool readULong(Guint *x);
00110   GBool readLong(int *x);
00111 
00112   Guint pageW, pageH, curPageH;
00113   Guint pageDefPixel;
00114   JBIG2Bitmap *pageBitmap;
00115   Guint defCombOp;
00116   GList *segments;      // [JBIG2Segment]
00117   GList *globalSegments;    // [JBIG2Segment]
00118   Stream *curStr;
00119   Guchar *dataPtr;
00120   Guchar *dataEnd;
00121 
00122   JBIG2ArithmeticDecoder *arithDecoder;
00123   JBIG2ArithmeticDecoderStats *genericRegionStats;
00124   JBIG2ArithmeticDecoderStats *refinementRegionStats;
00125   JBIG2ArithmeticDecoderStats *iadhStats;
00126   JBIG2ArithmeticDecoderStats *iadwStats;
00127   JBIG2ArithmeticDecoderStats *iaexStats;
00128   JBIG2ArithmeticDecoderStats *iaaiStats;
00129   JBIG2ArithmeticDecoderStats *iadtStats;
00130   JBIG2ArithmeticDecoderStats *iaitStats;
00131   JBIG2ArithmeticDecoderStats *iafsStats;
00132   JBIG2ArithmeticDecoderStats *iadsStats;
00133   JBIG2ArithmeticDecoderStats *iardxStats;
00134   JBIG2ArithmeticDecoderStats *iardyStats;
00135   JBIG2ArithmeticDecoderStats *iardwStats;
00136   JBIG2ArithmeticDecoderStats *iardhStats;
00137   JBIG2ArithmeticDecoderStats *iariStats;
00138   JBIG2ArithmeticDecoderStats *iaidStats;
00139   JBIG2HuffmanDecoder *huffDecoder;
00140   JBIG2MMRDecoder *mmrDecoder;
00141 };
00142 
00143 #endif
KDE Home | KDE Accessibility Home | Description of Access Keys