Changeset 100 in 3DVCSoftware for trunk/source/Lib/TLibRenderer


Ignore:
Timestamp:
9 Aug 2012, 12:53:16 (13 years ago)
Author:
tech
Message:

Adopted modifications:

  • disparity vector generation (A0097)
  • inter-view motion prediction modification (A0049)
  • simplification of disparity vector derivation (A0126)
  • region boundary chain coding (A0070)
  • residual skip intra (A0087)
  • VSO modification (A0033/A0093)

+ Clean ups + Bug fixes

Update of cfg files (A0033 modification 2)

Location:
trunk/source/Lib/TLibRenderer
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/source/Lib/TLibRenderer/TRenImage.cpp

    r56 r100  
    106106}
    107107
     108#if HHI_VSO_SPEEDUP_A033
     109template<typename T>
     110Void TRenImage<T>::getDataAndStrides( T** pptData, Int* piStrides )
     111{
     112  for (UInt uiCurPlane = 0; uiCurPlane < m_uiNumberOfPlanes; uiCurPlane++ )
     113  {
     114    piStrides[uiCurPlane] = m_apcPlanes[uiCurPlane]->getStride   ();
     115    pptData  [uiCurPlane] = m_apcPlanes[uiCurPlane]->getPlaneData();
     116  }
     117}
     118
     119
     120template<typename T>
     121Void TRenImage<T>::getWidthAndHeight( Int* ppiWidths, Int* ppiHeights )
     122{
     123  for (UInt uiCurPlane = 0; uiCurPlane < m_uiNumberOfPlanes; uiCurPlane++ )
     124  {
     125    ppiWidths [uiCurPlane] = m_apcPlanes[uiCurPlane]->getWidth ();
     126    ppiHeights[uiCurPlane] = m_apcPlanes[uiCurPlane]->getHeight();
     127  }
     128}
     129#endif
     130
    108131template<typename T>
    109132Void TRenImage<T>::allocatePlanes( UInt uiWidth, UInt uiHeight, UInt uiNumberOfFullPlanes, UInt uiNumberOfQuaterPlanes )
  • trunk/source/Lib/TLibRenderer/TRenImage.h

    r56 r100  
    6969  TRenImagePlane<T>** getPlanes() const;
    7070
     71#if HHI_VSO_SPEEDUP_A033
     72  Void getDataAndStrides( T**    pptData, Int*  piStrides );
     73  Void getWidthAndHeight( Int*  piWidths, Int*  piHeights );
     74#endif
     75
    7176  UInt getNumberOfPlanes()  const;
    7277  UInt getNumberOfQuaterPlanes() const;
  • trunk/source/Lib/TLibRenderer/TRenModSetupStrParser.cpp

    r56 r100  
    357357  {
    358358  case 'E':
    359     iBlendMode = -1;
     359    iBlendMode = BLEND_NONE;
    360360    break;
    361361  case 'I':
    362     iBlendMode = 0;
     362    iBlendMode = BLEND_AVRG;
    363363    break;
    364364  case 'L':
    365     iBlendMode = 1;
     365    iBlendMode = BLEND_LEFT;
    366366    break;
    367367  case 'R':
    368     iBlendMode = 2;
     368    iBlendMode = BLEND_RIGHT;
    369369    break;
    370370  default:
  • trunk/source/Lib/TLibRenderer/TRenModel.cpp

    r56 r100  
    3232 */
    3333
    34 
    35 
    3634#include "TRenImage.h"
    3735#include "TRenFilter.h"
     
    4846  m_iShiftPrec         =  0;
    4947  m_iHoleMargin        =  1;
     48  m_uiHorOff           = -1;
     49#if LGE_VSO_EARLY_SKIP_A0093
     50  m_bEarlySkip         = false;
     51#endif
    5052
    5153  // Current Error Type ///
     
    211213
    212214Void
     215#if LGE_VSO_EARLY_SKIP_A0093
     216TRenModel::create( Int iNumOfBaseViews, Int iNumOfModels, Int iWidth, Int iHeight, Int iShiftPrec, Int iHoleMargin, Bool bEarlySkip )
     217#else
    213218TRenModel::create( Int iNumOfBaseViews, Int iNumOfModels, Int iWidth, Int iHeight, Int iShiftPrec, Int iHoleMargin )
     219#endif
    214220{
    215221  m_iNumOfBaseViews     = iNumOfBaseViews;
     
    219225  m_iShiftPrec          = iShiftPrec;
    220226  m_iHoleMargin         = iHoleMargin;
     227#if LGE_VSO_EARLY_SKIP_A0093
     228  m_bEarlySkip          = bEarlySkip;
     229#endif
     230
    221231
    222232// LUTs for sub pel shifting
     
    231241
    232242  TRenFilter::setSubPelShiftLUT( m_iShiftPrec, m_aaaiSubPelShiftLut[0], 0 );
    233   TRenFilter::setSubPelShiftLUT( m_iShiftPrec, m_aaaiSubPelShiftLut[1], -1);
     243  TRenFilter::setSubPelShiftLUT( m_iShiftPrec, m_aaaiSubPelShiftLut[1], 0 );
    234244
    235245  m_iSampledWidth       = iWidth << m_iShiftPrec;
     
    268278  for (Int iModelNum = 0; iModelNum < m_iNumOfRenModels; iModelNum++)
    269279  {
    270     m_apcRenModels         [iModelNum] = new TRenSingleModel();
     280    m_apcRenModels         [iModelNum] = NULL;
    271281  }
    272282
     
    339349
    340350  AOT( iMode == -1);
    341   AOT( iModelNum < 0 || iModelNum > m_iNumOfRenModels );
    342   AOF( m_apcRenModels[iModelNum] );
     351  AOT( iModelNum < 0 || iModelNum > m_iNumOfRenModels ); 
    343352  AOT( iLeftViewNum  < -1 || iLeftViewNum  > m_iNumOfBaseViews );
    344353  AOT( iRightViewNum < -1 || iRightViewNum > m_iNumOfBaseViews );
     
    348357  AOT( iBlendMode < -1 || iBlendMode > 2 );
    349358
     359  Bool bBitInc = (g_uiBitIncrement != 0);
     360
     361  AOT( m_apcRenModels[iModelNum] );
     362
     363  if ( bBitInc )
     364  {
     365    if ( iMode != 2 )
     366    { // No Blending
     367      m_apcRenModels[iModelNum]   = new TRenSingleModelC<BLEND_NONE, true>;
     368    }
     369    else
     370    {
     371      switch ( iBlendMode )
     372      {
     373      case BLEND_AVRG: // average
     374        m_apcRenModels[iModelNum] = new TRenSingleModelC<BLEND_AVRG, true>;       
     375        break;
     376      case BLEND_LEFT: // left  view is main view
     377        m_apcRenModels[iModelNum] = new TRenSingleModelC<BLEND_LEFT, true>;       
     378        break;
     379      case BLEND_RIGHT: // right view is main view
     380        m_apcRenModels[iModelNum] = new TRenSingleModelC<BLEND_RIGHT, true>;       
     381        break;
     382      default:
     383        AOT(true);
     384        break;
     385      }   
     386    }
     387  }
     388  else
     389  {
     390    if ( iMode != 2 )
     391    { // No Blending
     392      m_apcRenModels[iModelNum] = new TRenSingleModelC<BLEND_NONE, false>;
     393    }
     394    else
     395    {
     396      switch ( iBlendMode )
     397      {
     398      case BLEND_AVRG: // average
     399        m_apcRenModels[iModelNum] = new TRenSingleModelC<BLEND_AVRG, false>;       
     400        break;
     401      case BLEND_LEFT: // left  view is main view
     402        m_apcRenModels[iModelNum] = new TRenSingleModelC<BLEND_LEFT, false>;       
     403        break;
     404      case BLEND_RIGHT: // right view is main view
     405        m_apcRenModels[iModelNum] = new TRenSingleModelC<BLEND_RIGHT, false>;       
     406        break;
     407      default:
     408        AOT(true);
     409        break;
     410      }   
     411    }
     412  }
     413
     414
     415#if LGE_VSO_EARLY_SKIP_A0093
     416  m_apcRenModels[iModelNum]->create( iMode ,m_iWidth, m_iHeight, m_iShiftPrec, m_aaaiSubPelShiftLut, m_iHoleMargin,  bUseOrgRef, iBlendMode, m_bEarlySkip );
     417#else
    350418  m_apcRenModels[iModelNum]->create( iMode ,m_iWidth, m_iHeight, m_iShiftPrec, m_aaaiSubPelShiftLut, m_iHoleMargin,  bUseOrgRef, iBlendMode );
     419#endif
    351420
    352421  if ( iLeftViewNum != -1 )
     
    361430}
    362431
    363 
    364432Void
    365433TRenModel::setBaseView( Int iViewNum, TComPicYuv* pcPicYuvVideoData, TComPicYuv* pcPicYuvDepthData, TComPicYuv* pcPicYuvOrgVideoData, TComPicYuv* pcPicYuvOrgDepthData )
    366434{
    367435  AOT( iViewNum < 0 || iViewNum > m_iNumOfBaseViews );
    368   AOF( pcPicYuvVideoData->getHeight() == m_iHeight || pcPicYuvVideoData->getWidth() == m_iWidth );
    369   AOF( pcPicYuvDepthData->getHeight() == m_iHeight || pcPicYuvDepthData->getWidth() == m_iWidth );
     436  AOF( pcPicYuvVideoData->getHeight() <= m_iHeight + m_uiHorOff || pcPicYuvVideoData->getWidth() == m_iWidth );
     437  AOF( pcPicYuvDepthData->getHeight() <= m_iHeight + m_uiHorOff || pcPicYuvDepthData->getWidth() == m_iWidth );
    370438
    371439  pcPicYuvVideoData->extendPicBorder();
    372   TRenFilter::sampleHorUp   ( m_iShiftPrec, pcPicYuvVideoData->getLumaAddr(), pcPicYuvVideoData->getStride() , m_iWidth,      m_iHeight,      m_aapiCurVideoPel[ iViewNum ][0], m_aaiCurVideoStrides[iViewNum][0] );
    373   TRenFilter::sampleCUpHorUp( m_iShiftPrec, pcPicYuvVideoData->getCbAddr()  , pcPicYuvVideoData->getCStride(), m_iWidth >> 1, m_iHeight >> 1, m_aapiCurVideoPel[ iViewNum ][1], m_aaiCurVideoStrides[iViewNum][1] );
    374   TRenFilter::sampleCUpHorUp( m_iShiftPrec, pcPicYuvVideoData->getCrAddr()  , pcPicYuvVideoData->getCStride(), m_iWidth >> 1, m_iHeight >> 1, m_aapiCurVideoPel[ iViewNum ][2], m_aaiCurVideoStrides[iViewNum][2] );
    375   TRenFilter::copy          (               pcPicYuvDepthData->getLumaAddr(), pcPicYuvDepthData->getStride(),   m_iWidth,     m_iHeight,      m_apiCurDepthPel [ iViewNum],     m_aiCurDepthStrides [iViewNum]    );
     440
     441 
     442
     443
     444  TRenFilter::sampleHorUp   ( m_iShiftPrec, pcPicYuvVideoData->getLumaAddr() +  m_uiHorOff        * pcPicYuvVideoData->getStride () , pcPicYuvVideoData->getStride() , m_iWidth,      m_iHeight,      m_aapiCurVideoPel[ iViewNum ][0], m_aaiCurVideoStrides[iViewNum][0] );
     445  TRenFilter::sampleCUpHorUp( m_iShiftPrec, pcPicYuvVideoData->getCbAddr()   + (m_uiHorOff >> 1 ) * pcPicYuvVideoData->getCStride() , pcPicYuvVideoData->getCStride(), m_iWidth >> 1, m_iHeight >> 1, m_aapiCurVideoPel[ iViewNum ][1], m_aaiCurVideoStrides[iViewNum][1] );
     446  TRenFilter::sampleCUpHorUp( m_iShiftPrec, pcPicYuvVideoData->getCrAddr()   + (m_uiHorOff >> 1 ) * pcPicYuvVideoData->getCStride() , pcPicYuvVideoData->getCStride(), m_iWidth >> 1, m_iHeight >> 1, m_aapiCurVideoPel[ iViewNum ][2], m_aaiCurVideoStrides[iViewNum][2] );
     447  TRenFilter::copy          (               pcPicYuvDepthData->getLumaAddr() +  m_uiHorOff        * pcPicYuvDepthData->getStride () , pcPicYuvDepthData->getStride(),  m_iWidth,      m_iHeight,      m_apiCurDepthPel [ iViewNum],     m_aiCurDepthStrides [iViewNum]    );
    376448
    377449  // Used for rendering reference pic from original video data
     
    381453  if ( m_abSetupVideoFromOrgForView[iViewNum] )
    382454  {
    383     AOF( pcPicYuvOrgVideoData->getHeight() == m_iHeight || pcPicYuvOrgVideoData->getWidth() == m_iWidth );
     455    AOF( pcPicYuvOrgVideoData->getHeight() <= m_iHeight + m_uiHorOff || pcPicYuvOrgVideoData->getWidth() == m_iWidth );
    384456    pcPicYuvOrgVideoData->extendPicBorder();
    385     TRenFilter::sampleHorUp   ( m_iShiftPrec, pcPicYuvOrgVideoData->getLumaAddr(), pcPicYuvOrgVideoData->getStride() , m_iWidth,      m_iHeight,      m_aapiOrgVideoPel[ iViewNum ][0], m_aaiOrgVideoStrides[iViewNum][0] );
    386     TRenFilter::sampleCUpHorUp( m_iShiftPrec, pcPicYuvOrgVideoData->getCbAddr()  , pcPicYuvOrgVideoData->getCStride(), m_iWidth >> 1, m_iHeight >> 1, m_aapiOrgVideoPel[ iViewNum ][1], m_aaiOrgVideoStrides[iViewNum][1] );
    387     TRenFilter::sampleCUpHorUp( m_iShiftPrec, pcPicYuvOrgVideoData->getCrAddr()  , pcPicYuvOrgVideoData->getCStride(), m_iWidth >> 1, m_iHeight >> 1, m_aapiOrgVideoPel[ iViewNum ][2], m_aaiOrgVideoStrides[iViewNum][2] );
     457    TRenFilter::sampleHorUp   ( m_iShiftPrec, pcPicYuvOrgVideoData->getLumaAddr() +  m_uiHorOff        * pcPicYuvOrgVideoData->getStride() , pcPicYuvOrgVideoData->getStride() , m_iWidth,      m_iHeight,      m_aapiOrgVideoPel[ iViewNum ][0], m_aaiOrgVideoStrides[iViewNum][0] );
     458    TRenFilter::sampleCUpHorUp( m_iShiftPrec, pcPicYuvOrgVideoData->getCbAddr()   + (m_uiHorOff >> 1 ) * pcPicYuvOrgVideoData->getCStride(), pcPicYuvOrgVideoData->getCStride(), m_iWidth >> 1, m_iHeight >> 1, m_aapiOrgVideoPel[ iViewNum ][1], m_aaiOrgVideoStrides[iViewNum][1] );
     459    TRenFilter::sampleCUpHorUp( m_iShiftPrec, pcPicYuvOrgVideoData->getCrAddr()   + (m_uiHorOff >> 1 ) * pcPicYuvOrgVideoData->getCStride(), pcPicYuvOrgVideoData->getCStride(), m_iWidth >> 1, m_iHeight >> 1, m_aapiOrgVideoPel[ iViewNum ][2], m_aaiOrgVideoStrides[iViewNum][2] );
    388460  }
    389461
    390462  if ( m_abSetupDepthFromOrgForView[iViewNum] )
    391463  {
    392     AOF( pcPicYuvOrgDepthData->getHeight() == m_iHeight || pcPicYuvOrgDepthData->getWidth() == m_iWidth );
    393     TRenFilter::copy          (               pcPicYuvOrgDepthData->getLumaAddr(), pcPicYuvOrgDepthData->getStride(),  m_iWidth,     m_iHeight,      m_apiOrgDepthPel [ iViewNum],     m_aiOrgDepthStrides [iViewNum]    );
     464    AOF( pcPicYuvOrgDepthData->getHeight() <= m_iHeight + m_uiHorOff || pcPicYuvOrgDepthData->getWidth() == m_iWidth );
     465    TRenFilter::copy          (               pcPicYuvOrgDepthData->getLumaAddr() +  m_uiHorOff        * pcPicYuvOrgDepthData->getStride() , pcPicYuvOrgDepthData->getStride(),  m_iWidth,     m_iHeight,      m_apiOrgDepthPel [ iViewNum],     m_aiOrgDepthStrides [iViewNum]    );
    394466  }
    395467}
     
    404476  for (Int iBaseViewIdx = 0; iBaseViewIdx < m_iNumOfBaseViews; iBaseViewIdx++ )
    405477  {
     478
    406479    Bool bSetupFromOrgVideo = m_abSetupVideoFromOrgForView[iBaseViewIdx];
    407480    Bool bSetupFromOrgDepth = m_abSetupDepthFromOrgForView[iBaseViewIdx];
    408 
    409     if ( ( bSetupFromOrgVideo || bSetupFromOrgDepth ) && m_aaeBaseViewPosInModel[iBaseViewIdx][iModelNum] != VIEWPOS_INVALID )
     481    bAnyRefFromOrg          = bAnyRefFromOrg || bSetupFromOrgVideo || bSetupFromOrgDepth;
     482
     483    if ( m_aaeBaseViewPosInModel[iBaseViewIdx][iModelNum] != VIEWPOS_INVALID )
    410484    {
    411485      bAnyRefFromOrg = true;
     
    418492  }
    419493
    420   m_apcRenModels[iModelNum]->setup     ( pcPicYuvRefView, ppiShiftLutLeft, ppiBaseShiftLutLeft, ppiShiftLutRight, ppiBaseShiftLutRight, iDistToLeft, false );
     494  m_apcRenModels[iModelNum]->setup     ( pcPicYuvRefView, ppiShiftLutLeft, ppiBaseShiftLutLeft, ppiShiftLutRight, ppiBaseShiftLutRight, iDistToLeft, false, m_uiHorOff );
    421495
    422496  // Setup to Org
     
    438512    }
    439513
    440     // setup keeping reference from original data
    441     m_apcRenModels[iModelNum]->setup     ( pcPicYuvRefView, ppiShiftLutLeft, ppiBaseShiftLutLeft, ppiShiftLutRight, ppiBaseShiftLutRight, iDistToLeft, true );
     514    // setup keeping reference rendered from original data
     515    m_apcRenModels[iModelNum]->setup     ( pcPicYuvRefView, ppiShiftLutLeft, ppiBaseShiftLutLeft, ppiShiftLutRight, ppiBaseShiftLutRight, iDistToLeft, true, m_uiHorOff);
    442516  }
    443517}
     
    468542}
    469543
     544
     545Void 
     546TRenModel::setHorOffset     ( UInt uiHorOff )
     547{
     548    m_uiHorOff = uiHorOff;
     549}
     550
     551#if LGE_VSO_EARLY_SKIP_A0093
     552RMDist
     553TRenModel::getDist( Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, Pel* piNewData, Pel * piOrgData, Int iOrgStride)
     554#else
    470555RMDist
    471556TRenModel::getDist( Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, Pel* piNewData )
    472 {
     557#endif
     558{
     559  iStartPosY -= m_uiHorOff;
     560
    473561  AOT( iWidth  + iStartPosX > m_iWidth  );
    474562  AOT( iHeight + iStartPosY > m_iHeight );
     
    484572    if (m_iCurrentContent == 1)
    485573    {
     574#if LGE_VSO_EARLY_SKIP_A0093
     575      iDist +=  m_apcCurRenModels[iModelNum]->getDistDepth  ( m_aiCurPosInModels[iModelNum], iStartPosX, iStartPosY,  iWidth,  iHeight,  iStride,  piNewData , piOrgData, iOrgStride);
     576#else
    486577      iDist +=  m_apcCurRenModels[iModelNum]->getDistDepth  ( m_aiCurPosInModels[iModelNum], iStartPosX, iStartPosY,  iWidth,  iHeight,  iStride,  piNewData );
     578#endif
    487579    }
    488580    else
     
    498590TRenModel::setData( Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, Pel* piNewData )
    499591{
     592  iStartPosY -= m_uiHorOff;
     593
    500594  iWidth  = min(iWidth , m_iWidth  - iStartPosX );
    501595  iHeight = min(iHeight, m_iHeight - iStartPosY );
     
    510604    if (m_iCurrentContent == 1)
    511605    {
     606#ifdef LGE_VSO_EARLY_SKIP_A0093
     607      Int iTargetStride = m_aiCurDepthStrides[ m_iCurrentView ];
     608      m_apcCurRenModels[iModelNum]->setDepth  ( m_aiCurPosInModels[iModelNum], iStartPosX, iStartPosY, iWidth, iHeight, iStride, piNewData,m_apiCurDepthPel[ m_iCurrentView ] + iStartPosY * iTargetStride + iStartPosX ,iTargetStride );
     609#else
    512610      m_apcCurRenModels[iModelNum]->setDepth  ( m_aiCurPosInModels[iModelNum], iStartPosX, iStartPosY, iWidth, iHeight, iStride, piNewData );
    513 
     611#endif
    514612    }
    515613    else
     
    519617  }
    520618
     619#ifdef LGE_VSO_EARLY_SKIP_A0093
    521620  if (m_iCurrentContent == 1)
    522621  {
     
    524623    TRenFilter::copy( piNewData, iStride, iWidth, iHeight,  m_apiCurDepthPel[ m_iCurrentView ] + iStartPosY * iTargetStride + iStartPosX, iTargetStride );
    525624  }
    526   else
    527   {
    528     Int iTargetStride = m_aaiCurVideoStrides[ m_iCurrentView ][m_iCurrentPlane];
    529     TRenFilter::copy( piNewData, iStride, iWidth, iHeight,  m_aapiCurVideoPel[ m_iCurrentView ][m_iCurrentPlane] + iStartPosY * iTargetStride + iStartPosX, iTargetStride);
    530   }
    531 }
    532 
    533 Void
    534 TRenModel::getSynthVideo( Int iModelNum, Int iViewNum, TComPicYuv*& rpcPicYuvSynthVideo )
    535 {
    536   Pel** ppiSynthVideoPel = NULL;
    537   Pel*  ppiSynthDepthPel = NULL;
    538   Int   iStride          = -1;
    539   Int   aiStrides[3];
    540 
    541   m_apcRenModels[iModelNum]->getSynthView(iViewNum, ppiSynthVideoPel, ppiSynthDepthPel, iStride );
    542 
    543   aiStrides[0] = iStride; aiStrides[1] = iStride; aiStrides[2] = iStride;
    544   xCopy2PicYuv( ppiSynthVideoPel, aiStrides, rpcPicYuvSynthVideo  );
    545 }
    546 
    547 Void
    548 TRenModel::getSynthDepth( Int iModelNum, Int iViewNum, TComPicYuv*& rpcPicYuvSynthDepth )
    549 {
    550   Pel** ppiSynthVideoPel = NULL;
    551   Pel*  piSynthDepthPel  = NULL;
    552   Int   iStride          = -1;
    553 
    554   m_apcRenModels[iModelNum]->getSynthView(iViewNum, ppiSynthVideoPel, piSynthDepthPel, iStride );
    555   TRenFilter::copy( piSynthDepthPel, iStride, m_iWidth, m_iHeight, rpcPicYuvSynthDepth->getLumaAddr(), rpcPicYuvSynthDepth->getStride() );
    556   rpcPicYuvSynthDepth->setChromaTo( 128 << g_uiBitIncrement );
    557 }
    558 
     625#endif
     626}
     627
     628Void
     629TRenModel::getSynthVideo( Int iModelNum, Int iViewNum, TComPicYuv* pcPicYuv )
     630{
     631  m_apcRenModels[iModelNum]->getSynthVideo(iViewNum, pcPicYuv, m_uiHorOff );
     632}
     633
     634Void
     635TRenModel::getSynthDepth( Int iModelNum, Int iViewNum, TComPicYuv* pcPicYuv )
     636{
     637#if HHI_VSO_SPEEDUP_A033
     638  m_apcRenModels[iModelNum]->getSynthDepth(iViewNum, pcPicYuv, m_uiHorOff );
     639#else
     640  m_apcRenModels[iModelNum]->getSynthDepth(iViewNum, pcPicYuv );
     641#endif
     642}
    559643
    560644Void
     
    573657  for (Int iCurModel = 0; iCurModel < m_iNumOfCurRenModels; iCurModel++)
    574658  {
    575     Pel** ppiSynthVideoPel = NULL;
    576     Pel*  ppiSynthDepthPel = NULL;
    577     Pel** ppiRefVideoPel   = NULL;
    578     Int   iSynStride       = -1;
    579     Int*  piRefStrides     = NULL;
    580     Int   aiSynStrides[3];
    581 
    582     m_apcCurRenModels[iCurModel]->getSynthView( m_aiCurPosInModels[iCurModel], ppiSynthVideoPel, ppiSynthDepthPel, iSynStride );
    583     aiSynStrides[0] = iSynStride; aiSynStrides[1] = iSynStride; aiSynStrides[2] = iSynStride;
    584     xCopy2PicYuv( ppiSynthVideoPel, aiSynStrides,  &cPicYuvSynth );
    585 
    586     TComPicYuv* pcPicYuvOrgRef;
    587     TComPicYuv* pcPicYuvRef;
    588     m_apcCurRenModels[iCurModel]->getRefView  ( pcPicYuvOrgRef, ppiRefVideoPel, piRefStrides );
    589 
    590     if (!pcPicYuvOrgRef )
    591     {
    592       xCopy2PicYuv( ppiRefVideoPel, piRefStrides,  &cPicYuvTempRef);
    593       pcPicYuvRef = &cPicYuvTempRef;
    594     }
    595     else
    596     {
    597       pcPicYuvRef = pcPicYuvOrgRef;
    598     }
     659    m_apcCurRenModels[iCurModel]->getSynthVideo( m_aiCurPosInModels[iCurModel], &cPicYuvSynth, 0 );
     660    TComPicYuv* pcPicYuvRef = &cPicYuvTempRef;
     661    m_apcCurRenModels[iCurModel]->getRefVideo  ( m_aiCurPosInModels[iCurModel], pcPicYuvRef  , 0 );
    599662
    600663    iSSEY += TRenFilter::SSE( cPicYuvSynth.getLumaAddr(), cPicYuvSynth.getStride(),  m_iWidth,      m_iHeight     , pcPicYuvRef->getLumaAddr(), pcPicYuvRef->getStride() );
     
    620683  m_aaeBaseViewPosInModel[iBaseViewNum][iModelNum] = iViewPos;
    621684
    622   m_apcRenModels[iModelNum]->setLRView( iViewPos, m_aapiCurVideoPel[iBaseViewNum], m_aaiCurVideoStrides[iBaseViewNum], m_apiCurDepthPel[iBaseViewNum], m_aiCurDepthStrides [iBaseViewNum] );
    623 
    624685  if (bAdd)
    625686  {
     
    639700  }
    640701}
    641 
    642 Void
    643 TRenModel::xCopy2PicYuv( Pel** ppiSrcVideoPel, Int* piStrides, TComPicYuv* rpcPicYuvTarget )
    644 {
    645   TRenFilter::copy            ( ppiSrcVideoPel[0], piStrides[0], m_iWidth, m_iHeight, rpcPicYuvTarget->getLumaAddr(), rpcPicYuvTarget->getStride() );
    646   TRenFilter::sampleDown2Tap13( ppiSrcVideoPel[1], piStrides[1], m_iWidth, m_iHeight, rpcPicYuvTarget->getCbAddr  (), rpcPicYuvTarget->getCStride() );
    647   TRenFilter::sampleDown2Tap13( ppiSrcVideoPel[2], piStrides[2], m_iWidth, m_iHeight, rpcPicYuvTarget->getCrAddr  (), rpcPicYuvTarget->getCStride() );
    648 }
  • trunk/source/Lib/TLibRenderer/TRenModel.h

    r56 r100  
    5050
    5151  // Creation
     52#if LGE_VSO_EARLY_SKIP_A0093
     53  Void  create           ( Int iNumOfBaseViews, Int iNumOfModels, Int iWidth, Int iHeight, Int iShiftPrec, Int iHoleMargin, Bool bEarlySkip );
     54#else
    5255  Void  create           ( Int iNumOfBaseViews, Int iNumOfModels, Int iWidth, Int iHeight, Int iShiftPrec, Int iHoleMargin );
     56#endif
    5357  Void  createSingleModel( Int iBaseViewNum, Int iContent, Int iModelNum, Int iLeftViewNum, Int iRightViewNum, Bool bUseOrgRef, Int iBlendMode );
    5458
     
    5761  Void  setSingleModel   ( Int iModelNum, Int** ppiShiftLutLeft, Int** ppiBaseShiftLutLeft, Int** ppiShiftLutRight, Int** ppiBaseShiftLutRight, Int iDistToLeft, TComPicYuv* pcPicYuvRefView );
    5862
     63  // Set horizontal offset
     64  Void  setHorOffset     ( UInt uiHorOff );
     65
    5966  // Set Mode
    6067  Void  setErrorMode     ( Int iView, Int iContent, int iPlane );
    6168
    6269  // Get Distortion, set Data
     70#ifdef LGE_VSO_EARLY_SKIP_A0093
     71  Int64 getDist          ( Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, Pel* piNewData, Pel * piOrgData, Int iOrgStride);
     72#else
    6373  Int64 getDist          ( Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, Pel* piNewData  );
     74#endif
    6475  Void  setData          ( Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, Pel* piNewData  );
    6576
    6677  // Get Rendered View
    67   Void  getSynthVideo    ( Int iModelNum, Int iViewNum, TComPicYuv*& rpcPicYuvSynthVideo );
    68   Void  getSynthDepth    ( Int iModelNum, Int iViewNum, TComPicYuv*& rpcPicYuvSynthDepth );
     78
     79  Void  getSynthVideo    ( Int iModelNum, Int iViewNum, TComPicYuv* pcPicYuvSynthVideo );
     80  Void  getSynthDepth    ( Int iModelNum, Int iViewNum, TComPicYuv* pcPicYuvSynthDepth );
    6981
    7082  // Get Total Distortion
     
    7486  // helpers
    7587  Void xSetLRViewAndAddModel( Int iModelNum, Int iBaseViewNum, Int iContent, Int iViewPos, Bool bAdd );
    76   Void xCopy2PicYuv ( Pel** ppiSrcVideoPel, Int* piStrides, TComPicYuv* rpcPicYuvTarget );
    7788
    7889  // Settings
     
    8091  Int**  m_aaaiSubPelShiftLut[2];
    8192  Int    m_iHoleMargin;
     93#if LGE_VSO_EARLY_SKIP_A0093
     94  Bool   m_bEarlySkip;
     95#endif
    8296
    8397  /// Size of Video and Depth
     
    88102
    89103  Int m_iNumOfBaseViews;
     104
     105#if HHI_VSO_SPEEDUP_A033                 
     106  // Horizontal Offset in input data
     107  UInt m_uiHorOff;         
     108#endif
    90109
    91110  /// Current Error Type ///
  • trunk/source/Lib/TLibRenderer/TRenSingleModel.cpp

    r81 r100  
    3232 */
    3333
    34 
    3534#include "TRenImage.h"
    3635#include "TRenFilter.h"
     
    3837
    3938////////////// TRENSINGLE MODEL ///////////////
    40 TRenSingleModel::TRenSingleModel()
     39template <BlenMod iBM, Bool bBitInc>
     40TRenSingleModelC<iBM,bBitInc>::TRenSingleModelC()
    4141:  m_iDistShift ( g_uiBitIncrement << 1 )
    4242{
     
    5050
    5151  m_pcPicYuvRef          = NULL;
     52
     53  m_pcOutputSamples      = NULL;
     54  m_pcOutputSamplesRow   = NULL;   
     55  m_iOutputSamplesStride = -1;
     56
     57  m_ppiCurLUT            = NULL;
     58  m_piInvZLUTLeft        = NULL;
     59  m_piInvZLUTRight       = NULL;
     60
    5261  m_aapiRefVideoPel[0]   = NULL;
    5362  m_aapiRefVideoPel[1]   = NULL;
    5463  m_aapiRefVideoPel[2]   = NULL;
    5564
    56 
    5765  m_aiRefVideoStrides[0] = -1;
    5866  m_aiRefVideoStrides[1] = -1;
    5967  m_aiRefVideoStrides[2] = -1;
    6068
     69
    6170  for (UInt uiViewNum = 0 ; uiViewNum < 2; uiViewNum++)
    6271  {
    6372    // LUT
    6473    m_appiShiftLut[uiViewNum] = NULL;
     74
     75    m_pcInputSamples[uiViewNum] = NULL;
     76    m_iInputSamplesStride       = -1;
     77
    6578    m_ppiCurLUT               = NULL;
    6679    m_piInvZLUTLeft           = NULL;
    6780    m_piInvZLUTRight          = NULL;
    68 
    69     // Cur Data
    70     m_apiBaseDepthPel      [uiViewNum] = NULL;
    71     m_aiBaseDepthStrides   [uiViewNum] = -1;
    72 
    73     // State Data
    74     m_apbOccluded          [uiViewNum] = NULL;
    75     m_apiFilled            [uiViewNum] = NULL;
    76 
    77     // Cur Data
    78     m_aapiBaseVideoPel     [uiViewNum] = NULL;
    79     m_aaiBaseVideoStrides  [uiViewNum] = NULL;
    80   };
    81 
    82   m_piError                            = NULL;
    83 
    84   for (UInt uiViewNum = 0 ; uiViewNum < 3; uiViewNum++)
    85   {
    86     m_apiSynthDepthPel[uiViewNum] = NULL;
    87     for (UInt uiPlaneNum = 0; uiPlaneNum < 3; uiPlaneNum++)
    88     {
    89       // Rendered Data
    90       m_aapiSynthVideoPel[uiViewNum][uiPlaneNum] = NULL;
    91     }
    92   }
    93 }
    94 
    95 TRenSingleModel::~TRenSingleModel()
    96 {
    97   if ( m_apbOccluded[0] ) delete[] m_apbOccluded[0];
    98   if ( m_apbOccluded[1] ) delete[] m_apbOccluded[1];
    99 
    100   if ( m_apiFilled  [0] ) delete[] m_apiFilled  [0];
    101   if ( m_apiFilled  [1] ) delete[] m_apiFilled  [1];
    102 
    103   if ( m_piError        ) delete[] m_piError      ;
    104 
    105 
    106   for (UInt uiViewNum = 0 ; uiViewNum < 3; uiViewNum++)
    107   {
    108     for (UInt uiPlaneNum = 0; uiPlaneNum < 3; uiPlaneNum++)
    109     {
    110       if ( m_aapiSynthVideoPel[uiViewNum] && m_aapiSynthVideoPel[uiViewNum][uiPlaneNum] ) delete[] m_aapiSynthVideoPel[uiViewNum][uiPlaneNum];
    111     }
    112     if ( m_apiSynthDepthPel[uiViewNum] ) delete[] m_apiSynthDepthPel[uiViewNum];
    113   }
    114 
    115   delete[] (m_aapiRefVideoPel[0] - m_iPad * m_aiRefVideoStrides[0] - m_iPad );
    116   delete[] (m_aapiRefVideoPel[1] - m_iPad * m_aiRefVideoStrides[1] - m_iPad );
    117   delete[] (m_aapiRefVideoPel[2] - m_iPad * m_aiRefVideoStrides[2] - m_iPad );
    118 
    119   if ( m_piInvZLUTLeft  ) delete[] m_piInvZLUTLeft;
    120   if ( m_piInvZLUTRight ) delete[] m_piInvZLUTRight;
    121 }
    122 
    123 Void
    124 TRenSingleModel::create( Int iMode, Int iWidth, Int iHeight, Int iShiftPrec, Int*** aaaiSubPelShiftTable, Int iHoleMargin, Bool bUseOrgRef, Int iBlendMode )
    125 {
    126   m_iBlendMode = iBlendMode;
     81  }
     82
     83#ifdef LGE_VSO_EARLY_SKIP_A0093
     84  m_pbHorSkip = NULL;
     85#endif
     86}
     87
     88template <BlenMod iBM, Bool bBitInc>
     89TRenSingleModelC<iBM,bBitInc>::~TRenSingleModelC()
     90{
     91#ifdef LGE_VSO_EARLY_SKIP_A0093
     92  if (m_pbHorSkip)
     93  {
     94    delete[] m_pbHorSkip;
     95    m_pbHorSkip = NULL;
     96  }
     97#endif
     98
     99  if ( m_pcInputSamples [0] ) delete[] m_pcInputSamples [0];
     100  if ( m_pcInputSamples [1] ) delete[] m_pcInputSamples [1];
     101  if ( m_pcOutputSamples    ) delete   m_pcOutputSamples   ;
     102}
     103
     104template <BlenMod iBM, Bool bBitInc> Void
     105#if LGE_VSO_EARLY_SKIP_A0093
     106TRenSingleModelC<iBM,bBitInc>::create( Int iMode, Int iWidth, Int iHeight, Int iShiftPrec, Int*** aaaiSubPelShiftTable, Int iHoleMargin, Bool bUseOrgRef, Int iBlendMode, Bool bEarlySkip )
     107#else
     108TRenSingleModelC<iBM,bBitInc>::create( Int iMode, Int iWidth, Int iHeight, Int iShiftPrec, Int*** aaaiSubPelShiftTable, Int iHoleMargin, Bool bUseOrgRef, Int iBlendMode )
     109#endif
     110
     111{
     112#if LGE_VSO_EARLY_SKIP_A0093
     113  m_pbHorSkip     = new Bool [MAX_CU_SIZE];
     114  m_bEarlySkip    = bEarlySkip;
     115#endif
     116
     117  AOF( iBlendMode == iBM );
     118
    127119  m_iMode = iMode;
     120
    128121  m_iWidth  = iWidth;
    129122  m_iHeight = iHeight;
     
    160153  m_aapiRefVideoPel  [2] += m_aiRefVideoStrides[2] * m_iPad + m_iPad;
    161154
    162   m_piError               = new Int [m_iStride*m_iHeight];
    163 
    164   // Create Buffers
    165   if ( (m_iMode == 0) || (m_iMode == 2 ) )
    166   {
    167     m_apbOccluded        [0]  = new Bool[m_iStride*m_iHeight];
    168     m_apiFilled          [0]  = new Pel [m_iStride*m_iHeight];
    169 
    170     for (UInt uiPlaneNum = 0; uiPlaneNum < 3; uiPlaneNum++)
    171     {
    172       m_aapiSynthVideoPel[0][uiPlaneNum] = new Pel[m_iStride*m_iHeight];
    173     }
    174   }
    175 
    176   if ( (m_iMode == 1) || (m_iMode == 2 ) )
    177   {
    178     m_apbOccluded        [1]  = new Bool[m_iStride*m_iHeight];
    179     m_apiFilled          [1]  = new Pel [m_iStride*m_iHeight];
    180 
    181     for (UInt uiPlaneNum = 0; uiPlaneNum < 3; uiPlaneNum++)
    182     {
    183       m_aapiSynthVideoPel[1][uiPlaneNum] = new Pel[m_iStride*m_iHeight];
    184     }
    185   }
    186 
    187   if ( m_iMode == 2 )
    188   {
    189     m_apiSynthDepthPel[0] = new Pel[m_iStride*m_iHeight];
    190     m_apiSynthDepthPel[1] = new Pel[m_iStride*m_iHeight];
    191     m_apiSynthDepthPel[2] = new Pel[m_iStride*m_iHeight];
    192 
    193     for (UInt uiPlaneNum = 0; uiPlaneNum < 3; uiPlaneNum++)
    194     {
    195       m_aapiSynthVideoPel[2][uiPlaneNum] = new Pel[m_iStride*m_iHeight];
    196     }
    197   }
    198 }
    199 
    200 Void
    201 TRenSingleModel::setLRView( Int iViewPos, Pel** apiCurVideoPel, Int* aiCurVideoStride, Pel* piCurDepthPel, Int iCurDepthStride )
     155  m_iInputSamplesStride  = m_iWidth+1;
     156  m_iOutputSamplesStride = m_iWidth;
     157
     158  m_pcInputSamples[0]     = new RenModelInPels[m_iInputSamplesStride*m_iHeight];
     159  m_pcInputSamples[1]     = new RenModelInPels[m_iInputSamplesStride*m_iHeight];
     160
     161  m_pcOutputSamples       = new RenModelOutPels[m_iOutputSamplesStride*m_iHeight]; 
     162}
     163
     164template <BlenMod iBM, Bool bBitInc> Void
     165TRenSingleModelC<iBM,bBitInc>::setLRView( Int iViewPos, Pel** apiCurVideoPel, Int* aiCurVideoStride, Pel* piCurDepthPel, Int iCurDepthStride )
    202166{
    203167  AOF(( iViewPos == 0) || (iViewPos == 1) );
     168
     169  RenModelInPels* pcCurInputSampleRow = m_pcInputSamples[iViewPos];
     170 
     171  Pel* piDRow = piCurDepthPel;
     172  Pel* piYRow = apiCurVideoPel[0];
     173#if HHI_VSO_COLOR_PLANES
     174  Pel* piURow = apiCurVideoPel[1];
     175  Pel* piVRow = apiCurVideoPel[2];
     176#endif 
     177
     178
     179  Int iOffsetX = ( iViewPos == VIEWPOS_RIGHT ) ? 1 : 0;
     180
     181  for ( Int iPosY = 0; iPosY < m_iHeight; iPosY++ )
     182  {
     183    if ( iViewPos == VIEWPOS_RIGHT )
     184    {
     185      Int iSubPosX = (1 << m_iShiftPrec);
     186      pcCurInputSampleRow[0].aiY[iSubPosX] = piYRow[0];
     187#if HHI_VSO_COLOR_PLANES
     188      pcCurInputSampleRow[0].aiU[iSubPosX] = piURow[0];
     189      pcCurInputSampleRow[0].aiV[iSubPosX] = piVRow[0];
     190#endif
     191    }
     192
     193    for ( Int iPosX = 0; iPosX < m_iWidth; iPosX++ )
     194    {
     195      pcCurInputSampleRow[iPosX].iD = piDRow[iPosX];
     196
     197      for (Int iSubPosX = 0; iSubPosX < (1 << m_iShiftPrec)+1; iSubPosX++ )
     198      {
     199        Int iShift = (iPosX << m_iShiftPrec) + iSubPosX;
     200        pcCurInputSampleRow[iPosX+iOffsetX].aiY[iSubPosX] = piYRow[iShift];
     201#if HHI_VSO_COLOR_PLANES
     202        pcCurInputSampleRow[iPosX+iOffsetX].aiU[iSubPosX] = piURow[iShift];
     203        pcCurInputSampleRow[iPosX+iOffsetX].aiV[iSubPosX] = piVRow[iShift];
     204#endif
     205      }
     206    }
     207
     208    pcCurInputSampleRow += m_iInputSamplesStride;
     209
     210    piDRow += iCurDepthStride;
     211    piYRow += aiCurVideoStride[0];
     212#if HHI_VSO_COLOR_PLANES
     213    piURow += aiCurVideoStride[1];
     214    piVRow += aiCurVideoStride[2];
     215#endif
     216  }
     217
     218 
    204219  m_aapiBaseVideoPel      [iViewPos] = apiCurVideoPel;
    205220  m_aaiBaseVideoStrides   [iViewPos] = aiCurVideoStride;
    206221  m_apiBaseDepthPel       [iViewPos] = piCurDepthPel;
    207222  m_aiBaseDepthStrides    [iViewPos] = iCurDepthStride;
    208 }
    209 
    210 Void
    211 TRenSingleModel::setup( TComPicYuv* pcOrgVideo, Int** ppiShiftLutLeft, Int** ppiBaseShiftLutLeft, Int** ppiShiftLutRight,  Int** ppiBaseShiftLutRight,  Int iDistToLeft, Bool bKeepReference )
     223
     224}
     225
     226template <BlenMod iBM, Bool bBitInc> Void
     227TRenSingleModelC<iBM,bBitInc>::setup( TComPicYuv* pcOrgVideo, Int** ppiShiftLutLeft, Int** ppiBaseShiftLutLeft, Int** ppiShiftLutRight,  Int** ppiBaseShiftLutRight,  Int iDistToLeft, Bool bKeepReference, UInt uiHorOff )
    212228{
    213229  AOT( !m_bUseOrgRef && pcOrgVideo );
    214230  AOT( (ppiShiftLutLeft  == NULL) && (m_iMode == 0 || m_iMode == 2) );
    215231  AOT( (ppiShiftLutRight == NULL) && (m_iMode == 1 || m_iMode == 2) );
    216 #if HHI_FIX
    217 #else
    218   AOT( pcOrgVideo != NULL && bKeepReference );
    219 #endif
    220232
    221233  m_appiShiftLut[0] = ppiShiftLutLeft;
     
    225237  m_pcPicYuvRef = pcOrgVideo;
    226238
    227 #if HHI_FIX
    228239  if ( pcOrgVideo && !bKeepReference )
    229 #else
    230   if ( pcOrgVideo )
    231 #endif
    232   {
    233     TRenFilter::copy(             pcOrgVideo->getLumaAddr(), pcOrgVideo->getStride() , m_iWidth,      m_iHeight,      m_aapiRefVideoPel[0], m_aiRefVideoStrides[0]);
    234     TRenFilter::sampleCUpHorUp(0, pcOrgVideo->getCbAddr()  , pcOrgVideo->getCStride(), m_iWidth >> 1, m_iHeight >> 1, m_aapiRefVideoPel[1], m_aiRefVideoStrides[1]);
    235     TRenFilter::sampleCUpHorUp(0, pcOrgVideo->getCrAddr()  , pcOrgVideo->getCStride(), m_iWidth >> 1, m_iHeight >> 1, m_aapiRefVideoPel[2], m_aiRefVideoStrides[2]);
     240  {
     241    TRenFilter::copy(             pcOrgVideo->getLumaAddr() +  uiHorOff       * pcOrgVideo->getStride() , pcOrgVideo->getStride() , m_iWidth,      m_iHeight,      m_aapiRefVideoPel[0], m_aiRefVideoStrides[0]);
     242    TRenFilter::sampleCUpHorUp(0, pcOrgVideo->getCbAddr()   + (uiHorOff >> 1) * pcOrgVideo->getCStride(), pcOrgVideo->getCStride(), m_iWidth >> 1, m_iHeight >> 1, m_aapiRefVideoPel[1], m_aiRefVideoStrides[1]);
     243    TRenFilter::sampleCUpHorUp(0, pcOrgVideo->getCrAddr()   + (uiHorOff >> 1) * pcOrgVideo->getCStride(), pcOrgVideo->getCStride(), m_iWidth >> 1, m_iHeight >> 1, m_aapiRefVideoPel[2], m_aiRefVideoStrides[2]);   
     244    xSetStructRefView();
    236245  }
    237246
    238247  // Initial Rendering
    239   xSetInts( m_piError                       , m_iStride, m_iWidth, m_iHeight, 0 );
     248  xResetStructError();
     249  xInitSampleStructs();
    240250
    241251  switch ( m_iMode )
    242   {
    243   case 0:
    244     xInitView( VIEWPOS_LEFT );
    245     xRenderL( 0, 0, m_iWidth, m_iHeight, m_aiBaseDepthStrides[0], m_apiBaseDepthPel[0], true );
     252  { 
     253  case 0:   
     254#if LGE_VSO_EARLY_SKIP_A0093
     255    xRenderL<true>( 0, 0, m_iWidth, m_iHeight, m_aiBaseDepthStrides[0], m_apiBaseDepthPel[0],false );
     256#else
     257    xRenderL<true>( 0, 0, m_iWidth, m_iHeight, m_aiBaseDepthStrides[0], m_apiBaseDepthPel[0] );
     258#endif   
    246259    break;
    247   case 1:
    248     xInitView( VIEWPOS_RIGHT );
    249     xRenderR( 0, 0, m_iWidth, m_iHeight, m_aiBaseDepthStrides[1], m_apiBaseDepthPel[1], true );
     260  case 1:   
     261#ifdef LGE_VSO_EARLY_SKIP_A0093
     262    xRenderR<true>( 0, 0, m_iWidth, m_iHeight, m_aiBaseDepthStrides[1], m_apiBaseDepthPel[1],false);
     263#else
     264    xRenderR<true>( 0, 0, m_iWidth, m_iHeight, m_aiBaseDepthStrides[1], m_apiBaseDepthPel[1] );
     265#endif
    250266    break;
    251267  case 2:
    252268    TRenFilter::setupZLUT( true, 30, iDistToLeft, ppiBaseShiftLutLeft, ppiBaseShiftLutRight, m_iBlendZThres, m_iBlendDistWeight, m_piInvZLUTLeft, m_piInvZLUTRight );
    253     xInitView( VIEWPOS_LEFT   );
    254     xInitView( VIEWPOS_RIGHT  );
    255     xInitView( VIEWPOS_MERGED );
    256     xRenderL( 0, 0, m_iWidth, m_iHeight, m_aiBaseDepthStrides[0], m_apiBaseDepthPel[0], true );
    257     xRenderR( 0, 0, m_iWidth, m_iHeight, m_aiBaseDepthStrides[1], m_apiBaseDepthPel[1], true );
     269#ifdef LGE_VSO_EARLY_SKIP_A0093
     270    xRenderL<true>( 0, 0, m_iWidth, m_iHeight, m_aiBaseDepthStrides[0], m_apiBaseDepthPel[0],false);
     271    xRenderR<true>( 0, 0, m_iWidth, m_iHeight, m_aiBaseDepthStrides[1], m_apiBaseDepthPel[1],false);
     272#else     
     273    xRenderL<true>( 0, 0, m_iWidth, m_iHeight, m_aiBaseDepthStrides[0], m_apiBaseDepthPel[0] );
     274    xRenderR<true>( 0, 0, m_iWidth, m_iHeight, m_aiBaseDepthStrides[1], m_apiBaseDepthPel[1] );
     275#endif
    258276    break;
    259277  default:
     
    264282  if ( !pcOrgVideo && !bKeepReference )
    265283  {
    266     xSetInts        ( m_piError                       , m_iStride, m_iWidth, m_iHeight, 0 );
    267       TRenFilter::copy( m_aapiSynthVideoPel[m_iMode ][0], m_iStride, m_iWidth, m_iHeight , m_aapiRefVideoPel[0], m_aiRefVideoStrides[0]);
    268       TRenFilter::copy( m_aapiSynthVideoPel[m_iMode ][1], m_iStride, m_iWidth, m_iHeight , m_aapiRefVideoPel[1], m_aiRefVideoStrides[1]);
    269       TRenFilter::copy( m_aapiSynthVideoPel[m_iMode ][2], m_iStride, m_iWidth, m_iHeight , m_aapiRefVideoPel[2], m_aiRefVideoStrides[2]);
    270   }
    271 }
    272 
    273 RMDist
    274 TRenSingleModel::getDistDepth( Int iViewPos, Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, Pel* piNewData )
    275 {
    276   RMDist iSSE = 0;
    277   switch (iViewPos )
     284    xResetStructError();
     285    xSetStructSynthViewAsRefView();
     286  }
     287}
     288
     289template <BlenMod iBM, Bool bBitInc> Void
     290#if HHI_VSO_COLOR_PLANES
     291TRenSingleModelC<iBM,bBitInc>::xGetSampleStrTextPtrs( Int iViewNum, Pel RenModelOutPels::*& rpiSrcY, Pel RenModelOutPels::*& rpiSrcU, Pel RenModelOutPels::*& rpiSrcV )
     292#else
     293TRenSingleModelC<iBM,bBitInc>::xGetSampleStrTextPtrs( Int iViewNum, Pel RenModelOutPels::*& rpiSrcY )
     294#endif
     295{
     296  switch ( iViewNum )
    278297  {
    279298  case 0:
    280     iSSE = xRenderL( iStartPosX,   iStartPosY,   iWidth,   iHeight,   iStride, piNewData, false );
     299    rpiSrcY = &RenModelOutPels::iYLeft;
     300#if HHI_VSO_COLOR_PLANES 
     301    rpiSrcU = &RenModelOutPels::iULeft;
     302    rpiSrcV = &RenModelOutPels::iVLeft;
     303#endif
    281304    break;
    282305  case 1:
    283     iSSE = xRenderR( iStartPosX,   iStartPosY,   iWidth,   iHeight,   iStride, piNewData, false );
     306    rpiSrcY = &RenModelOutPels::iYRight;
     307#if HHI_VSO_COLOR_PLANES 
     308    rpiSrcU = &RenModelOutPels::iURight;
     309    rpiSrcV = &RenModelOutPels::iVRight;
     310#endif
     311    break;
     312  case 2:
     313    rpiSrcY = &RenModelOutPels::iYBlended;
     314#if HHI_VSO_COLOR_PLANES 
     315    rpiSrcU = &RenModelOutPels::iUBlended;
     316    rpiSrcV = &RenModelOutPels::iVBlended;
     317#endif
     318    break;
     319  }
     320}
     321
     322
     323template <BlenMod iBM, Bool bBitInc> Void
     324TRenSingleModelC<iBM,bBitInc>::xGetSampleStrDepthPtrs( Int iViewNum, Pel RenModelOutPels::*& rpiSrcD )
     325{
     326  AOT(iViewNum != 0 && iViewNum != 1); 
     327  rpiSrcD = (iViewNum == 1) ? &RenModelOutPels::iDRight : &RenModelOutPels::iDLeft;
     328}
     329
     330
     331template <BlenMod iBM, Bool bBitInc> Void
     332TRenSingleModelC<iBM,bBitInc>::xSetStructRefView( )
     333{
     334  RenModelOutPels* pcCurOutSampleRow = m_pcOutputSamples;
     335 
     336  Pel* piYRow = m_aapiRefVideoPel[0];
     337#if HHI_VSO_COLOR_PLANES
     338  Pel* piURow = m_aapiRefVideoPel[1];
     339  Pel* piVRow = m_aapiRefVideoPel[2];
     340#endif 
     341
     342  for ( Int iPosY = 0; iPosY < m_iHeight; iPosY++ )
     343  {
     344    for ( Int iPosX = 0; iPosX < m_iWidth; iPosX++ )
     345    {     
     346      pcCurOutSampleRow[iPosX].iYRef = piYRow[iPosX];
     347#if HHI_VSO_COLOR_PLANES
     348      pcCurOutSampleRow[iPosX].iURef = piURow[iPosX];
     349      pcCurOutSampleRow[iPosX].iVRef = piVRow[iPosX];
     350#endif
     351    }
     352
     353    pcCurOutSampleRow += m_iOutputSamplesStride;
     354   
     355    piYRow += m_aiRefVideoStrides[0];
     356#if HHI_VSO_COLOR_PLANES
     357    piURow += m_aiRefVideoStrides[1];
     358    piVRow += m_aiRefVideoStrides[2];
     359#endif
     360  }
     361}
     362
     363template <BlenMod iBM, Bool bBitInc> Void
     364TRenSingleModelC<iBM,bBitInc>::xResetStructError( )
     365{
     366  RenModelOutPels* pcCurOutSampleRow = m_pcOutputSamples;
     367
     368  for ( Int iPosY = 0; iPosY < m_iHeight; iPosY++ )
     369  {
     370    for ( Int iPosX = 0; iPosX < m_iWidth; iPosX++ )
     371    {     
     372      pcCurOutSampleRow[iPosX].iError = 0;
     373    }
     374    pcCurOutSampleRow += m_iOutputSamplesStride;
     375  }
     376}
     377
     378template <BlenMod iBM, Bool bBitInc> Void
     379TRenSingleModelC<iBM,bBitInc>::xSetStructSynthViewAsRefView( )
     380{
     381  AOT( m_iMode < 0 || m_iMode > 2);
     382
     383  RenModelOutPels* pcCurOutSampleRow = m_pcOutputSamples;
     384
     385  Pel RenModelOutPels::* piSrcY = NULL;
     386
     387#if HHI_VSO_COLOR_PLANES 
     388  Pel RenModelOutPels::* piSrcU = NULL;
     389  Pel RenModelOutPels::* piSrcV = NULL;
     390  xGetSampleStrTextPtrs( m_iMode, piSrcY, piSrcU, piSrcV );
     391#else
     392  xGetSampleStrTextPtrs( m_iMode, piSrcY );
     393#endif
     394
     395  for ( Int iPosY = 0; iPosY < m_iHeight; iPosY++ )
     396  {
     397    for ( Int iPosX = 0; iPosX < m_iWidth; iPosX++ )
     398    {     
     399      pcCurOutSampleRow[iPosX].iYRef = pcCurOutSampleRow[iPosX].*piSrcY;
     400#if HHI_VSO_COLOR_PLANES
     401      pcCurOutSampleRow[iPosX].iURef = pcCurOutSampleRow[iPosX].*piSrcU;
     402      pcCurOutSampleRow[iPosX].iVRef = pcCurOutSampleRow[iPosX].*piSrcV;
     403#endif
     404    }
     405    pcCurOutSampleRow += m_iOutputSamplesStride;
     406  }
     407}
     408
     409template <BlenMod iBM, Bool bBitInc> Void
     410TRenSingleModelC<iBM,bBitInc>::xInitSampleStructs()
     411{
     412  RenModelOutPels* pcOutSampleRow      = m_pcOutputSamples;
     413  RenModelInPels * pcLeftInSampleRow   = m_pcInputSamples[0];
     414  RenModelInPels * pcRightInSampleRow  = m_pcInputSamples[1];
     415
     416
     417  for (Int iPosY = 0; iPosY < m_iHeight; iPosY++)
     418  {
     419    for (Int iPosX = 0; iPosX < m_iWidth; iPosX++)
     420    {
     421      //// Output Samples
     422      pcOutSampleRow[iPosX].iFilledLeft   = REN_IS_HOLE;
     423      pcOutSampleRow[iPosX].iFilledRight  = REN_IS_HOLE;
     424
     425      pcOutSampleRow[iPosX].iDLeft        = 0;
     426      pcOutSampleRow[iPosX].iDRight       = 0;
     427      pcOutSampleRow[iPosX].iDBlended     = 0;     
     428                                     
     429      // Y Planes                   
     430      pcOutSampleRow[iPosX].iYLeft        = 0;
     431      pcOutSampleRow[iPosX].iYRight       = 0;
     432      pcOutSampleRow[iPosX].iYBlended     = 0;
     433#if HHI_VSO_COLOR_PLANES             
     434      // U Planes                   
     435      pcOutSampleRow[iPosX].iULeft        = 128 << g_uiBitIncrement;
     436      pcOutSampleRow[iPosX].iURight       = 128 << g_uiBitIncrement;
     437      pcOutSampleRow[iPosX].iUBlended     = 128 << g_uiBitIncrement;
     438                                     
     439      // V Planes                   
     440      pcOutSampleRow[iPosX].iVLeft        = 128 << g_uiBitIncrement;
     441      pcOutSampleRow[iPosX].iVRight       = 128 << g_uiBitIncrement;
     442      pcOutSampleRow[iPosX].iVBlended     = 128 << g_uiBitIncrement;
     443#endif
     444      //// Input Samples
     445      pcLeftInSampleRow [iPosX].bOccluded = false;
     446      pcRightInSampleRow[iPosX].bOccluded = false;
     447    }
     448
     449    pcOutSampleRow     += m_iOutputSamplesStride;
     450    pcLeftInSampleRow  += m_iInputSamplesStride;
     451    pcRightInSampleRow += m_iInputSamplesStride;
     452  } 
     453}
     454
     455
     456#ifdef LGE_VSO_EARLY_SKIP_A0093
     457template <BlenMod iBM, Bool bBitInc> RMDist
     458TRenSingleModelC<iBM,bBitInc>::getDistDepth( Int iViewPos, Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, Pel* piNewData , Pel * piOrgData, Int iOrgStride )
     459#else
     460template <BlenMod iBM, Bool bBitInc> RMDist
     461TRenSingleModelC<iBM,bBitInc>::getDistDepth( Int iViewPos, Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, Pel* piNewData )
     462#endif
     463{
     464  RMDist iSSE = 0;
     465#ifdef LGE_VSO_EARLY_SKIP_A0093
     466  Bool   bEarlySkip;
     467#endif
     468  switch ( iViewPos )
     469  {
     470  case 0:
     471#ifdef LGE_VSO_EARLY_SKIP_A0093
     472    bEarlySkip = m_bEarlySkip ? xDetectEarlySkipL(iStartPosX,   iStartPosY,   iWidth,   iHeight,   iStride, piNewData, piOrgData, iOrgStride) : false;
     473    if( !bEarlySkip )
     474    {
     475      iSSE = xRenderL<false>( iStartPosX,   iStartPosY,   iWidth,   iHeight,   iStride, piNewData,true );
     476    }   
     477#else
     478    iSSE = xRenderL<false>( iStartPosX,   iStartPosY,   iWidth,   iHeight,   iStride, piNewData );
     479#endif
     480    break;
     481  case 1:
     482#ifdef LGE_VSO_EARLY_SKIP_A0093
     483    bEarlySkip = m_bEarlySkip ? xDetectEarlySkipR(iStartPosX,   iStartPosY,   iWidth,   iHeight,   iStride, piNewData, piOrgData, iOrgStride) : false;
     484    if( !bEarlySkip )
     485    {
     486      iSSE = xRenderR<false>( iStartPosX,   iStartPosY,   iWidth,   iHeight,   iStride, piNewData,true );
     487    }   
     488#else
     489    iSSE = xRenderR<false>( iStartPosX,   iStartPosY,   iWidth,   iHeight,   iStride, piNewData );
     490#endif
    284491    break;
    285492  default:
    286493    assert(0);
    287494  }
     495
    288496  return iSSE;
    289497}
    290 
    291 Void
    292 TRenSingleModel::setDepth( Int iViewPos, Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, Pel* piNewData )
    293 {
    294   switch (iViewPos )
    295   {
    296     case 0:
    297       xRenderL( iStartPosX,   iStartPosY,   iWidth,   iHeight,   iStride, piNewData, true );
    298       break;
    299     case 1:
    300       xRenderR( iStartPosX,   iStartPosY,   iWidth,   iHeight,   iStride, piNewData, true );
    301       break;
    302     default:
    303       assert(0);
    304   }
    305 }
    306 
    307 
    308 Void
    309 TRenSingleModel::getSynthView( Int iViewPos, Pel**& rppiRenVideoPel, Pel*& rpiRenDepthPel, Int& riStride )
    310 {
    311   rppiRenVideoPel = m_aapiSynthVideoPel[iViewPos];
    312   rpiRenDepthPel  = m_apiSynthDepthPel [iViewPos];
    313   riStride = m_iStride;
    314 }
    315 
    316 
    317 Void
    318 TRenSingleModel::getRefView( TComPicYuv*& rpcPicYuvRefView, Pel**& rppiRefVideoPel, Int*& raiStrides )
    319 {
    320   rpcPicYuvRefView = m_pcPicYuvRef;
    321   rppiRefVideoPel  = m_aapiRefVideoPel;
    322   raiStrides       = m_aiRefVideoStrides;
    323 }
    324 
    325 
    326 RMDist
    327 TRenSingleModel::getDistVideo( Int iViewPos, Int iPlane, Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, Pel* piNewData )
     498#ifdef LGE_VSO_EARLY_SKIP_A0093
     499template <BlenMod iBM, Bool bBitInc> Void
     500TRenSingleModelC<iBM,bBitInc>::setDepth( Int iViewPos, Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, Pel* piNewData, Pel* piOrgData, Int iOrgStride )
     501#else
     502template <BlenMod iBM, Bool bBitInc> Void
     503TRenSingleModelC<iBM,bBitInc>::setDepth( Int iViewPos, Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, Pel* piNewData )
     504#endif
     505{
     506#ifdef  LGE_VSO_EARLY_SKIP_A0093
     507  Bool bEarlySkip;
     508#endif
     509  switch ( iViewPos )
     510  {
     511  case 0:
     512#ifdef LGE_VSO_EARLY_SKIP_A0093
     513    bEarlySkip = m_bEarlySkip ? xDetectEarlySkipL(iStartPosX,   iStartPosY,   iWidth,   iHeight,   iStride, piNewData, piOrgData,iOrgStride) : false;
     514    if( !bEarlySkip )
     515    {
     516      xRenderL<true>( iStartPosX,   iStartPosY,   iWidth,   iHeight,   iStride, piNewData,true );
     517    }   
     518#else
     519    xRenderL<true>( iStartPosX,   iStartPosY,   iWidth,   iHeight,   iStride, piNewData );
     520#endif     
     521    break;
     522  case 1:
     523#ifdef LGE_VSO_EARLY_SKIP_A0093
     524    bEarlySkip = m_bEarlySkip ? xDetectEarlySkipR(iStartPosX,   iStartPosY,   iWidth,   iHeight,   iStride, piNewData, piOrgData,iOrgStride) : false;
     525    if( !bEarlySkip )
     526    {
     527      xRenderR<true>( iStartPosX,   iStartPosY,   iWidth,   iHeight,   iStride, piNewData,true );
     528    }   
     529#else
     530    xRenderR<true>( iStartPosX,   iStartPosY,   iWidth,   iHeight,   iStride, piNewData );
     531#endif     
     532    break;
     533  default:
     534    assert(0);
     535  }
     536}
     537
     538template <BlenMod iBM, Bool bBitInc> Void
     539TRenSingleModelC<iBM,bBitInc>::getSynthVideo( Int iViewPos, TComPicYuv* pcPicYuv, UInt uiHorOffset )
     540
     541  AOT( pcPicYuv->getWidth() != m_iWidth );
     542  AOT( pcPicYuv->getHeight() > m_iHeight + uiHorOffset );
     543
     544#if HHI_VSO_COLOR_PLANES
     545  Pel RenModelOutPels::* piText[3] = { NULL, NULL, NULL };
     546  xGetSampleStrTextPtrs(iViewPos, piText[0], piText[1], piText[2]);
     547
     548  // Temp image for chroma down sampling
     549  PelImage cTempImage( m_iWidth, m_iHeight, 3, 0);
     550  Int  aiStrides[3];
     551  Pel* apiData  [3];
     552
     553  cTempImage.getDataAndStrides( apiData, aiStrides );
     554
     555  for (UInt uiCurPlane = 0; uiCurPlane < 3; uiCurPlane++ )
     556  {
     557    xCopyFromSampleStruct( m_pcOutputSamples, m_iOutputSamplesStride, piText[uiCurPlane], apiData[uiCurPlane], aiStrides[uiCurPlane] , m_iWidth, m_iHeight);
     558  } 
     559
     560  xCopy2PicYuv( apiData, aiStrides, pcPicYuv, uiHorOffset );
     561#else
     562  Pel RenModelOutPels::* piY;
     563  xGetSampleStrTextPtrs(iViewPos, piY);
     564  xCopyFromSampleStruct( m_pcOutputSamples, m_iOutputSamplesStride, piY, pcPicYuv->getLumaAddr() + uiHorOffset * pcPicYuv->getStride(), pcPicYuv->getStride(), m_iWidth, m_iHeight );
     565  pcPicYuv->setChromaTo( 128 << g_uiBitIncrement );   
     566#endif 
     567}
     568
     569
     570template <BlenMod iBM, Bool bBitInc> Void
     571TRenSingleModelC<iBM,bBitInc>::getSynthDepth( Int iViewPos, TComPicYuv* pcPicYuv, UInt uiHorOff )
     572
     573  AOT( iViewPos != 0 && iViewPos != 1);
     574
     575  AOT( pcPicYuv->getWidth()  != m_iWidth  );
     576  AOT( pcPicYuv->getHeight() > m_iHeight + uiHorOff );
     577
     578  Pel RenModelOutPels::* piD = 0;
     579  xGetSampleStrDepthPtrs(iViewPos, piD);
     580  xCopyFromSampleStruct( m_pcOutputSamples, m_iOutputSamplesStride, piD, pcPicYuv->getLumaAddr() + pcPicYuv->getStride() * uiHorOff, pcPicYuv->getStride(), m_iWidth, m_iHeight );
     581  pcPicYuv->setChromaTo( 128 << g_uiBitIncrement );   
     582}
     583
     584template <BlenMod iBM, Bool bBitInc> Void
     585TRenSingleModelC<iBM,bBitInc>::getRefVideo ( Int iViewPos, TComPicYuv* pcPicYuv, UInt uiHorOffset )
     586
     587  AOT( pcPicYuv->getWidth()  != m_iWidth  );
     588  AOT( pcPicYuv->getHeight() >  m_iHeight + uiHorOffset);
     589
     590#if HHI_VSO_COLOR_PLANES
     591  Pel RenModelOutPels::* piText[3];
     592  piText[0] = &RenModelOutPels::iYRef;
     593  piText[1] = &RenModelOutPels::iURef;
     594  piText[2] = &RenModelOutPels::iVRef;
     595
     596  // Temp image for chroma down sampling
     597  PelImage cTempImage( m_iWidth, m_iHeight, 3, 0);
     598  Int  aiStrides[3];
     599  Pel* apiData  [3];
     600
     601  cTempImage.getDataAndStrides( apiData, aiStrides );
     602
     603  for (UInt uiCurPlane = 0; uiCurPlane < 3; uiCurPlane++ )
     604  {
     605    xCopyFromSampleStruct( m_pcOutputSamples, m_iOutputSamplesStride, piText[uiCurPlane], apiData[uiCurPlane], aiStrides[uiCurPlane] , m_iWidth, m_iHeight);
     606  } 
     607
     608  xCopy2PicYuv( apiData, aiStrides, pcPicYuv, uiHorOffset );
     609#else
     610  xCopyFromSampleStruct( m_pcOutputSamples, m_iOutputSamplesStride, &RenModelOutPels::iYRef, pcPicYuv->getLumaAddr() *  pcPicYuv->getStride() + uiHorOffset, pcPicYuv->getStride(), m_iWidth, m_iHeight );
     611  pcPicYuv->setChromaTo( 128 << g_uiBitIncrement );   
     612#endif 
     613}
     614
     615
     616template <BlenMod iBM, Bool bBitInc> RMDist
     617TRenSingleModelC<iBM,bBitInc>::getDistVideo( Int iViewPos, Int iPlane, Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, Pel* piNewData )
    328618{
    329619  AOF(false);
     
    331621}
    332622
    333 Void
    334 TRenSingleModel::setVideo( Int iViewPos, Int iPlane, Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, Pel* piNewData )
     623template <BlenMod iBM, Bool bBitInc> Void
     624TRenSingleModelC<iBM,bBitInc>::setVideo( Int iViewPos, Int iPlane, Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, Pel* piNewData )
    335625{
    336626  AOF(false);
     
    339629
    340630
    341 __inline Void
    342 TRenSingleModel::xSetViewRow( Int iPosY )
    343 {
    344   m_aapiBaseVideoPelRow     [m_iCurViewPos][0] = m_aapiBaseVideoPel   [m_iCurViewPos]  [0] + m_aaiBaseVideoStrides [ m_iCurViewPos ][0] * iPosY;
    345   m_aapiBaseVideoPelRow     [m_iCurViewPos][1] = m_aapiBaseVideoPel   [m_iCurViewPos]  [1] + m_aaiBaseVideoStrides [ m_iCurViewPos ][1] * iPosY;
    346   m_aapiBaseVideoPelRow     [m_iCurViewPos][2] = m_aapiBaseVideoPel   [m_iCurViewPos]  [2] + m_aaiBaseVideoStrides [ m_iCurViewPos ][2] * iPosY;
    347 
    348   m_apiBaseDepthPelRow      [m_iCurViewPos]    = m_apiBaseDepthPel    [m_iCurViewPos]      + m_aiBaseDepthStrides  [ m_iCurViewPos]     * iPosY;
    349   m_apbOccludedRow          [m_iCurViewPos]    = m_apbOccluded        [m_iCurViewPos]      + m_iStride                                  * iPosY;
    350   m_apiFilledRow            [m_iCurViewPos]    = m_apiFilled          [m_iCurViewPos]      + m_iStride                                  * iPosY;
    351   m_apiErrorRow                                = m_piError                                 + m_iStride                                  * iPosY;
    352 
    353   m_aapiSynthVideoPelRow    [m_iCurViewPos][0] = m_aapiSynthVideoPel  [m_iCurViewPos]  [0] + m_iStride                                  * iPosY;
    354   m_aapiSynthVideoPelRow    [m_iCurViewPos][1] = m_aapiSynthVideoPel  [m_iCurViewPos]  [1] + m_iStride                                  * iPosY;
    355   m_aapiSynthVideoPelRow    [m_iCurViewPos][2] = m_aapiSynthVideoPel  [m_iCurViewPos]  [2] + m_iStride                                  * iPosY;
    356 
    357   m_aapiRefVideoPelRow                     [0] = m_aapiRefVideoPel                     [0] + m_aiRefVideoStrides                    [0] * iPosY;
    358   m_aapiRefVideoPelRow                     [1] = m_aapiRefVideoPel                     [1] + m_aiRefVideoStrides                    [1] * iPosY;
    359   m_aapiRefVideoPelRow                     [2] = m_aapiRefVideoPel                     [2] + m_aiRefVideoStrides                    [2] * iPosY;
    360 
    361   if (m_iMode == 2)
    362   {
    363     m_apiSynthDepthPelRow [m_iCurViewPos ]     = m_apiSynthDepthPel   [m_iCurViewPos]      + m_iStride                                  * iPosY;
    364     m_aapiSynthVideoPelRow[m_iOtherViewPos][0] = m_aapiSynthVideoPel  [m_iOtherViewPos][0] + m_iStride                                  * iPosY;
    365     m_aapiSynthVideoPelRow[m_iOtherViewPos][1] = m_aapiSynthVideoPel  [m_iOtherViewPos][1] + m_iStride                                  * iPosY;
    366     m_aapiSynthVideoPelRow[m_iOtherViewPos][2] = m_aapiSynthVideoPel  [m_iOtherViewPos][2] + m_iStride                                  * iPosY;
    367 
    368     m_apiFilledRow        [m_iOtherViewPos]    = m_apiFilled          [m_iOtherViewPos]    + m_iStride                                  * iPosY;
    369     m_apiSynthDepthPelRow [m_iOtherViewPos]    = m_apiSynthDepthPel   [m_iOtherViewPos]    + m_iStride                                  * iPosY;
    370 
    371     m_aapiSynthVideoPelRow[2              ][0] = m_aapiSynthVideoPel[2]                [0] + m_iStride                                  * iPosY;
    372     m_aapiSynthVideoPelRow[2              ][1] = m_aapiSynthVideoPel[2]                [1] + m_iStride                                  * iPosY;
    373     m_aapiSynthVideoPelRow[2              ][2] = m_aapiSynthVideoPel[2]                [2] + m_iStride                                  * iPosY;
    374   }
    375 }
    376 
    377 __inline Void
    378 TRenSingleModel::xIncViewRow( )
    379 {
    380   m_aapiBaseVideoPelRow     [m_iCurViewPos][0] += m_aaiBaseVideoStrides [ m_iCurViewPos ][0];
    381   m_aapiBaseVideoPelRow     [m_iCurViewPos][1] += m_aaiBaseVideoStrides [ m_iCurViewPos ][1];
    382   m_aapiBaseVideoPelRow     [m_iCurViewPos][2] += m_aaiBaseVideoStrides [ m_iCurViewPos ][2];
    383 
    384   m_apiBaseDepthPelRow      [m_iCurViewPos]    += m_aiBaseDepthStrides  [ m_iCurViewPos]    ;
    385   m_apbOccludedRow          [m_iCurViewPos]    += m_iStride                                 ;
    386   m_apiFilledRow            [m_iCurViewPos]    += m_iStride                                 ;
    387   m_apiErrorRow                                += m_iStride                                 ;
    388 
    389   m_aapiSynthVideoPelRow    [m_iCurViewPos][0] += m_iStride                                 ;
    390   m_aapiSynthVideoPelRow    [m_iCurViewPos][1] += m_iStride                                 ;
    391   m_aapiSynthVideoPelRow    [m_iCurViewPos][2] += m_iStride                                 ;
    392 
    393   m_aapiRefVideoPelRow                     [0] += m_aiRefVideoStrides                    [0];
    394   m_aapiRefVideoPelRow                     [1] += m_aiRefVideoStrides                    [1];
    395   m_aapiRefVideoPelRow                     [2] += m_aiRefVideoStrides                    [2];
    396 
    397   if (m_iMode == 2)
    398   {
    399     m_apiSynthDepthPelRow [m_iCurViewPos ]     += m_iStride                                 ;    // This is correct!
    400 
    401     m_aapiSynthVideoPelRow[m_iOtherViewPos][0] += m_iStride                                 ;
    402     m_aapiSynthVideoPelRow[m_iOtherViewPos][1] += m_iStride                                 ;
    403     m_aapiSynthVideoPelRow[m_iOtherViewPos][2] += m_iStride                                 ;
    404 
    405     m_apiFilledRow        [m_iOtherViewPos]    += m_iStride                                 ;
    406     m_apiSynthDepthPelRow [m_iOtherViewPos]    += m_iStride                                 ;
    407 
    408     m_aapiSynthVideoPelRow[2              ][0] += m_iStride                                 ;
    409     m_aapiSynthVideoPelRow[2              ][1] += m_iStride                                 ;
    410     m_aapiSynthVideoPelRow[2              ][2] += m_iStride                                 ;
    411   }
    412 }
    413 
    414 __inline RMDist
    415 TRenSingleModel::xRenderL( Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, Pel* piNewData, Bool bAdd )
    416 {
    417   m_bSet             = bAdd;
    418   m_iCurViewPos      = 0;
    419   m_iOtherViewPos    = 1;
     631template <BlenMod iBM, Bool bBitInc> __inline Void
     632TRenSingleModelC<iBM,bBitInc>::xSetViewRow( Int iPosY )
     633{
     634  m_pcInputSamplesRow[0] = m_pcInputSamples[0] + m_iInputSamplesStride  * iPosY;
     635  m_pcInputSamplesRow[1] = m_pcInputSamples[1] + m_iInputSamplesStride  * iPosY;
     636  m_pcOutputSamplesRow   = m_pcOutputSamples   + m_iOutputSamplesStride * iPosY; 
     637
     638}
     639
     640template <BlenMod iBM, Bool bBitInc> __inline Void
     641TRenSingleModelC<iBM,bBitInc>::xIncViewRow( )
     642{
     643  m_pcInputSamplesRow[0] += m_iInputSamplesStride ;
     644  m_pcInputSamplesRow[1] += m_iInputSamplesStride ;
     645  m_pcOutputSamplesRow   += m_iOutputSamplesStride; 
     646}
     647#if LGE_VSO_EARLY_SKIP_A0093
     648template <BlenMod iBM, Bool bBitInc> template<Bool bSet> __inline RMDist
     649TRenSingleModelC<iBM,bBitInc>::xRenderL( Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, Pel* piNewData, Bool bFast)
     650#else
     651template <BlenMod iBM, Bool bBitInc> template<Bool bSet> __inline RMDist
     652TRenSingleModelC<iBM,bBitInc>::xRenderL( Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, Pel* piNewData)
     653#endif
     654{
     655  const Int iCurViewPos   = 0;
     656  const Int iOtherViewPos = 1;
     657
     658  m_iCurViewPos   = iCurViewPos  ;
     659  m_iOtherViewPos = iOtherViewPos;
    420660
    421661  m_piNewDepthData   = piNewData;
     
    426666    return 0;
    427667
    428   //TODO: Specialize to left and right; setData and getDist
    429 
    430668  // Get Data
    431   m_ppiCurLUT      = m_appiShiftLut   [m_iCurViewPos];
     669  m_ppiCurLUT      = m_appiShiftLut   [iCurViewPos];
    432670
    433671  xSetViewRow      ( iStartPosY);
     
    441679  for (Int iPosY = iStartPosY; iPosY < iStartPosY + iHeight; iPosY++ )
    442680  {
     681#ifdef LGE_VSO_EARLY_SKIP_A0093
     682    if( m_bEarlySkip && bFast )
     683    {
     684      if ( m_pbHorSkip[iPosY-iStartPosY] )
     685      {
     686        xIncViewRow();
     687        m_piNewDepthData += iStride;
     688        continue;
     689      }
     690    }
     691#endif
    443692    m_bInOcclusion = false;
    444693
     
    454703      m_iLastOccludedSPos   = iCurSPos + 1;
    455704      m_iLastOccludedSPosFP = xRangeLeftL( m_iLastOccludedSPos );
    456       xExtrapolateMarginL  ( iCurSPos, iEndChangePos, iError );
    457       iMinChangedSPos       = Min( iMinChangedSPos, (iEndChangePos << m_iShiftPrec) - m_ppiCurLUT[0][ RemoveBitIncrement( max(m_apiBaseDepthPelRow[m_iCurViewPos][iEndChangePos], m_piNewDepthData[iPosXinNewData] )) ]);
     705      xExtrapolateMarginL<bSet>  ( iCurSPos, iEndChangePos, iError );
     706
     707      iMinChangedSPos       = Min( iMinChangedSPos, (iEndChangePos << m_iShiftPrec) - m_ppiCurLUT[0][ RenModRemoveBitInc( Max(m_pcInputSamplesRow[iCurViewPos][iEndChangePos].iD, m_piNewDepthData[iPosXinNewData] )) ]);
    458708      iLastSPos             = iCurSPos;
    459709      m_iLastDepth          = m_iCurDepth;
     710
     711      if ( bSet )
     712      {
     713        m_pcInputSamplesRow[iCurViewPos][iEndChangePos].iD = m_piNewDepthData[iPosXinNewData];
     714      }
     715
    460716      iPosXinNewData--;
    461717      iEndChangePos--;
     
    464720    {
    465721      iLastSPos    = xShift(iEndChangePos+1);
    466       m_iLastDepth = m_apiBaseDepthPelRow[m_iCurViewPos][iEndChangePos+1];
     722      m_iLastDepth = m_pcInputSamplesRow [iCurViewPos][iEndChangePos+1].iD;
    467723      xInitRenderPartL( iEndChangePos, iLastSPos );
    468724    }
     
    473729    {
    474730      // Get minimal changed sample position
    475       iMinChangedSPos = Min( iMinChangedSPos, (iCurPosX << m_iShiftPrec) - m_ppiCurLUT[0][ RemoveBitIncrement( max(m_apiBaseDepthPelRow[m_iCurViewPos][iCurPosX], m_piNewDepthData[iPosXinNewData] )) ]);
     731
     732      iMinChangedSPos = Min( iMinChangedSPos, (iCurPosX << m_iShiftPrec) - m_ppiCurLUT[0][ RenModRemoveBitInc( Max(m_pcInputSamplesRow[iCurViewPos][iCurPosX].iD, m_piNewDepthData[iPosXinNewData] )) ]);
    476733      Int iCurSPos    = xShiftNewData(iCurPosX,iPosXinNewData);
    477734      m_iCurDepth     = m_piNewDepthData[iPosXinNewData];
    478       xRenderRangeL(iCurSPos, iLastSPos, iCurPosX, iError );
     735      xRenderRangeL<bSet>(iCurSPos, iLastSPos, iCurPosX, iError );
    479736      iLastSPos       = iCurSPos;
    480737      m_iLastDepth    = m_iCurDepth;
     738
     739      if ( bSet )
     740      {
     741        m_pcInputSamplesRow[iCurViewPos][iCurPosX].iD = m_piNewDepthData[iPosXinNewData];
     742      }
     743
    481744      iPosXinNewData--;
    482745    }
     
    486749    {
    487750      Int iCurSPos = xShift(iCurPosX);
    488       m_iCurDepth  = m_apiBaseDepthPelRow[m_iCurViewPos][iCurPosX];
    489       xRenderRangeL( iCurSPos, iLastSPos, iCurPosX, iError );
     751
     752      m_iCurDepth  = m_pcInputSamplesRow[iCurViewPos][iCurPosX].iD;
     753      xRenderRangeL<bSet>( iCurSPos, iLastSPos, iCurPosX, iError );
    490754
    491755      if ( iCurSPos < iMinChangedSPos )
     
    499763    }
    500764
     765
    501766    xIncViewRow();
    502767    m_piNewDepthData += iStride;
     
    505770}
    506771
    507 
    508 __inline RMDist
    509 TRenSingleModel::xRenderR( Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, Pel* piNewData, Bool bAdd )
    510 {
    511   m_bSet             = bAdd;
    512   m_iCurViewPos      = 1;
    513   m_iOtherViewPos    = 0;
     772#ifdef  LGE_VSO_EARLY_SKIP_A0093
     773template <BlenMod iBM, Bool bBitInc> template<Bool bSet> __inline RMDist
     774TRenSingleModelC<iBM,bBitInc>::xRenderR( Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, Pel* piNewData , Bool bFast)
     775#else
     776template <BlenMod iBM, Bool bBitInc> template<Bool bSet> __inline RMDist
     777TRenSingleModelC<iBM,bBitInc>::xRenderR( Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, Pel* piNewData )
     778#endif
     779{
     780
     781  const Int iCurViewPos   = 1;
     782  const Int iOtherViewPos = 0;
     783
     784  m_iCurViewPos      = iCurViewPos;
     785  m_iOtherViewPos    = iOtherViewPos;
    514786
    515787  m_piNewDepthData   = piNewData;
     
    521793
    522794  // Get Data
    523   m_ppiCurLUT      = m_appiShiftLut   [m_iCurViewPos];
    524 
     795  m_ppiCurLUT      = m_appiShiftLut   [iCurViewPos];
    525796  xSetViewRow      ( iStartPosY);
    526797
     
    534805  for (Int iPosY = iStartPosY; iPosY < iStartPosY + iHeight; iPosY++ )
    535806  {
     807
     808#ifdef LGE_VSO_EARLY_SKIP_A0093
     809    if( m_bEarlySkip && bFast )
     810    {
     811      if ( m_pbHorSkip[iPosY-iStartPosY] )
     812      {
     813        xIncViewRow();
     814        m_piNewDepthData += iStride;
     815        continue;
     816      }
     817    }
     818#endif
    536819    m_bInOcclusion = false;
    537820
     
    547830      m_iLastOccludedSPos   = iCurSPos - 1;
    548831      m_iLastOccludedSPosFP = xRangeRightR( m_iLastOccludedSPos );
    549       xExtrapolateMarginR     ( iCurSPos, iStartChangePos, iError );
    550       iMaxChangedSPos       = max( iMaxChangedSPos, (iStartChangePos << m_iShiftPrec) - m_ppiCurLUT[0][ RemoveBitIncrement( max(m_apiBaseDepthPelRow[m_iCurViewPos][iStartChangePos], m_piNewDepthData[iPosXinNewData] )) ]);
     832      xExtrapolateMarginR<bSet>     ( iCurSPos, iStartChangePos, iError );
     833
     834      iMaxChangedSPos       = Max( iMaxChangedSPos, (iStartChangePos << m_iShiftPrec) - m_ppiCurLUT[0][ RenModRemoveBitInc( Max(m_pcInputSamplesRow[iCurViewPos][iStartChangePos].iD, m_piNewDepthData[iPosXinNewData] )) ]);
    551835      iLastSPos             = iCurSPos;
    552836      m_iLastDepth          = m_iCurDepth;
     837      if ( bSet )
     838      {
     839        m_pcInputSamplesRow[iCurViewPos][iStartChangePos].iD = m_piNewDepthData[iPosXinNewData];
     840      }
     841
     842
    553843      iPosXinNewData++;
    554844      iStartChangePos++;
     
    557847    {
    558848      iLastSPos   = xShift(iStartChangePos-1);
    559       m_iLastDepth = m_apiBaseDepthPelRow[m_iCurViewPos][iStartChangePos-1];
     849
     850      m_iLastDepth = m_pcInputSamplesRow[iCurViewPos][iStartChangePos-1].iD;
    560851      xInitRenderPartR( iStartChangePos, iLastSPos );
    561852    }
     
    566857    {
    567858      // Get minimal changed sample position
    568       iMaxChangedSPos = max( iMaxChangedSPos, (iCurPosX << m_iShiftPrec) - m_ppiCurLUT[0][ RemoveBitIncrement( max(m_apiBaseDepthPelRow[m_iCurViewPos][iCurPosX], m_piNewDepthData[iPosXinNewData] )) ]);
     859
     860      iMaxChangedSPos = Max( iMaxChangedSPos, (iCurPosX << m_iShiftPrec) - m_ppiCurLUT[0][ RenModRemoveBitInc( Max(m_pcInputSamplesRow[iCurViewPos][iCurPosX].iD, m_piNewDepthData[iPosXinNewData] )) ]);
    569861      Int iCurSPos    = xShiftNewData(iCurPosX,iPosXinNewData);
    570862      m_iCurDepth     = m_piNewDepthData[iPosXinNewData];
    571       xRenderRangeR(iCurSPos, iLastSPos, iCurPosX, iError );
     863      xRenderRangeR<bSet>(iCurSPos, iLastSPos, iCurPosX, iError );
    572864      iLastSPos      = iCurSPos;
    573865      m_iLastDepth    = m_iCurDepth;
     866
     867      if ( bSet )
     868      {
     869        m_pcInputSamplesRow[iCurViewPos][iCurPosX].iD = m_piNewDepthData[iPosXinNewData];
     870      }
     871
    574872      iPosXinNewData++;
    575873    }
     
    579877    {
    580878      Int iCurSPos = xShift(iCurPosX);
    581       m_iCurDepth  = m_apiBaseDepthPelRow[m_iCurViewPos][iCurPosX];
    582       xRenderRangeR( iCurSPos, iLastSPos, iCurPosX, iError );
     879
     880      m_iCurDepth  = m_pcInputSamplesRow[iCurViewPos][iCurPosX].iD;
     881      xRenderRangeR<bSet>( iCurSPos, iLastSPos, iCurPosX, iError );
    583882
    584883      if ( iCurSPos > iMaxChangedSPos )
     
    590889      m_iLastDepth = m_iCurDepth;
    591890    }
     891
    592892    xIncViewRow();
    593893    m_piNewDepthData += iStride;
     
    597897
    598898
    599 __inline Void
    600 TRenSingleModel::xInitRenderPartL(  Int iEndChangePos, Int iLastSPos )
    601 {
     899template <BlenMod iBM, Bool bBitInc> __inline Void
     900TRenSingleModelC<iBM,bBitInc>::xInitRenderPartL(  Int iEndChangePos, Int iLastSPos )
     901{
     902  const Int iCurViewPos = 0;
    602903  // GET MINIMAL OCCLUDED SAMPLE POSITION
    603904  Int iCurPosX           = iEndChangePos;
    604905
    605   if ( ( iCurPosX + 1 < m_iWidth ) && (m_apbOccludedRow[m_iCurViewPos][ iCurPosX + 1] ) )
     906
     907  if ( ( iCurPosX + 1 < m_iWidth ) && (m_pcInputSamplesRow[iCurViewPos][ iCurPosX + 1].bOccluded ) )
    606908  {
    607909    iCurPosX++;
    608     while ( (iCurPosX + 1 < m_iWidth) &&  (m_apbOccludedRow[m_iCurViewPos][ iCurPosX + 1] )  )
     910
     911    while ( (iCurPosX + 1 < m_iWidth) &&  (m_pcInputSamplesRow[iCurViewPos][ iCurPosX + 1].bOccluded  )  )
     912
    609913      iCurPosX++;
    610914
     
    630934};
    631935
    632 __inline Void
    633 TRenSingleModel::xInitRenderPartR(  Int iStartChangePos, Int iLastSPos )
    634 {
     936template <BlenMod iBM, Bool bBitInc> __inline Void
     937TRenSingleModelC<iBM,bBitInc>::xInitRenderPartR(  Int iStartChangePos, Int iLastSPos )
     938{
     939    const Int iCurViewPos = 1;
    635940  // GET MINIMAL OCCLUDED SAMPLE POSITION
    636941  Int iCurPosX           = iStartChangePos;
    637942
    638   if ( ( iCurPosX - 1 > -1 ) && (m_apbOccludedRow[m_iCurViewPos][ iCurPosX - 1] ) )
     943  if ( ( iCurPosX - 1 > -1 ) && (m_pcInputSamplesRow[iCurViewPos][ iCurPosX - 1].bOccluded ) )
    639944  {
    640945    iCurPosX--;
    641     while ( (iCurPosX - 1 > -1 ) &&  (m_apbOccludedRow[m_iCurViewPos][ iCurPosX - 1] )  )
     946
     947    while ( (iCurPosX - 1 > -1 ) &&  (m_pcInputSamplesRow[iCurViewPos][ iCurPosX - 1].bOccluded  )  )
    642948      iCurPosX--;
    643949
     
    663969
    664970
    665 __inline Void
    666 TRenSingleModel::xRenderShiftedRangeL(Int iCurSPos, Int iLastSPos, Int iCurPos, RMDist& riError )
     971template <BlenMod iBM, Bool bBitInc> template<Bool bSet> __inline Void
     972TRenSingleModelC<iBM,bBitInc>::xRenderShiftedRangeL(Int iCurSPos, Int iLastSPos, Int iCurPos, RMDist& riError )
    667973{
    668974  assert( iCurSPos <= iLastSPos );
     
    672978  if ( iDeltaSPos > m_iGapTolerance )
    673979  {
    674     xFillHoleL( iCurSPos, iLastSPos, iCurPos, riError );
     980    xFillHoleL<bSet>( iCurSPos, iLastSPos, iCurPos, riError );
    675981  }
    676982  else
     
    679985      return;
    680986
    681     AOT( iDeltaSPos    > m_iGapTolerance );
     987    RM_AOT( iDeltaSPos    > m_iGapTolerance );
    682988
    683989    m_iThisDepth = m_iCurDepth;
    684     for (Int iFillSPos = max(0, xRangeLeftL(iCurSPos) ); iFillSPos <= min(xRangeRightL( iLastSPos ) ,m_iLastOccludedSPosFP-1); iFillSPos++ )
     990    for (Int iFillSPos = Max(0, xRangeLeftL(iCurSPos) ); iFillSPos <= min(xRangeRightL( iLastSPos ) ,m_iLastOccludedSPosFP-1); iFillSPos++ )
    685991    {
    686992      Int iDeltaCurSPos  = (iFillSPos << m_iShiftPrec) - iCurSPos;
    687993
    688       AOT( iDeltaCurSPos > iDeltaSPos );
    689       AOT( iDeltaCurSPos < 0 );
    690       AOT( m_aaiSubPelShiftL[iDeltaSPos][iDeltaCurSPos] == 0xdeaddead);
    691 
    692       Int iSourcePos = (iCurPos  << m_iShiftPrec) +  m_aaiSubPelShiftL[iDeltaSPos][iDeltaCurSPos];   // GT:  = iPosX - iStep + ( iStep * iDeltaCurPos + ( iDeltaPos >> 1) ) / iDeltaPos;
    693       xSetShiftedPel( iSourcePos, iFillSPos, REN_IS_FILLED, riError );
     994      RM_AOT( iDeltaCurSPos > iDeltaSPos );
     995      RM_AOT( iDeltaCurSPos < 0 );
     996      RM_AOT( m_aaiSubPelShiftL[iDeltaSPos][iDeltaCurSPos] == 0xdeaddead);
     997
     998      xSetShiftedPelL<bSet>( iCurPos, m_aaiSubPelShiftL[iDeltaSPos][iDeltaCurSPos], iFillSPos, REN_IS_FILLED, riError );
    694999    }
    6951000  };
    6961001}
    6971002
    698 __inline Void
    699 TRenSingleModel::xRenderShiftedRangeR(Int iCurSPos, Int iLastSPos, Int iCurPos, RMDist& riError )
     1003template <BlenMod iBM, Bool bBitInc> template<Bool bSet> __inline Void
     1004TRenSingleModelC<iBM,bBitInc>::xRenderShiftedRangeR(Int iCurSPos, Int iLastSPos, Int iCurPos, RMDist& riError )
    7001005{
    7011006  assert( iCurSPos >= iLastSPos );
    702   //assert( iRightSPos < m_iWidth );
    7031007
    7041008  Int iDeltaSPos = iCurSPos - iLastSPos;
    7051009  if ( iDeltaSPos > m_iGapTolerance )
    7061010  {
    707     xFillHoleR( iCurSPos, iLastSPos, iCurPos, riError );
     1011    xFillHoleR<bSet>( iCurSPos, iLastSPos, iCurPos, riError );
    7081012  }
    7091013  else
     
    7131017
    7141018    m_iThisDepth = m_iCurDepth;
    715     AOT( iDeltaSPos    > m_iGapTolerance );
     1019    RM_AOT( iDeltaSPos    > m_iGapTolerance );
    7161020    for (Int iFillSPos = max(m_iLastOccludedSPosFP+1, xRangeLeftR(iLastSPos) ); iFillSPos <= min(xRangeRightR( iCurSPos ) ,m_iWidth -1); iFillSPos++ )
    7171021    {
    7181022      Int iDeltaCurSPos  = (iFillSPos << m_iShiftPrec) - iLastSPos;
    7191023
    720       AOT( iDeltaCurSPos > iDeltaSPos );
    721       AOT( iDeltaCurSPos < 0 );
    722       AOT( m_aaiSubPelShiftR[iDeltaSPos][iDeltaCurSPos] == 0xdeaddead);
    723 
    724       Int iSourcePos = (iCurPos  << m_iShiftPrec) +  m_aaiSubPelShiftR[iDeltaSPos][iDeltaCurSPos];   // GT:  = iPosX - iStep + ( iStep * iDeltaCurPos + ( iDeltaPos >> 1) ) / iDeltaPos;
    725 
    726       xSetShiftedPel( iSourcePos, iFillSPos, REN_IS_FILLED, riError );
     1024      RM_AOT( iDeltaCurSPos > iDeltaSPos );
     1025      RM_AOT( iDeltaCurSPos < 0 );
     1026      RM_AOT( m_aaiSubPelShiftR[iDeltaSPos][iDeltaCurSPos] == 0xdeaddead);
     1027
     1028      xSetShiftedPelR<bSet>( iCurPos, m_aaiSubPelShiftR[iDeltaSPos][iDeltaCurSPos], iFillSPos, REN_IS_FILLED, riError );
    7271029    }
    7281030  };
     
    7311033
    7321034
    733 __inline Void
    734 TRenSingleModel::xRenderRangeL(Int iCurSPos, Int iLastSPos, Int iCurPos, RMDist& riError )
    735 {
     1035template <BlenMod iBM, Bool bBitInc> template<Bool bSet> __inline Void
     1036TRenSingleModelC<iBM,bBitInc>::xRenderRangeL(Int iCurSPos, Int iLastSPos, Int iCurPos, RMDist& riError )
     1037{
     1038  const Int iCurViewPos = 0;
    7361039  if (  !m_bInOcclusion )
    7371040  {
     
    7441047      {
    7451048        m_iThisDepth = m_iLastDepth;
    746         xSetShiftedPel( (iCurPos+1) << m_iShiftPrec, iRightSPosFP, REN_IS_FILLED, riError );
     1049
     1050        xSetShiftedPelL<bSet>( iCurPos+1, 0, iRightSPosFP, REN_IS_FILLED, riError );
    7471051      }
    7481052      m_iLastOccludedSPosFP = iRightSPosFP;
     
    7501054      m_bInOcclusion = true;
    7511055
    752       if ( m_bSet )
    753       {
    754         m_apbOccludedRow[m_iCurViewPos][ iCurPos ] = true;
     1056      if ( bSet )
     1057      {
     1058        m_pcInputSamplesRow[iCurViewPos][ iCurPos ].bOccluded = true;
    7551059      }
    7561060    }
    7571061    else
    7581062    {
    759       if ( m_bSet )
    760       {
    761         m_apbOccludedRow[m_iCurViewPos][ iCurPos ] = false;
    762       }
    763 
    764       xRenderShiftedRangeL(iCurSPos, iLastSPos, iCurPos, riError );
     1063      if ( bSet )
     1064      {
     1065        m_pcInputSamplesRow[iCurViewPos][ iCurPos ].bOccluded = false;
     1066      }
     1067
     1068      xRenderShiftedRangeL<bSet>(iCurSPos, iLastSPos, iCurPos, riError );
    7651069    }
    7661070  }
     
    7701074    {
    7711075      m_bInOcclusion = false;
    772       if ( m_bSet )
    773       {
    774         m_apbOccludedRow[m_iCurViewPos][ iCurPos ] = false;
    775       }
    776 
    777       xRenderShiftedRangeL(iCurSPos, iLastSPos, iCurPos, riError );
     1076      if ( bSet )
     1077      {
     1078        m_pcInputSamplesRow[iCurViewPos][ iCurPos ].bOccluded = false;
     1079      }
     1080
     1081      xRenderShiftedRangeL<bSet>(iCurSPos, iLastSPos, iCurPos, riError );
    7781082    }
    7791083    else
    7801084    {
    781       if ( m_bSet )
    782       {
    783         m_apbOccludedRow[m_iCurViewPos][ iCurPos ] = true;
    784       }
    785     }
    786   }
    787 }
    788 
    789 __inline Void
    790 TRenSingleModel::xRenderRangeR(Int iCurSPos, Int iLastSPos, Int iCurPos, RMDist& riError )
    791 {
     1085      if ( bSet )
     1086      {
     1087        m_pcInputSamplesRow[iCurViewPos][ iCurPos ].bOccluded  = true;
     1088      }
     1089    }
     1090  }
     1091}
     1092
     1093template <BlenMod iBM, Bool bBitInc> template<Bool bSet> __inline Void
     1094TRenSingleModelC<iBM,bBitInc>::xRenderRangeR(Int iCurSPos, Int iLastSPos, Int iCurPos, RMDist& riError )
     1095{
     1096  const Int iCurViewPos = 1;
    7921097  // Find out if current sample is occluded
    7931098  if (  !m_bInOcclusion )
     
    8011106      {
    8021107        m_iThisDepth = m_iLastDepth;
    803         xSetShiftedPel( (iCurPos-1) << m_iShiftPrec, iLeftSPosFP, REN_IS_FILLED, riError );
     1108        xSetShiftedPelR<bSet>( iCurPos-1,1 << m_iShiftPrec , iLeftSPosFP, REN_IS_FILLED, riError );
    8041109      }
    8051110      m_iLastOccludedSPosFP = iLeftSPosFP;
     
    8071112      m_bInOcclusion = true;
    8081113
    809       if ( m_bSet )
    810       {
    811         m_apbOccludedRow[m_iCurViewPos][ iCurPos ] = true;
     1114      if ( bSet )
     1115      {
     1116        m_pcInputSamplesRow[iCurViewPos][ iCurPos ].bOccluded = true;
    8121117      }
    8131118    }
    8141119    else
    8151120    {
    816       if ( m_bSet )
    817       {
    818         m_apbOccludedRow[m_iCurViewPos][ iCurPos ] = false;
    819       }
    820 
    821       xRenderShiftedRangeR(iCurSPos, iLastSPos, iCurPos, riError );
     1121      if ( bSet )
     1122      {
     1123        m_pcInputSamplesRow[iCurViewPos][ iCurPos ].bOccluded = false;
     1124      }
     1125
     1126      xRenderShiftedRangeR<bSet>(iCurSPos, iLastSPos, iCurPos, riError );
    8221127    }
    8231128  }
     
    8271132    {
    8281133      m_bInOcclusion = false;
    829       if ( m_bSet )
    830       {
    831         m_apbOccludedRow[m_iCurViewPos][ iCurPos ] = false;
    832       }
    833 
    834       xRenderShiftedRangeR(iCurSPos, iLastSPos, iCurPos, riError );
     1134      if ( bSet )
     1135      {
     1136        m_pcInputSamplesRow[iCurViewPos][ iCurPos ].bOccluded = false;
     1137      }
     1138
     1139      xRenderShiftedRangeR<bSet>(iCurSPos, iLastSPos, iCurPos, riError );
    8351140    }
    8361141    else
    8371142    {
    838       if ( m_bSet )
    839       {
    840         m_apbOccludedRow[m_iCurViewPos][ iCurPos ] = true;
    841       }
    842     }
    843   }
    844 }
    845 
    846 __inline Void
    847 TRenSingleModel::xFillHoleL( Int iCurSPos, Int iLastSPos, Int iCurPos, RMDist& riError )
     1143      if ( bSet )
     1144      {
     1145        m_pcInputSamplesRow[iCurViewPos][ iCurPos ].bOccluded = true;
     1146      }
     1147    }
     1148  }
     1149}
     1150
     1151template <BlenMod iBM, Bool bBitInc> template<Bool bSet> __inline Void
     1152TRenSingleModelC<iBM,bBitInc>::xFillHoleL( Int iCurSPos, Int iLastSPos, Int iCurPos, RMDist& riError )
    8481153{
    8491154  if (iLastSPos < 0)
     
    8611166    {
    8621167      m_iThisDepth = m_iCurDepth;
    863       xSetShiftedPel     ( iStartFillPos << m_iShiftPrec, iStartFillSPosFP, REN_IS_FILLED, riError );
     1168      xSetShiftedPelL<bSet>    ( iStartFillPos, 0, iStartFillSPosFP, REN_IS_FILLED, riError );
    8641169    }
    8651170  }
     
    8701175
    8711176  m_iThisDepth = m_iLastDepth;
    872   for (Int iFillSPos = max(iStartFillSPosFP+1,0); iFillSPos <= min(xRangeRightL( iLastSPos ), m_iLastOccludedSPosFP-1 ); iFillSPos++ )
    873   {
    874     xSetShiftedPel( iLastPos << m_iShiftPrec, iFillSPos, REN_IS_HOLE, riError );
    875   }
    876 }
    877 
    878 __inline Void
    879 TRenSingleModel::xFillHoleR( Int iCurSPos, Int iLastSPos, Int iCurPos, RMDist& riError )
     1177  for (Int iFillSPos = Max(iStartFillSPosFP+1,0); iFillSPos <= min(xRangeRightL( iLastSPos ), m_iLastOccludedSPosFP-1 ); iFillSPos++ )
     1178  {
     1179    xSetShiftedPelL<bSet>( iLastPos, 0, iFillSPos, REN_IS_HOLE, riError );
     1180  }
     1181}
     1182
     1183template <BlenMod iBM, Bool bBitInc> template<Bool bSet> __inline Void
     1184TRenSingleModelC<iBM,bBitInc>::xFillHoleR( Int iCurSPos, Int iLastSPos, Int iCurPos, RMDist& riError )
    8801185{
    8811186  if (iLastSPos < 0)
     
    8931198    {
    8941199      m_iThisDepth = m_iCurDepth;
    895       xSetShiftedPel( iEndFillPos << m_iShiftPrec, iStartFillSPosFP, REN_IS_FILLED, riError );
     1200      xSetShiftedPelR<bSet>( iEndFillPos, 1 << m_iShiftPrec , iStartFillSPosFP, REN_IS_FILLED, riError );
    8961201    }
    8971202  }
     
    9041209  for (Int iFillSPos = max(xRangeLeftR( iLastSPos ), m_iLastOccludedSPosFP+1); iFillSPos <= min(iStartFillSPosFP,m_iWidth)-1 ; iFillSPos++ )
    9051210  {
    906     xSetShiftedPel( iLastPos << m_iShiftPrec, iFillSPos, REN_IS_HOLE, riError );
    907   }
    908 }
    909 
    910 __inline Void
    911 TRenSingleModel::xExtrapolateMarginL(Int iCurSPos, Int iCurPos, RMDist& riError )
     1211    xSetShiftedPelR<bSet>( iLastPos, 1 << m_iShiftPrec, iFillSPos, REN_IS_HOLE, riError );
     1212  }
     1213}
     1214
     1215template <BlenMod iBM, Bool bBitInc> template<Bool bSet> __inline Void
     1216TRenSingleModelC<iBM,bBitInc>::xExtrapolateMarginL(Int iCurSPos, Int iCurPos, RMDist& riError )
    9121217{
    9131218//  if (iLeftSPos < 0 )
    9141219//    return;
    9151220
    916   Int iSPosFullPel = max(0,xRangeLeftL(iCurSPos));
     1221  Int iSPosFullPel = Max(0,xRangeLeftL(iCurSPos));
    9171222
    9181223  m_iThisDepth = m_iCurDepth;
    9191224  if (iSPosFullPel < m_iWidth)
    9201225  {
    921     xSetShiftedPel( iCurPos << m_iShiftPrec, iSPosFullPel, REN_IS_FILLED, riError );
     1226    xSetShiftedPelL<bSet>( iCurPos, 0, iSPosFullPel, REN_IS_FILLED, riError );
    9221227  }
    9231228
    9241229  for (Int iFillSPos = iSPosFullPel +1; iFillSPos < m_iWidth; iFillSPos++ )
    9251230  {
    926     xSetShiftedPel( iCurPos << m_iShiftPrec, iFillSPos, REN_IS_HOLE, riError );
    927   }
    928 }
    929 
    930 __inline Void
    931 TRenSingleModel::xExtrapolateMarginR(Int iCurSPos, Int iCurPos, RMDist& riError )
     1231    xSetShiftedPelL<bSet>( iCurPos, 0, iFillSPos, REN_IS_HOLE, riError );
     1232  }
     1233}
     1234
     1235template <BlenMod iBM, Bool bBitInc> template<Bool bSet> __inline Void
     1236TRenSingleModelC<iBM,bBitInc>::xExtrapolateMarginR(Int iCurSPos, Int iCurPos, RMDist& riError )
    9321237{
    9331238  //  if (iLeftSPos < 0 )
     
    9391244  if (iSPosFullPel > -1)
    9401245  {
    941     xSetShiftedPel( iCurPos << m_iShiftPrec, iSPosFullPel, REN_IS_FILLED, riError );
     1246    xSetShiftedPelR<bSet>( iCurPos, 1 << m_iShiftPrec, iSPosFullPel, REN_IS_FILLED, riError );
    9421247  }
    9431248
    9441249  for (Int iFillSPos = iSPosFullPel -1; iFillSPos > -1; iFillSPos-- )
    9451250  {
    946     xSetShiftedPel( iCurPos << m_iShiftPrec, iFillSPos, REN_IS_HOLE, riError );
    947   }
    948 }
    949 
    950 
    951 __inline Int
    952 TRenSingleModel::xShiftNewData( Int iPosX, Int iPosInNewData )
    953 {
    954   AOT( iPosInNewData <               0 );
    955   AOF( iPosInNewData < m_iNewDataWidth );
    956 
    957   return (iPosX << m_iShiftPrec) - m_ppiCurLUT[0][ RemoveBitIncrement( m_piNewDepthData[iPosInNewData] )];
    958 }
    959 
    960 __inline Int
    961 TRenSingleModel::xShift( Int iPosX )
    962 {
    963  AOT( iPosX <        0);
    964  AOF( iPosX < m_iWidth);
    965  return (iPosX  << m_iShiftPrec) - m_ppiCurLUT[0][ RemoveBitIncrement( m_apiBaseDepthPelRow[m_iCurViewPos][iPosX] )];
    966 }
    967 
    968 
    969 __inline Int
    970 TRenSingleModel::xShift( Int iPos, Int iPosInNewData )
     1251    xSetShiftedPelR<bSet>( iCurPos , 1 << m_iShiftPrec, iFillSPos, REN_IS_HOLE, riError );
     1252  }
     1253}
     1254
     1255template <BlenMod iBM, Bool bBitInc> __inline Int
     1256TRenSingleModelC<iBM,bBitInc>::xShiftNewData( Int iPosX, Int iPosInNewData )
     1257{
     1258  RM_AOT( iPosInNewData <               0 );
     1259  RM_AOF( iPosInNewData < m_iNewDataWidth );
     1260
     1261  return (iPosX << m_iShiftPrec) - m_ppiCurLUT[0][ RenModRemoveBitInc( m_piNewDepthData[iPosInNewData] )];
     1262}
     1263
     1264template <BlenMod iBM, Bool bBitInc> __inline Int
     1265TRenSingleModelC<iBM,bBitInc>::xShift( Int iPosX )
     1266{
     1267 RM_AOT( iPosX <        0);
     1268 RM_AOF( iPosX < m_iWidth);
     1269
     1270 return (iPosX  << m_iShiftPrec) - m_ppiCurLUT[0][ RenModRemoveBitInc( m_pcInputSamplesRow[m_iCurViewPos][iPosX].iD )];
     1271}
     1272
     1273
     1274template <BlenMod iBM, Bool bBitInc> __inline Int
     1275TRenSingleModelC<iBM,bBitInc>::xShift( Int iPos, Int iPosInNewData )
    9711276{
    9721277  if ( (iPosInNewData >= 0) && (iPosInNewData < m_iNewDataWidth) )
     
    9801285}
    9811286
    982 __inline Int
    983 TRenSingleModel::xRangeLeftL( Int iPos )
     1287template <BlenMod iBM, Bool bBitInc> __inline Int
     1288TRenSingleModelC<iBM,bBitInc>::xRangeLeftL( Int iPos )
    9841289{
    9851290  return  ( iPos +  (1 << m_iShiftPrec) - 1) >> m_iShiftPrec;
     
    9871292
    9881293
    989 __inline Int
    990 TRenSingleModel::xRangeLeftR( Int iPos )
     1294template <BlenMod iBM, Bool bBitInc> __inline Int
     1295TRenSingleModelC<iBM,bBitInc>::xRangeLeftR( Int iPos )
    9911296{
    9921297
     
    9951300
    9961301
    997 __inline Int
    998 TRenSingleModel::xRangeRightL( Int iPos )
     1302template <BlenMod iBM, Bool bBitInc> __inline Int
     1303TRenSingleModelC<iBM,bBitInc>::xRangeRightL( Int iPos )
    9991304{
    10001305  return xRangeLeftL(iPos) - 1;
    10011306}
    10021307
    1003 __inline Int
    1004 TRenSingleModel::xRangeRightR( Int iPos )
     1308template <BlenMod iBM, Bool bBitInc> __inline Int
     1309TRenSingleModelC<iBM,bBitInc>::xRangeRightR( Int iPos )
    10051310{
    10061311  return iPos >> m_iShiftPrec;
     
    10081313
    10091314
    1010 __inline Int
    1011 TRenSingleModel::xRoundL( Int iPos )
     1315template <BlenMod iBM, Bool bBitInc> __inline Int
     1316TRenSingleModelC<iBM,bBitInc>::xRoundL( Int iPos )
    10121317{
    10131318  return  (iPos + (( 1 << m_iShiftPrec ) >> 1 )) >> m_iShiftPrec;
    10141319}
    10151320
    1016 __inline Int
    1017 TRenSingleModel::xRoundR( Int iPos )
     1321template <BlenMod iBM, Bool bBitInc> __inline Int
     1322TRenSingleModelC<iBM,bBitInc>::xRoundR( Int iPos )
    10181323{
    10191324  return  (m_iShiftPrec == 0) ? iPos : xRoundL(iPos - 1);
     
    10211326
    10221327
    1023 Void
    1024 TRenSingleModel::xSetPels( Pel* piPelSource , Int iSourceStride, Int iWidth, Int iHeight, Pel iVal )
     1328template <BlenMod iBM, Bool bBitInc> Void
     1329TRenSingleModelC<iBM,bBitInc>::xSetPels( Pel* piPelSource , Int iSourceStride, Int iWidth, Int iHeight, Pel iVal )
    10251330{
    10261331  for (Int iYPos = 0; iYPos < iHeight; iYPos++)
     
    10341339}
    10351340
    1036 Void
    1037 TRenSingleModel::xSetInts( Int* piPelSource , Int iSourceStride, Int iWidth, Int iHeight, Int iVal )
     1341template <BlenMod iBM, Bool bBitInc> Void
     1342TRenSingleModelC<iBM,bBitInc>::xSetInts( Int* piPelSource , Int iSourceStride, Int iWidth, Int iHeight, Int iVal )
    10381343{
    10391344  for (Int iYPos = 0; iYPos < iHeight; iYPos++)
     
    10481353
    10491354
    1050 Void
    1051 TRenSingleModel::xSetBools( Bool* pbPelSource , Int iSourceStride, Int iWidth, Int iHeight, Bool bVal )
     1355template <BlenMod iBM, Bool bBitInc> Void
     1356TRenSingleModelC<iBM,bBitInc>::xSetBools( Bool* pbPelSource , Int iSourceStride, Int iWidth, Int iHeight, Bool bVal )
    10521357{
    10531358  for (Int iYPos = 0; iYPos < iHeight; iYPos++)
     
    10611366}
    10621367
    1063 Void
    1064 TRenSingleModel::xInitView( Int iViewPos )
    1065 {
    1066   AOT( iViewPos == VIEWPOS_MERGED && ( m_iMode == 0 || m_iMode == 1 ) );
    1067 
    1068   xSetPels( m_aapiSynthVideoPel[iViewPos][0], m_iStride, m_iWidth, m_iHeight, 0 );
    1069   xSetPels( m_aapiSynthVideoPel[iViewPos][1], m_iStride, m_iWidth, m_iHeight, 128 << g_uiBitIncrement );
    1070   xSetPels( m_aapiSynthVideoPel[iViewPos][2], m_iStride, m_iWidth, m_iHeight, 128 << g_uiBitIncrement );
    1071 
    1072   if ( iViewPos != VIEWPOS_MERGED)
    1073   {
    1074     xSetBools( m_apbOccluded     [iViewPos],  m_iStride, m_iWidth, m_iHeight, false );
    1075     xSetPels ( m_apiFilled       [iViewPos],  m_iStride, m_iWidth, m_iHeight, REN_IS_HOLE);
    1076     if ( m_iMode == 2 )
    1077     {
    1078       xSetPels( m_apiSynthDepthPel [iViewPos],  m_iStride, m_iWidth, m_iHeight, 0);
    1079     }
    1080   }
    1081 }
    1082 
    1083 __inline Void
    1084 TRenSingleModel::xSetShiftedPel(Int iSourcePos, Int iTargetSPos, Pel iFilled, RMDist& riError )
    1085 {
    1086   AOT( iSourcePos < 0         );
    1087   AOT( iSourcePos >= m_iSampledWidth );
    1088 
    1089   AOT( iTargetSPos < 0         );
    1090   AOT( iTargetSPos >= m_iWidth );
    1091 //  AOT(  m_apiFilledRow[m_iViewPos][iTargetSPos] != REN_IS_HOLE);
    1092 
    1093   if ( m_iMode == 2)
    1094   {
    1095     xSetShiftedPelBlend(iSourcePos, iTargetSPos, iFilled, riError );
    1096     return;
    1097   }
    1098 
    1099   if ( m_bSet )
    1100   {
    1101     m_aapiSynthVideoPelRow[m_iCurViewPos][0][iTargetSPos] = m_aapiBaseVideoPelRow[m_iCurViewPos][0][iSourcePos];
    1102 #if HHI_VSO_COLOR_PLANES
    1103     m_aapiSynthVideoPelRow[m_iCurViewPos][1][iTargetSPos] = m_aapiBaseVideoPelRow[m_iCurViewPos][1][iSourcePos];
    1104     m_aapiSynthVideoPelRow[m_iCurViewPos][2][iTargetSPos] = m_aapiBaseVideoPelRow[m_iCurViewPos][2][iSourcePos];
    1105 #endif
    1106     m_apiFilledRow        [m_iCurViewPos]   [iTargetSPos] = iFilled;
    1107     Int iDiffY = m_aapiRefVideoPelRow    [0][iTargetSPos] - m_aapiSynthVideoPelRow[m_iCurViewPos][0][iTargetSPos];
    1108 #if HHI_VSO_COLOR_PLANES
    1109     Int iDiffU = m_aapiRefVideoPelRow    [1][iTargetSPos] - m_aapiSynthVideoPelRow[m_iCurViewPos][1][iTargetSPos];
    1110     Int iDiffV = m_aapiRefVideoPelRow    [2][iTargetSPos] - m_aapiSynthVideoPelRow[m_iCurViewPos][2][iTargetSPos];
    1111     m_apiErrorRow                           [iTargetSPos] = xGetDist( iDiffY, iDiffU, iDiffV);
    1112 #else
    1113     m_apiErrorRow                           [iTargetSPos] = xGetDist(iDiffY);
    1114 #endif
     1368template <BlenMod iBM, Bool bBitInc> template<Bool bSet> __inline Void
     1369TRenSingleModelC<iBM,bBitInc>::xSetShiftedPelL(Int iSourcePos, Int iSubSourcePos, Int iTargetSPos, Pel iFilled, RMDist& riError )
     1370{
     1371  RM_AOT( iSourcePos    <  0                   );
     1372  RM_AOT( iSourcePos    >= m_iWidth            );
     1373  RM_AOT( iSubSourcePos < 0                    );
     1374  RM_AOT( iSubSourcePos >  (1 << m_iShiftPrec) );
     1375  RM_AOT( iTargetSPos   < 0                    );
     1376  RM_AOT( iTargetSPos   >= m_iWidth            ); 
     1377
     1378  RenModelOutPels* pcOutSample = m_pcOutputSamplesRow              + iTargetSPos;
     1379  RenModelInPels * pcInSample  = m_pcInputSamplesRow[VIEWPOS_LEFT] + iSourcePos ;
     1380
     1381  if ( iBM != BLEND_NONE )
     1382  {
     1383    xSetShiftedPelBlendL<bSet>  (pcInSample, iSubSourcePos, pcOutSample, iFilled, riError);
    11151384  }
    11161385  else
    11171386  {
    1118     Int iSDOld   = m_apiErrorRow            [iTargetSPos];
    1119     Int iDiffY   = m_aapiRefVideoPelRow  [0][iTargetSPos] - m_aapiBaseVideoPelRow [m_iCurViewPos][0][iSourcePos];
    1120 #if HHI_VSO_COLOR_PLANES
    1121     Int iDiffU   = m_aapiRefVideoPelRow  [1][iTargetSPos] - m_aapiBaseVideoPelRow [m_iCurViewPos][1][iSourcePos];
    1122     Int iDiffV   = m_aapiRefVideoPelRow  [2][iTargetSPos] - m_aapiBaseVideoPelRow [m_iCurViewPos][2][iSourcePos];
    1123     riError     += ( xGetDist(iDiffY,iDiffU,iDiffV) - iSDOld  );
    1124 #else
    1125     riError     +=  ( xGetDist( iDiffY ) - iSDOld );
    1126 #endif
    1127   }
    1128 }
    1129 
    1130 __inline Void
    1131 TRenSingleModel::xSetShiftedPelBlend( Int iSourcePos, Int iTargetSPos, Pel iFilled, RMDist& riError )
    1132 {
    1133   AOT( iSourcePos < 0         );
    1134   AOT( iSourcePos >= m_iSampledWidth );
    1135 
    1136   AOT( iTargetSPos < 0         );
    1137   AOT( iTargetSPos >= m_iWidth );
    1138   //  AOT(  m_apiFilledRow[m_iViewPos][iTargetSPos] != REN_IS_HOLE);
    1139 
     1387    xSetShiftedPelNoBlendL<bSet>(pcInSample, iSubSourcePos, pcOutSample, iFilled, riError);
     1388  }
     1389}
     1390
     1391template <BlenMod iBM, Bool bBitInc> template<Bool bSet> __inline Void
     1392TRenSingleModelC<iBM,bBitInc>::xSetShiftedPelNoBlendL(RenModelInPels* pcInSample, Int iSubSourcePos, RenModelOutPels* pcOutSample, Pel iFilled, RMDist& riError )
     1393{
     1394  if ( bSet )
     1395  {
     1396    // Filled
     1397    pcOutSample->iFilledLeft = iFilled;
     1398
     1399    // Yuv
     1400    pcOutSample->iYLeft  = pcInSample->aiY[iSubSourcePos];
     1401#if HHI_VSO_COLOR_PLANES
     1402    pcOutSample->iULeft  = pcInSample->aiU[iSubSourcePos];
     1403    pcOutSample->iVLeft  = pcInSample->aiV[iSubSourcePos];
     1404
     1405    pcOutSample->iError = xGetDist( pcOutSample->iYLeft - pcOutSample->iYRef,
     1406                                    pcOutSample->iULeft - pcOutSample->iURef,   
     1407                                    pcOutSample->iVLeft - pcOutSample->iVRef
     1408                                  );   
     1409#else
     1410    pcOutSample->iError = xGetDist( pcOutSample->iYLeft - pcOutSample->iYRef );   
     1411#endif   
     1412   
     1413  }
     1414  else
     1415  {
     1416#if HHI_VSO_COLOR_PLANES
     1417    riError += xGetDist( pcInSample->aiY[iSubSourcePos] - pcOutSample->iYRef,
     1418                         pcInSample->aiU[iSubSourcePos] - pcOutSample->iURef,
     1419                         pcInSample->aiV[iSubSourcePos] - pcOutSample->iVRef
     1420                       );
     1421#else               
     1422    riError += xGetDist( pcInSample->aiY[iSubSourcePos] - pcOutSample->iYRef );
     1423#endif
     1424
     1425    riError -= pcOutSample->iError;
     1426  }
     1427}
     1428
     1429template <BlenMod iBM, Bool bBitInc> template<Bool bSet> __inline Void
     1430TRenSingleModelC<iBM,bBitInc>::xSetShiftedPelBlendL(RenModelInPels* pcInSample, Int iSubSourcePos, RenModelOutPels* pcOutSample, Pel iFilled, RMDist& riError )
     1431{
    11401432  Pel piBlendedValueY;
    11411433#if HHI_VSO_COLOR_PLANES
     
    11441436#endif
    11451437
    1146 
    1147   if (m_iCurViewPos == 0)
    1148   {
    1149     xGetBlendedValue (
    1150       m_aapiBaseVideoPelRow                                    [0][0][iSourcePos ]  ,
    1151       m_aapiSynthVideoPelRow                                   [1][0][iTargetSPos]  ,
    1152 #if HHI_VSO_COLOR_PLANES
    1153       m_aapiBaseVideoPelRow                                    [0][1][iSourcePos ]  ,
    1154       m_aapiSynthVideoPelRow                                   [1][1][iTargetSPos]  ,
    1155       m_aapiBaseVideoPelRow                                    [0][2][iSourcePos ]  ,
    1156       m_aapiSynthVideoPelRow                                   [1][2][iTargetSPos]  ,
    1157 #endif
    1158       m_piInvZLUTLeft [RemoveBitIncrement(m_iThisDepth)                            ],
    1159       m_piInvZLUTRight[RemoveBitIncrement(m_apiSynthDepthPelRow[1]   [iTargetSPos])],
    1160       iFilled,
    1161       m_apiFilledRow                                           [1]   [iTargetSPos]  ,
    1162       piBlendedValueY
     1438  xGetBlendedValue (
     1439    pcInSample ->aiY[iSubSourcePos],
     1440    pcOutSample->iYRight,   
     1441#if HHI_VSO_COLOR_PLANES
     1442    pcInSample ->aiU[iSubSourcePos],
     1443    pcOutSample->iURight,   
     1444    pcInSample ->aiV[iSubSourcePos],
     1445    pcOutSample->iVRight,   
     1446#endif
     1447    m_piInvZLUTLeft [RenModRemoveBitInc(m_iThisDepth)        ],
     1448    m_piInvZLUTRight[RenModRemoveBitInc(pcOutSample->iDRight)],
     1449    iFilled,
     1450    pcOutSample->iFilledRight  ,
     1451    piBlendedValueY
    11631452#if HHI_VSO_COLOR_PLANES
    11641453    , piBlendedValueU,
    1165       piBlendedValueV
     1454    piBlendedValueV
    11661455#endif
    11671456    );
     1457
     1458  if ( bSet )
     1459  {   
     1460    // Set values
     1461    pcOutSample->iDLeft      = m_iThisDepth;
     1462    pcOutSample->iYLeft      = pcInSample ->aiY[iSubSourcePos];
     1463    pcOutSample->iYBlended   = piBlendedValueY;   
     1464#if HHI_VSO_COLOR_PLANES 
     1465    pcOutSample->iULeft      = pcInSample ->aiU[iSubSourcePos];
     1466    pcOutSample->iUBlended   = piBlendedValueU;   
     1467    pcOutSample->iVLeft      = pcInSample ->aiV[iSubSourcePos];
     1468    pcOutSample->iVBlended   = piBlendedValueV;   
     1469#endif
     1470    pcOutSample->iFilledLeft = iFilled;
     1471
     1472    // Get Error
     1473    Int iDiffY = pcOutSample->iYRef - piBlendedValueY;
     1474#if HHI_VSO_COLOR_PLANES
     1475    Int iDiffU = pcOutSample->iURef - piBlendedValueU;
     1476    Int iDiffV = pcOutSample->iVRef - piBlendedValueV;
     1477    pcOutSample->iError  = xGetDist(iDiffY, iDiffU, iDiffV );
     1478#else
     1479    pcOutSample->iError  = xGetDist(iDiffY );
     1480#endif
    11681481  }
    11691482  else
    11701483  {
    1171     xGetBlendedValue (
    1172       m_aapiSynthVideoPelRow                                   [0][0][iTargetSPos],
    1173       m_aapiBaseVideoPelRow                                    [1][0][iSourcePos ],
    1174 #if HHI_VSO_COLOR_PLANES
    1175       m_aapiSynthVideoPelRow                                   [0][1][iTargetSPos],
    1176       m_aapiBaseVideoPelRow                                    [1][1][iSourcePos ],
    1177       m_aapiSynthVideoPelRow                                   [0][2][iTargetSPos],
    1178       m_aapiBaseVideoPelRow                                    [1][2][iSourcePos ],
    1179 #endif
    1180       m_piInvZLUTLeft [RemoveBitIncrement(m_apiSynthDepthPelRow[0]   [iTargetSPos])],
    1181       m_piInvZLUTRight[RemoveBitIncrement(m_iThisDepth)                            ],
    1182       m_apiFilledRow                                           [0]   [iTargetSPos],
    1183       iFilled                                                                     ,
    1184       piBlendedValueY
     1484    Int iDiffY = pcOutSample->iYRef - piBlendedValueY;
     1485#if HHI_VSO_COLOR_PLANES
     1486    Int iDiffU = pcOutSample->iURef - piBlendedValueU;
     1487    Int iDiffV = pcOutSample->iVRef - piBlendedValueV;
     1488    riError   += ( xGetDist( iDiffY, iDiffU, iDiffV ) - pcOutSample->iError );
     1489
     1490#else
     1491    riError   += ( xGetDist( iDiffY ) - pcOutSample->iError  );
     1492#endif
     1493
     1494  }
     1495}
     1496
     1497
     1498template <BlenMod iBM, Bool bBitInc> template<Bool bSet> __inline Void
     1499TRenSingleModelC<iBM,bBitInc>::xSetShiftedPelR(Int iSourcePos, Int iSubSourcePos, Int iTargetSPos, Pel iFilled, RMDist& riError )
     1500{
     1501  RM_AOT( iSourcePos    <  0                     );
     1502  RM_AOT( iSourcePos    >= m_iWidth              );
     1503  RM_AOT( iSubSourcePos <  0                     );
     1504  RM_AOT( iSubSourcePos >= (1 << m_iShiftPrec)+1 );
     1505  RM_AOT( iTargetSPos   < 0                      );
     1506  RM_AOT( iTargetSPos   >= m_iWidth              ); 
     1507
     1508  RenModelOutPels* pcOutSample = m_pcOutputSamplesRow               + iTargetSPos;
     1509  RenModelInPels * pcInSample  = m_pcInputSamplesRow[VIEWPOS_RIGHT] + iSourcePos ;
     1510
     1511  if ( iBM != BLEND_NONE )
     1512  {
     1513    xSetShiftedPelBlendR<bSet>   (pcInSample, iSubSourcePos, pcOutSample, iFilled, riError);
     1514  }
     1515  else
     1516  {
     1517    xSetShiftedPelNoBlendR<bSet> (pcInSample, iSubSourcePos, pcOutSample, iFilled, riError);
     1518  }
     1519}
     1520
     1521template <BlenMod iBM, Bool bBitInc> template<Bool bSet> __inline Void
     1522TRenSingleModelC<iBM,bBitInc>::xSetShiftedPelNoBlendR(RenModelInPels* pcInSample, Int iSubSourcePos, RenModelOutPels* pcOutSample, Pel iFilled, RMDist& riError )
     1523{
     1524  if ( bSet )
     1525  {
     1526    // Filled
     1527    pcOutSample->iFilledRight = iFilled;
     1528
     1529    // Yuv
     1530    pcOutSample->iYRight  = pcInSample->aiY[iSubSourcePos];
     1531#if HHI_VSO_COLOR_PLANES
     1532    pcOutSample->iURight  = pcInSample->aiU[iSubSourcePos];
     1533    pcOutSample->iVRight  = pcInSample->aiV[iSubSourcePos];
     1534
     1535    pcOutSample->iError = xGetDist(
     1536      pcOutSample->iYRight - pcOutSample->iYRef,
     1537      pcOutSample->iURight - pcOutSample->iURef,   
     1538      pcOutSample->iVRight - pcOutSample->iVRef
     1539      );   
     1540#else
     1541    pcOutSample->iError = xGetDist( pcOutSample->iYRight - pcOutSample->iYRef );   
     1542#endif   
     1543
     1544  }
     1545  else
     1546  {
     1547#if HHI_VSO_COLOR_PLANES
     1548    riError += xGetDist( pcInSample->aiY[iSubSourcePos] - pcOutSample->iYRef,
     1549      pcInSample->aiU[iSubSourcePos] - pcOutSample->iURef,
     1550      pcInSample->aiV[iSubSourcePos] - pcOutSample->iVRef
     1551      );
     1552#else               
     1553    riError += xGetDist( pcInSample->aiY[iSubSourcePos] - pcOutSample->iYRef );
     1554#endif
     1555
     1556    riError -= pcOutSample->iError;
     1557  }
     1558}
     1559
     1560template <BlenMod iBM, Bool bBitInc> template<Bool bSet> __inline Void
     1561TRenSingleModelC<iBM,bBitInc>::xSetShiftedPelBlendR(RenModelInPels* pcInSample, Int iSubSourcePos, RenModelOutPels* pcOutSample, Pel iFilled, RMDist& riError )
     1562{
     1563  Pel piBlendedValueY;
     1564#if HHI_VSO_COLOR_PLANES
     1565  Pel piBlendedValueU;
     1566  Pel piBlendedValueV;
     1567#endif
     1568
     1569  xGetBlendedValue (
     1570    pcOutSample->iYLeft,
     1571    pcInSample ->aiY[iSubSourcePos],       
     1572#if HHI_VSO_COLOR_PLANES
     1573    pcOutSample->iULeft,   
     1574    pcInSample ->aiU[iSubSourcePos],
     1575    pcOutSample->iVLeft,   
     1576    pcInSample ->aiV[iSubSourcePos],
     1577#endif
     1578    m_piInvZLUTLeft  [RenModRemoveBitInc(pcOutSample->iDLeft)],
     1579    m_piInvZLUTRight [RenModRemoveBitInc(m_iThisDepth)       ],
     1580    pcOutSample->iFilledLeft,
     1581    iFilled,
     1582    piBlendedValueY
    11851583#if HHI_VSO_COLOR_PLANES
    11861584    , piBlendedValueU,
    1187       piBlendedValueV
     1585    piBlendedValueV
    11881586#endif
    11891587    );
    1190   }
    1191 
    1192   if ( m_bSet )
    1193   {
    1194     m_apiSynthDepthPelRow [m_iCurViewPos]   [iTargetSPos] = m_iThisDepth;
    1195     m_aapiSynthVideoPelRow[m_iCurViewPos][0][iTargetSPos] = m_aapiBaseVideoPelRow[m_iCurViewPos][0][iSourcePos];
    1196     m_aapiSynthVideoPelRow[2            ][0][iTargetSPos] = piBlendedValueY;
    1197 #if HHI_VSO_COLOR_PLANES
    1198     m_aapiSynthVideoPelRow[m_iCurViewPos][1][iTargetSPos] = m_aapiBaseVideoPelRow[m_iCurViewPos][1][iSourcePos];
    1199     m_aapiSynthVideoPelRow[2            ][1][iTargetSPos] = piBlendedValueU;
    1200     m_aapiSynthVideoPelRow[m_iCurViewPos][2][iTargetSPos] = m_aapiBaseVideoPelRow[m_iCurViewPos][2][iSourcePos];
    1201     m_aapiSynthVideoPelRow[2            ][2][iTargetSPos] = piBlendedValueV;
    1202 #endif
    1203     m_apiFilledRow        [m_iCurViewPos]   [iTargetSPos] = iFilled;
    1204 
    1205     Int iDiffY = m_aapiRefVideoPelRow    [0][iTargetSPos] - piBlendedValueY;
    1206 #if HHI_VSO_COLOR_PLANES
    1207     Int iDiffU = m_aapiRefVideoPelRow    [1][iTargetSPos] - piBlendedValueU;
    1208     Int iDiffV = m_aapiRefVideoPelRow    [2][iTargetSPos] - piBlendedValueV;
    1209     m_apiErrorRow                           [iTargetSPos] = xGetDist(iDiffY, iDiffU, iDiffV );
    1210 #else
    1211     m_apiErrorRow                           [iTargetSPos] = xGetDist(iDiffY);
     1588
     1589  if ( bSet )
     1590  {   
     1591    // Set values
     1592    pcOutSample->iDRight     = m_iThisDepth;
     1593    pcOutSample->iYRight     = pcInSample ->aiY[iSubSourcePos];
     1594    pcOutSample->iYBlended   = piBlendedValueY;   
     1595#if HHI_VSO_COLOR_PLANES 
     1596    pcOutSample->iURight     = pcInSample ->aiU[iSubSourcePos];
     1597    pcOutSample->iUBlended   = piBlendedValueU;   
     1598    pcOutSample->iVRight     = pcInSample ->aiV[iSubSourcePos];
     1599    pcOutSample->iVBlended   = piBlendedValueV;   
     1600#endif
     1601    pcOutSample->iFilledRight = iFilled;
     1602
     1603    // Get Error
     1604    Int iDiffY = pcOutSample->iYRef - piBlendedValueY;
     1605#if HHI_VSO_COLOR_PLANES
     1606    Int iDiffU = pcOutSample->iURef - piBlendedValueU;
     1607    Int iDiffV = pcOutSample->iVRef - piBlendedValueV;
     1608    pcOutSample->iError  = xGetDist(iDiffY, iDiffU, iDiffV );
     1609#else
     1610    pcOutSample->iError  = xGetDist(iDiffY );
    12121611#endif
    12131612  }
    12141613  else
    12151614  {
    1216     Int iSDOld   = m_apiErrorRow            [iTargetSPos];
    1217     Int iDiffY = m_aapiRefVideoPelRow    [0][iTargetSPos] - piBlendedValueY;
    1218 #if HHI_VSO_COLOR_PLANES
    1219     Int iDiffU = m_aapiRefVideoPelRow    [1][iTargetSPos] - piBlendedValueU;
    1220     Int iDiffV = m_aapiRefVideoPelRow    [2][iTargetSPos] - piBlendedValueV;
    1221     riError   += ( xGetDist( iDiffY, iDiffU, iDiffV ) - iSDOld );
    1222 #else
    1223     riError   += ( xGetDist( iDiffY )- iSDOld  );
    1224 #endif
    1225   }
    1226 }
    1227 
    1228 
    1229 __inline Int
    1230 TRenSingleModel::xGetDist( Int iDiffY, Int iDiffU, Int iDiffV )
    1231 {
    1232   return (          ((iDiffY * iDiffY) >> m_iDistShift)
    1233              +  ((( ((iDiffU * iDiffU) >> m_iDistShift)
    1234                    +((iDiffV * iDiffV) >> m_iDistShift)
     1615    Int iDiffY = pcOutSample->iYRef - piBlendedValueY;
     1616#if HHI_VSO_COLOR_PLANES
     1617    Int iDiffU = pcOutSample->iURef - piBlendedValueU;
     1618    Int iDiffV = pcOutSample->iVRef - piBlendedValueV;
     1619    riError   += ( xGetDist( iDiffY, iDiffU, iDiffV ) - pcOutSample->iError );
     1620#else
     1621    riError   += ( xGetDist( iDiffY ) -  pcOutSample->iError  );
     1622#endif
     1623  }
     1624}
     1625
     1626template <BlenMod iBM, Bool bBitInc> __inline Int
     1627TRenSingleModelC<iBM,bBitInc>::xGetDist( Int iDiffY, Int iDiffU, Int iDiffV )
     1628{
     1629
     1630  if ( !bBitInc )
     1631  {
     1632    return (          (iDiffY * iDiffY )
     1633               +  ((( (iDiffU * iDiffU )
     1634                     +(iDiffV * iDiffV )
     1635                    )
     1636                   ) >> 2
    12351637                  )
    1236                  ) >> 2
    1237                 )
    1238          );
    1239 }
    1240 
    1241 __inline Int
    1242 TRenSingleModel::xGetDist( Int iDiffY )
    1243 {
    1244   return ((iDiffY * iDiffY) >> m_iDistShift);
    1245 }
    1246 
    1247 #if HHI_VSO_COLOR_PLANES
    1248 __inline Void
    1249 TRenSingleModel::xGetBlendedValue( Pel iYL, Pel iYR, Pel iUL, Pel iUR, Pel iVL, Pel iVR, Pel iDepthL, Pel iDepthR, Int iFilledL, Int iFilledR, Pel& riY, Pel& riU, Pel&riV )
    1250 #else
    1251 Void
    1252 TRenSingleModel::xGetBlendedValue( Pel iYL, Pel iYR, Pel iDepthL, Pel iDepthR, Int iFilledL, Int iFilledR, Pel& riY )
    1253 #endif
    1254 {
    1255   if (m_iBlendMode != 0 )
    1256   {
    1257     if (m_iBlendMode == 1 )
     1638           );
     1639  }
     1640  else
     1641  {
     1642    return (          ((iDiffY * iDiffY) >> m_iDistShift)
     1643               +  ((( ((iDiffU * iDiffU) >> m_iDistShift)
     1644                     +((iDiffV * iDiffV) >> m_iDistShift)
     1645                    )
     1646                   ) >> 2
     1647                  )
     1648           );
     1649 
     1650  }
     1651}
     1652
     1653template <BlenMod iBM, Bool bBitInc> __inline Int
     1654TRenSingleModelC<iBM,bBitInc>::xGetDist( Int iDiffY )
     1655{
     1656  if ( !bBitInc )
     1657  {
     1658    return (iDiffY * iDiffY);
     1659  }
     1660  else
     1661  {
     1662    return ((iDiffY * iDiffY) >> m_iDistShift);
     1663  }
     1664
     1665}
     1666
     1667
     1668#if HHI_VSO_COLOR_PLANES
     1669template <BlenMod iBM, Bool bBitInc>  __inline Void
     1670TRenSingleModelC<iBM,bBitInc>::xGetBlendedValue( Pel iYL, Pel iYR, Pel iUL, Pel iUR, Pel iVL, Pel iVR, Pel iDepthL, Pel iDepthR, Int iFilledL, Int iFilledR, Pel& riY, Pel& riU, Pel&riV )
     1671#else
     1672template <BlenMod iBM, Bool bBitInc>  __inline Void
     1673TRenSingleModelC<iBM,bBitInc>::xGetBlendedValue( Pel iYL, Pel iYR, Pel iDepthL, Pel iDepthR, Int iFilledL, Int iFilledR, Pel& riY )
     1674#endif
     1675{
     1676
     1677  RM_AOT( iBM != BLEND_AVRG && iBM != BLEND_LEFT && iBM != BLEND_RIGHT );
     1678
     1679  if (iBM != BLEND_AVRG )
     1680  {
     1681    if (iBM == BLEND_LEFT )
    12581682    {
    12591683#if HHI_VSO_COLOR_PLANES
     
    12991723      else
    13001724      {
    1301 #if HHI_FIX
    13021725        riY = xBlend( iYL, iYR, m_iBlendDistWeight );
    13031726#if HHI_VSO_COLOR_PLANES   
     
    13051728        riV = xBlend( iVL, iVR, m_iBlendDistWeight );
    13061729#endif
    1307 #else
    1308         riY = xBlend( iYR, iYL, m_iBlendDistWeight );
    1309 #if HHI_VSO_COLOR_PLANES
    1310         riU = xBlend( iUR, iUL, m_iBlendDistWeight );
    1311         riV = xBlend( iVR, iVL, m_iBlendDistWeight );
    1312 #endif
    1313 #endif
    13141730      }
    13151731    }
     
    13691785    }
    13701786  }
    1371 
    1372 }
    1373 
    1374 __inline Void
    1375 #if HHI_VSO_COLOR_PLANES
    1376 TRenSingleModel::xGetBlendedValueBM1( Pel iYL, Pel iYR, Pel iUL, Pel iUR, Pel iVL, Pel iVR, Pel iDepthL, Pel iDepthR, Int iFilledL, Int iFilledR, Pel& riY, Pel& riU, Pel&riV )
    1377 #else
    1378 TRenSingleModel::xGetBlendedValueBM1( Pel iYL, Pel iYR, Pel iDepthL, Pel iDepthR, Int iFilledL, Int iFilledR, Pel& riY )
    1379 #endif
    1380 {
    1381   if      ( iFilledL == REN_IS_FILLED ||  iFilledR == REN_IS_HOLE )
     1787}
     1788
     1789template <BlenMod iBM, Bool bBitInc> __inline Void
     1790#if HHI_VSO_COLOR_PLANES
     1791TRenSingleModelC<iBM,bBitInc>::xGetBlendedValueBM1( Pel iYL, Pel iYR, Pel iUL, Pel iUR, Pel iVL, Pel iVR, Pel iDepthL, Pel iDepthR, Int iFilledL, Int iFilledR, Pel& riY, Pel& riU, Pel&riV )
     1792#else
     1793TRenSingleModelC<iBM,bBitInc>::xGetBlendedValueBM1( Pel iYL, Pel iYR, Pel iDepthL, Pel iDepthR, Int iFilledL, Int iFilledR, Pel& riY )
     1794#endif
     1795{
     1796  if ( iFilledL == REN_IS_FILLED ||  iFilledR == REN_IS_HOLE )
    13821797  {
    13831798    riY = iYL;
     
    14051820}
    14061821
    1407 __inline Void
    1408 #if HHI_VSO_COLOR_PLANES
    1409 TRenSingleModel::xGetBlendedValueBM2( Pel iYL, Pel iYR, Pel iUL, Pel iUR, Pel iVL, Pel iVR, Pel iDepthL, Pel iDepthR, Int iFilledL, Int iFilledR, Pel& riY, Pel& riU, Pel&riV )
    1410 #else
    1411 TRenSingleModel::xGetBlendedValueBM2( Pel iYL, Pel iYR, Pel iDepthL, Pel iDepthR, Int iFilledL, Int iFilledR, Pel& riY )
     1822template <BlenMod iBM, Bool bBitInc> __inline Void
     1823#if HHI_VSO_COLOR_PLANES
     1824TRenSingleModelC<iBM,bBitInc>::xGetBlendedValueBM2( Pel iYL, Pel iYR, Pel iUL, Pel iUR, Pel iVL, Pel iVR, Pel iDepthL, Pel iDepthR, Int iFilledL, Int iFilledR, Pel& riY, Pel& riU, Pel&riV )
     1825#else
     1826TRenSingleModelC<iBM,bBitInc>::xGetBlendedValueBM2( Pel iYL, Pel iYR, Pel iDepthL, Pel iDepthR, Int iFilledL, Int iFilledR, Pel& riY )
    14121827#endif
    14131828{
     
    14381853}
    14391854
    1440 __inline Pel
    1441 TRenSingleModel::xBlend( Pel pVal1, Pel pVal2, Int iWeightVal2 )
     1855template <BlenMod iBM, Bool bBitInc> __inline Pel
     1856TRenSingleModelC<iBM,bBitInc>::xBlend( Pel pVal1, Pel pVal2, Int iWeightVal2 )
    14421857{
    14431858  return pVal1  +  (Pel) (  ( (Int) ( pVal2 - pVal1) * iWeightVal2 + (1 << (REN_VDWEIGHT_PREC - 1)) ) >> REN_VDWEIGHT_PREC );
    14441859}
     1860
     1861template <BlenMod iBM, Bool bBitInc> Void
     1862TRenSingleModelC<iBM,bBitInc>::xCopy2PicYuv( Pel** ppiSrcVideoPel, Int* piStrides, TComPicYuv* rpcPicYuvTarget, UInt uiHorOffset )
     1863{
     1864  TRenFilter::copy            ( ppiSrcVideoPel[0], piStrides[0], m_iWidth, m_iHeight, rpcPicYuvTarget->getLumaAddr() +  uiHorOffset       * rpcPicYuvTarget->getStride() , rpcPicYuvTarget->getStride () );
     1865  TRenFilter::sampleDown2Tap13( ppiSrcVideoPel[1], piStrides[1], m_iWidth, m_iHeight, rpcPicYuvTarget->getCbAddr  () + (uiHorOffset >> 1) * rpcPicYuvTarget->getCStride(), rpcPicYuvTarget->getCStride() );
     1866  TRenFilter::sampleDown2Tap13( ppiSrcVideoPel[2], piStrides[2], m_iWidth, m_iHeight, rpcPicYuvTarget->getCrAddr  () + (uiHorOffset >> 1) * rpcPicYuvTarget->getCStride(), rpcPicYuvTarget->getCStride() );
     1867}
     1868
     1869template class TRenSingleModelC<BLEND_NONE ,true>;
     1870template class TRenSingleModelC<BLEND_AVRG ,true>;
     1871template class TRenSingleModelC<BLEND_LEFT ,true>;
     1872template class TRenSingleModelC<BLEND_RIGHT,true>;
     1873
     1874template class TRenSingleModelC<BLEND_NONE ,false>;
     1875template class TRenSingleModelC<BLEND_AVRG ,false>;
     1876template class TRenSingleModelC<BLEND_LEFT ,false>;
     1877template class TRenSingleModelC<BLEND_RIGHT,false>;
     1878
     1879#ifdef LGE_VSO_EARLY_SKIP_A0093
     1880template <BlenMod iBM, Bool bBitInc>
     1881__inline Bool
     1882TRenSingleModelC<iBM,bBitInc>::xDetectEarlySkipL( Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, Pel* piNewData,Pel* piOrgData, Int iOrgStride)
     1883{
     1884  RM_AOF( m_bEarlySkip );
     1885  const Int iCurViewPos = 0;
     1886  Int** ppiCurLUT       = m_appiShiftLut   [ iCurViewPos ];
     1887 
     1888  Bool bNoDiff          = true;   
     1889 
     1890  for (Int iPosY=0; iPosY < iHeight; iPosY++)
     1891  {
     1892    m_pbHorSkip[iPosY] = true;
     1893
     1894    for (Int iPosX = 0; iPosX < iWidth; iPosX++)
     1895    {
     1896      Int iDisparityRec = abs(ppiCurLUT[0][ RenModRemoveBitInc(piNewData[iPosX])]);
     1897      Int iDispartyOrg  = abs(ppiCurLUT[0][ RenModRemoveBitInc(piOrgData[iPosX])]);
     1898
     1899      if( iDispartyOrg != iDisparityRec)
     1900      {
     1901        m_pbHorSkip[iPosY] = false;
     1902        bNoDiff            = false;
     1903        break;
     1904      }
     1905    }
     1906    piNewData += iStride;
     1907    piOrgData += iOrgStride;
     1908  }
     1909  return bNoDiff;
     1910}
     1911
     1912template <BlenMod iBM, Bool bBitInc>
     1913__inline Bool
     1914TRenSingleModelC<iBM,bBitInc>::xDetectEarlySkipR( Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, Pel* piNewData,Pel* piOrgData, Int iOrgStride)
     1915{
     1916  RM_AOF( m_bEarlySkip );
     1917  Bool bNoDiff  = true;
     1918
     1919  const Int iCurViewPos = 1;
     1920  Int** ppiCurLUT       = m_appiShiftLut   [ iCurViewPos ];
     1921
     1922  for ( Int iPosY = 0; iPosY < iHeight; iPosY++ )
     1923  {
     1924    m_pbHorSkip[iPosY] = true;
     1925
     1926    for (Int iPosX = 0; iPosX < iWidth; iPosX++)
     1927    {
     1928      Int iDisparityRec = abs( ppiCurLUT[0][ RenModRemoveBitInc(piNewData[iPosX])] );
     1929      Int iDisparityOrg = abs( ppiCurLUT[0][ RenModRemoveBitInc(piOrgData[iPosX])] );
     1930
     1931      if( iDisparityRec != iDisparityOrg )
     1932      {
     1933        m_pbHorSkip[iPosY] = false;
     1934        bNoDiff            = false;
     1935        break;
     1936      }
     1937    }
     1938
     1939    piNewData += iStride;
     1940    piOrgData += iOrgStride;
     1941  }
     1942  return bNoDiff;
     1943}
     1944#endif
  • trunk/source/Lib/TLibRenderer/TRenSingleModel.h

    r56 r100  
    5555
    5656
     57#if HHI_VSO_RM_ASSERTIONS
     58#define RM_AOT( exp ) AOT ( exp )
     59#define RM_AOF( exp ) AOF ( exp )
     60#else
     61#define RM_AOT( exp ) ((void)0)
     62#define RM_AOF( exp ) ((void)0)
     63#endif
     64
     65#define RenModRemoveBitInc( exp ) bBitInc ? ( RemoveBitIncrement( exp ) ) : ( exp )
     66
    5767class TRenSingleModel
    5868{
     69public:
     70#if LGE_VSO_EARLY_SKIP_A0093
     71  virtual Void   create    ( Int iMode, Int iWidth, Int iHeight, Int iShiftPrec, Int*** aaaiSubPelShiftTable, Int iHoleMargin, Bool bUseOrgRef, Int iBlendMode, Bool bEarlySkip ) = 0;
     72#else
     73  virtual Void   create    ( Int iMode, Int iWidth, Int iHeight, Int iShiftPrec, Int*** aaaiSubPelShiftTable, Int iHoleMargin, Bool bUseOrgRef, Int iBlendMode ) = 0;
     74#endif
     75
     76  // Set Frame dependent data
     77  virtual Void   setLRView ( Int iViewPos, Pel** apiCurVideoPel, Int* aiCurVideoStride, Pel* piCurDepthPel, Int iCurDepthStride ) = 0;
     78  virtual Void   setup     ( TComPicYuv* pcOrgVideo, Int** ppiShiftLutLeft, Int** ppiBaseShiftLutLeft, Int** ppiShiftLutRight,  Int** ppiBaseShiftLutRight,  Int iDistToLeft, Bool bKeepReference, UInt uiHorOffset ) = 0;
     79
     80  // Set Data
     81#ifdef LGE_VSO_EARLY_SKIP_A0093
     82  virtual Void   setDepth  ( Int iViewPos,                 Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, Pel* piNewData, Pel* piOrgData, Int iOrgStride )  = 0;
     83#else
     84  virtual Void   setDepth  ( Int iViewPos,                 Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, Pel* piNewData )  = 0;
     85#endif
     86  virtual Void   setVideo  ( Int iViewPos,     Int iPlane, Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, Pel* piNewData ) = 0;
     87
     88  // Get Distortion
     89#ifdef LGE_VSO_EARLY_SKIP_A0093
     90  virtual RMDist getDistDepth  ( Int iViewPos,             Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, Pel* piNewData, Pel * piOrgData , Int iOrgStride)=0;
     91#else
     92  virtual RMDist getDistDepth  ( Int iViewPos,             Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, Pel* piNewData ) = 0;
     93#endif
     94  virtual RMDist getDistVideo  ( Int iViewPos, Int iPlane, Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, Pel* piNewData ) = 0;
     95
     96  virtual Void   getSynthVideo  ( Int iViewPos, TComPicYuv* pcPicYuv, UInt uiHorOffset  ) = 0; 
     97  virtual Void   getSynthDepth  ( Int iViewPos, TComPicYuv* pcPicYuv, UInt uiHorOffset  ) = 0;
     98  virtual Void   getRefVideo    ( Int iViewPos, TComPicYuv* pcPicYuv, UInt uiHorOffset  ) = 0;
     99};
     100
     101template < BlenMod iBM, Bool bBitInc >
     102class TRenSingleModelC : public TRenSingleModel
     103{
     104  struct RenModelInPels
     105  {
     106    // video
     107    Pel aiY[5]    ; // y-value
     108#if HHI_VSO_COLOR_PLANES
     109    Pel aiU[5]    ; // u-value
     110    Pel aiV[5]    ; // v-value
     111#endif
     112    // depth
     113    Pel iD        ; // depth
     114
     115    // state
     116    Bool bOccluded; // Occluded
     117  };
     118
     119  struct RenModelOutPels
     120  {
     121    // video
     122    Pel iYLeft    ;
     123    Pel iYRight   ;
     124    Pel iYBlended ;
     125#if HHI_VSO_COLOR_PLANES
     126    Pel iULeft    ;
     127    Pel iURight   ;
     128    Pel iUBlended ;
     129    Pel iVLeft    ;
     130    Pel iVRight   ;
     131    Pel iVBlended ;
     132#endif
     133    // depth
     134    Pel iDLeft    ;
     135    Pel iDRight   ;
     136    Pel iDBlended ;
     137
     138    // state
     139    Int iFilledLeft ;
     140    Int iFilledRight;
     141
     142    // error
     143    Int  iError   ;
     144
     145    // reference
     146    Pel iYRef    ;
     147#if HHI_VSO_COLOR_PLANES
     148    Pel iURef    ;
     149    Pel iVRef    ;
     150#endif       
     151  };
     152
     153
    59154
    60155public:
    61   TRenSingleModel();
    62   ~TRenSingleModel();
     156  TRenSingleModelC();
     157  ~TRenSingleModelC();
    63158
    64159  // Create Model
     160#if LGE_VSO_EARLY_SKIP_A0093
     161  Void   create    ( Int iMode, Int iWidth, Int iHeight, Int iShiftPrec, Int*** aaaiSubPelShiftTable, Int iHoleMargin, Bool bUseOrgRef, Int iBlendMode, Bool bEarlySkip  );
     162#else
    65163  Void   create    ( Int iMode, Int iWidth, Int iHeight, Int iShiftPrec, Int*** aaaiSubPelShiftTable, Int iHoleMargin, Bool bUseOrgRef, Int iBlendMode );
     164#endif
    66165
    67166  // Set Frame dependent data
    68167  Void   setLRView ( Int iViewPos, Pel** apiCurVideoPel, Int* aiCurVideoStride, Pel* piCurDepthPel, Int iCurDepthStride );
    69   Void   setup     ( TComPicYuv* pcOrgVideo, Int** ppiShiftLutLeft, Int** ppiBaseShiftLutLeft, Int** ppiShiftLutRight,  Int** ppiBaseShiftLutRight,  Int iDistToLeft, Bool bKeepReference );
    70 
    71   // Set Data
     168  Void   setup     ( TComPicYuv* pcOrgVideo, Int** ppiShiftLutLeft, Int** ppiBaseShiftLutLeft, Int** ppiShiftLutRight,  Int** ppiBaseShiftLutRight,  Int iDistToLeft, Bool bKeepReference, UInt uiHorOffset );
     169
     170#if LGE_VSO_EARLY_SKIP_A0093
     171  Void   setDepth  ( Int iViewPos,                 Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, Pel* piNewData, Pel* piOrgData, Int iOrgStride );
     172#else
    72173  Void   setDepth  ( Int iViewPos,                 Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, Pel* piNewData );
     174#endif
    73175  Void   setVideo  ( Int iViewPos,     Int iPlane, Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, Pel* piNewData );
    74176
    75177  // Get Distortion
     178#ifdef LGE_VSO_EARLY_SKIP_A0093
     179  RMDist getDistDepth  ( Int iViewPos,             Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, Pel* piNewData, Pel * piOrgData , Int iOrgStride);
     180#else
    76181  RMDist getDistDepth  ( Int iViewPos,             Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, Pel* piNewData );
     182#endif
    77183  RMDist getDistVideo  ( Int iViewPos, Int iPlane, Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, Pel* piNewData );
    78184
    79   // Get Rendered Data
    80   Void   getSynthView( Int iViewPos, Pel**& rppiRenVideoPel, Pel*& rpiRenDepthPel, Int& riStride );
    81 
    82   // Get Reference Data
    83   Void   getRefView  ( TComPicYuv*& rpcPicYuvRefView, Pel**& rppiRefVideoPel, Int*& raiStrides );
     185  Void   getSynthVideo  ( Int iViewPos, TComPicYuv* pcPicYuv, UInt uiHorOffset ); 
     186  Void   getSynthDepth  ( Int iViewPos, TComPicYuv* pcPicYuv, UInt uiHorOffset  );
     187  Void   getRefVideo    ( Int iViewPos, TComPicYuv* pcPicYuv, UInt uiHorOffset  );
    84188
    85189private:
     
    90194  /////  Rendering /////
    91195  // Left to Right
    92   __inline RMDist xRenderL            ( Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, Pel* piNewData, Bool bSet);
    93   __inline Void   xInitRenderPartL    ( Int iEndChangePos, Int iLastSPos  );
    94   __inline Void   xRenderRangeL       ( Int iCurSPos, Int iLastSPos, Int iCurPos, RMDist& riError );
    95   __inline Void   xRenderShiftedRangeL( Int iCurSPos, Int iLastSPos, Int iCurPos, RMDist& riError );
    96   __inline Void   xFillHoleL          ( Int iCurSPos, Int iLastSPos, Int iCurPos, RMDist& riError );
    97   __inline Void   xExtrapolateMarginL ( Int iCurSPos,                Int iCurPos, RMDist& riError );
    98   __inline Int    xRangeLeftL         ( Int iPos );
    99   __inline Int    xRangeRightL        ( Int iPos );
    100   __inline Int    xRoundL             ( Int iPos );
     196#ifdef LGE_VSO_EARLY_SKIP_A0093
     197                      __inline Bool   xDetectEarlySkipL   ( Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, Pel* piNewData,Pel* piOrgData, Int iOrgStride );
     198                      __inline Bool   xDetectEarlySkipR   ( Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, Pel* piNewData,Pel* piOrgData, Int iOrgStride );
     199  template<Bool bSet> __inline RMDist xRenderL            ( Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, Pel* piNewData, Bool bFast );
     200  template<Bool bSet> __inline RMDist xRenderR            ( Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, Pel* piNewData, Bool bFast );
     201#else
     202  template<Bool bSet> __inline RMDist xRenderR            ( Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, Pel* piNewData );
     203  template<Bool bSet> __inline RMDist xRenderL            ( Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, Pel* piNewData );
     204#endif
     205                      __inline Void   xInitRenderPartL    ( Int iEndChangePos, Int iLastSPos  );
     206  template<Bool bSet> __inline Void   xRenderRangeL       ( Int iCurSPos, Int iLastSPos, Int iCurPos, RMDist& riError );
     207  template<Bool bSet> __inline Void   xRenderShiftedRangeL( Int iCurSPos, Int iLastSPos, Int iCurPos, RMDist& riError );
     208  template<Bool bSet> __inline Void   xFillHoleL          ( Int iCurSPos, Int iLastSPos, Int iCurPos, RMDist& riError );
     209  template<Bool bSet> __inline Void   xExtrapolateMarginL ( Int iCurSPos,                Int iCurPos, RMDist& riError );
     210                      __inline Int    xRangeLeftL         ( Int iPos );
     211                      __inline Int    xRangeRightL        ( Int iPos );
     212                      __inline Int    xRoundL             ( Int iPos );
    101213
    102214  // Right to Left
    103   __inline RMDist xRenderR            ( Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, Pel* piNewData, Bool bSet );
    104   __inline Void   xInitRenderPartR    ( Int iStartChangePos, Int iLastSPos );
    105   __inline Void   xRenderShiftedRangeR( Int iCurSPos, Int iLastSPos, Int iCurPos, RMDist& riError );
    106   __inline Void   xRenderRangeR       ( Int iCurSPos, Int iLastSPos, Int iCurPos, RMDist& riError );
    107   __inline Void   xFillHoleR          ( Int iCurSPos, Int iLastSPos, Int iCurPos, RMDist& riError );
    108   __inline Void   xExtrapolateMarginR ( Int iCurSPos,                Int iCurPos, RMDist& riError );
    109   __inline Int    xRangeLeftR         ( Int iPos );
    110   __inline Int    xRangeRightR        ( Int iPos );
    111   __inline Int    xRoundR             ( Int iPos );
     215                      __inline Void   xInitRenderPartR    ( Int iStartChangePos, Int iLastSPos );
     216  template<Bool bSet> __inline Void   xRenderShiftedRangeR( Int iCurSPos, Int iLastSPos, Int iCurPos, RMDist& riError );
     217  template<Bool bSet> __inline Void   xRenderRangeR       ( Int iCurSPos, Int iLastSPos, Int iCurPos, RMDist& riError );
     218  template<Bool bSet> __inline Void   xFillHoleR          ( Int iCurSPos, Int iLastSPos, Int iCurPos, RMDist& riError );
     219  template<Bool bSet> __inline Void   xExtrapolateMarginR ( Int iCurSPos,                Int iCurPos, RMDist& riError );
     220                      __inline Int    xRangeLeftR         ( Int iPos );
     221                      __inline Int    xRangeRightR        ( Int iPos );
     222                      __inline Int    xRoundR             ( Int iPos );
    112223
    113224  // Blending
    114   __inline Void   xSetShiftedPelBlend ( Int iSourcePos, Int iTargetSPos, Pel iFilled, RMDist& riError );
     225  template<Bool bSet> __inline Void   xSetShiftedPelBlend ( Int iSourcePos, Int iTargetSPos, Pel iFilled, RMDist& riError );
    115226
    116227#if HHI_VSO_COLOR_PLANES
     
    125236  __inline Pel    xBlend              ( Pel pVal1, Pel pVal2, Int iWeightVal2 );
    126237
    127 // General
    128   __inline Void   xSetShiftedPel     ( Int iSourcePos, Int iTargetSPos, Pel iFilled, RMDist& riError );
     238  // General
     239  template<Bool bSet> __inline Void xSetShiftedPelL       (Int iSourcePos,                  Int iSubSourcePos, Int iTargetSPos,                   Pel iFilled, RMDist& riError );
     240  template<Bool bSet> __inline Void xSetShiftedPelBlendL  (RenModelInPels* pcInSample, Int iSubSourcePos, RenModelOutPels* pcOutSample, Pel iFilled, RMDist& riError );
     241  template<Bool bSet> __inline Void xSetShiftedPelNoBlendL(RenModelInPels* pcInSample, Int iSubSourcePos, RenModelOutPels* pcOutSample, Pel iFilled, RMDist& riError );
     242
     243  template<Bool bSet> __inline Void xSetShiftedPelR       (Int iSourcePos,                  Int iSubSourcePos, Int iTargetSPos,                   Pel iFilled, RMDist& riError );
     244  template<Bool bSet> __inline Void xSetShiftedPelBlendR  (RenModelInPels* pcInSample, Int iSubSourcePos, RenModelOutPels* pcOutSample, Pel iFilled, RMDist& riError );
     245  template<Bool bSet> __inline Void xSetShiftedPelNoBlendR(RenModelInPels* pcInSample, Int iSubSourcePos, RenModelOutPels* pcOutSample, Pel iFilled, RMDist& riError );
     246
    129247  __inline Int    xShiftNewData      ( Int iPos, Int iPosInNewData );
    130248  __inline Int    xShift             ( Int iPos );
     
    134252
    135253  // Utilities
    136   __inline Void   xInitView  ( Int iViewPos );
    137254  __inline Void   xSetPels   ( Pel*  piPelSource , Int iSourceStride, Int iWidth, Int iHeight, Pel iVal );
    138255  __inline Void   xSetBools  ( Bool* pbSource    , Int iSourceStride, Int iWidth, Int iHeight, Bool bVal );
    139256  __inline Void   xSetInts   ( Int*  piPelSource , Int iSourceStride, Int iWidth, Int iHeight, Int iVal );
     257
     258#if HHI_VSO_COLOR_PLANES
     259  Void            xGetSampleStrTextPtrs ( Int iViewNum, Pel RenModelOutPels::*& rpiSrcY, Pel RenModelOutPels::*& rpiSrcU, Pel RenModelOutPels::*& rpiSrcV );
     260#else 
     261  Void            xGetSampleStrTextPtrs ( Int iViewNum, Pel RenModelOutPels::*& rpiSrcY );
     262#endif
     263  Void            xGetSampleStrDepthPtrs( Int iViewNum, Pel RenModelOutPels::*& rpiSrcD );
     264       
     265  Void            xSetStructRefView            ();
     266  Void            xResetStructError            ();
     267  Void            xInitSampleStructs           ();
     268  Void            xSetStructSynthViewAsRefView ();
     269  Void            xCopy2PicYuv                ( Pel** ppiSrcVideoPel, Int* piStrides, TComPicYuv* rpcPicYuvTarget, UInt uiHorOffset );
     270
     271
     272  template< typename S, typename T>
     273  Void   xCopyFromSampleStruct ( S* ptSource , Int iSourceStride, T S::* ptSourceElement, T* ptTarget, Int iTargetStride, Int iWidth, Int iHeight )
     274  {
     275    for (Int iPosY = 0; iPosY < m_iHeight; iPosY++)
     276    {
     277      for (Int iPosX = 0; iPosX < m_iWidth; iPosX++)
     278      {
     279        ptTarget[iPosX] = ptSource[iPosX].*ptSourceElement;
     280      }
     281      ptSource += iSourceStride;
     282      ptTarget += iTargetStride;
     283    }   
     284  } 
     285
     286  template< typename S, typename T>
     287  Void   xCopyToSampleStruct ( T* ptSource , Int iSourceStride, S* ptTarget, Int iTargetStride, T S::* ptSourceElement, Int iWidth, Int iHeight )
     288  {
     289    for (Int iPosY = 0; iPosY < m_iHeight; iPosY++)
     290    {
     291      for (Int iPosX = 0; iPosX < m_iWidth; iPosX++)
     292      {
     293        ptTarget[iPosX] = ptSource[iPosX].*ptSourceElement;
     294      }
     295      ptSource += iSourceStride;
     296      ptTarget += iTargetStride;
     297    }   
     298  }   
    140299
    141300private:
     
    151310  Int   m_iSampledStride;
    152311
     312  RenModelInPels* m_pcInputSamples[2];
     313  Int                  m_iInputSamplesStride;
     314
    153315  // Base
    154316  Pel** m_aapiBaseVideoPel     [2]; // Dim1: ViewPosition 0->Left, 1->Right; Dim2: Plane  0-> Y, 1->U, 2->V
     
    157319  Pel*  m_apiBaseDepthPel      [2]; // Dim1: ViewPosition
    158320  Int   m_aiBaseDepthStrides   [2]; // Dim1: ViewPosition
     321
    159322
    160323  // LUT
     
    170333  //// Reference Data  ////
    171334  TComPicYuv* m_pcPicYuvRef       ;    // Reference PIcYuv
     335
     336  //// Output Samples
     337  RenModelOutPels* m_pcOutputSamples;
     338  Int                   m_iOutputSamplesStride;
     339
    172340  Pel*  m_aapiRefVideoPel      [3];    // Dim1: Plane  0-> Y, 1->U, 2->V
    173341  Int   m_aiRefVideoStrides    [3];    // Dim1: Plane  0-> Y, 1->U, 2->V
    174 
    175   // Renderer State
    176   Int*  m_piError                 ;
    177   Pel*  m_apiFilled            [2];    // Dim1: ViewPosition
    178   Bool* m_apbOccluded          [2];    // Dim1: ViewPosition
    179   Pel*  m_aapiSynthVideoPel    [3][3]; // Dim1: ViewPosition 0: Left, 1:Right, 2: Merged, Dim2: Plane  0-> Y, 1->U, 2->V
    180   Pel*  m_apiSynthDepthPel     [3];    // Dim1: ViewPosition 0: Left, 1:Right, 2: Merged, Dim2: Plane  0-> Y, 1->U, 2->V
    181342
    182343  // Rendering State
     
    185346  Int   m_iLastOccludedSPosFP;         // Position of last topmost shifted position in FullPels
    186347
    187   Bool  m_bSet;                        // Set Data, or get Error
    188348  Int   m_iCurViewPos;                 // Current View Position 0: Left, 1: Right
    189349  Int   m_iOtherViewPos;               // Other View Position 0: Left, 1: Right
     
    201361  Int   m_iShiftPrec;
    202362  Int   m_iHoleMargin;
    203   Int   m_iBlendMode;
     363#ifdef LGE_VSO_EARLY_SKIP_A0093
     364  Bool  m_bEarlySkip;
     365#endif
    204366
    205367  // Derived settings
     
    209371
    210372  //// Current Pointers ////
    211   Pel*  m_aapiBaseVideoPelRow  [2][3]; // Dim1: ViewPosition 0->Left, 1->Right; Dim2: Plane  0-> Y, 1->U, 2->V
    212   Pel*  m_apiBaseDepthPelRow   [2];    // Dim1: ViewPosition
    213   Bool* m_apbOccludedRow       [2];    // Dim1: ViewPosition
    214   Pel*  m_apiFilledRow         [2];    // Dim1: ViewPosition
    215   Int*  m_apiErrorRow             ;
    216 
    217   Pel*  m_aapiRefVideoPelRow   [3];    // Dim1: Plane  0-> Y, 1->U, 2->V
    218   Pel*  m_aapiSynthVideoPelRow [3][3]; // Dim1: ViewPosition 0: Left, 1:Right, 2: Merged, Dim2: Plane  0-> Y, 1->U, 2->V
    219   Pel*  m_apiSynthDepthPelRow  [3];    // Dim1: ViewPosition 0: Left, 1:Right, 2: Merged
    220 
     373
     374  RenModelInPels*  m_pcInputSamplesRow [2];
     375  RenModelOutPels* m_pcOutputSamplesRow;
    221376
    222377  //// MISC ////
    223378  const Int m_iDistShift;                  // Shift in Distortion computation
     379
     380  //// Early Skip
     381#ifdef LGE_VSO_EARLY_SKIP_A0093
     382  Bool* m_pbHorSkip;
     383#endif
    224384};
    225385
  • trunk/source/Lib/TLibRenderer/TRenTop.cpp

    r81 r100  
    10131013          if ((iPrevShiftedPos + (iStep >> 1) ) > iPrevShiftedPosCeiled )
    10141014          {
    1015 #if HHI_FIX
    10161015            if ( !((iInterPolPos < (Int) 0) || (iInterPolPos >= iOutputWidth)))
    10171016            {
     
    10261025            iInterPolPos++;
    10271026          }         
    1028 #else
    1029           if ( (iInterPolPos < (Int) 0) || (iInterPolPos >= iOutputWidth))
    1030           {
    1031             // skip Interpolation if Interpolation position is outside frame
    1032             iPrevShiftedPos = iShiftedPos;
    1033             continue;
    1034           };
    1035 
    1036           for( UInt uiCurPlane = 0; uiCurPlane < uiNumberOfPlanes; uiCurPlane++)
    1037           {
    1038               apcOutputData[uiCurPlane][iInterPolPos]  = apcInputData[uiCurPlane][iPosX - iStep];
    1039           }
    1040           pcFilledData[iInterPolPos]  = REN_IS_FILLED;
    1041             iInterPolPos++;
    1042         }
    1043 #endif
    10441027
    10451028          // Fill Disocclusion
     
    10641047        {
    10651048          iInterPolPos = iShiftedPosFloor >> m_iRelShiftLUTPrec;
    1066 #if HHI_FIX
    10671049          if ( !((iInterPolPos < (Int) 0) || (iInterPolPos >= iOutputWidth)))
    10681050          {       
     
    10741056            pcFilledData[iInterPolPos]  = REN_IS_FILLED;
    10751057          }
    1076 #else
    1077           if ( (iInterPolPos < (Int) 0) || (iInterPolPos >= iOutputWidth))
    1078           {
    1079             // skip Interpolation if Interpolation position is outside frame
    1080             iPrevShiftedPos = iShiftedPos;
    1081             continue;
    1082           };
    1083 
    1084           for( UInt uiCurPlane = 0; uiCurPlane < uiNumberOfPlanes; uiCurPlane++)
    1085           {
    1086             apcOutputData[uiCurPlane][iInterPolPos]  = apcInputData[uiCurPlane][iPosX ];
    1087           }
    1088 
    1089           pcFilledData[iInterPolPos]  = REN_IS_FILLED;
    1090 #endif
    10911058        }
    10921059      }
     
    19591926          for( Int iCurPosX = 0; iCurPosX < 4; iCurPosX++)
    19601927          {
    1961             iSAD += abs( pcVideoLastDataBlk[iCurPosX] - pcVideoCurDataBlk[iCurPosX] );  //SAD
     1928            iSAD += abs( pcVideoLastDataBlk[iCurPosX] - pcVideoCurDataBlk[iCurPosX] );  //SAD
    19621929          }
    19631930          pcVideoLastDataBlk += iVideoLastStride;
Note: See TracChangeset for help on using the changeset viewer.