Index: trunk/source/Lib/TLibCommon/TComPicYuv.cpp
===================================================================
--- trunk/source/Lib/TLibCommon/TComPicYuv.cpp	(revision 443)
+++ trunk/source/Lib/TLibCommon/TComPicYuv.cpp	(revision 608)
@@ -4,5 +4,5 @@
  * granted under this license.  
  *
- * Copyright (c) 2010-2012, ITU/ISO/IEC
+ * Copyright (c) 2010-2013, ITU/ISO/IEC
  * All rights reserved.
  *
@@ -60,12 +60,5 @@
   m_piPicOrgU       = NULL;
   m_piPicOrgV       = NULL;
-
-#if FIX_APPENCTOP_T_ONLY
-  m_cuOffsetY       = NULL;
-  m_cuOffsetC       = NULL;
-  m_buOffsetY       = NULL;
-  m_buOffsetC       = NULL;
-#endif  
-
+  
   m_bIsBorderExtended = false;
 }
@@ -84,17 +77,16 @@
   m_iCuHeight       = uiMaxCUHeight;
 
+#if H_3D_IV_MERGE
   m_iNumCuInWidth   = m_iPicWidth / m_iCuWidth;
   m_iNumCuInWidth  += ( m_iPicWidth % m_iCuWidth ) ? 1 : 0;
 
-  m_uiMaxCuDepth = uiMaxCUDepth;
-
   m_iBaseUnitWidth  = uiMaxCUWidth  >> uiMaxCUDepth;
   m_iBaseUnitHeight = uiMaxCUHeight >> uiMaxCUDepth;
-
+#endif
   Int numCuInWidth  = m_iPicWidth  / m_iCuWidth  + (m_iPicWidth  % m_iCuWidth  != 0);
   Int numCuInHeight = m_iPicHeight / m_iCuHeight + (m_iPicHeight % m_iCuHeight != 0);
   
-  m_iLumaMarginX    = g_uiMaxCUWidth  + PICYUV_PAD; // for 16-byte alignment
-  m_iLumaMarginY    = g_uiMaxCUHeight + PICYUV_PAD;  // margin for 8-tap filter and infinite padding
+  m_iLumaMarginX    = g_uiMaxCUWidth  + 16; // for 16-byte alignment
+  m_iLumaMarginY    = g_uiMaxCUHeight + 16;  // margin for 8-tap filter and infinite padding
   
   m_iChromaMarginX  = m_iLumaMarginX>>1;
@@ -144,15 +136,9 @@
   if( m_apiPicBufU ){ xFree( m_apiPicBufU );    m_apiPicBufU = NULL; }
   if( m_apiPicBufV ){ xFree( m_apiPicBufV );    m_apiPicBufV = NULL; }
-#if FIX_APPENCTOP_T_ONLY
-  if( m_cuOffsetY )
-  {
-#endif
+
   delete[] m_cuOffsetY;
   delete[] m_cuOffsetC;
   delete[] m_buOffsetY;
   delete[] m_buOffsetC;
-#if FIX_APPENCTOP_T_ONLY
-  }
-#endif
 }
 
@@ -165,18 +151,10 @@
   m_iCuWidth        = uiMaxCUWidth;
   m_iCuHeight       = uiMaxCUHeight;
-  m_uiMaxCuDepth    = uiMaxCUDepth;
-
-  m_iNumCuInWidth   = m_iPicWidth / m_iCuWidth;
-  m_iNumCuInWidth  += ( m_iPicWidth % m_iCuWidth ) ? 1 : 0;
-
-  m_iBaseUnitWidth  = uiMaxCUWidth  >> uiMaxCUDepth;
-  m_iBaseUnitHeight = uiMaxCUHeight >> uiMaxCUDepth;
-
   
   Int numCuInWidth  = m_iPicWidth  / m_iCuWidth  + (m_iPicWidth  % m_iCuWidth  != 0);
   Int numCuInHeight = m_iPicHeight / m_iCuHeight + (m_iPicHeight % m_iCuHeight != 0);
   
