Esempio n. 1
0
Int CVTCDecoder::decUpdateStateAC(Int c)
{
  Int err;
  Int x, y;
  Int nc;
  Int xc[3], yc[3];

  err=0;

  /* loop through DC */
  noteDetail("Updating state of AC bands....");
  for (x = 0; x < mzte_codec.m_iDCWidth; ++x)
    for (y = 0; y < mzte_codec.m_iDCHeight; ++y)
    {
      if ((nc = findChild(x, y, xc, yc,c)) != 3)
      {
	noteError("DC band coefficient has %d children instead of 3.", nc);
	exit(-1);
      }
      
      updateCoeffAndDescState(xc[0], yc[0], c);
      updateCoeffAndDescState(xc[1], yc[1], c);
      updateCoeffAndDescState(xc[2], yc[2], c);
    }
  
  noteDetail("Completed updating state of AC bands.");

  return err;
}
Esempio n. 2
0
/* hjlee 0901 */
Int CVTCDecoder::decUpdateStateAC_spa(Int c)
{  
  Int err,h,w,hstart,wstart,hend,wend;

  err=0;

  /* loop through DC */
  noteDetail("Updating state of AC bands (difference)....");

  hstart=mzte_codec.m_SPlayer[c].height/2;
  wstart=mzte_codec.m_SPlayer[c].width/2;
  hend=mzte_codec.m_SPlayer[c].height;
  wend=mzte_codec.m_SPlayer[c].width;

  for(h=0;h<hstart;h++)
    for(w=wstart;w<wend;w++)
      updateCoeffAndDescState(w, h, c);

  for(h=hstart;h<hend;h++)
    for(w=0;w<wend;w++)
      updateCoeffAndDescState(w, h, c);
   
  noteDetail("Completed updating state of AC bands.");

  return err;
}
Esempio n. 3
0
Int CVTCDecoder::decIQuantizeAC(Int c)
{
  Int err;
  Int x, y;
  Int nc;
  Int xc[3], yc[3];

  err=0;

  /* loop through DC */
  noteDetail("Inverse quantizing AC bands....");
  for (x = 0; x < mzte_codec.m_iDCWidth; ++x)
    for (y = 0; y < mzte_codec.m_iDCHeight; ++y)
    {
      if ((nc = findChild(x, y, xc, yc,c)) != 3)
      {
	noteError("DC band coefficient has %d children instead of 3.", nc);
	exit(-1);
      }
	
      iQuantizeCoeffs(xc[0], yc[0],c);
      iQuantizeCoeffs(xc[1], yc[1],c);
      iQuantizeCoeffs(xc[2], yc[2],c);
    }

  noteDetail("Completed inverse quantizing of AC bands.");

  return err;
}
/********************************************************
  Function Name
  -------------
  Void wavelet_dc_encode(Int c)


  Arguments
  ---------
  Int c - color component.
  
  Description
  -----------
  Control program for encode DC information for one 
  color component.

  Functions Called
  ----------------
  None.
  DC_predict()
  put_param()
  cacll_encode()
  
  Return Value
  ------------
  None.

********************************************************/ 
Void CVTCEncoder::wavelet_dc_encode(Int c)
{

  noteDetail("Encoding DC (wavelet_dc_encode)....");
  color=c;

//Added by Sarnoff for error resilience, 3/5/99
#ifdef _DC_PACKET_
  if(!mzte_codec.m_usErrResiDisable)
    acmSGMK.Max_frequency = Bitplane_Max_frequency;
#endif
//End: Added by Sarnoff for error resilience, 3/5/99

  emit_bits((UShort)mzte_codec.m_iMean[color], 8);
  put_param((UShort)mzte_codec.m_iQDC[color], 7);
  /* emit_bits(mzte_codec.Qdc[color], 8); */

  DC_predict(color);
  put_param(-mzte_codec.m_iOffsetDC,7);
  put_param(mzte_codec.m_iMaxDC,7); /* hjlee */
  /* put_param(mzte_codec.m_iMaxDC+mzte_codec.m_iOffsetDC,7); */ /* hjlee */
  //printf("%d %d %d %d\n", mzte_codec.m_iMean[color],mzte_codec.m_iQDC[color],-mzte_codec.m_iOffsetDC,mzte_codec.m_iMaxDC);
  cacll_encode();
  noteDetail("Completed encoding DC.");

}
Esempio n. 5
0
Int CVTCCommon::ztqInitDC(Int decode, Int c)
{
  Int err;
  Int x, y;
  Int dummyPrevQ;

  err = 0;

  noteDetail("Initializing DC coefficient information....");
  noteDebug("DC Dimensions: Width=%d, Height=%d", 
	    mzte_codec.m_iDCWidth, mzte_codec.m_iDCHeight);

  for (y = 0; y < mzte_codec.m_iDCHeight; ++y)
    for (x = 0; x < mzte_codec.m_iDCWidth; ++x)
    {
      if (decode)
	initInvQuantSingleStage(&COEFF_QSTATE(x, y, c), &dummyPrevQ);
      else
	initQuantSingleStage(&COEFF_QSTATE(x, y, c), &dummyPrevQ,
			     COEFF_ORGVAL(x,y,c));

      COEFF_TYPE(x, y, c)  = UNTYPED;
      COEFF_STATE(x, y, c) = S_DC;
    }

  noteDetail("Completed initializing of DC coefficient information.");

  return err;
}
Esempio n. 6
0
// hjlee 0901
Int CVTCCommon::ztqInitAC(Int decode, Int c)
{
  Int err;
  Int x, y, xc[4], yc[4];
  Int height, width;
  Int dummyPrevQ;

  err = 0;

  noteDetail("Initializing AC coefficient information for col %d....",c);

  height = mzte_codec.m_iHeight >> (int)(c!=0);
  width = mzte_codec.m_iWidth >> (int)(c!=0);

  noteDebug("Image: Width=%d, Height=%d", width, height);

  for (y = 0; y < height; ++y)
    for (x = 0; x < width; ++x)
    {
      if (x >= mzte_codec.m_iDCWidth || y >= mzte_codec.m_iDCHeight)
      {
	if (decode)
	  initInvQuantSingleStage(&COEFF_QSTATE(x, y, c), &dummyPrevQ);
	else
	{
	  initQuantSingleStage(&COEFF_QSTATE(x, y, c), &dummyPrevQ,
			       COEFF_ORGVAL(x,y,c));
	}

	COEFF_TYPE(x, y, c) = UNTYPED;

	/* AC Bands */
	if (findChild(x, y, xc, yc, c)==0 || 
	    x >= mzte_codec.m_SPlayer[c].width ||
	    y >= mzte_codec.m_SPlayer[c].height) /* leaf */
	  COEFF_STATE(x, y, c) = S_LINIT;
	else
	  COEFF_STATE(x, y,c) = S_INIT;
      }
    }

  noteDetail("Completed Initializing of AC coefficient information.");

  return err;
}
Esempio n. 7
0
Int CVTCDecoder::decIQuantizeDC(Int c)
{
  Int err;
  Int x, y;
 
  err=0;

  /* loop through DC */
  noteDetail("Inverse Quantizing DC band....");
  for (x = 0; x < mzte_codec.m_iDCWidth; ++x)
    for (y = 0; y < mzte_codec.m_iDCHeight; ++y)
    {
       /* assign new quantization value */

      COEFF_RECVAL(x,y,c) = COEFF_VAL(x,y,c) * mzte_codec.m_iQDC[c];
    }

  noteDetail("Completed inverse Quantizing DC bands.");

  return err;
}
Esempio n. 8
0
/********************************************
  Inverse quantize the 3 difference bands 
  between two spatial consecutive spatial
  layers.
  *****************************************/
