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/TLibDecoder
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • branches/HTM-11.2-dev3-MediaTek/source/Lib/TLibDecoder/TDecCAVLC.cpp

    r976 r983  
    24732473    }
    24742474#endif
     2475#if MTK_SINGLE_DEPTH_MODE_I0095
     2476    if(rpcSlice->getIsDepth())
     2477    {
     2478      UInt uiCodeTmp = 0;
     2479      READ_FLAG( uiCodeTmp, "slice_enable_single_depth_mode" );
     2480      rpcSlice->setApplySingleDepthMode(uiCodeTmp);
     2481    }
     2482#endif
    24752483    if (!rpcSlice->isIntra())
    24762484    {
     
    28432851  assert(0);
    28442852}
    2845 
     2853#if MTK_SINGLE_DEPTH_MODE_I0095
     2854Void TDecCavlc::parseSingleDepthMode( TComDataCU* /*pcCU*/, UInt /*uiAbsPartIdx*/, UInt /*uiDepth*/ )
     2855{
     2856  assert(0);
     2857}
     2858#endif
    28462859Void TDecCavlc::parseCUTransquantBypassFlag( TComDataCU* /*pcCU*/, UInt /*uiAbsPartIdx*/, UInt /*uiDepth*/ )
    28472860{
  • branches/HTM-11.2-dev3-MediaTek/source/Lib/TLibDecoder/TDecCAVLC.h

    r976 r983  
    119119 
    120120  Void  parseSkipFlag       ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
     121#if MTK_SINGLE_DEPTH_MODE_I0095
     122  Void  parseSingleDepthMode        ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
     123#endif 
    121124  Void  parseCUTransquantBypassFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
    122125  Void parseMergeFlag       ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt uiPUIdx );
  • branches/HTM-11.2-dev3-MediaTek/source/Lib/TLibDecoder/TDecCu.cpp

    r976 r983  
    542542    return;
    543543  }
    544 
     544#if MTK_SINGLE_DEPTH_MODE_I0095
     545  m_pcEntropyDecoder->decodeSingleDepthMode( pcCU, uiAbsPartIdx, uiDepth );
     546  if(!pcCU->getSingleDepthFlag(uiAbsPartIdx))
     547  {
     548#endif
    545549  m_pcEntropyDecoder->decodePredMode( pcCU, uiAbsPartIdx, uiDepth );
    546550  m_pcEntropyDecoder->decodePartSize( pcCU, uiAbsPartIdx, uiDepth );
     
    572576  m_pcEntropyDecoder->decodeCoeff( pcCU, uiAbsPartIdx, uiDepth, uiCurrWidth, uiCurrHeight, bCodeDQP );
    573577  setdQPFlag( bCodeDQP );
     578#if MTK_SINGLE_DEPTH_MODE_I0095
     579  }
     580#endif
    574581  xFinishDecodeCU( pcCU, uiAbsPartIdx, uiDepth, ruiIsLast );
    575582#if H_3D_IV_MERGE
     
    671678      break;
    672679    case MODE_INTRA:
     680#if MTK_SINGLE_DEPTH_MODE_I0095
     681      if( m_ppcCU[uiDepth]->getSingleDepthFlag(0) )
     682        xReconIntraSingleDepth( m_ppcCU[uiDepth], 0, uiDepth );
     683#if H_3D_DIM_SDC
     684      else if( m_ppcCU[uiDepth]->getSDCFlag(0) )
     685        xReconIntraSDC( m_ppcCU[uiDepth], 0, uiDepth );
     686#endif
     687      else
     688#else
    673689#if H_3D_DIM_SDC
    674690      if( m_ppcCU[uiDepth]->getSDCFlag(0) )
    675691        xReconIntraSDC( m_ppcCU[uiDepth], 0, uiDepth );
    676692      else
     693#endif
    677694#endif
    678695      xReconIntraQT( m_ppcCU[uiDepth], uiDepth );
     
    709726  }
    710727}
    711 
     728#if MTK_SINGLE_DEPTH_MODE_I0095
     729Void TDecCu::xReconIntraSingleDepth( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth )
     730{
     731  UInt uiWidth        = pcCU->getWidth  ( 0 );
     732  UInt uiHeight       = pcCU->getHeight ( 0 );
     733
     734  TComYuv* pcRecoYuv  = m_ppcYuvReco[uiDepth];
     735
     736  UInt    uiStride    = pcRecoYuv->getStride  ();
     737  Pel*    piReco      = pcRecoYuv->getLumaAddr( uiAbsPartIdx );
     738
     739
     740  AOF( uiWidth == uiHeight );
     741  AOF( uiAbsPartIdx == 0 );
     742
     743  //construction of depth candidates
     744  Pel testDepth;
     745  Pel DepthNeighbours[5];
     746  Int index =0;
     747  for( Int i = 0; (i < 5) && (index<MTK_SINGLE_DEPTH_MODE_CANDIDATE_LIST_SIZE) ; i++ )
     748  {
     749    if(!pcCU->getNeighDepth (0, uiAbsPartIdx, &testDepth, i))
     750    {
     751      continue;
     752    }
     753    DepthNeighbours[index]=testDepth;
     754    index++;
     755    for(Int j=0;j<index-1;j++)
     756    {
     757     if( (DepthNeighbours[index-1]==DepthNeighbours[j]) )
     758     {
     759       index--;
     760       break;
     761     }
     762    }
     763  }
     764
     765  if(index==0)
     766  {
     767    DepthNeighbours[index]=1<<(g_bitDepthY-1);
     768    index++;
     769  }
     770
     771  if(index==1)
     772  {
     773    DepthNeighbours[index]=ClipY(DepthNeighbours[0] + 1 );
     774    index++;
     775  }
     776
     777  for( UInt uiY = 0; uiY < uiHeight; uiY++ )
     778  {
     779    for( UInt uiX = 0; uiX < uiWidth; uiX++ )
     780    {
     781      piReco[ uiX ] =DepthNeighbours[(Int)pcCU->getSingleDepthValue(uiAbsPartIdx)];
     782    }
     783    piReco     += uiStride;
     784  }
     785
     786  // clear UV
     787  UInt  uiStrideC     = pcRecoYuv->getCStride();
     788  Pel   *pRecCb       = pcRecoYuv->getCbAddr();
     789  Pel   *pRecCr       = pcRecoYuv->getCrAddr();
     790
     791  for (Int y=0; y<uiHeight/2; y++)
     792  {
     793    for (Int x=0; x<uiWidth/2; x++)
     794    {
     795      pRecCb[x] = 1<<(g_bitDepthC-1);
     796      pRecCr[x] = 1<<(g_bitDepthC-1);
     797    }
     798
     799    pRecCb += uiStrideC;
     800    pRecCr += uiStrideC;
     801  }
     802}
     803#endif
    712804#if H_3D_INTER_SDC
    713805Void TDecCu::xReconInterSDC( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth )
  • branches/HTM-11.2-dev3-MediaTek/source/Lib/TLibDecoder/TDecCu.h

    r872 r983  
    123123  Void setdQPFlag               ( Bool b )                { m_bDecodeDQP = b;           }
    124124  Void xFillPCMBuffer           (TComDataCU* pCU, UInt depth);
     125#if MTK_SINGLE_DEPTH_MODE_I0095
     126  Void xReconIntraSingleDepth( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
     127#endif
    125128#if H_3D_DIM_SDC
    126129  Void xReconIntraSDC           ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
  • branches/HTM-11.2-dev3-MediaTek/source/Lib/TLibDecoder/TDecEntropy.cpp

    r976 r983  
    5252  m_pcEntropyDecoderIf->parseSkipFlag( pcCU, uiAbsPartIdx, uiDepth );
    5353}
    54 
     54#if MTK_SINGLE_DEPTH_MODE_I0095
     55Void TDecEntropy::decodeSingleDepthMode( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth )
     56{
     57  if ( !pcCU->getSlice()->getIsDepth() )
     58  {
     59    return;
     60  }
     61  if(!pcCU->getSlice()->getApplySingleDepthMode())
     62  {
     63     return;
     64  }
     65  m_pcEntropyDecoderIf->parseSingleDepthMode( pcCU, uiAbsPartIdx, uiDepth );
     66}
     67#endif
    5568Void TDecEntropy::decodeCUTransquantBypassFlag(TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth )
    5669{
  • branches/HTM-11.2-dev3-MediaTek/source/Lib/TLibDecoder/TDecEntropy.h

    r976 r983  
    8989public:
    9090  virtual Void parseSkipFlag      ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) = 0;
     91#if MTK_SINGLE_DEPTH_MODE_I0095
     92  virtual Void parseSingleDepthMode       ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) = 0;
     93#endif
    9194  virtual Void parseCUTransquantBypassFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) = 0;
    9295  virtual Void parseSplitFlag     ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) = 0;
     
    176179  Void decodeSplitFlag         ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
    177180  Void decodeSkipFlag          ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
     181#if MTK_SINGLE_DEPTH_MODE_I0095
     182  Void decodeSingleDepthMode ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) ;
     183#endif
    178184  Void decodeCUTransquantBypassFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
    179185  Void decodeMergeFlag         ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt uiPUIdx );
  • branches/HTM-11.2-dev3-MediaTek/source/Lib/TLibDecoder/TDecSbac.cpp

    r976 r983  
    5252, m_cCUSplitFlagSCModel       ( 1,             1,               NUM_SPLIT_FLAG_CTX            , m_contextModels + m_numContextModels, m_numContextModels )
    5353, m_cCUSkipFlagSCModel        ( 1,             1,               NUM_SKIP_FLAG_CTX             , m_contextModels + m_numContextModels, m_numContextModels)
     54#if MTK_SINGLE_DEPTH_MODE_I0095
     55, m_cCUSingleDepthFlagSCModel        ( 1,             1,               NUM_SINGLEDEPTH_FLAG_CTX             , m_contextModels + m_numContextModels, m_numContextModels)
     56, m_cSingleDepthValueSCModel         ( 1,             1,               NUM_SINGLE_DEPTH_VALUE_DATA_CTX      , m_contextModels + m_numContextModels, m_numContextModels)
     57#endif
    5458, m_cCUMergeFlagExtSCModel    ( 1,             1,               NUM_MERGE_FLAG_EXT_CTX        , m_contextModels + m_numContextModels, m_numContextModels)
    5559, m_cCUMergeIdxExtSCModel     ( 1,             1,               NUM_MERGE_IDX_EXT_CTX         , m_contextModels + m_numContextModels, m_numContextModels)
     
    132136  m_cCUSplitFlagSCModel.initBuffer       ( sliceType, qp, (UChar*)INIT_SPLIT_FLAG );
    133137  m_cCUSkipFlagSCModel.initBuffer        ( sliceType, qp, (UChar*)INIT_SKIP_FLAG );
     138#if MTK_SINGLE_DEPTH_MODE_I0095
     139  m_cCUSingleDepthFlagSCModel.initBuffer        ( sliceType, qp, (UChar*)INIT_SINGLEDEPTH_FLAG );
     140  m_cSingleDepthValueSCModel.initBuffer         ( sliceType, qp, (UChar*)INIT_SINGLE_DEPTH_VALUE_DATA );
     141#endif
    134142  m_cCUMergeFlagExtSCModel.initBuffer    ( sliceType, qp, (UChar*)INIT_MERGE_FLAG_EXT );
    135143  m_cCUMergeIdxExtSCModel.initBuffer     ( sliceType, qp, (UChar*)INIT_MERGE_IDX_EXT );
     
    199207  m_cCUSplitFlagSCModel.initBuffer       ( eSliceType, iQp, (UChar*)INIT_SPLIT_FLAG );
    200208  m_cCUSkipFlagSCModel.initBuffer        ( eSliceType, iQp, (UChar*)INIT_SKIP_FLAG );
     209#if MTK_SINGLE_DEPTH_MODE_I0095
     210  m_cCUSingleDepthFlagSCModel.initBuffer        ( eSliceType, iQp, (UChar*)INIT_SINGLEDEPTH_FLAG );
     211  m_cSingleDepthValueSCModel.initBuffer         ( eSliceType, iQp, (UChar*)INIT_SINGLE_DEPTH_VALUE_DATA );
     212#endif
    201213  m_cCUMergeFlagExtSCModel.initBuffer    ( eSliceType, iQp, (UChar*)INIT_MERGE_FLAG_EXT );
    202214  m_cCUMergeIdxExtSCModel.initBuffer     ( eSliceType, iQp, (UChar*)INIT_MERGE_IDX_EXT );
     
    636648#endif
    637649}
    638 
     650#if MTK_SINGLE_DEPTH_MODE_I0095
     651Void TDecSbac::parseSingleDepthMode( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth )
     652{
     653  pcCU->setSingleDepthFlagSubParts( false,        uiAbsPartIdx, uiDepth );
     654  UInt uiSymbol = 0;
     655  m_pcTDecBinIf->decodeBin( uiSymbol, m_cCUSingleDepthFlagSCModel.get( 0, 0, 0 ) );
     656  if( uiSymbol )
     657  {
     658    pcCU->setSingleDepthFlagSubParts( true,        uiAbsPartIdx, uiDepth );
     659    pcCU->setSkipFlagSubParts( false,        uiAbsPartIdx, uiDepth );
     660    pcCU->setSDCFlagSubParts( false,        uiAbsPartIdx, uiDepth );
     661    pcCU->setPredModeSubParts( MODE_INTRA,  uiAbsPartIdx, uiDepth );
     662    pcCU->setPartSizeSubParts( SIZE_2Nx2N, uiAbsPartIdx, uiDepth );
     663    pcCU->setLumaIntraDirSubParts (DC_IDX, uiAbsPartIdx, uiDepth );
     664    pcCU->setSizeSubParts( g_uiMaxCUWidth>>uiDepth, g_uiMaxCUHeight>>uiDepth, uiAbsPartIdx, uiDepth );
     665    pcCU->setMergeFlagSubParts( false , uiAbsPartIdx, 0, uiDepth );
     666    pcCU->setTrIdxSubParts(0, uiAbsPartIdx, uiDepth);
     667    pcCU->setCbfSubParts(0, 1, 1, uiAbsPartIdx, uiDepth);
     668
     669    UInt absValDeltaDC = 0;
     670
     671    UInt uiUnaryIdx = 0;
     672    UInt uiNumCand = MTK_SINGLE_DEPTH_MODE_CANDIDATE_LIST_SIZE;
     673    if ( uiNumCand > 1 )
     674    {
     675      for( ; uiUnaryIdx < uiNumCand - 1; ++uiUnaryIdx )
     676      {
     677        UInt uiSymbol2 = 0;
     678        if ( uiUnaryIdx==0 )
     679        {
     680          m_pcTDecBinIf->decodeBin( uiSymbol2, m_cSingleDepthValueSCModel.get( 0, 0, 0 ) );
     681        }
     682        else
     683        {
     684          m_pcTDecBinIf->decodeBinEP( uiSymbol2);
     685        }
     686        if( uiSymbol2 == 0 )
     687        {
     688          break;
     689        }
     690      }
     691    }
     692    absValDeltaDC = uiUnaryIdx;
     693    pcCU->setSingleDepthValueSubParts((Pel)absValDeltaDC,uiAbsPartIdx, 0, uiDepth);
     694  }
     695}
     696
     697#endif
    639698/** parse merge flag
    640699 * \param pcCU
  • branches/HTM-11.2-dev3-MediaTek/source/Lib/TLibDecoder/TDecSbac.h

    r976 r983  
    129129 
    130130  Void parseSkipFlag      ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
     131#if MTK_SINGLE_DEPTH_MODE_I0095 
     132  Void parseSingleDepthMode      ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
     133#endif 
    131134  Void parseCUTransquantBypassFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
    132135  Void parseSplitFlag     ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
     
    179182  ContextModel3DBuffer m_cCUSplitFlagSCModel;
    180183  ContextModel3DBuffer m_cCUSkipFlagSCModel;
     184#if MTK_SINGLE_DEPTH_MODE_I0095
     185  ContextModel3DBuffer m_cCUSingleDepthFlagSCModel;
     186  ContextModel3DBuffer m_cSingleDepthValueSCModel;
     187#endif
    181188  ContextModel3DBuffer m_cCUMergeFlagExtSCModel;
    182189  ContextModel3DBuffer m_cCUMergeIdxExtSCModel;
Note: See TracChangeset for help on using the changeset viewer.