"Fossies" - the Fresh Open Source Software Archive 
Member "xpdf-4.04/xpdf/JBIG2Stream.h" (18 Apr 2022, 4824 Bytes) of package /linux/misc/xpdf-4.04.tar.gz:
As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style:
standard) with prefixed line numbers and
code folding option.
Alternatively you can here
view or
download the uninterpreted source code file.
For more information about "JBIG2Stream.h" see the
Fossies "Dox" file reference documentation and the latest
Fossies "Diffs" side-by-side code changes report:
4.03_vs_4.04.
1 //========================================================================
2 //
3 // JBIG2Stream.h
4 //
5 // Copyright 2002-2003 Glyph & Cog, LLC
6 //
7 //========================================================================
8
9 #ifndef JBIG2STREAM_H
10 #define JBIG2STREAM_H
11
12 #include <aconf.h>
13
14 #ifdef USE_GCC_PRAGMAS
15 #pragma interface
16 #endif
17
18 #include "gtypes.h"
19 #include "Object.h"
20 #include "Stream.h"
21
22 class GList;
23 class JBIG2Segment;
24 class JBIG2Bitmap;
25 class JArithmeticDecoder;
26 class JArithmeticDecoderStats;
27 class JBIG2HuffmanDecoder;
28 struct JBIG2HuffmanTable;
29 class JBIG2MMRDecoder;
30
31 //------------------------------------------------------------------------
32
33 class JBIG2Stream: public FilterStream {
34 public:
35
36 JBIG2Stream(Stream *strA, Object *globalsStreamA);
37 virtual ~JBIG2Stream();
38 virtual Stream *copy();
39 virtual StreamKind getKind() { return strJBIG2; }
40 virtual void reset();
41 virtual void close();
42 virtual int getChar();
43 virtual int lookChar();
44 virtual int getBlock(char *blk, int size);
45 virtual GString *getPSFilter(int psLevel, const char *indent,
46 GBool okToReadStream);
47 virtual GBool isBinary(GBool last = gTrue);
48
49 private:
50
51 void decodeImage();
52 void readSegments();
53 GBool readSymbolDictSeg(Guint segNum, Guint length,
54 Guint *refSegs, Guint nRefSegs);
55 void readTextRegionSeg(Guint segNum, GBool imm,
56 GBool lossless, Guint length,
57 Guint *refSegs, Guint nRefSegs);
58 JBIG2Bitmap *readTextRegion(GBool huff, GBool refine,
59 int w, int h,
60 Guint numInstances,
61 Guint logStrips,
62 int numSyms,
63 JBIG2HuffmanTable *symCodeTab,
64 Guint symCodeLen,
65 JBIG2Bitmap **syms,
66 Guint defPixel, Guint combOp,
67 Guint transposed, Guint refCorner,
68 int sOffset,
69 JBIG2HuffmanTable *huffFSTable,
70 JBIG2HuffmanTable *huffDSTable,
71 JBIG2HuffmanTable *huffDTTable,
72 JBIG2HuffmanTable *huffRDWTable,
73 JBIG2HuffmanTable *huffRDHTable,
74 JBIG2HuffmanTable *huffRDXTable,
75 JBIG2HuffmanTable *huffRDYTable,
76 JBIG2HuffmanTable *huffRSizeTable,
77 Guint templ,
78 int *atx, int *aty);
79 void readPatternDictSeg(Guint segNum, Guint length);
80 void readHalftoneRegionSeg(Guint segNum, GBool imm,
81 GBool lossless, Guint length,
82 Guint *refSegs, Guint nRefSegs);
83 void readGenericRegionSeg(Guint segNum, GBool imm,
84 GBool lossless, Guint length);
85 void mmrAddPixels(int a1, int blackPixels,
86 int *codingLine, int *a0i, int w);
87 void mmrAddPixelsNeg(int a1, int blackPixels,
88 int *codingLine, int *a0i, int w);
89 JBIG2Bitmap *readGenericBitmap(GBool mmr, int w, int h,
90 int templ, GBool tpgdOn,
91 GBool useSkip, JBIG2Bitmap *skip,
92 int *atx, int *aty,
93 int mmrDataLength);
94 void readGenericRefinementRegionSeg(Guint segNum, GBool imm,
95 GBool lossless, Guint length,
96 Guint *refSegs,
97 Guint nRefSegs);
98 JBIG2Bitmap *readGenericRefinementRegion(int w, int h,
99 int templ, GBool tpgrOn,
100 JBIG2Bitmap *refBitmap,
101 int refDX, int refDY,
102 int *atx, int *aty);
103 void readPageInfoSeg(Guint length);
104 void readEndOfStripeSeg(Guint length);
105 void readProfilesSeg(Guint length);
106 void readCodeTableSeg(Guint segNum, Guint length);
107 void readExtensionSeg(Guint length);
108 JBIG2Segment *findSegment(Guint segNum);
109 void discardSegment(Guint segNum);
110 void resetGenericStats(Guint templ,
111 JArithmeticDecoderStats *prevStats);
112 void resetRefinementStats(Guint templ,
113 JArithmeticDecoderStats *prevStats);
114 void resetIntStats(int symCodeLen);
115 GBool readUByte(Guint *x);
116 GBool readByte(int *x);
117 GBool readUWord(Guint *x);
118 GBool readULong(Guint *x);
119 GBool readLong(int *x);
120
121 GBool decoded;
122 Object globalsStream;
123 Guint pageW, pageH, curPageH;
124 Guint pageDefPixel;
125 JBIG2Bitmap *pageBitmap;
126 Guint defCombOp;
127 GList *segments; // [JBIG2Segment]
128 GList *globalSegments; // [JBIG2Segment]
129 Stream *curStr;
130 Guchar *dataPtr;
131 Guchar *dataEnd;
132 Guint byteCounter;
133 GBool done;
134
135 JArithmeticDecoder *arithDecoder;
136 JArithmeticDecoderStats *genericRegionStats;
137 JArithmeticDecoderStats *refinementRegionStats;
138 JArithmeticDecoderStats *iadhStats;
139 JArithmeticDecoderStats *iadwStats;
140 JArithmeticDecoderStats *iaexStats;
141 JArithmeticDecoderStats *iaaiStats;
142 JArithmeticDecoderStats *iadtStats;
143 JArithmeticDecoderStats *iaitStats;
144 JArithmeticDecoderStats *iafsStats;
145 JArithmeticDecoderStats *iadsStats;
146 JArithmeticDecoderStats *iardxStats;
147 JArithmeticDecoderStats *iardyStats;
148 JArithmeticDecoderStats *iardwStats;
149 JArithmeticDecoderStats *iardhStats;
150 JArithmeticDecoderStats *iariStats;
151 JArithmeticDecoderStats *iaidStats;
152 JBIG2HuffmanDecoder *huffDecoder;
153 JBIG2MMRDecoder *mmrDecoder;
154 };
155
156 #endif