Logo Search packages:      
Sourcecode: djvulibre version File versions  Download package

void IWBitmap::Encode::init ( const GBitmap bm,
const GP< GBitmap mask = 0 

Initializes an IWBitmap with image bm#. This constructor performs the wavelet decomposition of image bm# and records the corresponding wavelet coefficient. Argument mask# is an optional bilevel image specifying the masked pixels (see {IW44Image.h}).

Definition at line 1417 of file IW44EncodeCodec.cpp.

References close_codec(), GBitmap::columns(), GBitmap::get_grays(), GBitmap::rows(), and GBitmap::rowsize().

Referenced by IW44Image::create_encode().

  // Free
  delete ymap;
  ymap = 0;
  // Init
  int i, j;
  int w = bm.columns();
  int h = bm.rows();
  int g = bm.get_grays()-1;
  signed char *buffer;
  GPBuffer<signed char> gbuffer(buffer,w*h);
  // Prepare gray level conversion table
  signed char  bconv[256];
  for (i=0; i<256; i++)
    bconv[i] = max(0,min(255,i*255/g)) - 128;
  // Perform decomposition
  // Prepare mask information
  const signed char *msk8 = 0;
  int mskrowsize = 0;
  GBitmap *mask=gmask;
  if (gmask)
    msk8 = (const signed char*)((*mask)[0]);
    mskrowsize = mask->rowsize();
  // Prepare a buffer of signed bytes
  for (i=0; i<h; i++)
      signed char *bufrow = buffer + i*w;
      const unsigned char *bmrow = bm[i];
      for (j=0; j<w; j++)
        bufrow[j] = bconv[bmrow[j]];
  // Create map
  Map::Encode *eymap=new Map::Encode(w,h);
  ymap = eymap;
  eymap->create(buffer, w, msk8, mskrowsize);

Generated by  Doxygen 1.6.0   Back to index