Ignore:
Timestamp:
11 Jul 2014, 03:49:39 (10 years ago)
Author:
mediatek-htm
Message:

Integration of Single Depth Mode proposed in JCT3V-I0095.
The MACRO is "MTK_SINGLE_DEPTH_MODE_I0095".

By Yi-Wen Chen (yiwen.chen@…)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/HTM-11.2-dev3-MediaTek/source/Lib/TLibEncoder/TEncCu.cpp

    r976 r983  
    709709    }
    710710#endif
    711 
     711#if MTK_SINGLE_DEPTH_MODE_I0095
     712    rpcTempCU->initEstData( uiDepth, iMinQP, isAddLowestQP  );
     713    if(rpcBestCU->getSlice()->getApplySingleDepthMode())
     714    {
     715      xCheckRDCostSingleDepth( rpcBestCU, rpcTempCU, SIZE_2Nx2N );
     716      rpcTempCU->initEstData( uiDepth, iMinQP, isAddLowestQP  );
     717    }
     718#endif
    712719    if(!earlyDetectionSkipMode)
    713720    {
     
    15361543    return;
    15371544  }
     1545#if MTK_SINGLE_DEPTH_MODE_I0095
     1546  m_pcEntropyCoder->encodeSingleDepthMode( pcCU, uiAbsPartIdx );
     1547  if(!pcCU->getSingleDepthFlag(uiAbsPartIdx))
     1548  {
     1549#endif
    15381550  m_pcEntropyCoder->encodePredMode( pcCU, uiAbsPartIdx );
    15391551 
     
    15681580  m_pcEntropyCoder->encodeCoeff( pcCU, uiAbsPartIdx, uiDepth, pcCU->getWidth (uiAbsPartIdx), pcCU->getHeight(uiAbsPartIdx), bCodeDQP );
    15691581  setdQPFlag( bCodeDQP );
    1570 
     1582#if MTK_SINGLE_DEPTH_MODE_I0095
     1583  }
     1584#endif
    15711585  // --- write terminating bit ---
    15721586  finishCU(pcCU,uiAbsPartIdx,uiDepth);
     
    19711985
    19721986          rpcTempCU->setSkipFlagSubParts( rpcTempCU->getQtRootCbf(0) == 0, 0, uhDepth );
     1987#if MTK_SINGLE_DEPTH_MODE_I0095
     1988          rpcTempCU->setSingleDepthFlagSubParts( false, 0, uhDepth );
     1989#endif
    19731990#if H_3D_VSP // possible bug fix
    19741991          if( rpcTempCU->getSkipFlag(0) )
     
    19942011              }
    19952012              rpcTempCU->setSkipFlagSubParts( false, 0, uhDepth );
     2013#if MTK_SINGLE_DEPTH_MODE_I0095
     2014              rpcTempCU->setSingleDepthFlagSubParts( false, 0, uhDepth );
     2015#endif
    19962016              rpcTempCU->setTrIdxSubParts( 0, 0, uhDepth );
    19972017              rpcTempCU->setCbfSubParts( 1, 1, 1, 0, uhDepth );
     
    21302150 
    21312151  rpcTempCU->setSkipFlagSubParts( false, 0, uhDepth );
    2132 
     2152#if MTK_SINGLE_DEPTH_MODE_I0095
     2153  rpcTempCU->setSingleDepthFlagSubParts( false, 0, uhDepth );
     2154#endif
    21332155  rpcTempCU->setPartSizeSubParts  ( ePartSize,  0, uhDepth );
    21342156  rpcTempCU->setPredModeSubParts  ( MODE_INTER, 0, uhDepth );
     
    22262248      }
    22272249      rpcTempCU->setSkipFlagSubParts( false, 0, uhDepth );
     2250#if MTK_SINGLE_DEPTH_MODE_I0095
     2251      rpcTempCU->setSingleDepthFlagSubParts( false, 0, uhDepth );
     2252#endif
    22282253      rpcTempCU->setTrIdxSubParts( 0, 0, uhDepth );
    22292254      rpcTempCU->setCbfSubParts( 1, 1, 1, 0, uhDepth );
     
    23202345  }
    23212346}
    2322 
     2347#if MTK_SINGLE_DEPTH_MODE_I0095
     2348Void TEncCu::xCheckRDCostSingleDepth( TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU, PartSize eSize )
     2349{
     2350  UInt uiDepth = rpcTempCU->getDepth( 0 );
     2351  if( !rpcBestCU->getSlice()->getIsDepth() || (eSize != SIZE_2Nx2N))
     2352  {
     2353    return;
     2354  }
     2355 
     2356#if H_3D_VSO // M5
     2357  if( m_pcRdCost->getUseRenModel() )
     2358  {
     2359    UInt  uiWidth     = m_ppcOrigYuv[uiDepth]->getWidth   ();
     2360    UInt  uiHeight    = m_ppcOrigYuv[uiDepth]->getHeight  ();
     2361    Pel*  piSrc       = m_ppcOrigYuv[uiDepth]->getLumaAddr();
     2362    UInt  uiSrcStride = m_ppcOrigYuv[uiDepth]->getStride  ();
     2363    m_pcRdCost->setRenModelData( rpcTempCU, 0, piSrc, uiSrcStride, uiWidth, uiHeight );
     2364  }
     2365#endif
     2366
     2367  rpcTempCU->setSkipFlagSubParts( false, 0, uiDepth );
     2368  rpcTempCU->setPartSizeSubParts( SIZE_2Nx2N, 0, uiDepth );
     2369  rpcTempCU->setPredModeSubParts( MODE_INTRA, 0, uiDepth );
     2370  rpcTempCU->setCUTransquantBypassSubParts( rpcTempCU->getCUTransquantBypass(0), 0, uiDepth );
     2371
     2372  rpcTempCU->setTrIdxSubParts(0, 0, uiDepth);
     2373  rpcTempCU->setCbfSubParts(0, 1, 1, 0, uiDepth);
     2374  rpcTempCU->setSingleDepthFlagSubParts(true, 0, uiDepth);
     2375  rpcTempCU->setLumaIntraDirSubParts (DC_IDX, 0, uiDepth);
     2376#if H_3D_DIM_SDC
     2377  rpcTempCU->setSDCFlagSubParts( false, 0, uiDepth);
     2378#endif
     2379
     2380  UInt uiPreCalcDistC;
     2381  m_pcPredSearch  ->estIntraPredSingleDepth      ( rpcTempCU, m_ppcOrigYuv[uiDepth], m_ppcPredYuvTemp[uiDepth], m_ppcResiYuvTemp[uiDepth], m_ppcRecoYuvTemp[uiDepth], uiPreCalcDistC, false );
     2382
     2383
     2384  m_ppcRecoYuvTemp[uiDepth]->copyToPicLuma(rpcTempCU->getPic()->getPicYuvRec(), rpcTempCU->getAddr(), rpcTempCU->getZorderIdxInCU() );
     2385 
     2386 
     2387  m_pcEntropyCoder->resetBits();
     2388  if ( rpcTempCU->getSlice()->getPPS()->getTransquantBypassEnableFlag())
     2389  {
     2390    m_pcEntropyCoder->encodeCUTransquantBypassFlag( rpcTempCU, 0,          true );
     2391  }
     2392  m_pcEntropyCoder->encodeSkipFlag ( rpcTempCU, 0,          true );
     2393  m_pcEntropyCoder->encodeSingleDepthMode( rpcTempCU, 0,          true );
     2394 
     2395
     2396  m_pcRDGoOnSbacCoder->store(m_pppcRDSbacCoder[uiDepth][CI_TEMP_BEST]);
     2397 
     2398  rpcTempCU->getTotalBits() = m_pcEntropyCoder->getNumberOfWrittenBits();
     2399  rpcTempCU->getTotalBins() = ((TEncBinCABAC *)((TEncSbac*)m_pcEntropyCoder->m_pcEntropyCoderIf)->getEncBinIf())->getBinsCoded();
     2400
     2401
     2402#if H_3D_VSO // M6
     2403  if( m_pcRdCost->getUseLambdaScaleVSO()) 
     2404    rpcTempCU->getTotalCost() = m_pcRdCost->calcRdCostVSO( rpcTempCU->getTotalBits(), rpcTempCU->getTotalDistortion() ); 
     2405  else
     2406#endif
     2407  rpcTempCU->getTotalCost() = m_pcRdCost->calcRdCost( rpcTempCU->getTotalBits(), rpcTempCU->getTotalDistortion() );
     2408 
     2409
     2410  xCheckDQP( rpcTempCU );
     2411  xCheckBestMode(rpcBestCU, rpcTempCU, uiDepth);
     2412}
     2413#endif
    23232414Void TEncCu::xCheckRDCostInterDBBP( TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU, Bool bUseMRG )
    23242415{
     
    24632554
    24642555  rpcTempCU->setSkipFlagSubParts( false, 0, uiDepth );
    2465 
     2556#if MTK_SINGLE_DEPTH_MODE_I0095
     2557  rpcTempCU->setSingleDepthFlagSubParts( false, 0, uiDepth );
     2558#endif
    24662559  rpcTempCU->setPartSizeSubParts( eSize, 0, uiDepth );
    24672560  rpcTempCU->setPredModeSubParts( MODE_INTRA, 0, uiDepth );
     
    24882581  }
    24892582  m_pcEntropyCoder->encodeSkipFlag ( rpcTempCU, 0,          true );
     2583#if MTK_SINGLE_DEPTH_MODE_I0095
     2584  m_pcEntropyCoder->encodeSingleDepthMode( rpcTempCU, 0,          true );
     2585  if(!rpcTempCU->getSingleDepthFlag(0))
     2586  {
     2587#endif
    24902588  m_pcEntropyCoder->encodePredMode( rpcTempCU, 0,          true );
    24912589  m_pcEntropyCoder->encodePartSize( rpcTempCU, 0, uiDepth, true );
     
    25002598  m_pcEntropyCoder->encodeCoeff( rpcTempCU, 0, uiDepth, rpcTempCU->getWidth (0), rpcTempCU->getHeight(0), bCodeDQP );
    25012599  setdQPFlag( bCodeDQP );
    2502  
     2600#if MTK_SINGLE_DEPTH_MODE_I0095
     2601  }
     2602#endif       
    25032603  m_pcRDGoOnSbacCoder->store(m_pppcRDSbacCoder[uiDepth][CI_TEMP_BEST]);
    25042604 
     
    25282628
    25292629  rpcTempCU->setSkipFlagSubParts( false, 0, uiDepth );
    2530 
     2630#if MTK_SINGLE_DEPTH_MODE_I0095
     2631  rpcTempCU->setSingleDepthFlagSubParts( false, 0, uiDepth );
     2632#endif
    25312633  rpcTempCU->setIPCMFlag(0, true);
    25322634  rpcTempCU->setIPCMFlagSubParts (true, 0, rpcTempCU->getDepth(0));
     
    25452647  }
    25462648  m_pcEntropyCoder->encodeSkipFlag ( rpcTempCU, 0,          true );
     2649#if MTK_SINGLE_DEPTH_MODE_I0095
     2650  m_pcEntropyCoder->encodeSingleDepthMode( rpcTempCU, 0,          true );
     2651#endif
    25472652  m_pcEntropyCoder->encodePredMode ( rpcTempCU, 0,          true );
    25482653  m_pcEntropyCoder->encodePartSize ( rpcTempCU, 0, uiDepth, true );
Note: See TracChangeset for help on using the changeset viewer.