-  m_iLumaMarginX    = g_uiMaxCUWidth  + PICYUV_PAD; // for 16-byte alignment
-  m_iLumaMarginY    = g_uiMaxCUHeight + PICYUV_PAD;  // margin for 8-tap filter and infinite padding
+  m_iLumaMarginX    = g_uiMaxCUWidth  + 16; // for 16-byte alignment
+  m_iLumaMarginY    = g_uiMaxCUHeight + 16;  // margin for 8-tap filter and infinite padding
   
   m_apiPicBufY      = (Pel*)xMalloc( Pel, ( m_iPicWidth       + (m_iLumaMarginX  <<1)) * ( m_iPicHeight       + (m_iLumaMarginY  <<1)));
@@ -253,26 +231,4 @@
 }
 
-
-Void TComPicYuv::getLumaMinMax( Int *pMin, Int *pMax )
-{
-  Pel*  piY   = getLumaAddr();
-  Int   iMin  = (1<<(g_uiBitDepth))-1;
-  Int   iMax  = 0;
-  Int   x, y;
-  
-  for ( y = 0; y < m_iPicHeight; y++ )
-  {
-    for ( x = 0; x < m_iPicWidth; x++ )
-    {
-      if ( piY[x] < iMin ) iMin = piY[x];
-      if ( piY[x] > iMax ) iMax = piY[x];
-    }
-    piY += getStride();
-  }
-  
-  *pMin = iMin;
-  *pMax = iMax;
-}
-
 Void TComPicYuv::extendPicBorder ()
 {
@@ -316,5 +272,5 @@
 
 
-Void TComPicYuv::dump (char* pFileName, Bool bAdd)
+Void TComPicYuv::dump (Char* pFileName, Bool bAdd)
 {
   FILE* pFile;
@@ -328,5 +284,5 @@
   }
   
-  Int     shift = g_uiBitIncrement;
+  Int     shift = g_bitDepthY-8;
   Int     offset = (shift>0)?(1<<(shift-1)):0;
   
@@ -338,11 +294,9 @@
   Pel*  piCr  = getCrAddr();
   
-  Pel  iMax = ((1<<(g_uiBitDepth))-1);
-  
   for ( y = 0; y < m_iPicHeight; y++ )
   {
     for ( x = 0; x < m_iPicWidth; x++ )
     {
-      uc = (UChar)Clip3<Pel>(0, iMax, (piY[x]+offset)>>shift);
+      uc = (UChar)Clip3<Pel>(0, 255, (piY[x]+offset)>>shift);
       
       fwrite( &uc, sizeof(UChar), 1, pFile );
@@ -351,9 +305,12 @@
   }
   
+  shift = g_bitDepthC-8;
+  offset = (shift>0)?(1<<(shift-1)):0;
+
   for ( y = 0; y < m_iPicHeight >> 1; y++ )
   {
     for ( x = 0; x < m_iPicWidth >> 1; x++ )
     {
-      uc = (UChar)Clip3<Pel>(0, iMax, (piCb[x]+offset)>>shift);
+      uc = (UChar)Clip3<Pel>(0, 255, (piCb[x]+offset)>>shift);
       fwrite( &uc, sizeof(UChar), 1, pFile );
     }
@@ -365,5 +322,5 @@
     for ( x = 0; x < m_iPicWidth >> 1; x++ )
     {
-      uc = (UChar)Clip3<Pel>(0, iMax, (piCr[x]+offset)>>shift);
+      uc = (UChar)Clip3<Pel>(0, 255, (piCr[x]+offset)>>shift);
       fwrite( &uc, sizeof(UChar), 1, pFile );
     }
@@ -374,70 +331,6 @@
 }
 
-#if FIXED_ROUNDING_FRAME_MEMORY
-Void TComPicYuv::xFixedRoundingPic()
-{
-  Int   x, y;
-  Pel*  pRec    = getLumaAddr();
-  Int   iStride = getStride();
-  Int   iWidth  = getWidth();
-  Int   iHeight = getHeight();
-#if FULL_NBIT
-  Int   iOffset  = ((g_uiBitDepth-8)>0)?(1<<(g_uiBitDepth-8-1)):0;
-  Int   iMask   = (~0<<(g_uiBitDepth-8));
-  Int   iMaxBdi = g_uiBASE_MAX<<(g_uiBitDepth-8);
-#else
-  Int   iOffset  = (g_uiBitIncrement>0)?(1<<(g_uiBitIncrement-1)):0;
-  Int   iMask   = (~0<<g_uiBitIncrement);
-  Int   iMaxBdi = g_uiBASE_MAX<<g_uiBitIncrement;
-#endif
-
-  for( y = 0; y < iHeight; y++ )
-  {
-    for( x = 0; x < iWidth; x++ )
-    {
-#if IBDI_NOCLIP_RANGE
-      pRec[x] = ( pRec[x] + iOffset ) & iMask;
-#else
-      pRec[x] = ( pRec[x]+iOffset>iMaxBdi)? iMaxBdi : ((pRec[x]+iOffset) & iMask);
-#endif
-    }
-    pRec += iStride;
-  }
-
-  iHeight >>= 1;
-  iWidth  >>= 1;
-  iStride >>= 1;
-  pRec  = getCbAddr();
-
-  for( y = 0; y < iHeight; y++ )
-  {
-    for( x = 0; x < iWidth; x++ )
-    {
-#if IBDI_NOCLIP_RANGE
-      pRec[x] = ( pRec[x] + iOffset ) & iMask;
-#else
-      pRec[x] = ( pRec[x]+iOffset>iMaxBdi)? iMaxBdi : ((pRec[x]+iOffset) & iMask);
-#endif
-    }
-    pRec += iStride;
-  }
-
-  pRec  = getCrAddr();
-
-  for( y = 0; y < iHeight; y++ )
-  {
-    for( x = 0; x < iWidth; x++ )
-    {
-#if IBDI_NOCLIP_RANGE
-      pRec[x] = ( pRec[x] + iOffset ) & iMask;
-#else
-      pRec[x] = ( pRec[x]+iOffset>iMaxBdi)? iMaxBdi : ((pRec[x]+iOffset) & iMask);
-#endif
-    }
-    pRec += iStride;
-  }
-}
-#endif
-
+#if H_3D
+#if H_3D_IV_MERGE
 Void
 TComPicYuv::getTopLeftSamplePos( Int iCuAddr, Int iAbsZorderIdx, Int& riX, Int& riY )
@@ -465,5 +358,5 @@
   riAbsZorderIdx      = g_auiRasterToZscan[ iRastPartIdx ];
 }
-
+#endif
 Void TComPicYuv::setLumaTo( Pel pVal )
 {
@@ -488,11 +381,5 @@
   }
 }
-#if QC_ARP_D0177
-Void  TComPicYuv::clearPic()
-{
-  ::memset ( m_apiPicBufY, 0 , sizeof (Pel) * ( m_iPicWidth       + (m_iLumaMarginX   << 1)) * ( m_iPicHeight       + (m_iLumaMarginY   << 1)) );
-  ::memset ( m_apiPicBufU, 0 , sizeof (Pel) * ((m_iPicWidth >> 1) + (m_iChromaMarginX << 1)) * ((m_iPicHeight >> 1) + (m_iChromaMarginY << 1)) );
-  ::memset ( m_apiPicBufV, 0 , sizeof (Pel) * ((m_iPicWidth >> 1) + (m_iChromaMarginX << 1)) * ((m_iPicHeight >> 1) + (m_iChromaMarginY << 1)) );
-}
 #endif
+
 //! \}
