Changeset 1313 in 3DVCSoftware for trunk/source/Lib/TLibCommon/TComPicYuv.cpp


Ignore:
Timestamp:
13 Aug 2015, 17:38:13 (9 years ago)
Author:
tech
Message:

Merged 14.1-update-dev1@1312.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/source/Lib/TLibCommon/TComPicYuv.cpp

    r1179 r1313  
    22 * License, included below. This software may be subject to other third party
    33 * and contributor rights, including patent rights, and no such rights are
    4  * granted under this license. 
     4 * granted under this license.
    55 *
    6 * Copyright (c) 2010-2015, ITU/ISO/IEC
     6 * Copyright (c) 2010-2015, ITU/ISO/IEC
    77 * All rights reserved.
    88 *
     
    4747
    4848#include "TComPicYuv.h"
     49#include "TLibVideoIO/TVideoIOYuv.h"
    4950
    5051//! \ingroup TLibCommon
     
    5354TComPicYuv::TComPicYuv()
    5455{
    55   m_apiPicBufY      = NULL;   // Buffer (including margin)
    56   m_apiPicBufU      = NULL;
    57   m_apiPicBufV      = NULL;
    58  
    59   m_piPicOrgY       = NULL;    // m_apiPicBufY + m_iMarginLuma*getStride() + m_iMarginLuma
    60   m_piPicOrgU       = NULL;
    61   m_piPicOrgV       = NULL;
    62  
     56  for(UInt i=0; i<MAX_NUM_COMPONENT; i++)
     57  {
     58    m_apiPicBuf[i]    = NULL;   // Buffer (including margin)
     59    m_piPicOrg[i]     = NULL;    // m_apiPicBufY + m_iMarginLuma*getStride() + m_iMarginLuma
     60  }
     61
     62  for(UInt i=0; i<MAX_NUM_CHANNEL_TYPE; i++)
     63  {
     64    m_ctuOffsetInBuffer[i]=0;
     65    m_subCuOffsetInBuffer[i]=0;
     66  }
     67
    6368  m_bIsBorderExtended = false;
    6469}
    6570
     71
     72
     73
    6674TComPicYuv::~TComPicYuv()
    6775{
    6876}
    6977
    70 Void TComPicYuv::create( Int iPicWidth, Int iPicHeight, UInt uiMaxCUWidth, UInt uiMaxCUHeight, UInt uiMaxCUDepth )
    71 {
    72   m_iPicWidth       = iPicWidth;
    73   m_iPicHeight      = iPicHeight;
    74  
    75   // --> After config finished!
     78
     79
     80
     81Void TComPicYuv::create ( const Int iPicWidth,                ///< picture width
     82                          const Int iPicHeight,               ///< picture height
     83                          const ChromaFormat chromaFormatIDC, ///< chroma format
     84                          const UInt uiMaxCUWidth,            ///< used for generating offsets to CUs. Can use iPicWidth if no offsets are required
     85                          const UInt uiMaxCUHeight,           ///< used for generating offsets to CUs. Can use iPicHeight if no offsets are required
     86                          const UInt uiMaxCUDepth,            ///< used for generating offsets to CUs. Can use 0 if no offsets are required
     87                          const Bool bUseMargin)              ///< if true, then a margin of uiMaxCUWidth+16 and uiMaxCUHeight+16 is created around the image.
     88
     89{
     90  m_iPicWidth         = iPicWidth;
     91  m_iPicHeight        = iPicHeight;
     92
     93#if NH_3D_IV_MERGE
    7694  m_iCuWidth        = uiMaxCUWidth;
    7795  m_iCuHeight       = uiMaxCUHeight;
    7896
    79 #if H_3D_IV_MERGE
    8097  m_iNumCuInWidth   = m_iPicWidth / m_iCuWidth;
    8198  m_iNumCuInWidth  += ( m_iPicWidth % m_iCuWidth ) ? 1 : 0;
     
    84101  m_iBaseUnitHeight = uiMaxCUHeight >> uiMaxCUDepth;
    85102#endif
    86   Int numCuInWidth  = m_iPicWidth  / m_iCuWidth  + (m_iPicWidth  % m_iCuWidth  != 0);
    87   Int numCuInHeight = m_iPicHeight / m_iCuHeight + (m_iPicHeight % m_iCuHeight != 0);
    88  
    89   m_iLumaMarginX    = g_uiMaxCUWidth  + 16; // for 16-byte alignment
    90   m_iLumaMarginY    = g_uiMaxCUHeight + 16;  // margin for 8-tap filter and infinite padding
    91  
    92   m_iChromaMarginX  = m_iLumaMarginX>>1;
    93   m_iChromaMarginY  = m_iLumaMarginY>>1;
    94  
    95   m_apiPicBufY      = (Pel*)xMalloc( Pel, ( m_iPicWidth       + (m_iLumaMarginX  <<1)) * ( m_iPicHeight       + (m_iLumaMarginY  <<1)));
    96   m_apiPicBufU      = (Pel*)xMalloc( Pel, ((m_iPicWidth >> 1) + (m_iChromaMarginX<<1)) * ((m_iPicHeight >> 1) + (m_iChromaMarginY<<1)));
    97   m_apiPicBufV      = (Pel*)xMalloc( Pel, ((m_iPicWidth >> 1) + (m_iChromaMarginX<<1)) * ((m_iPicHeight >> 1) + (m_iChromaMarginY<<1)));
    98  
    99   m_piPicOrgY       = m_apiPicBufY + m_iLumaMarginY   * getStride()  + m_iLumaMarginX;
    100   m_piPicOrgU       = m_apiPicBufU + m_iChromaMarginY * getCStride() + m_iChromaMarginX;
    101   m_piPicOrgV       = m_apiPicBufV + m_iChromaMarginY * getCStride() + m_iChromaMarginX;
    102  
     103
     104  m_chromaFormatIDC   = chromaFormatIDC;
     105  m_iMarginX          = (bUseMargin?uiMaxCUWidth:0) + 16;   // for 16-byte alignment
     106  m_iMarginY          = (bUseMargin?uiMaxCUHeight:0) + 16;  // margin for 8-tap filter and infinite padding
    103107  m_bIsBorderExtended = false;
    104  
    105   m_cuOffsetY = new Int[numCuInWidth * numCuInHeight];
    106   m_cuOffsetC = new Int[numCuInWidth * numCuInHeight];
    107   for (Int cuRow = 0; cuRow < numCuInHeight; cuRow++)
    108   {
    109     for (Int cuCol = 0; cuCol < numCuInWidth; cuCol++)
    110     {
    111       m_cuOffsetY[cuRow * numCuInWidth + cuCol] = getStride() * cuRow * m_iCuHeight + cuCol * m_iCuWidth;
    112       m_cuOffsetC[cuRow * numCuInWidth + cuCol] = getCStride() * cuRow * (m_iCuHeight / 2) + cuCol * (m_iCuWidth / 2);
    113     }
    114   }
    115  
    116   m_buOffsetY = new Int[(size_t)1 << (2 * uiMaxCUDepth)];
    117   m_buOffsetC = new Int[(size_t)1 << (2 * uiMaxCUDepth)];
    118   for (Int buRow = 0; buRow < (1 << uiMaxCUDepth); buRow++)
    119   {
    120     for (Int buCol = 0; buCol < (1 << uiMaxCUDepth); buCol++)
    121     {
    122       m_buOffsetY[(buRow << uiMaxCUDepth) + buCol] = getStride() * buRow * (uiMaxCUHeight >> uiMaxCUDepth) + buCol * (uiMaxCUWidth  >> uiMaxCUDepth);
    123       m_buOffsetC[(buRow << uiMaxCUDepth) + buCol] = getCStride() * buRow * (uiMaxCUHeight / 2 >> uiMaxCUDepth) + buCol * (uiMaxCUWidth / 2 >> uiMaxCUDepth);
     108
     109  // assign the picture arrays and set up the ptr to the top left of the original picture
     110  {
     111    Int chan=0;
     112    for(; chan<getNumberValidComponents(); chan++)
     113    {
     114      const ComponentID ch=ComponentID(chan);
     115      m_apiPicBuf[chan] = (Pel*)xMalloc( Pel, getStride(ch)       * getTotalHeight(ch));
     116      m_piPicOrg[chan]  = m_apiPicBuf[chan] + (m_iMarginY >> getComponentScaleY(ch))   * getStride(ch)       + (m_iMarginX >> getComponentScaleX(ch));
     117    }
     118    for(;chan<MAX_NUM_COMPONENT; chan++)
     119    {
     120      m_apiPicBuf[chan] = NULL;
     121      m_piPicOrg[chan]  = NULL;
     122    }
     123  }
     124
     125
     126  const Int numCuInWidth  = m_iPicWidth  / uiMaxCUWidth  + (m_iPicWidth  % uiMaxCUWidth  != 0);
     127  const Int numCuInHeight = m_iPicHeight / uiMaxCUHeight + (m_iPicHeight % uiMaxCUHeight != 0);
     128  for(Int chan=0; chan<2; chan++)
     129  {
     130    const ComponentID ch=ComponentID(chan);
     131    const Int ctuHeight=uiMaxCUHeight>>getComponentScaleY(ch);
     132    const Int ctuWidth=uiMaxCUWidth>>getComponentScaleX(ch);
     133    const Int stride = getStride(ch);
     134
     135    m_ctuOffsetInBuffer[chan] = new Int[numCuInWidth * numCuInHeight];
     136
     137    for (Int cuRow = 0; cuRow < numCuInHeight; cuRow++)
     138    {
     139      for (Int cuCol = 0; cuCol < numCuInWidth; cuCol++)
     140      {
     141        m_ctuOffsetInBuffer[chan][cuRow * numCuInWidth + cuCol] = stride * cuRow * ctuHeight + cuCol * ctuWidth;
     142      }
     143    }
     144
     145    m_subCuOffsetInBuffer[chan] = new Int[(size_t)1 << (2 * uiMaxCUDepth)];
     146
     147    const Int numSubBlockPartitions=(1<<uiMaxCUDepth);
     148    const Int minSubBlockHeight    =(ctuHeight >> uiMaxCUDepth);
     149    const Int minSubBlockWidth     =(ctuWidth  >> uiMaxCUDepth);
     150
     151    for (Int buRow = 0; buRow < numSubBlockPartitions; buRow++)
     152    {
     153      for (Int buCol = 0; buCol < numSubBlockPartitions; buCol++)
     154      {
     155        m_subCuOffsetInBuffer[chan][(buRow << uiMaxCUDepth) + buCol] = stride  * buRow * minSubBlockHeight + buCol * minSubBlockWidth;
     156      }
    124157    }
    125158  }
     
    127160}
    128161
     162
     163
    129164Void TComPicYuv::destroy()
    130165{
    131   m_piPicOrgY       = NULL;
    132   m_piPicOrgU       = NULL;
    133   m_piPicOrgV       = NULL;
    134  
    135   if( m_apiPicBufY ){ xFree( m_apiPicBufY );    m_apiPicBufY = NULL; }
    136   if( m_apiPicBufU ){ xFree( m_apiPicBufU );    m_apiPicBufU = NULL; }
    137   if( m_apiPicBufV ){ xFree( m_apiPicBufV );    m_apiPicBufV = NULL; }
    138 
    139   delete[] m_cuOffsetY;
    140   delete[] m_cuOffsetC;
    141   delete[] m_buOffsetY;
    142   delete[] m_buOffsetC;
    143 }
    144 
    145 Void TComPicYuv::createLuma( Int iPicWidth, Int iPicHeight, UInt uiMaxCUWidth, UInt uiMaxCUHeight, UInt uiMaxCUDepth )
    146 {
    147   m_iPicWidth       = iPicWidth;
    148   m_iPicHeight      = iPicHeight;
    149  
    150   // --> After config finished!
    151   m_iCuWidth        = uiMaxCUWidth;
    152   m_iCuHeight       = uiMaxCUHeight;
    153  
    154   Int numCuInWidth  = m_iPicWidth  / m_iCuWidth  + (m_iPicWidth  % m_iCuWidth  != 0);
    155   Int numCuInHeight = m_iPicHeight / m_iCuHeight + (m_iPicHeight % m_iCuHeight != 0);
    156  
    157   m_iLumaMarginX    = g_uiMaxCUWidth  + 16; // for 16-byte alignment
    158   m_iLumaMarginY    = g_uiMaxCUHeight + 16;  // margin for 8-tap filter and infinite padding
    159  
    160   m_apiPicBufY      = (Pel*)xMalloc( Pel, ( m_iPicWidth       + (m_iLumaMarginX  <<1)) * ( m_iPicHeight       + (m_iLumaMarginY  <<1)));
    161   m_piPicOrgY       = m_apiPicBufY + m_iLumaMarginY   * getStride()  + m_iLumaMarginX;
    162  
    163   m_cuOffsetY = new Int[numCuInWidth * numCuInHeight];
    164   m_cuOffsetC = NULL;
    165   for (Int cuRow = 0; cuRow < numCuInHeight; cuRow++)
    166   {
    167     for (Int cuCol = 0; cuCol < numCuInWidth; cuCol++)
    168     {
    169       m_cuOffsetY[cuRow * numCuInWidth + cuCol] = getStride() * cuRow * m_iCuHeight + cuCol * m_iCuWidth;
    170     }
    171   }
    172  
    173   m_buOffsetY = new Int[(size_t)1 << (2 * uiMaxCUDepth)];
    174   m_buOffsetC = NULL;
    175   for (Int buRow = 0; buRow < (1 << uiMaxCUDepth); buRow++)
    176   {
    177     for (Int buCol = 0; buCol < (1 << uiMaxCUDepth); buCol++)
    178     {
    179       m_buOffsetY[(buRow << uiMaxCUDepth) + buCol] = getStride() * buRow * (uiMaxCUHeight >> uiMaxCUDepth) + buCol * (uiMaxCUWidth  >> uiMaxCUDepth);
    180     }
     166  for(Int chan=0; chan<MAX_NUM_COMPONENT; chan++)
     167  {
     168    m_piPicOrg[chan] = NULL;
     169
     170    if( m_apiPicBuf[chan] )
     171    {
     172      xFree( m_apiPicBuf[chan] );
     173      m_apiPicBuf[chan] = NULL;
     174    }
     175  }
     176
     177  for(UInt chan=0; chan<MAX_NUM_CHANNEL_TYPE; chan++)
     178  {
     179    if (m_ctuOffsetInBuffer[chan])
     180    {
     181      delete[] m_ctuOffsetInBuffer[chan];
     182      m_ctuOffsetInBuffer[chan] = NULL;
     183    }
     184    if (m_subCuOffsetInBuffer[chan])
     185    {
     186      delete[] m_subCuOffsetInBuffer[chan];
     187      m_subCuOffsetInBuffer[chan] = NULL;
     188    }
     189  }
     190}
     191
     192
     193
     194Void  TComPicYuv::copyToPic (TComPicYuv*  pcPicYuvDst) const
     195{
     196  assert( m_iPicWidth  == pcPicYuvDst->getWidth(COMPONENT_Y)  );
     197  assert( m_iPicHeight == pcPicYuvDst->getHeight(COMPONENT_Y) );
     198  assert( m_chromaFormatIDC == pcPicYuvDst->getChromaFormat() );
     199
     200  for(Int chan=0; chan<getNumberValidComponents(); chan++)
     201  {
     202    const ComponentID ch=ComponentID(chan);
     203    ::memcpy ( pcPicYuvDst->getBuf(ch), m_apiPicBuf[ch], sizeof (Pel) * getStride(ch) * getTotalHeight(ch));
    181204  }
    182205  return;
    183206}
    184207
    185 Void TComPicYuv::destroyLuma()
    186 {
    187   m_piPicOrgY       = NULL;
    188  
    189   if( m_apiPicBufY ){ xFree( m_apiPicBufY );    m_apiPicBufY = NULL; }
    190  
    191   delete[] m_cuOffsetY;
    192   delete[] m_buOffsetY;
    193 }
    194 
    195 Void  TComPicYuv::copyToPic (TComPicYuv*  pcPicYuvDst)
    196 {
    197   assert( m_iPicWidth  == pcPicYuvDst->getWidth()  );
    198   assert( m_iPicHeight == pcPicYuvDst->getHeight() );
    199  
    200   ::memcpy ( pcPicYuvDst->getBufY(), m_apiPicBufY, sizeof (Pel) * ( m_iPicWidth       + (m_iLumaMarginX   << 1)) * ( m_iPicHeight       + (m_iLumaMarginY   << 1)) );
    201   ::memcpy ( pcPicYuvDst->getBufU(), m_apiPicBufU, sizeof (Pel) * ((m_iPicWidth >> 1) + (m_iChromaMarginX << 1)) * ((m_iPicHeight >> 1) + (m_iChromaMarginY << 1)) );
    202   ::memcpy ( pcPicYuvDst->getBufV(), m_apiPicBufV, sizeof (Pel) * ((m_iPicWidth >> 1) + (m_iChromaMarginX << 1)) * ((m_iPicHeight >> 1) + (m_iChromaMarginY << 1)) );
    203   return;
    204 }
    205 
    206 Void  TComPicYuv::copyToPicLuma (TComPicYuv*  pcPicYuvDst)
    207 {
    208   assert( m_iPicWidth  == pcPicYuvDst->getWidth()  );
    209   assert( m_iPicHeight == pcPicYuvDst->getHeight() );
    210  
    211   ::memcpy ( pcPicYuvDst->getBufY(), m_apiPicBufY, sizeof (Pel) * ( m_iPicWidth       + (m_iLumaMarginX   << 1)) * ( m_iPicHeight       + (m_iLumaMarginY   << 1)) );
    212   return;
    213 }
    214 
    215 Void  TComPicYuv::copyToPicCb (TComPicYuv*  pcPicYuvDst)
    216 {
    217   assert( m_iPicWidth  == pcPicYuvDst->getWidth()  );
    218   assert( m_iPicHeight == pcPicYuvDst->getHeight() );
    219  
    220   ::memcpy ( pcPicYuvDst->getBufU(), m_apiPicBufU, sizeof (Pel) * ((m_iPicWidth >> 1) + (m_iChromaMarginX << 1)) * ((m_iPicHeight >> 1) + (m_iChromaMarginY << 1)) );
    221   return;
    222 }
    223 
    224 Void  TComPicYuv::copyToPicCr (TComPicYuv*  pcPicYuvDst)
    225 {
    226   assert( m_iPicWidth  == pcPicYuvDst->getWidth()  );
    227   assert( m_iPicHeight == pcPicYuvDst->getHeight() );
    228  
    229   ::memcpy ( pcPicYuvDst->getBufV(), m_apiPicBufV, sizeof (Pel) * ((m_iPicWidth >> 1) + (m_iChromaMarginX << 1)) * ((m_iPicHeight >> 1) + (m_iChromaMarginY << 1)) );
    230   return;
    231 }
    232208
    233209Void TComPicYuv::extendPicBorder ()
    234210{
    235   if ( m_bIsBorderExtended ) return;
    236  
    237   xExtendPicCompBorder( getLumaAddr(), getStride(),  getWidth(),      getHeight(),      m_iLumaMarginX,   m_iLumaMarginY   );
    238   xExtendPicCompBorder( getCbAddr()  , getCStride(), getWidth() >> 1, getHeight() >> 1, m_iChromaMarginX, m_iChromaMarginY );
    239   xExtendPicCompBorder( getCrAddr()  , getCStride(), getWidth() >> 1, getHeight() >> 1, m_iChromaMarginX, m_iChromaMarginY );
    240  
     211  if ( m_bIsBorderExtended )
     212  {
     213    return;
     214  }
     215
     216  for(Int chan=0; chan<getNumberValidComponents(); chan++)
     217  {
     218    const ComponentID ch=ComponentID(chan);
     219    Pel *piTxt=getAddr(ch); // piTxt = point to (0,0) of image within bigger picture.
     220    const Int iStride=getStride(ch);
     221    const Int iWidth=getWidth(ch);
     222    const Int iHeight=getHeight(ch);
     223    const Int iMarginX=getMarginX(ch);
     224    const Int iMarginY=getMarginY(ch);
     225
     226    Pel*  pi = piTxt;
     227    // do left and right margins
     228    for (Int y = 0; y < iHeight; y++)
     229    {
     230      for (Int x = 0; x < iMarginX; x++ )
     231      {
     232        pi[ -iMarginX + x ] = pi[0];
     233        pi[    iWidth + x ] = pi[iWidth-1];
     234      }
     235      pi += iStride;
     236    }
     237
     238    // pi is now the (0,height) (bottom left of image within bigger picture
     239    pi -= (iStride + iMarginX);
     240    // pi is now the (-marginX, height-1)
     241    for (Int y = 0; y < iMarginY; y++ )
     242    {
     243      ::memcpy( pi + (y+1)*iStride, pi, sizeof(Pel)*(iWidth + (iMarginX<<1)) );
     244    }
     245
     246    // pi is still (-marginX, height-1)
     247    pi -= ((iHeight-1) * iStride);
     248    // pi is now (-marginX, 0)
     249    for (Int y = 0; y < iMarginY; y++ )
     250    {
     251      ::memcpy( pi - (y+1)*iStride, pi, sizeof(Pel)*(iWidth + (iMarginX<<1)) );
     252    }
     253  }
     254
    241255  m_bIsBorderExtended = true;
    242256}
    243257
    244 Void TComPicYuv::xExtendPicCompBorder  (Pel* piTxt, Int iStride, Int iWidth, Int iHeight, Int iMarginX, Int iMarginY)
    245 {
    246   Int   x, y;
    247   Pel*  pi;
    248  
    249   pi = piTxt;
    250   for ( y = 0; y < iHeight; y++)
    251   {
    252     for ( x = 0; x < iMarginX; x++ )
    253     {
    254       pi[ -iMarginX + x ] = pi[0];
    255       pi[    iWidth + x ] = pi[iWidth-1];
    256     }
    257     pi += iStride;
    258   }
    259  
    260   pi -= (iStride + iMarginX);
    261   for ( y = 0; y < iMarginY; y++ )
    262   {
    263     ::memcpy( pi + (y+1)*iStride, pi, sizeof(Pel)*(iWidth + (iMarginX<<1)) );
    264   }
    265  
    266   pi -= ((iHeight-1) * iStride);
    267   for ( y = 0; y < iMarginY; y++ )
    268   {
    269     ::memcpy( pi - (y+1)*iStride, pi, sizeof(Pel)*(iWidth + (iMarginX<<1)) );
    270   }
    271 }
    272 
    273 
    274 Void TComPicYuv::dump (Char* pFileName, Bool bAdd)
     258
     259
     260// NOTE: This function is never called, but may be useful for developers.
     261Void TComPicYuv::dump (const Char* pFileName, const BitDepths &bitDepths, Bool bAdd) const
    275262{
    276263  FILE* pFile;
     
    283270    pFile = fopen (pFileName, "ab");
    284271  }
    285  
    286   Int     shift = g_bitDepthY-8;
    287   Int     offset = (shift>0)?(1<<(shift-1)):0;
    288  
    289   Int   x, y;
    290   UChar uc;
    291  
    292   Pel*  piY   = getLumaAddr();
    293   Pel*  piCb  = getCbAddr();
    294   Pel*  piCr  = getCrAddr();
    295  
    296   for ( y = 0; y < m_iPicHeight; y++ )
    297   {
    298     for ( x = 0; x < m_iPicWidth; x++ )
    299     {
    300       uc = (UChar)Clip3<Pel>(0, 255, (piY[x]+offset)>>shift);
    301      
    302       fwrite( &uc, sizeof(UChar), 1, pFile );
    303     }
    304     piY += getStride();
    305   }
    306  
    307   shift = g_bitDepthC-8;
    308   offset = (shift>0)?(1<<(shift-1)):0;
    309 
    310   for ( y = 0; y < m_iPicHeight >> 1; y++ )
    311   {
    312     for ( x = 0; x < m_iPicWidth >> 1; x++ )
    313     {
    314       uc = (UChar)Clip3<Pel>(0, 255, (piCb[x]+offset)>>shift);
    315       fwrite( &uc, sizeof(UChar), 1, pFile );
    316     }
    317     piCb += getCStride();
    318   }
    319  
    320   for ( y = 0; y < m_iPicHeight >> 1; y++ )
    321   {
    322     for ( x = 0; x < m_iPicWidth >> 1; x++ )
    323     {
    324       uc = (UChar)Clip3<Pel>(0, 255, (piCr[x]+offset)>>shift);
    325       fwrite( &uc, sizeof(UChar), 1, pFile );
    326     }
    327     piCr += getCStride();
    328   }
    329  
     272
     273
     274  for(Int chan = 0; chan < getNumberValidComponents(); chan++)
     275  {
     276    const ComponentID  ch     = ComponentID(chan);
     277    const Int          shift  = bitDepths.recon[toChannelType(ch)] - 8;
     278    const Int          offset = (shift>0)?(1<<(shift-1)):0;
     279    const Pel         *pi     = getAddr(ch);
     280    const Int          stride = getStride(ch);
     281    const Int          height = getHeight(ch);
     282    const Int          width  = getWidth(ch);
     283
     284    for (Int y = 0; y < height; y++ )
     285    {
     286      for (Int x = 0; x < width; x++ )
     287      {
     288        UChar uc = (UChar)Clip3<Pel>(0, 255, (pi[x]+offset)>>shift);
     289        fwrite( &uc, sizeof(UChar), 1, pFile );
     290      }
     291      pi += stride;
     292    }
     293  }
     294
    330295  fclose(pFile);
    331296}
    332 
    333 #if H_3D
    334 #if H_3D_IV_MERGE
     297#if NH_3D_IV_MERGE
    335298Void
    336299TComPicYuv::getTopLeftSamplePos( Int iCuAddr, Int iAbsZorderIdx, Int& riX, Int& riY )
     
    358321  riAbsZorderIdx      = g_auiRasterToZscan[ iRastPartIdx ];
    359322}
     323
    360324#endif
    361 Void TComPicYuv::setLumaTo( Pel pVal )
    362 {
    363   xSetPels( getLumaAddr(), getStride(), getWidth(), getHeight(), pVal );
    364 }
    365 
     325
     326#if NH_3D_VSO
    366327Void TComPicYuv::setChromaTo( Pel pVal )
    367328{
    368   xSetPels( getCbAddr(), getCStride(), getWidth() >> 1, getHeight() >> 1, pVal );
    369   xSetPels( getCrAddr(), getCStride(), getWidth() >> 1, getHeight() >> 1, pVal );
     329  xSetPels( getAddr( COMPONENT_Cb ), getStride( COMPONENT_Cb ), getWidth( COMPONENT_Cb), getHeight( COMPONENT_Cb ), pVal );
     330  xSetPels( getAddr( COMPONENT_Cr ), getStride( COMPONENT_Cr ), getWidth( COMPONENT_Cr), getHeight( COMPONENT_Cr ), pVal );
    370331}
    371332
     
    382343}
    383344#endif
    384 
    385345//! \}
Note: See TracChangeset for help on using the changeset viewer.