Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- enum JBIG2SegmentType
- {
- jbig2SegBitmap,
- jbig2SegSymbolDict,
- jbig2SegPatternDict,
- jbig2SegCodeTable
- };
- ////ACID: refSegs, nRefSegs
- void JBIG2Stream::readTextRegionSeg(unsigned int segNum, bool imm, bool lossless, unsigned int length, unsigned int *refSegs, unsigned int nRefSegs)
- {
- JBIG2Segment *seg;
- std::vector codeTables;
- JBIG2SymbolDict *symbolDict;
- JBIG2Bitmap **syms;
- unsigned int huff;
- unsigned int numSyms, symCodeLen;
- unsigned int i, k, kk;
- // ...
- // get symbol dictionaries and tables
- numSyms = 0;
- for (i = 0; i < nRefSegs; ++i) {
- if ((seg = findSegment(refSegs[i]))) {
- if (seg->getType() == jbig2SegSymbolDict) {
- numSyms += ((JBIG2SymbolDict *)seg)->getSize();
- } else if (seg->getType() == jbig2SegCodeTable) {
- codeTables.push_back(seg);
- }
- } else {
- error(errSyntaxError, curStr->getPos(), "Invalid segment reference in JBIG2 text region");
- return;
- }
- }
- // ...
- // get the symbol bitmaps
- syms = (JBIG2Bitmap **)gmallocn(numSyms, sizeof(JBIG2Bitmap *));
- if (numSyms > 0 && !syms) {
- return;
- }
- kk = 0;
- for (i = 0; i < nRefSegs; ++i) {
- if ((seg = findSegment(refSegs[i]))) {
- if (seg->getType() == jbig2SegSymbolDict) {
- symbolDict = (JBIG2SymbolDict *)seg;
- for (k = 0; k < symbolDict->getSize(); ++k) {
- syms[kk++] = symbolDict->getBitmap(k);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement