Back to index

tetex-bin  3.0
Public Member Functions | Protected Attributes | Private Member Functions | Private Attributes
DCTStream Class Reference

#include <Stream.h>

Inheritance diagram for DCTStream:
Inheritance graph
[legend]
Collaboration diagram for DCTStream:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 DCTStream (Stream *strA)
virtual ~DCTStream ()
virtual StreamKind getKind ()
virtual void reset ()
virtual int getChar ()
virtual int lookChar ()
virtual GStringgetPSFilter (int psLevel, char *indent)
virtual GBool isBinary (GBool last=gTrue)
StreamgetRawStream ()
virtual void close ()
virtual int getPos ()
virtual void setPos (Guint pos, int dir=0)
virtual BaseStreamgetBaseStream ()
virtual DictgetDict ()
virtual void ignoreLength ()
int incRef ()
int decRef ()
virtual int getRawChar ()
virtual char * getLine (char *buf, int size)
virtual GBool isEncoder ()
StreamaddFilters (Object *dict)

Protected Attributes

Streamstr

Private Member Functions

void restart ()
GBool readMCURow ()
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 readBaselineSOF ()
GBool readProgressiveSOF ()
GBool readScanInfo ()
GBool readQuantTables ()
GBool readHuffmanTables ()
GBool readRestartInterval ()
GBool readJFIFMarker ()
GBool readAdobeMarker ()
GBool readTrailer ()
int readMarker ()
int read16 ()

Private Attributes

GBool progressive
GBool interleaved
int width
int height
int mcuWidth
int mcuHeight
int bufWidth
int bufHeight
DCTCompInfo compInfo [4]
DCTScanInfo scanInfo
int numComps
int colorXform
GBool gotJFIFMarker
GBool gotAdobeMarker
int restartInterval
Guchar quantTables [4][64]
int numQuantTables
DCTHuffTable dcHuffTables [4]
DCTHuffTable acHuffTables [4]
int numDCHuffTables
int numACHuffTables
GucharrowBuf [4][32]
intframeBuf [4]
int comp
int x
int y
int dy
int restartCtr
int restartMarker
int eobRun
int inputBuf
int inputBits

Detailed Description

Definition at line 567 of file Stream.h.


Constructor & Destructor Documentation

Definition at line 1833 of file Stream.cc.

                                :
    FilterStream(strA) {
  int i, j;

  progressive = interleaved = gFalse;
  width = height = 0;
  mcuWidth = mcuHeight = 0;
  numComps = 0;
  comp = 0;
  x = y = dy = 0;
  for (i = 0; i < 4; ++i) {
    for (j = 0; j < 32; ++j) {
      rowBuf[i][j] = NULL;
    }
    frameBuf[i] = NULL;
  }

  if (!dctClipInit) {
    for (i = -256; i < 0; ++i)
      dctClip[dctClipOffset + i] = 0;
    for (i = 0; i < 256; ++i)
      dctClip[dctClipOffset + i] = i;
    for (i = 256; i < 512; ++i)
      dctClip[dctClipOffset + i] = 255;
    dctClipInit = 1;
  }
}
DCTStream::~DCTStream ( ) [virtual]

Definition at line 1861 of file Stream.cc.

                      {
  int i, j;

  delete str;
  if (progressive || !interleaved) {
    for (i = 0; i < numComps; ++i) {
      gfree(frameBuf[i]);
    }
  } else {
    for (i = 0; i < numComps; ++i) {
      for (j = 0; j < mcuHeight; ++j) {
       gfree(rowBuf[i][j]);
      }
    }
  }
}

Here is the call graph for this function:


Member Function Documentation

Stream * Stream::addFilters ( Object dict) [inherited]

