Changeset 231 in 3DVCSoftware


Ignore:
Timestamp:
26 Jan 2013, 19:36:53 (11 years ago)
Author:
mitsubishi-htm
Message:

-Integration of JCT3V-C0152 & JCT3V-C0131
-This check-in enable C0131 only

Location:
branches/HTM-5.1-dev3-MERL/source
Files:
37 edited

Legend:

Unmodified
Added
Removed
  • branches/HTM-5.1-dev3-MERL/source/App/TAppDecoder/TAppDecTop.cpp

    r210 r231  
    764764#endif
    765765}
     766
     767#if MERL_VSP_C0152
     768Void TAppDecTop::setBWVSPLUT(TComSlice* pcSlice,  Int iCodedViewIdx,  Int iCurPoc)
     769{
     770  //first view does not have VSP
     771  if((iCodedViewIdx == 0)) return;
     772
     773  AOT( iCodedViewIdx <= 0);
     774  //AOT( iCodedViewIdx >= m_iNumberOfViews );
     775  Int iNeighborViewId = 0;
     776  //  Int* piShiftLUT = bRenderFromLeft ? m_cCamParsCollector.getBaseViewShiftLUTI()[iCodedViewIdx][iNeighborViewId][0] : m_cCamParsCollector.getBaseViewShiftLUTI()[iNeighborViewId][iCodedViewIdx][0];
     777  Int* piShiftLUT = m_cCamParsCollector.getBaseViewShiftLUTI()[iNeighborViewId][iCodedViewIdx][0];
     778  pcSlice->setBWVSPLUTParam(piShiftLUT, 2-LOG2_DISP_PREC_LUT );
     779}
     780#endif
     781
    766782//! \}
  • branches/HTM-5.1-dev3-MERL/source/App/TAppDecoder/TAppDecTop.h

    r210 r231  
    112112#endif
    113113
     114#if MERL_VSP_C0152
     115  Void  setBWVSPLUT( TComSlice* pcSlice, Int iCodedViewIdx, Int iCurPoc   );
     116#endif
     117
    114118protected:
    115119//  Void  xCreateDecLib     (); ///< create internal classes
  • branches/HTM-5.1-dev3-MERL/source/App/TAppEncoder/TAppEncCfg.cpp

    r210 r231  
    220220 
    221221  /* File, I/O and source parameters */
    222   ("InputFile_%d,i_%d",       m_pchInputFileList,       (char *) 0 , MAX_VIEW_NUM , "original Yuv input file name %d")
    223   ("DepthInputFile_%d,di_%d", m_pchDepthInputFileList,  (char *) 0 , MAX_VIEW_NUM , "original Yuv depth input file name %d")
    224   ("ReconFile_%d,o_%d",       m_pchReconFileList,       (char *) 0 , MAX_VIEW_NUM , "reconstructed Yuv output file name %d")
    225   ("DepthReconFile_%d,do_%d", m_pchDepthReconFileList,  (char *) 0 , MAX_VIEW_NUM , "reconstructed Yuv depth output file name %d")
    226   ("BitstreamFile,b", cfg_BitstreamFile, string(""), "bitstream output file name")
    227   ("CodeDepthMaps",         m_bUsingDepthMaps, false, "Encode depth maps" )
    228   ("CodedCamParsPrecision", m_iCodedCamParPrecision, STD_CAM_PARAMETERS_PRECISION, "precision for coding of camera parameters (in units of 2^(-x) luma samples)" )
    229   ("LambdaModifier0,-LM0", m_adLambdaModifier[ 0 ], ( double )1.0, "Lambda modifier for temporal layer 0")
    230   ("LambdaModifier1,-LM1", m_adLambdaModifier[ 1 ], ( double )1.0, "Lambda modifier for temporal layer 1")
    231   ("LambdaModifier2,-LM2", m_adLambdaModifier[ 2 ], ( double )1.0, "Lambda modifier for temporal layer 2")
    232   ("LambdaModifier3,-LM3", m_adLambdaModifier[ 3 ], ( double )1.0, "Lambda modifier for temporal layer 3")
    233   ("SourceWidth,-wdt",      m_iSourceWidth,  0, "Source picture width")
    234   ("SourceHeight,-hgt",     m_iSourceHeight, 0, "Source picture height")
     222  ("InputFile_%d,i_%d",       m_pchInputFileList,       (char *) 0 , MAX_VIEW_NUM ,   "original Yuv input file name %d")
     223  ("DepthInputFile_%d,di_%d", m_pchDepthInputFileList,  (char *) 0 , MAX_VIEW_NUM ,   "original Yuv depth input file name %d")
     224  ("ReconFile_%d,o_%d",       m_pchReconFileList,       (char *) 0 , MAX_VIEW_NUM ,   "reconstructed Yuv output file name %d")
     225  ("DepthReconFile_%d,do_%d", m_pchDepthReconFileList,  (char *) 0 , MAX_VIEW_NUM ,   "reconstructed Yuv depth output file name %d")
     226  ("BitstreamFile,b",         cfg_BitstreamFile,        string(""),                  "bitstream output file name")
     227  ("CodeDepthMaps",           m_bUsingDepthMaps,        false,                        "Encode depth maps" )
     228  ("CodedCamParsPrecision",   m_iCodedCamParPrecision, STD_CAM_PARAMETERS_PRECISION, "precision for coding of camera parameters (in units of 2^(-x) luma samples)" )
     229  ("LambdaModifier0,-LM0",    m_adLambdaModifier[ 0 ],  ( double )1.0,                "Lambda modifier for temporal layer 0")
     230  ("LambdaModifier1,-LM1",    m_adLambdaModifier[ 1 ],  ( double )1.0,                "Lambda modifier for temporal layer 1")
     231  ("LambdaModifier2,-LM2",    m_adLambdaModifier[ 2 ],  ( double )1.0,                "Lambda modifier for temporal layer 2")
     232  ("LambdaModifier3,-LM3",    m_adLambdaModifier[ 3 ],  ( double )1.0,                "Lambda modifier for temporal layer 3")
     233  ("SourceWidth,-wdt",        m_iSourceWidth,           0,                            "Source picture width")
     234  ("SourceHeight,-hgt",       m_iSourceHeight,          0,                            "Source picture height")
    235235#if PIC_CROPPING
    236   ("CroppingMode",          m_croppingMode,  0, "Cropping mode (0: no cropping, 1:automatic padding, 2: padding, 3:cropping")
    237   ("CropLeft",              m_cropLeft,      0, "Left cropping/padding for cropping mode 3")
    238   ("CropRight",             m_cropRight,     0, "Right cropping/padding for cropping mode 3")
    239   ("CropTop",               m_cropTop,       0, "Top cropping/padding for cropping mode 3")
    240   ("CropBottom",            m_cropBottom,    0, "Bottom cropping/padding for cropping mode 3")
    241   ("HorizontalPadding,-pdx",m_aiPad[0],      0, "horizontal source padding for cropping mode 2")
    242   ("VerticalPadding,-pdy",  m_aiPad[1],      0, "vertical source padding for cropping mode 2")
     236  ("CroppingMode",            m_croppingMode,           0,                            "Cropping mode (0: no cropping, 1:automatic padding, 2: padding, 3:cropping")
     237  ("CropLeft",                m_cropLeft,               0,                            "Left cropping/padding for cropping mode 3")
     238  ("CropRight",               m_cropRight,              0,                            "Right cropping/padding for cropping mode 3")
     239  ("CropTop",                 m_cropTop,                0,                            "Top cropping/padding for cropping mode 3")
     240  ("CropBottom",              m_cropBottom,             0,                            "Bottom cropping/padding for cropping mode 3")
     241  ("HorizontalPadding,-pdx",  m_aiPad[0],               0,                            "horizontal source padding for cropping mode 2")
     242  ("VerticalPadding,-pdy",    m_aiPad[1],               0,                            "vertical source padding for cropping mode 2")
    243243#endif
    244244  ("InputBitDepth",         m_uiInputBitDepth, 8u, "bit-depth of input file")
     
    254254  ("FrameSkip,-fs",         m_FrameSkip,         0u, "Number of frames to skip at start of input YUV")
    255255  ("FramesToBeEncoded,f",   m_iFrameToBeEncoded, 0, "number of frames to be encoded (default=all)")
    256   ("FrameToBeEncoded",        m_iFrameToBeEncoded, 0, "deprecated alias of FramesToBeEncoded")
     256  ("FrameToBeEncoded",      m_iFrameToBeEncoded, 0, "deprecated alias of FramesToBeEncoded")
    257257 
    258258  ("NumberOfViews",         m_iNumberOfViews,    0, "Number of views")
  • branches/HTM-5.1-dev3-MERL/source/App/TAppEncoder/TAppEncTop.cpp

    r210 r231  
    793793  m_cUsedPelsRenderer.init(m_iSourceWidth, m_iSourceHeight, true, 0, LOG2_DISP_PREC_LUT, true, 0, 0, 0, 0, 0, 6, 4, 1, 0, 6 );
    794794#endif
    795 
    796795}
    797796
     
    931930  TComPicYuv*       pcPicYuvRec = NULL;
    932931  TComPicYuv*       pcDepthPicYuvRec = NULL;
    933  
     932
    934933  // initialize internal class & member variables
    935934  xInitLibCfg();
     
    10331032      if ( iNextPoc < m_iFrameToBeEncoded )
    10341033      {
    1035       m_cCameraData.update( iNextPoc );
     1034        m_cCameraData.update( iNextPoc );
    10361035      }
    10371036#endif
     
    10961095#endif
    10971096        iNumEncoded = 0;
     1097
     1098#if MERL_VSP_C0152
     1099        Int iCurPoc = m_acTEncDepthTopList[iViewIdx]->getFrameId(gopId);
     1100        if( iCurPoc < m_acTEncDepthTopList[iViewIdx]->getFrameToBeEncoded() && iViewIdx!=0 )
     1101        {
     1102          TComPic* pcBaseTxtPic   = getPicFromView(  0, m_acTEncDepthTopList[iViewIdx]->getFrameId(gopId), false ); //get base view reconstructed texture
     1103          TComPic* pcBaseDepthPic = getPicFromView(  0, m_acTEncDepthTopList[iViewIdx]->getFrameId(gopId), true );  //get base view reconstructed depth
     1104          TEncSlice* pEncSlice = m_acTEncTopList[iViewIdx]->getSliceEncoder();
     1105          pEncSlice->setRefPicBaseTxt(pcBaseTxtPic);
     1106          pEncSlice->setRefPicBaseDepth(pcBaseDepthPic);
     1107        }
     1108        setBWVSPLUT( iViewIdx, gopId, false);
     1109#endif
    10981110        // call encoding function for one frame
    10991111        m_acTEncTopList[iViewIdx]->encode( eos[iViewIdx], pcPicYuvOrg, *m_picYuvRec[iViewIdx], outputAccessUnits, iNumEncoded, gopId );
     
    11031115        {
    11041116          Int  iNumDepthEncoded = 0;
     1117#if MERL_VSP_C0152
     1118        Int iCurPocDepth = m_acTEncDepthTopList[iViewIdx]->getFrameId(gopId);
     1119        if( iCurPocDepth < m_acTEncDepthTopList[iViewIdx]->getFrameToBeEncoded() && iViewIdx!=0 )
     1120        {
     1121          TComPic* pcBaseDepthPic = getPicFromView(  0, m_acTEncDepthTopList[iViewIdx]->getFrameId(gopId), true );
     1122          TEncSlice* pcSlice = (TEncSlice*) m_acTEncDepthTopList[iViewIdx]->getSliceEncoder();
     1123          pcSlice->setRefPicBaseDepth(pcBaseDepthPic);
     1124        }
     1125        setBWVSPLUT( iViewIdx, gopId, true);
     1126#endif
     1127
    11051128          // call encoding function for one depth frame
    11061129          m_acTEncDepthTopList[iViewIdx]->encode( depthEos[iViewIdx], pcDepthPicYuvOrg, *m_picYuvDepthRec[iViewIdx], outputAccessUnits, iNumDepthEncoded, gopId );
     
    16341657#endif
    16351658
     1659#if MERL_VSP_C0152
     1660Void TAppEncTop::setBWVSPLUT(Int iCodedViewIdx, Int gopId, Bool isDepth)
     1661{
     1662  //first view does not have VSP
     1663  if((iCodedViewIdx == 0)) return;
     1664
     1665  AOT( iCodedViewIdx <= 0);
     1666  AOT( iCodedViewIdx >= m_iNumberOfViews );
     1667
     1668  Int iNeighborViewId = 0;
     1669  //setting look-up table
     1670  Int* piShiftLUT = m_cCameraData.getBaseViewShiftLUTI()[iNeighborViewId][iCodedViewIdx][0];
     1671
     1672  if(isDepth)
     1673  {
     1674    TEncSlice* pcEncSlice = (TEncSlice*) m_acTEncDepthTopList[iCodedViewIdx]->getSliceEncoder();
     1675    pcEncSlice->setBWVSPLUTParam(  piShiftLUT, LOG2_DISP_PREC_LUT );
     1676  }
     1677  else
     1678  {
     1679    TEncSlice* pcEncSlice = (TEncSlice*) m_acTEncTopList[iCodedViewIdx]->getSliceEncoder();
     1680    pcEncSlice->setBWVSPLUTParam(  piShiftLUT, LOG2_DISP_PREC_LUT );
     1681  }
     1682
     1683}
     1684#endif
     1685
    16361686//! \}
  • branches/HTM-5.1-dev3-MERL/source/App/TAppEncoder/TAppEncTop.h

    r210 r231  
    9999  TRenTop  m_cUsedPelsRenderer;                               ///< renderer for used pels map
    100100#endif
     101
    101102protected:
    102103  // initialization
     
    165166#endif
    166167
     168#if MERL_VSP_C0152
     169  Void setBWVSPLUT( Int iCodedViewIdx, Int gopId, Bool isDepth);
     170#endif
    167171};// END CLASS DEFINITION TAppEncTop
    168172
  • branches/HTM-5.1-dev3-MERL/source/Lib/TAppCommon/TAppComCamPara.cpp

    r106 r231  
    8989}
    9090
    91 
    9291Void
    9392TAppComCamPara::xCreate2dArray( UInt uiNum1Ids, UInt uiNum2Ids, Int**& raaiArray )
     
    928927}
    929928
    930 
    931929Void
    932930TAppComCamPara::xSetShiftParametersAndLUT( UInt uiFrame )
  • branches/HTM-5.1-dev3-MERL/source/Lib/TAppCommon/TAppComCamPara.h

    r102 r231  
    107107  Int****             m_aiSynthViewShiftLUT;                   ///< Disparity LUT
    108108
    109 
    110109protected:
    111110  // create and delete arrays
     
    143142  Void  xSetShiftParametersAndLUT ( UInt uiNumViewDim1, UInt uiNumViewDim2, UInt uiFrame, Bool bExternalReference, Double****& radLUT, Int****& raiLUT, Double***& radShiftParams, Int64***& raiShiftParams );
    144143  Void  xSetShiftParametersAndLUT ( UInt uiFrame );
    145 
    146144
    147145  // getting conversion parameters for disparity to virtual depth conversion
  • branches/HTM-5.1-dev3-MERL/source/Lib/TLibCommon/TComDataCU.cpp

    r210 r231  
    5151#endif
    5252
     53#if MERL_VSP_C0152
     54
     55#define CHECK_ADD_YET(pcCURef,uiIdx,vspIdx) && !( (pcCURef)->getVSPIndex(uiIdx) == vspIdx && bVspMvZeroDone[vspIdx-1] )
     56
     57inline Void TComDataCU::xInheritVspMode( TComDataCU* pcCURef, UInt uiIdx, Bool* bVspMvZeroDone, Int iCount, Int* iVSPIndexTrue, TComMvField* pcMvFieldNeighbours, DisInfo* pDInfo )
     58{
     59  Int vspIdx = (Int) pcCURef->getVSPIndex(uiIdx);
     60  if( vspIdx != 0 )
     61  {
     62    Int idx = vspIdx - 1;
     63    bVspMvZeroDone[idx] = true;
     64    iVSPIndexTrue [idx] = iCount;
     65
     66    // no need to reset Inter Dir
     67
     68    // set MV using checked disparity
     69    if (vspIdx < 4)
     70    {
     71      pcMvFieldNeighbours[ iCount<<1].setMvField ( pDInfo->m_acMvCand[0],  NOT_VALID );
     72      if ( pcCURef->getSlice()->isInterB() )
     73      {
     74         pcMvFieldNeighbours[(iCount<<1)+1 ].setMvField ( pDInfo->m_acMvCand[0],  NOT_VALID );
     75      }
     76    }
     77  }
     78}
     79
     80inline Bool TComDataCU::xAddVspMergeCand( UChar ucVspMergePos, Int vspIdx, Bool* bVspMvZeroDone, UInt uiDepth, Bool* abCandIsInter, Int& iCount,
     81                                          UChar* puhInterDirNeighbours, TComMvField* pcMvFieldNeighbours, Int* iVSPIndexTrue, Int mrgCandIdx, DisInfo* pDInfo )
     82{
     83  if( ucVspMergePos == VSP_MERGE_POS )
     84  {
     85    Int idx = vspIdx - 1;
     86    {
     87      if( getSlice()->getSPS()->getViewId() != 0 && bVspMvZeroDone[idx] == false )
     88      {
     89        {
     90          abCandIsInter [iCount] = true;
     91          bVspMvZeroDone[idx] = true;
     92
     93          // get Inter Dir
     94          Int iInterDir = ((getSlice()->getNumRefIdx(REF_PIC_LIST_0) > 0 && getSlice()->getNumRefIdx(REF_PIC_LIST_1) > 0) ? 3 :
     95            (getSlice()->getNumRefIdx(REF_PIC_LIST_0) > 0 ? 1 : 2));
     96          puhInterDirNeighbours[iCount] = iInterDir; // The direction information does not matter
     97          // get Mv using checked disparity vector
     98          if (vspIdx < 4) // spatial
     99          {
     100            pcMvFieldNeighbours[iCount<<1].setMvField(pDInfo->m_acMvCand[0], NOT_VALID );
     101            if ( getSlice()->isInterB() )
     102            {
     103              pcMvFieldNeighbours[(iCount<<1)+1].setMvField( pDInfo->m_acMvCand[0], NOT_VALID );
     104            }
     105          }
     106          iVSPIndexTrue[idx] = iCount;
     107#if SIMP_MRG_PRUN
     108          if ( mrgCandIdx == iCount )
     109          {
     110            return false;
     111          }
     112#endif
     113          iCount ++;
     114        }
     115      }
     116    }
     117  }
     118  return true;
     119}
     120#endif
     121
    53122// ====================================================================================================================
    54123// Constructor / destructor / create / destroy
     
    79148#endif
    80149  m_puhMergeIndex      = NULL;
     150#if MERL_VSP_C0152
     151  m_piVSPIndex         = NULL;
     152#endif
    81153  m_puhLumaIntraDir    = NULL;
    82154  m_puhChromaIntraDir  = NULL;
     
    213285#endif
    214286    m_puhMergeIndex      = (UChar* )xMalloc(UChar,  uiNumPartition);
     287#if MERL_VSP_C0152
     288    m_piVSPIndex         = (Char*  )xMalloc(Char,   uiNumPartition);
     289#endif
    215290#if HHI_INTER_VIEW_RESIDUAL_PRED
    216291    m_pbResPredAvailable = (Bool*  )xMalloc(Bool,   uiNumPartition);
     
    364439    if ( m_pbICFlag           ) { xFree(m_pbICFlag);            m_pbICFlag          = NULL; }
    365440#endif
     441#if MERL_VSP_C0152
     442    if ( m_piVSPIndex         ) { xFree(m_piVSPIndex);          m_piVSPIndex        = NULL; }
     443#endif
    366444    if ( m_puhMergeIndex      ) { xFree(m_puhMergeIndex);       m_puhMergeIndex     = NULL; }
    367445#if HHI_INTER_VIEW_RESIDUAL_PRED
     
    558636#endif
    559637    m_puhMergeIndex[ui]=pcFrom->m_puhMergeIndex[ui];
     638#if MERL_VSP_C0152
     639    m_piVSPIndex[ui] = pcFrom->m_piVSPIndex[ui];
     640#endif
    560641    m_puhLumaIntraDir[ui]=pcFrom->m_puhLumaIntraDir[ui];
    561642    m_puhChromaIntraDir[ui]=pcFrom->m_puhChromaIntraDir[ui];
     
    598679#endif
    599680    memset( m_puhMergeIndex     + firstElement, 0,                        numElements * sizeof( *m_puhMergeIndex ) );
     681#if MERL_VSP_C0152
     682    memset( m_piVSPIndex        + firstElement, 0,                        numElements * sizeof( *m_piVSPIndex ) );
     683#endif
    600684    memset( m_puhLumaIntraDir   + firstElement, 2,                        numElements * sizeof( *m_puhLumaIntraDir ) );
    601685    memset( m_puhChromaIntraDir + firstElement, 0,                        numElements * sizeof( *m_puhChromaIntraDir ) );
     
    781865#endif
    782866      m_puhMergeIndex[ui] = 0;
     867#if MERL_VSP_C0152
     868      m_piVSPIndex[ui] = 0;
     869#endif
    783870#if HHI_INTER_VIEW_RESIDUAL_PRED
    784871      m_pbResPredAvailable[ui] = 0;
     
    876963  Int iSizeInUchar = sizeof( UChar  ) * m_uiNumPartition;
    877964  Int iSizeInBool  = sizeof( Bool   ) * m_uiNumPartition;
     965#if MERL_VSP_C0152
     966  Int iSizeInChar  = sizeof( Char   ) * m_uiNumPartition;
     967#endif
    878968
    879969#if H0736_AVC_STYLE_QP_RANGE
     
    893983#endif
    894984  memset( m_puhMergeIndex,      0, iSizeInUchar );
     985#if MERL_VSP_C0152
     986  memset( m_piVSPIndex,         0, iSizeInChar );
     987#endif
    895988#if HHI_INTER_VIEW_RESIDUAL_PRED
    896989  memset( m_pbResPredAvailable, 0, iSizeInBool  );
     
    9731066#endif
    9741067      m_puhMergeIndex[ui]=pcCU->m_puhMergeIndex[uiPartOffset+ui];
     1068#if MERL_VSP_C0152
     1069      m_piVSPIndex[ui]=pcCU->m_piVSPIndex[uiPartOffset+ui];
     1070#endif
    9751071      m_puhLumaIntraDir[ui]=pcCU->m_puhLumaIntraDir[uiPartOffset+ui];
    9761072      m_puhChromaIntraDir[ui]=pcCU->m_puhChromaIntraDir[uiPartOffset+ui];
     
    11171213#endif
    11181214  m_puhMergeIndex       = pcCU->getMergeIndex()       + uiPart;
     1215#if MERL_VSP_C0152
     1216  m_piVSPIndex          = pcCU->getVSPIndex()         + uiPart;
     1217#endif
    11191218#if HHI_INTER_VIEW_RESIDUAL_PRED
    11201219  m_pbResPredAvailable  = pcCU->getResPredAvail()     + uiPart;
     
    12271326  m_uiCUAddr           = pcCU->getAddr();
    12281327  m_uiAbsIdxInLCU      = uiAbsPartIdx;
    1229  
     1328
    12301329  Int iRastPartIdx     = g_auiZscanToRaster[uiAbsPartIdx];
    12311330  m_uiCUPelX           = pcCU->getCUPelX() + m_pcPic->getMinCUWidth ()*( iRastPartIdx % m_pcPic->getNumPartInWidth() );
     
    12571356#endif
    12581357  m_puhMergeIndex      = pcCU->getMergeIndex()            + uiAbsPartIdx;
     1358#if MERL_VSP_C0152
     1359  m_piVSPIndex         = pcCU->getVSPIndex()              + uiAbsPartIdx;
     1360#endif
    12591361#if HHI_INTER_VIEW_RESIDUAL_PRED
    12601362  m_pbResPredAvailable = pcCU->getResPredAvail()          + uiAbsPartIdx;
     
    12881390  Int iSizeInUchar  = sizeof( UChar ) * uiNumPartition;
    12891391  Int iSizeInBool   = sizeof( Bool  ) * uiNumPartition;
     1392#if MERL_VSP_C0152
     1393  Int iSizeInChar   = sizeof( Char )  * uiNumPartition;
     1394#endif
    12901395 
    12911396#if H0736_AVC_STYLE_QP_RANGE
     
    13061411#endif
    13071412  memcpy( m_puhMergeIndex       + uiOffset, pcCU->getMergeIndex(),        iSizeInUchar );
     1413#if MERL_VSP_C0152
     1414  memcpy( m_piVSPIndex          + uiOffset, pcCU->getVSPIndex(),          iSizeInChar );
     1415#endif
    13081416#if HHI_INTER_VIEW_RESIDUAL_PRED
    13091417  memcpy( m_pbResPredAvailable  + uiOffset, pcCU->getResPredAvail(),      iSizeInBool  );
     
    14191527  Int iSizeInUchar  = sizeof( UChar ) * m_uiNumPartition;
    14201528  Int iSizeInBool   = sizeof( Bool  ) * m_uiNumPartition;
     1529#if MERL_VSP_C0152
     1530  Int iSizeInChar   = sizeof( Char  ) * m_uiNumPartition;
     1531#endif
    14211532 
    14221533#if H0736_AVC_STYLE_QP_RANGE
     
    14401551#endif
    14411552  memcpy( rpcCU->getMergeIndex()        + m_uiAbsIdxInLCU, m_puhMergeIndex,       iSizeInUchar );
     1553#if MERL_VSP_C0152
     1554  memcpy( rpcCU->getVSPIndex()          + m_uiAbsIdxInLCU, m_piVSPIndex,         iSizeInChar );
     1555#endif
    14421556#if HHI_INTER_VIEW_RESIDUAL_PRED
    14431557  memcpy( rpcCU->getResPredAvail()      + m_uiAbsIdxInLCU, m_pbResPredAvailable,  iSizeInBool  );
     
    15471661  Int iSizeInUchar  = sizeof( UChar  ) * uiQNumPart;
    15481662  Int iSizeInBool   = sizeof( Bool   ) * uiQNumPart;
     1663#if MERL_VSP_C0152
     1664  Int iSizeInChar   = sizeof( Char   ) * uiQNumPart;
     1665#endif
    15491666 
    15501667#if H0736_AVC_STYLE_QP_RANGE
     
    15661683#endif
    15671684  memcpy( rpcCU->getMergeIndex()        + uiPartOffset, m_puhMergeIndex,       iSizeInUchar );
     1685#if MERL_VSP_C0152
     1686  memcpy( rpcCU->getVSPIndex()          + uiPartOffset, m_piVSPIndex,         iSizeInChar );
     1687#endif
    15681688#if HHI_INTER_VIEW_RESIDUAL_PRED
    15691689  memcpy( rpcCU->getResPredAvail()      + uiPartOffset, m_pbResPredAvailable,  iSizeInBool  );
     
    30333153}
    30343154
     3155#if MERL_VSP_C0152
     3156Void TComDataCU::setVSPIndexSubParts ( Char iVSPIdx, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth )
     3157{
     3158  setSubPart<Char>( iVSPIdx, m_piVSPIndex, uiAbsPartIdx, uiDepth, uiPartIdx );
     3159}
     3160#endif
     3161
    30353162#if HHI_INTER_VIEW_RESIDUAL_PRED
    30363163Void TComDataCU::setResPredAvailSubParts( Bool bResPredAvailable, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth )
     
    30843211
    30853212      if((getInterDir(uiPartAddr) & (uiRefIdx+1)) && iBestRefIdx >= 0 && getSlice()->getViewId() != getSlice()->getRefViewId(eRefList, iBestRefIdx))
    3086       {
    30873213        return true;
    3088       }
    30893214    }
    30903215  }
     
    36183743 */
    36193744#if SIMP_MRG_PRUN
     3745#if MERL_VSP_C0152
     3746Void TComDataCU::getInterMergeCandidates( UInt uiAbsPartIdx, UInt uiPUIdx, UInt uiDepth, TComMvField* pcMvFieldNeighbours, UChar* puhInterDirNeighbours, Int& numValidMergeCand, Int* iVSPIndexTrue, Int mrgCandIdx )
     3747#else
    36203748Void TComDataCU::getInterMergeCandidates( UInt uiAbsPartIdx, UInt uiPUIdx, UInt uiDepth, TComMvField* pcMvFieldNeighbours, UChar* puhInterDirNeighbours, Int& numValidMergeCand, Int mrgCandIdx )
     3749#endif
    36213750#else
    36223751Void TComDataCU::getInterMergeCandidates( UInt uiAbsPartIdx, UInt uiPUIdx, UInt uiDepth, TComMvField* pcMvFieldNeighbours, UChar* puhInterDirNeighbours, Int& numValidMergeCand )
     
    36453774#endif
    36463775
     3776#if MERL_VSP_C0152
     3777  Bool bVspMvZeroDone[3] = {false, false, false};
     3778#endif
     3779 
    36473780  Int iCount = 0;
    36483781
     
    36873820    getDisMvpCand2(uiPUIdx, uiAbsPartIdx, &cDisInfo
    36883821#if LGE_IVMP_PARALLEL_MERGE_B0136==QC_SIMPLE_NBDV_B0047
    3689 ,
    3690 true
     3822            , true
     3823#endif
     3824#if MERL_VSP_C0152
     3825            , true
    36913826#endif
    36923827);
     
    37143849  Int     iPdmInterDir      = getPdmMergeCandidate( uiPUIdx, aiPdmRefIdx, acPdmMv );
    37153850#endif
     3851
    37163852#if QC_MRG_CANS_B0048
    37173853  if( iPdmDir[0] && !bNoPdmMerge && PDM_MERGE_POS == 0 )
     
    37853921  }
    37863922#endif
     3923
     3924#if MERL_VSP_COMPENSATION_C0152
     3925  //===== vsp 0 =====
     3926  if( iCount < 4 + extraMergeCand )
     3927    if ( !xAddVspMergeCand(0, 1, bVspMvZeroDone, uiDepth, abCandIsInter, iCount, puhInterDirNeighbours, pcMvFieldNeighbours, iVSPIndexTrue, mrgCandIdx, &cDisInfo) )
     3928      return;
     3929#endif
     3930
    37873931  //left
    37883932  UInt uiLeftPartIdx = 0;
     
    38053949  if (!(uiPUIdx == 1 && (partSize == SIZE_Nx2N || partSize == SIZE_nLx2N || partSize == SIZE_nRx2N)))
    38063950  {
    3807   if ( pcCULeft && !pcCULeft->isIntra( uiLeftPartIdx ) )
     3951  if ( pcCULeft && !pcCULeft->isIntra( uiLeftPartIdx )
     3952#if MERL_VSP_C0152
     3953     CHECK_ADD_YET(pcCULeft, uiLeftPartIdx, 1)
     3954#endif
     3955  )
    38083956  {
    38093957    abCandIsInter[iCount] = true;
     
    38524000    pcMvFieldNeighbours[(iCount<<1)+1].getMv().m_bDvMcp = false;
    38534001#endif
     4002#if MERL_VSP_C0152
     4003     xInheritVspMode( pcCULeft, uiLeftPartIdx, bVspMvZeroDone, iCount, iVSPIndexTrue, pcMvFieldNeighbours, &cDisInfo ) ;
     4004#endif
    38544005#if SIMP_MRG_PRUN
    38554006    if ( mrgCandIdx == iCount )
     
    39024053    iCount ++;
    39034054  }
     4055#endif
     4056
     4057#if MERL_VSP_COMPENSATION_C0152
     4058  //===== vsp 1 =====
     4059  if( iCount < 4 + extraMergeCand )
     4060    if ( !xAddVspMergeCand(1, 1, bVspMvZeroDone, uiDepth, abCandIsInter, iCount, puhInterDirNeighbours, pcMvFieldNeighbours, iVSPIndexTrue, mrgCandIdx, &cDisInfo) )
     4061      return;
    39044062#endif
    39054063
     
    39284086#if SIMP_MRG_PRUN
    39294087  if ( pcCUAbove && !pcCUAbove->isIntra( uiAbovePartIdx )
     4088#if MERL_VSP_C0152
     4089    CHECK_ADD_YET(pcCUAbove, uiAbovePartIdx, 1)
     4090#endif
    39304091    && !(uiPUIdx == 1 && (cCurPS == SIZE_2NxN || cCurPS == SIZE_2NxnU || cCurPS == SIZE_2NxnD))
    39314092    && ( !pcCULeft || pcCULeft->isIntra( uiLeftPartIdx ) || !pcCULeft->hasEqualMotion( uiLeftPartIdx, pcCUAbove, uiAbovePartIdx ) ) )
     
    39784139    pcMvFieldNeighbours[(iCount<<1)+1].getMv().m_bDvMcp = false;
    39794140#endif
     4141#if MERL_VSP_C0152
     4142     xInheritVspMode( pcCUAbove, uiAbovePartIdx, bVspMvZeroDone, iCount, iVSPIndexTrue, pcMvFieldNeighbours, &cDisInfo ) ;
     4143#endif
    39804144#if SIMP_MRG_PRUN
    39814145    if ( mrgCandIdx == iCount )
     
    40304194    iCount ++;
    40314195  }
     4196#endif
     4197
     4198#if MERL_VSP_COMPENSATION_C0152
     4199  //===== vsp 2 =====
     4200  if( iCount < 4 + extraMergeCand )
     4201    if ( !xAddVspMergeCand(2, 1, bVspMvZeroDone, uiDepth, abCandIsInter, iCount, puhInterDirNeighbours, pcMvFieldNeighbours, iVSPIndexTrue, mrgCandIdx, &cDisInfo) )
     4202      return;
    40324203#endif
    40334204
     
    40504221#endif
    40514222#if SIMP_MRG_PRUN
    4052   if ( pcCUAboveRight && !pcCUAboveRight->isIntra( uiAboveRightPartIdx ) && ( !pcCUAbove || pcCUAbove->isIntra( uiAbovePartIdx ) || !pcCUAbove->hasEqualMotion( uiAbovePartIdx, pcCUAboveRight, uiAboveRightPartIdx ) ) )
     4223  if ( pcCUAboveRight && !pcCUAboveRight->isIntra( uiAboveRightPartIdx )
     4224#if MERL_VSP_C0152
     4225    CHECK_ADD_YET(pcCUAboveRight, uiAboveRightPartIdx, 1)
     4226#endif
     4227    && ( !pcCUAbove || pcCUAbove->isIntra( uiAbovePartIdx ) || !pcCUAbove->hasEqualMotion( uiAbovePartIdx, pcCUAboveRight, uiAboveRightPartIdx ) ) )
    40534228#else
    40544229  if ( pcCUAboveRight && !pcCUAboveRight->isIntra( uiAboveRightPartIdx ) )
     
    40744249    pcMvFieldNeighbours[(iCount<<1)+1].getMv().m_bDvMcp = false;
    40754250#endif
     4251#if MERL_VSP_C0152
     4252    xInheritVspMode( pcCUAboveRight, uiAboveRightPartIdx, bVspMvZeroDone, iCount, iVSPIndexTrue, pcMvFieldNeighbours, &cDisInfo ) ;
     4253#endif
    40764254#if SIMP_MRG_PRUN
    40774255    if ( mrgCandIdx == iCount )
     
    41284306    {
    41294307      assert(iCount < MRG_MAX_NUM_CANDS_MEM);
    4130       Bool bRemoveSpa = false; //prunign to A1, B1
     4308      Bool bRemoveSpa = false; //pruning to A1, B1
    41314309      abCandIsInter        [ iCount ] = true;
    41324310      puhInterDirNeighbours[ iCount ] = iPdmDir[1];
     
    41734351  }
    41744352#endif
     4353#if MERL_VSP_COMPENSATION_C0152
     4354  //===== vsp 3 =====
     4355  if( iCount < 4 + extraMergeCand )
     4356    if ( !xAddVspMergeCand(3, 1, bVspMvZeroDone, uiDepth, abCandIsInter, iCount, puhInterDirNeighbours, pcMvFieldNeighbours, iVSPIndexTrue, mrgCandIdx, &cDisInfo) )
     4357      return;
     4358#endif
     4359
     4360#if MERL_VSP_C0152
     4361#if VSP_MERGE_POS < 4
     4362#if HHI_INTER_VIEW_MOTION_PRED
     4363  if( iCount < 4 + extraMergeCand )
     4364#else
     4365  if( iCount < 4 )
     4366#endif
     4367  {
     4368#endif
     4369#endif
     4370
    41754371  //left bottom
    41764372  UInt uiLeftBottomPartIdx = 0;
     
    41914387#endif
    41924388#if SIMP_MRG_PRUN
    4193   if ( pcCULeftBottom && !pcCULeftBottom->isIntra( uiLeftBottomPartIdx ) && ( !pcCULeft || pcCULeft->isIntra( uiLeftPartIdx ) || !pcCULeft->hasEqualMotion( uiLeftPartIdx, pcCULeftBottom, uiLeftBottomPartIdx ) ) )
     4389  if ( pcCULeftBottom && !pcCULeftBottom->isIntra( uiLeftBottomPartIdx )
     4390#if MERL_VSP_C0152
     4391    CHECK_ADD_YET(pcCULeftBottom, uiLeftBottomPartIdx, 1)
     4392#endif
     4393    && ( !pcCULeft || pcCULeft->isIntra( uiLeftPartIdx ) || !pcCULeft->hasEqualMotion( uiLeftPartIdx, pcCULeftBottom, uiLeftBottomPartIdx ) ) )
    41944394#else
    41954395  if ( pcCULeftBottom && !pcCULeftBottom->isIntra( uiLeftBottomPartIdx ) )
     
    42154415    pcMvFieldNeighbours[(iCount<<1)+1].getMv().m_bDvMcp = false;
    42164416#endif
     4417#if MERL_VSP_C0152
     4418     xInheritVspMode( pcCULeftBottom, uiLeftBottomPartIdx, bVspMvZeroDone, iCount, iVSPIndexTrue, pcMvFieldNeighbours, &cDisInfo ) ;
     4419#endif
    42174420#if SIMP_MRG_PRUN
    42184421    if ( mrgCandIdx == iCount )
     
    42234426    iCount ++;
    42244427  }
    4225 
     4428#if MERL_VSP_C0152
     4429#if VSP_MERGE_POS < 4
     4430  }
     4431#endif
     4432#endif
     4433 
    42264434#if HHI_INTER_VIEW_MOTION_PRED
    42274435#if QC_MRG_CANS_B0048
     
    42634471#endif
    42644472
    4265   // above left
     4473#if MERL_VSP_COMPENSATION_C0152
     4474  //===== vsp 4 =====
     4475  if( iCount < 4 + extraMergeCand )
     4476    if ( !xAddVspMergeCand(4, 1, bVspMvZeroDone, uiDepth, abCandIsInter, iCount, puhInterDirNeighbours, pcMvFieldNeighbours, iVSPIndexTrue, mrgCandIdx, &cDisInfo) )
     4477      return;
     4478#endif
     4479 
     4480  // above left
    42664481#if HHI_INTER_VIEW_MOTION_PRED
    42674482  if( iCount < 4 + extraMergeCand )
     
    42884503#if SIMP_MRG_PRUN
    42894504    if( pcCUAboveLeft && !pcCUAboveLeft->isIntra( uiAboveLeftPartIdx )
     4505#if MERL_VSP_C0152
     4506     CHECK_ADD_YET(pcCUAboveLeft, uiAboveLeftPartIdx, 1)
     4507#endif
    42904508     && ( !pcCULeft || pcCULeft->isIntra( uiLeftPartIdx ) || !pcCULeft->hasEqualMotion( uiLeftPartIdx, pcCUAboveLeft, uiAboveLeftPartIdx ) )
    42914509     && ( !pcCUAbove || pcCUAbove->isIntra( uiAbovePartIdx ) || !pcCUAbove->hasEqualMotion( uiAbovePartIdx, pcCUAboveLeft, uiAboveLeftPartIdx ) )
     
    43144532      pcMvFieldNeighbours[(iCount<<1)+1].getMv().m_bDvMcp = false;
    43154533#endif
     4534#if MERL_VSP_C0152
     4535     xInheritVspMode( pcCUAboveLeft, uiAboveLeftPartIdx, bVspMvZeroDone, iCount, iVSPIndexTrue, pcMvFieldNeighbours, &cDisInfo ) ;
     4536#endif
    43164537#if SIMP_MRG_PRUN
    43174538      if ( mrgCandIdx == iCount )
     
    43234544    }
    43244545  }
     4546
     4547#if MERL_VSP_COMPENSATION_C0152
     4548  //===== vsp 5 =====
     4549  if( iCount < 4 + extraMergeCand )
     4550    if ( !xAddVspMergeCand(5, 1, bVspMvZeroDone, uiDepth, abCandIsInter, iCount, puhInterDirNeighbours, pcMvFieldNeighbours, iVSPIndexTrue, mrgCandIdx, &cDisInfo) )
     4551      return;
     4552#endif
    43254553
    43264554  if ( getSlice()->getPPS()->getEnableTMVPFlag()
     
    43564584    Int uiLCUIdx = getAddr();
    43574585    PartSize eCUMode = getPartitionSize( 0 );
     4586
     4587#if MERL_VSP_C0152 // Potential bug, not related to BW_VSP
     4588    if (eCUMode==SIZE_NxN)
     4589    {
     4590      printf("Size NxN ???");
     4591      assert(0);
     4592    }
     4593#endif
    43584594
    43594595    deriveRightBottomIdx( eCUMode, uiPUIdx, uiPartIdxRB ); 
     
    45984834    {
    45994835      Int i = uiPriorityList0[idx]; Int j = uiPriorityList1[idx];
    4600       if (abCandIsInter[i] && abCandIsInter[j]&& (puhInterDirNeighbours[i]&0x1)&&(puhInterDirNeighbours[j]&0x2))
     4836#if MERL_VSP_C0152
     4837      Bool bValid = true;
     4838      if (pcMvFieldNeighbours[i<<1].getRefIdx() < 0 || pcMvFieldNeighbours[(j<<1)+1].getRefIdx() < 0) // NOT_VALID
     4839        bValid = false;
     4840#endif
     4841      if (abCandIsInter[i] && abCandIsInter[j]&& (puhInterDirNeighbours[i]&0x1)&&(puhInterDirNeighbours[j]&0x2)
     4842#if MERL_VSP_C0152
     4843       && bValid
     4844#endif
     4845         )
    46014846      {
    46024847        abCandIsInter[uiArrayAddr] = true;
     
    47705015  if( uiIter == 0 )
    47715016  {
    4772     if( pcCorner && !pcCorner->isIntra( uiCornerPUIdx ) )
     5017    if( pcCorner && !pcCorner->isIntra( uiCornerPUIdx )
     5018#if MERL_VSP_C0152
     5019     && !pcCorner->getVSPIndex( uiCornerPUIdx )
     5020#endif
     5021    )
    47735022    {
    47745023      rbValidCand = true;
     
    48055054  else
    48065055  {
    4807     if( pcCorner && !pcCorner->isIntra( uiCornerPUIdx ) )
     5056    if( pcCorner && !pcCorner->isIntra( uiCornerPUIdx )
     5057#if MERL_VSP_C0152
     5058     && !pcCorner->getVSPIndex( uiCornerPUIdx )
     5059#endif
     5060    )
    48085061    {
    48095062      rbValidCand = true;
     
    49545207#endif
    49555208  if(pcTmpCU != NULL && !pcTmpCU->isIntra( uiIdx ) )
     5209#if MERL_VSP_C0152
     5210  if(! pcTmpCU->getVSPIndex(uiIdx))
     5211#endif
    49565212  {
    49575213    for(Int iList = 0; iList < (getSlice()->isInterB() ? 2: 1); iList ++)
     
    49805236
    49815237  if(pcTmpCU != NULL && !pcTmpCU->isIntra( uiIdx ))
     5238#if MERL_VSP_C0152
     5239  if(! pcTmpCU->getVSPIndex(uiIdx))
     5240#endif
    49825241  {
    49835242    for(Int iList = 0; iList < (getSlice()->isInterB() ? 2: 1); iList ++)
     
    50065265#endif
    50075266  if(pcTmpCU != NULL && !pcTmpCU->isIntra( uiIdx ) )
     5267#if MERL_VSP_C0152
     5268  if(! pcTmpCU->getVSPIndex(uiIdx))
     5269#endif
    50085270  {
    50095271    for(Int iList = 0; iList < (getSlice()->isInterB() ? 2: 1); iList ++)
     
    50315293#endif
    50325294  if(pcTmpCU != NULL && !pcTmpCU->isIntra( uiIdx ))
     5295#if MERL_VSP_C0152
     5296  if(! pcTmpCU->getVSPIndex(uiIdx))
     5297#endif
    50335298  {
    50345299    for(Int iList = 0; iList < (getSlice()->isInterB() ? 2: 1); iList ++)
     
    50595324#endif
    50605325  if(pcTmpCU != NULL && !pcTmpCU->isIntra( uiIdx ))
     5326#if MERL_VSP_C0152
     5327  if(! pcTmpCU->getVSPIndex(uiIdx))
     5328#endif
    50615329  {
    50625330    for(Int iList = 0; iList < (getSlice()->isInterB() ? 2: 1); iList ++)
     
    52575525}
    52585526
     5527#if MERL_VSP_C0152
     5528Pel TComDataCU::getMcpFromDM(TComPicYuv* pcBaseViewDepthPicYuv, TComMv* mv, Int iBlkX, Int iBlkY, Int iWidth, Int iHeight, Int* aiShiftLUT, Int iShiftPrec)
     5529{
     5530  Int depStride =  pcBaseViewDepthPicYuv->getStride();
     5531
     5532  Int width  = pcBaseViewDepthPicYuv->getWidth();
     5533  Int height = pcBaseViewDepthPicYuv->getHeight();
     5534
     5535  Int depthPosX = Clip3(0,   width - iWidth  - 1,  iBlkX + (mv->getHor()>>2));
     5536  Int depthPosY = Clip3(0,   height- iHeight - 1,  iBlkY + (mv->getVer()>>2));
     5537
     5538  Pel *depth  = pcBaseViewDepthPicYuv->getLumaAddr() + depthPosX + depthPosY * depStride;
     5539  Pel  maxDepth = 0;
     5540
     5541  for (Int j = 0; j < iHeight; j++)
     5542  {
     5543    for (Int i = 0; i < iWidth; i++)
     5544    {
     5545      if (maxDepth < depth[i])
     5546        maxDepth = depth[i];
     5547    }
     5548    depth += depStride;
     5549  }
     5550
     5551  Int disparity = aiShiftLUT[ maxDepth ] << iShiftPrec;
     5552
     5553  return disparity;
     5554}
     5555
     5556Void TComDataCU::estimateDVFromDM(UInt uiPartIdx, TComPic* picDepth, UInt uiPartAddr, TComMv* cMvPred)
     5557{
     5558  if (picDepth)
     5559  {
     5560    UInt uiAbsPartAddrCurrCU = m_uiAbsIdxInLCU + uiPartAddr;
     5561    Int iWidth, iHeight;
     5562    getPartIndexAndSize( uiPartIdx, uiPartAddr, iWidth, iHeight ); // The modified value of uiPartAddr won't be used any more
     5563   
     5564    TComPicYuv* pcBaseViewDepthPicYuv = picDepth->getPicYuvRec();
     5565    Int iBlkX = ( getAddr() % picDepth->getFrameWidthInCU() ) * g_uiMaxCUWidth  + g_auiRasterToPelX[ g_auiZscanToRaster[ uiAbsPartAddrCurrCU ] ];
     5566    Int iBlkY = ( getAddr() / picDepth->getFrameWidthInCU() ) * g_uiMaxCUHeight + g_auiRasterToPelY[ g_auiZscanToRaster[ uiAbsPartAddrCurrCU ] ];
     5567    Int* aiShiftLUT;
     5568    Int  iShiftPrec;
     5569    getSlice()->getBWVSPLUTParam(aiShiftLUT, iShiftPrec);
     5570   
     5571    Pel x = getMcpFromDM( pcBaseViewDepthPicYuv, cMvPred, iBlkX, iBlkY, iWidth, iHeight, aiShiftLUT, iShiftPrec );
     5572
     5573    cMvPred->setHor(x);
     5574    clipMv(*cMvPred);
     5575  }
     5576}
     5577#endif
     5578
    52595579#if LGE_DVMCP_A0126
    52605580#if QC_SIMPLE_NBDV_B0047
     
    52635583                                , Bool bParMerge
    52645584#endif
     5585#if MERL_VSP_C0152
     5586                                , Bool bDepthRefine
     5587#endif
    52655588#else
    52665589Void TComDataCU::getDisMvpCand2( UInt uiPartIdx, UInt uiPartAddr,DisInfo* pDInfo, Bool bMerge, RefPicList eRefPicList0, Int iRefIdx0
     
    53455668      {
    53465669        Int refViewIdx  = pcTmpCU->getSlice()->getRefViewId( eRefPicList, refId);
    5347         if (refViewIdx!= m_pcSlice->getViewId()) // DCP
     5670        if (refViewIdx != m_pcSlice->getViewId()) // DCP
    53485671        {
    53495672          TComMv cMvPred = pcTmpCU->getCUMvField(eRefPicList)->getMv(uiIdx);
    53505673          clipMv(cMvPred);
     5674#if !MERL_MTK_VSP_DVP_REFINE_C0152_C0131
    53515675          pDInfo->m_acMvCand[ pDInfo->iN] = cMvPred;
    53525676          pDInfo->m_aVIdxCan[ pDInfo->iN++] = refViewIdx;
     5677#else
     5678          {
     5679            TComPic* picDepth = NULL;
     5680            picDepth = getSlice()->getRefPicBaseDepth();
     5681            if (picDepth && bDepthRefine)
     5682              estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &cMvPred);
     5683            pDInfo->m_acMvCand[ pDInfo->iN] = cMvPred;
     5684            pDInfo->m_aVIdxCan[ pDInfo->iN++] = refViewIdx;
     5685          }
     5686#endif
    53535687          return;
    53545688        }
     
    53645698        }
    53655699      }
     5700#if MERL_VSP_C0152
     5701      else if (pcTmpCU->getVSPIndex(uiIdx) != 0) // is VSP
     5702      {
     5703        TComPic* picDepth = NULL;
     5704        TComMv myMv = pcTmpCU->getCUMvField( eRefPicList )->getMv( uiIdx );
     5705        picDepth = pcTmpCU->getSlice()->getRefPicBaseDepth();
     5706        if (picDepth && bDepthRefine)
     5707          estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &myMv);
     5708        myMv.setVer(0);
     5709
     5710        pDInfo->m_acMvCand[ pDInfo->iN] = myMv;
     5711        pDInfo->m_aVIdxCan[ pDInfo->iN++] = 0; // refViewIdx;
     5712        return;
     5713      }
     5714#endif
    53665715    }
    53675716  }
     
    54055754          TComMv cMvPred = pcTmpCU->getCUMvField(eRefPicList)->getMv(uiIdx);
    54065755          clipMv(cMvPred);
     5756#if !MERL_MTK_VSP_DVP_REFINE_C0152_C0131
    54075757          pDInfo->m_acMvCand[ pDInfo->iN] = cMvPred;
    54085758          pDInfo->m_aVIdxCan[ pDInfo->iN++] = refViewIdx;
     5759#else
     5760          {
     5761            TComPic* picDepth = NULL;
     5762            picDepth = getSlice()->getRefPicBaseDepth();
     5763            if (picDepth && bDepthRefine)
     5764              estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &cMvPred);
     5765            pDInfo->m_acMvCand[ pDInfo->iN] = cMvPred;
     5766            pDInfo->m_aVIdxCan[ pDInfo->iN++] = refViewIdx;
     5767          }
     5768#endif
    54095769          return;
    54105770        }
     
    54245784        }
    54255785      }
     5786#if MERL_VSP_C0152
     5787      else if (pcTmpCU->getVSPIndex(uiIdx) != 0) // is VSP
     5788      {
     5789        TComPic* picDepth = NULL;
     5790        TComMv myMv = pcTmpCU->getCUMvField( eRefPicList )->getMv( uiIdx );
     5791        picDepth = pcTmpCU->getSlice()->getRefPicBaseDepth();
     5792        if (picDepth && bDepthRefine)
     5793          estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &myMv);
     5794        myMv.setVer(0);
     5795
     5796        pDInfo->m_acMvCand[ pDInfo->iN] = myMv;
     5797        pDInfo->m_aVIdxCan[ pDInfo->iN++] = 0; // refViewIdx;
     5798        return;
     5799      }
     5800#endif
    54265801    }
    54275802  }
     
    54595834          TComMv cMvPred = pcTmpCU->getCUMvField(eRefPicList)->getMv(uiIdx);
    54605835          clipMv(cMvPred);
     5836#if !MERL_MTK_VSP_DVP_REFINE_C0152_C0131
    54615837          pDInfo->m_acMvCand[ pDInfo->iN] = cMvPred;
    54625838          pDInfo->m_aVIdxCan[ pDInfo->iN++] = refViewIdx;
     5839#else
     5840          {
     5841            TComPic* picDepth = NULL;
     5842            picDepth = getSlice()->getRefPicBaseDepth();
     5843            if (picDepth && bDepthRefine)
     5844              estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &cMvPred);
     5845            pDInfo->m_acMvCand[ pDInfo->iN] = cMvPred;
     5846            pDInfo->m_aVIdxCan[ pDInfo->iN++] = refViewIdx;
     5847          }
     5848#endif
    54635849          return;
    54645850        }
     
    54785864        }
    54795865      }
     5866#if MERL_VSP_C0152
     5867      else if (pcTmpCU->getVSPIndex(uiIdx) != 0) // is VSP
     5868      {
     5869        TComPic* picDepth = NULL;
     5870        TComMv myMv = pcTmpCU->getCUMvField( eRefPicList )->getMv( uiIdx );
     5871        picDepth = pcTmpCU->getSlice()->getRefPicBaseDepth();
     5872        if (picDepth && bDepthRefine)
     5873          estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &myMv);
     5874        myMv.setVer(0);
     5875
     5876        pDInfo->m_acMvCand[ pDInfo->iN] = myMv;
     5877        pDInfo->m_aVIdxCan[ pDInfo->iN++] = 0; // refViewIdx;
     5878        return;
     5879      }
     5880#endif
    54805881    }
    54815882  }
     
    55095910          TComMv cMvPred = pcTmpCU->getCUMvField(eRefPicList)->getMv(uiIdx);
    55105911          clipMv(cMvPred);
     5912#if !MERL_MTK_VSP_DVP_REFINE_C0152_C0131
    55115913          pDInfo->m_acMvCand[ pDInfo->iN] = cMvPred;
    55125914          pDInfo->m_aVIdxCan[ pDInfo->iN++] = refViewIdx;
     5915#else
     5916          {
     5917            TComPic* picDepth = NULL;
     5918            picDepth = getSlice()->getRefPicBaseDepth();
     5919            if (picDepth && bDepthRefine)
     5920              estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &cMvPred);
     5921            pDInfo->m_acMvCand[ pDInfo->iN] = cMvPred;
     5922            pDInfo->m_aVIdxCan[ pDInfo->iN++] = refViewIdx;
     5923          }
     5924#endif
    55135925          return;
    55145926        }
     
    55245936        }
    55255937      }
     5938#if MERL_VSP_C0152
     5939      else if (pcTmpCU->getVSPIndex(uiIdx) != 0) // is VSP
     5940      {
     5941        TComPic* picDepth = NULL;
     5942        TComMv myMv = pcTmpCU->getCUMvField( eRefPicList )->getMv( uiIdx );
     5943        picDepth = pcTmpCU->getSlice()->getRefPicBaseDepth();
     5944        if (picDepth && bDepthRefine)
     5945          estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &myMv);
     5946        myMv.setVer(0);
     5947
     5948        pDInfo->m_acMvCand[ pDInfo->iN] = myMv;
     5949        pDInfo->m_aVIdxCan[ pDInfo->iN++] = 0; // refViewIdx;
     5950        return;
     5951      }
     5952#endif
    55265953    }
    55275954  }
     
    55615988          TComMv cMvPred = pcTmpCU->getCUMvField(eRefPicList)->getMv(uiIdx);
    55625989          clipMv(cMvPred);
     5990#if !MERL_MTK_VSP_DVP_REFINE_C0152_C0131
    55635991          pDInfo->m_acMvCand[ pDInfo->iN] = cMvPred;
    55645992          pDInfo->m_aVIdxCan[ pDInfo->iN++] = refViewIdx;
     5993#else
     5994          {
     5995            TComPic* picDepth = NULL;
     5996            picDepth = getSlice()->getRefPicBaseDepth();
     5997            if (picDepth && bDepthRefine)
     5998              estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &cMvPred);
     5999            pDInfo->m_acMvCand[ pDInfo->iN] = cMvPred;
     6000            pDInfo->m_aVIdxCan[ pDInfo->iN++] = refViewIdx;
     6001          }
     6002#endif
    55656003          return;
    55666004        }
     
    55806018        }
    55816019      }
     6020#if MERL_VSP_C0152
     6021      else if (pcTmpCU->getVSPIndex(uiIdx) != 0) // is VSP
     6022      {
     6023        TComPic* picDepth = NULL;
     6024        TComMv myMv = pcTmpCU->getCUMvField( eRefPicList )->getMv( uiIdx );
     6025        picDepth = pcTmpCU->getSlice()->getRefPicBaseDepth();
     6026        if (picDepth && bDepthRefine)
     6027          estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &myMv);
     6028        myMv.setVer(0);
     6029
     6030        pDInfo->m_acMvCand[ pDInfo->iN] = myMv;
     6031        pDInfo->m_aVIdxCan[ pDInfo->iN++] = 0; // refViewIdx;
     6032        return;
     6033      }
     6034#endif
    55826035    }
    55836036  }
     
    58106263          {
    58116264            clipMv(cColMv);
    5812             pDInfo->m_acMvCand[pDInfo->iN] = cColMv;
    5813             pDInfo->m_aVIdxCan[pDInfo->iN++] = iTargetViewIdx;
     6265#if !MERL_MTK_VSP_DVP_REFINE_C0152_C0131
     6266            pDInfo->m_acMvCand[ pDInfo->iN] = cColMv;
     6267            pDInfo->m_aVIdxCan[ pDInfo->iN++] = iTargetViewIdx;
     6268#else
     6269            {
     6270              TComPic* picDepth = NULL;
     6271              picDepth = getSlice()->getRefPicBaseDepth();
     6272              if (picDepth && bDepthRefine)
     6273                estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &cColMv);
     6274
     6275              pDInfo->m_acMvCand[ pDInfo->iN] = cColMv;
     6276              pDInfo->m_aVIdxCan[ pDInfo->iN++] = iTargetViewIdx;
     6277            }
     6278#endif
    58146279            return ;
    58156280          }
     
    58196284        {
    58206285          clipMv(cColMv);
    5821           pDInfo->m_acMvCand[pDInfo->iN] = cColMv;
    5822           pDInfo->m_aVIdxCan[pDInfo->iN++] = iTargetViewIdx;
     6286#if !MERL_MTK_VSP_DVP_REFINE_C0152_C0131
     6287            pDInfo->m_acMvCand[ pDInfo->iN] = cColMv;
     6288            pDInfo->m_aVIdxCan[ pDInfo->iN++] = iTargetViewIdx;
     6289#else
     6290            {
     6291              TComPic* picDepth = NULL;
     6292              picDepth = getSlice()->getRefPicBaseDepth();
     6293              if (picDepth && bDepthRefine)
     6294                estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &cColMv);
     6295              pDInfo->m_acMvCand[ pDInfo->iN] = cColMv;
     6296              pDInfo->m_aVIdxCan[ pDInfo->iN++] = iTargetViewIdx;
     6297            }
     6298#endif
    58236299          return ;
    58246300        }
     
    58286304          {
    58296305            clipMv(cColMv);
    5830             pDInfo->m_acMvCand[pDInfo->iN] = cColMv;
    5831             pDInfo->m_aVIdxCan[pDInfo->iN++] = iTargetViewIdx;
     6306#if !MERL_MTK_VSP_DVP_REFINE_C0152_C0131
     6307            pDInfo->m_acMvCand[ pDInfo->iN] = cColMv;
     6308            pDInfo->m_aVIdxCan[ pDInfo->iN++] = iTargetViewIdx;
     6309#else
     6310            {
     6311              TComPic* picDepth = NULL;
     6312              picDepth = getSlice()->getRefPicBaseDepth();
     6313              if (picDepth && bDepthRefine)
     6314                estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &cColMv);
     6315              pDInfo->m_acMvCand[ pDInfo->iN] = cColMv;
     6316              pDInfo->m_aVIdxCan[ pDInfo->iN++] = iTargetViewIdx;
     6317            }
     6318#endif
    58326319            return ;
    58336320          }
     
    58526339          TComMv dv( aiDvMcpDvCand[iList][ i ], 0 );
    58536340          clipMv( dv );
    5854           pDInfo->m_acMvCand[ pDInfo->iN  ] = dv;
    5855           pDInfo->m_aVIdxCan[ pDInfo->iN++] = 0;
     6341#if !MERL_MTK_VSP_DVP_REFINE_C0152_C0131
     6342          pDInfo->m_acMvCand[ pDInfo->iN] = dv;
     6343          pDInfo->m_aVIdxCan[ pDInfo->iN++] = 0;
     6344#else
     6345          {
     6346            TComPic* picDepth = NULL;
     6347            picDepth = getSlice()->getRefPicBaseDepth();
     6348            if (picDepth && bDepthRefine)
     6349              estimateDVFromDM(uiPartIdx, picDepth, uiPartAddr, &dv);
     6350            pDInfo->m_acMvCand[ pDInfo->iN] = dv;
     6351            pDInfo->m_aVIdxCan[ pDInfo->iN++] = 0;
     6352          }
     6353#endif
    58566354          return;
    58576355        }
     
    58636361}
    58646362#endif
     6363
    58656364#endif
    58666365
     
    59046403#if QC_SIMPLE_NBDV_B0047
    59056404#if FIX_LGE_IVMP_PARALLEL_MERGE_B0136
    5906       getDisMvpCand2(uiPartIdx, uiPartAddr, &cDisInfo, false);
     6405      getDisMvpCand2(uiPartIdx, uiPartAddr, &cDisInfo, false
     6406#if MERL_VSP_C0152
     6407            , true
     6408#endif
     6409              );
    59076410#else
    59086411      getDisMvpCand2(uiPartIdx, uiPartAddr, &cDisInfo);
     
    64076910  }
    64086911 
     6912#if MERL_VSP_C0152
     6913  if(pcTmpCU != NULL && pcTmpCU->getVSPIndex(uiIdx))
     6914  {
     6915    return false;
     6916  }
     6917#endif
     6918
    64096919  if ( pcTmpCU != NULL && m_pcSlice->isEqualRef(eRefPicList, pcTmpCU->getCUMvField(eRefPicList)->getRefIdx(uiIdx), iRefIdx) )
    64106920  {
     
    65157025  TComDataCU* pcTmpCU = NULL;
    65167026  UInt uiIdx;
     7027
    65177028  switch( eDir )
    65187029  {
     
    65727083    return false;
    65737084  }
    6574  
     7085
     7086#if MERL_VSP_C0152
     7087  if(pcTmpCU->getVSPIndex(uiIdx))
     7088  {
     7089    return false;
     7090  }
     7091#endif
    65757092  RefPicList eRefPicList2nd = REF_PIC_LIST_0;
    65767093  if(       eRefPicList == REF_PIC_LIST_0 )
     
    67027219  TComDataCU *pColCU = pColPic->getCU( uiCUAddr );
    67037220  iColViewIdx = pColCU->getSlice()->getViewId();
    6704 
     7221#if MERL_VSP_C0152
     7222  //TComDataCU *pColCU = pColPic->getCU( uiCUAddr );
     7223  if( pColCU->getCUMvField(eColRefPicList)->getRefIdx(uiAbsPartAddr) < 0)
     7224  {
     7225    return false;
     7226  }
     7227#endif
    67057228
    67067229  if (pColCU->getPic()==0||pColCU->getPartitionSize(uiPartUnitIdx)==SIZE_NONE||pColCU->isIntra(uiAbsPartAddr))
     
    70267549    return false;
    70277550  }
    7028  
     7551
    70297552  if( m_pcSlice->getRefPic( eRefPicList, iRefIdx )->getViewId() != m_pcSlice->getViewId() )
    70307553  {
     
    70717594    }
    70727595  }
     7596
     7597#if MERL_VSP_C0152 // Preventive
     7598  if (pColCU->getCUMvField(eColRefPicList)->getRefIdx(uiPartIdxCenter) < 0) // NOT_VALID
     7599    return false;
     7600#endif
    70737601 
    70747602  // Scale the vector.
     
    78468374  memcpy( m_puhInterDir + uiAbsPartIdxDst, pcCU->getInterDir() + uiAbsPartIdxSrc,       sizeof( m_puhInterDir[0] ) * uiNumPartition );
    78478375
     8376#if MERL_VSP_C0152 && MTK_UNCONSTRAINED_MVI_B0083
     8377  memcpy( m_piVSPIndex + uiAbsPartIdxDst,  pcCU->getVSPIndex() + uiAbsPartIdxSrc, sizeof( m_piVSPIndex[0] ) * uiNumPartition );
     8378#endif
     8379
    78488380#if !MTK_UNCONSTRAINED_MVI_B0083
    78498381  memcpy( m_apiMVPIdx[0] + uiAbsPartIdxDst, pcCU->getMVPIdx(REF_PIC_LIST_0) + uiAbsPartIdxSrc, sizeof(*m_apiMVPIdx[0]) * uiNumPartition );
     
    79538485#if QC_SIMPLE_NBDV_B0047
    79548486#if FIX_LGE_IVMP_PARALLEL_MERGE_B0136
    7955   getDisMvpCand2( 0, 0,  &cDisInfo, false);
     8487  getDisMvpCand2( 0, 0,  &cDisInfo, false );
    79568488#else
    79578489  getDisMvpCand2( 0, 0,  &cDisInfo);
  • branches/HTM-5.1-dev3-MERL/source/Lib/TLibCommon/TComDataCU.h

    r189 r231  
    197197#endif
    198198  UChar*        m_puhMergeIndex;      ///< array of merge candidate indices
     199#if MERL_VSP_C0152
     200  Char*         m_piVSPIndex;         ///< array of VSP flags to indicate the current block uses synthetic predictor or not
     201                                      ///< value 0: non-VSP, value 1: VSP
     202#endif
    199203#if AMP_MRG
    200204  Bool          m_bIsMergeAMP;
     
    279283  Bool          xAddMVPCand           ( AMVPInfo* pInfo, RefPicList eRefPicList, Int iRefIdx, UInt uiPartUnitIdx, MVP_DIR eDir );
    280284  Bool          xAddMVPCandOrder      ( AMVPInfo* pInfo, RefPicList eRefPicList, Int iRefIdx, UInt uiPartUnitIdx, MVP_DIR eDir );
    281 
     285#if MERL_VSP_C0152
     286  inline Bool   xAddVspMergeCand      ( UChar ucVspMergePos, Int vspIdx, Bool* bVspMvZeroDone, UInt uiDepth, Bool* abCandIsInter, Int& iCount,
     287                                        UChar* puhInterDirNeighbours, TComMvField* pcMvFieldNeighbours, Int* iVSPIndexTrue, Int mrgCandIdx, DisInfo* pDisInfo );
     288  inline Void   xInheritVspMode       ( TComDataCU* pcCURef, UInt uiIdx, Bool* bVspMvZeroDone, Int iCount, Int* iVSPIndexTrue, TComMvField* pcMvFieldNeighbours, DisInfo* pDInfo ) ;
     289#endif
    282290  Void          deriveRightBottomIdx        ( PartSize eCUMode, UInt uiPartIdx, UInt& ruiPartIdxRB );
    283291  Bool          xGetColMVP( RefPicList eRefPicList, Int uiCUAddr, Int uiPartUnitIdx, TComMv& rcMv, Int& riRefIdx );
     
    366374  Void          copyTextureMotionDataFrom( TComDataCU* pcCU, UInt uiDepth, UInt uiAbsPartIdxSrc, UInt uiAbsPartIdxDst = 0 );
    367375#endif
    368  
    369   // -------------------------------------------------------------------------------------------------------------------
     376
     377   // -------------------------------------------------------------------------------------------------------------------
    370378  // member functions for CU data
    371379  // -------------------------------------------------------------------------------------------------------------------
     
    471479  Void          setMergeIndex         ( UInt uiIdx, UInt uiMergeIndex ) { m_puhMergeIndex[uiIdx] = uiMergeIndex;  }
    472480  Void          setMergeIndexSubParts ( UInt uiMergeIndex, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth );
     481
     482#if MERL_VSP_C0152
     483  Char*         getVSPIndex        ()                        { return m_piVSPIndex;        }
     484  Char          getVSPIndex        ( UInt uiIdx )            { return m_piVSPIndex[uiIdx]; }
     485  Void          setVSPIndex        ( UInt uiIdx, Int n )     { m_piVSPIndex[uiIdx] = n;    }
     486  Void          setVSPIndexSubParts( Char bVSPIndex, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth );
     487#endif
     488
    473489  template <typename T>
    474490  Void          setSubPart            ( T bParameter, T* pbBaseLCU, UInt uiCUAddr, UInt uiCUDepth, UInt uiPUIdx );
     
    555571  Void          getDisMvpCand2( UInt uiPartIdx, UInt uiPartAddr, DisInfo* pDInfo
    556572#if LGE_IVMP_PARALLEL_MERGE_B0136
    557     , Bool bParMerg = false
     573                              , Bool bParMerg = false
     574#endif
     575#if MERL_VSP_C0152
     576                              , Bool bDepthRefine = false
    558577#endif
    559578    );
     
    567586#endif
    568587
     588#endif
     589
     590#if MERL_VSP_C0152
     591  Pel           getMcpFromDM(TComPicYuv* pcBaseViewDepthPicYuv, TComMv* mv, Int iBlkX, Int iBlkY, Int iWidth, Int iHeight, Int* aiShiftLUT, Int iShiftPrec);
     592  Void          estimateDVFromDM(UInt uiPartIdx, TComPic* picDepth, UInt uiPartAddr, TComMv* cMvPred);
    569593#endif
    570594  Bool          getIViewOrgDepthMvPred( UInt uiPartIdx, RefPicList eRefPicList, Int iRefIdx, TComMv& rcMv );
     
    685709  Bool          hasEqualMotion              ( UInt uiAbsPartIdx, TComDataCU* pcCandCU, UInt uiCandAbsPartIdx );
    686710#if SIMP_MRG_PRUN
    687   Void          getInterMergeCandidates       ( UInt uiAbsPartIdx, UInt uiPUIdx, UInt uiDepth, TComMvField* pcMFieldNeighbours, UChar* puhInterDirNeighbours, Int& numValidMergeCand, Int mrgCandIdx = -1 );
    688 #else
    689   Void          getInterMergeCandidates       ( UInt uiAbsPartIdx, UInt uiPUIdx, UInt uiDepth, TComMvField* pcMFieldNeighbours, UChar* puhInterDirNeighbours, Int& numValidMergeCand );
    690 #endif
    691   Void          deriveLeftRightTopIdxGeneral  ( PartSize eCUMode, UInt uiAbsPartIdx, UInt uiPartIdx, UInt& ruiPartIdxLT, UInt& ruiPartIdxRT );
    692   Void          deriveLeftBottomIdxGeneral    ( PartSize eCUMode, UInt uiAbsPartIdx, UInt uiPartIdx, UInt& ruiPartIdxLB );
     711#if MERL_VSP_C0152
     712  Void          getInterMergeCandidates     ( UInt uiAbsPartIdx, UInt uiPUIdx, UInt uiDepth, TComMvField* pcMFieldNeighbours, UChar* puhInterDirNeighbours, Int& numValidMergeCand, Int* uiVSPIndexTrue, Int mrgCandIdx = -1 );
     713#else
     714  Void          getInterMergeCandidates     ( UInt uiAbsPartIdx, UInt uiPUIdx, UInt uiDepth, TComMvField* pcMFieldNeighbours, UChar* puhInterDirNeighbours, Int& numValidMergeCand, Int mrgCandIdx = -1 );
     715#endif
     716#else
     717  Void          getInterMergeCandidates     ( UInt uiAbsPartIdx, UInt uiPUIdx, UInt uiDepth, TComMvField* pcMFieldNeighbours, UChar* puhInterDirNeighbours, Int& numValidMergeCand );
     718#endif
     719  Void          deriveLeftRightTopIdxGeneral( PartSize eCUMode, UInt uiAbsPartIdx, UInt uiPartIdx, UInt& ruiPartIdxLT, UInt& ruiPartIdxRT );
     720  Void          deriveLeftBottomIdxGeneral  ( PartSize eCUMode, UInt uiAbsPartIdx, UInt uiPartIdx, UInt& ruiPartIdxLB );
    693721 
    694722 
  • branches/HTM-5.1-dev3-MERL/source/Lib/TLibCommon/TComDepthMapGenerator.cpp

    r189 r231  
    562562  m_cTmpPic.dump( acFilename, ( pcPic->getPOC() != 0 )  );
    563563}
     564
    564565#endif
    565566
     
    744745      Int         iNumRefPics       = pcSlice->getNumRefIdx( eRefPicList );
    745746      for( Int iPdmRefIdx = 0; iPdmRefIdx < iNumRefPics; iPdmRefIdx++ )
    746 {
     747      {
    747748        if( pcSlice->getRefPOC( eRefPicList, iPdmRefIdx ) == pcSlice->getPOC())
    748749        {
  • branches/HTM-5.1-dev3-MERL/source/Lib/TLibCommon/TComLoopFilter.cpp

    r56 r231  
    439439 
    440440  //-- Set BS for Intra MB : BS = 4 or 3
    441   if ( pcCUP->isIntra(uiPartP) || pcCUQ->isIntra(uiPartQ) )
     441  if ( pcCUP->isIntra(uiPartP) || pcCUQ->isIntra(uiPartQ)
     442#if MERL_VSP_C0152
     443    || pcCUP->getVSPIndex(uiPartP) || pcCUQ->getVSPIndex(uiPartQ)
     444#endif
     445     )
    442446  {
    443447    uiBs = 2;
     
    445449 
    446450  //-- Set BS for not Intra MB : BS = 2 or 1 or 0
    447   if ( !pcCUP->isIntra(uiPartP) && !pcCUQ->isIntra(uiPartQ) )
     451  if ( !pcCUP->isIntra(uiPartP) && !pcCUQ->isIntra(uiPartQ)
     452#if MERL_VSP_C0152
     453    && !pcCUP->getVSPIndex(uiPartP) && !pcCUQ->getVSPIndex(uiPartQ)
     454#endif
     455  )
    448456  {
    449457#if NSQT_LFFIX
     
    542550  }   // enf of "if( not Intra )"
    543551 
     552#if MERL_VSP_C0152
     553  if ( pcCUP->getVSPIndex(uiPartP) || pcCUQ->getVSPIndex(uiPartQ))
     554  {
     555    uiBs = 0;
     556  }
     557#endif
     558
    544559  m_aapucBS[iDir][uiAbsPartIdx] = uiBs;
    545560}
  • branches/HTM-5.1-dev3-MERL/source/Lib/TLibCommon/TComMotionInfo.cpp

    r189 r231  
    378378
    379379#if MTK_UNCONSTRAINED_MVI_B0083
    380 Void TComCUMvField::setUndefinedMv( Int iPartAddr, Int iNumPart, Char* pePredMode, UChar* puhInterDir, Int refIdx, Int InterDir )
     380Void TComCUMvField::setUndefinedMv( Int iPartAddr, Int iNumPart, Char* pePredMode, UChar* puhInterDir, Int refIdx, Int InterDir
     381                                   )
    381382{
    382383  PredMode predMode = MODE_INTRA;
     
    386387  {
    387388    predMode = static_cast<PredMode>( pePredMode[ iPartAddr+i ] );
    388     if( predMode==MODE_INTRA )
     389    if( predMode == MODE_INTRA )
    389390    {
    390391      m_pcMv[iPartAddr+i] = cMv;
  • branches/HTM-5.1-dev3-MERL/source/Lib/TLibCommon/TComPic.cpp

    r210 r231  
    703703}
    704704
    705 
    706705//! \}
  • branches/HTM-5.1-dev3-MERL/source/Lib/TLibCommon/TComPrediction.cpp

    r210 r231  
    5454{
    5555  m_piYuvExt = NULL;
     56#if MERL_VSP_C0152
     57  m_pDepth = (Int*) malloc(64*64*sizeof(Int)); // TODO: Use a smart way to determine the size of the array
     58  if (m_pDepth == NULL)
     59  {
     60      printf("ERROR: UKTGHU, No memory allocated.\n");
     61  }
     62#endif
    5663}
    5764
     
    5966{
    6067 
     68#if MERL_VSP_C0152
     69  if (m_pDepth != NULL)
     70  {
     71      free(m_pDepth);
     72  }
     73#endif
    6174  delete[] m_piYuvExt;
    6275
     
    886899  }
    887900}
     901
     902#if MERL_VSP_C0152
     903#if DEPTH_MAP_GENERATION
     904Void TComPrediction::motionCompensationBWVSP( TComDataCU* pcCU, TComYuv* pcYuvPred, UInt uiAbsPartIdx, RefPicList eRefPicList, Int iPartIdx, Bool bPrdDepthMap, UInt uiSubSampExpX, UInt uiSubSampExpY )
     905#else
     906Void TComPrediction::motionCompensationBWVSP ( TComDataCU* pcCU, TComYuv* pcYuvPred, UInt uiAbsPartIdx, RefPicList eRefPicList, Int iPartIdx )
     907#endif
     908{
     909  Int         iWidth;
     910  Int         iHeight;
     911  UInt        uiPartAddr;
     912
     913  if ( iPartIdx >= 0 )
     914  {
     915    pcCU->getPartIndexAndSize( iPartIdx, uiPartAddr, iWidth, iHeight );
     916
     917#if DEPTH_MAP_GENERATION
     918    if( bPrdDepthMap )
     919    {
     920      iWidth  >>= uiSubSampExpX;
     921      iHeight >>= uiSubSampExpY;
     922    }
     923#endif
     924
     925    if ( eRefPicList != REF_PIC_LIST_X )
     926    {
     927#if LGE_ILLUCOMP_B0045
     928      if( pcCU->getSlice()->getPPS()->getUseWP() && !pcCU->getICFlag(uiPartAddr))
     929#else
     930      if( pcCU->getSlice()->getPPS()->getUseWP())
     931#endif
     932      {
     933#if DEPTH_MAP_GENERATION
     934        xPredInterUniBWVSP (pcCU, uiPartAddr, uiAbsPartIdx+uiPartAddr , iWidth, iHeight, eRefPicList, pcYuvPred, iPartIdx, bPrdDepthMap, uiSubSampExpX, uiSubSampExpY, true );
     935#else
     936        xPredInterUniBWVSP (pcCU, uiPartAddr, uiAbsPartIdx+uiPartAddr , iWidth, iHeight, eRefPicList, pcYuvPred, iPartIdx, true );
     937#endif
     938      }
     939      else
     940      {
     941#if DEPTH_MAP_GENERATION
     942        xPredInterUniBWVSP (pcCU, uiPartAddr, uiAbsPartIdx+uiPartAddr , iWidth, iHeight, eRefPicList, pcYuvPred, iPartIdx, bPrdDepthMap, uiSubSampExpX, uiSubSampExpY, false );
     943#else
     944        xPredInterUniBWVSP (pcCU, uiPartAddr, uiAbsPartIdx+uiPartAddr, iWidth, iHeight, eRefPicList, pcYuvPred, iPartIdx, false );
     945#endif
     946      }
     947#if LGE_ILLUCOMP_B0045
     948      if( pcCU->getSlice()->getPPS()->getUseWP() && !pcCU->getICFlag(uiPartAddr))
     949#else
     950      if( pcCU->getSlice()->getPPS()->getUseWP())
     951#endif
     952      {
     953        xWeightedPredictionUni( pcCU, pcYuvPred, uiPartAddr, iWidth, iHeight, eRefPicList, pcYuvPred, iPartIdx );
     954      }
     955    }
     956    else
     957    {
     958#if DEPTH_MAP_GENERATION
     959      if( xCheckIdenticalMotion( pcCU, uiPartAddr ) && !bPrdDepthMap )
     960#else
     961      if ( xCheckIdenticalMotion( pcCU, uiPartAddr ) )
     962#endif
     963      {
     964#if DEPTH_MAP_GENERATION
     965        xPredInterUniBWVSP (pcCU, uiPartAddr, uiAbsPartIdx+uiPartAddr , iWidth, iHeight, REF_PIC_LIST_0, pcYuvPred, iPartIdx, bPrdDepthMap, uiSubSampExpX, uiSubSampExpY, false );
     966#else
     967        xPredInterUniBWVSP (pcCU, uiPartAddr, uiAbsPartIdx+uiPartAddr , iWidth, iHeight, REF_PIC_LIST_0, pcYuvPred, iPartIdx, false );
     968#endif
     969      }
     970      else
     971      {
     972#if DEPTH_MAP_GENERATION
     973        xPredInterBiBWVSP  (pcCU, uiPartAddr, uiAbsPartIdx+uiPartAddr , iWidth, iHeight, uiSubSampExpX, uiSubSampExpY, pcYuvPred, iPartIdx, bPrdDepthMap );
     974#else
     975        xPredInterBiBWVSP  (pcCU, uiPartAddr, uiAbsPartIdx+uiPartAddr , iWidth, iHeight, pcYuvPred, iPartIdx );
     976#endif
     977      }
     978    }
     979    return;
     980  }
     981
     982  for ( iPartIdx = 0; iPartIdx < pcCU->getNumPartInter(); iPartIdx++ )
     983  {
     984    pcCU->getPartIndexAndSize( iPartIdx, uiPartAddr, iWidth, iHeight );
     985
     986#if DEPTH_MAP_GENERATION
     987    if( bPrdDepthMap )
     988    {
     989      iWidth  >>= uiSubSampExpX;
     990      iHeight >>= uiSubSampExpY;
     991    }
     992#endif
     993
     994    if ( eRefPicList != REF_PIC_LIST_X )
     995    {
     996#if LGE_ILLUCOMP_B0045
     997      if( pcCU->getSlice()->getPPS()->getUseWP() && !pcCU->getICFlag(uiPartAddr))
     998#else
     999      if( pcCU->getSlice()->getPPS()->getUseWP())
     1000#endif
     1001      {
     1002#if DEPTH_MAP_GENERATION
     1003        xPredInterUniBWVSP (pcCU, uiPartAddr, uiAbsPartIdx+uiPartAddr , iWidth, iHeight, eRefPicList, pcYuvPred, iPartIdx, bPrdDepthMap, uiSubSampExpX, uiSubSampExpY, true );
     1004#else
     1005        xPredInterUniBWVSP (pcCU, uiPartAddr, uiAbsPartIdx+uiPartAddr, iWidth, iHeight, eRefPicList, pcYuvPred, iPartIdx, true );
     1006#endif   
     1007      }
     1008      else
     1009      {
     1010#if DEPTH_MAP_GENERATION
     1011        xPredInterUniBWVSP (pcCU, uiPartAddr, uiAbsPartIdx+uiPartAddr, iWidth, iHeight, eRefPicList, pcYuvPred, iPartIdx, bPrdDepthMap, uiSubSampExpX, uiSubSampExpY, false );
     1012#else
     1013        xPredInterUniBWVSP (pcCU, uiPartAddr, uiAbsPartIdx+uiPartAddr, iWidth, iHeight, eRefPicList, pcYuvPred, iPartIdx, false );
     1014#endif   
     1015      }
     1016#if DEPTH_MAP_GENERATION
     1017      xPredInterUniBWVSP (pcCU, uiPartAddr, uiAbsPartIdx+uiPartAddr, iWidth, iHeight, eRefPicList, pcYuvPred, iPartIdx, bPrdDepthMap, uiSubSampExpX, uiSubSampExpY, false );
     1018#else
     1019      xPredInterUniBWVSP (pcCU, uiPartAddr, uiAbsPartIdx+uiPartAddr, iWidth, iHeight, eRefPicList, pcYuvPred, iPartIdx, false );
     1020#endif 
     1021#if LGE_ILLUCOMP_B0045
     1022      if( pcCU->getSlice()->getPPS()->getUseWP() && !pcCU->getICFlag(uiPartAddr))
     1023#else
     1024      if( pcCU->getSlice()->getPPS()->getUseWP())
     1025#endif
     1026      {
     1027        xWeightedPredictionUni( pcCU, pcYuvPred, uiPartAddr, iWidth, iHeight, eRefPicList, pcYuvPred, iPartIdx );
     1028      }
     1029    }
     1030    else
     1031    {
     1032      if ( xCheckIdenticalMotion( pcCU, uiPartAddr ) )
     1033      {
     1034#if DEPTH_MAP_GENERATION
     1035        xPredInterUniBWVSP (pcCU, uiPartAddr, uiAbsPartIdx+uiPartAddr, iWidth, iHeight, REF_PIC_LIST_0, pcYuvPred, iPartIdx, bPrdDepthMap, uiSubSampExpX, uiSubSampExpY, false );
     1036#else
     1037        xPredInterUniBWVSP (pcCU, uiPartAddr, uiAbsPartIdx+uiPartAddr, iWidth, iHeight, REF_PIC_LIST_0, pcYuvPred, iPartIdx, false );
     1038#endif
     1039      }
     1040      else
     1041      {
     1042#if DEPTH_MAP_GENERATION
     1043        xPredInterBiBWVSP  (pcCU, uiPartAddr, uiAbsPartIdx+uiPartAddr, iWidth, iHeight, uiSubSampExpX, uiSubSampExpY, pcYuvPred, iPartIdx, bPrdDepthMap );
     1044#else
     1045        xPredInterBiBWVSP  (pcCU, uiPartAddr, uiAbsPartIdx+uiPartAddr, iWidth, iHeight, pcYuvPred, iPartIdx );
     1046#endif
     1047      }
     1048    }
     1049  }
     1050
     1051  return;
     1052}
     1053
     1054
     1055// Output: rpcYuvPred
     1056#if DEPTH_MAP_GENERATION
     1057Void TComPrediction::xPredInterUniBWVSP ( TComDataCU* pcCU, UInt uiPartAddr, UInt uiAbsPartIdx, Int iWidth, Int iHeight, RefPicList eRefPicList, TComYuv*& rpcYuvPred, Int iPartIdx, Bool bPrdDepthMap, UInt uiSubSampExpX, UInt uiSubSampExpY, Bool bi )
     1058#else
     1059Void TComPrediction::xPredInterUniBWVSP ( TComDataCU* pcCU, UInt uiPartAddr, UInt uiAbsPartIdx, Int iWidth, Int iHeight, RefPicList eRefPicList, TComYuv*& rpcYuvPred, Int iPartIdx, Bool bi )
     1060#endif
     1061{
     1062  Int  iRefIdx = pcCU->getCUMvField( eRefPicList )->getRefIdx( uiPartAddr );   
     1063  Int  vspIdx  = pcCU->getVSPIndex(uiPartAddr);
     1064  if (vspIdx != 0)
     1065  {
     1066    if (iRefIdx >= 0)
     1067    {
     1068      printf("vspIdx = %d, iRefIdx = %d\n", vspIdx, iRefIdx);
     1069    }
     1070    assert (iRefIdx < 0); // assert (iRefIdx == NOT_VALID);
     1071  }
     1072  else
     1073  {
     1074    assert (iRefIdx >= 0);
     1075  }
     1076
     1077  TComMv cMv = pcCU->getCUMvField( eRefPicList )->getMv( uiPartAddr );
     1078  pcCU->clipMv(cMv);
     1079
     1080#if DEPTH_MAP_GENERATION
     1081  if( bPrdDepthMap )
     1082  {
     1083    UInt uiRShift = 0;
     1084#if PDM_REMOVE_DEPENDENCE
     1085    if( pcCU->getPic()->getStoredPDMforV2() == 1 )
     1086      xPredInterPrdDepthMap( pcCU, pcCU->getSlice()->getRefPic( eRefPicList, iRefIdx )->getPredDepthMapTemp(), uiPartAddr, &cMv, iWidth, iHeight, uiSubSampExpX, uiSubSampExpY, rpcYuvPred, uiRShift, 0 );
     1087    else
     1088#endif
     1089      xPredInterPrdDepthMap( pcCU, pcCU->getSlice()->getRefPic( eRefPicList, iRefIdx )->getPredDepthMap(), uiPartAddr, &cMv, iWidth, iHeight, uiSubSampExpX, uiSubSampExpY, rpcYuvPred, uiRShift, 0 );
     1090
     1091    return;
     1092  }
     1093#endif
     1094
     1095#if HHI_FULL_PEL_DEPTH_MAP_MV_ACC
     1096  if( pcCU->getSlice()->getSPS()->isDepth() )
     1097  {
     1098    if (vspIdx != 0)
     1099    { // depth, vsp
     1100      // get depth estimator here
     1101      TComPic* pRefPicBaseDepth = pcCU->getSlice()->getRefPicBaseDepth();
     1102      TComPicYuv* pcBaseViewDepthPicYuv = NULL;
     1103      if (vspIdx < 4) // spatial
     1104      {
     1105        pcBaseViewDepthPicYuv = pRefPicBaseDepth->getPicYuvRec();
     1106      }
     1107      Int iBlkX = ( pcCU->getAddr() % pRefPicBaseDepth->getFrameWidthInCU() ) * g_uiMaxCUWidth  + g_auiRasterToPelX[ g_auiZscanToRaster[ uiAbsPartIdx ] ];
     1108      Int iBlkY = ( pcCU->getAddr() / pRefPicBaseDepth->getFrameWidthInCU() ) * g_uiMaxCUHeight + g_auiRasterToPelY[ g_auiZscanToRaster[ uiAbsPartIdx ] ];
     1109      Int* pShiftLUT;
     1110      Int iShiftPrec;
     1111      pcCU->getSlice()->getBWVSPLUTParam(pShiftLUT, iShiftPrec);
     1112      //using disparity to find the depth block of the base view as the depth block estimator of the current block
     1113      //using depth block estimator and base view texture to get Backward warping
     1114      xPredInterLumaBlkFromDM  ( pcBaseViewDepthPicYuv, pcBaseViewDepthPicYuv, pShiftLUT, iShiftPrec, &cMv, uiPartAddr, iBlkX,    iBlkY,    iWidth,    iHeight,     pcCU->getSlice()->getSPS()->isDepth(), vspIdx, rpcYuvPred );
     1115      xPredInterChromaBlkFromDM( pcBaseViewDepthPicYuv, pcBaseViewDepthPicYuv, pShiftLUT, iShiftPrec, &cMv, uiPartAddr, iBlkX>>1, iBlkY>>1, iWidth>>1, iHeight>>1,  pcCU->getSlice()->getSPS()->isDepth(), vspIdx, rpcYuvPred );
     1116    }
     1117    else
     1118    { // depth, non-vsp
     1119      UInt uiRShift = ( bi ? 14-g_uiBitDepth-g_uiBitIncrement : 0 );
     1120      UInt uiOffset = bi ? IF_INTERNAL_OFFS : 0;
     1121#if DEPTH_MAP_GENERATION
     1122      xPredInterPrdDepthMap( pcCU, pcCU->getSlice()->getRefPic( eRefPicList, iRefIdx )->getPicYuvRec(), uiPartAddr, &cMv, iWidth, iHeight, 0, 0, rpcYuvPred, uiRShift, uiOffset );
     1123#else
     1124      xPredInterPrdDepthMap( pcCU, pcCU->getSlice()->getRefPic( eRefPicList, iRefIdx )->getPicYuvRec(), uiPartAddr, &cMv, iWidth, iHeight, rpcYuvPred, uiRShift, uiOffset );
     1125#endif
     1126
     1127      xPredInterChromaBlk( pcCU, pcCU->getSlice()->getRefPic( eRefPicList, iRefIdx )->getPicYuvRec(), uiPartAddr, &cMv, iWidth, iHeight, rpcYuvPred, bi );
     1128    }
     1129  }
     1130  else // texture
     1131  {
     1132#endif
     1133    if ( vspIdx != 0 && !pcCU->getSlice()->getSPS()->isDepth())
     1134    { // texture, vsp
     1135      TComPic*    pRefPicBaseTxt        = pcCU->getSlice()->getRefPicBaseTxt();
     1136      TComPicYuv* pcBaseViewTxtPicYuv   = pRefPicBaseTxt->getPicYuvRec();
     1137      TComPicYuv* pcBaseViewDepthPicYuv = NULL;
     1138      if (vspIdx < 4) // spatial
     1139      {
     1140        TComPic* pRefPicBaseDepth = pcCU->getSlice()->getRefPicBaseDepth();
     1141        pcBaseViewDepthPicYuv     = pRefPicBaseDepth->getPicYuvRec();
     1142      }
     1143      Int iBlkX = ( pcCU->getAddr() % pRefPicBaseTxt->getFrameWidthInCU() ) * g_uiMaxCUWidth  + g_auiRasterToPelX[ g_auiZscanToRaster[ uiAbsPartIdx ] ];
     1144      Int iBlkY = ( pcCU->getAddr() / pRefPicBaseTxt->getFrameWidthInCU() ) * g_uiMaxCUHeight + g_auiRasterToPelY[ g_auiZscanToRaster[ uiAbsPartIdx ] ];
     1145      Int* pShiftLUT;
     1146      Int iShiftPrec;
     1147      pcCU->getSlice()->getBWVSPLUTParam(pShiftLUT, iShiftPrec);
     1148
     1149      //using disparity to find the depth block of the base view as the depth block estimator of the current block
     1150      //using depth block estimator and base view texture to get Backward warping
     1151      xPredInterLumaBlkFromDM  ( pcBaseViewTxtPicYuv, pcBaseViewDepthPicYuv, pShiftLUT, iShiftPrec, &cMv, uiPartAddr, iBlkX,    iBlkY,    iWidth,    iHeight,    pcCU->getSlice()->getSPS()->isDepth(), vspIdx, rpcYuvPred );
     1152      xPredInterChromaBlkFromDM( pcBaseViewTxtPicYuv, pcBaseViewDepthPicYuv, pShiftLUT, iShiftPrec, &cMv, uiPartAddr, iBlkX>>1, iBlkY>>1, iWidth>>1, iHeight>>1, pcCU->getSlice()->getSPS()->isDepth(), vspIdx, rpcYuvPred );
     1153    }
     1154    else
     1155    { // texture, non-vsp
     1156#if LGE_ILLUCOMP_B0045
     1157      Bool bICFlag = pcCU->getICFlag(uiPartAddr) && (pcCU->getSlice()->getRefViewId( eRefPicList, iRefIdx ) != pcCU->getSlice()->getViewId());
     1158
     1159      xPredInterLumaBlk  ( pcCU, pcCU->getSlice()->getRefPic( eRefPicList, iRefIdx )->getPicYuvRec(), uiPartAddr, &cMv, iWidth, iHeight, rpcYuvPred, bi, bICFlag);
     1160      xPredInterChromaBlk( pcCU, pcCU->getSlice()->getRefPic( eRefPicList, iRefIdx )->getPicYuvRec(), uiPartAddr, &cMv, iWidth, iHeight, rpcYuvPred, bi, bICFlag );
     1161#else
     1162      xPredInterLumaBlk  ( pcCU, pcCU->getSlice()->getRefPic( eRefPicList, iRefIdx )->getPicYuvRec(), uiPartAddr, &cMv, iWidth, iHeight, rpcYuvPred, bi );
     1163      xPredInterChromaBlk( pcCU, pcCU->getSlice()->getRefPic( eRefPicList, iRefIdx )->getPicYuvRec(), uiPartAddr, &cMv, iWidth, iHeight, rpcYuvPred, bi );
     1164#endif
     1165    }
     1166#if HHI_FULL_PEL_DEPTH_MAP_MV_ACC
     1167  }
     1168#endif
     1169}
     1170
     1171
     1172#if DEPTH_MAP_GENERATION
     1173Void TComPrediction::xPredInterBiBWVSP ( TComDataCU* pcCU, UInt uiPartAddr, UInt uiAbsPartIdx, Int iWidth, Int iHeight, UInt uiSubSampExpX, UInt uiSubSampExpY, TComYuv*& rpcYuvPred, Int iPartIdx, Bool bPrdDepthMap )
     1174#else
     1175Void TComPrediction::xPredInterBiSDM ( TComDataCU* pcCU, UInt uiPartAddr, UInt uiAbsPartIdx, Int iWidth, Int iHeight, TComYuv*& rpcYuvPred, Int iPartIdx )
     1176#endif
     1177{
     1178  TComYuv* pcMbYuv;
     1179  Int      iRefIdx[2] = {-1, -1};
     1180
     1181  for ( Int iRefList = 0; iRefList < 2; iRefList++ )
     1182  {
     1183    RefPicList eRefPicList = (iRefList ? REF_PIC_LIST_1 : REF_PIC_LIST_0);
     1184    iRefIdx[iRefList] = pcCU->getCUMvField( eRefPicList )->getRefIdx( uiPartAddr );
     1185#if MERL_VSP_C0152
     1186    if(!pcCU->getVSPIndex(uiPartAddr))
     1187    {
     1188      if ( iRefIdx[iRefList] < 0 )
     1189      {
     1190        continue;
     1191      }
     1192    }
     1193    else
     1194    {
     1195      if ( iRefList== REF_PIC_LIST_1 && iRefIdx[iRefList] < 0 ) // iRefIdx[iRefList] ==NOT_VALID
     1196      {
     1197        continue;
     1198      }
     1199    }
     1200#else
     1201    if ( iRefIdx[iRefList] < 0 )
     1202    {
     1203      continue;
     1204    }
     1205#endif
     1206    assert( iRefIdx[iRefList] < pcCU->getSlice()->getNumRefIdx(eRefPicList) );
     1207
     1208    pcMbYuv = &m_acYuvPred[iRefList];
     1209    if( pcCU->getCUMvField( REF_PIC_LIST_0 )->getRefIdx( uiPartAddr ) >= 0 && pcCU->getCUMvField( REF_PIC_LIST_1 )->getRefIdx( uiPartAddr ) >= 0 )
     1210    {
     1211#if DEPTH_MAP_GENERATION
     1212      xPredInterUniBWVSP ( pcCU, uiPartAddr, uiAbsPartIdx, iWidth, iHeight, eRefPicList, pcMbYuv, iPartIdx, bPrdDepthMap, uiSubSampExpX, uiSubSampExpY, true );
     1213#else
     1214      xPredInterUniBWVSP ( pcCU, uiPartAddr, uiAbsPartIdx, iWidth, iHeight, eRefPicList, pcMbYuv, iPartIdx, true );
     1215#endif
     1216    }
     1217    else
     1218    {
     1219      if ( pcCU->getSlice()->getPPS()->getWPBiPredIdc() )
     1220      {
     1221#if DEPTH_MAP_GENERATION
     1222        xPredInterUniBWVSP ( pcCU, uiPartAddr, uiAbsPartIdx, iWidth, iHeight, eRefPicList, pcMbYuv, iPartIdx, bPrdDepthMap, uiSubSampExpX, uiSubSampExpY, true );
     1223#else
     1224        xPredInterUniBWVSP ( pcCU, uiPartAddr, uiAbsPartIdx, iWidth, iHeight, eRefPicList, pcMbYuv, iPartIdx, true );
     1225#endif
     1226      }
     1227      else
     1228      {
     1229#if DEPTH_MAP_GENERATION
     1230        xPredInterUniBWVSP ( pcCU, uiPartAddr, uiAbsPartIdx, iWidth, iHeight, eRefPicList, pcMbYuv, iPartIdx, bPrdDepthMap, uiSubSampExpX, uiSubSampExpY, false );
     1231#else
     1232        xPredInterUniBWVSP ( pcCU, uiPartAddr, uiAbsPartIdx, iWidth, iHeight, eRefPicList, pcMbYuv, iPartIdx, false );
     1233#endif
     1234      }
     1235    }
     1236  }
     1237
     1238  if ( pcCU->getSlice()->getPPS()->getWPBiPredIdc() )
     1239  {
     1240#if MERL_VSP_C0152
     1241    if(pcCU->getVSPIndex(uiPartAddr))
     1242      m_acYuvPred[0].copyPartToPartYuv( rpcYuvPred, uiPartAddr, iWidth, iHeight );
     1243    else
     1244#endif
     1245    xWeightedPredictionBi( pcCU, &m_acYuvPred[0], &m_acYuvPred[1], iRefIdx[0], iRefIdx[1], uiPartAddr, iWidth, iHeight, rpcYuvPred );
     1246  }
     1247  else
     1248  {
     1249#if DEPTH_MAP_GENERATION
     1250    if ( bPrdDepthMap )
     1251    {
     1252      xWeightedAveragePdm( pcCU, &m_acYuvPred[0], &m_acYuvPred[1], iRefIdx[0], iRefIdx[1], uiPartAddr, iWidth, iHeight, rpcYuvPred, uiSubSampExpX, uiSubSampExpY );
     1253    }
     1254    else
     1255    {
     1256#if MERL_VSP_C0152
     1257      if(pcCU->getVSPIndex(uiPartAddr))
     1258        m_acYuvPred[0].copyPartToPartYuv( rpcYuvPred, uiPartAddr, iWidth, iHeight );
     1259      else
     1260#endif
     1261      xWeightedAverage( pcCU, &m_acYuvPred[0], &m_acYuvPred[1], iRefIdx[0], iRefIdx[1], uiPartAddr, iWidth, iHeight, rpcYuvPred );
     1262    }
     1263#else
     1264    xWeightedAverage( pcCU, &m_acYuvPred[0], &m_acYuvPred[1], iRefIdx[0], iRefIdx[1], uiPartAddr, iWidth, iHeight, rpcYuvPred );
     1265#endif
     1266  }
     1267}
     1268#endif
    8881269
    8891270Void
     
    11191500}
    11201501
     1502#if MERL_VSP_C0152
     1503// Input:
     1504// refPic: Ref picture. Full picture, with padding
     1505// posX, posY:     PU position, texture
     1506// size_x, size_y: PU size
     1507// partAddr: z-order index
     1508// mv: disparity vector. derived from neighboring blocks
     1509//
     1510// Output: dstPic, PU predictor 64x64
     1511Void TComPrediction::xPredInterLumaBlkFromDM( TComPicYuv *refPic, TComPicYuv *pPicBaseDepth, Int* pShiftLUT, Int iShiftPrec, TComMv* mv, UInt partAddr,Int posX, Int posY, Int size_x, Int size_y, Bool isDepth, Int vspIdx
     1512                                            , TComYuv *&dstPic )
     1513{
     1514  Int widthLuma;
     1515  Int heightLuma;
     1516
     1517  if (isDepth)
     1518  {
     1519    widthLuma   =  pPicBaseDepth->getWidth();
     1520    heightLuma  =  pPicBaseDepth->getHeight();
     1521  }
     1522  else
     1523  {
     1524    widthLuma   =  refPic->getWidth();
     1525    heightLuma  =  refPic->getHeight();
     1526  }
     1527
     1528#if MERL_VSP_BLOCKSIZE_C0152 != 1
     1529  Int widthDepth  = pPicBaseDepth->getWidth();
     1530  Int heightDepth = pPicBaseDepth->getHeight();
     1531#endif
     1532
     1533  Int nTxtPerDepthX = widthLuma  / ( pPicBaseDepth->getWidth() );  // texture pixel # per depth pixel
     1534  Int nTxtPerDepthY = heightLuma / ( pPicBaseDepth->getHeight() );
     1535
     1536  Int refStride = refPic->getStride();
     1537  Int dstStride = dstPic->getStride();
     1538  Int depStride =  pPicBaseDepth->getStride();
     1539
     1540  Int depthPosX = Clip3(0,   widthLuma - size_x - 1,  (posX/nTxtPerDepthX) + (mv->getHor()>>2));
     1541  Int depthPosY = Clip3(0,   heightLuma- size_y - 1,  (posY/nTxtPerDepthY) + (mv->getVer()>>2));
     1542
     1543  Pel *ref    = refPic->getLumaAddr() + posX + posY * refStride;
     1544  Pel *dst    = dstPic->getLumaAddr(partAddr);
     1545  Pel *depth  = pPicBaseDepth->getLumaAddr() + depthPosX + depthPosY * depStride;
     1546
     1547#if MERL_VSP_BLOCKSIZE_C0152 != 1
     1548#if MERL_VSP_BLOCKSIZE_C0152 == 2
     1549  Int  dW = size_x>>1;
     1550  Int  dH = size_y>>1;
     1551#endif
     1552#if MERL_VSP_BLOCKSIZE_C0152 == 4
     1553  Int  dW = size_x>>2;
     1554  Int  dH = size_y>>2;
     1555#endif
     1556  {
     1557    Pel* depthi = depth;
     1558    for (Int j = 0; j < dH; j++)
     1559    {
     1560      for (Int i = 0; i < dW; i++)
     1561      {
     1562        Pel* depthTmp;
     1563#if MERL_VSP_BLOCKSIZE_C0152 == 2
     1564        if (depthPosX + (i<<1) < widthDepth)
     1565          depthTmp = depthi + (i << 1);
     1566        else
     1567          depthTmp = depthi + (widthDepth - depthPosX - 1);
     1568#endif
     1569#if MERL_VSP_BLOCKSIZE_C0152 == 4
     1570        if (depthPosX + (i<<2) < widthDepth)
     1571          depthTmp = depthi + (i << 2);
     1572        else
     1573          depthTmp = depthi + (widthDepth - depthPosX - 1);
     1574#endif
     1575        Int maxV = 0;
     1576        for (Int blockj = 0; blockj < MERL_VSP_BLOCKSIZE_C0152; blockj++)
     1577        {
     1578          Int iX = 0;
     1579          for (Int blocki = 0; blocki < MERL_VSP_BLOCKSIZE_C0152; blocki++)
     1580          {
     1581            if (maxV < depthTmp[iX])
     1582              maxV = depthTmp[iX];
     1583#if MERL_VSP_BLOCKSIZE_C0152 == 2
     1584            if (depthPosX + (i<<1) + blocki < widthDepth - 1)
     1585#else // MERL_VSP_BLOCKSIZE_C0152 == 4
     1586            if (depthPosX + (i<<2) + blocki < widthDepth - 1)
     1587#endif
     1588              iX++;
     1589          }
     1590#if MERL_VSP_BLOCKSIZE_C0152 == 2
     1591          if (depthPosY + (j<<1) + blockj < heightDepth - 1)
     1592#else // MERL_VSP_BLOCKSIZE_C0152 == 4
     1593          if (depthPosY + (j<<2) + blockj < heightDepth - 1)
     1594#endif
     1595            depthTmp += depStride;
     1596        }
     1597        m_pDepth[i+j*dW] = maxV;
     1598      } // end of i < dW
     1599#if MERL_VSP_BLOCKSIZE_C0152 == 2
     1600      if (depthPosY + ((j+1)<<1) < heightDepth)
     1601        depthi += (depStride << 1);
     1602      else
     1603        depthi  = depth + (heightDepth-depthPosY-1)*depStride;
     1604#endif
     1605#if MERL_VSP_BLOCKSIZE_C0152 == 4
     1606      if (depthPosY + ((j+1)<<2) < heightDepth) // heightDepth-1
     1607        depthi += (depStride << 2);
     1608      else
     1609        depthi  = depth + (heightDepth-depthPosY-1)*depStride; // the last line
     1610#endif
     1611    }
     1612  }
     1613#endif
     1614 
     1615#if MERL_VSP_BLOCKSIZE_C0152 != 1
     1616  Int yDepth = 0;
     1617#endif
     1618  for ( Int yTxt = 0; yTxt < size_y; yTxt += nTxtPerDepthY )
     1619  {
     1620    for ( Int xTxt = 0, xDepth = 0; xTxt < size_x; xTxt += nTxtPerDepthX, xDepth++ )
     1621    {
     1622      Pel rep_depth = 0; // to store the depth value used for warping
     1623#if MERL_VSP_BLOCKSIZE_C0152 == 1
     1624      rep_depth = depth[xDepth];
     1625#endif
     1626#if MERL_VSP_BLOCKSIZE_C0152 == 2
     1627      rep_depth = m_pDepth[(xTxt>>1) + (yTxt>>1)*dW];
     1628#endif
     1629#if MERL_VSP_BLOCKSIZE_C0152 == 4
     1630      rep_depth = m_pDepth[(xTxt>>2) + (yTxt>>2)*dW];
     1631#endif
     1632
     1633      assert( rep_depth >= 0 && rep_depth <= 255 );
     1634      Int disparity = pShiftLUT[ rep_depth ] << iShiftPrec;
     1635      Int refOffset = xTxt + (disparity >> 2);
     1636      Int xFrac = disparity & 0x3;
     1637      Int absX  = posX + refOffset;
     1638
     1639      if (xFrac == 0)
     1640        absX = Clip3(0, widthLuma-1, absX);
     1641      else
     1642        absX = Clip3(4, widthLuma-5, absX);
     1643
     1644      refOffset = absX - posX;
     1645
     1646      assert( ref[refOffset] >= 0 && ref[refOffset]<= 255 );
     1647      m_if.filterHorLuma( &ref[refOffset], refStride, &dst[xTxt], dstStride, nTxtPerDepthX, nTxtPerDepthY, xFrac, true );
     1648    }
     1649    ref   += refStride*nTxtPerDepthY;
     1650    dst   += dstStride*nTxtPerDepthY;
     1651    depth += depStride;
     1652#if MERL_VSP_BLOCKSIZE_C0152 != 1
     1653    yDepth++;
     1654#endif
     1655  }
     1656}
     1657
     1658Void TComPrediction::xPredInterChromaBlkFromDM ( TComPicYuv *refPic, TComPicYuv *pPicBaseDepth, Int* pShiftLUT, Int iShiftPrec, TComMv*mv, UInt partAddr, Int posX, Int posY, Int size_x, Int size_y, Bool isDepth, Int vspIdx
     1659                                               , TComYuv *&dstPic )
     1660{
     1661  Int refStride = refPic->getCStride();
     1662  Int dstStride = dstPic->getCStride();
     1663  Int depStride = pPicBaseDepth->getStride();
     1664
     1665  Int widthChroma, heightChroma;
     1666  if( isDepth)
     1667  {
     1668     widthChroma   = pPicBaseDepth->getWidth()>>1;
     1669     heightChroma  = pPicBaseDepth->getHeight()>>1;
     1670  }
     1671  else
     1672  {
     1673     widthChroma   = refPic->getWidth()>>1;
     1674     heightChroma  = refPic->getHeight()>>1;
     1675  }
     1676
     1677  // Below is only for Texture chroma component
     1678
     1679  Int widthDepth  = pPicBaseDepth->getWidth();
     1680  Int heightDepth = pPicBaseDepth->getHeight();
     1681
     1682  Int nTxtPerDepthX, nTxtPerDepthY;  // Number of texture samples per one depth sample
     1683  Int nDepthPerTxtX, nDepthPerTxtY;  // Number of depth samples per one texture sample
     1684
     1685  Int depthPosX;  // Starting position in depth image
     1686  Int depthPosY;
     1687
     1688  if ( widthChroma > widthDepth )
     1689  {
     1690    nTxtPerDepthX = widthChroma / widthDepth;
     1691    nDepthPerTxtX = 1;
     1692    depthPosX = posX / nTxtPerDepthX + (mv->getHor()>>2);        //mv denotes the disparity for VSP
     1693  }
     1694  else
     1695  {
     1696    nTxtPerDepthX = 1;
     1697    nDepthPerTxtX = widthDepth / widthChroma;
     1698    depthPosX = posX * nDepthPerTxtX + (mv->getHor()>>2);        //mv denotes the disparity for VSP
     1699  }
     1700  depthPosX = Clip3(0, widthDepth - (size_x<<1) - 1, depthPosX);
     1701 
     1702  if ( heightChroma > heightDepth )
     1703  {
     1704    nTxtPerDepthY = heightChroma / heightDepth;
     1705    nDepthPerTxtY = 1;
     1706    depthPosY = posY / nTxtPerDepthY + (mv->getVer()>>2);     //mv denotes the disparity for VSP
     1707  }
     1708  else
     1709  {
     1710    nTxtPerDepthY = 1;
     1711    nDepthPerTxtY = heightDepth / heightChroma;
     1712    depthPosY = posY * nDepthPerTxtY + (mv->getVer()>>2);     //mv denotes the disparity for VSP
     1713  }
     1714  depthPosY = Clip3(0, heightDepth - (size_y<<1) - 1, depthPosY);
     1715
     1716  Pel *refCb  = refPic->getCbAddr() + posX + posY * refStride;
     1717  Pel *refCr  = refPic->getCrAddr() + posX + posY * refStride;
     1718  Pel *dstCb  = dstPic->getCbAddr(partAddr);
     1719  Pel *dstCr  = dstPic->getCrAddr(partAddr);
     1720  Pel *depth  = pPicBaseDepth->getLumaAddr() + depthPosX + depthPosY * depStride;  // move the pointer to the current depth pixel position
     1721 
     1722  Int refStrideBlock = refStride * nTxtPerDepthY;
     1723  Int dstStrideBlock = dstStride * nTxtPerDepthY;
     1724  Int depStrideBlock = depStride * nDepthPerTxtY;
     1725
     1726  if (isDepth)
     1727  {
     1728     // DT: Since the call for this function is redundant, ..
     1729     for (Int y = 0; y < size_y; y++)
     1730     {
     1731       for (Int x = 0; x < size_x; x++)
     1732       {
     1733         dstCb[x] = 128;
     1734         dstCr[x] = 128;
     1735       }
     1736       dstCb += dstStride;
     1737       dstCr += dstStride;
     1738     }
     1739     return;
     1740  }
     1741 
     1742  if ( widthChroma > widthDepth ) // We assume
     1743  {
     1744    assert( heightChroma > heightDepth );
     1745    printf("This branch should never been reached.\n");
     1746    exit(0);
     1747  }
     1748  else
     1749  {
     1750#if MERL_VSP_BLOCKSIZE_C0152 == 1
     1751  Int  dW = size_x;
     1752  Int  dH = size_y;
     1753  Int  sW = 2; // search window size
     1754  Int  sH = 2;
     1755#endif
     1756#if MERL_VSP_BLOCKSIZE_C0152 == 2
     1757  Int  dW = size_x;
     1758  Int  dH = size_y;
     1759  Int  sW = 2; // search window size
     1760  Int  sH = 2;
     1761#endif
     1762#if MERL_VSP_BLOCKSIZE_C0152 == 4
     1763  Int  dW = size_x>>1;
     1764  Int  dH = size_y>>1;
     1765  Int  sW = 4; // search window size
     1766  Int  sH = 4;
     1767#endif
     1768
     1769  {
     1770    Pel* depthi = depth;
     1771    for (Int j = 0; j < dH; j++)
     1772    {
     1773      for (Int i = 0; i < dW; i++)
     1774      {
     1775        Pel* depthTmp;
     1776#if MERL_VSP_BLOCKSIZE_C0152 == 1
     1777        depthTmp = depthi + (i << 1);
     1778#endif
     1779#if MERL_VSP_BLOCKSIZE_C0152 == 2
     1780        if (depthPosX + (i<<1) < widthDepth)
     1781          depthTmp = depthi + (i << 1);
     1782        else
     1783          depthTmp = depthi + (widthDepth - depthPosX - 1);
     1784#endif
     1785#if MERL_VSP_BLOCKSIZE_C0152 == 4
     1786        if (depthPosX + (i<<2) < widthDepth)
     1787          depthTmp = depthi + (i << 2);
     1788        else
     1789          depthTmp = depthi + (widthDepth - depthPosX - 1);
     1790#endif
     1791        Int maxV = 0;
     1792        for (Int blockj = 0; blockj < sH; blockj++)
     1793        {
     1794          Int iX = 0;
     1795          for (Int blocki = 0; blocki < sW; blocki++)
     1796          {
     1797            if (maxV < depthTmp[iX])
     1798              maxV = depthTmp[iX];
     1799            if (depthPosX + i*sW + blocki < widthDepth - 1)
     1800              iX++;
     1801          }
     1802          if (depthPosY + j*sH + blockj < heightDepth - 1)
     1803            depthTmp += depStride;
     1804        }
     1805        m_pDepth[i+j*dW] = maxV;
     1806      } // end of i < dW
     1807#if MERL_VSP_BLOCKSIZE_C0152 == 1
     1808      if (depthPosY + ((j+1)<<1) < heightDepth)
     1809        depthi += (depStride << 1);
     1810      else
     1811        depthi  = depth + (heightDepth-1)*depStride;
     1812#endif
     1813#if MERL_VSP_BLOCKSIZE_C0152 == 2
     1814      if (depthPosY + ((j+1)<<1) < heightDepth)
     1815        depthi += (depStride << 1);
     1816      else
     1817        depthi  = depth + (heightDepth-depthPosY-1)*depStride;
     1818#endif
     1819#if MERL_VSP_BLOCKSIZE_C0152 == 4
     1820      if (depthPosY + ((j+1)<<2) < heightDepth) // heightDepth-1
     1821        depthi += (depStride << 2);
     1822      else
     1823        depthi  = depth + (heightDepth-depthPosY-1)*depStride; // the last line
     1824#endif
     1825    }
     1826  }
     1827
     1828
     1829    // (size_x, size_y) is Chroma block size
     1830    for ( Int yTxt = 0, yDepth = 0; yTxt < size_y; yTxt += nTxtPerDepthY, yDepth += nDepthPerTxtY )
     1831    {
     1832      for ( Int xTxt = 0, xDepth = 0; xTxt < size_x; xTxt += nTxtPerDepthX, xDepth += nDepthPerTxtX )
     1833      {
     1834        Pel rep_depth = 0; // to store the depth value used for warping
     1835#if MERL_VSP_BLOCKSIZE_C0152 == 1
     1836        rep_depth = m_pDepth[(xTxt) + (yTxt)*dW];
     1837#endif
     1838#if MERL_VSP_BLOCKSIZE_C0152 == 2
     1839        rep_depth = m_pDepth[(xTxt) + (yTxt)*dW];
     1840#endif
     1841#if MERL_VSP_BLOCKSIZE_C0152 == 4
     1842        rep_depth = m_pDepth[(xTxt>>1) + (yTxt>>1)*dW];
     1843#endif
     1844
     1845      // calculate the offset in the reference picture
     1846        Int disparity = pShiftLUT[ rep_depth ] << iShiftPrec;
     1847        Int refOffset = xTxt + (disparity >> 3); // in integer pixel in chroma image
     1848        Int xFrac = disparity & 0x7;
     1849        Int absX  = posX + refOffset;
     1850
     1851        if (xFrac == 0)
     1852          absX = Clip3(0, widthChroma-1, absX);
     1853        else
     1854          absX = Clip3(4, widthChroma-5, absX);
     1855
     1856        refOffset = absX - posX;
     1857
     1858        assert( refCb[refOffset] >= 0 && refCb[refOffset]<= 255 );
     1859        assert( refCr[refOffset] >= 0 && refCr[refOffset]<= 255 );
     1860        m_if.filterHorChroma(&refCb[refOffset], refStride, &dstCb[xTxt],  dstStride, nTxtPerDepthX, nTxtPerDepthY, xFrac, true);
     1861        m_if.filterHorChroma(&refCr[refOffset], refStride, &dstCr[xTxt],  dstStride, nTxtPerDepthX, nTxtPerDepthY, xFrac, true);
     1862      }
     1863      refCb += refStrideBlock;
     1864      refCr += refStrideBlock;
     1865      dstCb += dstStrideBlock;
     1866      dstCr += dstStrideBlock;
     1867      depth += depStrideBlock;
     1868    }
     1869  }
     1870}
     1871
     1872#endif // MERL_VSP_C0152
     1873
    11211874#if DEPTH_MAP_GENERATION
    11221875Void TComPrediction::xWeightedAveragePdm( TComDataCU* pcCU, TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, Int iRefIdx0, Int iRefIdx1, UInt uiPartIdx, Int iWidth, Int iHeight, TComYuv*& rpcYuvDst, UInt uiSubSampExpX, UInt uiSubSampExpY )
  • branches/HTM-5.1-dev3-MERL/source/Lib/TLibCommon/TComPrediction.h

    r210 r231  
    7878  UInt   m_uiaShift[ 63 ];       // Table for multiplication to substitue of division operation
    7979
     80#if MERL_VSP_C0152
     81  Int*   m_pDepth; ///< Local variable, to store a depth block, just to prevent allocate memory every time
     82#endif
     83
    8084  Void xPredIntraAng            ( Int* pSrc, Int srcStride, Pel*& rpDst, Int dstStride, UInt width, UInt height, UInt dirMode, Bool blkAboveAvailable, Bool blkLeftAvailable, Bool bFilter );
    8185  Void xPredIntraPlanar         ( Int* pSrc, Int srcStride, Pel* rpDst, Int dstStride, UInt width, UInt height );
     
    9498  Void xPredInterBi             ( TComDataCU* pcCU,                          UInt uiPartAddr,               Int iWidth, Int iHeight,                         TComYuv*& rpcYuvPred, Int iPartIdx          );
    9599  Void xPredInterPrdDepthMap    ( TComDataCU* pcCU, TComPicYuv* pcPicYuvRef, UInt uiPartAddr, TComMv* pcMv, Int iWidth, Int iHeight,                         TComYuv*& rpcYuv, UInt uiRShift, UInt uiOffset );
     100#endif
     101#if MERL_VSP_C0152
     102  Void xPredInterUniBWVSP         ( TComDataCU* pcCU,                          UInt uiPartAddr, UInt uiAbsPartIdx,               Int iWidth, Int iHeight, RefPicList eRefPicList, TComYuv*& rpcYuvPred, Int iPartIdx, Bool bPrdDepthMap, UInt uiSubSampExpX, UInt uiSubSampExpY, Bool bi=false );
     103  Void xPredInterBiBWVSP          ( TComDataCU* pcCU,                          UInt uiPartAddr, UInt uiAbsPartIdx,               Int iWidth, Int iHeight, UInt uiSubSampExpX, UInt uiSubSampExpY, TComYuv*& rpcYuvPred, Int iPartIdx, Bool bPrdDepthMap );
    96104#endif
    97105
     
    108116#endif
    109117  Void xWeightedAverage         ( TComDataCU* pcCU, TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, Int iRefIdx0, Int iRefIdx1, UInt uiPartAddr, Int iWidth, Int iHeight, TComYuv*& rpcYuvDst );
    110  
     118
     119#if MERL_VSP_C0152
     120  Void xPredInterLumaBlkFromDM    ( TComPicYuv *refPic, TComPicYuv *pPicBaseDepth, Int* pShiftLUT, Int iShiftPrec, TComMv *mv, UInt partAddr,Int posX, Int posY, Int size_x, Int size_y, Bool isDepth, Int vspIdx
     121                                  , TComYuv *&dstPic );
     122  Void xPredInterChromaBlkFromDM  ( TComPicYuv *refPic, TComPicYuv *pPicBaseDepth, Int* pShiftLUT, Int iShiftPrec, TComMv *mv, UInt partAddr,Int posX, Int posY, Int size_x, Int size_y, Bool isDepth, Int vspIdx
     123                                  , TComYuv *&dstPic );
     124#endif
    111125  Void xGetLLSPrediction ( TComPattern* pcPattern, Int* pSrc0, Int iSrcStride, Pel* pDst0, Int iDstStride, UInt uiWidth, UInt uiHeight, UInt uiExt0 );
    112126#if LGE_ILLUCOMP_B0045
     
    150164  Void motionCompensation         ( TComDataCU*  pcCU, TComYuv* pcYuvPred, RefPicList eRefPicList = REF_PIC_LIST_X, Int iPartIdx = -1 );
    151165#endif
    152  
     166
     167#if MERL_VSP_C0152
     168   Void motionCompensationBWVSP   ( TComDataCU*  pcCU, TComYuv* pcYuvPred, UInt uiAbsPartIdx, RefPicList eRefPicList = REF_PIC_LIST_X, Int iPartIdx = -1, Bool bPrdDepthMap = false, UInt uiSubSampExpX = 0, UInt uiSubSampExpY = 0 );
     169#endif
     170
    153171  // motion vector prediction
    154172  Void getMvPredAMVP              ( TComDataCU* pcCU, UInt uiPartIdx, UInt uiPartAddr, RefPicList eRefPicList, Int iRefIdx, TComMv& rcMvPred );
  • branches/HTM-5.1-dev3-MERL/source/Lib/TLibCommon/TComSlice.cpp

    r210 r231  
    121121{
    122122  m_aiNumRefIdx[0] = m_aiNumRefIdx[1] = m_aiNumRefIdx[2] = 0;
    123  
     123
    124124  initEqualRef();
    125125 
  • branches/HTM-5.1-dev3-MERL/source/Lib/TLibCommon/TComSlice.h

    r210 r231  
    12651265#endif
    12661266#if QC_IV_AS_LT_B0046
    1267   Bool                  m_bWasLongTerm[2][MAX_NUM_REF+1]; //was long-term picture
     1267  Bool        m_bWasLongTerm[2][MAX_NUM_REF+1]; //was long-term picture
    12681268#endif
    12691269  TComSPS*    m_pcSPS;
     
    13411341
    13421342#if SONY_COLPIC_AVAILABILITY|QC_MVHEVC_B0046
    1343   Int         m_iViewOrderIdx;
     1343  Int        m_iViewOrderIdx;
    13441344#endif
    13451345#if LGE_ILLUCOMP_B0045
    13461346  Bool        m_bApplyIC;
     1347#endif
     1348
     1349#if MERL_VSP_C0152
     1350  TComPic*     m_apcRefPicBaseTxt;
     1351  TComPic*     m_apcRefPicBaseDepth;
     1352  Int*         m_aiShiftLUT;
     1353  Int          m_iShiftPrec;
    13471354#endif
    13481355
     
    16551662#endif
    16561663
     1664#if MERL_VSP_C0152
     1665  TComPic*     getRefPicBaseTxt          ()                        { return  m_apcRefPicBaseTxt; }
     1666  Void         setRefPicBaseTxt          ( TComPic* RefPic)        { m_apcRefPicBaseTxt = RefPic; }
     1667  TComPic*     getRefPicBaseDepth        ()                        { return  m_apcRefPicBaseDepth; }
     1668  Void         setRefPicBaseDepth        ( TComPic* RefPic)        { m_apcRefPicBaseDepth = RefPic; }
     1669
     1670  Void setBWVSPLUTParam( Int *pShiftLUT, Int iLoG2LUTPrec) { m_aiShiftLUT = pShiftLUT; m_iShiftPrec = iLoG2LUTPrec; }
     1671  Void getBWVSPLUTParam( Int*&pShiftLUT, Int&iLoG2LUTPrec) { pShiftLUT = m_aiShiftLUT; iLoG2LUTPrec = m_iShiftPrec; }
     1672#endif
     1673
    16571674protected:
    16581675  TComPic*  xGetRefPic        (TComList<TComPic*>& rcListPic, UInt uiPOC);
  • branches/HTM-5.1-dev3-MERL/source/Lib/TLibCommon/TypeDef.h

    r211 r231  
    5151
    5252#if !QC_MVHEVC_B0046
     53
     54///// ***** VSP MODES *********
     55#define MERL_VSP_C0152                       1 // JCT3V-C0152: 1: enable VSP-related tools; 0: disable VSP-related tools
     56
     57#if MERL_VSP_C0152
     58
     59/*
     60 * Two macros are used to configure combinations of JCT3V-C0152 and JCT3V-C0131
     61 *
     62 *   a) (full) A full JCT3V-C0152 implementation, including JCT3V-C0131
     63 *      #define MERL_VSP_COMPENSATION_C0152          1
     64 *      #define MERL_MTK_VSP_DVP_REFINE_C0152_C0131  1
     65 *
     66 *   b) (mvp2off) For partial JCT3V-C0152 excluding overlaps from JCT3V-C0131
     67 *      #define MERL_VSP_COMPENSATION_C0152          1
     68 *      #define MERL_MTK_VSP_DVP_REFINE_C0152_C0131  0
     69 *
     70 *   c) (nocand) For JCT3V-C0131 only
     71 *      #define MERL_VSP_COMPENSATION_C0152          0
     72 *      #define MERL_MTK_VSP_DVP_REFINE_C0152_C0131  1
     73 */
     74
     75#define MERL_VSP_COMPENSATION_C0152          0 // JCT3V-C0152: 1: add VSP merge candidate to merging candidate list; 0: not to add   (nocand).
     76#define MERL_MTK_VSP_DVP_REFINE_C0152_C0131  1 // JCT3V-C0152 && JCT3V-C0131: 1: refine disparity vector using a warped depth block; 0: not to refine  (mvp2off).
     77
     78#define MERL_VSP_BLOCKSIZE_C0152             4 // JCT3V-C0152: VSP block size, supported values: 1, 2 and 4.
     79#define VSP_MERGE_POS                        5 // JCT3V-C0152: fixed position of VSP candidate in merge list, supported values: 5.
     80
     81#else // !MERL_VSP_C0152
     82#define MERL_VSP_COMPENSATION_C0152          0 // JCT3V-C0152: 1: add VSP merge candidate to merging candidate list; 0: not to add
     83#define MERL_MTK_VSP_DVP_REFINE_C0152_C0131  0 // JCT3V-C0152 && JCT3V-C0131: 1: refine disparity vector using a warped depth block; 0: not to refine
     84#define MERL_VSP_BLOCKSIZE_C0152             4 // JCT3V-C0152: VSP block size, supported values: 1, 2 and 4.
     85#endif
     86
    5387///// ***** FIXES *********
    5488// A
  • branches/HTM-5.1-dev3-MERL/source/Lib/TLibDecoder/TDecCu.cpp

    r189 r231  
    361361
    362362      UInt uiCurrPartNumb = pcCU->getPic()->getNumPartInCU() >> (uiDepth << 1);
     363
    363364      for( UInt ui = 0; ui < uiCurrPartNumb; ui++ )
    364365      {
    365366        const UChar uhNewDepth = max<UInt>( uiDepth, pcTextureCU->getDepth( uiAbsPartIdx + ui ) );
     367#if MERL_VSP_C0152
     368        Int vspIdx = pcTextureCU->getVSPIndex( uiAbsPartIdx + ui);
     369        pcCU->setVSPIndex( uiAbsPartIdx + ui, vspIdx);
     370#endif
    366371        pcCU->setPredictionMode( uiAbsPartIdx + ui, MODE_SKIP );
    367372        pcCU->setPartitionSize( uiAbsPartIdx + ui, SIZE_2Nx2N );
     
    376381#if SIMP_MRG_PRUN     
    377382    UInt uiMergeIndex = pcCU->getMergeIndex(uiAbsPartIdx);
     383#if MERL_VSP_C0152
     384    Int iVSPIndexTrue[3] = {-1, -1, -1};
     385    m_ppcCU[uiDepth]->getInterMergeCandidates( 0, 0, uiDepth, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand, iVSPIndexTrue, uiMergeIndex );
     386    {
     387      Int iVSPIdx = 0;
     388      Int numVspIdx;
     389      numVspIdx = 3;
     390      for (Int i = 0; i < numVspIdx; i++)
     391      {
     392        if (iVSPIndexTrue[i] == uiMergeIndex)
     393          {
     394            iVSPIdx = i+1;
     395            break;
     396          }
     397      }
     398      pcCU->setVSPIndexSubParts( iVSPIdx, uiAbsPartIdx, 0, uiDepth );  //Initialize the VSP, may change later in get InterMergeCandidates()
     399    }
     400#else
    378401    m_ppcCU[uiDepth]->getInterMergeCandidates( 0, 0, uiDepth, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand, uiMergeIndex );
     402#endif
    379403#else
    380404    m_ppcCU[uiDepth]->getInterMergeCandidates( 0, 0, uiDepth, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand );
     
    467491
    468492      UInt uiCurrPartNumb = pcCU->getPic()->getNumPartInCU() >> (uiDepth << 1);
     493
    469494      for( UInt ui = 0; ui < uiCurrPartNumb; ui++ )
    470495      {
    471496        const UChar uhNewDepth = max<UInt>( uiDepth, pcTextureCU->getDepth( uiAbsPartIdx + ui ) );
     497#if MERL_VSP_C0152
     498        Int vspIdx = pcTextureCU->getVSPIndex( uiAbsPartIdx + ui);
     499        pcCU->setVSPIndex( uiAbsPartIdx + ui, vspIdx);
     500#endif
    472501        pcCU->setPredictionMode( uiAbsPartIdx + ui, MODE_INTER );
    473502        pcCU->setPartitionSize( uiAbsPartIdx + ui, SIZE_2Nx2N );
     
    658687 
    659688  // inter prediction
     689#if MERL_VSP_C0152
     690  m_pcPrediction->motionCompensationBWVSP( pcCU, m_ppcYuvReco[uiDepth], uiAbsPartIdx );
     691#else
    660692  m_pcPrediction->motionCompensation( pcCU, m_ppcYuvReco[uiDepth] );
    661  
     693#endif
    662694#if HHI_MPI
    663695  if( pcCU->getTextureModeDepth( 0 ) != -1 )
     
    10471079  // reconstruct residual based on mask + DC residuals
    10481080  Pel apDCResiValues[2];
    1049   Pel apDCRecoValues[2];
     1081  //Pel apDCRecoValues[2];
    10501082  for( UInt ui = 0; ui < uiNumSegments; ui++ )
    10511083  {
     
    10541086    Pel   pRecoValue  = GetIdx2DepthValue( pPredIdx + pResiIdx );
    10551087   
    1056     apDCRecoValues[ui]  = pRecoValue;
     1088    //apDCRecoValues[ui]  = pRecoValue;
    10571089    apDCResiValues[ui]  = pRecoValue - apDCPredValues[ui];
    10581090  }
  • branches/HTM-5.1-dev3-MERL/source/Lib/TLibDecoder/TDecCu.h

    r189 r231  
    6565#endif
    6666  TComDataCU**        m_ppcCU;            ///< CU data array
    67  
     67
    6868  // access channel
    6969  TComTrQuant*        m_pcTrQuant;
     
    8585  /// destroy internal buffers
    8686  Void  destroy                 ();
    87  
     87
    8888  /// decode CU information
    8989  Void  decodeCU                ( TComDataCU* pcCU, UInt& ruiIsLast );
  • branches/HTM-5.1-dev3-MERL/source/Lib/TLibDecoder/TDecEntropy.cpp

    r189 r231  
    337337#if SIMP_MRG_PRUN       
    338338      UInt uiMergeIndex = pcCU->getMergeIndex(uiSubPartIdx);
     339#if MERL_VSP_C0152
     340      Int iVSPIndexTrue[3] = {-1, -1, -1};
     341      pcSubCU->getInterMergeCandidates( uiSubPartIdx-uiAbsPartIdx, uiPartIdx, uiDepth, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand, iVSPIndexTrue, uiMergeIndex );
     342
     343      if(pcCU->getTextureModeDepth( uiSubPartIdx ) == uiDepth)//MPI is used
     344      {
     345        TComDataCU *pcTextureCU = pcCU->getSlice()->getTexturePic()->getCU( pcCU->getAddr() );
     346        UInt uiCurrPartNumb = pcCU->getPic()->getNumPartInCU() >> (uiDepth << 1);
     347        for( UInt ui = 0; ui < uiCurrPartNumb; ui++ )
     348        {
     349          Int vspIdx = pcTextureCU->getVSPIndex( uiAbsPartIdx + ui);
     350          pcCU->setVSPIndex( uiAbsPartIdx + ui, vspIdx);
     351        }
     352      }
     353      else // MPI not used
     354      {
     355        Int iVSPIdx = 0;
     356        Int numVspIdx;
     357        numVspIdx = 3;
     358        for (Int i = 0; i < numVspIdx; i++)
     359        {
     360          if (iVSPIndexTrue[i] == uiMergeIndex)
     361            {
     362              iVSPIdx = i+1;
     363              break;
     364            }
     365        }
     366        pcCU->setVSPIndexSubParts( iVSPIdx, uiSubPartIdx, uiPartIdx, uiDepth );  //Initialize the VSP, may change later in get InterMergeCandidates()
     367      }
     368
     369#else
    339370      pcSubCU->getInterMergeCandidates( uiSubPartIdx-uiAbsPartIdx, uiPartIdx, uiDepth, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand, uiMergeIndex );
     371#endif
    340372#else     
    341373      pcSubCU->getInterMergeCandidates( uiSubPartIdx-uiAbsPartIdx, uiPartIdx, uiDepth, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand );
  • branches/HTM-5.1-dev3-MERL/source/Lib/TLibDecoder/TDecGop.cpp

    r189 r231  
    511511    m_vAlfCUCtrlSlices.clear();
    512512  }
     513  fflush(stdout);
    513514}
    514515
  • branches/HTM-5.1-dev3-MERL/source/Lib/TLibDecoder/TDecTop.cpp

    r210 r231  
    5959    m_aaiCodedScale       [ uiId ] = new Int [ MAX_VIEW_NUM ];
    6060  }
     61
     62#if MERL_VSP_C0152
     63  xCreateLUTs( (UInt)MAX_VIEW_NUM, (UInt)MAX_VIEW_NUM, m_adBaseViewShiftLUT, m_aiBaseViewShiftLUT );
     64  m_iLog2Precision   = LOG2_DISP_PREC_LUT;
     65  m_uiBitDepthForLUT = 8; // fixed
     66#endif
    6167}
    6268
     
    7278  delete [] m_aiViewOrderIndex;
    7379  delete [] m_aiViewReceived;
     80
     81#if MERL_VSP_C0152
     82  xDeleteArray( m_adBaseViewShiftLUT, MAX_VIEW_NUM, MAX_VIEW_NUM, 2 );
     83  xDeleteArray( m_aiBaseViewShiftLUT, MAX_VIEW_NUM, MAX_VIEW_NUM, 2 );
     84#endif
    7485}
    7586
     
    8596  m_uiMaxViewId             = 0;
    8697}
     98
     99#if MERL_VSP_C0152
     100Void
     101CamParsCollector::xCreateLUTs( UInt uiNumberSourceViews, UInt uiNumberTargetViews, Double****& radLUT, Int****& raiLUT)
     102{
     103  //AOF( m_uiBitDepthForLUT == 8 );
     104  //AOF(radLUT == NULL && raiLUT == NULL );
     105
     106  uiNumberSourceViews = Max( 1, uiNumberSourceViews );
     107  uiNumberTargetViews = Max( 1, uiNumberTargetViews );
     108
     109  radLUT         = new Double***[ uiNumberSourceViews ];
     110  raiLUT         = new Int   ***[ uiNumberSourceViews ];
     111
     112  for( UInt uiSourceView = 0; uiSourceView < uiNumberSourceViews; uiSourceView++ )
     113  {
     114    radLUT        [ uiSourceView ] = new Double**[ uiNumberTargetViews ];
     115    raiLUT        [ uiSourceView ] = new Int   **[ uiNumberTargetViews ];
     116
     117    for( UInt uiTargetView = 0; uiTargetView < uiNumberTargetViews; uiTargetView++ )
     118    {
     119      radLUT        [ uiSourceView ][ uiTargetView ]      = new Double*[ 2 ];
     120      radLUT        [ uiSourceView ][ uiTargetView ][ 0 ] = new Double [ 257 ];
     121      radLUT        [ uiSourceView ][ uiTargetView ][ 1 ] = new Double [ 257 ];
     122
     123      raiLUT        [ uiSourceView ][ uiTargetView ]      = new Int*   [ 2 ];
     124      raiLUT        [ uiSourceView ][ uiTargetView ][ 0 ] = new Int    [ 257 ];
     125      raiLUT        [ uiSourceView ][ uiTargetView ][ 1 ] = new Int    [ 257 ];
     126    }
     127  }
     128}
     129
     130Void
     131  CamParsCollector::xInitLUTs( UInt uiSourceView, UInt uiTargetView, Int iScale, Int iOffset, Double****& radLUT, Int****& raiLUT)
     132{
     133  Int     iLog2DivLuma   = m_uiBitDepthForLUT + m_uiCamParsCodedPrecision + 1 - m_iLog2Precision;   AOF( iLog2DivLuma > 0 );
     134  Int     iLog2DivChroma = iLog2DivLuma + 1;
     135
     136  iOffset <<= m_uiBitDepthForLUT;
     137
     138  Double dScale  = (Double) iScale  / (( Double ) ( 1 << iLog2DivLuma ));
     139  Double dOffset = (Double) iOffset / (( Double ) ( 1 << iLog2DivLuma ));
     140
     141  // offsets including rounding offsets
     142  Int64 iOffsetLuma   = iOffset + ( ( 1 << iLog2DivLuma   ) >> 1 );
     143  Int64 iOffsetChroma = iOffset + ( ( 1 << iLog2DivChroma ) >> 1 );
     144
     145
     146  for( UInt uiDepthValue = 0; uiDepthValue < 256; uiDepthValue++ )
     147  {
     148
     149    // real-valued look-up tables
     150    Double  dShiftLuma      = ( (Double)uiDepthValue * dScale + dOffset ) * Double( 1 << m_iLog2Precision );
     151    Double  dShiftChroma    = dShiftLuma / 2;
     152    radLUT[ uiSourceView ][ uiTargetView ][ 0 ][ uiDepthValue ] = dShiftLuma;
     153    radLUT[ uiSourceView ][ uiTargetView ][ 1 ][ uiDepthValue ] = dShiftChroma;
     154
     155    // integer-valued look-up tables
     156    Int64   iTempScale      = (Int64)uiDepthValue * iScale;
     157    Int64   iShiftLuma      = ( iTempScale + iOffsetLuma   ) >> iLog2DivLuma;
     158    Int64   iShiftChroma    = ( iTempScale + iOffsetChroma ) >> iLog2DivChroma;
     159    raiLUT[ uiSourceView ][ uiTargetView ][ 0 ][ uiDepthValue ] = (Int)iShiftLuma;
     160    raiLUT[ uiSourceView ][ uiTargetView ][ 1 ][ uiDepthValue ] = (Int)iShiftChroma;
     161
     162    // maximum deviation
     163    //dMaxDispDev     = Max( dMaxDispDev,    fabs( Double( (Int) iTestScale   ) - dShiftLuma * Double( 1 << iLog2DivLuma ) ) / Double( 1 << iLog2DivLuma ) );
     164    //dMaxRndDispDvL  = Max( dMaxRndDispDvL, fabs( Double( (Int) iShiftLuma   ) - dShiftLuma   ) );
     165    //dMaxRndDispDvC  = Max( dMaxRndDispDvC, fabs( Double( (Int) iShiftChroma ) - dShiftChroma ) );
     166  }
     167
     168  radLUT[ uiSourceView ][ uiTargetView ][ 0 ][ 256 ] = radLUT[ uiSourceView ][ uiTargetView ][ 0 ][ 255 ];
     169  radLUT[ uiSourceView ][ uiTargetView ][ 1 ][ 256 ] = radLUT[ uiSourceView ][ uiTargetView ][ 1 ][ 255 ];
     170  raiLUT[ uiSourceView ][ uiTargetView ][ 0 ][ 256 ] = raiLUT[ uiSourceView ][ uiTargetView ][ 0 ][ 255 ];
     171  raiLUT[ uiSourceView ][ uiTargetView ][ 1 ][ 256 ] = raiLUT[ uiSourceView ][ uiTargetView ][ 1 ][ 255 ];
     172}
     173#endif // end MERL_VSP_C0152
    87174
    88175Void
     
    167254        m_aaiCodedScale [ uiViewId ][ uiBaseId ]  = pcSlice->getInvCodedScale () [ uiBaseId ];
    168255        m_aaiCodedOffset[ uiViewId ][ uiBaseId ]  = pcSlice->getInvCodedOffset() [ uiBaseId ];
     256#if MERL_VSP_C0152
     257        xInitLUTs( uiBaseId, uiViewId, m_aaiCodedScale[ uiBaseId ][ uiViewId ], m_aaiCodedOffset[ uiBaseId ][ uiViewId ], m_adBaseViewShiftLUT, m_aiBaseViewShiftLUT);
     258        xInitLUTs( uiViewId, uiBaseId, m_aaiCodedScale[ uiViewId ][ uiBaseId ], m_aaiCodedOffset[ uiViewId ][ uiBaseId ], m_adBaseViewShiftLUT, m_aiBaseViewShiftLUT);
     259#endif
    169260      }
    170261      else
     
    174265        m_aaiCodedScale [ uiViewId ][ uiBaseId ]  = pcSlice->getSPS()->getInvCodedScale () [ uiBaseId ];
    175266        m_aaiCodedOffset[ uiViewId ][ uiBaseId ]  = pcSlice->getSPS()->getInvCodedOffset() [ uiBaseId ];
     267#if MERL_VSP_C0152
     268        xInitLUTs( uiBaseId, uiViewId, m_aaiCodedScale[ uiBaseId ][ uiViewId ], m_aaiCodedOffset[ uiBaseId ][ uiViewId ], m_adBaseViewShiftLUT, m_aiBaseViewShiftLUT );
     269        xInitLUTs( uiViewId, uiBaseId, m_aaiCodedScale[ uiViewId ][ uiBaseId ], m_aaiCodedOffset[ uiViewId ][ uiBaseId ], m_adBaseViewShiftLUT, m_aiBaseViewShiftLUT );
     270#endif
    176271      }
    177272    }
     
    188283        m_aaiCodedScale [ uiViewId ][ uiBaseId ]  = pcSlice->getInvCodedScale () [ uiBaseId ];
    189284        m_aaiCodedOffset[ uiViewId ][ uiBaseId ]  = pcSlice->getInvCodedOffset() [ uiBaseId ];
     285#if MERL_VSP_C0152
     286        xInitLUTs( uiBaseId, uiViewId, m_aaiCodedScale[ uiBaseId ][ uiViewId ], m_aaiCodedOffset[ uiBaseId ][ uiViewId ], m_adBaseViewShiftLUT, m_aiBaseViewShiftLUT );
     287        xInitLUTs( uiViewId, uiBaseId, m_aaiCodedScale[ uiViewId ][ uiBaseId ], m_aaiCodedOffset[ uiViewId ][ uiBaseId ], m_adBaseViewShiftLUT, m_aiBaseViewShiftLUT );
     288#endif
    190289      }
    191290    }
     
    258357#endif
    259358#if ENC_DEC_TRACE
    260   g_hTrace = fopen( "TraceDec.txt", "wb" );
     359  if(!g_hTrace) g_hTrace = fopen( "TraceDec.txt", "wb" );
    261360  g_bJustDoIt = g_bEncDecTraceDisable;
    262361  g_nSymbolCounter = 0;
     
    277376{
    278377#if ENC_DEC_TRACE
    279   fclose( g_hTrace );
     378  if(g_hTrace) fclose( g_hTrace );
     379  g_hTrace=NULL;
    280380#endif
    281381}
     
    304404  m_cResidualGenerator.destroy();
    305405#endif
     406
    306407}
    307408
     
    11091210    initWedgeLists();
    11101211  }
     1212#endif
     1213
     1214#if MERL_VSP_C0152 // set BW LUT
     1215  if( m_pcCamParsCollector ) // Initialize the LUT elements
     1216  {
     1217    m_pcCamParsCollector->setSlice( pcSlice );
     1218  }
     1219  if( pcSlice->getViewId() !=0 )
     1220  {
     1221    TComPic* pcBaseTxtPic = m_tAppDecTop->getPicFromView(  0, pcSlice->getPOC(), false );  // get base view reconstructed texture
     1222    TComPic* pcBaseDepthPic = m_tAppDecTop->getPicFromView(  0, pcSlice->getPOC(), true ); // get base view reconstructed depth
     1223     pcSlice->setRefPicBaseTxt(pcBaseTxtPic);
     1224     pcSlice->setRefPicBaseDepth(pcBaseDepthPic);
     1225  }
     1226  getTAppDecTop()->setBWVSPLUT( pcSlice, pcSlice->getViewId(),  pcSlice->getPOC() ); // get the LUT for backward warping
    11111227#endif
    11121228
  • branches/HTM-5.1-dev3-MERL/source/Lib/TLibDecoder/TDecTop.h

    r210 r231  
    7777  Bool  isInitialized() const { return m_bInitialized; }
    7878
     79#if MERL_VSP_C0152
     80  Int**** getBaseViewShiftLUTI()  { return m_aiBaseViewShiftLUT;   }
     81#endif
    7982private:
    8083  Bool  xIsComplete ();
     
    97100  Int     m_iLastPOC;
    98101  UInt    m_uiMaxViewId;
     102
     103#if MERL_VSP_C0152
     104  UInt    m_uiBitDepthForLUT;
     105  UInt    m_iLog2Precision;
     106  UInt    m_uiInputBitDepth;
     107  // look-up tables
     108  Double****   m_adBaseViewShiftLUT;       ///< Disparity LUT
     109  Int****      m_aiBaseViewShiftLUT;       ///< Disparity LUT
     110  Void xCreateLUTs( UInt uiNumberSourceViews, UInt uiNumberTargetViews, Double****& radLUT, Int****& raiLUT);
     111  Void xInitLUTs( UInt uiSourceView, UInt uiTargetView, Int iScale, Int iOffset, Double****& radLUT, Int****& raiLUT);
     112  template<class T> Void  xDeleteArray  ( T*& rpt, UInt uiSize1, UInt uiSize2, UInt uiSize3 );
     113  template<class T> Void  xDeleteArray  ( T*& rpt, UInt uiSize1, UInt uiSize2 );
     114  template<class T> Void  xDeleteArray  ( T*& rpt, UInt uiSize );
     115#endif
     116
    99117};
     118
     119#if MERL_VSP_C0152
     120template <class T>
     121Void CamParsCollector::xDeleteArray( T*& rpt, UInt uiSize1, UInt uiSize2, UInt uiSize3 )
     122{
     123  if( rpt )
     124  {
     125    for( UInt uiK = 0; uiK < uiSize1; uiK++ )
     126    {
     127      for( UInt uiL = 0; uiL < uiSize2; uiL++ )
     128      {
     129        for( UInt uiM = 0; uiM < uiSize3; uiM++ )
     130        {
     131          delete[] rpt[ uiK ][ uiL ][ uiM ];
     132        }
     133        delete[] rpt[ uiK ][ uiL ];
     134      }
     135      delete[] rpt[ uiK ];
     136    }
     137    delete[] rpt;
     138  }
     139  rpt = NULL;
     140};
     141
     142
     143template <class T>
     144Void CamParsCollector::xDeleteArray( T*& rpt, UInt uiSize1, UInt uiSize2 )
     145{
     146  if( rpt )
     147  {
     148    for( UInt uiK = 0; uiK < uiSize1; uiK++ )
     149    {
     150      for( UInt uiL = 0; uiL < uiSize2; uiL++ )
     151      {
     152        delete[] rpt[ uiK ][ uiL ];
     153      }
     154      delete[] rpt[ uiK ];
     155    }
     156    delete[] rpt;
     157  }
     158  rpt = NULL;
     159};
     160
     161
     162template <class T>
     163Void CamParsCollector::xDeleteArray( T*& rpt, UInt uiSize )
     164{
     165  if( rpt )
     166  {
     167    for( UInt uiK = 0; uiK < uiSize; uiK++ )
     168    {
     169      delete[] rpt[ uiK ];
     170    }
     171    delete[] rpt;
     172  }
     173  rpt = NULL;
     174};
     175
     176#endif
    100177
    101178/// decoder class
     
    206283  ParameterSetManagerDecoder* xGetParaSetDec ()        {return  &m_parameterSetManagerDecoder;}
    207284#endif
     285
    208286protected:
    209287  Void  xGetNewPicBuffer  (TComSlice* pcSlice, TComPic*& rpcPic);
  • branches/HTM-5.1-dev3-MERL/source/Lib/TLibEncoder/TEncCu.cpp

    r189 r231  
    18901890
    18911891  rpcTempCU->setPartSizeSubParts( SIZE_2Nx2N, 0, uhDepth ); // interprets depth relative to LCU level
    1892   rpcTempCU->getInterMergeCandidates( 0, 0, uhDepth, cMvFieldNeighbours,uhInterDirNeighbours, numValidMergeCand );
    1893 
     1892#if MERL_VSP_C0152
     1893  Int iVSPIndexTrue[3] = {-1, -1, -1};
     1894  rpcTempCU->getInterMergeCandidates( 0, 0, uhDepth, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand, iVSPIndexTrue );
     1895#else
     1896  rpcTempCU->getInterMergeCandidates( 0, 0, uhDepth, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand );
     1897#endif
    18941898#if FAST_DECISION_FOR_MRG_RD_COST
    18951899  Bool bestIsSkip = false;
     
    19331937          rpcTempCU->setMergeFlagSubParts( true, 0, 0, uhDepth ); // interprets depth relative to LCU level
    19341938          rpcTempCU->setMergeIndexSubParts( uiMergeCand, 0, 0, uhDepth ); // interprets depth relative to LCU level
     1939#if MERL_VSP_C0152
     1940          {
     1941            Int iVSPIdx = 0;
     1942            Int numVSPIdx;
     1943            numVSPIdx = 3;
     1944            for (Int i = 0; i < numVSPIdx; i++)
     1945            {
     1946              if (iVSPIndexTrue[i] == uiMergeCand)
     1947                {
     1948                  iVSPIdx = i+1;
     1949                  break;
     1950                }
     1951            }
     1952            rpcTempCU->setVSPIndexSubParts( iVSPIdx, 0, 0, uhDepth );
     1953          }
     1954#endif
    19351955          rpcTempCU->setInterDirSubParts( uhInterDirNeighbours[uiMergeCand], 0, 0, uhDepth ); // interprets depth relative to LCU level
    19361956          rpcTempCU->getCUMvField( REF_PIC_LIST_0 )->setAllMvField( cMvFieldNeighbours[0 + 2*uiMergeCand], SIZE_2Nx2N, 0, 0 ); // interprets depth relative to rpcTempCU level
     
    19521972#endif
    19531973        {
     1974#if MERL_VSP_C0152
     1975            m_pcPredSearch->motionCompensationBWVSP ( rpcTempCU, m_ppcPredYuvTemp[uhDepth],  rpcTempCU->getZorderIdxInCU() );
     1976#else
    19541977            m_pcPredSearch->motionCompensation ( rpcTempCU, m_ppcPredYuvTemp[uhDepth] );
     1978#endif
    19551979            // save pred adress
    19561980            pcPredYuvTemp = m_ppcPredYuvTemp[uhDepth];
     
    19621986            if( bestIsSkip)
    19631987            {
     1988#if MERL_VSP_C0152
     1989              m_pcPredSearch->motionCompensationBWVSP ( rpcTempCU, m_ppcPredYuvTemp[uhDepth], rpcTempCU->getZorderIdxInCU() );
     1990#else
    19641991              m_pcPredSearch->motionCompensation ( rpcTempCU, m_ppcPredYuvTemp[uhDepth] );
     1992#endif
    19651993              // save pred adress
    19661994              pcPredYuvTemp = m_ppcPredYuvTemp[uhDepth];
     
    20652093 
    20662094  rpcTempCU->setPartSizeSubParts  ( ePartSize,  0, uhDepth );
     2095
    20672096#if HHI_INTER_VIEW_RESIDUAL_PRED
    20682097  rpcTempCU->setResPredAvailSubParts( bResPrdAvail, 0, 0, uhDepth );
     
    20842113  #if HHI_INTERVIEW_SKIP
    20852114#if LG_RESTRICTEDRESPRED_M24766
    2086   m_pcPredSearch->predInterSearch ( rpcTempCU, m_ppcOrigYuv[uhDepth], m_ppcResPredTmp[uhDepth], m_ppcPredYuvTemp[uhDepth], m_ppcResiYuvTemp[uhDepth], m_ppcRecoYuvTemp[uhDepth], bSkipRes, bUseMRG  );
     2115  m_pcPredSearch->predInterSearch ( rpcTempCU, m_ppcOrigYuv[uhDepth], m_ppcResPredTmp[uhDepth], m_ppcPredYuvTemp[uhDepth], m_ppcResiYuvTemp[uhDepth], m_ppcRecoYuvTemp[uhDepth], bSkipRes, bUseMRG);
    20872116#else
    20882117  m_pcPredSearch->predInterSearch ( rpcTempCU, m_ppcOrigYuv[uhDepth], m_ppcPredYuvTemp[uhDepth], m_ppcResiYuvTemp[uhDepth], m_ppcRecoYuvTemp[uhDepth], bSkipRes, bUseMRG  );
     
    27872816      assert( rpcTempCU->getInterDir( ui ) != 0 );
    27882817      assert( rpcTempCU->getPredictionMode( ui ) != MODE_NONE );
    2789     }
     2818#if MERL_VSP_C0152
     2819      Int vspIdx = pcTextureCU->getVSPIndex( rpcTempCU->getZorderIdxInCU() + ui);
     2820      rpcTempCU->setVSPIndex( ui , vspIdx);
     2821#endif
     2822    }
     2823
    27902824    rpcTempCU->setPredModeSubParts( bSkipResidual ? MODE_SKIP : MODE_INTER, 0, uhDepth );
     2825#if MERL_VSP_C0152
     2826    m_pcPredSearch->motionCompensationBWVSP( rpcTempCU, m_ppcPredYuvTemp[uhDepth], rpcTempCU->getZorderIdxInCU()  );
     2827#else
    27912828    m_pcPredSearch->motionCompensation( rpcTempCU, m_ppcPredYuvTemp[uhDepth] );
    2792 
     2829#endif
    27932830    // get Original YUV data from picture
    27942831    m_ppcOrigYuv[uhDepth]->copyFromPicYuv( rpcBestCU->getPic()->getPicYuvOrg(), rpcBestCU->getAddr(), rpcBestCU->getZorderIdxInCU() );
  • branches/HTM-5.1-dev3-MERL/source/Lib/TLibEncoder/TEncCu.h

    r56 r231  
    8181  TComYuv**               m_ppcResPredTmp;  ///< Temporary residual prediction for each depth
    8282#endif
    83  
     83
    8484  //  Data : encoder control
    8585  Bool                    m_bEncodeDQP;
     
    121121  /// destroy internal buffers
    122122  Void  destroy             ();
    123  
     123
    124124  /// CU analysis function
    125125  Void  compressCU          ( TComDataCU*&  rpcCU );
  • branches/HTM-5.1-dev3-MERL/source/Lib/TLibEncoder/TEncEntropy.cpp

    r210 r231  
    13471347    uiAbsPartIdx = 0;
    13481348  }
    1349  
     1349
    13501350#if RWTH_SDC_DLT_B0036
    13511351  if( pcCU->getSDCFlag(uiAbsPartIdx) )
     
    13551355  }
    13561356#endif
    1357  
     1357
    13581358  PartSize eSize = pcCU->getPartitionSize( uiAbsPartIdx );
    13591359 
  • branches/HTM-5.1-dev3-MERL/source/Lib/TLibEncoder/TEncGOP.cpp

    r210 r231  
    254254      pcSlice->setSliceIdx(0);
    255255      pcSlice->setViewId( m_pcEncTop->getViewId() );
    256       pcSlice->setIsDepth( m_pcEncTop->getIsDepth() ); 
     256      pcSlice->setIsDepth( m_pcEncTop->getIsDepth() );
    257257
    258258      m_pcEncTop->getSPS()->setDisInter4x4(m_pcEncTop->getDisInter4x4());
     
    340340      pcSlice->setNumRefIdx( REF_PIC_LIST_1, min( m_pcCfg->getGOPEntry( (getNalUnitType(uiPOCCurr) == NAL_UNIT_CODED_SLICE_IDV) ? MAX_GOP : iGOPid ).m_numRefPicsActive, (pcSlice->getRPS()->getNumberOfPictures() + pcSlice->getSPS()->getNumberOfUsableInterViewRefs()) ) );
    341341#else
    342 
    343     Bool bNalRAP = ((getNalUnitType(uiPOCCurr) == NAL_UNIT_CODED_SLICE_CRA) || (getNalUnitType(uiPOCCurr) == NAL_UNIT_CODED_SLICE_IDR)) && (pcSlice->getSPS()->getViewId())  ? 1: 0;
    344     pcSlice->setNumRefIdx( REF_PIC_LIST_0, min( m_pcCfg->getGOPEntry( bNalRAP ? MAX_GOP : iGOPid ).m_numRefPicsActive, (pcSlice->getRPS()->getNumberOfPictures() + pcSlice->getSPS()->getNumberOfUsableInterViewRefs()) ) );
    345     pcSlice->setNumRefIdx( REF_PIC_LIST_1, min( m_pcCfg->getGOPEntry( bNalRAP ? MAX_GOP : iGOPid ).m_numRefPicsActive, (pcSlice->getRPS()->getNumberOfPictures() + pcSlice->getSPS()->getNumberOfUsableInterViewRefs()) ) );
    346 #endif
    347     TComRefPicListModification* refPicListModification = pcSlice->getRefPicListModification();
    348     refPicListModification->setRefPicListModificationFlagL0( false );
     342      Bool bNalRAP = ((getNalUnitType(uiPOCCurr) == NAL_UNIT_CODED_SLICE_CRA) || (getNalUnitType(uiPOCCurr) == NAL_UNIT_CODED_SLICE_IDR)) && (pcSlice->getSPS()->getViewId())  ? 1: 0;
     343      pcSlice->setNumRefIdx( REF_PIC_LIST_0, min( m_pcCfg->getGOPEntry( bNalRAP ? MAX_GOP : iGOPid ).m_numRefPicsActive, (pcSlice->getRPS()->getNumberOfPictures() + pcSlice->getSPS()->getNumberOfUsableInterViewRefs()) ) );
     344      pcSlice->setNumRefIdx( REF_PIC_LIST_1, min( m_pcCfg->getGOPEntry( bNalRAP ? MAX_GOP : iGOPid ).m_numRefPicsActive, (pcSlice->getRPS()->getNumberOfPictures() + pcSlice->getSPS()->getNumberOfUsableInterViewRefs()) ) );
     345#endif
     346     
     347      TComRefPicListModification* refPicListModification = pcSlice->getRefPicListModification();
     348      refPicListModification->setRefPicListModificationFlagL0( false );
    349349#if !H0137_0138_LIST_MODIFICATION
    350350      refPicListModification->setNumberOfRefPicListModificationsL0(0);
  • branches/HTM-5.1-dev3-MERL/source/Lib/TLibEncoder/TEncSbac.cpp

    r210 r231  
    12771277      xWriteUnaryMaxSymbol( iRefFrame - 1, pCtx + 1, 1, pcCU->getSlice()->getNumRefIdx( REF_PIC_LIST_C )-2 );
    12781278    }
     1279#if MERL_VSP_C0152
     1280    else if (iRefFrame < 0) // NOT_VALID
     1281    {
     1282      assert(0);
     1283    }
     1284#endif
    12791285  }
    12801286  else
     
    12881294      xWriteUnaryMaxSymbol( iRefFrame - 1, pCtx + 1, 1, pcCU->getSlice()->getNumRefIdx( eRefList )-2 );
    12891295    }
     1296#if MERL_VSP_C0152
     1297    else if (iRefFrame < 0) // NOT_VALID
     1298    {
     1299      assert(0);
     1300    }
     1301#endif
    12901302  }
    12911303  return;
  • branches/HTM-5.1-dev3-MERL/source/Lib/TLibEncoder/TEncSearch.cpp

    r210 r231  
    696696UInt TEncSearch::xPatternRefinement( TComPattern* pcPatternKey,
    697697                                    TComMv baseRefMv,
    698                                     Int iFrac, TComMv& rcMvFrac )
     698                                    Int iFrac, TComMv& rcMvFrac
     699                                   )
    699700{
    700701  UInt  uiDist;
     
    16881689  // reconstruct residual based on mask + DC residuals
    16891690  Pel apDCResiValues[2];
    1690   Pel apDCRecoValues[2];
     1691  //Pel apDCRecoValues[2];
    16911692  for( UInt uiSegment = 0; uiSegment < uiNumSegments; uiSegment++ )
    16921693  {
     
    16951696    Pel   pRecoValue  = GetIdx2DepthValue( pPredIdx + pResiIdx );
    16961697   
    1697     apDCRecoValues[uiSegment]  = pRecoValue;
     1698    //apDCRecoValues[uiSegment]  = pRecoValue;
    16981699    apDCResiValues[uiSegment]  = pRecoValue - apDCPredValues[uiSegment];
    16991700  }
     
    28972898Void TEncSearch::xGetInterPredictionError( TComDataCU* pcCU, TComYuv* pcYuvOrg, Int iPartIdx, UInt& ruiErr, Bool bHadamard )
    28982899{
     2900#if !MERL_VSP_C0152
    28992901  motionCompensation( pcCU, &m_tmpYuvPred, REF_PIC_LIST_X, iPartIdx );
    2900 
     2902#endif
    29012903  UInt uiAbsPartIdx = 0;
    29022904  Int iWidth = 0;
    29032905  Int iHeight = 0;
    29042906  pcCU->getPartIndexAndSize( iPartIdx, uiAbsPartIdx, iWidth, iHeight );
    2905 
     2907#if MERL_VSP_C0152
     2908  motionCompensationBWVSP( pcCU, &m_tmpYuvPred,  pcCU->getZorderIdxInCU(), REF_PIC_LIST_X, iPartIdx );
     2909#endif
    29062910  DistParam cDistParam;
    29072911
     
    29432947#else
    29442948#if LG_RESTRICTEDRESPRED_M24766
     2949#if MERL_VSP_C0152
     2950Void TEncSearch::xMergeEstimation( TComDataCU* pcCU, TComYuv* pcYuvOrg, TComYuv* rpcResiPredYuv, Int iPUIdx, UInt& uiInterDir, TComMvField* pacMvField, UInt& uiMergeIndex, UInt& ruiCost, Int* iVSPIndexTrue )
     2951#else
    29452952Void TEncSearch::xMergeEstimation( TComDataCU* pcCU, TComYuv* pcYuvOrg, TComYuv* rpcResiPredYuv, Int iPUIdx, UInt& uiInterDir, TComMvField* pacMvField, UInt& uiMergeIndex, UInt& ruiCost )
     2953#endif
    29462954#else
    29472955Void TEncSearch::xMergeEstimation( TComDataCU* pcCU, TComYuv* pcYuvOrg, Int iPUIdx, UInt& uiInterDir, TComMvField* pacMvField, UInt& uiMergeIndex, UInt& ruiCost )
     
    29882996  }
    29892997#else
     2998#if MERL_VSP_C0152
     2999  pcCU->getInterMergeCandidates( uiAbsPartIdx, iPUIdx, uiDepth, cMvFieldNeighbours,uhInterDirNeighbours, numValidMergeCand, iVSPIndexTrue );
     3000#else
    29903001  pcCU->getInterMergeCandidates( uiAbsPartIdx, iPUIdx, uiDepth, cMvFieldNeighbours,uhInterDirNeighbours, numValidMergeCand );
    29913002#endif
     3003#endif
     3004
    29923005
    29933006#if HHI_INTER_VIEW_MOTION_PRED
     
    30093022      pcCU->getCUMvField(REF_PIC_LIST_0)->setAllMvField( cMvFieldNeighbours[0 + 2*uiMergeCand], ePartSize, uiAbsPartIdx, 0, iPUIdx );
    30103023      pcCU->getCUMvField(REF_PIC_LIST_1)->setAllMvField( cMvFieldNeighbours[1 + 2*uiMergeCand], ePartSize, uiAbsPartIdx, 0, iPUIdx );
     3024#if MERL_VSP_C0152
     3025      {
     3026        Int iVSPIdx = 0;
     3027        Int numVSPIdx;
     3028        numVSPIdx = 3;
     3029        for (Int i = 0; i < numVSPIdx; i++)
     3030        {
     3031          if (iVSPIndexTrue[i] == uiMergeCand)
     3032            {
     3033              iVSPIdx = i+1;
     3034              break;
     3035            }
     3036        }
     3037        pcCU->setVSPIndexSubParts( iVSPIdx, uiAbsPartIdx, iPUIdx, pcCU->getDepth( uiAbsPartIdx ) );
     3038      }
     3039#endif
    30113040#if LG_RESTRICTEDRESPRED_M24766
    30123041      Int iAddResiShift;
     
    30813110Void TEncSearch::predInterSearch( TComDataCU* pcCU, TComYuv* pcOrgYuv, TComYuv* rpcResiPredYuv, TComYuv*& rpcPredYuv, TComYuv*& rpcResiYuv, TComYuv*& rpcRecoYuv, Bool bUseRes, Bool bUseMRG )
    30823111#else
    3083 Void TEncSearch::predInterSearch( TComDataCU* pcCU, TComYuv* pcOrgYuv, TComYuv*& rpcPredYuv, TComYuv*& rpcResiYuv, TComYuv*& rpcRecoYuv, Bool bUseRes, Bool bUseMRG )
     3112Void TEncSearch::predInterSearch( TComDataCU* pcCU, TComYuv* pcOrgYuv, TComYuv*& rpcPredYuv, TComYuv*& rpcResiYuv, TComYuv*& rpcRecoYuv, Bool bUseRes, Bool bUseMRG)
    30843113#endif
    30853114#else
     
    31853214    for (Int iNumRef=0; iNumRef < MAX_NUM_REF; iNumRef++) uiCostTempL0[iNumRef] = MAX_UINT;
    31863215    UInt          uiBitsTempL0[MAX_NUM_REF];
     3216
    31873217#if LG_RESTRICTEDRESPRED_M24766
    31883218    Int iPUResiPredShift[4] = {0, 0, 0, 0};
     
    31913221   
    31923222    pcCU->getPartIndexAndSize( iPartIdx, uiPartAddr, iRoiWidth, iRoiHeight );
    3193    
     3223#if MERL_VSP_C0152
     3224    //reset the VSP flag to be 0
     3225    pcCU->setVSPIndexSubParts( 0, uiPartAddr, iPartIdx, pcCU->getDepth(uiPartAddr) );
     3226#endif
    31943227#if AMP_MRG
    31953228    Bool bTestNormalMC = true;
     
    32063239      Bool bLastResiFlag = false;
    32073240#endif
     3241
    32083242    //  Uni-directional prediction
    32093243    for ( Int iRefList = 0; iRefList < iNumPredDir; iRefList++ )
     
    35453579            xCheckBestMVP(pcCU, eRefPicList, cMvTemp[iRefList][iRefIdxTemp], cMvPredBi[iRefList][iRefIdxTemp], aaiMvpIdxBi[iRefList][iRefIdxTemp], uiBitsTemp, uiCostTemp);
    35463580          }
    3547          
     3581
    35483582          if ( uiCostTemp < uiCostBi )
    35493583          {
     
    37933827      TComMvField cMRGMvField[2];
    37943828      UInt uiMRGIndex = 0;
    3795 
     3829#if MERL_VSP_C0152
     3830      Int iVSPIndexTrue[3] = {-1, -1, -1};
     3831#endif
    37963832      UInt uiMEInterDir = 0;
    37973833      TComMvField cMEMvField[2];
     
    38443880#else
    38453881#if LG_RESTRICTEDRESPRED_M24766
     3882#if MERL_VSP_C0152
     3883      xMergeEstimation( pcCU, pcOrgYuv, rpcResiPredYuv, iPartIdx, uiMRGInterDir, cMRGMvField, uiMRGIndex, uiMRGCost,  iVSPIndexTrue );
     3884#else
    38463885      xMergeEstimation( pcCU, pcOrgYuv, rpcResiPredYuv, iPartIdx, uiMRGInterDir, cMRGMvField, uiMRGIndex, uiMRGCost );
     3886#endif
    38473887#else
    38483888      xMergeEstimation( pcCU, pcOrgYuv, iPartIdx, uiMRGInterDir, cMRGMvField, uiMRGIndex, uiMRGCost );
     
    38543894        pcCU->setMergeFlagSubParts ( true,          uiPartAddr, iPartIdx, pcCU->getDepth( uiPartAddr ) );
    38553895        pcCU->setMergeIndexSubParts( uiMRGIndex,    uiPartAddr, iPartIdx, pcCU->getDepth( uiPartAddr ) );
     3896#if MERL_VSP_C0152
     3897        {
     3898          Int iVSPIdx = 0;
     3899          Int numVSPIdx;
     3900          numVSPIdx = 3;
     3901          for (Int i = 0; i < numVSPIdx; i++)
     3902          {
     3903            if (iVSPIndexTrue[i] == uiMRGIndex)
     3904              {
     3905                iVSPIdx = i+1;
     3906                break;
     3907              }
     3908          }
     3909          pcCU->setVSPIndexSubParts( iVSPIdx, uiPartAddr, iPartIdx, pcCU->getDepth( uiPartAddr ) );
     3910        }
     3911#endif
    38563912        pcCU->setInterDirSubParts  ( uiMRGInterDir, uiPartAddr, iPartIdx, pcCU->getDepth( uiPartAddr ) );
    38573913        {
     
    38733929        pcCU->setMergeFlagSubParts( false,        uiPartAddr, iPartIdx, pcCU->getDepth( uiPartAddr ) );
    38743930        pcCU->setInterDirSubParts ( uiMEInterDir, uiPartAddr, iPartIdx, pcCU->getDepth( uiPartAddr ) );
     3931#if MERL_VSP_C0152
     3932        pcCU->setVSPIndexSubParts ( 0 ,           uiPartAddr, iPartIdx, pcCU->getDepth( uiPartAddr ) );
     3933#endif
    38753934        {
    38763935          pcCU->getCUMvField( REF_PIC_LIST_0 )->setAllMvField( cMEMvField[0], ePartSize, uiPartAddr, 0, iPartIdx );
     
    38813940
    38823941    //  MC
     3942#if MERL_VSP_C0152
     3943    motionCompensationBWVSP ( pcCU, rpcPredYuv, pcCU->getZorderIdxInCU(), REF_PIC_LIST_X, iPartIdx);
     3944#else
    38833945    motionCompensation ( pcCU, rpcPredYuv, REF_PIC_LIST_X, iPartIdx );
    3884    
     3946#endif
    38853947  } //  end of for ( Int iPartIdx = 0; iPartIdx < iNumPart; iPartIdx++ )
    38863948
     
    43384400  m_pcRdCost->setMultiviewReg( 0 );
    43394401#endif
     4402
    43404403  setWpScalingDistParam( pcCU, iRefIdxPred, eRefPicList );
    43414404  //  Do integer search
     
    43514414 
    43524415  m_pcRdCost->getMotionCost( 1, 0 );
     4416
    43534417#if HHI_FULL_PEL_DEPTH_MAP_MV_ACC
    43544418  if( ! pcCU->getSlice()->getIsDepth() )
     
    43784442    ruiCost += m_pcRdCost->getCost( uiMvBits );
    43794443#endif
    4380  
     4444
    43814445  ruiBits      += uiMvBits;
    43824446  ruiCost       = (UInt)( floor( fWeight * ( (Double)ruiCost - (Double)m_pcRdCost->getCost( uiMvBits ) ) ) + (Double)m_pcRdCost->getCost( ruiBits ) );
     
    47234787  rcMvQter = *pcMvInt;   rcMvQter <<= 1;    // for mv-cost
    47244788  rcMvQter += rcMvHalf;  rcMvQter <<= 1;
    4725   ruiCost = xPatternRefinement( pcPatternKey, baseRefMv, 1, rcMvQter );
     4789  ruiCost = xPatternRefinement( pcPatternKey, baseRefMv, 1, rcMvQter);
    47264790}
    47274791
     
    47584822#endif
    47594823  //  No residual coding : SKIP mode
    4760   if ( ePredMode == MODE_SKIP && bSkipRes )
     4824  if ( (ePredMode == MODE_SKIP && bSkipRes) )
    47614825  {
    47624826    rpcYuvResi->clear();
  • branches/HTM-5.1-dev3-MERL/source/Lib/TLibEncoder/TEncSearch.h

    r210 r231  
    152152  UInt  xPatternRefinement( TComPattern* pcPatternKey,
    153153                           TComMv baseRefMv,
    154                            Int iFrac, TComMv& rcMvFrac );
     154                           Int iFrac, TComMv& rcMvFrac);
    155155 
    156156  typedef struct
     
    513513                                    Int& numValidMergeCand
    514514#endif
     515#if MERL_VSP_C0152
     516                                  , Int* iVSPIndexTrue
     517#endif
    515518                                   );
    516519  // -------------------------------------------------------------------------------------------------------------------
     
    579582                                    TComMv&       rcMvQter,
    580583                                    UInt&         ruiCost
    581                                    ,Bool biPred
    582                                    );
     584                                   ,Bool biPred);
    583585 
    584586  Void xExtDIFUpSamplingH( TComPattern* pcPattern, Bool biPred  );
  • branches/HTM-5.1-dev3-MERL/source/Lib/TLibEncoder/TEncSlice.cpp

    r210 r231  
    811811      m_pcBufferLowLatSbacCoders[ui].load(m_pppcRDSbacCoder[0][CI_CURR_BEST]);  //init. state
    812812  }
     813
     814#if MERL_VSP_C0152
     815  // Send Depth/Texture pointers to slice level
     816  pcSlice->setBWVSPLUTParam(m_aiShiftLUT, m_iShiftPrec);
     817  pcSlice->setRefPicBaseTxt(m_pPicBaseTxt);
     818  pcSlice->setRefPicBaseDepth(m_pPicBaseDepth);
     819#endif
     820
    813821  UInt uiWidthInLCUs  = rpcPic->getPicSym()->getFrameWidthInCU();
    814822  //UInt uiHeightInLCUs = rpcPic->getPicSym()->getFrameHeightInCU();
     
    11381146
    11391147  UInt uiEncCUOrder;
     1148
    11401149  uiCUAddr = rpcPic->getPicSym()->getCUOrderMap( uiStartCUAddr /rpcPic->getNumPartInCU());  /*for tiles, uiStartCUAddr is NOT the real raster scan address, it is actually
    11411150                                                                                              an encoding order index, so we need to convert the index (uiStartCUAddr)
  • branches/HTM-5.1-dev3-MERL/source/Lib/TLibEncoder/TEncSlice.h

    r210 r231  
    101101 
    102102  UInt                    m_uiSliceIdx;
     103
     104#if MERL_VSP_C0152
     105  // Data temporarily stored, will be sent to TComSlice level where the data will be actually used
     106  TComPic* m_pPicBaseTxt;
     107  TComPic* m_pPicBaseDepth;
     108  Int*     m_aiShiftLUT;
     109  Int      m_iShiftPrec;
     110#endif
     111
    103112public:
    104113  TEncSlice();
     
    128137  UInt    getSliceIdx()         { return m_uiSliceIdx;                    }
    129138  Void    setSliceIdx(UInt i)   { m_uiSliceIdx = i;                       }
     139
     140#if MERL_VSP_C0152
     141   Void     setBWVSPLUTParam    ( Int *pShiftLUT, Int iLoG2LUTPrec ) { m_aiShiftLUT = pShiftLUT; m_iShiftPrec = 2-iLoG2LUTPrec; }
     142   Void     setRefPicBaseTxt    ( TComPic*pPicTxt   ) { m_pPicBaseTxt = pPicTxt;    }
     143   Void     setRefPicBaseDepth  ( TComPic*pPicDepth ) { m_pPicBaseDepth = pPicDepth;}
     144   Void     getBWVSPLUTParam    ( Int*& pShiftLUT, Int& iShiftPrec ) { pShiftLUT = m_aiShiftLUT; iShiftPrec = m_iShiftPrec; }
     145   TComPic* getRefPicBaseTxt    () { return m_pPicBaseTxt;   }
     146   TComPic* getRefPicBaseDepth  () { return m_pPicBaseDepth; }
     147#endif
    130148};
    131149
  • branches/HTM-5.1-dev3-MERL/source/Lib/TLibRenderer/TRenFilter.cpp

    r56 r231  
    11541154}
    11551155
    1156 
    11571156// Down Sampling
    11581157// Down sample luma
     
    12241223  }
    12251224}
    1226 
    12271225
    12281226Void TRenFilter::xInterpHorChroma( Pel* piSrc, Int iSrcStride, Int iSrcStepX, Int iSrcStepY, Int iWidth, Int iHeight, Pel* piDst, Int iDstStride, Int iDstStepX, Int iDstStepY, FpChromaIntFilt fpFilter )
  • branches/HTM-5.1-dev3-MERL/source/Lib/TLibRenderer/TRenInterpFilter.h

    r56 r231  
    7272  __inline Void xCTI_FilterQuarter1Hor(Pel* piSrc, Int iSrcStride, Int iSrcStep, Int iWidth, Int iHeight, Int iDstStride, Int iDstStep, Pel*& rpiDst);
    7373  __inline Void xCTI_FilterQuarter1Hor(Int* piSrc, Int iSrcStride, Int iSrcStep, Int iWidth, Int iHeight, Int iDstStride, Int iDstStep, Pel*& rpiDst);
    74  
     74
    7575  __inline Void xCTI_FilterHalfVer (Pel* piSrc, Int iSrcStride, Int iSrcStep, Int iWidth, Int iHeight, Int iDstStride, Int iDstStep, Int*& rpiDst, Int iDstStridePel, Pel*& rpiDstPel );
    7676  __inline Void xCTI_FilterHalfVer (Pel* piSrc, Int iSrcStride, Int iSrcStep, Int iWidth, Int iHeight, Int iDstStride, Int iDstStep, Int*& rpiDst );
  • branches/HTM-5.1-dev3-MERL/source/Lib/TLibRenderer/TRenSingleModel.h

    r210 r231  
    3333
    3434#if !QC_MVHEVC_B0046
    35 #ifndef __TRENSINGLEMODEL__ 
     35#ifndef __TRENSINGLEMODEL__
    3636#define __TRENSINGLEMODEL__
    3737
  • branches/HTM-5.1-dev3-MERL/source/Lib/TLibRenderer/TRenTop.cpp

    r100 r231  
    193193}
    194194
    195 
    196195Void TRenTop::xConvertOutputData( PelImage* pcOrgOutputImage, PelImage* pcConvOutputImage, Bool bMirror )
    197196{
     
    14501449
    14511450    for( Int iXPos = iSourcePos + 1; iXPos <  iWidth; iXPos++)
    1452         {
     1451    {
    14531452      for( UInt uiCurPlane = 0; uiCurPlane < uiNumberOfPlanes; uiCurPlane++)
    1454           {
     1453      {
    14551454        apcOutputData[uiCurPlane][iXPos] = apcInputData[uiCurPlane][iSourcePos];
    14561455      }
    1457             }
     1456    }
    14581457
    14591458    // Fill Left Gap
     
    14691468      {
    14701469        apcOutputData[uiCurPlane][iXPos] = apcInputData[uiCurPlane][iSourcePos];
    1471           }
    1472         }
     1470      }
     1471    }
    14731472
    14741473    // Go to next line
     
    21542153    {
    21552154      m_aaiSubPelShift[uiEntry] = new Int[ iNumEntries ];
    2156         }
     2155    }
    21572156
    21582157    TRenFilter::setSubPelShiftLUT(m_iRelShiftLUTPrec, m_aaiSubPelShift, -1);
Note: See TracChangeset for help on using the changeset viewer.