parameters: (self, inbuf)
return_statement: return outbuf
docstring: DecompressImage(), the main function in this class !!
         inbuf is source data in jpg format
         return is bmp bgr format, bottom_up
docstring_summary: DecompressImage(), the main function in this class !!
         inbuf is source data in jpg format
         return is bmp bgr format, bottom_up
docstring_tokens: DecompressImage () the main function in this class !! inbuf is source data in jpg format return is bmp bgr format bottom_up
function: def DecompressImage(self, inbuf):
      """DecompressImage(), the main function in this class !!
         inbuf is source data in jpg format
         return is bmp bgr format, bottom_up"""
      self.ReadJpgHeader(inbuf)
      outbuf = [0] * (self.Width * self.Height * 3)
      #    horizontal and vertical count of tile, macroblocks, 
      #    MCU(Minimum Coded Unit), 
      #        case 1: maybe is 16*16 pixels, 6 blocks
      #        case 2: may be 8*8 pixels, only 3 blocks
      cxTile = (self.Width  + self.McuSize - 1) / self.McuSize
      cyTile = (self.Height + self.McuSize - 1) / self.McuSize
  
      #    BMP row width, must be divided by 4
      nRowBytes = (self.Width * 3 + 3) / 4 * 4
  
      # FIXME: source ptr (don't need to read as we already read the header)
      # self.Data = inbuf
      # self.DataPos = 0
      #    Decompress all the tiles, or macroblocks, or MCUs
      for yTile in range(cyTile):
        # print "decompressing row %d/%d" % (yTile, cyTile)
        for xTile in range(cxTile):
              # Decompress one macroblock started from self.Data
              # This function will push self.Data ahead
              # Result is storing in byTile
              byTile = self.DecompressOneTile()
  
              #    Get tile starting pixel position
              xPixel = xTile * self.McuSize
              yPixel = yTile * self.McuSize
  
              #    Get the true number of tile columns and rows
              nTrueRows = self.McuSize
              nTrueCols = self.McuSize
              if yPixel + nTrueRows > self.Height:
                  nTrueRows = self.Height - yPixel
              if xPixel + nTrueCols > self.Width:
                  nTrueCols = self.Width - xPixel
  
              #    Invert output, to bmp format; row 0=>row (self.Height-1)
              outbufpos = (self.Height - 1 - yPixel) * nRowBytes + xPixel * 3
              for y in range(nTrueRows):
                offset = y * self.McuSize * 3
                tilerow = byTile[offset:offset + nTrueCols*3]
                outbuf[outbufpos:outbufpos + nTrueCols*3] = tilerow
                outbufpos -= nRowBytes
      return outbuf
function_tokens: def DecompressImage ( self , inbuf ) : self . ReadJpgHeader ( inbuf ) outbuf = [ 0 ] * ( self . Width * self . Height * 3 ) #    horizontal and vertical count of tile, macroblocks,  #    MCU(Minimum Coded Unit),  #        case 1: maybe is 16*16 pixels, 6 blocks #        case 2: may be 8*8 pixels, only 3 blocks cxTile = ( self . Width + self . McuSize - 1 ) / self . McuSize cyTile = ( self . Height + self . McuSize - 1 ) / self . McuSize #    BMP row width, must be divided by 4 nRowBytes = ( self . Width * 3 + 3 ) / 4 * 4 # FIXME: source ptr (don't need to read as we already read the header) # self.Data = inbuf # self.DataPos = 0 #    Decompress all the tiles, or macroblocks, or MCUs for yTile in range ( cyTile ) : # print "decompressing row %d/%d" % (yTile, cyTile) for xTile in range ( cxTile ) : # Decompress one macroblock started from self.Data # This function will push self.Data ahead # Result is storing in byTile byTile = self . DecompressOneTile ( ) #    Get tile starting pixel position xPixel = xTile * self . McuSize yPixel = yTile * self . McuSize #    Get the true number of tile columns and rows nTrueRows = self . McuSize nTrueCols = self . McuSize if yPixel + nTrueRows > self . Height : nTrueRows = self . Height - yPixel if xPixel + nTrueCols > self . Width : nTrueCols = self . Width - xPixel #    Invert output, to bmp format; row 0=>row (self.Height-1) outbufpos = ( self . Height - 1 - yPixel ) * nRowBytes + xPixel * 3 for y in range ( nTrueRows ) : offset = y * self . McuSize * 3 tilerow = byTile [ offset : offset + nTrueCols * 3 ] outbuf [ outbufpos : outbufpos + nTrueCols * 3 ] = tilerow outbufpos -= nRowBytes return outbuf