Changeset 608 in 3DVCSoftware for trunk/source/Lib/TLibDecoder/TDecCu.cpp


Ignore:
Timestamp:
1 Sep 2013, 22:47:26 (11 years ago)
Author:
tech
Message:

Merged DEV-2.0-dev0@604.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/source/Lib/TLibDecoder/TDecCu.cpp

    r443 r608  
    44 * granted under this license. 
    55 *
    6  * Copyright (c) 2010-2012, ITU/ISO/IEC
     6 * Copyright (c) 2010-2013, ITU/ISO/IEC
    77 * All rights reserved.
    88 *
     
    3838#include "TDecCu.h"
    3939
    40 #if RWTH_SDC_DLT_B0036
    41 #define GetDepthValue2Idx(val)     (pcCU->getSlice()->getSPS()->depthValue2idx(val))
    42 #define GetIdx2DepthValue(val)     (pcCU->getSlice()->getSPS()->idx2DepthValue(val))
    43 #endif
    44 
    4540//! \ingroup TLibDecoder
    4641//! \{
     
    5449  m_ppcYuvResi = NULL;
    5550  m_ppcYuvReco = NULL;
    56 #if H3D_IVRP & !QC_ARP_D0177
    57   m_ppcYuvResPred = NULL;
    58 #endif
    5951  m_ppcCU      = NULL;
    6052}
     
    8274  m_ppcYuvResi = new TComYuv*[m_uiMaxDepth-1];
    8375  m_ppcYuvReco = new TComYuv*[m_uiMaxDepth-1];
    84 #if H3D_IVRP & !QC_ARP_D0177
    85   m_ppcYuvResPred = new TComYuv*   [m_uiMaxDepth-1];
    86 #endif
    8776  m_ppcCU      = new TComDataCU*[m_uiMaxDepth-1];
    8877 
     
    9685    m_ppcYuvResi[ui] = new TComYuv;    m_ppcYuvResi[ui]->create( uiWidth, uiHeight );
    9786    m_ppcYuvReco[ui] = new TComYuv;    m_ppcYuvReco[ui]->create( uiWidth, uiHeight );
    98 #if H3D_IVRP & !QC_ARP_D0177
    99     m_ppcYuvResPred[ui] = new TComYuv;    m_ppcYuvResPred[ui]->create( uiWidth, uiHeight );
    100 #endif
    10187    m_ppcCU     [ui] = new TComDataCU; m_ppcCU     [ui]->create( uiNumPartitions, uiWidth, uiHeight, true, uiMaxWidth >> (m_uiMaxDepth - 1) );
    10288  }
     
    11197  // initialize conversion matrix from partition index to pel
    11298  initRasterToPelXY( uiMaxWidth, uiMaxHeight, m_uiMaxDepth );
    113   initMotionReferIdx ( uiMaxWidth, uiMaxHeight, m_uiMaxDepth );
    11499}
    115100
     
    120105    m_ppcYuvResi[ui]->destroy(); delete m_ppcYuvResi[ui]; m_ppcYuvResi[ui] = NULL;
    121106    m_ppcYuvReco[ui]->destroy(); delete m_ppcYuvReco[ui]; m_ppcYuvReco[ui] = NULL;
    122 #if H3D_IVRP & !QC_ARP_D0177
    123     m_ppcYuvResPred[ui]->destroy(); delete m_ppcYuvResPred[ui]; m_ppcYuvResPred[ui] = NULL;
    124 #endif
    125107    m_ppcCU     [ui]->destroy(); delete m_ppcCU     [ui]; m_ppcCU     [ui] = NULL;
    126108  }
     
    128110  delete [] m_ppcYuvResi; m_ppcYuvResi = NULL;
    129111  delete [] m_ppcYuvReco; m_ppcYuvReco = NULL;
    130 #if H3D_IVRP & !QC_ARP_D0177
    131   delete [] m_ppcYuvResPred; m_ppcYuvResPred = NULL;
    132 #endif
    133112  delete [] m_ppcCU     ; m_ppcCU      = NULL;
    134113}
     
    148127  }
    149128
    150   pcCU->setNumSucIPCM(0);
    151 
    152129  // start from the top level CU
    153130  xDecodeCU( pcCU, 0, 0, ruiIsLast);
     
    158135Void TDecCu::decompressCU( TComDataCU* pcCU )
    159136{
    160   xDecompressCU( pcCU, pcCU, 0,  0 );
     137  xDecompressCU( pcCU, 0,  0 );
    161138}
    162139
     
    171148 * \returns Bool
    172149 */
    173 Bool TDecCu::xDecodeSliceEnd( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth) {
     150Bool TDecCu::xDecodeSliceEnd( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth)
     151{
    174152  UInt uiIsLast;
    175153  TComPic* pcPic = pcCU->getPic();
     
    178156  UInt uiWidth = pcSlice->getSPS()->getPicWidthInLumaSamples();
    179157  UInt uiHeight = pcSlice->getSPS()->getPicHeightInLumaSamples();
    180   UInt uiGranularityWidth = g_uiMaxCUWidth>>(pcSlice->getPPS()->getSliceGranularity());
     158  UInt uiGranularityWidth = g_uiMaxCUWidth;
    181159  UInt uiPosX = pcCU->getCUPelX() + g_auiRasterToPelX[ g_auiZscanToRaster[uiAbsPartIdx] ];
    182160  UInt uiPosY = pcCU->getCUPelY() + g_auiRasterToPelY[ g_auiZscanToRaster[uiAbsPartIdx] ];
    183161
    184 #if HHI_MPI
    185   const UInt uiCUWidth  = pcCU->getTextureModeDepth( uiAbsPartIdx ) != -1 ? g_uiMaxCUWidth>>uiDepth  : pcCU->getWidth (uiAbsPartIdx);
    186   const UInt uiCUHeight = pcCU->getTextureModeDepth( uiAbsPartIdx ) != -1 ? g_uiMaxCUHeight>>uiDepth : pcCU->getHeight(uiAbsPartIdx);
    187   if(((uiPosX+uiCUWidth)%uiGranularityWidth==0||(uiPosX+uiCUWidth==uiWidth))
    188     &&((uiPosY+uiCUHeight)%uiGranularityWidth==0||(uiPosY+uiCUHeight==uiHeight)))
    189 #else
    190162  if(((uiPosX+pcCU->getWidth(uiAbsPartIdx))%uiGranularityWidth==0||(uiPosX+pcCU->getWidth(uiAbsPartIdx)==uiWidth))
    191163    &&((uiPosY+pcCU->getHeight(uiAbsPartIdx))%uiGranularityWidth==0||(uiPosY+pcCU->getHeight(uiAbsPartIdx)==uiHeight)))
    192 #endif
    193164  {
    194165    m_pcEntropyDecoder->decodeTerminatingBit( uiIsLast );
     
    201172  if(uiIsLast)
    202173  {
    203     if(pcSlice->isNextEntropySlice()&&!pcSlice->isNextSlice())
    204     {
    205       pcSlice->setEntropySliceCurEndCUAddr(pcCU->getSCUAddr()+uiAbsPartIdx+uiCurNumParts);
     174    if(pcSlice->isNextSliceSegment()&&!pcSlice->isNextSlice())
     175    {
     176      pcSlice->setSliceSegmentCurEndCUAddr(pcCU->getSCUAddr()+uiAbsPartIdx+uiCurNumParts);
    206177    }
    207178    else
    208179    {
    209180      pcSlice->setSliceCurEndCUAddr(pcCU->getSCUAddr()+uiAbsPartIdx+uiCurNumParts);
    210       pcSlice->setEntropySliceCurEndCUAddr(pcCU->getSCUAddr()+uiAbsPartIdx+uiCurNumParts);
     181      pcSlice->setSliceSegmentCurEndCUAddr(pcCU->getSCUAddr()+uiAbsPartIdx+uiCurNumParts);
    211182    }
    212183  }
     
    233204  UInt uiTPelY   = pcCU->getCUPelY() + g_auiRasterToPelY[ g_auiZscanToRaster[uiAbsPartIdx] ];
    234205  UInt uiBPelY   = uiTPelY + (g_uiMaxCUHeight>>uiDepth) - 1;
    235 
     206#if H_MV_ENC_DEC_TRAC
     207  DTRACE_CU_S("=========== coding_quadtree ===========\n")
     208  DTRACE_CU("x0", uiLPelX)
     209  DTRACE_CU("x1", uiTPelY)
     210  DTRACE_CU("log2CbSize", g_uiMaxCUWidth>>uiDepth)
     211  DTRACE_CU("cqtDepth"  , uiDepth)
     212#endif
    236213  TComSlice * pcSlice = pcCU->getPic()->getSlice(pcCU->getPic()->getCurrSliceIdx());
    237   Bool bStartInCU = pcCU->getSCUAddr()+uiAbsPartIdx+uiCurNumParts>pcSlice->getEntropySliceCurStartCUAddr()&&pcCU->getSCUAddr()+uiAbsPartIdx<pcSlice->getEntropySliceCurStartCUAddr();
     214  Bool bStartInCU = pcCU->getSCUAddr()+uiAbsPartIdx+uiCurNumParts>pcSlice->getSliceSegmentCurStartCUAddr()&&pcCU->getSCUAddr()+uiAbsPartIdx<pcSlice->getSliceSegmentCurStartCUAddr();
    238215  if((!bStartInCU) && ( uiRPelX < pcSlice->getSPS()->getPicWidthInLumaSamples() ) && ( uiBPelY < pcSlice->getSPS()->getPicHeightInLumaSamples() ) )
    239216  {
    240     if(pcCU->getNumSucIPCM() == 0)
    241     {
    242 #if HHI_MPI
    243       if( pcCU->getTextureModeDepth( uiAbsPartIdx ) == -1 || uiDepth < pcCU->getTextureModeDepth( uiAbsPartIdx ) )
    244 #endif
    245       m_pcEntropyDecoder->decodeSplitFlag( pcCU, uiAbsPartIdx, uiDepth );
    246     }
    247     else
    248     {
    249       pcCU->setDepthSubParts( uiDepth, uiAbsPartIdx );
    250     }
     217    m_pcEntropyDecoder->decodeSplitFlag( pcCU, uiAbsPartIdx, uiDepth );
    251218  }
    252219  else
     
    269236      uiTPelY   = pcCU->getCUPelY() + g_auiRasterToPelY[ g_auiZscanToRaster[uiIdx] ];
    270237     
    271       Bool bSubInSlice = pcCU->getSCUAddr()+uiIdx+uiQNumParts>pcSlice->getEntropySliceCurStartCUAddr();
     238      Bool bSubInSlice = pcCU->getSCUAddr()+uiIdx+uiQNumParts>pcSlice->getSliceSegmentCurStartCUAddr();
    272239      if ( bSubInSlice )
    273240      {
    274         if ( ( uiLPelX < pcCU->getSlice()->getSPS()->getPicWidthInLumaSamples() ) && ( uiTPelY < pcCU->getSlice()->getSPS()->getPicHeightInLumaSamples() ) )
     241        if ( !ruiIsLast && ( uiLPelX < pcCU->getSlice()->getSPS()->getPicWidthInLumaSamples() ) && ( uiTPelY < pcCU->getSlice()->getSPS()->getPicHeightInLumaSamples() ) )
    275242        {
    276243          xDecodeCU( pcCU, uiIdx, uiDepth+1, ruiIsLast );
     
    281248        }
    282249      }
    283       if(ruiIsLast)
    284       {
    285         break;
    286       }
    287250     
    288251      uiIdx += uiQNumParts;
     
    293256      {
    294257        UInt uiQPSrcPartIdx;
    295         if ( pcPic->getCU( pcCU->getAddr() )->getEntropySliceStartCU(uiAbsPartIdx) != pcSlice->getEntropySliceCurStartCUAddr() )
     258        if ( pcPic->getCU( pcCU->getAddr() )->getSliceSegmentStartCU(uiAbsPartIdx) != pcSlice->getSliceSegmentCurStartCUAddr() )
    296259        {
    297           uiQPSrcPartIdx = pcSlice->getEntropySliceCurStartCUAddr() % pcPic->getNumPartInCU();
     260          uiQPSrcPartIdx = pcSlice->getSliceSegmentCurStartCUAddr() % pcPic->getNumPartInCU();
    298261        }
    299262        else
     
    307270  }
    308271 
     272#if H_MV_ENC_DEC_TRAC
     273  DTRACE_CU_S("=========== coding_unit ===========\n")
     274#endif
     275
    309276  if( (g_uiMaxCUWidth>>uiDepth) >= pcCU->getSlice()->getPPS()->getMinCuDQPSize() && pcCU->getSlice()->getPPS()->getUseDQP())
    310277  {
     
    312279    pcCU->setQPSubParts( pcCU->getRefQP(uiAbsPartIdx), uiAbsPartIdx, uiDepth ); // set QP to default QP
    313280  }
    314 #if QC_CU_NBDV_D0181
    315       DisInfo DvInfo;
    316       DvInfo.bDV = false;
    317       if(!pcCU->getSlice()->isIntra())
    318       {
    319 #if QC_ARP_D0177
    320         if(( pcCU->getSlice()->getSPS()->getMultiviewMvPredMode() || pcCU->getSlice()->getSPS()->getUseAdvRP())             && pcCU->getSlice()->getViewId())
     281#if H_3D_NBDV
     282  DisInfo DvInfo;
     283  DvInfo.bDV = false;
     284  DvInfo.m_acNBDV.setZero();
     285  DvInfo.m_aVIdxCan = 0;
     286#if H_3D_NBDV_REF 
     287  DvInfo.m_acDoNBDV.setZero();
     288#endif
     289 
     290 
     291  if(!pcCU->getSlice()->isIntra())
     292  {
     293#if H_3D_ARP && H_3D_IV_MERGE
     294    if( pcCU->getSlice()->getVPS()->getUseAdvRP( pcCU->getSlice()->getLayerId() ) || pcCU->getSlice()->getVPS()->getIvMvPredFlag( pcCU->getSlice()->getLayerId() ))
     295#else
     296#if H_3D_ARP
     297    if( pcCU->getSlice()->getVPS()->getUseAdvRP(pcCU->getSlice()->getLayerId()) )
    321298#else
    322         if(( pcCU->getSlice()->getSPS()->getMultiviewMvPredMode() || pcCU->getSlice()->getSPS()->getMultiviewResPredMode()) && pcCU->getSlice()->getViewId())
    323 #endif
    324         { 
    325           m_ppcCU[uiDepth]->copyInterPredInfoFrom( pcCU, uiAbsPartIdx, REF_PIC_LIST_0, true );
    326           m_ppcCU[uiDepth]->copyDVInfoFrom( pcCU, uiAbsPartIdx);
    327           PartSize ePartTemp = m_ppcCU[uiDepth]->getPartitionSize(0);
    328           UChar cWidTemp     = m_ppcCU[uiDepth]->getWidth(0);
    329           UChar cHeightTemp  = m_ppcCU[uiDepth]->getHeight(0);
    330           m_ppcCU[uiDepth]->setWidth  ( 0, pcCU->getSlice()->getSPS()->getMaxCUWidth ()/(1<<uiDepth)  );
    331           m_ppcCU[uiDepth]->setHeight ( 0, pcCU->getSlice()->getSPS()->getMaxCUHeight()/(1<<uiDepth)  );
    332           m_ppcCU[uiDepth]->setPartSizeSubParts( SIZE_2Nx2N, 0, uiDepth );     
    333   #if MERL_VSP_C0152
    334           DvInfo.bDV = m_ppcCU[uiDepth]->getDisMvpCandNBDV(0, 0, &DvInfo, false, true);
    335   #else
    336           DvInfo.bDV = m_ppcCU[uiDepth]->getDisMvpCandNBDV(0, 0, &DvInfo, false);
    337   #endif
    338           pcCU->setDvInfoSubParts(DvInfo, uiAbsPartIdx, uiDepth);
    339           m_ppcCU[uiDepth]->setPartSizeSubParts( ePartTemp, 0, uiDepth );
    340           m_ppcCU[uiDepth]->setWidth  ( 0, cWidTemp );
    341           m_ppcCU[uiDepth]->setHeight ( 0, cHeightTemp );
    342         }
    343         if(DvInfo.bDV==false)
    344         {
    345           DvInfo.iN=1;
    346 #if !SEC_DEFAULT_DV_D0112
    347           DvInfo.m_acMvCand[0].setHor(0);
    348           DvInfo.m_acMvCand[0].setVer(0);
    349           DvInfo.m_aVIdxCan[0] = 0;
    350 #endif
    351           pcCU->setDvInfoSubParts(DvInfo, uiAbsPartIdx, uiDepth);
    352         }
    353       }
    354 #endif
     299#if H_3D_IV_MERGE
     300    if( pcCU->getSlice()->getVPS()->getIvMvPredFlag(pcCU->getSlice()->getLayerId()) )
     301#else
     302    if (0)
     303#endif
     304#endif
     305#endif
     306    {
     307      m_ppcCU[uiDepth]->copyInterPredInfoFrom( pcCU, uiAbsPartIdx, REF_PIC_LIST_0, true );
     308      m_ppcCU[uiDepth]->copyDVInfoFrom( pcCU, uiAbsPartIdx);
     309      PartSize ePartTemp = m_ppcCU[uiDepth]->getPartitionSize(0);
     310      UChar cWidTemp     = m_ppcCU[uiDepth]->getWidth(0);
     311      UChar cHeightTemp  = m_ppcCU[uiDepth]->getHeight(0);
     312      m_ppcCU[uiDepth]->setWidth  ( 0, pcCU->getSlice()->getSPS()->getMaxCUWidth ()/(1<<uiDepth)  );
     313      m_ppcCU[uiDepth]->setHeight ( 0, pcCU->getSlice()->getSPS()->getMaxCUHeight()/(1<<uiDepth)  );
     314      m_ppcCU[uiDepth]->setPartSizeSubParts( SIZE_2Nx2N, 0, uiDepth );     
     315#if H_3D_NBDV_REF
     316      if(pcCU->getSlice()->getVPS()->getDepthRefinementFlag( pcCU->getSlice()->getLayerIdInVps() ))  //Notes from QC: please check the condition for DoNBDV. Remove this comment once it is done.
     317        DvInfo.bDV = m_ppcCU[uiDepth]->getDisMvpCandNBDV(&DvInfo, true);
     318      else
     319#endif
     320        DvInfo.bDV = m_ppcCU[uiDepth]->getDisMvpCandNBDV(&DvInfo);
     321
     322      pcCU->setDvInfoSubParts(DvInfo, uiAbsPartIdx, uiDepth);
     323      m_ppcCU[uiDepth]->setPartSizeSubParts( ePartTemp, 0, uiDepth );
     324      m_ppcCU[uiDepth]->setWidth  ( 0, cWidTemp );
     325      m_ppcCU[uiDepth]->setHeight ( 0, cHeightTemp );
     326     }
     327  }
     328#endif
     329  if (pcCU->getSlice()->getPPS()->getTransquantBypassEnableFlag())
     330  {
     331    m_pcEntropyDecoder->decodeCUTransquantBypassFlag( pcCU, uiAbsPartIdx, uiDepth );
     332  }
     333 
    355334  // decode CU mode and the partition size
    356   if( !pcCU->getSlice()->isIntra() && pcCU->getNumSucIPCM() == 0 )
    357 #if HHI_MPI
    358   if( pcCU->getTextureModeDepth( uiAbsPartIdx ) == -1 )
    359 #endif
     335  if( !pcCU->getSlice()->isIntra())
    360336  {
    361337    m_pcEntropyDecoder->decodeSkipFlag( pcCU, uiAbsPartIdx, uiDepth );
     
    364340  if( pcCU->isSkipped(uiAbsPartIdx) )
    365341  {
     342#if H_MV_ENC_DEC_TRAC
     343    DTRACE_PU_S("=========== prediction_unit ===========\n")
     344    DTRACE_PU("x0", uiLPelX)
     345    DTRACE_PU("x1", uiTPelY)
     346#endif
    366347    m_ppcCU[uiDepth]->copyInterPredInfoFrom( pcCU, uiAbsPartIdx, REF_PIC_LIST_0 );
    367348    m_ppcCU[uiDepth]->copyInterPredInfoFrom( pcCU, uiAbsPartIdx, REF_PIC_LIST_1 );
    368 #if H3D_IVMP
     349#if H_3D_IV_MERGE
     350    m_ppcCU[uiDepth]->copyDVInfoFrom(pcCU, uiAbsPartIdx);
    369351    TComMvField cMvFieldNeighbours[MRG_MAX_NUM_CANDS_MEM << 1]; // double length for mv of both lists
    370352    UChar uhInterDirNeighbours[MRG_MAX_NUM_CANDS_MEM];
    371     Int numValidMergeCand = 0;
    372     for( UInt ui = 0; ui < MRG_MAX_NUM_CANDS_MEM; ++ui )
    373353#else
    374354    TComMvField cMvFieldNeighbours[MRG_MAX_NUM_CANDS << 1]; // double length for mv of both lists
    375355    UChar uhInterDirNeighbours[MRG_MAX_NUM_CANDS];
     356#endif
    376357    Int numValidMergeCand = 0;
    377     for( UInt ui = 0; ui < MRG_MAX_NUM_CANDS; ++ui )
    378 #endif
     358    for( UInt ui = 0; ui < m_ppcCU[uiDepth]->getSlice()->getMaxNumMergeCand(); ++ui )
    379359    {
    380360      uhInterDirNeighbours[ui] = 0;
    381361    }
    382     m_pcEntropyDecoder->decodeMergeIndex( pcCU, 0, uiAbsPartIdx, SIZE_2Nx2N, uhInterDirNeighbours, cMvFieldNeighbours, uiDepth );
    383 #if HHI_MPI
    384     if( pcCU->getTextureModeDepth( uiAbsPartIdx ) == uiDepth )
    385     {
    386       TComDataCU *pcTextureCU = pcCU->getSlice()->getTexturePic()->getCU( pcCU->getAddr() );
    387       pcCU->copyTextureMotionDataFrom( pcTextureCU, uiDepth, pcCU->getZorderIdxInCU() + uiAbsPartIdx, uiAbsPartIdx );
    388 
    389       UInt uiCurrPartNumb = pcCU->getPic()->getNumPartInCU() >> (uiDepth << 1);
    390 
    391       for( UInt ui = 0; ui < uiCurrPartNumb; ui++ )
    392       {
    393         const UChar uhNewDepth = max<UInt>( uiDepth, pcTextureCU->getDepth( uiAbsPartIdx + ui ) );
    394 #if MERL_VSP_C0152
    395         Int vspIdx = pcTextureCU->getVSPIndex( uiAbsPartIdx + ui );
    396         pcCU->setVSPIndex( uiAbsPartIdx + ui, vspIdx );
    397 #endif
    398 #if MERL_VSP_NBDV_RefVId_Fix_D0166
    399         Int vspDir = pcTextureCU->getVSPDir( uiAbsPartIdx + ui );
    400         pcCU->setVSPDir( uiAbsPartIdx + ui, vspDir );
    401 #endif
    402         pcCU->setPredictionMode( uiAbsPartIdx + ui, MODE_SKIP );
    403         pcCU->setPartitionSize( uiAbsPartIdx + ui, SIZE_2Nx2N );
    404         pcCU->setDepth( uiAbsPartIdx + ui, uhNewDepth );
    405         pcCU->setWidth( uiAbsPartIdx + ui, g_uiMaxCUWidth>>uhNewDepth );
    406         pcCU->setHeight( uiAbsPartIdx + ui, g_uiMaxCUHeight>>uhNewDepth );
    407       }
    408 #if LGE_ILLUCOMP_DEPTH_C0046
    409       m_pcEntropyDecoder->decodeICFlag( pcCU, uiAbsPartIdx, uiDepth );
    410 #endif
    411     }
    412     else
    413     {
    414 #endif
     362    m_pcEntropyDecoder->decodeMergeIndex( pcCU, 0, uiAbsPartIdx, uiDepth );
    415363    UInt uiMergeIndex = pcCU->getMergeIndex(uiAbsPartIdx);
    416 #if MERL_VSP_C0152
    417 #if LGE_VSP_INHERIT_D0092
    418     Int iVSPIndexTrue[MRG_MAX_NUM_CANDS_MEM];
    419     for (Int i=0; i<MRG_MAX_NUM_CANDS_MEM; i++)
    420     {
    421         iVSPIndexTrue[i] = 0;
    422     }
     364
     365#if H_3D_VSP
     366    Int vspFlag[MRG_MAX_NUM_CANDS_MEM];
     367    memset(vspFlag, 0, sizeof(Int)*MRG_MAX_NUM_CANDS_MEM);
     368#if MTK_VSP_FIX_ALIGN_WD_E0172
     369    InheritedVSPDisInfo inheritedVSPDisInfo[MRG_MAX_NUM_CANDS_MEM];
     370    m_ppcCU[uiDepth]->getInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours, vspFlag, inheritedVSPDisInfo, numValidMergeCand, uiMergeIndex );
    423371#else
    424     Int iVSPIndexTrue[3] = {-1, -1, -1};
    425 #endif
    426 #if MERL_VSP_NBDV_RefVId_Fix_D0166
    427     Int iVSPDirTrue[3]   = {-1, -1, -1};
    428     m_ppcCU[uiDepth]->getInterMergeCandidates( 0, 0, uiDepth, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand, iVSPIndexTrue, iVSPDirTrue, uiMergeIndex );
     372#if MTK_VSP_FIX_E0172
     373    Int vspDir[MRG_MAX_NUM_CANDS_MEM];
     374    memset(vspDir, 0, sizeof(Int)*MRG_MAX_NUM_CANDS_MEM);
     375    m_ppcCU[uiDepth]->getInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours, vspFlag,vspDir, numValidMergeCand, uiMergeIndex );
     376    pcCU->setVSPDirSubParts( vspDir[uiMergeIndex], uiAbsPartIdx, 0, uiDepth );
    429377#else
    430     m_ppcCU[uiDepth]->getInterMergeCandidates( 0, 0, uiDepth, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand, iVSPIndexTrue, uiMergeIndex );
    431 #endif
    432 #if MTK_D0156
    433     if( !pcCU->getSlice()->getSPS()->getUseVSPCompensation() )
    434     {
    435         pcCU->setVSPIndexSubParts( 0, uiAbsPartIdx, 0, uiDepth );
    436     }
    437     else
    438 #endif
    439     {
    440       Int iVSPIdx = 0;
    441 #if LGE_VSP_INHERIT_D0092
    442       if (iVSPIndexTrue[uiMergeIndex] == 1)
    443       {
    444           iVSPIdx = 1;
    445       }
     378    m_ppcCU[uiDepth]->getInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours, vspFlag, numValidMergeCand, uiMergeIndex );
     379#endif
     380#endif// end of MTK_VSP_FIX_ALIGN_WD_E0172
     381    pcCU->setVSPFlagSubParts( vspFlag[uiMergeIndex], uiAbsPartIdx, 0, uiDepth );
    446382#else
    447       Int numVspIdx;
    448       numVspIdx = 3;
    449       for (Int i = 0; i < numVspIdx; i++)
    450       {
    451         if (iVSPIndexTrue[i] == uiMergeIndex)
    452           {
    453             iVSPIdx = i+1;
    454             break;
    455           }
    456       }
    457 #endif
    458       pcCU->setVSPIndexSubParts( iVSPIdx, uiAbsPartIdx, 0, uiDepth );  // Initialize
    459 #if MERL_VSP_NBDV_RefVId_Fix_D0166
    460       pcCU->setVSPDirSubParts( 0, uiAbsPartIdx, 0, uiDepth );
    461 #endif
    462 #if QC_BVSP_CleanUP_D0191 && !LGE_VSP_INHERIT_D0092
    463       if(iVSPIdx != 0)
    464       {
    465         Int iIVCIdx = pcCU->getSlice()->getRefPic(REF_PIC_LIST_0, 0)->getPOC()==pcCU->getSlice()->getPOC() ? 0: pcCU->getSlice()->getNewRefIdx(REF_PIC_LIST_0);
    466        cMvFieldNeighbours[ 2*uiMergeIndex].setRefIdx(iIVCIdx);
    467       }
    468 #endif
    469     }
    470 #else
    471     m_ppcCU[uiDepth]->getInterMergeCandidates( 0, 0, uiDepth, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand, uiMergeIndex );
     383    m_ppcCU[uiDepth]->getInterMergeCandidates( 0, 0, cMvFieldNeighbours, uhInterDirNeighbours, numValidMergeCand, uiMergeIndex );
     384#endif
     385#if MTK_VSP_FIX_ALIGN_WD_E0172
     386    if(vspFlag[uiMergeIndex])
     387    {
     388      pcCU->setDvInfoSubParts(inheritedVSPDisInfo[uiMergeIndex].m_acDvInfo, uiAbsPartIdx, 0, uiDepth);
     389    }
    472390#endif
    473391    pcCU->setInterDirSubParts( uhInterDirNeighbours[uiMergeIndex], uiAbsPartIdx, 0, uiDepth );
     
    484402      }
    485403    }
    486 #if LGE_ILLUCOMP_B0045
     404#if H_3D_IC
    487405    m_pcEntropyDecoder->decodeICFlag( pcCU, uiAbsPartIdx, uiDepth );
    488406#endif
    489 #if HHI_MPI
    490     }
    491 #endif
    492 #if QC_ARP_D0177
    493     if( pcCU->getSlice()->getSPS()->getUseAdvRP() )
    494     {
    495       pcCU->setResPredAvailSubParts ( false, uiAbsPartIdx, 0, uiDepth );
    496       pcCU->setResPredFlagSubParts  ( false, uiAbsPartIdx, 0, uiDepth );
    497       m_pcEntropyDecoder->decodeARPW( pcCU , uiAbsPartIdx , uiDepth, m_ppcCU[uiDepth], 0 );
    498     }
     407#if H_3D_ARP
     408    m_pcEntropyDecoder->decodeARPW( pcCU , uiAbsPartIdx , uiDepth );
    499409#endif
    500410    xFinishDecodeCU( pcCU, uiAbsPartIdx, uiDepth, ruiIsLast );
     
    502412  }
    503413
    504 #if HHI_MPI
    505   if( pcCU->getTextureModeDepth( uiAbsPartIdx ) == -1 )
    506   {
    507 #endif
    508   if( pcCU->getNumSucIPCM() == 0 )
    509   {
    510     m_pcEntropyDecoder->decodePredMode( pcCU, uiAbsPartIdx, uiDepth );
    511     m_pcEntropyDecoder->decodePartSize( pcCU, uiAbsPartIdx, uiDepth );
    512   }
    513   else
    514   {
    515     pcCU->setPredModeSubParts( MODE_INTRA, uiAbsPartIdx, uiDepth );
    516     pcCU->setPartSizeSubParts( SIZE_2Nx2N, uiAbsPartIdx, uiDepth );
    517     pcCU->setSizeSubParts( g_uiMaxCUWidth>>uiDepth, g_uiMaxCUHeight>>uiDepth, uiAbsPartIdx, uiDepth );
    518     pcCU->setTrIdxSubParts( 0, uiAbsPartIdx, uiDepth );
    519   }
     414  m_pcEntropyDecoder->decodePredMode( pcCU, uiAbsPartIdx, uiDepth );
     415  m_pcEntropyDecoder->decodePartSize( pcCU, uiAbsPartIdx, uiDepth );
    520416
    521417  if (pcCU->isIntra( uiAbsPartIdx ) && pcCU->getPartitionSize( uiAbsPartIdx ) == SIZE_2Nx2N )
     
    530426  }
    531427
    532 #if ! HHI_MPI
    533428  UInt uiCurrWidth      = pcCU->getWidth ( uiAbsPartIdx );
    534429  UInt uiCurrHeight     = pcCU->getHeight( uiAbsPartIdx );
    535 #endif
    536430 
    537431  // prediction mode ( Intra : direction mode, Inter : Mv, reference idx )
    538432  m_pcEntropyDecoder->decodePredInfo( pcCU, uiAbsPartIdx, uiDepth, m_ppcCU[uiDepth]);
    539  
    540 #if LGE_ILLUCOMP_B0045
    541 #if LGE_ILLUCOMP_DEPTH_C0046 && HHI_MPI
    542   if( pcCU->getTextureModeDepth( uiAbsPartIdx ) != uiDepth )
    543   {
    544 #endif
     433#if H_3D_IC
    545434  m_pcEntropyDecoder->decodeICFlag( pcCU, uiAbsPartIdx, uiDepth );
    546435#endif
    547 
    548 #if LGE_ILLUCOMP_DEPTH_C0046 && HHI_MPI
    549   }
    550 #endif
    551 #if QC_ARP_D0177
    552   if (pcCU->getSlice()->getSPS()->getUseAdvRP() && pcCU->isIntra( uiAbsPartIdx ) )
    553   {
    554     pcCU->setResPredAvailSubParts ( 0, uiAbsPartIdx, 0, uiDepth );
    555     pcCU->setResPredFlagSubParts  ( 0, uiAbsPartIdx, 0, uiDepth );
    556   }
    557 #endif
    558 #if HHI_MPI
    559     if( pcCU->getTextureModeDepth( uiAbsPartIdx ) == uiDepth )
    560     {
    561       assert( pcCU->getZorderIdxInCU() == 0 );
    562       TComDataCU *pcTextureCU = pcCU->getSlice()->getTexturePic()->getCU( pcCU->getAddr() );
    563       pcCU->copyTextureMotionDataFrom( pcTextureCU, uiDepth, pcCU->getZorderIdxInCU() + uiAbsPartIdx, uiAbsPartIdx );
    564 
    565       UInt uiCurrPartNumb = pcCU->getPic()->getNumPartInCU() >> (uiDepth << 1);
    566 
    567       for( UInt ui = 0; ui < uiCurrPartNumb; ui++ )
    568       {
    569         const UChar uhNewDepth = max<UInt>( uiDepth, pcTextureCU->getDepth( uiAbsPartIdx + ui ) );
    570 #if MERL_VSP_C0152
    571         Int vspIdx = pcTextureCU->getVSPIndex( uiAbsPartIdx + ui);
    572         pcCU->setVSPIndex( uiAbsPartIdx + ui, vspIdx);
    573 #endif
    574 #if MERL_VSP_NBDV_RefVId_Fix_D0166
    575         if (pcCU->getSlice()->getIsDepth()) {
    576           pcCU->setVSPDir( uiAbsPartIdx + ui, 0);
    577         }
    578         else {
    579           Int vspDir = pcTextureCU->getVSPDir( uiAbsPartIdx + ui);
    580           pcCU->setVSPDir( uiAbsPartIdx + ui, vspDir);
    581         }
    582 #endif
    583         pcCU->setPredictionMode( uiAbsPartIdx + ui, MODE_INTER );
    584         pcCU->setPartitionSize( uiAbsPartIdx + ui, SIZE_2Nx2N );
    585         pcCU->setDepth( uiAbsPartIdx + ui, uhNewDepth );
    586         pcCU->setWidth( uiAbsPartIdx + ui, g_uiMaxCUWidth>>uhNewDepth );
    587         pcCU->setHeight( uiAbsPartIdx + ui, g_uiMaxCUHeight>>uhNewDepth );
    588       }
    589 #if LGE_ILLUCOMP_DEPTH_C0046
    590       m_pcEntropyDecoder->decodeICFlag( pcCU, uiAbsPartIdx, uiDepth );
    591 #endif
    592       if( ( ( uiDepth < pcCU->getDepth( uiAbsPartIdx ) ) && ( uiDepth < g_uiMaxCUDepth - g_uiAddCUDepth ) ) || bBoundary )
    593       {
    594         UInt uiIdx = uiAbsPartIdx;
    595         if( (g_uiMaxCUWidth>>uiDepth) == pcCU->getSlice()->getPPS()->getMinCuDQPSize() && pcCU->getSlice()->getPPS()->getUseDQP())
    596         {
    597           setdQPFlag(true);
    598           pcCU->setQPSubParts( pcCU->getRefQP(uiAbsPartIdx), uiAbsPartIdx, uiDepth ); // set QP to default QP
    599         }
    600 
    601         for ( UInt uiPartUnitIdx = 0; uiPartUnitIdx < 4; uiPartUnitIdx++ )
    602         {
    603           uiLPelX   = pcCU->getCUPelX() + g_auiRasterToPelX[ g_auiZscanToRaster[uiIdx] ];
    604           uiTPelY   = pcCU->getCUPelY() + g_auiRasterToPelY[ g_auiZscanToRaster[uiIdx] ];
    605 
    606           Bool bSubInSlice = pcCU->getSCUAddr()+uiIdx+uiQNumParts>pcSlice->getEntropySliceCurStartCUAddr();
    607           if ( bSubInSlice )
    608           {
    609             if ( ( uiLPelX < pcCU->getSlice()->getSPS()->getPicWidthInLumaSamples() ) && ( uiTPelY < pcCU->getSlice()->getSPS()->getPicHeightInLumaSamples() ) )
    610             {
    611               xDecodeCU( pcCU, uiIdx, uiDepth+1, ruiIsLast );
    612             }
    613             else
    614             {
    615               pcCU->setOutsideCUPart( uiIdx, uiDepth+1 );
    616             }
    617           }
    618           if(ruiIsLast)
    619           {
    620             break;
    621           }
    622           uiIdx += uiQNumParts;
    623         }
    624         if( (g_uiMaxCUWidth>>uiDepth) == pcCU->getSlice()->getPPS()->getMinCuDQPSize() && pcCU->getSlice()->getPPS()->getUseDQP())
    625         {
    626           if ( getdQPFlag() )
    627           {
    628             UInt uiQPSrcPartIdx;
    629             if ( pcPic->getCU( pcCU->getAddr() )->getEntropySliceStartCU(uiAbsPartIdx) != pcSlice->getEntropySliceCurStartCUAddr() )
    630             {
    631               uiQPSrcPartIdx = pcSlice->getEntropySliceCurStartCUAddr() % pcPic->getNumPartInCU();
    632             }
    633             else
    634             {
    635               uiQPSrcPartIdx = uiAbsPartIdx;
    636             }
    637             pcCU->setQPSubParts( pcCU->getRefQP( uiQPSrcPartIdx ), uiAbsPartIdx, uiDepth ); // set QP to default QP
    638           }
    639         }
    640         return;
    641       }
    642     }
    643   }
    644 
    645   UInt uiCurrWidth      = pcCU->getWidth ( uiAbsPartIdx );
    646   UInt uiCurrHeight     = pcCU->getHeight( uiAbsPartIdx );
    647 #endif
    648 
     436#if H_3D_ARP
     437  m_pcEntropyDecoder->decodeARPW    ( pcCU , uiAbsPartIdx , uiDepth ); 
     438#endif 
     439#if LGE_INTER_SDC_E0156
     440  m_pcEntropyDecoder->decodeInterSDCFlag( pcCU, uiAbsPartIdx, uiDepth );
     441#endif
    649442  // Coefficient decoding
    650443  Bool bCodeDQP = getdQPFlag();
     
    656449Void TDecCu::xFinishDecodeCU( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt& ruiIsLast)
    657450{
    658   if( (g_uiMaxCUWidth>>uiDepth) >= pcCU->getSlice()->getPPS()->getMinCuDQPSize() && pcCU->getSlice()->getPPS()->getUseDQP())
    659   {
    660     if( getdQPFlag() )
    661     {
    662       pcCU->setQPSubParts( pcCU->getRefQP(uiAbsPartIdx), uiAbsPartIdx, uiDepth ); // set QP to default QP
    663     }
    664   }
    665 
    666   if( pcCU->getNumSucIPCM() > 0 )
    667   {
    668     ruiIsLast = 0;
    669     return;
     451  if(  pcCU->getSlice()->getPPS()->getUseDQP())
     452  {
     453    pcCU->setQPSubParts( getdQPFlag()?pcCU->getRefQP(uiAbsPartIdx):pcCU->getCodedQP(), uiAbsPartIdx, uiDepth ); // set QP
    670454  }
    671455
     
    673457}
    674458
    675 Void TDecCu::xDecompressCU( TComDataCU* pcCU, TComDataCU* pcCUCur, UInt uiAbsPartIdx,  UInt uiDepth )
     459Void TDecCu::xDecompressCU( TComDataCU* pcCU, UInt uiAbsPartIdx,  UInt uiDepth )
    676460{
    677461  TComPic* pcPic = pcCU->getPic();
     
    685469  UInt uiCurNumParts    = pcPic->getNumPartInCU() >> (uiDepth<<1);
    686470  TComSlice * pcSlice = pcCU->getPic()->getSlice(pcCU->getPic()->getCurrSliceIdx());
    687   Bool bStartInCU = pcCU->getSCUAddr()+uiAbsPartIdx+uiCurNumParts>pcSlice->getEntropySliceCurStartCUAddr()&&pcCU->getSCUAddr()+uiAbsPartIdx<pcSlice->getEntropySliceCurStartCUAddr();
     471  Bool bStartInCU = pcCU->getSCUAddr()+uiAbsPartIdx+uiCurNumParts>pcSlice->getSliceSegmentCurStartCUAddr()&&pcCU->getSCUAddr()+uiAbsPartIdx<pcSlice->getSliceSegmentCurStartCUAddr();
    688472  if(bStartInCU||( uiRPelX >= pcSlice->getSPS()->getPicWidthInLumaSamples() ) || ( uiBPelY >= pcSlice->getSPS()->getPicHeightInLumaSamples() ) )
    689473  {
     
    701485      uiTPelY = pcCU->getCUPelY() + g_auiRasterToPelY[ g_auiZscanToRaster[uiIdx] ];
    702486     
    703       Bool binSlice = (pcCU->getSCUAddr()+uiIdx+uiQNumParts>pcSlice->getEntropySliceCurStartCUAddr())&&(pcCU->getSCUAddr()+uiIdx<pcSlice->getEntropySliceCurEndCUAddr());
     487      Bool binSlice = (pcCU->getSCUAddr()+uiIdx+uiQNumParts>pcSlice->getSliceSegmentCurStartCUAddr())&&(pcCU->getSCUAddr()+uiIdx<pcSlice->getSliceSegmentCurEndCUAddr());
    704488      if(binSlice&&( uiLPelX < pcSlice->getSPS()->getPicWidthInLumaSamples() ) && ( uiTPelY < pcSlice->getSPS()->getPicHeightInLumaSamples() ) )
    705489      {
    706         xDecompressCU(pcCU, m_ppcCU[uiNextDepth], uiIdx, uiNextDepth );
     490        xDecompressCU(pcCU, uiIdx, uiNextDepth );
    707491      }
    708492     
     
    719503  switch( m_ppcCU[uiDepth]->getPredictionMode(0) )
    720504  {
    721     case MODE_SKIP:
    722505    case MODE_INTER:
    723       xReconInter( m_ppcCU[uiDepth], uiAbsPartIdx, uiDepth );
     506#if LGE_INTER_SDC_E0156
     507      if( m_ppcCU[uiDepth]->getInterSDCFlag( 0 ) )
     508      {
     509        xReconInterSDC( m_ppcCU[uiDepth], uiAbsPartIdx, uiDepth );
     510      }
     511      else
     512      {
     513#endif
     514      xReconInter( m_ppcCU[uiDepth], uiDepth );
     515#if LGE_INTER_SDC_E0156
     516      }
     517#endif
    724518      break;
    725519    case MODE_INTRA:
    726 #if RWTH_SDC_DLT_B0036
     520#if H_3D_DIM_SDC
    727521      if( m_ppcCU[uiDepth]->getSDCFlag(0) )
    728522        xReconIntraSDC( m_ppcCU[uiDepth], 0, uiDepth );
    729523      else
    730524#endif
    731       xReconIntraQT( m_ppcCU[uiDepth], uiAbsPartIdx, uiDepth );
     525      xReconIntraQT( m_ppcCU[uiDepth], uiDepth );
    732526      break;
    733527    default:
     
    735529      break;
    736530  }
    737 #if LOSSLESS_CODING
    738531  if ( m_ppcCU[uiDepth]->isLosslessCoded(0) && (m_ppcCU[uiDepth]->getIPCMFlag(0) == false))
    739532  {
    740     xFillPCMBuffer(m_ppcCU[uiDepth], uiAbsPartIdx, uiDepth);   
    741   }
    742 #endif
     533    xFillPCMBuffer(m_ppcCU[uiDepth], uiDepth);
     534  }
    743535 
    744536  xCopyToPic( m_ppcCU[uiDepth], pcPic, uiAbsPartIdx, uiDepth );
    745537}
    746538
    747 Void TDecCu::xReconInter( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth )
    748 {
    749 #if HHI_MPI
    750 #if FIX_MPI_B0065
    751   if( pcCU->getTextureModeDepth( 0 ) != -1 )
    752   {
    753     TComDataCU *pcTextureCU = pcCU->getSlice()->getTexturePic()->getCU( pcCU->getAddr() );
    754     if( uiDepth == pcTextureCU->getDepth(uiAbsPartIdx))
    755     {
    756       PartSize partSize = pcTextureCU->getPartitionSize(uiAbsPartIdx);
    757       pcCU->setPartSizeSubParts( partSize, 0, uiDepth );
    758     }
    759     else
    760     {
    761       pcCU->setPartSizeSubParts( SIZE_NxN, 0, uiDepth );
    762     }
    763   }
    764 #else
    765   if( pcCU->getTextureModeDepth( 0 ) != -1 )
    766     pcCU->setPartSizeSubParts( SIZE_NxN, 0, uiDepth );
    767 #endif
    768 #endif
     539Void TDecCu::xReconInter( TComDataCU* pcCU, UInt uiDepth )
     540{
    769541 
    770542  // inter prediction
    771 #if MERL_VSP_C0152
    772   m_pcPrediction->motionCompensation( pcCU, m_ppcYuvReco[uiDepth], uiAbsPartIdx );
    773 #else
    774543  m_pcPrediction->motionCompensation( pcCU, m_ppcYuvReco[uiDepth] );
    775 #endif
    776 #if H3D_IVRP & !QC_ARP_D0177
    777   if (pcCU->getMergeFlag(0) && pcCU->getMergeIndex(0)==0 && pcCU->getResPredAvail(0))
    778   {
    779     m_pcPrediction->residualPrediction(pcCU, m_ppcYuvReco[uiDepth], m_ppcYuvResPred[uiDepth]);
    780   }
    781 #endif
    782 
    783 #if HHI_MPI
    784   if( pcCU->getTextureModeDepth( 0 ) != -1 )
    785     pcCU->setPartSizeSubParts( SIZE_2Nx2N, 0, uiDepth );
    786 #endif
    787 
     544 
    788545  // inter recon
    789546  xDecodeInterTexture( pcCU, 0, uiDepth );
     
    796553  else
    797554  {
    798 #if H3D_IVRP
    799     if (pcCU->getMergeFlag(0) && pcCU->getMergeIndex(0)==0 && pcCU->getResPredAvail(0))
    800     {
    801       m_ppcYuvReco[uiDepth]->clip( pcCU->getWidth( 0 ), pcCU->getHeight( 0 ) );
    802     }
    803 #endif
    804555    m_ppcYuvReco[uiDepth]->copyPartToPartYuv( m_ppcYuvReco[uiDepth],0, pcCU->getWidth( 0 ),pcCU->getHeight( 0 ));
    805556  }
    806557}
     558
     559#if LGE_INTER_SDC_E0156
     560Void TDecCu::xReconInterSDC( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth )
     561{
     562  // inter prediction
     563  m_pcPrediction->motionCompensation( pcCU, m_ppcYuvReco[uiDepth] );
     564
     565  UInt  uiWidth      = pcCU->getWidth ( 0 );
     566  UInt  uiHeight     = pcCU->getHeight( 0 );
     567  UChar* pMask       = pcCU->getInterSDCMask();
     568
     569  memset( pMask, 0, uiWidth*uiHeight );
     570  pcCU->xSetInterSDCCUMask( pcCU, pMask );
     571
     572  Pel  *pResi;
     573  UInt uiPelX, uiPelY;
     574  UInt uiResiStride = m_ppcYuvResi[uiDepth]->getStride();
     575
     576  pResi = m_ppcYuvResi[uiDepth]->getLumaAddr( 0 );
     577  for( uiPelY = 0; uiPelY < uiHeight; uiPelY++ )
     578  {
     579    for( uiPelX = 0; uiPelX < uiWidth; uiPelX++ )
     580    {
     581      UChar uiSeg = pMask[ uiPelX + uiPelY*uiWidth ];
     582
     583      pResi[ uiPelX ] = pcCU->getInterSDCSegmentDCOffset( uiSeg, 0 );;
     584    }
     585    pResi += uiResiStride;
     586  }
     587
     588  m_ppcYuvReco[uiDepth]->addClip( m_ppcYuvReco[uiDepth], m_ppcYuvResi[uiDepth], 0, pcCU->getWidth( 0 ) );
     589
     590  // clear UV
     591  UInt  uiStrideC     = m_ppcYuvReco[uiDepth]->getCStride();
     592  Pel   *pRecCb       = m_ppcYuvReco[uiDepth]->getCbAddr();
     593  Pel   *pRecCr       = m_ppcYuvReco[uiDepth]->getCrAddr();
     594
     595  for (Int y = 0; y < uiHeight/2; y++)
     596  {
     597    for (Int x = 0; x < uiWidth/2; x++)
     598    {
     599      pRecCb[x] = (Pel)( 1 << ( g_bitDepthC - 1 ) );
     600      pRecCr[x] = (Pel)( 1 << ( g_bitDepthC - 1 ) );
     601    }
     602
     603    pRecCb += uiStrideC;
     604    pRecCr += uiStrideC;
     605  }
     606}
     607#endif
    807608
    808609Void
     
    829630  Pel*    piRecIPred        = pcCU->getPic()->getPicYuvRec()->getLumaAddr( pcCU->getAddr(), uiZOrder );
    830631  UInt    uiRecIPredStride  = pcCU->getPic()->getPicYuvRec()->getStride  ();
    831  
     632  Bool    useTransformSkip  = pcCU->getTransformSkip(uiAbsPartIdx, TEXT_LUMA);
    832633  //===== init availability pattern =====
    833634  Bool  bAboveAvail = false;
     
    839640                                     m_pcPrediction->getPredicBufHeight (),
    840641                                     bAboveAvail, bLeftAvail );
    841 #if LGE_EDGE_INTRA_A0070
    842   if( uiLumaPredMode >= EDGE_INTRA_IDX )
    843   {
    844     m_pcPrediction->predIntraLumaEdge( pcCU, pcCU->getPattern(), uiAbsPartIdx, uiWidth, uiHeight, piPred, uiStride
    845 #if LGE_EDGE_INTRA_DELTA_DC
    846       , uiLumaPredMode == EDGE_INTRA_DELTA_IDX
    847 #endif
    848       );
    849   }
     642 
     643  //===== get prediction signal =====
     644#if H_3D_DIM
     645  if( isDimMode( uiLumaPredMode ) )
     646  {
     647    m_pcPrediction->predIntraLumaDepth( pcCU, uiAbsPartIdx, uiLumaPredMode, piPred, uiStride, uiWidth, uiHeight );
     648  }
    850649  else
    851 #endif
    852  
    853   //===== get prediction signal =====
    854 #if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX
    855   if( uiLumaPredMode >= NUM_INTRA_MODE )
    856   {
    857     m_pcPrediction->predIntraLumaDMM( pcCU, uiAbsPartIdx, uiLumaPredMode, piPred, uiStride, uiWidth, uiHeight, bAboveAvail, bLeftAvail, false );
    858   }
    859   else
    860   {
    861 #endif
    862   m_pcPrediction->predIntraLumaAng( pcCU->getPattern(), uiLumaPredMode, piPred, uiStride, uiWidth, uiHeight, pcCU, bAboveAvail, bLeftAvail );
    863 #if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX
     650  {
     651#endif
     652  m_pcPrediction->predIntraLumaAng( pcCU->getPattern(), uiLumaPredMode, piPred, uiStride, uiWidth, uiHeight, bAboveAvail, bLeftAvail );
     653#if H_3D_DIM
    864654  }
    865655#endif
    866656 
    867657  //===== inverse transform =====
    868   m_pcTrQuant->setQPforQuant  ( pcCU->getQP(0), !pcCU->getSlice()->getDepth(), pcCU->getSlice()->getSliceType(), TEXT_LUMA, pcCU->getSlice()->getSPS()->getQpBDOffsetY(), 0 );
     658  m_pcTrQuant->setQPforQuant  ( pcCU->getQP(0), TEXT_LUMA, pcCU->getSlice()->getSPS()->getQpBDOffsetY(), 0 );
    869659
    870660  Int scalingListType = (pcCU->isIntra(uiAbsPartIdx) ? 0 : 3) + g_eTTable[(Int)TEXT_LUMA];
    871661  assert(scalingListType < 6);
    872 #if LOSSLESS_CODING
    873   m_pcTrQuant->invtransformNxN( pcCU, TEXT_LUMA, pcCU->getLumaIntraDir( uiAbsPartIdx ), piResi, uiStride, pcCoeff, uiWidth, uiHeight, scalingListType );
    874 #else 
    875   m_pcTrQuant->invtransformNxN(       TEXT_LUMA, pcCU->getLumaIntraDir( uiAbsPartIdx ), piResi, uiStride, pcCoeff, uiWidth, uiHeight, scalingListType );
    876 #endif
     662  m_pcTrQuant->invtransformNxN( pcCU->getCUTransquantBypass(uiAbsPartIdx), TEXT_LUMA, pcCU->getLumaIntraDir( uiAbsPartIdx ), piResi, uiStride, pcCoeff, uiWidth, uiHeight, scalingListType, useTransformSkip );
    877663
    878664 
     
    886672    for( UInt uiX = 0; uiX < uiWidth; uiX++ )
    887673    {
    888       pReco    [ uiX ] = Clip( pPred[ uiX ] + pResi[ uiX ] );
     674      pReco    [ uiX ] = ClipY( pPred[ uiX ] + pResi[ uiX ] );
    889675      pRecIPred[ uiX ] = pReco[ uiX ];
    890676    }
     
    937723  Pel*      piRecIPred        = ( uiChromaId > 0 ? pcCU->getPic()->getPicYuvRec()->getCrAddr( pcCU->getAddr(), uiZOrder ) : pcCU->getPic()->getPicYuvRec()->getCbAddr( pcCU->getAddr(), uiZOrder ) );
    938724  UInt      uiRecIPredStride  = pcCU->getPic()->getPicYuvRec()->getCStride();
    939  
     725  Bool      useTransformSkipChroma = pcCU->getTransformSkip(uiAbsPartIdx,eText);
    940726  //===== init availability pattern =====
    941727  Bool  bAboveAvail = false;
     
    943729  pcCU->getPattern()->initPattern         ( pcCU, uiTrDepth, uiAbsPartIdx );
    944730
    945   if( uiChromaPredMode == LM_CHROMA_IDX && uiChromaId == 0 )
    946   {
    947     pcCU->getPattern()->initAdiPattern( pcCU, uiAbsPartIdx, uiTrDepth,
    948                                      m_pcPrediction->getPredicBuf       (),
    949                                      m_pcPrediction->getPredicBufWidth  (),
    950                                      m_pcPrediction->getPredicBufHeight (),
    951                                      bAboveAvail, bLeftAvail,
    952                                      true );
    953 
    954     m_pcPrediction->getLumaRecPixels( pcCU->getPattern(), uiWidth, uiHeight );
    955   }
    956  
    957   pcCU->getPattern()->initAdiPatternChroma( pcCU, uiAbsPartIdx, uiTrDepth,
     731  pcCU->getPattern()->initAdiPatternChroma( pcCU, uiAbsPartIdx, uiTrDepth,
    958732                                           m_pcPrediction->getPredicBuf       (),
    959733                                           m_pcPrediction->getPredicBufWidth  (),
     
    963737 
    964738  //===== get prediction signal =====
    965   if( uiChromaPredMode == LM_CHROMA_IDX )
    966   {
    967     m_pcPrediction->predLMIntraChroma( pcCU->getPattern(), pPatChroma, piPred, uiStride, uiWidth, uiHeight, uiChromaId );
     739  {
     740    if( uiChromaPredMode == DM_CHROMA_IDX )
     741    {
     742      uiChromaPredMode = pcCU->getLumaIntraDir( 0 );
     743#if H_3D_DIM
     744      mapDepthModeToIntraDir( uiChromaPredMode );
     745#endif
     746    }
     747    m_pcPrediction->predIntraChromaAng( pPatChroma, uiChromaPredMode, piPred, uiStride, uiWidth, uiHeight, bAboveAvail, bLeftAvail ); 
     748  }
     749
     750  //===== inverse transform =====
     751  Int curChromaQpOffset;
     752  if(eText == TEXT_CHROMA_U)
     753  {
     754    curChromaQpOffset = pcCU->getSlice()->getPPS()->getChromaCbQpOffset() + pcCU->getSlice()->getSliceQpDeltaCb();
    968755  }
    969756  else
    970757  {
    971     if( uiChromaPredMode == DM_CHROMA_IDX )
    972     {
    973       uiChromaPredMode = pcCU->getLumaIntraDir( 0 );
    974 #if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX
    975       mapDMMtoIntraMode( uiChromaPredMode );
    976 #endif
    977     }
    978     m_pcPrediction->predIntraChromaAng( pcCU->getPattern(), pPatChroma, uiChromaPredMode, piPred, uiStride, uiWidth, uiHeight, pcCU, bAboveAvail, bLeftAvail ); 
    979   }
    980 
    981   //===== inverse transform =====
    982   if(eText == TEXT_CHROMA_U)
    983   {
    984     m_pcTrQuant->setQPforQuant  ( pcCU->getQP(0), !pcCU->getSlice()->getDepth(), pcCU->getSlice()->getSliceType(), eText, pcCU->getSlice()->getSPS()->getQpBDOffsetC(), pcCU->getSlice()->getPPS()->getChromaQpOffset() );
    985   }
    986   else
    987   {
    988     m_pcTrQuant->setQPforQuant  ( pcCU->getQP(0), !pcCU->getSlice()->getDepth(), pcCU->getSlice()->getSliceType(), eText, pcCU->getSlice()->getSPS()->getQpBDOffsetC(), pcCU->getSlice()->getPPS()->getChromaQpOffset2nd() );
    989   }
     758    curChromaQpOffset = pcCU->getSlice()->getPPS()->getChromaCrQpOffset() + pcCU->getSlice()->getSliceQpDeltaCr();
     759  }
     760  m_pcTrQuant->setQPforQuant  ( pcCU->getQP(0), eText, pcCU->getSlice()->getSPS()->getQpBDOffsetC(), curChromaQpOffset );
    990761
    991762  Int scalingListType = (pcCU->isIntra(uiAbsPartIdx) ? 0 : 3) + g_eTTable[(Int)eText];
    992763  assert(scalingListType < 6);
    993 #if LOSSLESS_CODING
    994   m_pcTrQuant->invtransformNxN( pcCU, eText, REG_DCT, piResi, uiStride, pcCoeff, uiWidth, uiHeight, scalingListType );
    995 #else 
    996   m_pcTrQuant->invtransformNxN(       eText, REG_DCT, piResi, uiStride, pcCoeff, uiWidth, uiHeight, scalingListType );
    997 #endif
     764  m_pcTrQuant->invtransformNxN( pcCU->getCUTransquantBypass(uiAbsPartIdx), eText, REG_DCT, piResi, uiStride, pcCoeff, uiWidth, uiHeight, scalingListType, useTransformSkipChroma );
    998765
    999766  //===== reconstruction =====
     
    1006773    for( UInt uiX = 0; uiX < uiWidth; uiX++ )
    1007774    {
    1008       pReco    [ uiX ] = Clip( pPred[ uiX ] + pResi[ uiX ] );
     775      pReco    [ uiX ] = ClipC( pPred[ uiX ] + pResi[ uiX ] );
    1009776      pRecIPred[ uiX ] = pReco[ uiX ];
    1010777    }
     
    1016783}
    1017784
     785
    1018786Void
    1019 TDecCu::xIntraRecQT( TComDataCU* pcCU,
    1020                     UInt        uiTrDepth,
    1021                     UInt        uiAbsPartIdx,
    1022                     TComYuv*    pcRecoYuv,
    1023                     TComYuv*    pcPredYuv,
    1024                     TComYuv*    pcResiYuv )
    1025 {
    1026   UInt uiFullDepth  = pcCU->getDepth(0) + uiTrDepth;
    1027   UInt uiTrMode     = pcCU->getTransformIdx( uiAbsPartIdx );
    1028   if( uiTrMode == uiTrDepth )
    1029   {
    1030     xIntraRecLumaBlk  ( pcCU, uiTrDepth, uiAbsPartIdx, pcRecoYuv, pcPredYuv, pcResiYuv );
    1031     xIntraRecChromaBlk( pcCU, uiTrDepth, uiAbsPartIdx, pcRecoYuv, pcPredYuv, pcResiYuv, 0 );
    1032     xIntraRecChromaBlk( pcCU, uiTrDepth, uiAbsPartIdx, pcRecoYuv, pcPredYuv, pcResiYuv, 1 );
    1033   }
    1034   else
    1035   {
    1036     UInt uiNumQPart  = pcCU->getPic()->getNumPartInCU() >> ( ( uiFullDepth + 1 ) << 1 );
    1037     for( UInt uiPart = 0; uiPart < 4; uiPart++ )
    1038     {
    1039       xIntraRecQT( pcCU, uiTrDepth + 1, uiAbsPartIdx + uiPart * uiNumQPart, pcRecoYuv, pcPredYuv, pcResiYuv );
    1040     }
    1041   }
    1042 }
    1043 
    1044 Void
    1045 TDecCu::xReconIntraQT( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth )
     787TDecCu::xReconIntraQT( TComDataCU* pcCU, UInt uiDepth )
    1046788{
    1047789  UInt  uiInitTrDepth = ( pcCU->getPartitionSize(0) == SIZE_2Nx2N ? 0 : 1 );
     
    1051793  if (pcCU->getIPCMFlag(0))
    1052794  {
    1053     xReconPCM( pcCU, uiAbsPartIdx, uiDepth );
     795    xReconPCM( pcCU, uiDepth );
    1054796    return;
    1055797  }
     
    1067809}
    1068810
    1069 #if RWTH_SDC_DLT_B0036
     811#if H_3D_DIM_SDC
    1070812Void TDecCu::xReconIntraSDC( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth )
    1071813{
     
    1100842 
    1101843  //===== get prediction signal =====
    1102 #if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX
    1103   if( uiLumaPredMode >= NUM_INTRA_MODE )
    1104   {
    1105     m_pcPrediction->predIntraLumaDMM( pcCU, uiAbsPartIdx, uiLumaPredMode, piPred, uiStride, uiWidth, uiHeight, bAboveAvail, bLeftAvail, false );
     844#if H_3D_DIM
     845  if( isDimMode( uiLumaPredMode ) )
     846  {
     847    m_pcPrediction->predIntraLumaDepth( pcCU, uiAbsPartIdx, uiLumaPredMode, piPred, uiStride, uiWidth, uiHeight );
    1106848  }
    1107849  else
    1108850  {
    1109851#endif
    1110     m_pcPrediction->predIntraLumaAng( pcCU->getPattern(), uiLumaPredMode, piPred, uiStride, uiWidth, uiHeight, pcCU, bAboveAvail, bLeftAvail );
    1111 #if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX
     852    m_pcPrediction->predIntraLumaAng( pcCU->getPattern(), uiLumaPredMode, piPred, uiStride, uiWidth, uiHeight, bAboveAvail, bLeftAvail );
     853#if H_3D_DIM
    1112854  }
    1113855#endif
    1114856 
    1115857  // number of segments depends on prediction mode
    1116   UInt uiNumSegments = 1; 
     858  UInt uiNumSegments = 1;
    1117859  Bool* pbMask = NULL;
    1118860  UInt uiMaskStride = 0;
    1119861 
    1120   if( uiLumaPredMode == DMM_WEDGE_FULL_IDX || uiLumaPredMode == DMM_WEDGE_PREDDIR_IDX )
    1121   {
    1122     Int uiTabIdx = (uiLumaPredMode == DMM_WEDGE_FULL_IDX)?pcCU->getWedgeFullTabIdx(uiAbsPartIdx):pcCU->getWedgePredDirTabIdx(uiAbsPartIdx);
     862  if( getDimType( uiLumaPredMode ) == DMM1_IDX )
     863  {
     864    Int uiTabIdx = pcCU->getDmmWedgeTabIdx(DMM1_IDX, uiAbsPartIdx);
    1123865   
    1124     WedgeList* pacWedgeList = &g_aacWedgeLists[(g_aucConvertToBit[uiWidth])];
     866    WedgeList* pacWedgeList = &g_dmmWedgeLists[(g_aucConvertToBit[uiWidth])];
    1125867    TComWedgelet* pcWedgelet = &(pacWedgeList->at( uiTabIdx ));
    1126868   
     
    1132874  // get DC prediction for each segment
    1133875  Pel apDCPredValues[2];
    1134   xAnalyzeSegmentsSDC(piPred, uiStride, uiWidth, apDCPredValues, uiNumSegments, pbMask, uiMaskStride);
     876#if KWU_SDC_SIMPLE_DC_E0117
     877  m_pcPrediction->analyzeSegmentsSDC(piPred, uiStride, uiWidth, apDCPredValues, uiNumSegments, pbMask, uiMaskStride, uiLumaPredMode);
     878#else
     879  m_pcPrediction->analyzeSegmentsSDC(piPred, uiStride, uiWidth, apDCPredValues, uiNumSegments, pbMask, uiMaskStride);
     880#endif
    1135881 
    1136882  // reconstruct residual based on mask + DC residuals
    1137883  Pel apDCResiValues[2];
    1138 #if !MERL_General_Fix
    1139   Pel apDCRecoValues[2];
    1140 #endif
    1141   for( UInt ui = 0; ui < uiNumSegments; ui++ )
    1142   {
    1143     Pel   pPredIdx    = GetDepthValue2Idx( apDCPredValues[ui] );
    1144     Pel   pResiIdx    = pcCU->getSDCSegmentDCOffset(ui, uiAbsPartIdx);
    1145     Pel   pRecoValue  = GetIdx2DepthValue( pPredIdx + pResiIdx );
     884  for( UInt uiSegment = 0; uiSegment < uiNumSegments; uiSegment++ )
     885  {
     886#if H_3D_DIM_DLT
     887    Pel   pPredIdx    = pcCU->getSlice()->getVPS()->depthValue2idx( pcCU->getSlice()->getLayerIdInVps(), apDCPredValues[uiSegment] );
     888    Pel   pResiIdx    = pcCU->getSDCSegmentDCOffset(uiSegment, uiAbsPartIdx);
     889    Pel   pRecoValue  = pcCU->getSlice()->getVPS()->idx2DepthValue( pcCU->getSlice()->getLayerIdInVps(), pPredIdx + pResiIdx );
    1146890   
    1147 #if !MERL_General_Fix
    1148     apDCRecoValues[ui]  = pRecoValue;
    1149 #endif
    1150     apDCResiValues[ui]  = pRecoValue - apDCPredValues[ui];
     891    apDCResiValues[uiSegment]  = pRecoValue - apDCPredValues[uiSegment];
     892#else
     893    apDCResiValues[uiSegment]  = pcCU->getSDCSegmentDCOffset(uiSegment, uiAbsPartIdx);
     894#endif
    1151895  }
    1152896 
     
    1164908      UChar ucSegment = pMask?(UChar)pMask[uiX]:0;
    1165909      assert( ucSegment < uiNumSegments );
    1166 #if MTK_SAMPLE_BASED_SDC_D0110     
     910     
    1167911      Pel pResiDC = apDCResiValues[ucSegment];
    1168912     
    1169       pReco    [ uiX ] = Clip( pPred[ uiX ] + pResiDC );
    1170 #else
    1171       Pel pPredVal= apDCPredValues[ucSegment];
    1172       Pel pResiDC = apDCResiValues[ucSegment];
    1173      
    1174       pReco    [ uiX ] = Clip( pPredVal + pResiDC );
    1175 #endif
     913      pReco    [ uiX ] = ClipY( pPred[ uiX ] + pResiDC );
    1176914      pRecIPred[ uiX ] = pReco[ uiX ];
    1177915    }
     
    1192930    for (Int x=0; x<uiWidth/2; x++)
    1193931    {
    1194       pRecCb[x] = (Pel)(128<<g_uiBitIncrement);
    1195       pRecCr[x] = (Pel)(128<<g_uiBitIncrement);
     932      pRecCb[x] = 128;
     933      pRecCr[x] = 128;
    1196934    }
    1197935   
     
    12871025 
    12881026  Pel*    pResi;
    1289   UInt    uiLumaTrMode, uiChromaTrMode;
    1290  
    1291   pcCU->convertTransIdx( uiAbsPartIdx, pcCU->getTransformIdx( uiAbsPartIdx ), uiLumaTrMode, uiChromaTrMode );
     1027  UInt    trMode = pcCU->getTransformIdx( uiAbsPartIdx );
    12921028 
    12931029  // Y
     
    12951031  pResi = m_ppcYuvResi[uiDepth]->getLumaAddr();
    12961032
    1297   m_pcTrQuant->setQPforQuant( pcCU->getQP( uiAbsPartIdx ), !pcCU->getSlice()->getDepth(), pcCU->getSlice()->getSliceType(), TEXT_LUMA, pcCU->getSlice()->getSPS()->getQpBDOffsetY(), 0 );
    1298 
    1299   m_pcTrQuant->invRecurTransformNxN ( pcCU, 0, TEXT_LUMA, pResi, 0, m_ppcYuvResi[uiDepth]->getStride(), uiWidth, uiHeight, uiLumaTrMode, 0, piCoeff );
     1033  m_pcTrQuant->setQPforQuant( pcCU->getQP( uiAbsPartIdx ), TEXT_LUMA, pcCU->getSlice()->getSPS()->getQpBDOffsetY(), 0 );
     1034
     1035  m_pcTrQuant->invRecurTransformNxN ( pcCU, 0, TEXT_LUMA, pResi, 0, m_ppcYuvResi[uiDepth]->getStride(), uiWidth, uiHeight, trMode, 0, piCoeff );
    13001036 
    13011037  // Cb and Cr
    1302   m_pcTrQuant->setQPforQuant( pcCU->getQP( uiAbsPartIdx ), !pcCU->getSlice()->getDepth(), pcCU->getSlice()->getSliceType(), TEXT_CHROMA, pcCU->getSlice()->getSPS()->getQpBDOffsetC(), pcCU->getSlice()->getPPS()->getChromaQpOffset() );
     1038  Int curChromaQpOffset = pcCU->getSlice()->getPPS()->getChromaCbQpOffset() + pcCU->getSlice()->getSliceQpDeltaCb();
     1039  m_pcTrQuant->setQPforQuant( pcCU->getQP( uiAbsPartIdx ), TEXT_CHROMA, pcCU->getSlice()->getSPS()->getQpBDOffsetC(), curChromaQpOffset );
    13031040
    13041041  uiWidth  >>= 1;
    13051042  uiHeight >>= 1;
    13061043  piCoeff = pcCU->getCoeffCb(); pResi = m_ppcYuvResi[uiDepth]->getCbAddr();
    1307   m_pcTrQuant->invRecurTransformNxN ( pcCU, 0, TEXT_CHROMA_U, pResi, 0, m_ppcYuvResi[uiDepth]->getCStride(), uiWidth, uiHeight, uiChromaTrMode, 0, piCoeff );
    1308 
    1309   m_pcTrQuant->setQPforQuant( pcCU->getQP( uiAbsPartIdx ), !pcCU->getSlice()->getDepth(), pcCU->getSlice()->getSliceType(), TEXT_CHROMA, pcCU->getSlice()->getSPS()->getQpBDOffsetC(), pcCU->getSlice()->getPPS()->getChromaQpOffset2nd() );
     1044  m_pcTrQuant->invRecurTransformNxN ( pcCU, 0, TEXT_CHROMA_U, pResi, 0, m_ppcYuvResi[uiDepth]->getCStride(), uiWidth, uiHeight, trMode, 0, piCoeff );
     1045
     1046  curChromaQpOffset = pcCU->getSlice()->getPPS()->getChromaCrQpOffset() + pcCU->getSlice()->getSliceQpDeltaCr();
     1047  m_pcTrQuant->setQPforQuant( pcCU->getQP( uiAbsPartIdx ), TEXT_CHROMA, pcCU->getSlice()->getSPS()->getQpBDOffsetC(), curChromaQpOffset );
    13101048
    13111049  piCoeff = pcCU->getCoeffCr(); pResi = m_ppcYuvResi[uiDepth]->getCrAddr();
    1312   m_pcTrQuant->invRecurTransformNxN ( pcCU, 0, TEXT_CHROMA_V, pResi, 0, m_ppcYuvResi[uiDepth]->getCStride(), uiWidth, uiHeight, uiChromaTrMode, 0, piCoeff );
     1050  m_pcTrQuant->invRecurTransformNxN ( pcCU, 0, TEXT_CHROMA_V, pResi, 0, m_ppcYuvResi[uiDepth]->getCStride(), uiWidth, uiHeight, trMode, 0, piCoeff );
    13131051}
    13141052
     
    13351073    uiPicStride   = pcCU->getPic()->getPicYuvRec()->getStride();
    13361074    piPicReco = pcCU->getPic()->getPicYuvRec()->getLumaAddr(pcCU->getAddr(), pcCU->getZorderIdxInCU()+uiPartIdx);
    1337     uiPcmLeftShiftBit = g_uiBitDepth + g_uiBitIncrement - pcCU->getSlice()->getSPS()->getPCMBitDepthLuma();
     1075    uiPcmLeftShiftBit = g_bitDepthY - pcCU->getSlice()->getSPS()->getPCMBitDepthLuma();
    13381076  }
    13391077  else
     
    13491087      piPicReco = pcCU->getPic()->getPicYuvRec()->getCrAddr(pcCU->getAddr(), pcCU->getZorderIdxInCU()+uiPartIdx);
    13501088    }
    1351     uiPcmLeftShiftBit = g_uiBitDepth + g_uiBitIncrement - pcCU->getSlice()->getSPS()->getPCMBitDepthChroma();
     1089    uiPcmLeftShiftBit = g_bitDepthC - pcCU->getSlice()->getSPS()->getPCMBitDepthChroma();
    13521090  }
    13531091
     
    13671105/** Function for reconstructing a PCM mode CU.
    13681106 * \param pcCU pointer to current CU
    1369  * \param uiAbsPartIdx CU index
    13701107 * \param uiDepth CU Depth
    13711108 * \returns Void
    13721109 */
    1373 Void TDecCu::xReconPCM( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth )
     1110Void TDecCu::xReconPCM( TComDataCU* pcCU, UInt uiDepth )
    13741111{
    13751112  // Luma
     
    13991136}
    14001137
    1401 #if LOSSLESS_CODING
    14021138/** Function for filling the PCM buffer of a CU using its reconstructed sample array
    14031139 * \param pcCU pointer to current CU
    1404  * \param uiAbsPartIdx CU index
    14051140 * \param uiDepth CU Depth
    14061141 * \returns Void
    14071142 */
    1408 Void TDecCu::xFillPCMBuffer(TComDataCU* pCU, UInt absPartIdx, UInt depth)
     1143Void TDecCu::xFillPCMBuffer(TComDataCU* pCU, UInt depth)
    14091144{
    14101145  // Luma
     
    14521187
    14531188}
    1454 #endif
    1455 
    1456 #if RWTH_SDC_DLT_B0036
    1457 Void TDecCu::xAnalyzeSegmentsSDC( Pel* pOrig, UInt uiStride, UInt uiSize, Pel* rpSegMeans, UInt uiNumSegments, Bool* pMask, UInt uiMaskStride )
    1458 {
    1459   Int iSumDepth[2];
    1460   memset(iSumDepth, 0, sizeof(Int)*2);
    1461   Int iSumPix[2];
    1462   memset(iSumPix, 0, sizeof(Int)*2);
    1463 #if HS_REFERENCE_SUBSAMPLE_C0154
    1464   Int subSamplePix;
    1465   if ( uiSize == 64 || uiSize == 32 )
    1466   {
    1467     subSamplePix = 2;
    1468   }
    1469   else
    1470   {
    1471     subSamplePix = 1;
    1472   }
    1473   for (Int y=0; y<uiSize; y+=subSamplePix)
    1474   {
    1475     for (Int x=0; x<uiSize; x+=subSamplePix)
    1476     {
    1477       UChar ucSegment = pMask?(UChar)pMask[x]:0;
    1478       assert( ucSegment < uiNumSegments );
    1479  
    1480       iSumDepth[ucSegment] += pOrig[x];
    1481       iSumPix[ucSegment]   += 1;
    1482     }
    1483     pOrig  += uiStride*subSamplePix;
    1484     pMask  += uiMaskStride*subSamplePix;
    1485   }
    1486 #else
    1487   for (Int y=0; y<uiSize; y++)
    1488   {
    1489     for (Int x=0; x<uiSize; x++)
    1490     {
    1491       UChar ucSegment = pMask?(UChar)pMask[x]:0;
    1492       assert( ucSegment < uiNumSegments );
    1493      
    1494       iSumDepth[ucSegment] += pOrig[x];
    1495       iSumPix[ucSegment]   += 1;
    1496     }
    1497    
    1498     pOrig  += uiStride;
    1499     pMask  += uiMaskStride;
    1500   }
    1501 #endif
    1502   // compute mean for each segment
    1503   for( UChar ucSeg = 0; ucSeg < uiNumSegments; ucSeg++ )
    1504   {
    1505     if( iSumPix[ucSeg] > 0 )
    1506       rpSegMeans[ucSeg] = iSumDepth[ucSeg] / iSumPix[ucSeg];
    1507     else
    1508       rpSegMeans[ucSeg] = 0;  // this happens for zero-segments
    1509   }
    1510 }
    1511 #endif
    15121189
    15131190//! \}
Note: See TracChangeset for help on using the changeset viewer.