Index: trunk/source/Lib/TLibRenderer/TRenImage.cpp
===================================================================
--- trunk/source/Lib/TLibRenderer/TRenImage.cpp	(revision 81)
+++ trunk/source/Lib/TLibRenderer/TRenImage.cpp	(revision 100)
@@ -106,4 +106,27 @@
 }
 
+#if HHI_VSO_SPEEDUP_A033
+template<typename T>
+Void TRenImage<T>::getDataAndStrides( T** pptData, Int* piStrides )
+{
+  for (UInt uiCurPlane = 0; uiCurPlane < m_uiNumberOfPlanes; uiCurPlane++ )
+  {
+    piStrides[uiCurPlane] = m_apcPlanes[uiCurPlane]->getStride   ();
+    pptData  [uiCurPlane] = m_apcPlanes[uiCurPlane]->getPlaneData();
+  }
+}
+
+
+template<typename T>
+Void TRenImage<T>::getWidthAndHeight( Int* ppiWidths, Int* ppiHeights )
+{
+  for (UInt uiCurPlane = 0; uiCurPlane < m_uiNumberOfPlanes; uiCurPlane++ )
+  {
+    ppiWidths [uiCurPlane] = m_apcPlanes[uiCurPlane]->getWidth ();
+    ppiHeights[uiCurPlane] = m_apcPlanes[uiCurPlane]->getHeight();
+  }
+}
+#endif
+
 template<typename T>
 Void TRenImage<T>::allocatePlanes( UInt uiWidth, UInt uiHeight, UInt uiNumberOfFullPlanes, UInt uiNumberOfQuaterPlanes )
Index: trunk/source/Lib/TLibRenderer/TRenImage.h
===================================================================
--- trunk/source/Lib/TLibRenderer/TRenImage.h	(revision 81)
+++ trunk/source/Lib/TLibRenderer/TRenImage.h	(revision 100)
@@ -69,4 +69,9 @@
   TRenImagePlane<T>** getPlanes() const;
 
+#if HHI_VSO_SPEEDUP_A033
+  Void getDataAndStrides( T**    pptData, Int*  piStrides );
+  Void getWidthAndHeight( Int*  piWidths, Int*  piHeights );
+#endif
+
   UInt getNumberOfPlanes()  const;
   UInt getNumberOfQuaterPlanes() const;
Index: trunk/source/Lib/TLibRenderer/TRenModSetupStrParser.cpp
===================================================================
--- trunk/source/Lib/TLibRenderer/TRenModSetupStrParser.cpp	(revision 81)
+++ trunk/source/Lib/TLibRenderer/TRenModSetupStrParser.cpp	(revision 100)
@@ -357,14 +357,14 @@
   {
   case 'E':
-    iBlendMode = -1;
+    iBlendMode = BLEND_NONE;
     break;
   case 'I':
-    iBlendMode = 0;
+    iBlendMode = BLEND_AVRG;
     break;
   case 'L':
-    iBlendMode = 1;
+    iBlendMode = BLEND_LEFT;
     break;
   case 'R':
-    iBlendMode = 2;
+    iBlendMode = BLEND_RIGHT;
     break;
   default:
Index: trunk/source/Lib/TLibRenderer/TRenModel.cpp
===================================================================
--- trunk/source/Lib/TLibRenderer/TRenModel.cpp	(revision 81)
+++ trunk/source/Lib/TLibRenderer/TRenModel.cpp	(revision 100)
@@ -32,6 +32,4 @@
  */
 
-
-
 #include "TRenImage.h"
 #include "TRenFilter.h"
@@ -48,4 +46,8 @@
   m_iShiftPrec         =  0;
   m_iHoleMargin        =  1;
+  m_uiHorOff           = -1;
+#if LGE_VSO_EARLY_SKIP_A0093
+  m_bEarlySkip         = false; 
+#endif
 
   // Current Error Type ///
@@ -211,5 +213,9 @@
 
 Void
+#if LGE_VSO_EARLY_SKIP_A0093
+TRenModel::create( Int iNumOfBaseViews, Int iNumOfModels, Int iWidth, Int iHeight, Int iShiftPrec, Int iHoleMargin, Bool bEarlySkip )
+#else
 TRenModel::create( Int iNumOfBaseViews, Int iNumOfModels, Int iWidth, Int iHeight, Int iShiftPrec, Int iHoleMargin )
+#endif
 {
   m_iNumOfBaseViews     = iNumOfBaseViews;
@@ -219,4 +225,8 @@
   m_iShiftPrec          = iShiftPrec;
   m_iHoleMargin         = iHoleMargin;
+#if LGE_VSO_EARLY_SKIP_A0093
+  m_bEarlySkip          = bEarlySkip; 
+#endif
+
 
 // LUTs for sub pel shifting
@@ -231,5 +241,5 @@
 
   TRenFilter::setSubPelShiftLUT( m_iShiftPrec, m_aaaiSubPelShiftLut[0], 0 );
-  TRenFilter::setSubPelShiftLUT( m_iShiftPrec, m_aaaiSubPelShiftLut[1], -1);
+  TRenFilter::setSubPelShiftLUT( m_iShiftPrec, m_aaaiSubPelShiftLut[1], 0 );
 
   m_iSampledWidth       = iWidth << m_iShiftPrec;
@@ -268,5 +278,5 @@
   for (Int iModelNum = 0; iModelNum < m_iNumOfRenModels; iModelNum++)
   {
-    m_apcRenModels         [iModelNum] = new TRenSingleModel();
+    m_apcRenModels         [iModelNum] = NULL;
   }
 
@@ -339,6 +349,5 @@
 
   AOT( iMode == -1);
-  AOT( iModelNum < 0 || iModelNum > m_iNumOfRenModels );
-  AOF( m_apcRenModels[iModelNum] );
+  AOT( iModelNum < 0 || iModelNum > m_iNumOfRenModels );  
   AOT( iLeftViewNum  < -1 || iLeftViewNum  > m_iNumOfBaseViews );
   AOT( iRightViewNum < -1 || iRightViewNum > m_iNumOfBaseViews );
@@ -348,5 +357,65 @@
   AOT( iBlendMode < -1 || iBlendMode > 2 );
 
+  Bool bBitInc = (g_uiBitIncrement != 0);
+
+  AOT( m_apcRenModels[iModelNum] );
+
+  if ( bBitInc )
+  { 
+    if ( iMode != 2 ) 
+    { // No Blending
+      m_apcRenModels[iModelNum]   = new TRenSingleModelC<BLEND_NONE, true>; 
+    }
+    else
+    {
+      switch ( iBlendMode )
+      {
+      case BLEND_AVRG: // average
+        m_apcRenModels[iModelNum] = new TRenSingleModelC<BLEND_AVRG, true>;       
+        break;
+      case BLEND_LEFT: // left  view is main view
+        m_apcRenModels[iModelNum] = new TRenSingleModelC<BLEND_LEFT, true>;       
+        break;
+      case BLEND_RIGHT: // right view is main view
+        m_apcRenModels[iModelNum] = new TRenSingleModelC<BLEND_RIGHT, true>;       
+        break;
+      default: 
+        AOT(true);
+        break;
+      }    
+    }
+  }
+  else
+  {
+    if ( iMode != 2 ) 
+    { // No Blending
+      m_apcRenModels[iModelNum] = new TRenSingleModelC<BLEND_NONE, false>; 
+    }
+    else
+    {
+      switch ( iBlendMode )
+      {
+      case BLEND_AVRG: // average
+        m_apcRenModels[iModelNum] = new TRenSingleModelC<BLEND_AVRG, false>;       
+        break;
+      case BLEND_LEFT: // left  view is main view
+        m_apcRenModels[iModelNum] = new TRenSingleModelC<BLEND_LEFT, false>;       
+        break;
+      case BLEND_RIGHT: // right view is main view
+        m_apcRenModels[iModelNum] = new TRenSingleModelC<BLEND_RIGHT, false>;       
+        break;
+      default: 
+        AOT(true);
+        break;
+      }    
+    }
+  }
+
+
+#if LGE_VSO_EARLY_SKIP_A0093
+  m_apcRenModels[iModelNum]->create( iMode ,m_iWidth, m_iHeight, m_iShiftPrec, m_aaaiSubPelShiftLut, m_iHoleMargin,  bUseOrgRef, iBlendMode, m_bEarlySkip );
+#else
   m_apcRenModels[iModelNum]->create( iMode ,m_iWidth, m_iHeight, m_iShiftPrec, m_aaaiSubPelShiftLut, m_iHoleMargin,  bUseOrgRef, iBlendMode );
+#endif
 
   if ( iLeftViewNum != -1 )
@@ -361,17 +430,20 @@
 }
 
-
 Void
 TRenModel::setBaseView( Int iViewNum, TComPicYuv* pcPicYuvVideoData, TComPicYuv* pcPicYuvDepthData, TComPicYuv* pcPicYuvOrgVideoData, TComPicYuv* pcPicYuvOrgDepthData )
 {
   AOT( iViewNum < 0 || iViewNum > m_iNumOfBaseViews );
-  AOF( pcPicYuvVideoData->getHeight() == m_iHeight || pcPicYuvVideoData->getWidth() == m_iWidth );
-  AOF( pcPicYuvDepthData->getHeight() == m_iHeight || pcPicYuvDepthData->getWidth() == m_iWidth );
+  AOF( pcPicYuvVideoData->getHeight() <= m_iHeight + m_uiHorOff || pcPicYuvVideoData->getWidth() == m_iWidth );
+  AOF( pcPicYuvDepthData->getHeight() <= m_iHeight + m_uiHorOff || pcPicYuvDepthData->getWidth() == m_iWidth );
 
   pcPicYuvVideoData->extendPicBorder();
-  TRenFilter::sampleHorUp   ( m_iShiftPrec, pcPicYuvVideoData->getLumaAddr(), pcPicYuvVideoData->getStride() , m_iWidth,      m_iHeight,      m_aapiCurVideoPel[ iViewNum ][0], m_aaiCurVideoStrides[iViewNum][0] );
-  TRenFilter::sampleCUpHorUp( m_iShiftPrec, pcPicYuvVideoData->getCbAddr()  , pcPicYuvVideoData->getCStride(), m_iWidth >> 1, m_iHeight >> 1, m_aapiCurVideoPel[ iViewNum ][1], m_aaiCurVideoStrides[iViewNum][1] );
-  TRenFilter::sampleCUpHorUp( m_iShiftPrec, pcPicYuvVideoData->getCrAddr()  , pcPicYuvVideoData->getCStride(), m_iWidth >> 1, m_iHeight >> 1, m_aapiCurVideoPel[ iViewNum ][2], m_aaiCurVideoStrides[iViewNum][2] );
-  TRenFilter::copy          (               pcPicYuvDepthData->getLumaAddr(), pcPicYuvDepthData->getStride(),   m_iWidth,     m_iHeight,      m_apiCurDepthPel [ iViewNum],     m_aiCurDepthStrides [iViewNum]    );
+
+  
+
+
+  TRenFilter::sampleHorUp   ( m_iShiftPrec, pcPicYuvVideoData->getLumaAddr() +  m_uiHorOff        * pcPicYuvVideoData->getStride () , pcPicYuvVideoData->getStride() , m_iWidth,      m_iHeight,      m_aapiCurVideoPel[ iViewNum ][0], m_aaiCurVideoStrides[iViewNum][0] );
+  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] );
+  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] );
+  TRenFilter::copy          (               pcPicYuvDepthData->getLumaAddr() +  m_uiHorOff        * pcPicYuvDepthData->getStride () , pcPicYuvDepthData->getStride(),  m_iWidth,      m_iHeight,      m_apiCurDepthPel [ iViewNum],     m_aiCurDepthStrides [iViewNum]    );
 
   // Used for rendering reference pic from original video data
@@ -381,15 +453,15 @@
   if ( m_abSetupVideoFromOrgForView[iViewNum] )
   {
-    AOF( pcPicYuvOrgVideoData->getHeight() == m_iHeight || pcPicYuvOrgVideoData->getWidth() == m_iWidth );
+    AOF( pcPicYuvOrgVideoData->getHeight() <= m_iHeight + m_uiHorOff || pcPicYuvOrgVideoData->getWidth() == m_iWidth );
     pcPicYuvOrgVideoData->extendPicBorder();
-    TRenFilter::sampleHorUp   ( m_iShiftPrec, pcPicYuvOrgVideoData->getLumaAddr(), pcPicYuvOrgVideoData->getStride() , m_iWidth,      m_iHeight,      m_aapiOrgVideoPel[ iViewNum ][0], m_aaiOrgVideoStrides[iViewNum][0] );
-    TRenFilter::sampleCUpHorUp( m_iShiftPrec, pcPicYuvOrgVideoData->getCbAddr()  , pcPicYuvOrgVideoData->getCStride(), m_iWidth >> 1, m_iHeight >> 1, m_aapiOrgVideoPel[ iViewNum ][1], m_aaiOrgVideoStrides[iViewNum][1] );
-    TRenFilter::sampleCUpHorUp( m_iShiftPrec, pcPicYuvOrgVideoData->getCrAddr()  , pcPicYuvOrgVideoData->getCStride(), m_iWidth >> 1, m_iHeight >> 1, m_aapiOrgVideoPel[ iViewNum ][2], m_aaiOrgVideoStrides[iViewNum][2] );
+    TRenFilter::sampleHorUp   ( m_iShiftPrec, pcPicYuvOrgVideoData->getLumaAddr() +  m_uiHorOff        * pcPicYuvOrgVideoData->getStride() , pcPicYuvOrgVideoData->getStride() , m_iWidth,      m_iHeight,      m_aapiOrgVideoPel[ iViewNum ][0], m_aaiOrgVideoStrides[iViewNum][0] );
+    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] );
+    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] );
   }
 
   if ( m_abSetupDepthFromOrgForView[iViewNum] )
   {
-    AOF( pcPicYuvOrgDepthData->getHeight() == m_iHeight || pcPicYuvOrgDepthData->getWidth() == m_iWidth );
-    TRenFilter::copy          (               pcPicYuvOrgDepthData->getLumaAddr(), pcPicYuvOrgDepthData->getStride(),  m_iWidth,     m_iHeight,      m_apiOrgDepthPel [ iViewNum],     m_aiOrgDepthStrides [iViewNum]    );
+    AOF( pcPicYuvOrgDepthData->getHeight() <= m_iHeight + m_uiHorOff || pcPicYuvOrgDepthData->getWidth() == m_iWidth );
+    TRenFilter::copy          (               pcPicYuvOrgDepthData->getLumaAddr() +  m_uiHorOff        * pcPicYuvOrgDepthData->getStride() , pcPicYuvOrgDepthData->getStride(),  m_iWidth,     m_iHeight,      m_apiOrgDepthPel [ iViewNum],     m_aiOrgDepthStrides [iViewNum]    );
   }
 }
@@ -404,8 +476,10 @@
   for (Int iBaseViewIdx = 0; iBaseViewIdx < m_iNumOfBaseViews; iBaseViewIdx++ )
   {
+
     Bool bSetupFromOrgVideo = m_abSetupVideoFromOrgForView[iBaseViewIdx];
     Bool bSetupFromOrgDepth = m_abSetupDepthFromOrgForView[iBaseViewIdx];
-
-    if ( ( bSetupFromOrgVideo || bSetupFromOrgDepth ) && m_aaeBaseViewPosInModel[iBaseViewIdx][iModelNum] != VIEWPOS_INVALID )
+    bAnyRefFromOrg          = bAnyRefFromOrg || bSetupFromOrgVideo || bSetupFromOrgDepth;
+
+    if ( m_aaeBaseViewPosInModel[iBaseViewIdx][iModelNum] != VIEWPOS_INVALID )
     {
       bAnyRefFromOrg = true;
@@ -418,5 +492,5 @@
   }
 
-  m_apcRenModels[iModelNum]->setup     ( pcPicYuvRefView, ppiShiftLutLeft, ppiBaseShiftLutLeft, ppiShiftLutRight, ppiBaseShiftLutRight, iDistToLeft, false );
+  m_apcRenModels[iModelNum]->setup     ( pcPicYuvRefView, ppiShiftLutLeft, ppiBaseShiftLutLeft, ppiShiftLutRight, ppiBaseShiftLutRight, iDistToLeft, false, m_uiHorOff );
 
   // Setup to Org
@@ -438,6 +512,6 @@
     }
 
-    // setup keeping reference from original data
-    m_apcRenModels[iModelNum]->setup     ( pcPicYuvRefView, ppiShiftLutLeft, ppiBaseShiftLutLeft, ppiShiftLutRight, ppiBaseShiftLutRight, iDistToLeft, true );
+    // setup keeping reference rendered from original data
+    m_apcRenModels[iModelNum]->setup     ( pcPicYuvRefView, ppiShiftLutLeft, ppiBaseShiftLutLeft, ppiShiftLutRight, ppiBaseShiftLutRight, iDistToLeft, true, m_uiHorOff);
   }
 }
@@ -468,7 +542,21 @@
 }
 
+
+Void  
+TRenModel::setHorOffset     ( UInt uiHorOff )
+{
+    m_uiHorOff = uiHorOff; 
+}
+
+#if LGE_VSO_EARLY_SKIP_A0093
+RMDist
+TRenModel::getDist( Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, Pel* piNewData, Pel * piOrgData, Int iOrgStride)
+#else
 RMDist
 TRenModel::getDist( Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, Pel* piNewData )
-{
+#endif
+{
+  iStartPosY -= m_uiHorOff; 
+
   AOT( iWidth  + iStartPosX > m_iWidth  );
   AOT( iHeight + iStartPosY > m_iHeight );
@@ -484,5 +572,9 @@
     if (m_iCurrentContent == 1)
     {
+#if LGE_VSO_EARLY_SKIP_A0093
+      iDist +=  m_apcCurRenModels[iModelNum]->getDistDepth  ( m_aiCurPosInModels[iModelNum], iStartPosX, iStartPosY,  iWidth,  iHeight,  iStride,  piNewData , piOrgData, iOrgStride);
+#else
       iDist +=  m_apcCurRenModels[iModelNum]->getDistDepth  ( m_aiCurPosInModels[iModelNum], iStartPosX, iStartPosY,  iWidth,  iHeight,  iStride,  piNewData );
+#endif
     }
     else
@@ -498,4 +590,6 @@
 TRenModel::setData( Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, Pel* piNewData )
 {
+  iStartPosY -= m_uiHorOff; 
+
   iWidth  = min(iWidth , m_iWidth  - iStartPosX );
   iHeight = min(iHeight, m_iHeight - iStartPosY );
@@ -510,6 +604,10 @@
     if (m_iCurrentContent == 1)
     {
+#ifdef LGE_VSO_EARLY_SKIP_A0093
+      Int iTargetStride = m_aiCurDepthStrides[ m_iCurrentView ];
+      m_apcCurRenModels[iModelNum]->setDepth  ( m_aiCurPosInModels[iModelNum], iStartPosX, iStartPosY, iWidth, iHeight, iStride, piNewData,m_apiCurDepthPel[ m_iCurrentView ] + iStartPosY * iTargetStride + iStartPosX ,iTargetStride );
+#else
       m_apcCurRenModels[iModelNum]->setDepth  ( m_aiCurPosInModels[iModelNum], iStartPosX, iStartPosY, iWidth, iHeight, iStride, piNewData );
-
+#endif
     }
     else
@@ -519,4 +617,5 @@
   }
 
+#ifdef LGE_VSO_EARLY_SKIP_A0093
   if (m_iCurrentContent == 1)
   {
@@ -524,37 +623,22 @@
     TRenFilter::copy( piNewData, iStride, iWidth, iHeight,  m_apiCurDepthPel[ m_iCurrentView ] + iStartPosY * iTargetStride + iStartPosX, iTargetStride );
   }
-  else
-  {
-    Int iTargetStride = m_aaiCurVideoStrides[ m_iCurrentView ][m_iCurrentPlane];
-    TRenFilter::copy( piNewData, iStride, iWidth, iHeight,  m_aapiCurVideoPel[ m_iCurrentView ][m_iCurrentPlane] + iStartPosY * iTargetStride + iStartPosX, iTargetStride);
-  }
-}
-
-Void
-TRenModel::getSynthVideo( Int iModelNum, Int iViewNum, TComPicYuv*& rpcPicYuvSynthVideo )
-{
-  Pel** ppiSynthVideoPel = NULL;
-  Pel*  ppiSynthDepthPel = NULL;
-  Int   iStride          = -1;
-  Int   aiStrides[3];
-
-  m_apcRenModels[iModelNum]->getSynthView(iViewNum, ppiSynthVideoPel, ppiSynthDepthPel, iStride );
-
-  aiStrides[0] = iStride; aiStrides[1] = iStride; aiStrides[2] = iStride;
-  xCopy2PicYuv( ppiSynthVideoPel, aiStrides, rpcPicYuvSynthVideo  );
-}
-
-Void
-TRenModel::getSynthDepth( Int iModelNum, Int iViewNum, TComPicYuv*& rpcPicYuvSynthDepth )
-{
-  Pel** ppiSynthVideoPel = NULL;
-  Pel*  piSynthDepthPel  = NULL;
-  Int   iStride          = -1;
-
-  m_apcRenModels[iModelNum]->getSynthView(iViewNum, ppiSynthVideoPel, piSynthDepthPel, iStride );
-  TRenFilter::copy( piSynthDepthPel, iStride, m_iWidth, m_iHeight, rpcPicYuvSynthDepth->getLumaAddr(), rpcPicYuvSynthDepth->getStride() );
-  rpcPicYuvSynthDepth->setChromaTo( 128 << g_uiBitIncrement );
-}
-
+#endif
+}
+
+Void
+TRenModel::getSynthVideo( Int iModelNum, Int iViewNum, TComPicYuv* pcPicYuv )
+{
+  m_apcRenModels[iModelNum]->getSynthVideo(iViewNum, pcPicYuv, m_uiHorOff );
+}
+
+Void
+TRenModel::getSynthDepth( Int iModelNum, Int iViewNum, TComPicYuv* pcPicYuv )
+{
+#if HHI_VSO_SPEEDUP_A033
+  m_apcRenModels[iModelNum]->getSynthDepth(iViewNum, pcPicYuv, m_uiHorOff );
+#else
+  m_apcRenModels[iModelNum]->getSynthDepth(iViewNum, pcPicYuv );
+#endif
+}
 
 Void
