Back to index

tetex-bin  3.0
Public Member Functions | Private Attributes
JBIG2MMRDecoder Class Reference
Collaboration diagram for JBIG2MMRDecoder:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 JBIG2MMRDecoder ()
 ~JBIG2MMRDecoder ()
void setStream (Stream *strA)
void reset ()
int get2DCode ()
int getBlackCode ()
int getWhiteCode ()
Guint get24Bits ()
void skipTo (Guint length)

Private Attributes

Streamstr
Guint buf
Guint bufLen
Guint nBytesRead

Detailed Description

Definition at line 437 of file JBIG2Stream.cc.


Constructor & Destructor Documentation

Definition at line 458 of file JBIG2Stream.cc.

                                 {
  str = NULL;
  reset();
}

Here is the call graph for this function:

Definition at line 463 of file JBIG2Stream.cc.

                                  {
}

Member Function Documentation

Definition at line 592 of file JBIG2Stream.cc.

                                 {
  while (bufLen < 24) {
    buf = (buf << 8) | (str->getChar() & 0xff);
    bufLen += 8;
    ++nBytesRead;
  }
  return (buf >> (bufLen - 24)) & 0xffffff;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 472 of file JBIG2Stream.cc.

                               {
  CCITTCode *p;

  if (bufLen == 0) {
    buf = str->getChar() & 0xff;
    bufLen = 8;
    ++nBytesRead;
    p = &twoDimTab1[(buf >> 1) & 0x7f];
  } else if (bufLen == 8) {
    p = &twoDimTab1[(buf >> 1) & 0x7f];
  } else {
    p = &twoDimTab1[(buf << (7 - bufLen)) & 0x7f];
    if (p->bits < 0 || p->bits > (int)bufLen) {
      buf = (buf << 8) | (str->getChar() & 0xff);
      bufLen += 8;
      ++nBytesRead;
      p = &twoDimTab1[(buf >> (bufLen - 7)) & 0x7f];
    }
  }
  if (p->bits < 0) {
    error(str->getPos(), "Bad two dim code in JBIG2 MMR stream");
    return 0;
  }
  bufLen -= p->bits;
  return p->n;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 542 of file JBIG2Stream.cc.

                                  {
  CCITTCode *p;
  Guint code;

  if (bufLen == 0) {
    buf = str->getChar() & 0xff;
    bufLen = 8;
    ++nBytesRead;
  }
  while (1) {
    if (bufLen >= 6 && ((buf >> (bufLen - 6)) & 0x3f) == 0) {
      if (bufLen <= 13) {
       code = buf << (13 - bufLen);
      } else {
       code = buf >> (bufLen - 13);
      }
      p = &blackTab1[code & 0x7f];
    } else if (bufLen >= 4 && ((buf >> (bufLen - 4)) & 0x0f) == 0) {
      if (bufLen <= 12) {
       code = buf << (12 - bufLen);
      } else {
       code = buf >> (bufLen - 12);
      }
      p = &blackTab2[(code & 0xff) - 64];
    } else {
      if (bufLen <= 6) {
       code = buf << (6 - bufLen);
      } else {
       code = buf >> (bufLen - 6);
      }
      p = &blackTab3[code & 0x3f];
    }
    if (p->bits > 0 && p->bits <= (int)bufLen) {
      bufLen -= p->bits;
      return p->n;
    }
    if (bufLen >= 13) {
      break;
    }
    buf = (buf << 8) | (str->getChar() & 0xff);
    bufLen += 8;
    ++nBytesRead;
  }
  error(str->getPos(), "Bad black code in JBIG2 MMR stream");
  // eat a bit and return a positive number so that the caller doesn't
  // go into an infinite loop
  --bufLen;
  return 1;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 499 of file JBIG2Stream.cc.

                                  {
  CCITTCode *p;
  Guint code;

  if (bufLen == 0) {
    buf = str->getChar() & 0xff;
    bufLen = 8;
    ++nBytesRead;
  }
  while (1) {
    if (bufLen >= 7 && ((buf >> (bufLen - 7)) & 0x7f) == 0) {
      if (bufLen <= 12) {
       code = buf << (12 - bufLen);
      } else {
       code = buf >> (bufLen - 12);
      }
      p = &whiteTab1[code & 0x1f];
    } else {
      if (bufLen <= 9) {
       code = buf << (9 - bufLen);
      } else {
       code = buf >> (bufLen - 9);
      }
      p = &whiteTab2[code & 0x1ff];
    }
    if (p->bits > 0 && p->bits <= (int)bufLen) {
      bufLen -= p->bits;
      return p->n;
    }
    if (bufLen >= 12) {
      break;
    }
    buf = (buf << 8) | (str->getChar() & 0xff);
    bufLen += 8;
    ++nBytesRead;
  }
  error(str->getPos(), "Bad white code in JBIG2 MMR stream");
  // eat a bit and return a positive number so that the caller doesn't
  // go into an infinite loop
  --bufLen;
  return 1;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 466 of file JBIG2Stream.cc.

                            {
  buf = 0;
  bufLen = 0;
  nBytesRead = 0;
}

Here is the caller graph for this function:

void JBIG2MMRDecoder::setStream ( Stream strA) [inline]

Definition at line 442 of file JBIG2Stream.cc.

{ str = strA; }

Here is the caller graph for this function:

Definition at line 601 of file JBIG2Stream.cc.

                                         {
  while (nBytesRead < length) {
    str->getChar();
    ++nBytesRead;
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

Definition at line 453 of file JBIG2Stream.cc.

Definition at line 454 of file JBIG2Stream.cc.

Definition at line 455 of file JBIG2Stream.cc.

Definition at line 452 of file JBIG2Stream.cc.


The documentation for this class was generated from the following file: