Ignore:
Timestamp:
11 Jul 2014, 03:49:39 (11 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@…)

Location:
branches/HTM-11.2-dev3-MediaTek/source/Lib/TLibEncoder
Files:
12 edited

Legend:

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

    r976 r983  
    20222022    }
    20232023#endif
    2024 
     2024#if MTK_SINGLE_DEPTH_MODE_I0095
     2025    if(pcSlice->getIsDepth())
     2026    {
     2027      WRITE_FLAG( pcSlice->getApplySingleDepthMode() ? 1 : 0, "slice_enable_single_depth_mode" );
     2028    }
     2029#endif
    20252030#if H_3D_IV_MERGE
    20262031    assert(pcSlice->getMaxNumMergeCand()<=MRG_MAX_NUM_CANDS_MEM);
     
    24082413  assert(0);
    24092414}
    2410 
     2415#if MTK_SINGLE_DEPTH_MODE_I0095
     2416Void TEncCavlc::codeSingleDepthMode( TComDataCU* pcCU, UInt uiAbsPartIdx )
     2417{
     2418  assert(0);
     2419}
     2420#endif
    24112421Void TEncCavlc::codeSplitFlag   ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth )
    24122422{
  • branches/HTM-11.2-dev3-MediaTek/source/Lib/TLibEncoder/TEncCavlc.h

    r884 r983  
    123123  Void codeCUTransquantBypassFlag( TComDataCU* pcCU, UInt uiAbsPartIdx );
    124124  Void codeSkipFlag      ( TComDataCU* pcCU, UInt uiAbsPartIdx );
     125#if MTK_SINGLE_DEPTH_MODE_I0095
     126  Void codeSingleDepthMode( TComDataCU* pcCU, UInt uiAbsPartIdx );
     127#endif
    125128  Void codeMergeFlag     ( TComDataCU* pcCU, UInt uiAbsPartIdx );
    126129  Void codeMergeIndex    ( TComDataCU* pcCU, UInt uiAbsPartIdx );
  • branches/HTM-11.2-dev3-MediaTek/source/Lib/TLibEncoder/TEncCfg.h

    r976 r983  
    416416  Bool      m_useSDC;
    417417  Bool      m_useDLT;
     418#endif
     419#if MTK_SINGLE_DEPTH_MODE_I0095
     420  Bool      m_useSingleDepthMode;
    418421#endif
    419422#if H_3D_IV_MERGE
     
    10081011  Void      setUseDLT                       ( Bool b) { m_useDLT = b;    }
    10091012#endif
     1013#if MTK_SINGLE_DEPTH_MODE_I0095
     1014  Void       setUseSingleDepthMode          ( Bool bVal )    { m_useSingleDepthMode = bVal; }
     1015  Bool       getUseSingleDepthMode          ()               { return m_useSingleDepthMode; }
     1016#endif
    10101017#if H_3D_QTLPC
    10111018  Void      setUseQTL                       ( Bool b ) { m_bUseQTL = b;    }
  • 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 );
  • branches/HTM-11.2-dev3-MediaTek/source/Lib/TLibEncoder/TEncCu.h

    r872 r983  
    159159  Void  xCheckRDCostInterDBBP( TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU, Bool bUseMRG = false );
    160160#endif
     161#if MTK_SINGLE_DEPTH_MODE_I0095
     162  Void  xCheckRDCostSingleDepth   ( TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU, PartSize ePartSize  );
     163#endif
    161164  Void  xCheckRDCostIntra   ( TComDataCU*& rpcBestCU, TComDataCU*& rpcTempCU, PartSize ePartSize  );
    162165  Void  xCheckDQP           ( TComDataCU*  pcCU );
  • branches/HTM-11.2-dev3-MediaTek/source/Lib/TLibEncoder/TEncEntropy.cpp

    r976 r983  
    119119  m_pcEntropyCoderIf->codeSkipFlag( pcCU, uiAbsPartIdx );
    120120}
    121 
     121#if MTK_SINGLE_DEPTH_MODE_I0095
     122Void TEncEntropy::encodeSingleDepthMode( TComDataCU* pcCU, UInt uiAbsPartIdx, Bool bRD )
     123{
     124  if ( !pcCU->getSlice()->getIsDepth() )
     125  {
     126    return;
     127  }
     128  if(!pcCU->getSlice()->getApplySingleDepthMode())
     129  {
     130     return;
     131  }
     132 
     133  if( bRD )
     134  {
     135    uiAbsPartIdx = 0;
     136  }
     137  m_pcEntropyCoderIf->codeSingleDepthMode( pcCU, uiAbsPartIdx );
     138}
     139#endif
    122140/** encode merge flag
    123141 * \param pcCU
  • branches/HTM-11.2-dev3-MediaTek/source/Lib/TLibEncoder/TEncEntropy.h

    r884 r983  
    8686  virtual Void codeCUTransquantBypassFlag( TComDataCU* pcCU, UInt uiAbsPartIdx ) = 0;
    8787  virtual Void codeSkipFlag      ( TComDataCU* pcCU, UInt uiAbsPartIdx ) = 0;
     88#if MTK_SINGLE_DEPTH_MODE_I0095
     89  virtual Void codeSingleDepthMode      ( TComDataCU* pcCU, UInt uiAbsPartIdx ) = 0;
     90#endif
    8891  virtual Void codeMergeFlag     ( TComDataCU* pcCU, UInt uiAbsPartIdx ) = 0;
    8992  virtual Void codeMergeIndex    ( TComDataCU* pcCU, UInt uiAbsPartIdx ) = 0;
     
    171174  Void encodeCUTransquantBypassFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, Bool bRD = false );
    172175  Void encodeSkipFlag          ( TComDataCU* pcCU, UInt uiAbsPartIdx, Bool bRD = false );
     176#if MTK_SINGLE_DEPTH_MODE_I0095
     177  Void encodeSingleDepthMode( TComDataCU* pcCU, UInt uiAbsPartIdx, Bool bRD=false );
     178#endif
    173179  Void encodePUWise       ( TComDataCU* pcCU, UInt uiAbsPartIdx, Bool bRD = false );
    174180  Void encodeInterDirPU   ( TComDataCU* pcSubCU, UInt uiAbsPartIdx  );
  • branches/HTM-11.2-dev3-MediaTek/source/Lib/TLibEncoder/TEncGOP.cpp

    r976 r983  
    934934    pcSlice->setRefPicList ( rcListPic );
    935935#endif
    936  
     936#if MTK_SINGLE_DEPTH_MODE_I0095
     937    TEncTop* pcEncTop = (TEncTop*) m_pcCfg;
     938    bool enableSingleDepthMode=false;
     939    if(pcEncTop->getUseSingleDepthMode())
     940    {
     941      if(pcSlice->getIsDepth())
     942      {
     943        enableSingleDepthMode=true;
     944      }
     945    }
     946    pcSlice->setApplySingleDepthMode(enableSingleDepthMode);
     947#endif   
    937948#if H_3D_ARP
    938949    //GT: This seems to be broken when layerId in vps is not equal to layerId in nuh
  • branches/HTM-11.2-dev3-MediaTek/source/Lib/TLibEncoder/TEncSbac.cpp

    r976 r983  
    5858, m_cCUSplitFlagSCModel       ( 1,             1,               NUM_SPLIT_FLAG_CTX            , m_contextModels + m_numContextModels, m_numContextModels )
    5959, m_cCUSkipFlagSCModel        ( 1,             1,               NUM_SKIP_FLAG_CTX             , m_contextModels + m_numContextModels, m_numContextModels)
     60#if MTK_SINGLE_DEPTH_MODE_I0095
     61, m_cCUSingleDepthFlagSCModel        ( 1,             1,               NUM_SINGLEDEPTH_FLAG_CTX             , m_contextModels + m_numContextModels, m_numContextModels)
     62, m_cSingleDepthValueSCModel         ( 1,             1,               NUM_SINGLE_DEPTH_VALUE_DATA_CTX      , m_contextModels + m_numContextModels, m_numContextModels)
     63#endif
    6064, m_cCUMergeFlagExtSCModel    ( 1,             1,               NUM_MERGE_FLAG_EXT_CTX        , m_contextModels + m_numContextModels, m_numContextModels)
    6165, m_cCUMergeIdxExtSCModel     ( 1,             1,               NUM_MERGE_IDX_EXT_CTX         , m_contextModels + m_numContextModels, m_numContextModels)
     
    130134 
    131135  m_cCUSkipFlagSCModel.initBuffer        ( eSliceType, iQp, (UChar*)INIT_SKIP_FLAG );
     136#if MTK_SINGLE_DEPTH_MODE_I0095
     137  m_cCUSingleDepthFlagSCModel.initBuffer        ( eSliceType, iQp, (UChar*)INIT_SINGLEDEPTH_FLAG );
     138  m_cSingleDepthValueSCModel.initBuffer         ( eSliceType, iQp, (UChar*)INIT_SINGLE_DEPTH_VALUE_DATA );
     139#endif
    132140  m_cCUMergeFlagExtSCModel.initBuffer    ( eSliceType, iQp, (UChar*)INIT_MERGE_FLAG_EXT);
    133141  m_cCUMergeIdxExtSCModel.initBuffer     ( eSliceType, iQp, (UChar*)INIT_MERGE_IDX_EXT);
     
    206214      curCost  = m_cCUSplitFlagSCModel.calcCost       ( curSliceType, qp, (UChar*)INIT_SPLIT_FLAG );
    207215      curCost += m_cCUSkipFlagSCModel.calcCost        ( curSliceType, qp, (UChar*)INIT_SKIP_FLAG );
     216#if MTK_SINGLE_DEPTH_MODE_I0095
     217      curCost += m_cCUSingleDepthFlagSCModel.calcCost        ( curSliceType, qp, (UChar*)INIT_SINGLEDEPTH_FLAG );
     218      curCost += m_cSingleDepthValueSCModel.calcCost         ( curSliceType, qp, (UChar*)INIT_SINGLE_DEPTH_VALUE_DATA );
     219#endif
    208220      curCost += m_cCUMergeFlagExtSCModel.calcCost    ( curSliceType, qp, (UChar*)INIT_MERGE_FLAG_EXT);
    209221      curCost += m_cCUMergeIdxExtSCModel.calcCost     ( curSliceType, qp, (UChar*)INIT_MERGE_IDX_EXT);
     
    275287 
    276288  m_cCUSkipFlagSCModel.initBuffer        ( eSliceType, iQp, (UChar*)INIT_SKIP_FLAG );
     289#if MTK_SINGLE_DEPTH_MODE_I0095
     290  m_cCUSingleDepthFlagSCModel.initBuffer        ( eSliceType, iQp, (UChar*)INIT_SINGLEDEPTH_FLAG );
     291  m_cSingleDepthValueSCModel.initBuffer         ( eSliceType, iQp, (UChar*)INIT_SINGLE_DEPTH_VALUE_DATA );
     292#endif 
    277293  m_cCUMergeFlagExtSCModel.initBuffer    ( eSliceType, iQp, (UChar*)INIT_MERGE_FLAG_EXT);
    278294  m_cCUMergeIdxExtSCModel.initBuffer     ( eSliceType, iQp, (UChar*)INIT_MERGE_IDX_EXT);
     
    434450  m_pcBinIf->encodeBinsEP( bins, numBins );
    435451}
    436 
     452#if MTK_SINGLE_DEPTH_MODE_I0095
     453Void TEncSbac::codeSingleDepthMode( TComDataCU* pcCU, UInt uiAbsPartIdx )
     454{
     455  UInt uiSymbol = pcCU->getSingleDepthFlag(uiAbsPartIdx ) ? 1 : 0;
     456  m_pcBinIf->encodeBin( uiSymbol, m_cCUSingleDepthFlagSCModel.get( 0, 0, 0 ) );
     457  if(uiSymbol)
     458  {
     459    UInt uiUnaryIdx = (UInt) pcCU->getSingleDepthValue(uiAbsPartIdx);
     460    UInt uiNumCand = MTK_SINGLE_DEPTH_MODE_CANDIDATE_LIST_SIZE;
     461    if ( uiNumCand > 1 )
     462    {
     463      for( UInt ui = 0; ui < uiNumCand - 1; ++ui )
     464      {
     465        const UInt uiSymbol2 = ui == uiUnaryIdx ? 0 : 1;
     466        if ( ui==0 )
     467        {
     468          m_pcBinIf->encodeBin( uiSymbol2, m_cSingleDepthValueSCModel.get( 0, 0, 0 ) );
     469        }
     470        else
     471        {
     472          m_pcBinIf->encodeBinEP( uiSymbol2 );
     473        }
     474        if( uiSymbol2 == 0 )
     475        {
     476          break;
     477        }
     478      }
     479    }
     480  }
     481}
     482#endif
    437483/** Coding of coeff_abs_level_minus3
    438484 * \param uiSymbol value of coeff_abs_level_minus3
  • branches/HTM-11.2-dev3-MediaTek/source/Lib/TLibEncoder/TEncSbac.h

    r976 r983  
    153153  Void codeCUTransquantBypassFlag( TComDataCU* pcCU, UInt uiAbsPartIdx );
    154154  Void codeSkipFlag      ( TComDataCU* pcCU, UInt uiAbsPartIdx );
     155#if MTK_SINGLE_DEPTH_MODE_I0095
     156  Void codeSingleDepthMode( TComDataCU* pcCU, UInt uiAbsPartIdx );
     157#endif
    155158  Void codeMergeFlag     ( TComDataCU* pcCU, UInt uiAbsPartIdx );
    156159  Void codeMergeIndex    ( TComDataCU* pcCU, UInt uiAbsPartIdx );
     
    219222  ContextModel3DBuffer m_cCUSplitFlagSCModel;
    220223  ContextModel3DBuffer m_cCUSkipFlagSCModel;
     224#if MTK_SINGLE_DEPTH_MODE_I0095
     225  ContextModel3DBuffer m_cCUSingleDepthFlagSCModel;
     226  ContextModel3DBuffer m_cSingleDepthValueSCModel;
     227#endif
    221228  ContextModel3DBuffer m_cCUMergeFlagExtSCModel;
    222229  ContextModel3DBuffer m_cCUMergeIdxExtSCModel;
  • branches/HTM-11.2-dev3-MediaTek/source/Lib/TLibEncoder/TEncSearch.cpp

    r976 r983  
    915915        }
    916916        m_pcEntropyCoder->encodeSkipFlag( pcCU, 0, true );
     917#if MTK_SINGLE_DEPTH_MODE_I0095
     918        m_pcEntropyCoder->encodeSingleDepthMode(pcCU, 0, true );
     919        if(!pcCU->getSingleDepthFlag(uiAbsPartIdx))
     920#endif
    917921        m_pcEntropyCoder->encodePredMode( pcCU, 0, true );
    918922      }
    919      
     923#if MTK_SINGLE_DEPTH_MODE_I0095
     924      else
     925      {
     926        m_pcEntropyCoder->encodeSingleDepthMode(pcCU, 0, true );
     927      }
     928#endif     
     929#if MTK_SINGLE_DEPTH_MODE_I0095
     930      if(!pcCU->getSingleDepthFlag(uiAbsPartIdx))
     931      {
     932#endif
    920933      m_pcEntropyCoder  ->encodePartSize( pcCU, 0, pcCU->getDepth(0), true );
    921934
     
    932945        }
    933946      }
    934     }
     947#if MTK_SINGLE_DEPTH_MODE_I0095
     948    }
     949#endif
     950    }
     951#if MTK_SINGLE_DEPTH_MODE_I0095
     952      if(!pcCU->getSingleDepthFlag(uiAbsPartIdx))
     953      {
     954#endif
    935955    // luma prediction mode
    936956    if( pcCU->getPartitionSize(0) == SIZE_2Nx2N )
     
    975995    }
    976996  }
    977 
     997#if MTK_SINGLE_DEPTH_MODE_I0095
     998    }
     999#endif
    9781000  }
    9791001  if( bChroma )
     
    18371859  dRDCost  += dSingleCost;
    18381860}
    1839 
     1861#if MTK_SINGLE_DEPTH_MODE_I0095
     1862Void TEncSearch::xIntraCodingSingleDepth( TComDataCU* pcCU, UInt uiAbsPartIdx, TComYuv* pcOrgYuv, TComYuv* pcPredYuv, Dist& ruiDist, Double& dRDCost, Int iTestDepthIdx, Pel *DepthNeighbor )
     1863{
     1864  UInt    uiWidth           = pcCU     ->getWidth   ( 0 );
     1865  UInt    uiHeight          = pcCU     ->getHeight  ( 0 );
     1866  UInt    uiStride          = pcOrgYuv ->getStride  ();
     1867  Pel*    piOrg             = pcOrgYuv ->getLumaAddr( uiAbsPartIdx );
     1868  Pel*    piPred            = pcPredYuv->getLumaAddr( uiAbsPartIdx );
     1869
     1870  AOF( uiWidth == uiHeight );
     1871  AOF( uiAbsPartIdx == 0 );
     1872  pcCU->setSingleDepthValueSubParts((Pel)iTestDepthIdx,uiAbsPartIdx, 0, pcCU->getDepth(0)); 
     1873  //===== reconstruction =====
     1874
     1875  for( UInt uiY = 0; uiY < uiHeight; uiY++ )
     1876  {
     1877    for( UInt uiX = 0; uiX < uiWidth; uiX++ )
     1878    {
     1879    piPred[ uiX ] = DepthNeighbor[iTestDepthIdx];
     1880    }
     1881    piPred     += uiStride;
     1882  }
     1883
     1884  // clear UV
     1885  UInt  uiStrideC     = pcPredYuv->getCStride();
     1886  Pel   *pRecCb       = pcPredYuv->getCbAddr();
     1887  Pel   *pRecCr       = pcPredYuv->getCrAddr();
     1888
     1889  for (Int y=0; y<uiHeight/2; y++)
     1890  {
     1891    for (Int x=0; x<uiWidth/2; x++)
     1892    {
     1893      pRecCb[x] = 1<<(g_bitDepthC-1);
     1894      pRecCr[x] = 1<<(g_bitDepthC-1);
     1895    }
     1896
     1897    pRecCb += uiStrideC;
     1898    pRecCr += uiStrideC;
     1899  }
     1900
     1901  piPred            = pcPredYuv->getLumaAddr( uiAbsPartIdx );
     1902  //===== determine distortion =====
     1903#if H_3D_VSO
     1904  if ( m_pcRdCost->getUseVSO() )
     1905    ruiDist = m_pcRdCost->getDistPartVSO  ( pcCU, uiAbsPartIdx, piPred, uiStride, piOrg, uiStride, uiWidth, uiHeight, false );
     1906  else
     1907#endif
     1908    ruiDist = m_pcRdCost->getDistPart(g_bitDepthY, piPred, uiStride, piOrg, uiStride, uiWidth, uiHeight );
     1909
     1910  //===== determine rate and r-d cost =====
     1911  m_pcEntropyCoder->resetBits();
     1912  m_pcEntropyCoder->encodeSingleDepthMode( pcCU, 0, true );
     1913  UInt uiBits = m_pcEntropyCoder->getNumberOfWrittenBits();
     1914
     1915#if H_3D_VSO
     1916  if ( m_pcRdCost->getUseLambdaScaleVSO())
     1917    dRDCost = m_pcRdCost->calcRdCostVSO( uiBits, ruiDist );
     1918  else
     1919#endif
     1920    dRDCost = m_pcRdCost->calcRdCost( uiBits, ruiDist );
     1921}
     1922#endif
    18401923#if H_3D_DIM_SDC
    18411924Void TEncSearch::xIntraCodingSDC( TComDataCU* pcCU, UInt uiAbsPartIdx, TComYuv* pcOrgYuv, TComYuv* pcPredYuv, Dist& ruiDist, Double& dRDCost, Bool bZeroResidual, Int iSDCDeltaResi  )
     
    27772860  pcCU->setChromIntraDirSubParts( uiBestMode, 0, pcCU->getDepth( 0 ) );
    27782861}
    2779 
     2862#if MTK_SINGLE_DEPTH_MODE_I0095
     2863Void
     2864TEncSearch::estIntraPredSingleDepth( TComDataCU* pcCU,
     2865                           TComYuv*    pcOrgYuv,
     2866                           TComYuv*    pcPredYuv,
     2867                           TComYuv*    pcResiYuv,
     2868                           TComYuv*    pcRecoYuv,
     2869                           UInt&       ruiDistC,
     2870                           Bool        bLumaOnly )
     2871{
     2872  UInt    uiDepth        = pcCU->getDepth(0);
     2873  UInt    uiWidth        = pcCU->getWidth (0);
     2874  UInt    uiHeight       = pcCU->getHeight(0);
     2875
     2876
     2877  Pel* piOrg         = pcOrgYuv ->getLumaAddr( 0, uiWidth );
     2878  UInt uiStride      = pcPredYuv->getStride();
     2879
     2880  Int index=0;
     2881  Pel testDepth;
     2882  Pel DepthNeighbours[5];
     2883  //construction of depth candidates
     2884  for( Int i = 0; (i < 5)  && (index<MTK_SINGLE_DEPTH_MODE_CANDIDATE_LIST_SIZE) ; i++ )
     2885  {
     2886    if(!pcCU->getNeighDepth (0, 0, &testDepth, i))
     2887    {
     2888      continue;
     2889    }
     2890    DepthNeighbours[index]=testDepth;
     2891    index++;
     2892    for(Int j=0;j<index-1;j++)
     2893    {
     2894      if( (DepthNeighbours[index-1]==DepthNeighbours[j]))
     2895      {
     2896        index--;
     2897        break;
     2898      }
     2899    }
     2900  }
     2901
     2902  if(index==0)
     2903  {
     2904    DepthNeighbours[index]=1<<(g_bitDepthY-1);
     2905    index++;
     2906  }
     2907
     2908  if(index==1)
     2909  {
     2910    DepthNeighbours[index]=ClipY(DepthNeighbours[0] + 1 );
     2911    index++;
     2912  }
     2913
     2914
     2915  Dist   uiDist = 0;
     2916  Double dCost   = 0.0;
     2917  Dist    uiBestDist = 0;
     2918  Double  dBestCost   = MAX_DOUBLE;
     2919  Pel     pBestSingleDepthValue = 0;
     2920
     2921  for( Int testdepthidx = 0; testdepthidx < index ; testdepthidx++ )
     2922  {
     2923      // set context models
     2924      m_pcRDGoOnSbacCoder->load( m_pppcRDSbacCoder[uiDepth][CI_CURR_BEST] );
     2925
     2926      // determine residual for partition
     2927      uiDist = 0;
     2928      dCost   = 0.0;
     2929#if H_3D_VSO // M36
     2930      if( m_pcRdCost->getUseRenModel() )
     2931      {
     2932        m_pcRdCost->setRenModelData( pcCU, 0, piOrg, uiStride, uiWidth, uiHeight );
     2933      }
     2934#endif
     2935      xIntraCodingSingleDepth(pcCU, 0, pcOrgYuv, pcPredYuv, uiDist, dCost, testdepthidx, DepthNeighbours);
     2936      // check r-d cost
     2937      if( dCost < dBestCost )
     2938      {
     2939        uiBestDist = uiDist;
     2940        dBestCost   = dCost;
     2941        pBestSingleDepthValue = pcCU->getSingleDepthValue(0);
     2942        // copy reconstruction
     2943        pcPredYuv->copyPartToPartYuv(pcRecoYuv, 0, uiWidth, uiHeight);
     2944      }
     2945  } // depth index loop
     2946
     2947
     2948  pcCU->setSingleDepthValueSubParts((Pel)pBestSingleDepthValue,0, 0, uiDepth);
     2949  assert(pBestSingleDepthValue>=0);
     2950
     2951  //===== reset context models =====
     2952  m_pcRDGoOnSbacCoder->load(m_pppcRDSbacCoder[uiDepth][CI_CURR_BEST]);
     2953 
     2954  //===== set distortion (rate and r-d costs are determined later) =====
     2955  pcCU->getTotalDistortion() = uiBestDist;
     2956}
     2957
     2958#endif
    27802959Void
    27812960TEncSearch::estIntraPredQT( TComDataCU* pcCU,
     
    69817160    }
    69827161    m_pcEntropyCoder->encodeSkipFlag ( pcCU, 0, true );
     7162#if MTK_SINGLE_DEPTH_MODE_I0095
     7163    m_pcEntropyCoder->encodeSingleDepthMode ( pcCU, 0, true );
     7164#endif
    69837165    m_pcEntropyCoder->encodePredMode( pcCU, 0, true );
    69847166    m_pcEntropyCoder->encodePartSize( pcCU, 0, pcCU->getDepth(0), true );
  • branches/HTM-11.2-dev3-MediaTek/source/Lib/TLibEncoder/TEncSearch.h

    r884 r983  
    187187                                  TComYuv*    pcRecoYuv,
    188188                                  UInt        uiPreCalcDistC );
    189  
     189#if MTK_SINGLE_DEPTH_MODE_I0095
     190  Void  estIntraPredSingleDepth  ( TComDataCU* pcCU,
     191                                  TComYuv*    pcOrgYuv,
     192                                  TComYuv*    pcPredYuv,
     193                                  TComYuv*    pcResiYuv,
     194                                  TComYuv*    pcRecoYuv,
     195                                  UInt&       ruiDistC,
     196                                  Bool        bLumaOnly );
     197#endif   
    190198 
    191199  /// encoder estimation - inter prediction (non-skip)
     
    342350                                    UInt         uiAbsPartIdx,
    343351                                    UInt         stateU0V1Both2 );
    344 
     352#if MTK_SINGLE_DEPTH_MODE_I0095
     353  Void xIntraCodingSingleDepth( TComDataCU* pcCU, UInt uiAbsPartIdx, TComYuv* pcOrgYuv, TComYuv* pcPredYuv, Dist& ruiDist, Double& dRDCost, Int iTestDepthIdx, Pel * DepthNeighbor );
     354#endif
    345355#if H_3D_DIM
    346356  // -------------------------------------------------------------------------------------------------------------------
Note: See TracChangeset for help on using the changeset viewer.