Changeset 1396 in 3DVCSoftware


Ignore:
Timestamp:
11 Mar 2016, 16:54:51 (9 years ago)
Author:
tech
Message:

Merged HTM-16.0-dev1@1395.

Location:
trunk
Files:
47 edited

Legend:

Unmodified
Added
Removed
  • trunk/cfg/MV-HEVC/baseCfg_2view.cfg

    r1386 r1396  
    9090FEN                           : 1           # Fast encoder decision
    9191FDM                           : 1           # Fast Decision for Merge RD cost
    92 DispSearchRangeRestriction    : 0           # Limit Search range for vertical component of disparity vector
     92DispSearchRangeRestriction    : 1           # Limit Search range for vertical component of disparity vector
    9393VerticalDispSearchRange       : 56          # Vertical Search range in pixel
    9494
  • trunk/cfg/MV-HEVC/baseCfg_3view.cfg

    r1386 r1396  
    120120FEN                           : 1           # Fast encoder decision
    121121FDM                           : 1           # Fast Decision for Merge RD cost
    122 DispSearchRangeRestriction    : 0           # Limit Search range for vertical component of disparity vector
     122DispSearchRangeRestriction    : 1           # Limit Search range for vertical component of disparity vector
    123123VerticalDispSearchRange       : 56          # Vertical Search range in pixel
    124124
  • trunk/cfg/MV-HEVC/fullCfg.cfg

    r1356 r1396  
    226226FEN                           : 1           # Fast encoder decision
    227227FDM                           : 1           # Fast Decision for Merge RD cost
    228 DispSearchRangeRestriction    : 0           # Limit Search range for vertical component of disparity vector
     228DispSearchRangeRestriction    : 1           # Limit Search range for vertical component of disparity vector
    229229VerticalDispSearchRange       : 56          # Vertical Search range in pixel
    230230
  • trunk/source/App/TAppDecoder/TAppDecTop.cpp

    r1386 r1396  
    10921092    m_newVpsActivatedbyCurAu  = true; //TBD
    10931093    m_newVpsActivatedbyCurPic = true;
    1094 #if NH_3D_VSO
     1094#if NH_3D_VSO || NH_3D
    10951095    m_dpb.setVPS( m_vps );
    10961096#endif
  • trunk/source/App/TAppEncoder/TAppEncCfg.cpp

    r1386 r1396  
    188188    free (  m_pchVSOConfig );
    189189  }
     190#endif
     191#if NH_3D_VSO || NH_3D 
    190192 
    191193  if ( m_pchCameraParameterFile != NULL )
     
    816818  ("ViewId",                         m_viewId                      , IntAry1d(1,0),                                 "View Id per View Order Index")
    817819  ("AuxId",                          m_auxId                       , IntAry1d(1,0),                                 "AuxId per layer")
    818 #if NH_3D_VSO
     820#if NH_3D_VSO || NH_3D
    819821  ("DepthFlag",                      m_depthFlag                   , IntAry1d(1,0),                                 "Depth Flag")
    820822#endif
     
    12851287  ("Depth420OutputFlag",                              m_depth420OutputFlag,           true                     , "Output depth layers in 4:2:0 ")
    12861288#endif
    1287 #if NH_3D_VSO 
     1289#if NH_3D_VSO  || NH_3D
    12881290  ("CameraParameterFile,cpf",                         m_pchCameraParameterFile,    (TChar *) 0                 , "Camera Parameter File Name")
    12891291  ("CodedCamParsPrecision",                           m_iCodedCamParPrecision,      STD_CAM_PARAMETERS_PRECISION, "precision for coding of camera parameters (in units of 2^(-x) luma samples)" )
    1290 
     1292#endif
     1293#if NH_3D_VSO 
    12911294  /* View Synthesis Optimization */
    12921295  ("VSOConfig",                                       m_pchVSOConfig            , (TChar *) 0                   ,"VSO configuration")
     
    18071810  xResizeVector( m_auxId );
    18081811
    1809 #if NH_3D_VSO
     1812#if NH_3D_VSO || NH_3D
    18101813  xResizeVector( m_depthFlag );
    18111814#endif
     
    20702073      LOG2_DISP_PREC_LUT );
    20712074  }
    2072 #if NH_3D
    20732075  else
     2076#endif
     2077#if NH_3D || NH_3D_VSO
    20742078  {
    20752079    m_cCameraData     .init     ( ((UInt) m_iNumberOfViews ),
     
    20852089  }
    20862090  m_cCameraData.check( false, true );
    2087 #endif
    20882091#endif
    20892092
     
    22702273#endif
    22712274
    2272 #if NH_3D_VSO
     2275#if NH_3D_VSO || NH_3D
    22732276  if ( m_scalabilityMask & ( 1 << DEPTH_ID ) )
    22742277  {
     
    26292632  }
    26302633
    2631 #if NH_3D_VSO
     2634#if NH_3D_VSO || NH_3D
    26322635  xConfirmPara( m_pchCameraParameterFile    == 0                ,   "CameraParameterFile must be given");
    26332636  xConfirmPara( m_pchBaseViewCameraNumbers  == 0                ,   "BaseViewCameraNumbers must be given" );
    26342637  xConfirmPara( m_iNumberOfViews != m_cCameraData.getBaseViewNumbers().size() ,   "Number of Views in BaseViewCameraNumbers must be equal to NumberOfViews" );
    26352638  xConfirmPara    ( m_iCodedCamParPrecision < 0 || m_iCodedCamParPrecision > 5,       "CodedCamParsPrecision must be in range of 0..5" );
     2639#endif
     2640#if NH_3D_VSO
    26362641    if( m_bUseVSO )
    26372642    {
     
    33933398  xPrintParaVector( "AuxId", m_auxId );
    33943399#endif
    3395 #if NH_3D_VSO
     3400#if NH_3D_VSO || NH_3D
    33963401  xPrintParaVector( "DepthLayerFlag", m_depthFlag );
    33973402  printf("Coded Camera Param. Precision     : %d\n", m_iCodedCamParPrecision); 
     
    35953600
    35963601  printf("Max Num Merge Candidates          : %d\n", m_maxNumMergeCand);
    3597 #if NH_3D_VSO
     3602#if NH_3D_VSO || NH_3D
    35983603  printf("BaseViewCameraNumbers             : %s\n", m_pchBaseViewCameraNumbers );
    35993604  printf("Coded Camera Param. Precision     : %d\n", m_iCodedCamParPrecision);
     3605#endif
     3606#if NH_3D_VSO
    36003607  printf("Force use of Lambda Scale         : %d\n", m_bForceLambdaScaleVSO );
    36013608
  • trunk/source/App/TAppEncoder/TAppEncCfg.h

    r1386 r1396  
    8080  IntAry1d               m_viewOrderIndex;                    ///< view order index 
    8181  IntAry1d               m_auxId;                             ///< auxiliary id
    82 #if NH_3D_VSO
     82#if NH_3D_VSO || NH_3D
    8383  IntAry1d               m_depthFlag;                         ///< depth flag
    8484#endif
     
    532532#endif
    533533    // Camera parameters
    534 #if NH_3D_VSO
     534#if NH_3D || NH_3D_VSO
    535535  TChar*    m_pchCameraParameterFile;                         ///< camera parameter file
    536536  TAppComCamPara m_cCameraData;
    537537  Int       m_iCodedCamParPrecision;                          ///< precision for coding of camera parameters
     538#endif
     539#if NH_3D_VSO
    538540  TChar*    m_pchVSOConfig;
    539541  Bool      m_bUseVSO;                                        ///< flag for using View Synthesis Optimization
  • trunk/source/App/TAppEncoder/TAppEncTop.cpp

    r1386 r1396  
    148148  xSetCamPara              ( vps );
    149149#endif
    150 #if NH_3D_VSO
     150#if NH_3D_VSO || NH_3D
    151151  m_ivPicLists.setVPS      ( &vps );
    152152#endif
     
    278278    m_cTEncTop.setViewId                       ( vps.getViewId      (  layerId ) );
    279279    m_cTEncTop.setViewIndex                    ( vps.getViewIndex   (  layerId ) );
    280 #if NH_3D_VSO
     280#if NH_3D_VSO || NH_3D
    281281    Bool isDepth    = ( vps.getDepthId     ( layerId ) != 0  ) ;
    282282    Bool isAuxDepth = ( vps.getAuxId       ( layerId ) ==  2 ) ; // TBD: define 2 as AUX_DEPTH
     
    284284    m_cTEncTop.setIsAuxDepth               ( isAuxDepth );
    285285    //====== Camera Parameters =========
    286     m_cTEncTop.setCameraParameters             ( &m_cCameraData );     
     286    m_cTEncTop.setCameraParameters         ( &m_cCameraData );     
     287#endif
     288#if NH_3D_VSO
    287289    //====== VSO =========
    288290    m_cTEncTop.setRenderModelParameters        ( &m_cRenModStrParser );
     
    796798    {
    797799#if H_3D_VSO_EARLY_SKIP
    798       m_cRendererModel.create( m_cRenModStrParser.getNumOfBaseViews(), m_cRenModStrParser.getNumOfModels(), m_iSourceWidth, m_uiMaxCUHeight , LOG2_DISP_PREC_LUT, 0, m_bVSOEarlySkip );
    799 #else
    800       m_cRendererModel.create( m_cRenModStrParser.getNumOfBaseViews(), m_cRenModStrParser.getNumOfModels(), m_iSourceWidth, m_uiMaxCUHeight , LOG2_DISP_PREC_LUT, 0 );
     800      m_cRendererModel.create( m_cRenModStrParser.getNumOfBaseViews(), m_cRenModStrParser.getNumOfModels(), m_iSourceWidth, m_uiMaxCUHeight , LOG2_DISP_PREC_LUT, 0, true, m_bVSOEarlySkip );
     801#else
     802      m_cRendererModel.create( m_cRenModStrParser.getNumOfBaseViews(), m_cRenModStrParser.getNumOfModels(), m_iSourceWidth, m_uiMaxCUHeight , LOG2_DISP_PREC_LUT, 0 , true);
    801803#endif
    802804      for ( Int layer = 0; layer < m_numberOfLayers ; layer++ )
     
    10361038    for ( Int gopId=0; gopId < gopSize; gopId++ )
    10371039    {
    1038 #if NH_3D_VSO
     1040#if NH_3D_VSO || NH_3D
    10391041      UInt iNextPoc = m_acTEncTopList[0] -> getFrameId( gopId );
    10401042      if ( iNextPoc < m_framesToBeEncoded )
  • trunk/source/App/TAppRenderer/TAppRendererCfg.cpp

    r1386 r1396  
    4444#include "../../Lib/TAppCommon/program_options_lite.h"
    4545
    46 #if NH_3D_VSO
     46#if NH_3D_VSO || NH_3D
    4747
    4848using namespace std;
     
    207207  else
    208208  {
    209   if ( m_bUseSetupString )
    210   {
    211     std::vector<Int>  iaTempViews;
    212     std::vector<Int>* piaTempViews;
    213     m_cCameraData     .convertNumberString( m_pchBaseViewCameraNumbers, iaTempViews, VIEW_NUM_PREC );
    214     m_cRenModStrParser.setString( (Int) iaTempViews.size(), m_pchViewConfig );
    215     piaTempViews               = m_cRenModStrParser.getSynthViews();
    216     m_iNumberOfOutputViews     = (Int) m_cRenModStrParser.getNumOfModels();
    217     m_iNumberOfInputViews      = (Int) m_cRenModStrParser.getNumOfBaseViews();
    218     m_bContOutputFileNumbering = true;
    219 
    220   m_cCameraData.init( MAX_INPUT_VIEW_NUM, uiInputBitDepth, uiCamParPrecision, (UInt)m_iFrameSkip, (UInt)m_iFramesToBeRendered,
    221       m_pchCameraParameterFile, m_pchBaseViewCameraNumbers, NULL, piaTempViews, m_iLog2SamplingFactor+m_iShiftPrecision );
    222   }
    223   else
    224   {
    225   m_cCameraData.init( MAX_INPUT_VIEW_NUM, uiInputBitDepth, uiCamParPrecision, (UInt)m_iFrameSkip, (UInt)m_iFramesToBeRendered,
    226       m_pchCameraParameterFile, m_pchBaseViewCameraNumbers, m_pchSynthViewCameraNumbers, NULL, m_iLog2SamplingFactor+m_iShiftPrecision );
    227   m_iNumberOfOutputViews = (Int) m_cCameraData.getSynthViewNumbers().size();
    228   m_iNumberOfInputViews  = (Int) m_cCameraData.getBaseViewNumbers() .size();
    229   }
     209#if NH_3D_VSO
     210    if ( m_bUseSetupString )
     211    {
     212      std::vector<Int>  iaTempViews;
     213      std::vector<Int>* piaTempViews;
     214      m_cCameraData     .convertNumberString( m_pchBaseViewCameraNumbers, iaTempViews, VIEW_NUM_PREC );
     215      m_cRenModStrParser.setString( (Int) iaTempViews.size(), m_pchViewConfig );
     216      piaTempViews               = m_cRenModStrParser.getSynthViews();
     217      m_iNumberOfOutputViews     = (Int) m_cRenModStrParser.getNumOfModels();
     218      m_iNumberOfInputViews      = (Int) m_cRenModStrParser.getNumOfBaseViews();
     219      m_bContOutputFileNumbering = true;
     220
     221      m_cCameraData.init( MAX_INPUT_VIEW_NUM, uiInputBitDepth, uiCamParPrecision, (UInt)m_iFrameSkip, (UInt)m_iFramesToBeRendered,
     222        m_pchCameraParameterFile, m_pchBaseViewCameraNumbers, NULL, piaTempViews, m_iLog2SamplingFactor+m_iShiftPrecision );
     223    }
     224    else
     225    {
     226      m_cCameraData.init( MAX_INPUT_VIEW_NUM, uiInputBitDepth, uiCamParPrecision, (UInt)m_iFrameSkip, (UInt)m_iFramesToBeRendered,
     227        m_pchCameraParameterFile, m_pchBaseViewCameraNumbers, m_pchSynthViewCameraNumbers, NULL, m_iLog2SamplingFactor+m_iShiftPrecision );
     228      m_iNumberOfOutputViews = (Int) m_cCameraData.getSynthViewNumbers().size();
     229      m_iNumberOfInputViews  = (Int) m_cCameraData.getBaseViewNumbers() .size();
     230    }
     231#else
     232    AOF( false ); // Compile with VSO enabled to use this option.
     233#endif
    230234  }
    231235
  • trunk/source/App/TAppRenderer/TAppRendererCfg.h

    r1386 r1396  
    4747#include <vector>
    4848
    49 #if NH_3D_VSO
     49#if NH_3D_VSO  || NH_3D
    5050
    5151// ====================================================================================================================
     
    9191  // derived
    9292  TAppComCamPara      m_cCameraData;                    ///< class to store camera parameters
     93#if NH_3D_VSO
    9394  TRenModSetupStrParser m_cRenModStrParser;             ///< class to manage View to be rendered
     95#endif
    9496  Bool                m_bUseSetupString;                ///< true if setup string is used
    9597
  • trunk/source/App/TAppRenderer/TAppRendererTop.cpp

    r1386 r1396  
    434434
    435435      m_apcTVideoIOYuvSynthOutput[m_bSweep ? 0 : iSynthViewIdx]->write( pcPicYuvSynthOut, IPCOLOURSPACE_UNCHANGED, 0, 0, 0, 0, CHROMA_420 );
    436     }
     436   }
    437437    iFrame++;
    438438    iNumOfRenderedFrames++;
     
    544544    AOT( m_iLog2SamplingFactor != 0 );
    545545#if H_3D_VSO_EARLY_SKIP
     546    cCurModel.create( m_cRenModStrParser.getNumOfBaseViews(), m_cRenModStrParser.getNumOfModels(), m_iSourceWidth, m_iSourceHeight, m_iShiftPrecision, m_iBlendHoleMargin, false, false );
     547#else
    546548    cCurModel.create( m_cRenModStrParser.getNumOfBaseViews(), m_cRenModStrParser.getNumOfModels(), m_iSourceWidth, m_iSourceHeight, m_iShiftPrecision, m_iBlendHoleMargin, false );
    547 #else
    548     cCurModel.create( m_cRenModStrParser.getNumOfBaseViews(), m_cRenModStrParser.getNumOfModels(), m_iSourceWidth, m_iSourceHeight, m_iShiftPrecision, m_iBlendHoleMargin );
    549549#endif
    550550
     
    725725
    726726#if H_3D_VSO_EARLY_SKIP
    727   cCurModel.create( m_iNumberOfInputViews, m_iNumberOfOutputViews, m_iSourceWidth, m_iSourceHeight, m_iShiftPrecision, m_iBlendHoleMargin, false );
     727  cCurModel.create( m_iNumberOfInputViews, m_iNumberOfOutputViews, m_iSourceWidth, m_iSourceHeight, m_iShiftPrecision, m_iBlendHoleMargin, false , false);
    728728#else
    729   cCurModel.create( m_iNumberOfInputViews, m_iNumberOfOutputViews, m_iSourceWidth, m_iSourceHeight, m_iShiftPrecision, m_iBlendHoleMargin );
     729  cCurModel.create( m_iNumberOfInputViews, m_iNumberOfOutputViews, m_iSourceWidth, m_iSourceHeight, m_iShiftPrecision, m_iBlendHoleMargin ,false);
    730730#endif
    731731  cCurModel.setupPart( 0, m_iSourceHeight  );
  • trunk/source/Lib/TAppCommon/TAppComCamPara.cpp

    r1386 r1396  
    4949#include <functional>
    5050#include <string>
    51 #if NH_3D_VSO
     51#if NH_3D_VSO || NH_3D
    5252
    5353
  • trunk/source/Lib/TLibCommon/CommonDef.h

    r1387 r1396  
    442442#endif
    443443
    444 #if NH_3D_VSO
     444#if NH_3D_VSO || NH_3D
    445445//PICYUV
    446446#define PICYUV_PAD         16
     
    456456#define REN_UNUSED_PEL     0
    457457#define REN_IS_HOLE        0
    458 #if NH_3D_VSO
    459458#define ENC_INTERNAL_BIT_DEPTH  REN_BIT_DEPTH // consider making this a variable
    460 #endif
    461 
    462 
     459#endif // end of NH_3D_VSO
     460#if NH_3D
    463461// CAMERA PARAMETERS
    464462#define LOG2_DISP_PREC_LUT           2           ///< log2 of disparity precision used in integer disparity LUTs
    465463#define STD_CAM_PARAMETERS_PRECISION 5        ///< quarter luma sample accuarcy for derived disparities (as default)
    466 
    467 #endif // end of NH_3D
     464#endif
    468465//! \}
    469466
  • trunk/source/Lib/TLibCommon/TComDataCU.cpp

    r1386 r1396  
    51015101
    51025102  //// ******* Get disparity from left block ******* /////
    5103 #if NH_3D_FIX_TICKET_91
    51045103    pcTmpCU = getPULeft(uiIdx, uiPartIdxLB);
    5105 #else
    5106   pcTmpCU = getPULeft(uiIdx, uiPartIdxLB, true, false);
    5107 #endif
    51085104  bCheckMcpDv = true;
    51095105  if ( xCheckSpatialNBDV( pcTmpCU, uiIdx, pDInfo, bCheckMcpDv, &cIDVInfo, DVFROM_LEFT
  • trunk/source/Lib/TLibCommon/TComDataCU.h

    r1386 r1396  
    4949#include "TComRdCost.h"
    5050#include "TComPattern.h"
     51#if NH_3D
     52#include "TComYuv.h"
     53#endif
    5154
    5255//! \ingroup TLibCommon
  • trunk/source/Lib/TLibCommon/TComPic.cpp

    r1386 r1396  
    6060, m_viewId                                (0)
    6161, m_bPicOutputFlag                        (false)
    62 #if NH_3D_VSO
     62#if NH_3D_VSO || NH_3D
    6363, m_viewIndex                             (0)
    6464, m_isDepth                               (false)
     
    989989}
    990990
    991 #if NH_3D_VSO
     991#if NH_3D_VSO || NH_3D
    992992TComPicYuv* TComPicLists::getPicYuv( Int viewIndex, Bool depthFlag, Int auxId, Int poc, Bool recon )
    993993
  • trunk/source/Lib/TLibCommon/TComPic.h

    r1386 r1396  
    154154  TComDecodedRps        m_decodedRps;
    155155#endif
    156 #if NH_3D_VSO
     156#if NH_3D_VSO || NH_3D
    157157  Int                   m_viewIndex;
    158158  Bool                  m_isDepth;
     
    311311   Void          print( Int outputLevel );
    312312
    313 #if NH_3D_VSO
     313#if NH_3D_VSO ||  NH_3D
    314314   Void          setViewIndex          ( Int viewIndex )  { m_viewIndex = viewIndex;   }
    315315   Int           getViewIndex          () const           { return m_viewIndex;     }
     
    404404  TComList<TComSubDpb*>       m_subDpbs;
    405405  Bool                        m_printPicOutput;
    406 #if NH_3D_VSO
     406#if NH_3D_VSO || NH_3D
    407407  const TComVPS*              m_vps;
    408408#endif
     
    448448  Void                   print();
    449449
    450 #if NH_3D_VSO
     450#if NH_3D_VSO || NH_3D
    451451  Void                   setVPS                        ( const TComVPS* vps ) { m_vps = vps;  };
     452#endif
     453
     454#if NH_3D || NH_3D_VSO
    452455  TComPic*               getPic                        ( Int viewIndex, Bool depthFlag, Int auxId, Int poc );
    453456  TComPicYuv*            getPicYuv                     ( Int viewIndex, Bool depthFlag, Int auxId, Int poc, Bool recon );
  • trunk/source/Lib/TLibCommon/TComRdCost.cpp

    r1386 r1396  
    252252      rcDistParam.DistFunc = TComRdCost::xGetMaskedSAD;
    253253    }
     254#if NH_3D_VSO
    254255    else if( eDFunc >= DF_VSD && eDFunc <= DF_VSD16N )
    255256    {
    256257      rcDistParam.DistFunc = TComRdCost::xGetMaskedVSD;
    257258    }
     259#endif
    258260    else if( eDFunc >= DF_SAD12 && eDFunc <= DF_SADS48 )
    259261    {
     
    626628}
    627629
    628 
     630#if NH_3D_VSO
    629631UInt TComRdCost::xGetMaskedVSD( DistParam* pcDtParam )
    630632{
     
    660662  return ( uiSum );
    661663}
     664#endif
    662665#endif
    663666// --------------------------------------------------------------------------------------------------------------------
  • trunk/source/Lib/TLibCommon/TComRom.h

    r1386 r1396  
    150150// ====================================================================================================================
    151151extern       SChar   g_aucConvertToBit  [ MAX_CU_SIZE+1 ];   // from width to log2(width)-2
    152 #if NH_MV
    153 // Change later
    154 #ifndef ENC_DEC_TRACE
    155 #define ENC_DEC_TRACE 0
    156 #endif
    157 #endif
    158152#if ENC_DEC_TRACE
    159153extern FILE*  g_hTrace;
  • trunk/source/Lib/TLibCommon/TComSlice.cpp

    r1386 r1396  
    118118, m_viewId                        (0)
    119119, m_viewIndex                     (0)
    120 #if NH_3D_VSO
     120#if NH_3D_VSO || NH_3D
    121121, m_isDepth                       (false)
    122122#endif
     
    19231923  for ( Int i = 0; i < MAX_VPS_OUTPUTLAYER_SETS; i++)
    19241924  {
    1925 #if !NH_3D_FIX_TICKET_107
    1926     m_layerSetIdxForOlsMinus1[i]  = -1;
    1927 #endif
    19281925    for ( Int j = 0; j < MAX_VPS_NUH_LAYER_ID_PLUS1; j++)
    19291926    {
     
    21842181}
    21852182
    2186 #if NH_3D_VSO
     2183#if NH_3D_VSO || NH_3D
    21872184Int TComVPS::getLayerIdInNuh( Int viewIndex, Bool depthFlag, Int auxId ) const
    21882185{
  • trunk/source/Lib/TLibCommon/TComSlice.h

    r1386 r1396  
    13841384  /// VPS EXTENSION 2 SYNTAX ELEMENTS
    13851385  Int     getDepthId                   ( Int layerIdInNuh)             const    { return getScalabilityId( getLayerIdInVps(layerIdInNuh), DEPTH_ID ); }
    1386 #if NH_3D_VSO                                                            
     1386#if NH_3D_VSO || NH_3D
    13871387  Bool    getVpsDepthFlag              ( Int layerIdInNuh)             const    { return (getDepthId( layerIdInNuh ) > 0);  }
    13881388  Int     getLayerIdInNuh              ( Int viewIndex, Bool depthFlag, Int auxId ) const;   
     
    27012701  Int        m_viewId;
    27022702  Int        m_viewIndex;
    2703 #if NH_3D_VSO
     2703#if NH_3D_VSO || NH_3D
    27042704  Bool       m_isDepth;
    27052705#endif
     
    31683168#endif                       
    31693169#endif
    3170 #if NH_3D_VSO
     3170#if NH_3D_VSO || NH_3D
    31713171  Void                        setIsDepth            ( Bool isDepth )                 { m_isDepth = isDepth;                                          }
    31723172  Bool                        getIsDepth            () const                         { return m_isDepth;                                             }
  • trunk/source/Lib/TLibCommon/TComYuv.cpp

    r1386 r1396  
    487487  }
    488488}
     489#endif
    489490
    490491#if NH_3D_ARP
     
    676677}
    677678#endif
    678 #endif
    679679
    680680//! \}
  • trunk/source/Lib/TLibCommon/TypeDef.h

    r1386 r1396  
    6565#if NH_MV
    6666// Recent bug fixes
    67 #define NH_3D_FIX_TICKET_107                     1 // Clean up.
    68 #define NH_3D_FIX_TICKET_91                      1 // NBDV availability in case of tiles.
     67#define RM_INIT_FIX                      1
     68#define RM_FIX_SETUP                     1
     69#define NH_MV_FIX_VERT_MV_REST                         1
     70
     71#define NH_3D_FIX_INTRA_SDC_VSO_OFF              1
     72#define NH_3D_FIX_TICKET_114                     1  //Mismatch between text and software on DPB size syntax
     73#define NH_3D_FIX_LEAK                           1
    6974// Things that needs to be fixed also in the Specification ...
    7075#define NH_MV_FIX_NO_REF_PICS_CHECK               1 // !!SPEC!!
     
    349354#endif
    350355// This can be enabled by the makefile
    351 #if !NH_MV
    352356#ifndef ENC_DEC_TRACE
    353357#define ENC_DEC_TRACE                                     0
     358#endif
     359
     360#if NH_MV
     361#if ENC_DEC_TRACE
     362#define GT_DEBUG   1
     363#else
     364#define GT_DEBUG   0
    354365#endif
    355366#endif
     
    510521#define       RDO_DIST_MAX     MAX_UINT
    511522#endif
     523#else
     524#define       RDO_DIST_MAX     MAX_UINT
    512525#endif
    513526// ====================================================================================================================
     
    10001013  BLEND_GEN   =  3
    10011014};
     1015
     1016  enum SetMod
     1017  {
     1018    GET_FULL   = 0,
     1019    SET_FULL   = 1,
     1020    GET_SIMP   = 2,
     1021    SET_SIMP   = 3   
     1022  };
     1023
     1024 
    10021025enum
    10031026{
  • trunk/source/Lib/TLibDecoder/TDecCAVLC.cpp

    r1386 r1396  
    21352135    for( Int j = 0; j  <=  vps->getMaxSubLayersInLayerSetMinus1( currLsIdx ); j++ )
    21362136    { 
     2137#if NH_3D_FIX_TICKET_114
     2138      if( j > 0  &&  dpbSize.getSubLayerFlagInfoPresentFlag( i )  ) 
     2139#else
    21372140      if( j > 0  &&  dpbSize.getSubLayerDpbInfoPresentFlag( i, j )  ) 
     2141#endif
    21382142      {
    21392143        READ_FLAG( uiCode, "sub_layer_dpb_info_present_flag" ); dpbSize.setSubLayerDpbInfoPresentFlag( i, j, uiCode == 1 );
  • trunk/source/Lib/TLibDecoder/TDecTop.cpp

    r1386 r1396  
    10631063    m_pcPic->setLayerId( nalu.m_nuhLayerId );
    10641064    m_pcPic->setViewId ( getViewId() );
    1065 #if NH_3D
     1065#if NH_3D || NH_3D_VSO
    10661066    m_pcPic->setViewIndex( getViewIndex() );
    10671067    m_pcPic->setIsDepth  ( getIsDepth  () );
  • trunk/source/Lib/TLibDecoder/TDecTop.h

    r1321 r1396  
    247247  Int                     m_layerId;
    248248  Int                     m_viewId;
    249 #if NH_3D                
     249#if NH_3D || NH_3D_VSO
    250250  Int                     m_viewIndex;
    251251  Bool                    m_isDepth;
  • trunk/source/Lib/TLibEncoder/SyntaxElementWriter.cpp

    r1386 r1396  
    128128
    129129#if NH_MV_ENC_DEC_TRAC
    130 Void  SyntaxElementWriter::xWriteStringTr( UChar* value, UInt length, const Char *pSymbolName)
     130Void  SyntaxElementWriter::xWriteStringTr( UChar* value, UInt length, const TChar *pSymbolName)
    131131{
    132132  xWriteString(value, length);
  • trunk/source/Lib/TLibEncoder/SyntaxElementWriter.h

    r1386 r1396  
    9696  Void  xWriteFlagTr          ( UInt value,               const TChar *pSymbolName);
    9797#if NH_MV
    98   Void  xWriteStringTr        ( UChar* value, UInt length, const Char *pSymbolName);
     98  Void  xWriteStringTr        ( UChar* value, UInt length, const TChar *pSymbolName);
    9999#endif
    100100#endif
  • trunk/source/Lib/TLibEncoder/TEncCavlc.cpp

    r1386 r1396  
    6969  fprintf( g_hTrace, "=========== Slice ===========\n");
    7070}
     71#endif
    7172
    7273Void  xTraceAccessUnitDelimiter ()
     
    7576}
    7677
    77 #endif
    7878#endif
    7979
     
    14281428    for( Int j = 0; j  <=  vps->getMaxSubLayersInLayerSetMinus1( currLsIdx ); j++ )
    14291429    { 
     1430#if NH_3D_FIX_TICKET_114
     1431      if( j > 0  &&  dpbSize->getSubLayerFlagInfoPresentFlag( i )  ) 
     1432#else
    14301433      if( j > 0  &&  dpbSize->getSubLayerDpbInfoPresentFlag( i, j )  ) 
     1434#endif
    14311435      {
    14321436        WRITE_FLAG( dpbSize->getSubLayerDpbInfoPresentFlag( i, j ) ? 1 : 0 , "sub_layer_dpb_info_present_flag" );
  • trunk/source/Lib/TLibEncoder/TEncCfg.h

    r1386 r1396  
    4646#include "TLibCommon/TComSlice.h"
    4747#include <assert.h>
     48
     49#if NH_3D
     50#include "TAppCommon/TAppComCamPara.h"
     51#endif
    4852#if NH_3D_VSO
    49 #include "TAppCommon/TAppComCamPara.h"
    5053#include "TLibRenderer/TRenModSetupStrParser.h"
    5154#endif
     
    458461#endif
    459462
    460 #if NH_3D_VSO
     463#if NH_3D_VSO || NH_3D
    461464  Bool      m_isDepth;
    462465  Bool      m_isAuxDepth;
     
    464467  //====== Camera Parameters ======
    465468  TAppComCamPara* m_cameraParameters;
     469#endif
    466470 
     471#if NH_3D_VSO
    467472  //====== View Synthesis Optimization ======
    468473  TRenModSetupStrParser* m_renderModelParameters;
     
    504509  , m_viewId(-1)
    505510  , m_viewIndex(-1)
    506 #if NH_3D_VSO
     511#if NH_3D_VSO || NH_3D
    507512  , m_isDepth(false)
    508513  , m_isAuxDepth(false)
     514#endif
     515#if NH_3D_VSO
    509516  , m_bUseVSO(false)
    510517#endif
     
    555562  Void      setViewIndex                     ( Int viewIndex  )   { m_viewIndex  = viewIndex;  }
    556563  Int       getViewIndex                     ()                   { return m_viewIndex;    }
    557 #if NH_3D_VSO
     564#if NH_3D_VSO || NH_3D
    558565  Void      setIsDepth                       ( Bool isDepth )   { m_isDepth = isDepth; }
    559566  Bool      getIsDepth                       ()                 { return m_isDepth; }
     
    11571164  UInt      getSummaryVerboseness( ) const                           { return m_summaryVerboseness; }
    11581165
    1159 #if NH_3D_VSO
     1166#if NH_3D_VSO || NH_3D
    11601167  // Only flags that are not in the SPS3dExtension should go here.
    11611168  /// 3D Tools
     
    11631170 //==== CAMERA PARAMETERS  ==========
    11641171  Void      setCameraParameters             ( TAppComCamPara* c) { m_cameraParameters   = c; }
    1165  //==== VSO  ==========
     1172#endif
     1173#if NH_3D_VSO
     1174  //==== VSO  ==========
    11661175  Void      setRenderModelParameters ( TRenModSetupStrParser* c ) { m_renderModelParameters = c; }
    11671176  Bool      getUseVSO                       ()              { return m_bUseVSO;     }
  • trunk/source/Lib/TLibEncoder/TEncCu.cpp

    r1386 r1396  
    11991199      rpcBestCU->getTotalBins() += ((TEncBinCABAC *)((TEncSbac*)m_pcEntropyCoder->m_pcEntropyCoderIf)->getEncBinIf())->getBinsCoded();
    12001200#if NH_3D_VSO // M8
    1201     if ( m_pcRdCost->getUseVSO() )   
     1201    if ( m_pcRdCost->getUseLambdaScaleVSO() )   
    12021202    {
    12031203      rpcBestCU->getTotalCost()  = m_pcRdCost->calcRdCostVSO( rpcBestCU->getTotalBits(), rpcBestCU->getTotalDistortion() );   
     
    13401340      }
    13411341#if NH_3D_VSO // M10
    1342       if ( m_pcRdCost->getUseVSO() )
     1342      if ( m_pcRdCost->getUseLambdaScaleVSO() )
    13431343      {
    13441344        rpcTempCU->getTotalCost()  = m_pcRdCost->calcRdCostVSO( rpcTempCU->getTotalBits(), rpcTempCU->getTotalDistortion() );
     
    29742974  rpcTempCU->getTotalBins() = ((TEncBinCABAC *)((TEncSbac*)m_pcEntropyCoder->m_pcEntropyCoderIf)->getEncBinIf())->getBinsCoded();
    29752975#if NH_3D_VSO // M44
    2976   if ( m_pcRdCost->getUseVSO() )
     2976  if ( m_pcRdCost->getUseLambdaScaleVSO() )
    29772977  {
    29782978    rpcTempCU->getTotalCost() = m_pcRdCost->calcRdCostVSO( rpcTempCU->getTotalBits(), rpcTempCU->getTotalDistortion() );
     
    30473047      pcCU->getTotalBins() += ((TEncBinCABAC *)((TEncSbac*)m_pcEntropyCoder->m_pcEntropyCoderIf)->getEncBinIf())->getBinsCoded();
    30483048#if NH_3D_VSO // M45
    3049       if ( m_pcRdCost->getUseVSO() )     
     3049      if ( m_pcRdCost->getUseLambdaScaleVSO() )     
    30503050      {
    30513051        pcCU->getTotalCost() = m_pcRdCost->calcRdCostVSO( pcCU->getTotalBits(), pcCU->getTotalDistortion() );     
  • trunk/source/Lib/TLibEncoder/TEncSearch.cpp

    r1386 r1396  
    16471647          UInt uiSingleBits = xGetIntraBitsQT( rTu, true, false, false );
    16481648#if NH_3D_VSO // M NEW
    1649           if ( m_pcRdCost->getUseRenModel() )
     1649          if ( m_pcRdCost->getUseLambdaScaleVSO() )
    16501650          {
    16511651            singleCostTmp     = m_pcRdCost->calcRdCostVSO( uiSingleBits, singleDistTmpLuma );
     
    18871887
    18881888#if NH_3D_DIS
    1889 Void TEncSearch::xIntraCodingDIS( TComDataCU* pcCU, UInt uiAbsPartIdx, TComYuv* pcOrgYuv, TComYuv* pcPredYuv, Dist& ruiDist, Double& dRDCost, UInt uiPredMode )
     1889#if NH_3D_VSO
     1890Void TEncSearch::xIntraCodingDIS( TComDataCU* pcCU, UInt uiAbsPartIdx, TComYuv* pcOrgYuv, TComYuv* pcPredYuv, Dist&       ruiDist, Double& dRDCost, UInt uiPredMode )
     1891#else
     1892Void TEncSearch::xIntraCodingDIS( TComDataCU* pcCU, UInt uiAbsPartIdx, TComYuv* pcOrgYuv, TComYuv* pcPredYuv, Distortion& ruiDist, Double& dRDCost, UInt uiPredMode )
     1893#endif
    18901894{
    18911895  UInt    uiWidth           = pcCU     ->getWidth   ( 0 );
     
    19821986#endif
    19831987#if NH_3D_SDC_INTRA
    1984 Void TEncSearch::xIntraCodingSDC( TComDataCU* pcCU, UInt uiAbsPartIdx, TComYuv* pcOrgYuv, TComYuv* pcPredYuv, Dist& ruiDist, Double& dRDCost, Bool bZeroResidual, Int iSDCDeltaResi  )
     1988#if NH_3D_VSO
     1989Void TEncSearch::xIntraCodingSDC( TComDataCU* pcCU, UInt uiAbsPartIdx, TComYuv* pcOrgYuv, TComYuv* pcPredYuv, Dist&       ruiDist, Double& dRDCost, Bool bZeroResidual, Int iSDCDeltaResi  )
     1990#else
     1991Void TEncSearch::xIntraCodingSDC( TComDataCU* pcCU, UInt uiAbsPartIdx, TComYuv* pcOrgYuv, TComYuv* pcPredYuv, Distortion& ruiDist, Double& dRDCost, Bool bZeroResidual, Int iSDCDeltaResi  )
     1992#endif
     1993
     1994
    19851995{
    19861996  UInt uiWidth        = pcCU->getWidth ( 0 );
     
    22152225#endif
    22162226  {
     2227#if NH_3D_FIX_INTRA_SDC_VSO_OFF
     2228    ruiDist = m_pcRdCost->getDistPart( bitDepthY, piPred, uiStride, piOrg, uiStride, uiWidth, uiHeight, COMPONENT_Y );
     2229#else
    22172230    ruiDist = m_pcRdCost->getDistPart( bitDepthY, piPred, uiStride, piOrg, uiStride, uiWidth, uiHeight, COMPONENT_Y, DF_SAD );
     2231#endif
    22182232  }
    22192233
     
    27432757  Pel* piOrg         = pcOrgYuv ->getAddr(COMPONENT_Y, 0, uiWidth );
    27442758  UInt uiStride      = pcPredYuv->getStride(COMPONENT_Y);
    2745 #endif
     2759
    27462760  Dist   uiDist = 0;
    27472761  Double dCost   = 0.0;
     
    27492763  Double  dBestCost   = MAX_DOUBLE;
    27502764  UInt     uiBestDISType = 0;
     2765#else
     2766  Distortion   uiDist = 0;
     2767  Double       dCost   = 0.0;
     2768  Distortion   uiBestDist = 0;
     2769  Double       dBestCost   = MAX_DOUBLE;
     2770  UInt         uiBestDISType = 0;
     2771#endif
    27512772
    27522773  for( UInt uiPredMode = 0; uiPredMode < 4 ; uiPredMode++ )
     
    52325253  {
    52335254    rcMv = *pcMvPred;
     5255#if NH_MV_FIX_VERT_MV_REST
     5256    if ( m_vertRestriction )
     5257    {
     5258      if (rcMv.getVer() > cMvSrchRngRB.getVer()<<2)
     5259      {
     5260        rcMv.setVer(cMvSrchRngRB.getVer()<<2);
     5261      }
     5262    }
     5263#endif
    52345264    const TComMv *pIntegerMv2Nx2NPred=0;
    52355265    if (pcCU->getPartitionSize(0) != SIZE_2Nx2N || pcCU->getDepth(0) != 0)
     
    63166346  }
    63176347
    6318   Dist ruiDist;
     6348#if NH_3D_VSO
     6349    Dist ruiDist;
     6350#else
     6351    Distortion ruiDist;
     6352#endif
    63196353  Double rdCost;
    63206354#if NH_3D_VSO // M13
     
    67876821
    67886822#if NH_3D_VSO // M NEW01
    6789                if ( m_pcRdCost->getUseRenModel() )
     6823               if ( m_pcRdCost->getUseLambdaScaleVSO() )
    67906824               {
    67916825                 currCompCost = m_pcRdCost->calcRdCostVSO(currCompBits, currCompDist);
     
    69556989
    69566990#if NH_3D_VSO
    6957     if ( m_pcRdCost->getUseRenModel() )
     6991    if ( m_pcRdCost->getUseLambdaScaleVSO() )
    69586992    {
    69596993      dSingleCost = m_pcRdCost->calcRdCostVSO( uiSingleBits, uiSingleDist );
     
    78987932
    78997933  // coarse wedge search
    7900   Dist uiBestDist   = RDO_DIST_MAX;
     7934#if NH_3D_VSO
     7935  Dist       uiBestDist   = RDO_DIST_MAX;
     7936#else
     7937  Distortion uiBestDist   = RDO_DIST_MAX;
     7938#endif
    79017939  UInt uiBestNodeId = 0;
    79027940  for( UInt uiNodeId = 0; uiNodeId < pacWedgeNodeList->size(); uiNodeId++ )
     
    79087946    assignBiSegDCs( piPred, uiPredStride, pbPattern, uiStride, refDC1, refDC2 );
    79097947
     7948#if !NH_3D_VSO
     7949    Distortion uiActDist = RDO_DIST_MAX;
     7950#else
    79107951    Dist uiActDist = RDO_DIST_MAX;
    7911 #if NH_3D_VSO
     7952
    79127953    if( m_pcRdCost->getUseVSO() )
    79137954    {
     
    79357976
    79367977  // refinement
     7978#if NH_3D_VSO
    79377979  Dist uiBestDistRef = uiBestDist;
     7980#else
     7981  Distortion uiBestDistRef = uiBestDist;
     7982#endif
    79387983  UInt uiBestTabIdxRef  = pacWedgeNodeList->at(uiBestNodeId).getPatternIdx();
    79397984  for( UInt uiRefId = 0; uiRefId < DMM_NUM_WEDGE_REFINES; uiRefId++ )
     
    79467991      xCalcBiSegDCs  ( piRef,  uiRefStride,  pbPattern, uiStride, refDC1, refDC2, (1<<(bitDepthY-1)) );
    79477992      assignBiSegDCs( piPred, uiPredStride, pbPattern, uiStride, refDC1, refDC2 );
     7993
     7994#if !NH_3D_VSO
     7995      Distortion uiActDist = RDO_DIST_MAX;
     7996#else
    79487997      Dist uiActDist = RDO_DIST_MAX;
    7949 #if NH_3D_VSO
    79507998      if( m_pcRdCost->getUseVSO() )
    79517999      {
  • trunk/source/Lib/TLibEncoder/TEncSearch.h

    r1386 r1396  
    343343  Void  xLoadIntraResultQT        ( const ComponentID compID, TComTU &rTu);
    344344#if NH_3D_DIS
    345   Void xIntraCodingDIS           ( TComDataCU* pcCU, UInt uiAbsPartIdx, TComYuv* pcOrgYuv, TComYuv* pcPredYuv, Dist& ruiDist, Double& dRDCost, UInt uiPredMode );
     345#if NH_3D_VSO
     346  Void xIntraCodingDIS           ( TComDataCU* pcCU, UInt uiAbsPartIdx, TComYuv* pcOrgYuv, TComYuv* pcPredYuv, Dist&       ruiDist, Double& dRDCost, UInt uiPredMode );
     347#else
     348  Void xIntraCodingDIS           ( TComDataCU* pcCU, UInt uiAbsPartIdx, TComYuv* pcOrgYuv, TComYuv* pcPredYuv, Distortion& ruiDist, Double& dRDCost, UInt uiPredMode );
     349#endif
    346350#endif
    347351
     
    356360#endif
    357361#if NH_3D_SDC_INTRA
    358   Void xIntraCodingSDC            ( TComDataCU* pcCU, UInt uiAbsPartIdx, TComYuv* pcOrgYuv, TComYuv* pcPredYuv, Dist& ruiDist, Double& dRDCost, Bool bZeroResidual, Int iSDCDeltaResi    );
     362#if NH_3D_VSO
     363  Void xIntraCodingSDC            ( TComDataCU* pcCU, UInt uiAbsPartIdx, TComYuv* pcOrgYuv, TComYuv* pcPredYuv, Dist& ruiDist      , Double& dRDCost, Bool bZeroResidual, Int iSDCDeltaResi    );
     364#else
     365  Void xIntraCodingSDC            ( TComDataCU* pcCU, UInt uiAbsPartIdx, TComYuv* pcOrgYuv, TComYuv* pcPredYuv, Distortion& ruiDist, Double& dRDCost, Bool bZeroResidual, Int iSDCDeltaResi    );
     366#endif
    359367  Void xCalcConstantSDC           ( Pel* ptrSrc, UInt srcStride, UInt uiSize, Pel& valDC );
    360368#endif
  • trunk/source/Lib/TLibEncoder/TEncSlice.cpp

    r1386 r1396  
    461461
    462462#if NH_3D_VSO
    463   m_pcRdCost->setUseLambdaScaleVSO  ( (m_pcCfg->getUseVSO() ||  m_pcCfg->getForceLambdaScaleVSO()) && ( m_pcCfg->getIsDepth()  | m_pcCfg->getIsAuxDepth() ) );
     463  m_pcRdCost->setUseLambdaScaleVSO  ( (m_pcCfg->getUseVSO() ||  m_pcCfg->getForceLambdaScaleVSO()) && ( m_pcCfg->getIsDepth() || m_pcCfg->getIsAuxDepth() ) );
    464464  m_pcRdCost->setLambdaVSO          ( dLambda * m_pcCfg->getLambdaScaleVSO() );
    465465
  • trunk/source/Lib/TLibEncoder/TEncTop.cpp

    r1386 r1396  
    9191TEncTop::~TEncTop()
    9292{
     93#if NH_3D_FIX_LEAK
     94#if NH_3D_IC
     95  if ( m_aICEnableCandidate != NULL )
     96  {
     97    delete[] m_aICEnableCandidate;
     98  }
     99
     100  if ( m_aICEnableNum != NULL )
     101  {
     102    delete[] m_aICEnableNum;
     103  }
     104#endif
     105
     106#endif
    93107#if ENC_DEC_TRACE
    94108  if (g_hTrace != stdout)
     
    16521666    }
    16531667
    1654     rendererModel->setSingleModel( iModelNum, ppiShiftLUTLeft, ppiBaseShiftLUTLeft, ppiShiftLUTRight, ppiBaseShiftLUTRight, iDistToLeft, pcPicYuvOrgRef );
     1668    rendererModel->setSingleModel( iModelNum, ppiShiftLUTLeft, ppiBaseShiftLUTLeft, ppiShiftLUTRight, ppiBaseShiftLUTRight, iDistToLeft, pcPicYuvOrgRef, iEncViewSIdx );
    16551669  }
    16561670}
  • trunk/source/Lib/TLibRenderer/TRenFilter.cpp

    r1386 r1396  
    3636#include "TRenFilter.h"
    3737#include "TRenInterpFilter.h"
    38 #if NH_3D_VSO
     38#if NH_3D_VSO  || NH_3D
    3939
    4040///// COMMON /////
  • trunk/source/Lib/TLibRenderer/TRenFilter.h

    r1386 r1396  
    3939#include "TRenImage.h"
    4040#include "TRenInterpFilter.h"
    41 #if NH_3D_VSO
     41#if NH_3D_VSO  || NH_3D
    4242
    4343typedef Int (TRenInterpFilter<REN_BIT_DEPTH>::*FpChromaIntFilt) ( Pel*, Int );
  • trunk/source/Lib/TLibRenderer/TRenImage.h

    r1386 r1396  
    3939#include "../TLibCommon/TComPicYuv.h"
    4040#include "TRenImagePlane.h"
    41 #if NH_3D_VSO
     41#if NH_3D_VSO  || NH_3D
    4242
    4343
  • trunk/source/Lib/TLibRenderer/TRenImagePlane.cpp

    r1386 r1396  
    3636#include "TRenFilter.h"
    3737#include <string.h>
    38 #if NH_3D_VSO
     38#if NH_3D_VSO  || NH_3D
    3939
    4040/////// TRenImagePlane ///////
  • trunk/source/Lib/TLibRenderer/TRenImagePlane.h

    r1386 r1396  
    3939#include "../TLibCommon/TComPicYuv.h"
    4040
    41 #if NH_3D_VSO
     41#if NH_3D_VSO  || NH_3D
    4242#define PelImagePlane     TRenImagePlane<Pel>
    4343#define DoubleImagePlane  TRenImagePlane<Double>
  • trunk/source/Lib/TLibRenderer/TRenInterpFilter.cpp

    r1386 r1396  
    3939
    4040#include "TRenInterpFilter.h"
    41 #if NH_3D_VSO
     41#if NH_3D_VSO  || NH_3D
    4242
    4343// ====================================================================================================================
  • trunk/source/Lib/TLibRenderer/TRenInterpFilter.h

    r1386 r1396  
    4444#include "TLibCommon/CommonDef.h"
    4545#include "assert.h"
    46 #if NH_3D_VSO
     46#if NH_3D_VSO  || NH_3D
    4747
    4848// ====================================================================================================================
  • trunk/source/Lib/TLibRenderer/TRenModel.cpp

    r1313 r1396  
    216216Void
    217217#if H_3D_VSO_EARLY_SKIP
    218 TRenModel::create( Int iNumOfBaseViews, Int iNumOfModels, Int iWidth, Int iHeight, Int iShiftPrec, Int iHoleMargin, Bool bEarlySkip )
     218TRenModel::create( Int iNumOfBaseViews, Int iNumOfModels, Int iWidth, Int iHeight, Int iShiftPrec, Int iHoleMargin, Bool bLimOutput, Bool bEarlySkip )
    219219#else
    220 TRenModel::create( Int iNumOfBaseViews, Int iNumOfModels, Int iWidth, Int iHeight, Int iShiftPrec, Int iHoleMargin )
    221 #endif
    222 {
     220TRenModel::create( Int iNumOfBaseViews, Int iNumOfModels, Int iWidth, Int iHeight, Int iShiftPrec, Int iHoleMargin, Bool bLimOutput )
     221#endif
     222{
     223  m_bLimOutput          = bLimOutput;
     224
    223225  m_iNumOfBaseViews     = iNumOfBaseViews;
    224226  m_iNumOfRenModels     = iNumOfModels;
     
    416418
    417419#if H_3D_VSO_EARLY_SKIP
    418   m_apcRenModels[iModelNum]->create( iMode ,m_iWidth, m_iHeight, m_iShiftPrec, m_aaaiSubPelShiftLut, m_iHoleMargin,  bUseOrgRef, iBlendMode, m_bEarlySkip );
     420#if RM_INIT_FIX
     421  m_apcRenModels[iModelNum]->create( iMode ,m_iWidth, m_iHeight, m_iShiftPrec, m_aaaiSubPelShiftLut, m_iHoleMargin,  bUseOrgRef, ( iMode != 2 )  ? BLEND_NONE : iBlendMode , m_bLimOutput, m_bEarlySkip );
    419422#else
    420   m_apcRenModels[iModelNum]->create( iMode ,m_iWidth, m_iHeight, m_iShiftPrec, m_aaaiSubPelShiftLut, m_iHoleMargin,  bUseOrgRef, iBlendMode );
     423  m_apcRenModels[iModelNum]->create( iMode ,m_iWidth, m_iHeight, m_iShiftPrec, m_aaaiSubPelShiftLut, m_iHoleMargin,  bUseOrgRef, iBlendMode, m_bLimOutput, m_bEarlySkip );
     424#endif
     425
     426#else
     427
     428#if RM_INIT_FIX
     429  m_apcRenModels[iModelNum]->create( iMode ,m_iWidth, m_iHeight, m_iShiftPrec, m_aaaiSubPelShiftLut, m_iHoleMargin,  bUseOrgRef, ( iMode != 2 )  ? BLEND_NONE : iBlendMode, m_bLimOutput );
     430#else
     431  m_apcRenModels[iModelNum]->create( iMode ,m_iWidth, m_iHeight, m_iShiftPrec, m_aaaiSubPelShiftLut, m_iHoleMargin,  bUseOrgRef, iBlendMode, m_bLimOutput );
     432#endif
    421433#endif
    422434
     
    470482
    471483Void
    472 TRenModel::setSingleModel( Int iModelNum, Int** ppiShiftLutLeft, Int** ppiBaseShiftLutLeft, Int** ppiShiftLutRight, Int** ppiBaseShiftLutRight, Int iDistToLeft, TComPicYuv* pcPicYuvRefView )
     484TRenModel::setSingleModel( Int iModelNum, Int** ppiShiftLutLeft, Int** ppiBaseShiftLutLeft, Int** ppiShiftLutRight, Int** ppiBaseShiftLutRight, Int iDistToLeft, TComPicYuv* pcPicYuvRefView, Int iEncViewSIdx)
    473485{
    474486  AOT( iModelNum < 0 || iModelNum > m_iNumOfRenModels );
     
    486498    if ( m_aaeBaseViewPosInModel[iBaseViewIdx][iModelNum] != VIEWPOS_INVALID )
    487499    {
    488       bAnyRefFromOrg = true;
    489500      m_apcRenModels[iModelNum]->setLRView( m_aaeBaseViewPosInModel[iBaseViewIdx][iModelNum],
    490501        ( bSetupFromOrgVideo ? m_aapiOrgVideoPel   : m_aapiCurVideoPel   ) [iBaseViewIdx],
     
    495506  }
    496507
    497   m_apcRenModels[iModelNum]->setup     ( pcPicYuvRefView, ppiShiftLutLeft, ppiBaseShiftLutLeft, ppiShiftLutRight, ppiBaseShiftLutRight, iDistToLeft, false );
    498 
    499   // Setup to Org
    500   if ( bAnyRefFromOrg )
    501   {
    502     // Restore old values
     508  // Render
     509#if !RM_FIX_SETUP
     510  m_apcRenModels[iModelNum]->setupLutAndRef(  pcPicYuvRefView, ppiShiftLutLeft, ppiBaseShiftLutLeft, ppiShiftLutRight, ppiBaseShiftLutRight, iDistToLeft, bAnyRefFromOrg );
     511
     512  // Setup with actual data 
    503513    for (Int iBaseViewIdx = 0; iBaseViewIdx < m_iNumOfBaseViews; iBaseViewIdx++ )
    504514    {
     
    514524      }
    515525    }
    516 
    517     // setup keeping reference rendered from original data
    518     m_apcRenModels[iModelNum]->setup     ( pcPicYuvRefView, ppiShiftLutLeft, ppiBaseShiftLutLeft, ppiShiftLutRight, ppiBaseShiftLutRight, iDistToLeft, true );
    519   }
     526  // Render initial state
     527  AOT( m_bLimOutput && m_aaeBaseViewPosInModel[ iEncViewSIdx ][iModelNum] == VIEWPOS_INVALID );
     528  m_apcRenModels[iModelNum]->setupInitialState( m_bLimOutput ? m_aaeBaseViewPosInModel[ iEncViewSIdx ][iModelNum] : VIEWPOS_INVALID ); 
     529
     530#else
     531  m_apcRenModels[iModelNum]->setupLut(  ppiShiftLutLeft, ppiBaseShiftLutLeft, ppiShiftLutRight, ppiBaseShiftLutRight, iDistToLeft );
     532 
     533  // Copy yuv to reference if given.
     534  AOT( pcPicYuvRefView != NULL && bAnyRefFromOrg );
     535 
     536  if (pcPicYuvRefView )
     537  {
     538    m_apcRenModels[iModelNum]->setupRefView( pcPicYuvRefView );
     539  }
     540
     541  m_apcRenModels[iModelNum]->renderAll( );
     542
     543  // pcPicYuvRefView != NULL &&  bAnyRefFromOrg --> invalid combination
     544  // pcPicYuvRefView != NULL && !bAnyRefFromOrg --> distortion correct; reference view correct; current view correct
     545  // pcPicYuvRefView == NULL &&  bAnyRefFromOrg --> distortion TBD    ; reference view TBD    ; current view TBD
     546  // pcPicYuvRefView == NULL && !bAnyRefFromOrg --> distortion TBD    ; reference view TBD    ; current view correct
     547
     548  if ( pcPicYuvRefView == NULL )
     549  {
     550    // Update reference view
     551    m_apcRenModels[iModelNum]->setStructSynthViewAsRefView(); 
     552
     553    // pcPicYuvRefView != NULL &&  bAnyRefFromOrg --> invalid combination
     554    // pcPicYuvRefView != NULL && !bAnyRefFromOrg --> distortion correct; reference view correct; current view correct
     555    // pcPicYuvRefView == NULL &&  bAnyRefFromOrg --> distortion TBD    ; reference view correct; current view TBD
     556    // pcPicYuvRefView == NULL && !bAnyRefFromOrg --> distortion TBD    ; reference view correct; current view correct
     557
     558    if ( bAnyRefFromOrg )
     559    {   
     560      // Update current view and distortion
     561      for (Int iBaseViewIdx = 0; iBaseViewIdx < m_iNumOfBaseViews; iBaseViewIdx++ )
     562      {
     563        if ( m_aaeBaseViewPosInModel[iBaseViewIdx][iModelNum] != VIEWPOS_INVALID )
     564        {
     565          m_apcRenModels[iModelNum]->setLRView(
     566            m_aaeBaseViewPosInModel[iBaseViewIdx][iModelNum],
     567            m_aapiCurVideoPel      [iBaseViewIdx],
     568            m_aaiCurVideoStrides   [iBaseViewIdx],
     569            m_apiCurDepthPel       [iBaseViewIdx],
     570            m_aiCurDepthStrides    [iBaseViewIdx]
     571          );
     572        }
     573      }
     574      m_apcRenModels[iModelNum]->renderAll( );
     575    }
     576    else
     577    {
     578      // Update to distortion
     579      m_apcRenModels[iModelNum]->resetStructError();
     580    }
     581  }     
     582
     583  if ( m_bLimOutput )
     584  {
     585    AOT( m_aaeBaseViewPosInModel[ iEncViewSIdx ][iModelNum] == VIEWPOS_INVALID );
     586    Int curViewPosInModel = m_aaeBaseViewPosInModel[ iEncViewSIdx ][iModelNum];   
     587    m_apcRenModels[iModelNum]->setLimOutStruct( (curViewPosInModel == VIEWPOS_RIGHT)  ? VIEWPOS_LEFT : VIEWPOS_RIGHT );
     588  } 
     589#endif
    520590}
    521591
     
    549619TRenModel::setupPart ( UInt uiHorOff, Int iUsedHeight )
    550620{
    551   AOT( iUsedHeight > m_iHeight );     
     621//  AOT( iUsedHeight > m_iHeight );     
    552622  m_uiHorOff    = uiHorOff;
    553623  m_iUsedHeight = iUsedHeight;
     
    589659    }
    590660  }
    591 
    592   return ( iDist + (m_iNumOfCurRenModels >> 1) ) / m_iNumOfCurRenModels;
     661  return m_iNumOfCurRenModels > 0 ? ( iDist + (m_iNumOfCurRenModels >> 1) ) / m_iNumOfCurRenModels : 0;
    593662}
    594663
  • trunk/source/Lib/TLibRenderer/TRenModel.h

    r1313 r1396  
    5353  // Creation
    5454#if H_3D_VSO_EARLY_SKIP
    55   Void  create           ( Int iNumOfBaseViews, Int iNumOfModels, Int iWidth, Int iHeight, Int iShiftPrec, Int iHoleMargin, Bool bEarlySkip );
     55  Void  create           ( Int iNumOfBaseViews, Int iNumOfModels, Int iWidth, Int iHeight, Int iShiftPrec, Int iHoleMargin, Bool bLimOutput, Bool bEarlySkip );
    5656#else
    57   Void  create           ( Int iNumOfBaseViews, Int iNumOfModels, Int iWidth, Int iHeight, Int iShiftPrec, Int iHoleMargin );
     57  Void  create           ( Int iNumOfBaseViews, Int iNumOfModels, Int iWidth, Int iHeight, Int iShiftPrec, Int iHoleMargin, Bool bLimOutput );
    5858#endif
    5959  Void  createSingleModel( Int iBaseViewNum, Int iContent, Int iModelNum, Int iLeftViewNum, Int iRightViewNum, Bool bUseOrgRef, Int iBlendMode );
     
    6161  // Set new Frame
    6262  Void  setBaseView      ( Int iViewNum, TComPicYuv* pcPicYuvVideoData, TComPicYuv* pcPicYuvDepthData, TComPicYuv* pcPicYuvOrgVideoData, TComPicYuv* pcPicYuvOrgDepthData  );
    63   Void  setSingleModel   ( Int iModelNum, Int** ppiShiftLutLeft, Int** ppiBaseShiftLutLeft, Int** ppiShiftLutRight, Int** ppiBaseShiftLutRight, Int iDistToLeft, TComPicYuv* pcPicYuvRefView );
     63  Void  setSingleModel   ( Int iModelNum, Int** ppiShiftLutLeft, Int** ppiBaseShiftLutLeft, Int** ppiShiftLutRight, Int** ppiBaseShiftLutRight, Int iDistToLeft, TComPicYuv* pcPicYuvRefView, Int curViewIdx = VIEWPOS_INVALID );
    6464
    6565  // Set horizontal offset
     
    9696  Bool   m_bEarlySkip;
    9797#endif
     98  Bool   m_bLimOutput;
    9899
    99100  /// Size of Video and Depth
  • trunk/source/Lib/TLibRenderer/TRenSingleModel.cpp

    r1313 r1396  
    5656
    5757  m_pcOutputSamples      = NULL;
    58   m_pcOutputSamplesRow   = NULL;  
     58  m_pcOutputSamplesRow   = NULL;
    5959  m_iOutputSamplesStride = -1;
    6060
     
    106106  if ( m_pcOutputSamples    ) delete[] m_pcOutputSamples   ;
    107107
    108   if ( m_piInvZLUTLeft  ) delete[] m_piInvZLUTLeft ;
    109   if ( m_piInvZLUTRight ) delete[] m_piInvZLUTRight;
     108  if ( m_piInvZLUTLeft      ) delete[] m_piInvZLUTLeft ;
     109  if ( m_piInvZLUTRight     ) delete[] m_piInvZLUTRight;
    110110
    111111  if ( m_aapiRefVideoPel[0] ) delete[] ( m_aapiRefVideoPel[0] - ( m_aiRefVideoStrides[0] * m_iPad + m_iPad ) );
     
    116116template <BlenMod iBM, Bool bBitInc> Void
    117117#if H_3D_VSO_EARLY_SKIP
    118 TRenSingleModelC<iBM,bBitInc>::create( Int iMode, Int iWidth, Int iHeight, Int iShiftPrec, Int*** aaaiSubPelShiftTable, Int iHoleMargin, Bool bUseOrgRef, Int iBlendMode, Bool bEarlySkip )
    119 #else
    120 TRenSingleModelC<iBM,bBitInc>::create( Int iMode, Int iWidth, Int iHeight, Int iShiftPrec, Int*** aaaiSubPelShiftTable, Int iHoleMargin, Bool bUseOrgRef, Int iBlendMode )
    121 #endif
    122 
    123 {
     118TRenSingleModelC<iBM,bBitInc>::create( Int iMode, Int iWidth, Int iHeight, Int iShiftPrec, Int*** aaaiSubPelShiftTable, Int iHoleMargin, Bool bUseOrgRef, Int iBlendMode, Bool bLimOutput, Bool bEarlySkip )
     119#else
     120TRenSingleModelC<iBM,bBitInc>::create( Int iMode, Int iWidth, Int iHeight, Int iShiftPrec, Int*** aaaiSubPelShiftTable, Int iHoleMargin, Bool bUseOrgRef, Int iBlendMode, Bool bLimOutput )
     121#endif
     122
     123{
     124  m_bLimOutput = bLimOutput;
    124125#if H_3D_VSO_EARLY_SKIP
    125126  m_pbHorSkip     = new Bool [MAX_CU_SIZE];
     
    127128#endif
    128129
    129   AOF( iBlendMode == iBM );
    130 
     130  AOF( ( iBlendMode == iBM ) || ( iBM == BLEND_NONE ) );
    131131  m_iMode = iMode;
    132132
     
    171171  m_pcInputSamples[1]     = new RenModelInPels[m_iInputSamplesStride*m_iHeight];
    172172
    173   m_pcOutputSamples       = new RenModelOutPels[m_iOutputSamplesStride*m_iHeight]; 
     173  m_pcOutputSamples       = new RenModelOutPels   [m_iOutputSamplesStride*m_iHeight];
     174  m_pcLimOutputSamples    = m_bLimOutput ? new RenModelLimOutPels[m_iOutputSamplesStride*m_iHeight] : NULL;
    174175}
    175176
     
    244245}
    245246
    246 template <BlenMod iBM, Bool bBitInc> Void
    247 TRenSingleModelC<iBM,bBitInc>::setup( TComPicYuv* pcOrgVideo, Int** ppiShiftLutLeft, Int** ppiBaseShiftLutLeft, Int** ppiShiftLutRight,  Int** ppiBaseShiftLutRight,  Int iDistToLeft, Bool bKeepReference )
    248 {
     247
     248#if !RM_FIX_SETUP
     249template <BlenMod iBM, Bool bBitInc> Void
     250  TRenSingleModelC<iBM,bBitInc>::setupInitialState( Int curViewPosInModel )
     251{
     252  xRenderAll( );
     253
     254  if ( m_bLimOutput )
     255  {
     256    AOT( curViewPosInModel == VIEWPOS_INVALID )
     257    xSetLimOutStruct( (curViewPosInModel == VIEWPOS_RIGHT)  ? VIEWPOS_LEFT : VIEWPOS_RIGHT );
     258  }
     259}
     260#endif
     261
     262#if RM_FIX_SETUP
     263template <BlenMod iBM, Bool bBitInc> Void
     264  TRenSingleModelC<iBM,bBitInc>::setupRefView      ( TComPicYuv* pcOrgVideo )
     265{
     266  m_pcPicYuvRef = pcOrgVideo;
     267  // Use provided ref view reference
     268 
     269  TRenFilter<REN_BIT_DEPTH>::copy(             pcOrgVideo->getAddr( COMPONENT_Y  ) +  m_iHorOffset       * pcOrgVideo->getStride( COMPONENT_Y  ), pcOrgVideo->getStride( COMPONENT_Y  ), m_iWidth,      m_iUsedHeight,      m_aapiRefVideoPel[0], m_aiRefVideoStrides[0]);
     270  switch ( pcOrgVideo->getChromaFormat() )
     271  {
     272  case CHROMA_420:
     273    TRenFilter<REN_BIT_DEPTH>::sampleCUpHorUp(0, pcOrgVideo->getAddr( COMPONENT_Cb ) + (m_iHorOffset >> 1) * pcOrgVideo->getStride( COMPONENT_Cb ), pcOrgVideo->getStride( COMPONENT_Cb ), m_iWidth >> 1, m_iUsedHeight >> 1, m_aapiRefVideoPel[1], m_aiRefVideoStrides[1]);
     274    TRenFilter<REN_BIT_DEPTH>::sampleCUpHorUp(0, pcOrgVideo->getAddr( COMPONENT_Cr ) + (m_iHorOffset >> 1) * pcOrgVideo->getStride( COMPONENT_Cr ), pcOrgVideo->getStride( COMPONENT_Cr ), m_iWidth >> 1, m_iUsedHeight >> 1, m_aapiRefVideoPel[2], m_aiRefVideoStrides[2]);
     275    break;
     276  case CHROMA_444:
     277    TRenFilter<REN_BIT_DEPTH>::copy(             pcOrgVideo->getAddr( COMPONENT_Cb  ) +  m_iHorOffset       * pcOrgVideo->getStride( COMPONENT_Cb  ), pcOrgVideo->getStride( COMPONENT_Cb  ), m_iWidth,      m_iUsedHeight,      m_aapiRefVideoPel[1], m_aiRefVideoStrides[1]);
     278    TRenFilter<REN_BIT_DEPTH>::copy(             pcOrgVideo->getAddr( COMPONENT_Cr  ) +  m_iHorOffset       * pcOrgVideo->getStride( COMPONENT_Cr  ), pcOrgVideo->getStride( COMPONENT_Cr  ), m_iWidth,      m_iUsedHeight,      m_aapiRefVideoPel[2], m_aiRefVideoStrides[2]);
     279    break;
     280  default:
     281    break;
     282  }
     283  xSetStructRefView();
     284}
     285
     286
     287template <BlenMod iBM, Bool bBitInc> Void
     288  TRenSingleModelC<iBM,bBitInc>::setupLut( Int** ppiShiftLutLeft, Int** ppiBaseShiftLutLeft, Int** ppiShiftLutRight,  Int** ppiBaseShiftLutRight,  Int iDistToLeft )
     289#else
     290template <BlenMod iBM, Bool bBitInc> Void
     291  TRenSingleModelC<iBM,bBitInc>::setupLutAndRef( TComPicYuv* pcOrgVideo, Int** ppiShiftLutLeft, Int** ppiBaseShiftLutLeft, Int** ppiShiftLutRight,  Int** ppiBaseShiftLutRight,  Int iDistToLeft, Bool bRenderRef )
     292#endif
     293{
     294#if !RM_FIX_SETUP
    249295  AOT( !m_bUseOrgRef && pcOrgVideo );
     296#endif
    250297  AOT( (ppiShiftLutLeft  == NULL) && (m_iMode == 0 || m_iMode == 2) );
    251298  AOT( (ppiShiftLutRight == NULL) && (m_iMode == 1 || m_iMode == 2) );
     
    254301  m_appiShiftLut[1] = ppiShiftLutRight;
    255302
     303
     304  if ( m_iMode == 2 )
     305  {
     306    TRenFilter<REN_BIT_DEPTH>::setupZLUT( true, 30, iDistToLeft, ppiBaseShiftLutLeft, ppiBaseShiftLutRight, m_iBlendZThres, m_iBlendDistWeight, m_piInvZLUTLeft, m_piInvZLUTRight );
     307  }
     308
     309#if !RM_FIX_SETUP
    256310  // Copy Reference
    257311  m_pcPicYuvRef = pcOrgVideo;
    258312
    259   if ( pcOrgVideo && !bKeepReference )
    260   {
    261     assert( pcOrgVideo->getChromaFormat() != CHROMA_420 );     
     313  if ( pcOrgVideo )
     314  {
     315    assert( pcOrgVideo->getChromaFormat() == CHROMA_420 );     
    262316
    263317    TRenFilter<REN_BIT_DEPTH>::copy(             pcOrgVideo->getAddr( COMPONENT_Y  ) +  m_iHorOffset       * pcOrgVideo->getStride( COMPONENT_Y  ), pcOrgVideo->getStride( COMPONENT_Y  ), m_iWidth,      m_iUsedHeight,      m_aapiRefVideoPel[0], m_aiRefVideoStrides[0]);
     
    266320    xSetStructRefView();
    267321  }
    268 
     322  else
     323  {
     324    if ( bRenderRef )
     325    {   
     326      xRenderAll( );
     327      xSetStructSynthViewAsRefView();
     328    }
     329  }
     330#endif
     331}
     332
     333template <BlenMod iBM, Bool bBitInc> Void
     334#if RM_FIX_SETUP
     335TRenSingleModelC<iBM,bBitInc>::renderAll( )
     336#else
     337TRenSingleModelC<iBM,bBitInc>::xRenderAll( )
     338#endif
     339{
    269340  // Initial Rendering
     341#if RM_FIX_SETUP
     342  resetStructError();
     343#else
    270344  xResetStructError();
     345#endif
    271346  xInitSampleStructs();
    272347  switch ( m_iMode )
     
    274349  case 0:   
    275350#if H_3D_VSO_EARLY_SKIP
    276     xRenderL<true>( 0, 0, m_iWidth, m_iUsedHeight, m_aiBaseDepthStrides[0], m_apiBaseDepthPel[0],false );
    277 #else
    278     xRenderL<true>( 0, 0, m_iWidth, m_iUsedHeight, m_aiBaseDepthStrides[0], m_apiBaseDepthPel[0] );
     351    xRender<true, SET_FULL>( 0, 0, m_iWidth, m_iUsedHeight, m_aiBaseDepthStrides[0], m_apiBaseDepthPel[0],false );
     352#else
     353    xRender<true, SET_FULL>( 0, 0, m_iWidth, m_iUsedHeight, m_aiBaseDepthStrides[0], m_apiBaseDepthPel[0] );
    279354#endif   
    280355    break;
    281356  case 1:   
    282357#if H_3D_VSO_EARLY_SKIP
    283     xRenderR<true>( 0, 0, m_iWidth, m_iUsedHeight, m_aiBaseDepthStrides[1], m_apiBaseDepthPel[1],false);
    284 #else
    285     xRenderR<true>( 0, 0, m_iWidth, m_iUsedHeight, m_aiBaseDepthStrides[1], m_apiBaseDepthPel[1] );
     358    xRender<false, SET_FULL>( 0, 0, m_iWidth, m_iUsedHeight, m_aiBaseDepthStrides[1], m_apiBaseDepthPel[1],false);
     359#else
     360    xRender<false, SET_FULL>( 0, 0, m_iWidth, m_iUsedHeight, m_aiBaseDepthStrides[1], m_apiBaseDepthPel[1] );
    286361#endif
    287362    break;
    288363  case 2:
    289     TRenFilter<REN_BIT_DEPTH>::setupZLUT( true, 30, iDistToLeft, ppiBaseShiftLutLeft, ppiBaseShiftLutRight, m_iBlendZThres, m_iBlendDistWeight, m_piInvZLUTLeft, m_piInvZLUTRight );
    290 #if H_3D_VSO_EARLY_SKIP
    291     xRenderL<true>( 0, 0, m_iWidth, m_iUsedHeight, m_aiBaseDepthStrides[0], m_apiBaseDepthPel[0],false);
    292     xRenderR<true>( 0, 0, m_iWidth, m_iUsedHeight, m_aiBaseDepthStrides[1], m_apiBaseDepthPel[1],false);
     364#if H_3D_VSO_EARLY_SKIP
     365    xRender<true , SET_FULL>( 0, 0, m_iWidth, m_iUsedHeight, m_aiBaseDepthStrides[0], m_apiBaseDepthPel[0],false);
     366    xRender<false, SET_FULL>( 0, 0, m_iWidth, m_iUsedHeight, m_aiBaseDepthStrides[1], m_apiBaseDepthPel[1],false);
    293367#else     
    294     xRenderL<true>( 0, 0, m_iWidth, m_iUsedHeight, m_aiBaseDepthStrides[0], m_apiBaseDepthPel[0] );
    295     xRenderR<true>( 0, 0, m_iWidth, m_iUsedHeight, m_aiBaseDepthStrides[1], m_apiBaseDepthPel[1] );
     368    xRender<true,  SET_FULL>( 0, 0, m_iWidth, m_iUsedHeight, m_aiBaseDepthStrides[0], m_apiBaseDepthPel[0] );
     369    xRender<false, SET_FULL>( 0, 0, m_iWidth, m_iUsedHeight, m_aiBaseDepthStrides[1], m_apiBaseDepthPel[1] );
    296370#endif
    297371    break;
     
    299373    AOT(true);
    300374  }
    301 
    302   // Get Rendered View as Reference
    303   if ( !pcOrgVideo && !bKeepReference )
    304   {
    305     xResetStructError();
    306     xSetStructSynthViewAsRefView();
    307   }
    308375}
    309376
     
    317384  switch ( iViewNum )
    318385  {
     386
     387  case -1: 
     388    rpiSrcY = &RenModelOutPels::iYRef;
     389#if H_3D_VSO_COLOR_PLANES 
     390    rpiSrcU = &RenModelOutPels::iURef;
     391    rpiSrcV = &RenModelOutPels::iVRef;
     392#endif
     393    break;
    319394  case 0:
    320395    rpiSrcY = &RenModelOutPels::iYLeft;
     
    349424}
    350425
     426template <BlenMod iBM, Bool bBitInc> Void
     427  TRenSingleModelC<iBM,bBitInc>::xGetSampleStrFilledPtrs( Int iViewNum, Int RenModelOutPels::*& rpiSrcFilled )
     428{
     429  AOT(iViewNum != 0 && iViewNum != 1); 
     430  rpiSrcFilled = (iViewNum == 1) ? &RenModelOutPels::iFilledRight : &RenModelOutPels::iFilledLeft;
     431}
     432
    351433
    352434template <BlenMod iBM, Bool bBitInc> Void
     
    383465
    384466template <BlenMod iBM, Bool bBitInc> Void
     467#if RM_FIX_SETUP
     468TRenSingleModelC<iBM,bBitInc>::resetStructError( )
     469#else
    385470TRenSingleModelC<iBM,bBitInc>::xResetStructError( )
     471#endif
    386472{
    387473  RenModelOutPels* pcCurOutSampleRow = m_pcOutputSamples;
     
    398484
    399485template <BlenMod iBM, Bool bBitInc> Void
     486#if RM_FIX_SETUP
     487  TRenSingleModelC<iBM,bBitInc>::setLimOutStruct(Int iSourceViewPos )
     488#else
     489  TRenSingleModelC<iBM,bBitInc>::xSetLimOutStruct(Int iSourceViewPos )
     490#endif
     491
     492  RM_AOF( m_bLimOutput );
     493  RM_AOT( iSourceViewPos < 0 || iSourceViewPos > 1);
     494
     495  RenModelOutPels*    pcCurOutSampleRow    = m_pcOutputSamples;
     496  RenModelLimOutPels* pcCurLimOutSampleRow = m_pcLimOutputSamples;
     497
     498  Int RenModelOutPels::* piFilled = NULL;
     499  xGetSampleStrFilledPtrs( iSourceViewPos, piFilled );
     500 
     501  Pel RenModelOutPels::* piDepth  = NULL;
     502  xGetSampleStrDepthPtrs ( iSourceViewPos, piDepth  );
     503
     504  Pel RenModelOutPels::* piSrcY = NULL;
     505 
     506#if H_3D_VSO_COLOR_PLANES 
     507  Pel RenModelOutPels::* piSrcU = NULL; 
     508  Pel RenModelOutPels::* piSrcV = NULL;
     509  xGetSampleStrTextPtrs  ( iSourceViewPos, piSrcY, piSrcU, piSrcV );
     510#else
     511  xGetSampleStrTextPtrs  ( iSourceViewPos, piSrcY );
     512#endif
     513 
     514  for ( Int iPosY = 0; iPosY < m_iUsedHeight; iPosY++ )
     515  {
     516    for ( Int iPosX = 0; iPosX < m_iWidth; iPosX++ )
     517    {     
     518      pcCurLimOutSampleRow[iPosX].iYOther      = pcCurOutSampleRow[iPosX].*piSrcY;
     519      pcCurLimOutSampleRow[iPosX].iYRef        = pcCurOutSampleRow[iPosX].iYRef;
     520
     521#if H_3D_VSO_COLOR_PLANES     
     522      pcCurLimOutSampleRow[iPosX].iUOther      = pcCurOutSampleRow[iPosX].*piSrcU;
     523      pcCurLimOutSampleRow[iPosX].iURef        = pcCurOutSampleRow[iPosX].iURef;
     524
     525      pcCurLimOutSampleRow[iPosX].iVOther      = pcCurOutSampleRow[iPosX].*piSrcV;     
     526      pcCurLimOutSampleRow[iPosX].iVRef        = pcCurOutSampleRow[iPosX].iVRef;
     527#endif
     528      pcCurLimOutSampleRow[iPosX].iDOther      = pcCurOutSampleRow[iPosX].*piDepth;     
     529      pcCurLimOutSampleRow[iPosX].iFilledOther = pcCurOutSampleRow[iPosX].*piFilled;     
     530      pcCurLimOutSampleRow[iPosX].iError       = pcCurOutSampleRow[iPosX].iError;     
     531
     532    }
     533    pcCurOutSampleRow    += m_iOutputSamplesStride;
     534    pcCurLimOutSampleRow += m_iOutputSamplesStride;
     535  }
     536}
     537
     538template <BlenMod iBM, Bool bBitInc> Void
     539#if RM_FIX_SETUP
     540TRenSingleModelC<iBM,bBitInc>::setStructSynthViewAsRefView( )
     541#else
    400542TRenSingleModelC<iBM,bBitInc>::xSetStructSynthViewAsRefView( )
     543#endif
    401544{
    402545  AOT( m_iMode < 0 || m_iMode > 2);
     
    447590      pcOutSampleRow[iPosX].iDRight       = 0;
    448591      pcOutSampleRow[iPosX].iDBlended     = 0;     
     592      pcOutSampleRow[iPosX].iError        = 0;
    449593                                     
    450594      // Y Planes                   
     
    463607      pcOutSampleRow[iPosX].iVBlended     = 1 << (REN_BIT_DEPTH  - 1);
    464608#endif
    465       //// Input Samples
    466       pcLeftInSampleRow [iPosX].bOccluded = false;
    467       pcRightInSampleRow[iPosX].bOccluded = false;
     609  //// Input Samples
     610      pcLeftInSampleRow [iPosX].aiOccludedPos = MAX_INT;
     611      pcRightInSampleRow[iPosX].aiOccludedPos = MIN_INT;
    468612    }
    469613
     
    491635  case 0:
    492636#if H_3D_VSO_EARLY_SKIP
    493     bEarlySkip = m_bEarlySkip ? xDetectEarlySkipL(iStartPosX,   iStartPosY,   iWidth,   iHeight,   iStride, piNewData, piOrgData, iOrgStride) : false;
     637    bEarlySkip = m_bEarlySkip ? xDetectEarlySkip<true>(iStartPosX,   iStartPosY,   iWidth,   iHeight,   iStride, piNewData, piOrgData, iOrgStride) : false;
    494638    if( !bEarlySkip )
    495639    {
    496       iSSE = xRenderL<false>( iStartPosX,   iStartPosY,   iWidth,   iHeight,   iStride, piNewData,true );
     640      iSSE = xRender<true, GET_SIMP>( iStartPosX,   iStartPosY,   iWidth,   iHeight,   iStride, piNewData,true );
    497641    }   
    498642#else
    499     iSSE = xRenderL<false>( iStartPosX,   iStartPosY,   iWidth,   iHeight,   iStride, piNewData );
     643    iSSE = xRender<true, GET_SIMP>( iStartPosX,   iStartPosY,   iWidth,   iHeight,   iStride, piNewData );
    500644#endif
    501645    break;
    502646  case 1:
    503647#if H_3D_VSO_EARLY_SKIP
    504     bEarlySkip = m_bEarlySkip ? xDetectEarlySkipR(iStartPosX,   iStartPosY,   iWidth,   iHeight,   iStride, piNewData, piOrgData, iOrgStride) : false;
     648    bEarlySkip = m_bEarlySkip ? xDetectEarlySkip<false>(iStartPosX,   iStartPosY,   iWidth,   iHeight,   iStride, piNewData, piOrgData, iOrgStride) : false;
    505649    if( !bEarlySkip )
    506650    {
    507       iSSE = xRenderR<false>( iStartPosX,   iStartPosY,   iWidth,   iHeight,   iStride, piNewData,true );
     651      iSSE = xRender<false, GET_SIMP>( iStartPosX,   iStartPosY,   iWidth,   iHeight,   iStride, piNewData,true );
    508652    }   
    509653#else
    510     iSSE = xRenderR<false>( iStartPosX,   iStartPosY,   iWidth,   iHeight,   iStride, piNewData );
     654    iSSE = xRender<false, GET_SIMP>( iStartPosX,   iStartPosY,   iWidth,   iHeight,   iStride, piNewData );
    511655#endif
    512656    break;
     
    525669#endif
    526670{
    527 #ifdef  H_3D_VSO_EARLY_SKIP
     671#if  H_3D_VSO_EARLY_SKIP
    528672  Bool bEarlySkip;
    529673#endif
     
    532676  case 0:
    533677#if H_3D_VSO_EARLY_SKIP
    534     bEarlySkip = m_bEarlySkip ? xDetectEarlySkipL(iStartPosX,   iStartPosY,   iWidth,   iHeight,   iStride, piNewData, piOrgData,iOrgStride) : false;
     678    bEarlySkip = m_bEarlySkip ? xDetectEarlySkip<true>(iStartPosX,   iStartPosY,   iWidth,   iHeight,   iStride, piNewData, piOrgData,iOrgStride) : false;
    535679    if( !bEarlySkip )
    536680    {
    537       xRenderL<true>( iStartPosX,   iStartPosY,   iWidth,   iHeight,   iStride, piNewData,true );
     681      xRender<true, SET_SIMP>( iStartPosX,   iStartPosY,   iWidth,   iHeight,   iStride, piNewData,true );
    538682    }   
    539683#else
    540     xRenderL<true>( iStartPosX,   iStartPosY,   iWidth,   iHeight,   iStride, piNewData );
     684    xRender<true, SET_SIMP>( iStartPosX,   iStartPosY,   iWidth,   iHeight,   iStride, piNewData );
    541685#endif     
    542686    break;
    543687  case 1:
    544688#if H_3D_VSO_EARLY_SKIP
    545     bEarlySkip = m_bEarlySkip ? xDetectEarlySkipR(iStartPosX,   iStartPosY,   iWidth,   iHeight,   iStride, piNewData, piOrgData,iOrgStride) : false;
     689    bEarlySkip = m_bEarlySkip ? xDetectEarlySkip<false>(iStartPosX,   iStartPosY,   iWidth,   iHeight,   iStride, piNewData, piOrgData,iOrgStride) : false;
    546690    if( !bEarlySkip )
    547691    {
    548       xRenderR<true>( iStartPosX,   iStartPosY,   iWidth,   iHeight,   iStride, piNewData,true );
     692      xRender<false, SET_SIMP>( iStartPosX,   iStartPosY,   iWidth,   iHeight,   iStride, piNewData,true );
    549693    }   
    550694#else
    551     xRenderR<true>( iStartPosX,   iStartPosY,   iWidth,   iHeight,   iStride, piNewData );
     695    xRender<false, SET_SIMP>( iStartPosX,   iStartPosY,   iWidth,   iHeight,   iStride, piNewData );
    552696#endif     
    553697    break;
     
    585729  Pel RenModelOutPels::* piY;
    586730  xGetSampleStrTextPtrs(iViewPos, piY);
    587   xCopyFromSampleStruct( m_pcOutputSamples, m_iOutputSamplesStride, piY, pcPicYuv->getLumaAddr() + m_iHorOffset * pcPicYuv->getStride(), pcPicYuv->getStride(), m_iWidth, m_iUsedHeight );
    588   pcPicYuv->setChromaTo( 1 << (g_bitDepthC - 1) );   
     731  xCopyFromSampleStruct( m_pcOutputSamples, m_iOutputSamplesStride, piY, pcPicYuv->getAddr(COMPONENT_Y) + m_iHorOffset * pcPicYuv->getStride(COMPONENT_Y), pcPicYuv->getStride(COMPONENT_Y), m_iWidth, m_iUsedHeight );
     732  pcPicYuv->setChromaTo( 1 << (REN_BIT_DEPTH - 1) );   
    589733#endif 
    590734}
     
    633777  xCopy2PicYuv( apiData, aiStrides, pcPicYuv );
    634778#else
    635   xCopyFromSampleStruct( m_pcOutputSamples, m_iOutputSamplesStride, &RenModelOutPels::iYRef, pcPicYuv->getLumaAddr() *  pcPicYuv->getStride() + m_iHorOffset, pcPicYuv->getStride(), m_iWidth, m_iUsedHeight );
    636   pcPicYuv->setChromaTo( 1 << ( g_bitDepthC - 1 ) );   
     779  xCopyFromSampleStruct( m_pcOutputSamples, m_iOutputSamplesStride, &RenModelOutPels::iYRef, pcPicYuv->getAddr(COMPONENT_Y), pcPicYuv->getStride(COMPONENT_Y), m_iWidth, m_iUsedHeight );
     780  pcPicYuv->setChromaTo( 1 << ( REN_BIT_DEPTH - 1 ) );   
    637781#endif 
    638782}
     
    653797
    654798
    655 template <BlenMod iBM, Bool bBitInc> __inline Void
     799template <BlenMod iBM, Bool bBitInc> template<SetMod bSM> __inline Void
    656800TRenSingleModelC<iBM,bBitInc>::xSetViewRow( Int iPosY )
    657801{
    658802  m_pcInputSamplesRow[0] = m_pcInputSamples[0] + m_iInputSamplesStride  * iPosY;
    659803  m_pcInputSamplesRow[1] = m_pcInputSamples[1] + m_iInputSamplesStride  * iPosY;
    660   m_pcOutputSamplesRow   = m_pcOutputSamples   + m_iOutputSamplesStride * iPosY; 
    661 
    662 }
    663 
    664 template <BlenMod iBM, Bool bBitInc> __inline Void
     804  if (bSM == SET_FULL || bSM == GET_FULL )
     805  { 
     806    m_pcOutputSamplesRow   = m_pcOutputSamples   + m_iOutputSamplesStride * iPosY; 
     807  }
     808  else
     809  {
     810    m_pcLimOutputSamplesRow   = m_pcLimOutputSamples  + m_iOutputSamplesStride * iPosY; 
     811  }
     812}
     813
     814template <BlenMod iBM, Bool bBitInc> template<SetMod bSM> __inline Void
    665815TRenSingleModelC<iBM,bBitInc>::xIncViewRow( )
    666816{
    667817  m_pcInputSamplesRow[0] += m_iInputSamplesStride ;
    668818  m_pcInputSamplesRow[1] += m_iInputSamplesStride ;
    669   m_pcOutputSamplesRow   += m_iOutputSamplesStride; 
    670 }
    671 #if H_3D_VSO_EARLY_SKIP
    672 template <BlenMod iBM, Bool bBitInc> template<Bool bSet> __inline RMDist
    673 TRenSingleModelC<iBM,bBitInc>::xRenderL( Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, const Pel* piNewData, Bool bFast)
    674 #else
    675 template <BlenMod iBM, Bool bBitInc> template<Bool bSet> __inline RMDist
    676 TRenSingleModelC<iBM,bBitInc>::xRenderL( Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, const Pel* piNewData)
     819 
     820  if (bSM == SET_FULL || bSM == GET_FULL )
     821  { 
     822    m_pcOutputSamplesRow   += m_iOutputSamplesStride;
     823  }
     824  else
     825  {
     826    m_pcLimOutputSamplesRow   += m_iOutputSamplesStride;
     827  }
     828}
     829#if H_3D_VSO_EARLY_SKIP
     830template <BlenMod iBM, Bool bBitInc> template<SetMod bSM> __inline RMDist
     831TRenSingleModelC<iBM,bBitInc>::xGetSSE( Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, const Pel* piNewData, Bool bFast)
     832#else
     833template <BlenMod iBM, Bool bBitInc> template<SetMod bSM> __inline RMDist
     834TRenSingleModelC<iBM,bBitInc>::xGetSSE( Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, const Pel* piNewData)
    677835#endif
    678836{
     
    680838  const Int iOtherViewPos = 1;
    681839
    682   m_iCurViewPos   = iCurViewPos  ;
    683   m_iOtherViewPos = iOtherViewPos;
     840  m_piNewDepthData   = piNewData; 
     841  m_iNewDataWidth    = iWidth;     
     842  m_iStartChangePosX = iStartPosX;
     843
     844  if ((iWidth == 0) || (iHeight == 0))
     845    return 0;
     846
     847  xSetViewRow<bSM>      ( iStartPosY);
     848
     849  // Init Start
     850  RMDist iError = 0;     
     851  Int iStartChangePos = m_iStartChangePosX;
     852  Int iEndChangePos   = m_iStartChangePosX + iWidth - 1;
     853
     854  for (Int iPosY = iStartPosY; iPosY < iStartPosY + iHeight; iPosY++ )
     855  {   
     856    Int iPosXinNewData        = iWidth - 1;                       
     857    for ( Int iCurPosX = iEndChangePos; iCurPosX >= iStartChangePos; iCurPosX-- )
     858    {
     859      Int iCurDepth   = m_piNewDepthData[iPosXinNewData];
     860      Int iOldDepth   = m_pcInputSamplesRow[iCurViewPos][iCurPosX].iD;
     861      Int iDiff = (iCurDepth - iOldDepth);
     862      iError += iDiff * iDiff;
     863      iPosXinNewData--;
     864    }
     865    xIncViewRow<bSM>();
     866    m_piNewDepthData += iStride;
     867  }
     868  return iError;
     869}
     870
     871#if H_3D_VSO_EARLY_SKIP
     872template <BlenMod iBM, Bool bBitInc> template<Bool bL, SetMod bSM> __inline RMDist
     873TRenSingleModelC<iBM,bBitInc>::xRender( Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, const Pel* piNewData, Bool bFast)
     874#else
     875template <BlenMod iBM, Bool bBitInc> template<Bool bL, SetMod bSM> __inline RMDist
     876TRenSingleModelC<iBM,bBitInc>::xRender( Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, const Pel* piNewData)
     877#endif
     878{
     879  const Int iCurViewPos   = bL ? 0 : 1;
    684880
    685881  m_piNewDepthData   = piNewData;
     
    688884
    689885  if ((iWidth == 0) || (iHeight == 0))
     886  {
    690887    return 0;
     888  }
    691889
    692890  // Get Data
    693891  m_ppiCurLUT      = m_appiShiftLut   [iCurViewPos];
    694   xSetViewRow      ( iStartPosY);
     892  xSetViewRow<bSM>( iStartPosY);
    695893
    696894  // Init Start
     
    698896  Int   iStartChangePos;
    699897
    700   iStartChangePos = m_iStartChangePosX;
     898  iStartChangePos = m_iStartChangePosX + ( bL ? 0  : (iWidth - 1));
    701899
    702900  for (Int iPosY = iStartPosY; iPosY < iStartPosY + iHeight; iPosY++ )
     
    707905      if ( m_pbHorSkip[iPosY-iStartPosY] )
    708906      {
    709         xIncViewRow();
     907        xIncViewRow<bSM>();
    710908        m_piNewDepthData += iStride;
    711909        continue;
     
    716914
    717915    Int iLastSPos;
    718     Int iEndChangePos         = m_iStartChangePosX + iWidth - 1;
    719     Int iPosXinNewData        = iWidth - 1;
    720     Int iMinChangedSPos       = m_iSampledWidth;
    721 
    722     if ( iEndChangePos == ( m_iWidth -1 )) // Special processing for rightmost depth sample
     916    Int iEndChangePos         = m_iStartChangePosX + ( bL ? (iWidth - 1) : 0 ) ;
     917
     918    Int iEndChangePosInSubPel = iEndChangePos << m_iShiftPrec;
     919    Int iPosXinNewData        = bL ? iWidth - 1 : 0;
     920    Int iMinChangedSPos       = bL ? m_iSampledWidth : -1;
     921    if ( iEndChangePos == xWidthMinus1<bL>() )
    723922    {
    724923      m_iCurDepth           = m_piNewDepthData[iPosXinNewData];
    725       Int iCurSPos          = xShiftNewData(iEndChangePos, iPosXinNewData);
    726       m_iLastOccludedSPos   = iCurSPos + 1;
    727       m_iLastOccludedSPosFP = xRangeLeftL( m_iLastOccludedSPos );
    728       xExtrapolateMarginL<bSet>  ( iCurSPos, iEndChangePos, iError );
    729 
    730       iMinChangedSPos       = std::min( iMinChangedSPos, (iEndChangePos << m_iShiftPrec) - m_ppiCurLUT[0][ RenModRemoveBitInc( std::max(m_pcInputSamplesRow[iCurViewPos][iEndChangePos].iD, m_piNewDepthData[iPosXinNewData] )) ]);
    731       iLastSPos             = iCurSPos;
    732       m_iLastDepth          = m_iCurDepth;
    733 
    734       if ( bSet )
     924      Int iCurSPos          = xShiftDept(iEndChangePosInSubPel, m_iCurDepth );
     925
     926      m_curRangeStart       = xRangeLeft<bL>( iCurSPos );
     927      xExtrapolateMargin<bL, bSM>  ( iCurSPos, iEndChangePos, iError );
     928
     929      Int iOldDepth          = m_pcInputSamplesRow[iCurViewPos][iEndChangePos].iD;
     930      iMinChangedSPos        = xMin<Int, bL>( ( iOldDepth <= m_iCurDepth ) ? iCurSPos : xShiftDept(iEndChangePosInSubPel, iOldDepth ), iMinChangedSPos);
     931      iLastSPos           = iCurSPos;
     932      m_lastRangeStart    = m_curRangeStart;
     933      m_iLastDepth        = m_iCurDepth;
     934      m_iLastOccludedSPos = iLastSPos;
     935
     936      if ( bSM == SET_FULL || bSM == SET_SIMP )
    735937      {
    736938        m_pcInputSamplesRow[iCurViewPos][iEndChangePos].iD = m_piNewDepthData[iPosXinNewData];
    737939      }
    738940
    739       iPosXinNewData--;
    740       iEndChangePos--;
     941      xDec<Int, bL>(iPosXinNewData);
     942      xDec<Int, bL>(iEndChangePos);
    741943    }
    742944    else
    743945    {
    744       iLastSPos    = xShift(iEndChangePos+1);
    745       m_iLastDepth = m_pcInputSamplesRow [iCurViewPos][iEndChangePos+1].iD;
    746       xInitRenderPartL( iEndChangePos, iLastSPos );
     946      m_iLastDepth = m_pcInputSamplesRow [iCurViewPos][xPlus<Int,bL>(iEndChangePos,1)].iD;
     947      iLastSPos    = xShiftDept(xPlus<Int,bL>(iEndChangePosInSubPel, ( 1 << m_iShiftPrec ) ), m_iLastDepth );
     948      xInitRenderPart<bL>( iEndChangePos, iLastSPos );
    747949    }
    748950
    749951    //// RENDER NEW DATA
    750952    Int iCurPosX;
    751     for ( iCurPosX = iEndChangePos; iCurPosX >= iStartChangePos; iCurPosX-- )
    752     {
    753       // Get minimal changed sample position
    754 
    755       iMinChangedSPos = std::min( iMinChangedSPos, (iCurPosX << m_iShiftPrec) - m_ppiCurLUT[0][ RenModRemoveBitInc( std::max(m_pcInputSamplesRow[iCurViewPos][iCurPosX].iD, m_piNewDepthData[iPosXinNewData] )) ]);
    756       Int iCurSPos    = xShiftNewData(iCurPosX,iPosXinNewData);
    757       m_iCurDepth     = m_piNewDepthData[iPosXinNewData];
    758       xRenderRangeL<bSet>(iCurSPos, iLastSPos, iCurPosX, iError );
     953    for ( iCurPosX = iEndChangePos; xGeQ<Int,bL>(iCurPosX,iStartChangePos); xDec<Int,bL>(iCurPosX))
     954    {
     955      Int iCurPosXInSubPel = iCurPosX << m_iShiftPrec;
     956      m_iCurDepth     = m_piNewDepthData[iPosXinNewData]        ;
     957      Int iCurSPos    = xShiftDept(iCurPosXInSubPel,m_iCurDepth); 
     958
     959      Int iOldDepth   = m_pcInputSamplesRow[iCurViewPos][iCurPosX].iD;
     960      iMinChangedSPos = xMin<Int,bL>( ( iOldDepth <= m_iCurDepth ) ? iCurSPos : xShiftDept(iCurPosXInSubPel, iOldDepth ), iMinChangedSPos);
     961
     962      xRenderRange<bL,bSM>(iCurSPos, iLastSPos, iCurPosX, iError );
    759963      iLastSPos       = iCurSPos;
    760964      m_iLastDepth    = m_iCurDepth;
    761965
    762       if ( bSet )
     966      if ( bSM == SET_FULL || bSM == SET_SIMP )
    763967      {
    764968        m_pcInputSamplesRow[iCurViewPos][iCurPosX].iD = m_piNewDepthData[iPosXinNewData];
    765969      }
    766 
    767       iPosXinNewData--;
     970      xDec<Int,bL>(iPosXinNewData);
    768971    }
    769972
    770973    //// RE-RENDER DATA LEFT TO NEW DATA
    771     while ( iCurPosX >= 0 )
    772     {
    773       Int iCurSPos = xShift(iCurPosX);
    774 
     974
     975    while ( xGeQ<Int,bL>(iCurPosX, xZero<bL>() ) )
     976    {
     977      Int iCurPosXInSubPel = iCurPosX << m_iShiftPrec;
    775978      m_iCurDepth  = m_pcInputSamplesRow[iCurViewPos][iCurPosX].iD;
    776       xRenderRangeL<bSet>( iCurSPos, iLastSPos, iCurPosX, iError );
    777 
    778       if ( iCurSPos < iMinChangedSPos )
     979      Int iCurSPos = xShiftDept(iCurPosXInSubPel,m_iCurDepth);     
     980      xRenderRange<bL,bSM>( iCurSPos, iLastSPos, iCurPosX, iError );
     981      if ( xLess<Int,bL>(iCurSPos,iMinChangedSPos) )
    779982      {
    780           break;
     983        break;
    781984      }
    782985
    783       iCurPosX--;
     986      xDec<Int,bL>(iCurPosX);
    784987      iLastSPos    = iCurSPos;
    785988      m_iLastDepth = m_iCurDepth;
     
    787990
    788991
    789     xIncViewRow();
     992
     993
     994    xIncViewRow<bSM>();
    790995    m_piNewDepthData += iStride;
    791996  }
     
    793998}
    794999
    795 #ifdef  H_3D_VSO_EARLY_SKIP
    796 template <BlenMod iBM, Bool bBitInc> template<Bool bSet> __inline RMDist
    797 TRenSingleModelC<iBM,bBitInc>::xRenderR( Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, const Pel* piNewData , Bool bFast)
    798 #else
    799 template <BlenMod iBM, Bool bBitInc> template<Bool bSet> __inline RMDist
    800 TRenSingleModelC<iBM,bBitInc>::xRenderR( Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, const Pel* piNewData )
    801 #endif
    802 {
    803 
    804   const Int iCurViewPos   = 1;
    805   const Int iOtherViewPos = 0;
    806 
    807   m_iCurViewPos      = iCurViewPos;
    808   m_iOtherViewPos    = iOtherViewPos;
    809 
    810   m_piNewDepthData   = piNewData;
    811   m_iNewDataWidth    = iWidth;
    812   m_iStartChangePosX = iStartPosX;
    813 
    814   if ((iWidth == 0) || (iHeight == 0))
    815     return 0;
    816 
    817   // Get Data
    818   m_ppiCurLUT      = m_appiShiftLut   [iCurViewPos];
    819   xSetViewRow      ( iStartPosY);
    820 
    821   // Init Start
    822   RMDist iError = 0;
    823   Int   iEndChangePos;
    824 
    825   iEndChangePos = m_iStartChangePosX + iWidth - 1;
    826 
    827   for (Int iPosY = iStartPosY; iPosY < iStartPosY + iHeight; iPosY++ )
    828   {
    829 #if H_3D_VSO_EARLY_SKIP
    830     if( m_bEarlySkip && bFast )
    831     {
    832       if ( m_pbHorSkip[iPosY-iStartPosY] )
    833       {
    834         xIncViewRow();
    835         m_piNewDepthData += iStride;
    836         continue;
    837       }
    838     }
    839 #endif
    840     m_bInOcclusion = false;
    841 
    842     Int iLastSPos;
    843     Int iStartChangePos       = m_iStartChangePosX;
    844     Int iPosXinNewData        = 0;
    845     Int iMaxChangedSPos = -1;
    846 
    847     if ( iStartChangePos == 0 ) // Special processing for leftmost depth sample
    848     {
    849       m_iCurDepth           = m_piNewDepthData[iPosXinNewData];
    850       Int iCurSPos          = xShiftNewData(iStartChangePos, iPosXinNewData);
    851       m_iLastOccludedSPos   = iCurSPos - 1;
    852       m_iLastOccludedSPosFP = xRangeRightR( m_iLastOccludedSPos );
    853       xExtrapolateMarginR<bSet>     ( iCurSPos, iStartChangePos, iError );
    854 
    855       iMaxChangedSPos       = std::max( iMaxChangedSPos, (iStartChangePos << m_iShiftPrec) - m_ppiCurLUT[0][ RenModRemoveBitInc( std::max(m_pcInputSamplesRow[iCurViewPos][iStartChangePos].iD, m_piNewDepthData[iPosXinNewData] )) ]);
    856       iLastSPos             = iCurSPos;
    857       m_iLastDepth          = m_iCurDepth;
    858       if ( bSet )
    859       {
    860         m_pcInputSamplesRow[iCurViewPos][iStartChangePos].iD = m_piNewDepthData[iPosXinNewData];
    861       }
    862 
    863 
    864       iPosXinNewData++;
    865       iStartChangePos++;
    866     }
    867     else
    868     {
    869       iLastSPos   = xShift(iStartChangePos-1);
    870 
    871       m_iLastDepth = m_pcInputSamplesRow[iCurViewPos][iStartChangePos-1].iD;
    872       xInitRenderPartR( iStartChangePos, iLastSPos );
    873     }
    874 
    875     //// RENDER NEW DATA
    876     Int iCurPosX;
    877     for ( iCurPosX = iStartChangePos; iCurPosX <= iEndChangePos; iCurPosX++ )
    878     {
    879       // Get minimal changed sample position
    880 
    881       iMaxChangedSPos = std::max( iMaxChangedSPos, (iCurPosX << m_iShiftPrec) - m_ppiCurLUT[0][ RenModRemoveBitInc( std::max(m_pcInputSamplesRow[iCurViewPos][iCurPosX].iD, m_piNewDepthData[iPosXinNewData] )) ]);
    882       Int iCurSPos    = xShiftNewData(iCurPosX,iPosXinNewData);
    883       m_iCurDepth     = m_piNewDepthData[iPosXinNewData];
    884       xRenderRangeR<bSet>(iCurSPos, iLastSPos, iCurPosX, iError );
    885       iLastSPos      = iCurSPos;
    886       m_iLastDepth    = m_iCurDepth;
    887 
    888       if ( bSet )
    889       {
    890         m_pcInputSamplesRow[iCurViewPos][iCurPosX].iD = m_piNewDepthData[iPosXinNewData];
    891       }
    892 
    893       iPosXinNewData++;
    894     }
    895 
    896     //// RE-RENDER DATA LEFT TO NEW DATA
    897     while ( iCurPosX < m_iWidth )
    898     {
    899       Int iCurSPos = xShift(iCurPosX);
    900 
    901       m_iCurDepth  = m_pcInputSamplesRow[iCurViewPos][iCurPosX].iD;
    902       xRenderRangeR<bSet>( iCurSPos, iLastSPos, iCurPosX, iError );
    903 
    904       if ( iCurSPos > iMaxChangedSPos )
    905       {
    906           break;
    907         }
    908       iCurPosX++;
    909       iLastSPos    = iCurSPos;
    910       m_iLastDepth = m_iCurDepth;
    911     }
    912 
    913     xIncViewRow();
    914     m_piNewDepthData += iStride;
    915   }
    916   return iError;
    917 }
    918 
    919 
    920 template <BlenMod iBM, Bool bBitInc> __inline Void
    921 TRenSingleModelC<iBM,bBitInc>::xInitRenderPartL(  Int iEndChangePos, Int iLastSPos )
    922 {
    923   const Int iCurViewPos = 0;
    924   // GET MINIMAL OCCLUDED SAMPLE POSITION
    925   Int iCurPosX           = iEndChangePos;
    926 
    927 
    928   if ( ( iCurPosX + 1 < m_iWidth ) && (m_pcInputSamplesRow[iCurViewPos][ iCurPosX + 1].bOccluded ) )
    929   {
    930     iCurPosX++;
    931 
    932     while ( (iCurPosX + 1 < m_iWidth) &&  (m_pcInputSamplesRow[iCurViewPos][ iCurPosX + 1].bOccluded  )  )
    933 
    934       iCurPosX++;
    935 
    936     if ( iCurPosX + 1 < m_iWidth )
    937     {
    938       iCurPosX++;
    939       m_iLastOccludedSPos = xShift(iCurPosX);
    940     }
    941     else
    942     {
    943       m_iLastOccludedSPos = xShift(iCurPosX) + 1;
    944     }
    945 
    946     m_iLastOccludedSPosFP = xRoundL( m_iLastOccludedSPos );
     1000template <BlenMod iBM, Bool bBitInc> template<Bool bL> __inline Void
     1001TRenSingleModelC<iBM,bBitInc>::xInitRenderPart(  Int iEndChangePos, Int iLastSPos )
     1002{
     1003  const Int iCurViewPos = bL ? 0 : 1;   
     1004  m_iLastOccludedSPos = m_pcInputSamplesRow[iCurViewPos][ xPlus<Int,bL>(iEndChangePos,1) ].aiOccludedPos; 
     1005  m_bInOcclusion      = xGeQ<Int,bL>( iLastSPos, m_iLastOccludedSPos );
     1006
     1007  if( m_bInOcclusion )
     1008  {
     1009    m_lastRangeStart = xRound<bL>( m_iLastOccludedSPos ); 
    9471010  }
    9481011  else
    9491012  {
    950     m_iLastOccludedSPos   = iLastSPos+1;
    951     m_iLastOccludedSPosFP = xRangeLeftL( m_iLastOccludedSPos );
    952   }
    953 
    954   m_bInOcclusion = iLastSPos >= m_iLastOccludedSPos;
     1013    m_iLastOccludedSPos = iLastSPos;
     1014    m_lastRangeStart = xRangeLeft<bL>( iLastSPos ); 
     1015  }
    9551016};
    9561017
    957 template <BlenMod iBM, Bool bBitInc> __inline Void
    958 TRenSingleModelC<iBM,bBitInc>::xInitRenderPartR(  Int iStartChangePos, Int iLastSPos )
    959 {
    960     const Int iCurViewPos = 1;
    961   // GET MINIMAL OCCLUDED SAMPLE POSITION
    962   Int iCurPosX           = iStartChangePos;
    963 
    964   if ( ( iCurPosX - 1 > -1 ) && (m_pcInputSamplesRow[iCurViewPos][ iCurPosX - 1].bOccluded  ) )
    965   {
    966     iCurPosX--;
    967 
    968     while ( (iCurPosX - 1 > -1 ) &&  (m_pcInputSamplesRow[iCurViewPos][ iCurPosX - 1].bOccluded  )  )
    969       iCurPosX--;
    970 
    971     if ( iCurPosX - 1 > -1 )
    972     {
    973       iCurPosX--;
    974       m_iLastOccludedSPos = xShift(iCurPosX);
    975     }
    976     else
    977     {
    978       m_iLastOccludedSPos = xShift(iCurPosX) - 1;
    979     }
    980     m_iLastOccludedSPosFP = xRoundR( m_iLastOccludedSPos );
     1018template <BlenMod iBM, Bool bBitInc> template<Bool bL, SetMod bSM> __inline Void
     1019TRenSingleModelC<iBM,bBitInc>::xRenderShiftedRange(Int iCurSPos, Int iLastSPos, Int iCurPos, RMDist& riError )
     1020{
     1021  RM_AOF( (xGeQ<Int,bL>(iLastSPos,iCurSPos)) );
     1022  Int iDeltaSPos = bL ? iLastSPos - iCurSPos : iCurSPos - iLastSPos;
     1023
     1024  m_curRangeStart = xRangeLeft<bL>( iCurSPos );
     1025  if ( iDeltaSPos > m_iGapTolerance )
     1026  {
     1027    xFillHole<bL,bSM>( iCurSPos, iLastSPos, iCurPos, riError );
    9811028  }
    9821029  else
    9831030  {
    984     m_iLastOccludedSPos   = iLastSPos-1;
    985     m_iLastOccludedSPosFP = xRangeRightR( m_iLastOccludedSPos );
    986   }
    987 
    988   m_bInOcclusion = iLastSPos <= m_iLastOccludedSPos;
    989 };
    990 
    991 
    992 template <BlenMod iBM, Bool bBitInc> template<Bool bSet> __inline Void
    993 TRenSingleModelC<iBM,bBitInc>::xRenderShiftedRangeL(Int iCurSPos, Int iLastSPos, Int iCurPos, RMDist& riError )
    994 {
    995   assert( iCurSPos <= iLastSPos );
    996   //assert( iRightSPos < m_iWidth );
    997 
    998   Int iDeltaSPos = iLastSPos - iCurSPos;
    999   if ( iDeltaSPos > m_iGapTolerance )
    1000   {
    1001     xFillHoleL<bSet>( iCurSPos, iLastSPos, iCurPos, riError );
    1002   }
    1003   else
    1004   {
    1005     if (iLastSPos < 0 )
     1031    if (!xGeQ<Int,bL>(iLastSPos, bL ? 0 : ( m_iSampledWidth - 1) ))
     1032    {
    10061033      return;
     1034    }
    10071035
    10081036    RM_AOT( iDeltaSPos    > m_iGapTolerance );
    10091037
    10101038    m_iThisDepth = m_iCurDepth;
    1011     for (Int iFillSPos = std::max(0, xRangeLeftL(iCurSPos) ); iFillSPos <= min(xRangeRightL( iLastSPos ) ,m_iLastOccludedSPosFP-1); iFillSPos++ )
    1012     {
    1013       Int iDeltaCurSPos  = (iFillSPos << m_iShiftPrec) - iCurSPos;
     1039
     1040    for (Int iFillSPos = xMax<Int,bL>(xZero<bL>(), m_curRangeStart ); xLess<Int,bL>(iFillSPos,m_lastRangeStart); xInc<Int,bL>(iFillSPos))
     1041    {
     1042      Int iDeltaCurSPos  = (iFillSPos << m_iShiftPrec) - (bL ? iCurSPos : iLastSPos);
    10141043
    10151044      RM_AOT( iDeltaCurSPos > iDeltaSPos );
     
    10171046      RM_AOT( m_aaiSubPelShiftL[iDeltaSPos][iDeltaCurSPos] == 0xdeaddead);
    10181047
    1019       xSetShiftedPelL<bSet>( iCurPos, m_aaiSubPelShiftL[iDeltaSPos][iDeltaCurSPos], iFillSPos, REN_IS_FILLED, riError );
     1048      xSetShiftedPel<bL, bSM>( iCurPos, m_aaiSubPelShiftL[iDeltaSPos][iDeltaCurSPos], iFillSPos, REN_IS_FILLED, riError );
    10201049    }
    10211050  };
    1022 }
    1023 
    1024 template <BlenMod iBM, Bool bBitInc> template<Bool bSet> __inline Void
    1025 TRenSingleModelC<iBM,bBitInc>::xRenderShiftedRangeR(Int iCurSPos, Int iLastSPos, Int iCurPos, RMDist& riError )
    1026 {
    1027   assert( iCurSPos >= iLastSPos );
    1028 
    1029   Int iDeltaSPos = iCurSPos - iLastSPos;
    1030   if ( iDeltaSPos > m_iGapTolerance )
    1031   {
    1032     xFillHoleR<bSet>( iCurSPos, iLastSPos, iCurPos, riError );
     1051  m_lastRangeStart = m_curRangeStart;
     1052}
     1053
     1054template <BlenMod iBM, Bool bBitInc> template<Bool bL, SetMod bSM> __inline Void
     1055TRenSingleModelC<iBM,bBitInc>::xRenderRange(Int iCurSPos, Int iLastSPos, Int iCurPos, RMDist& riError )
     1056{
     1057  const Int iCurViewPos = bL ? 0 : 1;
     1058
     1059  if ( bSM == SET_FULL || bSM == SET_SIMP )
     1060  {
     1061    m_pcInputSamplesRow[iCurViewPos][ iCurPos ].aiOccludedPos = m_iLastOccludedSPos;
     1062  }
     1063
     1064  if ( xLess<Int,bL>(iCurSPos,m_iLastOccludedSPos ))
     1065  {
     1066    m_bInOcclusion      = false;
     1067    m_iLastOccludedSPos = iCurSPos;
     1068    xRenderShiftedRange<bL,bSM>(iCurSPos, iLastSPos, iCurPos, riError );
    10331069  }
    10341070  else
    10351071  {
    1036     if (iLastSPos > m_iSampledWidth - 1 )
    1037       return;
    1038 
    1039     m_iThisDepth = m_iCurDepth;
    1040     RM_AOT( iDeltaSPos    > m_iGapTolerance );
    1041     for (Int iFillSPos = max(m_iLastOccludedSPosFP+1, xRangeLeftR(iLastSPos) ); iFillSPos <= min(xRangeRightR( iCurSPos ) ,m_iWidth -1); iFillSPos++ )
    1042     {
    1043       Int iDeltaCurSPos  = (iFillSPos << m_iShiftPrec) - iLastSPos;
    1044 
    1045       RM_AOT( iDeltaCurSPos > iDeltaSPos );
    1046       RM_AOT( iDeltaCurSPos < 0 );
    1047       RM_AOT( m_aaiSubPelShiftR[iDeltaSPos][iDeltaCurSPos] == 0xdeaddead);
    1048 
    1049       xSetShiftedPelR<bSet>( iCurPos, m_aaiSubPelShiftR[iDeltaSPos][iDeltaCurSPos], iFillSPos, REN_IS_FILLED, riError );
    1050     }
    1051   };
    1052 }
    1053 
    1054 
    1055 
    1056 template <BlenMod iBM, Bool bBitInc> template<Bool bSet> __inline Void
    1057 TRenSingleModelC<iBM,bBitInc>::xRenderRangeL(Int iCurSPos, Int iLastSPos, Int iCurPos, RMDist& riError )
    1058 {
    1059   const Int iCurViewPos = 0;
    1060   if (  !m_bInOcclusion )
    1061   {
    1062     if ( iCurSPos >= iLastSPos )
    1063     {
    1064       m_iLastOccludedSPos = iLastSPos;
    1065 
    1066       Int iRightSPosFP = xRoundL( iLastSPos );
    1067       if ( ( iRightSPosFP == xRangeRightL(iLastSPos)) && (iRightSPosFP >= 0) )
     1072    if ( !m_bInOcclusion )
     1073    {     
     1074      RM_AOF( (xGeQ<Int,bL>(iLastSPos, m_iLastOccludedSPos)) );
     1075      Int iRightSPosFP = xRound<bL>( iLastSPos );     
     1076      if ( ( iRightSPosFP == xPlus<Int,bL>(m_lastRangeStart, -1) ) && xGeQ<Int,bL>(iRightSPosFP, xZero<bL>()) )
    10681077      {
    10691078        m_iThisDepth = m_iLastDepth;
    1070 
    1071         xSetShiftedPelL<bSet>( iCurPos+1, 0, iRightSPosFP, REN_IS_FILLED, riError );
     1079        xSetShiftedPel<bL, bSM>( xPlus<Int,bL>(iCurPos,1), bL ? 0 : (1 << m_iShiftPrec), iRightSPosFP, REN_IS_FILLED, riError );
    10721080      }
    1073       m_iLastOccludedSPosFP = iRightSPosFP;
    1074 
    1075       m_bInOcclusion = true;
    1076 
    1077       if ( bSet )
    1078       {
    1079         m_pcInputSamplesRow[iCurViewPos][ iCurPos ].bOccluded  = true;
    1080       }
    1081     }
    1082     else
    1083     {
    1084       if ( bSet )
    1085       {
    1086         m_pcInputSamplesRow[iCurViewPos][ iCurPos ].bOccluded  = false;
    1087       }
    1088 
    1089       xRenderShiftedRangeL<bSet>(iCurSPos, iLastSPos, iCurPos, riError );
    1090     }
    1091   }
    1092   else
    1093   {
    1094     if ( iCurSPos < m_iLastOccludedSPos )
    1095     {
    1096       m_bInOcclusion = false;
    1097       if ( bSet )
    1098       {
    1099         m_pcInputSamplesRow[iCurViewPos][ iCurPos ].bOccluded  = false;
    1100       }
    1101 
    1102       xRenderShiftedRangeL<bSet>(iCurSPos, iLastSPos, iCurPos, riError );
    1103     }
    1104     else
    1105     {
    1106       if ( bSet )
    1107       {
    1108         m_pcInputSamplesRow[iCurViewPos][ iCurPos ].bOccluded  = true;
    1109       }
    1110     }
    1111   }
    1112 }
    1113 
    1114 template <BlenMod iBM, Bool bBitInc> template<Bool bSet> __inline Void
    1115 TRenSingleModelC<iBM,bBitInc>::xRenderRangeR(Int iCurSPos, Int iLastSPos, Int iCurPos, RMDist& riError )
    1116 {
    1117   const Int iCurViewPos = 1;
    1118   // Find out if current sample is occluded
    1119   if (  !m_bInOcclusion )
    1120   {
    1121     if ( iCurSPos <= iLastSPos )
    1122     {
    1123       m_iLastOccludedSPos = iLastSPos;
    1124 
    1125       Int iLeftSPosFP = xRoundR( iLastSPos );
    1126       if ( ( iLeftSPosFP == xRangeLeftR(iLastSPos)) && (iLeftSPosFP <= m_iWidth - 1) )
    1127       {
    1128         m_iThisDepth = m_iLastDepth;
    1129         xSetShiftedPelR<bSet>( iCurPos-1,1 << m_iShiftPrec , iLeftSPosFP, REN_IS_FILLED, riError );
    1130       }
    1131       m_iLastOccludedSPosFP = iLeftSPosFP;
    1132 
    1133       m_bInOcclusion = true;
    1134 
    1135       if ( bSet )
    1136       {
    1137         m_pcInputSamplesRow[iCurViewPos][ iCurPos ].bOccluded  = true;
    1138       }
    1139     }
    1140     else
    1141     {
    1142       if ( bSet )
    1143       {
    1144         m_pcInputSamplesRow[iCurViewPos][ iCurPos ].bOccluded  = false;
    1145       }
    1146 
    1147       xRenderShiftedRangeR<bSet>(iCurSPos, iLastSPos, iCurPos, riError );
    1148     }
    1149   }
    1150   else
    1151   {
    1152     if ( iCurSPos > m_iLastOccludedSPos )
    1153     {
    1154       m_bInOcclusion = false;
    1155       if ( bSet )
    1156       {
    1157         m_pcInputSamplesRow[iCurViewPos][ iCurPos ].bOccluded  = false;
    1158       }
    1159 
    1160       xRenderShiftedRangeR<bSet>(iCurSPos, iLastSPos, iCurPos, riError );
    1161     }
    1162     else
    1163     {
    1164       if ( bSet )
    1165       {
    1166         m_pcInputSamplesRow[iCurViewPos][ iCurPos ].bOccluded  = true;
    1167       }
    1168     }
    1169   }
    1170 }
    1171 
    1172 template <BlenMod iBM, Bool bBitInc> template<Bool bSet> __inline Void
    1173 TRenSingleModelC<iBM,bBitInc>::xFillHoleL( Int iCurSPos, Int iLastSPos, Int iCurPos, RMDist& riError )
     1081      m_lastRangeStart = iRightSPosFP;
     1082      m_bInOcclusion   = true;
     1083    }
     1084  }
     1085}
     1086
     1087template <BlenMod iBM, Bool bBitInc> template<Bool bL, SetMod bSM> __inline Void
     1088TRenSingleModelC<iBM,bBitInc>::xFillHole( Int iCurSPos, Int iLastSPos, Int iCurPos, RMDist& riError )
    11741089{
    11751090  if (iLastSPos < 0)
     1091  {
    11761092    return;
     1093  }
    11771094
    11781095  Int iStartFillSPos = iCurSPos;
    11791096  Int iStartFillPos  = iCurPos;
    1180   Int iLastPos      = iCurPos + 1;
    1181 
    1182   Int iStartFillSPosFP = xRangeLeftL(iStartFillSPos);
    1183 
    1184   if (iStartFillSPosFP == xRoundL(iStartFillSPos))
    1185   {
    1186     if ((iStartFillSPosFP >= 0) && (iStartFillSPosFP < m_iLastOccludedSPosFP) )
     1097  Int iLastPos       = xPlus<Int,bL>( iCurPos,1);
     1098
     1099  Int iStartFillSPosFP = m_curRangeStart;
     1100  if (iStartFillSPosFP == xRound<bL>(iStartFillSPos))
     1101  {
     1102    if ( xGeQ<Int,bL>(iStartFillSPosFP, xZero<bL>())  && xLess<Int,bL>(iStartFillSPosFP, m_lastRangeStart) )
    11871103    {
    11881104      m_iThisDepth = m_iCurDepth;
    1189       xSetShiftedPelL<bSet>    ( iStartFillPos, 0, iStartFillSPosFP, REN_IS_FILLED, riError );
     1105      xSetShiftedPel<bL, bSM>    ( iStartFillPos, bL ? 0 : ( 1 << m_iShiftPrec), iStartFillSPosFP, REN_IS_FILLED, riError );
    11901106    }
    11911107  }
    11921108  else
    11931109  {
    1194     iStartFillSPosFP--;
     1110    xDec<Int,bL>( iStartFillSPosFP );
    11951111  }
    11961112
    11971113  m_iThisDepth = m_iLastDepth;
    1198   for (Int iFillSPos = std::max(iStartFillSPosFP+1,0); iFillSPos <= min(xRangeRightL( iLastSPos ), m_iLastOccludedSPosFP-1 ); iFillSPos++ )
    1199   {
    1200     xSetShiftedPelL<bSet>( iLastPos, 0,  iFillSPos, REN_IS_HOLE, riError );
    1201   }
    1202 }
    1203 
    1204 template <BlenMod iBM, Bool bBitInc> template<Bool bSet> __inline Void
    1205 TRenSingleModelC<iBM,bBitInc>::xFillHoleR( Int iCurSPos, Int iLastSPos, Int iCurPos, RMDist& riError )
    1206 {
    1207   if (iLastSPos < 0)
    1208     return;
    1209 
    1210   Int iStartFillSPos = iCurSPos;
    1211   Int iEndFillPos    = iCurPos;
    1212   Int iLastPos       = iCurPos - 1;
    1213 
    1214   Int iStartFillSPosFP = xRangeRightR(iStartFillSPos);
    1215 
    1216   if (iStartFillSPosFP == xRoundR(iStartFillSPos))
    1217   {
    1218     if ((iStartFillSPosFP < m_iWidth) && (iStartFillSPosFP > m_iLastOccludedSPosFP) )
    1219     {
    1220       m_iThisDepth = m_iCurDepth;
    1221       xSetShiftedPelR<bSet>( iEndFillPos, 1 << m_iShiftPrec , iStartFillSPosFP, REN_IS_FILLED, riError );
    1222     }
    1223   }
    1224   else
    1225   {
    1226     iStartFillSPosFP++;
    1227   }
    1228 
    1229   m_iThisDepth = m_iLastDepth;
    1230   for (Int iFillSPos = max(xRangeLeftR( iLastSPos ), m_iLastOccludedSPosFP+1); iFillSPos <= min(iStartFillSPosFP,m_iWidth)-1 ; iFillSPos++ )
    1231   {
    1232     xSetShiftedPelR<bSet>( iLastPos, 1 << m_iShiftPrec, iFillSPos, REN_IS_HOLE, riError );
    1233   }
    1234 }
    1235 
    1236 template <BlenMod iBM, Bool bBitInc> template<Bool bSet> __inline Void
    1237 TRenSingleModelC<iBM,bBitInc>::xExtrapolateMarginL(Int iCurSPos, Int iCurPos, RMDist& riError )
    1238 {
    1239 //  if (iLeftSPos < 0 )
    1240 //    return;
    1241 
    1242   Int iSPosFullPel = std::max(0,xRangeLeftL(iCurSPos));
     1114  for (Int iFillSPos = xMax<Int,bL>(xPlus<Int,bL>(iStartFillSPosFP,1),xZero<bL>()); xLess<Int,bL>(iFillSPos, m_lastRangeStart); xInc<Int,bL>(iFillSPos))
     1115  {
     1116    xSetShiftedPel<bL, bSM>( iLastPos, bL ? 0 : (1 << m_iShiftPrec),  iFillSPos, REN_IS_HOLE, riError );
     1117  }
     1118}
     1119
     1120template <BlenMod iBM, Bool bBitInc> template<Bool bL, SetMod bSM> __inline Void
     1121TRenSingleModelC<iBM,bBitInc>::xExtrapolateMargin(Int iCurSPos, Int iCurPos, RMDist& riError )
     1122{
     1123  Int iSPosFullPel = xMax<Int,bL>(xZero<bL>(),m_curRangeStart);
    12431124
    12441125  m_iThisDepth = m_iCurDepth;
    1245   if (iSPosFullPel < m_iWidth)
    1246   {
    1247     xSetShiftedPelL<bSet>( iCurPos, 0, iSPosFullPel, REN_IS_FILLED, riError );
    1248   }
    1249 
    1250   for (Int iFillSPos = iSPosFullPel +1; iFillSPos < m_iWidth; iFillSPos++ )
    1251   {
    1252     xSetShiftedPelL<bSet>( iCurPos, 0, iFillSPos, REN_IS_HOLE, riError );
    1253   }
    1254 }
    1255 
    1256 template <BlenMod iBM, Bool bBitInc> template<Bool bSet> __inline Void
    1257 TRenSingleModelC<iBM,bBitInc>::xExtrapolateMarginR(Int iCurSPos, Int iCurPos, RMDist& riError )
    1258 {
    1259   //  if (iLeftSPos < 0 )
    1260   //    return;
    1261 
    1262   Int iSPosFullPel = std::min(m_iWidth-1,xRangeRightR(iCurSPos));
    1263 
    1264   m_iThisDepth = m_iCurDepth;
    1265   if (iSPosFullPel > -1)
    1266   {
    1267     xSetShiftedPelR<bSet>( iCurPos, 1 << m_iShiftPrec, iSPosFullPel, REN_IS_FILLED, riError );
    1268   }
    1269 
    1270   for (Int iFillSPos = iSPosFullPel -1; iFillSPos > -1; iFillSPos-- )
    1271   {
    1272     xSetShiftedPelR<bSet>( iCurPos , 1 << m_iShiftPrec, iFillSPos, REN_IS_HOLE, riError );
    1273   }
    1274 }
    1275 
    1276 template <BlenMod iBM, Bool bBitInc> __inline Int
     1126  if ( xGeQ<Int,bL>(xWidthMinus1<bL>(), iSPosFullPel) )
     1127  {
     1128    xSetShiftedPel<bL, bSM>( iCurPos, bL ? 0 : (1 << m_iShiftPrec) , iSPosFullPel, REN_IS_FILLED, riError );
     1129  }
     1130  for (Int iFillSPos = xPlus<Int,bL>(iSPosFullPel ,1); xGeQ<Int,bL>( xWidthMinus1<bL>(), iFillSPos ); xInc<Int,bL>(iFillSPos))
     1131  {
     1132    xSetShiftedPel<bL, bSM>( iCurPos, bL ? 0 : ( 1 << m_iShiftPrec ), iFillSPos, REN_IS_HOLE, riError );
     1133  }
     1134}
     1135
     1136template <BlenMod iBM, Bool bBitInc> template <Bool bL> __inline Int
    12771137TRenSingleModelC<iBM,bBitInc>::xShiftNewData( Int iPosX, Int iPosInNewData )
    12781138{
    12791139  RM_AOT( iPosInNewData <               0 );
    12801140  RM_AOF( iPosInNewData < m_iNewDataWidth );
    1281 
    12821141  return (iPosX << m_iShiftPrec) - m_ppiCurLUT[0][ RenModRemoveBitInc( m_piNewDepthData[iPosInNewData] )];
    12831142}
    12841143
     1144
    12851145template <BlenMod iBM, Bool bBitInc> __inline Int
     1146TRenSingleModelC<iBM,bBitInc>::xShiftDept( Int iPosXinSubPel, Int iDepth )
     1147{
     1148  return (iPosXinSubPel) - m_ppiCurLUT[0][ RenModRemoveBitInc( iDepth )];
     1149}
     1150
     1151
     1152template <BlenMod iBM, Bool bBitInc> template <Bool bL> __inline Int
    12861153TRenSingleModelC<iBM,bBitInc>::xShift( Int iPosX )
    12871154{
    12881155 RM_AOT( iPosX <        0);
    12891156 RM_AOF( iPosX < m_iWidth);
    1290 
    1291  return (iPosX  << m_iShiftPrec) - m_ppiCurLUT[0][ RenModRemoveBitInc( m_pcInputSamplesRow[m_iCurViewPos][iPosX].iD )];
    1292 }
    1293 
    1294 
    1295 template <BlenMod iBM, Bool bBitInc> __inline Int
     1157 return (iPosX  << m_iShiftPrec) - m_ppiCurLUT[0][ RenModRemoveBitInc( m_pcInputSamplesRow[(bL ? 0 : 1)][iPosX].iD )];
     1158}
     1159
     1160
     1161template <BlenMod iBM, Bool bBitInc> template <Bool bL> __inline Int
    12961162TRenSingleModelC<iBM,bBitInc>::xShift( Int iPos, Int iPosInNewData )
    12971163{
     
    13021168  else
    13031169  {
    1304     return xShift(iPos);
    1305   }
    1306 }
    1307 
    1308 template <BlenMod iBM, Bool bBitInc> __inline Int
    1309 TRenSingleModelC<iBM,bBitInc>::xRangeLeftL( Int iPos )
    1310 {
    1311   return  ( iPos +  (1 << m_iShiftPrec) - 1) >> m_iShiftPrec;
    1312 }
    1313 
    1314 
    1315 template <BlenMod iBM, Bool bBitInc> __inline Int
    1316 TRenSingleModelC<iBM,bBitInc>::xRangeLeftR( Int iPos )
    1317 {
    1318 
    1319   return  xRangeRightR( iPos ) + 1;
    1320 }
    1321 
    1322 
    1323 template <BlenMod iBM, Bool bBitInc> __inline Int
    1324 TRenSingleModelC<iBM,bBitInc>::xRangeRightL( Int iPos )
    1325 {
    1326   return xRangeLeftL(iPos) - 1;
    1327 }
    1328 
    1329 template <BlenMod iBM, Bool bBitInc> __inline Int
    1330 TRenSingleModelC<iBM,bBitInc>::xRangeRightR( Int iPos )
    1331 {
    1332   return iPos >> m_iShiftPrec;
    1333 }
    1334 
    1335 
    1336 template <BlenMod iBM, Bool bBitInc> __inline Int
    1337 TRenSingleModelC<iBM,bBitInc>::xRoundL( Int iPos )
    1338 {
    1339   return  (iPos + (( 1 << m_iShiftPrec ) >> 1 )) >> m_iShiftPrec;
    1340 }
    1341 
    1342 template <BlenMod iBM, Bool bBitInc> __inline Int
    1343 TRenSingleModelC<iBM,bBitInc>::xRoundR( Int iPos )
    1344 {
    1345   return  (m_iShiftPrec == 0) ? iPos : xRoundL(iPos - 1);
     1170    return xShift<bL>(iPos);
     1171  }
     1172}
     1173
     1174template <BlenMod iBM, Bool bBitInc> template<Bool bL> __inline Int
     1175TRenSingleModelC<iBM,bBitInc>::xRangeLeft( Int iPos )
     1176{
     1177  if ( bL )
     1178  {
     1179    return  ( iPos +  (1 << m_iShiftPrec) - 1) >> m_iShiftPrec;
     1180  }
     1181  else
     1182  {
     1183    return iPos >> m_iShiftPrec;
     1184  }
     1185}
     1186
     1187
     1188
     1189template <BlenMod iBM, Bool bBitInc> template<Bool bL> __inline Int
     1190TRenSingleModelC<iBM,bBitInc>::xRangeRight( Int iPos )
     1191{
     1192  if ( bL )
     1193  {
     1194    return xRangeLeft<true>(iPos)    - 1;
     1195  }
     1196  else
     1197  {
     1198    return xRangeLeft<false>( iPos ) + 1;   
     1199  } 
     1200}
     1201
     1202template <BlenMod iBM, Bool bBitInc> template<Bool bL> __inline Int
     1203TRenSingleModelC<iBM,bBitInc>::xRound( Int iPos )
     1204{
     1205  if( bL )
     1206  { 
     1207    return  (iPos + (( 1 << m_iShiftPrec ) >> 1 )) >> m_iShiftPrec;
     1208  }
     1209  else
     1210  {
     1211    return  (m_iShiftPrec == 0) ? iPos : xRound<true>(iPos - 1);
     1212  }
    13461213}
    13471214
     
    13871254}
    13881255
    1389 template <BlenMod iBM, Bool bBitInc> template<Bool bSet> __inline Void
    1390 TRenSingleModelC<iBM,bBitInc>::xSetShiftedPelL(Int iSourcePos, Int iSubSourcePos, Int iTargetSPos, Pel iFilled, RMDist& riError )
     1256template <BlenMod iBM, Bool bBitInc> template<Bool bL, SetMod bSM> __inline Void
     1257TRenSingleModelC<iBM,bBitInc>::xSetShiftedPel(Int iSourcePos, Int iSubSourcePos, Int iTargetSPos, Pel iFilled, RMDist& riError )
    13911258{
    13921259  RM_AOT( iSourcePos    <  0                   );
     
    13951262  RM_AOT( iSubSourcePos >  (1 << m_iShiftPrec) );
    13961263  RM_AOT( iTargetSPos   < 0                    );
    1397   RM_AOT( iTargetSPos   >= m_iWidth            ); 
    1398 
    1399   RenModelOutPels* pcOutSample = m_pcOutputSamplesRow              + iTargetSPos;
    1400   RenModelInPels * pcInSample  = m_pcInputSamplesRow[VIEWPOS_LEFT] + iSourcePos ;
    1401 
    1402   if ( iBM != BLEND_NONE )
    1403   {
    1404     xSetShiftedPelBlendL<bSet>  (pcInSample, iSubSourcePos, pcOutSample, iFilled, riError);
    1405   }
    1406   else
    1407   {
    1408     xSetShiftedPelNoBlendL<bSet>(pcInSample, iSubSourcePos, pcOutSample, iFilled, riError);
    1409   }
    1410 }
    1411 
    1412 template <BlenMod iBM, Bool bBitInc> template<Bool bSet> __inline Void
    1413 TRenSingleModelC<iBM,bBitInc>::xSetShiftedPelNoBlendL(RenModelInPels* pcInSample, Int iSubSourcePos, RenModelOutPels* pcOutSample, Pel iFilled, RMDist& riError )
    1414 {
    1415   if ( bSet )
    1416   {
    1417     // Filled
    1418     pcOutSample->iFilledLeft = iFilled;
    1419 
    1420     // Yuv
    1421     pcOutSample->iYLeft  = pcInSample->aiY[iSubSourcePos];
    1422 #if H_3D_VSO_COLOR_PLANES
    1423     pcOutSample->iULeft  = pcInSample->aiU[iSubSourcePos];
    1424     pcOutSample->iVLeft  = pcInSample->aiV[iSubSourcePos];
    1425 
    1426     pcOutSample->iError = xGetDist( pcOutSample->iYLeft - pcOutSample->iYRef,
    1427                                     pcOutSample->iULeft - pcOutSample->iURef,   
    1428                                     pcOutSample->iVLeft - pcOutSample->iVRef
    1429                                   );   
    1430 #else
    1431     pcOutSample->iError = xGetDist( pcOutSample->iYLeft - pcOutSample->iYRef );   
     1264  RM_AOT( iTargetSPos   >= m_iWidth            );
     1265
     1266  RenModelInPels * pcInSample  = m_pcInputSamplesRow[ bL ? VIEWPOS_LEFT : VIEWPOS_RIGHT ] + iSourcePos ;
     1267
     1268  Pel iY;
     1269  Pel iYCurNew = pcInSample->aiY[iSubSourcePos];   
     1270#if H_3D_VSO_COLOR_PLANES
     1271  Pel iU;
     1272  Pel iUCurNew = pcInSample->aiU[iSubSourcePos];
     1273  Pel iV;
     1274  Pel iVCurNew = pcInSample->aiV[iSubSourcePos];;
    14321275#endif   
    1433    
     1276
     1277  const Bool bFullMode = ( bSM == GET_FULL || bSM == SET_FULL );
     1278
     1279  RenModelOutPels*    pcOutSample    = bFullMode ? ( m_pcOutputSamplesRow    + iTargetSPos ) : NULL;
     1280  RenModelLimOutPels* pcLimOutSample = bFullMode ? NULL  : ( m_pcLimOutputSamplesRow + iTargetSPos );
     1281
     1282  if ( iBM == BLEND_NONE )
     1283  {
     1284    iY = iYCurNew;
     1285#if H_3D_VSO_COLOR_PLANES
     1286    iU = iUCurNew;
     1287    iV = iVCurNew;
     1288#endif
    14341289  }
    14351290  else
    14361291  {
    1437 #if H_3D_VSO_COLOR_PLANES
    1438     riError += xGetDist( pcInSample->aiY[iSubSourcePos] - pcOutSample->iYRef,
    1439                          pcInSample->aiU[iSubSourcePos] - pcOutSample->iURef,
    1440                          pcInSample->aiV[iSubSourcePos] - pcOutSample->iVRef
    1441                        );
    1442 #else               
    1443     riError += xGetDist( pcInSample->aiY[iSubSourcePos] - pcOutSample->iYRef );
    1444 #endif
    1445 
    1446     riError -= pcOutSample->iError;
    1447   }
    1448 }
    1449 
    1450 template <BlenMod iBM, Bool bBitInc> template<Bool bSet> __inline Void
    1451 TRenSingleModelC<iBM,bBitInc>::xSetShiftedPelBlendL(RenModelInPels* pcInSample, Int iSubSourcePos, RenModelOutPels* pcOutSample, Pel iFilled, RMDist& riError )
    1452 {
    1453   Pel piBlendedValueY;
    1454 #if H_3D_VSO_COLOR_PLANES
    1455   Pel piBlendedValueU;
    1456   Pel piBlendedValueV;
    1457 #endif
    1458 
    1459   xGetBlendedValue (
    1460     pcInSample ->aiY[iSubSourcePos],
    1461     pcOutSample->iYRight,   
    1462 #if H_3D_VSO_COLOR_PLANES
    1463     pcInSample ->aiU[iSubSourcePos],
    1464     pcOutSample->iURight,   
    1465     pcInSample ->aiV[iSubSourcePos],
    1466     pcOutSample->iVRight,   
    1467 #endif
    1468     m_piInvZLUTLeft [RenModRemoveBitInc(m_iThisDepth)        ],
    1469     m_piInvZLUTRight[RenModRemoveBitInc(pcOutSample->iDRight)],
    1470     iFilled,
    1471     pcOutSample->iFilledRight  ,
    1472     piBlendedValueY
    1473 #if H_3D_VSO_COLOR_PLANES
    1474     , piBlendedValueU,
    1475     piBlendedValueV
    1476 #endif
    1477     );
    1478 
    1479   if ( bSet )
     1292    Pel iYOther      = bFullMode ? ( bL ? pcOutSample->iYRight : pcOutSample->iYLeft) : pcLimOutSample->iYOther;
     1293#if H_3D_VSO_COLOR_PLANES
     1294    Pel iUOther      = bFullMode ? ( bL ? pcOutSample->iURight : pcOutSample->iULeft ) : pcLimOutSample->iUOther;
     1295    Pel iVOther      = bFullMode ? ( bL ? pcOutSample->iVRight : pcOutSample->iVLeft ) : pcLimOutSample->iVOther;
     1296#endif
     1297    Int iFilledOther = bFullMode ? ( bL ? pcOutSample->iFilledRight : pcOutSample->iFilledLeft ) : pcLimOutSample->iFilledOther;
     1298    Pel iDOther      = bFullMode ? ( bL ? pcOutSample->iDRight      : pcOutSample->iDLeft      ) : pcLimOutSample->iDOther;
     1299
     1300    xGetBlendedValue<bL, bSM>(
     1301      iY,
     1302      bL ? iYCurNew : iYOther,
     1303      bL ? iYOther  : iYCurNew,
     1304#if H_3D_VSO_COLOR_PLANES
     1305      iU,
     1306      bL ? iUCurNew  : iUOther,
     1307      bL ? iUOther   : iUCurNew,
     1308      iV,
     1309      bL ? iVCurNew  : iVOther,
     1310      bL ? iVOther   : iVCurNew,         
     1311#endif
     1312      bL ? iFilled      : iFilledOther,
     1313      bL ? iFilledOther : iFilled,
     1314      m_piInvZLUTLeft [RenModRemoveBitInc( bL ? m_iThisDepth : iDOther)],
     1315      m_piInvZLUTRight[RenModRemoveBitInc( bL ? iDOther      : m_iThisDepth)]
     1316      );
     1317  }
     1318
     1319
     1320  Int iDist = xGetDist(
     1321    iY - ( bFullMode ? pcOutSample->iYRef : pcLimOutSample->iYRef )
     1322#if H_3D_VSO_COLOR_PLANES
     1323  , iU - ( bFullMode ? pcOutSample->iURef : pcLimOutSample->iURef )
     1324  , iV - ( bFullMode ? pcOutSample->iVRef : pcLimOutSample->iVRef )
     1325#endif
     1326  );
     1327
     1328  if ( bSM == GET_FULL || bSM == GET_SIMP )
    14801329  {   
    1481     // Set values
    1482     pcOutSample->iDLeft      = m_iThisDepth;
    1483     pcOutSample->iYLeft      = pcInSample ->aiY[iSubSourcePos];
    1484     pcOutSample->iYBlended   = piBlendedValueY;   
    1485 #if H_3D_VSO_COLOR_PLANES 
    1486     pcOutSample->iULeft      = pcInSample ->aiU[iSubSourcePos];
    1487     pcOutSample->iUBlended   = piBlendedValueU;   
    1488     pcOutSample->iVLeft      = pcInSample ->aiV[iSubSourcePos];
    1489     pcOutSample->iVBlended   = piBlendedValueV;   
    1490 #endif
    1491     pcOutSample->iFilledLeft = iFilled;
    1492 
    1493     // Get Error
    1494     Int iDiffY = pcOutSample->iYRef - piBlendedValueY;
    1495 #if H_3D_VSO_COLOR_PLANES
    1496     Int iDiffU = pcOutSample->iURef - piBlendedValueU;
    1497     Int iDiffV = pcOutSample->iVRef - piBlendedValueV;
    1498     pcOutSample->iError  = xGetDist(iDiffY, iDiffU, iDiffV );
    1499 #else
    1500     pcOutSample->iError  = xGetDist(iDiffY );
    1501 #endif
    1502   }
    1503   else
    1504   {
    1505     Int iDiffY = pcOutSample->iYRef - piBlendedValueY;
    1506 #if H_3D_VSO_COLOR_PLANES
    1507     Int iDiffU = pcOutSample->iURef - piBlendedValueU;
    1508     Int iDiffV = pcOutSample->iVRef - piBlendedValueV;
    1509     riError   += ( xGetDist( iDiffY, iDiffU, iDiffV ) - pcOutSample->iError );
    1510 
    1511 #else
    1512     riError   += ( xGetDist( iDiffY ) - pcOutSample->iError  );
    1513 #endif
    1514 
    1515   }
    1516 }
    1517 
    1518 
    1519 template <BlenMod iBM, Bool bBitInc> template<Bool bSet> __inline Void
    1520 TRenSingleModelC<iBM,bBitInc>::xSetShiftedPelR(Int iSourcePos, Int iSubSourcePos, Int iTargetSPos, Pel iFilled, RMDist& riError )
    1521 {
    1522   RM_AOT( iSourcePos    <  0                     );
    1523   RM_AOT( iSourcePos    >= m_iWidth              );
    1524   RM_AOT( iSubSourcePos <  0                     );
    1525   RM_AOT( iSubSourcePos >= (1 << m_iShiftPrec)+1 );
    1526   RM_AOT( iTargetSPos   < 0                      );
    1527   RM_AOT( iTargetSPos   >= m_iWidth              ); 
    1528 
    1529   RenModelOutPels* pcOutSample = m_pcOutputSamplesRow               + iTargetSPos;
    1530   RenModelInPels * pcInSample  = m_pcInputSamplesRow[VIEWPOS_RIGHT] + iSourcePos ;
    1531 
    1532   if ( iBM != BLEND_NONE )
    1533   {
    1534     xSetShiftedPelBlendR<bSet>   (pcInSample, iSubSourcePos, pcOutSample, iFilled, riError);
    1535   }
    1536   else
    1537   {
    1538     xSetShiftedPelNoBlendR<bSet> (pcInSample, iSubSourcePos, pcOutSample, iFilled, riError);
    1539   }
    1540 }
    1541 
    1542 template <BlenMod iBM, Bool bBitInc> template<Bool bSet> __inline Void
    1543 TRenSingleModelC<iBM,bBitInc>::xSetShiftedPelNoBlendR(RenModelInPels* pcInSample, Int iSubSourcePos, RenModelOutPels* pcOutSample, Pel iFilled, RMDist& riError )
    1544 {
    1545   if ( bSet )
    1546   {
    1547     // Filled
    1548     pcOutSample->iFilledRight = iFilled;
    1549 
    1550     // Yuv
    1551     pcOutSample->iYRight  = pcInSample->aiY[iSubSourcePos];
    1552 #if H_3D_VSO_COLOR_PLANES
    1553     pcOutSample->iURight  = pcInSample->aiU[iSubSourcePos];
    1554     pcOutSample->iVRight  = pcInSample->aiV[iSubSourcePos];
    1555 
    1556     pcOutSample->iError = xGetDist(
    1557       pcOutSample->iYRight - pcOutSample->iYRef,
    1558       pcOutSample->iURight - pcOutSample->iURef,   
    1559       pcOutSample->iVRight - pcOutSample->iVRef
    1560       );   
    1561 #else
    1562     pcOutSample->iError = xGetDist( pcOutSample->iYRight - pcOutSample->iYRef );   
    1563 #endif   
    1564 
    1565   }
    1566   else
    1567   {
    1568 #if H_3D_VSO_COLOR_PLANES
    1569     riError += xGetDist( pcInSample->aiY[iSubSourcePos] - pcOutSample->iYRef,
    1570       pcInSample->aiU[iSubSourcePos] - pcOutSample->iURef,
    1571       pcInSample->aiV[iSubSourcePos] - pcOutSample->iVRef
    1572       );
    1573 #else               
    1574     riError += xGetDist( pcInSample->aiY[iSubSourcePos] - pcOutSample->iYRef );
    1575 #endif
    1576 
    1577     riError -= pcOutSample->iError;
    1578   }
    1579 }
    1580 
    1581 template <BlenMod iBM, Bool bBitInc> template<Bool bSet> __inline Void
    1582 TRenSingleModelC<iBM,bBitInc>::xSetShiftedPelBlendR(RenModelInPels* pcInSample, Int iSubSourcePos, RenModelOutPels* pcOutSample, Pel iFilled, RMDist& riError )
    1583 {
    1584   Pel piBlendedValueY;
    1585 #if H_3D_VSO_COLOR_PLANES
    1586   Pel piBlendedValueU;
    1587   Pel piBlendedValueV;
    1588 #endif
    1589 
    1590   xGetBlendedValue (
    1591     pcOutSample->iYLeft,
    1592     pcInSample ->aiY[iSubSourcePos],       
    1593 #if H_3D_VSO_COLOR_PLANES
    1594     pcOutSample->iULeft,   
    1595     pcInSample ->aiU[iSubSourcePos],
    1596     pcOutSample->iVLeft,   
    1597     pcInSample ->aiV[iSubSourcePos],
    1598 #endif
    1599     m_piInvZLUTLeft  [RenModRemoveBitInc(pcOutSample->iDLeft)],
    1600     m_piInvZLUTRight [RenModRemoveBitInc(m_iThisDepth)       ],
    1601     pcOutSample->iFilledLeft,
    1602     iFilled,
    1603     piBlendedValueY
    1604 #if H_3D_VSO_COLOR_PLANES
    1605     , piBlendedValueU,
    1606     piBlendedValueV
    1607 #endif
    1608     );
    1609 
    1610   if ( bSet )
    1611   {   
    1612     // Set values
    1613     pcOutSample->iDRight     = m_iThisDepth;
    1614     pcOutSample->iYRight     = pcInSample ->aiY[iSubSourcePos];
    1615     pcOutSample->iYBlended   = piBlendedValueY;   
    1616 #if H_3D_VSO_COLOR_PLANES 
    1617     pcOutSample->iURight     = pcInSample ->aiU[iSubSourcePos];
    1618     pcOutSample->iUBlended   = piBlendedValueU;   
    1619     pcOutSample->iVRight     = pcInSample ->aiV[iSubSourcePos];
    1620     pcOutSample->iVBlended   = piBlendedValueV;   
    1621 #endif
    1622     pcOutSample->iFilledRight = iFilled;
    1623 
    1624     // Get Error
    1625     Int iDiffY = pcOutSample->iYRef - piBlendedValueY;
    1626 #if H_3D_VSO_COLOR_PLANES
    1627     Int iDiffU = pcOutSample->iURef - piBlendedValueU;
    1628     Int iDiffV = pcOutSample->iVRef - piBlendedValueV;
    1629     pcOutSample->iError  = xGetDist(iDiffY, iDiffU, iDiffV );
    1630 #else
    1631     pcOutSample->iError  = xGetDist(iDiffY );
    1632 #endif
    1633   }
    1634   else
    1635   {
    1636     Int iDiffY = pcOutSample->iYRef - piBlendedValueY;
    1637 #if H_3D_VSO_COLOR_PLANES
    1638     Int iDiffU = pcOutSample->iURef - piBlendedValueU;
    1639     Int iDiffV = pcOutSample->iVRef - piBlendedValueV;
    1640     riError   += ( xGetDist( iDiffY, iDiffU, iDiffV ) - pcOutSample->iError );
    1641 #else
    1642     riError   += ( xGetDist( iDiffY ) -  pcOutSample->iError  );
    1643 #endif
    1644   }
     1330    riError += ( iDist - ( bFullMode ? pcOutSample->iError : pcLimOutSample->iError ) );
     1331  }
     1332  else // bSM == SET_FULL
     1333  {
     1334    Int& riErrorStr = bFullMode ? pcOutSample->iError : pcLimOutSample->iError;
     1335    riErrorStr      = iDist;
     1336
     1337    if ( bFullMode )
     1338    {     
     1339      if ( iBM != BLEND_NONE )
     1340      {       
     1341        pcOutSample->iYBlended   = iY;
     1342#if H_3D_VSO_COLOR_PLANES
     1343        pcOutSample->iUBlended   = iU;
     1344        pcOutSample->iVBlended   = iV;
     1345#endif
     1346      }
     1347
     1348      if ( bL )
     1349      {
     1350        pcOutSample->iDLeft      = m_iThisDepth;
     1351        pcOutSample->iFilledLeft = iFilled;
     1352        pcOutSample->iYLeft      = iYCurNew;
     1353#if  H_3D_VSO_COLOR_PLANES
     1354        pcOutSample->iULeft      = iUCurNew;
     1355        pcOutSample->iVLeft      = iVCurNew;
     1356#endif
     1357      }
     1358      else
     1359      {
     1360        pcOutSample->iDRight      = m_iThisDepth;
     1361        pcOutSample->iFilledRight = iFilled;
     1362        pcOutSample->iYRight      = iYCurNew;
     1363#if  H_3D_VSO_COLOR_PLANES
     1364        pcOutSample->iURight      = iUCurNew;
     1365        pcOutSample->iVRight      = iVCurNew;
     1366#endif
     1367      }
     1368    }
     1369  }   
    16451370}
    16461371
     
    16871412
    16881413
    1689 #if H_3D_VSO_COLOR_PLANES
    1690 template <BlenMod iBM, Bool bBitInc>  __inline Void
    1691 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 )
    1692 #else
    1693 template <BlenMod iBM, Bool bBitInc>  __inline Void
    1694 TRenSingleModelC<iBM,bBitInc>::xGetBlendedValue( Pel iYL, Pel iYR, Pel iDepthL, Pel iDepthR, Int iFilledL, Int iFilledR, Pel& riY )
    1695 #endif
    1696 {
    1697 
     1414
     1415template <BlenMod iBM, Bool bBitInc>  template< Bool bL, SetMod bSM > __inline Void
     1416  TRenSingleModelC<iBM,bBitInc>::xGetBlendedValue( Pel& riY, Pel iYL,  Pel iYR, 
     1417#if H_3D_VSO_COLOR_PLANES
     1418                                                   Pel& riU, Pel iUL,  Pel iUR,  Pel& riV, Pel iVL,  Pel iVR, 
     1419#endif
     1420                                                   Int iFilledL,  Int iFilledR, Pel iDepthL,  Pel iDepthR  )
     1421
    16981422  RM_AOT( iBM != BLEND_AVRG && iBM != BLEND_LEFT && iBM != BLEND_RIGHT );
    16991423
     
    17021426    if (iBM == BLEND_LEFT )
    17031427    {
    1704 #if H_3D_VSO_COLOR_PLANES
    1705       xGetBlendedValueBM1(  iYL,  iYR,  iUL,  iUR,  iVL,  iVR,  iDepthL,  iDepthR,  iFilledL,  iFilledR,  riY,  riU, riV );
    1706 #else
    1707       xGetBlendedValueBM1(  iYL,  iYR,  iDepthL,  iDepthR,  iFilledL,  iFilledR,  riY );
    1708 #endif
     1428      xGetBlendedValueBM1<bL, bSM>( riY, iYL,  iYR, 
     1429#if H_3D_VSO_COLOR_PLANES
     1430        riU, iUL,  iUR,  riV, iVL,  iVR, 
     1431#endif
     1432        iFilledL,  iFilledR, iDepthL,  iDepthR  );
    17091433    }
    17101434    else
    17111435    {
    1712 #if H_3D_VSO_COLOR_PLANES
    1713       xGetBlendedValueBM2(  iYL,  iYR,  iUL,  iUR,  iVL,  iVR,  iDepthL,  iDepthR,  iFilledL,  iFilledR,  riY,  riU, riV );
    1714 #else
    1715       xGetBlendedValueBM2(  iYL,  iYR, iDepthL,  iDepthR,  iFilledL,  iFilledR,  riY );
    1716 #endif
     1436      xGetBlendedValueBM2<bL, bSM>(  riY, iYL,  iYR, 
     1437#if H_3D_VSO_COLOR_PLANES
     1438        riU, iUL,  iUR,  riV, iVL,  iVR, 
     1439#endif
     1440        iFilledL,  iFilledR, iDepthL,  iDepthR );
    17171441    }
    17181442    return;
     
    17251449    if ( abs ( iDepthDifference ) <= m_iBlendZThres )
    17261450    {
    1727       if      ((iFilledL == REN_IS_FILLED) && ( iFilledR != REN_IS_FILLED))
    1728       {
    1729         riY = xBlend( iYL, iYR, iFilledR >> 1 );
    1730 #if H_3D_VSO_COLOR_PLANES
    1731         riU = xBlend( iUL, iUR, iFilledR >> 1 );
    1732         riV = xBlend( iVL, iVR, iFilledR >> 1 );
    1733 #endif
    1734 
    1735       }
    1736       else if ((iFilledL != REN_IS_FILLED) && ( iFilledR == REN_IS_FILLED))
    1737       {
    1738         riY = xBlend( iYR, iYL, (iFilledL >> 1) );
    1739 #if H_3D_VSO_COLOR_PLANES
    1740         riU = xBlend( iUR, iUL, (iFilledL >> 1) );
    1741         riV = xBlend( iVR, iVL, (iFilledL >> 1) );
    1742 #endif
    1743       }
    1744       else
    17451451      {
    17461452        riY = xBlend( iYL, iYR, m_iBlendDistWeight );
     
    17601466    }
    17611467    else
    1762     {
     1468    {     
    17631469      riY = iYR;
    17641470#if H_3D_VSO_COLOR_PLANES
     
    18081514}
    18091515
    1810 template <BlenMod iBM, Bool bBitInc> __inline Void
    1811 #if H_3D_VSO_COLOR_PLANES
    1812 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 )
    1813 #else
    1814 TRenSingleModelC<iBM,bBitInc>::xGetBlendedValueBM1( Pel iYL, Pel iYR, Pel iDepthL, Pel iDepthR, Int iFilledL, Int iFilledR, Pel& riY )
    1815 #endif
     1516template <BlenMod iBM, Bool bBitInc> template< Bool bL, SetMod SM > __inline Void
     1517TRenSingleModelC<iBM,bBitInc>::xGetBlendedValueBM1( Pel& riY, Pel iYL,  Pel iYR, 
     1518#if H_3D_VSO_COLOR_PLANES
     1519                                                    Pel& riU, Pel iUL,  Pel iUR,  Pel& riV, Pel iVL,  Pel iVR, 
     1520#endif
     1521                                                    Int iFilledL,  Int iFilledR, Pel iDepthL,  Pel iDepthR  )
    18161522{
    18171523  if ( iFilledL == REN_IS_FILLED ||  iFilledR == REN_IS_HOLE )
     
    18411547}
    18421548
    1843 template <BlenMod iBM, Bool bBitInc> __inline Void
    1844 #if H_3D_VSO_COLOR_PLANES
    1845 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 )
    1846 #else
    1847 TRenSingleModelC<iBM,bBitInc>::xGetBlendedValueBM2( Pel iYL, Pel iYR, Pel iDepthL, Pel iDepthR, Int iFilledL, Int iFilledR, Pel& riY )
    1848 #endif
     1549template <BlenMod iBM, Bool bBitInc> template< Bool bL, SetMod SM > __inline Void
     1550  TRenSingleModelC<iBM,bBitInc>::xGetBlendedValueBM2( Pel& riY, Pel iYL,  Pel iYR, 
     1551#if H_3D_VSO_COLOR_PLANES
     1552                                                      Pel& riU, Pel iUL,  Pel iUR,  Pel& riV, Pel iVL,  Pel iVR, 
     1553#endif
     1554                                                      Int iFilledL,  Int iFilledR, Pel iDepthL,  Pel iDepthR  )
    18491555{
    18501556  if      ( iFilledR == REN_IS_FILLED ||  iFilledL == REN_IS_HOLE )
     
    18991605
    19001606#if H_3D_VSO_EARLY_SKIP
    1901 template <BlenMod iBM, Bool bBitInc>
    1902 __inline Bool
    1903 TRenSingleModelC<iBM,bBitInc>::xDetectEarlySkipL( Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, const Pel* piNewData, const Pel* piOrgData, Int iOrgStride)
     1607template <BlenMod iBM, Bool bBitInc> template <Bool bL > __inline Bool
     1608TRenSingleModelC<iBM,bBitInc>::xDetectEarlySkip( Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, const Pel* piNewData, const Pel* piOrgData, Int iOrgStride)
    19041609{
    19051610  RM_AOF( m_bEarlySkip );
    1906   const Int iCurViewPos = 0;
     1611  const Int iCurViewPos = bL ? 0 : 1;
    19071612  Int** ppiCurLUT       = m_appiShiftLut   [ iCurViewPos ];
    19081613 
     
    19301635  return bNoDiff;
    19311636}
    1932 
    1933 template <BlenMod iBM, Bool bBitInc>
    1934 __inline Bool
    1935 TRenSingleModelC<iBM,bBitInc>::xDetectEarlySkipR( Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, const Pel* piNewData, const Pel* piOrgData, Int iOrgStride)
    1936 {
    1937   RM_AOF( m_bEarlySkip );
    1938   Bool bNoDiff  = true;
    1939 
    1940   const Int iCurViewPos = 1;
    1941   Int** ppiCurLUT       = m_appiShiftLut   [ iCurViewPos ];
    1942 
    1943   for ( Int iPosY = 0; iPosY < iHeight; iPosY++ )
    1944   {
    1945     m_pbHorSkip[iPosY] = true;
    1946 
    1947     for (Int iPosX = 0; iPosX < iWidth; iPosX++)
    1948     {
    1949       Int iDisparityRec = abs( ppiCurLUT[0][ RenModRemoveBitInc(piNewData[iPosX])] );
    1950       Int iDisparityOrg = abs( ppiCurLUT[0][ RenModRemoveBitInc(piOrgData[iPosX])] );
    1951 
    1952       if( iDisparityRec != iDisparityOrg )
    1953       {
    1954         m_pbHorSkip[iPosY] = false;
    1955         bNoDiff            = false;
    1956         break;
    1957       }
    1958     }
    1959 
    1960     piNewData += iStride;
    1961     piOrgData += iOrgStride;
    1962   }
    1963   return bNoDiff;
    1964 }
    19651637#endif
    19661638#endif // NH_3D
  • trunk/source/Lib/TLibRenderer/TRenSingleModel.h

    r1313 r1396  
    7070  virtual ~TRenSingleModel() { } 
    7171#if H_3D_VSO_EARLY_SKIP
    72   virtual Void   create    ( Int iMode, Int iWidth, Int iHeight, Int iShiftPrec, Int*** aaaiSubPelShiftTable, Int iHoleMargin, Bool bUseOrgRef, Int iBlendMode, Bool bEarlySkip ) = 0;
    73 #else
    74   virtual Void   create    ( Int iMode, Int iWidth, Int iHeight, Int iShiftPrec, Int*** aaaiSubPelShiftTable, Int iHoleMargin, Bool bUseOrgRef, Int iBlendMode ) = 0;
    75 #endif
    76 
    77   // Set Frame dependent data
    78   virtual Void   setLRView ( Int iViewPos, Pel** apiCurVideoPel, Int* aiCurVideoStride, Pel* piCurDepthPel, Int iCurDepthStride ) = 0;
    79   virtual Void   setupPart ( UInt uiHorOffset,       Int iUsedHeight ) = 0;
    80   virtual Void   setup     ( TComPicYuv* pcOrgVideo, Int** ppiShiftLutLeft, Int** ppiBaseShiftLutLeft, Int** ppiShiftLutRight,  Int** ppiBaseShiftLutRight,  Int iDistToLeft, Bool bKeepReference ) = 0;
     72  virtual Void   create    ( Int iMode, Int iWidth, Int iHeight, Int iShiftPrec, Int*** aaaiSubPelShiftTable, Int iHoleMargin, Bool bUseOrgRef, Int iBlendMode, Bool bLimOutput, Bool bEarlySkip ) = 0;
     73#else
     74  virtual Void   create    ( Int iMode, Int iWidth, Int iHeight, Int iShiftPrec, Int*** aaaiSubPelShiftTable, Int iHoleMargin, Bool bUseOrgRef, Int iBlendMode, Bool bLimOutput ) = 0;
     75#endif
     76
     77  // Setup
     78  virtual Void   setLRView         ( Int iViewPos, Pel** apiCurVideoPel, Int* aiCurVideoStride, Pel* piCurDepthPel, Int iCurDepthStride ) = 0;
     79  virtual Void   setupPart         ( UInt uiHorOffset,       Int iUsedHeight ) = 0;
     80#if RM_FIX_SETUP
     81  virtual Void   setupLut          ( Int** ppiShiftLutLeft, Int** ppiBaseShiftLutLeft, Int** ppiShiftLutRight, Int** ppiBaseShiftLutRight, Int iDistToLeft ) = 0;
     82  virtual Void   setupRefView      ( TComPicYuv* pcOrgVideo ) = 0;
     83
     84  virtual Void   renderAll                   ()                     = 0;
     85  virtual Void   setStructSynthViewAsRefView ()                     = 0;
     86  virtual Void   resetStructError            ()                     = 0;
     87  virtual Void   setLimOutStruct             ( Int iSourceViewPos ) = 0;
     88#else
     89  virtual Void   setupLutAndRef    ( TComPicYuv* pcOrgVideo, Int** ppiShiftLutLeft, Int** ppiBaseShiftLutLeft, Int** ppiShiftLutRight, Int** ppiBaseShiftLutRight, Int iDistToLeft, Bool bRenderRef ) = 0;
     90  virtual Void   setupInitialState ( Int curViewPosInModel ) = 0;
     91#endif
    8192
    8293  // Set Data
     
    114125    // depth
    115126    Pel iD        ; // depth
    116 
    117     // state
    118     Bool bOccluded; // Occluded
     127   Int aiOccludedPos; // Occluded
     128
     129  };
     130
     131  struct RenModelLimOutPels
     132  {
     133    Pel iDOther;
     134    Int iFilledOther;
     135    // video
     136    Pel iYOther;
     137    Pel iYRef  ;
     138#if H_3D_VSO_COLOR_PLANES
     139    Pel iUOther;
     140    Pel iURef  ;
     141    Pel iVOther;
     142    Pel iVRef  ;
     143#endif 
     144    Int iError ;
    119145  };
    120146
     
    161187  // Create Model
    162188#if H_3D_VSO_EARLY_SKIP
    163   Void   create    ( Int iMode, Int iWidth, Int iHeight, Int iShiftPrec, Int*** aaaiSubPelShiftTable, Int iHoleMargin, Bool bUseOrgRef, Int iBlendMode, Bool bEarlySkip  );
    164 #else
    165   Void   create    ( Int iMode, Int iWidth, Int iHeight, Int iShiftPrec, Int*** aaaiSubPelShiftTable, Int iHoleMargin, Bool bUseOrgRef, Int iBlendMode );
    166 #endif
    167 
    168   // Set Frame dependent data
    169   Void   setLRView ( Int iViewPos, Pel** apiCurVideoPel, Int* aiCurVideoStride, Pel* piCurDepthPel, Int iCurDepthStride );
    170   Void   setupPart ( UInt uiHorOffset,       Int uiUsedHeight );
    171   Void   setup     ( TComPicYuv* pcOrgVideo, Int** ppiShiftLutLeft, Int** ppiBaseShiftLutLeft, Int** ppiShiftLutRight,  Int** ppiBaseShiftLutRight,  Int iDistToLeft, Bool bKeepReference );
     189  Void   create    ( Int iMode, Int iWidth, Int iHeight, Int iShiftPrec, Int*** aaaiSubPelShiftTable, Int iHoleMargin, Bool bUseOrgRef, Int iBlendMode, Bool bLimOutput, Bool bEarlySkip  );
     190#else
     191  Void   create    ( Int iMode, Int iWidth, Int iHeight, Int iShiftPrec, Int*** aaaiSubPelShiftTable, Int iHoleMargin, Bool bUseOrgRef, Int iBlendMode, Bool bLimOutput );
     192#endif
     193
     194  // Setup
     195  Void   setLRView         ( Int iViewPos, Pel** apiCurVideoPel, Int* aiCurVideoStride, Pel* piCurDepthPel, Int iCurDepthStride ); 
     196  Void   setupPart         ( UInt uiHorOffset,       Int uiUsedHeight );
     197#if RM_FIX_SETUP
     198  Void   setupLut          (  Int** ppiShiftLutLeft, Int** ppiBaseShiftLutLeft, Int** ppiShiftLutRight, Int** ppiBaseShiftLutRight, Int iDistToLeft);
     199  Void   setupRefView      ( TComPicYuv* pcOrgVideo );
     200 
     201  __inline   Void   renderAll( );
     202  Void              setStructSynthViewAsRefView ();
     203  Void              resetStructError            ();
     204  Void              setLimOutStruct             ( Int iSourceViewPos );
     205#else
     206  Void   setupLutAndRef    ( TComPicYuv* pcOrgVideo, Int** ppiShiftLutLeft, Int** ppiBaseShiftLutLeft, Int** ppiShiftLutRight, Int** ppiBaseShiftLutRight, Int iDistToLeft, Bool bRenderRef );
     207  Void   setupInitialState ( Int curViewPosInModel );
     208#endif
     209
    172210
    173211#if H_3D_VSO_EARLY_SKIP
    174212  Void   setDepth  ( Int iViewPos,                 Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, const Pel* piNewData, const Pel* piOrgData, Int iOrgStride );
    175 #else                                                                                                                   
     213#else
    176214  Void   setDepth  ( Int iViewPos,                 Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, const Pel* piNewData );
    177 #endif                                                                                                                   
     215#endif
    178216  Void   setVideo  ( Int iViewPos,     Int iPlane, Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, const Pel* piNewData );
    179                                                                                                                          
    180   // Get Distortion                                                                                                     
    181 #if H_3D_VSO_EARLY_SKIP                                                                                                 
     217
     218  // Get Distortion
     219#if H_3D_VSO_EARLY_SKIP
    182220  RMDist getDistDepth  ( Int iViewPos,             Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, const Pel* piNewData, const Pel * piOrgData , Int iOrgStride);
    183 #else                                                                                                                   
     221#else
    184222  RMDist getDistDepth  ( Int iViewPos,             Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, const Pel* piNewData );
    185 #endif                                                                                                                   
     223#endif
    186224  RMDist getDistVideo  ( Int iViewPos, Int iPlane, Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, const Pel* piNewData );
    187225
     
    191229
    192230private:
     231
     232#if !RM_FIX_SETUP
     233   __inline Void  xRenderAll( );
     234#endif
     235
     236
     237#if H_3D_VSO_EARLY_SKIP
     238    template < Bool bL, SetMod iSM > RMDist xSetOrGet( Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, const Pel* piNewData, Pel* piOrgData, Int iOrgStride );     
     239#else
     240    template < Bool bL, SetMod iSM > RMDist xSetOrGet( Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, const Pel* piNewData );
     241#endif
     242
    193243  // Set and inc Current Row
    194   __inline Void   xSetViewRow(  Int iPosY );
    195   __inline Void   xIncViewRow();
     244  template< SetMod bSM  > __inline Void   xSetViewRow(  Int iPosY );
     245  template< SetMod bSM  > __inline Void   xIncViewRow();
    196246
    197247  /////  Rendering /////
    198   // Left to Right
    199 #if H_3D_VSO_EARLY_SKIP
    200                       __inline Bool   xDetectEarlySkipL   ( Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, const Pel* piNewData, const Pel* piOrgData, Int iOrgStride );
    201                       __inline Bool   xDetectEarlySkipR   ( Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, const Pel* piNewData, const Pel* piOrgData, Int iOrgStride );
    202   template<Bool bSet> __inline RMDist xRenderL            ( Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, const Pel* piNewData, Bool bFast );
    203   template<Bool bSet> __inline RMDist xRenderR            ( Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, const Pel* piNewData, Bool bFast );
    204 #else
    205   template<Bool bSet> __inline RMDist xRenderR            ( Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, const Pel* piNewData );
    206   template<Bool bSet> __inline RMDist xRenderL            ( Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, const Pel* piNewData );
    207 #endif
    208                       __inline Void   xInitRenderPartL    ( Int iEndChangePos, Int iLastSPos  );
    209   template<Bool bSet> __inline Void   xRenderRangeL       ( Int iCurSPos, Int iLastSPos, Int iCurPos, RMDist& riError );
    210   template<Bool bSet> __inline Void   xRenderShiftedRangeL( Int iCurSPos, Int iLastSPos, Int iCurPos, RMDist& riError );
    211   template<Bool bSet> __inline Void   xFillHoleL          ( Int iCurSPos, Int iLastSPos, Int iCurPos, RMDist& riError );
    212   template<Bool bSet> __inline Void   xExtrapolateMarginL ( Int iCurSPos,                Int iCurPos, RMDist& riError );
    213                       __inline Int    xRangeLeftL         ( Int iPos );
    214                       __inline Int    xRangeRightL        ( Int iPos );
    215                       __inline Int    xRoundL             ( Int iPos );
    216 
    217   // Right to Left
    218                       __inline Void   xInitRenderPartR    ( Int iStartChangePos, Int iLastSPos );
    219   template<Bool bSet> __inline Void   xRenderShiftedRangeR( Int iCurSPos, Int iLastSPos, Int iCurPos, RMDist& riError );
    220   template<Bool bSet> __inline Void   xRenderRangeR       ( Int iCurSPos, Int iLastSPos, Int iCurPos, RMDist& riError );
    221   template<Bool bSet> __inline Void   xFillHoleR          ( Int iCurSPos, Int iLastSPos, Int iCurPos, RMDist& riError );
    222   template<Bool bSet> __inline Void   xExtrapolateMarginR ( Int iCurSPos,                Int iCurPos, RMDist& riError );
    223                       __inline Int    xRangeLeftR         ( Int iPos );
    224                       __inline Int    xRangeRightR        ( Int iPos );
    225                       __inline Int    xRoundR             ( Int iPos );
    226 
    227   // Blending
    228   template<Bool bSet> __inline Void   xSetShiftedPelBlend ( Int iSourcePos, Int iTargetSPos, Pel iFilled, RMDist& riError );
    229 
    230 #if H_3D_VSO_COLOR_PLANES
    231   __inline Void   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 );
    232   __inline Void   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 );
    233   __inline Void   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 );
    234 #else
    235   __inline Void   xGetBlendedValue    ( Pel iYL, Pel iYR, Pel iDepthL, Pel iDepthR, Int iFilledL, Int iFilledR, Pel& riY );
    236   __inline Void   xGetBlendedValueBM1 ( Pel iYL, Pel iYR, Pel iDepthL, Pel iDepthR, Int iFilledL, Int iFilledR, Pel& riY );
    237   __inline Void   xGetBlendedValueBM2 ( Pel iYL, Pel iYR, Pel iDepthL, Pel iDepthR, Int iFilledL, Int iFilledR, Pel& riY );
     248  template< typename T, Bool bL > __inline T    xPlus   ( T arg1, T arg2 ) { return bL ? (arg1 + arg2) : (arg1 - arg2); };
     249  template< typename T, Bool bL > __inline T    xMin    ( T arg1, T arg2 ) { return bL ? std::min(arg1, arg2) : std::max(arg1, arg2) ;};
     250  template< typename T, Bool bL > __inline T    xMax    ( T arg1, T arg2 ) { return bL ? std::max(arg1, arg2) : std::min(arg1, arg2) ;};
     251  template< typename T, Bool bL > __inline Void xInc    ( T& arg1        ) { bL ? arg1++ : arg1-- ;};
     252  template< typename T, Bool bL > __inline Void xDec    ( T& arg1        ) { bL ? arg1-- : arg1++ ;};
     253  template< typename T, Bool bL > __inline Bool xLess   ( T arg1, T arg2 ) { return bL ? arg1 <  arg2 : arg1 >  arg2; }; 
     254  template< typename T, Bool bL > __inline Bool xGeQ    ( T arg1, T arg2 ) { return bL ? arg1 >= arg2 : arg1 <= arg2; };
     255  template<             Bool bL > __inline Int  xZero   (                ) { return bL ? 0 : m_iWidth - 1; };
     256  template<             Bool bL > __inline Int  xWidthMinus1(            ) { return bL ? m_iWidth - 1 : 0; };
     257#if H_3D_VSO_EARLY_SKIP
     258  template<             Bool bL > __inline Bool   xDetectEarlySkip    ( Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, const Pel* piNewData,const Pel* piOrgData, Int iOrgStride );
     259  template< Bool bL, SetMod bSM > __inline RMDist xRender             ( Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, const Pel* piNewData, Bool bFast );
     260  template< SetMod bSM >            __inline RMDist xGetSSE             ( Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, const Pel* piNewData, Bool bFast );
     261#else       
     262  template< Bool bL, SetMod bSM  > __inline RMDist xRender             ( Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, const Pel* piNewData );
     263  template<          SetMod bSM  > __inline RMDist xGetSSE             ( Int iStartPosX, Int iStartPosY, Int iWidth, Int iHeight, Int iStride, const Pel* piNewData );
     264#endif                         
     265  template< Bool bL              > __inline Void   xInitRenderPart    ( Int iEndChangePos, Int iLastSPos  );
     266  template< Bool bL, SetMod bSM  > __inline Void   xRenderRange       ( Int iCurSPos, Int iLastSPos, Int iCurPos, RMDist& riError );
     267  template< Bool bL, SetMod bSM  > __inline Void   xRenderShiftedRange( Int iCurSPos, Int iLastSPos, Int iCurPos, RMDist& riError );
     268  template< Bool bL, SetMod bSM  > __inline Void   xFillHole          ( Int iCurSPos, Int iLastSPos, Int iCurPos, RMDist& riError );
     269  template< Bool bL, SetMod bSM  > __inline Void   xExtrapolateMargin ( Int iCurSPos,                Int iCurPos, RMDist& riError );
     270  template< Bool bL              > __inline Int    xRangeLeft         ( Int iPos );
     271  template< Bool bL              > __inline Int    xRangeRight        ( Int iPos );
     272  template< Bool bL              > __inline Int    xRound             ( Int iPos );
     273
     274#if H_3D_VSO_COLOR_PLANES 
     275  template< Bool bL, SetMod bSM > __inline Void   xGetBlendedValue    ( Pel& riY, Pel iYL,  Pel iYR, Pel& riU, Pel iUL,  Pel iUR,  Pel& riV, Pel iVL,  Pel iVR, Int iFilledL,  Int iFilledR, Pel iDepthL,  Pel iDepthR );
     276  template< Bool bL, SetMod bSM > __inline Void   xGetBlendedValueBM1 ( Pel& riY, Pel iYL,  Pel iYR, Pel& riU, Pel iUL,  Pel iUR,  Pel& riV, Pel iVL,  Pel iVR, Int iFilledL,  Int iFilledR, Pel iDepthL,  Pel iDepthR );
     277  template< Bool bL, SetMod bSM > __inline Void   xGetBlendedValueBM2 ( Pel& riY, Pel iYL,  Pel iYR, Pel& riU, Pel iUL,  Pel iUR,  Pel& riV, Pel iVL,  Pel iVR, Int iFilledL,  Int iFilledR, Pel iDepthL,  Pel iDepthR );
     278#else
     279  template< Bool bL, SetMod bSM > __inline Void   xGetBlendedValue    ( Pel& riY, Pel iYL,  Pel iYR, Int iFilledL,  Int iFilledR, Pel iDepthL,  Pel iDepthR  );
     280  template< Bool bL, SetMod bSM > __inline Void   xGetBlendedValueBM1 ( Pel& riY, Pel iYL,  Pel iYR, Int iFilledL,  Int iFilledR, Pel iDepthL,  Pel iDepthR  );
     281  template< Bool bL, SetMod bSM > __inline Void   xGetBlendedValueBM2 ( Pel& riY, Pel iYL,  Pel iYR, Int iFilledL,  Int iFilledR, Pel iDepthL,  Pel iDepthR  );
    238282#endif
    239283  __inline Pel    xBlend              ( Pel pVal1, Pel pVal2, Int iWeightVal2 );
    240284
    241285  // General
    242   template<Bool bSet> __inline Void xSetShiftedPelL       (Int iSourcePos,             Int iSubSourcePos, Int iTargetSPos,              Pel iFilled, RMDist& riError );
    243   template<Bool bSet> __inline Void xSetShiftedPelBlendL  (RenModelInPels* pcInSample, Int iSubSourcePos, RenModelOutPels* pcOutSample, Pel iFilled, RMDist& riError );
    244   template<Bool bSet> __inline Void xSetShiftedPelNoBlendL(RenModelInPels* pcInSample, Int iSubSourcePos, RenModelOutPels* pcOutSample, Pel iFilled, RMDist& riError );
    245 
    246   template<Bool bSet> __inline Void xSetShiftedPelR       (Int iSourcePos,             Int iSubSourcePos, Int iTargetSPos,              Pel iFilled, RMDist& riError );
    247   template<Bool bSet> __inline Void xSetShiftedPelBlendR  (RenModelInPels* pcInSample, Int iSubSourcePos, RenModelOutPels* pcOutSample, Pel iFilled, RMDist& riError );
    248   template<Bool bSet> __inline Void xSetShiftedPelNoBlendR(RenModelInPels* pcInSample, Int iSubSourcePos, RenModelOutPels* pcOutSample, Pel iFilled, RMDist& riError );
    249 
    250   __inline Int    xShiftNewData      ( Int iPos, Int iPosInNewData );
    251   __inline Int    xShift             ( Int iPos );
    252   __inline Int    xShift             ( Int iPos, Int iPosInNewData );
     286  template<Bool bL, SetMod bSM> __inline Void xSetShiftedPel       (Int iSourcePos, Int iSubSourcePos, Int iTargetSPos, Pel iFilled, RMDist& riError );
     287 
     288  template <Bool bL>           __inline Int  xShiftNewData        ( Int iPos, Int iPosInNewData );
     289  template <Bool bL>           __inline Int  xShift               ( Int iPos );
     290  template <Bool bL>           __inline Int  xShift               ( Int iPos, Int iPosInNewData );
     291
     292  __inline Int    xShiftDept         ( Int iPosXinSubPel, Int iDepth );
     293
    253294  __inline Int    xGetDist           ( Int iDiffY, Int iDiffU, Int iDiffV );
    254295  __inline Int    xGetDist           ( Int iDiffY );
     
    264305  Void            xGetSampleStrTextPtrs ( Int iViewNum, Pel RenModelOutPels::*& rpiSrcY );
    265306#endif
    266   Void            xGetSampleStrDepthPtrs( Int iViewNum, Pel RenModelOutPels::*& rpiSrcD );
     307  Void            xGetSampleStrDepthPtrs ( Int iViewNum, Pel RenModelOutPels::*& rpiSrcD      );
     308  Void            xGetSampleStrFilledPtrs( Int iViewNum, Int RenModelOutPels::*& rpiSrcFilled );
     309
    267310       
    268311  Void            xSetStructRefView            ();
     312#if !RM_FIX_SETUP
    269313  Void            xResetStructError            ();
     314  Void            xSetLimOutStruct             (Int iSourceViewPos );
     315#endif
     316 
    270317  Void            xInitSampleStructs           ();
     318#if !RM_FIX_SETUP
    271319  Void            xSetStructSynthViewAsRefView ();
     320#endif
    272321  Void            xCopy2PicYuv                ( Pel** ppiSrcVideoPel, Int* piStrides, TComPicYuv* rpcPicYuvTarget );
    273322
     
    340389
    341390  //// Output Samples
    342   RenModelOutPels* m_pcOutputSamples;
     391  RenModelOutPels*      m_pcOutputSamples;
     392  RenModelLimOutPels*   m_pcLimOutputSamples;
     393
    343394  Int                   m_iOutputSamplesStride;
    344395
     
    349400  Bool  m_bInOcclusion;                // Currently rendering in occluded area
    350401  Int   m_iLastOccludedSPos;           // Position of last topmost shifted position
    351   Int   m_iLastOccludedSPosFP;         // Position of last topmost shifted position in FullPels
    352 
    353   Int   m_iCurViewPos;                 // Current View Position 0: Left, 1: Right
    354   Int   m_iOtherViewPos;               // Other View Position 0: Left, 1: Right
     402
     403  Int   m_curRangeStart;
     404  Int   m_lastRangeStart; 
     405
    355406  const Pel*  m_piNewDepthData;              // Pointer to new depth data
    356407  Int   m_iStartChangePosX;            // Start Position of new data
     
    377428  //// Current Pointers ////
    378429
    379   RenModelInPels*  m_pcInputSamplesRow [2];
    380   RenModelOutPels* m_pcOutputSamplesRow;
     430  RenModelInPels*     m_pcInputSamplesRow [2];
     431  RenModelOutPels*    m_pcOutputSamplesRow;
     432  RenModelLimOutPels* m_pcLimOutputSamplesRow;
    381433
    382434  //// MISC ////
    383   const Int m_iDistShift;                  // Shift in Distortion computation
     435  const Int m_iDistShift;            // Shift in Distortion computation
     436  Bool      m_bLimOutput;            // Save distortion only
    384437
    385438  //// Early Skip
     
    389442};
    390443
    391 #endif // NH_3D
     444#endif // H_3D
    392445#endif //__TRENSINGLEMODEL__
    393446
  • trunk/source/Lib/TLibRenderer/TRenTop.cpp

    r1386 r1396  
    4040#include <math.h>
    4141#include "../TLibCommon/CommonDef.h"
    42 #if NH_3D_VSO
     42#if NH_3D_VSO  || NH_3D
    4343
    4444
  • trunk/source/Lib/TLibRenderer/TRenTop.h

    r1386 r1396  
    3939#include "../TLibCommon/TComPicYuv.h"
    4040
    41 #if NH_3D_VSO
     41#if NH_3D_VSO || NH_3D
    4242#include <list>
    4343#include <vector>
Note: See TracChangeset for help on using the changeset viewer.