Changeset 1187 in 3DVCSoftware


Ignore:
Timestamp:
8 Apr 2015, 15:26:52 (9 years ago)
Author:
tech
Message:

Clean up Part 3.

Location:
branches/HTM-14.0-dev0/source
Files:
25 edited

Legend:

Unmodified
Added
Removed
  • branches/HTM-14.0-dev0/source/App/TAppEncoder/TAppEncCfg.h

    r1185 r1187  
    539539    Int iSpace = max(1, ENC_CFG_CONSOUT_SPACE - (Int) description.length() );
    540540   
    541     for ( Int i = 0; i < iSpace; i++ )
     541    for ( Int i = 0; i < iSpace; i++ )
     542    {
    542543      description.append( " " );
     544    }
    543545     
    544546    description.append( ":" );
    545547    printf( "%s", description.c_str() );
    546548
    547     for(Int i=0;i<rpcVector.size();i++)               
     549    for(Int i=0;i<rpcVector.size();i++)
     550    {
    548551      xPrintVectorElem( rpcVector[i] );
     552    }
    549553
    550554    printf("\n");
  • branches/HTM-14.0-dev0/source/Lib/TLibCommon/ContextTables.h

    r1185 r1187  
    5151#define NUM_SPLIT_FLAG_CTX            3       ///< number of context models for split flag
    5252#define NUM_SKIP_FLAG_CTX             3       ///< number of context models for skip flag
     53#if H_3D
    5354#define NUM_DIS_FLAG_CTX              1
    5455#define NUM_DIS_TYPE_CTX              1       
     56#endif
    5557#define NUM_MERGE_FLAG_EXT_CTX        1       ///< number of context models for merge flag of merge extended
    5658#define NUM_MERGE_IDX_EXT_CTX         1       ///< number of context models for merge index of merge extended
  • branches/HTM-14.0-dev0/source/Lib/TLibCommon/TComDataCU.cpp

    r1185 r1187  
    153153  m_pbDBBPFlag         = NULL;
    154154#endif
    155 
    156155}
    157156
     
    957956      m_pbICFlag          [ui] = pcCU->m_pbICFlag[uiPartOffset+ui];
    958957#endif
    959 
    960 
    961958#if H_3D_DIM
    962959      for( Int i = 0; i < DIM_NUM_TYPE; i++ )
     
    10951092  m_pbSPIVMPFlag        = pcCU->getSPIVMPFlag()          + uiPart;
    10961093#endif
    1097 
    10981094#if H_3D_ARP
    10991095  m_puhARPW             = pcCU->getARPW()             + uiPart;
     
    11021098  m_pbICFlag            = pcCU->getICFlag()           + uiPart;
    11031099#endif
    1104 
    1105 
    11061100  m_puhLumaIntraDir     = pcCU->getLumaIntraDir()     + uiPart;
    11071101  m_puhChromaIntraDir   = pcCU->getChromaIntraDir()   + uiPart;
     
    12421236#endif
    12431237#if H_3D_SPIVMP
    1244   m_pbSPIVMPFlag       = pcCU->getSPIVMPFlag()               + uiAbsPartIdx;
    1245 #endif
    1246 
     1238  m_pbSPIVMPFlag       = pcCU->getSPIVMPFlag()            + uiAbsPartIdx;
     1239#endif
    12471240  m_apiMVPIdx[eRefPicList] = pcCU->getMVPIdx(eRefPicList) + uiAbsPartIdx;
    1248   m_apiMVPNum[eRefPicList] = pcCU->getMVPNum(eRefPicList) + uiAbsPartIdx;
    1249  
     1241  m_apiMVPNum[eRefPicList] = pcCU->getMVPNum(eRefPicList) + uiAbsPartIdx; 
    12501242#if H_3D_ARP
    12511243  m_puhARPW            = pcCU->getARPW()                  + uiAbsPartIdx;
    1252 #endif
    1253 
    1254    
     1244#endif   
    12551245#if H_3D_DBBP
    12561246  m_pbDBBPFlag       = pcCU->getDBBPFlag()              + uiAbsPartIdx;
     
    13001290  memcpy( m_piVSPFlag           + uiOffset, pcCU->getVSPFlag(),           sizeof( Char ) * uiNumPartition );
    13011291  memcpy( m_pDvInfo             + uiOffset, pcCU->getDvInfo(),            sizeof( *m_pDvInfo ) * uiNumPartition );
    1302 
    13031292#endif
    13041293#if H_3D_SPIVMP
     
    13161305  memcpy( m_puhCbf[1] + uiOffset, pcCU->getCbf(TEXT_CHROMA_U), iSizeInUchar );
    13171306  memcpy( m_puhCbf[2] + uiOffset, pcCU->getCbf(TEXT_CHROMA_V), iSizeInUchar );
    1318 
    1319 
    1320 
    13211307#if H_3D_DIM
    13221308  for( Int i = 0; i < DIM_NUM_TYPE; i++ )
     
    14151401  memcpy( rpcCU->getDvInfo()         + m_uiAbsIdxInLCU, m_pDvInfo,    sizeof(* m_pDvInfo)     * m_uiNumPartition );
    14161402#endif
    1417 
    1418 
    14191403  memcpy( rpcCU->getPartitionSize()  + m_uiAbsIdxInLCU, m_pePartSize, sizeof( *m_pePartSize ) * m_uiNumPartition );
    14201404  memcpy( rpcCU->getPredictionMode() + m_uiAbsIdxInLCU, m_pePredMode, sizeof( *m_pePredMode ) * m_uiNumPartition );
     
    15481532  memcpy( rpcCU->getCbf(TEXT_CHROMA_U) + uiPartOffset, m_puhCbf[1], iSizeInUchar );
    15491533  memcpy( rpcCU->getCbf(TEXT_CHROMA_V) + uiPartOffset, m_puhCbf[2], iSizeInUchar );
    1550 
    1551 
    15521534#if H_3D_DIM
    15531535  for( Int i = 0; i < DMM_NUM_TYPE; i++ )
     
    22842266  {
    22852267    return NULL;
    2286   }
    2287  
     2268  } 
    22882269#if H_3D_FCO
    22892270  TComPic* depthPic = getSlice()->getIvPic(true, getSlice()->getViewIndex() );
     
    38503831#endif
    38513832#if H_3D_ARP
    3852   Bool bARPFlag = getARPW(uiAbsPartIdx)>0 ? true : false;
     3833  Bool bARPFlag = getARPW(uiAbsPartIdx) > 0;
    38533834#endif
    38543835#if H_3D_DBBP
     
    38833864    m_mergCands[MRG_A1].setCand( &pcMvFieldNeighbours[m_baseListidc<<1], puhInterDirNeighbours[m_baseListidc]
    38843865#if H_3D_VSP
    3885     ,
    3886       (pcCULeft->getVSPFlag(uiLeftPartIdx) != 0
     3866    , (pcCULeft->getVSPFlag(uiLeftPartIdx) != 0
    38873867#if H_3D_IC
    38883868      && !bICFlag
     
    39073887    m_mergCands[MRG_B1].setCand( &pcMvFieldNeighbours[m_baseListidc<<1], puhInterDirNeighbours[m_baseListidc]
    39083888#if H_3D_VSP
    3909     ,
    3910       false
     3889    , false
    39113890#endif
    39123891      , false
     
    39353914    m_mergCands[MRG_A0].setCand( &pcMvFieldNeighbours[m_baseListidc<<1], puhInterDirNeighbours[m_baseListidc]
    39363915#if H_3D_VSP
    3937     ,
    3938       false
     3916    , false
    39393917#endif
    39403918      , false
     
    39493927    m_mergCands[MRG_B2].setCand( &pcMvFieldNeighbours[m_baseListidc<<1], puhInterDirNeighbours[m_baseListidc]
    39503928#if H_3D_VSP
    3951     ,
    3952       false
     3929    , false
    39533930#endif
    39543931      , false
     
    39773954    TComPic * pcTexPic = m_pcSlice->getTexturePic();
    39783955#if H_3D_FCO
    3979 #if H_3D_FCO
    39803956    if (pcTexPic && pcTexPic->getReconMark())
    3981 #else
    3982     if (pcTexturePic->getReconMark())
    3983 #endif
    39843957    {
    39853958#endif   
     
    40163989      Int         iTexPosX, iTexPosY;
    40173990      const TComMv cMvRounding( 1 << ( 2 - 1 ), 1 << ( 2 - 1 ) );
    4018      
     3991
    40193992      Int         iCenterPosX = iCurrPosX + ( ( iWidth /  iPUWidth ) >> 1 )  * iPUWidth + ( iPUWidth >> 1 );
    40203993      Int         iCenterPosY = iCurrPosY + ( ( iHeight /  iPUHeight ) >> 1 )  * iPUHeight + (iPUHeight >> 1);
     
    40233996      if(iWidth == iPUWidth && iHeight == iPUHeight)
    40243997      {
    4025           iCenterPosX = iCurrPosX + (iWidth >> 1);
    4026           iCenterPosY = iCurrPosY + (iHeight >> 1);
     3998        iCenterPosX = iCurrPosX + (iWidth >> 1);
     3999        iCenterPosY = iCurrPosY + (iHeight >> 1);
    40274000      }
    40284001
     
    40604033      if ( bSPIVMPFlag == true )
    40614034      {   
    4062           iInterDirSaved = (cMvFieldSaved[0].getRefIdx()!=-1 ? 1: 0) + (cMvFieldSaved[1].getRefIdx()!=-1 ? 2: 0);
    4063           tmpDir = iInterDirSaved;
    4064           tmpMV[0] = cMvFieldSaved[0];
    4065           tmpMV[1] = cMvFieldSaved[1];
     4035        iInterDirSaved = (cMvFieldSaved[0].getRefIdx()!=-1 ? 1: 0) + (cMvFieldSaved[1].getRefIdx()!=-1 ? 2: 0);
     4036        tmpDir = iInterDirSaved;
     4037        tmpMV[0] = cMvFieldSaved[0];
     4038        tmpMV[1] = cMvFieldSaved[1];
    40664039      }
    40674040
     
    42054178    if (!bRemoveSpa)
    42064179    {
    4207       Bool SPIVMPFlag = false;
     4180      Bool spiMvpFlag = false;
    42084181      if(!m_pcSlice->getIsDepth())
    42094182      {
    4210         SPIVMPFlag = true;
     4183        spiMvpFlag = true;
    42114184      }
    42124185#if H_3D_DBBP
    4213       SPIVMPFlag &= !bDBBPFlag;
    4214 #endif
    4215 
    4216       m_mergCands[MRG_IVMC].setCand( tmpMV, ivCandDir[0], false, SPIVMPFlag);
     4186      spiMvpFlag &= !bDBBPFlag;
     4187#endif
     4188
     4189      m_mergCands[MRG_IVMC].setCand( tmpMV, ivCandDir[0], false, spiMvpFlag);
    42174190
    42184191      if ( mrgCandIdx == iCount )
     
    53195292
    53205293#if H_MV
    5321 Void TComDataCU::checkMV_V (TComMv&  rcMv,  RefPicList eRefPicList, int iRefIdx )
     5294Void TComDataCU::checkMvVertRest (TComMv&  rcMv,  RefPicList eRefPicList, int iRefIdx )
    53225295{
    53235296  if ( getSlice()->getSPS()->getInterViewMvVertConstraintFlag() )
     
    56855658    iScale = 4096;
    56865659    if ( iCurrRefViewId != iCurrViewId && iColViewId != iColRefViewId )
     5660    {
    56875661      iScale = xGetDistScaleFactor( iCurrViewId, iCurrRefViewId, iColViewId, iColRefViewId );
     5662    }
    56885663    if ( bMRG && iScale != 4096 && m_pcSlice->getIvMvScalingFlag( ) )
    56895664    {
     
    58625837}
    58635838#endif
     5839
    58645840#if H_3D_IV_MERGE
    58655841Void TComDataCU::getDispforDepth (UInt uiPartIdx, UInt uiPartAddr, DisInfo* pDisp)
    58665842{
    5867 
    58685843  assert(getPartitionSize( uiPartAddr ) == SIZE_2Nx2N);
    58695844
     
    58715846  if ( getSlice()->getDefaultRefViewIdxAvailableFlag() )
    58725847  {
    5873       Int iViewIdx = getSlice()->getDefaultRefViewIdx();
    5874       pDisp->m_aVIdxCan = iViewIdx;
    5875       Int iDisp     = getSlice()->getDepthToDisparityB( iViewIdx )[ (Int64) (1 << ( getSlice()->getSPS()->getBitDepthY() - 1 )) ];
    5876 
    5877       cMv.setHor(iDisp);
    5878       cMv.setVer(0);
    5879       pDisp->m_acNBDV = cMv;
    5880       pDisp->m_aVIdxCan = iViewIdx;
     5848    Int iViewIdx = getSlice()->getDefaultRefViewIdx();
     5849    pDisp->m_aVIdxCan = iViewIdx;
     5850    Int iDisp     = getSlice()->getDepthToDisparityB( iViewIdx )[ (Int64) (1 << ( getSlice()->getSPS()->getBitDepthY() - 1 )) ];
     5851
     5852    cMv.setHor(iDisp);
     5853    cMv.setVer(0);
     5854    pDisp->m_acNBDV = cMv;
     5855    pDisp->m_aVIdxCan = iViewIdx;
    58815856  }
    58825857}
     
    60376012#endif
    60386013        if (picDepth && bDepthRefine)
     6014        {
    60396015          estimateDVFromDM(iTargetViewIdx, uiPartIdx, picDepth, uiPartAddr, &cColMv );
    6040 
     6016        }
    60416017        pDInfo->m_acDoNBDV  = cColMv;
    60426018#endif //H_3D_NBDV_REF
     
    61216097  if (getSlice()->getDefaultRefViewIdxAvailableFlag())
    61226098  {
    6123       pDInfo->m_aVIdxCan = getSlice()->getDefaultRefViewIdx();
     6099    pDInfo->m_aVIdxCan = getSlice()->getDefaultRefViewIdx();
    61246100
    61256101#if H_3D_NBDV_REF
    6126           TComPic* picDepth = NULL;
     6102    TComPic* picDepth = NULL;
    61276103#if H_3D_FCO_VSP_DONBDV_E0163
    6128           picDepth  = getSlice()->getIvPic(true, getSlice()->getViewIndex() );
    6129       if ( picDepth->getPicYuvRec() != NULL ) 
    6130       {
    6131           defaultDV.setZero();
    6132       }
    6133       else // Go back with virtual depth
    6134       {
    6135           picDepth = getSlice()->getIvPic( true, getSlice()->getDefaultRefViewIdx());
    6136       }
    6137 
    6138       assert(picDepth != NULL);
     6104    picDepth  = getSlice()->getIvPic(true, getSlice()->getViewIndex() );
     6105    if ( picDepth->getPicYuvRec() != NULL ) 
     6106    {
     6107      defaultDV.setZero();
     6108    }
     6109    else // Go back with virtual depth
     6110    {
     6111      picDepth = getSlice()->getIvPic( true, getSlice()->getDefaultRefViewIdx());
     6112    }
     6113
     6114    assert(picDepth != NULL);
    61396115#else
    6140           picDepth = getSlice()->getIvPic( true, getSlice()->getDefaultRefViewIdx());
    6141 #endif
    6142       if (picDepth && bDepthRefine)
    6143       {
    6144           estimateDVFromDM(getSlice()->getDefaultRefViewIdx(), uiPartIdx, picDepth, uiPartAddr, &defaultDV ); // from base view
    6145       }
    6146       pDInfo->m_acDoNBDV = defaultDV;
     6116    picDepth = getSlice()->getIvPic( true, getSlice()->getDefaultRefViewIdx());
     6117#endif
     6118    if (picDepth && bDepthRefine)
     6119    {
     6120      estimateDVFromDM(getSlice()->getDefaultRefViewIdx(), uiPartIdx, picDepth, uiPartAddr, &defaultDV ); // from base view
     6121    }
     6122    pDInfo->m_acDoNBDV = defaultDV;
    61476123#endif
    61486124  }
     
    62366212
    62376213          if (picDepth && bDepthRefine)
     6214          {
    62386215            estimateDVFromDM(refViewIdx, uiPartIdx, picDepth, uiPartAddr, &cMvPred );
    6239 
     6216          }
    62406217          pNbDvInfo->m_acDoNBDV = cMvPred;
    62416218#endif
     
    66576634                {
    66586635                  RefPicList  eCurrRefPicList = RefPicList( uiCurrRefListId );
    6659                   Bool bLoop_stop = false;
    6660                   for(Int iLoop = 0; iLoop < 2 && !bLoop_stop; ++iLoop)
     6636                  Bool bLoopStop = false;
     6637                  for(Int iLoop = 0; iLoop < 2 && !bLoopStop; ++iLoop)
    66616638                  {
    66626639                    RefPicList eBaseRefPicList = (iLoop ==1)? RefPicList( 1 -  uiCurrRefListId ) : RefPicList( uiCurrRefListId );
     
    66846661                            }
    66856662
    6686                             bLoop_stop = true;
     6663                            bLoopStop = true;
    66876664
    66886665                            pcMvFieldSP[2*iPartition + uiCurrRefListId].setMvField(cMv, iPdmRefIdx);
     
    69166893{
    69176894  UInt uiCurrPartNumb = m_pcPic->getNumPartInCU() >> (uiDepth << 1);
    6918   for( UInt ui = 0; ui < uiCurrPartNumb; ui++ ) { m_dmmWedgeTabIdx[dmmType][uiAbsPartIdx+ui] = tabIdx; }
     6895  for( UInt ui = 0; ui < uiCurrPartNumb; ui++ )
     6896  {
     6897    m_dmmWedgeTabIdx[dmmType][uiAbsPartIdx+ui] = tabIdx;
     6898  }
    69196899}
    69206900#endif
  • branches/HTM-14.0-dev0/source/Lib/TLibCommon/TComDataCU.h

    r1185 r1187  
    7272  PartSize    eVirtualPartSize;
    7373  UInt        uiVirtualPartIndex;
    74 } DBBPTmpData;
     74} DbbpTmpData;
    7575#endif
    7676
     
    173173#endif
    174174#if H_3D_VSP
    175   Char*         m_piVSPFlag;          ///< array of VSP flags to indicate whehter a block uses VSP or not
    176                                       ///< 0: non-VSP; 1: VSP
     175  Char*         m_piVSPFlag;          ///< array of VSP flags to indicate whehter a block uses VSP or not  ///< 0: non-VSP; 1: VSP
    177176#endif
    178177#if H_3D_SPIVMP
    179   Bool*         m_pbSPIVMPFlag;       ///< array of sub-PU IVMP flags to indicate whehter a block uses sub-PU IVMP
    180                                       ///< 0: non-SPIVMP; 1: SPIVMP
     178  Bool*         m_pbSPIVMPFlag;       ///< array of sub-PU IVMP flags to indicate whehter a block uses sub-PU IVMP ///< 0: non-SPIVMP; 1: SPIVMP
    181179#endif
    182180#if H_3D_ARP
     
    194192  Bool*         m_pbSDCFlag;
    195193  Pel*          m_apSegmentDCOffset[2];
    196   Pel          m_apDmmPredictor[2];
     194  Pel           m_apDmmPredictor[2];
    197195#endif
    198196#endif
    199197#if H_3D_DBBP
    200198  Bool*         m_pbDBBPFlag;        ///< array of DBBP flags
    201   DBBPTmpData   m_sDBBPTmpData;
     199  DbbpTmpData   m_sDBBPTmpData;
    202200#endif
    203201#if H_3D
     
    247245  Bool          xGetColMVP( RefPicList eRefPicList, Int uiCUAddr, Int uiPartUnitIdx, TComMv& rcMv, Int& riRefIdx
    248246#if H_3D_TMVP
    249   ,
    250   Bool bMRG = true
     247  ,  Bool bMRG = true
    251248#endif
    252249  );
     
    368365  Void          setDBBPFlag           ( UInt uiIdx, Bool b )    { m_pbDBBPFlag[uiIdx] = b;           }
    369366  Void          setDBBPFlagSubParts   ( Bool bDBBPFlag, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth );
    370   DBBPTmpData*  getDBBPTmpData        () { return &m_sDBBPTmpData; }
     367  DbbpTmpData*  getDBBPTmpData        () { return &m_sDBBPTmpData; }
    371368#endif
    372369 
     
    596593  Void          clipMv                ( TComMv&     rcMv     );
    597594#if H_MV
    598   Void          checkMV_V (TComMv&  rcMv,  RefPicList eRefPicList, int iRefIdx );
     595  Void          checkMvVertRest (TComMv&  rcMv,  RefPicList eRefPicList, int iRefIdx );
    599596#endif
    600597  Void          getMvPredLeft         ( TComMv&     rcMvPred )   { rcMvPred = m_cMvFieldA.getMv(); }
  • branches/HTM-14.0-dev0/source/Lib/TLibCommon/TComInterpolationFilter.cpp

    r1179 r1187  
    353353{
    354354  assert(frac >= 0 && frac < 4);
    355  
     355
    356356  if ( frac == 0 )
    357357  {
     
    368368    {
    369369#endif
    370     filterHor<NTAPS_LUMA>(g_bitDepthY, src, srcStride, dst, dstStride, width, height, isLast, m_lumaFilter[frac]);
     370      filterHor<NTAPS_LUMA>(g_bitDepthY, src, srcStride, dst, dstStride, width, height, isLast, m_lumaFilter[frac]);
    371371#if H_3D_ARP
    372372    }
     
    436436{
    437437  assert(frac >= 0 && frac < 8);
    438  
     438
    439439  if ( frac == 0 )
    440440  {
     
    451451    {
    452452#endif
    453     filterHor<NTAPS_CHROMA>(g_bitDepthC, src, srcStride, dst, dstStride, width, height, isLast, m_chromaFilter[frac]);
     453      filterHor<NTAPS_CHROMA>(g_bitDepthC, src, srcStride, dst, dstStride, width, height, isLast, m_chromaFilter[frac]);
    454454#if H_3D_ARP
    455455    }
     
    478478{
    479479  assert(frac >= 0 && frac < 8);
    480  
     480
    481481  if ( frac == 0 )
    482482  {
     
    493493    {
    494494#endif
    495     filterVer<NTAPS_CHROMA>(g_bitDepthC, src, srcStride, dst, dstStride, width, height, isFirst, isLast, m_chromaFilter[frac]);
     495      filterVer<NTAPS_CHROMA>(g_bitDepthC, src, srcStride, dst, dstStride, width, height, isFirst, isLast, m_chromaFilter[frac]);
    496496#if H_3D_ARP
    497497    }
  • branches/HTM-14.0-dev0/source/Lib/TLibCommon/TComMotionInfo.cpp

    r1179 r1187  
    335335  Int iStartPelY = g_auiRasterToPelY[g_auiZscanToRaster[uiAbsPartIdx]];
    336336  Int iEndPelX = iStartPelX + iWidth;
    337   Int iEndPelY = iStartPelY + iHeight;
    338 
    339   Int iCurrRaster, uiPartAddr;
     337  Int iEndPelY = iStartPelY + iHeight; 
    340338
    341339  for (Int i=iStartPelY; i<iEndPelY; i+=pcCU->getPic()->getMinCUHeight())
     
    343341    for (Int j=iStartPelX; j < iEndPelX; j += pcCU->getPic()->getMinCUWidth())
    344342    {
    345       iCurrRaster = i / pcCU->getPic()->getMinCUHeight() * pcCU->getPic()->getNumPartInWidth() + j/pcCU->getPic()->getMinCUWidth();
    346       uiPartAddr = g_auiRasterToZscan[iCurrRaster];
     343      Int iCurrRaster = i / pcCU->getPic()->getMinCUHeight() * pcCU->getPic()->getNumPartInWidth() + j/pcCU->getPic()->getMinCUWidth();
     344      Int uiPartAddr = g_auiRasterToZscan[iCurrRaster];
    347345      uiPartAddr -= pcCU->getZorderIdxInCU(); 
    348346
  • branches/HTM-14.0-dev0/source/Lib/TLibCommon/TComPic.cpp

    r1179 r1187  
    415415#endif
    416416
    417   TComSlice* pcTextSlice = pcTextPic->getSlice(0); // currently only support single slice
    418 
    419   for( Int iTextRefDir = 0; (iTextRefDir < (pcTextSlice->isInterB()? 2:1) ) && !pcTextSlice->isIntra(); iTextRefDir ++ )
    420   {
    421     for( Int iTextRefIdx =0; iTextRefIdx<pcTextSlice->getNumRefIdx(( RefPicList )iTextRefDir ); iTextRefIdx++)
    422     {
    423       Int iTextRefPOC    = pcTextSlice->getRefPOC( ( RefPicList )iTextRefDir, iTextRefIdx);
    424       Int iTextRefViewId = pcTextSlice->getRefPic( ( RefPicList )iTextRefDir, iTextRefIdx)->getViewIndex();
    425       m_aiTexToDepRef[iTextRefDir][iTextRefIdx] = -1;
    426       Int iCurrRefDir = iTextRefDir;
    427       for( Int iCurrRefIdx =0; ( iCurrRefIdx<pcCurrSlice->getNumRefIdx(( RefPicList )iCurrRefDir ) ) && ( m_aiTexToDepRef[iTextRefDir][iTextRefIdx] < 0 ) ; iCurrRefIdx++)
    428       {
    429         if( pcCurrSlice->getRefPOC( ( RefPicList )iCurrRefDir, iCurrRefIdx ) == iTextRefPOC &&
    430           pcCurrSlice->getRefPic( ( RefPicList )iCurrRefDir, iCurrRefIdx)->getViewIndex() == iTextRefViewId )
    431         { 
    432           m_aiTexToDepRef[iTextRefDir][iTextRefIdx] = iCurrRefIdx;
     417    TComSlice* pcTextSlice = pcTextPic->getSlice(0); // currently only support single slice
     418
     419    for( Int iTextRefDir = 0; (iTextRefDir < (pcTextSlice->isInterB()? 2:1) ) && !pcTextSlice->isIntra(); iTextRefDir ++ )
     420    {
     421      for( Int iTextRefIdx =0; iTextRefIdx<pcTextSlice->getNumRefIdx(( RefPicList )iTextRefDir ); iTextRefIdx++)
     422      {
     423        Int iTextRefPOC    = pcTextSlice->getRefPOC( ( RefPicList )iTextRefDir, iTextRefIdx);
     424        Int iTextRefViewId = pcTextSlice->getRefPic( ( RefPicList )iTextRefDir, iTextRefIdx)->getViewIndex();
     425        m_aiTexToDepRef[iTextRefDir][iTextRefIdx] = -1;
     426        Int iCurrRefDir = iTextRefDir;
     427        for( Int iCurrRefIdx =0; ( iCurrRefIdx<pcCurrSlice->getNumRefIdx(( RefPicList )iCurrRefDir ) ) && ( m_aiTexToDepRef[iTextRefDir][iTextRefIdx] < 0 ) ; iCurrRefIdx++)
     428        {
     429          if( pcCurrSlice->getRefPOC( ( RefPicList )iCurrRefDir, iCurrRefIdx ) == iTextRefPOC &&
     430            pcCurrSlice->getRefPic( ( RefPicList )iCurrRefDir, iCurrRefIdx)->getViewIndex() == iTextRefViewId )
     431          { 
     432            m_aiTexToDepRef[iTextRefDir][iTextRefIdx] = iCurrRefIdx;
     433          }
    433434        }
    434435      }
    435     }
    436 
    437   }
     436
     437    }
    438438#if H_3D_FCO
    439439  }
    440440#endif
    441 
    442441}
    443442
  • branches/HTM-14.0-dev0/source/Lib/TLibCommon/TComPrediction.cpp

    r1185 r1187  
    5454  m_pDepthBlock = (Int*) malloc(MAX_NUM_SPU_W*MAX_NUM_SPU_W*sizeof(Int));
    5555  if (m_pDepthBlock == NULL)
     56  {
    5657      printf("ERROR: UKTGHU, No memory allocated.\n");
     58  }
    5759#endif
    5860}
     
    6264#if H_3D_VSP
    6365  if (m_pDepthBlock != NULL)
    64       free(m_pDepthBlock);
     66  {
     67    free(m_pDepthBlock);
     68  }
    6569  m_cYuvDepthOnVsp.destroy();
    6670#endif
     
    513517
    514518#if H_3D_DIM_DMM
    515   if( dimType == DMM4_IDX && dmm4Segmentation == NULL ) { dmmSegmentation->destroy(); delete dmmSegmentation; }
     519  if( dimType == DMM4_IDX && dmm4Segmentation == NULL )
     520  {
     521    dmmSegmentation->destroy();
     522    delete dmmSegmentation;
     523  }
    516524#endif
    517525}
     
    635643  // segmentation of texture block --> mask IDs
    636644  Pel*  pDepthBlockStart      = pDepthPels;
    637  
     645
    638646  // first compute average of depth block for thresholding
    639647  Int iSumDepth = 0;
     
    648656  Int iBlkX = ( pcCU->getAddr() % pcCU->getSlice()->getIvPic (true, pcCU->getDvInfo(0).m_aVIdxCan)->getFrameWidthInCU() ) * g_uiMaxCUWidth  + g_auiRasterToPelX[ g_auiZscanToRaster[ pcCU->getZorderIdxInCU() ] ]+ ((cDv.getHor()+2)>>2);
    649657  Int iBlkY = ( pcCU->getAddr() / pcCU->getSlice()->getIvPic (true, pcCU->getDvInfo(0).m_aVIdxCan)->getFrameWidthInCU() ) * g_uiMaxCUHeight + g_auiRasterToPelY[ g_auiZscanToRaster[ pcCU->getZorderIdxInCU() ] ]+ ((cDv.getVer()+2)>>2);
     658 
    650659  UInt t=0;
    651660
    652661  for (Int y=0; y<uiSize; y+=iSubSample)
    653    {
     662  {
    654663    for (Int x=0; x<uiSize; x+=iSubSample)
    655    {
    656 if (iBlkX+x>iPictureWidth)
    657 {
    658     Int depthPel = pDepthPels[t];
    659     iSumDepth += depthPel;
    660 }
    661 else
    662 {
    663     Int depthPel = pDepthPels[x];
    664     t=x;
    665     iSumDepth += depthPel;
    666 }
    667    }
    668    
     664    {
     665      if (iBlkX+x>iPictureWidth)
     666      {
     667        Int depthPel = pDepthPels[t];
     668        iSumDepth += depthPel;
     669      }
     670      else
     671      {
     672        Int depthPel = pDepthPels[x];
     673        t=x;
     674        iSumDepth += depthPel;
     675      }
     676    }
     677
    669678    // next row
    670679    if (!(iBlkY+y+4>iPictureHeight))
    671     pDepthPels += uiDepthStride*iSubSample;
    672   }
    673  
     680    {
     681      pDepthPels += uiDepthStride*iSubSample;
     682    }
     683  }
     684
    674685  Int iSizeInBits = g_aucConvertToBit[uiSize] - g_aucConvertToBit[iSubSample];  // respect sub-sampling factor
    675686  Int iMean = iSumDepth >> iSizeInBits*2;       // iMean /= (uiSize*uiSize);
    676  
     687
    677688  // start again for segmentation
    678689  pDepthPels = pDepthBlockStart;
    679  
     690
    680691  // start mapping process
    681692  Int matchedPartSum[2][2] = {{0,0},{0,0}}; // counter for each part size and boolean option
    682693  PartSize virtualPartSizes[2] = { SIZE_Nx2N, SIZE_2NxN};
    683  
     694
    684695  UInt uiHalfSize = uiSize>>1;
    685696  for (Int y=0; y<uiSize; y+=iSubSample)
     
    688699    {
    689700      Int depthPel = 0;
    690 if (iBlkX+x>iPictureWidth)
    691 {
    692     depthPel = pDepthPels[t];
    693 }
    694 else
    695 {
    696     depthPel = pDepthPels[x];
    697      t=x;
    698 }
    699      
     701      if (iBlkX+x>iPictureWidth)
     702      {
     703        depthPel = pDepthPels[t];
     704      }
     705      else
     706      {
     707        depthPel = pDepthPels[x];
     708        t=x;
     709      }
     710
    700711      // decide which segment this pixel belongs to
    701712      Int ucSegment = (Int)(depthPel>iMean);
    702      
     713
    703714      // Matched Filter to find optimal (conventional) partitioning
    704      
     715
    705716      // SIZE_Nx2N
    706717      if(x<uiHalfSize)  // left
     
    712723        matchedPartSum[0][1-ucSegment]++;
    713724      }
    714      
     725
    715726      // SIZE_2NxN
    716727      if(y<uiHalfSize)  // top
     
    723734      }
    724735    }
    725    
     736
    726737    // next row
    727738    if (!(iBlkY+y+4>iPictureHeight))
    728     pDepthPels += uiDepthStride*iSubSample;
    729   }
    730  
     739    {
     740      pDepthPels += uiDepthStride*iSubSample;
     741    }
     742  }
     743
    731744  PartSize matchedPartSize = SIZE_NONE;
    732  
     745
    733746  Int iMaxMatchSum = 0;
    734747  for(Int p=0; p<2; p++)  // loop over partition
     
    743756    }
    744757  }
    745  
     758
    746759  AOF( matchedPartSize != SIZE_NONE );
    747  
     760
    748761  return matchedPartSize;
    749762}
     
    761774  uiMaxDepth = pDepthPels[ 0 ];
    762775  iSumDepth  = pDepthPels[ 0 ];
    763   UInt t=0;
     776 
    764777  Int iPictureWidth = pcCU->getSlice()->getIvPic (true, pcCU->getDvInfo(0).m_aVIdxCan)->getPicYuvRec()->getWidth();
    765778  Int iPictureHeight = pcCU->getSlice()->getIvPic (true, pcCU->getDvInfo(0).m_aVIdxCan)->getPicYuvRec()->getHeight(); 
     
    835848
    836849  // generate mask
     850  UInt t=0;
    837851  UInt uiSumPix[2] = {0,0};
    838852  for (Int y=0; y<uiHeight; y++)
     
    952966  }
    953967
    954   if ( tmpTar    ) { xFree(tmpTar);             tmpTar        = NULL; }
     968  if ( tmpTar    )
     969  {
     970    xFree(tmpTar);             
     971    tmpTar        = NULL;
     972  }
    955973 
    956974  // now combine chroma
     
    10551073  }
    10561074
    1057   if ( tmpTarU    ) { xFree(tmpTarU);             tmpTarU        = NULL; }
    1058   if ( tmpTarV    ) { xFree(tmpTarV);             tmpTarV        = NULL; }
     1075  if( tmpTarU )
     1076  {
     1077    xFree(tmpTarU);
     1078    tmpTarU        = NULL;
     1079  }
     1080  if ( tmpTarV    )
     1081  {
     1082    xFree(tmpTarV);
     1083    tmpTarV        = NULL;
     1084  }
    10591085}
    10601086#endif
     
    12431269  pcCU->clipMv(cMv);
    12441270#if H_MV
    1245   pcCU->checkMV_V(cMv, eRefPicList, iRefIdx );
     1271  pcCU->checkMvVertRest(cMv, eRefPicList, iRefIdx );
    12461272#endif
    12471273#if H_3D_ARP
     
    23672393    for( UInt k = 0; k < (patternStride * patternStride); k++ )
    23682394    {
    2369       if( true == biSegPattern[k] ) { ptrDst[k] = valDC2; }
    2370       else                          { ptrDst[k] = valDC1; }
     2395      if( true == biSegPattern[k] )
     2396      {
     2397        ptrDst[k] = valDC2;
     2398      }
     2399      else                         
     2400      {
     2401        ptrDst[k] = valDC1;
     2402      }
    23712403    }
    23722404  }
     
    23782410      for( UInt uiX = 0; uiX < patternStride; uiX++ )
    23792411      {
    2380         if( true == biSegPattern[uiX] ) { piTemp[uiX] = valDC2; }
    2381         else                            { piTemp[uiX] = valDC1; }
     2412        if( true == biSegPattern[uiX] )
     2413        {
     2414          piTemp[uiX] = valDC2;
     2415        }
     2416        else                           
     2417        {
     2418          piTemp[uiX] = valDC1;
     2419        }
    23822420      }
    23832421      piTemp       += dstStride;
     
    24492487  Int iSumPix[2];
    24502488  memset(iSumPix, 0, sizeof(Int)*2);
     2489
    24512490  for( Int i = 0; i < uiNumSegments; i++ )
    24522491  {
    2453     rpSegMeans[i] = 0;
    2454   }
    2455   if (orgDC == false)
     2492    rpSegMeans[i] = 0; 
     2493  }
     2494
     2495  if ( !orgDC )
    24562496  {
    24572497    Pel* pLeftTop = pOrig;
     
    24732513    subSamplePix = 1;
    24742514  }
     2515
    24752516  for (Int y=0; y<uiSize; y+=subSamplePix)
    24762517  {
     
    24922533  {
    24932534    if( iSumPix[ucSeg] > 0 )
     2535    {
    24942536      rpSegMeans[ucSeg] = iSumDepth[ucSeg] / iSumPix[ucSeg];
     2537    }
    24952538    else
     2539    {
    24962540      rpSegMeans[ucSeg] = 0;  // this happens for zero-segments
     2541    }
    24972542  }
    24982543}
  • branches/HTM-14.0-dev0/source/Lib/TLibCommon/TComPrediction.h

    r1185 r1187  
    121121  Void xPredInterUniSubPU        ( TComDataCU *cu, UInt uiPartAddr, Int iWidth, Int iHeight, RefPicList eRefPicList, TComYuv*& rpcYuvPred, Bool bi, Int widthSubPU=4, Int heightSubPU=4 );
    122122#endif
    123 
    124   Void xWeightedAverage         ( TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, Int iRefIdx0, Int iRefIdx1, UInt uiPartAddr, Int iWidth, Int iHeight, TComYuv*& rpcYuvDst );
    125  
     123  Void xWeightedAverage         ( TComYuv* pcYuvSrc0, TComYuv* pcYuvSrc1, Int iRefIdx0, Int iRefIdx1, UInt uiPartAddr, Int iWidth, Int iHeight, TComYuv*& rpcYuvDst ); 
    126124  Void xGetLLSPrediction ( TComPattern* pcPattern, Int* pSrc0, Int iSrcStride, Pel* pDst0, Int iDstStride, UInt uiWidth, UInt uiHeight, UInt uiExt0 );
    127125#if H_3D_IC
  • branches/HTM-14.0-dev0/source/Lib/TLibCommon/TComRdCost.cpp

    r1185 r1187  
    28622862UInt TComRdCost::getVSDEstimate( Int dDM, Pel* pOrg, Int iOrgStride,  Pel* pVirRec, Pel* pVirOrg, Int iVirStride, Int x, Int y )
    28632863{
    2864   Double dD;
    2865   Int iTemp;
    2866 
    2867   dD = ( (Double) ( dDM >> DISTORTION_PRECISION_ADJUSTMENT( g_bitDepthY - 8 ) ) ) * m_dDisparityCoeff;
     2864  Double  dD = ( (Double) ( dDM >> DISTORTION_PRECISION_ADJUSTMENT( g_bitDepthY - 8 ) ) ) * m_dDisparityCoeff;
    28682865
    28692866  Double dDepthWeight = ( pOrg[x] >=  ( (1<<(g_bitDepthY - 3)) + (1<<(g_bitDepthY - 2)) ) ? 4 : pOrg[x] > ((1<<g_bitDepthY) >> 4) ? (Float)(pOrg[x] - ((1<<g_bitDepthY) >> 4))/(Float)((1<<g_bitDepthY) >> 3) + 1 : 1.0 );
    28702867  Double dTemp = ( 0.5 * fabs(dD) * dDepthWeight * ( abs( (Int) pVirRec[ x+y*iVirStride ] - (Int) pVirRec[ x-1+y*iVirStride ] ) + abs( (Int) pVirRec[ x+y*iVirStride ] - (Int) pVirRec[ x+1+y*iVirStride ] ) ) );
    2871   iTemp = (Int) (((dTemp) < 0)? (Int)((dTemp) - 0.5) : (Int)((dTemp) + 0.5));
     2868  Int iTemp = (Int) (((dTemp) < 0)? (Int)((dTemp) - 0.5) : (Int)((dTemp) + 0.5));
    28722869
    28732870  return (UInt) ( (iTemp*iTemp)>>1 );
  • branches/HTM-14.0-dev0/source/Lib/TLibCommon/TComRom.cpp

    r1185 r1187  
    104104  if( !g_dmmWedgeLists.empty() )
    105105  {
    106     for( UInt ui = 0; ui < g_dmmWedgeLists.size(); ui++ ) { g_dmmWedgeLists[ui].clear(); }
     106    for( UInt ui = 0; ui < g_dmmWedgeLists.size(); ui++ )
     107    {
     108      g_dmmWedgeLists[ui].clear();
     109    }
    107110    g_dmmWedgeLists.clear();
    108111  }
    109112  if( !g_dmmWedgeRefLists.empty() )
    110113  {
    111     for( UInt ui = 0; ui < g_dmmWedgeRefLists.size(); ui++ ) { g_dmmWedgeRefLists[ui].clear(); }
     114    for( UInt ui = 0; ui < g_dmmWedgeRefLists.size(); ui++ )
     115    {
     116      g_dmmWedgeRefLists[ui].clear();
     117    }
    112118    g_dmmWedgeRefLists.clear();
    113119  }
     
    115121  if( !g_dmmWedgeNodeLists.empty() )
    116122  {
    117     for( UInt ui = 0; ui < g_dmmWedgeNodeLists.size(); ui++ ) { g_dmmWedgeNodeLists[ui].clear(); }
     123    for( UInt ui = 0; ui < g_dmmWedgeNodeLists.size(); ui++ )
     124    {
     125      g_dmmWedgeNodeLists[ui].clear();
     126    }
    118127    g_dmmWedgeNodeLists.clear();
    119128  }
  • branches/HTM-14.0-dev0/source/Lib/TLibCommon/TComRom.h

    r1179 r1187  
    290290
    291291#if H_MV_ENC_DEC_TRAC
    292 #define DTRACE_CU(x,y)            
    293 #define DTRACE_PU(x,y)            
    294 #define DTRACE_TU(x,y)            
    295 
    296 #define DTRACE_CU_S(x)            
    297 #define DTRACE_PU_S(x)            
    298 #define DTRACE_TU_S(x)            
     292#define DTRACE_CU(x,y) ;            
     293#define DTRACE_PU(x,y) ;           
     294#define DTRACE_TU(x,y) ;           
     295
     296#define DTRACE_CU_S(x) ;           
     297#define DTRACE_PU_S(x) ;           
     298#define DTRACE_TU_S(x) ;           
    299299
    300300#endif
  • branches/HTM-14.0-dev0/source/Lib/TLibCommon/TComSlice.cpp

    r1185 r1187  
    27212721}
    27222722
     2723#if H_3D
     2724Void TComVPS::initViewCompLayer()
     2725{
     2726  assert( m_viewCompLayerId.size() == 0 && m_viewCompLayerPresentFlag.size() == 0  );
     2727  for( Int i = 0; i < getNumViews(); i++ )
     2728  {
     2729    m_viewCompLayerId         .push_back( std::vector<Int>(0)  );
     2730    m_viewCompLayerPresentFlag.push_back( std::vector<Bool>(0) );     
     2731
     2732    for( Int depFlag = 0; depFlag  <=  1; depFlag++ )
     2733    {
     2734      Int iViewOIdx = getViewOIdxList( i );
     2735      Int layerId = -1;
     2736      for( Int j = 0; j  <=  getMaxLayersMinus1(); j++ )
     2737      {
     2738        Int jNuhLId = getLayerIdInNuh( j );
     2739        if( getVpsDepthFlag( jNuhLId ) == ( (Bool) depFlag )  &&  getViewOrderIdx( jNuhLId )  ==  iViewOIdx 
     2740          &&  getDependencyId( jNuhLId )  ==  0  &&  getAuxId( jNuhLId )  ==  0 )
     2741        {
     2742          layerId = jNuhLId;
     2743        }
     2744      }
     2745      m_viewCompLayerPresentFlag[ i ].push_back( layerId  !=  -1 );
     2746      m_viewCompLayerId         [ i ].push_back( layerId );       
     2747    }
     2748  }
     2749}
     2750
     2751Int TComVPS::getVoiInVps(Int viewOIdx)
     2752{
     2753  for ( Int i = 0; i < m_viewOIdxList.size(); i++ )
     2754  {
     2755    if  ( m_viewOIdxList[ i ] == viewOIdx )
     2756    {
     2757      return i;
     2758    }
     2759  }
     2760  assert( 0 );   
     2761  return -1;
     2762}
     2763
     2764Void TComVPS::deriveCpPresentFlag()
     2765{
     2766  for( Int nInVps = 0; nInVps < getNumViews(); nInVps++  )
     2767  {
     2768    for( Int mInVps = 0; mInVps < getNumViews(); mInVps++ )
     2769    {
     2770      m_cpPresentFlag[nInVps][mInVps] = 0;
     2771    }
     2772  }
     2773
     2774  for( Int n = 1; n < getNumViews(); n++ )
     2775  {
     2776    Int iInVps = getVoiInVps(  getViewOIdxList( n ) );     
     2777    for( Int m = 0; m < getNumCp( iInVps ); m++ )
     2778    {
     2779      m_cpPresentFlag[ iInVps ][ getVoiInVps( getCpRefVoi( iInVps, m ) ) ] = 1;
     2780    }
     2781  }
     2782}
     2783#endif
    27232784
    27242785#endif // H_MV
     
    38243885}
    38253886#endif
     3887
    38263888#if H_3D_IC
     3889// This is an encoder only function and should be moved to TEncSlice or TEncSearch!!
    38273890Void TComSlice::xSetApplyIC(Bool bUseLowLatencyICEnc)
    38283891{
     
    38883951  }
    38893952  else
    3890   {
    3891   Int iMaxPelValue = ( 1 << g_bitDepthY );
    3892   Int *aiRefOrgHist;
    3893   Int *aiCurrHist;
    3894   aiRefOrgHist = (Int *) xMalloc( Int,iMaxPelValue );
    3895   aiCurrHist   = (Int *) xMalloc( Int,iMaxPelValue );
    3896   memset( aiRefOrgHist, 0, iMaxPelValue*sizeof(Int) );
    3897   memset( aiCurrHist, 0, iMaxPelValue*sizeof(Int) );
    3898   // Reference Idx Number
    3899   Int iNumRefIdx = getNumRefIdx( REF_PIC_LIST_0 );
    3900   TComPic* pcCurrPic = NULL;
    3901   TComPic* pcRefPic = NULL;
    3902   TComPicYuv* pcCurrPicYuv = NULL;
    3903   TComPicYuv* pcRefPicYuvOrg = NULL;
    3904   pcCurrPic = getPic();
    3905   pcCurrPicYuv = pcCurrPic->getPicYuvOrg();
    3906   Int iWidth = pcCurrPicYuv->getWidth();
    3907   Int iHeight = pcCurrPicYuv->getHeight();
    3908 
    3909 
    3910   // Get InterView Reference picture
    3911   // !!!!! Assume only one Interview Reference Picture in L0
    3912   for ( Int i = 0; i < iNumRefIdx; i++ )
    3913   {
    3914     pcRefPic = getRefPic( REF_PIC_LIST_0, i );
    3915     if ( pcRefPic != NULL )
    3916     {
    3917       if ( pcCurrPic->getViewIndex() != pcRefPic->getViewIndex() )
    3918       {
    3919         pcRefPicYuvOrg = pcRefPic->getPicYuvOrg();
    3920       }
    3921     }
    3922   }
    3923 
    3924   if ( pcRefPicYuvOrg != NULL )
    3925   {
    3926     Pel* pCurrY = pcCurrPicYuv ->getLumaAddr();
    3927     Pel* pRefOrgY = pcRefPicYuvOrg  ->getLumaAddr();
    3928     Int iCurrStride = pcCurrPicYuv->getStride();
    3929     Int iRefStride = pcRefPicYuvOrg->getStride();
    3930     Int iSumOrgSAD = 0;
    3931     Double dThresholdOrgSAD = getIsDepth() ? 0.1 : 0.05;
    3932 
    3933     // Histogram building - luminance
    3934     for ( Int y = 0; y < iHeight; y++ )
    3935     {
    3936       for ( Int x = 0; x < iWidth; x++ )
    3937       {
    3938         aiCurrHist[pCurrY[x]]++;
    3939         aiRefOrgHist[pRefOrgY[x]]++;
    3940       }
    3941       pCurrY += iCurrStride;
    3942       pRefOrgY += iRefStride;
    3943     }
    3944     // Histogram SAD
    3945     for ( Int i = 0; i < iMaxPelValue; i++ )
    3946     {
    3947       iSumOrgSAD += abs( aiCurrHist[i] - aiRefOrgHist[i] );
    3948     }
    3949     // Setting
    3950     if ( iSumOrgSAD > Int( dThresholdOrgSAD * iWidth * iHeight ) )
    3951     {
    3952       m_bApplyIC = true;
    3953     }
    3954     else
    3955     {
    3956       m_bApplyIC = false;
    3957     }
    3958   }
    3959 
    3960   xFree( aiCurrHist   );
    3961   xFree( aiRefOrgHist );
    3962   aiCurrHist = NULL;
    3963   aiRefOrgHist = NULL;
     3953  {       
     3954    TComPic*    pcCurrPic = getPic();
     3955    TComPicYuv* pcCurrPicYuv = pcCurrPic->getPicYuvOrg();
     3956   
     3957    // Get InterView Reference picture
     3958    // !!!!! Assume only one Interview Reference Picture in L0
     3959    // GT: Is this assumption correct?
     3960
     3961    TComPicYuv* pcRefPicYuvOrg = NULL;
     3962    for ( Int i = 0; i < getNumRefIdx( REF_PIC_LIST_0 ); i++ )
     3963    {
     3964      TComPic* pcRefPic = getRefPic( REF_PIC_LIST_0, i );
     3965      if ( pcRefPic != NULL )
     3966      {
     3967        if ( pcCurrPic->getViewIndex() != pcRefPic->getViewIndex() )
     3968        {
     3969          pcRefPicYuvOrg = pcRefPic->getPicYuvOrg();
     3970        }
     3971      }
     3972    }
     3973
     3974    if ( pcRefPicYuvOrg != NULL )
     3975    {
     3976      // Histogram building - luminance
     3977      Int iMaxPelValue = ( 1 << g_bitDepthY );
     3978      Int *aiRefOrgHist = (Int *) xMalloc( Int,iMaxPelValue );
     3979      Int *aiCurrHist   = (Int *) xMalloc( Int,iMaxPelValue );
     3980      memset( aiRefOrgHist, 0, iMaxPelValue*sizeof(Int) );
     3981      memset( aiCurrHist, 0, iMaxPelValue*sizeof(Int) );
     3982
     3983      Int iWidth   = pcCurrPicYuv->getWidth();
     3984      Int iHeight  = pcCurrPicYuv->getHeight();
     3985
     3986      Pel* pCurrY   = pcCurrPicYuv ->getLumaAddr();
     3987      Pel* pRefOrgY = pcRefPicYuvOrg  ->getLumaAddr();
     3988      Int iCurrStride = pcCurrPicYuv->getStride();
     3989      Int iRefStride = pcRefPicYuvOrg->getStride();
     3990
     3991      for ( Int y = 0; y < iHeight; y++ )
     3992      {
     3993        for ( Int x = 0; x < iWidth; x++ )
     3994        {
     3995          aiCurrHist[pCurrY[x]]++;
     3996          aiRefOrgHist[pRefOrgY[x]]++;
     3997        }
     3998        pCurrY += iCurrStride;
     3999        pRefOrgY += iRefStride;
     4000      }
     4001
     4002      // Histogram SAD
     4003      Int iSumOrgSAD = 0;
     4004      for ( Int i = 0; i < iMaxPelValue; i++ )
     4005      {
     4006        iSumOrgSAD += abs( aiCurrHist[i] - aiRefOrgHist[i] );
     4007      }
     4008
     4009      // Setting
     4010      Double dThresholdOrgSAD = getIsDepth() ? 0.1 : 0.05;
     4011
     4012      if ( iSumOrgSAD > Int( dThresholdOrgSAD * iWidth * iHeight ) )
     4013      {
     4014        m_bApplyIC = true;
     4015      }
     4016      else
     4017      {
     4018        m_bApplyIC = false;
     4019      }
     4020
     4021      xFree( aiCurrHist   );
     4022      xFree( aiRefOrgHist );
     4023    }
    39644024  }//if(bUseLowLatencyICEnc)
    39654025}
     
    41364196#endif
    41374197}
     4198
     4199Void TComSlice::deriveInCmpPredAndCpAvailFlag()
     4200{
     4201  Int numCurCmpLIds = getIsDepth() ? 1 : getNumActiveRefLayerPics();
     4202  std::vector<Int> curCmpLIds;
     4203  if ( getIsDepth() )
     4204  {
     4205    curCmpLIds.push_back( getLayerId() );
     4206  }
     4207  else
     4208  {
     4209    for (Int i = 0; i < numCurCmpLIds; i++)
     4210    {
     4211      curCmpLIds.push_back( getRefPicLayerId( i ) );
     4212    }
     4213  }
     4214
     4215  m_cpAvailableFlag = true;
     4216  m_inCmpRefViewIdcs.clear();
     4217  Bool allRefCmpLayersAvailFlag = true;
     4218
     4219  for( Int i = 0; i <= numCurCmpLIds - 1; i++ )
     4220  {     
     4221    m_inCmpRefViewIdcs.push_back( getVPS()->getViewOrderIdx( curCmpLIds[ i ] ));
     4222    if( !getVPS()->getCpPresentFlag( getVPS()->getVoiInVps( getViewIndex() ),  getVPS()->getVoiInVps( m_inCmpRefViewIdcs[ i ] ) ) )
     4223    {
     4224      m_cpAvailableFlag = false;
     4225    }
     4226    Bool refCmpCurLIdAvailFlag = false;
     4227    if( getVPS()->getViewCompLayerPresentFlag( m_inCmpRefViewIdcs[ i ], !getIsDepth() ) )
     4228    {
     4229      Int j = getVPS()->getLayerIdInVps( getVPS()->getViewCompLayerId( m_inCmpRefViewIdcs[ i ],  !getIsDepth() ) );
     4230      if  ( getVPS()->getDirectDependencyFlag( getVPS()->getLayerIdInVps( getLayerId() ) ,  j ) &&
     4231        getVPS()->getSubLayersVpsMaxMinus1( j ) >= getTemporalId()   &&
     4232        ( getTemporalId() == 0 || getVPS()->getMaxTidIlRefPicsPlus1( j , getVPS()->getLayerIdInVps( getLayerId() ) ) > getTemporalId() )       
     4233        )
     4234      {
     4235        refCmpCurLIdAvailFlag = true;
     4236      }
     4237    }
     4238    if( !refCmpCurLIdAvailFlag )
     4239    {
     4240      allRefCmpLayersAvailFlag = false;
     4241    }
     4242  }
     4243
     4244  if( !allRefCmpLayersAvailFlag )
     4245  {
     4246    m_inCmpPredAvailFlag = false;
     4247  } 
     4248  else
     4249  {
     4250    TComSps3dExtension* sps3dExt = getSPS()->getSps3dExtension();
     4251    if( !getIsDepth() )
     4252    {
     4253      m_inCmpPredAvailFlag = sps3dExt->getViewSynthesisPredFlag( getIsDepth() ) ||
     4254        sps3dExt->getDepthBasedBlkPartFlag( getIsDepth() ) ||
     4255        sps3dExt->getDepthRefinementFlag  ( getIsDepth() );                           
     4256    }
     4257    else
     4258    {
     4259      m_inCmpPredAvailFlag = sps3dExt->getIntraContourFlag( getIsDepth() ) ||
     4260        sps3dExt->getQtPredFlag( getIsDepth() ) ||
     4261        sps3dExt->getMpiFlag( getIsDepth() );                                 
     4262    }
     4263  }
     4264}
     4265
     4266Void TComSlice::checkInCompPredRefLayers()
     4267{
     4268  if ( getInCompPredFlag() )
     4269  {
     4270    for (Int i = 0; i < getNumCurCmpLIds(); i++ )
     4271    {
     4272      assert( getIvPic(!getIsDepth(), getInCmpRefViewIdcs( i ) ) != NULL );       
     4273      //  It is a requirement of bitstream conformance that there
     4274      //  is a picture in the DPB with PicOrderCntVal equal to the PicOrderCntVal of the current picture,
     4275      //  and a nuh_layer_id value equal to ViewCompLayerId[ inCmpRefViewIdcs[ i ] ][ !DepthFlag ].
     4276    }
     4277  }
     4278}
     4279
    41384280#endif
    41394281
  • branches/HTM-14.0-dev0/source/Lib/TLibCommon/TComSlice.h

    r1185 r1187  
    912912  Int         xGetDimBitOffset( Int j );
    913913  Void        xSetRefLayerFlags( Int currLayerId );
     914
    914915  // VPS EXTENSION 2 SYNTAX ELEMENTS
    915916#if H_3D
     
    10111012  Void    setVpsNonVuiExtensionLength( Int  val )                          { m_vpsNonVuiExtensionLength = val; }
    10121013  Int     getVpsNonVuiExtensionLength(  )                                  { return m_vpsNonVuiExtensionLength; }
    1013 
     1014 
     1015  // VPS Extension
    10141016  Void    setSplittingFlag( Bool val )                                     { m_splittingFlag = val;  }
    10151017  Bool    getSplittingFlag()                                               { return m_splittingFlag; }
     
    11541156  Void    initNumViews();
    11551157#if H_3D
    1156   Void   initViewCompLayer( )
    1157   {
    1158     assert( m_viewCompLayerId.size() == 0 && m_viewCompLayerPresentFlag.size() == 0  );
    1159     for( Int i = 0; i < getNumViews(); i++ )
    1160     {
    1161       m_viewCompLayerId         .push_back( std::vector<Int>(0)  );
    1162       m_viewCompLayerPresentFlag.push_back( std::vector<Bool>(0) );     
    1163 
    1164       for( Int depFlag = 0; depFlag  <=  1; depFlag++ )
    1165       {
    1166         Int iViewOIdx = getViewOIdxList( i );
    1167         Int layerId = -1;
    1168         for( Int j = 0; j  <=  getMaxLayersMinus1(); j++ )
    1169         {
    1170           Int jNuhLId = getLayerIdInNuh( j );
    1171           if( getVpsDepthFlag( jNuhLId ) == ( (Bool) depFlag )  &&  getViewOrderIdx( jNuhLId )  ==  iViewOIdx 
    1172             &&  getDependencyId( jNuhLId )  ==  0  &&  getAuxId( jNuhLId )  ==  0 )
    1173           {
    1174             layerId = jNuhLId;
    1175           }
    1176         }
    1177         m_viewCompLayerPresentFlag[ i ].push_back( layerId  !=  -1 );
    1178         m_viewCompLayerId         [ i ].push_back( layerId );       
    1179       }
    1180     }
    1181   };
    1182 
    1183 
     1158  Void   initViewCompLayer( );
    11841159  Int     getViewOIdxList( Int i )                                         { return m_viewOIdxList[i]; }
    11851160  std::vector<Int> getViewOIdxList( )                                               { return m_viewOIdxList; }
    11861161
    1187   Int     getVoiInVps( Int viewOIdx )                                     
    1188   {   
    1189     for ( Int i = 0; i < m_viewOIdxList.size(); i++ )
    1190     {
    1191       if  ( m_viewOIdxList[ i ] == viewOIdx )
    1192       {
    1193         return i;
    1194       }
    1195     }
    1196     assert( 0 );   
    1197     return -1;
    1198   };
     1162  Int     getVoiInVps( Int viewOIdx );;
    11991163
    12001164  Bool    getViewCompLayerPresentFlag (Int i, Bool d ) { return  m_viewCompLayerPresentFlag[ getVoiInVps(i) ][d]; }
     
    13491313
    13501314// Derived
    1351   Void deriveCpPresentFlag( )
    1352   {
    1353     for( Int nInVps = 0; nInVps < getNumViews(); nInVps++  )
    1354     {
    1355       for( Int mInVps = 0; mInVps < getNumViews(); mInVps++ )
    1356       {
    1357         m_cpPresentFlag[nInVps][mInVps] = 0;
    1358       }
    1359     }
    1360 
    1361    for( Int n = 1; n < getNumViews(); n++ )
    1362    {
    1363       Int iInVps = getVoiInVps(  getViewOIdxList( n ) );     
    1364       for( Int m = 0; m < getNumCp( iInVps ); m++ )
    1365       {
    1366          m_cpPresentFlag[ iInVps ][ getVoiInVps( getCpRefVoi( iInVps, m ) ) ] = 1;
    1367       }
    1368     }
    1369   }
     1315  Void deriveCpPresentFlag( );
    13701316
    13711317  Void setCpPresentFlag( Int i, Int m, Bool flag ) { m_cpPresentFlag[i][m] = flag; }
     
    24802426  Bool      m_bApplyDIS;
    24812427#if H_3D_IC
    2482   Int *m_aICEnableCandidate;
    2483   Int *m_aICEnableNum;
     2428  Int*      m_aICEnableCandidate;
     2429  Int*      m_aICEnableNum;
    24842430#endif
    24852431  Int       m_iDefaultRefViewIdx;
     
    29302876#if H_3D
    29312877  // 3D-HEVC tool parameters
    2932   Void deriveInCmpPredAndCpAvailFlag()
    2933   {
    2934     Int numCurCmpLIds = getIsDepth() ? 1 : getNumActiveRefLayerPics();
    2935     std::vector<Int> curCmpLIds;
    2936     if ( getIsDepth() )
    2937     {
    2938       curCmpLIds.push_back( getLayerId() );
    2939     }
    2940     else
    2941     {
    2942       for (Int i = 0; i < numCurCmpLIds; i++)
    2943       {
    2944         curCmpLIds.push_back( getRefPicLayerId( i ) );
    2945       }
    2946     }
    2947 
    2948     m_cpAvailableFlag = true;
    2949     m_inCmpRefViewIdcs.clear();
    2950     Bool allRefCmpLayersAvailFlag = true;
    2951 
    2952     for( Int i = 0; i <= numCurCmpLIds - 1; i++ )
    2953     {     
    2954       m_inCmpRefViewIdcs.push_back( getVPS()->getViewOrderIdx( curCmpLIds[ i ] ));
    2955       if( !getVPS()->getCpPresentFlag( getVPS()->getVoiInVps( getViewIndex() ),  getVPS()->getVoiInVps( m_inCmpRefViewIdcs[ i ] ) ) )
    2956       {
    2957         m_cpAvailableFlag = false;
    2958       }
    2959       Bool refCmpCurLIdAvailFlag = false;
    2960       if( getVPS()->getViewCompLayerPresentFlag( m_inCmpRefViewIdcs[ i ], !getIsDepth() ) )
    2961       {
    2962         Int j = getVPS()->getLayerIdInVps( getVPS()->getViewCompLayerId( m_inCmpRefViewIdcs[ i ],  !getIsDepth() ) );
    2963         if  ( getVPS()->getDirectDependencyFlag( getVPS()->getLayerIdInVps( getLayerId() ) ,  j ) &&
    2964           getVPS()->getSubLayersVpsMaxMinus1( j ) >= getTemporalId()   &&
    2965           ( getTemporalId() == 0 || getVPS()->getMaxTidIlRefPicsPlus1( j , getVPS()->getLayerIdInVps( getLayerId() ) ) > getTemporalId() )       
    2966           )
    2967         {
    2968           refCmpCurLIdAvailFlag = true;
    2969         }
    2970       }
    2971       if( !refCmpCurLIdAvailFlag )
    2972       {
    2973         allRefCmpLayersAvailFlag = false;
    2974       }
    2975     }
    2976 
    2977     if( !allRefCmpLayersAvailFlag )
    2978     {
    2979       m_inCmpPredAvailFlag = false;
    2980     } 
    2981     else
    2982     {
    2983       TComSps3dExtension* sps3dExt = getSPS()->getSps3dExtension();
    2984       if( !getIsDepth() )
    2985       {
    2986         m_inCmpPredAvailFlag = sps3dExt->getViewSynthesisPredFlag( getIsDepth() ) ||
    2987           sps3dExt->getDepthBasedBlkPartFlag( getIsDepth() ) ||
    2988           sps3dExt->getDepthRefinementFlag  ( getIsDepth() );                           
    2989       }
    2990       else
    2991       {
    2992         m_inCmpPredAvailFlag = sps3dExt->getIntraContourFlag( getIsDepth() ) ||
    2993           sps3dExt->getQtPredFlag( getIsDepth() ) ||
    2994           sps3dExt->getMpiFlag( getIsDepth() );                                 
    2995       }
    2996     } 
    2997   };
    2998 
    2999 
     2878  Void deriveInCmpPredAndCpAvailFlag();
    30002879  Void init3dToolParameters();   
    3001   Void checkInCompPredRefLayers()
    3002   {
    3003     if ( getInCompPredFlag() )
    3004     {
    3005       for (Int i = 0; i < getNumCurCmpLIds(); i++ )
    3006       {
    3007         assert( getIvPic(!getIsDepth(), getInCmpRefViewIdcs( i ) ) != NULL );       
    3008         //  It is a requirement of bitstream conformance that there
    3009         //  is a picture in the DPB with PicOrderCntVal equal to the PicOrderCntVal of the current picture,
    3010         //  and a nuh_layer_id value equal to ViewCompLayerId[ inCmpRefViewIdcs[ i ] ][ !DepthFlag ].
    3011       }
    3012     }
    3013   };
     2880  Void checkInCompPredRefLayers();;
    30142881
    30152882  Bool getIvMvPredFlag           ( ) { return m_ivMvPredFlag           ; };
  • branches/HTM-14.0-dev0/source/Lib/TLibCommon/TypeDef.h

    r1185 r1187  
    306306#define H_3D_DISABLE_CHROMA                    1
    307307#define H_3D_OUTPUT_ACTIVE_TOOLS               0
     308#define H_3D_REN_MAX_DEV_OUT                   0
    308309#endif
    309310
  • branches/HTM-14.0-dev0/source/Lib/TLibDecoder/TDecCAVLC.cpp

    r1185 r1187  
    23972397      if( rpcSlice->getSPS()->getChromaFormatIdc() != 0 )
    23982398      {
    2399       READ_FLAG(uiCode, "slice_sao_chroma_flag");  rpcSlice->setSaoEnabledFlagChroma((Bool)uiCode);
    2400     }
     2399        READ_FLAG(uiCode, "slice_sao_chroma_flag");  rpcSlice->setSaoEnabledFlagChroma((Bool)uiCode);
     2400      }
    24012401      else
    24022402      {
    24032403        rpcSlice->setSaoEnabledFlagChroma( false );
    24042404      }
    2405      
    24062405#else
    24072406      READ_FLAG(uiCode, "slice_sao_chroma_flag");  rpcSlice->setSaoEnabledFlagChroma((Bool)uiCode);
  • branches/HTM-14.0-dev0/source/Lib/TLibDecoder/TDecCu.cpp

    r1185 r1187  
    593593  UInt uiTPelY   = pcCU->getCUPelY() + g_auiRasterToPelY[ g_auiZscanToRaster[uiAbsPartIdx] ];
    594594  UInt uiBPelY   = uiTPelY + (g_uiMaxCUHeight>>uiDepth) - 1;
    595  
     595
    596596  UInt uiCurNumParts    = pcPic->getNumPartInCU() >> (uiDepth<<1);
    597597  TComSlice * pcSlice = pcCU->getPic()->getSlice(pcCU->getPic()->getCurrSliceIdx());
     
    601601    bBoundary = true;
    602602  }
    603  
     603
    604604  if( ( ( uiDepth < pcCU->getDepth( uiAbsPartIdx ) ) && ( uiDepth < g_uiMaxCUDepth - g_uiAddCUDepth ) ) || bBoundary )
    605605  {
     
    611611      uiLPelX = pcCU->getCUPelX() + g_auiRasterToPelX[ g_auiZscanToRaster[uiIdx] ];
    612612      uiTPelY = pcCU->getCUPelY() + g_auiRasterToPelY[ g_auiZscanToRaster[uiIdx] ];
    613      
     613
    614614      Bool binSlice = (pcCU->getSCUAddr()+uiIdx+uiQNumParts>pcSlice->getSliceSegmentCurStartCUAddr())&&(pcCU->getSCUAddr()+uiIdx<pcSlice->getSliceSegmentCurEndCUAddr());
    615615      if(binSlice&&( uiLPelX < pcSlice->getSPS()->getPicWidthInLumaSamples() ) && ( uiTPelY < pcSlice->getSPS()->getPicHeightInLumaSamples() ) )
     
    617617        xDecompressCU(pcCU, uiIdx, uiNextDepth );
    618618      }
    619      
     619
    620620      uiIdx += uiQNumParts;
    621621    }
     
    625625  // Residual reconstruction
    626626  m_ppcYuvResi[uiDepth]->clear();
    627  
     627
    628628  m_ppcCU[uiDepth]->copySubCU( pcCU, uiAbsPartIdx, uiDepth );
    629629
    630630  switch( m_ppcCU[uiDepth]->getPredictionMode(0) )
    631631  {
    632     case MODE_INTER:
     632  case MODE_INTER:
    633633#if H_3D_DBBP
    634       if( m_ppcCU[uiDepth]->getDBBPFlag(0) )
    635       {
    636         xReconInterDBBP( m_ppcCU[uiDepth], uiAbsPartIdx, uiDepth );
    637       }
    638       else
    639       {
     634    if( m_ppcCU[uiDepth]->getDBBPFlag(0) )
     635    {
     636      xReconInterDBBP( m_ppcCU[uiDepth], uiAbsPartIdx, uiDepth );
     637    }
     638    else
     639    {
    640640#endif
    641641#if H_3D_INTER_SDC
     
    647647      {
    648648#endif
    649       xReconInter( m_ppcCU[uiDepth], uiDepth );
     649        xReconInter( m_ppcCU[uiDepth], uiDepth );
    650650#if H_3D_INTER_SDC
    651651      }
    652652#endif
    653653#if H_3D_DBBP
    654       }
    655 #endif
    656       break;
    657     case MODE_INTRA:
     654    }
     655#endif
     656    break;
     657  case MODE_INTRA:
    658658#if H_3D
    659       if( m_ppcCU[uiDepth]->getDISFlag(0) )
    660       {
    661         xReconDIS( m_ppcCU[uiDepth], 0, uiDepth );
    662       }
     659    if( m_ppcCU[uiDepth]->getDISFlag(0) )
     660    {
     661      xReconDIS( m_ppcCU[uiDepth], 0, uiDepth );
     662    }
    663663#if H_3D_DIM_SDC
    664       else if( m_ppcCU[uiDepth]->getSDCFlag(0) )
    665       {
    666         xReconIntraSDC( m_ppcCU[uiDepth], 0, uiDepth );
    667       }
    668 #endif
    669       else
     664    else if( m_ppcCU[uiDepth]->getSDCFlag(0) )
     665    {
     666      xReconIntraSDC( m_ppcCU[uiDepth], 0, uiDepth );
     667    }
     668#endif
     669    else
    670670#endif
    671671      xReconIntraQT( m_ppcCU[uiDepth], uiDepth );
    672       break;
    673     default:
    674       assert(0);
    675       break;
     672    break;
     673  default:
     674    assert(0);
     675    break;
    676676  }
    677677  if ( m_ppcCU[uiDepth]->isLosslessCoded(0) && (m_ppcCU[uiDepth]->getIPCMFlag(0) == false))
     
    679679    xFillPCMBuffer(m_ppcCU[uiDepth], uiDepth);
    680680  }
    681  
     681
    682682  xCopyToPic( m_ppcCU[uiDepth], pcPic, uiAbsPartIdx, uiDepth );
    683683}
     
    847847  AOF(bValidMask);
    848848 
    849   DBBPTmpData* pDBBPTmpData = pcCU->getDBBPTmpData();
     849  DbbpTmpData* pDBBPTmpData = pcCU->getDBBPTmpData();
    850850  TComYuv* apSegPredYuv[2] = { m_ppcYuvReco[uiDepth], m_ppcYuvRecoDBBP[uiDepth] };
    851851 
  • branches/HTM-14.0-dev0/source/Lib/TLibDecoder/TDecEntropy.cpp

    r1186 r1187  
    220220#endif
    221221#if H_3D_SPIVMP
    222   Bool bSPIVMPFlag[MRG_MAX_NUM_CANDS_MEM];
    223   TComMvField*  pcMvFieldSP;
    224   UChar* puhInterDirSP;
    225   pcMvFieldSP = new TComMvField[pcCU->getPic()->getPicSym()->getNumPartition()*2];
    226   puhInterDirSP = new UChar[pcCU->getPic()->getPicSym()->getNumPartition()];
     222  Bool bSPIVMPFlag[MRG_MAX_NUM_CANDS_MEM];     
     223  TComMvField*  pcMvFieldSP = new TComMvField[pcCU->getPic()->getPicSym()->getNumPartition()*2];
     224  UChar* puhInterDirSP = new UChar[pcCU->getPic()->getPicSym()->getNumPartition()];
    227225#endif
    228226  for ( UInt ui = 0; ui < pcCU->getSlice()->getMaxNumMergeCand(); ui++ )
     
    489487        }
    490488      }
    491 #if H_3D_ARP
    492       decodeARPW  ( pcCU, uiAbsPartIdx, uiDepth );
    493 #endif
    494 #if H_3D_IC
    495       decodeICFlag( pcCU, uiAbsPartIdx, uiDepth );
    496 #endif
    497489    }
    498490    if ( (pcCU->getInterDir(uiSubPartIdx) == 3) && pcSubCU->isBipredRestriction(uiPartIdx) )
     
    735727      if (pcCU->getSlice()->getSPS()->getChromaFormatIdc() != 0 )     
    736728      {
    737       if( bFirstCbfOfCU || pcCU->getCbf( uiAbsPartIdx, TEXT_CHROMA_U, uiTrDepth - 1 ) )
    738       {
    739         m_pcEntropyDecoderIf->parseQtCbf( pcCU, uiAbsPartIdx, TEXT_CHROMA_U, uiTrDepth, uiDepth );
    740       }
    741       if( bFirstCbfOfCU || pcCU->getCbf( uiAbsPartIdx, TEXT_CHROMA_V, uiTrDepth - 1 ) )
    742       {
    743         m_pcEntropyDecoderIf->parseQtCbf( pcCU, uiAbsPartIdx, TEXT_CHROMA_V, uiTrDepth, uiDepth );
    744       }
    745     }
    746     else
    747     {
     729        if( bFirstCbfOfCU || pcCU->getCbf( uiAbsPartIdx, TEXT_CHROMA_U, uiTrDepth - 1 ) )
     730        {
     731          m_pcEntropyDecoderIf->parseQtCbf( pcCU, uiAbsPartIdx, TEXT_CHROMA_U, uiTrDepth, uiDepth );
     732        }
     733        if( bFirstCbfOfCU || pcCU->getCbf( uiAbsPartIdx, TEXT_CHROMA_V, uiTrDepth - 1 ) )
     734        {
     735          m_pcEntropyDecoderIf->parseQtCbf( pcCU, uiAbsPartIdx, TEXT_CHROMA_V, uiTrDepth, uiDepth );
     736        }
     737      }
     738      else
     739      {
    748740        if( bFirstCbfOfCU || pcCU->getCbf( uiAbsPartIdx, TEXT_CHROMA_U, uiTrDepth - 1 ) )
    749741        {
  • branches/HTM-14.0-dev0/source/Lib/TLibDecoder/TDecSbac.cpp

    r1185 r1187  
    446446  UInt uiSymbol;
    447447
    448     m_pcTDecBinIf->decodeBinTrm(uiSymbol);
     448  m_pcTDecBinIf->decodeBinTrm(uiSymbol);
    449449
    450450#if H_MV_ENC_DEC_TRAC
    451       DTRACE_CU("pcm_flag", uiSymbol)
    452 #endif
    453     if (uiSymbol)
    454     {
     451  DTRACE_CU("pcm_flag", uiSymbol)
     452#endif
     453  if (uiSymbol)
     454  {
    455455    Bool bIpcmFlag = true;
    456456
     
    485485      piPCMSample += uiWidth;
    486486    }
    487 
    488 
    489487#if H_3D_DISABLE_CHROMA
    490488    if( pcCU->getSlice()->getSPS()->getChromaFormatIdc() != 0 )
    491489    {   
    492490#endif
    493     piPCMSample = pcCU->getPCMSampleCb() + uiChromaOffset;
    494     uiWidth = pcCU->getWidth(uiAbsPartIdx)/2;
    495     uiHeight = pcCU->getHeight(uiAbsPartIdx)/2;
    496     uiSampleBits = pcCU->getSlice()->getSPS()->getPCMBitDepthChroma();
    497 
    498     for(uiY = 0; uiY < uiHeight; uiY++)
    499     {
    500       for(uiX = 0; uiX < uiWidth; uiX++)
    501       {
    502         UInt uiSample;
    503         m_pcTDecBinIf->xReadPCMCode(uiSampleBits, uiSample);
    504         piPCMSample[uiX] = uiSample;
    505       }
    506       piPCMSample += uiWidth;
    507     }
    508 
    509     piPCMSample = pcCU->getPCMSampleCr() + uiChromaOffset;
    510     uiWidth = pcCU->getWidth(uiAbsPartIdx)/2;
    511     uiHeight = pcCU->getHeight(uiAbsPartIdx)/2;
    512     uiSampleBits = pcCU->getSlice()->getSPS()->getPCMBitDepthChroma();
    513 
    514     for(uiY = 0; uiY < uiHeight; uiY++)
    515     {
    516       for(uiX = 0; uiX < uiWidth; uiX++)
    517       {
    518         UInt uiSample;
    519         m_pcTDecBinIf->xReadPCMCode(uiSampleBits, uiSample);
    520         piPCMSample[uiX] = uiSample;
    521       }
    522       piPCMSample += uiWidth;
    523     }
     491      piPCMSample = pcCU->getPCMSampleCb() + uiChromaOffset;
     492      uiWidth = pcCU->getWidth(uiAbsPartIdx)/2;
     493      uiHeight = pcCU->getHeight(uiAbsPartIdx)/2;
     494      uiSampleBits = pcCU->getSlice()->getSPS()->getPCMBitDepthChroma();
     495
     496      for(uiY = 0; uiY < uiHeight; uiY++)
     497      {
     498        for(uiX = 0; uiX < uiWidth; uiX++)
     499        {
     500          UInt uiSample;
     501          m_pcTDecBinIf->xReadPCMCode(uiSampleBits, uiSample);
     502          piPCMSample[uiX] = uiSample;
     503        }
     504        piPCMSample += uiWidth;
     505      }
     506
     507      piPCMSample = pcCU->getPCMSampleCr() + uiChromaOffset;
     508      uiWidth = pcCU->getWidth(uiAbsPartIdx)/2;
     509      uiHeight = pcCU->getHeight(uiAbsPartIdx)/2;
     510      uiSampleBits = pcCU->getSlice()->getSPS()->getPCMBitDepthChroma();
     511
     512      for(uiY = 0; uiY < uiHeight; uiY++)
     513      {
     514        for(uiX = 0; uiX < uiWidth; uiX++)
     515        {
     516          UInt uiSample;
     517          m_pcTDecBinIf->xReadPCMCode(uiSampleBits, uiSample);
     518          piPCMSample[uiX] = uiSample;
     519        }
     520        piPCMSample += uiWidth;
     521      }
    524522#if H_3D_DISABLE_CHROMA
    525523    }
    526524#endif
    527 
    528 
    529525    m_pcTDecBinIf->start();
    530526  }
     
    707703#if H_3D_QTLPC
    708704  Bool bParseSplitFlag    = true;
    709 
    710  
    711705  Bool    bLimQtPredFlag = pcCU->getPic()->getSlice(0)->getQtPredFlag();
    712706  TComPic *pcTexture      = pcCU->getSlice()->getTexturePic();
     
    745739#endif
    746740  pcCU->setDepthSubParts( uiDepth + uiSymbol, uiAbsPartIdx );
    747  
     741
    748742  return;
    749743}
     
    762756#if H_3D_QTLPC
    763757  Bool bParsePartSize    = true;
    764  
     758
    765759  Bool    bLimQtPredFlag = pcCU->getPic()->getSlice(0)->getQtPredFlag();
    766760  TComPic *pcTexture     = pcCU->getSlice()->getTexturePic();
     
    794788#endif
    795789
    796  
     790
    797791  if ( pcCU->isIntra( uiAbsPartIdx ) )
    798792  {
     
    801795    {
    802796#endif
    803      uiSymbol = 1;
     797      uiSymbol = 1;
    804798      if( uiDepth == g_uiMaxCUDepth - g_uiAddCUDepth )
    805799      {
     
    834828      {
    835829#endif
    836       UInt uiMaxNumBits = 2;
    837       if( uiDepth == g_uiMaxCUDepth - g_uiAddCUDepth && !( (g_uiMaxCUWidth>>uiDepth) == 8 && (g_uiMaxCUHeight>>uiDepth) == 8 ) )
    838       {
    839         uiMaxNumBits ++;
    840       }
    841       for ( UInt ui = 0; ui < uiMaxNumBits; ui++ )
    842       {
    843         m_pcTDecBinIf->decodeBin( uiSymbol, m_cCUPartSizeSCModel.get( 0, 0, ui) );
    844         if ( uiSymbol )
    845         {
    846           break;
    847         }
    848         uiMode++;
    849       }
    850       eMode = (PartSize) uiMode;
    851       if ( pcCU->getSlice()->getSPS()->getAMPAcc( uiDepth ) )
    852       {
    853         if (eMode == SIZE_2NxN)
    854         {
    855         m_pcTDecBinIf->decodeBin(uiSymbol, m_cCUPartSizeSCModel.get( 0, 0, 3 ));
    856           if (uiSymbol == 0)
     830        UInt uiMaxNumBits = 2;
     831        if( uiDepth == g_uiMaxCUDepth - g_uiAddCUDepth && !( (g_uiMaxCUWidth>>uiDepth) == 8 && (g_uiMaxCUHeight>>uiDepth) == 8 ) )
     832        {
     833          uiMaxNumBits ++;
     834        }
     835        for ( UInt ui = 0; ui < uiMaxNumBits; ui++ )
     836        {
     837          m_pcTDecBinIf->decodeBin( uiSymbol, m_cCUPartSizeSCModel.get( 0, 0, ui) );
     838          if ( uiSymbol )
    857839          {
    858             m_pcTDecBinIf->decodeBinEP(uiSymbol);
    859             eMode = (uiSymbol == 0? SIZE_2NxnU : SIZE_2NxnD);
     840            break;
    860841          }
    861         }
    862         else if (eMode == SIZE_Nx2N)
    863         {
    864         m_pcTDecBinIf->decodeBin(uiSymbol, m_cCUPartSizeSCModel.get( 0, 0, 3 ));
    865           if (uiSymbol == 0)
     842          uiMode++;
     843        }
     844        eMode = (PartSize) uiMode;
     845        if ( pcCU->getSlice()->getSPS()->getAMPAcc( uiDepth ) )
     846        {
     847          if (eMode == SIZE_2NxN)
    866848          {
    867             m_pcTDecBinIf->decodeBinEP(uiSymbol);
    868             eMode = (uiSymbol == 0? SIZE_nLx2N : SIZE_nRx2N);
     849            m_pcTDecBinIf->decodeBin(uiSymbol, m_cCUPartSizeSCModel.get( 0, 0, 3 ));
     850            if (uiSymbol == 0)
     851            {
     852              m_pcTDecBinIf->decodeBinEP(uiSymbol);
     853              eMode = (uiSymbol == 0? SIZE_2NxnU : SIZE_2NxnD);
     854            }
    869855          }
    870         }
    871       }
     856          else if (eMode == SIZE_Nx2N)
     857          {
     858            m_pcTDecBinIf->decodeBin(uiSymbol, m_cCUPartSizeSCModel.get( 0, 0, 3 ));
     859            if (uiSymbol == 0)
     860            {
     861              m_pcTDecBinIf->decodeBinEP(uiSymbol);
     862              eMode = (uiSymbol == 0? SIZE_nLx2N : SIZE_nRx2N);
     863            }
     864          }
     865        }
    872866#if H_3D_QTLPC
    873867      }
     
    995989    {
    996990#endif
    997     m_pcTDecBinIf->decodeBin( symbol, m_cCUIntraPredSCModel.get( 0, 0, 0) );
    998     mpmPred[j] = symbol;
     991      m_pcTDecBinIf->decodeBin( symbol, m_cCUIntraPredSCModel.get( 0, 0, 0) );
     992      mpmPred[j] = symbol;
    999993#if H_MV_ENC_DEC_TRAC         
    1000     DTRACE_CU("prev_intra_luma_pred_flag", symbol)
     994      DTRACE_CU("prev_intra_luma_pred_flag", symbol)
    1001995#endif
    1002996#if H_3D_DIM
     
    10101004    {
    10111005#endif
    1012     Int preds[3] = {-1, -1, -1};
    1013     Int predNum = pcCU->getIntraDirLumaPredictor(absPartIdx+partOffset*j, preds); 
    1014     if (mpmPred[j])
    1015     {
    1016       m_pcTDecBinIf->decodeBinEP( symbol );
    1017       if (symbol)
     1006      Int preds[3] = {-1, -1, -1};
     1007      Int predNum = pcCU->getIntraDirLumaPredictor(absPartIdx+partOffset*j, preds); 
     1008      if (mpmPred[j])
    10181009      {
    10191010        m_pcTDecBinIf->decodeBinEP( symbol );
    1020         symbol++;
    1021       }
     1011        if (symbol)
     1012        {
     1013          m_pcTDecBinIf->decodeBinEP( symbol );
     1014          symbol++;
     1015        }
    10221016#if H_MV_ENC_DEC_TRAC         
    1023       DTRACE_CU("mpm_idx", symbol)
    1024 #endif
    1025       intraPredMode = preds[symbol];
    1026     }
    1027     else
    1028     {
    1029       m_pcTDecBinIf->decodeBinsEP( symbol, 5 );
    1030       intraPredMode = symbol;
     1017        DTRACE_CU("mpm_idx", symbol)
     1018#endif
     1019          intraPredMode = preds[symbol];
     1020      }
     1021      else
     1022      {
     1023        m_pcTDecBinIf->decodeBinsEP( symbol, 5 );
     1024        intraPredMode = symbol;
    10311025#if H_MV_ENC_DEC_TRAC         
    1032       DTRACE_CU("rem_intra_luma_pred_mode", symbol)
     1026        DTRACE_CU("rem_intra_luma_pred_mode", symbol)
    10331027#endif       
    1034       //postponed sorting of MPMs (only in remaining branch)
    1035       if (preds[0] > preds[1])
    1036       {
    1037         std::swap(preds[0], preds[1]);
    1038       }
    1039       if (preds[0] > preds[2])
    1040       {
    1041         std::swap(preds[0], preds[2]);
    1042       }
    1043       if (preds[1] > preds[2])
    1044       {
    1045         std::swap(preds[1], preds[2]);
    1046       }
    1047       for ( Int i = 0; i < predNum; i++ )
    1048       {
    1049         intraPredMode += ( intraPredMode >= preds[i] );
    1050       }
    1051     }
    1052     pcCU->setLumaIntraDirSubParts( (UChar)intraPredMode, absPartIdx+partOffset*j, depth );
     1028          //postponed sorting of MPMs (only in remaining branch)
     1029          if (preds[0] > preds[1])
     1030          {
     1031            std::swap(preds[0], preds[1]);
     1032          }
     1033          if (preds[0] > preds[2])
     1034          {
     1035            std::swap(preds[0], preds[2]);
     1036          }
     1037          if (preds[1] > preds[2])
     1038          {
     1039            std::swap(preds[1], preds[2]);
     1040          }
     1041          for ( Int i = 0; i < predNum; i++ )
     1042          {
     1043            intraPredMode += ( intraPredMode >= preds[i] );
     1044          }
     1045      }
     1046      pcCU->setLumaIntraDirSubParts( (UChar)intraPredMode, absPartIdx+partOffset*j, depth );
    10531047#if H_3D_DIM
    10541048    }
     
    10681062    DTRACE_CU("intra_chroma_pred_mode", uiSymbol )
    10691063#endif       
    1070     uiSymbol = DM_CHROMA_IDX;
     1064      uiSymbol = DM_CHROMA_IDX;
    10711065  }
    10721066  else
     
    10781072      DTRACE_CU("intra_chroma_pred_mode", uiIPredMode )
    10791073#endif       
    1080       UInt uiAllowedChromaDir[ NUM_CHROMA_MODE ];
     1074        UInt uiAllowedChromaDir[ NUM_CHROMA_MODE ];
    10811075      pcCU->getAllowedChromaDir( uiAbsPartIdx, uiAllowedChromaDir );
    10821076      uiSymbol = uiAllowedChromaDir[ uiIPredMode ];
  • branches/HTM-14.0-dev0/source/Lib/TLibDecoder/TDecTop.cpp

    r1185 r1187  
    290290    }
    291291  } 
    292 
    293 
    294292}
    295293
     
    349347}
    350348#endif
     349
    351350TDecTop::TDecTop()
    352351{
     
    11971196#if  H_3D_TMVP
    11981197    if(pcSlice->getLayerId())
     1198    {
    11991199      pcSlice->generateAlterRefforTMVP();
     1200    }
    12001201#endif
    12011202  }
     
    16501651}
    16511652
    1652 #if H_MV
    16531653Void TDecTop::xCeckNoClrasOutput()
    16541654{
     
    16841684  return allRefLayersInitilizedFlag;
    16851685}
     1686
     1687#if H_3D
     1688Void TDecTop::setProfileIdc()
     1689{
     1690  if (m_targetOptLayerSetIdx != -1 )
     1691  {   
     1692    TComVPS* vps = getPrefetchedVPS();
     1693    Int lsIdx = vps->olsIdxToLsIdx( m_targetOptLayerSetIdx );
     1694    Int lIdx = -1;
     1695    for (Int j = 0; j < vps->getNumLayersInIdList( lsIdx ); j++ )
     1696    {
     1697      if ( vps->getLayerSetLayerIdList( lsIdx, j ) == getLayerId() )
     1698      {
     1699        lIdx = j;
     1700        break;
     1701      }       
     1702    }
     1703    assert( lIdx != -1 );
     1704
     1705    Int profileIdc = vps->getPTL( vps->getProfileTierLevelIdx( m_targetOptLayerSetIdx, lIdx ) )->getGeneralPTL()->getProfileIdc();
     1706    assert( profileIdc == 1 || profileIdc == 6 || profileIdc == 8 );
     1707    m_profileIdc = profileIdc;   
     1708  };
     1709}
    16861710#endif
    16871711#endif
  • branches/HTM-14.0-dev0/source/Lib/TLibDecoder/TDecTop.h

    r1185 r1187  
    301301  Void                    setCamParsCollector( CamParsCollector* pcCamParsCollector ) { m_pcCamParsCollector = pcCamParsCollector; }
    302302
    303   Void                    setProfileIdc()
    304   {       
    305     if (m_targetOptLayerSetIdx != -1 )
    306     {   
    307       TComVPS* vps = getPrefetchedVPS();
    308       Int lsIdx = vps->olsIdxToLsIdx( m_targetOptLayerSetIdx );
    309       Int lIdx = -1;
    310       for (Int j = 0; j < vps->getNumLayersInIdList( lsIdx ); j++ )
    311       {
    312         if ( vps->getLayerSetLayerIdList( lsIdx, j ) == getLayerId() )
    313         {
    314           lIdx = j;
    315           break;
    316         }       
    317       }
    318       assert( lIdx != -1 );
    319 
    320       Int profileIdc = vps->getPTL( vps->getProfileTierLevelIdx( m_targetOptLayerSetIdx, lIdx ) )->getGeneralPTL()->getProfileIdc();
    321       assert( profileIdc == 1 || profileIdc == 6 || profileIdc == 8 );
    322       m_profileIdc = profileIdc;   
    323     };
    324   }
     303  Void                    setProfileIdc();
    325304  Bool                    decProcAnnexI()           { assert( m_profileIdc != -1 ); return ( m_profileIdc == 8); }   
    326305#endif
  • branches/HTM-14.0-dev0/source/Lib/TLibEncoder/TEncCu.cpp

    r1186 r1187  
    541541        TComDataCU* pcTextureCU = pcTexture->getCU( rpcBestCU->getAddr() ); //Corresponding texture LCU
    542542        UInt uiCUIdx            = rpcBestCU->getZorderIdxInCU();
    543         assert(pcTextureCU->getDepth(uiCUIdx) >= uiDepth); //Depth cannot be more partitionned than the texture.
     543        assert(pcTextureCU->getDepth(uiCUIdx) >= uiDepth); //Depth cannot be more partitioned than the texture.
    544544        if (pcTextureCU->getDepth(uiCUIdx) > uiDepth || pcTextureCU->getPartitionSize(uiCUIdx) == SIZE_NxN) //Texture was split.
    545545        {
     
    556556          {
    557557            if(pcTextureCU->getPartitionSize(uiCUIdx)==SIZE_2NxN || pcTextureCU->getPartitionSize(uiCUIdx)==SIZE_2NxnU|| pcTextureCU->getPartitionSize(uiCUIdx)==SIZE_2NxnD)
     558            {
    558559              bTry2NxN  = true;
     560            }
    559561            else
     562            {
    560563              bTryNx2N  = true;
     564            }
    561565          }
    562566        }
     
    592596#endif
    593597#if H_3D_NBDV_REF
    594           if( rpcTempCU->getSlice()->getDepthRefinementFlag() )
    595             rpcTempCU->getDisMvpCandNBDV(&DvInfo, true);
    596           else
     598            if( rpcTempCU->getSlice()->getDepthRefinementFlag() )
     599            {
     600              rpcTempCU->getDisMvpCandNBDV(&DvInfo, true);
     601            }
     602            else
    597603#endif
    598             rpcTempCU->getDisMvpCandNBDV(&DvInfo);
    599 
     604            {
     605              rpcTempCU->getDisMvpCandNBDV(&DvInfo);
     606            }
    600607#if H_3D_IV_MERGE
    601608          }
     
    624631          Bool bICFlag = uiICId ? true : false;
    625632#endif
    626         // 2Nx2N
    627         if(m_pcEncCfg->getUseEarlySkipDetection())
    628         {
     633          // 2Nx2N
     634          if(m_pcEncCfg->getUseEarlySkipDetection())
     635          {
     636#if H_3D_IC
     637            rpcTempCU->setICFlagSubParts(bICFlag, 0, 0, uiDepth);
     638#endif
     639#if  H_3D_FAST_TEXTURE_ENCODING
     640            xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_2Nx2N, bFMD );  rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode  );//by Competition for inter_2Nx2N
     641#else
     642            xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_2Nx2N );
     643            rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode );//by Competition for inter_2Nx2N
     644#endif
     645#if H_3D_VSP
     646            rpcTempCU->setDvInfoSubParts(DvInfo, 0, uiDepth);
     647#endif
     648          }
     649          // SKIP
    629650#if H_3D_IC
    630651          rpcTempCU->setICFlagSubParts(bICFlag, 0, 0, uiDepth);
    631652#endif
     653          xCheckRDCostMerge2Nx2N( rpcBestCU, rpcTempCU, &earlyDetectionSkipMode );//by Merge for inter_2Nx2N
    632654#if  H_3D_FAST_TEXTURE_ENCODING
    633           xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_2Nx2N, bFMD );  rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode  );//by Competition for inter_2Nx2N
    634 #else
    635           xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_2Nx2N );
    636           rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode );//by Competition for inter_2Nx2N
    637 #endif
     655          bFMD = bIVFMerge && rpcBestCU->isSkipped(0);
     656#endif
     657          rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode );
    638658#if H_3D_VSP
    639659          rpcTempCU->setDvInfoSubParts(DvInfo, 0, uiDepth);
    640660#endif
    641         }
    642         // SKIP
    643 #if H_3D_IC
    644         rpcTempCU->setICFlagSubParts(bICFlag, 0, 0, uiDepth);
    645 #endif
    646         xCheckRDCostMerge2Nx2N( rpcBestCU, rpcTempCU, &earlyDetectionSkipMode );//by Merge for inter_2Nx2N
    647 #if  H_3D_FAST_TEXTURE_ENCODING
    648         bFMD = bIVFMerge && rpcBestCU->isSkipped(0);
    649 #endif
    650         rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode );
    651 #if H_3D_VSP
    652         rpcTempCU->setDvInfoSubParts(DvInfo, 0, uiDepth);
    653 #endif
    654 
    655         if(!m_pcEncCfg->getUseEarlySkipDetection())
    656         {
    657           // 2Nx2N, NxN
     661
     662          if(!m_pcEncCfg->getUseEarlySkipDetection())
     663          {
     664            // 2Nx2N, NxN
    658665#if H_3D_IC
    659666            rpcTempCU->setICFlagSubParts(bICFlag, 0, 0, uiDepth);
     
    662669            xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_2Nx2N, bFMD );  rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode );
    663670#else
    664           xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_2Nx2N );
    665           rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode );
     671            xCheckRDCostInter( rpcBestCU, rpcTempCU, SIZE_2Nx2N );
     672            rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode );
    666673#endif
    667674#if H_3D_VSP
    668675            rpcTempCU->setDvInfoSubParts(DvInfo, 0, uiDepth);
    669676#endif
    670          
     677
    671678#if H_3D_DBBP
    672           if( rpcTempCU->getSlice()->getDepthBasedBlkPartFlag() && rpcTempCU->getSlice()->getDefaultRefViewIdxAvailableFlag() )
    673           {
    674             xCheckRDCostInterDBBP( rpcBestCU, rpcTempCU, false );
    675             rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode  );
     679            if( rpcTempCU->getSlice()->getDepthBasedBlkPartFlag() && rpcTempCU->getSlice()->getDefaultRefViewIdxAvailableFlag() )
     680            {
     681              xCheckRDCostInterDBBP( rpcBestCU, rpcTempCU, false );
     682              rpcTempCU->initEstData( uiDepth, iQP, bIsLosslessMode  );
    676683#if H_3D_VSP
    677             rpcTempCU->setDvInfoSubParts(DvInfo, 0, uiDepth);
    678 #endif
    679           }
    680 #endif
    681          
     684              rpcTempCU->setDvInfoSubParts(DvInfo, 0, uiDepth);
     685#endif
     686            }
     687#endif
    682688            if(m_pcEncCfg->getUseCbfFastMode())
    683689            {
    684690              doNotBlockPu = rpcBestCU->getQtRootCbf( 0 ) != 0;
    685691            }
    686         }
     692          }
    687693#if H_3D_IC
    688694        }
     
    17711777  Bool bICFlag = rpcTempCU->getICFlag( 0 );
    17721778#endif
    1773 #if H_3D_VSO // M1  //nececcary here?
     1779#if H_3D_VSO // M1  //necessary here?
    17741780  if( m_pcRdCost->getUseRenModel() )
    17751781  {
     
    18961902    {     
    18971903#if H_3D_IC
    1898         if( rpcTempCU->getSlice()->getApplyIC() && rpcTempCU->getSlice()->getIcSkipParseFlag() )
     1904      if( rpcTempCU->getSlice()->getApplyIC() && rpcTempCU->getSlice()->getIcSkipParseFlag() )
     1905      {
     1906        if( bICFlag && uiMergeCand == 0 )
    18991907        {
    1900           if( bICFlag && uiMergeCand == 0 )
    1901           {
    1902             continue;
    1903           }
     1908          continue;
    19041909        }
    1905 #endif
    1906         if(!(uiNoResidual==1 && mergeCandBuffer[uiMergeCand]==1))
    1907         {
     1910      }
     1911#endif
     1912      if(!(uiNoResidual==1 && mergeCandBuffer[uiMergeCand]==1))
     1913      {
    19081914        if( !(bestIsSkip && uiNoResidual == 0) )
    19091915        {
     
    19441950#if H_3D_VSP
    19451951          {
    1946           if ( vspFlag[uiMergeCand] )
    1947           {
    1948             UInt partAddr;
    1949             Int vspSize;
    1950             Int width, height;
    1951             rpcTempCU->getPartIndexAndSize( 0, partAddr, width, height );
    1952             if( uhInterDirNeighbours[ uiMergeCand ] & 0x01 )
     1952            if ( vspFlag[uiMergeCand] )
    19531953            {
    1954               rpcTempCU->setMvFieldPUForVSP( rpcTempCU, partAddr, width, height, REF_PIC_LIST_0, cMvFieldNeighbours[ 2*uiMergeCand + 0 ].getRefIdx(), vspSize );
    1955               rpcTempCU->setVSPFlag( partAddr, vspSize );
     1954              UInt partAddr;
     1955              Int vspSize;
     1956              Int width, height;
     1957              rpcTempCU->getPartIndexAndSize( 0, partAddr, width, height );
     1958              if( uhInterDirNeighbours[ uiMergeCand ] & 0x01 )
     1959              {
     1960                rpcTempCU->setMvFieldPUForVSP( rpcTempCU, partAddr, width, height, REF_PIC_LIST_0, cMvFieldNeighbours[ 2*uiMergeCand + 0 ].getRefIdx(), vspSize );
     1961                rpcTempCU->setVSPFlag( partAddr, vspSize );
     1962              }
     1963              else
     1964              {
     1965                rpcTempCU->getCUMvField( REF_PIC_LIST_0 )->setAllMvField( cMvFieldNeighbours[0 + 2*uiMergeCand], SIZE_2Nx2N, 0, 0 ); // interprets depth relative to rpcTempCU level
     1966              }
     1967              if( uhInterDirNeighbours[ uiMergeCand ] & 0x02 )
     1968              {
     1969                rpcTempCU->setMvFieldPUForVSP( rpcTempCU, partAddr, width, height, REF_PIC_LIST_1 , cMvFieldNeighbours[ 2*uiMergeCand + 1 ].getRefIdx(), vspSize );
     1970                rpcTempCU->setVSPFlag( partAddr, vspSize );
     1971              }
     1972              else
     1973              {
     1974                rpcTempCU->getCUMvField( REF_PIC_LIST_1 )->setAllMvField( cMvFieldNeighbours[1 + 2*uiMergeCand], SIZE_2Nx2N, 0, 0 ); // interprets depth relative to rpcTempCU level
     1975              }
     1976              rpcTempCU->setInterDirSubParts( uhInterDirNeighbours[uiMergeCand], 0, 0, uhDepth ); // interprets depth relative to LCU level
    19561977            }
    19571978            else
    19581979            {
     1980#endif
     1981              rpcTempCU->setInterDirSubParts( uhInterDirNeighbours[uiMergeCand], 0, 0, uhDepth ); // interprets depth relative to LCU level
    19591982              rpcTempCU->getCUMvField( REF_PIC_LIST_0 )->setAllMvField( cMvFieldNeighbours[0 + 2*uiMergeCand], SIZE_2Nx2N, 0, 0 ); // interprets depth relative to rpcTempCU level
     1983              rpcTempCU->getCUMvField( REF_PIC_LIST_1 )->setAllMvField( cMvFieldNeighbours[1 + 2*uiMergeCand], SIZE_2Nx2N, 0, 0 ); // interprets depth relative to rpcTempCU level
     1984#if H_3D_VSP
    19601985            }
    1961             if( uhInterDirNeighbours[ uiMergeCand ] & 0x02 )
    1962             {
    1963               rpcTempCU->setMvFieldPUForVSP( rpcTempCU, partAddr, width, height, REF_PIC_LIST_1 , cMvFieldNeighbours[ 2*uiMergeCand + 1 ].getRefIdx(), vspSize );
    1964               rpcTempCU->setVSPFlag( partAddr, vspSize );
    1965             }
    1966             else
    1967             {
    1968               rpcTempCU->getCUMvField( REF_PIC_LIST_1 )->setAllMvField( cMvFieldNeighbours[1 + 2*uiMergeCand], SIZE_2Nx2N, 0, 0 ); // interprets depth relative to rpcTempCU level
    1969             }
    1970             rpcTempCU->setInterDirSubParts( uhInterDirNeighbours[uiMergeCand], 0, 0, uhDepth ); // interprets depth relative to LCU level
    19711986          }
    1972           else
     1987#endif
     1988          // do MC
     1989          m_pcPredSearch->motionCompensation ( rpcTempCU, m_ppcPredYuvTemp[uhDepth] );
     1990          // estimate residual and encode everything
     1991#if H_3D_VSO //M2
     1992          if( m_pcRdCost->getUseRenModel() )
     1993          { //Reset
     1994            UInt  uiWidth     = m_ppcOrigYuv[uhDepth]->getWidth    ();
     1995            UInt  uiHeight    = m_ppcOrigYuv[uhDepth]->getHeight   ();
     1996            Pel*  piSrc       = m_ppcOrigYuv[uhDepth]->getLumaAddr ();
     1997            UInt  uiSrcStride = m_ppcOrigYuv[uhDepth]->getStride   ();
     1998            m_pcRdCost->setRenModelData( rpcTempCU, 0, piSrc, uiSrcStride, uiWidth, uiHeight );
     1999          }
     2000#endif
     2001          m_pcPredSearch->encodeResAndCalcRdInterCU( rpcTempCU,
     2002            m_ppcOrigYuv    [uhDepth],
     2003            m_ppcPredYuvTemp[uhDepth],
     2004            m_ppcResiYuvTemp[uhDepth],
     2005            m_ppcResiYuvBest[uhDepth],
     2006            m_ppcRecoYuvTemp[uhDepth],
     2007            (uiNoResidual? true:false));
     2008
     2009
     2010          if ( uiNoResidual == 0 && rpcTempCU->getQtRootCbf(0) == 0 )
    19732011          {
    1974 #endif
    1975             rpcTempCU->setInterDirSubParts( uhInterDirNeighbours[uiMergeCand], 0, 0, uhDepth ); // interprets depth relative to LCU level
    1976             rpcTempCU->getCUMvField( REF_PIC_LIST_0 )->setAllMvField( cMvFieldNeighbours[0 + 2*uiMergeCand], SIZE_2Nx2N, 0, 0 ); // interprets depth relative to rpcTempCU level
    1977             rpcTempCU->getCUMvField( REF_PIC_LIST_1 )->setAllMvField( cMvFieldNeighbours[1 + 2*uiMergeCand], SIZE_2Nx2N, 0, 0 ); // interprets depth relative to rpcTempCU level
    1978 #if H_3D_VSP
     2012            // If no residual when allowing for one, then set mark to not try case where residual is forced to 0
     2013            mergeCandBuffer[uiMergeCand] = 1;
    19792014          }
    1980         }
    1981 #endif
    1982        // do MC
    1983        m_pcPredSearch->motionCompensation ( rpcTempCU, m_ppcPredYuvTemp[uhDepth] );
    1984        // estimate residual and encode everything
    1985 #if H_3D_VSO //M2
    1986        if( m_pcRdCost->getUseRenModel() )
    1987        { //Reset
    1988          UInt  uiWidth     = m_ppcOrigYuv[uhDepth]->getWidth    ();
    1989          UInt  uiHeight    = m_ppcOrigYuv[uhDepth]->getHeight   ();
    1990          Pel*  piSrc       = m_ppcOrigYuv[uhDepth]->getLumaAddr ();
    1991          UInt  uiSrcStride = m_ppcOrigYuv[uhDepth]->getStride   ();
    1992          m_pcRdCost->setRenModelData( rpcTempCU, 0, piSrc, uiSrcStride, uiWidth, uiHeight );
    1993        }
    1994 #endif
    1995        m_pcPredSearch->encodeResAndCalcRdInterCU( rpcTempCU,
    1996          m_ppcOrigYuv    [uhDepth],
    1997          m_ppcPredYuvTemp[uhDepth],
    1998          m_ppcResiYuvTemp[uhDepth],
    1999          m_ppcResiYuvBest[uhDepth],
    2000          m_ppcRecoYuvTemp[uhDepth],
    2001          (uiNoResidual? true:false));
    2002 
    2003 
    2004           if ( uiNoResidual == 0 && rpcTempCU->getQtRootCbf(0) == 0 )
    2005          {
    2006             // If no residual when allowing for one, then set mark to not try case where residual is forced to 0
    2007            mergeCandBuffer[uiMergeCand] = 1;
    2008          }
    20092015
    20102016          rpcTempCU->setSkipFlagSubParts( rpcTempCU->getQtRootCbf(0) == 0, 0, uhDepth );
     
    20942100          rpcTempCU->initEstData( uhDepth, orgQP, bTransquantBypassFlag );
    20952101
    2096       if( m_pcEncCfg->getUseFastDecisionForMerge() && !bestIsSkip )
     2102          if( m_pcEncCfg->getUseFastDecisionForMerge() && !bestIsSkip )
     2103          {
     2104#if H_3D_INTER_SDC
     2105            if( rpcTempCU->getSlice()->getInterSdcFlag() )
     2106            {
     2107              bestIsSkip = !rpcBestCU->getSDCFlag( 0 ) && ( rpcBestCU->getQtRootCbf(0) == 0 );
     2108            }
     2109            else
     2110            {
     2111#endif
     2112              bestIsSkip = rpcBestCU->getQtRootCbf(0) == 0;
     2113#if H_3D_INTER_SDC
     2114            }
     2115#endif
     2116          }
     2117        }
     2118      }
     2119    }
     2120
     2121    if(uiNoResidual == 0 && m_pcEncCfg->getUseEarlySkipDetection())
     2122    {
     2123      if(rpcBestCU->getQtRootCbf( 0 ) == 0)
    20972124      {
    2098 #if H_3D_INTER_SDC
    2099         if( rpcTempCU->getSlice()->getInterSdcFlag() )
     2125        if( rpcBestCU->getMergeFlag( 0 ))
    21002126        {
    2101           bestIsSkip = !rpcBestCU->getSDCFlag( 0 ) && ( rpcBestCU->getQtRootCbf(0) == 0 );
     2127          *earlyDetectionSkipMode = true;
    21022128        }
    21032129        else
    21042130        {
    2105 #endif
    2106         bestIsSkip = rpcBestCU->getQtRootCbf(0) == 0;
    2107 #if H_3D_INTER_SDC
    2108         }
    2109 #endif
    2110       }
    2111     }
    2112    }
    2113   }
    2114 
    2115   if(uiNoResidual == 0 && m_pcEncCfg->getUseEarlySkipDetection())
    2116   {
    2117     if(rpcBestCU->getQtRootCbf( 0 ) == 0)
    2118     {
    2119       if( rpcBestCU->getMergeFlag( 0 ))
    2120       {
    2121         *earlyDetectionSkipMode = true;
    2122       }
    2123       else
    2124       {
    2125         Int absoulte_MV=0;
    2126         for ( UInt uiRefListIdx = 0; uiRefListIdx < 2; uiRefListIdx++ )
    2127         {
    2128           if ( rpcBestCU->getSlice()->getNumRefIdx( RefPicList( uiRefListIdx ) ) > 0 )
     2131          Int absoulte_MV=0;
     2132          for ( UInt uiRefListIdx = 0; uiRefListIdx < 2; uiRefListIdx++ )
    21292133          {
    2130             TComCUMvField* pcCUMvField = rpcBestCU->getCUMvField(RefPicList( uiRefListIdx ));
    2131             Int iHor = pcCUMvField->getMvd( 0 ).getAbsHor();
    2132             Int iVer = pcCUMvField->getMvd( 0 ).getAbsVer();
    2133             absoulte_MV+=iHor+iVer;
     2134            if ( rpcBestCU->getSlice()->getNumRefIdx( RefPicList( uiRefListIdx ) ) > 0 )
     2135            {
     2136              TComCUMvField* pcCUMvField = rpcBestCU->getCUMvField(RefPicList( uiRefListIdx ));
     2137              Int iHor = pcCUMvField->getMvd( 0 ).getAbsHor();
     2138              Int iVer = pcCUMvField->getMvd( 0 ).getAbsVer();
     2139              absoulte_MV+=iHor+iVer;
     2140            }
     2141          }
     2142
     2143          if(absoulte_MV == 0)
     2144          {
     2145            *earlyDetectionSkipMode = true;
    21342146          }
    21352147        }
    2136 
    2137         if(absoulte_MV == 0)
    2138         {
    2139           *earlyDetectionSkipMode = true;
    2140         }
    21412148      }
    21422149    }
    21432150  }
    2144  }
    21452151#if H_3D_SPIVMP
    21462152 delete[] pcMvFieldSP;
     
    21632169#endif
    21642170{
    2165 
    21662171#if H_3D
    21672172  const Bool bTransquantBypassFlag = rpcTempCU->getCUTransquantBypass(0);
     
    21712176  {
    21722177#endif
    2173   UChar uhDepth = rpcTempCU->getDepth( 0 );
     2178    UChar uhDepth = rpcTempCU->getDepth( 0 );
    21742179#if H_3D_ARP
    2175   Bool bFirstTime = true;
    2176   Int nARPWMax    = rpcTempCU->getSlice()->getARPStepNum() - 1;
    2177   if( nARPWMax < 0 || ePartSize != SIZE_2Nx2N || rpcTempCU->getICFlag(0) )
    2178   {
    2179     nARPWMax = 0;
    2180   }
    2181 
    2182   for( Int nARPW = 0; nARPW <= nARPWMax; nARPW++ )
    2183   {
    2184     if( !bFirstTime && rpcTempCU->getSlice()->getIvResPredFlag() )
    2185     {
    2186       rpcTempCU->initEstData( rpcTempCU->getDepth(0), rpcTempCU->getQP(0),bTransquantBypassFlag );     
    2187     }
    2188 #endif
    2189 #if H_3D_VSO // M3
    2190   if( m_pcRdCost->getUseRenModel() )
    2191   {
    2192     UInt  uiWidth     = m_ppcOrigYuv[uhDepth]->getWidth ( );
    2193     UInt  uiHeight    = m_ppcOrigYuv[uhDepth]->getHeight( );
    2194     Pel*  piSrc       = m_ppcOrigYuv[uhDepth]->getLumaAddr( );
    2195     UInt  uiSrcStride = m_ppcOrigYuv[uhDepth]->getStride();
    2196     m_pcRdCost->setRenModelData( rpcTempCU, 0, piSrc, uiSrcStride, uiWidth, uiHeight );
    2197   }
    2198 #endif
    2199 
    2200   rpcTempCU->setDepthSubParts( uhDepth, 0 );
    2201  
    2202   rpcTempCU->setSkipFlagSubParts( false, 0, uhDepth );
    2203 #if H_3D
    2204   rpcTempCU->setDISFlagSubParts( false, 0, uhDepth );
    2205 #endif
    2206   rpcTempCU->setPartSizeSubParts  ( ePartSize,  0, uhDepth );
    2207   rpcTempCU->setPredModeSubParts  ( MODE_INTER, 0, uhDepth );
    2208 
    2209 #if H_3D_ARP
    2210   rpcTempCU->setARPWSubParts( (UChar)nARPW , 0 , uhDepth );
    2211 #endif
    2212 
    2213 #if H_3D_ARP
    2214   if( bFirstTime == false && nARPWMax )
    2215   {
    2216     rpcTempCU->copyPartFrom( m_ppcWeightedTempCU[uhDepth] , 0 , uhDepth );
    2217     rpcTempCU->setARPWSubParts( (UChar)nARPW , 0 , uhDepth );
    2218 
    2219     m_pcPredSearch->motionCompensation( rpcTempCU , m_ppcPredYuvTemp[uhDepth] );
    2220   }
    2221   else
    2222   {
    2223     bFirstTime = false;
    2224 #endif
    2225 #if AMP_MRG
    2226   rpcTempCU->setMergeAMP (true);
    2227 #if  H_3D_FAST_TEXTURE_ENCODING
    2228   m_pcPredSearch->predInterSearch ( rpcTempCU, m_ppcOrigYuv[uhDepth], m_ppcPredYuvTemp[uhDepth], m_ppcResiYuvTemp[uhDepth], m_ppcRecoYuvTemp[uhDepth], bFMD, false, bUseMRG );
    2229 #else
    2230   m_pcPredSearch->predInterSearch ( rpcTempCU, m_ppcOrigYuv[uhDepth], m_ppcPredYuvTemp[uhDepth], m_ppcResiYuvTemp[uhDepth], m_ppcRecoYuvTemp[uhDepth], false, bUseMRG );
    2231 #endif
    2232 #else 
    2233   m_pcPredSearch->predInterSearch ( rpcTempCU, m_ppcOrigYuv[uhDepth], m_ppcPredYuvTemp[uhDepth], m_ppcResiYuvTemp[uhDepth], m_ppcRecoYuvTemp[uhDepth] );
    2234 #endif
    2235 #if H_3D_ARP
    2236    if( nARPWMax )
    2237    {
    2238      m_ppcWeightedTempCU[uhDepth]->copyPartFrom( rpcTempCU , 0 , uhDepth );
    2239    }
    2240   }
    2241 #endif
    2242 
    2243 #if AMP_MRG
    2244   if ( !rpcTempCU->getMergeAMP() )
    2245   {
    2246 #if H_3D_ARP
    2247     if( nARPWMax )
    2248     {
    2249       continue;
    2250     }
    2251     else
    2252 #endif
    2253     return;
    2254   }
    2255 #endif
    2256 
    2257 #if KWU_RC_MADPRED_E0227
    2258   if ( m_pcEncCfg->getUseRateCtrl() && m_pcEncCfg->getLCULevelRC() && ePartSize == SIZE_2Nx2N && uhDepth <= m_addSADDepth )
    2259   {
    2260     UInt SAD = m_pcRdCost->getSADPart( g_bitDepthY, m_ppcPredYuvTemp[uhDepth]->getLumaAddr(), m_ppcPredYuvTemp[uhDepth]->getStride(),
    2261       m_ppcOrigYuv[uhDepth]->getLumaAddr(), m_ppcOrigYuv[uhDepth]->getStride(),
    2262       rpcTempCU->getWidth(0), rpcTempCU->getHeight(0) );
    2263     m_temporalSAD = (Int)SAD;
    2264   }
    2265 #endif
    2266   m_pcPredSearch->encodeResAndCalcRdInterCU( rpcTempCU, m_ppcOrigYuv[uhDepth], m_ppcPredYuvTemp[uhDepth], m_ppcResiYuvTemp[uhDepth], m_ppcResiYuvBest[uhDepth], m_ppcRecoYuvTemp[uhDepth], false );
    2267 #if H_3D_VSP // possible bug fix
    2268   if( rpcTempCU->getQtRootCbf(0)==0 )
    2269   {
    2270     rpcTempCU->setTrIdxSubParts(0, 0, uhDepth);
    2271   }
    2272 #endif
    2273 #if H_3D_VSO // M4
    2274   if( m_pcRdCost->getUseLambdaScaleVSO() )
    2275     rpcTempCU->getTotalCost()  = m_pcRdCost->calcRdCostVSO( rpcTempCU->getTotalBits(), rpcTempCU->getTotalDistortion() );
    2276   else
    2277 #endif
    2278   rpcTempCU->getTotalCost()  = m_pcRdCost->calcRdCost( rpcTempCU->getTotalBits(), rpcTempCU->getTotalDistortion() );
    2279 #if H_3D_INTER_SDC
    2280   TComDataCU *rpcTempCUPre = rpcTempCU;
    2281 #endif
    2282   xCheckDQP( rpcTempCU );
    2283   xCheckBestMode(rpcBestCU, rpcTempCU, uhDepth);
    2284 #if H_3D_INTER_SDC
    2285   if( rpcTempCU->getSlice()->getInterSdcFlag() && ePartSize == SIZE_2Nx2N)
    2286   {
    2287     Double dOffsetCost[3] = {MAX_DOUBLE,MAX_DOUBLE,MAX_DOUBLE};
    2288     for( Int uiOffest = 1 ; uiOffest <= 5 ; uiOffest++ )
    2289     {
    2290       if( uiOffest > 3)
     2180    Bool bFirstTime = true;
     2181    Int nARPWMax    = rpcTempCU->getSlice()->getARPStepNum() - 1;
     2182    if( nARPWMax < 0 || ePartSize != SIZE_2Nx2N || rpcTempCU->getICFlag(0) )
     2183    {
     2184      nARPWMax = 0;
     2185    }
     2186
     2187    for( Int nARPW = 0; nARPW <= nARPWMax; nARPW++ )
     2188    {
     2189      if( !bFirstTime && rpcTempCU->getSlice()->getIvResPredFlag() )
    22912190      {
    2292         if ( dOffsetCost[0] < (0.9*dOffsetCost[1]) && dOffsetCost[0] < (0.9*dOffsetCost[2]) )
    2293         {
    2294           continue;
    2295         }
    2296         if ( dOffsetCost[1] < dOffsetCost[0] && dOffsetCost[0] < dOffsetCost[2] &&  uiOffest == 5)
    2297         {
    2298           continue;
    2299         }
    2300         if ( dOffsetCost[0] < dOffsetCost[1] && dOffsetCost[2] < dOffsetCost[0] &&  uiOffest == 4)
    2301         {
    2302           continue;
    2303         }
     2191        rpcTempCU->initEstData( rpcTempCU->getDepth(0), rpcTempCU->getQP(0),bTransquantBypassFlag );     
    23042192      }
    2305 
    2306       if( rpcTempCU != rpcTempCUPre )
    2307       {
    2308         Int orgQP = rpcBestCU->getQP( 0 );
    2309         rpcTempCU->initEstData( uhDepth, orgQP ,bTransquantBypassFlag );     
    2310         rpcTempCU->copyPartFrom( rpcBestCU, 0, uhDepth );
    2311       }
    2312       rpcTempCU->setSkipFlagSubParts( false, 0, uhDepth );
    2313 #if H_3D
    2314       rpcTempCU->setDISFlagSubParts( false, 0, uhDepth );
    2315 #endif
    2316       rpcTempCU->setTrIdxSubParts( 0, 0, uhDepth );
    2317       rpcTempCU->setCbfSubParts( 1, 1, 1, 0, uhDepth );
     2193#endif
    23182194#if H_3D_VSO // M3
    23192195      if( m_pcRdCost->getUseRenModel() )
     
    23272203#endif
    23282204
    2329       Int iSdcOffset = 0;
    2330       if(uiOffest % 2 == 0)
     2205      rpcTempCU->setDepthSubParts( uhDepth, 0 );
     2206
     2207      rpcTempCU->setSkipFlagSubParts( false, 0, uhDepth );
     2208#if H_3D
     2209      rpcTempCU->setDISFlagSubParts( false, 0, uhDepth );
     2210#endif
     2211      rpcTempCU->setPartSizeSubParts  ( ePartSize,  0, uhDepth );
     2212      rpcTempCU->setPredModeSubParts  ( MODE_INTER, 0, uhDepth );
     2213#if H_3D_ARP
     2214      rpcTempCU->setARPWSubParts( (UChar)nARPW , 0 , uhDepth );
     2215#endif
     2216#if H_3D_ARP
     2217      if( bFirstTime == false && nARPWMax )
    23312218      {
    2332         iSdcOffset = uiOffest >> 1;
     2219        rpcTempCU->copyPartFrom( m_ppcWeightedTempCU[uhDepth] , 0 , uhDepth );
     2220        rpcTempCU->setARPWSubParts( (UChar)nARPW , 0 , uhDepth );
     2221
     2222        m_pcPredSearch->motionCompensation( rpcTempCU , m_ppcPredYuvTemp[uhDepth] );
    23332223      }
    23342224      else
    23352225      {
    2336         iSdcOffset = -1 * (uiOffest >> 1);
     2226        bFirstTime = false;
     2227#endif
     2228#if AMP_MRG
     2229        rpcTempCU->setMergeAMP (true);
     2230#if  H_3D_FAST_TEXTURE_ENCODING
     2231        m_pcPredSearch->predInterSearch ( rpcTempCU, m_ppcOrigYuv[uhDepth], m_ppcPredYuvTemp[uhDepth], m_ppcResiYuvTemp[uhDepth], m_ppcRecoYuvTemp[uhDepth], bFMD, false, bUseMRG );
     2232#else
     2233        m_pcPredSearch->predInterSearch ( rpcTempCU, m_ppcOrigYuv[uhDepth], m_ppcPredYuvTemp[uhDepth], m_ppcResiYuvTemp[uhDepth], m_ppcRecoYuvTemp[uhDepth], false, bUseMRG );
     2234#endif
     2235#else 
     2236        m_pcPredSearch->predInterSearch ( rpcTempCU, m_ppcOrigYuv[uhDepth], m_ppcPredYuvTemp[uhDepth], m_ppcResiYuvTemp[uhDepth], m_ppcRecoYuvTemp[uhDepth] );
     2237#endif
     2238#if H_3D_ARP
     2239        if( nARPWMax )
     2240        {
     2241          m_ppcWeightedTempCU[uhDepth]->copyPartFrom( rpcTempCU , 0 , uhDepth );
     2242        }
    23372243      }
    2338       m_pcPredSearch->encodeResAndCalcRdInterSDCCU( rpcTempCU,
    2339         m_ppcOrigYuv[uhDepth],
    2340         ( rpcTempCU != rpcTempCUPre ) ? m_ppcPredYuvBest[uhDepth] : m_ppcPredYuvTemp[uhDepth],
    2341         m_ppcResiYuvTemp[uhDepth],
    2342         m_ppcRecoYuvTemp[uhDepth],
    2343         iSdcOffset,
    2344         uhDepth );
    2345       if (uiOffest <= 3 )
     2244#endif
     2245
     2246#if AMP_MRG
     2247      if ( !rpcTempCU->getMergeAMP() )
    23462248      {
    2347         dOffsetCost [uiOffest -1] = rpcTempCU->getTotalCost();
     2249#if H_3D_ARP
     2250        if( nARPWMax )
     2251        {
     2252          continue;
     2253        }
     2254        else
     2255#endif
     2256          return;
    23482257      }
    2349 
     2258#endif
     2259
     2260#if KWU_RC_MADPRED_E0227
     2261      if ( m_pcEncCfg->getUseRateCtrl() && m_pcEncCfg->getLCULevelRC() && ePartSize == SIZE_2Nx2N && uhDepth <= m_addSADDepth )
     2262      {
     2263        UInt SAD = m_pcRdCost->getSADPart( g_bitDepthY, m_ppcPredYuvTemp[uhDepth]->getLumaAddr(), m_ppcPredYuvTemp[uhDepth]->getStride(),
     2264          m_ppcOrigYuv[uhDepth]->getLumaAddr(), m_ppcOrigYuv[uhDepth]->getStride(),
     2265          rpcTempCU->getWidth(0), rpcTempCU->getHeight(0) );
     2266        m_temporalSAD = (Int)SAD;
     2267      }
     2268#endif
     2269      m_pcPredSearch->encodeResAndCalcRdInterCU( rpcTempCU, m_ppcOrigYuv[uhDepth], m_ppcPredYuvTemp[uhDepth], m_ppcResiYuvTemp[uhDepth], m_ppcResiYuvBest[uhDepth], m_ppcRecoYuvTemp[uhDepth], false );
     2270#if H_3D_VSP // possible bug fix
     2271      if( rpcTempCU->getQtRootCbf(0)==0 )
     2272      {
     2273        rpcTempCU->setTrIdxSubParts(0, 0, uhDepth);
     2274      }
     2275#endif
     2276#if H_3D_VSO // M4
     2277      if( m_pcRdCost->getUseLambdaScaleVSO() )
     2278        rpcTempCU->getTotalCost()  = m_pcRdCost->calcRdCostVSO( rpcTempCU->getTotalBits(), rpcTempCU->getTotalDistortion() );
     2279      else
     2280#endif
     2281        rpcTempCU->getTotalCost()  = m_pcRdCost->calcRdCost( rpcTempCU->getTotalBits(), rpcTempCU->getTotalDistortion() );
     2282#if H_3D_INTER_SDC
     2283      TComDataCU *rpcTempCUPre = rpcTempCU;
     2284#endif
    23502285      xCheckDQP( rpcTempCU );
    23512286      xCheckBestMode(rpcBestCU, rpcTempCU, uhDepth);
    2352     }
    2353 
    2354   }
     2287#if H_3D_INTER_SDC
     2288      if( rpcTempCU->getSlice()->getInterSdcFlag() && ePartSize == SIZE_2Nx2N)
     2289      {
     2290        Double dOffsetCost[3] = {MAX_DOUBLE,MAX_DOUBLE,MAX_DOUBLE};
     2291        for( Int uiOffest = 1 ; uiOffest <= 5 ; uiOffest++ )
     2292        {
     2293          if( uiOffest > 3)
     2294          {
     2295            if ( dOffsetCost[0] < (0.9*dOffsetCost[1]) && dOffsetCost[0] < (0.9*dOffsetCost[2]) )
     2296            {
     2297              continue;
     2298            }
     2299            if ( dOffsetCost[1] < dOffsetCost[0] && dOffsetCost[0] < dOffsetCost[2] &&  uiOffest == 5)
     2300            {
     2301              continue;
     2302            }
     2303            if ( dOffsetCost[0] < dOffsetCost[1] && dOffsetCost[2] < dOffsetCost[0] &&  uiOffest == 4)
     2304            {
     2305              continue;
     2306            }
     2307          }
     2308
     2309          if( rpcTempCU != rpcTempCUPre )
     2310          {
     2311            Int orgQP = rpcBestCU->getQP( 0 );
     2312            rpcTempCU->initEstData( uhDepth, orgQP ,bTransquantBypassFlag );     
     2313            rpcTempCU->copyPartFrom( rpcBestCU, 0, uhDepth );
     2314          }
     2315          rpcTempCU->setSkipFlagSubParts( false, 0, uhDepth );
     2316#if H_3D
     2317          rpcTempCU->setDISFlagSubParts( false, 0, uhDepth );
     2318#endif
     2319          rpcTempCU->setTrIdxSubParts( 0, 0, uhDepth );
     2320          rpcTempCU->setCbfSubParts( 1, 1, 1, 0, uhDepth );
     2321#if H_3D_VSO // M3
     2322          if( m_pcRdCost->getUseRenModel() )
     2323          {
     2324            UInt  uiWidth     = m_ppcOrigYuv[uhDepth]->getWidth ( );
     2325            UInt  uiHeight    = m_ppcOrigYuv[uhDepth]->getHeight( );
     2326            Pel*  piSrc       = m_ppcOrigYuv[uhDepth]->getLumaAddr( );
     2327            UInt  uiSrcStride = m_ppcOrigYuv[uhDepth]->getStride();
     2328            m_pcRdCost->setRenModelData( rpcTempCU, 0, piSrc, uiSrcStride, uiWidth, uiHeight );
     2329          }
     2330#endif
     2331
     2332          Int iSdcOffset = 0;
     2333          if(uiOffest % 2 == 0)
     2334          {
     2335            iSdcOffset = uiOffest >> 1;
     2336          }
     2337          else
     2338          {
     2339            iSdcOffset = -1 * (uiOffest >> 1);
     2340          }
     2341          m_pcPredSearch->encodeResAndCalcRdInterSDCCU( rpcTempCU,
     2342            m_ppcOrigYuv[uhDepth],
     2343            ( rpcTempCU != rpcTempCUPre ) ? m_ppcPredYuvBest[uhDepth] : m_ppcPredYuvTemp[uhDepth],
     2344            m_ppcResiYuvTemp[uhDepth],
     2345            m_ppcRecoYuvTemp[uhDepth],
     2346            iSdcOffset,
     2347            uhDepth );
     2348          if (uiOffest <= 3 )
     2349          {
     2350            dOffsetCost [uiOffest -1] = rpcTempCU->getTotalCost();
     2351          }
     2352
     2353          xCheckDQP( rpcTempCU );
     2354          xCheckBestMode(rpcBestCU, rpcTempCU, uhDepth);
     2355        }
     2356
     2357      }
    23552358#endif
    23562359#if H_3D_ARP
    2357   }
     2360    }
    23582361#endif
    23592362#if  H_3D_FAST_TEXTURE_ENCODING
     
    25482551  // find optimal motion/disparity vector for each segment
    25492552  DisInfo originalDvInfo = rpcTempCU->getDvInfo(0);
    2550   DBBPTmpData* pDBBPTmpData = rpcTempCU->getDBBPTmpData();
     2553  DbbpTmpData* pDBBPTmpData = rpcTempCU->getDBBPTmpData();
    25512554  TComYuv* apPredYuv[2] = { m_ppcRecoYuvTemp[uhDepth], m_ppcPredYuvTemp[uhDepth] };
    25522555 
     
    26292632}
    26302633#endif
     2634
    26312635#if H_3D_DIM
    26322636Void TEncCu::xCheckRDCostIntra( TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU, PartSize eSize, Bool bOnlyIVP )
     
    26702674  if( !rpcTempCU->getSDCFlag( 0 ) )
    26712675#endif
    2672   m_pcPredSearch  ->estIntraPredChromaQT( rpcTempCU, m_ppcOrigYuv[uiDepth], m_ppcPredYuvTemp[uiDepth], m_ppcResiYuvTemp[uiDepth], m_ppcRecoYuvTemp[uiDepth], uiPreCalcDistC );
     2676    m_pcPredSearch  ->estIntraPredChromaQT( rpcTempCU, m_ppcOrigYuv[uiDepth], m_ppcPredYuvTemp[uiDepth], m_ppcResiYuvTemp[uiDepth], m_ppcRecoYuvTemp[uiDepth], uiPreCalcDistC );
    26732677 
    26742678  m_pcEntropyCoder->resetBits();
     
    26832687  {
    26842688#endif
    2685   m_pcEntropyCoder->encodePredMode( rpcTempCU, 0,          true );
    2686   m_pcEntropyCoder->encodePartSize( rpcTempCU, 0, uiDepth, true );
    2687   m_pcEntropyCoder->encodePredInfo( rpcTempCU, 0,          true );
    2688   m_pcEntropyCoder->encodeIPCMInfo(rpcTempCU, 0, true );
     2689    m_pcEntropyCoder->encodePredMode( rpcTempCU, 0,          true );
     2690    m_pcEntropyCoder->encodePartSize( rpcTempCU, 0, uiDepth, true );
     2691    m_pcEntropyCoder->encodePredInfo( rpcTempCU, 0,          true );
     2692    m_pcEntropyCoder->encodeIPCMInfo(rpcTempCU, 0, true );
    26892693#if H_3D_DIM_SDC
    2690   m_pcEntropyCoder->encodeSDCFlag( rpcTempCU, 0, true );
    2691 #endif
    2692 
    2693   // Encode Coefficients
    2694   Bool bCodeDQP = getdQPFlag();
     2694    m_pcEntropyCoder->encodeSDCFlag( rpcTempCU, 0, true );
     2695#endif
     2696
     2697    // Encode Coefficients
     2698    Bool bCodeDQP = getdQPFlag();
    26952699#if H_3D_DISABLE_CHROMA
    2696   m_pcEntropyCoder->encodeCoeff( rpcTempCU, 0, uiDepth, rpcTempCU->getWidth (0), rpcTempCU->getHeight(0), bCodeDQP, true );
    2697 #else
    2698   m_pcEntropyCoder->encodeCoeff( rpcTempCU, 0, uiDepth, rpcTempCU->getWidth (0), rpcTempCU->getHeight(0), bCodeDQP );
    2699 #endif
    2700 
    2701 
    2702   setdQPFlag( bCodeDQP );
     2700    m_pcEntropyCoder->encodeCoeff( rpcTempCU, 0, uiDepth, rpcTempCU->getWidth (0), rpcTempCU->getHeight(0), bCodeDQP, true );
     2701#else
     2702    m_pcEntropyCoder->encodeCoeff( rpcTempCU, 0, uiDepth, rpcTempCU->getWidth (0), rpcTempCU->getHeight(0), bCodeDQP );
     2703#endif
     2704    setdQPFlag( bCodeDQP );
    27032705#if H_3D
    27042706  }
     
    27072709 
    27082710  rpcTempCU->getTotalBits() = m_pcEntropyCoder->getNumberOfWrittenBits();
    2709     rpcTempCU->getTotalBins() = ((TEncBinCABAC *)((TEncSbac*)m_pcEntropyCoder->m_pcEntropyCoderIf)->getEncBinIf())->getBinsCoded();
     2711  rpcTempCU->getTotalBins() = ((TEncBinCABAC *)((TEncSbac*)m_pcEntropyCoder->m_pcEntropyCoderIf)->getEncBinIf())->getBinsCoded();
    27102712#if H_3D_VSO // M6
    27112713  if( m_pcRdCost->getUseLambdaScaleVSO()) 
  • branches/HTM-14.0-dev0/source/Lib/TLibEncoder/TEncEntropy.cpp

    r1185 r1187  
    561561#endif
    562562#endif
    563     encodeIntraDirModeChroma( pcCU, uiAbsPartIdx, bRD );
     563      encodeIntraDirModeChroma( pcCU, uiAbsPartIdx, bRD );
    564564  }
    565565  else                                                                // if it is Inter mode, encode motion vector and reference index
  • branches/HTM-14.0-dev0/source/Lib/TLibEncoder/TEncSbac.cpp

    r1185 r1187  
    255255      curCost += m_CUTransquantBypassFlagSCModel.calcCost( curSliceType, qp, (UChar*)INIT_CU_TRANSQUANT_BYPASS_FLAG );
    256256#if H_3D_DIM
    257     if( m_pcSlice->getIntraSdcWedgeFlag() || m_pcSlice->getIntraContourFlag() )
    258     {
    259       curCost += m_cDepthIntraModeSCModel.calcCost    ( curSliceType, qp, (UChar*)INIT_DEPTH_INTRA_MODE );
    260       curCost += m_cDdcFlagSCModel.calcCost           ( curSliceType, qp, (UChar*)INIT_DDC_FLAG );
    261       curCost += m_cDdcDataSCModel.calcCost           ( curSliceType, qp, (UChar*)INIT_DDC_DATA );
    262       curCost += m_cAngleFlagSCModel.calcCost         ( curSliceType, qp, (UChar*)INIT_ANGLE_FLAG ); 
    263     }
     257      if( m_pcSlice->getIntraSdcWedgeFlag() || m_pcSlice->getIntraContourFlag() )
     258      {
     259        curCost += m_cDepthIntraModeSCModel.calcCost    ( curSliceType, qp, (UChar*)INIT_DEPTH_INTRA_MODE );
     260        curCost += m_cDdcFlagSCModel.calcCost           ( curSliceType, qp, (UChar*)INIT_DDC_FLAG );
     261        curCost += m_cDdcDataSCModel.calcCost           ( curSliceType, qp, (UChar*)INIT_DDC_DATA );
     262        curCost += m_cAngleFlagSCModel.calcCost         ( curSliceType, qp, (UChar*)INIT_ANGLE_FLAG ); 
     263      }
    264264#endif
    265265      if (curCost < bestCost)
     
    626626  Bool bDepthMapDetect   = (pcTexture != NULL);
    627627  Bool bIntraSliceDetect = (pcCU->getSlice()->getSliceType() == I_SLICE);
    628  
     628
    629629  Bool rapPic     = (pcCU->getSlice()->getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_W_RADL || pcCU->getSlice()->getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_N_LP || pcCU->getSlice()->getNalUnitType() == NAL_UNIT_CODED_SLICE_CRA);
    630630
     
    664664    return;
    665665  }
    666  
     666
    667667#if H_MV_ENC_DEC_TRAC         
    668668  DTRACE_CU("part_mode", eSize )
     
    672672    {
    673673#endif
    674   switch(eSize)
    675   {
    676     case SIZE_2Nx2N:
    677     {
    678       m_pcBinIf->encodeBin( 1, m_cCUPartSizeSCModel.get( 0, 0, 0) );
    679       break;
    680     }
    681     case SIZE_2NxN:
    682     case SIZE_2NxnU:
    683     case SIZE_2NxnD:
    684     {
    685       m_pcBinIf->encodeBin( 0, m_cCUPartSizeSCModel.get( 0, 0, 0) );
    686       m_pcBinIf->encodeBin( 1, m_cCUPartSizeSCModel.get( 0, 0, 1) );
    687       if ( pcCU->getSlice()->getSPS()->getAMPAcc( uiDepth ) )
    688       {
    689         if (eSize == SIZE_2NxN)
    690         {
    691           m_pcBinIf->encodeBin(1, m_cCUPartSizeSCModel.get( 0, 0, 3 ));
    692         }
    693         else
    694         {
    695           m_pcBinIf->encodeBin(0, m_cCUPartSizeSCModel.get( 0, 0, 3 ));
    696           m_pcBinIf->encodeBinEP((eSize == SIZE_2NxnU? 0: 1));
    697         }
    698       }
    699       break;
    700     }
    701     case SIZE_Nx2N:
    702     case SIZE_nLx2N:
    703     case SIZE_nRx2N:
    704     {
    705       m_pcBinIf->encodeBin( 0, m_cCUPartSizeSCModel.get( 0, 0, 0) );
    706       m_pcBinIf->encodeBin( 0, m_cCUPartSizeSCModel.get( 0, 0, 1) );
    707       if( uiDepth == g_uiMaxCUDepth - g_uiAddCUDepth && !( pcCU->getWidth(uiAbsPartIdx) == 8 && pcCU->getHeight(uiAbsPartIdx) == 8 ) )
    708       {
    709         m_pcBinIf->encodeBin( 1, m_cCUPartSizeSCModel.get( 0, 0, 2) );
    710       }
    711       if ( pcCU->getSlice()->getSPS()->getAMPAcc( uiDepth ) )
    712       {
    713         if (eSize == SIZE_Nx2N)
    714         {
    715           m_pcBinIf->encodeBin(1, m_cCUPartSizeSCModel.get( 0, 0, 3 ));
    716         }
    717         else
    718         {
    719           m_pcBinIf->encodeBin(0, m_cCUPartSizeSCModel.get( 0, 0, 3 ));
    720           m_pcBinIf->encodeBinEP((eSize == SIZE_nLx2N? 0: 1));
    721         }
    722       }
    723       break;
    724     }
    725     case SIZE_NxN:
    726     {
    727       if( uiDepth == g_uiMaxCUDepth - g_uiAddCUDepth && !( pcCU->getWidth(uiAbsPartIdx) == 8 && pcCU->getHeight(uiAbsPartIdx) == 8 ) )
    728       {
    729         m_pcBinIf->encodeBin( 0, m_cCUPartSizeSCModel.get( 0, 0, 0) );
    730         m_pcBinIf->encodeBin( 0, m_cCUPartSizeSCModel.get( 0, 0, 1) );
    731         m_pcBinIf->encodeBin( 0, m_cCUPartSizeSCModel.get( 0, 0, 2) );
    732       }
    733       break;
    734     }
    735     default:
    736     {
    737       assert(0);
    738     }
    739   }
     674      switch(eSize)
     675      {
     676      case SIZE_2Nx2N:
     677        {
     678          m_pcBinIf->encodeBin( 1, m_cCUPartSizeSCModel.get( 0, 0, 0) );
     679          break;
     680        }
     681      case SIZE_2NxN:
     682      case SIZE_2NxnU:
     683      case SIZE_2NxnD:
     684        {
     685          m_pcBinIf->encodeBin( 0, m_cCUPartSizeSCModel.get( 0, 0, 0) );
     686          m_pcBinIf->encodeBin( 1, m_cCUPartSizeSCModel.get( 0, 0, 1) );
     687          if ( pcCU->getSlice()->getSPS()->getAMPAcc( uiDepth ) )
     688          {
     689            if (eSize == SIZE_2NxN)
     690            {
     691              m_pcBinIf->encodeBin(1, m_cCUPartSizeSCModel.get( 0, 0, 3 ));
     692            }
     693            else
     694            {
     695              m_pcBinIf->encodeBin(0, m_cCUPartSizeSCModel.get( 0, 0, 3 ));
     696              m_pcBinIf->encodeBinEP((eSize == SIZE_2NxnU? 0: 1));
     697            }
     698          }
     699          break;
     700        }
     701      case SIZE_Nx2N:
     702      case SIZE_nLx2N:
     703      case SIZE_nRx2N:
     704        {
     705          m_pcBinIf->encodeBin( 0, m_cCUPartSizeSCModel.get( 0, 0, 0) );
     706          m_pcBinIf->encodeBin( 0, m_cCUPartSizeSCModel.get( 0, 0, 1) );
     707          if( uiDepth == g_uiMaxCUDepth - g_uiAddCUDepth && !( pcCU->getWidth(uiAbsPartIdx) == 8 && pcCU->getHeight(uiAbsPartIdx) == 8 ) )
     708          {
     709            m_pcBinIf->encodeBin( 1, m_cCUPartSizeSCModel.get( 0, 0, 2) );
     710          }
     711          if ( pcCU->getSlice()->getSPS()->getAMPAcc( uiDepth ) )
     712          {
     713            if (eSize == SIZE_Nx2N)
     714            {
     715              m_pcBinIf->encodeBin(1, m_cCUPartSizeSCModel.get( 0, 0, 3 ));
     716            }
     717            else
     718            {
     719              m_pcBinIf->encodeBin(0, m_cCUPartSizeSCModel.get( 0, 0, 3 ));
     720              m_pcBinIf->encodeBinEP((eSize == SIZE_nLx2N? 0: 1));
     721            }
     722          }
     723          break;
     724        }
     725      case SIZE_NxN:
     726        {
     727          if( uiDepth == g_uiMaxCUDepth - g_uiAddCUDepth && !( pcCU->getWidth(uiAbsPartIdx) == 8 && pcCU->getHeight(uiAbsPartIdx) == 8 ) )
     728          {
     729            m_pcBinIf->encodeBin( 0, m_cCUPartSizeSCModel.get( 0, 0, 0) );
     730            m_pcBinIf->encodeBin( 0, m_cCUPartSizeSCModel.get( 0, 0, 1) );
     731            m_pcBinIf->encodeBin( 0, m_cCUPartSizeSCModel.get( 0, 0, 2) );
     732          }
     733          break;
     734        }
     735      default:
     736        {
     737          assert(0);
     738        }
     739      }
    740740#if H_3D_QTLPC
    741741    }
     
    10891089    {
    10901090#endif
    1091     if(predIdx[j] != -1)
    1092     {
    1093       m_pcBinIf->encodeBinEP( predIdx[j] ? 1 : 0 );
    1094       if (predIdx[j])
    1095       {
    1096         m_pcBinIf->encodeBinEP( predIdx[j]-1 );
    1097       }
     1091      if(predIdx[j] != -1)
     1092      {
     1093        m_pcBinIf->encodeBinEP( predIdx[j] ? 1 : 0 );
     1094        if (predIdx[j])
     1095        {
     1096          m_pcBinIf->encodeBinEP( predIdx[j]-1 );
     1097        }
    10981098#if H_MV_ENC_DEC_TRAC
    1099       DTRACE_CU("mpm_idx", predIdx[j] );
    1100 #endif
    1101     }
    1102     else
    1103     {
    1104       if (preds[j][0] > preds[j][1])
    1105       {
    1106         std::swap(preds[j][0], preds[j][1]);
    1107       }
    1108       if (preds[j][0] > preds[j][2])
    1109       {
    1110         std::swap(preds[j][0], preds[j][2]);
    1111       }
    1112       if (preds[j][1] > preds[j][2])
    1113       {
    1114         std::swap(preds[j][1], preds[j][2]);
    1115       }
    1116       for(Int i = (predNum[j] - 1); i >= 0; i--)
    1117       {
    1118         dir[j] = dir[j] > preds[j][i] ? dir[j] - 1 : dir[j];
    1119       }
    1120       m_pcBinIf->encodeBinsEP( dir[j], 5 );
     1099        DTRACE_CU("mpm_idx", predIdx[j] );
     1100#endif
     1101      }
     1102      else
     1103      {
     1104        if (preds[j][0] > preds[j][1])
     1105        {
     1106          std::swap(preds[j][0], preds[j][1]);
     1107        }
     1108        if (preds[j][0] > preds[j][2])
     1109        {
     1110          std::swap(preds[j][0], preds[j][2]);
     1111        }
     1112        if (preds[j][1] > preds[j][2])
     1113        {
     1114          std::swap(preds[j][1], preds[j][2]);
     1115        }
     1116        for(Int i = (predNum[j] - 1); i >= 0; i--)
     1117        {
     1118          dir[j] = dir[j] > preds[j][i] ? dir[j] - 1 : dir[j];
     1119        }
     1120        m_pcBinIf->encodeBinsEP( dir[j], 5 );
    11211121#if H_MV_ENC_DEC_TRAC
    1122       DTRACE_CU("rem_intra_luma_pred_mode", dir[j] );
    1123 #endif
    1124     }
     1122        DTRACE_CU("rem_intra_luma_pred_mode", dir[j] );
     1123#endif
     1124      }
    11251125#if H_3D_DIM
    11261126    }
     
    14671467    {   
    14681468#endif
    1469     piPCMSample = pcCU->getPCMSampleCb() + uiChromaOffset;
    1470     uiWidth = pcCU->getWidth(uiAbsPartIdx)/2;
    1471     uiHeight = pcCU->getHeight(uiAbsPartIdx)/2;
    1472     uiSampleBits = pcCU->getSlice()->getSPS()->getPCMBitDepthChroma();
    1473 
    1474     for(uiY = 0; uiY < uiHeight; uiY++)
    1475     {
    1476       for(uiX = 0; uiX < uiWidth; uiX++)
    1477       {
    1478         UInt uiSample = piPCMSample[uiX];
    1479 
    1480         m_pcBinIf->xWritePCMCode(uiSample, uiSampleBits);
    1481       }
    1482       piPCMSample += uiWidth;
    1483     }
    1484 
    1485     piPCMSample = pcCU->getPCMSampleCr() + uiChromaOffset;
    1486     uiWidth = pcCU->getWidth(uiAbsPartIdx)/2;
    1487     uiHeight = pcCU->getHeight(uiAbsPartIdx)/2;
    1488     uiSampleBits = pcCU->getSlice()->getSPS()->getPCMBitDepthChroma();
    1489 
    1490     for(uiY = 0; uiY < uiHeight; uiY++)
    1491     {
    1492       for(uiX = 0; uiX < uiWidth; uiX++)
    1493       {
    1494         UInt uiSample = piPCMSample[uiX];
    1495 
    1496         m_pcBinIf->xWritePCMCode(uiSample, uiSampleBits);
    1497       }
    1498       piPCMSample += uiWidth;
    1499     }
     1469      piPCMSample = pcCU->getPCMSampleCb() + uiChromaOffset;
     1470      uiWidth = pcCU->getWidth(uiAbsPartIdx)/2;
     1471      uiHeight = pcCU->getHeight(uiAbsPartIdx)/2;
     1472      uiSampleBits = pcCU->getSlice()->getSPS()->getPCMBitDepthChroma();
     1473
     1474      for(uiY = 0; uiY < uiHeight; uiY++)
     1475      {
     1476        for(uiX = 0; uiX < uiWidth; uiX++)
     1477        {
     1478          UInt uiSample = piPCMSample[uiX];
     1479
     1480          m_pcBinIf->xWritePCMCode(uiSample, uiSampleBits);
     1481        }
     1482        piPCMSample += uiWidth;
     1483      }
     1484
     1485      piPCMSample = pcCU->getPCMSampleCr() + uiChromaOffset;
     1486      uiWidth = pcCU->getWidth(uiAbsPartIdx)/2;
     1487      uiHeight = pcCU->getHeight(uiAbsPartIdx)/2;
     1488      uiSampleBits = pcCU->getSlice()->getSPS()->getPCMBitDepthChroma();
     1489
     1490      for(uiY = 0; uiY < uiHeight; uiY++)
     1491      {
     1492        for(uiX = 0; uiX < uiWidth; uiX++)
     1493        {
     1494          UInt uiSample = piPCMSample[uiX];
     1495
     1496          m_pcBinIf->xWritePCMCode(uiSample, uiSampleBits);
     1497        }
     1498        piPCMSample += uiWidth;
     1499      }
    15001500#if H_3D_DISABLE_CHROMA
    15011501    }
  • branches/HTM-14.0-dev0/source/Lib/TLibEncoder/TEncSearch.cpp

    r1185 r1187  
    976976          {
    977977            m_pcEntropyCoder->encodeIntraDirModeLuma ( pcCU, uiPart * uiQNumParts );
    978 #if H_3D_SDC
     978#if H_3D_DIM_SDC
    979979          }
    980980          m_pcEntropyCoder->encodeSDCFlag( pcCU, 0, true );
     
    22112211  // encode pred direction + DC residual data
    22122212  m_pcEntropyCoder->encodePredInfo( pcCU, 0, true );
    2213 #if H_3D_SDC
     2213#if H_3D_DIM_SDC
    22142214  m_pcEntropyCoder->encodeSDCFlag( pcCU, 0, true );
    22152215#endif
     
    30163016    pcCU->getPattern()->initPattern   ( pcCU, uiInitTrDepth, uiPartOffset );
    30173017    pcCU->getPattern()->initAdiPattern( pcCU, uiPartOffset, uiInitTrDepth, m_piYuvExt, m_iYuvExtStride, m_iYuvExtHeight, bAboveAvail, bLeftAvail );
    3018    
     3018
    30193019    //===== determine set of modes to be tested (using prediction signal only) =====
    30203020    Int numModesAvailable     = 35; //total number of Intra modes
     
    30243024    UInt uiRdModeList[FAST_UDI_MAX_RDMODE_NUM];
    30253025    Int numModesForFullRD = g_aucIntraModeNumFast[ uiWidthBit ];
    3026    
     3026
    30273027#if H_3D_DIM
    30283028    if( bOnlyIVP )
     
    30333033    {
    30343034#endif
    3035     Bool doFastSearch = (numModesForFullRD != numModesAvailable);
    3036     if (doFastSearch)
    3037     {
    3038       assert(numModesForFullRD < numModesAvailable);
    3039 
    3040       for( Int i=0; i < numModesForFullRD; i++ )
    3041       {
    3042         CandCostList[ i ] = MAX_DOUBLE;
    3043       }
    3044       CandNum = 0;
    3045      
    3046       for( Int modeIdx = 0; modeIdx < numModesAvailable; modeIdx++ )
    3047       {
    3048         UInt uiMode = modeIdx;
    3049 
    3050         predIntraLumaAng( pcCU->getPattern(), uiMode, piPred, uiStride, uiWidth, uiHeight, bAboveAvail, bLeftAvail );
     3035      Bool doFastSearch = (numModesForFullRD != numModesAvailable);
     3036      if (doFastSearch)
     3037      {
     3038        assert(numModesForFullRD < numModesAvailable);
     3039
     3040        for( Int i=0; i < numModesForFullRD; i++ )
     3041        {
     3042          CandCostList[ i ] = MAX_DOUBLE;
     3043        }
     3044        CandNum = 0;
     3045
     3046        for( Int modeIdx = 0; modeIdx < numModesAvailable; modeIdx++ )
     3047        {
     3048          UInt uiMode = modeIdx;
     3049
     3050          predIntraLumaAng( pcCU->getPattern(), uiMode, piPred, uiStride, uiWidth, uiHeight, bAboveAvail, bLeftAvail );
    30513051#if H_3D_VSO // M34
    3052         Dist uiSad;
    3053         if ( m_pcRdCost->getUseVSO() )
    3054         {
    3055           if ( m_pcRdCost->getUseEstimatedVSD() )
    3056           {         
    3057             uiSad = (Dist) ( m_pcRdCost->getDistPartVSD( pcCU, uiPartOffset, piPred, uiStride, piOrg, uiStride, uiWidth, uiHeight, true ) );
     3052          Dist uiSad;
     3053          if ( m_pcRdCost->getUseVSO() )
     3054          {
     3055            if ( m_pcRdCost->getUseEstimatedVSD() )
     3056            {         
     3057              uiSad = (Dist) ( m_pcRdCost->getDistPartVSD( pcCU, uiPartOffset, piPred, uiStride, piOrg, uiStride, uiWidth, uiHeight, true ) );
     3058            }
     3059            else
     3060            {   
     3061              uiSad = m_pcRdCost->getDistPartVSO(pcCU, uiPartOffset, piPred, uiStride, piOrg, uiStride, uiWidth, uiHeight, true );
     3062            }
    30583063          }
    30593064          else
    3060           {   
    3061             uiSad = m_pcRdCost->getDistPartVSO(pcCU, uiPartOffset, piPred, uiStride, piOrg, uiStride, uiWidth, uiHeight, true );
     3065          {
     3066            uiSad = m_pcRdCost->calcHAD(g_bitDepthY, piOrg, uiStride, piPred, uiStride, uiWidth, uiHeight );
    30623067          }
    3063         }
    3064         else
    3065         {
    3066           uiSad = m_pcRdCost->calcHAD(g_bitDepthY, piOrg, uiStride, piPred, uiStride, uiWidth, uiHeight );
    3067         }
    30683068#else       
    3069         // use hadamard transform here
    3070         UInt uiSad = m_pcRdCost->calcHAD(g_bitDepthY, piOrg, uiStride, piPred, uiStride, uiWidth, uiHeight );
    3071 #endif
    3072        
    3073         UInt   iModeBits = xModeBitsIntra( pcCU, uiMode, uiPU, uiPartOffset, uiDepth, uiInitTrDepth );
     3069          // use hadamard transform here
     3070          UInt uiSad = m_pcRdCost->calcHAD(g_bitDepthY, piOrg, uiStride, piPred, uiStride, uiWidth, uiHeight );
     3071#endif
     3072
     3073          UInt   iModeBits = xModeBitsIntra( pcCU, uiMode, uiPU, uiPartOffset, uiDepth, uiInitTrDepth );
    30743074#if H_3D_VSO // M35
    3075         Double dLambda;
    3076         if ( m_pcRdCost->getUseLambdaScaleVSO() )
    3077         {
    3078           dLambda = m_pcRdCost->getUseRenModel() ? m_pcRdCost->getLambdaVSO() : m_pcRdCost->getSqrtLambdaVSO();
    3079         }
    3080         else       
    3081         {
    3082           dLambda = m_pcRdCost->getSqrtLambda();       
    3083         }
    3084 
    3085         Double cost      = (Double)uiSad + (Double)iModeBits * dLambda;
     3075          Double dLambda;
     3076          if ( m_pcRdCost->getUseLambdaScaleVSO() )
     3077          {
     3078            dLambda = m_pcRdCost->getUseRenModel() ? m_pcRdCost->getLambdaVSO() : m_pcRdCost->getSqrtLambdaVSO();
     3079          }
     3080          else       
     3081          {
     3082            dLambda = m_pcRdCost->getSqrtLambda();       
     3083          }
     3084
     3085          Double cost      = (Double)uiSad + (Double)iModeBits * dLambda;
    30863086#else
    3087         Double cost      = (Double)uiSad + (Double)iModeBits * m_pcRdCost->getSqrtLambda();
    3088 #endif
    3089        
    3090         CandNum += xUpdateCandList( uiMode, cost, numModesForFullRD, uiRdModeList, CandCostList );
    3091       }
    3092    
     3087          Double cost      = (Double)uiSad + (Double)iModeBits * m_pcRdCost->getSqrtLambda();
     3088#endif
     3089
     3090          CandNum += xUpdateCandList( uiMode, cost, numModesForFullRD, uiRdModeList, CandCostList );
     3091        }
     3092
    30933093#if FAST_UDI_USE_MPM
    3094       Int uiPreds[3] = {-1, -1, -1};
    3095       Int iMode = -1;
    3096       Int numCand = pcCU->getIntraDirLumaPredictor( uiPartOffset, uiPreds, &iMode );
    3097       if( iMode >= 0 )
    3098       {
    3099         numCand = iMode;
    3100       }
    3101      
    3102       for( Int j=0; j < numCand; j++)
    3103 
    3104       {
    3105         Bool mostProbableModeIncluded = false;
    3106         Int mostProbableMode = uiPreds[j];
    3107        
     3094        Int uiPreds[3] = {-1, -1, -1};
     3095        Int iMode = -1;
     3096        Int numCand = pcCU->getIntraDirLumaPredictor( uiPartOffset, uiPreds, &iMode );
     3097        if( iMode >= 0 )
     3098        {
     3099          numCand = iMode;
     3100        }
     3101
     3102        for( Int j=0; j < numCand; j++)
     3103
     3104        {
     3105          Bool mostProbableModeIncluded = false;
     3106          Int mostProbableMode = uiPreds[j];
     3107
     3108          for( Int i=0; i < numModesForFullRD; i++)
     3109          {
     3110            mostProbableModeIncluded |= (mostProbableMode == uiRdModeList[i]);
     3111          }
     3112          if (!mostProbableModeIncluded)
     3113          {
     3114            uiRdModeList[numModesForFullRD++] = mostProbableMode;
     3115          }
     3116        }
     3117#endif // FAST_UDI_USE_MPM
     3118      }
     3119      else
     3120      {
    31083121        for( Int i=0; i < numModesForFullRD; i++)
    31093122        {
    3110           mostProbableModeIncluded |= (mostProbableMode == uiRdModeList[i]);
    3111         }
    3112         if (!mostProbableModeIncluded)
    3113         {
    3114           uiRdModeList[numModesForFullRD++] = mostProbableMode;
    3115         }
    3116       }
    3117 #endif // FAST_UDI_USE_MPM
    3118     }
    3119     else
    3120     {
    3121       for( Int i=0; i < numModesForFullRD; i++)
    3122       {
    3123         uiRdModeList[i] = i;
    3124       }
    3125     }
     3123          uiRdModeList[i] = i;
     3124        }
     3125      }
    31263126#if H_3D_DIM
    31273127    }
    31283128#endif
    3129    
     3129
    31303130#if H_3D_DIM
    31313131    //===== determine set of depth intra modes to be tested =====
     
    31483148      {
    31493149#if H_3D_FAST_DEPTH_INTRA
    3150       Int  threshold    = max(((pcCU->getQP(0))>>3)-1,3);
    3151       Int  varThreshold = (Int)( threshold * threshold - 8 );
    3152       UInt varCU      = m_pcRdCost->calcVAR(piOrg, uiStride, uiWidth,uiHeight,pcCU->getDepth(0));
     3150        Int  threshold    = max(((pcCU->getQP(0))>>3)-1,3);
     3151        Int  varThreshold = (Int)( threshold * threshold - 8 );
     3152        UInt varCU      = m_pcRdCost->calcVAR(piOrg, uiStride, uiWidth,uiHeight,pcCU->getDepth(0));
    31533153#endif
    31543154
    31553155#if H_3D_DIM_DMM
    3156       if( ( ( m_pcEncCfg->getUseDMM() &&  pcCU->getSlice()->getIntraSdcWedgeFlag() )  || pcCU->getSlice()->getIntraContourFlag() )
     3156        if( ( ( m_pcEncCfg->getUseDMM() &&  pcCU->getSlice()->getIntraSdcWedgeFlag() )  || pcCU->getSlice()->getIntraContourFlag() )
    31573157#if H_3D_FAST_DEPTH_INTRA
    3158          && (uiRdModeList[0] != PLANAR_IDX || varCU >= varThreshold)
    3159 #endif
    3160         )
    3161       {
    3162         UInt uiStart, uiEnd;
    3163         if( ( m_pcEncCfg->getUseDMM() &&  pcCU->getSlice()->getIntraSdcWedgeFlag() ) &&  pcCU->getSlice()->getIntraContourFlag() )
    3164         {
    3165           uiStart = 0;
    3166           uiEnd   = 2;
    3167         }
    3168         else if( ( m_pcEncCfg->getUseDMM() &&  pcCU->getSlice()->getIntraSdcWedgeFlag() ) )
    3169         {
    3170           uiStart = 0;
    3171           uiEnd   = 1;
    3172         }
    3173         else if( pcCU->getSlice()->getIntraContourFlag() )
    3174         {
    3175           uiStart = 1;
    3176           uiEnd   = 2;
    3177         }
    3178         else
    3179         {
    3180           uiStart = 0;
    3181           uiEnd   = 0;
    3182         }
    3183         for( UInt dmmType = uiStart; dmmType < uiEnd; dmmType++ )
    3184         {
     3158          && (uiRdModeList[0] != PLANAR_IDX || varCU >= varThreshold)
     3159#endif
     3160          )
     3161        {
     3162          UInt uiStart, uiEnd;
     3163          if( ( m_pcEncCfg->getUseDMM() &&  pcCU->getSlice()->getIntraSdcWedgeFlag() ) &&  pcCU->getSlice()->getIntraContourFlag() )
     3164          {
     3165            uiStart = 0;
     3166            uiEnd   = 2;
     3167          }
     3168          else if( ( m_pcEncCfg->getUseDMM() &&  pcCU->getSlice()->getIntraSdcWedgeFlag() ) )
     3169          {
     3170            uiStart = 0;
     3171            uiEnd   = 1;
     3172          }
     3173          else if( pcCU->getSlice()->getIntraContourFlag() )
     3174          {
     3175            uiStart = 1;
     3176            uiEnd   = 2;
     3177          }
     3178          else
     3179          {
     3180            uiStart = 0;
     3181            uiEnd   = 0;
     3182          }
     3183          for( UInt dmmType = uiStart; dmmType < uiEnd; dmmType++ )
     3184          {
    31853185#if H_3D_FCO
    31863186            TComPic* picTexture  = pcCU->getSlice()->getIvPic(false, pcCU->getSlice()->getViewIndex() );
     
    31913191#endif
    31923192            {
    3193                 continue;
     3193              continue;
    31943194            }
    31953195#endif
    3196           UInt uiTabIdx = 0;
    3197           TComWedgelet* biSegmentation = NULL;
    3198           Pel deltaDC1 = 0; Pel deltaDC2 = 0;
    3199           switch( dmmType )
    3200           {
    3201           case( DMM1_IDX ):
     3196            UInt uiTabIdx = 0;
     3197            TComWedgelet* biSegmentation = NULL;
     3198            Pel deltaDC1 = 0; Pel deltaDC2 = 0;
     3199            switch( dmmType )
    32023200            {
    3203               xSearchDmm1Wedge( pcCU, uiPartOffset, piOrg, uiStride, uiWidth, uiHeight, uiTabIdx );
    3204               pcCU->setDmmWedgeTabIdxSubParts( uiTabIdx, dmmType,  uiPartOffset, uiDepth + uiInitTrDepth );
    3205               biSegmentation = pcCU->isDMM1UpscaleMode( uiWidth ) ?
     3201            case( DMM1_IDX ):
     3202              {
     3203                xSearchDmm1Wedge( pcCU, uiPartOffset, piOrg, uiStride, uiWidth, uiHeight, uiTabIdx );
     3204                pcCU->setDmmWedgeTabIdxSubParts( uiTabIdx, dmmType,  uiPartOffset, uiDepth + uiInitTrDepth );
     3205                biSegmentation = pcCU->isDMM1UpscaleMode( uiWidth ) ?
    32063206                  &(g_dmmWedgeLists[(g_aucConvertToBit[pcCU->getDMM1BasePatternWidth(uiWidth)])][uiTabIdx]) : &(g_dmmWedgeLists[(g_aucConvertToBit[uiWidth])][uiTabIdx]);
    3207             } break;
    3208 
    3209           case( DMM4_IDX ):
     3207              } break;
     3208
     3209            case( DMM4_IDX ):
     3210              {
     3211                {
     3212                  biSegmentation = new TComWedgelet( uiWidth, uiHeight );
     3213                  xPredContourFromTex( pcCU, uiPartOffset, uiWidth, uiHeight, biSegmentation );
     3214                }
     3215              } break;
     3216            default: assert(0);
     3217            }
     3218
     3219            if( biSegmentation )
    32103220            {
     3221              if( dmmType == DMM1_IDX && pcCU->isDMM1UpscaleMode( uiWidth ) ){
     3222                xSearchDmmDeltaDCs( pcCU, uiPartOffset, piOrg, piPred, uiStride, biSegmentation->getScaledPattern(uiWidth), uiWidth, uiWidth, uiHeight, deltaDC1, deltaDC2 );
     3223              }
     3224              else
    32113225              {
    3212                 biSegmentation = new TComWedgelet( uiWidth, uiHeight );
    3213                 xPredContourFromTex( pcCU, uiPartOffset, uiWidth, uiHeight, biSegmentation );
     3226                xSearchDmmDeltaDCs( pcCU, uiPartOffset, piOrg, piPred, uiStride, biSegmentation->getPattern(), biSegmentation->getStride(), uiWidth, uiHeight, deltaDC1, deltaDC2 );
    32143227              }
    3215             } break;
    3216           default: assert(0);
     3228              pcCU->setDimDeltaDC( dmmType, 0, uiPartOffset, deltaDC1 );
     3229              pcCU->setDimDeltaDC( dmmType, 1, uiPartOffset, deltaDC2 );
     3230
     3231              uiRdModeList[ numModesForFullRD++ ] = (dmmType  +DIM_OFFSET);
     3232              if( DMM4_IDX == dmmType ) { biSegmentation->destroy(); delete biSegmentation; }
     3233            }
    32173234          }
    3218 
    3219           if( biSegmentation )
    3220           {
    3221             if( dmmType == DMM1_IDX && pcCU->isDMM1UpscaleMode( uiWidth ) ){
    3222                 xSearchDmmDeltaDCs( pcCU, uiPartOffset, piOrg, piPred, uiStride, biSegmentation->getScaledPattern(uiWidth), uiWidth, uiWidth, uiHeight, deltaDC1, deltaDC2 );
    3223             }
    3224             else
    3225             {
    3226                 xSearchDmmDeltaDCs( pcCU, uiPartOffset, piOrg, piPred, uiStride, biSegmentation->getPattern(), biSegmentation->getStride(), uiWidth, uiHeight, deltaDC1, deltaDC2 );
    3227             }
    3228             pcCU->setDimDeltaDC( dmmType, 0, uiPartOffset, deltaDC1 );
    3229             pcCU->setDimDeltaDC( dmmType, 1, uiPartOffset, deltaDC2 );
    3230 
    3231             uiRdModeList[ numModesForFullRD++ ] = (dmmType  +DIM_OFFSET);
    3232             if( DMM4_IDX == dmmType ) { biSegmentation->destroy(); delete biSegmentation; }
    3233           }
    3234         }
    3235       }
     3235        }
    32363236#if H_3D_DIM
    32373237      }
     
    32453245    Double dSecondBestPUCost = MAX_DOUBLE;
    32463246#endif
    3247    
     3247
    32483248    UInt    uiBestPUMode  = 0;
    32493249#if H_3D_FAST_INTRA_SDC
     
    32793279      // set luma prediction mode
    32803280#if !H_3D_FAST_INTRA_SDC
    3281      UInt uiOrgMode = uiRdModeList[uiMode]; 
    3282 #endif
    3283      
     3281      UInt uiOrgMode = uiRdModeList[uiMode]; 
     3282#endif
     3283
    32843284#if H_3D_FAST_INTRA_SDC
    32853285      UInt uiOrgMode;
    32863286      if (uiMode < numModesForFullRD)
    32873287      {   
    3288          uiOrgMode = uiRdModeList[uiMode];
     3288        uiOrgMode = uiRdModeList[uiMode];
    32893289      }
    32903290      else
    32913291      {
    3292            uiOrgMode = uiRdModeList[uiMode - numModesForFullRD];
    3293 
    3294            if (uiBestPUModeConv <= 1 )
    3295            {
    3296            if (uiOrgMode > 1 && varCU < 1) continue;         
    3297            }
    3298            else
    3299            {
    3300               if (uiOrgMode != uiBestPUModeConv && uiOrgMode != uiSecondBestPUModeConv && uiOrgMode != uiThirdBestPUModeConv
    3301                   && uiOrgMode > 1 && uiOrgMode < NUM_INTRA_MODE && varCU < 4)
    3302               continue;
    3303            }
    3304        }
     3292        uiOrgMode = uiRdModeList[uiMode - numModesForFullRD];
     3293
     3294        if (uiBestPUModeConv <= 1 )
     3295        {
     3296          if (uiOrgMode > 1 && varCU < 1) continue;         
     3297        }
     3298        else
     3299        {
     3300          if (uiOrgMode != uiBestPUModeConv && uiOrgMode != uiSecondBestPUModeConv && uiOrgMode != uiThirdBestPUModeConv
     3301            && uiOrgMode > 1 && uiOrgMode < NUM_INTRA_MODE && varCU < 4)
     3302            continue;
     3303        }
     3304      }
    33053305#endif
    33063306
    33073307      pcCU->setLumaIntraDirSubParts ( uiOrgMode, uiPartOffset, uiDepth + uiInitTrDepth );
    3308      
     3308
    33093309#if H_3D_DIM_SDC
    33103310#if H_3D_FAST_INTRA_SDC
     
    33133313      Bool bTestSDC = ( m_pcEncCfg->getUseSDC() && pcCU->getSDCAvailable(uiPartOffset) );
    33143314#endif
    3315      
     3315
    33163316      for( UInt uiSDC=0; uiSDC<=(bTestSDC?1:0); uiSDC++ )
    33173317      {
     
    33523352          }
    33533353#endif
    3354      
     3354
    33553355#if H_3D_DIM_ENC || H_3D_DIM_SDC
    3356       Bool bTestZeroResi = false;
     3356          Bool bTestZeroResi = false;
    33573357#if H_3D_DIM_ENC
    3358       bTestZeroResi |= pcCU->getSlice()->getIsDepth() && !pcCU->getSlice()->isIRAP();
     3358          bTestZeroResi |= pcCU->getSlice()->getIsDepth() && !pcCU->getSlice()->isIRAP();
    33593359#endif
    33603360#if H_3D_DIM_SDC
    3361       bTestZeroResi |= pcCU->getSDCFlag(uiPartOffset);
    3362 #endif
    3363       if( uiSDC != 0 && iSDCDeltaResi != 0 )
    3364       {
    3365         bTestZeroResi = false;
    3366       }
    3367 #endif
    3368      
     3361          bTestZeroResi |= pcCU->getSDCFlag(uiPartOffset);
     3362#endif
     3363          if( uiSDC != 0 && iSDCDeltaResi != 0 )
     3364          {
     3365            bTestZeroResi = false;
     3366          }
     3367#endif
     3368
    33693369#if H_3D_DIM_ENC || H_3D_DIM_SDC     
    3370       for( UInt testZeroResi = 0; testZeroResi <= (bTestZeroResi ? 1 : 0) ; testZeroResi++ )
    3371       {
    3372 #endif
    3373         // set context models
    3374         m_pcRDGoOnSbacCoder->load( m_pppcRDSbacCoder[uiDepth][CI_CURR_BEST] );
    3375 
    3376         // determine residual for partition
     3370          for( UInt testZeroResi = 0; testZeroResi <= (bTestZeroResi ? 1 : 0) ; testZeroResi++ )
     3371          {
     3372#endif
     3373            // set context models
     3374            m_pcRDGoOnSbacCoder->load( m_pppcRDSbacCoder[uiDepth][CI_CURR_BEST] );
     3375
     3376            // determine residual for partition
    33773377#if H_3D_VSO
    3378         Dist   uiPUDistY = 0;
     3378            Dist   uiPUDistY = 0;
    33793379#else
    3380         UInt   uiPUDistY = 0;
    3381 #endif
    3382         UInt   uiPUDistC = 0;
    3383         Double dPUCost   = 0.0;
     3380            UInt   uiPUDistY = 0;
     3381#endif
     3382            UInt   uiPUDistC = 0;
     3383            Double dPUCost   = 0.0;
    33843384#if H_3D_VSO // M36
    3385         if( m_pcRdCost->getUseRenModel() )
    3386         {
    3387           m_pcRdCost->setRenModelData( pcCU, uiPartOffset, piOrg, uiStride, uiWidth, uiHeight );
    3388         }
     3385            if( m_pcRdCost->getUseRenModel() )
     3386            {
     3387              m_pcRdCost->setRenModelData( pcCU, uiPartOffset, piOrg, uiStride, uiWidth, uiHeight );
     3388            }
    33893389#endif
    33903390#if H_3D_DIM_SDC
    3391         if( pcCU->getSDCFlag(uiPartOffset) )
    3392         {
    3393           pcCU->setTrIdxSubParts(0, uiPartOffset, uiDepth + uiInitTrDepth);
    3394           pcCU->setCbfSubParts(1, 1, 1, uiPartOffset, uiDepth + uiInitTrDepth);
    3395 
    3396           // start encoding with SDC
    3397           xIntraCodingSDC(pcCU, uiPartOffset, pcOrgYuv, pcPredYuv, uiPUDistY, dPUCost, ( testZeroResi != 0 ), iSDCDeltaResi );
    3398           if ( testZeroResi == 0 && iOffset <= 3 )
    3399           {
    3400             dOffsetCost [iOffset -1] = dPUCost;
    3401           }
    3402         }
    3403         else
    3404         {
     3391            if( pcCU->getSDCFlag(uiPartOffset) )
     3392            {
     3393              pcCU->setTrIdxSubParts(0, uiPartOffset, uiDepth + uiInitTrDepth);
     3394              pcCU->setCbfSubParts(1, 1, 1, uiPartOffset, uiDepth + uiInitTrDepth);
     3395
     3396              // start encoding with SDC
     3397              xIntraCodingSDC(pcCU, uiPartOffset, pcOrgYuv, pcPredYuv, uiPUDistY, dPUCost, ( testZeroResi != 0 ), iSDCDeltaResi );
     3398              if ( testZeroResi == 0 && iOffset <= 3 )
     3399              {
     3400                dOffsetCost [iOffset -1] = dPUCost;
     3401              }
     3402            }
     3403            else
     3404            {
    34053405#endif
    34063406#if HHI_RQT_INTRA_SPEEDUP
    34073407#if H_3D_DIM_ENC
    3408           xRecurIntraCodingQT( pcCU, uiInitTrDepth, uiPartOffset, bLumaOnly, pcOrgYuv, pcPredYuv, pcResiYuv, uiPUDistY, uiPUDistC, true, dPUCost, (testZeroResi != 0) );
     3408              xRecurIntraCodingQT( pcCU, uiInitTrDepth, uiPartOffset, bLumaOnly, pcOrgYuv, pcPredYuv, pcResiYuv, uiPUDistY, uiPUDistC, true, dPUCost, (testZeroResi != 0) );
    34093409#if H_3D_FAST_INTRA_SDC   
    3410       if( dPUCost < dBestPUCostConv )
    3411       {
    3412         uiThirdBestPUModeConv = uiSecondBestPUModeConv;
    3413         uiSecondBestPUModeConv = uiBestPUModeConv;
    3414         uiBestPUModeConv  = uiOrgMode;
    3415         dBestPUCostConv   = dPUCost;
    3416       }
     3410              if( dPUCost < dBestPUCostConv )
     3411              {
     3412                uiThirdBestPUModeConv = uiSecondBestPUModeConv;
     3413                uiSecondBestPUModeConv = uiBestPUModeConv;
     3414                uiBestPUModeConv  = uiOrgMode;
     3415                dBestPUCostConv   = dPUCost;
     3416              }
    34173417#endif
    34183418#else
    3419           xRecurIntraCodingQT( pcCU, uiInitTrDepth, uiPartOffset, bLumaOnly, pcOrgYuv, pcPredYuv, pcResiYuv, uiPUDistY, uiPUDistC, true, dPUCost );
     3419              xRecurIntraCodingQT( pcCU, uiInitTrDepth, uiPartOffset, bLumaOnly, pcOrgYuv, pcPredYuv, pcResiYuv, uiPUDistY, uiPUDistC, true, dPUCost );
    34203420#endif
    34213421#else
    34223422#if H_3D_DIM_ENC
    3423           xRecurIntraCodingQT( pcCU, uiInitTrDepth, uiPartOffset, bLumaOnly, pcOrgYuv, pcPredYuv, pcResiYuv, uiPUDistY, uiPUDistC, dPUCost, (testZeroResi != 0) );
     3423              xRecurIntraCodingQT( pcCU, uiInitTrDepth, uiPartOffset, bLumaOnly, pcOrgYuv, pcPredYuv, pcResiYuv, uiPUDistY, uiPUDistC, dPUCost, (testZeroResi != 0) );
    34243424#else
    3425           xRecurIntraCodingQT( pcCU, uiInitTrDepth, uiPartOffset, bLumaOnly, pcOrgYuv, pcPredYuv, pcResiYuv, uiPUDistY, uiPUDistC, dPUCost );
     3425              xRecurIntraCodingQT( pcCU, uiInitTrDepth, uiPartOffset, bLumaOnly, pcOrgYuv, pcPredYuv, pcResiYuv, uiPUDistY, uiPUDistC, dPUCost );
    34263426#endif
    34273427#endif
    34283428#if H_3D_DIM_SDC
    3429         }
    3430 #endif
    3431 
    3432         // check r-d cost
    3433         if( dPUCost < dBestPUCost )
    3434         {
     3429            }
     3430#endif
     3431
     3432            // check r-d cost
     3433            if( dPUCost < dBestPUCost )
     3434            {
    34353435#if HHI_RQT_INTRA_SPEEDUP_MOD
    3436           uiSecondBestMode  = uiBestPUMode;
    3437           dSecondBestPUCost = dBestPUCost;
    3438 #endif
    3439           uiBestPUMode  = uiOrgMode;
    3440           uiBestPUDistY = uiPUDistY;
    3441           uiBestPUDistC = uiPUDistC;
    3442           dBestPUCost   = dPUCost;
     3436              uiSecondBestMode  = uiBestPUMode;
     3437              dSecondBestPUCost = dBestPUCost;
     3438#endif
     3439              uiBestPUMode  = uiOrgMode;
     3440              uiBestPUDistY = uiPUDistY;
     3441              uiBestPUDistC = uiPUDistC;
     3442              dBestPUCost   = dPUCost;
    34433443
    34443444#if H_3D_DIM_SDC
    3445           if( pcCU->getSDCFlag(uiPartOffset) )
    3446           {
    3447             bBestUseSDC = true;
    3448 
    3449             // copy reconstruction
    3450             pcPredYuv->copyPartToPartYuv(pcRecoYuv, uiPartOffset, uiWidth, uiHeight);
    3451 
    3452             // copy DC values
    3453             apBestDCOffsets[0] = pcCU->getSDCSegmentDCOffset(0, uiPartOffset);
    3454             apBestDCOffsets[1] = pcCU->getSDCSegmentDCOffset(1, uiPartOffset);
     3445              if( pcCU->getSDCFlag(uiPartOffset) )
     3446              {
     3447                bBestUseSDC = true;
     3448
     3449                // copy reconstruction
     3450                pcPredYuv->copyPartToPartYuv(pcRecoYuv, uiPartOffset, uiWidth, uiHeight);
     3451
     3452                // copy DC values
     3453                apBestDCOffsets[0] = pcCU->getSDCSegmentDCOffset(0, uiPartOffset);
     3454                apBestDCOffsets[1] = pcCU->getSDCSegmentDCOffset(1, uiPartOffset);
     3455              }
     3456              else
     3457              {
     3458                bBestUseSDC = false;
     3459#endif
     3460                xSetIntraResultQT( pcCU, uiInitTrDepth, uiPartOffset, bLumaOnly, pcRecoYuv );
     3461
     3462                UInt uiQPartNum = pcCU->getPic()->getNumPartInCU() >> ( ( pcCU->getDepth(0) + uiInitTrDepth ) << 1 );
     3463                ::memcpy( m_puhQTTempTrIdx,  pcCU->getTransformIdx()       + uiPartOffset, uiQPartNum * sizeof( UChar ) );
     3464                ::memcpy( m_puhQTTempCbf[0], pcCU->getCbf( TEXT_LUMA     ) + uiPartOffset, uiQPartNum * sizeof( UChar ) );
     3465                ::memcpy( m_puhQTTempCbf[1], pcCU->getCbf( TEXT_CHROMA_U ) + uiPartOffset, uiQPartNum * sizeof( UChar ) );
     3466                ::memcpy( m_puhQTTempCbf[2], pcCU->getCbf( TEXT_CHROMA_V ) + uiPartOffset, uiQPartNum * sizeof( UChar ) );
     3467                ::memcpy( m_puhQTTempTransformSkipFlag[0], pcCU->getTransformSkip(TEXT_LUMA)     + uiPartOffset, uiQPartNum * sizeof( UChar ) );
     3468                ::memcpy( m_puhQTTempTransformSkipFlag[1], pcCU->getTransformSkip(TEXT_CHROMA_U) + uiPartOffset, uiQPartNum * sizeof( UChar ) );
     3469                ::memcpy( m_puhQTTempTransformSkipFlag[2], pcCU->getTransformSkip(TEXT_CHROMA_V) + uiPartOffset, uiQPartNum * sizeof( UChar ) );
     3470#if H_3D_DIM_SDC
     3471              }
     3472#endif
     3473            }
     3474#if HHI_RQT_INTRA_SPEEDUP_MOD
     3475            else if( dPUCost < dSecondBestPUCost )
     3476            {
     3477              uiSecondBestMode  = uiOrgMode;
     3478              dSecondBestPUCost = dPUCost;
     3479            }
     3480#endif
     3481#if H_3D_DIM_ENC || H_3D_DIM_SDC
    34553482          }
    3456           else
    3457           {
    3458             bBestUseSDC = false;
    3459 #endif
    3460             xSetIntraResultQT( pcCU, uiInitTrDepth, uiPartOffset, bLumaOnly, pcRecoYuv );
    3461 
    3462             UInt uiQPartNum = pcCU->getPic()->getNumPartInCU() >> ( ( pcCU->getDepth(0) + uiInitTrDepth ) << 1 );
    3463             ::memcpy( m_puhQTTempTrIdx,  pcCU->getTransformIdx()       + uiPartOffset, uiQPartNum * sizeof( UChar ) );
    3464             ::memcpy( m_puhQTTempCbf[0], pcCU->getCbf( TEXT_LUMA     ) + uiPartOffset, uiQPartNum * sizeof( UChar ) );
    3465             ::memcpy( m_puhQTTempCbf[1], pcCU->getCbf( TEXT_CHROMA_U ) + uiPartOffset, uiQPartNum * sizeof( UChar ) );
    3466             ::memcpy( m_puhQTTempCbf[2], pcCU->getCbf( TEXT_CHROMA_V ) + uiPartOffset, uiQPartNum * sizeof( UChar ) );
    3467             ::memcpy( m_puhQTTempTransformSkipFlag[0], pcCU->getTransformSkip(TEXT_LUMA)     + uiPartOffset, uiQPartNum * sizeof( UChar ) );
    3468             ::memcpy( m_puhQTTempTransformSkipFlag[1], pcCU->getTransformSkip(TEXT_CHROMA_U) + uiPartOffset, uiQPartNum * sizeof( UChar ) );
    3469             ::memcpy( m_puhQTTempTransformSkipFlag[2], pcCU->getTransformSkip(TEXT_CHROMA_V) + uiPartOffset, uiQPartNum * sizeof( UChar ) );
    3470 #if H_3D_DIM_SDC
    3471           }
    3472 #endif
    3473         }
    3474 #if HHI_RQT_INTRA_SPEEDUP_MOD
    3475         else if( dPUCost < dSecondBestPUCost )
    3476         {
    3477           uiSecondBestMode  = uiOrgMode;
    3478           dSecondBestPUCost = dPUCost;
    3479         }
    3480 #endif
    3481 #if H_3D_DIM_ENC || H_3D_DIM_SDC
    3482       }
    34833483        } // SDC residual loop
    34843484#endif
     
    34873487#endif
    34883488    } // Mode loop
    3489    
     3489
    34903490#if HHI_RQT_INTRA_SPEEDUP
    34913491#if HHI_RQT_INTRA_SPEEDUP_MOD
     
    35023502      UInt uiOrgMode = uiBestPUMode;
    35033503#endif
    3504      
     3504
    35053505      pcCU->setLumaIntraDirSubParts ( uiOrgMode, uiPartOffset, uiDepth + uiInitTrDepth );
    35063506#if H_3D_DIM_SDC
    35073507      pcCU->setSDCFlagSubParts(false, uiPartOffset, uiDepth + uiInitTrDepth);
    35083508#endif
    3509      
     3509
    35103510      // set context models
    3511         m_pcRDGoOnSbacCoder->load( m_pppcRDSbacCoder[uiDepth][CI_CURR_BEST] );
    3512      
     3511      m_pcRDGoOnSbacCoder->load( m_pppcRDSbacCoder[uiDepth][CI_CURR_BEST] );
     3512
    35133513      // determine residual for partition
    35143514#if H_3D_VSO
     
    35273527#endif
    35283528      xRecurIntraCodingQT( pcCU, uiInitTrDepth, uiPartOffset, bLumaOnly, pcOrgYuv, pcPredYuv, pcResiYuv, uiPUDistY, uiPUDistC, false, dPUCost );
    3529      
     3529
    35303530      // check r-d cost
    35313531      if( dPUCost < dBestPUCost )
     
    35383538        bBestUseSDC   = false;
    35393539#endif
    3540        
     3540
    35413541        xSetIntraResultQT( pcCU, uiInitTrDepth, uiPartOffset, bLumaOnly, pcRecoYuv );
    3542        
     3542
    35433543        UInt uiQPartNum = pcCU->getPic()->getNumPartInCU() >> ( ( pcCU->getDepth(0) + uiInitTrDepth ) << 1 );
    35443544        ::memcpy( m_puhQTTempTrIdx,  pcCU->getTransformIdx()       + uiPartOffset, uiQPartNum * sizeof( UChar ) );
     
    35523552    } // Mode loop
    35533553#endif
    3554    
     3554
    35553555    //--- update overall distortion ---
    35563556    uiOverallDistY += uiBestPUDistY;
    35573557    uiOverallDistC += uiBestPUDistC;
    3558    
     3558
    35593559#if H_3D_DIM_SDC
    35603560    if( bBestUseSDC )
     
    35623562      pcCU->setTrIdxSubParts(0, uiPartOffset, uiDepth + uiInitTrDepth);
    35633563      pcCU->setCbfSubParts(1, 1, 1, uiPartOffset, uiDepth + uiInitTrDepth);
    3564      
     3564
    35653565      //=== copy best DC segment values back to CU ====
    35663566      pcCU->setSDCSegmentDCOffset(apBestDCOffsets[0], 0, uiPartOffset);
     
    35703570    {
    35713571#endif
    3572         //--- update transform index and cbf ---
    3573     UInt uiQPartNum = pcCU->getPic()->getNumPartInCU() >> ( ( pcCU->getDepth(0) + uiInitTrDepth ) << 1 );
    3574     ::memcpy( pcCU->getTransformIdx()       + uiPartOffset, m_puhQTTempTrIdx,  uiQPartNum * sizeof( UChar ) );
    3575     ::memcpy( pcCU->getCbf( TEXT_LUMA     ) + uiPartOffset, m_puhQTTempCbf[0], uiQPartNum * sizeof( UChar ) );
    3576     ::memcpy( pcCU->getCbf( TEXT_CHROMA_U ) + uiPartOffset, m_puhQTTempCbf[1], uiQPartNum * sizeof( UChar ) );
    3577     ::memcpy( pcCU->getCbf( TEXT_CHROMA_V ) + uiPartOffset, m_puhQTTempCbf[2], uiQPartNum * sizeof( UChar ) );
    3578     ::memcpy( pcCU->getTransformSkip(TEXT_LUMA)     + uiPartOffset, m_puhQTTempTransformSkipFlag[0], uiQPartNum * sizeof( UChar ) );
    3579     ::memcpy( pcCU->getTransformSkip(TEXT_CHROMA_U) + uiPartOffset, m_puhQTTempTransformSkipFlag[1], uiQPartNum * sizeof( UChar ) );
    3580     ::memcpy( pcCU->getTransformSkip(TEXT_CHROMA_V) + uiPartOffset, m_puhQTTempTransformSkipFlag[2], uiQPartNum * sizeof( UChar ) );
     3572      //--- update transform index and cbf ---
     3573      UInt uiQPartNum = pcCU->getPic()->getNumPartInCU() >> ( ( pcCU->getDepth(0) + uiInitTrDepth ) << 1 );
     3574      ::memcpy( pcCU->getTransformIdx()       + uiPartOffset, m_puhQTTempTrIdx,  uiQPartNum * sizeof( UChar ) );
     3575      ::memcpy( pcCU->getCbf( TEXT_LUMA     ) + uiPartOffset, m_puhQTTempCbf[0], uiQPartNum * sizeof( UChar ) );
     3576      ::memcpy( pcCU->getCbf( TEXT_CHROMA_U ) + uiPartOffset, m_puhQTTempCbf[1], uiQPartNum * sizeof( UChar ) );
     3577      ::memcpy( pcCU->getCbf( TEXT_CHROMA_V ) + uiPartOffset, m_puhQTTempCbf[2], uiQPartNum * sizeof( UChar ) );
     3578      ::memcpy( pcCU->getTransformSkip(TEXT_LUMA)     + uiPartOffset, m_puhQTTempTransformSkipFlag[0], uiQPartNum * sizeof( UChar ) );
     3579      ::memcpy( pcCU->getTransformSkip(TEXT_CHROMA_U) + uiPartOffset, m_puhQTTempTransformSkipFlag[1], uiQPartNum * sizeof( UChar ) );
     3580      ::memcpy( pcCU->getTransformSkip(TEXT_CHROMA_V) + uiPartOffset, m_puhQTTempTransformSkipFlag[2], uiQPartNum * sizeof( UChar ) );
    35813581#if H_3D_DIM_SDC
    35823582    }
     
    35943594        bChromaSame  = true;
    35953595      }
    3596      
     3596
    35973597      UInt    uiCompWidth   = pcCU->getWidth ( 0 ) >> uiInitTrDepth;
    35983598      UInt    uiCompHeight  = pcCU->getHeight( 0 ) >> uiInitTrDepth;
     
    36463646      }
    36473647    }
    3648    
     3648
    36493649    //=== update PU data ====
    36503650    pcCU->setLumaIntraDirSubParts     ( uiBestPUMode, uiPartOffset, uiDepth + uiInitTrDepth );
     
    39743974 
    39753975#if H_3D_DBBP
    3976   DBBPTmpData* pDBBPTmpData = pcCU->getDBBPTmpData();
     3976  DbbpTmpData* pDBBPTmpData = pcCU->getDBBPTmpData();
    39773977  if( pcCU->getDBBPFlag(0) )
    39783978  {
     
    49644964  {
    49654965#if H_3D_DBBP
    4966     DBBPTmpData* pDBBPTmpData = pcCU->getDBBPTmpData();
     4966    DbbpTmpData* pDBBPTmpData = pcCU->getDBBPTmpData();
    49674967    if( pcCU->getDBBPFlag(0) )
    49684968    {
     
    53265326 
    53275327#if H_MV
    5328   Bool bMv_VRng_Restricted = false;
     5328  Bool motVecVertRngRestricted = false;
    53295329  if( m_pcEncCfg->getUseDisparitySearchRangeRestriction()
    53305330       &&
     
    53325332    )
    53335333  {
    5334       bMv_VRng_Restricted = true;
    5335   }
    5336   if ( bBi )  xSetSearchRange   ( pcCU, rcMv   , iSrchRng, cMvSrchRngLT, cMvSrchRngRB, bMv_VRng_Restricted, m_pcEncCfg->getVerticalDisparitySearchRange() );
    5337   else        xSetSearchRange   ( pcCU, cMvPred, iSrchRng, cMvSrchRngLT, cMvSrchRngRB, bMv_VRng_Restricted, m_pcEncCfg->getVerticalDisparitySearchRange() );
     5334      motVecVertRngRestricted = true;
     5335  }
     5336  if ( bBi )  xSetSearchRange   ( pcCU, rcMv   , iSrchRng, cMvSrchRngLT, cMvSrchRngRB, motVecVertRngRestricted, m_pcEncCfg->getVerticalDisparitySearchRange() );
     5337  else        xSetSearchRange   ( pcCU, cMvPred, iSrchRng, cMvSrchRngLT, cMvSrchRngRB, motVecVertRngRestricted, m_pcEncCfg->getVerticalDisparitySearchRange() );
    53385338#else
    53395339  if ( bBi )  xSetSearchRange   ( pcCU, rcMv   , iSrchRng, cMvSrchRngLT, cMvSrchRngRB );
     
    55235523  if( ! pcCU->getSlice()->getIsDepth() )
    55245524#endif
    5525   rcMv >>= 2;
     5525    rcMv >>= 2;
    55265526  // init TZSearchStruct
    55275527  IntTZSearchStruct cStruct;
Note: See TracChangeset for help on using the changeset viewer.