@@ -573,28 +657,7 @@
   for (Int iCurModel = 0; iCurModel < m_iNumOfCurRenModels; iCurModel++)
   {
-    Pel** ppiSynthVideoPel = NULL;
-    Pel*  ppiSynthDepthPel = NULL;
-    Pel** ppiRefVideoPel   = NULL;
-    Int   iSynStride       = -1;
-    Int*  piRefStrides     = NULL;
-    Int   aiSynStrides[3];
-
-    m_apcCurRenModels[iCurModel]->getSynthView( m_aiCurPosInModels[iCurModel], ppiSynthVideoPel, ppiSynthDepthPel, iSynStride );
-    aiSynStrides[0] = iSynStride; aiSynStrides[1] = iSynStride; aiSynStrides[2] = iSynStride;
-    xCopy2PicYuv( ppiSynthVideoPel, aiSynStrides,  &cPicYuvSynth );
-
-    TComPicYuv* pcPicYuvOrgRef;
-    TComPicYuv* pcPicYuvRef;
-    m_apcCurRenModels[iCurModel]->getRefView  ( pcPicYuvOrgRef, ppiRefVideoPel, piRefStrides );
-
-    if (!pcPicYuvOrgRef )
-    {
-      xCopy2PicYuv( ppiRefVideoPel, piRefStrides,  &cPicYuvTempRef);
-      pcPicYuvRef = &cPicYuvTempRef;
-    }
-    else
-    {
-      pcPicYuvRef = pcPicYuvOrgRef;
-    }
+    m_apcCurRenModels[iCurModel]->getSynthVideo( m_aiCurPosInModels[iCurModel], &cPicYuvSynth, 0 );
+    TComPicYuv* pcPicYuvRef = &cPicYuvTempRef;
+    m_apcCurRenModels[iCurModel]->getRefVideo  ( m_aiCurPosInModels[iCurModel], pcPicYuvRef  , 0 );
 
     iSSEY += TRenFilter::SSE( cPicYuvSynth.getLumaAddr(), cPicYuvSynth.getStride(),  m_iWidth,      m_iHeight     , pcPicYuvRef->getLumaAddr(), pcPicYuvRef->getStride() );
@@ -620,6 +683,4 @@
   m_aaeBaseViewPosInModel[iBaseViewNum][iModelNum] = iViewPos;
 
-  m_apcRenModels[iModelNum]->setLRView( iViewPos, m_aapiCurVideoPel[iBaseViewNum], m_aaiCurVideoStrides[iBaseViewNum], m_apiCurDepthPel[iBaseViewNum], m_aiCurDepthStrides [iBaseViewNum] );
-
   if (bAdd)
   {
@@ -639,10 +700,2 @@
   }
 }
-
-Void
-TRenModel::xCopy2PicYuv( Pel** ppiSrcVideoPel, Int* piStrides, TComPicYuv* rpcPicYuvTarget )
-{
-  TRenFilter::copy            ( ppiSrcVideoPel[0], piStrides[0], m_iWidth, m_iHeight, rpcPicYuvTarget->getLumaAddr(), rpcPicYuvTarget->getStride() );
-  TRenFilter::sampleDown2Tap13( ppiSrcVideoPel[1], piStrides[1], m_iWidth, m_iHeight, rpcPicYuvTarget->getCbAddr  (), rpcPicYuvTarget->getCStride() );
-  TRenFilter::sampleDown2Tap13( ppiSrcVideoPel[2], piStrides[2], m_iWidth, m_iHeight, rpcPicYuvTarget->getCrAddr  (), rpcPicYuvTarget->getCStride() );
-}
Index: trunk/source/Lib/TLibRenderer/TRenModel.h
===================================================================
--- trunk/source/Lib/TLibRenderer/TRenModel.h	(revision 81)
+++ trunk/source/Lib/TLibRenderer/TRenModel.h	(revision 100)
@@ -50,5 +50,9 @@
 
   // Creation
+#if LGE_VSO_EARLY_SKIP_A0093
+  Void  create           ( Int iNumOfBaseViews, Int iNumOfModels, Int iWidth, Int iHeight, Int iShiftPrec, Int iHoleMargin, Bool bEarlySkip );
+#else
   Void  create           ( Int iNumOfBaseViews, Int iNumOfModels, Int iWidth, Int iHeight, Int iShiftPrec, Int iHoleMargin );
+#endif
   Void  createSingleModel( Int iBaseViewNum, Int iContent, Int iModelNum, Int iLeftViewNum, Int iRightViewNum, Bool bUseOrgRef, Int iBlendMode );
 
@@ -57,14 +61,22 @@
   Void  setSingleModel   ( Int iModelNum, Int** ppiShiftLutLeft, Int** ppiBaseShiftLutLeft, Int** ppiShiftLutRight, Int** ppiBaseShiftLutRight, Int iDistToLeft, TComPicYuv* pcPicYuvRefView );
 
+  // Set horizontal offset
+  Void  setHorOffset     ( UInt uiHorOff );
+
   // Set Mode
   Void  setErrorMode     ( Int iView, Int iContent, int iPlane );
 
   // Get Distortion, set Data
+#ifdef LGE_VSO_EARLY_SKIP_A0093
+  Int64 getDist          ( Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, Pel* piNewData, Pel * piOrgData, Int iOrgStride);
+#else
   Int64 getDist          ( Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, Pel* piNewData  );
+#endif
   Void  setData          ( Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, Pel* piNewData  );
 
   // Get Rendered View
-  Void  getSynthVideo    ( Int iModelNum, Int iViewNum, TComPicYuv*& rpcPicYuvSynthVideo );
-  Void  getSynthDepth    ( Int iModelNum, Int iViewNum, TComPicYuv*& rpcPicYuvSynthDepth );
+
+  Void  getSynthVideo    ( Int iModelNum, Int iViewNum, TComPicYuv* pcPicYuvSynthVideo );
+  Void  getSynthDepth    ( Int iModelNum, Int iViewNum, TComPicYuv* pcPicYuvSynthDepth );
 
   // Get Total Distortion
@@ -74,5 +86,4 @@
   // helpers
   Void xSetLRViewAndAddModel( Int iModelNum, Int iBaseViewNum, Int iContent, Int iViewPos, Bool bAdd );
-  Void xCopy2PicYuv ( Pel** ppiSrcVideoPel, Int* piStrides, TComPicYuv* rpcPicYuvTarget );
 
   // Settings
@@ -80,4 +91,7 @@
   Int**  m_aaaiSubPelShiftLut[2];
   Int    m_iHoleMargin;
+#if LGE_VSO_EARLY_SKIP_A0093
+  Bool   m_bEarlySkip; 
+#endif
 
   /// Size of Video and Depth
@@ -88,4 +102,9 @@
 
   Int m_iNumOfBaseViews;
+
+#if HHI_VSO_SPEEDUP_A033                 
+  // Horizontal Offset in input data
+  UInt m_uiHorOff;          
+#endif
 
   /// Current Error Type ///
Index: trunk/source/Lib/TLibRenderer/TRenSingleModel.cpp
===================================================================
--- trunk/source/Lib/TLibRenderer/TRenSingleModel.cpp	(revision 81)
+++ trunk/source/Lib/TLibRenderer/TRenSingleModel.cpp	(revision 100)
@@ -32,5 +32,4 @@
  */
 
-
 #include "TRenImage.h"
 #include "TRenFilter.h"
@@ -38,5 +37,6 @@
 
 ////////////// TRENSINGLE MODEL ///////////////
