Changeset 827 in 3DVCSoftware for branches/HTM-9.3-dev0/source/Lib/TLibEncoder


Ignore:
Timestamp:
5 Feb 2014, 20:06:56 (11 years ago)
Author:
tech
Message:

Merged 9.3-dev3-Fix@824

Location:
branches/HTM-9.3-dev0/source/Lib/TLibEncoder
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • branches/HTM-9.3-dev0/source/Lib/TLibEncoder/TEncCavlc.cpp

    r816 r827  
    25272527
    25282528#if H_3D_INTER_SDC
     2529#if QC_SDC_UNIFY_G0130
     2530Void TEncCavlc::codeDeltaDC( TComDataCU* pcCU, UInt uiAbsPartIdx )
     2531{
     2532  assert(0);
     2533}
     2534
     2535Void TEncCavlc::codeSDCFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx )
     2536{
     2537  assert(0);
     2538}
     2539#else
    25292540Void TEncCavlc::codeInterSDCFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx )
    25302541{
     
    25362547  assert(0);
    25372548}
     2549#endif
    25382550#endif
    25392551   
  • branches/HTM-9.3-dev0/source/Lib/TLibEncoder/TEncCavlc.h

    r816 r827  
    138138#endif
    139139#if H_3D_INTER_SDC
     140#if QC_SDC_UNIFY_G0130
     141  Void codeDeltaDC       ( TComDataCU* pcCU, UInt uiAbsPartIdx );
     142  Void codeSDCFlag       ( TComDataCU* pcCU, UInt uiAbsPartIdx );
     143#else
    140144  Void codeInterSDCFlag          ( TComDataCU* pcCU, UInt uiAbsPartIdx );
    141145  Void codeInterSDCResidualData  ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiSegment );
     146#endif
    142147#endif
    143148#if H_3D_DBBP
  • branches/HTM-9.3-dev0/source/Lib/TLibEncoder/TEncCu.cpp

    r826 r827  
    16401640  m_pcEntropyCoder->encodePartSize( pcCU, uiAbsPartIdx, uiDepth );
    16411641 
     1642#if QC_SDC_UNIFY_G0130
     1643  m_pcEntropyCoder->encodeSDCFlag( pcCU, uiAbsPartIdx, false );
     1644#endif
    16421645  if (pcCU->isIntra( uiAbsPartIdx ) && pcCU->getPartitionSize( uiAbsPartIdx ) == SIZE_2Nx2N )
    16431646  {
     
    16671670#endif
    16681671#endif
    1669 #if H_3D_INTER_SDC
     1672#if H_3D_INTER_SDC && !QC_SDC_UNIFY_G0130
    16701673  m_pcEntropyCoder->encodeInterSDCFlag( pcCU, uiAbsPartIdx, false );
    16711674#endif
     
    20492052            rpcTempCU->getCUMvField( REF_PIC_LIST_0 )->setAllMvField( cMvFieldNeighbours[0 + 2*uiMergeCand], SIZE_2Nx2N, 0, 0 ); // interprets depth relative to rpcTempCU level
    20502053            rpcTempCU->getCUMvField( REF_PIC_LIST_1 )->setAllMvField( cMvFieldNeighbours[1 + 2*uiMergeCand], SIZE_2Nx2N, 0, 0 ); // interprets depth relative to rpcTempCU level
     2054#if H_3D_SPIVMP
    20512055          }
     2056#endif
    20522057       // do MC
    20532058       m_pcPredSearch->motionCompensation ( rpcTempCU, m_ppcPredYuvTemp[uhDepth] );
     
    20942099          if( rpcTempCU->getSlice()->getVPS()->getInterSDCFlag( rpcTempCU->getSlice()->getLayerIdInVps() ) && rpcTempCU->getSlice()->getIsDepth() && !uiNoResidual )
    20952100          {
     2101#if SEC_INTER_SDC_G0101
     2102            for( Int uiOffest = -2 ; uiOffest <= 2 ; uiOffest++ )
     2103            {
     2104              if( rpcTempCU != rpcTempCUPre )
     2105              {
     2106                rpcTempCU->initEstData( uhDepth, orgQP );
     2107                rpcTempCU->copyPartFrom( rpcBestCU, 0, uhDepth );
     2108              }
     2109              rpcTempCU->setSkipFlagSubParts( false, 0, uhDepth );
     2110              rpcTempCU->setTrIdxSubParts( 0, 0, uhDepth );
     2111              rpcTempCU->setCbfSubParts( 1, 1, 1, 0, uhDepth );
     2112#if H_3D_VSO //M2
     2113              if( m_pcRdCost->getUseRenModel() )
     2114              { //Reset
     2115                UInt  uiWidth     = m_ppcOrigYuv[uhDepth]->getWidth    ();
     2116                UInt  uiHeight    = m_ppcOrigYuv[uhDepth]->getHeight   ();
     2117                Pel*  piSrc       = m_ppcOrigYuv[uhDepth]->getLumaAddr ();
     2118                UInt  uiSrcStride = m_ppcOrigYuv[uhDepth]->getStride   ();
     2119                m_pcRdCost->setRenModelData( rpcTempCU, 0, piSrc, uiSrcStride, uiWidth, uiHeight );
     2120              }
     2121#endif
     2122              m_pcPredSearch->encodeResAndCalcRdInterSDCCU( rpcTempCU,
     2123                m_ppcOrigYuv[uhDepth],
     2124                ( rpcTempCU != rpcTempCUPre ) ? m_ppcPredYuvBest[uhDepth] : m_ppcPredYuvTemp[uhDepth],
     2125                m_ppcResiYuvTemp[uhDepth],
     2126                m_ppcRecoYuvTemp[uhDepth],
     2127                uiOffest,
     2128                uhDepth );
     2129
     2130              xCheckDQP( rpcTempCU );
     2131              xCheckBestMode( rpcBestCU, rpcTempCU, uhDepth );
     2132            }
     2133#else
    20962134            if( rpcTempCU != rpcTempCUPre )
    20972135            {
     
    21212159            xCheckDQP( rpcTempCU );
    21222160            xCheckBestMode( rpcBestCU, rpcTempCU, uhDepth );
     2161#endif
    21232162          }
    21242163#endif
     
    23312370  xCheckBestMode(rpcBestCU, rpcTempCU, uhDepth);
    23322371#if H_3D_INTER_SDC
     2372#if SEC_INTER_SDC_G0101 // ONLY_2NX2N_SDC
     2373  if( rpcTempCU->getSlice()->getVPS()->getInterSDCFlag( rpcTempCU->getSlice()->getLayerIdInVps() ) && rpcTempCU->getSlice()->getIsDepth() && ePartSize == SIZE_2Nx2N)
     2374#else
    23332375  if( rpcTempCU->getSlice()->getVPS()->getInterSDCFlag( rpcTempCU->getSlice()->getLayerIdInVps() ) && rpcTempCU->getSlice()->getIsDepth() )
    2334   {
     2376#endif
     2377  {
     2378#if SEC_INTER_SDC_G0101
     2379    for( Int uiOffest = -2 ; uiOffest <= 2 ; uiOffest++ )
     2380    {
     2381      if( rpcTempCU != rpcTempCUPre )
     2382      {
     2383        Int orgQP = rpcBestCU->getQP( 0 );
     2384        rpcTempCU->initEstData( uhDepth, orgQP );
     2385        rpcTempCU->copyPartFrom( rpcBestCU, 0, uhDepth );
     2386      }
     2387      rpcTempCU->setSkipFlagSubParts( false, 0, uhDepth );
     2388      rpcTempCU->setTrIdxSubParts( 0, 0, uhDepth );
     2389      rpcTempCU->setCbfSubParts( 1, 1, 1, 0, uhDepth );
     2390#if H_3D_VSO // M3
     2391      if( m_pcRdCost->getUseRenModel() )
     2392      {
     2393        UInt  uiWidth     = m_ppcOrigYuv[uhDepth]->getWidth ( );
     2394        UInt  uiHeight    = m_ppcOrigYuv[uhDepth]->getHeight( );
     2395        Pel*  piSrc       = m_ppcOrigYuv[uhDepth]->getLumaAddr( );
     2396        UInt  uiSrcStride = m_ppcOrigYuv[uhDepth]->getStride();
     2397        m_pcRdCost->setRenModelData( rpcTempCU, 0, piSrc, uiSrcStride, uiWidth, uiHeight );
     2398      }
     2399#endif
     2400
     2401      m_pcPredSearch->encodeResAndCalcRdInterSDCCU( rpcTempCU,
     2402        m_ppcOrigYuv[uhDepth],
     2403        ( rpcTempCU != rpcTempCUPre ) ? m_ppcPredYuvBest[uhDepth] : m_ppcPredYuvTemp[uhDepth],
     2404        m_ppcResiYuvTemp[uhDepth],
     2405        m_ppcRecoYuvTemp[uhDepth],
     2406        uiOffest,
     2407        uhDepth );
     2408
     2409      xCheckDQP( rpcTempCU );
     2410      xCheckBestMode(rpcBestCU, rpcTempCU, uhDepth);
     2411    }
     2412#else
    23352413    if( rpcTempCU != rpcTempCUPre )
    23362414    {
     
    23622440  xCheckDQP( rpcTempCU );
    23632441  xCheckBestMode(rpcBestCU, rpcTempCU, uhDepth);
     2442#endif
    23642443  }
    23652444#endif
     
    26052684  m_pcEntropyCoder->encodePredMode( rpcTempCU, 0,          true );
    26062685  m_pcEntropyCoder->encodePartSize( rpcTempCU, 0, uiDepth, true );
     2686#if QC_SDC_UNIFY_G0130
     2687  m_pcEntropyCoder->encodeSDCFlag( rpcTempCU, 0, true );
     2688#endif
    26072689  m_pcEntropyCoder->encodePredInfo( rpcTempCU, 0,          true );
    26082690  m_pcEntropyCoder->encodeIPCMInfo(rpcTempCU, 0, true );
     
    26942776  m_pcEntropyCoder->encodePredMode ( rpcTempCU, 0,          true );
    26952777  m_pcEntropyCoder->encodePartSize ( rpcTempCU, 0, uiDepth, true );
     2778#if QC_SDC_UNIFY_G0130
     2779  m_pcEntropyCoder->encodeSDCFlag( rpcTempCU, 0, true );
     2780#endif
    26962781  m_pcEntropyCoder->encodeIPCMInfo ( rpcTempCU, 0, true );
    26972782
  • branches/HTM-9.3-dev0/source/Lib/TLibEncoder/TEncEntropy.cpp

    r826 r827  
    679679  UInt uiLumaOffset   = uiMinCoeffSize*uiAbsPartIdx;
    680680  UInt uiChromaOffset = uiLumaOffset>>2;
    681    
     681#if QC_SDC_UNIFY_G0130
    682682#if H_3D_DIM_SDC
    683   if( pcCU->getSDCFlag( uiAbsPartIdx ) )
     683  if( pcCU->getSDCFlag( uiAbsPartIdx ) && pcCU->isIntra( uiAbsPartIdx ) )
    684684  {
    685685    assert( pcCU->getPartitionSize(uiAbsPartIdx) == SIZE_2Nx2N );
     
    688688    assert( pcCU->getCbf(uiAbsPartIdx, TEXT_CHROMA_U) == 1 );
    689689    assert( pcCU->getCbf(uiAbsPartIdx, TEXT_CHROMA_V) == 1 );
    690     return;
    691690  }
    692691#endif
    693692
    694693#if H_3D_INTER_SDC
    695   if( pcCU->getInterSDCFlag( uiAbsPartIdx ) )
     694  if( pcCU->getSDCFlag( uiAbsPartIdx ) && !pcCU->isIntra( uiAbsPartIdx ) )
    696695  {
    697696    assert( !pcCU->isSkipped( uiAbsPartIdx ) );
    698697    assert( !pcCU->isIntra( uiAbsPartIdx) );
    699698    assert( pcCU->getSlice()->getIsDepth() );
     699  }
     700#endif
     701#if QC_SDC_UNIFY_G0130_FIX
     702  if( pcCU->getSlice()->getIsDepth() && ( pcCU->getSDCFlag( uiAbsPartIdx ) || pcCU->isIntra( uiAbsPartIdx ) ) )
     703#else
     704  if( pcCU->getSDCFlag( uiAbsPartIdx ) || pcCU->isIntra( uiAbsPartIdx ) )
     705#endif
     706  {
     707    Int iPartNum = ( pcCU->isIntra( uiAbsPartIdx ) && pcCU->getPartitionSize( uiAbsPartIdx ) == SIZE_NxN ) ? 4 : 1;
     708    UInt uiPartOffset = ( pcCU->getPic()->getNumPartInCU() >> ( pcCU->getDepth( uiAbsPartIdx ) << 1 ) ) >> 2;
     709   
     710    if( !pcCU->getSDCFlag( uiAbsPartIdx ) )
     711    {
     712      for( Int iPart = 0; iPart < iPartNum; iPart++ )
     713      {
     714        if( getDimType( pcCU->getLumaIntraDir( uiAbsPartIdx + uiPartOffset*iPart ) ) < DIM_NUM_TYPE )
     715        {
     716          m_pcEntropyCoderIf->codeDeltaDC( pcCU, uiAbsPartIdx + uiPartOffset*iPart );
     717        }
     718      }
     719    }
     720    else
     721    {
     722      m_pcEntropyCoderIf->codeDeltaDC( pcCU, uiAbsPartIdx );
     723      return;
     724    }
     725  }
     726#else
     727#if H_3D_DIM_SDC
     728  if( pcCU->getSDCFlag( uiAbsPartIdx ) )
     729  {
     730    assert( pcCU->getPartitionSize(uiAbsPartIdx) == SIZE_2Nx2N );
     731    assert( pcCU->getTransformIdx(uiAbsPartIdx) == 0 );
     732    assert( pcCU->getCbf(uiAbsPartIdx, TEXT_LUMA) == 1 );
     733    assert( pcCU->getCbf(uiAbsPartIdx, TEXT_CHROMA_U) == 1 );
     734    assert( pcCU->getCbf(uiAbsPartIdx, TEXT_CHROMA_V) == 1 );
     735    return;
     736  }
     737#endif
     738
     739#if H_3D_INTER_SDC
     740  if( pcCU->getInterSDCFlag( uiAbsPartIdx ) )
     741  {
     742    assert( !pcCU->isSkipped( uiAbsPartIdx ) );
     743    assert( !pcCU->isIntra( uiAbsPartIdx) );
     744    assert( pcCU->getSlice()->getIsDepth() );
    700745
    701746    encodeInterSDCResidualData( pcCU, uiAbsPartIdx, false );
    702747    return;
    703748  }
     749#endif
    704750#endif
    705751
     
    855901
    856902#if H_3D_INTER_SDC
     903#if QC_SDC_UNIFY_G0130
     904Void TEncEntropy::encodeDeltaDC  ( TComDataCU* pcCU, UInt absPartIdx )
     905{
     906  m_pcEntropyCoderIf->codeDeltaDC( pcCU, absPartIdx );
     907}
     908
     909Void TEncEntropy::encodeSDCFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, Bool bRD )
     910{
     911  if( ( !pcCU->isIntra( uiAbsPartIdx ) && !pcCU->getSlice()->getVPS()->getInterSDCFlag( pcCU->getSlice()->getLayerIdInVps() ) ) ||
     912    ( pcCU->isIntra( uiAbsPartIdx ) && !pcCU->getSlice()->getVPS()->getVpsDepthModesFlag( pcCU->getSlice()->getLayerIdInVps() ) ) )
     913  {
     914    return;
     915  }
     916
     917#if SEC_INTER_SDC_G0101
     918  if( !pcCU->getSlice()->getIsDepth() || pcCU->getPartitionSize( uiAbsPartIdx ) != SIZE_2Nx2N || pcCU->isSkipped( uiAbsPartIdx ) )
     919#else
     920  if( !pcCU->getSlice()->getIsDepth() || ( pcCU->isIntra( uiAbsPartIdx ) && pcCU->getPartitionSize( uiAbsPartIdx ) != SIZE_2Nx2N ) || pcCU->isSkipped( uiAbsPartIdx ) )
     921#endif
     922  {
     923    return;
     924  }
     925
     926#if SEC_INTER_SDC_G0101
     927  assert( pcCU->getPartitionSize( uiAbsPartIdx ) == SIZE_2Nx2N || ( !pcCU->isIntra( uiAbsPartIdx ) && !pcCU->isSkipped( uiAbsPartIdx ) ) );
     928#else
     929  assert( ( pcCU->isIntra( uiAbsPartIdx ) && pcCU->getPartitionSize( uiAbsPartIdx ) == SIZE_2Nx2N ) || ( !pcCU->isIntra( uiAbsPartIdx ) && !pcCU->isSkipped( uiAbsPartIdx ) ) );
     930#endif
     931
     932  if( bRD )
     933  {
     934    uiAbsPartIdx = 0;
     935  }
     936
     937  m_pcEntropyCoderIf->codeSDCFlag( pcCU, uiAbsPartIdx );
     938}
     939#else
    857940Void TEncEntropy::encodeInterSDCFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, Bool bRD )
    858941{
     
    902985}
    903986#endif
    904 
     987#endif
    905988#if H_3D_DBBP
    906989Void TEncEntropy::encodeDBBPFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, Bool bRD )
  • branches/HTM-9.3-dev0/source/Lib/TLibEncoder/TEncEntropy.h

    r816 r827  
    9595#endif
    9696#if H_3D_INTER_SDC
     97#if QC_SDC_UNIFY_G0130
     98  virtual Void codeDeltaDC       ( TComDataCU* pcCU, UInt uiAbsPartIdx ) = 0;
     99  virtual Void codeSDCFlag       ( TComDataCU* pcCU, UInt uiAbsPartIdx ) = 0;
     100#else
    97101  virtual Void codeInterSDCFlag  ( TComDataCU* pcCU, UInt uiAbsPartIdx ) = 0;
    98102  virtual Void codeInterSDCResidualData ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiSegment ) = 0;
     103#endif
    99104#endif
    100105#if H_3D_DBBP
     
    189194#endif
    190195#if H_3D_INTER_SDC
     196#if QC_SDC_UNIFY_G0130
     197  Void encodeDeltaDC      ( TComDataCU* pcCU, UInt absPartIdx );
     198  Void encodeSDCFlag      ( TComDataCU* pcCU, UInt uiAbsPartIdx, Bool bRD = false );
     199#else
    191200  Void encodeInterSDCFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, Bool bRD = false );
    192201  Void encodeInterSDCResidualData( TComDataCU* pcCU, UInt uiAbsPartIdx, Bool bRD );
     202#endif
    193203#endif
    194204#if H_3D_DBBP
  • branches/HTM-9.3-dev0/source/Lib/TLibEncoder/TEncSbac.cpp

    r826 r827  
    9393, m_cDdcFlagSCModel           ( 1,             1,               NUM_DDC_FLAG_CTX              , m_contextModels + m_numContextModels, m_numContextModels)
    9494, m_cDdcDataSCModel           ( 1,             1,               NUM_DDC_DATA_CTX              , m_contextModels + m_numContextModels, m_numContextModels)
     95#if QC_GENERIC_SDC_G0122
     96, m_cAngleFlagSCModel         ( 1,             1,               NUM_ANGLE_FLAG_CTX            , m_contextModels + m_numContextModels, m_numContextModels)
     97#if !QC_SDC_UNIFY_G0130
     98, m_cIntraSdcFlagSCModel      ( 1,             1,               NUM_INTRASDC_FLAG_CTX         , m_contextModels + m_numContextModels, m_numContextModels)
     99#endif
     100#endif
    95101#if H_3D_DIM_DMM
    96102, m_cDmm1DataSCModel          ( 1,             1,               NUM_DMM1_DATA_CTX             , m_contextModels + m_numContextModels, m_numContextModels)
     
    101107#endif
    102108#endif
    103 #if H_3D_INTER_SDC
     109#if H_3D_INTER_SDC && !QC_SDC_UNIFY_G0130
    104110, m_cInterSDCFlagSCModel             ( 1,             1,  NUM_INTER_SDC_FLAG_CTX           , m_contextModels + m_numContextModels, m_numContextModels)
    105111, m_cInterSDCResidualSCModel         ( 1,             1,  NUM_INTER_SDC_RESIDUAL_CTX       , m_contextModels + m_numContextModels, m_numContextModels)
    106112, m_cInterSDCResidualSignFlagSCModel ( 1,             1,  NUM_INTER_SDC_SIGN_FLAG_CTX      , m_contextModels + m_numContextModels, m_numContextModels)
     113#endif
     114#if QC_SDC_UNIFY_G0130
     115, m_cSDCFlagSCModel                  ( 1,             1,  NUM_SDC_FLAG_CTX                 , m_contextModels + m_numContextModels, m_numContextModels)
    107116#endif
    108117#if H_3D_DBBP
     
    171180  m_cDdcFlagSCModel.initBuffer           ( eSliceType, iQp, (UChar*)INIT_DDC_FLAG );
    172181  m_cDdcDataSCModel.initBuffer           ( eSliceType, iQp, (UChar*)INIT_DDC_DATA );
     182#if QC_GENERIC_SDC_G0122
     183  m_cAngleFlagSCModel.initBuffer         ( eSliceType, iQp, (UChar*)INIT_ANGLE_FLAG );
     184#if !QC_SDC_UNIFY_G0130
     185  m_cIntraSdcFlagSCModel.initBuffer      ( eSliceType, iQp, (UChar*)INIT_INTRASDC_FLAG );
     186#endif
     187#endif
    173188#if H_3D_DIM_DMM
    174189  m_cDmm1DataSCModel.initBuffer          ( eSliceType, iQp, (UChar*)INIT_DMM1_DATA );
     
    179194#endif
    180195#endif
    181 #if H_3D_INTER_SDC
     196#if H_3D_INTER_SDC && !QC_SDC_UNIFY_G0130
    182197  m_cInterSDCFlagSCModel.initBuffer         ( eSliceType, iQp, (UChar*)INIT_INTER_SDC_FLAG );
    183198  m_cInterSDCResidualSCModel.initBuffer     ( eSliceType, iQp, (UChar*)INIT_INTER_SDC_RESIDUAL );
    184199  m_cInterSDCResidualSignFlagSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_INTER_SDC_SIGN_FLAG );
     200#endif
     201#if QC_SDC_UNIFY_G0130
     202  m_cSDCFlagSCModel.initBuffer              ( eSliceType, iQp, (UChar*)INIT_SDC_FLAG );
    185203#endif
    186204#if H_3D_DBBP
     
    224242      curCost += m_cCUICFlagSCModel.calcCost          ( curSliceType, qp, (UChar*)INIT_IC_FLAG );
    225243#endif
    226 #if H_3D_INTER_SDC
     244#if H_3D_INTER_SDC && !QC_SDC_UNIFY_G0130
    227245      curCost += m_cInterSDCFlagSCModel.calcCost      ( curSliceType, qp, (UChar*)INIT_INTER_SDC_FLAG );
    228246      curCost += m_cInterSDCResidualSCModel.calcCost  ( curSliceType, qp, (UChar*)INIT_INTER_SDC_RESIDUAL );
    229247      curCost += m_cInterSDCResidualSignFlagSCModel.calcCost( curSliceType, qp, (UChar*)INIT_INTER_SDC_SIGN_FLAG );
     248#endif
     249#if QC_SDC_UNIFY_G0130
     250      curCost += m_cSDCFlagSCModel.calcCost           ( curSliceType, qp, (UChar*)INIT_SDC_FLAG );
    230251#endif
    231252#if H_3D_DBBP
     
    261282      curCost += m_cDdcFlagSCModel.calcCost           ( curSliceType, qp, (UChar*)INIT_DDC_FLAG );
    262283      curCost += m_cDdcDataSCModel.calcCost           ( curSliceType, qp, (UChar*)INIT_DDC_DATA );
     284#if QC_GENERIC_SDC_G0122
     285      curCost += m_cAngleFlagSCModel.calcCost         ( curSliceType, qp, (UChar*)INIT_ANGLE_FLAG ); 
     286#if !QC_SDC_UNIFY_G0130
     287      curCost += m_cIntraSdcFlagSCModel.calcCost      ( curSliceType, qp, (UChar*)INIT_INTRASDC_FLAG ); 
     288#endif
     289#endif
    263290#if H_3D_DIM_DMM
    264291      curCost += m_cDmm1DataSCModel.calcCost          ( curSliceType, qp, (UChar*)INIT_DMM1_DATA );
     
    326353  m_cDdcFlagSCModel.initBuffer           ( eSliceType, iQp, (UChar*)INIT_DDC_FLAG );
    327354  m_cDdcDataSCModel.initBuffer           ( eSliceType, iQp, (UChar*)INIT_DDC_DATA );
     355#if QC_GENERIC_SDC_G0122
     356  m_cAngleFlagSCModel.initBuffer         ( eSliceType, iQp, (UChar*)INIT_ANGLE_FLAG );
     357#if !QC_SDC_UNIFY_G0130
     358  m_cIntraSdcFlagSCModel.initBuffer      ( eSliceType, iQp, (UChar*)INIT_INTRASDC_FLAG );
     359#endif
     360#endif
    328361#if H_3D_DIM_DMM
    329362  m_cDmm1DataSCModel.initBuffer          ( eSliceType, iQp, (UChar*)INIT_DMM1_DATA );
     
    334367#endif
    335368#endif
    336 #if H_3D_INTER_SDC
     369#if H_3D_INTER_SDC && !QC_SDC_UNIFY_G0130
    337370  m_cInterSDCFlagSCModel.initBuffer         ( eSliceType, iQp, (UChar*)INIT_INTER_SDC_FLAG );
    338371  m_cInterSDCResidualSCModel.initBuffer     ( eSliceType, iQp, (UChar*)INIT_INTER_SDC_RESIDUAL );
    339372  m_cInterSDCResidualSignFlagSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_INTER_SDC_SIGN_FLAG );
     373#endif
     374#if QC_SDC_UNIFY_G0130
     375  m_cSDCFlagSCModel.initBuffer              ( eSliceType, iQp, (UChar*)INIT_SDC_FLAG );
    340376#endif
    341377#if H_3D_DBBP
     
    641677  this->m_cDepthIntraModeSCModel .copyFrom( &pSrc->m_cDepthIntraModeSCModel );
    642678  this->m_cDdcFlagSCModel        .copyFrom( &pSrc->m_cDdcFlagSCModel );
     679#if QC_GENERIC_SDC_G0122
     680  this->m_cAngleFlagSCModel      .copyFrom( &pSrc->m_cAngleFlagSCModel );
     681#if !QC_SDC_UNIFY_G0130
     682  this->m_cIntraSdcFlagSCModel   .copyFrom( &pSrc->m_cIntraSdcFlagSCModel );
     683#endif
     684#endif
    643685}
    644686#endif
     
    11311173    if( pcCU->getLumaIntraDir( absPartIdx+partOffset*j ) < NUM_INTRA_MODE )
    11321174#if H_3D_DIM_SDC
     1175#if QC_GENERIC_SDC_G0122
     1176      if( 1 )
     1177#else
    11331178      if( !pcCU->getSDCFlag( absPartIdx+partOffset*j ) )
     1179#endif
    11341180#endif
    11351181    {
     
    11571203    if( pcCU->getLumaIntraDir( absPartIdx+partOffset*j ) < NUM_INTRA_MODE )
    11581204#if H_3D_DIM_SDC
     1205#if QC_GENERIC_SDC_G0122
     1206      if( 1 )
     1207#else
    11591208      if( !pcCU->getSDCFlag( absPartIdx+partOffset*j ) )
     1209#endif
    11601210#endif
    11611211    {
     
    12561306  default: break;
    12571307  }
    1258 
     1308#if !QC_SDC_UNIFY_G0130
    12591309  if( dimType < DIM_NUM_TYPE || pcCU->getSDCFlag( absPartIdx ) )
    12601310  {
    12611311    UInt dimDeltaDC;
    12621312    Pel  deltaDC;
     1313#if QC_GENERIC_SDC_G0122
     1314    UInt uiNumSegments = isDimMode( dir ) ? 2 : 1;
     1315#else
    12631316    UInt uiNumSegments = ( dir == PLANAR_IDX ) ? 1 : 2;
     1317#endif
    12641318    if( pcCU->getSDCFlag( absPartIdx ) )
    12651319    {
     
    12891343    }
    12901344  }
    1291 }
    1292 
     1345#endif
     1346}
     1347
     1348#if QC_GENERIC_SDC_G0122
     1349Void TEncSbac::codeIntraDepthMode( TComDataCU* pcCU, UInt absPartIdx )
     1350{
     1351  UInt dir = pcCU->getLumaIntraDir( absPartIdx );
     1352
     1353  if( ( pcCU->getSlice()->getSPS()->getMaxCUWidth() >> pcCU->getDepth( absPartIdx ) ) < 64 ) //DMM and HEVC intra modes are both allowed
     1354  {
     1355    m_pcBinIf->encodeBin( isDimMode( dir ) ? 0 : 1, m_cAngleFlagSCModel.get( 0, 0, pcCU->getCtxAngleFlag( absPartIdx ) ) );
     1356  }
     1357#if !QC_SDC_UNIFY_G0130
     1358  if( pcCU->getPartitionSize( absPartIdx ) == SIZE_2Nx2N ) //SDC is allowed only in this case
     1359  {
     1360    m_pcBinIf->encodeBin( pcCU->getSDCFlag( absPartIdx ) ? 1 : 0, m_cIntraSdcFlagSCModel.get( 0, 0, pcCU->getCtxSDCFlag( absPartIdx ) ) );
     1361}
     1362#endif
     1363  if( isDimMode( dir ) )
     1364  {
     1365    UInt uiCodeIdx = 0;
     1366
     1367    switch( getDimType( dir ) )
     1368    {
     1369    case DMM1_IDX: uiCodeIdx = 0; break;
     1370    case DMM4_IDX: uiCodeIdx = 1; break;
     1371    default:                      break;
     1372    }
     1373    //mode coding
     1374    m_pcBinIf->encodeBin( uiCodeIdx == 0 ? 0 : 1, m_cDepthIntraModeSCModel.get( 0, 0, 0 ) );
     1375  }
     1376}
     1377#else
    12931378Void TEncSbac::codeIntraDepthMode( TComDataCU* pcCU, UInt absPartIdx )
    12941379{
     
    13311416  }
    13321417}
     1418#endif
    13331419#endif
    13341420
     
    22522338
    22532339#if H_3D_INTER_SDC
     2340#if QC_SDC_UNIFY_G0130
     2341Void TEncSbac::codeDeltaDC( TComDataCU* pcCU, UInt absPartIdx )
     2342{
     2343  if( !( pcCU->getSDCFlag( absPartIdx ) || ( pcCU->isIntra( absPartIdx ) && getDimType( pcCU->getLumaIntraDir( absPartIdx ) ) < DIM_NUM_TYPE ) ) )
     2344  {
     2345    assert( 0 );
     2346  }
     2347
     2348  UInt uiNumSegments = 0;
     2349  UInt dimDeltaDC = 0;
     2350
     2351  if( pcCU->isIntra( absPartIdx ) )
     2352  {
     2353    UInt dir     = pcCU->getLumaIntraDir( absPartIdx );
     2354    uiNumSegments = isDimMode( dir ) ? 2 : 1;
     2355
     2356    if( pcCU->getSDCFlag( absPartIdx ) )
     2357    {
     2358      if( uiNumSegments == 1 )
     2359      {
     2360        dimDeltaDC = pcCU->getSDCSegmentDCOffset( 0, absPartIdx ) ? 1 : 0;
     2361      }
     2362      else
     2363      {
     2364        dimDeltaDC = ( pcCU->getSDCSegmentDCOffset( 0, absPartIdx ) || pcCU->getSDCSegmentDCOffset( 1, absPartIdx ) ) ? 1 : 0;
     2365      }
     2366    }
     2367    else
     2368    {
     2369      dimDeltaDC = isDimDeltaDC( dir );
     2370    }
     2371
     2372    m_pcBinIf->encodeBin( dimDeltaDC, m_cDdcFlagSCModel.get( 0, 0, uiNumSegments-1 ) );
     2373  }
     2374  else //all-zero inter SDC is not allowed
     2375  {
     2376#if SEC_INTER_SDC_G0101
     2377    uiNumSegments = 1;
     2378#else
     2379    PartSize cPartSize = pcCU->getPartitionSize( absPartIdx );
     2380    uiNumSegments = ( cPartSize == SIZE_2Nx2N ) ? 1 : ( cPartSize == SIZE_NxN ? 4 : 2 );
     2381#endif
     2382    dimDeltaDC = 1;
     2383  }
     2384
     2385  if( dimDeltaDC )
     2386  {
     2387    for( UInt segment = 0; segment < uiNumSegments; segment++ )
     2388    {
     2389      Pel deltaDC = 0;
     2390
     2391      if( pcCU->isIntra( absPartIdx ) )
     2392      {
     2393        UInt dir     = pcCU->getLumaIntraDir( absPartIdx );
     2394        deltaDC = pcCU->getSDCFlag( absPartIdx ) ? pcCU->getSDCSegmentDCOffset( segment, absPartIdx ) : pcCU->getDimDeltaDC( getDimType( dir ), segment, absPartIdx );
     2395      }
     2396      else
     2397      {
     2398        deltaDC = pcCU->getSDCSegmentDCOffset( segment, absPartIdx );
     2399      }
     2400
     2401      xCodeDimDeltaDC( deltaDC, uiNumSegments );
     2402    }
     2403  }
     2404}
     2405
     2406Void TEncSbac::codeSDCFlag( TComDataCU* pcCU, UInt uiAbsPartIdx )
     2407{
     2408  UInt uiSymbol = pcCU->getSDCFlag( uiAbsPartIdx ) ? 1 : 0;
     2409  UInt uiCtxSDCFlag = pcCU->getCtxSDCFlag( uiAbsPartIdx );
     2410
     2411  m_pcBinIf->encodeBin( uiSymbol, m_cSDCFlagSCModel.get( 0, 0, uiCtxSDCFlag ) );
     2412}
     2413#else
    22542414Void TEncSbac::codeInterSDCFlag( TComDataCU* pcCU, UInt uiAbsPartIdx )
    22552415{
     
    22732433}
    22742434#endif
     2435#endif
    22752436
    22762437#if H_3D_DBBP
  • branches/HTM-9.3-dev0/source/Lib/TLibEncoder/TEncSbac.h

    r816 r827  
    154154#endif
    155155#if H_3D_INTER_SDC
     156#if QC_SDC_UNIFY_G0130
     157  Void codeDeltaDC       ( TComDataCU* pcCU, UInt absPartIdx );
     158  Void codeSDCFlag       ( TComDataCU* pcCU, UInt uiAbsPartIdx );
     159#else
    156160  Void codeInterSDCFlag  ( TComDataCU* pcCU, UInt uiAbsPartIdx );
    157161  Void codeInterSDCResidualData  ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiSegment );
     162#endif
    158163#endif
    159164#if H_3D_DBBP
     
    250255  ContextModel3DBuffer m_cDdcFlagSCModel;
    251256  ContextModel3DBuffer m_cDdcDataSCModel;
     257#if QC_GENERIC_SDC_G0122
     258  ContextModel3DBuffer m_cAngleFlagSCModel;
     259#if !QC_SDC_UNIFY_G0130
     260  ContextModel3DBuffer m_cIntraSdcFlagSCModel;
     261#endif
     262#endif
    252263#if H_3D_DIM_DMM
    253264  ContextModel3DBuffer m_cDmm1DataSCModel;
     
    258269#endif
    259270#endif
    260 #if H_3D_INTER_SDC
     271#if H_3D_INTER_SDC && !QC_SDC_UNIFY_G0130
    261272  ContextModel3DBuffer m_cInterSDCFlagSCModel;
    262273  ContextModel3DBuffer m_cInterSDCResidualSCModel;
    263274  ContextModel3DBuffer m_cInterSDCResidualSignFlagSCModel;
    264275#endif
     276#if QC_SDC_UNIFY_G0130
     277  ContextModel3DBuffer m_cSDCFlagSCModel;
     278#endif
    265279#if H_3D_DBBP
    266280  ContextModel3DBuffer m_cDBBPFlagSCModel;
  • branches/HTM-9.3-dev0/source/Lib/TLibEncoder/TEncSearch.cpp

    r826 r827  
    922922      m_pcEntropyCoder  ->encodePartSize( pcCU, 0, pcCU->getDepth(0), true );
    923923
     924#if QC_SDC_UNIFY_G0130
     925      m_pcEntropyCoder->encodeSDCFlag( pcCU, 0, true );
     926#endif
    924927      if (pcCU->isIntra(0) && pcCU->getPartitionSize(0) == SIZE_2Nx2N )
    925928      {
     
    938941      {
    939942        m_pcEntropyCoder->encodeIntraDirModeLuma ( pcCU, 0 );
     943#if QC_SDC_UNIFY_G0130_FIX
     944        if( pcCU->getSlice()->getIsDepth() && ( !pcCU->getSDCFlag( 0 ) ) && getDimType( pcCU->getLumaIntraDir( 0 ) ) < DIM_NUM_TYPE )
     945        {
     946          m_pcEntropyCoder->encodeDeltaDC( pcCU, 0 );
     947        }
     948#endif
    940949      }
    941950    }
     
    949958        {
    950959          m_pcEntropyCoder->encodeIntraDirModeLuma ( pcCU, uiPart * uiQNumParts );
     960#if QC_SDC_UNIFY_G0130_FIX
     961          if( pcCU->getSlice()->getIsDepth() && ( !pcCU->getSDCFlag( uiPart * uiQNumParts ) ) && getDimType( pcCU->getLumaIntraDir( uiPart * uiQNumParts ) ) < DIM_NUM_TYPE )
     962          {
     963            m_pcEntropyCoder->encodeDeltaDC( pcCU, uiPart * uiQNumParts );
     964          }
     965#endif
    951966        }
    952967      }
     
    954969      {
    955970        m_pcEntropyCoder->encodeIntraDirModeLuma ( pcCU, uiAbsPartIdx );
    956       }
    957     }
     971#if QC_SDC_UNIFY_G0130_FIX
     972        if( pcCU->getSlice()->getIsDepth() && ( !pcCU->getSDCFlag( uiAbsPartIdx ) ) && getDimType( pcCU->getLumaIntraDir( uiAbsPartIdx ) ) < DIM_NUM_TYPE )
     973        {
     974          m_pcEntropyCoder->encodeDeltaDC( pcCU, uiAbsPartIdx );
     975      }
     976#endif
     977    }
     978  }
     979#if QC_SDC_UNIFY_G0130 && !QC_SDC_UNIFY_G0130_FIX
     980    Int iPartNum = ( pcCU->isIntra( uiAbsPartIdx ) && pcCU->getPartitionSize( uiAbsPartIdx ) == SIZE_NxN ) ? 4 : 1;
     981    UInt uiPartOffset = ( pcCU->getPic()->getNumPartInCU() >> ( pcCU->getDepth( uiAbsPartIdx ) << 1 ) ) >> 2;
     982
     983    if( !pcCU->getSDCFlag( uiAbsPartIdx ) )
     984    {
     985      for( Int iPart = 0; iPart < iPartNum; iPart++ )
     986      {
     987        if( getDimType( pcCU->getLumaIntraDir( uiAbsPartIdx + uiPartOffset*iPart ) ) < DIM_NUM_TYPE )
     988        {
     989          m_pcEntropyCoder->encodeDeltaDC( pcCU, uiAbsPartIdx + uiPartOffset*iPart );
     990        }
     991      }
     992    }
     993#endif
    958994  }
    959995  if( bChroma )
     
    18621898
    18631899#if H_3D_DIM_SDC
    1864 Void TEncSearch::xIntraCodingSDC( TComDataCU* pcCU, UInt uiAbsPartIdx, TComYuv* pcOrgYuv, TComYuv* pcPredYuv, Dist& ruiDist, Double& dRDCost, Bool bResidual )
     1900Void TEncSearch::xIntraCodingSDC( TComDataCU* pcCU, UInt uiAbsPartIdx, TComYuv* pcOrgYuv, TComYuv* pcPredYuv, Dist& ruiDist, Double& dRDCost,
     1901#if QC_GENERIC_SDC_G0122
     1902  Bool bZeroResidual, Int iSDCDeltaResi
     1903#else
     1904  Bool bResidual
     1905#endif
     1906  )
    18651907{
    18661908  UInt    uiLumaPredMode    = pcCU     ->getLumaIntraDir( uiAbsPartIdx );
    18671909  UInt    uiWidth           = pcCU     ->getWidth   ( 0 );
    18681910  UInt    uiHeight          = pcCU     ->getHeight  ( 0 );
     1911#if QC_PKU_SDC_SPLIT_G0123
     1912#if HS_TSINGHUA_SDC_SPLIT_G0111
     1913#if QC_GENERIC_SDC_G0122
     1914  TComWedgelet* dmm4SegmentationOrg = new TComWedgelet( uiWidth, uiHeight );
     1915#endif
     1916#else
     1917#if QC_GENERIC_SDC_G0122
     1918  TComWedgelet* dmm4Segmentation = new TComWedgelet( uiWidth, uiHeight );
     1919#endif
     1920#endif
     1921#endif
     1922#if QC_PKU_SDC_SPLIT_G0123
     1923  UInt numParts = 1;
     1924  UInt i = 0;
     1925  UInt sdcDepth = 0;
     1926  UInt uiStride;         
     1927  Pel* piOrg;         
     1928  Pel* piPred;         
     1929  Pel* piReco;       
     1930
     1931  UInt uiZOrder;         
     1932  Pel* piRecIPred;       
     1933  UInt uiRecIPredStride;
     1934
     1935#if HS_TSINGHUA_SDC_SPLIT_G0111
     1936  if ( ( uiWidth >> pcCU->getSlice()->getSPS()->getQuadtreeTULog2MaxSize() ) > 1 )
     1937  {
     1938    numParts = uiWidth * uiWidth >> ( 2 * pcCU->getSlice()->getSPS()->getQuadtreeTULog2MaxSize() );
     1939    sdcDepth = g_aucConvertToBit[uiWidth] + 2 - pcCU->getSlice()->getSPS()->getQuadtreeTULog2MaxSize();
     1940    uiWidth = uiHeight = ( 1 << pcCU->getSlice()->getSPS()->getQuadtreeTULog2MaxSize() );
     1941  }
     1942#else
     1943  if (uiWidth == 64)
     1944  {
     1945    numParts = 4;
     1946    sdcDepth = 1;
     1947    uiWidth = uiHeight = 32;
     1948  }
     1949#endif
     1950
     1951  for ( i = 0; i < numParts; i++ )
     1952  {
     1953    uiStride          = pcOrgYuv ->getStride  ();
     1954    piOrg             = pcOrgYuv ->getLumaAddr( uiAbsPartIdx );
     1955    piPred            = pcPredYuv->getLumaAddr( uiAbsPartIdx );
     1956    piReco            = pcPredYuv->getLumaAddr( uiAbsPartIdx );
     1957
     1958    uiZOrder          = pcCU->getZorderIdxInCU() + uiAbsPartIdx;
     1959    piRecIPred        = pcCU->getPic()->getPicYuvRec()->getLumaAddr( pcCU->getAddr(), uiZOrder );
     1960    uiRecIPredStride  = pcCU->getPic()->getPicYuvRec()->getStride  ();
     1961
     1962    AOF( uiWidth == uiHeight );
     1963#else
    18691964  UInt    uiStride          = pcOrgYuv ->getStride  ();
    18701965  Pel*    piOrg             = pcOrgYuv ->getLumaAddr( uiAbsPartIdx );
     
    18801975  AOF( pcCU->getSDCAvailable(uiAbsPartIdx) );
    18811976  AOF( pcCU->getSDCFlag(uiAbsPartIdx) );
     1977#endif
     1978#if !QC_GENERIC_SDC_G0122
    18821979  AOF( uiLumaPredMode == DC_IDX || uiLumaPredMode == PLANAR_IDX || ( getDimType( uiLumaPredMode ) == DMM1_IDX && !isDimDeltaDC( uiLumaPredMode ) ) );
    18831980  AOF( uiLumaPredMode == DC_IDX || uiLumaPredMode == PLANAR_IDX || uiWidth < 64  );
     1981#endif
    18841982 
    18851983  //===== init availability pattern =====
    18861984  Bool  bAboveAvail = false;
    18871985  Bool  bLeftAvail  = false;
     1986#if QC_PKU_SDC_SPLIT_G0123
     1987  pcCU->getPattern()->initPattern   ( pcCU, sdcDepth, uiAbsPartIdx );
     1988  pcCU->getPattern()->initAdiPattern( pcCU, uiAbsPartIdx, sdcDepth, m_piYuvExt, m_iYuvExtStride, m_iYuvExtHeight, bAboveAvail, bLeftAvail );
     1989#else
    18881990  pcCU->getPattern()->initPattern   ( pcCU, 0, uiAbsPartIdx );
    18891991  pcCU->getPattern()->initAdiPattern( pcCU, uiAbsPartIdx, 0, m_piYuvExt, m_iYuvExtStride, m_iYuvExtHeight, bAboveAvail, bLeftAvail );
    18901992 
     1993#endif
     1994#if !QC_PKU_SDC_SPLIT_G0123
     1995#if QC_GENERIC_SDC_G0122
     1996  TComWedgelet* dmm4Segmentation = new TComWedgelet( uiWidth, uiHeight );
     1997#endif
     1998#endif
     1999#if HS_TSINGHUA_SDC_SPLIT_G0111
     2000#if QC_GENERIC_SDC_G0122
     2001  TComWedgelet* dmm4Segmentation = new TComWedgelet( uiWidth, uiHeight );
     2002#endif
     2003#endif
    18912004  //===== get prediction signal =====
    18922005#if H_3D_DIM
    18932006  if( isDimMode( uiLumaPredMode ) )
    18942007  {
    1895     predIntraLumaDepth( pcCU, uiAbsPartIdx, uiLumaPredMode, piPred, uiStride, uiWidth, uiHeight, true );
     2008#if HS_TSINGHUA_SDC_SPLIT_G0111 
     2009    UInt dimType   = getDimType  ( uiLumaPredMode );
     2010    UInt patternID = pcCU->getDmmWedgeTabIdx(dimType, uiAbsPartIdx);
     2011    if ( patternID >= g_dmmWedgeLists[g_aucConvertToBit[uiWidth]].size() && dimType == DMM1_IDX )
     2012    {
     2013      if (g_aucConvertToBit[uiWidth] == 2)  // Encoder method. Avoid DMM1 pattern list index exceeds the maximum DMM1 pattern number when SDC split is used.
     2014        patternID = 1349;  // Split 32x32 to 16x16. 1349: Maximum DMM1 pattern number when block size is 16x16
     2015      else
     2016        patternID = patternID >> 1;  // Other cases
     2017      pcCU->setDmmWedgeTabIdx(dimType, uiAbsPartIdx, patternID);
     2018    }
     2019#endif
     2020    predIntraLumaDepth( pcCU, uiAbsPartIdx, uiLumaPredMode, piPred, uiStride, uiWidth, uiHeight, true
     2021#if QC_GENERIC_SDC_G0122
     2022      , dmm4Segmentation
     2023#endif
     2024      );
     2025#if HS_TSINGHUA_SDC_SPLIT_G0111
     2026    Bool* dmm4PatternSplit = dmm4Segmentation->getPattern();
     2027    Bool* dmm4PatternOrg = dmm4SegmentationOrg->getPattern();
     2028    for( UInt k = 0; k < (uiWidth*uiHeight); k++ )
     2029    {
     2030      dmm4PatternOrg[k+(uiAbsPartIdx<<4)] = dmm4PatternSplit[k];
     2031    }
     2032#endif
    18962033  }
    18972034  else
     
    19022039  }
    19032040#endif
    1904  
     2041#if QC_PKU_SDC_SPLIT_G0123
     2042    if ( numParts > 1 )
     2043    {
     2044      for( UInt uiY = 0; uiY < uiHeight; uiY++ )
     2045      {
     2046        for( UInt uiX = 0; uiX < uiWidth; uiX++ )
     2047        {
     2048          piPred        [ uiX ] = ClipY( piPred[ uiX ] );
     2049          piRecIPred    [ uiX ] = piPred[ uiX ];
     2050        }
     2051        piPred     += uiStride;
     2052        piRecIPred += uiRecIPredStride;
     2053      }
     2054    }
     2055    uiAbsPartIdx += ( ( uiWidth * uiWidth ) >> 4 );
     2056#if HS_TSINGHUA_SDC_SPLIT_G0111
     2057    dmm4Segmentation->destroy(); delete dmm4Segmentation;
     2058#endif
     2059  }
     2060  uiAbsPartIdx = 0;
     2061  uiStride          = pcOrgYuv ->getStride  ();
     2062  piOrg             = pcOrgYuv ->getLumaAddr( uiAbsPartIdx );
     2063  piPred            = pcPredYuv->getLumaAddr( uiAbsPartIdx );
     2064  piReco            = pcPredYuv->getLumaAddr( uiAbsPartIdx );
     2065 
     2066  uiZOrder          = pcCU->getZorderIdxInCU() + uiAbsPartIdx;
     2067  piRecIPred        = pcCU->getPic()->getPicYuvRec()->getLumaAddr( pcCU->getAddr(), uiZOrder );
     2068  uiRecIPredStride  = pcCU->getPic()->getPicYuvRec()->getStride  ();
     2069
     2070  if (numParts > 1)
     2071  {
     2072    uiWidth = pcCU->getWidth( 0 );
     2073    uiHeight = pcCU->getHeight( 0 );
     2074  }
     2075#endif
    19052076  // number of segments depends on prediction mode
    19062077  UInt uiNumSegments = 1;
     
    19192090    uiMaskStride = pcWedgelet->getStride();
    19202091  }
     2092#if QC_GENERIC_SDC_G0122
     2093  if( getDimType( uiLumaPredMode ) == DMM4_IDX )
     2094  {
     2095    uiNumSegments = 2;
     2096#if HS_TSINGHUA_SDC_SPLIT_G0111
     2097    pbMask  = dmm4SegmentationOrg->getPattern();
     2098    uiMaskStride = dmm4SegmentationOrg->getStride();
     2099#else
     2100    pbMask  = dmm4Segmentation->getPattern();
     2101    uiMaskStride = dmm4Segmentation->getStride();
     2102#endif
     2103  }
     2104#endif
    19212105 
    19222106  // get DC prediction for each segment
     
    19312115  {
    19322116    // remap reconstructed value to valid depth values
     2117#if QC_GENERIC_SDC_G0122
     2118    Pel pDCRec = ( !bZeroResidual ) ? apDCOrigValues[uiSegment] : apDCPredValues[uiSegment];
     2119#else
    19332120    Pel pDCRec = bResidual?apDCOrigValues[uiSegment]:apDCPredValues[uiSegment];
    1934    
     2121#endif
    19352122    // get residual (idx)
    19362123#if H_3D_DIM_DLT
     
    19392126    Pel pResidualIdx = pDCRec - apDCPredValues[uiSegment];
    19402127#endif
    1941    
     2128#if QC_GENERIC_SDC_G0122
     2129    if( !bZeroResidual )
     2130    {
     2131      Pel   pPredIdx    = pcCU->getSlice()->getPPS()->getDLT()->depthValue2idx( pcCU->getSlice()->getLayerIdInVps(), apDCPredValues[uiSegment] );
     2132      Int   pTestIdx    = pPredIdx + pResidualIdx + iSDCDeltaResi;
     2133      if( pTestIdx >= 0 && pTestIdx < pcCU->getSlice()->getPPS()->getDLT()->getNumDepthValues( pcCU->getSlice()->getLayerIdInVps() ) )
     2134      {
     2135        pResidualIdx += iSDCDeltaResi;
     2136      }
     2137    }
     2138#endif
    19422139    // save SDC DC offset
    19432140    pcCU->setSDCSegmentDCOffset(pResidualIdx, uiSegment, uiAbsPartIdx);
     
    20122209 
    20132210  // encode reduced intra header
     2211#if QC_SDC_UNIFY_G0130
     2212  if( !pcCU->getSlice()->isIntra() )
     2213  {
     2214    if (pcCU->getSlice()->getPPS()->getTransquantBypassEnableFlag())
     2215    {
     2216      m_pcEntropyCoder->encodeCUTransquantBypassFlag( pcCU, 0, true );
     2217    }
     2218    m_pcEntropyCoder->encodeSkipFlag( pcCU, 0, true );
     2219    m_pcEntropyCoder->encodePredMode( pcCU, 0, true );
     2220  }
     2221
     2222  m_pcEntropyCoder->encodePartSize( pcCU, 0, true );
     2223  m_pcEntropyCoder->encodeSDCFlag( pcCU, 0, true );
     2224#else
    20142225  m_pcEntropyCoder->encodePredMode( pcCU, 0, true );
     2226#endif
    20152227 
    20162228  // encode pred direction + DC residual data
    20172229  m_pcEntropyCoder->encodePredInfo( pcCU, 0, true );
     2230#if QC_SDC_UNIFY_G0130
     2231  Bool bDummy = false;
     2232  m_pcEntropyCoder->encodeCoeff( pcCU, 0, pcCU->getDepth( 0 ), uiWidth, uiHeight, bDummy );
     2233#endif
    20182234  UInt uiBits = m_pcEntropyCoder->getNumberOfWrittenBits();
    20192235 
     
    20242240#endif
    20252241    dRDCost = m_pcRdCost->calcRdCost( uiBits, ruiDist );
     2242#if QC_GENERIC_SDC_G0122
     2243#if HS_TSINGHUA_SDC_SPLIT_G0111
     2244  dmm4SegmentationOrg->destroy(); delete dmm4SegmentationOrg;
     2245#else
     2246  dmm4Segmentation->destroy(); delete dmm4Segmentation;
     2247#endif
     2248#endif
    20262249}
    20272250#endif
     
    29013124          case( DMM4_IDX ):
    29023125            {
     3126#if !QC_GENERIC_SDC_G0122
    29033127              if( uiWidth > 4 )
     3128#endif
    29043129              {
    29053130                biSegmentation = new TComWedgelet( uiWidth, uiHeight );
     
    29573182      {
    29583183        pcCU->setSDCFlagSubParts( (uiSDC != 0), uiPartOffset, uiDepth + uiInitTrDepth );
     3184#if QC_GENERIC_SDC_G0122
     3185        for( Int iSDCDeltaResi = -2; iSDCDeltaResi <= 2; iSDCDeltaResi++ )
     3186        {
     3187          if( ( uiSDC == 0 ) && iSDCDeltaResi != 0 )
     3188          {
     3189            continue;
     3190          }
     3191#endif
    29593192#endif
    29603193     
     
    29663199#if H_3D_DIM_SDC
    29673200      bTestZeroResi |= pcCU->getSDCFlag(uiPartOffset);
     3201#endif
     3202#if QC_GENERIC_SDC_G0122
     3203      if( uiSDC != 0 && iSDCDeltaResi != 0 )
     3204      {
     3205        bTestZeroResi = false;
     3206      }
    29683207#endif
    29693208#endif
     
    30003239             
    30013240              // start encoding with SDC
     3241#if QC_GENERIC_SDC_G0122
     3242              xIntraCodingSDC(pcCU, uiPartOffset, pcOrgYuv, pcPredYuv, uiPUDistY, dPUCost, ( testZeroResi != 0 ), iSDCDeltaResi );
     3243#else
    30023244              xIntraCodingSDC(pcCU, uiPartOffset, pcOrgYuv, pcPredYuv, uiPUDistY, dPUCost, (testZeroResi!=0));
     3245#endif
    30033246            }
    30043247            else
     
    30733316#if H_3D_DIM_ENC || H_3D_DIM_SDC
    30743317      }
     3318#endif
     3319#if QC_GENERIC_SDC_G0122
     3320        } // SDC residual loop
    30753321#endif
    30763322#if H_3D_DIM_SDC
     
    57465992
    57475993#if H_3D_INTER_SDC
     5994#if SEC_INTER_SDC_G0101
     5995Void TEncSearch::encodeResAndCalcRdInterSDCCU( TComDataCU* pcCU, TComYuv* pcOrg, TComYuv* pcPred, TComYuv* pcResi, TComYuv* pcRec, Int uiOffest, const UInt uiDepth )
     5996#else
    57485997Void TEncSearch::encodeResAndCalcRdInterSDCCU( TComDataCU* pcCU, TComYuv* pcOrg, TComYuv* pcPred, TComYuv* pcResi, TComYuv* pcRec, const UInt uiDepth )
     5998#endif
    57495999{
    57506000  if( !pcCU->getSlice()->getIsDepth() || pcCU->isIntra( 0 ) )
     
    57526002    return;
    57536003  }
    5754 
     6004#if QC_SDC_UNIFY_G0130
     6005  pcCU->setSDCFlagSubParts( true, 0, uiDepth );
     6006#else
    57556007  pcCU->setInterSDCFlagSubParts( true, 0, 0, uiDepth );
     6008#endif
    57566009
    57576010  UInt  uiWidth      = pcCU->getWidth ( 0 );
    57586011  UInt  uiHeight     = pcCU->getHeight( 0 );
     6012#if SEC_INTER_SDC_G0101
     6013  UInt uiSegSize = 0;
     6014#else
    57596015  UChar* pMask       = pcCU->getInterSDCMask();
    57606016  memset( pMask, 0, uiWidth*uiHeight );
     
    57636019
    57646020  UInt uiSegSize[4] = { 0, 0, 0, 0 };
     6021#endif
    57656022  Pel *pPred, *pOrg;
    57666023  UInt uiPredStride = pcPred->getStride();
    57676024  UInt uiOrgStride  = pcOrg->getStride();
    57686025  UInt uiPelX, uiPelY;
     6026#if !SEC_INTER_SDC_G0101
    57696027  UInt uiPartitionSize = pcCU->getPartitionSize( 0 );
    57706028  UInt uiSegmentNum = ( uiPartitionSize == SIZE_2Nx2N ) ? 1 : ( uiPartitionSize == SIZE_NxN ? 4 : 2 );
     6029#endif
    57716030
    57726031  pPred = pcPred->getLumaAddr( 0 );
    57736032  pOrg  = pcOrg->getLumaAddr( 0 );
     6033#if SEC_INTER_SDC_G0101
     6034  Int pResDC = 0;
     6035#else
    57746036  Int pResDC[4] = { 0, 0, 0, 0};
     6037#endif
    57756038
    57766039  //calculate dc value for prediction and original signal, and calculate residual and reconstruction
     
    57796042    for( uiPelX = 0; uiPelX < uiWidth; uiPelX++ )
    57806043    {
     6044#if SEC_INTER_SDC_G0101
     6045      pResDC += (Int)( pOrg [uiPelX] - pPred[uiPelX] );
     6046      uiSegSize++;
     6047#else
    57816048      UChar uiSeg = pMask[ uiPelX + uiPelY*uiWidth ];
    57826049      pResDC[uiSeg] += (Int)( pOrg [uiPelX] - pPred[uiPelX] );
    57836050      uiSegSize[uiSeg]++;
     6051#endif
    57846052    }
    57856053    pOrg  += uiOrgStride;
     
    57876055  }
    57886056
     6057#if SEC_INTER_SDC_G0101
     6058  Int iResiOffset = ( pResDC  > 0 ? ( uiSegSize >> 1 ) : -1*( uiSegSize >> 1 ) );
     6059  pResDC          = ( pResDC + iResiOffset ) / (Int) uiSegSize;
     6060
     6061  pcCU->setSDCSegmentDCOffset( pResDC + uiOffest, 0, 0 );
     6062#else
    57896063  for( UInt uiSeg = 0; uiSeg < uiSegmentNum; uiSeg++ )
    57906064  {
    57916065    Int iResiOffset = ( pResDC [uiSeg] > 0 ? ( uiSegSize[uiSeg] >> 1 ) : -1*( uiSegSize[uiSeg] >> 1 ) );
    57926066    pResDC [uiSeg]  = ( pResDC [uiSeg] + iResiOffset ) / (Int) uiSegSize[uiSeg];
    5793 
     6067#if QC_SDC_UNIFY_G0130
     6068    pcCU->setSDCSegmentDCOffset( pResDC[uiSeg], uiSeg, 0 );
     6069#else
    57946070    pcCU->setInterSDCSegmentDCOffset( pResDC[uiSeg], uiSeg, 0 );
    5795   }
     6071#endif
     6072  }
     6073#endif
    57966074
    57976075  Pel *pRec;
     
    58046082    for( uiPelX = 0; uiPelX < uiWidth; uiPelX++ )
    58056083    {
     6084#if SEC_INTER_SDC_G0101
     6085      pRec[ uiPelX ] = Clip3( 0, ( 1 << g_bitDepthY ) - 1, pPred[uiPelX] + pcCU->getSDCSegmentDCOffset(0, 0) );
     6086#else
    58066087      UChar uiSeg = pMask[ uiPelX + uiPelY*uiWidth ];
    58076088      assert( uiSeg < uiSegmentNum );
    58086089
    58096090      pRec[ uiPelX ] = Clip3( 0, ( 1 << g_bitDepthY ) - 1, pPred[uiPelX] + pResDC[uiSeg] );
     6091#endif
    58106092    }
    58116093    pPred     += uiPredStride;
     
    58476129#endif
    58486130
     6131#if QC_SDC_UNIFY_G0130
     6132  Bool bNonSkip = false;
     6133#else
    58496134  Bool bNonSkip = true;
     6135#endif
     6136#if SEC_INTER_SDC_G0101
     6137  bNonSkip |= ( pcCU->getSDCSegmentDCOffset( 0, 0 ) != 0 ) ? 1 : 0;
     6138#else
    58506139  for( UInt uiSeg = 0; uiSeg < uiSegmentNum; uiSeg++ )
    58516140  {
     6141#if QC_SDC_UNIFY_G0130
     6142    bNonSkip |= ( pcCU->getSDCSegmentDCOffset( uiSeg, 0 ) != 0 ) ? 1 : 0;
     6143#else
    58526144    bNonSkip &= ( pcCU->getInterSDCSegmentDCOffset( uiSeg, 0 ) != 0 ) ? 1 : 0;
    5853   }
     6145#endif
     6146  }
     6147#endif
    58546148
    58556149  if( !bNonSkip )
     
    70687362    m_pcEntropyCoder->encodePredMode( pcCU, 0, true );
    70697363    m_pcEntropyCoder->encodePartSize( pcCU, 0, pcCU->getDepth(0), true );
     7364#if QC_SDC_UNIFY_G0130
     7365    m_pcEntropyCoder->encodeSDCFlag( pcCU, 0, true );
     7366#endif
    70707367    m_pcEntropyCoder->encodePredInfo( pcCU, 0, true );
    70717368#if !SEC_IC_ARP_SIG_G0072
     
    70827379#endif
    70837380#endif
    7084 #if H_3D_INTER_SDC
     7381#if H_3D_INTER_SDC && !QC_SDC_UNIFY_G0130
    70857382    m_pcEntropyCoder->encodeInterSDCFlag( pcCU, 0, true );
    70867383#endif
  • branches/HTM-9.3-dev0/source/Lib/TLibEncoder/TEncSearch.h

    r773 r827  
    219219    TComYuv* pcResi,
    220220    TComYuv* pcRec,
     221#if SEC_INTER_SDC_G0101
     222    Int      uiOffset,
     223#endif
    221224    const UInt uiDepth );
    222225#endif
     
    353356#endif
    354357#if H_3D_DIM_SDC
    355   Void xIntraCodingSDC            ( TComDataCU* pcCU, UInt uiAbsPartIdx, TComYuv* pcOrgYuv, TComYuv* pcPredYuv, Dist& ruiDist, Double& dRDCost, Bool bResidual );
     358  Void xIntraCodingSDC            ( TComDataCU* pcCU, UInt uiAbsPartIdx, TComYuv* pcOrgYuv, TComYuv* pcPredYuv, Dist& ruiDist, Double& dRDCost,
     359#if QC_GENERIC_SDC_G0122
     360    Bool bZeroResidual, Int iSDCDeltaResi
     361#else
     362    Bool bResidual
     363#endif
     364    );
    356365#endif
    357366#endif
Note: See TracChangeset for help on using the changeset viewer.