Changeset 1179 in 3DVCSoftware for trunk/source/Lib/TLibEncoder/TEncCu.cpp


Ignore:
Timestamp:
7 Apr 2015, 17:05:30 (9 years ago)
Author:
tech
Message:

Merged branch 13.1-dev0@1178.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/source/Lib/TLibEncoder/TEncCu.cpp

    r1133 r1179  
    44 * granted under this license. 
    55 *
    6 * Copyright (c) 2010-2014, ITU/ISO/IEC
     6* Copyright (c) 2010-2015, ITU/ISO/IEC
    77 * All rights reserved.
    88 *
     
    275275  m_ppcTempCU[0]->initCU( rpcCU->getPic(), rpcCU->getAddr() );
    276276
     277#if H_3D_DISABLE_CHROMA
     278  m_ppcWeightedTempCU[0]->initCU( rpcCU->getPic(), rpcCU->getAddr() );
     279#endif
     280
    277281#if KWU_RC_MADPRED_E0227
    278282  m_LCUPredictionSAD = 0;
     
    437441#if H_3D_VSP
    438442  DisInfo DvInfo;
     443#if !SEC_ARP_REM_ENC_RESTRICT_K0035
    439444  DvInfo.bDV = false;
     445#endif
    440446  DvInfo.m_acNBDV.setZero();
    441447  DvInfo.m_aVIdxCan = 0;
     
    583589          if (rpcTempCU->getSlice()->getIsDepth() )
    584590          {
     591#if SEC_ARP_REM_ENC_RESTRICT_K0035
     592            rpcTempCU->getDispforDepth(0, 0, &DvInfo);
     593#else
    585594            DvInfo.bDV = rpcTempCU->getDispforDepth(0, 0, &DvInfo);
     595#endif
    586596          }
    587597          else
     
    590600#if H_3D_NBDV_REF
    591601          if( rpcTempCU->getSlice()->getDepthRefinementFlag() )
     602#if SEC_ARP_REM_ENC_RESTRICT_K0035
     603            rpcTempCU->getDisMvpCandNBDV(&DvInfo, true);
     604#else
    592605            DvInfo.bDV = rpcTempCU->getDisMvpCandNBDV(&DvInfo, true);
     606#endif
    593607          else
    594608#endif
     609#if SEC_ARP_REM_ENC_RESTRICT_K0035
     610            rpcTempCU->getDisMvpCandNBDV(&DvInfo);
     611#else
    595612            DvInfo.bDV = rpcTempCU->getDisMvpCandNBDV(&DvInfo);
     613#endif
    596614
    597615#if H_3D_IV_MERGE
     
    712730    }
    713731#endif
     732#if SEC_DEPTH_INTRA_SKIP_MODE_K0033
     733    rpcTempCU->initEstData( uiDepth, iMinQP, isAddLowestQP  );
     734    if( rpcBestCU->getSlice()->getDepthIntraSkipFlag() )
     735    {
     736      xCheckRDCostDIS( rpcBestCU, rpcTempCU, SIZE_2Nx2N );
     737      rpcTempCU->initEstData( uiDepth, iMinQP, isAddLowestQP  );
     738    }
     739#else
    714740#if H_3D_SINGLE_DEPTH
    715741    rpcTempCU->initEstData( uiDepth, iMinQP, isAddLowestQP  );
     
    719745      rpcTempCU->initEstData( uiDepth, iMinQP, isAddLowestQP  );
    720746    }
     747#endif
    721748#endif
    722749    if(!earlyDetectionSkipMode)
     
    12261253      TComDataCU* pcSubTempPartCU     = m_ppcTempCU[uhNextDepth];
    12271254
     1255#if H_3D_DISABLE_CHROMA
     1256      m_ppcWeightedTempCU[uhNextDepth]->setSlice( m_ppcWeightedTempCU[ uiDepth]->getSlice());
     1257#endif
    12281258      for ( UInt uiPartUnitIdx = 0; uiPartUnitIdx < 4; uiPartUnitIdx++ )
    12291259      {
     
    15771607    return;
    15781608  }
     1609#if SEC_DEPTH_INTRA_SKIP_MODE_K0033
     1610  m_pcEntropyCoder->encodeDIS( pcCU, uiAbsPartIdx );
     1611  if(!pcCU->getDISFlag(uiAbsPartIdx))
     1612  {
     1613#else
    15791614#if H_3D_SINGLE_DEPTH
    15801615  m_pcEntropyCoder->encodeSingleDepthMode( pcCU, uiAbsPartIdx );
     
    15821617  {
    15831618#endif
     1619#endif
    15841620  m_pcEntropyCoder->encodePredMode( pcCU, uiAbsPartIdx );
    15851621 
    15861622  m_pcEntropyCoder->encodePartSize( pcCU, uiAbsPartIdx, uiDepth );
    15871623 
     1624#if !HHI_MOVE_SYN_K0052
    15881625#if H_3D_DIM_SDC
    15891626  m_pcEntropyCoder->encodeSDCFlag( pcCU, uiAbsPartIdx, false );
    15901627#endif
     1628#endif
    15911629  if (pcCU->isIntra( uiAbsPartIdx ) && pcCU->getPartitionSize( uiAbsPartIdx ) == SIZE_2Nx2N )
    15921630  {
    15931631    m_pcEntropyCoder->encodeIPCMInfo( pcCU, uiAbsPartIdx );
    1594 
    15951632    if(pcCU->getIPCMFlag(uiAbsPartIdx))
    15961633    {
     1634#if HHI_MOVE_SYN_K0052
     1635#if H_3D_DIM_SDC
     1636      m_pcEntropyCoder->encodeSDCFlag( pcCU, uiAbsPartIdx, false );
     1637#endif 
     1638#endif
    15971639      // Encode slice finish
    15981640      finishCU(pcCU,uiAbsPartIdx,uiDepth);
     
    16031645  // prediction Info ( Intra : direction mode, Inter : Mv, reference idx )
    16041646  m_pcEntropyCoder->encodePredInfo( pcCU, uiAbsPartIdx );
    1605 
     1647#if HHI_MOVE_SYN_K0052
     1648  m_pcEntropyCoder->encodeDBBPFlag( pcCU, uiAbsPartIdx );
     1649#if H_3D_DIM_SDC
     1650  m_pcEntropyCoder->encodeSDCFlag( pcCU, uiAbsPartIdx, false );
     1651#endif 
     1652#endif
    16061653#if H_3D_ARP
    16071654  m_pcEntropyCoder->encodeARPW( pcCU , uiAbsPartIdx );
     
    16121659  // Encode Coefficients
    16131660  Bool bCodeDQP = getdQPFlag();
     1661#if H_3D_DISABLE_CHROMA
     1662  m_pcEntropyCoder->encodeCoeff( pcCU, uiAbsPartIdx, uiDepth, pcCU->getWidth (uiAbsPartIdx), pcCU->getHeight(uiAbsPartIdx), bCodeDQP, false );
     1663#else
    16141664  m_pcEntropyCoder->encodeCoeff( pcCU, uiAbsPartIdx, uiDepth, pcCU->getWidth (uiAbsPartIdx), pcCU->getHeight(uiAbsPartIdx), bCodeDQP );
     1665#endif
    16151666  setdQPFlag( bCodeDQP );
     1667#if SEC_DEPTH_INTRA_SKIP_MODE_K0033
     1668  }
     1669#else
    16161670#if H_3D_SINGLE_DEPTH
    16171671  }
     1672#endif
    16181673#endif
    16191674  // --- write terminating bit ---
     
    18341889#if H_3D_ARP
    18351890  Int nARPWMax = rpcTempCU->getSlice()->getARPStepNum() - 1;
     1891#if SEC_ARP_REM_ENC_RESTRICT_K0035
     1892  if( nARPWMax < 0 || bICFlag )
     1893#else
    18361894  if( nARPWMax < 0 || !rpcTempCU->getDvInfo(0).bDV || bICFlag )
     1895#endif
    18371896  {
    18381897    nARPWMax = 0;
     
    20002059
    20012060          rpcTempCU->setSkipFlagSubParts( rpcTempCU->getQtRootCbf(0) == 0, 0, uhDepth );
     2061#if SEC_DEPTH_INTRA_SKIP_MODE_K0033
     2062          rpcTempCU->setDISFlagSubParts( false, 0, uhDepth );
     2063#else
    20022064#if H_3D_SINGLE_DEPTH
    20032065          rpcTempCU->setSingleDepthFlagSubParts( false, 0, uhDepth );
     2066#endif
    20042067#endif
    20052068#if H_3D_VSP // possible bug fix
     
    20422105              }
    20432106              rpcTempCU->setSkipFlagSubParts( false, 0, uhDepth );
     2107#if SEC_DEPTH_INTRA_SKIP_MODE_K0033
     2108              rpcTempCU->setDISFlagSubParts( false, 0, uhDepth );
     2109#else
    20442110#if H_3D_SINGLE_DEPTH
    20452111              rpcTempCU->setSingleDepthFlagSubParts( false, 0, uhDepth );
     2112#endif
    20462113#endif
    20472114              rpcTempCU->setTrIdxSubParts( 0, 0, uhDepth );
     
    21662233  Bool bFirstTime = true;
    21672234  Int nARPWMax    = rpcTempCU->getSlice()->getARPStepNum() - 1;
    2168 
     2235#if SEC_ARP_REM_ENC_RESTRICT_K0035
     2236  if( nARPWMax < 0 || ePartSize != SIZE_2Nx2N || rpcTempCU->getICFlag(0) )
     2237#else
    21692238  if( nARPWMax < 0 || ePartSize != SIZE_2Nx2N || !rpcTempCU->getDvInfo(0).bDV || rpcTempCU->getICFlag(0) )
     2239#endif
    21702240  {
    21712241    nARPWMax = 0;
     
    21932263 
    21942264  rpcTempCU->setSkipFlagSubParts( false, 0, uhDepth );
     2265#if SEC_DEPTH_INTRA_SKIP_MODE_K0033
     2266  rpcTempCU->setDISFlagSubParts( false, 0, uhDepth );
     2267#else
    21952268#if H_3D_SINGLE_DEPTH
    21962269  rpcTempCU->setSingleDepthFlagSubParts( false, 0, uhDepth );
     2270#endif
    21972271#endif
    21982272  rpcTempCU->setPartSizeSubParts  ( ePartSize,  0, uhDepth );
     
    23032377      }
    23042378      rpcTempCU->setSkipFlagSubParts( false, 0, uhDepth );
     2379#if SEC_DEPTH_INTRA_SKIP_MODE_K0033
     2380      rpcTempCU->setDISFlagSubParts( false, 0, uhDepth );
     2381#else
    23052382#if H_3D_SINGLE_DEPTH
    23062383      rpcTempCU->setSingleDepthFlagSubParts( false, 0, uhDepth );
     2384#endif
    23072385#endif
    23082386      rpcTempCU->setTrIdxSubParts( 0, 0, uhDepth );
     
    24132491  }
    24142492}
     2493
     2494#if SEC_DEPTH_INTRA_SKIP_MODE_K0033
     2495Void TEncCu::xCheckRDCostDIS( TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU, PartSize eSize )
     2496{
     2497  UInt uiDepth = rpcTempCU->getDepth( 0 );
     2498  if( !rpcBestCU->getSlice()->getIsDepth() || (eSize != SIZE_2Nx2N))
     2499  {
     2500    return;
     2501  }
     2502
     2503#if H_3D_VSO // M5
     2504  if( m_pcRdCost->getUseRenModel() )
     2505  {
     2506    UInt  uiWidth     = m_ppcOrigYuv[uiDepth]->getWidth   ();
     2507    UInt  uiHeight    = m_ppcOrigYuv[uiDepth]->getHeight  ();
     2508    Pel*  piSrc       = m_ppcOrigYuv[uiDepth]->getLumaAddr();
     2509    UInt  uiSrcStride = m_ppcOrigYuv[uiDepth]->getStride  ();
     2510    m_pcRdCost->setRenModelData( rpcTempCU, 0, piSrc, uiSrcStride, uiWidth, uiHeight );
     2511  }
     2512#endif
     2513
     2514  rpcTempCU->setSkipFlagSubParts( false, 0, uiDepth );
     2515  rpcTempCU->setPartSizeSubParts( SIZE_2Nx2N, 0, uiDepth );
     2516  rpcTempCU->setPredModeSubParts( MODE_INTRA, 0, uiDepth );
     2517  rpcTempCU->setCUTransquantBypassSubParts( rpcTempCU->getCUTransquantBypass(0), 0, uiDepth );
     2518
     2519  rpcTempCU->setTrIdxSubParts(0, 0, uiDepth);
     2520  rpcTempCU->setCbfSubParts(0, 1, 1, 0, uiDepth);
     2521  rpcTempCU->setDISFlagSubParts(true, 0, uiDepth);
     2522  rpcTempCU->setLumaIntraDirSubParts (DC_IDX, 0, uiDepth);
     2523#if H_3D_DIM_SDC
     2524  rpcTempCU->setSDCFlagSubParts( false, 0, uiDepth);
     2525#endif
     2526
     2527  UInt uiPreCalcDistC;
     2528  m_pcPredSearch  ->estIntraPredDIS      ( rpcTempCU, m_ppcOrigYuv[uiDepth], m_ppcPredYuvTemp[uiDepth], m_ppcResiYuvTemp[uiDepth], m_ppcRecoYuvTemp[uiDepth], uiPreCalcDistC, false );
     2529
     2530#if ENC_DEC_TRACE && H_MV_ENC_DEC_TRAC
     2531  Int oldTraceCopyBack = g_traceCopyBack;
     2532  g_traceCopyBack = false; 
     2533#endif
     2534  m_ppcRecoYuvTemp[uiDepth]->copyToPicLuma(rpcTempCU->getPic()->getPicYuvRec(), rpcTempCU->getAddr(), rpcTempCU->getZorderIdxInCU() );
     2535  #if ENC_DEC_TRACE && H_MV_ENC_DEC_TRAC 
     2536    g_traceCopyBack = oldTraceCopyBack;
     2537  #endif
     2538
     2539
     2540  m_pcEntropyCoder->resetBits();
     2541  if ( rpcTempCU->getSlice()->getPPS()->getTransquantBypassEnableFlag())
     2542  {
     2543    m_pcEntropyCoder->encodeCUTransquantBypassFlag( rpcTempCU, 0,          true );
     2544  }
     2545  m_pcEntropyCoder->encodeSkipFlag ( rpcTempCU, 0,          true );
     2546  m_pcEntropyCoder->encodeDIS( rpcTempCU, 0,          true );
     2547
     2548
     2549  m_pcRDGoOnSbacCoder->store(m_pppcRDSbacCoder[uiDepth][CI_TEMP_BEST]);
     2550
     2551  rpcTempCU->getTotalBits() = m_pcEntropyCoder->getNumberOfWrittenBits();
     2552  rpcTempCU->getTotalBins() = ((TEncBinCABAC *)((TEncSbac*)m_pcEntropyCoder->m_pcEntropyCoderIf)->getEncBinIf())->getBinsCoded();
     2553
     2554
     2555#if H_3D_VSO // M6
     2556  if( m_pcRdCost->getUseLambdaScaleVSO()) 
     2557    rpcTempCU->getTotalCost() = m_pcRdCost->calcRdCostVSO( rpcTempCU->getTotalBits(), rpcTempCU->getTotalDistortion() ); 
     2558  else
     2559#endif
     2560    rpcTempCU->getTotalCost() = m_pcRdCost->calcRdCost( rpcTempCU->getTotalBits(), rpcTempCU->getTotalDistortion() );
     2561
     2562
     2563  xCheckDQP( rpcTempCU );
     2564  xCheckBestMode(rpcBestCU, rpcTempCU, uiDepth);
     2565}
     2566#else
    24152567#if H_3D_SINGLE_DEPTH
    24162568Void TEncCu::xCheckRDCostSingleDepth( TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU, PartSize eSize )
     
    24802632}
    24812633#endif
     2634#endif
    24822635
    24832636Void TEncCu::xCheckRDCostInterDBBP( TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU, Bool bUseMRG )
     
    25222675  AOF( uiDepthStride != 0 );
    25232676 
     2677#if HS_DBBP_CLEAN_K0048
     2678  PartSize eVirtualPartSize = m_pcPredSearch->getPartitionSizeFromDepth(pDepthPels, uiDepthStride, uiWidth, rpcTempCU);
     2679
    25242680  // derive partitioning from depth
     2681  Bool pMask[MAX_CU_SIZE*MAX_CU_SIZE];
     2682  Bool bValidMask = m_pcPredSearch->getSegmentMaskFromDepth(pDepthPels, uiDepthStride, uiWidth, uiHeight, pMask, rpcTempCU);
     2683#else
    25252684  PartSize eVirtualPartSize = m_pcPredSearch->getPartitionSizeFromDepth(pDepthPels, uiDepthStride, uiWidth);
    25262685 
     
    25282687  Bool pMask[MAX_CU_SIZE*MAX_CU_SIZE];
    25292688  Bool bValidMask = m_pcPredSearch->getSegmentMaskFromDepth(pDepthPels, uiDepthStride, uiWidth, uiHeight, pMask);
     2689#endif
    25302690 
    25312691  if( !bValidMask )
     
    26362796
    26372797  rpcTempCU->setSkipFlagSubParts( false, 0, uiDepth );
     2798#if SEC_DEPTH_INTRA_SKIP_MODE_K0033
     2799  rpcTempCU->setDISFlagSubParts( false, 0, uiDepth );
     2800#else
    26382801#if H_3D_SINGLE_DEPTH
    26392802  rpcTempCU->setSingleDepthFlagSubParts( false, 0, uiDepth );
     2803#endif
    26402804#endif
    26412805  rpcTempCU->setPartSizeSubParts( eSize, 0, uiDepth );
     
    26562820 
    26572821#if H_3D_DIM_SDC
     2822#if 0 // H_3D_DISABLE_CHROMA
     2823  if( !rpcTempCU->getSDCFlag( 0 ) && !rpcTempCU->getSlice()->getIsDepth() )
     2824#else
    26582825  if( !rpcTempCU->getSDCFlag( 0 ) )
     2826#endif
    26592827#endif
    26602828  m_pcPredSearch  ->estIntraPredChromaQT( rpcTempCU, m_ppcOrigYuv[uiDepth], m_ppcPredYuvTemp[uiDepth], m_ppcResiYuvTemp[uiDepth], m_ppcRecoYuvTemp[uiDepth], uiPreCalcDistC );
     
    26662834  }
    26672835  m_pcEntropyCoder->encodeSkipFlag ( rpcTempCU, 0,          true );
     2836#if SEC_DEPTH_INTRA_SKIP_MODE_K0033
     2837  m_pcEntropyCoder->encodeDIS( rpcTempCU, 0,          true );
     2838  if(!rpcTempCU->getDISFlag(0))
     2839  {
     2840#else
    26682841#if H_3D_SINGLE_DEPTH
    26692842  m_pcEntropyCoder->encodeSingleDepthMode( rpcTempCU, 0,          true );
     
    26712844  {
    26722845#endif
     2846#endif
    26732847  m_pcEntropyCoder->encodePredMode( rpcTempCU, 0,          true );
    26742848  m_pcEntropyCoder->encodePartSize( rpcTempCU, 0, uiDepth, true );
     2849#if !HHI_MOVE_SYN_K0052
    26752850#if H_3D_DIM_SDC
    26762851  m_pcEntropyCoder->encodeSDCFlag( rpcTempCU, 0, true );
    26772852#endif
     2853#endif
    26782854  m_pcEntropyCoder->encodePredInfo( rpcTempCU, 0,          true );
    26792855  m_pcEntropyCoder->encodeIPCMInfo(rpcTempCU, 0, true );
     2856#if HHI_MOVE_SYN_K0052
     2857#if H_3D_DIM_SDC
     2858  m_pcEntropyCoder->encodeSDCFlag( rpcTempCU, 0, true );
     2859#endif
     2860#endif
    26802861
    26812862  // Encode Coefficients
    26822863  Bool bCodeDQP = getdQPFlag();
     2864#if H_3D_DISABLE_CHROMA
     2865  m_pcEntropyCoder->encodeCoeff( rpcTempCU, 0, uiDepth, rpcTempCU->getWidth (0), rpcTempCU->getHeight(0), bCodeDQP, true );
     2866#else
    26832867  m_pcEntropyCoder->encodeCoeff( rpcTempCU, 0, uiDepth, rpcTempCU->getWidth (0), rpcTempCU->getHeight(0), bCodeDQP );
     2868#endif
     2869
     2870
    26842871  setdQPFlag( bCodeDQP );
     2872#if SEC_DEPTH_INTRA_SKIP_MODE_K0033
     2873  }
     2874#else
    26852875#if H_3D_SINGLE_DEPTH
    26862876  }
    2687 #endif       
     2877#endif
     2878#endif
    26882879  m_pcRDGoOnSbacCoder->store(m_pppcRDSbacCoder[uiDepth][CI_TEMP_BEST]);
    26892880 
     
    27132904
    27142905  rpcTempCU->setSkipFlagSubParts( false, 0, uiDepth );
     2906#if SEC_DEPTH_INTRA_SKIP_MODE_K0033
     2907  rpcTempCU->setDISFlagSubParts( false, 0, uiDepth );
     2908#else
    27152909#if H_3D_SINGLE_DEPTH
    27162910  rpcTempCU->setSingleDepthFlagSubParts( false, 0, uiDepth );
     2911#endif
    27172912#endif
    27182913  rpcTempCU->setIPCMFlag(0, true);
     
    27322927  }
    27332928  m_pcEntropyCoder->encodeSkipFlag ( rpcTempCU, 0,          true );
     2929#if SEC_DEPTH_INTRA_SKIP_MODE_K0033
     2930  m_pcEntropyCoder->encodeDIS( rpcTempCU, 0,          true );
     2931#else
    27342932#if H_3D_SINGLE_DEPTH
    27352933  m_pcEntropyCoder->encodeSingleDepthMode( rpcTempCU, 0,          true );
    27362934#endif
     2935#endif
    27372936  m_pcEntropyCoder->encodePredMode ( rpcTempCU, 0,          true );
    27382937  m_pcEntropyCoder->encodePartSize ( rpcTempCU, 0, uiDepth, true );
     2938#if !HHI_MOVE_SYN_K0052
    27392939#if H_3D_DIM_SDC
    27402940  m_pcEntropyCoder->encodeSDCFlag( rpcTempCU, 0, true );
    27412941#endif
     2942#endif
    27422943  m_pcEntropyCoder->encodeIPCMInfo ( rpcTempCU, 0, true );
    2743 
     2944#if HHI_MOVE_SYN_K0052
     2945#if H_3D_DIM_SDC
     2946  m_pcEntropyCoder->encodeSDCFlag( rpcTempCU, 0, true );
     2947#endif
     2948#endif
    27442949  m_pcRDGoOnSbacCoder->store(m_pppcRDSbacCoder[uiDepth][CI_TEMP_BEST]);
    27452950
Note: See TracChangeset for help on using the changeset viewer.