Definition at line 92 of file Stream.cc.

                                       {
  Object obj, obj2;
  Object params, params2;
  Stream *str;
  int i;

  str = this;
  dict->dictLookup("Filter", &obj);
  if (obj.isNull()) {
    obj.free();
    dict->dictLookup("F", &obj);
  }
  dict->dictLookup("DecodeParms", &params);
  if (params.isNull()) {
    params.free();
    dict->dictLookup("DP", &params);
  }
  if (obj.isName()) {
    str = makeFilter(obj.getName(), str, &params);
  } else if (obj.isArray()) {
    for (i = 0; i < obj.arrayGetLength(); ++i) {
      obj.arrayGet(i, &obj2);
      if (params.isArray())
       params.arrayGet(i, &params2);
      else
       params2.initNull();
      if (obj2.isName()) {
       str = makeFilter(obj2.getName(), str, &params2);
      } else {
       error(getPos(), "Bad filter name");
       str = new EOFStream(str);
      }
      obj2.free();
      params2.free();
    }
  } else if (!obj.isNull()) {
    error(getPos(), "Bad 'Filter' attribute in stream");
  }
  obj.free();
  params.free();

  return str;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void FilterStream::close ( ) [virtual, inherited]

Reimplemented from Stream.

Definition at line 306 of file Stream.cc.

                         {
  str->close();
}

Here is the call graph for this function:

Definition at line 2453 of file Stream.cc.

                            {
  int dataIn[64];
  Guchar dataOut[64];
  Guchar *quantTable;
  int pY, pCb, pCr, pR, pG, pB;
  int x1, y1, x2, y2, x3, y3, x4, y4, x5, y5, cc, i;
  int h, v, horiz, vert, hSub, vSub;
  int *p0, *p1, *p2;

  for (y1 = 0; y1 < bufHeight; y1 += mcuHeight) {
    for (x1 = 0; x1 < bufWidth; x1 += mcuWidth) {
      for (cc = 0; cc < numComps; ++cc) {
       quantTable = quantTables[compInfo[cc].quantTable];
       h = compInfo[cc].hSample;
       v = compInfo[cc].vSample;
       horiz = mcuWidth / h;
       vert = mcuHeight / v;
       hSub = horiz / 8;
       vSub = vert / 8;
       for (y2 = 0; y2 < mcuHeight; y2 += vert) {
         for (x2 = 0; x2 < mcuWidth; x2 += horiz) {

           // pull out the coded data unit
           p1 = &frameBuf[cc][(y1+y2) * bufWidth + (x1+x2)];
           for (y3 = 0, i = 0; y3 < 8; ++y3, i += 8) {
             dataIn[i]   = p1[0];
             dataIn[i+1] = p1[1];
             dataIn[i+2] = p1[2];
             dataIn[i+3] = p1[3];
             dataIn[i+4] = p1[4];
             dataIn[i+5] = p1[5];
             dataIn[i+6] = p1[6];
             dataIn[i+7] = p1[7];
             p1 += bufWidth * vSub;
           }

           // transform
           transformDataUnit(quantTable, dataIn, dataOut);

           // store back into frameBuf, doing replication for
           // subsampled components
           p1 = &frameBuf[cc][(y1+y2) * bufWidth + (x1+x2)];
           if (hSub == 1 && vSub == 1) {
             for (y3 = 0, i = 0; y3 < 8; ++y3, i += 8) {
              p1[0] = dataOut[i] & 0xff;
              p1[1] = dataOut[i+1] & 0xff;
              p1[2] = dataOut[i+2] & 0xff;
              p1[3] = dataOut[i+3] & 0xff;
              p1[4] = dataOut[i+4] & 0xff;
              p1[5] = dataOut[i+5] & 0xff;
              p1[6] = dataOut[i+6] & 0xff;
              p1[7] = dataOut[i+7] & 0xff;
              p1 += bufWidth;
             }
           } else if (hSub == 2 && vSub == 2) {
             p2 = p1 + bufWidth;
             for (y3 = 0, i = 0; y3 < 16; y3 += 2, i += 8) {
              p1[0] = p1[1] = p2[0] = p2[1] = dataOut[i] & 0xff;
              p1[2] = p1[3] = p2[2] = p2[3] = dataOut[i+1] & 0xff;
              p1[4] = p1[5] = p2[4] = p2[5] = dataOut[i+2] & 0xff;
              p1[6] = p1[7] = p2[6] = p2[7] = dataOut[i+3] & 0xff;
              p1[8] = p1[9] = p2[8] = p2[9] = dataOut[i+4] & 0xff;
              p1[10] = p1[11] = p2[10] = p2[11] = dataOut[i+5] & 0xff;
              p1[12] = p1[13] = p2[12] = p2[13] = dataOut[i+6] & 0xff;
              p1[14] = p1[15] = p2[14] = p2[15] = dataOut[i+7] & 0xff;
              p1 += bufWidth * 2;
              p2 += bufWidth * 2;
             }
           } else {
             i = 0;
             for (y3 = 0, y4 = 0; y3 < 8; ++y3, y4 += vSub) {
              for (x3 = 0, x4 = 0; x3 < 8; ++x3, x4 += hSub) {
                p2 = p1 + x4;
                for (y5 = 0; y5 < vSub; ++y5) {
                  for (x5 = 0; x5 < hSub; ++x5) {
                    p2[x5] = dataOut[i] & 0xff;
                  }
                  p2 += bufWidth;
                }
                ++i;
              }
              p1 += bufWidth * vSub;
             }
           }
         }
       }
      }

      // color space conversion
      if (colorXform) {
       // convert YCbCr to RGB
       if (numComps == 3) {
         for (y2 = 0; y2 < mcuHeight; ++y2) {
           p0 = &frameBuf[0][(y1+y2) * bufWidth + x1];
           p1 = &frameBuf[1][(y1+y2) * bufWidth + x1];
           p2 = &frameBuf[2][(y1+y2) * bufWidth + x1];
           for (x2 = 0; x2 < mcuWidth; ++x2) {
             pY = *p0;
             pCb = *p1 - 128;
             pCr = *p2 - 128;
             pR = ((pY << 16) + dctCrToR * pCr + 32768) >> 16;
             *p0++ = dctClip[dctClipOffset + pR];
             pG = ((pY << 16) + dctCbToG * pCb + dctCrToG * pCr +
                  32768) >> 16;
             *p1++ = dctClip[dctClipOffset + pG];
             pB = ((pY << 16) + dctCbToB * pCb + 32768) >> 16;
             *p2++ = dctClip[dctClipOffset + pB];
           }
         }
       // convert YCbCrK to CMYK (K is passed through unchanged)
       } else if (numComps == 4) {
         for (y2 = 0; y2 < mcuHeight; ++y2) {
           p0 = &frameBuf[0][(y1+y2) * bufWidth + x1];
           p1 = &frameBuf[1][(y1+y2) * bufWidth + x1];
           p2 = &frameBuf[2][(y1+y2) * bufWidth + x1];
           for (x2 = 0; x2 < mcuWidth; ++x2) {
             pY = *p0;
             pCb = *p1 - 128;
             pCr = *p2 - 128;
             pR = ((pY << 16) + dctCrToR * pCr + 32768) >> 16;
             *p0++ = 255 - dctClip[dctClipOffset + pR];
             pG = ((pY << 16) + dctCbToG * pCb + dctCrToG * pCr +
                  32768) >> 16;
             *p1++ = 255 - dctClip[dctClipOffset + pG];
             pB = ((pY << 16) + dctCbToB * pCb + 32768) >> 16;
             *p2++ = 255 - dctClip[dctClipOffset + pB];
           }
         }
       }
      }
    }
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

int Stream::decRef ( ) [inline, inherited]

Definition at line 58 of file Stream.h.

{ return --ref; }
virtual BaseStream* FilterStream::getBaseStream ( ) [inline, virtual, inherited]

Implements Stream.

Definition at line 174 of file Stream.h.

{ return str->getBaseStream(); }

Here is the call graph for this function:

int DCTStream::getChar ( ) [virtual]

Implements Stream.

Definition at line 1978 of file Stream.cc.

                       {
  int c;

  if (y >= height) {
    return EOF;
  }
  if (progressive || !interleaved) {
    c = frameBuf[comp][y * bufWidth + x];
    if (++comp == numComps) {
      comp = 0;
      if (++x == width) {
       x = 0;
       ++y;
      }
    }
  } else {
    if (dy >= mcuHeight) {
      if (!readMCURow()) {
       y = height;
       return EOF;
      }
      comp = 0;
      x = 0;
      dy = 0;
    }
    c = rowBuf[comp][dy][x];
    if (++comp == numComps) {
      comp = 0;
      if (++x == width) {
       x = 0;
       ++y;
       ++dy;
       if (y == height) {
         readTrailer();
       }
      }
    }
  }
  return c;
}

Here is the call graph for this function:

virtual Dict* FilterStream::getDict ( ) [inline, virtual, inherited]

Implements Stream.

Definition at line 175 of file Stream.h.

{ return str->getDict(); }

Here is the call graph for this function:

virtual StreamKind DCTStream::getKind ( ) [inline, virtual]

Implements Stream.

Definition at line 572 of file Stream.h.

{ return strDCT; }
char * Stream::getLine ( char *  buf,
int  size 
) [virtual, inherited]

Definition at line 67 of file Stream.cc.

                                         {
  int i;
  int c;

  if (lookChar() == EOF)
    return NULL;
  for (i = 0; i < size - 1; ++i) {
    c = getChar();
    if (c == EOF || c == '\n')
      break;
    if (c == '\r') {
      if ((c = lookChar()) == '\n')
       getChar();
      break;
    }
    buf[i] = c;
  }
  buf[i] = '\0';
  return buf;
}

Here is the call graph for this function:

Here is the caller graph for this function:

virtual int FilterStream::getPos ( ) [inline, virtual, inherited]

Implements Stream.

Definition at line 172 of file Stream.h.

{ return str->getPos(); }

Here is the call graph for this function:

GString * DCTStream::getPSFilter ( int  psLevel,
char *  indent 
) [virtual]

Reimplemented from Stream.

Definition at line 3163 of file Stream.cc.

                                                         {
  GString *s;

  if (psLevel < 2) {
    return NULL;
  }
  if (!(s = str->getPSFilter(psLevel, indent))) {
    return NULL;
  }
  s->append(indent)->append("<< >> /DCTDecode filter\n");
  return s;
}

Here is the call graph for this function:

int Stream::getRawChar ( ) [virtual, inherited]

Reimplemented in FlateStream, and LZWStream.

Definition at line 62 of file Stream.cc.

                       {
  error(-1, "Internal: called getRawChar() on non-predictor stream");
  return EOF;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 578 of file Stream.h.

{ return str; }
virtual void FilterStream::ignoreLength ( ) [inline, virtual, inherited]

Reimplemented from Stream.

Definition at line 176 of file Stream.h.

{ str->ignoreLength(); }

Here is the call graph for this function:

int Stream::incRef ( ) [inline, inherited]

Definition at line 57 of file Stream.h.

{ return ++ref; }
GBool DCTStream::isBinary ( GBool  last = gTrue) [virtual]

Implements Stream.

Definition at line 3176 of file Stream.cc.

                                    {
  return str->isBinary(gTrue);
}

Here is the call graph for this function:

virtual GBool Stream::isEncoder ( ) [inline, virtual, inherited]

Reimplemented in RunLengthEncoder, ASCII85Encoder, ASCIIHexEncoder, and FixedLengthEncoder.

Definition at line 103 of file Stream.h.

{ return gFalse; }

Here is the caller graph for this function:

int DCTStream::lookChar ( ) [virtual]

Implements Stream.

Definition at line 2019 of file Stream.cc.

                        {
  if (y >= height) {
    return EOF;
  }
  if (progressive || !interleaved) {
    return frameBuf[comp][y * bufWidth + x];
  } else {
    if (dy >= mcuHeight) {
      if (!readMCURow()) {
       y = height;
       return EOF;
      }
      comp = 0;
      x = 0;
      dy = 0;
    }
    return rowBuf[comp][dy][x];
  }
}

Here is the call graph for this function:

int DCTStream::read16 ( ) [private]

Definition at line 3153 of file Stream.cc.

                      {
  int c1, c2;

  if ((c1 = str->getChar()) == EOF)
    return EOF;
  if ((c2 = str->getChar()) == EOF)
    return EOF;
  return (c1 << 8) + c2;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 3096 of file Stream.cc.

                                 {
  int length, i;
  char buf[12];
  int c;

  length = read16();
  if (length < 14) {
    goto err;
  }
  for (i = 0; i < 12; ++i) {
    if ((c = str->getChar()) == EOF) {
      goto err;
    }
    buf[i] = c;
  }
  if (strncmp(buf, "Adobe", 5)) {
    goto err;
  }
  colorXform = buf[11];
  gotAdobeMarker = gTrue;
  for (i = 14; i < length; ++i) {
    if (str->getChar() == EOF) {
      goto err;
    }
  }
  return gTrue;

 err:
  error(getPos(), "Bad DCT Adobe APP14 marker");
  return gFalse;
}

Here is the call graph for this function:

Here is the caller graph for this function:

int DCTStream::readAmp ( int  size) [private]

Definition at line 2773 of file Stream.cc.

                               {
  int amp, bit;
  int bits;

  amp = 0;
  for (bits = 0; bits < size; ++bits) {
    if ((bit = readBit()) == EOF)
      return 9999;
    amp = (amp << 1) + bit;
  }
  if (amp < (1 << (size - 1)))
    amp -= (1 << size) - 1;
  return amp;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 2889 of file Stream.cc.

                                 {
  int length;
  int prec;
  int i;
  int c;

  length = read16();
  prec = str->getChar();
  height = read16();
  width = read16();
  numComps = str->getChar();
  if (prec != 8) {
    error(getPos(), "Bad DCT precision %d", prec);
    return gFalse;
  }
  for (i = 0; i < numComps; ++i) {
    compInfo[i].id = str->getChar();
    c = str->getChar();
    compInfo[i].hSample = (c >> 4) & 0x0f;
    compInfo[i].vSample = c & 0x0f;
    compInfo[i].quantTable = str->getChar();
  }
  progressive = gFalse;
  return gTrue;
}

Here is the call graph for this function:

Here is the caller graph for this function:

int DCTStream::readBit ( ) [private]

Definition at line 2788 of file Stream.cc.

                       {
  int bit;
  int c, c2;

  if (inputBits == 0) {
    if ((c = str->getChar()) == EOF)
      return EOF;
    if (c == 0xff) {
      do {
       c2 = str->getChar();
      } while (c2 == 0xff);
      if (c2 != 0x00) {
       error(getPos(), "Bad DCT data: missing 00 after ff");
       return EOF;
      }
    }
    inputBuf = c;
    inputBits = 8;
  }
  bit = (inputBuf >> (inputBits - 1)) & 1;
  --inputBits;
  return bit;
}

Here is the call graph for this function:

Here is the caller graph for this function:

GBool DCTStream::readDataUnit ( DCTHuffTable dcHuffTable,
DCTHuffTable acHuffTable,
int prevDC,
int  data[64] 
) [private]

Definition at line 2276 of file Stream.cc.

                                                      {
  int run, size, amp;
  int c;
  int i, j;

  if ((size = readHuffSym(dcHuffTable)) == 9999) {
    return gFalse;
  }
  if (size > 0) {
    if ((amp = readAmp(size)) == 9999) {
      return gFalse;
    }
  } else {
    amp = 0;
  }
  data[0] = *prevDC += amp;
  for (i = 1; i < 64; ++i) {
    data[i] = 0;
  }
  i = 1;
  while (i < 64) {
    run = 0;
    while ((c = readHuffSym(acHuffTable)) == 0xf0 && run < 0x30) {
      run += 0x10;
    }
    if (c == 9999) {
      return gFalse;
    }
    if (c == 0x00) {
      break;
    } else {
      run += (c >> 4) & 0x0f;
      size = c & 0x0f;
      amp = readAmp(size);
      if (amp == 9999) {
       return gFalse;
      }
      i += run;
      if (i < 64) {
       j = dctZigZag[i++];
       data[j] = amp;
      }
    }
  }
  return gTrue;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 2812 of file Stream.cc.

                            {
  GBool doScan;
  int n;
  int c = 0;
  int i;

  // read headers
  doScan = gFalse;
  while (!doScan) {
    c = readMarker();
    switch (c) {
    case 0xc0:                     // SOF0
      if (!readBaselineSOF()) {
       return gFalse;
      }
      break;
    case 0xc2:                     // SOF2
      if (!readProgressiveSOF()) {
       return gFalse;
      }
      break;
    case 0xc4:                     // DHT
      if (!readHuffmanTables()) {
       return gFalse;
      }
      break;
    case 0xd8:                     // SOI
      break;
    case 0xd9:                     // EOI
      return gFalse;
    case 0xda:                     // SOS
      if (!readScanInfo()) {
       return gFalse;
      }
      doScan = gTrue;
      break;
    case 0xdb:                     // DQT
      if (!readQuantTables()) {
       return gFalse;
      }
      break;
    case 0xdd:                     // DRI
      if (!readRestartInterval()) {
       return gFalse;
      }
      break;
    case 0xe0:                     // APP0
      if (!readJFIFMarker()) {
       return gFalse;
      }
      break;
    case 0xee:                     // APP14
      if (!readAdobeMarker()) {
       return gFalse;
      }
      break;
    case EOF:
      error(getPos(), "Bad DCT header");
      return gFalse;
    default:
      // skip APPn / COM / etc.
      if (c >= 0xe0) {
       n = read16() - 2;
       for (i = 0; i < n; ++i) {
         str->getChar();
       }
      } else {
       error(getPos(), "Unknown DCT marker <%02x>", c);
       return gFalse;
      }
      break;
    }
  }

  return gTrue;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 3009 of file Stream.cc.

                                   {
  DCTHuffTable *tbl;
  int length;
  int index;
  Gushort code;
  Guchar sym;
  int i;
  int c;

  length = read16() - 2;
  while (length > 0) {
    index = str->getChar();
    --length;
    if ((index & 0x0f) >= 4) {
      error(getPos(), "Bad DCT Huffman table");
      return gFalse;
    }
    if (index & 0x10) {
      index &= 0x0f;
      if (index >= numACHuffTables)
       numACHuffTables = index+1;
      tbl = &acHuffTables[index];
    } else {
      if (index >= numDCHuffTables)
       numDCHuffTables = index+1;
      tbl = &dcHuffTables[index];
    }
    sym = 0;
    code = 0;
    for (i = 1; i <= 16; ++i) {
      c = str->getChar();
      tbl->firstSym[i] = sym;
      tbl->firstCode[i] = code;
      tbl->numCodes[i] = c;
      sym += c;
      code = (code + c) << 1;
    }
    length -= 16;
    for (i = 0; i < sym; ++i)
      tbl->sym[i] = str->getChar();
    length -= sym;
  }
  return gTrue;
}

Here is the call graph for this function:

Here is the caller graph for this function:

int DCTStream::readHuffSym ( DCTHuffTable table) [private]

Definition at line 2748 of file Stream.cc.

                                              {
  Gushort code;
  int bit;
  int codeBits;

  code = 0;
  codeBits = 0;
  do {
    // add a bit to the code
    if ((bit = readBit()) == EOF)
      return 9999;
    code = (code << 1) + bit;
    ++codeBits;

    // look up code
    if (code - table->firstCode[codeBits] < table->numCodes[codeBits]) {
      code -= table->firstCode[codeBits];
      return table->sym[table->firstSym[codeBits] + code];
    }
  } while (codeBits < 16);

  error(getPos(), "Bad Huffman code in DCT stream");
  return 9999;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 3066 of file Stream.cc.

                                {
  int length, i;
  char buf[5];
  int c;

  length = read16();
  length -= 2;
  if (length >= 5) {
    for (i = 0; i < 5; ++i) {
      if ((c = str->getChar()) == EOF) {
       error(getPos(), "Bad DCT APP0 marker");
       return gFalse;
      }
      buf[i] = c;
    }
    length -= 5;
    if (!memcmp(buf, "JFIF\0", 5)) {
      gotJFIFMarker = gTrue;
    }
  }
  while (length > 0) {
    if (str->getChar() == EOF) {
      error(getPos(), "Bad DCT APP0 marker");
      return gFalse;
    }
    --length;
  }
  return gTrue;
}

Here is the call graph for this function:

Here is the caller graph for this function:

int DCTStream::readMarker ( ) [private]

Definition at line 3139 of file Stream.cc.

                          {
  int c;

  do {
    do {
      c = str->getChar();
    } while (c != 0xff);
    do {
      c = str->getChar();
    } while (c == 0xff);
  } while (c == 0x00);
  return c;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 2051 of file Stream.cc.

                            {
  int data1[64];
  Guchar data2[64];
  Guchar *p1, *p2;
  int pY, pCb, pCr, pR, pG, pB;
  int h, v, horiz, vert, hSub, vSub;
  int x1, x2, y2, x3, y3, x4, y4, x5, y5, cc, i;
  int c;

  for (x1 = 0; x1 < width; x1 += mcuWidth) {

    // deal with restart marker
    if (restartInterval > 0 && restartCtr == 0) {
      c = readMarker();
      if (c != restartMarker) {
       error(getPos(), "Bad DCT data: incorrect restart marker");
       return gFalse;
      }
      if (++restartMarker == 0xd8)
       restartMarker = 0xd0;
      restart();
    }

    // read one MCU
    for (cc = 0; cc < numComps; ++cc) {
      h = compInfo[cc].hSample;
      v = compInfo[cc].vSample;
      horiz = mcuWidth / h;
      vert = mcuHeight / v;
      hSub = horiz / 8;
      vSub = vert / 8;
      for (y2 = 0; y2 < mcuHeight; y2 += vert) {
       for (x2 = 0; x2 < mcuWidth; x2 += horiz) {
         if (!readDataUnit(&dcHuffTables[scanInfo.dcHuffTable[cc]],
                         &acHuffTables[scanInfo.acHuffTable[cc]],
                         &compInfo[cc].prevDC,
                         data1)) {
           return gFalse;
         }
         transformDataUnit(quantTables[compInfo[cc].quantTable],
                         data1, data2);
         if (hSub == 1 && vSub == 1) {
           for (y3 = 0, i = 0; y3 < 8; ++y3, i += 8) {
             p1 = &rowBuf[cc][y2+y3][x1+x2];
             p1[0] = data2[i];
             p1[1] = data2[i+1];
             p1[2] = data2[i+2];
             p1[3] = data2[i+3];
             p1[4] = data2[i+4];
             p1[5] = data2[i+5];
             p1[6] = data2[i+6];
             p1[7] = data2[i+7];
           }
         } else if (hSub == 2 && vSub == 2) {
           for (y3 = 0, i = 0; y3 < 16; y3 += 2, i += 8) {
             p1 = &rowBuf[cc][y2+y3][x1+x2];
             p2 = &rowBuf[cc][y2+y3+1][x1+x2];
             p1[0] = p1[1] = p2[0] = p2[1] = data2[i];
             p1[2] = p1[3] = p2[2] = p2[3] = data2[i+1];
             p1[4] = p1[5] = p2[4] = p2[5] = data2[i+2];
             p1[6] = p1[7] = p2[6] = p2[7] = data2[i+3];
             p1[8] = p1[9] = p2[8] = p2[9] = data2[i+4];
             p1[10] = p1[11] = p2[10] = p2[11] = data2[i+5];
             p1[12] = p1[13] = p2[12] = p2[13] = data2[i+6];
             p1[14] = p1[15] = p2[14] = p2[15] = data2[i+7];
           }
         } else {
           i = 0;
           for (y3 = 0, y4 = 0; y3 < 8; ++y3, y4 += vSub) {
             for (x3 = 0, x4 = 0; x3 < 8; ++x3, x4 += hSub) {
              for (y5 = 0; y5 < vSub; ++y5)
                for (x5 = 0; x5 < hSub; ++x5)
                  rowBuf[cc][y2+y4+y5][x1+x2+x4+x5] = data2[i];
              ++i;
             }
           }
         }
       }
      }
    }
    --restartCtr;

    // color space conversion
    if (colorXform) {
      // convert YCbCr to RGB
      if (numComps == 3) {
       for (y2 = 0; y2 < mcuHeight; ++y2) {
         for (x2 = 0; x2 < mcuWidth; ++x2) {
           pY = rowBuf[0][y2][x1+x2];
           pCb = rowBuf[1][y2][x1+x2] - 128;
           pCr = rowBuf[2][y2][x1+x2] - 128;
           pR = ((pY << 16) + dctCrToR * pCr + 32768) >> 16;
           rowBuf[0][y2][x1+x2] = dctClip[dctClipOffset + pR];
           pG = ((pY << 16) + dctCbToG * pCb + dctCrToG * pCr + 32768) >> 16;
           rowBuf[1][y2][x1+x2] = dctClip[dctClipOffset + pG];
           pB = ((pY << 16) + dctCbToB * pCb + 32768) >> 16;
           rowBuf[2][y2][x1+x2] = dctClip[dctClipOffset + pB];
         }
       }
      // convert YCbCrK to CMYK (K is passed through unchanged)
      } else if (numComps == 4) {
       for (y2 = 0; y2 < mcuHeight; ++y2) {
         for (x2 = 0; x2 < mcuWidth; ++x2) {
           pY = rowBuf[0][y2][x1+x2];
           pCb = rowBuf[1][y2][x1+x2] - 128;
           pCr = rowBuf[2][y2][x1+x2] - 128;
           pR = ((pY << 16) + dctCrToR * pCr + 32768) >> 16;
           rowBuf[0][y2][x1+x2] = 255 - dctClip[dctClipOffset + pR];
           pG = ((pY << 16) + dctCbToG * pCb + dctCrToG * pCr + 32768) >> 16;
           rowBuf[1][y2][x1+x2] = 255 - dctClip[dctClipOffset + pG];
           pB = ((pY << 16) + dctCbToB * pCb + 32768) >> 16;
           rowBuf[2][y2][x1+x2] = 255 - dctClip[dctClipOffset + pB];
         }
       }
      }
    }
  }
  return gTrue;
}

Here is the call graph for this function:

Here is the caller graph for this function:

GBool DCTStream::readProgressiveDataUnit ( DCTHuffTable dcHuffTable,
DCTHuffTable acHuffTable,
int prevDC,
int  data[64] 
) [private]

Definition at line 2326 of file Stream.cc.

                                                               {
  int run, size, amp, bit, c;
  int i, j, k;

  // get the DC coefficient
  i = scanInfo.firstCoeff;
  if (i == 0) {
    if (scanInfo.ah == 0) {
      if ((size = readHuffSym(dcHuffTable)) == 9999) {
       return gFalse;
      }
      if (size > 0) {
       if ((amp = readAmp(size)) == 9999) {
         return gFalse;
       }
      } else {
       amp = 0;
      }
      data[0] += (*prevDC += amp) << scanInfo.al;
    } else {
      if ((bit = readBit()) == 9999) {
       return gFalse;
      }
      data[0] += bit << scanInfo.al;
    }
    ++i;
  }
  if (scanInfo.lastCoeff == 0) {
    return gTrue;
  }

  // check for an EOB run
  if (eobRun > 0) {
    while (i <= scanInfo.lastCoeff) {
      j = dctZigZag[i++];
      if (data[j] != 0) {
       if ((bit = readBit()) == EOF) {
         return gFalse;
       }
       if (bit) {
         data[j] += 1 << scanInfo.al;
       }
      }
    }
    --eobRun;
    return gTrue;
  }

  // read the AC coefficients
  while (i <= scanInfo.lastCoeff) {
    if ((c = readHuffSym(acHuffTable)) == 9999) {
      return gFalse;
    }

    // ZRL
    if (c == 0xf0) {
      k = 0;
      while (k < 16) {
       j = dctZigZag[i++];
       if (data[j] == 0) {
         ++k;
       } else {
         if ((bit = readBit()) == EOF) {
           return gFalse;
         }
         if (bit) {
           data[j] += 1 << scanInfo.al;
         }
       }
      }

    // EOB run
    } else if ((c & 0x0f) == 0x00) {
      j = c >> 4;
      eobRun = 0;
      for (k = 0; k < j; ++k) {
       if ((bit = readBit()) == EOF) {
         return gFalse;
       }
       eobRun = (eobRun << 1) | bit;
      }
      eobRun += 1 << j;
      while (i <= scanInfo.lastCoeff) {
       j = dctZigZag[i++];
       if (data[j] != 0) {
         if ((bit = readBit()) == EOF) {
           return gFalse;
         }
         if (bit) {
           data[j] += 1 << scanInfo.al;
         }
       }
      }
      --eobRun;
      break;

    // zero run and one AC coefficient
    } else {
      run = (c >> 4) & 0x0f;
      size = c & 0x0f;
      if ((amp = readAmp(size)) == 9999) {
       return gFalse;
      }
      k = 0;
      do {
       j = dctZigZag[i++];
       while (data[j] != 0) {
         if ((bit = readBit()) == EOF) {
           return gFalse;
         }
         if (bit) {
           data[j] += 1 << scanInfo.al;
         }
         j = dctZigZag[i++];
       }
       ++k;
      } while (k <= run);
      data[j] = amp << scanInfo.al;
    }
  }

  return gTrue;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 2915 of file Stream.cc.

                                    {
  int length;
  int prec;
  int i;
  int c;

  length = read16();
  prec = str->getChar();
  height = read16();
  width = read16();
  numComps = str->getChar();
  if (prec != 8) {
    error(getPos(), "Bad DCT precision %d", prec);
    return gFalse;
  }
  for (i = 0; i < numComps; ++i) {
    compInfo[i].id = str->getChar();
    c = str->getChar();
    compInfo[i].hSample = (c >> 4) & 0x0f;
    compInfo[i].vSample = c & 0x0f;
    compInfo[i].quantTable = str->getChar();
  }
  progressive = gTrue;
  return gTrue;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 2988 of file Stream.cc.

                                 {
  int length;
  int i;
  int index;

  length = read16() - 2;
  while (length > 0) {
    index = str->getChar();
    if ((index & 0xf0) || index >= 4) {
      error(getPos(), "Bad DCT quantization table");
      return gFalse;
    }
    if (index == numQuantTables)
      numQuantTables = index + 1;
    for (i = 0; i < 64; ++i)
      quantTables[index][dctZigZag[i]] = str->getChar();
    length -= 65;
  }
  return gTrue;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 3054 of file Stream.cc.

                                     {
  int length;

  length = read16();
  if (length != 4) {
    error(getPos(), "Bad DCT restart interval");
    return gFalse;
  }
  restartInterval = read16();
  return gTrue;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void DCTStream::readScan ( ) [private]

Definition at line 2172 of file Stream.cc.

                         {
  int data[64];
  int x1, y1, dx1, dy1, x2, y2, y3, cc, i;
  int h, v, horiz, vert, vSub;
  int *p1;
  int c;

  if (scanInfo.numComps == 1) {
    for (cc = 0; cc < numComps; ++cc) {
      if (scanInfo.comp[cc]) {
       break;
      }
    }
    dx1 = mcuWidth / compInfo[cc].hSample;
    dy1 = mcuHeight / compInfo[cc].vSample;
  } else {
    dx1 = mcuWidth;
    dy1 = mcuHeight;
  }

  for (y1 = 0; y1 < height; y1 += dy1) {
    for (x1 = 0; x1 < width; x1 += dx1) {

      // deal with restart marker
      if (restartInterval > 0 && restartCtr == 0) {
       c = readMarker();
       if (c != restartMarker) {
         error(getPos(), "Bad DCT data: incorrect restart marker");
         return;
       }
       if (++restartMarker == 0xd8) {
         restartMarker = 0xd0;
       }
       restart();
      }

      // read one MCU
      for (cc = 0; cc < numComps; ++cc) {
       if (!scanInfo.comp[cc]) {
         continue;
       }

       h = compInfo[cc].hSample;
       v = compInfo[cc].vSample;
       horiz = mcuWidth / h;
       vert = mcuHeight / v;
       vSub = vert / 8;
       for (y2 = 0; y2 < dy1; y2 += vert) {
         for (x2 = 0; x2 < dx1; x2 += horiz) {

           // pull out the current values
           p1 = &frameBuf[cc][(y1+y2) * bufWidth + (x1+x2)];
           for (y3 = 0, i = 0; y3 < 8; ++y3, i += 8) {
             data[i] = p1[0];
             data[i+1] = p1[1];
             data[i+2] = p1[2];
             data[i+3] = p1[3];
             data[i+4] = p1[4];
             data[i+5] = p1[5];
             data[i+6] = p1[6];
             data[i+7] = p1[7];
             p1 += bufWidth * vSub;
           }

           // read one data unit
           if (progressive) {
             if (!readProgressiveDataUnit(
                     &dcHuffTables[scanInfo.dcHuffTable[cc]],
                     &acHuffTables[scanInfo.acHuffTable[cc]],
                     &compInfo[cc].prevDC,
                     data)) {
              return;
             }
           } else {
             if (!readDataUnit(&dcHuffTables[scanInfo.dcHuffTable[cc]],
                            &acHuffTables[scanInfo.acHuffTable[cc]],
                            &compInfo[cc].prevDC,
                            data)) {
              return;
             }
           }

           // add the data unit into frameBuf
           p1 = &frameBuf[cc][(y1+y2) * bufWidth + (x1+x2)];
           for (y3 = 0, i = 0; y3 < 8; ++y3, i += 8) {
             p1[0] = data[i];
             p1[1] = data[i+1];
             p1[2] = data[i+2];
             p1[3] = data[i+3];
             p1[4] = data[i+4];
             p1[5] = data[i+5];
             p1[6] = data[i+6];
             p1[7] = data[i+7];
             p1 += bufWidth * vSub;
           }
         }
       }
      }
      --restartCtr;
    }
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 2941 of file Stream.cc.

                              {
  int length;
  int id, c;
  int i, j;

  length = read16() - 2;
  scanInfo.numComps = str->getChar();
  --length;
  if (length != 2 * scanInfo.numComps + 3) {
    error(getPos(), "Bad DCT scan info block");
    return gFalse;
  }
  interleaved = scanInfo.numComps == numComps;
  for (j = 0; j < numComps; ++j) {
    scanInfo.comp[j] = gFalse;
  }
  for (i = 0; i < scanInfo.numComps; ++i) {
    id = str->getChar();
    // some (broken) DCT streams reuse ID numbers, but at least they
    // keep the components in order, so we check compInfo[i] first to
    // work around the problem
    if (id == compInfo[i].id) {
      j = i;
    } else {
      for (j = 0; j < numComps; ++j) {
       if (id == compInfo[j].id) {
         break;
       }
      }
      if (j == numComps) {
       error(getPos(), "Bad DCT component ID in scan info block");
       return gFalse;
      }
    }
    scanInfo.comp[j] = gTrue;
    c = str->getChar();
    scanInfo.dcHuffTable[j] = (c >> 4) & 0x0f;
    scanInfo.acHuffTable[j] = c & 0x0f;
  }
  scanInfo.firstCoeff = str->getChar();
  scanInfo.lastCoeff = str->getChar();
  c = str->getChar();
  scanInfo.ah = (c >> 4) & 0x0f;
  scanInfo.al = c & 0x0f;
  return gTrue;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 3128 of file Stream.cc.

                             {
  int c;

  c = readMarker();
  if (c != 0xd9) {          // EOI
    error(getPos(), "Bad DCT trailer");
    return gFalse;
  }
  return gTrue;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void DCTStream::reset ( ) [virtual]

Implements Stream.

Definition at line 1878 of file Stream.cc.

                      {
  int minHSample, minVSample;
  int i, j;

  str->reset();

  progressive = interleaved = gFalse;
  width = height = 0;
  numComps = 0;
  numQuantTables = 0;
  numDCHuffTables = 0;
  numACHuffTables = 0;
  colorXform = 0;
  gotJFIFMarker = gFalse;
  gotAdobeMarker = gFalse;
  restartInterval = 0;

  if (!readHeader()) {
    y = height;
    return;
  }

  // compute MCU size
  mcuWidth = minHSample = compInfo[0].hSample;
  mcuHeight = minVSample = compInfo[0].vSample;
  for (i = 1; i < numComps; ++i) {
    if (compInfo[i].hSample < minHSample)
      minHSample = compInfo[i].hSample;
    if (compInfo[i].vSample < minVSample)
      minVSample = compInfo[i].vSample;
    if (compInfo[i].hSample > mcuWidth)
      mcuWidth = compInfo[i].hSample;
    if (compInfo[i].vSample > mcuHeight)
      mcuHeight = compInfo[i].vSample;
  }
  for (i = 0; i < numComps; ++i) {
    compInfo[i].hSample /= minHSample;
    compInfo[i].vSample /= minVSample;
  }
  mcuWidth = (mcuWidth / minHSample) * 8;
  mcuHeight = (mcuHeight / minVSample) * 8;

  // figure out color transform
  if (!gotAdobeMarker && numComps == 3) {
    if (gotJFIFMarker) {
      colorXform = 1;
    } else if (compInfo[0].id == 82 && compInfo[1].id == 71 &&
              compInfo[2].id == 66) { // ASCII "RGB"
      colorXform = 0;
    } else {
      colorXform = 1;
    }
  }

  if (progressive || !interleaved) {

    // allocate a buffer for the whole image
    bufWidth = ((width + mcuWidth - 1) / mcuWidth) * mcuWidth;
    bufHeight = ((height + mcuHeight - 1) / mcuHeight) * mcuHeight;
    for (i = 0; i < numComps; ++i) {
      frameBuf[i] = (int *)gmalloc(bufWidth * bufHeight * sizeof(int));
      memset(frameBuf[i], 0, bufWidth * bufHeight * sizeof(int));
    }

    // read the image data
    do {
      restartMarker = 0xd0;
      restart();
      readScan();
    } while (readHeader());

    // decode
    decodeImage();

    // initialize counters
    comp = 0;
    x = 0;
    y = 0;

  } else {

    // allocate a buffer for one row of MCUs
    bufWidth = ((width + mcuWidth - 1) / mcuWidth) * mcuWidth;
    for (i = 0; i < numComps; ++i) {
      for (j = 0; j < mcuHeight; ++j) {
       rowBuf[i][j] = (Guchar *)gmalloc(bufWidth * sizeof(Guchar));
      }
    }

    // initialize counters
    comp = 0;
    x = 0;
    y = 0;
    dy = mcuHeight;

    restartMarker = 0xd0;
    restart();
  }
}

Here is the call graph for this function:

void DCTStream::restart ( ) [private]

Definition at line 2039 of file Stream.cc.

                        {
  int i;

  inputBits = 0;
  restartCtr = restartInterval;
  for (i = 0; i < numComps; ++i) {
    compInfo[i].prevDC = 0;
  }
  eobRun = 0;
}

Here is the caller graph for this function:

void FilterStream::setPos ( Guint  pos,
int  dir = 0 
) [virtual, inherited]

Implements Stream.

Definition at line 310 of file Stream.cc.

                                            {
  error(-1, "Internal: called setPos() on FilterStream");
}

Here is the call graph for this function:

void DCTStream::transformDataUnit ( Guchar quantTable,
int  dataIn[64],
Guchar  dataOut[64] 
) [private]

Definition at line 2595 of file Stream.cc.

                                                                  {
  int v0, v1, v2, v3, v4, v5, v6, v7, t;
  int *p;
  int i;

  // dequant
  for (i = 0; i < 64; ++i) {
    dataIn[i] *= quantTable[i];
  }

  // inverse DCT on rows
  for (i = 0; i < 64; i += 8) {
    p = dataIn + i;

    // check for all-zero AC coefficients
    if (p[1] == 0 && p[2] == 0 && p[3] == 0 &&
       p[4] == 0 && p[5] == 0 && p[6] == 0 && p[7] == 0) {
      t = (dctSqrt2 * p[0] + 512) >> 10;
      p[0] = t;
      p[1] = t;
      p[2] = t;
      p[3] = t;
      p[4] = t;
      p[5] = t;
      p[6] = t;
      p[7] = t;
      continue;
    }

    // stage 4
    v0 = (dctSqrt2 * p[0] + 128) >> 8;
    v1 = (dctSqrt2 * p[4] + 128) >> 8;
    v2 = p[2];
    v3 = p[6];
    v4 = (dctSqrt1d2 * (p[1] - p[7]) + 128) >> 8;
    v7 = (dctSqrt1d2 * (p[1] + p[7]) + 128) >> 8;
    v5 = p[3] << 4;
    v6 = p[5] << 4;

    // stage 3
    t = (v0 - v1+ 1) >> 1;
    v0 = (v0 + v1 + 1) >> 1;
    v1 = t;
    t = (v2 * dctSin6 + v3 * dctCos6 + 128) >> 8;
    v2 = (v2 * dctCos6 - v3 * dctSin6 + 128) >> 8;
    v3 = t;
    t = (v4 - v6 + 1) >> 1;
    v4 = (v4 + v6 + 1) >> 1;
    v6 = t;
    t = (v7 + v5 + 1) >> 1;
    v5 = (v7 - v5 + 1) >> 1;
    v7 = t;

    // stage 2
    t = (v0 - v3 + 1) >> 1;
    v0 = (v0 + v3 + 1) >> 1;
    v3 = t;
    t = (v1 - v2 + 1) >> 1;
    v1 = (v1 + v2 + 1) >> 1;
    v2 = t;
    t = (v4 * dctSin3 + v7 * dctCos3 + 2048) >> 12;
    v4 = (v4 * dctCos3 - v7 * dctSin3 + 2048) >> 12;
    v7 = t;
    t = (v5 * dctSin1 + v6 * dctCos1 + 2048) >> 12;
    v5 = (v5 * dctCos1 - v6 * dctSin1 + 2048) >> 12;
    v6 = t;

    // stage 1
    p[0] = v0 + v7;
    p[7] = v0 - v7;
    p[1] = v1 + v6;
    p[6] = v1 - v6;
    p[2] = v2 + v5;
    p[5] = v2 - v5;
    p[3] = v3 + v4;
    p[4] = v3 - v4;
  }

  // inverse DCT on columns
  for (i = 0; i < 8; ++i) {
    p = dataIn + i;

    // check for all-zero AC coefficients
    if (p[1*8] == 0 && p[2*8] == 0 && p[3*8] == 0 &&
       p[4*8] == 0 && p[5*8] == 0 && p[6*8] == 0 && p[7*8] == 0) {
      t = (dctSqrt2 * dataIn[i+0] + 8192) >> 14;
      p[0*8] = t;
      p[1*8] = t;
      p[2*8] = t;
      p[3*8] = t;
      p[4*8] = t;
      p[5*8] = t;
      p[6*8] = t;
      p[7*8] = t;
      continue;
    }

    // stage 4
    v0 = (dctSqrt2 * p[0*8] + 2048) >> 12;
    v1 = (dctSqrt2 * p[4*8] + 2048) >> 12;
    v2 = p[2*8];
    v3 = p[6*8];
    v4 = (dctSqrt1d2 * (p[1*8] - p[7*8]) + 2048) >> 12;
    v7 = (dctSqrt1d2 * (p[1*8] + p[7*8]) + 2048) >> 12;
    v5 = p[3*8];
    v6 = p[5*8];

    // stage 3
    t = (v0 - v1 + 1) >> 1;
    v0 = (v0 + v1 + 1) >> 1;
    v1 = t;
    t = (v2 * dctSin6 + v3 * dctCos6 + 2048) >> 12;
    v2 = (v2 * dctCos6 - v3 * dctSin6 + 2048) >> 12;
    v3 = t;
    t = (v4 - v6 + 1) >> 1;
    v4 = (v4 + v6 + 1) >> 1;
    v6 = t;
    t = (v7 + v5 + 1) >> 1;
    v5 = (v7 - v5 + 1) >> 1;
    v7 = t;

    // stage 2
    t = (v0 - v3 + 1) >> 1;
    v0 = (v0 + v3 + 1) >> 1;
    v3 = t;
    t = (v1 - v2 + 1) >> 1;
    v1 = (v1 + v2 + 1) >> 1;
    v2 = t;
    t = (v4 * dctSin3 + v7 * dctCos3 + 2048) >> 12;
    v4 = (v4 * dctCos3 - v7 * dctSin3 + 2048) >> 12;
    v7 = t;
    t = (v5 * dctSin1 + v6 * dctCos1 + 2048) >> 12;
    v5 = (v5 * dctCos1 - v6 * dctSin1 + 2048) >> 12;
    v6 = t;

    // stage 1
    p[0*8] = v0 + v7;
    p[7*8] = v0 - v7;
    p[1*8] = v1 + v6;
    p[6*8] = v1 - v6;
    p[2*8] = v2 + v5;
    p[5*8] = v2 - v5;
    p[3*8] = v3 + v4;
    p[4*8] = v3 - v4;
  }

  // convert to 8-bit integers
  for (i = 0; i < 64; ++i) {
    dataOut[i] = dctClip[dctClipOffset + 128 + ((dataIn[i] + 8) >> 4)];
  }
}

Here is the caller graph for this function:


Member Data Documentation

Definition at line 597 of file Stream.h.

Definition at line 586 of file Stream.h.

Definition at line 586 of file Stream.h.

Definition at line 590 of file Stream.h.

int DCTStream::comp [private]

Definition at line 602 of file Stream.h.

Definition at line 587 of file Stream.h.

Definition at line 596 of file Stream.h.

int DCTStream::dy [private]

Definition at line 602 of file Stream.h.

Definition at line 605 of file Stream.h.

int* DCTStream::frameBuf[4] [private]

Definition at line 601 of file Stream.h.

Definition at line 592 of file Stream.h.

Definition at line 591 of file Stream.h.

Definition at line 584 of file Stream.h.

Definition at line 607 of file Stream.h.

Definition at line 606 of file Stream.h.

Definition at line 583 of file Stream.h.

Definition at line 585 of file Stream.h.

Definition at line 585 of file Stream.h.

Definition at line 599 of file Stream.h.

Definition at line 589 of file Stream.h.

Definition at line 598 of file Stream.h.

Definition at line 595 of file Stream.h.

Definition at line 582 of file Stream.h.

Guchar DCTStream::quantTables[4][64] [private]

Definition at line 594 of file Stream.h.

Definition at line 603 of file Stream.h.

Definition at line 593 of file Stream.h.

Definition at line 604 of file Stream.h.

Guchar* DCTStream::rowBuf[4][32] [private]

Definition at line 600 of file Stream.h.

Definition at line 588 of file Stream.h.

Stream* FilterStream::str [protected, inherited]

Definition at line 180 of file Stream.h.

int DCTStream::width [private]

Definition at line 584 of file Stream.h.

int DCTStream::x [private]

Definition at line 602 of file Stream.h.

int DCTStream::y [private]

Definition at line 602 of file Stream.h.


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