Int CVTCDecoder::decIQuantizeAC_spa(Int spa_lev,Int c)
{
  Int err,h,w,hstart,wstart,hend,wend;

  err=0;

  /* loop through DC */
  noteDetail("Inverse quantizing AC bands (difference)....");

  hend=mzte_codec.m_SPlayer[c].height;
  wend=mzte_codec.m_SPlayer[c].width;

  if (spa_lev==FIRST_SPA_LEV(mzte_codec.m_iSpatialLev,
			     mzte_codec.m_iWvtDecompLev, c))
  {
    hstart=mzte_codec.m_iDCHeight;
    wstart=mzte_codec.m_iDCWidth;
  }
  else
  {
    hstart=hend/2;
    wstart=wend/2;
  }

  for(h=0;h<hstart;h++)
    for(w=wstart;w<wend;w++)
      iQuantizeCoeff(w,h,c);

  for(h=hstart;h<hend;h++)
    for(w=0;w<wend;w++)
      iQuantizeCoeff(w,h,c);

  noteDetail("Completed inverse quantizing of AC bands.");

  return(err);

}
Esempio n. 9
0
Void CVTCCommon::spatialLayerChangeUpdate(Int c)
{  
  Int x, y;
  Int oldWidth, oldHeight;
  Int xLeafStart, yLeafStart;

  noteDetail("Updating new coefficients in spatial layer for col %d....",c);

  oldWidth  = mzte_codec.m_spaLayerWidth[mzte_codec.m_iCurSpatialLev][c]>>1;
  oldHeight = mzte_codec.m_spaLayerHeight[mzte_codec.m_iCurSpatialLev][c]>>1;

  xLeafStart = mzte_codec.m_spaLayerWidth[mzte_codec.m_iCurSpatialLev-1][c]>>1;
  yLeafStart = mzte_codec.m_spaLayerHeight[mzte_codec.m_iCurSpatialLev-1][c]>>1;
 
  /* loop through leaf coefficients */
  /* HL */
  for (y = 0; y < yLeafStart; ++y)
    for (x = xLeafStart; x < oldWidth; ++x)
      /* update state */
      switch (COEFF_STATE(x,y,c))
      {
	case S_LVZTR:
	  COEFF_STATE(x,y,c) = S_VZTR;
	  break;
	case S_LZTR:
	  COEFF_STATE(x,y,c) = S_ZTR;
	  break;
	case S_LZTR_D:
	  COEFF_STATE(x,y,c) = S_ZTR_D;
	  break;
	case S_LINIT:
	  COEFF_STATE(x,y,c) = S_INIT;
	  break;
	default:
	  errorHandler("Non-leaf state (%d) for leaf coefficient at"\
		       "(x=%d, y=%d).", 
		       COEFF_STATE(x, y,c), x, y);
      }

  /* LH */
  for (y = yLeafStart; y < oldHeight; ++y)
    for (x = 0; x < xLeafStart; ++x)
      /* update state */
      switch (COEFF_STATE(x,y,c))
      {
	case S_LVZTR:
	  COEFF_STATE(x,y,c) = S_VZTR;
	  break;
	case S_LZTR:
	  COEFF_STATE(x,y,c) = S_ZTR;
	  break;
	case S_LZTR_D:
	  COEFF_STATE(x,y,c) = S_ZTR_D;
	  break;
	case S_LINIT:
	  COEFF_STATE(x,y,c) = S_INIT;
	  break;
	default:
	  errorHandler("Non-leaf state (%d) for leaf coefficient at"\
		       "(x=%d, y=%d).", 
		       COEFF_STATE(x, y,c), x, y);
      }
  
  /* HH */
  for (y = yLeafStart; y < oldHeight; ++y)
    for (x = xLeafStart; x < oldWidth; ++x)
      /* update state */
      switch (COEFF_STATE(x,y,c))
      {
	case S_LVZTR:
	  COEFF_STATE(x,y,c) = S_VZTR;
	  break;
	case S_LZTR:
	  COEFF_STATE(x,y,c) = S_ZTR;
	  break;
	case S_LZTR_D:
	  COEFF_STATE(x,y,c) = S_ZTR_D;
	  break;
	case S_LINIT:
	  COEFF_STATE(x,y,c) = S_INIT;
	  break;
	default:
	  errorHandler("Non-leaf state (%d) for leaf coefficient at"\
		       "(x=%d, y=%d).", 
		       COEFF_STATE(x, y,c), x, y);
      }

  noteDetail("Completed updating new coefficients in spatial layer.");

}