Changeset 655 in 3DVCSoftware for trunk/source/Lib/TLibCommon


Ignore:
Timestamp:
23 Oct 2013, 23:01:30 (11 years ago)
Author:
tech
Message:

Merged 8.1-Cleanup@654

Location:
trunk/source/Lib/TLibCommon
Files:
22 edited

Legend:

Unmodified
Added
Removed
  • trunk/source/Lib/TLibCommon/CommonDef.h

    r625 r655  
    6161#if H_MV
    6262#define NV_VERSION        "8.1"                 ///< Current software version
    63 #define HM_VERSION        "11.0"                ///<
     63#define HM_VERSION        "12.0"                ///<
    6464#else
    65 #define NV_VERSION        "11.0"                 ///< Current software version
     65#define NV_VERSION        "12.0"                 ///< Current software version
    6666#endif
    6767
     
    187187}
    188188
    189 #if H_MV5
    190189template <typename T>
    191190__inline T gCeilLog2( T val )
     
    196195  return ceilLog2;
    197196}
    198 #endif
    199197
    200198#define RemoveBitIncrement( exp ) ( exp >> ( g_bitDepthY - 8 ) )
  • trunk/source/Lib/TLibCommon/ContextTables.h

    r622 r655  
    112112#if H_3D_DIM_DMM
    113113#define NUM_DMM1_DATA_CTX             1       ///< number of context models for DMM1 data
    114 #if !SEC_DMM2_E0146_HHIFIX
    115 #define NUM_DMM2_DATA_CTX             1       ///< number of context models for DMM2 data
    116 #endif
    117114#define NUM_DMM3_DATA_CTX             1       ///< number of context models for DMM3 data
    118115#endif
     
    127124#endif
    128125
    129 #if LGE_INTER_SDC_E0156
     126#if H_3D_INTER_SDC
    130127#define NUM_INTER_SDC_FLAG_CTX        1      ///< number of context models for inter SDC flag
    131128#define NUM_INTER_SDC_SIGN_FLAG_CTX   1      ///< number of context models for sign of inter SDC residual
     
    390387#endif
    391388#if H_3D_DIM
    392 #if ZJU_DEPTH_INTRA_MODE_E0204
    393389static const UChar
    394390INIT_DEPTH_INTRA_MODE[3][NUM_DEPTH_INTRA_MODE_CTX] =
     
    398394    {64, 0, CNU, CNU, 168, 109,   0, 0}
    399395};
    400 #else
    401 static const UChar
    402 INIT_DEPTH_INTRA_MODE[3][NUM_DEPTH_INTRA_MODE_CTX] =
    403 {
    404   {0,  0,  64,   0, CNU,   0, CNU, 0},
    405   {0, 64,   0, CNU,   0, CNU,   0, 0},
    406   {64, 0, CNU,   0, CNU,   0,   0, 0}
    407 };
    408 #endif
     396
    409397static const UChar
    410398INIT_DDC_FLAG[3][NUM_DDC_FLAG_CTX] =
     
    429417  { CNU },
    430418};
    431 #if !SEC_DMM2_E0146_HHIFIX
    432 static const UChar
    433 INIT_DMM2_DATA[3][NUM_DMM2_DATA_CTX] =
    434 {
    435   { CNU },
    436   { CNU },
    437   { CNU },
    438 };
    439 #endif
    440419static const UChar
    441420INIT_DMM3_DATA[3][NUM_DMM3_DATA_CTX] =
     
    473452#endif
    474453
    475 #if LGE_INTER_SDC_E0156
     454#if H_3D_INTER_SDC
    476455static const UChar
    477456INIT_INTER_SDC_FLAG[3][NUM_INTER_SDC_FLAG_CTX] =
  • trunk/source/Lib/TLibCommon/TComDataCU.cpp

    r622 r655  
    120120    m_dmmWedgeTabIdx[i] = NULL;
    121121  }
    122 #if !SEC_DMM2_E0146_HHIFIX
    123   m_dmm2DeltaEnd    = NULL;
    124 #endif
    125122  m_dmm3IntraTabIdx = NULL;
    126123#endif
     
    153150  m_pbICFlag             = NULL;
    154151#endif
    155 #if LGE_INTER_SDC_E0156
     152#if H_3D_INTER_SDC
    156153  m_pbInterSDCFlag       = NULL;
    157154  for( Int i = 0; i < 4; i++ )
     
    274271      m_dmmWedgeTabIdx[i]    = (UInt*)xMalloc(UInt, uiNumPartition);
    275272    }
    276 #if !SEC_DMM2_E0146_HHIFIX
    277     m_dmm2DeltaEnd    = (Int* )xMalloc(Int,  uiNumPartition);
    278 #endif
    279273    m_dmm3IntraTabIdx = (UInt*)xMalloc(UInt, uiNumPartition);
    280274#endif
     
    292286#endif
    293287#endif
    294 #if LGE_INTER_SDC_E0156
     288#if H_3D_INTER_SDC
    295289    m_pbInterSDCFlag     = (Bool*  )xMalloc(Bool,   uiNumPartition);
    296290    for( Int i = 0; i < 4; i++ )
     
    305299    m_acCUMvField[1].setNumPartition(uiNumPartition );
    306300  }
    307 #if LGE_INTER_SDC_E0156
     301#if H_3D_INTER_SDC
    308302  m_pucInterSDCMask     = (UChar*  )xMalloc(UChar,    g_uiMaxCUHeight*g_uiMaxCUWidth);
    309303#endif
     
    410404      if ( m_dmmWedgeTabIdx[i] ) { xFree( m_dmmWedgeTabIdx[i] ); m_dmmWedgeTabIdx[i] = NULL; }
    411405    }
    412 #if !SEC_DMM2_E0146_HHIFIX
    413     if ( m_dmm2DeltaEnd    ) { xFree( m_dmm2DeltaEnd    ); m_dmm2DeltaEnd    = NULL; }
    414 #endif
    415406    if ( m_dmm3IntraTabIdx ) { xFree( m_dmm3IntraTabIdx ); m_dmm3IntraTabIdx = NULL; }
    416407#endif
     
    428419#endif
    429420#endif   
    430 #if LGE_INTER_SDC_E0156
     421#if H_3D_INTER_SDC
    431422    if ( m_pbInterSDCFlag     ) { xFree(m_pbInterSDCFlag);      m_pbInterSDCFlag    = NULL; }
    432423    for(Int i = 0; i < 4; i++ )
     
    436427#endif
    437428  }
    438 #if LGE_INTER_SDC_E0156
     429#if H_3D_INTER_SDC
    439430  if ( m_pucInterSDCMask     ) { xFree(m_pucInterSDCMask);      m_pucInterSDCMask    = NULL; }
    440431#endif
     
    575566    m_pbSDCFlag[ui] = pcFrom->m_pbSDCFlag[ui];
    576567#endif
    577 #if LGE_INTER_SDC_E0156
     568#if H_3D_INTER_SDC
    578569    m_pbInterSDCFlag[ui] = pcFrom->m_pbInterSDCFlag[ui];
    579570#endif
     
    631622      memset( m_dmmWedgeTabIdx[i] + firstElement, 0,                      numElements * sizeof( *m_dmmWedgeTabIdx[i] ) );
    632623    }
    633 #if !SEC_DMM2_E0146_HHIFIX
    634     memset( m_dmm2DeltaEnd      + firstElement, 0,                        numElements * sizeof( *m_dmm2DeltaEnd    ) );
    635 #endif
    636624    memset( m_dmm3IntraTabIdx   + firstElement, 0,                        numElements * sizeof( *m_dmm3IntraTabIdx ) );
    637625#endif
     
    649637#endif
    650638#endif
    651 #if LGE_INTER_SDC_E0156
     639#if H_3D_INTER_SDC
    652640    memset( m_pbInterSDCFlag   + firstElement,     0,                    numElements * sizeof( *m_pbInterSDCFlag ) );
    653641    for( Int i = 0; i < 4; i++ )
     
    811799        m_dmmWedgeTabIdx[i] [ui] = 0;
    812800      }
    813 #if !SEC_DMM2_E0146_HHIFIX
    814       m_dmm2DeltaEnd    [ui] = 0;
    815 #endif
    816801      m_dmm3IntraTabIdx [ui] = 0;
    817802#endif
     
    822807#endif
    823808#endif
    824 #if LGE_INTER_SDC_E0156
     809#if H_3D_INTER_SDC
    825810      m_pbInterSDCFlag[ui] = false;
    826811      for( Int i = 0; i < 4; i++ )
     
    925910    memset( m_dmmWedgeTabIdx[i], 0, sizeof(UInt) * m_uiNumPartition );
    926911  }
    927 #if !SEC_DMM2_E0146_HHIFIX
    928   memset( m_dmm2DeltaEnd   , 0, sizeof(Int ) * m_uiNumPartition );
    929 #endif
    930912  memset( m_dmm3IntraTabIdx, 0, sizeof(UInt) * m_uiNumPartition );
    931913#endif
     
    943925#endif
    944926#endif
    945 #if LGE_INTER_SDC_E0156
     927#if H_3D_INTER_SDC
    946928  memset( m_pbInterSDCFlag,           0, sizeof( Bool ) * m_uiNumPartition );
    947929  for( Int i = 0; i < 4; i++ )
     
    1010992        m_dmmWedgeTabIdx[i] [ui] = pcCU->m_dmmWedgeTabIdx[i] [uiPartOffset+ui];
    1011993      }
    1012 #if !SEC_DMM2_E0146_HHIFIX
    1013       m_dmm2DeltaEnd    [ui] = pcCU->m_dmm2DeltaEnd   [uiPartOffset+ui];
    1014 #endif
    1015994      m_dmm3IntraTabIdx [ui] = pcCU->m_dmm3IntraTabIdx[uiPartOffset+ui];
    1016995#endif
     
    10211000#endif
    10221001#endif
    1023 #if LGE_INTER_SDC_E0156
     1002#if H_3D_INTER_SDC
    10241003      m_pbInterSDCFlag      [ui] = pcCU->m_pbInterSDCFlag    [ uiPartOffset + ui ];
    10251004      for( Int i = 0; i < 4; i++ )
     
    11671146    m_dmmWedgeTabIdx[i] = pcCU->getDmmWedgeTabIdx( i ) + uiPart;
    11681147  }
    1169 #if !SEC_DMM2_E0146_HHIFIX
    1170   m_dmm2DeltaEnd    = pcCU->getDmm2DeltaEnd()    + uiPart;
    1171 #endif
    11721148  m_dmm3IntraTabIdx = pcCU->getDmm3IntraTabIdx() + uiPart;
    11731149#endif
     
    11851161#endif
    11861162#endif 
    1187 #if LGE_INTER_SDC_E0156
     1163#if H_3D_INTER_SDC
    11881164  m_pbInterSDCFlag          = pcCU->getInterSDCFlag()       + uiPart;
    11891165  for( Int i = 0; i < 4; i++ )
     
    13661342    memcpy( m_dmmWedgeTabIdx[i] + uiOffset, pcCU->getDmmWedgeTabIdx( i ), sizeof(UInt) * uiNumPartition );
    13671343  }
    1368 #if !SEC_DMM2_E0146_HHIFIX
    1369   memcpy( m_dmm2DeltaEnd    + uiOffset, pcCU->getDmm2DeltaEnd()   , sizeof(Int ) * uiNumPartition );
    1370 #endif
    13711344  memcpy( m_dmm3IntraTabIdx + uiOffset, pcCU->getDmm3IntraTabIdx(), sizeof(UInt) * uiNumPartition );
    13721345#endif
     
    13841357#endif
    13851358#endif
    1386 #if LGE_INTER_SDC_E0156
     1359#if H_3D_INTER_SDC
    13871360  memcpy( m_pbInterSDCFlag  + uiOffset, pcCU->getInterSDCFlag(),      iSizeInBool  );
    13881361  for( Int i = 0; i < 4; i++ )
     
    14961469    memcpy( rpcCU->getDmmWedgeTabIdx( i ) + m_uiAbsIdxInLCU, m_dmmWedgeTabIdx[i], sizeof(UInt) * m_uiNumPartition );
    14971470  }
    1498 #if !SEC_DMM2_E0146_HHIFIX
    1499   memcpy( rpcCU->getDmm2DeltaEnd()    + m_uiAbsIdxInLCU, m_dmm2DeltaEnd   , sizeof(Int ) * m_uiNumPartition );
    1500 #endif
    15011471  memcpy( rpcCU->getDmm3IntraTabIdx() + m_uiAbsIdxInLCU, m_dmm3IntraTabIdx, sizeof(UInt) * m_uiNumPartition );
    15021472#endif
     
    15141484#endif
    15151485#endif
    1516 #if LGE_INTER_SDC_E0156
     1486#if H_3D_INTER_SDC
    15171487  memcpy( rpcCU->getInterSDCFlag() + m_uiAbsIdxInLCU, m_pbInterSDCFlag,      iSizeInBool  );
    15181488  for( Int i = 0;i < 4; i++ )
     
    16121582    memcpy( rpcCU->getDmmWedgeTabIdx( i ) + uiPartOffset, m_dmmWedgeTabIdx[i], sizeof(UInt) * uiQNumPart );
    16131583  }
    1614 #if !SEC_DMM2_E0146_HHIFIX
    1615   memcpy( rpcCU->getDmm2DeltaEnd()    + uiPartOffset, m_dmm2DeltaEnd   , sizeof(Int ) * uiQNumPart );
    1616 #endif
    16171584  memcpy( rpcCU->getDmm3IntraTabIdx() + uiPartOffset, m_dmm3IntraTabIdx, sizeof(UInt) * uiQNumPart );
    16181585#endif
     
    16301597#endif
    16311598#endif
    1632 #if LGE_INTER_SDC_E0156
     1599#if H_3D_INTER_SDC
    16331600  memcpy( rpcCU->getInterSDCFlag() + uiPartOffset, m_pbInterSDCFlag,      iSizeInBool  );
    16341601  for( Int i = 0; i < 4; i++ )
     
    23512318#endif
    23522319
    2353 #if LGE_INTER_SDC_E0156
     2320#if H_3D_INTER_SDC
    23542321Void TComDataCU::setInterSDCFlagSubParts ( Bool bInterSDCFlag, UInt uiAbsPartIdx, UInt uiPartIdx, UInt uiDepth )
    23552322{
     
    26892656  // check prediction mode
    26902657  UInt uiLumaPredMode = getLumaIntraDir( uiAbsPartIdx ); 
    2691 #if LGE_SDC_REMOVE_DC_E0158
    26922658  if( uiLumaPredMode == PLANAR_IDX || ( getDimType( uiLumaPredMode ) == DMM1_IDX && !isDimDeltaDC( uiLumaPredMode ) ) )
    2693 #else
    2694   if( uiLumaPredMode == DC_IDX || uiLumaPredMode == PLANAR_IDX || ( getDimType( uiLumaPredMode ) == DMM1_IDX && !isDimDeltaDC( uiLumaPredMode ) ) )
    2695 #endif
    26962659    return true;
    26972660 
     
    35693532    UInt uiPartIdxCenter;
    35703533    xDeriveCenterIdx( uiPUIdx, uiPartIdxCenter );   
     3534#if H_3D_FCO
     3535    TComPic * pcTexturePic = m_pcSlice->getTexturePic();
     3536    TComDataCU *pcTextureCU = 0;
     3537    if ( pcTexturePic )
     3538        pcTextureCU = pcTexturePic->getCU( getAddr() );
     3539#else
    35713540    TComDataCU *pcTextureCU = m_pcSlice->getTexturePic()->getCU( getAddr() );
     3541#endif
    35723542 
     3543#if H_3D_FCO
     3544    if ( pcTextureCU && pcTexturePic->getReconMark() && !pcTextureCU->isIntra( uiPartIdxCenter ) )
     3545#else
    35733546    if ( pcTextureCU && !pcTextureCU->isIntra( uiPartIdxCenter ) )
     3547#endif
    35743548    {
    35753549      pcTextureCU->getMvField( pcTextureCU, uiPartIdxCenter, REF_PIC_LIST_0, pcMvFieldNeighbours[iCount<<1] );
     
    48304804
    48314805  // use coldir.
    4832 #if H_MV5
    48334806  TComPic *pColPic = getSlice()->getRefPic( RefPicList(getSlice()->isInterB() ? 1-getSlice()->getColFromL0Flag() : 0), getSlice()->getColRefIdx());
    4834 #else
    4835 #if H_MV
    4836   TComPic *pColPic; 
    4837   if (getSlice()->getAltCollocatedIndicationFlag() )
    4838   {
    4839     pColPic = getSlice()->getPicFromRefPicSetInterLayer( getSlice()->getActiveMotionPredRefLayerId( getSlice()->getCollocatedRefLayerIdx() ));
    4840   }
    4841   else
    4842   {
    4843     pColPic = getSlice()->getRefPic( RefPicList(getSlice()->isInterB() ? 1-getSlice()->getColFromL0Flag() : 0), getSlice()->getColRefIdx()); 
    4844   } 
    4845 #else
    4846   TComPic *pColPic = getSlice()->getRefPic( RefPicList(getSlice()->isInterB() ? 1-getSlice()->getColFromL0Flag() : 0), getSlice()->getColRefIdx());
    4847 #endif
    4848 #endif
    48494807  TComDataCU *pColCU = pColPic->getCU( uiCUAddr );
    48504808  if(pColCU->getPic()==0||pColCU->getPartitionSize(uiPartUnitIdx)==SIZE_NONE)
     
    49964954                                        + ( iPartWidth/m_pcPic->getMinCUWidth()  )/2];
    49974955}
    4998 #if MTK_SONY_PROGRESSIVE_MV_COMPRESSION_E0170
    4999 Void TComDataCU::compressMV(int scale)
     4956#if H_3D
     4957Void TComDataCU::compressMV(Int scale)
    50004958#else
    50014959Void TComDataCU::compressMV()
    50024960#endif
    50034961{
    5004 #if MTK_SONY_PROGRESSIVE_MV_COMPRESSION_E0170
     4962#if H_3D
    50054963  Int scaleFactor = (4 / scale ) * AMVP_DECIMATION_FACTOR / m_unitSize;
    50064964#else
     
    55095467    xDeriveCenterIdx(uiPartIdx, uiPartIdxCenter );
    55105468
    5511     ///*** Derive bottom right neighbour position ***
    5512 #if !SEC_SIMPLIFIED_NBDV_E0142
    5513     Int iLCUIdxRBNb  = -1;   
    5514     Int iPartIdxRBNb = -1;
    5515     xDeriveRightBottomNbIdx(iLCUIdxRBNb, iPartIdxRBNb );
    5516 #endif
    5517 
    55185469    ///*** Search temporal candidate pictures for disparity vector ***
    55195470    const Int iNumCandPics = getPic()->getNumDdvCandPics();
     
    55335484      }
    55345485
    5535 #if !SEC_SIMPLIFIED_NBDV_E0142
    5536       // Check BR and Center       
    5537       for(Int curPosition = 0; curPosition < 2; curPosition++)
    5538       {
    5539 #endif
    5540         Bool bCheck = false;
    5541 #if !SEC_SIMPLIFIED_NBDV_E0142
    5542         if ( curPosition == 0 && iLCUIdxRBNb >= 0 )
    5543 #if MTK_NBDV_TN_FIX_E0172
    5544           bCheck = xGetColDisMV( curCandPic, eCurRefPicList, curCandPicRefIdx, iLCUIdxRBNb, iPartIdxRBNb,  cColMv, iTargetViewIdx, iTStartViewIdx);
     5486      Bool bCheck = xGetColDisMV( curCandPic, eCurRefPicList, curCandPicRefIdx, uiLCUIdx,   uiPartIdxCenter,  cColMv, iTargetViewIdx, iTStartViewIdx );
     5487
     5488      if( bCheck )
     5489      {
     5490        clipMv(cColMv);
     5491        pDInfo->m_acNBDV = cColMv;
     5492        pDInfo->m_aVIdxCan  = iTargetViewIdx;
     5493
     5494#if H_3D_NBDV_REF
     5495        TComPic* picDepth = NULL;   
     5496#if H_3D_FCO_VSP_DONBDV_E0163
     5497        picDepth  = getSlice()->getIvPic(true, getSlice()->getViewIndex() );
     5498        if ( picDepth->getPicYuvRec() != NULL  ) 
     5499        {
     5500          cColMv.setZero();
     5501        }
     5502        else // Go back with virtual depth
     5503        {
     5504          picDepth = getSlice()->getIvPic( true, iTargetViewIdx );
     5505        }
     5506
     5507        assert(picDepth != NULL);
    55455508#else
    5546           bCheck = xGetColDisMV( eCurRefPicList, curCandPicRefIdx, iLCUIdxRBNb, iPartIdxRBNb,  cColMv, iTargetViewIdx, iTStartViewIdx);
    5547 #endif
    5548 
    5549         if (curPosition == 1 )
    5550 #endif
    5551 #if MTK_NBDV_TN_FIX_E0172
    5552           bCheck = xGetColDisMV( curCandPic, eCurRefPicList, curCandPicRefIdx, uiLCUIdx,   uiPartIdxCenter,  cColMv, iTargetViewIdx, iTStartViewIdx );
    5553 #else
    5554           bCheck = xGetColDisMV( eCurRefPicList, curCandPicRefIdx, uiLCUIdx,   uiPartIdxCenter,  cColMv, iTargetViewIdx, iTStartViewIdx );
    5555 #endif
    5556 
    5557         if( bCheck )
    5558         {
    5559           clipMv(cColMv);
    5560           pDInfo->m_acNBDV = cColMv;
    5561           pDInfo->m_aVIdxCan  = iTargetViewIdx;
    5562 
    5563 #if H_3D_NBDV_REF
    5564           TComPic* picDepth = NULL;         
    5565           picDepth = getSlice()->getIvPic( true, iTargetViewIdx );
    5566           assert(picDepth != NULL);
    5567           if (picDepth && bDepthRefine)
    5568             estimateDVFromDM(iTargetViewIdx, uiPartIdx, picDepth, uiPartAddr, &cColMv );
    5569 
    5570           pDInfo->m_acDoNBDV  = cColMv;
     5509        picDepth = getSlice()->getIvPic( true, iTargetViewIdx );
     5510        assert(picDepth != NULL);
     5511#endif
     5512        if (picDepth && bDepthRefine)
     5513          estimateDVFromDM(iTargetViewIdx, uiPartIdx, picDepth, uiPartAddr, &cColMv );
     5514
     5515        pDInfo->m_acDoNBDV  = cColMv;
    55715516#endif //H_3D_NBDV_REF
    5572           return true;
    5573         }
    5574 #if !SEC_SIMPLIFIED_NBDV_E0142
    5575       }
    5576 #endif
     5517        return true;
     5518      }
    55775519    }
    55785520  }
     
    55875529  if ( xCheckSpatialNBDV( pcTmpCU, uiIdx, pDInfo, bCheckMcpDv, &cIDVInfo, DVFROM_LEFT
    55885530#if H_3D_NBDV_REF
    5589   , bDepthRefine
     5531    , bDepthRefine
    55905532#endif
    55915533    ) )
     
    55995541    if ( xCheckSpatialNBDV( pcTmpCU, uiIdx, pDInfo, bCheckMcpDv, &cIDVInfo, DVFROM_ABOVE
    56005542#if H_3D_NBDV_REF
    5601   , bDepthRefine
    5602 #endif
    5603     ) )
     5543      , bDepthRefine
     5544#endif
     5545      ) )
    56045546      return true;
    56055547  }
    5606 
    5607 #if !SEC_SIMPLIFIED_NBDV_E0142
    5608   //// ******* Get disparity from above right block ******* /////
    5609   pcTmpCU = getPUAboveRight(uiIdx, uiPartIdxRT, true);
    5610   if(pcTmpCU != NULL )
    5611   {
    5612     bCheckMcpDv = ( ( getAddr() - pcTmpCU->getAddr() ) == 0);
    5613     if ( xCheckSpatialNBDV( pcTmpCU, uiIdx, pDInfo, bCheckMcpDv, &cIDVInfo, DVFROM_ABOVERIGHT
    5614 #if H_3D_NBDV_REF
    5615   , bDepthRefine
    5616 #endif
    5617     ) )
    5618       return true;
    5619   }
    5620 
    5621   //// ******* Get disparity from below left block ******* /////
    5622   pcTmpCU = getPUBelowLeft(uiIdx, uiPartIdxLB, true);
    5623   if( pcTmpCU != NULL )
    5624   {
    5625     bCheckMcpDv = true;
    5626     if ( xCheckSpatialNBDV( pcTmpCU, uiIdx, pDInfo, bCheckMcpDv, &cIDVInfo, DVFROM_LEFTBELOW
    5627 #if H_3D_NBDV_REF
    5628   , bDepthRefine
    5629 #endif
    5630     ) )
    5631       return true;
    5632   }
    5633 
    5634   //// ******* Get disparity from above left block ******* /////
    5635   pcTmpCU = getPUAboveLeft(uiIdx, (m_uiAbsIdxInLCU + uiPartAddr), true);
    5636   assert(uiPartIdxLT == (m_uiAbsIdxInLCU + uiPartAddr));
    5637 
    5638   if( pcTmpCU != NULL )
    5639   {
    5640     bCheckMcpDv = (( getAddr() - pcTmpCU->getAddr() ) <= 1);
    5641     if ( xCheckSpatialNBDV( pcTmpCU, uiIdx, pDInfo, bCheckMcpDv, &cIDVInfo, DVFROM_ABOVELEFT
    5642 #if H_3D_NBDV_REF
    5643   , bDepthRefine
    5644 #endif
    5645     ) )
    5646       return true;
    5647   }
    5648 #endif
    56495548
    56505549  //// ******* Search MCP blocks ******* /////
     
    56625561          pDInfo->m_aVIdxCan = cIDVInfo.m_aVIdxCan[iList][ curPos ];
    56635562#if H_3D_NBDV_REF
     5563#if H_3D_FCO_VSP_DONBDV_E0163
     5564          TComPic* picDepth  = NULL;
     5565
     5566          picDepth  = getSlice()->getIvPic(true, getSlice()->getViewIndex() );
     5567          if ( picDepth->getPicYuvRec() != NULL ) 
     5568          {
     5569            cDispVec.setZero();
     5570          }
     5571          else // Go back with virtual depth
     5572          {
     5573            picDepth = getSlice()->getIvPic( true, pDInfo->m_aVIdxCan );
     5574          }
     5575
     5576          assert(picDepth != NULL);
     5577#else
    56645578          TComPic* picDepth = getSlice()->getIvPic( true, pDInfo->m_aVIdxCan );
    56655579          assert(picDepth!=NULL);
     5580#endif
    56665581
    56675582          if (picDepth && bDepthRefine)
     
    56795594  TComMv defaultDV(0, 0);
    56805595  pDInfo->m_acNBDV = defaultDV;
    5681 #if NBDV_DEFAULT_VIEWIDX_BUGFIX
     5596
    56825597  Int valid = 0;
    56835598  Int viewIndex = 0;
     
    57075622#if H_3D_NBDV_REF
    57085623    TComPic* picDepth = NULL;
     5624#if H_3D_FCO_VSP_DONBDV_E0163
     5625    picDepth  = getSlice()->getIvPic(true, getSlice()->getViewIndex() );
     5626    if ( picDepth->getPicYuvRec() != NULL ) 
     5627    {
     5628      defaultDV.setZero();
     5629    }
     5630    else // Go back with virtual depth
     5631    {
     5632      picDepth = getSlice()->getIvPic( true, viewIndex );
     5633    }
     5634
     5635    assert(picDepth != NULL);
     5636#else
    57095637    picDepth = getSlice()->getIvPic( true, viewIndex );
    57105638    assert(picDepth!=NULL);
    5711 
     5639#endif
    57125640    if (picDepth && bDepthRefine)
    57135641    {
     
    57175645#endif
    57185646  }
    5719 #else
    5720   pDInfo->m_aVIdxCan = 0;
    5721 #if H_3D_NBDV_REF
    5722   TComPic* picDepth = NULL;
    5723   picDepth = getSlice()->getIvPic( true, 0 );
    5724   assert(picDepth!=NULL);
    5725 
    5726   if (picDepth && bDepthRefine)
    5727   {
    5728     estimateDVFromDM(0, uiPartIdx, picDepth, uiPartAddr, &defaultDV ); // from base view
    5729   }
    5730   pDInfo->m_acDoNBDV = defaultDV;
    5731 #endif
    5732 #endif
    57335647  return false;
    57345648}
     
    57405654  Int iPictureHeight = pcBaseViewDepthPicYuv->getHeight();
    57415655 
    5742 #if NTT_DoNBDV_VECTOR_CLIP_E0141
    57435656  Int depthStartPosX = Clip3(0,   iPictureWidth - 1,  iBlkX + ((mv->getHor()+2)>>2));
    57445657  Int depthStartPosY = Clip3(0,   iPictureHeight - 1, iBlkY + ((mv->getVer()+2)>>2));
    57455658  Int depthEndPosX   = Clip3(0,   iPictureWidth - 1,  iBlkX + iBlkWidth - 1 + ((mv->getHor()+2)>>2));
    57465659  Int depthEndPosY   = Clip3(0,   iPictureHeight - 1, iBlkY + iBlkHeight - 1 + ((mv->getVer()+2)>>2));
    5747 #else
    5748   Int depthStartPosX = Clip3(0,   iPictureWidth - iBlkWidth,  iBlkX + ((mv->getHor()+2)>>2));
    5749   Int depthStartPosY = Clip3(0,   iPictureHeight- iBlkHeight,  iBlkY + ((mv->getVer()+2)>>2));
    5750   Int depthEndPosX   = Clip3(0,   iPictureWidth - 1,  iBlkX + iBlkWidth - 1 + ((mv->getHor()+2)>>2));
    5751   Int depthEndPosY   = Clip3(0,   iPictureHeight - 1,  iBlkY + iBlkHeight - 1 + ((mv->getVer()+2)>>2));
    5752 #endif
    57535660
    57545661  Pel* depthTL  = pcBaseViewDepthPicYuv->getLumaAddr();
     
    58125719          TComPic* picDepth = NULL;
    58135720          assert(getSlice()->getRefPic(eRefPicList, refId)->getPOC() == getSlice()->getPOC());         
     5721#if H_3D_FCO_VSP_DONBDV_E0163
     5722          picDepth  = getSlice()->getIvPic(true, getSlice()->getViewIndex() );
     5723          if ( picDepth->getPicYuvRec() != NULL ) 
     5724          {
     5725            cMvPred.setZero();
     5726          }
     5727          else// Go back with virtual depth
     5728          {
     5729            picDepth = getSlice()->getIvPic (true, refViewIdx );
     5730          }
     5731          assert(picDepth != NULL);
     5732#else
    58145733          picDepth   = getSlice()->getIvPic (true, refViewIdx );
    58155734          assert(picDepth != NULL);
    5816 
     5735#endif
    58175736          UInt uiPartIdx = 0;   //Notes from MTK: Please confirm that using 0 as partition index and partition address is correct for CU-level DoNBDV
    58185737          UInt uiPartAddr = 0;  //QC: confirmed
     
    58295748          assert( uiMvpDvPos < IDV_CANDS );
    58305749          paIDVInfo->m_acMvCand[iList][ uiMvpDvPos ] = TComMv( cMvPred.getIDVHor(), cMvPred.getIDVVer() );
    5831           //Notes from QC: DvMCP is implemented in a way that doesnE½t carry the reference view identifier as NBDV. It only works for CTC and needs to be fixed to be aligned with other part of the NBDV design.
     5750          //Notes from QC: DvMCP is implemented in a way that doesnot carry the reference view identifier as NBDV. It only works for CTC and needs to be fixed to be aligned with other part of the NBDV design.
    58325751          paIDVInfo->m_aVIdxCan[iList][ uiMvpDvPos ] = cMvPred.getIDVVId();
    58335752          paIDVInfo->m_bAvailab[iList][ uiMvpDvPos ] = true;
     
    59015820}
    59025821#endif
    5903 #if MTK_NBDV_TN_FIX_E0172
     5822
    59045823Bool TComDataCU::xGetColDisMV( Int currCandPic, RefPicList eRefPicList, Int refidx, Int uiCUAddr, Int uiPartUnitIdx, TComMv& rcMv , Int & iTargetViewIdx, Int & iStartViewIdx )
    5905 #else
    5906 Bool TComDataCU::xGetColDisMV( RefPicList eRefPicList, Int refidx, Int uiCUAddr, Int uiPartUnitIdx, TComMv& rcMv , Int & iTargetViewIdx, Int & iStartViewIdx )
    5907 #endif
    59085824{
    59095825
     
    59215837    if(pColCU->getSlice()->isInterB())
    59225838    {
    5923         eColRefPicList = RefPicList(ilist);
     5839      eColRefPicList = RefPicList(ilist);
    59245840    }
    59255841
     
    59395855    else
    59405856    {
    5941 #if MTK_NBDV_TN_FIX_E0172
    59425857      if(getPic()->isTempIVRefValid(currCandPic, ilist,  iColRefIdx))
    59435858      {
    5944 #endif
    5945       rcMv = pColCU->getCUMvField(eColRefPicList)->getMv(uiPartUnitIdx);
    5946       rcMv.setIDVFlag(0);
    5947       iTargetViewIdx  = iColRefViewIdx ;
    5948       iStartViewIdx   = iColViewIdx   ;
    5949       return true;   
    5950 #if MTK_NBDV_TN_FIX_E0172
    5951       }
    5952 #endif
     5859        rcMv = pColCU->getCUMvField(eColRefPicList)->getMv(uiPartUnitIdx);
     5860        rcMv.setIDVFlag(0);
     5861        iTargetViewIdx  = iColRefViewIdx ;
     5862        iStartViewIdx   = iColViewIdx   ;
     5863        return true;   
     5864      }
    59535865    }
    59545866  }
     
    59575869}
    59585870#endif
    5959 #if  MTK_FAST_TEXTURE_ENCODING_E0173
     5871#if  H_3D_FAST_TEXTURE_ENCODING
    59605872Void
    59615873TComDataCU::getIVNStatus       ( UInt uiPartIdx,  DisInfo* pDInfo, Bool& bIVFMerge, Int& iIVFMaxD)
     
    62426154  for( UInt ui = 0; ui < uiCurrPartNumb; ui++ ) { m_dmmWedgeTabIdx[dmmType][uiAbsPartIdx+ui] = tabIdx; }
    62436155}
    6244 #if !SEC_DMM2_E0146_HHIFIX
    6245 Void  TComDataCU::setDmm2DeltaEndSubParts( Int iDelta, UInt uiAbsPartIdx, UInt uiDepth )
    6246 {
    6247   UInt uiCurrPartNumb = m_pcPic->getNumPartInCU() >> (uiDepth << 1);
    6248   for( UInt ui = 0; ui < uiCurrPartNumb; ui++ ) { m_dmm2DeltaEnd[uiAbsPartIdx+ui] = iDelta; }
    6249 }
    6250 #endif
    62516156Void  TComDataCU::setDmm3IntraTabIdxSubParts( UInt uiTIdx, UInt uiAbsPartIdx, UInt uiDepth )
    62526157{
  • trunk/source/Lib/TLibCommon/TComDataCU.h

    r622 r655  
    208208#if H_3D_DIM_DMM
    209209  UInt*         m_dmmWedgeTabIdx[DMM_NUM_TYPE];
    210 #if !SEC_DMM2_E0146_HHIFIX
    211   Int*          m_dmm2DeltaEnd;
    212 #endif
    213210  UInt*         m_dmm3IntraTabIdx;
    214211#endif
     
    225222#endif
    226223#endif
    227 #if LGE_INTER_SDC_E0156
     224#if H_3D_INTER_SDC
    228225  Bool*         m_pbInterSDCFlag;
    229226  Int*          m_apSegmentInterDCOffset[4];
     
    489486#endif
    490487  );
    491 #if MTK_NBDV_TN_FIX_E0172
    492488  Bool          xGetColDisMV      ( Int currCandPic, RefPicList eRefPicList, Int refidx, Int uiCUAddr, Int uiPartUnitIdx, TComMv& rcMv, Int & iTargetViewIdx, Int & iStartViewIdx );
    493 #else
    494   Bool          xGetColDisMV      ( RefPicList eRefPicList, Int refidx, Int uiCUAddr, Int uiPartUnitIdx, TComMv& rcMv, Int & iTargetViewIdx, Int & iStartViewIdx );
    495 #endif
    496489  Bool          getDisMvpCandNBDV ( DisInfo* pDInfo
    497490#if H_3D_NBDV_REF
     
    505498#endif //H_3D_NBDV_REF
    506499#endif
    507 #if  MTK_FAST_TEXTURE_ENCODING_E0173
     500#if  H_3D_FAST_TEXTURE_ENCODING
    508501  Void          getIVNStatus       ( UInt uiPartIdx,  DisInfo* pDInfo, Bool& bIVFMerge,  Int& iIVFMaxD);
    509502#endif
     
    545538  Void  setDmmWedgeTabIdxSubParts     ( UInt tabIdx, UInt dmmType, UInt uiAbsPartIdx, UInt uiDepth );
    546539
    547 #if !SEC_DMM2_E0146_HHIFIX
    548   Int*  getDmm2DeltaEnd               ()                      { return m_dmm2DeltaEnd;        }
    549   Int   getDmm2DeltaEnd               ( UInt uiIdx )          { return m_dmm2DeltaEnd[uiIdx]; }
    550   Void  setDmm2DeltaEnd               ( UInt uiIdx, Int iD )  { m_dmm2DeltaEnd[uiIdx] = iD;   }
    551   Void  setDmm2DeltaEndSubParts       ( Int iDelta, UInt uiAbsPartIdx, UInt uiDepth );
    552 #endif
    553 
    554540  UInt* getDmm3IntraTabIdx            ()                      { return m_dmm3IntraTabIdx;        }
    555541  UInt  getDmm3IntraTabIdx            ( UInt uiIdx )          { return m_dmm3IntraTabIdx[uiIdx]; }
     
    588574#endif
    589575#endif
    590 #if LGE_INTER_SDC_E0156
     576#if H_3D_INTER_SDC
    591577  Bool*         getInterSDCFlag     ()                        { return m_pbInterSDCFlag;               }
    592578  Bool          getInterSDCFlag     ( UInt uiIdx )            { return m_pbInterSDCFlag[uiIdx];        }
     
    626612  Void          getMvPredAbove        ( TComMv&     rcMvPred )   { rcMvPred = m_cMvFieldB.getMv(); }
    627613  Void          getMvPredAboveRight   ( TComMv&     rcMvPred )   { rcMvPred = m_cMvFieldC.getMv(); }
    628 #if MTK_SONY_PROGRESSIVE_MV_COMPRESSION_E0170
    629   Void          compressMV            (int scale);
     614#if H_3D
     615  Void          compressMV            ( Int scale );
    630616#else           
    631617  Void          compressMV            ();
  • trunk/source/Lib/TLibCommon/TComMv.h

    r622 r655  
    4040
    4141#include "CommonDef.h"
     42#include <cstdlib>
    4243
    4344//! \ingroup TLibCommon
  • trunk/source/Lib/TLibCommon/TComPattern.h

    r608 r655  
    102102  Bool              m_bICFlag;
    103103#endif
    104 #if LGE_INTER_SDC_E0156
     104#if H_3D_INTER_SDC
    105105  Bool              m_bSDCMRSADFlag;
    106106#endif
     
    119119  Void  setICFlag( Bool bICFlag ) { m_bICFlag = bICFlag; }
    120120#endif
    121 #if LGE_INTER_SDC_E0156
     121#if H_3D_INTER_SDC
    122122  Bool  getSDCMRSADFlag()         { return m_bSDCMRSADFlag; }
    123123  Void  setSDCMRSADFlag( Bool bSDCMRSADFlag )    { m_bSDCMRSADFlag = bSDCMRSADFlag; }
  • trunk/source/Lib/TLibCommon/TComPic.cpp

    r608 r655  
    5050, m_bUsedByCurr                           (false)
    5151, m_bIsLongTerm                           (false)
    52 , m_bIsUsedAsLongTerm                     (false)
    5352, m_apcPicSym                             (NULL)
    5453, m_pcPicYuvPred                          (NULL)
     
    118117  memcpy(m_numReorderPics, numReorderPics, MAX_TLAYER*sizeof(Int));
    119118
     119  /* initialize the texture to depth reference status */
     120#if H_3D_FCO
     121  for (int j=0; j<2; j++)
     122  {
     123      for (int i=0; i<MAX_NUM_REF; i++)
     124      {
     125          m_aiTexToDepRef[j][i] = -1;
     126      }
     127  }
     128#endif
     129
    120130  return;
    121131}
     
    146156  deleteSEIs(m_SEIs);
    147157}
    148 #if MTK_SONY_PROGRESSIVE_MV_COMPRESSION_E0170
    149 Void TComPic::compressMotion(int scale)
     158#if H_3D
     159Void TComPic::compressMotion(Int scale)
    150160#else
    151161Void TComPic::compressMotion()
     
    156166  {
    157167    TComDataCU* pcCU = pPicSym->getCU(uiCUAddr);
    158 #if MTK_SONY_PROGRESSIVE_MV_COMPRESSION_E0170
     168#if H_3D
    159169    pcCU->compressMV(scale);
    160170#else
     
    661671  return numDdvCandPics;
    662672}
    663 #endif
    664 #if MTK_NBDV_TN_FIX_E0172
     673
    665674Void TComPic::checkTemporalIVRef()
    666675{
     
    716725  return m_abTIVRINCurrRL[currCandPic][iColRefDir][iColRefIdx];
    717726}
    718 #endif
    719 #if MTK_TEXTURE_MRGCAND_BUGFIX_E0182
     727
    720728Void TComPic::checkTextureRef(  )
    721729{
    722730  TComSlice* pcCurrSlice = getSlice(getCurrSliceIdx());
    723731  TComPic* pcTextPic = pcCurrSlice->getTexturePic();
     732#if H_3D_FCO
     733  if ( pcTextPic )
     734  {
     735#endif
     736
    724737  TComSlice* pcTextSlice = pcTextPic->getSlice(0); // currently only support single slice
    725738
     
    743756
    744757  }
     758#if H_3D_FCO
     759  }
     760#endif
     761
    745762}
    746763
  • trunk/source/Lib/TLibCommon/TComPic.h

    r608 r655  
    6161  Bool                  m_bUsedByCurr;            //  Used by current picture
    6262  Bool                  m_bIsLongTerm;            //  IS long term picture
    63   Bool                  m_bIsUsedAsLongTerm;      //  long term picture is used as reference before
    6463  TComPicSym*           m_apcPicSym;              //  Symbol
    6564 
     
    8382  Window                m_defaultDisplayWindow;
    8483
     84  bool                  m_isTop;
     85  bool                  m_isField;
     86 
    8587  std::vector<std::vector<TComDataCU*> > m_vSliceCUDataLink;
    8688
     
    104106  RefPicList  m_eRapRefList;
    105107  Int         m_iNumDdvCandPics;
    106 #endif
    107 #if MTK_NBDV_TN_FIX_E0172
    108108  Bool        m_abTIVRINCurrRL  [2][2][MAX_NUM_REF]; //whether an inter-view reference picture with the same view index of the inter-view reference picture of temporal reference picture of current picture exists in current reference picture lists
    109 #endif
    110 #if MTK_TEXTURE_MRGCAND_BUGFIX_E0182 
    111109  Int         m_aiTexToDepRef  [2][MAX_NUM_REF];
    112110#endif
     
    186184  Void          setNumReorderPics(Int i, UInt tlayer) { m_numReorderPics[tlayer] = i;    }
    187185  Int           getNumReorderPics(UInt tlayer)        { return m_numReorderPics[tlayer]; }
    188 #if MTK_SONY_PROGRESSIVE_MV_COMPRESSION_E0170
    189   Void          compressMotion(int scale);
     186#if H_3D
     187  Void          compressMotion(Int scale);
    190188#else   
    191189  Void          compressMotion();
     
    212210  TComPicYuv*   getYuvPicBufferForIndependentBoundaryProcessing()             {return m_pNDBFilterYuvTmp;}
    213211  std::vector<TComDataCU*>& getOneSliceCUDataForNDBFilter      (Int sliceID) { return m_vSliceCUDataLink[sliceID];}
     212
     213
     214  /* field coding parameters*/
     215
     216   Void              setTopField(bool b)                  {m_isTop = b;}
     217   bool              isTopField()                         {return m_isTop;}
     218   Void              setField(bool b)                     {m_isField = b;}
     219   bool              isField()                            {return m_isField;}
    214220
    215221#if H_MV
     
    224230  UInt          getRapRefIdx()                         {return m_uiRapRefIdx;       }
    225231  RefPicList    getRapRefList()                        {return m_eRapRefList;       }
    226 #endif
    227 #if MTK_NBDV_TN_FIX_E0172
    228   Void      checkTemporalIVRef();
    229   Bool      isTempIVRefValid(Int currCandPic, Int iTempRefDir, Int iTempRefIdx);
    230 #endif
    231 #if MTK_TEXTURE_MRGCAND_BUGFIX_E0182
    232   Void      checkTextureRef(  );
    233   Int       isTextRefValid(Int iTextRefDir, Int iTextRefIdx);
     232  Void          checkTemporalIVRef();
     233  Bool          isTempIVRefValid(Int currCandPic, Int iTempRefDir, Int iTempRefIdx);
     234  Void          checkTextureRef(  );
     235  Int           isTextRefValid(Int iTextRefDir, Int iTextRefIdx);
    234236#endif
    235237  /** transfer ownership of seis to this picture */
  • trunk/source/Lib/TLibCommon/TComPicSym.cpp

    r608 r655  
    6161,m_uiNumAllocatedSlice (0)
    6262,m_apcTComDataCU (NULL)
    63 ,m_iTileBoundaryIndependenceIdr (0)
    6463,m_iNumColumnsMinus1 (0)
    6564,m_iNumRowsMinus1(0)
  • trunk/source/Lib/TLibCommon/TComPicSym.h

    r608 r655  
    9999  UInt          m_uiNumAllocatedSlice;
    100100  TComDataCU**  m_apcTComDataCU;        ///< array of CU data
    101  
    102   Int           m_iTileBoundaryIndependenceIdr;
     101   
    103102  Int           m_iNumColumnsMinus1;
    104103  Int           m_iNumRowsMinus1;
  • trunk/source/Lib/TLibCommon/TComPrediction.cpp

    r622 r655  
    3939#include "TComPrediction.h"
    4040
    41 #if SHARP_ILLUCOMP_REFINE_E0046
    42 #define IC_REG_COST_SHIFT 7
    43 #define IC_CONST_SHIFT 5
    44 #define IC_SHIFT_DIFF 12
    45 #endif
    46 
    4741//! \ingroup TLibCommon
    4842//! \{
     
    6963  if (m_pDepthBlock != NULL)
    7064      free(m_pDepthBlock);
    71 #if NTT_VSP_COMMON_E0207_E0208
    7265  m_cYuvDepthOnVsp.destroy();
    73 #endif
    7466#endif
    7567
     
    129121    m_acYuvPredBase[1] .create( g_uiMaxCUWidth, g_uiMaxCUHeight );
    130122#endif
    131 #if NTT_VSP_COMMON_E0207_E0208
     123#if H_3D_VSP
    132124    m_cYuvDepthOnVsp.create( g_uiMaxCUWidth, g_uiMaxCUHeight );
    133125#endif
     
    143135  }
    144136#if H_3D_IC
    145 #if SHARP_ILLUCOMP_REFINE_E0046
    146137  m_uiaShift[0] = 0;
    147138  for( Int i = 1; i < 64; i++ )
     
    149140    m_uiaShift[i] = ( (1 << 15) + i/2 ) / i;
    150141  }
    151 #else
    152   for( Int i = 1; i < 64; i++ )
    153   {
    154     m_uiaShift[i-1] = ( (1 << 15) + i/2 ) / i;
    155   }
    156 #endif
    157142#endif
    158143}
     
    456441        dmmSegmentation = &(g_dmmWedgeLists[ g_aucConvertToBit[iWidth] ][ pcCU->getDmmWedgeTabIdx( dimType, uiAbsPartIdx ) ]);
    457442      } break;
    458 #if !SEC_DMM2_E0146_HHIFIX
    459     case( DMM2_IDX ):
    460       {
    461         UInt uiTabIdx = 0;
    462         if( bFastEnc ) { uiTabIdx = pcCU->getDmmWedgeTabIdx( dimType, uiAbsPartIdx ); }
    463         else
    464         {
    465           uiTabIdx = xPredWedgeFromIntra( pcCU, uiAbsPartIdx, iWidth, iHeight, pcCU->getDmm2DeltaEnd( uiAbsPartIdx ) );
    466           pcCU->setDmmWedgeTabIdxSubParts( uiTabIdx, dimType, uiAbsPartIdx, (pcCU->getDepth(0) + (pcCU->getPartitionSize(0) == SIZE_2Nx2N ? 0 : 1)) );
    467         }
    468         dmmSegmentation = &(g_dmmWedgeLists[ g_aucConvertToBit[iWidth] ][ uiTabIdx ]);
    469       } break;
    470 #endif
    471443    case( DMM3_IDX ):
    472444      {
     
    709681#endif
    710682      , bICFlag );
    711 #if SHARP_ILLUCOMP_REFINE_E0046
    712683    bICFlag = bICFlag && (iWidth > 8);
    713 #endif
    714684    xPredInterChromaBlk( pcCU, pcCU->getSlice()->getRefPic( eRefPicList, iRefIdx )->getPicYuvRec(), uiPartAddr, &cMv, iWidth, iHeight, rpcYuvPred, bi
    715685#if H_3D_ARP
     
    731701  // Get depth reference
    732702  Int       depthRefViewIdx = pcCU->getDvInfo(uiPartAddr).m_aVIdxCan;
     703#if H_3D_FCO_VSP_DONBDV_E0163
     704  TComPic* pRefPicBaseDepth = 0;
     705  Bool     bIsCurrDepthCoded = false;
     706  pRefPicBaseDepth  = pcCU->getSlice()->getIvPic( true, pcCU->getSlice()->getViewIndex() );
     707  if ( pRefPicBaseDepth->getPicYuvRec() != NULL  )
     708  {
     709    bIsCurrDepthCoded = true;
     710  }
     711  else
     712  {
     713    pRefPicBaseDepth = pcCU->getSlice()->getIvPic (true, depthRefViewIdx );
     714  }
     715#else
    733716  TComPic* pRefPicBaseDepth = pcCU->getSlice()->getIvPic (true, depthRefViewIdx );
     717#endif
    734718  assert(pRefPicBaseDepth != NULL);
    735719  TComPicYuv* pcBaseViewDepthPicYuv = pRefPicBaseDepth->getPicYuvRec();
     
    752736  pcCU->clipMv(cDv);
    753737
    754 #if NTT_VSP_COMMON_E0207_E0208
     738#if H_3D_FCO_VSP_DONBDV_E0163
     739  if ( bIsCurrDepthCoded )
     740  {
     741      cDv.setZero();
     742  }
     743#endif
    755744  // fetch virtual depth map
    756 #if NTT_VSP_VECTOR_CLIP_E0208
    757745  pcBaseViewDepthPicYuv->extendPicBorder();
    758 #endif
    759746  xGetVirtualDepth( pcCU, pcBaseViewDepthPicYuv, &cDv, uiPartAddr, iWidth, iHeight, &m_cYuvDepthOnVsp );
    760747  // sub-PU based compensation
    761748  xPredInterLumaBlkFromDM   ( pcCU, pcBaseViewTxtPicYuv, &m_cYuvDepthOnVsp, pShiftLUT, &cDv, uiPartAddr, iWidth, iHeight, pcCU->getSlice()->getIsDepth(), rpcYuvPred, bi );
    762749  xPredInterChromaBlkFromDM ( pcCU, pcBaseViewTxtPicYuv, &m_cYuvDepthOnVsp, pShiftLUT, &cDv, uiPartAddr, iWidth, iHeight, pcCU->getSlice()->getIsDepth(), rpcYuvPred, bi );
    763 #else
    764   UInt uiAbsPartIdx = pcCU->getZorderIdxInCU();
    765   Int iBlkX = ( pcCU->getAddr() % pRefPicBaseDepth->getFrameWidthInCU() ) * g_uiMaxCUWidth  + g_auiRasterToPelX[ g_auiZscanToRaster[ uiAbsPartIdx ] ];
    766   Int iBlkY = ( pcCU->getAddr() / pRefPicBaseDepth->getFrameWidthInCU() ) * g_uiMaxCUHeight + g_auiRasterToPelY[ g_auiZscanToRaster[ uiAbsPartIdx ] ];
    767   xPredInterLumaBlkFromDM  ( pcBaseViewTxtPicYuv, pcBaseViewDepthPicYuv, pShiftLUT, &cDv, uiPartAddr, iBlkX,    iBlkY,    iWidth,    iHeight,    pcCU->getSlice()->getIsDepth(), rpcYuvPred, bi );
    768   xPredInterChromaBlkFromDM( pcBaseViewTxtPicYuv, pcBaseViewDepthPicYuv, pShiftLUT, &cDv, uiPartAddr, iBlkX>>1, iBlkY>>1, iWidth>>1, iHeight>>1, pcCU->getSlice()->getIsDepth(), rpcYuvPred, bi );
    769 #endif
    770 
    771750}
    772751#endif
     
    984963  if ( yFrac == 0 )
    985964  {
    986 #if MTK_CLIPPING_ALIGN_IC_E0168
     965#if H_3D_IC
    987966    m_if.filterHorLuma( ref, refStride, dst, dstStride, width, height, xFrac,       !bi || bICFlag
    988967#else
     
    996975  else if ( xFrac == 0 )
    997976  {
    998 #if MTK_CLIPPING_ALIGN_IC_E0168
     977#if H_3D_IC
    999978    m_if.filterVerLuma( ref, refStride, dst, dstStride, width, height, yFrac, true, !bi || bICFlag
    1000979#else
     
    1019998#endif
    1020999      );
    1021 #if MTK_CLIPPING_ALIGN_IC_E0168
     1000#if H_3D_IC
    10221001    m_if.filterVerLuma(tmp + (halfFilterSize-1)*tmpStride, tmpStride, dst, dstStride, width, height,              yFrac, false, !bi || bICFlag
    10231002#else
     
    10331012  if( bICFlag )
    10341013  {
    1035 #if SHARP_ILLUCOMP_REFINE_E0046
    10361014    Int a, b, i, j;
    10371015    const Int iShift = IC_CONST_SHIFT;
    10381016
    10391017    xGetLLSICPrediction( cu, mv, refPic, a, b, TEXT_LUMA );
    1040 #else
    1041     Int a, b, iShift, i, j;
    1042 
    1043     xGetLLSICPrediction( cu, mv, refPic, a, b, iShift, TEXT_LUMA );
    1044 #endif
    10451018
    10461019
     
    10491022      for ( j = 0; j < width; j++ )
    10501023      {
    1051 #if !MTK_CLIPPING_ALIGN_IC_E0168
    1052         if( bi )
    1053         {
    1054           Int iIFshift = IF_INTERNAL_PREC - g_bitDepthY;
    1055           dst[j] = ( ( a*dst[j] + a*IF_INTERNAL_OFFS ) >> iShift ) + b*( 1 << iIFshift ) - IF_INTERNAL_OFFS;
    1056         }
    1057         else
    1058 #endif
    10591024          dst[j] = Clip3( 0, ( 1 << g_bitDepthY ) - 1, ( ( a*dst[j] ) >> iShift ) + b );
    10601025      }
    10611026      dst += dstStride;
    10621027    }
    1063 #if MTK_CLIPPING_ALIGN_IC_E0168
     1028
    10641029    if(bi)
    10651030    {
     
    10761041      }
    10771042    }
    1078 #endif
    10791043  }
    10801044#endif
     
    11271091  if ( yFrac == 0 )
    11281092  {
    1129 #if MTK_CLIPPING_ALIGN_IC_E0168
     1093#if H_3D_IC
    11301094    m_if.filterHorChroma(refCb, refStride, dstCb,  dstStride, cxWidth, cxHeight, xFrac, !bi || bICFlag
    11311095#else
     
    11361100#endif
    11371101    );   
    1138 #if MTK_CLIPPING_ALIGN_IC_E0168
     1102#if H_3D_IC
    11391103    m_if.filterHorChroma(refCr, refStride, dstCr,  dstStride, cxWidth, cxHeight, xFrac, !bi || bICFlag
    11401104#else
     
    11481112  else if ( xFrac == 0 )
    11491113  {
    1150 #if MTK_CLIPPING_ALIGN_IC_E0168
     1114#if H_3D_IC
    11511115    m_if.filterVerChroma(refCb, refStride, dstCb, dstStride, cxWidth, cxHeight, yFrac, true, !bi || bICFlag
    11521116#else
     
    11571121#endif
    11581122    );
    1159 #if MTK_CLIPPING_ALIGN_IC_E0168
     1123#if H_3D_IC
    11601124    m_if.filterVerChroma(refCr, refStride, dstCr, dstStride, cxWidth, cxHeight, yFrac, true, !bi || bICFlag
    11611125#else
     
    11741138#endif 
    11751139      );
    1176 #if MTK_CLIPPING_ALIGN_IC_E0168
     1140#if H_3D_IC
    11771141    m_if.filterVerChroma(extY  + (halfFilterSize-1)*extStride, extStride, dstCb, dstStride, cxWidth, cxHeight  , yFrac, false, !bi || bICFlag
    11781142#else
     
    11891153#endif
    11901154      );
    1191 #if MTK_CLIPPING_ALIGN_IC_E0168
     1155#if H_3D_IC
    11921156    m_if.filterVerChroma(extY  + (halfFilterSize-1)*extStride, extStride, dstCr, dstStride, cxWidth, cxHeight  , yFrac, false, !bi || bICFlag
    11931157#else
     
    12031167  if( bICFlag )
    12041168  {
    1205 #if SHARP_ILLUCOMP_REFINE_E0046
    12061169    Int a, b, i, j;
    12071170    const Int iShift = IC_CONST_SHIFT;
    12081171    xGetLLSICPrediction( cu, mv, refPic, a, b, TEXT_CHROMA_U ); // Cb
    1209 #else
    1210     Int a, b, iShift, i, j;
    1211     xGetLLSICPrediction( cu, mv, refPic, a, b, iShift, TEXT_CHROMA_U ); // Cb
    1212 #endif
    12131172    for ( i = 0; i < cxHeight; i++ )
    12141173    {
    12151174      for ( j = 0; j < cxWidth; j++ )
    12161175      {
    1217 #if !MTK_CLIPPING_ALIGN_IC_E0168
    1218         if( bi )
    1219         {
    1220           Int iIFshift = IF_INTERNAL_PREC - g_bitDepthC;
    1221           dstCb[j] = ( ( a*dstCb[j] + a*IF_INTERNAL_OFFS ) >> iShift ) + b*( 1<<iIFshift ) - IF_INTERNAL_OFFS;
    1222         }
    1223         else
    1224 #endif
    12251176          dstCb[j] = Clip3(  0, ( 1 << g_bitDepthC ) - 1, ( ( a*dstCb[j] ) >> iShift ) + b );
    12261177      }
    12271178      dstCb += dstStride;
    12281179    }
    1229 #if SHARP_ILLUCOMP_REFINE_E0046
    12301180    xGetLLSICPrediction( cu, mv, refPic, a, b, TEXT_CHROMA_V ); // Cr
    1231 #else
    1232     xGetLLSICPrediction( cu, mv, refPic, a, b, iShift, TEXT_CHROMA_V ); // Cr
    1233 #endif
    12341181    for ( i = 0; i < cxHeight; i++ )
    12351182    {
    12361183      for ( j = 0; j < cxWidth; j++ )
    12371184      {
    1238 #if !MTK_CLIPPING_ALIGN_IC_E0168
    1239         if( bi )
    1240         {
    1241           Int iIFshift = IF_INTERNAL_PREC - g_bitDepthC;
    1242           dstCr[j] = ( ( a*dstCr[j] + a*IF_INTERNAL_OFFS ) >> iShift ) + b*( 1<<iIFshift ) - IF_INTERNAL_OFFS;
    1243         }
    1244         else
    1245 #endif
    12461185          dstCr[j] = Clip3( 0, ( 1 << g_bitDepthC ) - 1, ( ( a*dstCr[j] ) >> iShift ) + b );
    12471186      }
    12481187      dstCr += dstStride;
    12491188    }
    1250 #if MTK_CLIPPING_ALIGN_IC_E0168
     1189
    12511190    if(bi)
    12521191    {
     
    12681207      }
    12691208    }
    1270 #endif
    12711209  }
    12721210#endif
     
    13231261  Int k, l, bottomLeft, topRight;
    13241262  Int horPred;
    1325   Int leftColumn[MAX_CU_SIZE], topRow[MAX_CU_SIZE], bottomRow[MAX_CU_SIZE], rightColumn[MAX_CU_SIZE];
     1263  Int leftColumn[MAX_CU_SIZE+1], topRow[MAX_CU_SIZE+1], bottomRow[MAX_CU_SIZE], rightColumn[MAX_CU_SIZE];
    13261264  UInt blkSize = width;
    13271265  UInt offset2D = width;
     
    14171355}
    14181356
    1419 #if !SHARP_ILLUCOMP_REFINE_E0046
    1420 /** Function for counting leading number of zeros/ones
    1421  * \param x input value
    1422  \ This function counts leading number of zeros for positive numbers and
    1423  \ leading number of ones for negative numbers. This can be implemented in
    1424  \ single instructure cycle on many processors.
    1425  */
    1426 
    1427 Short CountLeadingZerosOnes (Short x)
    1428 {
    1429   Short clz;
    1430   Short i;
    1431 
    1432   if(x == 0)
    1433   {
    1434     clz = 0;
    1435   }
    1436   else
    1437   {
    1438     if (x == -1)
    1439     {
    1440       clz = 15;
    1441     }
    1442     else
    1443     {
    1444       if(x < 0)
    1445       {
    1446         x = ~x;
    1447       }
    1448       clz = 15;
    1449       for(i = 0;i < 15;++i)
    1450       {
    1451         if(x)
    1452         {
    1453           clz --;
    1454         }
    1455         x = x >> 1;
    1456       }
    1457     }
    1458   }
    1459   return clz;
    1460 }
    1461 #endif
    14621357
    14631358/** Function for deriving LM illumination compensation.
    14641359 */
    1465 #if SHARP_ILLUCOMP_REFINE_E0046
    14661360Void TComPrediction::xGetLLSICPrediction( TComDataCU* pcCU, TComMv *pMv, TComPicYuv *pRefPic, Int &a, Int &b, TextType eType )
    1467 #else
    1468 Void TComPrediction::xGetLLSICPrediction( TComDataCU* pcCU, TComMv *pMv, TComPicYuv *pRefPic, Int &a, Int &b, Int &iShift, TextType eType )
    1469 #endif
    14701361{
    14711362  TComPicYuv *pRecPic = pcCU->getPic()->getPicYuvRec();
     
    14951386
    14961387  Int x = 0, y = 0, xx = 0, xy = 0;
    1497 #if SHARP_ILLUCOMP_REFINE_E0046
    14981388  Int precShift = std::max(0, (( eType == TEXT_LUMA ) ? g_bitDepthY : g_bitDepthC) - 12);
    1499 #endif
    15001389
    15011390  if( pcCU->getPUAbove( uiTmpPartIdx, pcCU->getZorderIdxInCU() ) && iCUPelY > 0 && iRefY > 0 )
     
    15191408    }
    15201409
    1521 #if SHARP_ILLUCOMP_REFINE_E0046
    15221410    for( j = 0; j < uiWidth; j+=2 )
    1523 #else
    1524     for( j = 0; j < uiWidth; j++ )
    1525 #endif
    15261411    {
    15271412      x += pRef[j];
    15281413      y += pRec[j];
    1529 #if SHARP_ILLUCOMP_REFINE_E0046
    15301414      xx += (pRef[j] * pRef[j])>>precShift;
    15311415      xy += (pRef[j] * pRec[j])>>precShift;
    1532 #else
    1533       xx += pRef[j] * pRef[j];
    1534       xy += pRef[j] * pRec[j];
    1535 #endif
    1536     }
    1537 #if SHARP_ILLUCOMP_REFINE_E0046
     1416    }
    15381417    iCountShift += g_aucConvertToBit[ uiWidth ] + 1;
    1539 #else
    1540     iCountShift += g_aucConvertToBit[ uiWidth ] + 2;
    1541 #endif
    15421418  }
    15431419
     
    15631439    }
    15641440
    1565 #if SHARP_ILLUCOMP_REFINE_E0046
    15661441    for( i = 0; i < uiHeight; i+=2 )
    1567 #else
    1568     for( i = 0; i < uiHeight; i++ )
    1569 #endif
    15701442    {
    15711443      x += pRef[0];
    15721444      y += pRec[0];
    1573 #if SHARP_ILLUCOMP_REFINE_E0046
     1445
    15741446      xx += (pRef[0] * pRef[0])>>precShift;
    15751447      xy += (pRef[0] * pRec[0])>>precShift;
     
    15771449      pRef += iRefStride*2;
    15781450      pRec += iRecStride*2;
    1579 #else
    1580       xx += pRef[0] * pRef[0];
    1581       xy += pRef[0] * pRec[0];
    1582 
    1583       pRef += iRefStride;
    1584       pRec += iRecStride;
    1585 #endif
    1586     }
    1587 #if SHARP_ILLUCOMP_REFINE_E0046
     1451    }
    15881452    iCountShift += iCountShift > 0 ? 1 : ( g_aucConvertToBit[ uiWidth ] + 1 );
    1589 #else
    1590     iCountShift += iCountShift > 0 ? 1 : ( g_aucConvertToBit[ uiWidth ] + 2 );
    1591 #endif
    1592   }
    1593 
    1594 #if SHARP_ILLUCOMP_REFINE_E0046
     1453  }
     1454
    15951455  xy += xx >> IC_REG_COST_SHIFT;
    15961456  xx += xx >> IC_REG_COST_SHIFT;
     
    15991459  const Int iShift = IC_CONST_SHIFT;
    16001460  {
    1601 #else
    1602   Int iTempShift = ( ( eType == TEXT_LUMA ) ? g_bitDepthY : g_bitDepthC ) + g_aucConvertToBit[ uiWidth ] + 3 - 15;
    1603 
    1604   if( iTempShift > 0 )
    1605   {
    1606     x  = ( x +  ( 1 << ( iTempShift - 1 ) ) ) >> iTempShift;
    1607     y  = ( y +  ( 1 << ( iTempShift - 1 ) ) ) >> iTempShift;
    1608     xx = ( xx + ( 1 << ( iTempShift - 1 ) ) ) >> iTempShift;
    1609     xy = ( xy + ( 1 << ( iTempShift - 1 ) ) ) >> iTempShift;
    1610     iCountShift -= iTempShift;
    1611   }
    1612 
    1613   iShift = 13;
    1614 
    1615   if( iCountShift == 0 )
    1616   {
    1617     a = 1;
    1618     b = 0;
    1619     iShift = 0;
    1620   }
    1621   else
    1622   {
    1623     Int a1 = ( xy << iCountShift ) - y * x;
    1624     Int a2 = ( xx << iCountShift ) - x * x;             
    1625 #endif
    16261461    {
    16271462      const Int iShiftA2 = 6;
    1628 #if !SHARP_ILLUCOMP_REFINE_E0046
    1629       const Int iShiftA1 = 15;
    1630 #endif
    16311463      const Int iAccuracyShift = 15;
    16321464
     
    16361468      Int a2s = a2;
    16371469
    1638 #if SHARP_ILLUCOMP_REFINE_E0046
    16391470      a1 = Clip3(0, 2*a2, a1);
    16401471      iScaleShiftA2 = GetMSB( abs( a2 ) ) - iShiftA2;
    16411472      iScaleShiftA1 = iScaleShiftA2 - IC_SHIFT_DIFF;
    1642 #else
    1643       iScaleShiftA1 = GetMSB( abs( a1 ) ) - iShiftA1;
    1644       iScaleShiftA2 = GetMSB( abs( a2 ) ) - iShiftA2; 
    1645 #endif
    16461473
    16471474      if( iScaleShiftA1 < 0 )
     
    16621489      a1s = a1 >> iScaleShiftA1;
    16631490
    1664 #if SHARP_ILLUCOMP_REFINE_E0046
    16651491      a = a1s * m_uiaShift[ a2s ];
    16661492      a = a >> iScaleShiftA;
    1667 #else
    1668       if (a2s >= 1)
    1669       {
    1670         a = a1s * m_uiaShift[ a2s - 1];
    1671       }
    1672       else
    1673       {
    1674         a = 0;
    1675       }
    1676 
    1677       if( iScaleShiftA < 0 )
    1678       {
    1679         a = a << -iScaleShiftA;
    1680       }
    1681       else
    1682       {
    1683         a = a >> iScaleShiftA;
    1684       }
    1685 
    1686       a = Clip3( -( 1 << 15 ), ( 1 << 15 ) - 1, a );
    1687 
    1688       Int minA = -(1 << (6));
    1689       Int maxA = (1 << 6) - 1;
    1690       if( a <= maxA && a >= minA )
    1691       {
    1692         // do nothing
    1693       }
    1694       else
    1695       {
    1696         Short n = CountLeadingZerosOnes( a );
    1697         a = a >> (9-n);
    1698         iShift -= (9-n);
    1699       }
    1700 #endif
    17011493      b = (  y - ( ( a * x ) >> iShift ) + ( 1 << ( iCountShift - 1 ) ) ) >> iCountShift;
    17021494    }
     
    17061498
    17071499#if H_3D_VSP
    1708 
    1709 #if NTT_VSP_COMMON_E0207_E0208
    17101500// not fully support iRatioTxtPerDepth* != 1
    17111501Void TComPrediction::xGetVirtualDepth( TComDataCU *cu, TComPicYuv *picRefDepth, TComMv *mv, UInt partAddr, Int width, Int height, TComYuv *yuvDepth, Int ratioTxtPerDepthX, Int ratioTxtPerDepthY )
     
    17151505
    17161506  Int refDepStride = picRefDepth->getStride();
    1717 
    1718 #if NTT_VSP_VECTOR_CLIP_E0208
    17191507
    17201508  Int refDepOffset  = ( (mv->getHor()+2) >> 2 ) + ( (mv->getVer()+2) >> 2 ) * refDepStride;
     
    17361524  refDepth += refDepOffset;
    17371525
    1738 #else // NTT_VSP_VECTOR_CLIP_E0208
    1739 
    1740   Int widthDepth = picRefDepth->getWidth();
    1741   Int heightDepth = picRefDepth->getHeight();
    1742   Int posX, posY;
    1743   cu->getPic()->getPicYuvRec()->getTopLeftSamplePos( cu->getAddr(), cu->getZorderIdxInCU() + partAddr, posX, posY ); // top-left position in texture
    1744   posX /= ratioTxtPerDepthX; // texture position -> depth postion
    1745   posY /= ratioTxtPerDepthY;
    1746  
    1747   posX = Clip3(0, widthDepth-width,   posX + ((mv->getHor()+2)>>2));
    1748   posY = Clip3(0, heightDepth-height, posY + ((mv->getVer()+2)>>2));
    1749  
    1750   Pel *refDepth  = picRefDepth->getLumaAddr() + posX + posY * refDepStride;
    1751 
    1752 #endif // NTT_VSP_VECTOR_CLIP_E0208
    1753 
    17541526  Int depStride = yuvDepth->getStride();
    17551527  Pel *depth = yuvDepth->getLumaAddr();
    1756 
    1757 #if NTT_VSP_ADAPTIVE_SPLIT_E0207
    17581528
    17591529  if( width<8 || height<8 )
     
    18941664  }
    18951665
    1896 #else // NTT_VSP_ADAPTIVE_SPLIT_E0207
    1897 
    1898   Int rightOffset = nTxtPerDepthX - 1;
    1899   Int depStrideBlock = depStride * nTxtPerDepthY;
    1900   Int refDepStrideBlock = refDepStride * nTxtPerDepthY;
    1901   Pel *refDepthTop = refDepth;
    1902   Pel *refDepthBot = refDepthTop + (nTxtPerDepthY-1)*refDepStride;
    1903 
    1904   for( Int y=0; y<height; y+= nTxtPerDepthY )
    1905   {
    1906     for( Int x=0; x<width; x+=nTxtPerDepthX )
    1907     {
    1908       Pel maxDepth = refDepthTop[x] > refDepthBot[x] ? refDepthTop[x] : refDepthBot[x];
    1909 
    1910       if( maxDepth < refDepthTop[x+rightOffset] )
    1911       {
    1912         maxDepth = refDepthTop[x+rightOffset];
    1913       }
    1914       if( maxDepth < refDepthBot[x+rightOffset] )
    1915       {
    1916         maxDepth = refDepthBot[x+rightOffset];
    1917       }
    1918 
    1919       depth[x] = maxDepth;
    1920 
    1921     }
    1922     refDepthTop += refDepStrideBlock;
    1923     refDepthBot += refDepStrideBlock;
    1924     depth       += depStrideBlock;
    1925   }
    1926 
    1927 #endif // NTT_VSP_ADAPTIVE_SPLIT_E0207
     1666
    19281667}
    19291668
     
    19431682  Pel *dst    = yuvDst->getLumaAddr(partAddr);
    19441683  Pel *depth  = yuvDepth->getLumaAddr();
    1945  
    1946 #if !(NTT_VSP_DC_BUGFIX_E0208)
    1947   Int widthLuma = picRef->getWidth();
    1948   Int posX, posY;
    1949   cu->getPic()->getPicYuvRec()->getTopLeftSamplePos( cu->getAddr(), cu->getZorderIdxInCU() + partAddr, posX, posY ); // top-left position in texture
    1950 #endif
    19511684
    19521685#if H_3D_VSP_BLOCKSIZE == 1
     
    20211754      Int xFrac = disparity & 0x3;
    20221755
    2023 #if NTT_VSP_DC_BUGFIX_E0208
    2024 
    20251756      dv.setHor( disparity );
    20261757      cu->clipMv( dv );
     
    20381769      assert( ref[refOffset] >= 0 && ref[refOffset]<= 255 );
    20391770      m_if.filterHorLuma( &ref[refOffset], refStride, &dst[xTxt], dstStride, nTxtPerDepthX, nTxtPerDepthY, xFrac, !isBi );
    2040 
    2041 #else // NTT_VSP_DC_BUGFIX_E0208
    2042 
    2043       for( Int j=0; j < nTxtPerDepthX; j++ )
    2044       {
    2045         Int refOffset = xTxt+j + (disparity >> 2);
    2046 #if H_3D_VSP_CONSTRAINED
    2047         if(refOffset<minRelativePos || refOffset>maxRelativePos)
    2048         {
    2049           xFrac = 0;
    2050         }
    2051         refOffset = Clip3(minRelativePos, maxRelativePos, refOffset);
    2052 #endif
    2053         Int absX  = posX + refOffset;
    2054 
    2055         if (xFrac == 0)
    2056         {
    2057           absX = Clip3(0, widthLuma-1, absX);
    2058         }
    2059         else
    2060         {
    2061           absX = Clip3(4, widthLuma-5, absX);
    2062         }
    2063 
    2064         refOffset = absX - posX;
    2065         assert( ref[refOffset] >= 0 && ref[refOffset] <= 255 );
    2066        
    2067         m_if.filterHorLuma( &ref[refOffset], refStride, &dst[xTxt+j], dstStride, 1, nTxtPerDepthY, xFrac, !isBi );
    2068       }
    2069 
    2070 #endif // NTT_VSP_DC_BUGFIX_E0208
    2071 
    20721771    }
    20731772    ref   += refStrideBlock;
     
    21011800  Pel *depth  = yuvDepth->getLumaAddr();
    21021801
    2103 #if !(NTT_VSP_DC_BUGFIX_E0208)
    2104   Int widthChroma = picRef->getWidth() >> 1;
    2105   Int posX, posY;
    2106   cu->getPic()->getPicYuvRec()->getTopLeftSamplePos( cu->getAddr(), cu->getZorderIdxInCU() + partAddr, posX, posY ); // top-left position in texture
    2107   posX >>= 1;
    2108   posY >>= 1;
    2109 #endif
    2110  
    21111802#if H_3D_VSP_BLOCKSIZE == 1
    21121803#if H_3D_VSP_CONSTRAINED
     
    21731864      Int xFrac = disparity & 0x7;
    21741865     
    2175 #if NTT_VSP_DC_BUGFIX_E0208
    2176 
    21771866      dv.setHor( disparity );
    21781867      cu->clipMv( dv );
     
    21931882      m_if.filterHorChroma( &refCb[refOffset], refStride, &dstCb[xTxt], dstStride, nTxtPerDepthX, nTxtPerDepthY, xFrac, !isBi );
    21941883      m_if.filterHorChroma( &refCr[refOffset], refStride, &dstCr[xTxt], dstStride, nTxtPerDepthX, nTxtPerDepthY, xFrac, !isBi );
    2195 
    2196 #else // NTT_VSP_DC_BUGFIX_E0208
    2197      
    2198       for( Int j=0; j < nTxtPerDepthX; j++ )
    2199       {
    2200         Int refOffset = xTxt+j + (disparity >> 3);
    2201 #if H_3D_VSP_CONSTRAINED
    2202         if(refOffset<minRelativePos || refOffset>maxRelativePos)
    2203         {
    2204           xFrac = 0;
    2205         }
    2206         refOffset = Clip3(minRelativePos, maxRelativePos, refOffset);
    2207 #endif
    2208         Int absX  = posX + refOffset;
    2209 
    2210         if (xFrac == 0)
    2211         {
    2212           absX = Clip3(0, widthChroma-1, absX);
    2213         }
    2214         else
    2215         {
    2216           absX = Clip3(4, widthChroma-5, absX);
    2217         }
    2218 
    2219         refOffset = absX - posX;
    2220         assert( refCb[refOffset] >= 0 && refCb[refOffset] <= 255 );
    2221         assert( refCr[refOffset] >= 0 && refCr[refOffset] <= 255 );
    2222 
    2223         m_if.filterHorChroma( &refCb[refOffset], refStride, &dstCb[xTxt+j], dstStride, 1, nTxtPerDepthY, xFrac, !isBi );
    2224         m_if.filterHorChroma( &refCr[refOffset], refStride, &dstCr[xTxt+j], dstStride, 1, nTxtPerDepthY, xFrac, !isBi );
    2225       }
    2226 
    2227 #endif // NTT_VSP_DC_BUGFIX_E0208
    22281884    }
    22291885    refCb += refStrideBlock;
     
    22331889    depth += depStrideBlock;
    22341890  }
    2235 
    2236 }
    2237 #else // NTT_VSP_COMMON_E0207_E0208
    2238 
    2239 // Input:
    2240 // refPic: Ref picture. Full picture, with padding
    2241 // posX, posY:     PU position, texture
    2242 // sizeX, sizeY: PU size
    2243 // partAddr: z-order index
    2244 // dv: disparity vector. derived from neighboring blocks
    2245 //
    2246 // Output: dstPic, PU predictor 64x64
    2247 Void TComPrediction::xPredInterLumaBlkFromDM( TComPicYuv *refPic, TComPicYuv *pPicBaseDepth, Int* pShiftLUT, TComMv* dv, UInt partAddr,Int posX, Int posY
    2248                                             , Int sizeX, Int sizeY, Bool isDepth, TComYuv *&dstPic, Bool bi )
    2249 {
    2250   Int widthLuma;
    2251   Int heightLuma;
    2252 
    2253   if (isDepth)
    2254   {
    2255     widthLuma   =  pPicBaseDepth->getWidth();
    2256     heightLuma  =  pPicBaseDepth->getHeight();
    2257   }
    2258   else
    2259   {
    2260     widthLuma   =  refPic->getWidth();
    2261     heightLuma  =  refPic->getHeight();
    2262   }
    2263 
    2264 #if H_3D_VSP_BLOCKSIZE != 1
    2265   Int widthDepth  = pPicBaseDepth->getWidth();
    2266   Int heightDepth = pPicBaseDepth->getHeight();
    2267 #endif
    2268 
    2269 #if H_3D_VSP_CONSTRAINED
    2270   Int widthDepth  = pPicBaseDepth->getWidth();
    2271   Int heightDepth = pPicBaseDepth->getHeight();
    2272 #endif
    2273 
    2274   Int nTxtPerDepthX = widthLuma  / ( pPicBaseDepth->getWidth() );  // texture pixel # per depth pixel
    2275   Int nTxtPerDepthY = heightLuma / ( pPicBaseDepth->getHeight() );
    2276 
    2277   Int refStride = refPic->getStride();
    2278   Int dstStride = dstPic->getStride();
    2279   Int depStride =  pPicBaseDepth->getStride();
    2280   Int depthPosX = Clip3(0,   widthLuma - sizeX,  (posX/nTxtPerDepthX) + ((dv->getHor()+2)>>2));
    2281   Int depthPosY = Clip3(0,   heightLuma- sizeY,  (posY/nTxtPerDepthY) + ((dv->getVer()+2)>>2));
    2282   Pel *ref    = refPic->getLumaAddr() + posX + posY * refStride;
    2283   Pel *dst    = dstPic->getLumaAddr(partAddr);
    2284   Pel *depth  = pPicBaseDepth->getLumaAddr() + depthPosX + depthPosY * depStride;
    2285 
    2286 #if H_3D_VSP_BLOCKSIZE != 1
    2287 #if H_3D_VSP_BLOCKSIZE == 2
    2288   Int  dW = sizeX>>1;
    2289   Int  dH = sizeY>>1;
    2290 #endif
    2291 #if H_3D_VSP_BLOCKSIZE == 4
    2292   Int  dW = sizeX>>2;
    2293   Int  dH = sizeY>>2;
    2294 #endif
    2295   {
    2296     Pel* depthi = depth;
    2297     for (Int j = 0; j < dH; j++)
    2298     {
    2299       for (Int i = 0; i < dW; i++)
    2300       {
    2301         Pel* depthTmp;
    2302 #if H_3D_VSP_BLOCKSIZE == 2
    2303         if (depthPosX + (i<<1) < widthDepth)
    2304           depthTmp = depthi + (i << 1);
    2305         else
    2306           depthTmp = depthi + (widthDepth - depthPosX - 1);
    2307 #endif
    2308 #if H_3D_VSP_BLOCKSIZE == 4
    2309         if (depthPosX + (i<<2) < widthDepth)
    2310           depthTmp = depthi + (i << 2);
    2311         else
    2312           depthTmp = depthi + (widthDepth - depthPosX - 1);
    2313 #endif
    2314         Int maxV = 0;
    2315         for (Int blockj = 0; blockj < H_3D_VSP_BLOCKSIZE; blockj+=(H_3D_VSP_BLOCKSIZE-1))
    2316         {
    2317           Int iX = 0;
    2318           for (Int blocki = 0; blocki < H_3D_VSP_BLOCKSIZE; blocki+=(H_3D_VSP_BLOCKSIZE-1))
    2319           {
    2320             if (maxV < depthTmp[iX])
    2321               maxV = depthTmp[iX];
    2322 #if H_3D_VSP_BLOCKSIZE == 2
    2323             if (depthPosX + (i<<1) + blocki < widthDepth - 1)
    2324 #else // H_3D_VSP_BLOCKSIZE == 4
    2325             if (depthPosX + (i<<2) + blocki < widthDepth - 1)
    2326 #endif
    2327               iX = (H_3D_VSP_BLOCKSIZE-1);
    2328           }
    2329 #if H_3D_VSP_BLOCKSIZE == 2
    2330           if (depthPosY + (j<<1) + blockj < heightDepth - 1)
    2331 #else // H_3D_VSP_BLOCKSIZE == 4
    2332           if (depthPosY + (j<<2) + blockj < heightDepth - 1)
    2333 #endif
    2334             depthTmp += depStride * (H_3D_VSP_BLOCKSIZE-1);
    2335         }
    2336         m_pDepthBlock[i+j*dW] = maxV;
    2337       } // end of i < dW
    2338 #if H_3D_VSP_BLOCKSIZE == 2
    2339       if (depthPosY + ((j+1)<<1) < heightDepth)
    2340         depthi += (depStride << 1);
    2341       else
    2342         depthi  = depth + (heightDepth-depthPosY-1)*depStride;
    2343 #endif
    2344 #if H_3D_VSP_BLOCKSIZE == 4
    2345       if (depthPosY + ((j+1)<<2) < heightDepth) // heightDepth-1
    2346         depthi += (depStride << 2);
    2347       else
    2348         depthi  = depth + (heightDepth-depthPosY-1)*depStride; // the last line
    2349 #endif
    2350     }
    2351   }
    2352 #endif // H_3D_VSP_BLOCKSIZE != 1
    2353 
    2354 #if H_3D_VSP_BLOCKSIZE == 1
    2355 #if H_3D_VSP_CONSTRAINED
    2356   //get LUT based horizontal reference range
    2357   Int range = xGetConstrainedSize(sizeX, sizeY);
    2358 
    2359   // The minimum depth value
    2360   Int minRelativePos = MAX_INT;
    2361   Int maxRelativePos = MIN_INT;
    2362 
    2363   Pel* depthTemp, *depthInitial=depth;
    2364   for (Int yTxt = 0; yTxt < sizeY; yTxt++)
    2365   {
    2366     for (Int xTxt = 0; xTxt < sizeX; xTxt++)
    2367     {
    2368       if (depthPosX+xTxt < widthDepth)
    2369         depthTemp = depthInitial + xTxt;
    2370       else
    2371         depthTemp = depthInitial + (widthDepth - depthPosX - 1);
    2372 
    2373       Int disparity = pShiftLUT[ *depthTemp ]; // << iShiftPrec;
    2374       Int disparityInt = disparity >> 2;
    2375 
    2376       if( disparity <= 0)
    2377       {
    2378         if (minRelativePos > disparityInt+xTxt)
    2379             minRelativePos = disparityInt+xTxt;
    2380       }
    2381       else
    2382       {
    2383         if (maxRelativePos < disparityInt+xTxt)
    2384             maxRelativePos = disparityInt+xTxt;
    2385       }
    2386     }
    2387     if (depthPosY+yTxt < heightDepth)
    2388       depthInitial = depthInitial + depStride;
    2389   }
    2390 
    2391   Int disparity_tmp = pShiftLUT[ *depth ]; // << iShiftPrec;
    2392   if (disparity_tmp <= 0)
    2393     maxRelativePos = minRelativePos + range -1 ;
    2394   else
    2395     minRelativePos = maxRelativePos - range +1 ;
    2396 #endif
    2397 #endif // H_3D_VSP_BLOCKSIZE == 1
    2398 
    2399 #if H_3D_VSP_BLOCKSIZE != 1
    2400   Int yDepth = 0;
    2401 #endif
    2402   for ( Int yTxt = 0; yTxt < sizeY; yTxt += nTxtPerDepthY )
    2403   {
    2404     for ( Int xTxt = 0, xDepth = 0; xTxt < sizeX; xTxt += nTxtPerDepthX, xDepth++ )
    2405     {
    2406       Pel repDepth = 0; // to store the depth value used for warping
    2407 #if H_3D_VSP_BLOCKSIZE == 1
    2408       repDepth = depth[xDepth];
    2409 #endif
    2410 #if H_3D_VSP_BLOCKSIZE == 2
    2411       repDepth = m_pDepthBlock[(xTxt>>1) + (yTxt>>1)*dW];
    2412 #endif
    2413 #if H_3D_VSP_BLOCKSIZE == 4
    2414       repDepth = m_pDepthBlock[(xTxt>>2) + (yTxt>>2)*dW];
    2415 #endif
    2416 
    2417       assert( repDepth >= 0 && repDepth <= 255 );
    2418       Int disparity = pShiftLUT[ repDepth ]; // remove << iShiftPrec ??
    2419       Int refOffset = xTxt + (disparity >> 2);
    2420       Int xFrac = disparity & 0x3;
    2421 #if H_3D_VSP_CONSTRAINED
    2422       if(refOffset<minRelativePos || refOffset>maxRelativePos)
    2423         xFrac = 0;
    2424       refOffset = Clip3(minRelativePos, maxRelativePos, refOffset);
    2425 #endif
    2426       Int absX  = posX + refOffset;
    2427 
    2428       if (xFrac == 0)
    2429         absX = Clip3(0, widthLuma-1, absX);
    2430       else
    2431         absX = Clip3(4, widthLuma-5, absX);
    2432 
    2433       refOffset = absX - posX;
    2434 
    2435       assert( ref[refOffset] >= 0 && ref[refOffset]<= 255 );
    2436       m_if.filterHorLuma( &ref[refOffset], refStride, &dst[xTxt], dstStride, nTxtPerDepthX, nTxtPerDepthY, xFrac, !bi );
    2437     }
    2438     ref   += refStride*nTxtPerDepthY;
    2439     dst   += dstStride*nTxtPerDepthY;
    2440     depth += depStride;
    2441 #if H_3D_VSP_BLOCKSIZE != 1
    2442     yDepth++;
    2443 #endif
    2444 
    2445   }
    2446 }
    2447 
    2448 Void TComPrediction::xPredInterChromaBlkFromDM ( TComPicYuv *refPic, TComPicYuv *pPicBaseDepth, Int* pShiftLUT, TComMv*dv, UInt partAddr, Int posX, Int posY
    2449                                                , Int sizeX, Int sizeY, Bool isDepth, TComYuv *&dstPic, Bool bi)
    2450 {
    2451   Int refStride = refPic->getCStride();
    2452   Int dstStride = dstPic->getCStride();
    2453   Int depStride = pPicBaseDepth->getStride();
    2454 
    2455   Int widthChroma, heightChroma;
    2456   if( isDepth)
    2457   {
    2458      widthChroma   = pPicBaseDepth->getWidth()>>1;
    2459      heightChroma  = pPicBaseDepth->getHeight()>>1;
    2460   }
    2461   else
    2462   {
    2463      widthChroma   = refPic->getWidth()>>1;
    2464      heightChroma  = refPic->getHeight()>>1;
    2465   }
    2466 
    2467   // Below is only for Texture chroma component
    2468 
    2469   Int widthDepth  = pPicBaseDepth->getWidth();
    2470   Int heightDepth = pPicBaseDepth->getHeight();
    2471 
    2472   Int nTxtPerDepthX, nTxtPerDepthY;  // Number of texture samples per one depth sample
    2473   Int nDepthPerTxtX, nDepthPerTxtY;  // Number of depth samples per one texture sample
    2474 
    2475   Int depthPosX;  // Starting position in depth image
    2476   Int depthPosY;
    2477 
    2478   if ( widthChroma > widthDepth )
    2479   {
    2480     nTxtPerDepthX = widthChroma / widthDepth;
    2481     nDepthPerTxtX = 1;
    2482     depthPosX = posX / nTxtPerDepthX + ((dv->getHor()+2)>>2);
    2483   }
    2484   else
    2485   {
    2486     nTxtPerDepthX = 1;
    2487     nDepthPerTxtX = widthDepth / widthChroma;
    2488     depthPosX = posX * nDepthPerTxtX + ((dv->getHor()+2)>>2);
    2489   }
    2490   depthPosX = Clip3(0, widthDepth - (sizeX<<1), depthPosX);
    2491   if ( heightChroma > heightDepth )
    2492   {
    2493     nTxtPerDepthY = heightChroma / heightDepth;
    2494     nDepthPerTxtY = 1;
    2495     depthPosY = posY / nTxtPerDepthY + ((dv->getVer()+2)>>2);
    2496   }
    2497   else
    2498   {
    2499     nTxtPerDepthY = 1;
    2500     nDepthPerTxtY = heightDepth / heightChroma;
    2501     depthPosY = posY * nDepthPerTxtY + ((dv->getVer()+2)>>2);
    2502   }
    2503   depthPosY = Clip3(0, heightDepth - (sizeY<<1), depthPosY);
    2504 
    2505   Pel *refCb  = refPic->getCbAddr() + posX + posY * refStride;
    2506   Pel *refCr  = refPic->getCrAddr() + posX + posY * refStride;
    2507   Pel *dstCb  = dstPic->getCbAddr(partAddr);
    2508   Pel *dstCr  = dstPic->getCrAddr(partAddr);
    2509   Pel *depth  = pPicBaseDepth->getLumaAddr() + depthPosX + depthPosY * depStride;  // move the pointer to the current depth pixel position
    2510 
    2511   Int refStrideBlock = refStride * nTxtPerDepthY;
    2512   Int dstStrideBlock = dstStride * nTxtPerDepthY;
    2513   Int depStrideBlock = depStride * nDepthPerTxtY;
    2514 
    2515   if ( widthChroma > widthDepth ) // We assume
    2516   {
    2517     assert( heightChroma > heightDepth );
    2518     printf("This branch should never been reached.\n");
    2519     exit(0);
    2520   }
    2521   else
    2522   {
    2523 #if H_3D_VSP_BLOCKSIZE == 1
    2524   Int  dW = sizeX;
    2525   Int  dH = sizeY;
    2526   Int  sW = 2; // search window size
    2527   Int  sH = 2;
    2528 #endif
    2529 #if H_3D_VSP_BLOCKSIZE == 2
    2530   Int  dW = sizeX;
    2531   Int  dH = sizeY;
    2532   Int  sW = 2; // search window size
    2533   Int  sH = 2;
    2534 #endif
    2535 #if H_3D_VSP_BLOCKSIZE == 4
    2536   Int  dW = sizeX>>1;
    2537   Int  dH = sizeY>>1;
    2538   Int  sW = 4; // search window size
    2539   Int  sH = 4;
    2540 #endif
    2541 
    2542   {
    2543     Pel* depthi = depth;
    2544     for (Int j = 0; j < dH; j++)
    2545     {
    2546       for (Int i = 0; i < dW; i++)
    2547       {
    2548         Pel* depthTmp;
    2549 #if H_3D_VSP_BLOCKSIZE == 1
    2550         depthTmp = depthi + (i << 1);
    2551 #endif
    2552 #if H_3D_VSP_BLOCKSIZE == 2
    2553         if (depthPosX + (i<<1) < widthDepth)
    2554           depthTmp = depthi + (i << 1);
    2555         else
    2556           depthTmp = depthi + (widthDepth - depthPosX - 1);
    2557 #endif
    2558 #if H_3D_VSP_BLOCKSIZE == 4
    2559         if (depthPosX + (i<<2) < widthDepth)
    2560           depthTmp = depthi + (i << 2);
    2561         else
    2562           depthTmp = depthi + (widthDepth - depthPosX - 1);
    2563 #endif
    2564         Int maxV = 0;
    2565         for (Int blockj = 0; blockj < sH; blockj+=(sH-1))
    2566         {
    2567           Int iX = 0;
    2568           for (Int blocki = 0; blocki < sW; blocki+=(sW-1))
    2569           {
    2570             if (maxV < depthTmp[iX])
    2571               maxV = depthTmp[iX];
    2572             if (depthPosX + i*sW + blocki < widthDepth - 1)
    2573                 iX = (sW-1);
    2574           }
    2575           if (depthPosY + j*sH + blockj < heightDepth - 1)
    2576                 depthTmp += depStride * (sH-1);
    2577         }
    2578         m_pDepthBlock[i+j*dW] = maxV;
    2579       } // end of i < dW
    2580 #if H_3D_VSP_BLOCKSIZE == 1
    2581       if (depthPosY + ((j+1)<<1) < heightDepth)
    2582         depthi += (depStride << 1);
    2583       else
    2584         depthi  = depth + (heightDepth-1)*depStride;
    2585 #endif
    2586 #if H_3D_VSP_BLOCKSIZE == 2
    2587       if (depthPosY + ((j+1)<<1) < heightDepth)
    2588         depthi += (depStride << 1);
    2589       else
    2590         depthi  = depth + (heightDepth-depthPosY-1)*depStride;
    2591 #endif
    2592 #if H_3D_VSP_BLOCKSIZE == 4
    2593       if (depthPosY + ((j+1)<<2) < heightDepth) // heightDepth-1
    2594         depthi += (depStride << 2);
    2595       else
    2596         depthi  = depth + (heightDepth-depthPosY-1)*depStride; // the last line
    2597 #endif
    2598     }
    2599   }
    2600 
    2601 
    2602 #if H_3D_VSP_BLOCKSIZE == 1
    2603 #if H_3D_VSP_CONSTRAINED
    2604   //get LUT based horizontal reference range
    2605   Int range = xGetConstrainedSize(sizeX, sizeY, false);
    2606 
    2607   // The minimum depth value
    2608   Int minRelativePos = MAX_INT;
    2609   Int maxRelativePos = MIN_INT;
    2610 
    2611   Int depthTmp;
    2612   for (Int yTxt=0; yTxt<sizeY; yTxt++)
    2613   {
    2614     for (Int xTxt=0; xTxt<sizeX; xTxt++)
    2615     {
    2616       depthTmp = m_pDepthBlock[xTxt+yTxt*dW];
    2617       Int disparity = pShiftLUT[ depthTmp ]; // << iShiftPrec;
    2618       Int disparityInt = disparity >> 3;//in chroma resolution
    2619 
    2620       if (disparityInt < 0)
    2621       {
    2622         if (minRelativePos > disparityInt+xTxt)
    2623             minRelativePos = disparityInt+xTxt;
    2624       }
    2625       else
    2626       {
    2627         if (maxRelativePos < disparityInt+xTxt)
    2628             maxRelativePos = disparityInt+xTxt;
    2629       }
    2630     }
    2631   }
    2632 
    2633   depthTmp = m_pDepthBlock[0];
    2634   Int disparity_tmp = pShiftLUT[ depthTmp ]; // << iShiftPrec;
    2635   if ( disparity_tmp < 0 )
    2636     maxRelativePos = minRelativePos + range - 1;
    2637   else
    2638     minRelativePos = maxRelativePos - range + 1;
    2639 
    2640 #endif // H_3D_VSP_CONSTRAINED
    2641 #endif // H_3D_VSP_BLOCKSIZE == 1
    2642 
    2643     // (sizeX, sizeY) is Chroma block size
    2644     for ( Int yTxt = 0, yDepth = 0; yTxt < sizeY; yTxt += nTxtPerDepthY, yDepth += nDepthPerTxtY )
    2645     {
    2646       for ( Int xTxt = 0, xDepth = 0; xTxt < sizeX; xTxt += nTxtPerDepthX, xDepth += nDepthPerTxtX )
    2647       {
    2648         Pel repDepth = 0; // to store the depth value used for warping
    2649 #if H_3D_VSP_BLOCKSIZE == 1
    2650         repDepth = m_pDepthBlock[(xTxt) + (yTxt)*dW];
    2651 #endif
    2652 #if H_3D_VSP_BLOCKSIZE == 2
    2653         repDepth = m_pDepthBlock[(xTxt) + (yTxt)*dW];
    2654 #endif
    2655 #if H_3D_VSP_BLOCKSIZE == 4
    2656         repDepth = m_pDepthBlock[(xTxt>>1) + (yTxt>>1)*dW];
    2657 #endif
    2658 
    2659       // calculate the offset in the reference picture
    2660         Int disparity = pShiftLUT[ repDepth ]; // Remove << iShiftPrec;
    2661         Int refOffset = xTxt + (disparity >> 3); // in integer pixel in chroma image
    2662         Int xFrac = disparity & 0x7;
    2663 #if H_3D_VSP_CONSTRAINED
    2664         if(refOffset < minRelativePos || refOffset > maxRelativePos)
    2665           xFrac = 0;
    2666         refOffset = Clip3(minRelativePos, maxRelativePos, refOffset);
    2667 #endif
    2668         Int absX  = posX + refOffset;
    2669 
    2670         if (xFrac == 0)
    2671           absX = Clip3(0, widthChroma-1, absX);
    2672         else
    2673           absX = Clip3(4, widthChroma-5, absX);
    2674 
    2675         refOffset = absX - posX;
    2676 
    2677         assert( refCb[refOffset] >= 0 && refCb[refOffset]<= 255 );
    2678         assert( refCr[refOffset] >= 0 && refCr[refOffset]<= 255 );
    2679         m_if.filterHorChroma(&refCb[refOffset], refStride, &dstCb[xTxt],  dstStride, nTxtPerDepthX, nTxtPerDepthY, xFrac, !bi);
    2680         m_if.filterHorChroma(&refCr[refOffset], refStride, &dstCr[xTxt],  dstStride, nTxtPerDepthX, nTxtPerDepthY, xFrac, !bi);
    2681       }
    2682       refCb += refStrideBlock;
    2683       refCr += refStrideBlock;
    2684       dstCb += dstStrideBlock;
    2685       dstCr += dstStrideBlock;
    2686       depth += depStrideBlock;
    2687     }
    2688   }
    2689 
    2690 }
    2691 
    2692 #endif // NTT_VSP_COMMON_E0207_E0208
     1891}
     1892
    26931893
    26941894#if H_3D_VSP_CONSTRAINED
     
    27681968
    27691969#if H_3D_DIM_DMM
    2770 #if !SEC_DMM2_E0146_HHIFIX
    2771 UInt TComPrediction::xPredWedgeFromIntra( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiWidth, UInt uiHeight, Int iDeltaEnd )
    2772 {
    2773   UInt uiThisBlockSize = uiWidth;
    2774 
    2775   TComDataCU* pcTempCU;
    2776   UInt        uiTempPartIdx;
    2777   // 1st: try continue above wedgelet
    2778   pcTempCU = pcCU->getPUAbove( uiTempPartIdx, pcCU->getZorderIdxInCU() + uiAbsPartIdx );
    2779   if( pcTempCU && isDimMode( pcTempCU->getLumaIntraDir( uiTempPartIdx ) ) )
    2780   {
    2781     UInt dimType =  getDimType( pcTempCU->getLumaIntraDir( uiTempPartIdx ) );
    2782     if( DMM1_IDX == dimType || DMM2_IDX == dimType || DMM3_IDX == dimType )
    2783     {
    2784       // get offset between current and reference block
    2785       UInt uiOffsetX = 0, uiOffsetY = 0;
    2786       xGetBlockOffset( pcCU, uiAbsPartIdx, pcTempCU, uiTempPartIdx, uiOffsetX, uiOffsetY );
    2787 
    2788       // get reference wedgelet
    2789       WedgeList* pacWedgeList = &g_dmmWedgeLists[(g_aucConvertToBit[(pcTempCU->getWidth( uiTempPartIdx )>>((pcTempCU->getPartitionSize( uiTempPartIdx ) == SIZE_NxN) ? 1 : 0))])];
    2790       TComWedgelet* pcRefWedgelet = &(pacWedgeList->at( pcTempCU->getDmmWedgeTabIdx( dimType, uiTempPartIdx ) ) );
    2791 
    2792       // find wedgelet, if direction is suitable for continue wedge
    2793       if( pcRefWedgelet->checkPredDirAbovePossible( uiThisBlockSize, uiOffsetX ) )
    2794       {
    2795         UChar uhContD_Xs, uhContD_Ys, uhContD_Xe, uhContD_Ye;
    2796         pcRefWedgelet->getPredDirStartEndAbove( uhContD_Xs, uhContD_Ys, uhContD_Xe, uhContD_Ye, uiThisBlockSize, uiOffsetX, iDeltaEnd );
    2797         return xGetWedgePatternIdx( uiThisBlockSize, uhContD_Xs, uhContD_Ys, uhContD_Xe, uhContD_Ye );
    2798       }
    2799     }
    2800   }
    2801 
    2802   // 2nd: try continue left wedglelet
    2803   pcTempCU = pcCU->getPULeft( uiTempPartIdx, pcCU->getZorderIdxInCU() + uiAbsPartIdx );
    2804   if( pcTempCU && isDimMode( pcTempCU->getLumaIntraDir( uiTempPartIdx ) ) )
    2805   {
    2806     UInt dimType = getDimType( pcTempCU->getLumaIntraDir( uiTempPartIdx ) );
    2807     if( DMM1_IDX == dimType || DMM2_IDX == dimType || DMM3_IDX == dimType )
    2808     {
    2809       // get offset between current and reference block
    2810       UInt uiOffsetX = 0, uiOffsetY = 0;
    2811       xGetBlockOffset( pcCU, uiAbsPartIdx, pcTempCU, uiTempPartIdx, uiOffsetX, uiOffsetY );
    2812 
    2813       // get reference wedgelet
    2814       WedgeList* pacWedgeList = &g_dmmWedgeLists[(g_aucConvertToBit[(pcTempCU->getWidth( uiTempPartIdx )>>((pcTempCU->getPartitionSize( uiTempPartIdx ) == SIZE_NxN) ? 1 : 0))])];
    2815       TComWedgelet* pcRefWedgelet = &(pacWedgeList->at( pcTempCU->getDmmWedgeTabIdx( dimType, uiTempPartIdx ) ) );
    2816 
    2817       // find wedgelet, if direction is suitable for continue wedge
    2818       if( pcRefWedgelet->checkPredDirLeftPossible( uiThisBlockSize, uiOffsetY ) )
    2819       {
    2820         UChar uhContD_Xs, uhContD_Ys, uhContD_Xe, uhContD_Ye;
    2821         pcRefWedgelet->getPredDirStartEndLeft( uhContD_Xs, uhContD_Ys, uhContD_Xe, uhContD_Ye, uiThisBlockSize, uiOffsetY, iDeltaEnd );
    2822         return xGetWedgePatternIdx( uiThisBlockSize, uhContD_Xs, uhContD_Ys, uhContD_Xe, uhContD_Ye );
    2823       }
    2824     }
    2825   }
    2826 
    2827   // 3rd: (default) make wedglet from intra dir and max slope point
    2828   Int iSlopeX = 0, iSlopeY = 0;
    2829   UInt uiStartPosX = 0, uiStartPosY = 0;
    2830   if( xGetWedgeIntraDirPredData( pcCU, uiAbsPartIdx, uiThisBlockSize, iSlopeX, iSlopeY, uiStartPosX, uiStartPosY ) )
    2831   {
    2832     UChar uhContD_Xs, uhContD_Ys, uhContD_Xe, uhContD_Ye;
    2833     xGetWedgeIntraDirStartEnd( pcCU, uiAbsPartIdx, uiThisBlockSize, iSlopeX, iSlopeY, uiStartPosX, uiStartPosY, uhContD_Xs, uhContD_Ys, uhContD_Xe, uhContD_Ye, iDeltaEnd );
    2834     return xGetWedgePatternIdx( uiThisBlockSize, uhContD_Xs, uhContD_Ys, uhContD_Xe, uhContD_Ye );
    2835   }
    2836 
    2837   return 0;
    2838 }
    2839 #endif
    2840 
    28411970UInt TComPrediction::xPredWedgeFromTex( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiWidth, UInt uiHeight, UInt intraTabIdx )
    28421971{
     
    28471976  Int           uiColTexIntraDir = pcColTexCU->isIntra( uiTexPartIdx ) ? pcColTexCU->getLumaIntraDir( uiTexPartIdx ) : 255;
    28481977
    2849 #if LGE_PKU_DMM3_OVERLAP_E0159_HHIFIX
    28501978  assert( uiColTexIntraDir > DC_IDX && uiColTexIntraDir < 35 );
    28511979  return g_aauiWdgLstM3[g_aucConvertToBit[uiWidth]][uiColTexIntraDir-2].at(intraTabIdx);
    2852 #else
    2853   if( uiColTexIntraDir > DC_IDX && uiColTexIntraDir < 35 ) { return g_aauiWdgLstM3[g_aucConvertToBit[uiWidth]][uiColTexIntraDir-2].at(intraTabIdx); }
    2854   else                                                     { return g_dmmWedgeNodeLists[(g_aucConvertToBit[uiWidth])].at(intraTabIdx).getPatternIdx(); }
    2855 #endif
    28561980}
    28571981
     
    28751999  }
    28762000
    2877 #if SCU_HS_DMM4_REMOVE_DIV_E0242
    2878   Int cuMaxLog2Size = g_aucConvertToBit[g_uiMaxCUWidth]+2;
    2879   iDC = iDC >> (cuMaxLog2Size - pcCU->getDepth(0))*2;
    2880 #else
    2881   iDC /= (uiWidth*uiHeight);
    2882 #endif
     2001  Int cuMaxLog2Size = g_aucConvertToBit[g_uiMaxCUWidth]+2;   //
     2002  iDC = iDC >> (cuMaxLog2Size - pcCU->getDepth(0))*2;        //  iDC /= (uiWidth*uiHeight);
     2003
    28832004  piRefBlkY = cTempYuv.getLumaAddr();
    28842005
     
    29072028  }
    29082029}
    2909 
    2910 #if !SEC_DMM2_E0146_HHIFIX
    2911 Void TComPrediction::xGetBlockOffset( TComDataCU* pcCU, UInt uiAbsPartIdx, TComDataCU* pcRefCU, UInt uiRefAbsPartIdx, UInt& ruiOffsetX, UInt& ruiOffsetY )
    2912 {
    2913   ruiOffsetX = 0;
    2914   ruiOffsetY = 0;
    2915 
    2916   // get offset between current and above/left block
    2917   UInt uiThisOriginX = pcCU->getCUPelX() + g_auiRasterToPelX[ g_auiZscanToRaster[uiAbsPartIdx] ];
    2918   UInt uiThisOriginY = pcCU->getCUPelY() + g_auiRasterToPelY[ g_auiZscanToRaster[uiAbsPartIdx] ];
    2919 
    2920   UInt uiNumPartInRefCU = pcRefCU->getTotalNumPart();
    2921   UInt uiMaxDepthRefCU = 0;
    2922   while( uiNumPartInRefCU > 1 )
    2923   {
    2924     uiNumPartInRefCU >>= 2;
    2925     uiMaxDepthRefCU++;
    2926   }
    2927 
    2928   UInt uiDepthRefPU = (pcRefCU->getDepth(uiRefAbsPartIdx)) + (pcRefCU->getPartitionSize(uiRefAbsPartIdx) == SIZE_2Nx2N ? 0 : 1);
    2929   UInt uiShifts = (uiMaxDepthRefCU - uiDepthRefPU)*2;
    2930   UInt uiRefBlockOriginPartIdx = (uiRefAbsPartIdx>>uiShifts)<<uiShifts;
    2931 
    2932   UInt uiRefOriginX = pcRefCU->getCUPelX() + g_auiRasterToPelX[ g_auiZscanToRaster[uiRefBlockOriginPartIdx] ];
    2933   UInt uiRefOriginY = pcRefCU->getCUPelY() + g_auiRasterToPelY[ g_auiZscanToRaster[uiRefBlockOriginPartIdx] ];
    2934 
    2935   if( (uiThisOriginX - uiRefOriginX) > 0 ) { ruiOffsetX = (UInt)(uiThisOriginX - uiRefOriginX); }
    2936   if( (uiThisOriginY - uiRefOriginY) > 0 ) { ruiOffsetY = (UInt)(uiThisOriginY - uiRefOriginY); }
    2937 }
    2938 
    2939 Bool TComPrediction::xGetWedgeIntraDirPredData( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiBlockSize, Int& riSlopeX, Int& riSlopeY, UInt& ruiStartPosX, UInt& ruiStartPosY )
    2940 {
    2941   riSlopeX = 0, riSlopeY = 0, ruiStartPosX = 0, ruiStartPosY = 0;
    2942 
    2943   // 1st step: get wedge start point (max. slope)
    2944   Int* piSource = pcCU->getPattern()->getAdiOrgBuf( uiBlockSize, uiBlockSize, m_piYuvExt );
    2945   Int iSourceStride = ( uiBlockSize<<1 ) + 1;
    2946 
    2947   UInt uiSlopeMaxAbove = 0, uiPosSlopeMaxAbove = 0;
    2948   for( UInt uiPosHor = 0; uiPosHor < (uiBlockSize-1); uiPosHor++ )
    2949   {
    2950     if( abs( piSource[uiPosHor+1] - piSource[uiPosHor] ) > uiSlopeMaxAbove )
    2951     {
    2952       uiSlopeMaxAbove = abs( piSource[uiPosHor+1] - piSource[uiPosHor] );
    2953       uiPosSlopeMaxAbove = uiPosHor;
    2954     }
    2955   }
    2956 
    2957   UInt uiSlopeMaxLeft = 0, uiPosSlopeMaxLeft = 0;
    2958   for( UInt uiPosVer = 0; uiPosVer < (uiBlockSize-1); uiPosVer++ )
    2959   {
    2960     if( abs( piSource[(uiPosVer+1)*iSourceStride] - piSource[uiPosVer*iSourceStride] ) > uiSlopeMaxLeft )
    2961     {
    2962       uiSlopeMaxLeft = abs( piSource[(uiPosVer+1)*iSourceStride] - piSource[uiPosVer*iSourceStride] );
    2963       uiPosSlopeMaxLeft = uiPosVer;
    2964     }
    2965   }
    2966 
    2967   if( uiSlopeMaxAbove == 0 && uiSlopeMaxLeft == 0 )
    2968   {
    2969     return false;
    2970   }
    2971 
    2972   ruiStartPosX = ( uiSlopeMaxAbove >  uiSlopeMaxLeft  ) ? uiPosSlopeMaxAbove : 0;
    2973   ruiStartPosY = ( uiSlopeMaxLeft  >= uiSlopeMaxAbove ) ? uiPosSlopeMaxLeft  : 0;
    2974 
    2975   // 2nd step: derive wedge direction
    2976   Int uiPreds[3] = {-1, -1, -1};
    2977   Int iMode = -1;
    2978   Int iPredNum = pcCU->getIntraDirLumaPredictor( uiAbsPartIdx, uiPreds, &iMode ); 
    2979 
    2980   UInt uiDirMode = 0;
    2981   if( iMode >= 0 ) { iPredNum = iMode; }
    2982   if( iPredNum == 1 ) { uiDirMode = uiPreds[0]; }
    2983   if( iPredNum == 2 ) { uiDirMode = uiPreds[1]; }
    2984 
    2985   if( uiDirMode < 2 ) { return false; } // no planar & DC
    2986 
    2987   Bool modeHor       = (uiDirMode < 18);
    2988   Bool modeVer       = !modeHor;
    2989   Int intraPredAngle = modeVer ? (Int)uiDirMode - VER_IDX : modeHor ? -((Int)uiDirMode - HOR_IDX) : 0;
    2990   Int absAng         = abs(intraPredAngle);
    2991   Int signAng        = intraPredAngle < 0 ? -1 : 1;
    2992   Int angTable[9]    = {0,2,5,9,13,17,21,26,32};
    2993   absAng             = angTable[absAng];
    2994   intraPredAngle     = signAng * absAng;
    2995 
    2996   // 3rd step: set slope for direction
    2997   if( modeHor )
    2998   {
    2999     riSlopeX = ( intraPredAngle > 0 ) ?            -32 :              32;
    3000     riSlopeY = ( intraPredAngle > 0 ) ? intraPredAngle : -intraPredAngle;
    3001   }
    3002   else if( modeVer )
    3003   {
    3004     riSlopeX = ( intraPredAngle > 0 ) ? intraPredAngle : -intraPredAngle;
    3005     riSlopeY = ( intraPredAngle > 0 ) ?            -32 :              32;
    3006   }
    3007 
    3008   return true;
    3009 }
    3010 
    3011 Void TComPrediction::xGetWedgeIntraDirStartEnd( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiBlockSize, Int iDeltaX, Int iDeltaY, UInt uiPMSPosX, UInt uiPMSPosY, UChar& ruhXs, UChar& ruhYs, UChar& ruhXe, UChar& ruhYe, Int iDeltaEnd )
    3012 {
    3013   ruhXs = 0;
    3014   ruhYs = 0;
    3015   ruhXe = 0;
    3016   ruhYe = 0;
    3017 
    3018   // scaling of start pos and block size to wedge resolution
    3019   UInt uiScaledStartPosX = 0;
    3020   UInt uiScaledStartPosY = 0;
    3021   UInt uiScaledBlockSize = 0;
    3022   WedgeResolution eWedgeRes = g_dmmWedgeResolution[(UInt)g_aucConvertToBit[uiBlockSize]];
    3023   switch( eWedgeRes )
    3024   {
    3025   case( DOUBLE_PEL ): { uiScaledStartPosX = (uiPMSPosX>>1); uiScaledStartPosY = (uiPMSPosY>>1); uiScaledBlockSize = (uiBlockSize>>1); break; }
    3026   case(   FULL_PEL ): { uiScaledStartPosX =  uiPMSPosX;     uiScaledStartPosY =  uiPMSPosY;     uiScaledBlockSize =  uiBlockSize;     break; }
    3027   case(   HALF_PEL ): { uiScaledStartPosX = (uiPMSPosX<<1); uiScaledStartPosY = (uiPMSPosY<<1); uiScaledBlockSize = (uiBlockSize<<1); break; }
    3028   }
    3029   Int iMaxPos = (Int)uiScaledBlockSize - 1;
    3030 
    3031   // case above
    3032   if( uiScaledStartPosX > 0 && uiScaledStartPosY == 0 )
    3033   {
    3034     ruhXs = (UChar)uiScaledStartPosX;
    3035     ruhYs = 0;
    3036 
    3037     if( iDeltaY == 0 )
    3038     {
    3039       if( iDeltaX < 0 )
    3040       {
    3041         ruhXe = 0;
    3042         ruhYe = (UChar)std::min( std::max( iDeltaEnd, 0 ), iMaxPos );
    3043         return;
    3044       }
    3045       else
    3046       {
    3047         ruhXe = (UChar)iMaxPos;
    3048         ruhYe = (UChar)std::min( std::max( -iDeltaEnd, 0 ), iMaxPos );
    3049         std::swap( ruhXs, ruhXe );
    3050         std::swap( ruhYs, ruhYe );
    3051         return;
    3052       }
    3053     }
    3054 
    3055     // regular case
    3056     Int iVirtualEndX = (Int)ruhXs + roftoi( (Double)iMaxPos * ((Double)iDeltaX / (Double)iDeltaY) );
    3057 
    3058     if( iVirtualEndX < 0 )
    3059     {
    3060       Int iYe = roftoi( (Double)(0 - (Int)ruhXs) * ((Double)iDeltaY / (Double)iDeltaX) ) + iDeltaEnd;
    3061       if( iYe < (Int)uiScaledBlockSize )
    3062       {
    3063         ruhXe = 0;
    3064         ruhYe = (UChar)std::max( iYe, 0 );
    3065         return;
    3066       }
    3067       else
    3068       {
    3069         ruhXe = (UChar)std::min( (iYe - iMaxPos), iMaxPos );
    3070         ruhYe = (UChar)iMaxPos;
    3071         return;
    3072       }
    3073     }
    3074     else if( iVirtualEndX > iMaxPos )
    3075     {
    3076       Int iYe = roftoi( (Double)(iMaxPos - (Int)ruhXs) * ((Double)iDeltaY / (Double)iDeltaX) ) - iDeltaEnd;
    3077       if( iYe < (Int)uiScaledBlockSize )
    3078       {
    3079         ruhXe = (UChar)iMaxPos;
    3080         ruhYe = (UChar)std::max( iYe, 0 );
    3081         std::swap( ruhXs, ruhXe );
    3082         std::swap( ruhYs, ruhYe );
    3083         return;
    3084       }
    3085       else
    3086       {
    3087         ruhXe = (UChar)std::max( (iMaxPos - (iYe - iMaxPos)), 0 );
    3088         ruhYe = (UChar)iMaxPos;
    3089         return;
    3090       }
    3091     }
    3092     else
    3093     {
    3094       Int iXe = iVirtualEndX + iDeltaEnd;
    3095       if( iXe < 0 )
    3096       {
    3097         ruhXe = 0;
    3098         ruhYe = (UChar)std::max( (iMaxPos + iXe), 0 );
    3099         return;
    3100       }
    3101       else if( iXe > iMaxPos )
    3102       {
    3103         ruhXe = (UChar)iMaxPos;
    3104         ruhYe = (UChar)std::max( (iMaxPos - (iXe - iMaxPos)), 0 );
    3105         std::swap( ruhXs, ruhXe );
    3106         std::swap( ruhYs, ruhYe );
    3107         return;
    3108       }
    3109       else
    3110       {
    3111         ruhXe = (UChar)iXe;
    3112         ruhYe = (UChar)iMaxPos;
    3113         return;
    3114       }
    3115     }
    3116   }
    3117 
    3118   // case left
    3119   if( uiScaledStartPosY > 0 && uiScaledStartPosX == 0 )
    3120   {
    3121     ruhXs = 0;
    3122     ruhYs = (UChar)uiScaledStartPosY;
    3123 
    3124     if( iDeltaX == 0 )
    3125     {
    3126       if( iDeltaY < 0 )
    3127       {
    3128         ruhXe = (UChar)std::min( std::max( -iDeltaEnd, 0 ), iMaxPos );
    3129         ruhYe = 0;
    3130         std::swap( ruhXs, ruhXe );
    3131         std::swap( ruhYs, ruhYe );
    3132         return;
    3133       }
    3134       else
    3135       {
    3136         ruhXe = (UChar)std::min( std::max( iDeltaEnd, 0 ), iMaxPos );
    3137         ruhYe = (UChar)iMaxPos;
    3138         return;
    3139       }
    3140     }
    3141 
    3142     // regular case
    3143     Int iVirtualEndY = (Int)ruhYs + roftoi( (Double)iMaxPos * ((Double)iDeltaY / (Double)iDeltaX) );
    3144 
    3145     if( iVirtualEndY < 0 )
    3146     {
    3147       Int iXe = roftoi( (Double)(0 - (Int)ruhYs ) * ((Double)iDeltaX / (Double)iDeltaY) ) - iDeltaEnd;
    3148       if( iXe < (Int)uiScaledBlockSize )
    3149       {
    3150         ruhXe = (UChar)std::max( iXe, 0 );
    3151         ruhYe = 0;
    3152         std::swap( ruhXs, ruhXe );
    3153         std::swap( ruhYs, ruhYe );
    3154         return;
    3155       }
    3156       else
    3157       {
    3158         ruhXe = (UChar)iMaxPos;
    3159         ruhYe = (UChar)std::min( (iXe - iMaxPos), iMaxPos );
    3160         std::swap( ruhXs, ruhXe );
    3161         std::swap( ruhYs, ruhYe );
    3162         return;
    3163       }
    3164     }
    3165     else if( iVirtualEndY > (uiScaledBlockSize-1) )
    3166     {
    3167       Int iXe = roftoi( (Double)((Int)(uiScaledBlockSize-1) - (Int)ruhYs ) * ((Double)iDeltaX / (Double)iDeltaY) ) + iDeltaEnd;
    3168       if( iXe < (Int)uiScaledBlockSize )
    3169       {
    3170         ruhXe = (UChar)std::max( iXe, 0 );
    3171         ruhYe = (UChar)(uiScaledBlockSize-1);
    3172         return;
    3173       }
    3174       else
    3175       {
    3176         ruhXe = (UChar)iMaxPos;
    3177         ruhYe = (UChar)std::max( (iMaxPos - (iXe - iMaxPos)), 0 );
    3178         std::swap( ruhXs, ruhXe );
    3179         std::swap( ruhYs, ruhYe );
    3180         return;
    3181       }
    3182     }
    3183     else
    3184     {
    3185       Int iYe = iVirtualEndY - iDeltaEnd;
    3186       if( iYe < 0 )
    3187       {
    3188         ruhXe = (UChar)std::max( (iMaxPos + iYe), 0 );
    3189         ruhYe = 0;
    3190         std::swap( ruhXs, ruhXe );
    3191         std::swap( ruhYs, ruhYe );
    3192         return;
    3193       }
    3194       else if( iYe > iMaxPos )
    3195       {
    3196         ruhXe = (UChar)std::max( (iMaxPos - (iYe - iMaxPos)), 0 );
    3197         ruhYe = (UChar)iMaxPos;
    3198         return;
    3199       }
    3200       else
    3201       {
    3202         ruhXe = (UChar)iMaxPos;
    3203         ruhYe = (UChar)iYe;
    3204         std::swap( ruhXs, ruhXe );
    3205         std::swap( ruhYs, ruhYe );
    3206         return;
    3207       }
    3208     }
    3209   }
    3210 
    3211   // case origin
    3212   if( uiScaledStartPosX == 0 && uiScaledStartPosY == 0 )
    3213   {
    3214     if( iDeltaX*iDeltaY < 0 )
    3215     {
    3216       return;
    3217     }
    3218 
    3219     ruhXs = 0;
    3220     ruhYs = 0;
    3221 
    3222     if( iDeltaY == 0 )
    3223     {
    3224       ruhXe = (UChar)iMaxPos;
    3225       ruhYe = 0;
    3226       std::swap( ruhXs, ruhXe );
    3227       std::swap( ruhYs, ruhYe );
    3228       return;
    3229     }
    3230 
    3231     if( iDeltaX == 0 )
    3232     {
    3233       ruhXe = 0;
    3234       ruhYe = (UChar)iMaxPos;
    3235       return;
    3236     }
    3237 
    3238     Int iVirtualEndX = (Int)ruhXs + roftoi( (Double)iMaxPos * ((Double)iDeltaX / (Double)iDeltaY) );
    3239 
    3240     if( iVirtualEndX > iMaxPos )
    3241     {
    3242       Int iYe = roftoi( (Double)((Int)iMaxPos - (Int)ruhXs) * ((Double)iDeltaY / (Double)iDeltaX) ) - iDeltaEnd;
    3243       if( iYe < (Int)uiScaledBlockSize )
    3244       {
    3245         ruhXe = (UChar)(uiScaledBlockSize-1);
    3246         ruhYe = (UChar)std::max( iYe, 0 );
    3247         std::swap( ruhXs, ruhXe );
    3248         std::swap( ruhYs, ruhYe );
    3249         return;
    3250       }
    3251       else
    3252       {
    3253         ruhXe = (UChar)std::max( (iMaxPos - (iYe - iMaxPos)), 0 );
    3254         ruhYe = (UChar)(uiScaledBlockSize-1);
    3255         return;
    3256       }
    3257     }
    3258     else
    3259     {
    3260       Int iXe = iVirtualEndX + iDeltaEnd;
    3261       if( iXe < 0 )
    3262       {
    3263         ruhXe = 0;
    3264         ruhYe = (UChar)std::max( (iMaxPos + iXe), 0 );
    3265         return;
    3266       }
    3267       else if( iXe > iMaxPos )
    3268       {
    3269         ruhXe = (UChar)(uiScaledBlockSize-1);
    3270         ruhYe = (UChar)std::max( (iMaxPos - (iXe - iMaxPos)), 0 );
    3271         std::swap( ruhXs, ruhXe );
    3272         std::swap( ruhYs, ruhYe );
    3273         return;
    3274       }
    3275       else
    3276       {
    3277         ruhXe = (UChar)iXe;
    3278         ruhYe = (UChar)(uiScaledBlockSize-1);
    3279         return;
    3280       }
    3281     }
    3282   }
    3283 }
    3284 
    3285 UInt TComPrediction::xGetWedgePatternIdx( UInt uiBlockSize, UChar uhXs, UChar uhYs, UChar uhXe, UChar uhYe )
    3286 {
    3287   WedgeRefList* pcWedgeRefList = &g_dmmWedgeRefLists[(g_aucConvertToBit[uiBlockSize])];
    3288   for( UInt uiIdx = 0; uiIdx < pcWedgeRefList->size(); uiIdx++ )
    3289   {
    3290     TComWedgeRef* pcTestWedgeRef = &(pcWedgeRefList->at(uiIdx));
    3291     if( pcTestWedgeRef->getStartX() == uhXs && pcTestWedgeRef->getStartY() == uhYs && pcTestWedgeRef->getEndX() == uhXe && pcTestWedgeRef->getEndY() == uhYe )
    3292     {
    3293       return pcTestWedgeRef->getRefIdx();
    3294     }
    3295   }
    3296   return 0;
    3297 }
    3298 #endif
    3299 #endif
     2030#endif
     2031
    33002032#if H_3D_DIM_RBC
    33012033Void TComPrediction::xDeltaDCQuantScaleUp( TComDataCU* pcCU, Pel& rDeltaDC )
     
    33272059#if H_3D_DIM_SDC
    33282060Void TComPrediction::analyzeSegmentsSDC( Pel* pOrig, UInt uiStride, UInt uiSize, Pel* rpSegMeans, UInt uiNumSegments, Bool* pMask, UInt uiMaskStride
    3329 #if KWU_SDC_SIMPLE_DC_E0117
    33302061                                         ,UInt uiIntraMode
    33312062                                         ,Bool orgDC
    3332 #endif
    33332063                                        )
    33342064{
     
    33382068  memset(iSumPix, 0, sizeof(Int)*2);
    33392069 
    3340 #if KWU_SDC_SIMPLE_DC_E0117
    33412070  if (orgDC == false)
    33422071  {
     
    33642093    return;
    33652094  }
    3366 #endif
    33672095
    33682096  Int subSamplePix;
  • trunk/source/Lib/TLibCommon/TComPrediction.h

    r622 r655  
    7676  Int    m_iLumaRecStride;       ///< stride of #m_pLumaRecBuffer array
    7777#if H_3D_IC
    78 #if SHARP_ILLUCOMP_REFINE_E0046
    7978  UInt   m_uiaShift[ 64 ];       // Table for multiplication to substitue of division operation
    80 #else
    81   UInt   m_uiaShift[ 63 ];       // Table for multiplication to substitue of division operation
    82 #endif
    8379#endif
    8480
     
    8884  Int  xGetConstrainedSize(Int nPbW, Int nPbH, Bool bLuma = true);
    8985#endif
    90 #if NTT_VSP_COMMON_E0207_E0208
    9186  TComYuv   m_cYuvDepthOnVsp;
    92 #endif
    9387#endif
    9488
     
    126120
    127121#if H_3D_VSP
    128 #if NTT_VSP_COMMON_E0207_E0208
    129122  Void xGetVirtualDepth           ( TComDataCU *cu, TComPicYuv *picRefDepth, TComMv *dv, UInt partAddr, Int width, Int height, TComYuv *yuvDepth, Int txtPerDepthX=1, Int txtPerDepthY=1 );
    130123  Void xPredInterLumaBlkFromDM    ( TComDataCU *cu, TComPicYuv *picRef, TComYuv *yuvDepth, Int* shiftLUT, TComMv *mv, UInt partAddr, Int width, Int height, Bool isDepth, TComYuv *&pcYuvDst, Bool isBi );
    131124  Void xPredInterChromaBlkFromDM  ( TComDataCU *cu, TComPicYuv *picRef, TComYuv *yuvDepth, Int* shiftLUT, TComMv *mv, UInt partAddr, Int width, Int height, Bool isDepth, TComYuv *&pcYuvDst, Bool isBi );
    132 #else
    133   Void xPredInterLumaBlkFromDM  ( TComPicYuv *refPic, TComPicYuv *pPicBaseDepth, Int* pShiftLUT, TComMv* dv, UInt partAddr, Int posX, Int posY, Int sizeX, Int sizeY, Bool isDepth, TComYuv *&dstPic, Bool bi );
    134   Void xPredInterChromaBlkFromDM( TComPicYuv *refPic, TComPicYuv *pPicBaseDepth, Int* pShiftLUT, TComMv* dv, UInt partAddr, Int posX, Int posY, Int sizeX, Int sizeY, Bool isDepth, TComYuv *&dstPic, Bool bi );
    135 #endif
    136125#endif
    137126
     
    140129  Void xGetLLSPrediction ( TComPattern* pcPattern, Int* pSrc0, Int iSrcStride, Pel* pDst0, Int iDstStride, UInt uiWidth, UInt uiHeight, UInt uiExt0 );
    141130#if H_3D_IC
    142 #if SHARP_ILLUCOMP_REFINE_E0046
    143131  Void xGetLLSICPrediction( TComDataCU* pcCU, TComMv *pMv, TComPicYuv *pRefPic, Int &a, Int &b, TextType eType );
    144 #else
    145   Void xGetLLSICPrediction( TComDataCU* pcCU, TComMv *pMv, TComPicYuv *pRefPic, Int &a, Int &b, Int &iShift, TextType eType );
    146 #endif
    147132#endif
    148133  Void xDCPredFiltering( Int* pSrc, Int iSrcStride, Pel*& rpDst, Int iDstStride, Int iWidth, Int iHeight );
     
    154139  Void xAssignBiSegDCs          ( Pel* ptrDst, UInt dstStride, Bool* biSegPattern, Int patternStride, Pel   valDC1, Pel   valDC2 );
    155140#if H_3D_DIM_DMM
    156 #if !SEC_DMM2_E0146_HHIFIX
    157   UInt xPredWedgeFromIntra      ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiWidth, UInt uiHeight, Int iDeltaEnd = 0 );
    158 #endif
    159141  UInt xPredWedgeFromTex        ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiWidth, UInt uiHeight, UInt intraTabIdx );
    160142  Void xPredContourFromTex      ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiWidth, UInt uiHeight, TComWedgelet* pcContourWedge );
    161 
    162143  Void xCopyTextureLumaBlock    ( TComDataCU* pcCU, UInt uiAbsPartIdx, Pel* piDestBlockY, UInt uiWidth, UInt uiHeight );
    163 
    164 #if !SEC_DMM2_E0146_HHIFIX
    165   Void xGetBlockOffset          ( TComDataCU* pcCU, UInt uiAbsPartIdx, TComDataCU* pcRefCU, UInt uiRefAbsPartIdx, UInt& ruiOffsetX, UInt& ruiOffsetY );
    166   Bool xGetWedgeIntraDirPredData( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiBlockSize, Int& riSlopeX, Int& riSlopeY, UInt& ruiStartPosX, UInt& ruiStartPosY );
    167   Void xGetWedgeIntraDirStartEnd( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiBlockSize, Int iDeltaX, Int iDeltaY, UInt uiPMSPosX, UInt uiPMSPosY, UChar& ruhXs, UChar& ruhYs, UChar& ruhXe, UChar& ruhYe, Int iDeltaEnd = 0 );
    168   UInt xGetWedgePatternIdx      ( UInt uiBlockSize, UChar uhXs, UChar uhYs, UChar uhXe, UChar uhYe );
    169 #endif
    170144#endif
    171145#if H_3D_DIM_RBC
     
    196170#if H_3D_DIM_SDC
    197171  Void analyzeSegmentsSDC         ( Pel* pOrig, UInt uiStride, UInt uiSize, Pel* rpSegMeans, UInt uiNumSegments, Bool* pMask, UInt uiMaskStride
    198 #if KWU_SDC_SIMPLE_DC_E0117
    199172                                    ,UInt uiIntraMode
    200173                                    ,Bool orgDC=false
    201 #endif
    202174    );
    203175#endif
  • trunk/source/Lib/TLibCommon/TComRdCost.cpp

    r622 r655  
    484484}
    485485
    486 #if SCU_HS_FAST_DEPTH_INTRA_E0238_HHIFIX
     486#if H_3D_FAST_DEPTH_INTRA
    487487
    488488UInt TComRdCost::calcVAR (Pel* pi0, Int stride, Int width, Int height, Int cuDepth)
     
    542542  cDtParam.bUseIC       = false;
    543543#endif
    544 #if LGE_INTER_SDC_E0156
     544#if H_3D_INTER_SDC
    545545  cDtParam.bUseSDCMRSAD = false;
    546546#endif
     
    605605    dist = (Dist) (iDWeight * distDepth + iVSOWeight * dist ) / ( iDWeight + iVSOWeight);
    606606  }
    607 #if H_3D_FIX_UINT_WARNING
     607
    608608  return (UInt) dist;
    609 #else
    610   return dist;
    611 #endif
    612 
    613 }
    614 #endif
    615 
    616 #if RATE_CONTROL_LAMBDA_DOMAIN && !M0036_RC_IMPROVEMENT
     609}
     610#endif
     611
     612#if (RATE_CONTROL_LAMBDA_DOMAIN && !M0036_RC_IMPROVEMENT) || KWU_RC_MADPRED_E0227
    617613UInt TComRdCost::getSADPart ( Int bitDepth, Pel* pelCur, Int curStride,  Pel* pelOrg, Int orgStride, UInt width, UInt height )
    618614{
     
    652648  }
    653649#endif
    654 #if LGE_INTER_SDC_E0156
     650#if H_3D_INTER_SDC
    655651  if( pcDtParam->bUseSDCMRSAD )
    656652  {
     
    692688  }
    693689#endif
    694 #if LGE_INTER_SDC_E0156
     690#if H_3D_INTER_SDC
    695691  if( pcDtParam->bUseSDCMRSAD )
    696692  {
     
    735731  }
    736732#endif
    737 #if LGE_INTER_SDC_E0156
     733#if H_3D_INTER_SDC
    738734  if( pcDtParam->bUseSDCMRSAD )
    739735  {
     
    782778  }
    783779#endif
    784 #if LGE_INTER_SDC_E0156
     780#if H_3D_INTER_SDC
    785781  if( pcDtParam->bUseSDCMRSAD )
    786782  {
     
    838834  }
    839835#endif
    840 #if LGE_INTER_SDC_E0156
     836#if H_3D_INTER_SDC
    841837  if( pcDtParam->bUseSDCMRSAD )
    842838  {
     
    886882  }
    887883#endif
    888 #if LGE_INTER_SDC_E0156
     884#if H_3D_INTER_SDC
    889885  if( pcDtParam->bUseSDCMRSAD )
    890886  {
     
    944940  }
    945941#endif
    946 #if LGE_INTER_SDC_E0156
     942#if H_3D_INTER_SDC
    947943  if( pcDtParam->bUseSDCMRSAD )
    948944  {
     
    10161012  }
    10171013#endif
    1018 #if LGE_INTER_SDC_E0156
     1014#if H_3D_INTER_SDC
    10191015  if( pcDtParam->bUseSDCMRSAD )
    10201016  {
     
    10811077  }
    10821078#endif
    1083 #if LGE_INTER_SDC_E0156
     1079#if H_3D_INTER_SDC
    10841080  if( pcDtParam->bUseSDCMRSAD )
    10851081  {
     
    11851181  }
    11861182#endif
    1187 #if LGE_INTER_SDC_E0156
     1183#if H_3D_INTER_SDC
    11881184  if( pcDtParam->bUseSDCMRSAD )
    11891185  {
     
    12611257#endif
    12621258
    1263 #if H_3D_IC || LGE_INTER_SDC_E0156
     1259#if H_3D_IC || H_3D_INTER_SDC
    12641260UInt TComRdCost::xGetSADic( DistParam* pcDtParam )
    12651261{
     
    35133509  }
    35143510#endif
    3515 #if LGE_INTER_SDC_E0156
     3511#if H_3D_INTER_SDC
    35163512  if( pcDtParam->bUseSDCMRSAD )
    35173513  {
     
    36163612}
    36173613
    3618 #if H_3D_IC || LGE_INTER_SDC_E0156
     3614#if H_3D_IC || H_3D_INTER_SDC
    36193615UInt TComRdCost::xGetHADsic( DistParam* pcDtParam )
    36203616{
  • trunk/source/Lib/TLibCommon/TComRdCost.h

    r622 r655  
    9494  Bool  bUseIC;
    9595#endif
    96 #if LGE_INTER_SDC_E0156
     96#if H_3D_INTER_SDC
    9797  Bool  bUseSDCMRSAD;
    9898#endif
     
    136136    iStrideVir = 0;
    137137#endif
    138 #if LGE_INTER_SDC_E0156
     138#if H_3D_INTER_SDC
    139139    bUseSDCMRSAD = false;
    140140#endif
     
    148148private:
    149149  // for distortion
    150   Int                     m_iBlkWidth;
    151   Int                     m_iBlkHeight;
    152150 
    153151#if AMP_SAD
     
    235233  UInt    calcHAD(Int bitDepth, Pel* pi0, Int iStride0, Pel* pi1, Int iStride1, Int iWidth, Int iHeight );
    236234 
    237 #if SCU_HS_FAST_DEPTH_INTRA_E0238_HHIFIX
     235#if H_3D_FAST_DEPTH_INTRA
    238236  UInt    calcVAR(Pel* pi0, Int stride, Int width, Int height, Int cuDepth);
    239237#endif 
     
    283281  static UInt xGetSSE64         ( DistParam* pcDtParam );
    284282  static UInt xGetSSE16N        ( DistParam* pcDtParam );
    285 #if H_3D_IC || LGE_INTER_SDC_E0156
     283#if H_3D_IC || H_3D_INTER_SDC
    286284  static UInt xGetSADic         ( DistParam* pcDtParam );
    287285  static UInt xGetSAD4ic        ( DistParam* pcDtParam );
     
    311309
    312310#if AMP_SAD
    313 #if H_3D_IC || LGE_INTER_SDC_E0156
     311#if H_3D_IC || H_3D_INTER_SDC
    314312  static UInt xGetSAD12ic       ( DistParam* pcDtParam );
    315313  static UInt xGetSAD24ic       ( DistParam* pcDtParam );
     
    322320#endif
    323321
    324 #if H_3D_IC || LGE_INTER_SDC_E0156
     322#if H_3D_IC || H_3D_INTER_SDC
    325323  static UInt xGetHADsic          ( DistParam* pcDtParam );
    326324#endif
     
    343341#endif
    344342
    345 #if RATE_CONTROL_LAMBDA_DOMAIN && !M0036_RC_IMPROVEMENT
     343#if (RATE_CONTROL_LAMBDA_DOMAIN && !M0036_RC_IMPROVEMENT) || KWU_RC_MADPRED_E0227
    346344  UInt   getSADPart ( Int bitDepth, Pel* pelCur, Int curStride,  Pel* pelOrg, Int orgStride, UInt width, UInt height );
    347345#endif
  • trunk/source/Lib/TLibCommon/TComRom.cpp

    r622 r655  
    5555  ::memset( g_aucConvertToBit,   -1, sizeof( g_aucConvertToBit ) );
    5656  c=0;
    57   for ( i=4; i<MAX_CU_SIZE; i*=2 )
     57  for ( i=4; i<=MAX_CU_SIZE; i*=2 )
    5858  {
    5959    g_aucConvertToBit[ i ] = c;
    6060    c++;
    6161  }
    62   g_aucConvertToBit[ i ] = c;
    6362 
    6463  c=2;
     
    292291
    293292#if FAST_UDI_USE_MPM
    294 const UChar g_aucIntraModeNumFast[7] =
     293const UChar g_aucIntraModeNumFast[MAX_CU_DEPTH] =
    295294{
    296295  3,  //   2x2
     
    299298  3,  //  16x16   
    300299  3,  //  32x32   
    301   3,  //  64x64   
    302   3   // 128x128 
     300  3   //  64x64   
    303301};
    304302#else // FAST_UDI_USE_MPM
    305 const UChar g_aucIntraModeNumFast[7] =
     303const UChar g_aucIntraModeNumFast[MAX_CU_DEPTH] =
    306304{
    307305  3,  //   2x2
     
    310308  4,  //  16x16   33
    311309  4,  //  32x32   33
    312   5,  //  64x64   33
    313   4   // 128x128  33
     310  5   //  64x64   33
    314311};
    315312#endif // FAST_UDI_USE_MPM
     
    347344{ //2x2   4x4   8x8 16x16 32x32 64x64
    348345     0,    7,   10,   11,   11,   13 };
    349 #if LGE_PKU_DMM3_OVERLAP_E0159_HHIFIX
     346
    350347const UChar g_dmm3IntraTabIdxBits[6] =
    351348{ //2x2   4x4   8x8 16x16 32x32 64x64
    352349     0,    4,    7,    8,    8,    0 };
    353 #else
    354 const UChar g_dmm3IntraTabIdxBits[6] =
    355 { //2x2   4x4   8x8 16x16 32x32 64x64
    356      0,    6,    9,    9,    9,    0 };
    357 #endif
    358350
    359351extern std::vector< std::vector<TComWedgelet> >   g_dmmWedgeLists;
     
    614606std::vector< std::vector< std::vector<UInt> > > g_aauiWdgLstM3;
    615607
    616 #if LGE_PKU_DMM3_OVERLAP_E0159_HHIFIX
    617608Void initWedgeLists( Bool initNodeList )
    618 #else
    619 Void initWedgeLists( Bool initRefinements )
    620 #endif
    621609{
    622610  if( !g_dmmWedgeLists.empty() ) return;
     
    631619    g_dmmWedgeRefLists.push_back( acWedgeRefList );
    632620
    633 #if LGE_PKU_DMM3_OVERLAP_E0159_HHIFIX
    634621    if( initNodeList )
    635622    {
    636 #endif
    637     // create WedgeNodeList
    638     std::vector<TComWedgeNode> acWedgeNodeList;
    639     for( UInt uiPos = 0; uiPos < acWedgeList.size(); uiPos++ )
    640     {
    641       if( acWedgeList[uiPos].getIsCoarse() )
    642       {
    643         TComWedgeNode cWedgeNode;
    644         cWedgeNode.setPatternIdx( uiPos );
    645 
    646 #if !LGE_PKU_DMM3_OVERLAP_E0159_HHIFIX
    647         if( initRefinements )
     623      // create WedgeNodeList
     624      std::vector<TComWedgeNode> acWedgeNodeList;
     625      for( UInt uiPos = 0; uiPos < acWedgeList.size(); uiPos++ )
     626      {
     627        if( acWedgeList[uiPos].getIsCoarse() )
    648628        {
    649 #endif
     629          TComWedgeNode cWedgeNode;
     630          cWedgeNode.setPatternIdx( uiPos );
     631
    650632          UInt uiRefPos = 0;
    651633          for( Int iOffS = -1; iOffS <= 1; iOffS++ )
     
    674656              {
    675657                if( iSx == (Int)acWedgeRefList[k].getStartX() &&
    676                     iSy == (Int)acWedgeRefList[k].getStartY() &&
    677                     iEx == (Int)acWedgeRefList[k].getEndX()   &&
    678                     iEy == (Int)acWedgeRefList[k].getEndY()      )
     658                  iSy == (Int)acWedgeRefList[k].getStartY() &&
     659                  iEx == (Int)acWedgeRefList[k].getEndX()   &&
     660                  iEy == (Int)acWedgeRefList[k].getEndY()      )
    679661                {
    680662                  if( acWedgeRefList[k].getRefIdx() != cWedgeNode.getPatternIdx() )
     
    694676            }
    695677          }
    696 #if !LGE_PKU_DMM3_OVERLAP_E0159_HHIFIX
     678          acWedgeNodeList.push_back( cWedgeNode );
    697679        }
    698 #endif
    699         acWedgeNodeList.push_back( cWedgeNode );
    700       }
    701     }
    702     g_dmmWedgeNodeLists.push_back( acWedgeNodeList );
    703 #if LGE_PKU_DMM3_OVERLAP_E0159_HHIFIX
    704   }
    705 #endif
    706   }
    707   return;
     680      }
     681      g_dmmWedgeNodeLists.push_back( acWedgeNodeList );
     682    }
     683  }
    708684}
    709685
  • trunk/source/Lib/TLibCommon/TComRom.h

    r622 r655  
    5656// ====================================================================================================================
    5757
    58 #define     MAX_CU_DEPTH            7                           // log2(LCUSize)
     58#define     MAX_CU_DEPTH            6                           // log2(LCUSize)
    5959#define     MAX_CU_SIZE             (1<<(MAX_CU_DEPTH))         // maximum allowable size of CU
    6060#define     MIN_PU_SIZE             4
     
    136136// ====================================================================================================================
    137137
    138 extern const UChar  g_aucIntraModeNumFast[7];
     138extern const UChar  g_aucIntraModeNumFast[ MAX_CU_DEPTH ];
    139139
    140140// ====================================================================================================================
     
    174174extern       std::vector< std::vector< std::vector<UInt> > > g_aauiWdgLstM3;
    175175
    176 #if LGE_PKU_DMM3_OVERLAP_E0159_HHIFIX
    177176Void initWedgeLists( Bool initNodeList = false );
    178 #else
    179 Void initWedgeLists( Bool initRefinements = false );
    180 #endif
    181177Void createWedgeList( UInt uiWidth, UInt uiHeight, std::vector<TComWedgelet> &racWedgeList, std::vector<TComWedgeRef> &racWedgeRefList, WedgeResolution eWedgeRes );
    182178Void addWedgeletToList( TComWedgelet cWedgelet, std::vector<TComWedgelet> &racWedgeList, std::vector<TComWedgeRef> &racWedgeRefList );
  • trunk/source/Lib/TLibCommon/TComSlice.cpp

    r622 r655  
    101101, m_enableTMVPFlag                ( true )
    102102#if H_MV
    103 #if H_MV5
    104103, m_refPicSetInterLayer0           ( NULL )
    105104, m_refPicSetInterLayer1           ( NULL )
    106 #else
    107 , m_refPicSetInterLayer           ( NULL )
    108 #endif
    109105, m_layerId                       (0)
    110106, m_viewId                        (0)
    111 #if H_MV5
    112107, m_viewIndex                     (0)
    113 #endif
    114108#if H_3D
    115 #if !H_MV5
    116 , m_viewIndex                     (0)
    117 #endif
    118109, m_isDepth                       (false)
    119110#endif
    120 #if H_MV5
    121111, m_pocResetFlag                  (false)
    122 #endif
    123112, m_discardableFlag               (false)
    124113, m_interLayerPredEnabledFlag     (false)
    125114, m_numInterLayerRefPicsMinus1    (0)
    126 #if !H_MV5
    127 , m_interLayerSamplePredOnlyFlag  (false)
    128 , m_altCollocatedIndicationFlag   (0)
    129 , m_collocatedRefLayerIdx         (0)
    130 #endif
    131115#if H_3D_IC
    132116, m_bApplyIC                      ( false )
     
    164148  for (Int i = 0; i < MAX_NUM_LAYERS; i++ )
    165149  {
    166 #if H_MV5
    167150   m_interLayerPredLayerIdc[ i ] = i;
    168 #else
    169    m_interLayerPredLayerIdc[ i ] = 0;
    170 #endif
    171151  }
    172152#endif
     
    322302  if (!pocHasMsb)
    323303  {
    324     poc = poc % pocCycle;
     304    poc = poc & (pocCycle - 1);
    325305  }
    326306 
     
    333313      if (!pocHasMsb)
    334314      {
    335         picPoc = picPoc % pocCycle;
     315        picPoc = picPoc & (pocCycle - 1);
    336316      }
    337317     
     
    387367  }
    388368}
    389 #if H_MV5
    390369#if !H_MV
    391370#if FIX1071
     
    472451  {
    473452    // The variable NumPocTotalCurr is derived as specified in subclause 7.4.7.2. It is a requirement of bitstream conformance that the following applies to the value of NumPocTotalCurr:
    474     // “ If the current picture is a BLA or CRA picture, the value of NumPocTotalCurr shall be equal to 0.
    475     // “ Otherwise, when the current picture contains a P or B slice, the value of NumPocTotalCurr shall not be equal to 0.
     453    // ?If the current picture is a BLA or CRA picture, the value of NumPocTotalCurr shall be equal to 0.
     454    // ?Otherwise, when the current picture contains a P or B slice, the value of NumPocTotalCurr shall not be equal to 0.
    476455    if (getRapPicFlag())
    477456    {
     
    730709}
    731710#endif
    732 #else
     711Int TComSlice::getNumRpsCurrTempList()
     712{
     713  Int numRpsCurrTempList = 0;
     714
     715  if (m_eSliceType == I_SLICE)
     716  {
     717    return 0;
     718  }
     719  for(UInt i=0; i < m_pcRPS->getNumberOfNegativePictures()+ m_pcRPS->getNumberOfPositivePictures() + m_pcRPS->getNumberOfLongtermPictures(); i++)
     720  {
     721    if(m_pcRPS->getUsed(i))
     722    {
     723      numRpsCurrTempList++;
     724    }
     725  }
    733726#if H_MV
    734 Void TComSlice::setRefPicList( TComList<TComPic*>& rcListPic, std::vector<TComPic*>& refPicSetInterLayer , Bool checkNumPocTotalCurr)
    735 #else
    736 #if FIX1071
    737 Void TComSlice::setRefPicList( TComList<TComPic*>& rcListPic, Bool checkNumPocTotalCurr )
    738 #else
    739 Void TComSlice::setRefPicList( TComList<TComPic*>& rcListPic )
    740 #endif
    741 #endif
    742 {
    743 #if FIX1071
    744   if (!checkNumPocTotalCurr)
    745 #endif
    746   {
    747     if (m_eSliceType == I_SLICE)
    748     {
    749       ::memset( m_apcRefPicList, 0, sizeof (m_apcRefPicList));
    750       ::memset( m_aiNumRefIdx,   0, sizeof ( m_aiNumRefIdx ));
    751      
    752       return;
    753     }
    754    
    755 #if !H_MV
    756     m_aiNumRefIdx[0] = getNumRefIdx(REF_PIC_LIST_0);
    757     m_aiNumRefIdx[1] = getNumRefIdx(REF_PIC_LIST_1);
    758 #endif
    759   }
    760 
    761   TComPic*  pcRefPic= NULL;
    762   TComPic*  RefPicSetStCurr0[16];
    763   TComPic*  RefPicSetStCurr1[16];
    764   TComPic*  RefPicSetLtCurr[16];
    765   UInt NumPocStCurr0 = 0;
    766   UInt NumPocStCurr1 = 0;
    767   UInt NumPocLtCurr = 0;
    768   Int i;
    769 
    770   for(i=0; i < m_pcRPS->getNumberOfNegativePictures(); i++)
    771   {
    772     if(m_pcRPS->getUsed(i))
    773     {
    774       pcRefPic = xGetRefPic(rcListPic, getPOC()+m_pcRPS->getDeltaPOC(i));
    775       pcRefPic->setIsLongTerm(0);
    776       pcRefPic->getPicYuvRec()->extendPicBorder();
    777       RefPicSetStCurr0[NumPocStCurr0] = pcRefPic;
    778       NumPocStCurr0++;
    779       pcRefPic->setCheckLTMSBPresent(false); 
    780     }
    781   }
    782  
    783   for(; i < m_pcRPS->getNumberOfNegativePictures()+m_pcRPS->getNumberOfPositivePictures(); i++)
    784   {
    785     if(m_pcRPS->getUsed(i))
    786     {
    787       pcRefPic = xGetRefPic(rcListPic, getPOC()+m_pcRPS->getDeltaPOC(i));
    788       pcRefPic->setIsLongTerm(0);
    789       pcRefPic->getPicYuvRec()->extendPicBorder();
    790       RefPicSetStCurr1[NumPocStCurr1] = pcRefPic;
    791       NumPocStCurr1++;
    792       pcRefPic->setCheckLTMSBPresent(false); 
    793     }
    794   }
    795  
    796   for(i = m_pcRPS->getNumberOfNegativePictures()+m_pcRPS->getNumberOfPositivePictures()+m_pcRPS->getNumberOfLongtermPictures()-1; i > m_pcRPS->getNumberOfNegativePictures()+m_pcRPS->getNumberOfPositivePictures()-1 ; i--)
    797   {
    798     if(m_pcRPS->getUsed(i))
    799     {
    800       pcRefPic = xGetLongTermRefPic(rcListPic, m_pcRPS->getPOC(i), m_pcRPS->getCheckLTMSBPresent(i));
    801       pcRefPic->setIsLongTerm(1);
    802       pcRefPic->getPicYuvRec()->extendPicBorder();
    803       RefPicSetLtCurr[NumPocLtCurr] = pcRefPic;
    804       NumPocLtCurr++;
    805     }
    806     if(pcRefPic==NULL)
    807     {
    808       pcRefPic = xGetLongTermRefPic(rcListPic, m_pcRPS->getPOC(i), m_pcRPS->getCheckLTMSBPresent(i));
    809     }
    810     pcRefPic->setCheckLTMSBPresent(m_pcRPS->getCheckLTMSBPresent(i)); 
    811   }
    812 
    813   // ref_pic_list_init
    814   TComPic*  rpsCurrList0[MAX_NUM_REF+1];
    815   TComPic*  rpsCurrList1[MAX_NUM_REF+1];
    816 #if H_MV
    817   Int numPocInterCurr = NumPocStCurr0 + NumPocStCurr1 + NumPocLtCurr;
    818   assert( numPocInterCurr == 0 || getInterRefEnabledInRPLFlag() );
    819   Int numPocTotalCurr = numPocInterCurr + getNumActiveRefLayerPics( );
    820   assert( numPocTotalCurr == getNumRpsCurrTempList() );
    821 #else
    822   Int numPocTotalCurr = NumPocStCurr0 + NumPocStCurr1 + NumPocLtCurr;
    823 #endif
    824 #if FIX1071
    825   if (checkNumPocTotalCurr)
    826   {
    827     // The variable NumPocTotalCurr is derived as specified in subclause 7.4.7.2. It is a requirement of bitstream conformance that the following applies to the value of NumPocTotalCurr:
    828 #if H_MV
    829     // – If nuh_layer_id is equal to 0 and the current picture is a BLA picture or a CRA picture, the value of NumPocTotalCurr shall be equal to 0.
    830     // – Otherwise, when the current picture contains a P or B slice, the value of NumPocTotalCurr shall not be equal to 0.
    831     if ( getRapPicFlag() && m_layerId == 0 )
    832 #else
    833     // – If the current picture is a BLA or CRA picture, the value of NumPocTotalCurr shall be equal to 0.
    834     // – Otherwise, when the current picture contains a P or B slice, the value of NumPocTotalCurr shall not be equal to 0.
    835     if (getRapPicFlag())
    836 #endif
    837     {
    838       assert(numPocTotalCurr == 0);
    839     }
    840 
    841     if (m_eSliceType == I_SLICE)
    842     {
    843       ::memset( m_apcRefPicList, 0, sizeof (m_apcRefPicList));
    844       ::memset( m_aiNumRefIdx,   0, sizeof ( m_aiNumRefIdx ));
    845      
    846       return;
    847     }
    848    
    849     assert(numPocTotalCurr > 0);
    850    
    851     m_aiNumRefIdx[0] = getNumRefIdx(REF_PIC_LIST_0);
    852     m_aiNumRefIdx[1] = getNumRefIdx(REF_PIC_LIST_1);
    853   }
    854 #endif
    855 
    856   Int cIdx = 0;
    857 #if H_MV
    858   if ( getInterRefEnabledInRPLFlag() )
    859   { 
    860 #endif
    861   for ( i=0; i<NumPocStCurr0; i++, cIdx++)
    862   {
    863     rpsCurrList0[cIdx] = RefPicSetStCurr0[i];
    864   }
    865   for ( i=0; i<NumPocStCurr1; i++, cIdx++)
    866   {
    867     rpsCurrList0[cIdx] = RefPicSetStCurr1[i];
    868   }
    869   for ( i=0; i<NumPocLtCurr;  i++, cIdx++)
    870   {
    871     rpsCurrList0[cIdx] = RefPicSetLtCurr[i];
    872   }
    873 #if H_MV
    874   }
    875   for ( i=0; i < getNumActiveRefLayerPics( );  i++, cIdx++)
    876     {
    877     assert( cIdx < MAX_NUM_REF );   
    878       rpsCurrList0[cIdx] = refPicSetInterLayer[i];
    879     }
    880 #endif
    881   assert(cIdx == numPocTotalCurr);
    882 
    883   if (m_eSliceType==B_SLICE)
    884   {
    885     cIdx = 0;
    886 #if H_MV
    887     if ( getInterRefEnabledInRPLFlag() )
    888     { 
    889 #endif
    890     for ( i=0; i<NumPocStCurr1; i++, cIdx++)
    891     {
    892       rpsCurrList1[cIdx] = RefPicSetStCurr1[i];
    893     }
    894     for ( i=0; i<NumPocStCurr0; i++, cIdx++)
    895     {
    896       rpsCurrList1[cIdx] = RefPicSetStCurr0[i];
    897     }
    898     for ( i=0; i<NumPocLtCurr;  i++, cIdx++)
    899     {
    900       rpsCurrList1[cIdx] = RefPicSetLtCurr[i];
    901     }
    902 #if H_MV
    903     }
    904     for ( i=0; i < getNumActiveRefLayerPics( );  i++, cIdx++)
    905       {
    906       assert( cIdx < MAX_NUM_REF );   
    907         rpsCurrList1[cIdx] = refPicSetInterLayer[i];
    908       }
    909 #endif
    910     assert(cIdx == numPocTotalCurr);
    911   }
    912 
    913   ::memset(m_bIsUsedAsLongTerm, 0, sizeof(m_bIsUsedAsLongTerm));
    914 
    915 #if H_MV
    916   Int numPocSt = NumPocStCurr0 + NumPocStCurr1;
    917   assert(  getInterRefEnabledInRPLFlag( ) || numPocSt == 0 );
    918 
    919   for (Int li = 0; li < 2; li++)
    920   {
    921     if ( m_eSliceType == P_SLICE && li == 1 )
    922     {
    923       m_aiNumRefIdx[1] = 0;
    924       ::memset( m_apcRefPicList[1], 0, sizeof(m_apcRefPicList[1]));
    925     }
    926     else
    927     {
    928       for (Int rIdx = 0; rIdx <= (m_aiNumRefIdx[ li ] - 1 ); rIdx ++)
    929       {
    930         Bool listModified             =                m_RefPicListModification.getRefPicListModificationFlagL( li );
    931         Int orgIdx                    = listModified ? m_RefPicListModification.getRefPicSetIdxL(li, rIdx) : (rIdx % numPocTotalCurr);
    932 
    933         m_apcRefPicList    [li][rIdx] = ( li == 0 )  ? rpsCurrList0[ orgIdx  ] : rpsCurrList1[ orgIdx  ];
    934         m_bIsUsedAsLongTerm[li][rIdx] = ( orgIdx >= numPocSt ) ;
    935       }
    936     }
    937   }
    938 #else
    939   for (Int rIdx = 0; rIdx < m_aiNumRefIdx[0]; rIdx ++)
    940   {
    941     cIdx = m_RefPicListModification.getRefPicListModificationFlagL0() ? m_RefPicListModification.getRefPicSetIdxL0(rIdx) : rIdx % numPocTotalCurr;
    942     assert(cIdx >= 0 && cIdx < numPocTotalCurr);
    943     m_apcRefPicList[0][rIdx] = rpsCurrList0[ cIdx ];
    944     m_bIsUsedAsLongTerm[0][rIdx] = ( cIdx >= NumPocStCurr0 + NumPocStCurr1 );
    945   }
    946   if ( m_eSliceType != B_SLICE )
    947   {
    948     m_aiNumRefIdx[1] = 0;
    949     ::memset( m_apcRefPicList[1], 0, sizeof(m_apcRefPicList[1]));
    950   }
    951   else
    952   {
    953     for (Int rIdx = 0; rIdx < m_aiNumRefIdx[1]; rIdx ++)
    954     {
    955       cIdx = m_RefPicListModification.getRefPicListModificationFlagL1() ? m_RefPicListModification.getRefPicSetIdxL1(rIdx) : rIdx % numPocTotalCurr;
    956       assert(cIdx >= 0 && cIdx < numPocTotalCurr);
    957       m_apcRefPicList[1][rIdx] = rpsCurrList1[ cIdx ];
    958       m_bIsUsedAsLongTerm[1][rIdx] = ( cIdx >= NumPocStCurr0 + NumPocStCurr1 );
    959     }
    960   }
    961 #endif
    962 }
    963 
    964 #endif
    965 Int TComSlice::getNumRpsCurrTempList()
    966 {
    967   Int numRpsCurrTempList = 0;
    968 
    969   if (m_eSliceType == I_SLICE)
    970   {
    971     return 0;
    972   }
    973   for(UInt i=0; i < m_pcRPS->getNumberOfNegativePictures()+ m_pcRPS->getNumberOfPositivePictures() + m_pcRPS->getNumberOfLongtermPictures(); i++)
    974   {
    975     if(m_pcRPS->getUsed(i))
    976     {
    977       numRpsCurrTempList++;
    978     }
    979   }
    980 #if H_MV
    981 #if !H_MV5
    982   assert( ( numRpsCurrTempList == 0 ) || getInterRefEnabledInRPLFlag() );
    983 #endif
    984727  numRpsCurrTempList = numRpsCurrTempList + getNumActiveRefLayerPics();
    985728#endif
     
    1063806}
    1064807
    1065 Void TComSlice::checkCRA(TComReferencePictureSet *pReferencePictureSet, Int& pocCRA, Bool& prevRAPisBLA, TComList<TComPic *>& rcListPic)
     808Void TComSlice::checkCRA(TComReferencePictureSet *pReferencePictureSet, Int& pocCRA, NalUnitType& associatedIRAPType, TComList<TComPic *>& rcListPic)
    1066809{
    1067810  for(Int i = 0; i < pReferencePictureSet->getNumberOfNegativePictures()+pReferencePictureSet->getNumberOfPositivePictures(); i++)
     
    1089832  {
    1090833    pocCRA = getPOC();
    1091     prevRAPisBLA = false;
     834    associatedIRAPType = getNalUnitType();
    1092835  }
    1093836  else if ( getNalUnitType() == NAL_UNIT_CODED_SLICE_CRA ) // CRA picture found
    1094837  {
    1095838    pocCRA = getPOC();
    1096     prevRAPisBLA = false;
     839    associatedIRAPType = getNalUnitType();
    1097840  }
    1098841  else if ( getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_LP
     
    1101844  {
    1102845    pocCRA = getPOC();
    1103     prevRAPisBLA = true;
     846    associatedIRAPType = getNalUnitType();
    1104847  }
    1105848}
     
    1126869{
    1127870  TComPic*                 rpcPic;
     871  setAssociatedIRAPPOC(pocCRA);
    1128872  Int pocCurr = getPOC();
    1129873
     
    12951039#if H_MV
    12961040  // Additional slice header syntax elements
    1297 #if H_MV5
    12981041  m_pocResetFlag               = pSrc->m_pocResetFlag;
    1299 #endif
    13001042  m_discardableFlag            = pSrc->m_discardableFlag;
    13011043  m_interLayerPredEnabledFlag  = pSrc->m_interLayerPredEnabledFlag;
     
    13061048    m_interLayerPredLayerIdc[ layer ] = pSrc->m_interLayerPredLayerIdc[ layer ];
    13071049  }
    1308 #if !H_MV5
    1309   m_interLayerSamplePredOnlyFlag = pSrc->m_interLayerSamplePredOnlyFlag;
    1310   m_altCollocatedIndicationFlag  = pSrc->m_altCollocatedIndicationFlag ;   
    1311   m_collocatedRefLayerIdx        = pSrc->m_collocatedRefLayerIdx       ;
    1312   m_numActiveMotionPredRefLayers = pSrc->m_numActiveMotionPredRefLayers;
    1313 
    1314   for (Int layer = 0; layer < MAX_NUM_LAYER_IDS; layer++)
    1315   {   
    1316     m_interLayerPredLayerIdc[layer] = pSrc->m_interLayerPredLayerIdc[layer];
    1317   }
    1318 #endif
    13191050#endif
    13201051#if H_3D_IC
     
    13241055}
    13251056
    1326 Int TComSlice::m_prevPOC = 0;
     1057Int TComSlice::m_prevTid0POC = 0;
    13271058
    13281059/** Function for setting the slice's temporal layer ID and corresponding temporal_layer_switching_point_flag.
     
    13791110}
    13801111
     1112
     1113Void TComSlice::checkLeadingPictureRestrictions(TComList<TComPic*>& rcListPic)
     1114{
     1115  TComPic* rpcPic;
     1116
     1117  Int nalUnitType = this->getNalUnitType();
     1118
     1119  // When a picture is a leading picture, it shall be a RADL or RASL picture.
     1120  if(this->getAssociatedIRAPPOC() > this->getPOC())
     1121  {
     1122    // Do not check IRAP pictures since they may get a POC lower than their associated IRAP
     1123    if(nalUnitType < NAL_UNIT_CODED_SLICE_BLA_W_LP ||
     1124       nalUnitType > NAL_UNIT_RESERVED_IRAP_VCL23)
     1125    {
     1126      assert(nalUnitType == NAL_UNIT_CODED_SLICE_RASL_N ||
     1127             nalUnitType == NAL_UNIT_CODED_SLICE_RASL_R ||
     1128             nalUnitType == NAL_UNIT_CODED_SLICE_RADL_N ||
     1129             nalUnitType == NAL_UNIT_CODED_SLICE_RADL_R);
     1130    }
     1131  }
     1132
     1133  // When a picture is a trailing picture, it shall not be a RADL or RASL picture.
     1134  if(this->getAssociatedIRAPPOC() < this->getPOC())
     1135  {
     1136    assert(nalUnitType != NAL_UNIT_CODED_SLICE_RASL_N &&
     1137           nalUnitType != NAL_UNIT_CODED_SLICE_RASL_R &&
     1138           nalUnitType != NAL_UNIT_CODED_SLICE_RADL_N &&
     1139           nalUnitType != NAL_UNIT_CODED_SLICE_RADL_R);
     1140  }
     1141
     1142  // No RASL pictures shall be present in the bitstream that are associated
     1143  // with a BLA picture having nal_unit_type equal to BLA_W_RADL or BLA_N_LP.
     1144  if(nalUnitType == NAL_UNIT_CODED_SLICE_RASL_N ||
     1145     nalUnitType == NAL_UNIT_CODED_SLICE_RASL_R)
     1146  {
     1147    assert(this->getAssociatedIRAPType() != NAL_UNIT_CODED_SLICE_BLA_W_RADL &&
     1148           this->getAssociatedIRAPType() != NAL_UNIT_CODED_SLICE_BLA_N_LP);
     1149  }
     1150
     1151  // No RASL pictures shall be present in the bitstream that are associated with
     1152  // an IDR picture.
     1153  if(nalUnitType == NAL_UNIT_CODED_SLICE_RASL_N ||
     1154     nalUnitType == NAL_UNIT_CODED_SLICE_RASL_R)
     1155  {
     1156    assert(this->getAssociatedIRAPType() != NAL_UNIT_CODED_SLICE_IDR_N_LP   &&
     1157           this->getAssociatedIRAPType() != NAL_UNIT_CODED_SLICE_IDR_W_RADL);
     1158  }
     1159
     1160  // No RADL pictures shall be present in the bitstream that are associated with
     1161  // a BLA picture having nal_unit_type equal to BLA_N_LP or that are associated
     1162  // with an IDR picture having nal_unit_type equal to IDR_N_LP.
     1163  if(nalUnitType == NAL_UNIT_CODED_SLICE_RADL_N ||
     1164     nalUnitType == NAL_UNIT_CODED_SLICE_RADL_R)
     1165  {
     1166    assert(this->getAssociatedIRAPType() != NAL_UNIT_CODED_SLICE_BLA_N_LP   &&
     1167           this->getAssociatedIRAPType() != NAL_UNIT_CODED_SLICE_IDR_N_LP);
     1168  }
     1169
     1170  // loop through all pictures in the reference picture buffer
     1171  TComList<TComPic*>::iterator iterPic = rcListPic.begin();
     1172  while ( iterPic != rcListPic.end())
     1173  {
     1174    rpcPic = *(iterPic++);
     1175    if (rpcPic->getPOC() == this->getPOC())
     1176    {
     1177      continue;
     1178    }
     1179
     1180    // Any picture that has PicOutputFlag equal to 1 that precedes an IRAP picture
     1181    // in decoding order shall precede the IRAP picture in output order.
     1182    // (Note that any picture following in output order would be present in the DPB)
     1183    if(rpcPic->getSlice(0)->getPicOutputFlag() == 1)
     1184    {
     1185      if(nalUnitType == NAL_UNIT_CODED_SLICE_BLA_N_LP    ||
     1186         nalUnitType == NAL_UNIT_CODED_SLICE_BLA_W_LP    ||
     1187         nalUnitType == NAL_UNIT_CODED_SLICE_BLA_W_RADL  ||
     1188         nalUnitType == NAL_UNIT_CODED_SLICE_CRA         ||
     1189         nalUnitType == NAL_UNIT_CODED_SLICE_IDR_N_LP    ||
     1190         nalUnitType == NAL_UNIT_CODED_SLICE_IDR_W_RADL)
     1191      {
     1192        assert(rpcPic->getPOC() < this->getPOC());
     1193      }
     1194    }
     1195
     1196    // Any picture that has PicOutputFlag equal to 1 that precedes an IRAP picture
     1197    // in decoding order shall precede any RADL picture associated with the IRAP
     1198    // picture in output order.
     1199    if(rpcPic->getSlice(0)->getPicOutputFlag() == 1)
     1200    {
     1201      if((nalUnitType == NAL_UNIT_CODED_SLICE_RADL_N ||
     1202          nalUnitType == NAL_UNIT_CODED_SLICE_RADL_R))
     1203      {
     1204        // rpcPic precedes the IRAP in decoding order
     1205        if(this->getAssociatedIRAPPOC() > rpcPic->getSlice(0)->getAssociatedIRAPPOC())
     1206        {
     1207          // rpcPic must not be the IRAP picture
     1208          if(this->getAssociatedIRAPPOC() != rpcPic->getPOC())
     1209          {
     1210            assert(rpcPic->getPOC() < this->getPOC());
     1211          }
     1212        }
     1213      }
     1214    }
     1215
     1216    // When a picture is a leading picture, it shall precede, in decoding order,
     1217    // all trailing pictures that are associated with the same IRAP picture.
     1218    if(nalUnitType == NAL_UNIT_CODED_SLICE_RASL_N ||
     1219       nalUnitType == NAL_UNIT_CODED_SLICE_RASL_R ||
     1220       nalUnitType == NAL_UNIT_CODED_SLICE_RADL_N ||
     1221       nalUnitType == NAL_UNIT_CODED_SLICE_RADL_R)
     1222    {
     1223      if(rpcPic->getSlice(0)->getAssociatedIRAPPOC() == this->getAssociatedIRAPPOC())
     1224      {
     1225        // rpcPic is a picture that preceded the leading in decoding order since it exist in the DPB
     1226        // rpcPic would violate the constraint if it was a trailing picture
     1227        assert(rpcPic->getPOC() <= this->getAssociatedIRAPPOC());
     1228      }
     1229    }
     1230
     1231    // Any RASL picture associated with a CRA or BLA picture shall precede any
     1232    // RADL picture associated with the CRA or BLA picture in output order
     1233    if(nalUnitType == NAL_UNIT_CODED_SLICE_RASL_N ||
     1234       nalUnitType == NAL_UNIT_CODED_SLICE_RASL_R)
     1235    {
     1236      if((this->getAssociatedIRAPType() == NAL_UNIT_CODED_SLICE_BLA_N_LP   ||
     1237          this->getAssociatedIRAPType() == NAL_UNIT_CODED_SLICE_BLA_W_LP   ||
     1238          this->getAssociatedIRAPType() == NAL_UNIT_CODED_SLICE_BLA_W_RADL ||
     1239          this->getAssociatedIRAPType() == NAL_UNIT_CODED_SLICE_CRA)       &&
     1240          this->getAssociatedIRAPPOC() == rpcPic->getSlice(0)->getAssociatedIRAPPOC())
     1241      {
     1242        if(rpcPic->getSlice(0)->getNalUnitType() == NAL_UNIT_CODED_SLICE_RADL_N ||
     1243           rpcPic->getSlice(0)->getNalUnitType() == NAL_UNIT_CODED_SLICE_RADL_R)
     1244        {
     1245          assert(rpcPic->getPOC() > this->getPOC());
     1246        }
     1247      }
     1248    }
     1249
     1250    // Any RASL picture associated with a CRA picture shall follow, in output
     1251    // order, any IRAP picture that precedes the CRA picture in decoding order.
     1252    if(nalUnitType == NAL_UNIT_CODED_SLICE_RASL_N ||
     1253       nalUnitType == NAL_UNIT_CODED_SLICE_RASL_R)
     1254    {
     1255      if(this->getAssociatedIRAPType() == NAL_UNIT_CODED_SLICE_CRA)
     1256      {
     1257        if(rpcPic->getSlice(0)->getPOC() < this->getAssociatedIRAPPOC() &&
     1258           (rpcPic->getSlice(0)->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_N_LP   ||
     1259            rpcPic->getSlice(0)->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_LP   ||
     1260            rpcPic->getSlice(0)->getNalUnitType() == NAL_UNIT_CODED_SLICE_BLA_W_RADL ||
     1261            rpcPic->getSlice(0)->getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_N_LP   ||
     1262            rpcPic->getSlice(0)->getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_W_RADL ||
     1263            rpcPic->getSlice(0)->getNalUnitType() == NAL_UNIT_CODED_SLICE_CRA))
     1264        {
     1265          assert(this->getPOC() > rpcPic->getSlice(0)->getPOC());
     1266        }
     1267      }
     1268    }
     1269  }
     1270}
     1271
     1272
     1273
    13811274/** Function for applying picture marking based on the Reference Picture Set in pReferencePictureSet.
    13821275*/
     
    13851278  TComPic* rpcPic;
    13861279  Int i, isReference;
     1280
     1281  checkLeadingPictureRestrictions(rcListPic);
    13871282
    13881283  // loop through all pictures in the reference picture buffer
     
    14211316      else
    14221317      {
    1423         if(rpcPic->getIsLongTerm() && (rpcPic->getPicSym()->getSlice(0)->getPOC()%(1<<rpcPic->getPicSym()->getSlice(0)->getSPS()->getBitsForPOC())) == pReferencePictureSet->getPOC(i)%(1<<rpcPic->getPicSym()->getSlice(0)->getSPS()->getBitsForPOC()))
     1318        Int pocCycle = 1<<rpcPic->getPicSym()->getSlice(0)->getSPS()->getBitsForPOC();
     1319        Int curPoc = rpcPic->getPicSym()->getSlice(0)->getPOC() & (pocCycle-1);
     1320        Int refPoc = pReferencePictureSet->getPOC(i) & (pocCycle-1);
     1321        if(rpcPic->getIsLongTerm() && curPoc == refPoc)
    14241322        {
    14251323          isReference = 1;
     
    14811379      else
    14821380      {
    1483         if(rpcPic->getIsLongTerm() && (rpcPic->getPicSym()->getSlice(0)->getPOC()%(1<<rpcPic->getPicSym()->getSlice(0)->getSPS()->getBitsForPOC())) == pReferencePictureSet->getPOC(i)%(1<<rpcPic->getPicSym()->getSlice(0)->getSPS()->getBitsForPOC()) && rpcPic->getSlice(0)->isReferenced())
     1381        Int pocCycle = 1<<rpcPic->getPicSym()->getSlice(0)->getSPS()->getBitsForPOC();
     1382        Int curPoc = rpcPic->getPicSym()->getSlice(0)->getPOC() & (pocCycle-1);
     1383        Int refPoc = pReferencePictureSet->getPOC(i) & (pocCycle-1);
     1384        if(rpcPic->getIsLongTerm() && curPoc == refPoc && rpcPic->getSlice(0)->isReferenced())
    14841385        {
    14851386          isAvailable = 1;
     
    15001401        if (!pReferencePictureSet->getCheckLTMSBPresent(i))
    15011402        {
    1502           curPoc = curPoc % pocCycle;
    1503           refPoc = refPoc % pocCycle;
     1403          curPoc = curPoc & (pocCycle - 1);
     1404          refPoc = refPoc & (pocCycle - 1);
    15041405        }
    15051406       
     
    17811682: m_VPSId                     (  0)
    17821683, m_uiMaxTLayers              (  1)
    1783 #if H_MV5
    17841684#if H_MV
    17851685, m_uiMaxLayersMinus1         (  0)
    1786 #else
    1787 , m_uiMaxLayers               (  1)
    1788 #endif
    17891686#else
    17901687, m_uiMaxLayers               (  1)
     
    18001697, m_hrdOpSetIdx               (NULL)
    18011698, m_cprmsPresentFlag          (NULL)
    1802 #if H_MV5
    18031699#if H_MV
    18041700, m_vpsVUI                 (  NULL )
    1805 #endif
    18061701#endif
    18071702{
     
    18481743
    18491744  m_avcBaseLayerFlag = false;
    1850 #if H_MV5
    18511745  m_vpsVuiOffset     = 0;
    1852 #endif
    18531746  m_splittingFlag    = false;
    18541747 
    18551748  for( Int i = 0; i < MAX_NUM_SCALABILITY_TYPES; i++ )
    18561749  {
    1857 #if H_MV5
    18581750    m_scalabilityMaskFlag[i] = false;
    1859 #else
    1860     m_scalabilityMask[i] = false;
    1861 #endif
    18621751    m_dimensionIdLen [i]  = -1;
    18631752  }
     
    18851774    m_layerIdInNuh      [i] = ( i == 0 ) ? 0 : -1;
    18861775    m_numDirectRefLayers[i] = 0;
    1887 #if H_MV5
    18881776    m_maxTidIlRefPicPlus1[i] = 7;
    18891777    m_vpsRepFormatIdx    [i] = 0;
    18901778    m_repFormat          [i] = NULL;
    18911779    m_viewIdVal          [i] = 0;
    1892 #else
    1893     m_maxTidIlRefPicPlus1[i] = -1;
    1894 #endif
    18951780
    18961781#if H_3D
     
    19351820#endif
    19361821  }
    1937 #if H_MV5
    19381822  m_vpsVUI = new TComVPSVUI;
    1939 #endif
    19401823#if H_3D
    19411824  for( Int i = 0; i < MAX_NUM_LAYERS; i++ )
     
    19501833    m_depthRefinementFlag  [ i ] = false;
    19511834#endif
    1952 #if LGE_INTER_SDC_E0156
     1835#if H_3D_INTER_SDC
    19531836    m_bInterSDCFlag        [ i ] = false;
    19541837#endif
     
    19631846  if( m_hrdOpSetIdx      != NULL )     delete[] m_hrdOpSetIdx;
    19641847  if( m_cprmsPresentFlag != NULL )     delete[] m_cprmsPresentFlag;
    1965 #if H_MV5
    19661848#if H_MV
    19671849  if ( m_vpsVUI          != NULL )     delete m_vpsVUI;
     
    19831865#endif
    19841866  }
    1985 #endif
    1986 #else
    1987 #if H_3D_DIM_DLT
    1988   for( Int i = 0; i < MAX_NUM_LAYERS; i++ )
    1989   {
    1990     if ( m_iDepthValue2Idx[i] != 0 )
    1991     {
    1992        xFree( m_iDepthValue2Idx[i] );
    1993        m_iDepthValue2Idx[i] = 0;
    1994     }
    1995 
    1996     if ( m_iIdx2DepthValue[i] != 0 )
    1997     {
    1998       xFree( m_iIdx2DepthValue[i] );
    1999       m_iIdx2DepthValue[i] = 0;
    2000 
    2001     }
    2002   }
    2003 #endif
    20041867#endif
    20051868}
     
    20721935Bool TComVPS::checkVPSExtensionSyntax()
    20731936{
    2074 #if H_MV5
    20751937  for( Int layer = 1; layer <= getMaxLayersMinus1(); layer++ )
    2076 #else
    2077   for( Int layer = 1; layer < getMaxLayers(); layer++ )
    2078 #endif
    20791938  {
    20801939    // check layer_id_in_nuh constraint
     
    20921951{
    20931952  assert( scalType >= 0 && scalType <= MAX_NUM_SCALABILITY_TYPES );
    2094 #if H_MV5
    20951953  assert( scalType == MAX_NUM_SCALABILITY_TYPES || getScalabilityMaskFlag( scalType ) );
    2096 #else
    2097   assert( scalType == MAX_NUM_SCALABILITY_TYPES || getScalabilityMask( scalType ) );
    2098 #endif
    20991954  Int scalIdx = 0;
    21001955  for( Int curScalType = 0; curScalType < scalType; curScalType++ )
    21011956  {
    2102 #if H_MV5
    21031957    scalIdx += ( getScalabilityMaskFlag( curScalType ) ? 1 : 0 );
    2104 #else
    2105     scalIdx += ( getScalabilityMask( curScalType ) ? 1 : 0 );
    2106 #endif
    21071958
    21081959  }
     
    21101961  return scalIdx;
    21111962}
    2112 #if H_MV5
    21131963Void TComVPS::setScalabilityMaskFlag( UInt val )
    21141964{
     
    21181968  }
    21191969}
    2120 #else
    2121 Void TComVPS::setScalabilityMask( UInt val )
    2122 {
    2123   for ( Int scalType = 0; scalType < MAX_NUM_SCALABILITY_TYPES; scalType++ )
    2124     setScalabilityMask( scalType, ( val & (1 << scalType ) ) != 0 );
    2125 }
    2126 
    2127 #endif
    2128 
    2129 #if H_MV5
     1970
    21301971Void TComVPS::setRefLayers()
    21311972{
     
    21762017}
    21772018#endif // H_3D
    2178 #else
    2179 Void TComVPS::setRefLayers()
    2180 {
    2181   for( Int i = 0; i < MAX_NUM_LAYERS; i++ )
    2182   {
    2183     m_numSamplePredRefLayers[ i ] = 0;
    2184     m_numMotionPredRefLayers[ i ] = 0;
    2185     m_numDirectRefLayers[ i ] = 0;
    2186     for( Int j = 0; j < MAX_NUM_LAYERS; j++ ) {
    2187       m_samplePredEnabledFlag[ i ][ j ] = 0;
    2188       m_motionPredEnabledFlag[ i ][ j ] = 0;
    2189       m_refLayerId[ i ][ j ] = 0;
    2190       m_samplePredRefLayerId[ i ][ j ] = 0;
    2191       m_motionPredRefLayerId[ i ][ j ] = 0;
    2192     }
    2193   }
    2194 
    2195   for( Int i = 1; i  <= getMaxLayers()- 1; i++ )
    2196   {
    2197     for( Int j = 0; j < i; j++ )
    2198     {
    2199       if( getDirectDependencyFlag(i,j) )
    2200       {
    2201         m_refLayerId[ i ][m_numDirectRefLayers[ i ]++ ] = getLayerIdInNuh( j );
    2202 
    2203         m_samplePredEnabledFlag [ i ][ j ]  = ( (   getDirectDependencyType( i , j ) + 1 ) & 1 ) == 1;
    2204         m_numSamplePredRefLayers[ i ]      += m_samplePredEnabledFlag [ i ][ j ] ? 1 : 0;
    2205         m_motionPredEnabledFlag [ i ][ j ]  = ( ( ( getDirectDependencyType( i , j ) + 1 ) & 2 ) >> 1 ) == 1;
    2206         m_numMotionPredRefLayers[ i ]      += m_motionPredEnabledFlag  [ i][ j ] ? 1 : 0;
    2207       }
    2208     }
    2209   }
    2210 
    2211   for( Int i = 1, mIdx = 0, sIdx = 0; i <= getMaxLayers()- 1; i++ )
    2212   {   
    2213     for( Int j = 0 ; j < i; j++ )
    2214     {
    2215       if( m_motionPredEnabledFlag[ i ][ j ] )
    2216       {
    2217         m_motionPredRefLayerId[ i ][ mIdx++ ] = getLayerIdInNuh( j );
    2218       }
    2219      
    2220       if( m_samplePredEnabledFlag[ i ][ j ] )
    2221       {
    2222         m_samplePredRefLayerId[ i ][ sIdx++ ] = getLayerIdInNuh( j );
    2223       }
    2224     }
    2225   }
    2226 }
    2227 
    2228 Int TComVPS::getRefLayerId( Int layerIdInVps, Int idx )
    2229 {
    2230   assert( idx >= 0 && idx < m_numDirectRefLayers[layerIdInVps] );     
    2231   Int layerIdInNuh = m_refLayerId[ layerIdInVps ][ idx ];   
    2232   assert ( layerIdInNuh >= 0 );
    2233   return layerIdInNuh;
    2234 }
    2235 
    2236 Int TComVPS::getScalabilityId( Int layerIdInVps, ScalabilityType scalType )
    2237 {
    2238   return getScalabilityMask( scalType ) ? getDimensionId( layerIdInVps, scalTypeToScalIdx( scalType ) ) : 0;
    2239 }
    2240 
    2241 #if H_3D
    2242 Void TComVPS::initViewIndex()
    2243 {
    2244   Int viewIdList   [ MAX_NUM_LAYERS ]; // ed. should be changed to MAX_VIEW_ID
    2245   Int viewIndexList[ MAX_NUM_LAYERS ];
    2246   Int numViewIds = 0;
    2247 
    2248   for ( Int i = 0 ; i  <  m_uiMaxLayers; i++ )
    2249   {     
    2250     Int currViewId = getViewId( i );
    2251 
    2252     Bool viewIdInListFlag = false;
    2253     for ( Int j = 0; j < numViewIds; j ++ )
    2254     {
    2255       viewIdInListFlag  = viewIdInListFlag || ( currViewId  == viewIdList[ j ]  );
    2256     }
    2257 
    2258     if ( !viewIdInListFlag )
    2259     {
    2260       viewIdList   [ numViewIds ] = currViewId;
    2261       viewIndexList[ currViewId ] = numViewIds;
    2262 
    2263       numViewIds++;
    2264     } 
    2265 
    2266     m_viewIndex[ i ] = viewIndexList[ currViewId ];
    2267   }
    2268 }
    2269 
    2270 Int TComVPS::getLayerIdInNuh( Int viewIndex, Bool depthFlag )
    2271 {
    2272   Int foundlayerId = -1;
    2273 
    2274   for (Int layer = 0 ; layer < m_uiMaxLayers; layer++ )
    2275   {
    2276     if( ( getViewIndex( layer ) == viewIndex ) && ( getDepthId( layer ) == ( depthFlag ? 1 : 0 ) )  )
    2277     {
    2278       foundlayerId = layer;
    2279       break;
    2280     }
    2281   }
    2282   assert( foundlayerId != -1 );
    2283 
    2284   return getLayerIdInNuh( foundlayerId );
    2285 }
    2286 
    2287 #endif // H_3D
    2288 
    2289 Int TComVPS::xCeilLog2( Int val )
    2290 {
    2291   assert( val > 0 );
    2292   Int ceilLog2 = 0;
    2293   while( val > ( 1 << ceilLog2 ) ) ceilLog2++;
    2294   return ceilLog2;
    2295 }
    2296 
    2297 #endif // H_MV5
    22982019
    22992020
     
    23362057  return numLayersInIdList;
    23372058}
    2338 #if H_MV5
    23392059Int TComVPS::getNumViews()
    23402060{
     
    23662086  return dependentFlag;
    23672087}
    2368 #endif
    23692088#endif // H_MV
    23702089
     
    24172136, m_vuiParameters             ()
    24182137#if H_MV
    2419 #if H_MV5
    24202138, m_pcVPS                     ( NULL )
    24212139, m_spsInferScalingListFlag   ( false )
     
    24232141, m_updateRepFormatFlag       ( true )
    24242142, m_interViewMvVertConstraintFlag (false)
    2425 #else
    2426 , m_interViewMvVertConstraintFlag (false)
    2427 , m_numIlpRestrictedRefLayers ( 0 )
    2428 #endif
    24292143#endif
    24302144#if H_3D
     
    24412155  ::memset(m_ltRefPicPocLsbSps, 0, sizeof(m_ltRefPicPocLsbSps));
    24422156  ::memset(m_usedByCurrPicLtSPSFlag, 0, sizeof(m_usedByCurrPicLtSPSFlag));
    2443 #if !H_MV5
    2444 #if H_MV
    2445   for (Int i = 0; i < MAX_NUM_LAYERS; i++ )
    2446   {
    2447     m_minSpatialSegmentOffsetPlus1[ i ] = 0;
    2448     m_ctuBasedOffsetEnabledFlag   [ i ] = false;
    2449     m_minHorizontalCtuOffsetPlus1 [ i ] = 0;
    2450   }
    2451 #endif
    2452 #endif
    24532157}
    24542158
     
    26032307, m_listsModificationPresentFlag(  0)
    26042308, m_numExtraSliceHeaderBits(0)
    2605 #if H_MV5
    26062309#if H_MV
    26072310, m_ppsInferScalingListFlag(false)
    26082311, m_ppsScalingListRefLayerId(0)
    26092312#endif
    2610 #endif
    26112313{
    26122314  m_scalingList = new TComScalingList;
     
    26282330}
    26292331
    2630 #if H_MV5
    26312332#if H_MV
    26322333Void TComSPS::inferRepFormat( TComVPS* vps, Int layerIdCurr )
     
    26792380  }
    26802381}
    2681 #endif
    26822382#endif
    26832383#if H_3D
     
    29082608TComScalingList::TComScalingList()
    29092609{
    2910   m_useTransformSkip = false;
    29112610  init();
    29122611}
     
    29502649
    29512650#if H_MV
    2952 #if H_MV5
    29532651Void TComSlice::createInterLayerReferencePictureSet( TComPicLists* ivPicLists, std::vector<TComPic*>& refPicSetInterLayer0, std::vector<TComPic*>& refPicSetInterLayer1 )
    29542652{
     
    29822680  }
    29832681}
    2984 #else
    2985 Void TComSlice::createAndApplyIvReferencePictureSet( TComPicLists* ivPicLists, std::vector<TComPic*>& refPicSetInterLayer )
    2986 {
    2987   refPicSetInterLayer.clear();
    2988 
    2989   for( Int i = 0; i < getNumActiveRefLayerPics(); i++ )
    2990   {
    2991     Int layerIdRef = getRefPicLayerId( i );
    2992     TComPic* picRef = ivPicLists->getPic( layerIdRef, getPOC() ) ;
    2993     assert ( picRef != 0 );
    2994 
    2995     picRef->getPicYuvRec()->extendPicBorder();
    2996     picRef->setIsLongTerm( true );       
    2997     picRef->getSlice(0)->setReferenced( true );       
    2998 
    2999     // Consider to check here:
    3000     // "If the current picture is a RADL picture, there shall be no entry in the RefPicSetInterLayer that is a RASL picture. "
    3001     refPicSetInterLayer.push_back( picRef );
    3002   }
    3003 }
    3004 #endif
    3005 
    3006 #if H_MV5
     2682
    30072683Void TComSlice::markIvRefPicsAsShortTerm( std::vector<TComPic*> refPicSetInterLayer0, std::vector<TComPic*> refPicSetInterLayer1 )
    30082684{
     
    30192695
    30202696}
    3021 #else
    3022 Void TComSlice::markIvRefPicsAsShortTerm( std::vector<TComPic*> refPicSetInterLayer )
    3023 {
    3024   // Mark as shortterm
    3025   for ( Int i = 0; i < refPicSetInterLayer.size(); i++ )
    3026   {
    3027     refPicSetInterLayer[i]->setIsLongTerm( false );
    3028   }
    3029 }
    3030 
    3031 #endif
    30322697Void TComSlice::markIvRefPicsAsUnused( TComPicLists* ivPicLists, std::vector<Int> targetDecLayerIdSet, TComVPS* vps, Int curLayerId, Int curPoc )
    30332698{
     
    30352700  if (targetDecLayerIdSet.size() == 0 )   
    30362701  {
    3037 #if H_MV5
    30382702    for ( Int layerIdInVps = 0; layerIdInVps <= vps->getMaxLayersMinus1(); layerIdInVps++ )
    3039 #else
    3040     for ( Int layerIdInVps = 0; layerIdInVps < vps->getMaxLayers(); layerIdInVps++ )
    3041 #endif
    30422703    {
    30432704      targetDecLayerIdSet.push_back( vps->getLayerIdInNuh( layerIdInVps ) );
     
    30682729          if ( vps->nuhLayerIdIncluded( targetDecLayerIdSet[ j ] ) )
    30692730          {
    3070 #if H_MV5
    30712731            for( Int k = 0; k < vpsSlice->getNumDirectRefLayers( targetDecLayerIdSet[ j ] ); k++ )
    30722732            {
    30732733              if ( targetDecLayerIdSet[ i ] == vpsSlice->getRefLayerId( targetDecLayerIdSet[ j ],  k  ) )
    3074 #else
    3075             Int targetDecLayerIdinVPS = vpsSlice->getLayerIdInVps( targetDecLayerIdSet[ j ] );
    3076             for( Int k = 0; k < vpsSlice->getNumDirectRefLayers( targetDecLayerIdinVPS ); k++ )
    3077             {
    3078               if ( targetDecLayerIdSet[ i ] == vpsSlice->getRefLayerId( targetDecLayerIdinVPS,  k  ) )
    3079 #endif
    30802734              {
    30812735                remainingInterLayerReferencesFlag = true;
     
    30932747}
    30942748
    3095 #if H_MV5
    30962749Void TComSlice::printRefPicList()
    3097 #else
    3098 Void TComSlice::xPrintRefPicList()
    3099 #endif
    31002750
    31012751  for ( Int li = 0; li < 2; li++)
     
    31102760  }
    31112761}
    3112 #if !H_MV5
    3113 Int TComSlice::xCeilLog2( Int val )
    3114 {
    3115   assert( val > 0 );
    3116   Int ceilLog2 = 0;
    3117   while( val > ( 1 << ceilLog2 ) ) ceilLog2++;
    3118   return ceilLog2;
    3119 }
    3120 #endif
    31212762
    31222763Void TComSlice::markCurrPic( TComPic* currPic )
     
    31332774}
    31342775
    3135 #if H_MV5
    31362776Void TComSlice::setRefPicSetInterLayer( std::vector<TComPic*>* refPicSetInterLayer0, std::vector<TComPic*>* refPicSetInterLayer1 )
    31372777{
     
    31582798  return pcPic;
    31592799}
    3160 #else
    3161 Void TComSlice::setRefPicSetInterLayer( std::vector<TComPic*>* refPicSetInterLayer )
    3162 {
    3163   m_refPicSetInterLayer = refPicSetInterLayer;
    3164 }
    3165 
    3166 TComPic* TComSlice::getPicFromRefPicSetInterLayer( Int layerId )
    3167 {
    3168   assert( m_refPicSetInterLayer != 0 );
    3169   assert( (*m_refPicSetInterLayer).size() == getNumActiveRefLayerPics() );
    3170   TComPic* pcPic = NULL;
    3171   for ( Int i = 0; i < getNumActiveRefLayerPics(); i++ )
    3172   {
    3173     if ((*m_refPicSetInterLayer)[ i ]->getLayerId() == layerId)
    3174     {
    3175       pcPic = (*m_refPicSetInterLayer)[ i ];
    3176     }
    3177   }
    3178   assert(pcPic != NULL);
    3179   return pcPic;
    3180 }
    3181 #endif
    31822800Int TComSlice::getNumActiveRefLayerPics()
    31832801{
    31842802  Int numActiveRefLayerPics;
    31852803
    3186 #if H_MV5
    31872804  if( getLayerId() == 0 || getVPS()->getNumDirectRefLayers( getLayerId() ) ==  0 )
    31882805  {
     
    31982815  }
    31992816  else if( getVPS()->getMaxOneActiveRefLayerFlag() || getVPS()->getNumDirectRefLayers( getLayerId() ) == 1 )
    3200 #else
    3201   if( getLayerId() == 0 || getVPS()->getNumDirectRefLayers( getLayerIdInVps() ) ==  0 || !getInterLayerPredEnabledFlag() )
    3202   {
    3203     numActiveRefLayerPics = 0;
    3204   }
    3205   else if( getVPS()->getMaxOneActiveRefLayerFlag() || getVPS()->getNumDirectRefLayers( getLayerIdInVps() ) == 1 )
    3206 #endif
    32072817  {
    32082818    numActiveRefLayerPics = 1;
     
    32172827Int TComSlice::getRefPicLayerId( Int i )
    32182828{
    3219 #if H_MV5
    32202829  return getVPS()->getRefLayerId( getLayerId(), getInterLayerPredLayerIdc( i ) );
    3221 #else
    3222   return getVPS()->getRefLayerId( getLayerIdInVps(), getInterLayerPredLayerIdc( i ) );
    3223 #endif
    3224 }
    3225 
    3226 #if !H_MV5
    3227 Void TComSlice::setActiveMotionPredRefLayers()
    3228 {
    3229   Int j = 0;
    3230   for( Int i = 0; i < getNumActiveRefLayerPics(); i++)
    3231   {
    3232     if( getVPS()->getMotionPredEnabledFlag( getLayerIdInVps(), getInterLayerPredLayerIdc( i ))  )
    3233     {
    3234       m_activeMotionPredRefLayerId[ j++ ] = getVPS()->getRefLayerId( getLayerIdInVps(), i );
    3235     }
    3236   }
    3237   m_numActiveMotionPredRefLayers = j;
    3238 
    3239   // Consider incorporating bitstream conformance tests on derived variables here.
    3240 }
    3241 
    3242 Bool TComSlice::getInterRefEnabledInRPLFlag()
    3243 {
    3244   Bool interRefEnabledInRPLFlag;
    3245   if ( getVPS()->getNumSamplePredRefLayers( getLayerIdInVps() ) > 0 && getNumActiveRefLayerPics() > 0 )
    3246   {
    3247     interRefEnabledInRPLFlag = !getInterLayerSamplePredOnlyFlag();
    3248   }
    3249   else
    3250   {
    3251     interRefEnabledInRPLFlag = 1;
    3252   }
    3253   return interRefEnabledInRPLFlag;
    3254 }
    3255 #endif
     2830}
     2831
    32562832#if H_3D_ARP
    32572833Void TComSlice::setARPStepNum()                                 
     
    35313107}
    35323108
    3533 #if H_MV5
    35343109#if H_MV
    35353110Void TComScalingList::inferFrom( TComScalingList* srcScLi )
     
    35453120  }
    35463121}
    3547 #endif
    35483122#endif
    35493123/** initialization process of quantization matrix array
     
    36363210, m_ppsMap(MAX_NUM_PPS)
    36373211, m_activeVPSId(-1)
    3638 #if H_MV5
    36393212#if !H_MV
    36403213, m_activeSPSId(-1)
     
    36493222  }
    36503223#endif
    3651 #else
    3652 , m_activeSPSId(-1)
    3653 , m_activePPSId(-1)
    3654 {
    3655 #endif
    36563224}
    36573225
     
    36633231//! activate a SPS from a active parameter sets SEI message
    36643232//! \returns true, if activation is successful
    3665 #if H_MV5
    36663233#if H_MV
    36673234Bool ParameterSetManager::activateSPSWithSEI(Int spsId, Int layerId )
     
    36693236Bool ParameterSetManager::activateSPSWithSEI(Int spsId)
    36703237#endif
    3671 #else
    3672 Bool ParameterSetManager::activateSPSWithSEI(Int spsId)
    3673 #endif
    36743238{
    36753239  TComSPS *sps = m_spsMap.getPS(spsId);
     
    36803244    {
    36813245      m_activeVPSId = vpsId;
    3682 #if !H_MV5
    3683       m_activeSPSId = spsId;
    3684 #else
    36853246#if H_MV
    36863247      m_activeSPSId[ layerId ] = spsId;
     
    36883249      m_activeSPSId = spsId;
    36893250#endif
    3690 #endif
    36913251      return true;
    36923252    }
     
    37053265//! activate a PPS and depending on isIDR parameter also SPS and VPS
    37063266//! \returns true, if activation is successful
    3707 #if H_MV5
    37083267#if H_MV
    37093268Bool ParameterSetManager::activatePPS(Int ppsId, Bool isIRAP, Int layerId )
     
    37423301        m_activeSPSId[ layerId ] = spsId;
    37433302#else
    3744         m_activePPSId = ppsId;
    3745         m_activeVPSId = vpsId;
    3746         m_activeSPSId = spsId;
    3747 #endif
    3748 #else
    3749 Bool ParameterSetManager::activatePPS(Int ppsId, Bool isIRAP)
    3750 {
    3751   TComPPS *pps = m_ppsMap.getPS(ppsId);
    3752   if (pps)
    3753   {
    3754     Int spsId = pps->getSPSId();
    3755 #if H_MV
    3756     // active parameter sets per layer should be used here
    3757 #else
    3758     if (!isIRAP && (spsId != m_activeSPSId))
    3759     {
    3760       printf("Warning: tried to activate PPS referring to a inactive SPS at non-IRAP.");
    3761       return false;
    3762     }
    3763 #endif
    3764     TComSPS *sps = m_spsMap.getPS(spsId);
    3765     if (sps)
    3766     {
    3767       Int vpsId = sps->getVPSId();
    3768       if (!isIRAP && (vpsId != m_activeVPSId))
    3769       {
    3770         printf("Warning: tried to activate PPS referring to a inactive VPS at non-IRAP.");
    3771         return false;
    3772       }
    3773       if (m_vpsMap.getPS(vpsId))
    3774       {
    37753303        m_activePPSId = ppsId;
    37763304        m_activeVPSId = vpsId;
     
    38283356//! \}
    38293357
    3830 #if H_MV5
    38313358#if H_MV
    38323359TComVPSVUI::TComVPSVUI()
     
    38613388}
    38623389#endif
    3863 #endif
  • trunk/source/Lib/TLibCommon/TComSlice.h

    r622 r655  
    155155  Void     setScalingListPresentFlag    (Bool b)                               { m_scalingListPresentFlag = b;    }
    156156  Bool     getScalingListPresentFlag    ()                                     { return m_scalingListPresentFlag; }
    157   Bool     getUseTransformSkip    ()                                     { return m_useTransformSkip; }     
    158   Void     setUseTransformSkip    (Bool b)                               { m_useTransformSkip = b;    }
    159157  Int*     getScalingListAddress          (UInt sizeId, UInt listId)           { return m_scalingListCoef[sizeId][listId]; } //!< get matrix coefficient
    160158  Bool     checkPredMode                  (UInt sizeId, UInt listId);
     
    169167  Void     processRefMatrix               (UInt sizeId, UInt listId , UInt refListId );
    170168  Bool     xParseScalingList              (Char* pchFile);
    171 #if H_MV5
    172169#if H_MV
    173170  Void     inferFrom                      ( TComScalingList* srcScLi );
    174 #endif
    175171#endif
    176172
     
    184180  UInt     m_predMatrixId                [SCALING_LIST_SIZE_NUM][SCALING_LIST_NUM]; //!< reference list index
    185181  Int      *m_scalingListCoef            [SCALING_LIST_SIZE_NUM][SCALING_LIST_NUM]; //!< quantization matrix
    186   Bool     m_useTransformSkip;                                                      //!< transform skipping flag for setting default scaling matrix for 4x4
    187182};
    188183
     
    407402};
    408403
    409 #if H_MV5
    410404#if H_MV
    411405class TComVPSVUI
     
    502496};
    503497#endif
    504 #endif
    505498
    506499class TComVPS
     
    510503  UInt        m_uiMaxTLayers;
    511504
    512 #if H_MV5
    513505#if H_MV
    514506  UInt        m_uiMaxLayersMinus1;
    515 #else
    516   UInt        m_uiMaxLayers;
    517 #endif
    518507#else
    519508  UInt        m_uiMaxLayers;
     
    551540  /// VPS EXTENSION SYNTAX ELEMENTS
    552541  Bool        m_avcBaseLayerFlag;
    553 #if H_MV5
    554542  Int         m_vpsVuiOffset;
    555 #endif
    556543  Bool        m_splittingFlag;
    557 #if H_MV5
    558544  Bool        m_scalabilityMaskFlag          [MAX_NUM_SCALABILITY_TYPES];
    559 #else
    560   Bool        m_scalabilityMask          [MAX_NUM_SCALABILITY_TYPES];
    561 #endif
    562545  Int         m_dimensionIdLen           [MAX_NUM_SCALABILITY_TYPES];
    563546  Bool        m_vpsNuhLayerIdPresentFlag;
    564547  Int         m_layerIdInNuh             [MAX_NUM_LAYER_IDS];
    565548  Int         m_dimensionId              [MAX_NUM_LAYER_IDS][MAX_NUM_SCALABILITY_TYPES]; 
    566 #if H_MV5
    567549  Int         m_viewIdLenMinus1;
    568550  Int         m_viewIdVal                [MAX_NUM_LAYERS];
    569 #endif
    570551  Bool        m_directDependencyFlag     [MAX_NUM_LAYER_IDS][MAX_NUM_LAYER_IDS];
    571 #if H_MV5
    572552  Bool        m_maxTidRefPresentFlag;
    573 #endif
    574553  Int         m_maxTidIlRefPicPlus1      [MAX_NUM_LAYERS];
    575 #if H_MV5
    576554  Bool        m_allRefLayersActiveFlag;
    577 #endif
    578555  Int         m_vpsNumberLayerSetsMinus1;
    579556  Int         m_vpsNumProfileTierLevelMinus1;   
     
    586563  Bool        m_outputLayerFlag          [MAX_VPS_OUTPUTLAYER_SETS][MAX_VPS_NUH_LAYER_ID_PLUS1];
    587564  Int         m_profileLevelTierIdx      [MAX_VPS_OUTPUTLAYER_SETS ];
    588 #if H_MV5
    589565  Bool        m_repFormatIdxPresentFlag;
    590566  Int         m_vpsNumRepFormatsMinus1;
    591567  Int         m_vpsRepFormatIdx          [MAX_NUM_LAYERS];
    592568  TComRepFormat* m_repFormat             [MAX_NUM_LAYERS];
    593 #endif
    594569  Bool        m_maxOneActiveRefLayerFlag;       
    595 #if H_MV5
    596570  Bool        m_crossLayerIrapAlignedFlag;
    597 #endif
    598571  Int         m_directDepTypeLenMinus2;         
    599 #if H_MV5
    600572  Bool        m_vpsVuiPresentFlag;
    601573  TComVPSVUI* m_vpsVUI;
    602 #endif
    603574  Int         m_directDependencyType     [MAX_NUM_LAYERS] [MAX_NUM_LAYERS];
    604575
     
    616587  Bool        m_motionPredEnabledFlag    [MAX_NUM_LAYERS][MAX_NUM_LAYERS];
    617588  Int         m_motionPredRefLayerId     [MAX_NUM_LAYERS][MAX_NUM_LAYERS];
    618 #if H_MV5
    619589  Int         m_viewIndex                [MAX_NUM_LAYERS   ];
    620 #else
    621 #if H_3D
    622   Int         m_viewIndex                [MAX_NUM_LAYERS   ];
    623 #endif
    624 
    625   Int         xCeilLog2       ( Int val );
    626 #endif
    627590  Int         xGetDimBitOffset( Int j );
    628591 
     
    653616  Bool        m_ivMvScalingFlag;
    654617#endif
    655 #if LGE_INTER_SDC_E0156
     618#if H_3D_INTER_SDC
    656619  Bool        m_bInterSDCFlag[MAX_NUM_LAYERS   ];
    657620#endif
     
    681644  Void    setMaxTLayers  (UInt t)             { m_uiMaxTLayers = t; }
    682645 
    683 #if H_MV5
    684646#if H_MV   
    685647  UInt    getMaxLayersMinus1()                { return m_uiMaxLayersMinus1;  };
     
    689651  Void    setMaxLayers   (UInt l)             { m_uiMaxLayers = l; }
    690652#endif
    691 #else
    692   UInt    getMaxLayers   ()                   { return m_uiMaxLayers;   }
    693   Void    setMaxLayers   (UInt l)             { m_uiMaxLayers = l; }
    694 #endif
    695653
    696654  Bool    getTemporalNestingFlag   ()         { return m_bTemporalIdNestingFlag;   }
     
    735693  Bool    getAvcBaseLayerFlag()                                            { return m_avcBaseLayerFlag; }
    736694
    737 #if H_MV5
    738695  Void    setVpsVuiOffset( Int  val )                                      { m_vpsVuiOffset = val; }
    739696  Int     getVpsVuiOffset(  )                                              { return m_vpsVuiOffset; }
    740 #endif
    741697
    742698  Void    setSplittingFlag( Bool val )                                     { m_splittingFlag = val;  }
    743699  Bool    getSplittingFlag()                                               { return m_splittingFlag; }
    744700
    745 #if H_MV5
    746701  Void    setScalabilityMaskFlag( UInt val );
    747702  Void    setScalabilityMaskFlag( Int scalType, Bool val )                     { m_scalabilityMaskFlag[scalType] = val;  }
    748703  Bool    getScalabilityMaskFlag( Int scalType )                               { return m_scalabilityMaskFlag[scalType]; }
    749 #else
    750   Void    setScalabilityMask( UInt val );
    751 
    752   Void    setScalabilityMask( Int scalType, Bool val )              { m_scalabilityMask[scalType] = val;  }
    753   Bool    getScalabilityMask( Int scalType )                        { return m_scalabilityMask[scalType]; }
    754 #endif
    755704  Int     getNumScalabilityTypes( );
    756705
     
    769718  Int     getDimensionId( Int layerIdInVps, Int scalIdx )                  { return m_dimensionId[layerIdInVps][scalIdx]; }
    770719
    771 #if H_MV5
    772720  Void    setViewIdLenMinus1( Int  val )                                   { m_viewIdLenMinus1 = val; }
    773721  Int     getViewIdLenMinus1(  )                                           { return m_viewIdLenMinus1; }
     
    775723  Void    setViewIdVal( Int viewOrderIndex, Int  val )                     { m_viewIdVal[viewOrderIndex] = val; }
    776724  Int     getViewIdVal( Int viewOrderIndex )                               { return m_viewIdVal[viewOrderIndex]; }
    777 #endif
    778725  Void    setDirectDependencyFlag( Int depLayeridInVps, Int refLayeridInVps, Bool val ) { m_directDependencyFlag[depLayeridInVps][refLayeridInVps] = val;  }
    779726  Bool    getDirectDependencyFlag( Int depLayeridInVps, Int refLayeridInVps )           { return m_directDependencyFlag[depLayeridInVps][refLayeridInVps]; }
    780727
    781 #if H_MV5
    782728  Void    setMaxTidRefPresentFlag( Bool flag )                             { m_maxTidRefPresentFlag = flag; }
    783729  Bool    getMaxTidRefPresentFlag(  )                                      { return m_maxTidRefPresentFlag; }
    784 #endif
    785730  Void    setMaxTidIlRefPicPlus1( Int layerIdInVps, Int val )              { m_maxTidIlRefPicPlus1[ layerIdInVps ] = val;  }
    786731  Int     getMaxTidIlRefPicPlus1( Int layerIdInVps )                       { return m_maxTidIlRefPicPlus1[ layerIdInVps ]; }
    787 #if H_MV5
    788732  Void    setAllRefLayersActiveFlag( Bool flag )                           { m_allRefLayersActiveFlag = flag; }
    789733  Bool    getAllRefLayersActiveFlag(  )                                    { return m_allRefLayersActiveFlag; }
    790 #endif
    791734  Void    setVpsNumberLayerSetsMinus1( Int val )                           { m_vpsNumberLayerSetsMinus1 = val;  }
    792735  Int     getVpsNumberLayerSetsMinus1( )                                   { return m_vpsNumberLayerSetsMinus1; }
     
    819762  Int     getProfileLevelTierIdx( Int outLayerSetIdx )                     { return m_profileLevelTierIdx[ outLayerSetIdx ]; }
    820763
    821 #if H_MV5
    822764  Void    setRepFormatIdxPresentFlag( Bool flag )                          { m_repFormatIdxPresentFlag = flag; }
    823765  Bool    getRepFormatIdxPresentFlag(  )                                   { return m_repFormatIdxPresentFlag; }
     
    831773  Void    setRepFormat( Int i, TComRepFormat* val )                        { m_repFormat[i] = val;  }
    832774  TComRepFormat* getRepFormat( Int i )                                     { return m_repFormat[i]; }
    833 #endif
    834775  Void    setMaxOneActiveRefLayerFlag( Bool flag)                          { m_maxOneActiveRefLayerFlag = flag; }
    835776  Bool    getMaxOneActiveRefLayerFlag( )                                   { return m_maxOneActiveRefLayerFlag; }
    836 #if H_MV5
    837777  Void    setCrossLayerIrapAlignedFlag( Bool flag )                        { m_crossLayerIrapAlignedFlag = flag; }
    838778  Bool    getCrossLayerIrapAlignedFlag(  )                                 { return m_crossLayerIrapAlignedFlag; }
    839 #endif
    840779  Void    setDirectDepTypeLenMinus2( Int val)                              { m_directDepTypeLenMinus2 = val; }
    841780  Int     getDirectDepTypeLenMinus2( )                                     { return m_directDepTypeLenMinus2; }
     
    843782  Void    setDirectDependencyType( Int depLayeridInVps, Int refLayeridInVps, Int val) { m_directDependencyType[ depLayeridInVps ][ refLayeridInVps ] = val; }
    844783  Int     getDirectDependencyType( Int depLayeridInVps, Int refLayeridInVps)   { return m_directDependencyType[ depLayeridInVps ][ refLayeridInVps ]; }
    845 #if H_MV5 
    846784  Void    setVpsVuiPresentFlag( Bool flag )                                { m_vpsVuiPresentFlag = flag; }
    847785  Bool    getVpsVuiPresentFlag(  )                                         { return m_vpsVuiPresentFlag; }
    848786
    849787  TComVPSVUI* getVPSVUI(  )                                                { return m_vpsVUI;  }
    850 #endif
    851788  // VPS EXTENSION SEMANTICS VARIABLES
    852789  Void    setLayerIdInVps( Int layerIdInNuh, Int val )                     { m_layerIdInVps[layerIdInNuh] = val;  }
     
    854791
    855792  Int     getScalabilityId ( Int layerIdInVps, ScalabilityType scalType );
    856 #if H_MV5
    857793  Int     getViewId        ( Int layerIdInNuh )                            { return m_viewIdVal[ getViewIndex( getLayerIdInVps( layerIdInNuh) )]; }
    858 #else
    859   Int     getViewId  ( Int layerIdInVps )                                  { return getScalabilityId( layerIdInVps, VIEW_ID  ); }
    860 
    861 #endif
    862794  Void    setRefLayers();
    863795
    864 #if H_MV5
    865796  Int     getViewIndex    ( Int layerIdInNuh )                             { return getScalabilityId( getLayerIdInVps(layerIdInNuh), VIEW_ORDER_INDEX  ); }   
    866797  Int     getNumViews();
     
    868799  Int     getNumDirectRefLayers( Int layerIdInNuh )                        { return m_numDirectRefLayers[ layerIdInNuh ];  };                               
    869800  Int     getRefLayerId        ( Int layerIdInNuh, Int idx );;
    870 #else
    871   Int     getNumDirectRefLayers( Int layerIdInVps )          { return m_numDirectRefLayers[ layerIdInVps ];  };                               
    872   Int     getRefLayerId        ( Int layerIdInVps, Int idx );;
    873  
    874   Int     getNumSamplePredRefLayers( Int layerIdInVps )          { return m_numSamplePredRefLayers[layerIdInVps]; }
    875   Bool    getSamplePredEnabledFlag ( Int layerIdInVps, Int idx ) { return m_samplePredEnabledFlag [layerIdInVps][idx]; }
    876   Int     getSamplePredRefLayerId  ( Int layerIdInVps, Int idx ) { return m_samplePredRefLayerId  [layerIdInVps][idx]; }
    877 
    878   Int     getNumMotionPredRefLayers( Int layerIdInVps )          { return m_numMotionPredRefLayers[layerIdInVps]; }
    879   Bool    getMotionPredEnabledFlag ( Int layerIdInVps, Int idx ) { return m_motionPredEnabledFlag [layerIdInVps][idx]; }
    880   Int     getMotionPredRefLayerId  ( Int layerIdInVps, Int idx ) { return m_motionPredRefLayerId  [layerIdInVps][idx]; }
    881 #endif 
    882801  Bool    checkVPSExtensionSyntax();
    883802  Int     scalTypeToScalIdx   ( ScalabilityType scalType );
    884803
    885   #if H_MV5
    886804Int     getProfileLevelTierIdxLen()                                      { return gCeilLog2( getVpsNumProfileTierLevelMinus1() + 1 ); };       
    887 #else
    888   Int     getProfileLevelTierIdxLen() { return xCeilLog2( getVpsNumProfileTierLevelMinus1() + 1 ); };       
    889 #endif
    890805
    891806  Int     getNumLayersInIdList              ( Int lsIdx );;
     
    895810  Int     inferLastDimsionIdLenMinus1();
    896811
    897 #if H_MV5
    898812  // helpers
    899813  Bool    getInDirectDependencyFlag( Int depLayeridInVps, Int refLayeridInVps, Int depth = 0 );
    900 #endif
    901814  /// VPS EXTENSION 2 SYNTAX ELEMENTS
    902815#if H_3D 
    903 #if H_MV5
    904816  Int     getDepthId      ( Int layerIdInNuh)                             { return getScalabilityId( getLayerIdInVps(layerIdInNuh), DEPTH_ID ); }
    905 #else
    906   Void    initViewIndex();
    907   Int     getViewIndex    ( Int layerIdInVps )                             { return m_viewIndex[ layerIdInVps ]; }   
    908   Int     getDepthId      ( Int layerIdInVps )                             { return getScalabilityId( layerIdInVps, DEPTH_ID ); }
    909 #endif
    910817  Int     getLayerIdInNuh( Int viewIndex, Bool depthFlag );   
    911818
     
    943850  Bool    getIvMvScalingFlag   (  )                       { return m_ivMvScalingFlag; }
    944851  Void    setIvMvScalingFlag   ( Bool b )                 { m_ivMvScalingFlag = b;    } 
    945 #if LGE_INTER_SDC_E0156
     852#if H_3D_INTER_SDC
    946853  Bool    getInterSDCFlag      ( Int layerIdInVps )           { return m_bInterSDCFlag[layerIdInVps]; }
    947854  Void    setInterSDCFlag      ( Int layerIdInVps, Bool bval ){ m_bInterSDCFlag[layerIdInVps] = bval; }
     
    960867  Int           m_winTopOffset;
    961868  Int           m_winBottomOffset;
    962 #if H_MV5
    963869#if H_MV
    964870  Bool          m_scaledFlag;
    965 #endif
    966871#endif
    967872public:
     
    972877  , m_winTopOffset      (0)
    973878  , m_winBottomOffset   (0)
    974 #if H_MV5
    975879#if H_MV
    976880  , m_scaledFlag(true)
    977 #endif
    978881#endif
    979882  { }
     
    990893  Void          setWindowBottomOffset(Int val)    { m_winBottomOffset = val; m_enabledFlag = true; }
    991894
    992 #if H_MV5
    993895#if H_MV
    994896  Void          setScaledFlag(Bool flag)          { m_scaledFlag = flag;  }
     
    1005907    }
    1006908  }
    1007 #endif
    1008909#endif
    1009910  Void          setWindow(Int offsetLeft, Int offsetLRight, Int offsetLTop, Int offsetLBottom)
     
    1054955  TComHRD m_hrdParameters;
    1055956  TimingInfo m_timingInfo;
    1056 #if !H_MV5
    1057 #if H_MV
    1058   Bool m_tileBoundariesAlignedFlag;
    1059 #endif
    1060 #endif
    1061957
    1062958public:
     
    1091987    ,m_log2MaxMvLengthHorizontal(15)
    1092988    ,m_log2MaxMvLengthVertical(15)
    1093 #if !H_MV5
    1094 #if H_MV
    1095     ,m_tileBoundariesAlignedFlag(true)
    1096 #endif
    1097 #endif
    1098989  {}
    1099990
     
    11911082  TComHRD* getHrdParameters                 ()             { return &m_hrdParameters; }
    11921083  TimingInfo* getTimingInfo() { return &m_timingInfo; }
    1193 #if !H_MV5
    1194 #if H_MV
    1195 Bool getTileBoundariesAlignedFlag(  ) { return m_tileBoundariesAlignedFlag; }
    1196   Void setTileBoundariesAlignedFlag( Bool flag ) { m_tileBoundariesAlignedFlag = flag; }
    1197 #endif
    1198 #endif
    11991084
    12001085};
     
    12811166  TComPTL     m_pcPTL;
    12821167#if H_MV
    1283 #if H_MV5
    12841168  TComVPS*    m_pcVPS;
    12851169  // SPS
     
    12871171  Int         m_spsScalingListRefLayerId;
    12881172  Bool        m_updateRepFormatFlag;
    1289 #endif
    12901173  // SPS Extension
    12911174  Bool        m_interViewMvVertConstraintFlag;
    1292 #if !H_MV5
    1293   Int         m_numIlpRestrictedRefLayers        ;
    1294   Int         m_minSpatialSegmentOffsetPlus1[MAX_NUM_LAYERS];
    1295   Bool        m_ctuBasedOffsetEnabledFlag   [MAX_NUM_LAYERS];
    1296   Int         m_minHorizontalCtuOffsetPlus1 [MAX_NUM_LAYERS];
    1297 #endif
    12981175#endif
    12991176#if H_3D
     
    14321309  TComPTL* getPTL()     { return &m_pcPTL; }
    14331310#if H_MV
    1434 #if H_MV5
    14351311  Void      setVPS          ( TComVPS* pcVPS ) { m_pcVPS = pcVPS; }
    14361312  TComVPS*  getVPS          () { return m_pcVPS; }
     
    14441320  Void setUpdateRepFormatFlag( Bool flag )     { m_updateRepFormatFlag = flag; }
    14451321  Bool getUpdateRepFormatFlag(  )              { return m_updateRepFormatFlag; }
    1446 #endif
    14471322  // SPS Extension
    14481323  Void setInterViewMvVertConstraintFlag(Bool val) { m_interViewMvVertConstraintFlag = val; }
    14491324  Bool getInterViewMvVertConstraintFlag()         { return m_interViewMvVertConstraintFlag;}
    1450 #if H_MV5
    14511325  // Inference
    14521326  Void inferRepFormat( TComVPS* vps, Int layerIdCurr );
    14531327
    14541328  Void inferScalingList( TComSPS* spsSrc );
    1455 #else
    1456   Void setNumIlpRestrictedRefLayers   ( Int val )        { m_numIlpRestrictedRefLayers         = val;}
    1457   Int  getNumIlpRestrictedRefLayers   ( )                { return m_numIlpRestrictedRefLayers        ;}
    1458  
    1459   Void setMinSpatialSegmentOffsetPlus1( Int i, Int val ) { m_minSpatialSegmentOffsetPlus1[ i ] = val;}
    1460   Int  getMinSpatialSegmentOffsetPlus1( Int i )          { return m_minSpatialSegmentOffsetPlus1[ i ];}
    1461  
    1462   Void setCtuBasedOffsetEnabledFlag   ( Int i, Bool flag ) { m_ctuBasedOffsetEnabledFlag   [ i ] = flag;}
    1463   Bool getCtuBasedOffsetEnabledFlag   ( Int i )            { return m_ctuBasedOffsetEnabledFlag   [ i ];}
    1464 
    1465   Void setMinHorizontalCtuOffsetPlus1 ( Int i, Int val )   { m_minHorizontalCtuOffsetPlus1 [ i ] = val;}
    1466   Int  getMinHorizontalCtuOffsetPlus1 ( Int i )            { return m_minHorizontalCtuOffsetPlus1 [ i ];}
    1467 
    1468 #endif
    14691329#endif
    14701330#if H_3D_QTLPC
     
    15821442  Int m_numExtraSliceHeaderBits;
    15831443
    1584 #if H_MV5
    15851444#if H_MV
    15861445  Int  m_layerId;
    15871446  Bool m_ppsInferScalingListFlag;
    15881447  Int  m_ppsScalingListRefLayerId;
    1589 #endif
    15901448#endif
    15911449public:
     
    17101568  Bool getSliceHeaderExtensionPresentFlag   ()                    { return m_sliceHeaderExtensionPresentFlag; }
    17111569  Void setSliceHeaderExtensionPresentFlag   (Bool val)            { m_sliceHeaderExtensionPresentFlag = val; }
    1712 #if H_MV5
    17131570#if H_MV
    17141571  Void setLayerId( Int  val ) { m_layerId = val; }
     
    17201577  Void setPpsScalingListRefLayerId( Int  val ) { m_ppsScalingListRefLayerId = val; }
    17211578  Int  getPpsScalingListRefLayerId(  ) { return m_ppsScalingListRefLayerId; }
    1722 #endif
    17231579#endif
    17241580};
     
    17541610  Bool        m_PicOutputFlag;        ///< pic_output_flag
    17551611  Int         m_iPOC;
    1756 #if H_MV5
    17571612#if H_MV
    17581613  Int         m_iPOCBeforeReset;
    17591614#endif
    1760 #endif
    17611615  Int         m_iLastIDR;
    1762   static Int  m_prevPOC;
     1616  Int         m_iAssociatedIRAP;
     1617  NalUnitType m_iAssociatedIRAPType;
     1618  static Int  m_prevTid0POC;
    17631619  TComReferencePictureSet *m_pcRPS;
    17641620  TComReferencePictureSet m_LocalRPS;
     
    18531709  Bool       m_enableTMVPFlag;
    18541710#if H_MV
    1855 #if H_MV5
    18561711  std::vector<TComPic*>* m_refPicSetInterLayer0;
    18571712  std::vector<TComPic*>* m_refPicSetInterLayer1;
     
    18621717  Bool       m_isDepth;
    18631718#endif
    1864 #else
    1865   std::vector<TComPic*>* m_refPicSetInterLayer;
    1866   Int        m_layerId;
    1867   Int        m_viewId;
    1868 #if H_3D
    1869   Int        m_viewIndex;
    1870   Bool       m_isDepth;
    1871 #endif
    1872 #endif
    18731719
    18741720// Additional slice header syntax elements
    1875 #if H_MV5
    18761721  Bool       m_pocResetFlag;
    1877 #endif
    18781722  Bool       m_discardableFlag;
    18791723  Bool       m_interLayerPredEnabledFlag;
    18801724  Int        m_numInterLayerRefPicsMinus1;
    18811725  Int        m_interLayerPredLayerIdc       [MAX_NUM_LAYERS];
    1882 #if !H_MV5
    1883   Bool       m_interLayerSamplePredOnlyFlag;
    1884   Bool       m_altCollocatedIndicationFlag;
    1885   Int        m_collocatedRefLayerIdx;
    1886 // Additional slice header semantics variables
    1887   Int        m_numActiveMotionPredRefLayers;
    1888   Int        m_activeMotionPredRefLayerId   [ MAX_NUM_LAYER_IDS ];
    1889 
    1890 #endif
    18911726  Int        m_aaiCodedScale [2][MAX_NUM_LAYERS];
    18921727  Int        m_aaiCodedOffset[2][MAX_NUM_LAYERS];
     
    19401775  Void      setRPSidx          ( Int iBDidx ) { m_iBDidx = iBDidx; }
    19411776  Int       getRPSidx          () { return m_iBDidx; }
    1942   Int       getPrevPOC      ()                          { return  m_prevPOC;       }
     1777  Int       getPrevTid0POC      ()                        { return  m_prevTid0POC;       }
    19431778  TComRefPicListModification* getRefPicListModification() { return &m_RefPicListModification; }
    19441779  Void      setLastIDR(Int iIDRPOC)                       { m_iLastIDR = iIDRPOC; }
    19451780  Int       getLastIDR()                                  { return m_iLastIDR; }
     1781  Void      setAssociatedIRAPPOC(Int iAssociatedIRAPPOC)             { m_iAssociatedIRAP = iAssociatedIRAPPOC; }
     1782  Int       getAssociatedIRAPPOC()                        { return m_iAssociatedIRAP; }
     1783  Void      setAssociatedIRAPType(NalUnitType associatedIRAPType)    { m_iAssociatedIRAPType = associatedIRAPType; }
     1784  NalUnitType getAssociatedIRAPType()                        { return m_iAssociatedIRAPType; }
    19461785  SliceType getSliceType    ()                          { return  m_eSliceType;         }
    19471786  Int       getPOC          ()                          { return  m_iPOC;           }
     
    19881827  Void      checkColRefIdx      (UInt curSliceIdx, TComPic* pic);
    19891828  Bool      getIsUsedAsLongTerm (Int i, Int j)                  { return m_bIsUsedAsLongTerm[i][j]; }
     1829  Void      setIsUsedAsLongTerm (Int i, Int j, Bool value)      { m_bIsUsedAsLongTerm[i][j] = value; }
    19901830  Bool      getCheckLDC     ()                                  { return m_bCheckLDC; }
    19911831  Bool      getMvdL1ZeroFlag ()                                  { return m_bLMvdL1Zero;    }
     
    19941834  Void      setReferenced(Bool b)                               { m_bRefenced = b; }
    19951835  Bool      isReferenced()                                      { return m_bRefenced; }
    1996   Void      setPOC              ( Int i )                       { m_iPOC              = i; if(getTLayer()==0) m_prevPOC=i; }
     1836  Bool      isReferenceNalu()                                   { return ((getNalUnitType() <= NAL_UNIT_RESERVED_VCL_R15) && (getNalUnitType()%2 != 0)) || ((getNalUnitType() >= NAL_UNIT_CODED_SLICE_BLA_W_LP) && (getNalUnitType() <= NAL_UNIT_RESERVED_IRAP_VCL23) ); }
     1837  Void      setPOC              ( Int i )                       { m_iPOC              = i; if ((getTLayer()==0) && (isReferenceNalu() && (getNalUnitType()!=NAL_UNIT_CODED_SLICE_RASL_R)&& (getNalUnitType()!=NAL_UNIT_CODED_SLICE_RADL_R))) {m_prevTid0POC=i;} }
    19971838  Void      setNalUnitType      ( NalUnitType e )               { m_eNalUnitType      = e;      }
    19981839  NalUnitType getNalUnitType    () const                        { return m_eNalUnitType;        }
     
    20001841  Bool      getIdrPicFlag       ()                              { return getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_W_RADL || getNalUnitType() == NAL_UNIT_CODED_SLICE_IDR_N_LP; }
    20011842  Bool      isIRAP              () const                        { return (getNalUnitType() >= 16) && (getNalUnitType() <= 23); } 
    2002   Void      checkCRA(TComReferencePictureSet *pReferencePictureSet, Int& pocCRA, Bool& prevRAPisBLA, TComList<TComPic *>& rcListPic);
     1843  Void      checkCRA(TComReferencePictureSet *pReferencePictureSet, Int& pocCRA, NalUnitType& associatedIRAPType, TComList<TComPic *>& rcListPic);
    20031844  Void      decodingRefreshMarking(Int& pocCRA, Bool& bRefreshPending, TComList<TComPic*>& rcListPic);
    20041845  Void      setSliceType        ( SliceType e )                 { m_eSliceType        = e;      }
     
    20221863 
    20231864#if H_MV
    2024 #if H_MV5
    20251865  Void      setPocBeforeReset   ( Int i )                       { m_iPOCBeforeReset = i; }
    20261866  Int       getPocBeforeReset   ( )                             { return m_iPOCBeforeReset; }
    2027 #endif
    20281867  Int       getRefLayerId        ( RefPicList e, Int iRefIdx)    { return  m_aiRefLayerIdList[e][iRefIdx]; }
    20291868  Void      setRefLayerId        ( Int i, RefPicList e, Int iRefIdx ) { m_aiRefLayerIdList[e][iRefIdx] = i; }
    2030 #if H_MV5
    20311869  Void      getTempRefPicLists   ( TComList<TComPic*>& rcListPic, std::vector<TComPic*>& refPicSetInterLayer0, std::vector<TComPic*>& refPicSetInterLayer1,                                     
    20321870                                   std::vector<TComPic*> rpsCurrList[2], std::vector<Bool> usedAsLongTerm[2], Int& numPocTotalCurr, Bool checkNumPocTotalCurr = false );
    20331871
    20341872  Void      setRefPicList        ( std::vector<TComPic*> rpsCurrList[2], std::vector<Bool> usedAsLongTerm[2], Int numPocTotalCurr, Bool checkNumPocTotalCurr = false );
    2035 #else
    2036   Void      setRefPicList       ( TComList<TComPic*>& rcListPic, std::vector<TComPic*>& interLayerRefPicSet , Bool checkNumPocTotalCurr = false );
    2037 #endif
    20381873#else
    20391874#if FIX1071
     
    20821917  Void setTLayerInfo( UInt uiTLayer );
    20831918  Void decodingMarking( TComList<TComPic*>& rcListPic, Int iGOPSIze, Int& iMaxRefPicNum );
     1919  Void checkLeadingPictureRestrictions( TComList<TComPic*>& rcListPic );
    20841920  Void applyReferencePictureSet( TComList<TComPic*>& rcListPic, TComReferencePictureSet *RPSList);
    20851921#if H_MV
    2086 #if !H_MV5
    2087   Void createAndApplyIvReferencePictureSet( TComPicLists* ivPicLists, std::vector<TComPic*>& refPicSetInterLayer );
    2088   static Void markIvRefPicsAsShortTerm    ( std::vector<TComPic*> refPicSetInterLayer );
    2089 #else
    20901922  Void createInterLayerReferencePictureSet( TComPicLists* ivPicLists, std::vector<TComPic*>& refPicSetInterLayer0, std::vector<TComPic*>& refPicSetInterLayer1 );
    20911923  static Void markIvRefPicsAsShortTerm    ( std::vector<TComPic*> refPicSetInterLayer0, std::vector<TComPic*> refPicSetInterLayer1 );
    2092 #endif
    20931924  static Void markCurrPic                 ( TComPic* currPic );;
    20941925  static Void markIvRefPicsAsUnused       ( TComPicLists* ivPicLists, std::vector<Int> targetDecLayerIdSet, TComVPS* vps, Int curLayerId, Int curPoc  );
    2095 #if H_MV5
    20961926  Void        printRefPicList();
    2097 #else
    2098   Void        xPrintRefPicList();
    2099 #endif
    21001927#endif
    21011928  Bool isTemporalLayerSwitchingPoint( TComList<TComPic*>& rcListPic );
     
    21842011  Void      setViewId             ( Int viewId )     { m_viewId = viewId;   }
    21852012  Int       getViewId             ()                 { return m_viewId;     }
    2186 #if H_MV5
    21872013  Void      setViewIndex          ( Int viewIndex )  { m_viewIndex = viewIndex;   }
    21882014  Int       getViewIndex          ()                 { return m_viewIndex;     }
    2189 #endif
    21902015#if H_3D
    21912016#if H_3D_TMVP
     
    21932018  Void      setAlterRefIdx          ( RefPicList e, Int i ) { m_aiAlterRefIdx[e]    = i;      }
    21942019  Int       getAlterRefIdx          ( RefPicList e )        { return  m_aiAlterRefIdx[e];     }
    2195 #endif
    2196 #if !H_MV5
    2197   Void      setViewIndex          ( Int viewIndex )  { m_viewIndex = viewIndex;   }
    2198   Int       getViewIndex          ()                 { return m_viewIndex;     }
    21992020#endif
    22002021  Void      setIsDepth            ( Bool isDepth )   { m_isDepth = isDepth; }
     
    22192040// Additional slice header syntax elements
    22202041
    2221 #if H_MV5
    22222042  Void setPocResetFlag( Bool flag ) { m_pocResetFlag = flag; }
    22232043  Bool getPocResetFlag(  ) { return m_pocResetFlag; }
    2224 #endif
    22252044
    22262045Void setDiscardableFlag( Bool flag ) { m_discardableFlag = flag; }
     
    22362055Int  getInterLayerPredLayerIdc( Int i ) { return m_interLayerPredLayerIdc[i]; }
    22372056
    2238 #if H_MV5
    22392057  // Additional variables derived in slice header semantics
    22402058  Int  getNumInterLayerRefPicsMinus1Len( ) { return gCeilLog2(  getVPS()->getNumDirectRefLayers( getLayerId() )); }
     
    22502068  Void     setRefPicSetInterLayer       ( std::vector<TComPic*>* refPicSetInterLayer0, std::vector<TComPic*>* refPicSetInterLayer1);
    22512069  TComPic* getPicFromRefPicSetInterLayer( Int setIdc, Int layerId );
    2252 #else
    2253 Void setInterLayerSamplePredOnlyFlag( Bool flag ) { m_interLayerSamplePredOnlyFlag = flag; }
    2254 Bool getInterLayerSamplePredOnlyFlag(  ) { return m_interLayerSamplePredOnlyFlag; }
    2255 
    2256 Void setAltCollocatedIndicationFlag( Bool flag ) { m_altCollocatedIndicationFlag = flag; }
    2257 Bool getAltCollocatedIndicationFlag(  ) { return m_altCollocatedIndicationFlag; }
    2258 
    2259 Void setCollocatedRefLayerIdx( Int  val ) { m_collocatedRefLayerIdx = val; }
    2260 Int  getCollocatedRefLayerIdx(  ) { return m_collocatedRefLayerIdx; }
    2261 
    2262 // Additional variables derived in slice header semantics
    2263 Int  getNumInterLayerRefPicsMinus1Len( ) { return xCeilLog2(  getVPS()->getNumDirectRefLayers( getLayerIdInVps() )); }
    2264 Int  getInterLayerPredLayerIdcLen    ( ) { return xCeilLog2(  getVPS()->getNumDirectRefLayers( getLayerIdInVps() )); }
    2265 
    2266 Int  getNumActiveRefLayerPics( );
    2267 Int  getRefPicLayerId               ( Int i );
    2268 
    2269 Void setActiveMotionPredRefLayers   ( );
    2270 
    2271 Int  getNumActiveMotionPredRefLayers(  )      { return m_numActiveMotionPredRefLayers; }
    2272 Int  getActiveMotionPredRefLayerId  ( Int i ) { return m_activeMotionPredRefLayerId[i]; }
    2273 
    2274 Bool getInterRefEnabledInRPLFlag( );
    2275 
    2276 Void     setRefPicSetInterLayer       ( std::vector<TComPic*>* m_refPicSetInterLayer );
    2277 TComPic* getPicFromRefPicSetInterLayer( Int layerId );
    2278 
    2279 #endif
    22802070#endif
    22812071protected:
     
    22842074TComPic*  xGetLongTermRefPic(TComList<TComPic*>& rcListPic, Int poc, Bool pocHasMsb);
    22852075#if H_MV
    2286 #if !H_MV5
    2287   Int       xCeilLog2( Int val );
    2288 #endif
    22892076  TComPic*  xGetInterLayerRefPic( std::vector<TComPic*>& rcListIlPic, Int layerId ); 
    22902077#endif
     
    23682155  //! activate a SPS from a active parameter sets SEI message
    23692156  //! \returns true, if activation is successful
    2370 #if !H_MV5
    2371   Bool activateSPSWithSEI(Int SPSId);
    2372 
    2373   //! activate a PPS and depending on isIDR parameter also SPS and VPS
    2374   //! \returns true, if activation is successful
    2375   Bool activatePPS(Int ppsId, Bool isIRAP);
    2376 
    2377   TComVPS* getActiveVPS(){ return m_vpsMap.getPS(m_activeVPSId); };
    2378   TComSPS* getActiveSPS(){ return m_spsMap.getPS(m_activeSPSId); };
    2379   TComPPS* getActivePPS(){ return m_ppsMap.getPS(m_activePPSId); };
    2380 
    2381 protected:
    2382  
    2383   ParameterSetMap<TComVPS> m_vpsMap;
    2384   ParameterSetMap<TComSPS> m_spsMap;
    2385   ParameterSetMap<TComPPS> m_ppsMap;
    2386 
    2387   Int m_activeVPSId;
    2388   Int m_activeSPSId;
    2389   Int m_activePPSId;
    2390 #else
    23912157#if H_MV
    23922158  Bool activateSPSWithSEI(Int SPSId, Int layerId );
     
    24262192#endif
    24272193
    2428 #endif
    24292194};
    24302195
  • trunk/source/Lib/TLibCommon/TComWedgelet.cpp

    r622 r655  
    175175}
    176176
    177 #if !SEC_DMM2_E0146_HHIFIX
    178 Bool TComWedgelet::checkPredDirAbovePossible( UInt uiPredDirBlockSize, UInt uiPredDirBlockOffset )
    179 {
    180   WedgeResolution eContDWedgeRes = g_dmmWedgeResolution[(UInt)g_aucConvertToBit[uiPredDirBlockSize]];
    181   UInt uiContDStartEndMax = 0;
    182   UInt uiContDStartEndOffset = 0;
    183   switch( eContDWedgeRes )
    184   {
    185   case( DOUBLE_PEL ): { uiContDStartEndMax = (uiPredDirBlockSize>>1); uiContDStartEndOffset = (uiPredDirBlockOffset>>1); break; }
    186   case(   FULL_PEL ): { uiContDStartEndMax =  uiPredDirBlockSize;     uiContDStartEndOffset =  uiPredDirBlockOffset;     break; }
    187   case(   HALF_PEL ): { uiContDStartEndMax = (uiPredDirBlockSize<<1); uiContDStartEndOffset = (uiPredDirBlockOffset<<1); break; }
    188   }
    189 
    190   if( m_uhOri == 2 || m_uhOri == 3 || m_uhOri == 4 )
    191   {
    192     UInt uiThisStartEndMax = 0;
    193     switch( m_eWedgeRes )
    194     {
    195     case( DOUBLE_PEL ): { uiThisStartEndMax = (m_uiWidth>>1); break; }
    196     case(   FULL_PEL ): { uiThisStartEndMax =  m_uiWidth;     break; }
    197     case(   HALF_PEL ): { uiThisStartEndMax = (m_uiWidth<<1); break; }
    198     }
    199 
    200     UChar uhStartX = m_uhXs;
    201     UChar uhStartY = m_uhYs;
    202     UChar uhEndX   = m_uhXe;
    203     UChar uhEndY   = m_uhYe;
    204 
    205     if( 2 == m_uhOri )
    206     {
    207       std::swap( uhStartX, uhEndX );
    208       std::swap( uhStartY, uhEndY );
    209     }
    210 
    211     UInt uiScaledEndX = (UInt)uhEndX;
    212     Int iDeltaRes = (Int)eContDWedgeRes - (Int)m_eWedgeRes;
    213     if( iDeltaRes > 0 ) { uiScaledEndX <<=  iDeltaRes; }
    214     if( iDeltaRes < 0 ) { uiScaledEndX >>= -iDeltaRes; }
    215 
    216     if( ((UInt)uhEndY == (uiThisStartEndMax-1)) && ((uiScaledEndX-uiContDStartEndOffset) > 0 && (uiScaledEndX-uiContDStartEndOffset) < (uiContDStartEndMax-1)) )
    217     {
    218       return true;
    219     }
    220   }
    221 
    222   return false;
    223 }
    224 
    225 Bool TComWedgelet::checkPredDirLeftPossible( UInt uiPredDirBlockSize, UInt uiPredDirBlockOffset )
    226 {
    227   WedgeResolution eContDWedgeRes = g_dmmWedgeResolution[(UInt)g_aucConvertToBit[uiPredDirBlockSize]];
    228   UInt uiContDStartEndMax = 0;
    229   UInt uiContDStartEndOffset = 0;
    230   switch( eContDWedgeRes )
    231   {
    232   case( DOUBLE_PEL ): { uiContDStartEndMax = (uiPredDirBlockSize>>1); uiContDStartEndOffset = (uiPredDirBlockOffset>>1); break; }
    233   case(   FULL_PEL ): { uiContDStartEndMax =  uiPredDirBlockSize;     uiContDStartEndOffset =  uiPredDirBlockOffset;     break; }
    234   case(   HALF_PEL ): { uiContDStartEndMax = (uiPredDirBlockSize<<1); uiContDStartEndOffset = (uiPredDirBlockOffset<<1); break; }
    235   }
    236 
    237   if( m_uhOri == 1 || m_uhOri == 2 || m_uhOri == 5 )
    238   {
    239     UInt uiThisStartEndMax = 0;
    240     switch( m_eWedgeRes )
    241     {
    242     case( DOUBLE_PEL ): { uiThisStartEndMax = (m_uiHeight>>1); break; }
    243     case(   FULL_PEL ): { uiThisStartEndMax =  m_uiHeight;     break; }
    244     case(   HALF_PEL ): { uiThisStartEndMax = (m_uiHeight<<1); break; }
    245     }
    246 
    247     UChar uhStartX = m_uhXs;
    248     UChar uhStartY = m_uhYs;
    249     UChar uhEndX   = m_uhXe;
    250     UChar uhEndY   = m_uhYe;
    251 
    252     if( 1 == m_uhOri || 5 == m_uhOri )
    253     {
    254       std::swap( uhStartX, uhEndX );
    255       std::swap( uhStartY, uhEndY );
    256     }
    257 
    258     UInt uiScaledEndY = (UInt)uhEndY;
    259     Int iDeltaRes = (Int)eContDWedgeRes - (Int)m_eWedgeRes;
    260     if( iDeltaRes > 0 ) { uiScaledEndY <<=  iDeltaRes; }
    261     if( iDeltaRes < 0 ) { uiScaledEndY >>= -iDeltaRes; }
    262 
    263     if( ((UInt)uhEndX == (uiThisStartEndMax-1)) && ((uiScaledEndY-uiContDStartEndOffset) > 0 && (uiScaledEndY-uiContDStartEndOffset) < (uiContDStartEndMax-1)) )
    264     {
    265       return true;
    266     }
    267   }
    268 
    269   return false;
    270 }
    271 
    272 Void TComWedgelet::getPredDirStartEndAbove( UChar& ruhXs, UChar& ruhYs, UChar& ruhXe, UChar& ruhYe, UInt uiPredDirBlockSize, UInt uiPredDirBlockOffset, Int iDeltaEnd )
    273 {
    274   ruhXs = 0;
    275   ruhYs = 0;
    276   ruhXe = 0;
    277   ruhYe = 0;
    278 
    279   // get start/end of reference (=this) wedgelet
    280   UInt uiRefStartX = (UInt)getStartX();
    281   UInt uiRefStartY = (UInt)getStartY();
    282   UInt uiRefEndX   = (UInt)getEndX();
    283   UInt uiRefEndY   = (UInt)getEndY();
    284 
    285   WedgeResolution eContDWedgeRes = g_dmmWedgeResolution[(UInt)g_aucConvertToBit[uiPredDirBlockSize]];
    286   UInt uiContDStartEndMax = 0;
    287   UInt uiContDStartEndOffset = 0;
    288   switch( eContDWedgeRes )
    289   {
    290   case( DOUBLE_PEL ): { uiContDStartEndMax = (uiPredDirBlockSize>>1); uiContDStartEndOffset = (uiPredDirBlockOffset>>1); break; }
    291   case(   FULL_PEL ): { uiContDStartEndMax =  uiPredDirBlockSize;     uiContDStartEndOffset =  uiPredDirBlockOffset;     break; }
    292   case(   HALF_PEL ): { uiContDStartEndMax = (uiPredDirBlockSize<<1); uiContDStartEndOffset = (uiPredDirBlockOffset<<1); break; }
    293   }
    294   Int iContDMaxPos = (Int)uiContDStartEndMax - 1;
    295 
    296   // swap if start/end if line orientation is not from top to bottom
    297   if( 2 == (UInt)getOri() )
    298   {
    299     std::swap( uiRefStartX, uiRefEndX );
    300     std::swap( uiRefStartY, uiRefEndY );
    301   }
    302 
    303   // calc slopes
    304   Int iA_DeltaX = (Int)uiRefEndX - (Int)uiRefStartX;
    305   Int iA_DeltaY = (Int)uiRefEndY - (Int)uiRefStartY;
    306 
    307   // get aligned end x value of ref wedge
    308   UInt uiScaledRefEndX = uiRefEndX;
    309   Int iDeltaRes = (Int)eContDWedgeRes - (Int)m_eWedgeRes;
    310   if( iDeltaRes > 0 ) { uiScaledRefEndX <<=  iDeltaRes; }
    311   if( iDeltaRes < 0 ) { uiScaledRefEndX >>= -iDeltaRes; }
    312 
    313   assert( uiScaledRefEndX >= uiContDStartEndOffset );
    314   Int iAlignedRefEndX = (Int)uiScaledRefEndX - (Int)uiContDStartEndOffset;
    315 
    316   // special for straight vertical wedge
    317   if( iA_DeltaX == 0 )
    318   {
    319     ruhXs = (UChar)iAlignedRefEndX;
    320     ruhYs = 0;
    321 
    322     Int iXe = iAlignedRefEndX + iDeltaEnd;
    323     if( iXe < 0 )
    324     {
    325       ruhXe = 0;
    326       ruhYe = (UChar)min( max( (iContDMaxPos + iXe), 0 ), iContDMaxPos );
    327 
    328       return;
    329     }
    330     else if( iXe > iContDMaxPos )
    331     {
    332       ruhXe = (UChar)iContDMaxPos;
    333       ruhYe = (UChar)min( max( (iContDMaxPos - (iXe - iContDMaxPos)), 0 ), iContDMaxPos );
    334 
    335       std::swap( ruhXs, ruhXe );
    336       std::swap( ruhYs, ruhYe );
    337       return;
    338     }
    339     else
    340     {
    341       ruhXe = (UChar)iXe;
    342       ruhYe = (UChar)iContDMaxPos;
    343 
    344       return;
    345     }
    346   }
    347 
    348   // special for straight horizontal short bottom line
    349   if( iA_DeltaY == 0 )
    350   {
    351     switch( (UInt)getOri() )
    352     {
    353     case( 2 ):
    354       {
    355         ruhXs = (UChar)(iAlignedRefEndX-1);
    356         ruhYs = 0;
    357         ruhXe = 0;
    358         ruhYe = (UChar)min( max( iDeltaEnd, 0 ), iContDMaxPos );
    359 
    360         return;
    361       }
    362     case( 3 ):
    363       {
    364         ruhXs = (UChar)(iAlignedRefEndX+1);
    365         ruhYs = 0;
    366         ruhXe = (UChar)iContDMaxPos;
    367         ruhYe = (UChar)min( max( -iDeltaEnd, 0 ), iContDMaxPos );
    368 
    369         std::swap( ruhXs, ruhXe );
    370         std::swap( ruhYs, ruhYe );
    371         return;
    372       }
    373     default:
    374       {
    375         assert( 0 );
    376         return;
    377       }
    378     }
    379   }
    380 
    381   // set start point depending on slope
    382   if( abs( iA_DeltaX ) >= abs( iA_DeltaY ) ) { if( iA_DeltaX < 0 ) { ruhXs = (UChar)(iAlignedRefEndX-1); ruhYs = 0; }
    383                                                 if( iA_DeltaX > 0 ) { ruhXs = (UChar)(iAlignedRefEndX+1); ruhYs = 0; } }
    384   else                                                             { ruhXs = (UChar)(iAlignedRefEndX);   ruhYs = 0;   }
    385 
    386   // calc end point and determine orientation
    387   Int iVirtualEndX = (Int)ruhXs + roftoi( (Double)iContDMaxPos * ((Double)iA_DeltaX / (Double)iA_DeltaY) );
    388 
    389   if( iVirtualEndX < 0 )
    390   {
    391     Int iYe = roftoi( (Double)(0 - (Int)ruhXs) * ((Double)iA_DeltaY / (Double)iA_DeltaX) ) + iDeltaEnd;
    392     if( iYe < (Int)uiContDStartEndMax )
    393     {
    394       ruhXe = 0;
    395       ruhYe = (UChar)max( iYe, 0 );
    396 
    397       return;
    398     }
    399     else
    400     {
    401       ruhXe = (UChar)min( (iYe - iContDMaxPos), iContDMaxPos );
    402       ruhYe = (UChar)iContDMaxPos;
    403 
    404       return;
    405     }
    406   }
    407   else if( iVirtualEndX > iContDMaxPos )
    408   {
    409     Int iYe = roftoi( (Double)(iContDMaxPos - (Int)ruhXs) * ((Double)iA_DeltaY / (Double)iA_DeltaX) ) - iDeltaEnd;
    410     if( iYe < (Int)uiContDStartEndMax )
    411     {
    412       ruhXe = (UChar)iContDMaxPos;
    413       ruhYe = (UChar)max( iYe, 0 );
    414 
    415       std::swap( ruhXs, ruhXe );
    416       std::swap( ruhYs, ruhYe );
    417       return;
    418     }
    419     else
    420     {
    421       ruhXe = (UChar)max( (iContDMaxPos - (iYe - iContDMaxPos)), 0 );
    422       ruhYe = (UChar)iContDMaxPos;
    423 
    424       return;
    425     }
    426   }
    427   else
    428   {
    429     Int iXe = iVirtualEndX + iDeltaEnd;
    430     if( iXe < 0 )
    431     {
    432       ruhXe = 0;
    433       ruhYe = (UChar)max( (iContDMaxPos + iXe), 0 );
    434 
    435       return;
    436     }
    437     else if( iXe > iContDMaxPos )
    438     {
    439       ruhXe = (UChar)iContDMaxPos;
    440       ruhYe = (UChar)max( (iContDMaxPos - (iXe - iContDMaxPos)), 0 );
    441 
    442       std::swap( ruhXs, ruhXe );
    443       std::swap( ruhYs, ruhYe );
    444       return;
    445     }
    446     else
    447     {
    448       ruhXe = (UChar)iXe;
    449       ruhYe = (UChar)iContDMaxPos;
    450 
    451       return;
    452     }
    453   }
    454 }
    455 
    456 Void TComWedgelet::getPredDirStartEndLeft( UChar& ruhXs, UChar& ruhYs, UChar& ruhXe, UChar& ruhYe, UInt uiPredDirBlockSize, UInt uiPredDirBlockOffset, Int iDeltaEnd )
    457 {
    458   ruhXs = 0;
    459   ruhYs = 0;
    460   ruhXe = 0;
    461   ruhYe = 0;
    462 
    463   // get start/end of reference (=this) wedgelet
    464   UInt uiRefStartX = (UInt)getStartX();
    465   UInt uiRefStartY = (UInt)getStartY();
    466   UInt uiRefEndX   = (UInt)getEndX();
    467   UInt uiRefEndY   = (UInt)getEndY();
    468 
    469   WedgeResolution eContDWedgeRes = g_dmmWedgeResolution[(UInt)g_aucConvertToBit[uiPredDirBlockSize]];
    470   UInt uiContDStartEndMax = 0;
    471   UInt uiContDStartEndOffset = 0;
    472   switch( eContDWedgeRes )
    473   {
    474   case( DOUBLE_PEL ): { uiContDStartEndMax = (uiPredDirBlockSize>>1); uiContDStartEndOffset = (uiPredDirBlockOffset>>1); break; }
    475   case(   FULL_PEL ): { uiContDStartEndMax =  uiPredDirBlockSize;     uiContDStartEndOffset =  uiPredDirBlockOffset;     break; }
    476   case(   HALF_PEL ): { uiContDStartEndMax = (uiPredDirBlockSize<<1); uiContDStartEndOffset = (uiPredDirBlockOffset<<1); break; }
    477   }
    478   Int iContDMaxPos = (Int)uiContDStartEndMax - 1;
    479 
    480   // swap if start/end if line orientation is not from left to right
    481   if( 1 == (UInt)getOri() || 5 == (UInt)getOri() )
    482   {
    483     std::swap( uiRefStartX, uiRefEndX );
    484     std::swap( uiRefStartY, uiRefEndY );
    485   }
    486 
    487   Int iL_DeltaX = (Int)uiRefEndX - (Int)uiRefStartX;
    488   Int iL_DeltaY = (Int)uiRefEndY - (Int)uiRefStartY;
    489 
    490   UInt uiScaledRefEndY = uiRefEndY;
    491   Int iDeltaRes = (Int)eContDWedgeRes - (Int)m_eWedgeRes;
    492   if( iDeltaRes > 0 ) { uiScaledRefEndY <<=  iDeltaRes; }
    493   if( iDeltaRes < 0 ) { uiScaledRefEndY >>= -iDeltaRes; }
    494 
    495   assert( uiScaledRefEndY >= uiContDStartEndOffset );
    496   Int iAlignedRefEndY = (Int)uiScaledRefEndY - (Int)uiContDStartEndOffset;
    497 
    498   // special for straight horizontal wedge
    499   if( iL_DeltaY == 0 )
    500   {
    501     ruhXs = 0;
    502     ruhYs = (UChar)iAlignedRefEndY;
    503 
    504     Int iYe = iAlignedRefEndY - iDeltaEnd;
    505     if( iYe < 0 )
    506     {
    507       ruhXe = (UChar)min( max( (iContDMaxPos + iYe), 0 ), iContDMaxPos );
    508       ruhYe = 0;
    509 
    510       std::swap( ruhXs, ruhXe );
    511       std::swap( ruhYs, ruhYe );
    512       return;
    513     }
    514     else if( iYe > iContDMaxPos )
    515     {
    516       ruhXe = (UChar)min( max( (iContDMaxPos - (iYe - iContDMaxPos)), 0 ), iContDMaxPos );
    517       ruhYe = (UChar)iContDMaxPos;
    518 
    519       return;
    520     }
    521     else
    522     {
    523       ruhXe = (UChar)iContDMaxPos;
    524       ruhYe = (UChar)iYe;
    525 
    526       std::swap( ruhXs, ruhXe );
    527       std::swap( ruhYs, ruhYe );
    528       return;
    529     }
    530   }
    531 
    532   // special for straight vertical short right line
    533   if( iL_DeltaX == 0 )
    534   {
    535     switch( (UInt)getOri() )
    536     {
    537     case( 1 ):
    538       {
    539         ruhXs = 0;
    540         ruhYs = (UChar)(iAlignedRefEndY+1);
    541         ruhXe = (UChar)min( max( iDeltaEnd, 0 ), iContDMaxPos );
    542         ruhYe = (UChar)iContDMaxPos;
    543 
    544         return;
    545       }
    546     case( 2 ):
    547       {
    548         ruhXs = 0;
    549         ruhYs = (UChar)(iAlignedRefEndY-1);
    550         ruhXe = (UChar)min( max( -iDeltaEnd, 0 ), iContDMaxPos );
    551         ruhYe = 0;
    552 
    553         std::swap( ruhXs, ruhXe );
    554         std::swap( ruhYs, ruhYe );
    555         return;
    556       }
    557     default:
    558       {
    559         assert( 0 );
    560         return;
    561       }
    562     }
    563   }
    564 
    565   // set start point depending on slope
    566   if( abs( iL_DeltaY ) >= abs( iL_DeltaX ) ) { if( iL_DeltaY < 0 ) { ruhYs = (UChar)(iAlignedRefEndY-1); ruhXs = 0; }
    567                                                if( iL_DeltaY > 0 ) { ruhYs = (UChar)(iAlignedRefEndY+1); ruhXs = 0; } }
    568   else                                       {                       ruhYs = (UChar)(iAlignedRefEndY);   ruhXs = 0;   }
    569 
    570   // calc end point and determine orientation
    571   Int iVirtualEndY = (Int)ruhYs + roftoi( (Double)iContDMaxPos * ((Double)iL_DeltaY / (Double)iL_DeltaX) );
    572 
    573   if( iVirtualEndY < 0 )
    574   {
    575     Int iXe = roftoi( (Double)(0 - (Int)ruhYs ) * ((Double)iL_DeltaX / (Double)iL_DeltaY) ) - iDeltaEnd;
    576     if( iXe < (Int)uiContDStartEndMax )
    577     {
    578       ruhXe = (UChar)max( iXe, 0 );
    579       ruhYe = 0;
    580 
    581       std::swap( ruhXs, ruhXe );
    582       std::swap( ruhYs, ruhYe );
    583       return;
    584     }
    585     else
    586     {
    587       ruhXe = (UChar)iContDMaxPos;
    588       ruhYe = (UChar)min( (iXe - iContDMaxPos), iContDMaxPos );
    589 
    590       std::swap( ruhXs, ruhXe );
    591       std::swap( ruhYs, ruhYe );
    592       return;
    593     }
    594   }
    595   else if( iVirtualEndY > iContDMaxPos )
    596   {
    597     Int iXe = roftoi( (Double)(iContDMaxPos - (Int)ruhYs ) * ((Double)iL_DeltaX / (Double)iL_DeltaY) ) + iDeltaEnd;
    598     if( iXe < (Int)uiContDStartEndMax )
    599     {
    600       ruhXe = (UChar)max( iXe, 0 );
    601       ruhYe = (UChar)iContDMaxPos;
    602 
    603       return;
    604     }
    605     else
    606     {
    607       ruhXe = (UChar)iContDMaxPos;
    608       ruhYe = (UChar)max( (iContDMaxPos - (iXe - iContDMaxPos)), 0 );
    609 
    610       std::swap( ruhXs, ruhXe );
    611       std::swap( ruhYs, ruhYe );
    612       return;
    613     }
    614   }
    615   else
    616   {
    617     Int iYe = iVirtualEndY - iDeltaEnd;
    618     if( iYe < 0 )
    619     {
    620       ruhXe = (UChar)max( (iContDMaxPos + iYe), 0 );
    621       ruhYe = 0;
    622 
    623       std::swap( ruhXs, ruhXe );
    624       std::swap( ruhYs, ruhYe );
    625       return;
    626     }
    627     else if( iYe > iContDMaxPos )
    628     {
    629       ruhXe = (UChar)max( (iContDMaxPos - (iYe - iContDMaxPos)), 0 );
    630       ruhYe = (UChar)iContDMaxPos;
    631 
    632       return;
    633     }
    634     else
    635     {
    636       ruhXe = (UChar)iContDMaxPos;
    637       ruhYe = (UChar)iYe;
    638 
    639       std::swap( ruhXs, ruhXe );
    640       std::swap( ruhYs, ruhYe );
    641       return;
    642     }
    643   }
    644 }
    645 #endif
    646 
    647177Void TComWedgelet::xGenerateWedgePattern()
    648178{
  • trunk/source/Lib/TLibCommon/TComWedgelet.h

    r622 r655  
    5050enum DIM_IDX
    5151{
    52 #if SEC_DMM2_E0146_HHIFIX
    5352  DMM1_IDX = 0,
    5453  DMM3_IDX = 1,
    5554  DMM4_IDX = 2,
    5655  RBC_IDX  = 3
    57 #else
    58   DMM1_IDX = 0,
    59   DMM2_IDX = 3,
    60   DMM3_IDX = 1,
    61   DMM4_IDX = 2,
    62   RBC_IDX  = 4
    63 #endif
    6456};
    65 #if SEC_DMM2_E0146_HHIFIX
     57
    6658#define DMM_NUM_TYPE   3
    67 #else
    68 #define DMM_NUM_TYPE   4
    69 #endif
    7059#define RBC_NUM_TYPE   1
    7160#define DIM_NUM_TYPE   (DMM_NUM_TYPE+RBC_NUM_TYPE)
     
    8675#define DMM_NO_WEDGEINDEX       MAX_UINT
    8776#define DMM_NUM_WEDGE_REFINES   8
    88 #if !SEC_DMM2_E0146_HHIFIX
    89 #define DMM2_DELTAEND_MAX       4
    90 #endif
    9177#define DMM3_SIMPLIFY_TR        1
    9278
     
    151137  Bool  checkInvIdentical( Bool* pbRefPattern );
    152138
    153 #if !SEC_DMM2_E0146_HHIFIX
    154   // functions for DMM2 prediction
    155   Bool  checkPredDirAbovePossible( UInt uiPredDirBlockSize, UInt uiPredDirBlockOffsett );
    156   Bool  checkPredDirLeftPossible ( UInt uiPredDirBlockSize, UInt uiPredDirBlockOffsett );
    157   Void  getPredDirStartEndAbove( UChar& ruhXs, UChar& ruhYs, UChar& ruhXe, UChar& ruhYe, UInt uiPredDirBlockSize, UInt uiPredDirBlockOffset, Int iDeltaEnd );
    158   Void  getPredDirStartEndLeft ( UChar& ruhXs, UChar& ruhYs, UChar& ruhXe, UChar& ruhYe, UInt uiPredDirBlockSize, UInt uiPredDirBlockOffset, Int iDeltaEnd );
    159 #endif
    160139};  // END CLASS DEFINITION TComWedgelet
    161140
  • trunk/source/Lib/TLibCommon/TComWeightPrediction.h

    r608 r655  
    5353class TComWeightPrediction
    5454{
    55   wpScalingParam  m_wp0[3], m_wp1[3];
    56 
    5755public:
    5856  TComWeightPrediction();
  • trunk/source/Lib/TLibCommon/TypeDef.h

    r622 r655  
    9292                                              // QC_CU_NBDV_D0181
    9393                                              // SEC_DEFAULT_DV_D0112
    94                                               // MTK_DVMCP_FIX_E0172               1 // fix the mismatch between software and WD for DV derivation from DVMCP blocks, issue 2 in JCT3V-E0172
     94                                              // MTK_DVMCP_FIX_E0172       fix the mismatch between software and WD for DV derivation from DVMCP blocks, issue 2 in JCT3V-E0172
     95                                              // SEC_SIMPLIFIED_NBDV_E0142 Simplified NBDV, JCT3V-E0142 and JCT3V-E0190
     96                                              // MTK_NBDV_TN_FIX_E0172     fix the issue of DV derivation from the temporal neighboring blocks, issue 7 in JCT3V-E0172
     97                                              // MTK_TEXTURE_MRGCAND_BUGFIX_E0182  Bug fix for TEXTURE MERGING CANDIDATE     , JCT3V-E0182
    9598#define H_3D_ARP                          1   // Advanced residual prediction (ARP), JCT3V-D0177
    9699#define H_3D_IC                           1   // Illumination Compensation, JCT3V-B0045, JCT3V-C0046, JCT3V-D0060
    97100                                              // Unifying rounding offset, for IC part, JCT3V-D0135
    98101                                              // Full Pel Interpolation for Depth, HHI_FULL_PEL_DEPTH_MAP_MV_ACC
     102                                              // SHARP_ILLUCOMP_REFINE_E0046
     103                                              // MTK_CLIPPING_ALIGN_IC_E0168       // To support simplify bi-prediction PU with identical motion checking, JCT3V-E0168
    99104
    100105#if H_3D_NBDV
     
    103108                                              // MERL_D0166: Reference view selection in NBDV & Bi-VSP
    104109                                              // MERL_C0152: Basic VSP
     110                                              // NBDV_DEFAULT_VIEWIDX_BUGFIX Bug fix for invalid default view index for NBDV
     111                                              // NTT_DoNBDV_VECTOR_CLIP_E0141 disparity vector clipping in DoNBDV, JCT3V-E0141 and JCT3V-E0209
     112
    105113#endif
    106114
     
    112120                                              // LG_D0092: Multiple VSP candidate allowed
    113121                                              // MTK_VSP_FIX_ALIGN_WD_E0172
     122                                              // NTT_VSP_ADAPTIVE_SPLIT_E0207 adaptive sub-PU partitioning in VSP, JCT3V-E0207
     123                                              // NTT_VSP_DC_BUGFIX_E0208 bugfix for sub-PU based DC in VSP, JCT3V-E0208
     124                                              // NTT_VSP_COMMON_E0207_E0208 common part of JCT3V-E0207 and JCT3V-E0208
    114125#define H_3D_IV_MERGE                     1   // Inter-view motion merge candidate
    115126                                              // HHI_INTER_VIEW_MOTION_PRED
     
    139150                                              // FIX_SDC_ENC_RD_WVSO_D0163
    140151                                              // MTK_SAMPLE_BASED_SDC_D0110
    141 
    142 
    143 
    144 /////////////////////////////////////////////////////////////////////////////////////////
    145 ///////////////////////////////////   HTM-8.0 INTEGRATIONS //////////////////////////////
    146 /////////////////////////////////////////////////////////////////////////////////////////
    147 
    148 #define SHARP_ILLUCOMP_REFINE_E0046       1
    149 #define MTK_FAST_TEXTURE_ENCODING_E0173   1   // Fast merge mode decision and early CU determination for texture component of dependent view, JCT3V-E0173
    150 #define MTK_SONY_PROGRESSIVE_MV_COMPRESSION_E0170            1   // Progressive MV Compression, JCT3V-E0170
    151 #define LGE_INTER_SDC_E0156               1   // Enable inter SDC for depth coding
    152 
    153 #if H_3D_IC
    154 #define MTK_CLIPPING_ALIGN_IC_E0168       1   // To support simplify bi-prediction PU with identical motion checking, JCT3V-E0168
    155 #endif
    156 
    157 #if H_3D_NBDV
    158 #define NBDV_DEFAULT_VIEWIDX_BUGFIX       1  // Bug fix for invalid default view index for NBDV
    159 #define MTK_RVS_BUGFIX_E0172              1  // Bug fix for issues caused by reference view selection, JCT3V-E0172
    160 #define MTK_TEXTURE_MRGCAND_BUGFIX_E0182  1  // Bug fix for TEXTURE MERGING CANDIDATE     , JCT3V-E0182
    161 
    162 #if MTK_RVS_BUGFIX_E0172
    163 #define MTK_DIVMC_FIX_E0172               1 // fix the issue of derivation of disparity inter-view merge candidate, issue 5 in JCT3V-E0172
    164 #define MTK_NBDV_TN_FIX_E0172             1 // fix the issue of DV derivation from the temporal neighboring blocks, issue 7 in JCT3V-E0172
    165 #endif // MTK_RVS_BUGFIX_E0172
    166 
    167 #if H_3D_NBDV_REF
    168 #define NTT_DoNBDV_VECTOR_CLIP_E0141      1   // disparity vector clipping in DoNBDV, JCT3V-E0141 and JCT3V-E0209
    169 #define SEC_SIMPLIFIED_NBDV_E0142         1   // Simplified NBDV, JCT3V-E0142 and JCT3V-E0190
    170 #endif
    171 #endif // H_3D_NBDV
    172 
     152                                              // SEC_DMM2_E0146_HHIFIX Removal of DMM2 from DMMs
     153                                              // ZJU_DEPTH_INTRA_MODE_E0204 Simplified Binarization for depth_intra_mode
     154                                              // KWU_SDC_SIMPLE_DC_E0117 Simplified DC calculation for SDC
     155                                              // SCU_HS_DMM4_REMOVE_DIV_E0242 DMM4 Division Removal
     156                                              // LGE_SDC_REMOVE_DC_E0158 Removal of DC mode from SDC
     157                                              // LGE_PKU_DMM3_OVERLAP_E0159_HHIFIX 1   Removal of overlap between DMM3 and DMM1
     158
     159#define H_3D_INTER_SDC                    1   // INTER SDC, Inter simplified depth coding
     160                                              // LGE_INTER_SDC_E0156  Enable inter SDC for depth coding
     161#define H_3D_FCO                          0   // Flexible coding order for 3D
     162
     163
     164
     165// OTHERS
     166                                              // MTK_SONY_PROGRESSIVE_MV_COMPRESSION_E0170 // Progressive MV Compression, JCT3V-E0170
     167#define H_3D_REN_MAX_DEV_OUT              0   // Output maximal possible shift deviation
     168#define H_3D_FAST_TEXTURE_ENCODING        1   // Fast merge mode decision and early CU determination for texture component of dependent view, JCT3V-E0173
     169                                              // MTK_FAST_TEXTURE_ENCODING_E0173
    173170#if H_3D_DIM
    174 #define SEC_DMM2_E0146_HHIFIX             1   // Removal of DMM2 from DMMs
    175 #define ZJU_DEPTH_INTRA_MODE_E0204        1   // Simplified Binarization for depth_intra_mode
    176 #define KWU_SDC_SIMPLE_DC_E0117           1   // Simplified DC calculation for SDC
    177 #define SCU_HS_DMM4_REMOVE_DIV_E0242      1   // DMM4 Division Removal
    178 #define SCU_HS_FAST_DEPTH_INTRA_E0238_HHIFIX     1   // Fast DMM and RBC Mode Selection
    179 #endif
    180 
    181 #if H_3D_VSP
    182 #define NTT_VSP_COMMON_E0207_E0208        1 // common part of JCT3V-E0207 and JCT3V-E0208
    183 #if NTT_VSP_COMMON_E0207_E0208
    184 #define NTT_VSP_DC_BUGFIX_E0208           1 // bugfix for sub-PU based DC in VSP, JCT3V-E0208
    185 #define NTT_VSP_VECTOR_CLIP_E0208         1 // disparity vector clipping on fetching depth map in VSP, JCT3V-E0208
    186 #define NTT_VSP_ADAPTIVE_SPLIT_E0207      1 // adaptive sub-PU partitioning in VSP, JCT3V-E0207
    187 #endif
    188 #endif
    189 
    190 #define H_3D_REN_MAX_DEV_OUT              0  // Output maximal possible shift deviation
    191 
    192 /// FIXES
    193 #define H_3D_FIX_BVSP                     1  // DV from NBDV instead of DoNBDV should be used
    194 #define H_3D_FIX_TICKET_036               1  // fix for ticket #36
    195 #define H_3D_FIX_REN                      1  // fix of erroneous inpainting for renderer
    196 #define H_3D_FIX_REN_WARNING              1  // fix of warning related to camera parameter precision
    197 
    198 #define H_3D_FIX_UINT_WARNING             1  // explicit in VSD
     171#define H_3D_FAST_DEPTH_INTRA             1   // Fast DMM and RBC Mode Selection
     172                                              // SCU_HS_FAST_DEPTH_INTRA_E0238_HHIFIX
     173#endif
     174
     175
     176// Rate Control
     177#define KWU_FIX_URQ                       1
     178#define KWU_RC_VIEWRC_E0227               0  ///< JCT3V-E0227, view-wise target bitrate allocation
     179#define KWU_RC_MADPRED_E0227              0  ///< JCT3V-E0227, inter-view MAD prediction
     180
    199181#endif // H_3D
    200182
    201183
    202 /////////////////////////////////////////////////////////////////////////////////////////
    203 ///////////////////////////////////   HTM-8.1 INTEGRATIONS //////////////////////////////
    204 /////////////////////////////////////////////////////////////////////////////////////////
    205 
    206 // Please put HTM-8.1 Integration defines here, when possible
    207 
    208 
    209 /// FIXES
    210 #if H_MV
    211 #define H_MV_FIX_LID_PIC_HASH_SEI_T40                      1   // Fix wrong layer_id in decoded picture hash SEI
    212 #define H_MV5                                              1   // Update to MV-HEVC 5 HLS
    213 #endif
     184
    214185/////////////////////////////////////////////////////////////////////////////////////////
    215186///////////////////////////////////   DERIVED DEFINES /////////////////////////////////// 
     
    223194#define H_3D_VSO_RM_ASSERTIONS            0   // Output VSO assertions
    224195#define H_3D_VSO_SYNTH_DIST_OUT           0   // Output of synthesized view distortion instead of depth distortion in encoder output
    225 
    226196#define H_3D_VSO_FIX                      0   // This fix should be enabled after verification
    227 
    228 #endif
    229 ////   ****** Neighbouring block-based Disparity Vector  *********
     197#endif
     198
     199////   ****** neighbouring block-based disparity vector  *********
    230200#if H_3D_NBDV
    231 #if SEC_SIMPLIFIED_NBDV_E0142
    232201#define DVFROM_LEFT                       0
    233202#define DVFROM_ABOVE                      1
    234203#define IDV_CANDS                         2
    235 #else
    236 #define DVFROM_LEFTBELOW                  0
    237 #define DVFROM_LEFT                       1
    238 #define DVFROM_ABOVERIGHT                 2
    239 #define DVFROM_ABOVE                      3
    240 #define DVFROM_ABOVELEFT                  4
    241 #define IDV_CANDS                         5
    242 #endif
    243204#endif
    244205
     
    247208#define H_3D_ARP_WFNR                     3
    248209#endif
     210
    249211///// ***** DEPTH INTRA MODES *********
    250212#if H_3D_DIM
     
    256218                                              // HHI_DEPTH_INTRA_SEARCH_RAU_C0160
    257219                                              // LG_ZEROINTRADEPTHRESI_A0087
    258 #if H_3D_DIM_SDC
    259 #define LGE_SDC_REMOVE_DC_E0158           1   // Removal of DC mode from SDC
    260 #endif
    261 #if H_3D_DIM_DMM
    262 #define LGE_PKU_DMM3_OVERLAP_E0159_HHIFIX 1   // Removal of overlap between DMM3 and DMM1
    263 #endif
    264 #endif
    265 
     220#endif
    266221///// ***** VIEW SYNTHESIS PREDICTION *********
    267222#if H_3D_VSP
     
    273228#endif
    274229
     230#endif
     231
     232///// ***** ILLUMATION COMPENSATION *********
     233#if H_3D_IC
     234#define IC_REG_COST_SHIFT                 7
     235#define IC_CONST_SHIFT                    5
     236#define IC_SHIFT_DIFF                     12
     237#endif
     238
     239///// ***** FCO *********
     240#if H_3D_FCO
     241#define H_3D_FCO_VSP_DONBDV_E0163               1   // Adaptive depth reference for flexible coding order
     242#else
     243#define H_3D_FCO_VSP_DONBDV_E0163               0   // Adaptive depth reference for flexible coding order
    275244#endif
    276245
     
    300269#define TICKET_1090_FIX                             1
    301270
     271#if KWU_FIX_URQ
     272#if RATE_CONTROL_LAMBDA_DOMAIN
    302273#define RC_FIX                                      1  /// suggested fix for M0036
    303274#define RATE_CONTROL_INTRA                          1  ///< JCTVC-M0257, rate control for intra
     275#endif
     276#else
     277#define RC_FIX                                      1  /// suggested fix for M0036
     278#define RATE_CONTROL_INTRA                          1  ///< JCTVC-M0257, rate control for intra
     279#endif
     280
    304281
    305282#define MAX_CPB_CNT                     32  ///< Upper bound of (cpb_cnt_minus1 + 1)
     
    484461
    485462#if H_3D_VSO_DIST_INT
    486 #if H_3D_FIX_TICKET_036
    487463typedef       Int64            Dist;       ///< RDO distortion
    488 #else
    489 typedef       Int              Dist;       ///< RDO distortion
    490 #endif
    491464typedef       Int64            Dist64;
    492465#define       RDO_DIST_MIN     MIN_INT
     
    793766  enum ScalabilityType
    794767  {
    795 #if H_MV5
    796768#if H_3D
    797769    DEPTH_ID = 0,   
    798770#endif   
    799771    VIEW_ORDER_INDEX  = 1,
    800 #else
    801     VIEW_ID  = 0,
    802 #if H_3D
    803     DEPTH_ID = 1,   
    804 #endif   
    805 #endif
    806772  };
    807773#endif
Note: See TracChangeset for help on using the changeset viewer.