-TRenSingleModel::TRenSingleModel()
+template <BlenMod iBM, Bool bBitInc>
+TRenSingleModelC<iBM,bBitInc>::TRenSingleModelC()
 :  m_iDistShift ( g_uiBitIncrement << 1 )
 {
@@ -50,80 +50,73 @@
 
   m_pcPicYuvRef          = NULL;
+
+  m_pcOutputSamples      = NULL; 
+  m_pcOutputSamplesRow   = NULL;   
+  m_iOutputSamplesStride = -1; 
+
+  m_ppiCurLUT            = NULL;
+  m_piInvZLUTLeft        = NULL;
+  m_piInvZLUTRight       = NULL;
+
   m_aapiRefVideoPel[0]   = NULL;
   m_aapiRefVideoPel[1]   = NULL;
   m_aapiRefVideoPel[2]   = NULL;
 
-
   m_aiRefVideoStrides[0] = -1;
   m_aiRefVideoStrides[1] = -1;
   m_aiRefVideoStrides[2] = -1;
 
+
   for (UInt uiViewNum = 0 ; uiViewNum < 2; uiViewNum++)
   {
     // LUT
     m_appiShiftLut[uiViewNum] = NULL;
+
+    m_pcInputSamples[uiViewNum] = NULL; 
+    m_iInputSamplesStride       = -1; 
+
     m_ppiCurLUT               = NULL;
     m_piInvZLUTLeft           = NULL;
     m_piInvZLUTRight          = NULL;
-
-    // Cur Data
-    m_apiBaseDepthPel      [uiViewNum] = NULL;
-    m_aiBaseDepthStrides   [uiViewNum] = -1;
-
-    // State Data
-    m_apbOccluded          [uiViewNum] = NULL;
-    m_apiFilled            [uiViewNum] = NULL;
-
-    // Cur Data
-    m_aapiBaseVideoPel     [uiViewNum] = NULL;
-    m_aaiBaseVideoStrides  [uiViewNum] = NULL;
-  };
-
-  m_piError                            = NULL;
-
-  for (UInt uiViewNum = 0 ; uiViewNum < 3; uiViewNum++)
-  {
-    m_apiSynthDepthPel[uiViewNum] = NULL;
-    for (UInt uiPlaneNum = 0; uiPlaneNum < 3; uiPlaneNum++)
-    {
-      // Rendered Data
-      m_aapiSynthVideoPel[uiViewNum][uiPlaneNum] = NULL;
-    }
-  }
-}
-
-TRenSingleModel::~TRenSingleModel()
-{
-  if ( m_apbOccluded[0] ) delete[] m_apbOccluded[0];
-  if ( m_apbOccluded[1] ) delete[] m_apbOccluded[1];
-
-  if ( m_apiFilled  [0] ) delete[] m_apiFilled  [0];
-  if ( m_apiFilled  [1] ) delete[] m_apiFilled  [1];
-
-  if ( m_piError        ) delete[] m_piError      ;
-
-
-  for (UInt uiViewNum = 0 ; uiViewNum < 3; uiViewNum++)
-  {
-    for (UInt uiPlaneNum = 0; uiPlaneNum < 3; uiPlaneNum++)
-    {
-      if ( m_aapiSynthVideoPel[uiViewNum] && m_aapiSynthVideoPel[uiViewNum][uiPlaneNum] ) delete[] m_aapiSynthVideoPel[uiViewNum][uiPlaneNum];
-    }
-    if ( m_apiSynthDepthPel[uiViewNum] ) delete[] m_apiSynthDepthPel[uiViewNum];
-  }
-
-  delete[] (m_aapiRefVideoPel[0] - m_iPad * m_aiRefVideoStrides[0] - m_iPad );
-  delete[] (m_aapiRefVideoPel[1] - m_iPad * m_aiRefVideoStrides[1] - m_iPad );
-  delete[] (m_aapiRefVideoPel[2] - m_iPad * m_aiRefVideoStrides[2] - m_iPad );
-
-  if ( m_piInvZLUTLeft  ) delete[] m_piInvZLUTLeft;
-  if ( m_piInvZLUTRight ) delete[] m_piInvZLUTRight;
-}
-
-Void
-TRenSingleModel::create( Int iMode, Int iWidth, Int iHeight, Int iShiftPrec, Int*** aaaiSubPelShiftTable, Int iHoleMargin, Bool bUseOrgRef, Int iBlendMode )
-{
-  m_iBlendMode = iBlendMode;
+  }
+
+#ifdef LGE_VSO_EARLY_SKIP_A0093
+  m_pbHorSkip = NULL;
+#endif
+}
+
+template <BlenMod iBM, Bool bBitInc>
+TRenSingleModelC<iBM,bBitInc>::~TRenSingleModelC()
+{
+#ifdef LGE_VSO_EARLY_SKIP_A0093
+  if (m_pbHorSkip) 
+  {
+    delete[] m_pbHorSkip;
+    m_pbHorSkip = NULL;
+  }
+#endif
+
+  if ( m_pcInputSamples [0] ) delete[] m_pcInputSamples [0];
+  if ( m_pcInputSamples [1] ) delete[] m_pcInputSamples [1];
+  if ( m_pcOutputSamples    ) delete   m_pcOutputSamples   ;
+}
+
+template <BlenMod iBM, Bool bBitInc> Void
+#if LGE_VSO_EARLY_SKIP_A0093
+TRenSingleModelC<iBM,bBitInc>::create( Int iMode, Int iWidth, Int iHeight, Int iShiftPrec, Int*** aaaiSubPelShiftTable, Int iHoleMargin, Bool bUseOrgRef, Int iBlendMode, Bool bEarlySkip )
+#else
+TRenSingleModelC<iBM,bBitInc>::create( Int iMode, Int iWidth, Int iHeight, Int iShiftPrec, Int*** aaaiSubPelShiftTable, Int iHoleMargin, Bool bUseOrgRef, Int iBlendMode )
+#endif
+
+{
+#if LGE_VSO_EARLY_SKIP_A0093
+  m_pbHorSkip     = new Bool [MAX_CU_SIZE];
+  m_bEarlySkip    = bEarlySkip; 
+#endif
+
+  AOF( iBlendMode == iBM ); 
+
   m_iMode = iMode;
+
   m_iWidth  = iWidth;
   m_iHeight = iHeight;
@@ -160,62 +153,81 @@
   m_aapiRefVideoPel  [2] += m_aiRefVideoStrides[2] * m_iPad + m_iPad;
 
-  m_piError               = new Int [m_iStride*m_iHeight];
-
-  // Create Buffers
-  if ( (m_iMode == 0) || (m_iMode == 2 ) )
-  {
-    m_apbOccluded        [0]  = new Bool[m_iStride*m_iHeight];
-    m_apiFilled          [0]  = new Pel [m_iStride*m_iHeight];
-
-    for (UInt uiPlaneNum = 0; uiPlaneNum < 3; uiPlaneNum++)
-    {
-      m_aapiSynthVideoPel[0][uiPlaneNum] = new Pel[m_iStride*m_iHeight];
-    }
-  }
-
-  if ( (m_iMode == 1) || (m_iMode == 2 ) )
-  {
-    m_apbOccluded        [1]  = new Bool[m_iStride*m_iHeight];
-    m_apiFilled          [1]  = new Pel [m_iStride*m_iHeight];
-
-    for (UInt uiPlaneNum = 0; uiPlaneNum < 3; uiPlaneNum++)
-    {
-      m_aapiSynthVideoPel[1][uiPlaneNum] = new Pel[m_iStride*m_iHeight];
-    }
-  }
-
-  if ( m_iMode == 2 )
-  {
-    m_apiSynthDepthPel[0] = new Pel[m_iStride*m_iHeight];
-    m_apiSynthDepthPel[1] = new Pel[m_iStride*m_iHeight];
-    m_apiSynthDepthPel[2] = new Pel[m_iStride*m_iHeight];
-
-    for (UInt uiPlaneNum = 0; uiPlaneNum < 3; uiPlaneNum++)
-    {
-      m_aapiSynthVideoPel[2][uiPlaneNum] = new Pel[m_iStride*m_iHeight];
-    }
-  }
-}
-
-Void
-TRenSingleModel::setLRView( Int iViewPos, Pel** apiCurVideoPel, Int* aiCurVideoStride, Pel* piCurDepthPel, Int iCurDepthStride )
+  m_iInputSamplesStride  = m_iWidth+1;
+  m_iOutputSamplesStride = m_iWidth;
+
+  m_pcInputSamples[0]     = new RenModelInPels[m_iInputSamplesStride*m_iHeight];
+  m_pcInputSamples[1]     = new RenModelInPels[m_iInputSamplesStride*m_iHeight];
+
+  m_pcOutputSamples       = new RenModelOutPels[m_iOutputSamplesStride*m_iHeight];  
+}
+
+template <BlenMod iBM, Bool bBitInc> Void
+TRenSingleModelC<iBM,bBitInc>::setLRView( Int iViewPos, Pel** apiCurVideoPel, Int* aiCurVideoStride, Pel* piCurDepthPel, Int iCurDepthStride )
 {
   AOF(( iViewPos == 0) || (iViewPos == 1) );
+
+  RenModelInPels* pcCurInputSampleRow = m_pcInputSamples[iViewPos];
+  
+  Pel* piDRow = piCurDepthPel;
+  Pel* piYRow = apiCurVideoPel[0];
+#if HHI_VSO_COLOR_PLANES
+  Pel* piURow = apiCurVideoPel[1];
+  Pel* piVRow = apiCurVideoPel[2];
+#endif  
+
+
+  Int iOffsetX = ( iViewPos == VIEWPOS_RIGHT ) ? 1 : 0;
+
+  for ( Int iPosY = 0; iPosY < m_iHeight; iPosY++ )
+  {
+    if ( iViewPos == VIEWPOS_RIGHT )
+    {
+      Int iSubPosX = (1 << m_iShiftPrec); 
+      pcCurInputSampleRow[0].aiY[iSubPosX] = piYRow[0];
+#if HHI_VSO_COLOR_PLANES 
+      pcCurInputSampleRow[0].aiU[iSubPosX] = piURow[0];
+      pcCurInputSampleRow[0].aiV[iSubPosX] = piVRow[0];
+#endif
+    }
+
+    for ( Int iPosX = 0; iPosX < m_iWidth; iPosX++ )
+    {
+      pcCurInputSampleRow[iPosX].iD = piDRow[iPosX];
+
+      for (Int iSubPosX = 0; iSubPosX < (1 << m_iShiftPrec)+1; iSubPosX++ )
+      { 
+        Int iShift = (iPosX << m_iShiftPrec) + iSubPosX;
+        pcCurInputSampleRow[iPosX+iOffsetX].aiY[iSubPosX] = piYRow[iShift];
+#if HHI_VSO_COLOR_PLANES 
+        pcCurInputSampleRow[iPosX+iOffsetX].aiU[iSubPosX] = piURow[iShift];
+        pcCurInputSampleRow[iPosX+iOffsetX].aiV[iSubPosX] = piVRow[iShift];
+#endif
+      }
+    } 
+
+    pcCurInputSampleRow += m_iInputSamplesStride; 
+
+    piDRow += iCurDepthStride;
+    piYRow += aiCurVideoStride[0];
+#if HHI_VSO_COLOR_PLANES
+    piURow += aiCurVideoStride[1];
+    piVRow += aiCurVideoStride[2];
+#endif
+  }
+
+  
   m_aapiBaseVideoPel      [iViewPos] = apiCurVideoPel;
   m_aaiBaseVideoStrides   [iViewPos] = aiCurVideoStride;
   m_apiBaseDepthPel       [iViewPos] = piCurDepthPel;
   m_aiBaseDepthStrides    [iViewPos] = iCurDepthStride;
-}
-
-Void
-TRenSingleModel::setup( TComPicYuv* pcOrgVideo, Int** ppiShiftLutLeft, Int** ppiBaseShiftLutLeft, Int** ppiShiftLutRight,  Int** ppiBaseShiftLutRight,  Int iDistToLeft, Bool bKeepReference )
+
+}
+
+template <BlenMod iBM, Bool bBitInc> Void
+TRenSingleModelC<iBM,bBitInc>::setup( TComPicYuv* pcOrgVideo, Int** ppiShiftLutLeft, Int** ppiBaseShiftLutLeft, Int** ppiShiftLutRight,  Int** ppiBaseShiftLutRight,  Int iDistToLeft, Bool bKeepReference, UInt uiHorOff )
 {
   AOT( !m_bUseOrgRef && pcOrgVideo );
   AOT( (ppiShiftLutLeft  == NULL) && (m_iMode == 0 || m_iMode == 2) );
   AOT( (ppiShiftLutRight == NULL) && (m_iMode == 1 || m_iMode == 2) );
-#if HHI_FIX
-#else
-  AOT( pcOrgVideo != NULL && bKeepReference );
-#endif
 
   m_appiShiftLut[0] = ppiShiftLutLeft;
@@ -225,35 +237,41 @@
   m_pcPicYuvRef = pcOrgVideo;
 
-#if HHI_FIX
   if ( pcOrgVideo && !bKeepReference )
-#else
-  if ( pcOrgVideo )
-#endif
-  {
-    TRenFilter::copy(             pcOrgVideo->getLumaAddr(), pcOrgVideo->getStride() , m_iWidth,      m_iHeight,      m_aapiRefVideoPel[0], m_aiRefVideoStrides[0]);
-    TRenFilter::sampleCUpHorUp(0, pcOrgVideo->getCbAddr()  , pcOrgVideo->getCStride(), m_iWidth >> 1, m_iHeight >> 1, m_aapiRefVideoPel[1], m_aiRefVideoStrides[1]);
-    TRenFilter::sampleCUpHorUp(0, pcOrgVideo->getCrAddr()  , pcOrgVideo->getCStride(), m_iWidth >> 1, m_iHeight >> 1, m_aapiRefVideoPel[2], m_aiRefVideoStrides[2]);
+  {
+    TRenFilter::copy(             pcOrgVideo->getLumaAddr() +  uiHorOff       * pcOrgVideo->getStride() , pcOrgVideo->getStride() , m_iWidth,      m_iHeight,      m_aapiRefVideoPel[0], m_aiRefVideoStrides[0]);
+    TRenFilter::sampleCUpHorUp(0, pcOrgVideo->getCbAddr()   + (uiHorOff >> 1) * pcOrgVideo->getCStride(), pcOrgVideo->getCStride(), m_iWidth >> 1, m_iHeight >> 1, m_aapiRefVideoPel[1], m_aiRefVideoStrides[1]);
+    TRenFilter::sampleCUpHorUp(0, pcOrgVideo->getCrAddr()   + (uiHorOff >> 1) * pcOrgVideo->getCStride(), pcOrgVideo->getCStride(), m_iWidth >> 1, m_iHeight >> 1, m_aapiRefVideoPel[2], m_aiRefVideoStrides[2]);    
+    xSetStructRefView();
   }
 
   // Initial Rendering
-  xSetInts( m_piError                       , m_iStride, m_iWidth, m_iHeight, 0 );
+  xResetStructError();
+  xInitSampleStructs();
 
   switch ( m_iMode )
-  {
-  case 0:
-    xInitView( VIEWPOS_LEFT );
-    xRenderL( 0, 0, m_iWidth, m_iHeight, m_aiBaseDepthStrides[0], m_apiBaseDepthPel[0], true );
+  {  
+  case 0:   
+#if LGE_VSO_EARLY_SKIP_A0093
+    xRenderL<true>( 0, 0, m_iWidth, m_iHeight, m_aiBaseDepthStrides[0], m_apiBaseDepthPel[0],false );
+#else
+    xRenderL<true>( 0, 0, m_iWidth, m_iHeight, m_aiBaseDepthStrides[0], m_apiBaseDepthPel[0] );
+#endif   
     break;
-  case 1:
-    xInitView( VIEWPOS_RIGHT );
-    xRenderR( 0, 0, m_iWidth, m_iHeight, m_aiBaseDepthStrides[1], m_apiBaseDepthPel[1], true );
+  case 1:    
+#ifdef LGE_VSO_EARLY_SKIP_A0093
+    xRenderR<true>( 0, 0, m_iWidth, m_iHeight, m_aiBaseDepthStrides[1], m_apiBaseDepthPel[1],false);
+#else
+    xRenderR<true>( 0, 0, m_iWidth, m_iHeight, m_aiBaseDepthStrides[1], m_apiBaseDepthPel[1] );
+#endif
     break;
   case 2:
     TRenFilter::setupZLUT( true, 30, iDistToLeft, ppiBaseShiftLutLeft, ppiBaseShiftLutRight, m_iBlendZThres, m_iBlendDistWeight, m_piInvZLUTLeft, m_piInvZLUTRight );
-    xInitView( VIEWPOS_LEFT   );
-    xInitView( VIEWPOS_RIGHT  );
-    xInitView( VIEWPOS_MERGED );
-    xRenderL( 0, 0, m_iWidth, m_iHeight, m_aiBaseDepthStrides[0], m_apiBaseDepthPel[0], true );
-    xRenderR( 0, 0, m_iWidth, m_iHeight, m_aiBaseDepthStrides[1], m_apiBaseDepthPel[1], true );
+#ifdef LGE_VSO_EARLY_SKIP_A0093
+    xRenderL<true>( 0, 0, m_iWidth, m_iHeight, m_aiBaseDepthStrides[0], m_apiBaseDepthPel[0],false);
+    xRenderR<true>( 0, 0, m_iWidth, m_iHeight, m_aiBaseDepthStrides[1], m_apiBaseDepthPel[1],false);
+#else      
+    xRenderL<true>( 0, 0, m_iWidth, m_iHeight, m_aiBaseDepthStrides[0], m_apiBaseDepthPel[0] );
+    xRenderR<true>( 0, 0, m_iWidth, m_iHeight, m_aiBaseDepthStrides[1], m_apiBaseDepthPel[1] );
+#endif
     break;
   default:
@@ -264,66 +282,338 @@
   if ( !pcOrgVideo && !bKeepReference )
   {
-    xSetInts        ( m_piError                       , m_iStride, m_iWidth, m_iHeight, 0 );
-      TRenFilter::copy( m_aapiSynthVideoPel[m_iMode ][0], m_iStride, m_iWidth, m_iHeight , m_aapiRefVideoPel[0], m_aiRefVideoStrides[0]);
-      TRenFilter::copy( m_aapiSynthVideoPel[m_iMode ][1], m_iStride, m_iWidth, m_iHeight , m_aapiRefVideoPel[1], m_aiRefVideoStrides[1]);
-      TRenFilter::copy( m_aapiSynthVideoPel[m_iMode ][2], m_iStride, m_iWidth, m_iHeight , m_aapiRefVideoPel[2], m_aiRefVideoStrides[2]);
-  }
-}
-
-RMDist
-TRenSingleModel::getDistDepth( Int iViewPos, Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, Pel* piNewData )
-{
-  RMDist iSSE = 0;
-  switch (iViewPos )
+    xResetStructError();
+    xSetStructSynthViewAsRefView();
+  }
+}
+
+template <BlenMod iBM, Bool bBitInc> Void
+#if HHI_VSO_COLOR_PLANES
+TRenSingleModelC<iBM,bBitInc>::xGetSampleStrTextPtrs( Int iViewNum, Pel RenModelOutPels::*& rpiSrcY, Pel RenModelOutPels::*& rpiSrcU, Pel RenModelOutPels::*& rpiSrcV )
+#else
+TRenSingleModelC<iBM,bBitInc>::xGetSampleStrTextPtrs( Int iViewNum, Pel RenModelOutPels::*& rpiSrcY )
+#endif
+{
+  switch ( iViewNum )
   {
   case 0:
-    iSSE = xRenderL( iStartPosX,   iStartPosY,   iWidth,   iHeight,   iStride, piNewData, false );
+    rpiSrcY = &RenModelOutPels::iYLeft;
+#if HHI_VSO_COLOR_PLANES  
+    rpiSrcU = &RenModelOutPels::iULeft;
+    rpiSrcV = &RenModelOutPels::iVLeft;
+#endif
     break;
   case 1:
-    iSSE = xRenderR( iStartPosX,   iStartPosY,   iWidth,   iHeight,   iStride, piNewData, false );
+    rpiSrcY = &RenModelOutPels::iYRight;
+#if HHI_VSO_COLOR_PLANES  
+    rpiSrcU = &RenModelOutPels::iURight;
+    rpiSrcV = &RenModelOutPels::iVRight;
+#endif
+    break;
+  case 2:
+    rpiSrcY = &RenModelOutPels::iYBlended;
+#if HHI_VSO_COLOR_PLANES  
+    rpiSrcU = &RenModelOutPels::iUBlended;
+    rpiSrcV = &RenModelOutPels::iVBlended;
+#endif
+    break;
+  }
+}
+
+
+template <BlenMod iBM, Bool bBitInc> Void
+TRenSingleModelC<iBM,bBitInc>::xGetSampleStrDepthPtrs( Int iViewNum, Pel RenModelOutPels::*& rpiSrcD )
+{
+  AOT(iViewNum != 0 && iViewNum != 1);  
+  rpiSrcD = (iViewNum == 1) ? &RenModelOutPels::iDRight : &RenModelOutPels::iDLeft; 
+}
+
+
+template <BlenMod iBM, Bool bBitInc> Void
+TRenSingleModelC<iBM,bBitInc>::xSetStructRefView( )
+{
+  RenModelOutPels* pcCurOutSampleRow = m_pcOutputSamples;
+  
+  Pel* piYRow = m_aapiRefVideoPel[0];
+#if HHI_VSO_COLOR_PLANES
+  Pel* piURow = m_aapiRefVideoPel[1];
+  Pel* piVRow = m_aapiRefVideoPel[2];
+#endif  
+
+  for ( Int iPosY = 0; iPosY < m_iHeight; iPosY++ )
+  {
+    for ( Int iPosX = 0; iPosX < m_iWidth; iPosX++ )
+    {      
+      pcCurOutSampleRow[iPosX].iYRef = piYRow[iPosX];
+#if HHI_VSO_COLOR_PLANES
+      pcCurOutSampleRow[iPosX].iURef = piURow[iPosX];
+      pcCurOutSampleRow[iPosX].iVRef = piVRow[iPosX];
+#endif
+    } 
+
+    pcCurOutSampleRow += m_iOutputSamplesStride; 
+    
+    piYRow += m_aiRefVideoStrides[0];
+#if HHI_VSO_COLOR_PLANES
+    piURow += m_aiRefVideoStrides[1];
+    piVRow += m_aiRefVideoStrides[2];
+#endif
+  }
+}
+
+template <BlenMod iBM, Bool bBitInc> Void
+TRenSingleModelC<iBM,bBitInc>::xResetStructError( )
+{
+  RenModelOutPels* pcCurOutSampleRow = m_pcOutputSamples;
+
+  for ( Int iPosY = 0; iPosY < m_iHeight; iPosY++ )
+  {
+    for ( Int iPosX = 0; iPosX < m_iWidth; iPosX++ )
+    {      
+      pcCurOutSampleRow[iPosX].iError = 0;
+    } 
+    pcCurOutSampleRow += m_iOutputSamplesStride; 
+  }
+}
+
+template <BlenMod iBM, Bool bBitInc> Void
+TRenSingleModelC<iBM,bBitInc>::xSetStructSynthViewAsRefView( )
+{
+  AOT( m_iMode < 0 || m_iMode > 2);
+
+  RenModelOutPels* pcCurOutSampleRow = m_pcOutputSamples;
+
+  Pel RenModelOutPels::* piSrcY = NULL;
+
+#if HHI_VSO_COLOR_PLANES  
+  Pel RenModelOutPels::* piSrcU = NULL;
+  Pel RenModelOutPels::* piSrcV = NULL;
+  xGetSampleStrTextPtrs( m_iMode, piSrcY, piSrcU, piSrcV );
+#else
+  xGetSampleStrTextPtrs( m_iMode, piSrcY );
+#endif
+
+  for ( Int iPosY = 0; iPosY < m_iHeight; iPosY++ )
+  {
+    for ( Int iPosX = 0; iPosX < m_iWidth; iPosX++ )
+    {      
+      pcCurOutSampleRow[iPosX].iYRef = pcCurOutSampleRow[iPosX].*piSrcY;
+#if HHI_VSO_COLOR_PLANES
+      pcCurOutSampleRow[iPosX].iURef = pcCurOutSampleRow[iPosX].*piSrcU;
+      pcCurOutSampleRow[iPosX].iVRef = pcCurOutSampleRow[iPosX].*piSrcV;
+#endif
+    } 
+    pcCurOutSampleRow += m_iOutputSamplesStride; 
+  }
+}
+
+template <BlenMod iBM, Bool bBitInc> Void
+TRenSingleModelC<iBM,bBitInc>::xInitSampleStructs()
+{
+  RenModelOutPels* pcOutSampleRow      = m_pcOutputSamples;
+  RenModelInPels * pcLeftInSampleRow   = m_pcInputSamples[0];
+  RenModelInPels * pcRightInSampleRow  = m_pcInputSamples[1];
+
+
+  for (Int iPosY = 0; iPosY < m_iHeight; iPosY++)
+  {
+    for (Int iPosX = 0; iPosX < m_iWidth; iPosX++)
+    {
+      //// Output Samples
+      pcOutSampleRow[iPosX].iFilledLeft   = REN_IS_HOLE;
+      pcOutSampleRow[iPosX].iFilledRight  = REN_IS_HOLE;
+
+      pcOutSampleRow[iPosX].iDLeft        = 0;
+      pcOutSampleRow[iPosX].iDRight       = 0;
+      pcOutSampleRow[iPosX].iDBlended     = 0;      
+                                     
+      // Y Planes                    
+      pcOutSampleRow[iPosX].iYLeft        = 0;
+      pcOutSampleRow[iPosX].iYRight       = 0;
+      pcOutSampleRow[iPosX].iYBlended     = 0;
+#if HHI_VSO_COLOR_PLANES             
+      // U Planes                    
+      pcOutSampleRow[iPosX].iULeft        = 128 << g_uiBitIncrement;
+      pcOutSampleRow[iPosX].iURight       = 128 << g_uiBitIncrement;
+      pcOutSampleRow[iPosX].iUBlended     = 128 << g_uiBitIncrement;
+                                     
+      // V Planes                    
+      pcOutSampleRow[iPosX].iVLeft        = 128 << g_uiBitIncrement;
+      pcOutSampleRow[iPosX].iVRight       = 128 << g_uiBitIncrement;
+      pcOutSampleRow[iPosX].iVBlended     = 128 << g_uiBitIncrement;
+#endif
+      //// Input Samples
+      pcLeftInSampleRow [iPosX].bOccluded = false;
+      pcRightInSampleRow[iPosX].bOccluded = false;
+    }
+
+    pcOutSampleRow     += m_iOutputSamplesStride;
+    pcLeftInSampleRow  += m_iInputSamplesStride;
+    pcRightInSampleRow += m_iInputSamplesStride;
+  }  
+}
+
+
+#ifdef LGE_VSO_EARLY_SKIP_A0093
+template <BlenMod iBM, Bool bBitInc> RMDist
+TRenSingleModelC<iBM,bBitInc>::getDistDepth( Int iViewPos, Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, Pel* piNewData , Pel * piOrgData, Int iOrgStride )
+#else
+template <BlenMod iBM, Bool bBitInc> RMDist
+TRenSingleModelC<iBM,bBitInc>::getDistDepth( Int iViewPos, Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, Pel* piNewData )
+#endif
+{
+  RMDist iSSE = 0;
+#ifdef LGE_VSO_EARLY_SKIP_A0093
+  Bool   bEarlySkip;
+#endif
+  switch ( iViewPos )
+  {
+  case 0:
+#ifdef LGE_VSO_EARLY_SKIP_A0093
+    bEarlySkip = m_bEarlySkip ? xDetectEarlySkipL(iStartPosX,   iStartPosY,   iWidth,   iHeight,   iStride, piNewData, piOrgData, iOrgStride) : false;
+    if( !bEarlySkip )
+    {
+      iSSE = xRenderL<false>( iStartPosX,   iStartPosY,   iWidth,   iHeight,   iStride, piNewData,true );
+    }    
+#else
+    iSSE = xRenderL<false>( iStartPosX,   iStartPosY,   iWidth,   iHeight,   iStride, piNewData );
+#endif
+    break;
+  case 1:
+#ifdef LGE_VSO_EARLY_SKIP_A0093
+    bEarlySkip = m_bEarlySkip ? xDetectEarlySkipR(iStartPosX,   iStartPosY,   iWidth,   iHeight,   iStride, piNewData, piOrgData, iOrgStride) : false;
+    if( !bEarlySkip )
+    {
+      iSSE = xRenderR<false>( iStartPosX,   iStartPosY,   iWidth,   iHeight,   iStride, piNewData,true );
+    }    
+#else
+    iSSE = xRenderR<false>( iStartPosX,   iStartPosY,   iWidth,   iHeight,   iStride, piNewData );
+#endif
     break;
   default:
     assert(0);
   }
+
   return iSSE;
 }
-
-Void
-TRenSingleModel::setDepth( Int iViewPos, Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, Pel* piNewData )
-{
-  switch (iViewPos )
-  {
-    case 0:
-      xRenderL( iStartPosX,   iStartPosY,   iWidth,   iHeight,   iStride, piNewData, true );
-      break;
-    case 1:
-      xRenderR( iStartPosX,   iStartPosY,   iWidth,   iHeight,   iStride, piNewData, true );
-      break;
-    default:
-      assert(0);
-  }
-}
-
-
-Void
-TRenSingleModel::getSynthView( Int iViewPos, Pel**& rppiRenVideoPel, Pel*& rpiRenDepthPel, Int& riStride )
-{
-  rppiRenVideoPel = m_aapiSynthVideoPel[iViewPos];
-  rpiRenDepthPel  = m_apiSynthDepthPel [iViewPos];
-  riStride = m_iStride;
-}
-
-
-Void
-TRenSingleModel::getRefView( TComPicYuv*& rpcPicYuvRefView, Pel**& rppiRefVideoPel, Int*& raiStrides )
-{
-  rpcPicYuvRefView = m_pcPicYuvRef;
-  rppiRefVideoPel  = m_aapiRefVideoPel;
-  raiStrides       = m_aiRefVideoStrides;
-}
-
-
-RMDist
-TRenSingleModel::getDistVideo( Int iViewPos, Int iPlane, Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, Pel* piNewData )
+#ifdef LGE_VSO_EARLY_SKIP_A0093
+template <BlenMod iBM, Bool bBitInc> Void
+TRenSingleModelC<iBM,bBitInc>::setDepth( Int iViewPos, Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, Pel* piNewData, Pel* piOrgData, Int iOrgStride )
+#else
+template <BlenMod iBM, Bool bBitInc> Void
+TRenSingleModelC<iBM,bBitInc>::setDepth( Int iViewPos, Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, Pel* piNewData )
+#endif
+{
+#ifdef  LGE_VSO_EARLY_SKIP_A0093
+  Bool bEarlySkip;
+#endif
+  switch ( iViewPos )
+  {
+  case 0:
+#ifdef LGE_VSO_EARLY_SKIP_A0093
+    bEarlySkip = m_bEarlySkip ? xDetectEarlySkipL(iStartPosX,   iStartPosY,   iWidth,   iHeight,   iStride, piNewData, piOrgData,iOrgStride) : false;
+    if( !bEarlySkip )
+    {
+      xRenderL<true>( iStartPosX,   iStartPosY,   iWidth,   iHeight,   iStride, piNewData,true );
+    }    
+#else
+    xRenderL<true>( iStartPosX,   iStartPosY,   iWidth,   iHeight,   iStride, piNewData );
+#endif     
+    break;
+  case 1:
+#ifdef LGE_VSO_EARLY_SKIP_A0093
+    bEarlySkip = m_bEarlySkip ? xDetectEarlySkipR(iStartPosX,   iStartPosY,   iWidth,   iHeight,   iStride, piNewData, piOrgData,iOrgStride) : false;
+    if( !bEarlySkip )
+    {
+      xRenderR<true>( iStartPosX,   iStartPosY,   iWidth,   iHeight,   iStride, piNewData,true ); 
+    }    
+#else
+    xRenderR<true>( iStartPosX,   iStartPosY,   iWidth,   iHeight,   iStride, piNewData );
+#endif     
+    break;
+  default:
+    assert(0);
+  }
+}
+
+template <BlenMod iBM, Bool bBitInc> Void
+TRenSingleModelC<iBM,bBitInc>::getSynthVideo( Int iViewPos, TComPicYuv* pcPicYuv, UInt uiHorOffset )
+{  
+  AOT( pcPicYuv->getWidth() != m_iWidth );
+  AOT( pcPicYuv->getHeight() > m_iHeight + uiHorOffset );
+
+#if HHI_VSO_COLOR_PLANES
+  Pel RenModelOutPels::* piText[3] = { NULL, NULL, NULL };
+  xGetSampleStrTextPtrs(iViewPos, piText[0], piText[1], piText[2]); 
+
+  // Temp image for chroma down sampling
+  PelImage cTempImage( m_iWidth, m_iHeight, 3, 0);
+  Int  aiStrides[3]; 
+  Pel* apiData  [3]; 
+
+  cTempImage.getDataAndStrides( apiData, aiStrides ); 
+
+  for (UInt uiCurPlane = 0; uiCurPlane < 3; uiCurPlane++ )
+  {
+    xCopyFromSampleStruct( m_pcOutputSamples, m_iOutputSamplesStride, piText[uiCurPlane], apiData[uiCurPlane], aiStrides[uiCurPlane] , m_iWidth, m_iHeight);
+  }  
+
+  xCopy2PicYuv( apiData, aiStrides, pcPicYuv, uiHorOffset );
+#else
+  Pel RenModelOutPels::* piY;
+  xGetSampleStrTextPtrs(iViewPos, piY); 
+  xCopyFromSampleStruct( m_pcOutputSamples, m_iOutputSamplesStride, piY, pcPicYuv->getLumaAddr() + uiHorOffset * pcPicYuv->getStride(), pcPicYuv->getStride(), m_iWidth, m_iHeight );
+  pcPicYuv->setChromaTo( 128 << g_uiBitIncrement );   
+#endif  
+}
+
+
+template <BlenMod iBM, Bool bBitInc> Void
+TRenSingleModelC<iBM,bBitInc>::getSynthDepth( Int iViewPos, TComPicYuv* pcPicYuv, UInt uiHorOff )
+{  
+  AOT( iViewPos != 0 && iViewPos != 1); 
+
+  AOT( pcPicYuv->getWidth()  != m_iWidth  );
+  AOT( pcPicYuv->getHeight() > m_iHeight + uiHorOff );
+
+  Pel RenModelOutPels::* piD = 0;
+  xGetSampleStrDepthPtrs(iViewPos, piD); 
+  xCopyFromSampleStruct( m_pcOutputSamples, m_iOutputSamplesStride, piD, pcPicYuv->getLumaAddr() + pcPicYuv->getStride() * uiHorOff, pcPicYuv->getStride(), m_iWidth, m_iHeight );
+  pcPicYuv->setChromaTo( 128 << g_uiBitIncrement );   
+}
+
+template <BlenMod iBM, Bool bBitInc> Void
+TRenSingleModelC<iBM,bBitInc>::getRefVideo ( Int iViewPos, TComPicYuv* pcPicYuv, UInt uiHorOffset )
+{  
+  AOT( pcPicYuv->getWidth()  != m_iWidth  );
+  AOT( pcPicYuv->getHeight() >  m_iHeight + uiHorOffset);
+
+#if HHI_VSO_COLOR_PLANES
+  Pel RenModelOutPels::* piText[3];
+  piText[0] = &RenModelOutPels::iYRef;
+  piText[1] = &RenModelOutPels::iURef;
+  piText[2] = &RenModelOutPels::iVRef;
+
+  // Temp image for chroma down sampling
+  PelImage cTempImage( m_iWidth, m_iHeight, 3, 0);
+  Int  aiStrides[3]; 
+  Pel* apiData  [3]; 
+
+  cTempImage.getDataAndStrides( apiData, aiStrides ); 
+
+  for (UInt uiCurPlane = 0; uiCurPlane < 3; uiCurPlane++ )
+  {
+    xCopyFromSampleStruct( m_pcOutputSamples, m_iOutputSamplesStride, piText[uiCurPlane], apiData[uiCurPlane], aiStrides[uiCurPlane] , m_iWidth, m_iHeight);
+  }  
+
+  xCopy2PicYuv( apiData, aiStrides, pcPicYuv, uiHorOffset );
+#else
+  xCopyFromSampleStruct( m_pcOutputSamples, m_iOutputSamplesStride, &RenModelOutPels::iYRef, pcPicYuv->getLumaAddr() *  pcPicYuv->getStride() + uiHorOffset, pcPicYuv->getStride(), m_iWidth, m_iHeight );
+  pcPicYuv->setChromaTo( 128 << g_uiBitIncrement );   
+#endif  
+}
+
+
+template <BlenMod iBM, Bool bBitInc> RMDist
+TRenSingleModelC<iBM,bBitInc>::getDistVideo( Int iViewPos, Int iPlane, Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, Pel* piNewData )
 {
   AOF(false);
@@ -331,6 +621,6 @@
 }
 
-Void
-TRenSingleModel::setVideo( Int iViewPos, Int iPlane, Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, Pel* piNewData )
+template <BlenMod iBM, Bool bBitInc> Void
+TRenSingleModelC<iBM,bBitInc>::setVideo( Int iViewPos, Int iPlane, Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, Pel* piNewData )
 {
   AOF(false);
@@ -339,83 +629,33 @@
 
 
-__inline Void
-TRenSingleModel::xSetViewRow( Int iPosY )
-{
-  m_aapiBaseVideoPelRow     [m_iCurViewPos][0] = m_aapiBaseVideoPel   [m_iCurViewPos]  [0] + m_aaiBaseVideoStrides [ m_iCurViewPos ][0] * iPosY;
-  m_aapiBaseVideoPelRow     [m_iCurViewPos][1] = m_aapiBaseVideoPel   [m_iCurViewPos]  [1] + m_aaiBaseVideoStrides [ m_iCurViewPos ][1] * iPosY;
-  m_aapiBaseVideoPelRow     [m_iCurViewPos][2] = m_aapiBaseVideoPel   [m_iCurViewPos]  [2] + m_aaiBaseVideoStrides [ m_iCurViewPos ][2] * iPosY;
-
-  m_apiBaseDepthPelRow      [m_iCurViewPos]    = m_apiBaseDepthPel    [m_iCurViewPos]      + m_aiBaseDepthStrides  [ m_iCurViewPos]     * iPosY;
-  m_apbOccludedRow          [m_iCurViewPos]    = m_apbOccluded        [m_iCurViewPos]      + m_iStride                                  * iPosY;
-  m_apiFilledRow            [m_iCurViewPos]    = m_apiFilled          [m_iCurViewPos]      + m_iStride                                  * iPosY;
-  m_apiErrorRow                                = m_piError                                 + m_iStride                                  * iPosY;
-
-  m_aapiSynthVideoPelRow    [m_iCurViewPos][0] = m_aapiSynthVideoPel  [m_iCurViewPos]  [0] + m_iStride                                  * iPosY;
-  m_aapiSynthVideoPelRow    [m_iCurViewPos][1] = m_aapiSynthVideoPel  [m_iCurViewPos]  [1] + m_iStride                                  * iPosY;
-  m_aapiSynthVideoPelRow    [m_iCurViewPos][2] = m_aapiSynthVideoPel  [m_iCurViewPos]  [2] + m_iStride                                  * iPosY;
-
-  m_aapiRefVideoPelRow                     [0] = m_aapiRefVideoPel                     [0] + m_aiRefVideoStrides                    [0] * iPosY;
-  m_aapiRefVideoPelRow                     [1] = m_aapiRefVideoPel                     [1] + m_aiRefVideoStrides                    [1] * iPosY;
-  m_aapiRefVideoPelRow                     [2] = m_aapiRefVideoPel                     [2] + m_aiRefVideoStrides                    [2] * iPosY;
-
-  if (m_iMode == 2)
-  {
-    m_apiSynthDepthPelRow [m_iCurViewPos ]     = m_apiSynthDepthPel   [m_iCurViewPos]      + m_iStride                                  * iPosY;
-    m_aapiSynthVideoPelRow[m_iOtherViewPos][0] = m_aapiSynthVideoPel  [m_iOtherViewPos][0] + m_iStride                                  * iPosY;
-    m_aapiSynthVideoPelRow[m_iOtherViewPos][1] = m_aapiSynthVideoPel  [m_iOtherViewPos][1] + m_iStride                                  * iPosY;
-    m_aapiSynthVideoPelRow[m_iOtherViewPos][2] = m_aapiSynthVideoPel  [m_iOtherViewPos][2] + m_iStride                                  * iPosY;
-
-    m_apiFilledRow        [m_iOtherViewPos]    = m_apiFilled          [m_iOtherViewPos]    + m_iStride                                  * iPosY;
-    m_apiSynthDepthPelRow [m_iOtherViewPos]    = m_apiSynthDepthPel   [m_iOtherViewPos]    + m_iStride                                  * iPosY;
-
-    m_aapiSynthVideoPelRow[2              ][0] = m_aapiSynthVideoPel[2]                [0] + m_iStride                                  * iPosY;
-    m_aapiSynthVideoPelRow[2              ][1] = m_aapiSynthVideoPel[2]                [1] + m_iStride                                  * iPosY;
-    m_aapiSynthVideoPelRow[2              ][2] = m_aapiSynthVideoPel[2]                [2] + m_iStride                                  * iPosY;
-  }
-}
-
-__inline Void
-TRenSingleModel::xIncViewRow( )
-{
-  m_aapiBaseVideoPelRow     [m_iCurViewPos][0] += m_aaiBaseVideoStrides [ m_iCurViewPos ][0];
-  m_aapiBaseVideoPelRow     [m_iCurViewPos][1] += m_aaiBaseVideoStrides [ m_iCurViewPos ][1];
-  m_aapiBaseVideoPelRow     [m_iCurViewPos][2] += m_aaiBaseVideoStrides [ m_iCurViewPos ][2];
-
-  m_apiBaseDepthPelRow      [m_iCurViewPos]    += m_aiBaseDepthStrides  [ m_iCurViewPos]    ;
-  m_apbOccludedRow          [m_iCurViewPos]    += m_iStride                                 ;
-  m_apiFilledRow            [m_iCurViewPos]    += m_iStride                                 ;
-  m_apiErrorRow                                += m_iStride                                 ;
-
-  m_aapiSynthVideoPelRow    [m_iCurViewPos][0] += m_iStride                                 ;
-  m_aapiSynthVideoPelRow    [m_iCurViewPos][1] += m_iStride                                 ;
-  m_aapiSynthVideoPelRow    [m_iCurViewPos][2] += m_iStride                                 ;
-
-  m_aapiRefVideoPelRow                     [0] += m_aiRefVideoStrides                    [0];
-  m_aapiRefVideoPelRow                     [1] += m_aiRefVideoStrides                    [1];
-  m_aapiRefVideoPelRow                     [2] += m_aiRefVideoStrides                    [2];
-
-  if (m_iMode == 2)
-  {
-    m_apiSynthDepthPelRow [m_iCurViewPos ]     += m_iStride                                 ;    // This is correct!
-
-    m_aapiSynthVideoPelRow[m_iOtherViewPos][0] += m_iStride                                 ;
-    m_aapiSynthVideoPelRow[m_iOtherViewPos][1] += m_iStride                                 ;
-    m_aapiSynthVideoPelRow[m_iOtherViewPos][2] += m_iStride                                 ;
-
-    m_apiFilledRow        [m_iOtherViewPos]    += m_iStride                                 ;
-    m_apiSynthDepthPelRow [m_iOtherViewPos]    += m_iStride                                 ;
-
-    m_aapiSynthVideoPelRow[2              ][0] += m_iStride                                 ;
-    m_aapiSynthVideoPelRow[2              ][1] += m_iStride                                 ;
-    m_aapiSynthVideoPelRow[2              ][2] += m_iStride                                 ;
-  }
-}
-
-__inline RMDist
-TRenSingleModel::xRenderL( Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, Pel* piNewData, Bool bAdd )
-{
-  m_bSet             = bAdd;
-  m_iCurViewPos      = 0;
-  m_iOtherViewPos    = 1;
+template <BlenMod iBM, Bool bBitInc> __inline Void
+TRenSingleModelC<iBM,bBitInc>::xSetViewRow( Int iPosY )
+{
+  m_pcInputSamplesRow[0] = m_pcInputSamples[0] + m_iInputSamplesStride  * iPosY;
+  m_pcInputSamplesRow[1] = m_pcInputSamples[1] + m_iInputSamplesStride  * iPosY;
+  m_pcOutputSamplesRow   = m_pcOutputSamples   + m_iOutputSamplesStride * iPosY;  
+
+}
+
+template <BlenMod iBM, Bool bBitInc> __inline Void
+TRenSingleModelC<iBM,bBitInc>::xIncViewRow( )
+{
+  m_pcInputSamplesRow[0] += m_iInputSamplesStride ;
+  m_pcInputSamplesRow[1] += m_iInputSamplesStride ;
+  m_pcOutputSamplesRow   += m_iOutputSamplesStride;  
+}
+#if LGE_VSO_EARLY_SKIP_A0093
+template <BlenMod iBM, Bool bBitInc> template<Bool bSet> __inline RMDist 
+TRenSingleModelC<iBM,bBitInc>::xRenderL( Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, Pel* piNewData, Bool bFast)
+#else
+template <BlenMod iBM, Bool bBitInc> template<Bool bSet> __inline RMDist 
+TRenSingleModelC<iBM,bBitInc>::xRenderL( Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, Pel* piNewData)
+#endif
+{
+  const Int iCurViewPos   = 0;
+  const Int iOtherViewPos = 1;
+
+  m_iCurViewPos   = iCurViewPos  ; 
+  m_iOtherViewPos = iOtherViewPos;
 
   m_piNewDepthData   = piNewData;
@@ -426,8 +666,6 @@
     return 0;
 
-  //TODO: Specialize to left and right; setData and getDist
-
   // Get Data
-  m_ppiCurLUT      = m_appiShiftLut   [m_iCurViewPos];
+  m_ppiCurLUT      = m_appiShiftLut   [iCurViewPos];
 
   xSetViewRow      ( iStartPosY);
@@ -441,4 +679,15 @@
   for (Int iPosY = iStartPosY; iPosY < iStartPosY + iHeight; iPosY++ )
   {
+#ifdef LGE_VSO_EARLY_SKIP_A0093
+    if( m_bEarlySkip && bFast )
+    {
+      if ( m_pbHorSkip[iPosY-iStartPosY] )
+      {
+        xIncViewRow();
+        m_piNewDepthData += iStride;
+        continue;
+      }
+    }
+#endif
     m_bInOcclusion = false;
 
@@ -454,8 +703,15 @@
       m_iLastOccludedSPos   = iCurSPos + 1;
       m_iLastOccludedSPosFP = xRangeLeftL( m_iLastOccludedSPos );
-      xExtrapolateMarginL  ( iCurSPos, iEndChangePos, iError );
-      iMinChangedSPos       = Min( iMinChangedSPos, (iEndChangePos << m_iShiftPrec) - m_ppiCurLUT[0][ RemoveBitIncrement( max(m_apiBaseDepthPelRow[m_iCurViewPos][iEndChangePos], m_piNewDepthData[iPosXinNewData] )) ]);
+      xExtrapolateMarginL<bSet>  ( iCurSPos, iEndChangePos, iError );
+
+      iMinChangedSPos       = Min( iMinChangedSPos, (iEndChangePos << m_iShiftPrec) - m_ppiCurLUT[0][ RenModRemoveBitInc( Max(m_pcInputSamplesRow[iCurViewPos][iEndChangePos].iD, m_piNewDepthData[iPosXinNewData] )) ]);
       iLastSPos             = iCurSPos;
       m_iLastDepth          = m_iCurDepth;
+
+      if ( bSet )
+      {
+        m_pcInputSamplesRow[iCurViewPos][iEndChangePos].iD = m_piNewDepthData[iPosXinNewData];
+      }
+
       iPosXinNewData--;
       iEndChangePos--;
@@ -464,5 +720,5 @@
     {
       iLastSPos    = xShift(iEndChangePos+1);
-      m_iLastDepth = m_apiBaseDepthPelRow[m_iCurViewPos][iEndChangePos+1];
+      m_iLastDepth = m_pcInputSamplesRow [iCurViewPos][iEndChangePos+1].iD;
       xInitRenderPartL( iEndChangePos, iLastSPos );
     }
@@ -473,10 +729,17 @@
     {
       // Get minimal changed sample position
-      iMinChangedSPos = Min( iMinChangedSPos, (iCurPosX << m_iShiftPrec) - m_ppiCurLUT[0][ RemoveBitIncrement( max(m_apiBaseDepthPelRow[m_iCurViewPos][iCurPosX], m_piNewDepthData[iPosXinNewData] )) ]);
+
+      iMinChangedSPos = Min( iMinChangedSPos, (iCurPosX << m_iShiftPrec) - m_ppiCurLUT[0][ RenModRemoveBitInc( Max(m_pcInputSamplesRow[iCurViewPos][iCurPosX].iD, m_piNewDepthData[iPosXinNewData] )) ]);
       Int iCurSPos    = xShiftNewData(iCurPosX,iPosXinNewData);
       m_iCurDepth     = m_piNewDepthData[iPosXinNewData];
-      xRenderRangeL(iCurSPos, iLastSPos, iCurPosX, iError );
+      xRenderRangeL<bSet>(iCurSPos, iLastSPos, iCurPosX, iError );
       iLastSPos       = iCurSPos;
       m_iLastDepth    = m_iCurDepth;
+
+      if ( bSet )
+      {
+        m_pcInputSamplesRow[iCurViewPos][iCurPosX].iD = m_piNewDepthData[iPosXinNewData];
+      }
+
       iPosXinNewData--;
     }
@@ -486,6 +749,7 @@
     {
       Int iCurSPos = xShift(iCurPosX);
-      m_iCurDepth  = m_apiBaseDepthPelRow[m_iCurViewPos][iCurPosX];
-      xRenderRangeL( iCurSPos, iLastSPos, iCurPosX, iError );
+
+      m_iCurDepth  = m_pcInputSamplesRow[iCurViewPos][iCurPosX].iD;
+      xRenderRangeL<bSet>( iCurSPos, iLastSPos, iCurPosX, iError );
 
       if ( iCurSPos < iMinChangedSPos )
@@ -499,4 +763,5 @@
     }
 
+
     xIncViewRow();
     m_piNewDepthData += iStride;
@@ -505,11 +770,18 @@
 }
 
-
-__inline RMDist
-TRenSingleModel::xRenderR( Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, Pel* piNewData, Bool bAdd )
-{
-  m_bSet             = bAdd;
-  m_iCurViewPos      = 1;
-  m_iOtherViewPos    = 0;
+#ifdef  LGE_VSO_EARLY_SKIP_A0093
+template <BlenMod iBM, Bool bBitInc> template<Bool bSet> __inline RMDist
+TRenSingleModelC<iBM,bBitInc>::xRenderR( Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, Pel* piNewData , Bool bFast)
+#else
+template <BlenMod iBM, Bool bBitInc> template<Bool bSet> __inline RMDist
+TRenSingleModelC<iBM,bBitInc>::xRenderR( Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, Pel* piNewData )
+#endif
+{
+
+  const Int iCurViewPos   = 1;
+  const Int iOtherViewPos = 0;
+
+  m_iCurViewPos      = iCurViewPos;
+  m_iOtherViewPos    = iOtherViewPos;
 
   m_piNewDepthData   = piNewData;
@@ -521,6 +793,5 @@
 
   // Get Data
-  m_ppiCurLUT      = m_appiShiftLut   [m_iCurViewPos];
-
+  m_ppiCurLUT      = m_appiShiftLut   [iCurViewPos];
   xSetViewRow      ( iStartPosY);
 
@@ -534,4 +805,16 @@
   for (Int iPosY = iStartPosY; iPosY < iStartPosY + iHeight; iPosY++ )
   {
+
+#ifdef LGE_VSO_EARLY_SKIP_A0093
+    if( m_bEarlySkip && bFast )
+    {
+      if ( m_pbHorSkip[iPosY-iStartPosY] )
+      {
+        xIncViewRow();
+        m_piNewDepthData += iStride;
+        continue;
+      }
+    }
+#endif
     m_bInOcclusion = false;
 
@@ -547,8 +830,15 @@
       m_iLastOccludedSPos   = iCurSPos - 1;
       m_iLastOccludedSPosFP = xRangeRightR( m_iLastOccludedSPos );
-      xExtrapolateMarginR     ( iCurSPos, iStartChangePos, iError );
-      iMaxChangedSPos       = max( iMaxChangedSPos, (iStartChangePos << m_iShiftPrec) - m_ppiCurLUT[0][ RemoveBitIncrement( max(m_apiBaseDepthPelRow[m_iCurViewPos][iStartChangePos], m_piNewDepthData[iPosXinNewData] )) ]);
+      xExtrapolateMarginR<bSet>     ( iCurSPos, iStartChangePos, iError );
+
+      iMaxChangedSPos       = Max( iMaxChangedSPos, (iStartChangePos << m_iShiftPrec) - m_ppiCurLUT[0][ RenModRemoveBitInc( Max(m_pcInputSamplesRow[iCurViewPos][iStartChangePos].iD, m_piNewDepthData[iPosXinNewData] )) ]);
       iLastSPos             = iCurSPos;
       m_iLastDepth          = m_iCurDepth;
+      if ( bSet )
+      {
+        m_pcInputSamplesRow[iCurViewPos][iStartChangePos].iD = m_piNewDepthData[iPosXinNewData];
+      }
+
+
       iPosXinNewData++;
       iStartChangePos++;
@@ -557,5 +847,6 @@
     {
       iLastSPos   = xShift(iStartChangePos-1);
-      m_iLastDepth = m_apiBaseDepthPelRow[m_iCurViewPos][iStartChangePos-1];
+
+      m_iLastDepth = m_pcInputSamplesRow[iCurViewPos][iStartChangePos-1].iD;
       xInitRenderPartR( iStartChangePos, iLastSPos );
     }
@@ -566,10 +857,17 @@
     {
       // Get minimal changed sample position
-      iMaxChangedSPos = max( iMaxChangedSPos, (iCurPosX << m_iShiftPrec) - m_ppiCurLUT[0][ RemoveBitIncrement( max(m_apiBaseDepthPelRow[m_iCurViewPos][iCurPosX], m_piNewDepthData[iPosXinNewData] )) ]);
+
+      iMaxChangedSPos = Max( iMaxChangedSPos, (iCurPosX << m_iShiftPrec) - m_ppiCurLUT[0][ RenModRemoveBitInc( Max(m_pcInputSamplesRow[iCurViewPos][iCurPosX].iD, m_piNewDepthData[iPosXinNewData] )) ]);
       Int iCurSPos    = xShiftNewData(iCurPosX,iPosXinNewData);
       m_iCurDepth     = m_piNewDepthData[iPosXinNewData];
-      xRenderRangeR(iCurSPos, iLastSPos, iCurPosX, iError );
+      xRenderRangeR<bSet>(iCurSPos, iLastSPos, iCurPosX, iError );
       iLastSPos      = iCurSPos;
       m_iLastDepth    = m_iCurDepth;
+
+      if ( bSet )
+      {
+        m_pcInputSamplesRow[iCurViewPos][iCurPosX].iD = m_piNewDepthData[iPosXinNewData];
+      }
+
       iPosXinNewData++;
     }
@@ -579,6 +877,7 @@
     {
       Int iCurSPos = xShift(iCurPosX);
-      m_iCurDepth  = m_apiBaseDepthPelRow[m_iCurViewPos][iCurPosX];
-      xRenderRangeR( iCurSPos, iLastSPos, iCurPosX, iError );
+
+      m_iCurDepth  = m_pcInputSamplesRow[iCurViewPos][iCurPosX].iD;
+      xRenderRangeR<bSet>( iCurSPos, iLastSPos, iCurPosX, iError );
 
       if ( iCurSPos > iMaxChangedSPos )
@@ -590,4 +889,5 @@
       m_iLastDepth = m_iCurDepth;
     }
+
     xIncViewRow();
     m_piNewDepthData += iStride;
@@ -597,14 +897,18 @@
 
 
-__inline Void
-TRenSingleModel::xInitRenderPartL(  Int iEndChangePos, Int iLastSPos )
-{
+template <BlenMod iBM, Bool bBitInc> __inline Void
+TRenSingleModelC<iBM,bBitInc>::xInitRenderPartL(  Int iEndChangePos, Int iLastSPos )
+{
+  const Int iCurViewPos = 0; 
   // GET MINIMAL OCCLUDED SAMPLE POSITION
   Int iCurPosX           = iEndChangePos;
 
-  if ( ( iCurPosX + 1 < m_iWidth ) && (m_apbOccludedRow[m_iCurViewPos][ iCurPosX + 1] ) )
+
+  if ( ( iCurPosX + 1 < m_iWidth ) && (m_pcInputSamplesRow[iCurViewPos][ iCurPosX + 1].bOccluded ) )
   {
     iCurPosX++;
-    while ( (iCurPosX + 1 < m_iWidth) &&  (m_apbOccludedRow[m_iCurViewPos][ iCurPosX + 1] )  )
+
+    while ( (iCurPosX + 1 < m_iWidth) &&  (m_pcInputSamplesRow[iCurViewPos][ iCurPosX + 1].bOccluded  )  )
+
       iCurPosX++;
 
@@ -630,14 +934,16 @@
 };
 
-__inline Void
-TRenSingleModel::xInitRenderPartR(  Int iStartChangePos, Int iLastSPos )
-{
+template <BlenMod iBM, Bool bBitInc> __inline Void
+TRenSingleModelC<iBM,bBitInc>::xInitRenderPartR(  Int iStartChangePos, Int iLastSPos )
+{
+    const Int iCurViewPos = 1; 
   // GET MINIMAL OCCLUDED SAMPLE POSITION
   Int iCurPosX           = iStartChangePos;
 
-  if ( ( iCurPosX - 1 > -1 ) && (m_apbOccludedRow[m_iCurViewPos][ iCurPosX - 1] ) )
+  if ( ( iCurPosX - 1 > -1 ) && (m_pcInputSamplesRow[iCurViewPos][ iCurPosX - 1].bOccluded  ) )
   {
     iCurPosX--;
-    while ( (iCurPosX - 1 > -1 ) &&  (m_apbOccludedRow[m_iCurViewPos][ iCurPosX - 1] )  )
+
+    while ( (iCurPosX - 1 > -1 ) &&  (m_pcInputSamplesRow[iCurViewPos][ iCurPosX - 1].bOccluded  )  )
       iCurPosX--;
 
@@ -663,6 +969,6 @@
 
 
-__inline Void
-TRenSingleModel::xRenderShiftedRangeL(Int iCurSPos, Int iLastSPos, Int iCurPos, RMDist& riError )
+template <BlenMod iBM, Bool bBitInc> template<Bool bSet> __inline Void
+TRenSingleModelC<iBM,bBitInc>::xRenderShiftedRangeL(Int iCurSPos, Int iLastSPos, Int iCurPos, RMDist& riError )
 {
   assert( iCurSPos <= iLastSPos );
@@ -672,5 +978,5 @@
   if ( iDeltaSPos > m_iGapTolerance )
   {
-    xFillHoleL( iCurSPos, iLastSPos, iCurPos, riError );
+    xFillHoleL<bSet>( iCurSPos, iLastSPos, iCurPos, riError );
   }
   else
@@ -679,31 +985,29 @@
       return;
 
-    AOT( iDeltaSPos    > m_iGapTolerance );
+    RM_AOT( iDeltaSPos    > m_iGapTolerance );
 
     m_iThisDepth = m_iCurDepth;
-    for (Int iFillSPos = max(0, xRangeLeftL(iCurSPos) ); iFillSPos <= min(xRangeRightL( iLastSPos ) ,m_iLastOccludedSPosFP-1); iFillSPos++ )
+    for (Int iFillSPos = Max(0, xRangeLeftL(iCurSPos) ); iFillSPos <= min(xRangeRightL( iLastSPos ) ,m_iLastOccludedSPosFP-1); iFillSPos++ )
     {
       Int iDeltaCurSPos  = (iFillSPos << m_iShiftPrec) - iCurSPos;
 
-      AOT( iDeltaCurSPos > iDeltaSPos );
-      AOT( iDeltaCurSPos < 0 );
-      AOT( m_aaiSubPelShiftL[iDeltaSPos][iDeltaCurSPos] == 0xdeaddead);
-
-      Int iSourcePos = (iCurPos  << m_iShiftPrec) +  m_aaiSubPelShiftL[iDeltaSPos][iDeltaCurSPos];   // GT:  = iPosX - iStep + ( iStep * iDeltaCurPos + ( iDeltaPos >> 1) ) / iDeltaPos;
-      xSetShiftedPel( iSourcePos, iFillSPos, REN_IS_FILLED, riError );
+      RM_AOT( iDeltaCurSPos > iDeltaSPos );
+      RM_AOT( iDeltaCurSPos < 0 );
+      RM_AOT( m_aaiSubPelShiftL[iDeltaSPos][iDeltaCurSPos] == 0xdeaddead);
+
+      xSetShiftedPelL<bSet>( iCurPos, m_aaiSubPelShiftL[iDeltaSPos][iDeltaCurSPos], iFillSPos, REN_IS_FILLED, riError );
     }
   };
 }
 
-__inline Void
-TRenSingleModel::xRenderShiftedRangeR(Int iCurSPos, Int iLastSPos, Int iCurPos, RMDist& riError )
+template <BlenMod iBM, Bool bBitInc> template<Bool bSet> __inline Void
+TRenSingleModelC<iBM,bBitInc>::xRenderShiftedRangeR(Int iCurSPos, Int iLastSPos, Int iCurPos, RMDist& riError )
 {
   assert( iCurSPos >= iLastSPos );
-  //assert( iRightSPos < m_iWidth );
 
   Int iDeltaSPos = iCurSPos - iLastSPos;
   if ( iDeltaSPos > m_iGapTolerance )
   {
-    xFillHoleR( iCurSPos, iLastSPos, iCurPos, riError );
+    xFillHoleR<bSet>( iCurSPos, iLastSPos, iCurPos, riError );
   }
   else
@@ -713,16 +1017,14 @@
 
     m_iThisDepth = m_iCurDepth;
-    AOT( iDeltaSPos    > m_iGapTolerance );
+    RM_AOT( iDeltaSPos    > m_iGapTolerance );
     for (Int iFillSPos = max(m_iLastOccludedSPosFP+1, xRangeLeftR(iLastSPos) ); iFillSPos <= min(xRangeRightR( iCurSPos ) ,m_iWidth -1); iFillSPos++ )
     {
       Int iDeltaCurSPos  = (iFillSPos << m_iShiftPrec) - iLastSPos;
 
-      AOT( iDeltaCurSPos > iDeltaSPos );
-      AOT( iDeltaCurSPos < 0 );
-      AOT( m_aaiSubPelShiftR[iDeltaSPos][iDeltaCurSPos] == 0xdeaddead);
-
-      Int iSourcePos = (iCurPos  << m_iShiftPrec) +  m_aaiSubPelShiftR[iDeltaSPos][iDeltaCurSPos];   // GT:  = iPosX - iStep + ( iStep * iDeltaCurPos + ( iDeltaPos >> 1) ) / iDeltaPos;
-
-      xSetShiftedPel( iSourcePos, iFillSPos, REN_IS_FILLED, riError );
+      RM_AOT( iDeltaCurSPos > iDeltaSPos );
+      RM_AOT( iDeltaCurSPos < 0 );
+      RM_AOT( m_aaiSubPelShiftR[iDeltaSPos][iDeltaCurSPos] == 0xdeaddead);
+
+      xSetShiftedPelR<bSet>( iCurPos, m_aaiSubPelShiftR[iDeltaSPos][iDeltaCurSPos], iFillSPos, REN_IS_FILLED, riError );
     }
   };
@@ -731,7 +1033,8 @@
 
 
-__inline Void
-TRenSingleModel::xRenderRangeL(Int iCurSPos, Int iLastSPos, Int iCurPos, RMDist& riError )
-{
+template <BlenMod iBM, Bool bBitInc> template<Bool bSet> __inline Void
+TRenSingleModelC<iBM,bBitInc>::xRenderRangeL(Int iCurSPos, Int iLastSPos, Int iCurPos, RMDist& riError )
+{
+  const Int iCurViewPos = 0; 
   if (  !m_bInOcclusion )
   {
@@ -744,5 +1047,6 @@
       {
         m_iThisDepth = m_iLastDepth;
-        xSetShiftedPel( (iCurPos+1) << m_iShiftPrec, iRightSPosFP, REN_IS_FILLED, riError );
+
+        xSetShiftedPelL<bSet>( iCurPos+1, 0, iRightSPosFP, REN_IS_FILLED, riError );
       }
       m_iLastOccludedSPosFP = iRightSPosFP;
@@ -750,17 +1054,17 @@
       m_bInOcclusion = true;
 
-      if ( m_bSet )
-      {
-        m_apbOccludedRow[m_iCurViewPos][ iCurPos ] = true;
+      if ( bSet )
+      {
+        m_pcInputSamplesRow[iCurViewPos][ iCurPos ].bOccluded  = true;
       }
     }
     else
     {
-      if ( m_bSet )
-      {
-        m_apbOccludedRow[m_iCurViewPos][ iCurPos ] = false;
-      }
-
-      xRenderShiftedRangeL(iCurSPos, iLastSPos, iCurPos, riError );
+      if ( bSet )
+      {
+        m_pcInputSamplesRow[iCurViewPos][ iCurPos ].bOccluded  = false;
+      }
+
+      xRenderShiftedRangeL<bSet>(iCurSPos, iLastSPos, iCurPos, riError );
     }
   }
@@ -770,24 +1074,25 @@
     {
       m_bInOcclusion = false;
-      if ( m_bSet )
-      {
-        m_apbOccludedRow[m_iCurViewPos][ iCurPos ] = false;
-      }
-
-      xRenderShiftedRangeL(iCurSPos, iLastSPos, iCurPos, riError );
+      if ( bSet )
+      {
+        m_pcInputSamplesRow[iCurViewPos][ iCurPos ].bOccluded  = false;
+      }
+
+      xRenderShiftedRangeL<bSet>(iCurSPos, iLastSPos, iCurPos, riError );
     }
     else
     {
-      if ( m_bSet )
-      {
-        m_apbOccludedRow[m_iCurViewPos][ iCurPos ] = true;
-      }
-    }
-  }
-}
-
-__inline Void
-TRenSingleModel::xRenderRangeR(Int iCurSPos, Int iLastSPos, Int iCurPos, RMDist& riError )
-{
+      if ( bSet )
+      {
+        m_pcInputSamplesRow[iCurViewPos][ iCurPos ].bOccluded  = true;
+      }
+    }
+  }
+}
+
+template <BlenMod iBM, Bool bBitInc> template<Bool bSet> __inline Void
+TRenSingleModelC<iBM,bBitInc>::xRenderRangeR(Int iCurSPos, Int iLastSPos, Int iCurPos, RMDist& riError )
+{
+  const Int iCurViewPos = 1; 
   // Find out if current sample is occluded
   if (  !m_bInOcclusion )
@@ -801,5 +1106,5 @@
       {
         m_iThisDepth = m_iLastDepth;
-        xSetShiftedPel( (iCurPos-1) << m_iShiftPrec, iLeftSPosFP, REN_IS_FILLED, riError );
+        xSetShiftedPelR<bSet>( iCurPos-1,1 << m_iShiftPrec , iLeftSPosFP, REN_IS_FILLED, riError );
       }
       m_iLastOccludedSPosFP = iLeftSPosFP;
@@ -807,17 +1112,17 @@
       m_bInOcclusion = true;
 
-      if ( m_bSet )
-      {
-        m_apbOccludedRow[m_iCurViewPos][ iCurPos ] = true;
+      if ( bSet )
+      {
+        m_pcInputSamplesRow[iCurViewPos][ iCurPos ].bOccluded  = true;
       }
     }
     else
     {
-      if ( m_bSet )
-      {
-        m_apbOccludedRow[m_iCurViewPos][ iCurPos ] = false;
-      }
-
-      xRenderShiftedRangeR(iCurSPos, iLastSPos, iCurPos, riError );
+      if ( bSet )
+      {
+        m_pcInputSamplesRow[iCurViewPos][ iCurPos ].bOccluded  = false;
+      }
+
+      xRenderShiftedRangeR<bSet>(iCurSPos, iLastSPos, iCurPos, riError );
     }
   }
@@ -827,23 +1132,23 @@
     {
       m_bInOcclusion = false;
-      if ( m_bSet )
-      {
-        m_apbOccludedRow[m_iCurViewPos][ iCurPos ] = false;
-      }
-
-      xRenderShiftedRangeR(iCurSPos, iLastSPos, iCurPos, riError );
+      if ( bSet )
+      {
+        m_pcInputSamplesRow[iCurViewPos][ iCurPos ].bOccluded  = false;
+      }
+
+      xRenderShiftedRangeR<bSet>(iCurSPos, iLastSPos, iCurPos, riError );
     }
     else
     {
-      if ( m_bSet )
-      {
-        m_apbOccludedRow[m_iCurViewPos][ iCurPos ] = true;
-      }
-    }
-  }
-}
-
-__inline Void
-TRenSingleModel::xFillHoleL( Int iCurSPos, Int iLastSPos, Int iCurPos, RMDist& riError )
+      if ( bSet )
+      {
+        m_pcInputSamplesRow[iCurViewPos][ iCurPos ].bOccluded  = true;
+      }
+    }
+  }
+}
+
+template <BlenMod iBM, Bool bBitInc> template<Bool bSet> __inline Void
+TRenSingleModelC<iBM,bBitInc>::xFillHoleL( Int iCurSPos, Int iLastSPos, Int iCurPos, RMDist& riError )
 {
   if (iLastSPos < 0)
@@ -861,5 +1166,5 @@
     {
       m_iThisDepth = m_iCurDepth;
-      xSetShiftedPel     ( iStartFillPos << m_iShiftPrec, iStartFillSPosFP, REN_IS_FILLED, riError );
+      xSetShiftedPelL<bSet>    ( iStartFillPos, 0, iStartFillSPosFP, REN_IS_FILLED, riError );
     }
   }
@@ -870,12 +1175,12 @@
 
   m_iThisDepth = m_iLastDepth;
-  for (Int iFillSPos = max(iStartFillSPosFP+1,0); iFillSPos <= min(xRangeRightL( iLastSPos ), m_iLastOccludedSPosFP-1 ); iFillSPos++ )
-  {
-    xSetShiftedPel( iLastPos << m_iShiftPrec, iFillSPos, REN_IS_HOLE, riError );
-  }
-}
-
-__inline Void
-TRenSingleModel::xFillHoleR( Int iCurSPos, Int iLastSPos, Int iCurPos, RMDist& riError )
+  for (Int iFillSPos = Max(iStartFillSPosFP+1,0); iFillSPos <= min(xRangeRightL( iLastSPos ), m_iLastOccludedSPosFP-1 ); iFillSPos++ )
+  {
+    xSetShiftedPelL<bSet>( iLastPos, 0,  iFillSPos, REN_IS_HOLE, riError );
+  }
+}
+
+template <BlenMod iBM, Bool bBitInc> template<Bool bSet> __inline Void
+TRenSingleModelC<iBM,bBitInc>::xFillHoleR( Int iCurSPos, Int iLastSPos, Int iCurPos, RMDist& riError )
 {
   if (iLastSPos < 0)
@@ -893,5 +1198,5 @@
     {
       m_iThisDepth = m_iCurDepth;
-      xSetShiftedPel( iEndFillPos << m_iShiftPrec, iStartFillSPosFP, REN_IS_FILLED, riError );
+      xSetShiftedPelR<bSet>( iEndFillPos, 1 << m_iShiftPrec , iStartFillSPosFP, REN_IS_FILLED, riError );
     }
   }
@@ -904,30 +1209,30 @@
   for (Int iFillSPos = max(xRangeLeftR( iLastSPos ), m_iLastOccludedSPosFP+1); iFillSPos <= min(iStartFillSPosFP,m_iWidth)-1 ; iFillSPos++ )
   {
-    xSetShiftedPel( iLastPos << m_iShiftPrec, iFillSPos, REN_IS_HOLE, riError );
-  }
-}
-
-__inline Void
-TRenSingleModel::xExtrapolateMarginL(Int iCurSPos, Int iCurPos, RMDist& riError )
+    xSetShiftedPelR<bSet>( iLastPos, 1 << m_iShiftPrec, iFillSPos, REN_IS_HOLE, riError );
+  }
+}
+
+template <BlenMod iBM, Bool bBitInc> template<Bool bSet> __inline Void
+TRenSingleModelC<iBM,bBitInc>::xExtrapolateMarginL(Int iCurSPos, Int iCurPos, RMDist& riError )
 {
 //  if (iLeftSPos < 0 )
 //    return;
 
-  Int iSPosFullPel = max(0,xRangeLeftL(iCurSPos));
+  Int iSPosFullPel = Max(0,xRangeLeftL(iCurSPos));
 
   m_iThisDepth = m_iCurDepth;
   if (iSPosFullPel < m_iWidth)
   {
-    xSetShiftedPel( iCurPos << m_iShiftPrec, iSPosFullPel, REN_IS_FILLED, riError );
+    xSetShiftedPelL<bSet>( iCurPos, 0, iSPosFullPel, REN_IS_FILLED, riError );
   }
 
   for (Int iFillSPos = iSPosFullPel +1; iFillSPos < m_iWidth; iFillSPos++ )
   {
-    xSetShiftedPel( iCurPos << m_iShiftPrec, iFillSPos, REN_IS_HOLE, riError );
-  }
-}
-
-__inline Void
-TRenSingleModel::xExtrapolateMarginR(Int iCurSPos, Int iCurPos, RMDist& riError )
+    xSetShiftedPelL<bSet>( iCurPos, 0, iFillSPos, REN_IS_HOLE, riError );
+  }
+}
+
+template <BlenMod iBM, Bool bBitInc> template<Bool bSet> __inline Void
+TRenSingleModelC<iBM,bBitInc>::xExtrapolateMarginR(Int iCurSPos, Int iCurPos, RMDist& riError )
 {
   //  if (iLeftSPos < 0 )
@@ -939,34 +1244,34 @@
   if (iSPosFullPel > -1)
   {
-    xSetShiftedPel( iCurPos << m_iShiftPrec, iSPosFullPel, REN_IS_FILLED, riError );
+    xSetShiftedPelR<bSet>( iCurPos, 1 << m_iShiftPrec, iSPosFullPel, REN_IS_FILLED, riError );
   }
 
   for (Int iFillSPos = iSPosFullPel -1; iFillSPos > -1; iFillSPos-- )
   {
-    xSetShiftedPel( iCurPos << m_iShiftPrec, iFillSPos, REN_IS_HOLE, riError );
-  }
-}
-
-
-__inline Int
-TRenSingleModel::xShiftNewData( Int iPosX, Int iPosInNewData )
-{
-  AOT( iPosInNewData <               0 );
-  AOF( iPosInNewData < m_iNewDataWidth );
-
-  return (iPosX << m_iShiftPrec) - m_ppiCurLUT[0][ RemoveBitIncrement( m_piNewDepthData[iPosInNewData] )];
-}
-
-__inline Int
-TRenSingleModel::xShift( Int iPosX )
-{
- AOT( iPosX <        0);
- AOF( iPosX < m_iWidth);
- return (iPosX  << m_iShiftPrec) - m_ppiCurLUT[0][ RemoveBitIncrement( m_apiBaseDepthPelRow[m_iCurViewPos][iPosX] )];
-}
-
-
-__inline Int
-TRenSingleModel::xShift( Int iPos, Int iPosInNewData )
+    xSetShiftedPelR<bSet>( iCurPos , 1 << m_iShiftPrec, iFillSPos, REN_IS_HOLE, riError );
+  }
+}
+
+template <BlenMod iBM, Bool bBitInc> __inline Int
+TRenSingleModelC<iBM,bBitInc>::xShiftNewData( Int iPosX, Int iPosInNewData )
+{
+  RM_AOT( iPosInNewData <               0 );
+  RM_AOF( iPosInNewData < m_iNewDataWidth );
+
+  return (iPosX << m_iShiftPrec) - m_ppiCurLUT[0][ RenModRemoveBitInc( m_piNewDepthData[iPosInNewData] )];
+}
+
+template <BlenMod iBM, Bool bBitInc> __inline Int
+TRenSingleModelC<iBM,bBitInc>::xShift( Int iPosX )
+{
+ RM_AOT( iPosX <        0);
+ RM_AOF( iPosX < m_iWidth);
+
+ return (iPosX  << m_iShiftPrec) - m_ppiCurLUT[0][ RenModRemoveBitInc( m_pcInputSamplesRow[m_iCurViewPos][iPosX].iD )];
+}
+
+
+template <BlenMod iBM, Bool bBitInc> __inline Int
+TRenSingleModelC<iBM,bBitInc>::xShift( Int iPos, Int iPosInNewData )
 {
   if ( (iPosInNewData >= 0) && (iPosInNewData < m_iNewDataWidth) )
@@ -980,6 +1285,6 @@
 }
 
