Ignore:
Timestamp:
22 May 2013, 21:05:43 (11 years ago)
Author:
tech
Message:

Merged HTM-6.2-dev3-RWTH-Fix Rev. 415

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/HTM-6.2-dev0/source/Lib/TLibDecoder/TDecSbac.cpp

    r427 r433  
    3737
    3838#include "TDecSbac.h"
    39 
    40 #if RWTH_SDC_DLT_B0036
    41 #define GetNumDepthValues()     (pcCU->getSlice()->getSPS()->getNumDepthValues())
    42 #define GetBitsPerDepthValue()  (pcCU->getSlice()->getSPS()->getBitsPerDepthValue())
    43 #endif
    4439
    4540//! \ingroup TLibDecoder
     
    10398#endif
    10499#if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX
     100#if !PKU_QC_DEPTH_INTRA_UNI_D0195
    105101, m_cDmmFlagSCModel           ( 1,             1,               NUM_DMM_FLAG_CTX              , m_contextModels + m_numContextModels, m_numContextModels)
    106102, m_cDmmModeSCModel           ( 1,             1,               NUM_DMM_MODE_CTX              , m_contextModels + m_numContextModels, m_numContextModels)
     103#endif
    107104, m_cDmmDataSCModel           ( 1,             1,               NUM_DMM_DATA_CTX              , m_contextModels + m_numContextModels, m_numContextModels)
    108105#endif
     
    114111#endif
    115112#if RWTH_SDC_DLT_B0036
     113#if !PKU_QC_DEPTH_INTRA_UNI_D0195
    116114, m_cSDCFlagSCModel             ( 1,             1,                 SDC_NUM_FLAG_CTX           , m_contextModels + m_numContextModels, m_numContextModels)
     115#else
     116, m_cDepthModeModel             ( 1,             1,                 DEPTH_MODE_NUM_FLAG_CTX           , m_contextModels + m_numContextModels, m_numContextModels)
     117, m_cDmmDeltaFlagModel             ( 1,             1,                 DMM_DELTA_NUM_FLAG_CTX           , m_contextModels + m_numContextModels, m_numContextModels)
     118#endif
     119#if RWTH_SDC_CTX_SIMPL_D0032
     120, m_cSDCResidualFlagSCModel     ( 1,             1,  SDC_NUM_RESIDUAL_FLAG_CTX  , m_contextModels + m_numContextModels, m_numContextModels)
     121, m_cSDCResidualSCModel         ( 1,             1,  SDC_NUM_RESIDUAL_CTX       , m_contextModels + m_numContextModels, m_numContextModels)
     122, m_cSDCPredModeSCModel             ( 1,             3,                 SDC_NUM_PRED_MODE_CTX     , m_contextModels + m_numContextModels, m_numContextModels)
     123#else
    117124, m_cSDCResidualFlagSCModel     ( 1,             2,  SDC_NUM_RESIDUAL_FLAG_CTX  , m_contextModels + m_numContextModels, m_numContextModels)
    118125, m_cSDCResidualSignFlagSCModel ( 1,             2,  SDC_NUM_SIGN_FLAG_CTX      , m_contextModels + m_numContextModels, m_numContextModels)
    119126, m_cSDCResidualSCModel         ( 1,             2,  SDC_NUM_RESIDUAL_CTX       , m_contextModels + m_numContextModels, m_numContextModels)
    120127, m_cSDCPredModeSCModel             ( 1,             3,                 SDC_NUM_PRED_MODE_CTX     , m_contextModels + m_numContextModels, m_numContextModels)
     128#endif
    121129#endif
    122130{
     
    216224  m_uiLastDQpNonZero  = 0;
    217225#if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX
     226#if !PKU_QC_DEPTH_INTRA_UNI_D0195
    218227  m_cDmmFlagSCModel.initBuffer           ( sliceType, qp, (UChar*)INIT_DMM_FLAG );
    219228  m_cDmmModeSCModel.initBuffer           ( sliceType, qp, (UChar*)INIT_DMM_MODE );
     229#endif
    220230  m_cDmmDataSCModel.initBuffer           ( sliceType, qp, (UChar*)INIT_DMM_DATA );
    221231#endif
    222232#if RWTH_SDC_DLT_B0036
     233#if !PKU_QC_DEPTH_INTRA_UNI_D0195
    223234  m_cSDCFlagSCModel.initBuffer              ( sliceType, qp, (UChar*)INIT_SDC_FLAG );
     235#else
     236  m_cDepthModeModel.initBuffer              ( sliceType, qp, (UChar*)INIT_DEPTHMODE_FLAG );
     237  m_cDmmDeltaFlagModel.initBuffer           ( sliceType, qp, (UChar*)INIT_DMMDELTA_FLAG );
     238#endif
    224239  m_cSDCResidualFlagSCModel.initBuffer      ( sliceType, qp, (UChar*)INIT_SDC_RESIDUAL_FLAG );
    225240  m_cSDCResidualSCModel.initBuffer          ( sliceType, qp, (UChar*)INIT_SDC_RESIDUAL );
     241#if !RWTH_SDC_CTX_SIMPL_D0032
    226242  m_cSDCResidualSignFlagSCModel.initBuffer  ( sliceType, qp, (UChar*)INIT_SDC_SIGN_FLAG );
     243#endif
    227244  m_cSDCPredModeSCModel.initBuffer              ( sliceType, qp, (UChar*)INIT_SDC_PRED_MODE );
    228245#endif
     
    303320  m_cCUTransSubdivFlagSCModel.initBuffer ( eSliceType, iQp, (UChar*)INIT_TRANS_SUBDIV_FLAG );
    304321#if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX
     322#if !PKU_QC_DEPTH_INTRA_UNI_D0195
    305323  m_cDmmFlagSCModel.initBuffer           ( eSliceType, iQp, (UChar*)INIT_DMM_FLAG );
    306324  m_cDmmModeSCModel.initBuffer           ( eSliceType, iQp, (UChar*)INIT_DMM_MODE );
     325#endif
    307326  m_cDmmDataSCModel.initBuffer           ( eSliceType, iQp, (UChar*)INIT_DMM_DATA );
    308327#endif
    309328#if RWTH_SDC_DLT_B0036
     329#if !PKU_QC_DEPTH_INTRA_UNI_D0195
    310330  m_cSDCFlagSCModel.initBuffer              ( eSliceType, iQp, (UChar*)INIT_SDC_FLAG );
     331#else
     332  m_cDepthModeModel.initBuffer              ( eSliceType, iQp, (UChar*)INIT_DEPTHMODE_FLAG );
     333  m_cDmmDeltaFlagModel.initBuffer           ( eSliceType, iQp, (UChar*)INIT_DMMDELTA_FLAG );
     334#endif
    311335  m_cSDCResidualFlagSCModel.initBuffer      ( eSliceType, iQp, (UChar*)INIT_SDC_RESIDUAL_FLAG );
    312336  m_cSDCResidualSCModel.initBuffer          ( eSliceType, iQp, (UChar*)INIT_SDC_RESIDUAL );
     337#if !RWTH_SDC_CTX_SIMPL_D0032
    313338  m_cSDCResidualSignFlagSCModel.initBuffer  ( eSliceType, iQp, (UChar*)INIT_SDC_SIGN_FLAG );
     339#endif
    314340  m_cSDCPredModeSCModel.initBuffer              ( eSliceType, iQp, (UChar*)INIT_SDC_PRED_MODE );
    315341#endif
     
    894920}
    895921 
     922  UInt uiSymbol;
     923  if (bDmmFlag)
     924  {
     925    if (bDmmFlag)
     926    {
     927      m_pcTDecBinIf->decodeBin( uiSymbol , m_cDmmDeltaFlagModel.get(0, 0, 0) );
     928      uiDir += uiSymbol;
     929    }
     930    if (uiSymbol)
     931    {
     932      UInt uiDC;
     933      Int iDC = 0,iDC1 = 0,iDC2 = 0;
     934      for ( Int i = 0; i  <2; i++ )
     935      {
     936        xReadExGolombLevel( uiDC, m_cDmmDataSCModel.get(0, 0, 1) );
     937        iDC = uiDC;
     938        if ( uiDC )
     939        {
     940          UInt uiSign;
     941          m_pcTDecBinIf->decodeBinEP( uiSign );
     942          if ( uiSign )
     943          {
     944            iDC = -iDC;
     945          }
     946        }
     947        if ( i == 0 ) { iDC1 = iDC; }
     948        else          { iDC2 = iDC; }
     949      }
     950
     951      if( uiDir == DMM_WEDGE_FULL_D_IDX )   
     952      {
     953        pcCU->setWedgeFullDeltaDC1SubParts( iDC1, uiAbsPartIdx, uiDepth );
     954        pcCU->setWedgeFullDeltaDC2SubParts( iDC2, uiAbsPartIdx, uiDepth );
     955      }
     956      else if( uiDir == DMM_WEDGE_PREDDIR_D_IDX )
     957      {
     958        pcCU->setWedgePredDirDeltaDC1SubParts( iDC1, uiAbsPartIdx, uiDepth );
     959        pcCU->setWedgePredDirDeltaDC2SubParts( iDC2, uiAbsPartIdx, uiDepth );
     960      }
     961      else if( uiDir == DMM_WEDGE_PREDTEX_D_IDX) 
     962      {
     963        pcCU->setWedgePredTexDeltaDC1SubParts( iDC1, uiAbsPartIdx, uiDepth );
     964        pcCU->setWedgePredTexDeltaDC2SubParts( iDC2, uiAbsPartIdx, uiDepth );
     965      }
     966      else if (uiDir== DMM_CONTOUR_PREDTEX_D_IDX )
     967      {
     968        pcCU->setContourPredTexDeltaDC1SubParts( iDC1, uiAbsPartIdx, uiDepth );
     969        pcCU->setContourPredTexDeltaDC2SubParts( iDC2, uiAbsPartIdx, uiDepth );
     970      }
     971    }
     972  }
     973  else if (uiDir >= EDGE_INTRA_IDX)
     974  {
     975    m_pcTDecBinIf->decodeBin( uiSymbol, m_cEdgeIntraDeltaDCSCModel.get(0, 0, 0) );
     976    if( uiSymbol )
     977    {
     978      uiDir = EDGE_INTRA_DELTA_IDX;
     979      Int iDeltaDC = 0,iDeltaDC0 = 0,iDeltaDC1 = 0;
     980      for (Int i = 0; i<2; i++)
     981      {
     982        xReadExGolombLevel( (UInt &) iDeltaDC, m_cEdgeIntraDeltaDCSCModel.get(0, 0, 1) );
     983        if( iDeltaDC != 0 )
     984        {
     985          UInt uiSign;
     986          m_pcTDecBinIf->decodeBinEP( uiSign );
     987          if ( uiSign )
     988          {
     989            iDeltaDC = -iDeltaDC;
     990          }
     991        }
     992        if ( i == 0 ) { iDeltaDC0 = iDeltaDC; }
     993        else          { iDeltaDC1 = iDeltaDC; }
     994      }
     995
     996      pcCU->setEdgeDeltaDC0( uiAbsPartIdx, iDeltaDC0 );
     997      pcCU->setEdgeDeltaDC1( uiAbsPartIdx, iDeltaDC1 );
     998    }
     999  }
     1000  else if(bSdcFlag)//SDC mode
     1001  {
     1002    assert(pcCU->getPartitionSize(uiAbsPartIdx)!=SIZE_NxN);
     1003    pcCU->setTrIdxSubParts(0, uiAbsPartIdx, uiDepth);
     1004    pcCU->setCbfSubParts(1, 1, 1, uiAbsPartIdx, uiDepth);
     1005
     1006    UInt uiNumSegments = ( uiDir == DC_IDX || uiDir == PLANAR_IDX )? 1 : 2;
     1007    for (int uiSeg=0; uiSeg<uiNumSegments; uiSeg++)
     1008    {
     1009      parseSDCResidualData(pcCU, uiAbsPartIdx, uiDepth, uiSeg);
     1010    }
     1011  }
     1012
     1013  pcCU->setLumaIntraDirSubParts( (UChar)uiDir, uiAbsPartIdx, uiDepth );
     1014}
     1015#endif
    8961016Void TDecSbac::parseIntraDirLumaAng  ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth )
    8971017{
    8981018  UInt uiSymbol;
    8991019  Int  intraPredMode;
    900 
     1020#if PKU_QC_DEPTH_INTRA_UNI_D0195
     1021  if (pcCU->getSlice()->getSPS()->isDepth())
     1022  {
     1023    parseDepthModelingTable(pcCU, uiAbsPartIdx, uiDepth);
     1024  }
     1025  if (pcCU->getLumaIntraDir(uiAbsPartIdx)<NUM_INTRA_MODE && !pcCU->getSDCFlag(uiAbsPartIdx))
     1026  {
     1027#else
    9011028#if HHI_DMM_WEDGE_INTRA || HHI_DMM_PRED_TEX
    9021029  UInt uiFlag = 0;
     
    9521079    }
    9531080#endif
    954 
    9551081    Int uiPreds[3] = {-1, -1, -1};
    9561082    Int uiPredNum = pcCU->getIntraDirLumaPredictor(uiAbsPartIdx, uiPreds); 
     1083#if !PKU_QC_DEPTH_INTRA_UNI_D0195
    9571084#if LGE_EDGE_INTRA_A0070
    9581085    UInt uiCheckBit = 0;
    9591086#endif
     1087#endif
    9601088
    9611089    m_pcTDecBinIf->decodeBin( uiSymbol, m_cCUIntraPredSCModel.get( 0, 0, 0) );
     
    9771105
    9781106      m_pcTDecBinIf->decodeBinsEP( uiSymbol, 5 );
     1107#if !PKU_QC_DEPTH_INTRA_UNI_D0195
    9791108#if LGE_EDGE_INTRA_A0070
    9801109      if (bCodeEdgeIntra)
     
    9871116        }
    9881117      }
     1118#endif
    9891119#endif
    9901120      intraPredMode = uiSymbol;
     
    10031133        std::swap(uiPreds[1], uiPreds[2]);
    10041134      }
     1135#if !PKU_QC_DEPTH_INTRA_UNI_D0195
    10051136#if LGE_EDGE_INTRA_A0070
    10061137      if ( intraPredMode != EDGE_INTRA_IDX)
    10071138      {
    10081139#endif
     1140#endif
    10091141        for ( Int i = 0; i < uiPredNum; i++ )
    10101142        {
    10111143          intraPredMode += ( intraPredMode >= uiPreds[i] );
    10121144        }
     1145#if !PKU_QC_DEPTH_INTRA_UNI_D0195
    10131146#if LGE_EDGE_INTRA_A0070
    10141147      }
    10151148#endif
    1016     }
    1017 
     1149#endif
     1150    }
     1151
     1152#if !PKU_QC_DEPTH_INTRA_UNI_D0195
    10181153#if LGE_EDGE_INTRA_A0070
    10191154    if( intraPredMode == EDGE_INTRA_IDX )
     
    10591194  }
    10601195#endif
    1061 
    10621196  pcCU->setLumaIntraDirSubParts( (UChar)intraPredMode, uiAbsPartIdx, uiDepth );
     1197#else
     1198  pcCU->setLumaIntraDirSubParts( (UChar)intraPredMode, uiAbsPartIdx, uiDepth );
     1199}
     1200#endif
    10631201}
    10641202
     
    26292767 
    26302768#if RWTH_SDC_DLT_B0036
     2769#if !PKU_QC_DEPTH_INTRA_UNI_D0195
    26312770Void TDecSbac::parseSDCFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth )
    26322771{
     
    26612800  {
    26622801    UInt uiIsMostProb = 0;
     2802#if INTEL_SDC64_D0193
     2803    if( !(pcCU->getWidth(uiAbsPartIdx) == 64 && i == 1))
     2804#endif
    26632805    m_pcTDecBinIf->decodeBin( uiIsMostProb, m_cSDCPredModeSCModel.get( 0, i, uiCtx ) );
    26642806   
     
    26792821  pcCU->setLumaIntraDirSubParts((UChar)intraPredMode, uiAbsPartIdx, uiDepth);
    26802822}
     2823#endif
    26812824
    26822825Void TDecSbac::parseSDCResidualData ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt uiSegment )
     
    26922835  Int  iIdx       = 0;
    26932836 
    2694   UInt uiMaxResidualBits  = GetBitsPerDepthValue();
     2837  UInt uiMaxResidualBits  = pcCU->getSlice()->getSPS()->getBitsPerDepthValue();
    26952838  assert( uiMaxResidualBits <= g_uiBitDepth );
    26962839 
     2840#if RWTH_SDC_CTX_SIMPL_D0032
     2841  m_pcTDecBinIf->decodeBin(uiResidual, m_cSDCResidualFlagSCModel.get( 0, 0, 0 ) );
     2842#else
    26972843  m_pcTDecBinIf->decodeBin(uiResidual, m_cSDCResidualFlagSCModel.get( 0, uiSegment, 0 ) );
     2844#endif
    26982845 
    26992846  if (uiResidual)
    27002847  {
    27012848    // decode residual sign bit
     2849#if RWTH_SDC_CTX_SIMPL_D0032
     2850    m_pcTDecBinIf->decodeBinEP(uiSign);
     2851#else
    27022852    m_pcTDecBinIf->decodeBin(uiSign, m_cSDCResidualSignFlagSCModel.get( 0, uiSegment, 0 ) );
     2853#endif
    27032854   
    27042855    // decode residual magnitude
     2856#if LGE_CONCATENATE_D0141
     2857    //prefix part
     2858    UInt uiCount = 0;
     2859    UInt uiNumDepthValues = pcCU->getSlice()->getSPS()->getNumDepthValues();
     2860    UInt uiPrefixThreshold = ((uiNumDepthValues * 3) >> 2);
     2861    for ( UInt ui = 0; ui < uiPrefixThreshold; ui++)
     2862    {
     2863        m_pcTDecBinIf->decodeBin( uiBit, m_cSDCResidualSCModel.get(0, 0, 0) );
     2864        if ( uiBit == 0 )
     2865            break;
     2866        else
     2867            uiCount++;
     2868    }
     2869    //suffix part
     2870    if ( uiCount == uiPrefixThreshold )
     2871    {
     2872        for ( UInt ui = 0; ui < ( (UInt)ceil( Log2(uiNumDepthValues - uiPrefixThreshold) ) ); ui++ )
     2873        {
     2874            m_pcTDecBinIf->decodeBinEP( uiBit );
     2875            uiAbsIdx |= uiBit << ui;
     2876        }
     2877        uiAbsIdx += uiCount;
     2878    }
     2879    else
     2880        uiAbsIdx = uiCount;
     2881#else
    27052882    for (Int i=0; i<uiMaxResidualBits; i++)
    27062883    {
     2884#if RWTH_SDC_CTX_SIMPL_D0032
     2885      m_pcTDecBinIf->decodeBin(uiBit, m_cSDCResidualSCModel.get( 0, 0, i ) );
     2886#else
    27072887      m_pcTDecBinIf->decodeBin(uiBit, m_cSDCResidualSCModel.get( 0, uiSegment, i ) );
     2888#endif
    27082889      uiAbsIdx |= uiBit << i;
    27092890    }
     2891#endif
    27102892   
    27112893    uiAbsIdx += 1;
Note: See TracChangeset for help on using the changeset viewer.