-__inline Int
-TRenSingleModel::xRangeLeftL( Int iPos )
+template <BlenMod iBM, Bool bBitInc> __inline Int
+TRenSingleModelC<iBM,bBitInc>::xRangeLeftL( Int iPos )
 {
   return  ( iPos +  (1 << m_iShiftPrec) - 1) >> m_iShiftPrec;
@@ -987,6 +1292,6 @@
 
 
-__inline Int
-TRenSingleModel::xRangeLeftR( Int iPos )
+template <BlenMod iBM, Bool bBitInc> __inline Int
+TRenSingleModelC<iBM,bBitInc>::xRangeLeftR( Int iPos )
 {
 
@@ -995,12 +1300,12 @@
 
 
-__inline Int
-TRenSingleModel::xRangeRightL( Int iPos )
+template <BlenMod iBM, Bool bBitInc> __inline Int
+TRenSingleModelC<iBM,bBitInc>::xRangeRightL( Int iPos )
 {
   return xRangeLeftL(iPos) - 1;
 }
 
-__inline Int
-TRenSingleModel::xRangeRightR( Int iPos )
+template <BlenMod iBM, Bool bBitInc> __inline Int
+TRenSingleModelC<iBM,bBitInc>::xRangeRightR( Int iPos )
 {
   return iPos >> m_iShiftPrec;
@@ -1008,12 +1313,12 @@
 
 
-__inline Int
-TRenSingleModel::xRoundL( Int iPos )
+template <BlenMod iBM, Bool bBitInc> __inline Int
+TRenSingleModelC<iBM,bBitInc>::xRoundL( Int iPos )
 {
   return  (iPos + (( 1 << m_iShiftPrec ) >> 1 )) >> m_iShiftPrec;
 }
 
-__inline Int
-TRenSingleModel::xRoundR( Int iPos )
+template <BlenMod iBM, Bool bBitInc> __inline Int
+TRenSingleModelC<iBM,bBitInc>::xRoundR( Int iPos )
 {
   return  (m_iShiftPrec == 0) ? iPos : xRoundL(iPos - 1);
@@ -1021,6 +1326,6 @@
 
 
-Void
-TRenSingleModel::xSetPels( Pel* piPelSource , Int iSourceStride, Int iWidth, Int iHeight, Pel iVal )
+template <BlenMod iBM, Bool bBitInc> Void
+TRenSingleModelC<iBM,bBitInc>::xSetPels( Pel* piPelSource , Int iSourceStride, Int iWidth, Int iHeight, Pel iVal )
 {
   for (Int iYPos = 0; iYPos < iHeight; iYPos++)
@@ -1034,6 +1339,6 @@
 }
 
-Void
-TRenSingleModel::xSetInts( Int* piPelSource , Int iSourceStride, Int iWidth, Int iHeight, Int iVal )
+template <BlenMod iBM, Bool bBitInc> Void
+TRenSingleModelC<iBM,bBitInc>::xSetInts( Int* piPelSource , Int iSourceStride, Int iWidth, Int iHeight, Int iVal )
 {
   for (Int iYPos = 0; iYPos < iHeight; iYPos++)
@@ -1048,6 +1353,6 @@
 
 
-Void
-TRenSingleModel::xSetBools( Bool* pbPelSource , Int iSourceStride, Int iWidth, Int iHeight, Bool bVal )
+template <BlenMod iBM, Bool bBitInc> Void
+TRenSingleModelC<iBM,bBitInc>::xSetBools( Bool* pbPelSource , Int iSourceStride, Int iWidth, Int iHeight, Bool bVal )
 {
   for (Int iYPos = 0; iYPos < iHeight; iYPos++)
@@ -1061,81 +1366,68 @@
 }
 
-Void
-TRenSingleModel::xInitView( Int iViewPos )
-{
-  AOT( iViewPos == VIEWPOS_MERGED && ( m_iMode == 0 || m_iMode == 1 ) );
-
-  xSetPels( m_aapiSynthVideoPel[iViewPos][0], m_iStride, m_iWidth, m_iHeight, 0 );
-  xSetPels( m_aapiSynthVideoPel[iViewPos][1], m_iStride, m_iWidth, m_iHeight, 128 << g_uiBitIncrement );
-  xSetPels( m_aapiSynthVideoPel[iViewPos][2], m_iStride, m_iWidth, m_iHeight, 128 << g_uiBitIncrement );
-
-  if ( iViewPos != VIEWPOS_MERGED)
-  {
-    xSetBools( m_apbOccluded     [iViewPos],  m_iStride, m_iWidth, m_iHeight, false );
-    xSetPels ( m_apiFilled       [iViewPos],  m_iStride, m_iWidth, m_iHeight, REN_IS_HOLE);
-    if ( m_iMode == 2 )
-    {
-      xSetPels( m_apiSynthDepthPel [iViewPos],  m_iStride, m_iWidth, m_iHeight, 0);
-    }
-  }
-}
-
-__inline Void
-TRenSingleModel::xSetShiftedPel(Int iSourcePos, Int iTargetSPos, Pel iFilled, RMDist& riError )
-{
-  AOT( iSourcePos < 0         );
-  AOT( iSourcePos >= m_iSampledWidth );
-
-  AOT( iTargetSPos < 0         );
-  AOT( iTargetSPos >= m_iWidth );
-//  AOT(  m_apiFilledRow[m_iViewPos][iTargetSPos] != REN_IS_HOLE);
-
-  if ( m_iMode == 2)
-  {
-    xSetShiftedPelBlend(iSourcePos, iTargetSPos, iFilled, riError );
-    return;
-  }
-
-  if ( m_bSet )
-  {
-    m_aapiSynthVideoPelRow[m_iCurViewPos][0][iTargetSPos] = m_aapiBaseVideoPelRow[m_iCurViewPos][0][iSourcePos];
-#if HHI_VSO_COLOR_PLANES
-    m_aapiSynthVideoPelRow[m_iCurViewPos][1][iTargetSPos] = m_aapiBaseVideoPelRow[m_iCurViewPos][1][iSourcePos];
-    m_aapiSynthVideoPelRow[m_iCurViewPos][2][iTargetSPos] = m_aapiBaseVideoPelRow[m_iCurViewPos][2][iSourcePos];
-#endif
-    m_apiFilledRow        [m_iCurViewPos]   [iTargetSPos] = iFilled;
-    Int iDiffY = m_aapiRefVideoPelRow    [0][iTargetSPos] - m_aapiSynthVideoPelRow[m_iCurViewPos][0][iTargetSPos];
-#if HHI_VSO_COLOR_PLANES
-    Int iDiffU = m_aapiRefVideoPelRow    [1][iTargetSPos] - m_aapiSynthVideoPelRow[m_iCurViewPos][1][iTargetSPos];
-    Int iDiffV = m_aapiRefVideoPelRow    [2][iTargetSPos] - m_aapiSynthVideoPelRow[m_iCurViewPos][2][iTargetSPos];
-    m_apiErrorRow                           [iTargetSPos] = xGetDist( iDiffY, iDiffU, iDiffV);
-#else
-    m_apiErrorRow                           [iTargetSPos] = xGetDist(iDiffY);
-#endif
+template <BlenMod iBM, Bool bBitInc> template<Bool bSet> __inline Void
+TRenSingleModelC<iBM,bBitInc>::xSetShiftedPelL(Int iSourcePos, Int iSubSourcePos, Int iTargetSPos, Pel iFilled, RMDist& riError )
+{
+  RM_AOT( iSourcePos    <  0                   );
+  RM_AOT( iSourcePos    >= m_iWidth            );
+  RM_AOT( iSubSourcePos < 0                    );
+  RM_AOT( iSubSourcePos >  (1 << m_iShiftPrec) );
+  RM_AOT( iTargetSPos   < 0                    );
+  RM_AOT( iTargetSPos   >= m_iWidth            );  
+
+  RenModelOutPels* pcOutSample = m_pcOutputSamplesRow              + iTargetSPos;
+  RenModelInPels * pcInSample  = m_pcInputSamplesRow[VIEWPOS_LEFT] + iSourcePos ;
+
+  if ( iBM != BLEND_NONE )
+  {
+    xSetShiftedPelBlendL<bSet>  (pcInSample, iSubSourcePos, pcOutSample, iFilled, riError);
   }
   else
   {
-    Int iSDOld   = m_apiErrorRow            [iTargetSPos];
-    Int iDiffY   = m_aapiRefVideoPelRow  [0][iTargetSPos] - m_aapiBaseVideoPelRow [m_iCurViewPos][0][iSourcePos];
-#if HHI_VSO_COLOR_PLANES
-    Int iDiffU   = m_aapiRefVideoPelRow  [1][iTargetSPos] - m_aapiBaseVideoPelRow [m_iCurViewPos][1][iSourcePos];
-    Int iDiffV   = m_aapiRefVideoPelRow  [2][iTargetSPos] - m_aapiBaseVideoPelRow [m_iCurViewPos][2][iSourcePos];
-    riError     += ( xGetDist(iDiffY,iDiffU,iDiffV) - iSDOld  );
-#else
-    riError     +=  ( xGetDist( iDiffY ) - iSDOld );
-#endif
-  }
-}
-
-__inline Void
-TRenSingleModel::xSetShiftedPelBlend( Int iSourcePos, Int iTargetSPos, Pel iFilled, RMDist& riError )
-{
-  AOT( iSourcePos < 0         );
-  AOT( iSourcePos >= m_iSampledWidth );
-
-  AOT( iTargetSPos < 0         );
-  AOT( iTargetSPos >= m_iWidth );
-  //  AOT(  m_apiFilledRow[m_iViewPos][iTargetSPos] != REN_IS_HOLE);
-
+    xSetShiftedPelNoBlendL<bSet>(pcInSample, iSubSourcePos, pcOutSample, iFilled, riError);
+  }
+}
+
+template <BlenMod iBM, Bool bBitInc> template<Bool bSet> __inline Void
+TRenSingleModelC<iBM,bBitInc>::xSetShiftedPelNoBlendL(RenModelInPels* pcInSample, Int iSubSourcePos, RenModelOutPels* pcOutSample, Pel iFilled, RMDist& riError )
+{
+  if ( bSet )
+  { 
+    // Filled
+    pcOutSample->iFilledLeft = iFilled;
+
+    // Yuv
+    pcOutSample->iYLeft  = pcInSample->aiY[iSubSourcePos];
+#if HHI_VSO_COLOR_PLANES
+    pcOutSample->iULeft  = pcInSample->aiU[iSubSourcePos];
+    pcOutSample->iVLeft  = pcInSample->aiV[iSubSourcePos];
+
+    pcOutSample->iError = xGetDist( pcOutSample->iYLeft - pcOutSample->iYRef,
+                                    pcOutSample->iULeft - pcOutSample->iURef,    
+                                    pcOutSample->iVLeft - pcOutSample->iVRef
+                                  );    
+#else
+    pcOutSample->iError = xGetDist( pcOutSample->iYLeft - pcOutSample->iYRef );    
+#endif    
+    
+  }
+  else
+  { 
+#if HHI_VSO_COLOR_PLANES
+    riError += xGetDist( pcInSample->aiY[iSubSourcePos] - pcOutSample->iYRef,
+                         pcInSample->aiU[iSubSourcePos] - pcOutSample->iURef,
+                         pcInSample->aiV[iSubSourcePos] - pcOutSample->iVRef
+                       );
+#else               
+    riError += xGetDist( pcInSample->aiY[iSubSourcePos] - pcOutSample->iYRef );
+#endif
+
+    riError -= pcOutSample->iError;
+  }
+}
+
+template <BlenMod iBM, Bool bBitInc> template<Bool bSet> __inline Void
+TRenSingleModelC<iBM,bBitInc>::xSetShiftedPelBlendL(RenModelInPels* pcInSample, Int iSubSourcePos, RenModelOutPels* pcOutSample, Pel iFilled, RMDist& riError )
+{
   Pel piBlendedValueY;
 #if HHI_VSO_COLOR_PLANES
@@ -1144,116 +1436,248 @@
 #endif
 
-
-  if (m_iCurViewPos == 0)
-  {
-    xGetBlendedValue (
-      m_aapiBaseVideoPelRow                                    [0][0][iSourcePos ]  ,
-      m_aapiSynthVideoPelRow                                   [1][0][iTargetSPos]  ,
-#if HHI_VSO_COLOR_PLANES
-      m_aapiBaseVideoPelRow                                    [0][1][iSourcePos ]  ,
-      m_aapiSynthVideoPelRow                                   [1][1][iTargetSPos]  ,
-      m_aapiBaseVideoPelRow                                    [0][2][iSourcePos ]  ,
-      m_aapiSynthVideoPelRow                                   [1][2][iTargetSPos]  ,
-#endif
-      m_piInvZLUTLeft [RemoveBitIncrement(m_iThisDepth)                            ],
-      m_piInvZLUTRight[RemoveBitIncrement(m_apiSynthDepthPelRow[1]   [iTargetSPos])],
-      iFilled,
-      m_apiFilledRow                                           [1]   [iTargetSPos]  ,
-      piBlendedValueY
+  xGetBlendedValue (
+    pcInSample ->aiY[iSubSourcePos],
+    pcOutSample->iYRight,    
+#if HHI_VSO_COLOR_PLANES
+    pcInSample ->aiU[iSubSourcePos],
+    pcOutSample->iURight,    
+    pcInSample ->aiV[iSubSourcePos],
+    pcOutSample->iVRight,    
+#endif
+    m_piInvZLUTLeft [RenModRemoveBitInc(m_iThisDepth)        ],
+    m_piInvZLUTRight[RenModRemoveBitInc(pcOutSample->iDRight)],
+    iFilled,
+    pcOutSample->iFilledRight  ,
+    piBlendedValueY
 #if HHI_VSO_COLOR_PLANES
     , piBlendedValueU,
-      piBlendedValueV
+    piBlendedValueV
 #endif
     );
+
+  if ( bSet )
+  {    
+    // Set values
+    pcOutSample->iDLeft      = m_iThisDepth;
+    pcOutSample->iYLeft      = pcInSample ->aiY[iSubSourcePos];
+    pcOutSample->iYBlended   = piBlendedValueY;    
+#if HHI_VSO_COLOR_PLANES  
+    pcOutSample->iULeft      = pcInSample ->aiU[iSubSourcePos];
+    pcOutSample->iUBlended   = piBlendedValueU;    
+    pcOutSample->iVLeft      = pcInSample ->aiV[iSubSourcePos];
+    pcOutSample->iVBlended   = piBlendedValueV;    
+#endif
+    pcOutSample->iFilledLeft = iFilled;
+
+    // Get Error
+    Int iDiffY = pcOutSample->iYRef - piBlendedValueY;
+#if HHI_VSO_COLOR_PLANES
+    Int iDiffU = pcOutSample->iURef - piBlendedValueU;
+    Int iDiffV = pcOutSample->iVRef - piBlendedValueV;
+    pcOutSample->iError  = xGetDist(iDiffY, iDiffU, iDiffV );
+#else
+    pcOutSample->iError  = xGetDist(iDiffY );
+#endif
   }
   else
   {
-    xGetBlendedValue (
-      m_aapiSynthVideoPelRow                                   [0][0][iTargetSPos],
-      m_aapiBaseVideoPelRow                                    [1][0][iSourcePos ],
-#if HHI_VSO_COLOR_PLANES
-      m_aapiSynthVideoPelRow                                   [0][1][iTargetSPos],
-      m_aapiBaseVideoPelRow                                    [1][1][iSourcePos ],
-      m_aapiSynthVideoPelRow                                   [0][2][iTargetSPos],
-      m_aapiBaseVideoPelRow                                    [1][2][iSourcePos ],
-#endif
-      m_piInvZLUTLeft [RemoveBitIncrement(m_apiSynthDepthPelRow[0]   [iTargetSPos])],
-      m_piInvZLUTRight[RemoveBitIncrement(m_iThisDepth)                            ],
-      m_apiFilledRow                                           [0]   [iTargetSPos],
-      iFilled                                                                     ,
-      piBlendedValueY
+    Int iDiffY = pcOutSample->iYRef - piBlendedValueY;
+#if HHI_VSO_COLOR_PLANES
+    Int iDiffU = pcOutSample->iURef - piBlendedValueU;
+    Int iDiffV = pcOutSample->iVRef - piBlendedValueV;
+    riError   += ( xGetDist( iDiffY, iDiffU, iDiffV ) - pcOutSample->iError );
+
+#else
+    riError   += ( xGetDist( iDiffY ) - pcOutSample->iError  );
+#endif
+
+  }
+}
+
+
+template <BlenMod iBM, Bool bBitInc> template<Bool bSet> __inline Void
+TRenSingleModelC<iBM,bBitInc>::xSetShiftedPelR(Int iSourcePos, Int iSubSourcePos, Int iTargetSPos, Pel iFilled, RMDist& riError )
+{
+  RM_AOT( iSourcePos    <  0                     );
+  RM_AOT( iSourcePos    >= m_iWidth              );
+  RM_AOT( iSubSourcePos <  0                     );
+  RM_AOT( iSubSourcePos >= (1 << m_iShiftPrec)+1 );
+  RM_AOT( iTargetSPos   < 0                      );
+  RM_AOT( iTargetSPos   >= m_iWidth              );  
+
+  RenModelOutPels* pcOutSample = m_pcOutputSamplesRow               + iTargetSPos;
+  RenModelInPels * pcInSample  = m_pcInputSamplesRow[VIEWPOS_RIGHT] + iSourcePos ;
+
+  if ( iBM != BLEND_NONE )
+  {
+    xSetShiftedPelBlendR<bSet>   (pcInSample, iSubSourcePos, pcOutSample, iFilled, riError);
+  }
+  else
+  {
+    xSetShiftedPelNoBlendR<bSet> (pcInSample, iSubSourcePos, pcOutSample, iFilled, riError);
+  }
+}
+
+template <BlenMod iBM, Bool bBitInc> template<Bool bSet> __inline Void
+TRenSingleModelC<iBM,bBitInc>::xSetShiftedPelNoBlendR(RenModelInPels* pcInSample, Int iSubSourcePos, RenModelOutPels* pcOutSample, Pel iFilled, RMDist& riError )
+{
+  if ( bSet )
+  { 
+    // Filled
+    pcOutSample->iFilledRight = iFilled;
+
+    // Yuv
+    pcOutSample->iYRight  = pcInSample->aiY[iSubSourcePos];
+#if HHI_VSO_COLOR_PLANES
+    pcOutSample->iURight  = pcInSample->aiU[iSubSourcePos];
+    pcOutSample->iVRight  = pcInSample->aiV[iSubSourcePos];
+
+    pcOutSample->iError = xGetDist( 
+      pcOutSample->iYRight - pcOutSample->iYRef,
+      pcOutSample->iURight - pcOutSample->iURef,    
+      pcOutSample->iVRight - pcOutSample->iVRef
+      );    
+#else
+    pcOutSample->iError = xGetDist( pcOutSample->iYRight - pcOutSample->iYRef );    
+#endif    
+
+  }
+  else
+  { 
+#if HHI_VSO_COLOR_PLANES
+    riError += xGetDist( pcInSample->aiY[iSubSourcePos] - pcOutSample->iYRef,
+      pcInSample->aiU[iSubSourcePos] - pcOutSample->iURef,
+      pcInSample->aiV[iSubSourcePos] - pcOutSample->iVRef
+      );
+#else               
+    riError += xGetDist( pcInSample->aiY[iSubSourcePos] - pcOutSample->iYRef );
+#endif
+
+    riError -= pcOutSample->iError;
+  }
+}
+
+template <BlenMod iBM, Bool bBitInc> template<Bool bSet> __inline Void
+TRenSingleModelC<iBM,bBitInc>::xSetShiftedPelBlendR(RenModelInPels* pcInSample, Int iSubSourcePos, RenModelOutPels* pcOutSample, Pel iFilled, RMDist& riError )
+{
+  Pel piBlendedValueY;
+#if HHI_VSO_COLOR_PLANES
+  Pel piBlendedValueU;
+  Pel piBlendedValueV;
+#endif
+
+  xGetBlendedValue (
+    pcOutSample->iYLeft, 
+    pcInSample ->aiY[iSubSourcePos],        
+#if HHI_VSO_COLOR_PLANES
+    pcOutSample->iULeft,    
+    pcInSample ->aiU[iSubSourcePos],
+    pcOutSample->iVLeft,    
+    pcInSample ->aiV[iSubSourcePos],
+#endif
+    m_piInvZLUTLeft  [RenModRemoveBitInc(pcOutSample->iDLeft)],
+    m_piInvZLUTRight [RenModRemoveBitInc(m_iThisDepth)       ],
+    pcOutSample->iFilledLeft,
+    iFilled,
+    piBlendedValueY
 #if HHI_VSO_COLOR_PLANES
     , piBlendedValueU,
-      piBlendedValueV
+    piBlendedValueV
 #endif
     );
-  }
-
-  if ( m_bSet )
-  {
-    m_apiSynthDepthPelRow [m_iCurViewPos]   [iTargetSPos] = m_iThisDepth;
-    m_aapiSynthVideoPelRow[m_iCurViewPos][0][iTargetSPos] = m_aapiBaseVideoPelRow[m_iCurViewPos][0][iSourcePos];
-    m_aapiSynthVideoPelRow[2            ][0][iTargetSPos] = piBlendedValueY;
-#if HHI_VSO_COLOR_PLANES
-    m_aapiSynthVideoPelRow[m_iCurViewPos][1][iTargetSPos] = m_aapiBaseVideoPelRow[m_iCurViewPos][1][iSourcePos];
-    m_aapiSynthVideoPelRow[2            ][1][iTargetSPos] = piBlendedValueU;
-    m_aapiSynthVideoPelRow[m_iCurViewPos][2][iTargetSPos] = m_aapiBaseVideoPelRow[m_iCurViewPos][2][iSourcePos];
-    m_aapiSynthVideoPelRow[2            ][2][iTargetSPos] = piBlendedValueV;
-#endif
-    m_apiFilledRow        [m_iCurViewPos]   [iTargetSPos] = iFilled;
-
-    Int iDiffY = m_aapiRefVideoPelRow    [0][iTargetSPos] - piBlendedValueY;
-#if HHI_VSO_COLOR_PLANES
-    Int iDiffU = m_aapiRefVideoPelRow    [1][iTargetSPos] - piBlendedValueU;
-    Int iDiffV = m_aapiRefVideoPelRow    [2][iTargetSPos] - piBlendedValueV;
-    m_apiErrorRow                           [iTargetSPos] = xGetDist(iDiffY, iDiffU, iDiffV );
-#else
-    m_apiErrorRow                           [iTargetSPos] = xGetDist(iDiffY);
+
+  if ( bSet )
+  {    
+    // Set values
+    pcOutSample->iDRight     = m_iThisDepth;
+    pcOutSample->iYRight     = pcInSample ->aiY[iSubSourcePos];
+    pcOutSample->iYBlended   = piBlendedValueY;    
+#if HHI_VSO_COLOR_PLANES  
+    pcOutSample->iURight     = pcInSample ->aiU[iSubSourcePos];
+    pcOutSample->iUBlended   = piBlendedValueU;    
+    pcOutSample->iVRight     = pcInSample ->aiV[iSubSourcePos];
+    pcOutSample->iVBlended   = piBlendedValueV;    
+#endif
+    pcOutSample->iFilledRight = iFilled;
+
+    // Get Error
+    Int iDiffY = pcOutSample->iYRef - piBlendedValueY;
+#if HHI_VSO_COLOR_PLANES
+    Int iDiffU = pcOutSample->iURef - piBlendedValueU;
+    Int iDiffV = pcOutSample->iVRef - piBlendedValueV;
+    pcOutSample->iError  = xGetDist(iDiffY, iDiffU, iDiffV );
+#else
+    pcOutSample->iError  = xGetDist(iDiffY );
 #endif
   }
   else
   {
-    Int iSDOld   = m_apiErrorRow            [iTargetSPos];
-    Int iDiffY = m_aapiRefVideoPelRow    [0][iTargetSPos] - piBlendedValueY;
-#if HHI_VSO_COLOR_PLANES
-    Int iDiffU = m_aapiRefVideoPelRow    [1][iTargetSPos] - piBlendedValueU;
-    Int iDiffV = m_aapiRefVideoPelRow    [2][iTargetSPos] - piBlendedValueV;
-    riError   += ( xGetDist( iDiffY, iDiffU, iDiffV ) - iSDOld );
-#else
-    riError   += ( xGetDist( iDiffY )- iSDOld  );
-#endif
-  }
-}
-
-
-__inline Int
-TRenSingleModel::xGetDist( Int iDiffY, Int iDiffU, Int iDiffV )
-{
-  return (          ((iDiffY * iDiffY) >> m_iDistShift)
-             +  ((( ((iDiffU * iDiffU) >> m_iDistShift)
-                   +((iDiffV * iDiffV) >> m_iDistShift)
+    Int iDiffY = pcOutSample->iYRef - piBlendedValueY;
+#if HHI_VSO_COLOR_PLANES
+    Int iDiffU = pcOutSample->iURef - piBlendedValueU;
+    Int iDiffV = pcOutSample->iVRef - piBlendedValueV;
+    riError   += ( xGetDist( iDiffY, iDiffU, iDiffV ) - pcOutSample->iError );
+#else
+    riError   += ( xGetDist( iDiffY ) -  pcOutSample->iError  );
+#endif
+  }
+}
+
+template <BlenMod iBM, Bool bBitInc> __inline Int
+TRenSingleModelC<iBM,bBitInc>::xGetDist( Int iDiffY, Int iDiffU, Int iDiffV )
+{
+
+  if ( !bBitInc )
+  {
+    return (          (iDiffY * iDiffY )
+               +  ((( (iDiffU * iDiffU )
+                     +(iDiffV * iDiffV )
+                    )
+                   ) >> 2
                   )
-                 ) >> 2
-                )
-         );
-}
-
-__inline Int
-TRenSingleModel::xGetDist( Int iDiffY )
-{
-  return ((iDiffY * iDiffY) >> m_iDistShift);
-}
-
-#if HHI_VSO_COLOR_PLANES
-__inline Void
-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 )
-#else
-Void
-TRenSingleModel::xGetBlendedValue( Pel iYL, Pel iYR, Pel iDepthL, Pel iDepthR, Int iFilledL, Int iFilledR, Pel& riY )
-#endif
-{
-  if (m_iBlendMode != 0 )
-  {
-    if (m_iBlendMode == 1 )
+           );
+  }
+  else
+  {
+    return (          ((iDiffY * iDiffY) >> m_iDistShift)
+               +  ((( ((iDiffU * iDiffU) >> m_iDistShift)
+                     +((iDiffV * iDiffV) >> m_iDistShift)
+                    )
+                   ) >> 2
+                  )
+           );
+  
+  }
+}
+
+template <BlenMod iBM, Bool bBitInc> __inline Int
+TRenSingleModelC<iBM,bBitInc>::xGetDist( Int iDiffY )
+{
+  if ( !bBitInc )
+  {
+    return (iDiffY * iDiffY);
+  }
+  else
+  {
+    return ((iDiffY * iDiffY) >> m_iDistShift);
+  }
+
+}
+
+
+#if HHI_VSO_COLOR_PLANES
+template <BlenMod iBM, Bool bBitInc>  __inline Void
+TRenSingleModelC<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 )
+#else
+template <BlenMod iBM, Bool bBitInc>  __inline Void
+TRenSingleModelC<iBM,bBitInc>::xGetBlendedValue( Pel iYL, Pel iYR, Pel iDepthL, Pel iDepthR, Int iFilledL, Int iFilledR, Pel& riY )
+#endif
+{
+
+  RM_AOT( iBM != BLEND_AVRG && iBM != BLEND_LEFT && iBM != BLEND_RIGHT );
+
+  if (iBM != BLEND_AVRG )
+  {
+    if (iBM == BLEND_LEFT )
     {
 #if HHI_VSO_COLOR_PLANES
@@ -1299,5 +1723,4 @@
       else
       {
-#if HHI_FIX
         riY = xBlend( iYL, iYR, m_iBlendDistWeight );
 #if HHI_VSO_COLOR_PLANES    
@@ -1305,11 +1728,4 @@
         riV = xBlend( iVL, iVR, m_iBlendDistWeight );
 #endif
-#else
-        riY = xBlend( iYR, iYL, m_iBlendDistWeight );
-#if HHI_VSO_COLOR_PLANES
-        riU = xBlend( iUR, iUL, m_iBlendDistWeight );
-        riV = xBlend( iVR, iVL, m_iBlendDistWeight );
-#endif
-#endif
       }
     }
@@ -1369,15 +1785,14 @@
     }
   }
-
-}
-
-__inline Void
-#if HHI_VSO_COLOR_PLANES
-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 )
-#else
-TRenSingleModel::xGetBlendedValueBM1( Pel iYL, Pel iYR, Pel iDepthL, Pel iDepthR, Int iFilledL, Int iFilledR, Pel& riY )
-#endif
-{
-  if      ( iFilledL == REN_IS_FILLED ||  iFilledR == REN_IS_HOLE )
+}
+
+template <BlenMod iBM, Bool bBitInc> __inline Void
+#if HHI_VSO_COLOR_PLANES
+TRenSingleModelC<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 )
+#else
+TRenSingleModelC<iBM,bBitInc>::xGetBlendedValueBM1( Pel iYL, Pel iYR, Pel iDepthL, Pel iDepthR, Int iFilledL, Int iFilledR, Pel& riY )
+#endif
+{
+  if ( iFilledL == REN_IS_FILLED ||  iFilledR == REN_IS_HOLE )
   {
     riY = iYL;
@@ -1405,9 +1820,9 @@
 }
 
-__inline Void
-#if HHI_VSO_COLOR_PLANES
-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 )
-#else
-TRenSingleModel::xGetBlendedValueBM2( Pel iYL, Pel iYR, Pel iDepthL, Pel iDepthR, Int iFilledL, Int iFilledR, Pel& riY )
+template <BlenMod iBM, Bool bBitInc> __inline Void
+#if HHI_VSO_COLOR_PLANES
+TRenSingleModelC<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 )
+#else
+TRenSingleModelC<iBM,bBitInc>::xGetBlendedValueBM2( Pel iYL, Pel iYR, Pel iDepthL, Pel iDepthR, Int iFilledL, Int iFilledR, Pel& riY )
 #endif
 {
@@ -1438,7 +1853,92 @@
 }
 
-__inline Pel
-TRenSingleModel::xBlend( Pel pVal1, Pel pVal2, Int iWeightVal2 )
+template <BlenMod iBM, Bool bBitInc> __inline Pel
+TRenSingleModelC<iBM,bBitInc>::xBlend( Pel pVal1, Pel pVal2, Int iWeightVal2 )
 {
   return pVal1  +  (Pel) (  ( (Int) ( pVal2 - pVal1) * iWeightVal2 + (1 << (REN_VDWEIGHT_PREC - 1)) ) >> REN_VDWEIGHT_PREC );
 }
+
+template <BlenMod iBM, Bool bBitInc> Void
+TRenSingleModelC<iBM,bBitInc>::xCopy2PicYuv( Pel** ppiSrcVideoPel, Int* piStrides, TComPicYuv* rpcPicYuvTarget, UInt uiHorOffset )
+{
+  TRenFilter::copy            ( ppiSrcVideoPel[0], piStrides[0], m_iWidth, m_iHeight, rpcPicYuvTarget->getLumaAddr() +  uiHorOffset       * rpcPicYuvTarget->getStride() , rpcPicYuvTarget->getStride () );
+  TRenFilter::sampleDown2Tap13( ppiSrcVideoPel[1], piStrides[1], m_iWidth, m_iHeight, rpcPicYuvTarget->getCbAddr  () + (uiHorOffset >> 1) * rpcPicYuvTarget->getCStride(), rpcPicYuvTarget->getCStride() );
+  TRenFilter::sampleDown2Tap13( ppiSrcVideoPel[2], piStrides[2], m_iWidth, m_iHeight, rpcPicYuvTarget->getCrAddr  () + (uiHorOffset >> 1) * rpcPicYuvTarget->getCStride(), rpcPicYuvTarget->getCStride() );
+}
+
+template class TRenSingleModelC<BLEND_NONE ,true>;
+template class TRenSingleModelC<BLEND_AVRG ,true>;
+template class TRenSingleModelC<BLEND_LEFT ,true>;
+template class TRenSingleModelC<BLEND_RIGHT,true>;
+
+template class TRenSingleModelC<BLEND_NONE ,false>;
+template class TRenSingleModelC<BLEND_AVRG ,false>;
+template class TRenSingleModelC<BLEND_LEFT ,false>;
+template class TRenSingleModelC<BLEND_RIGHT,false>;
+
+#ifdef LGE_VSO_EARLY_SKIP_A0093
+template <BlenMod iBM, Bool bBitInc> 
+__inline Bool
+TRenSingleModelC<iBM,bBitInc>::xDetectEarlySkipL( Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, Pel* piNewData,Pel* piOrgData, Int iOrgStride)
+{
+  RM_AOF( m_bEarlySkip ); 
+  const Int iCurViewPos = 0;
+  Int** ppiCurLUT       = m_appiShiftLut   [ iCurViewPos ];
+  
+  Bool bNoDiff          = true;   
+  
+  for (Int iPosY=0; iPosY < iHeight; iPosY++)
+  {
+    m_pbHorSkip[iPosY] = true;
+
+    for (Int iPosX = 0; iPosX < iWidth; iPosX++)
+    {
+      Int iDisparityRec = abs(ppiCurLUT[0][ RenModRemoveBitInc(piNewData[iPosX])]);
+      Int iDispartyOrg  = abs(ppiCurLUT[0][ RenModRemoveBitInc(piOrgData[iPosX])]);
+
+      if( iDispartyOrg != iDisparityRec)
+      {
+        m_pbHorSkip[iPosY] = false;
+        bNoDiff            = false;
+        break;
+      }
+    }
+    piNewData += iStride;
+    piOrgData += iOrgStride;
+  }
+  return bNoDiff;
+}
+
+template <BlenMod iBM, Bool bBitInc> 
+__inline Bool
+TRenSingleModelC<iBM,bBitInc>::xDetectEarlySkipR( Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, Pel* piNewData,Pel* piOrgData, Int iOrgStride)
+{
+  RM_AOF( m_bEarlySkip ); 
+  Bool bNoDiff  = true;
+
+  const Int iCurViewPos = 1;
+  Int** ppiCurLUT       = m_appiShiftLut   [ iCurViewPos ];
+
+  for ( Int iPosY = 0; iPosY < iHeight; iPosY++ )
+  {
+    m_pbHorSkip[iPosY] = true;
+
+    for (Int iPosX = 0; iPosX < iWidth; iPosX++)
+    {
+      Int iDisparityRec = abs( ppiCurLUT[0][ RenModRemoveBitInc(piNewData[iPosX])] );
+      Int iDisparityOrg = abs( ppiCurLUT[0][ RenModRemoveBitInc(piOrgData[iPosX])] );
+
+      if( iDisparityRec != iDisparityOrg )
+      {
+        m_pbHorSkip[iPosY] = false;
+        bNoDiff            = false;
+        break;
+      }
+    }
+
+    piNewData += iStride;
+    piOrgData += iOrgStride;
+  }
+  return bNoDiff;
+}
+#endif
Index: trunk/source/Lib/TLibRenderer/TRenSingleModel.h
===================================================================
--- trunk/source/Lib/TLibRenderer/TRenSingleModel.h	(revision 81)
+++ trunk/source/Lib/TLibRenderer/TRenSingleModel.h	(revision 100)
@@ -55,31 +55,135 @@
 
 
+#if HHI_VSO_RM_ASSERTIONS
+#define RM_AOT( exp ) AOT ( exp )
+#define RM_AOF( exp ) AOF ( exp )
+#else
+#define RM_AOT( exp ) ((void)0)
+#define RM_AOF( exp ) ((void)0)
+#endif
+
+#define RenModRemoveBitInc( exp ) bBitInc ? ( RemoveBitIncrement( exp ) ) : ( exp ) 
+
 class TRenSingleModel
 {
+public: 
+#if LGE_VSO_EARLY_SKIP_A0093
+  virtual Void   create    ( Int iMode, Int iWidth, Int iHeight, Int iShiftPrec, Int*** aaaiSubPelShiftTable, Int iHoleMargin, Bool bUseOrgRef, Int iBlendMode, Bool bEarlySkip ) = 0;
+#else
+  virtual Void   create    ( Int iMode, Int iWidth, Int iHeight, Int iShiftPrec, Int*** aaaiSubPelShiftTable, Int iHoleMargin, Bool bUseOrgRef, Int iBlendMode ) = 0;
+#endif
+
+  // Set Frame dependent data
+  virtual Void   setLRView ( Int iViewPos, Pel** apiCurVideoPel, Int* aiCurVideoStride, Pel* piCurDepthPel, Int iCurDepthStride ) = 0;
+  virtual Void   setup     ( TComPicYuv* pcOrgVideo, Int** ppiShiftLutLeft, Int** ppiBaseShiftLutLeft, Int** ppiShiftLutRight,  Int** ppiBaseShiftLutRight,  Int iDistToLeft, Bool bKeepReference, UInt uiHorOffset ) = 0;
+
+  // Set Data
+#ifdef LGE_VSO_EARLY_SKIP_A0093
+  virtual Void   setDepth  ( Int iViewPos,                 Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, Pel* piNewData, Pel* piOrgData, Int iOrgStride )  = 0;
+#else
+  virtual Void   setDepth  ( Int iViewPos,                 Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, Pel* piNewData )  = 0;
+#endif
+  virtual Void   setVideo  ( Int iViewPos,     Int iPlane, Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, Pel* piNewData ) = 0;
+
+  // Get Distortion
+#ifdef LGE_VSO_EARLY_SKIP_A0093
+  virtual RMDist getDistDepth  ( Int iViewPos,             Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, Pel* piNewData, Pel * piOrgData , Int iOrgStride)=0;
+#else
+  virtual RMDist getDistDepth  ( Int iViewPos,             Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, Pel* piNewData ) = 0;
+#endif
+  virtual RMDist getDistVideo  ( Int iViewPos, Int iPlane, Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, Pel* piNewData ) = 0;
+
+  virtual Void   getSynthVideo  ( Int iViewPos, TComPicYuv* pcPicYuv, UInt uiHorOffset  ) = 0;  
+  virtual Void   getSynthDepth  ( Int iViewPos, TComPicYuv* pcPicYuv, UInt uiHorOffset  ) = 0;
+  virtual Void   getRefVideo    ( Int iViewPos, TComPicYuv* pcPicYuv, UInt uiHorOffset  ) = 0;
+};
+
+template < BlenMod iBM, Bool bBitInc >
+class TRenSingleModelC : public TRenSingleModel
+{
+  struct RenModelInPels
+  {
+    // video
+    Pel aiY[5]    ; // y-value
+#if HHI_VSO_COLOR_PLANES
+    Pel aiU[5]    ; // u-value
+    Pel aiV[5]    ; // v-value
+#endif
+    // depth
+    Pel iD        ; // depth
+
+    // state
+    Bool bOccluded; // Occluded
+  };
+
+  struct RenModelOutPels
+  {
+    // video
+    Pel iYLeft    ; 
+    Pel iYRight   ; 
+    Pel iYBlended ; 
+#if HHI_VSO_COLOR_PLANES
+    Pel iULeft    ; 
+    Pel iURight   ; 
+    Pel iUBlended ; 
+    Pel iVLeft    ; 
+    Pel iVRight   ; 
+    Pel iVBlended ; 
+#endif
+    // depth
+    Pel iDLeft    ;
+    Pel iDRight   ; 
+    Pel iDBlended ; 
+
+    // state
+    Int iFilledLeft ; 
+    Int iFilledRight; 
+
+    // error
+    Int  iError   ;
+
+    // reference
+    Pel iYRef    ; 
+#if HHI_VSO_COLOR_PLANES
+    Pel iURef    ; 
+    Pel iVRef    ; 
+#endif        
+  };
+
+
 
 public:
-  TRenSingleModel();
-  ~TRenSingleModel();
+  TRenSingleModelC();
+  ~TRenSingleModelC();
 
   // Create Model
+#if LGE_VSO_EARLY_SKIP_A0093
+  Void   create    ( Int iMode, Int iWidth, Int iHeight, Int iShiftPrec, Int*** aaaiSubPelShiftTable, Int iHoleMargin, Bool bUseOrgRef, Int iBlendMode, Bool bEarlySkip  );
+#else
   Void   create    ( Int iMode, Int iWidth, Int iHeight, Int iShiftPrec, Int*** aaaiSubPelShiftTable, Int iHoleMargin, Bool bUseOrgRef, Int iBlendMode );
+#endif
 
   // Set Frame dependent data
   Void   setLRView ( Int iViewPos, Pel** apiCurVideoPel, Int* aiCurVideoStride, Pel* piCurDepthPel, Int iCurDepthStride );
-  Void   setup     ( TComPicYuv* pcOrgVideo, Int** ppiShiftLutLeft, Int** ppiBaseShiftLutLeft, Int** ppiShiftLutRight,  Int** ppiBaseShiftLutRight,  Int iDistToLeft, Bool bKeepReference );
-
-  // Set Data
+  Void   setup     ( TComPicYuv* pcOrgVideo, Int** ppiShiftLutLeft, Int** ppiBaseShiftLutLeft, Int** ppiShiftLutRight,  Int** ppiBaseShiftLutRight,  Int iDistToLeft, Bool bKeepReference, UInt uiHorOffset );
+
+#if LGE_VSO_EARLY_SKIP_A0093
+  Void   setDepth  ( Int iViewPos,                 Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, Pel* piNewData, Pel* piOrgData, Int iOrgStride );
+#else
   Void   setDepth  ( Int iViewPos,                 Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, Pel* piNewData );
+#endif
   Void   setVideo  ( Int iViewPos,     Int iPlane, Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, Pel* piNewData );
 
   // Get Distortion
+#ifdef LGE_VSO_EARLY_SKIP_A0093
+  RMDist getDistDepth  ( Int iViewPos,             Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, Pel* piNewData, Pel * piOrgData , Int iOrgStride);
+#else
   RMDist getDistDepth  ( Int iViewPos,             Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, Pel* piNewData );
+#endif
   RMDist getDistVideo  ( Int iViewPos, Int iPlane, Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, Pel* piNewData );
 
-  // Get Rendered Data
-  Void   getSynthView( Int iViewPos, Pel**& rppiRenVideoPel, Pel*& rpiRenDepthPel, Int& riStride );
-
-  // Get Reference Data
-  Void   getRefView  ( TComPicYuv*& rpcPicYuvRefView, Pel**& rppiRefVideoPel, Int*& raiStrides );
+  Void   getSynthVideo  ( Int iViewPos, TComPicYuv* pcPicYuv, UInt uiHorOffset );  
+  Void   getSynthDepth  ( Int iViewPos, TComPicYuv* pcPicYuv, UInt uiHorOffset  );
+  Void   getRefVideo    ( Int iViewPos, TComPicYuv* pcPicYuv, UInt uiHorOffset  );
 
 private:
@@ -90,27 +194,34 @@
   /////  Rendering /////
   // Left to Right
-  __inline RMDist xRenderL            ( Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, Pel* piNewData, Bool bSet);
-  __inline Void   xInitRenderPartL    ( Int iEndChangePos, Int iLastSPos  );
-  __inline Void   xRenderRangeL       ( Int iCurSPos, Int iLastSPos, Int iCurPos, RMDist& riError );
-  __inline Void   xRenderShiftedRangeL( Int iCurSPos, Int iLastSPos, Int iCurPos, RMDist& riError );
-  __inline Void   xFillHoleL          ( Int iCurSPos, Int iLastSPos, Int iCurPos, RMDist& riError );
-  __inline Void   xExtrapolateMarginL ( Int iCurSPos,                Int iCurPos, RMDist& riError );
-  __inline Int    xRangeLeftL         ( Int iPos );
-  __inline Int    xRangeRightL        ( Int iPos );
-  __inline Int    xRoundL             ( Int iPos );
+#ifdef LGE_VSO_EARLY_SKIP_A0093
+                      __inline Bool   xDetectEarlySkipL   ( Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, Pel* piNewData,Pel* piOrgData, Int iOrgStride );
+                      __inline Bool   xDetectEarlySkipR   ( Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, Pel* piNewData,Pel* piOrgData, Int iOrgStride );
+  template<Bool bSet> __inline RMDist xRenderL            ( Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, Pel* piNewData, Bool bFast );
+  template<Bool bSet> __inline RMDist xRenderR            ( Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, Pel* piNewData, Bool bFast );
+#else
+  template<Bool bSet> __inline RMDist xRenderR            ( Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, Pel* piNewData );
+  template<Bool bSet> __inline RMDist xRenderL            ( Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, Pel* piNewData );
+#endif
+                      __inline Void   xInitRenderPartL    ( Int iEndChangePos, Int iLastSPos  );
+  template<Bool bSet> __inline Void   xRenderRangeL       ( Int iCurSPos, Int iLastSPos, Int iCurPos, RMDist& riError );
+  template<Bool bSet> __inline Void   xRenderShiftedRangeL( Int iCurSPos, Int iLastSPos, Int iCurPos, RMDist& riError );
+  template<Bool bSet> __inline Void   xFillHoleL          ( Int iCurSPos, Int iLastSPos, Int iCurPos, RMDist& riError );
+  template<Bool bSet> __inline Void   xExtrapolateMarginL ( Int iCurSPos,                Int iCurPos, RMDist& riError );
+                      __inline Int    xRangeLeftL         ( Int iPos );
+                      __inline Int    xRangeRightL        ( Int iPos );
+                      __inline Int    xRoundL             ( Int iPos );
 
   // Right to Left
-  __inline RMDist xRenderR            ( Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, Pel* piNewData, Bool bSet );
-  __inline Void   xInitRenderPartR    ( Int iStartChangePos, Int iLastSPos );
-  __inline Void   xRenderShiftedRangeR( Int iCurSPos, Int iLastSPos, Int iCurPos, RMDist& riError );
-  __inline Void   xRenderRangeR       ( Int iCurSPos, Int iLastSPos, Int iCurPos, RMDist& riError );
-  __inline Void   xFillHoleR          ( Int iCurSPos, Int iLastSPos, Int iCurPos, RMDist& riError );
-  __inline Void   xExtrapolateMarginR ( Int iCurSPos,                Int iCurPos, RMDist& riError );
-  __inline Int    xRangeLeftR         ( Int iPos );
-  __inline Int    xRangeRightR        ( Int iPos );
-  __inline Int    xRoundR             ( Int iPos );
+                      __inline Void   xInitRenderPartR    ( Int iStartChangePos, Int iLastSPos );
+  template<Bool bSet> __inline Void   xRenderShiftedRangeR( Int iCurSPos, Int iLastSPos, Int iCurPos, RMDist& riError );
+  template<Bool bSet> __inline Void   xRenderRangeR       ( Int iCurSPos, Int iLastSPos, Int iCurPos, RMDist& riError );
+  template<Bool bSet> __inline Void   xFillHoleR          ( Int iCurSPos, Int iLastSPos, Int iCurPos, RMDist& riError );
+  template<Bool bSet> __inline Void   xExtrapolateMarginR ( Int iCurSPos,                Int iCurPos, RMDist& riError );
+                      __inline Int    xRangeLeftR         ( Int iPos );
+                      __inline Int    xRangeRightR        ( Int iPos );
+                      __inline Int    xRoundR             ( Int iPos );
 
   // Blending
-  __inline Void   xSetShiftedPelBlend ( Int iSourcePos, Int iTargetSPos, Pel iFilled, RMDist& riError );
+  template<Bool bSet> __inline Void   xSetShiftedPelBlend ( Int iSourcePos, Int iTargetSPos, Pel iFilled, RMDist& riError );
 
 #if HHI_VSO_COLOR_PLANES
@@ -125,6 +236,13 @@
   __inline Pel    xBlend              ( Pel pVal1, Pel pVal2, Int iWeightVal2 );
 
-// General
-  __inline Void   xSetShiftedPel     ( Int iSourcePos, Int iTargetSPos, Pel iFilled, RMDist& riError );
+  // General
+  template<Bool bSet> __inline Void xSetShiftedPelL       (Int iSourcePos,                  Int iSubSourcePos, Int iTargetSPos,                   Pel iFilled, RMDist& riError );
+  template<Bool bSet> __inline Void xSetShiftedPelBlendL  (RenModelInPels* pcInSample, Int iSubSourcePos, RenModelOutPels* pcOutSample, Pel iFilled, RMDist& riError );
+  template<Bool bSet> __inline Void xSetShiftedPelNoBlendL(RenModelInPels* pcInSample, Int iSubSourcePos, RenModelOutPels* pcOutSample, Pel iFilled, RMDist& riError );
+
+  template<Bool bSet> __inline Void xSetShiftedPelR       (Int iSourcePos,                  Int iSubSourcePos, Int iTargetSPos,                   Pel iFilled, RMDist& riError );
+  template<Bool bSet> __inline Void xSetShiftedPelBlendR  (RenModelInPels* pcInSample, Int iSubSourcePos, RenModelOutPels* pcOutSample, Pel iFilled, RMDist& riError );
+  template<Bool bSet> __inline Void xSetShiftedPelNoBlendR(RenModelInPels* pcInSample, Int iSubSourcePos, RenModelOutPels* pcOutSample, Pel iFilled, RMDist& riError );
+
   __inline Int    xShiftNewData      ( Int iPos, Int iPosInNewData );
   __inline Int    xShift             ( Int iPos );
@@ -134,8 +252,49 @@
 
   // Utilities
-  __inline Void   xInitView  ( Int iViewPos );
   __inline Void   xSetPels   ( Pel*  piPelSource , Int iSourceStride, Int iWidth, Int iHeight, Pel iVal );
   __inline Void   xSetBools  ( Bool* pbSource    , Int iSourceStride, Int iWidth, Int iHeight, Bool bVal );
   __inline Void   xSetInts   ( Int*  piPelSource , Int iSourceStride, Int iWidth, Int iHeight, Int iVal );
+
+#if HHI_VSO_COLOR_PLANES
+  Void            xGetSampleStrTextPtrs ( Int iViewNum, Pel RenModelOutPels::*& rpiSrcY, Pel RenModelOutPels::*& rpiSrcU, Pel RenModelOutPels::*& rpiSrcV );
+#else  
+  Void            xGetSampleStrTextPtrs ( Int iViewNum, Pel RenModelOutPels::*& rpiSrcY );
+#endif 
+  Void            xGetSampleStrDepthPtrs( Int iViewNum, Pel RenModelOutPels::*& rpiSrcD );
+       
+  Void            xSetStructRefView            ();
+  Void            xResetStructError            ();
+  Void            xInitSampleStructs           ();
+  Void            xSetStructSynthViewAsRefView ();
+  Void            xCopy2PicYuv                ( Pel** ppiSrcVideoPel, Int* piStrides, TComPicYuv* rpcPicYuvTarget, UInt uiHorOffset );
+
+
+  template< typename S, typename T> 
+  Void   xCopyFromSampleStruct ( S* ptSource , Int iSourceStride, T S::* ptSourceElement, T* ptTarget, Int iTargetStride, Int iWidth, Int iHeight )
+  {
+    for (Int iPosY = 0; iPosY < m_iHeight; iPosY++)
+    {
+      for (Int iPosX = 0; iPosX < m_iWidth; iPosX++)
+      {
+        ptTarget[iPosX] = ptSource[iPosX].*ptSourceElement;
+      }
+      ptSource += iSourceStride;
+      ptTarget += iTargetStride;
+    }    
+  }  
+
+  template< typename S, typename T> 
+  Void   xCopyToSampleStruct ( T* ptSource , Int iSourceStride, S* ptTarget, Int iTargetStride, T S::* ptSourceElement, Int iWidth, Int iHeight )
+  {
+    for (Int iPosY = 0; iPosY < m_iHeight; iPosY++)
+    {
+      for (Int iPosX = 0; iPosX < m_iWidth; iPosX++)
+      {
+        ptTarget[iPosX] = ptSource[iPosX].*ptSourceElement;
+      }
+      ptSource += iSourceStride;
+      ptTarget += iTargetStride;
+    }    
+  }   
 
 private:
@@ -151,4 +310,7 @@
   Int   m_iSampledStride;
 
+  RenModelInPels* m_pcInputSamples[2];
+  Int                  m_iInputSamplesStride;
+
   // Base
   Pel** m_aapiBaseVideoPel     [2]; // Dim1: ViewPosition 0->Left, 1->Right; Dim2: Plane  0-> Y, 1->U, 2->V
@@ -157,4 +319,5 @@
   Pel*  m_apiBaseDepthPel      [2]; // Dim1: ViewPosition
   Int   m_aiBaseDepthStrides   [2]; // Dim1: ViewPosition
+
 
   // LUT
@@ -170,13 +333,11 @@
   //// Reference Data  ////
   TComPicYuv* m_pcPicYuvRef       ;    // Reference PIcYuv
+
+  //// Output Samples
+  RenModelOutPels* m_pcOutputSamples;
+  Int                   m_iOutputSamplesStride;
+
   Pel*  m_aapiRefVideoPel      [3];    // Dim1: Plane  0-> Y, 1->U, 2->V
   Int   m_aiRefVideoStrides    [3];    // Dim1: Plane  0-> Y, 1->U, 2->V
-
-  // Renderer State
-  Int*  m_piError                 ;
-  Pel*  m_apiFilled            [2];    // Dim1: ViewPosition
-  Bool* m_apbOccluded          [2];    // Dim1: ViewPosition
-  Pel*  m_aapiSynthVideoPel    [3][3]; // Dim1: ViewPosition 0: Left, 1:Right, 2: Merged, Dim2: Plane  0-> Y, 1->U, 2->V
-  Pel*  m_apiSynthDepthPel     [3];    // Dim1: ViewPosition 0: Left, 1:Right, 2: Merged, Dim2: Plane  0-> Y, 1->U, 2->V
 
   // Rendering State
@@ -185,5 +346,4 @@
   Int   m_iLastOccludedSPosFP;         // Position of last topmost shifted position in FullPels
 
-  Bool  m_bSet;                        // Set Data, or get Error
   Int   m_iCurViewPos;                 // Current View Position 0: Left, 1: Right
   Int   m_iOtherViewPos;               // Other View Position 0: Left, 1: Right
@@ -201,5 +361,7 @@
   Int   m_iShiftPrec;
   Int   m_iHoleMargin;
-  Int   m_iBlendMode;
+#ifdef LGE_VSO_EARLY_SKIP_A0093
+  Bool  m_bEarlySkip; 
+#endif
 
   // Derived settings
@@ -209,17 +371,15 @@
 
   //// Current Pointers ////
-  Pel*  m_aapiBaseVideoPelRow  [2][3]; // Dim1: ViewPosition 0->Left, 1->Right; Dim2: Plane  0-> Y, 1->U, 2->V
-  Pel*  m_apiBaseDepthPelRow   [2];    // Dim1: ViewPosition
-  Bool* m_apbOccludedRow       [2];    // Dim1: ViewPosition
-  Pel*  m_apiFilledRow         [2];    // Dim1: ViewPosition
-  Int*  m_apiErrorRow             ;
-
-  Pel*  m_aapiRefVideoPelRow   [3];    // Dim1: Plane  0-> Y, 1->U, 2->V
-  Pel*  m_aapiSynthVideoPelRow [3][3]; // Dim1: ViewPosition 0: Left, 1:Right, 2: Merged, Dim2: Plane  0-> Y, 1->U, 2->V
-  Pel*  m_apiSynthDepthPelRow  [3];    // Dim1: ViewPosition 0: Left, 1:Right, 2: Merged
-
+
+  RenModelInPels*  m_pcInputSamplesRow [2];
+  RenModelOutPels* m_pcOutputSamplesRow;
 
   //// MISC ////
   const Int m_iDistShift;                  // Shift in Distortion computation
+
+  //// Early Skip 
+#ifdef LGE_VSO_EARLY_SKIP_A0093
+  Bool* m_pbHorSkip;
+#endif
 };
 
Index: trunk/source/Lib/TLibRenderer/TRenTop.cpp
===================================================================
--- trunk/source/Lib/TLibRenderer/TRenTop.cpp	(revision 81)
+++ trunk/source/Lib/TLibRenderer/TRenTop.cpp	(revision 100)
@@ -1013,5 +1013,4 @@
           if ((iPrevShiftedPos + (iStep >> 1) ) > iPrevShiftedPosCeiled )
           {
-#if HHI_FIX
             if ( !((iInterPolPos < (Int) 0) || (iInterPolPos >= iOutputWidth)))
             {
@@ -1026,20 +1025,4 @@
             iInterPolPos++;
           }          
-#else
-          if ( (iInterPolPos < (Int) 0) || (iInterPolPos >= iOutputWidth))
-          {
-            // skip Interpolation if Interpolation position is outside frame
-            iPrevShiftedPos = iShiftedPos;
-            continue;
-          };
-
-          for( UInt uiCurPlane = 0; uiCurPlane < uiNumberOfPlanes; uiCurPlane++)
-          {
-              apcOutputData[uiCurPlane][iInterPolPos]  = apcInputData[uiCurPlane][iPosX - iStep];
-          }
-          pcFilledData[iInterPolPos]  = REN_IS_FILLED;
-            iInterPolPos++;
-        }
-#endif
 
           // Fill Disocclusion
@@ -1064,5 +1047,4 @@
         {
           iInterPolPos = iShiftedPosFloor >> m_iRelShiftLUTPrec;
-#if HHI_FIX
           if ( !((iInterPolPos < (Int) 0) || (iInterPolPos >= iOutputWidth)))
           {        
@@ -1074,19 +1056,4 @@
             pcFilledData[iInterPolPos]  = REN_IS_FILLED;
           }
-#else
-          if ( (iInterPolPos < (Int) 0) || (iInterPolPos >= iOutputWidth))
-          {
-            // skip Interpolation if Interpolation position is outside frame
-            iPrevShiftedPos = iShiftedPos;
-            continue;
-          };
-
-          for( UInt uiCurPlane = 0; uiCurPlane < uiNumberOfPlanes; uiCurPlane++)
-          {
-            apcOutputData[uiCurPlane][iInterPolPos]  = apcInputData[uiCurPlane][iPosX ];
-          }
-
-          pcFilledData[iInterPolPos]  = REN_IS_FILLED;
-#endif
         }
       }
@@ -1959,5 +1926,5 @@
           for( Int iCurPosX = 0; iCurPosX < 4; iCurPosX++)
           {
-            iSAD += abs( pcVideoLastDataBlk[iCurPosX] - pcVideoCurDataBlk[iCurPosX] );	 //SAD
+            iSAD += abs( pcVideoLastDataBlk[iCurPosX] - pcVideoCurDataBlk[iCurPosX] );   //SAD
           }
           pcVideoLastDataBlk += iVideoLastStride;
