Ignore:
Timestamp:
11 Jul 2013, 16:03:14 (12 years ago)
Author:
tech
Message:

Merged HTM-DEV-0.3-dev1 Rev. 520.

Location:
branches/HTM-DEV-0.3-dev2/source/Lib/TLibDecoder
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • branches/HTM-DEV-0.3-dev2/source/Lib/TLibDecoder/TDecCAVLC.cpp

    r521 r531  
    977977    {
    978978#if H_3D
     979      m_pcBitstream->readOutTrailingBits();
     980
     981      for( Int i = 0; i <= pcVPS->getMaxLayers() - 1; i++ )
     982      {
     983        if( pcVPS->getDepthId( i ) )
     984        {
     985          READ_FLAG( uiCode, "vps_depth_modes_flag[i]" );             pcVPS->setVpsDepthModesFlag( i, uiCode == 1 ? true : false );
     986         
     987#if H_3D_DIM_DLT
     988          if( pcVPS->getVpsDepthModesFlag( i ) )
     989          {
     990            READ_FLAG( uiCode, "use_dlt_flag[i]" );
     991            pcVPS->setUseDLTFlag( i, uiCode == 1 ? true : false );
     992            if( pcVPS->getUseDLTFlag( i ) )
     993            {
     994              // decode mapping
     995              UInt uiNumDepthValues;
     996              // parse number of values in DLT
     997              READ_UVLC(uiNumDepthValues, "num_dlt_depth_values[i]");
     998             
     999              // parse actual DLT values
     1000              Int* aiIdx2DepthValue = (Int*) calloc(uiNumDepthValues, sizeof(Int));
     1001              for(Int d=0; d<uiNumDepthValues; d++)
     1002              {
     1003                READ_UVLC(uiCode, "dlt_depth_value[i][d]");
     1004                aiIdx2DepthValue[d] = (Int)uiCode;
     1005              }
     1006             
     1007              pcVPS->setDepthLUTs(i, aiIdx2DepthValue, uiNumDepthValues);
     1008             
     1009              // clean memory
     1010              free(aiIdx2DepthValue);
     1011            }
     1012          }
     1013#endif
     1014        }
     1015      }
     1016
    9791017#if H_3D_GEN
    9801018      for( Int layer = 0; layer <= pcVPS->getMaxLayers() - 1; layer++ )
  • branches/HTM-DEV-0.3-dev2/source/Lib/TLibDecoder/TDecCu.cpp

    r521 r531  
    488488      break;
    489489    case MODE_INTRA:
     490#if H_3D_DIM_SDC
     491      if( m_ppcCU[uiDepth]->getSDCFlag(0) )
     492        xReconIntraSDC( m_ppcCU[uiDepth], 0, uiDepth );
     493      else
     494#endif
    490495      xReconIntraQT( m_ppcCU[uiDepth], uiDepth );
    491496      break;
     
    557562 
    558563  //===== get prediction signal =====
     564#if H_3D_DIM
     565  if( isDimMode( uiLumaPredMode ) )
     566  {
     567    m_pcPrediction->predIntraLumaDepth( pcCU, uiAbsPartIdx, uiLumaPredMode, piPred, uiStride, uiWidth, uiHeight );
     568  }
     569  else
     570  {
     571#endif
    559572  m_pcPrediction->predIntraLumaAng( pcCU->getPattern(), uiLumaPredMode, piPred, uiStride, uiWidth, uiHeight, bAboveAvail, bLeftAvail );
     573#if H_3D_DIM
     574  }
     575#endif
    560576 
    561577  //===== inverse transform =====
     
    645661    {
    646662      uiChromaPredMode = pcCU->getLumaIntraDir( 0 );
     663#if H_3D_DIM
     664      mapDepthModeToIntraDir( uiChromaPredMode );
     665#endif
    647666    }
    648667    m_pcPrediction->predIntraChromaAng( pPatChroma, uiChromaPredMode, piPred, uiStride, uiWidth, uiHeight, bAboveAvail, bLeftAvail ); 
     
    709728
    710729}
     730
     731#if H_3D_DIM_SDC
     732Void TDecCu::xReconIntraSDC( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth )
     733{
     734  UInt uiWidth        = pcCU->getWidth  ( 0 );
     735  UInt uiHeight       = pcCU->getHeight ( 0 );
     736 
     737  TComYuv* pcRecoYuv  = m_ppcYuvReco[uiDepth];
     738  TComYuv* pcPredYuv  = m_ppcYuvReco[uiDepth];
     739  TComYuv* pcResiYuv  = m_ppcYuvResi[uiDepth];
     740 
     741  UInt    uiStride    = pcRecoYuv->getStride  ();
     742  Pel*    piReco      = pcRecoYuv->getLumaAddr( uiAbsPartIdx );
     743  Pel*    piPred      = pcPredYuv->getLumaAddr( uiAbsPartIdx );
     744  Pel*    piResi      = pcResiYuv->getLumaAddr( uiAbsPartIdx );
     745 
     746  UInt    uiZOrder          = pcCU->getZorderIdxInCU() + uiAbsPartIdx;
     747  Pel*    piRecIPred        = pcCU->getPic()->getPicYuvRec()->getLumaAddr( pcCU->getAddr(), uiZOrder );
     748  UInt    uiRecIPredStride  = pcCU->getPic()->getPicYuvRec()->getStride  ();
     749 
     750  UInt    uiLumaPredMode    = pcCU->getLumaIntraDir     ( uiAbsPartIdx );
     751 
     752  AOF( uiWidth == uiHeight );
     753  AOF( uiAbsPartIdx == 0 );
     754  AOF( pcCU->getSDCAvailable(uiAbsPartIdx) );
     755  AOF( pcCU->getSDCFlag(uiAbsPartIdx) );
     756 
     757  //===== init availability pattern =====
     758  Bool  bAboveAvail = false;
     759  Bool  bLeftAvail  = false;
     760  pcCU->getPattern()->initPattern   ( pcCU, 0, uiAbsPartIdx );
     761  pcCU->getPattern()->initAdiPattern( pcCU, uiAbsPartIdx, 0, m_pcPrediction->getPredicBuf(), m_pcPrediction->getPredicBufWidth(), m_pcPrediction->getPredicBufHeight(), bAboveAvail, bLeftAvail );
     762 
     763  //===== get prediction signal =====
     764#if H_3D_DIM
     765  if( isDimMode( uiLumaPredMode ) )
     766  {
     767    m_pcPrediction->predIntraLumaDepth( pcCU, uiAbsPartIdx, uiLumaPredMode, piPred, uiStride, uiWidth, uiHeight );
     768  }
     769  else
     770  {
     771#endif
     772    m_pcPrediction->predIntraLumaAng( pcCU->getPattern(), uiLumaPredMode, piPred, uiStride, uiWidth, uiHeight, bAboveAvail, bLeftAvail );
     773#if H_3D_DIM
     774  }
     775#endif
     776 
     777  // number of segments depends on prediction mode
     778  UInt uiNumSegments = 1;
     779  Bool* pbMask = NULL;
     780  UInt uiMaskStride = 0;
     781 
     782  if( getDimType( uiLumaPredMode ) == DMM1_IDX )
     783  {
     784    Int uiTabIdx = pcCU->getDmmWedgeTabIdx(DMM1_IDX, uiAbsPartIdx);
     785   
     786    WedgeList* pacWedgeList = &g_dmmWedgeLists[(g_aucConvertToBit[uiWidth])];
     787    TComWedgelet* pcWedgelet = &(pacWedgeList->at( uiTabIdx ));
     788   
     789    uiNumSegments = 2;
     790    pbMask = pcWedgelet->getPattern();
     791    uiMaskStride = pcWedgelet->getStride();
     792  }
     793 
     794  // get DC prediction for each segment
     795  Pel apDCPredValues[2];
     796  m_pcPrediction->analyzeSegmentsSDC(piPred, uiStride, uiWidth, apDCPredValues, uiNumSegments, pbMask, uiMaskStride);
     797 
     798  // reconstruct residual based on mask + DC residuals
     799  Pel apDCResiValues[2];
     800  for( UInt uiSegment = 0; uiSegment < uiNumSegments; uiSegment++ )
     801  {
     802#if H_3D_DIM_DLT
     803    Pel   pPredIdx    = pcCU->getSlice()->getVPS()->depthValue2idx( pcCU->getSlice()->getLayerIdInVps(), apDCPredValues[uiSegment] );
     804    Pel   pResiIdx    = pcCU->getSDCSegmentDCOffset(uiSegment, uiAbsPartIdx);
     805    Pel   pRecoValue  = pcCU->getSlice()->getVPS()->idx2DepthValue( pcCU->getSlice()->getLayerIdInVps(), pPredIdx + pResiIdx );
     806   
     807    apDCResiValues[uiSegment]  = pRecoValue - apDCPredValues[uiSegment];
     808#else
     809    apDCResiValues[uiSegment]  = pcCU->getSDCSegmentDCOffset(uiSegment, uiAbsPartIdx);
     810#endif
     811  }
     812 
     813  //===== reconstruction =====
     814  Bool*pMask      = pbMask;
     815  Pel* pPred      = piPred;
     816  Pel* pResi      = piResi;
     817  Pel* pReco      = piReco;
     818  Pel* pRecIPred  = piRecIPred;
     819 
     820  for( UInt uiY = 0; uiY < uiHeight; uiY++ )
     821  {
     822    for( UInt uiX = 0; uiX < uiWidth; uiX++ )
     823    {
     824      UChar ucSegment = pMask?(UChar)pMask[uiX]:0;
     825      assert( ucSegment < uiNumSegments );
     826     
     827      Pel pResiDC = apDCResiValues[ucSegment];
     828     
     829      pReco    [ uiX ] = ClipY( pPred[ uiX ] + pResiDC );
     830      pRecIPred[ uiX ] = pReco[ uiX ];
     831    }
     832    pPred     += uiStride;
     833    pResi     += uiStride;
     834    pReco     += uiStride;
     835    pRecIPred += uiRecIPredStride;
     836    pMask     += uiMaskStride;
     837  }
     838 
     839  // clear UV
     840  UInt  uiStrideC     = pcPredYuv->getCStride();
     841  Pel   *pRecCb       = pcPredYuv->getCbAddr();
     842  Pel   *pRecCr       = pcPredYuv->getCrAddr();
     843 
     844  for (Int y=0; y<uiHeight/2; y++)
     845  {
     846    for (Int x=0; x<uiWidth/2; x++)
     847    {
     848      pRecCb[x] = 128;
     849      pRecCr[x] = 128;
     850    }
     851   
     852    pRecCb += uiStrideC;
     853    pRecCr += uiStrideC;
     854  }
     855}
     856#endif
    711857
    712858/** Function for deriving recontructed PU/CU Luma sample with QTree structure
  • branches/HTM-DEV-0.3-dev2/source/Lib/TLibDecoder/TDecCu.h

    r324 r531  
    115115  Void setdQPFlag               ( Bool b )                { m_bDecodeDQP = b;           }
    116116  Void xFillPCMBuffer           (TComDataCU* pCU, UInt depth);
     117#if H_3D_DIM_SDC
     118  Void xReconIntraSDC           ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
     119#endif
    117120};
    118121
  • branches/HTM-DEV-0.3-dev2/source/Lib/TLibDecoder/TDecEntropy.cpp

    r521 r531  
    144144  {
    145145    decodeIntraDirModeLuma  ( pcCU, uiAbsPartIdx, uiDepth );
     146#if H_3D_DIM_SDC
     147    if(!pcCU->getSDCFlag(uiAbsPartIdx))
     148#endif
    146149    decodeIntraDirModeChroma( pcCU, uiAbsPartIdx, uiDepth );
    147150  }
     
    166169    return;
    167170  }
     171#if H_3D_DIM_SDC
     172  if( pcCU->getSDCFlag(uiAbsPartIdx) )
     173  {
     174    return;
     175  }
     176#endif
    168177 
    169178  m_pcEntropyDecoderIf->parseIPCMInfo( pcCU, uiAbsPartIdx, uiDepth );
     
    614623  UInt uiChromaOffset = uiLumaOffset>>2;
    615624 
     625#if H_3D_DIM_SDC
     626  if( pcCU->getSDCFlag( uiAbsPartIdx ) )
     627  {
     628    assert( pcCU->getPartitionSize(uiAbsPartIdx) == SIZE_2Nx2N );
     629    assert( pcCU->getTransformIdx(uiAbsPartIdx) == 0 );
     630    assert( pcCU->getCbf(uiAbsPartIdx, TEXT_LUMA) == 1 );
     631    assert( pcCU->getCbf(uiAbsPartIdx, TEXT_CHROMA_U) == 1 );
     632    assert( pcCU->getCbf(uiAbsPartIdx, TEXT_CHROMA_V) == 1 );
     633    return;
     634  }
     635#endif
     636 
    616637  if( pcCU->isIntra(uiAbsPartIdx) )
    617638  {
  • branches/HTM-DEV-0.3-dev2/source/Lib/TLibDecoder/TDecSbac.cpp

    r521 r531  
    8383, m_cTransformSkipSCModel     ( 1,             2,               NUM_TRANSFORMSKIP_FLAG_CTX    , m_contextModels + m_numContextModels, m_numContextModels)
    8484, m_CUTransquantBypassFlagSCModel( 1,          1,               NUM_CU_TRANSQUANT_BYPASS_FLAG_CTX, m_contextModels + m_numContextModels, m_numContextModels)
     85#if H_3D_DIM
     86, m_cDepthIntraModeSCModel    ( 1,             1,               NUM_DEPTH_INTRA_MODE_CTX      , m_contextModels + m_numContextModels, m_numContextModels)
     87, m_cDdcFlagSCModel           ( 1,             1,               NUM_DDC_FLAG_CTX              , m_contextModels + m_numContextModels, m_numContextModels)
     88, m_cDdcDataSCModel           ( 1,             1,               NUM_DDC_DATA_CTX              , m_contextModels + m_numContextModels, m_numContextModels)
     89#if H_3D_DIM_DMM
     90, m_cDmm1DataSCModel          ( 1,             1,               NUM_DMM1_DATA_CTX             , m_contextModels + m_numContextModels, m_numContextModels)
     91, m_cDmm2DataSCModel          ( 1,             1,               NUM_DMM2_DATA_CTX             , m_contextModels + m_numContextModels, m_numContextModels)
     92, m_cDmm3DataSCModel          ( 1,             1,               NUM_DMM3_DATA_CTX             , m_contextModels + m_numContextModels, m_numContextModels)
     93#endif
     94#if H_3D_DIM_RBC
     95, m_cRbcDataSCModel           ( 1,             1,               NUM_RBC_DATA_CTX              , m_contextModels + m_numContextModels, m_numContextModels)
     96#endif
     97#if H_3D_DIM_SDC
     98, m_cSDCResidualFlagSCModel     ( 1,             1,             SDC_NUM_RESIDUAL_FLAG_CTX     , m_contextModels + m_numContextModels, m_numContextModels)
     99, m_cSDCResidualSCModel         ( 1,             1,             SDC_NUM_RESIDUAL_CTX          , m_contextModels + m_numContextModels, m_numContextModels)
     100#endif
     101#endif
    85102{
    86103  assert( m_numContextModels <= MAX_NUM_CTX_MOD );
     
    149166  m_cTransformSkipSCModel.initBuffer     ( sliceType, qp, (UChar*)INIT_TRANSFORMSKIP_FLAG );
    150167  m_CUTransquantBypassFlagSCModel.initBuffer( sliceType, qp, (UChar*)INIT_CU_TRANSQUANT_BYPASS_FLAG );
     168
     169#if H_3D_DIM
     170  m_cDepthIntraModeSCModel.initBuffer    ( sliceType, qp, (UChar*)INIT_DEPTH_INTRA_MODE );
     171  m_cDdcFlagSCModel.initBuffer           ( sliceType, qp, (UChar*)INIT_DDC_FLAG );
     172  m_cDdcDataSCModel.initBuffer           ( sliceType, qp, (UChar*)INIT_DDC_DATA );
     173#if H_3D_DIM_DMM
     174  m_cDmm1DataSCModel.initBuffer          ( sliceType, qp, (UChar*)INIT_DMM1_DATA );
     175  m_cDmm2DataSCModel.initBuffer          ( sliceType, qp, (UChar*)INIT_DMM2_DATA );
     176  m_cDmm3DataSCModel.initBuffer          ( sliceType, qp, (UChar*)INIT_DMM3_DATA );
     177#endif
     178#if H_3D_DIM_RBC
     179  m_cRbcDataSCModel.initBuffer           ( sliceType, qp, (UChar*)INIT_RBC_DATA );
     180#endif
     181#if H_3D_DIM_SDC
     182  m_cSDCResidualFlagSCModel.initBuffer    ( sliceType, qp, (UChar*)INIT_SDC_RESIDUAL_FLAG );
     183  m_cSDCResidualSCModel.initBuffer        ( sliceType, qp, (UChar*)INIT_SDC_RESIDUAL );
     184#endif
     185#endif
     186
    151187  m_uiLastDQpNonZero  = 0;
    152188 
     
    199235  m_cTransformSkipSCModel.initBuffer     ( eSliceType, iQp, (UChar*)INIT_TRANSFORMSKIP_FLAG );
    200236  m_CUTransquantBypassFlagSCModel.initBuffer( eSliceType, iQp, (UChar*)INIT_CU_TRANSQUANT_BYPASS_FLAG );
     237
     238#if H_3D_DIM
     239  m_cDepthIntraModeSCModel.initBuffer    ( eSliceType, iQp, (UChar*)INIT_DEPTH_INTRA_MODE );
     240  m_cDdcFlagSCModel.initBuffer           ( eSliceType, iQp, (UChar*)INIT_DDC_FLAG );
     241  m_cDdcDataSCModel.initBuffer           ( eSliceType, iQp, (UChar*)INIT_DDC_DATA );
     242#if H_3D_DIM_DMM
     243  m_cDmm1DataSCModel.initBuffer          ( eSliceType, iQp, (UChar*)INIT_DMM1_DATA );
     244  m_cDmm2DataSCModel.initBuffer          ( eSliceType, iQp, (UChar*)INIT_DMM2_DATA );
     245  m_cDmm3DataSCModel.initBuffer          ( eSliceType, iQp, (UChar*)INIT_DMM3_DATA );
     246#endif
     247#if H_3D_DIM_RBC
     248  m_cRbcDataSCModel.initBuffer           ( eSliceType, iQp, (UChar*)INIT_RBC_DATA );
     249#endif
     250#if H_3D_DIM_SDC
     251  m_cSDCResidualFlagSCModel.initBuffer    ( eSliceType, iQp, (UChar*)INIT_SDC_RESIDUAL_FLAG );
     252  m_cSDCResidualSCModel.initBuffer        ( eSliceType, iQp, (UChar*)INIT_SDC_RESIDUAL );
     253#endif
     254#endif
    201255  m_pcTDecBinIf->start();
    202256}
     
    315369  }
    316370}
     371
     372#if H_3D_DIM
     373Void TDecSbac::xReadExGolombLevel( UInt& ruiSymbol, ContextModel& rcSCModel  )
     374{
     375  UInt uiSymbol;
     376  UInt uiCount = 0;
     377  do
     378  {
     379    m_pcTDecBinIf->decodeBin( uiSymbol, rcSCModel );
     380    uiCount++;
     381  }
     382  while( uiSymbol && ( uiCount != 13 ) );
     383
     384  ruiSymbol = uiCount - 1;
     385
     386  if( uiSymbol )
     387  {
     388    xReadEpExGolomb( uiSymbol, 0 );
     389    ruiSymbol += uiSymbol + 1;
     390  }
     391
     392  return;
     393}
     394
     395Void TDecSbac::xParseDimDeltaDC( Pel& rValDeltaDC, UInt dimType )
     396{
     397  UInt absValDeltaDC = 0;
     398  xReadExGolombLevel( absValDeltaDC, m_cDdcDataSCModel.get(0, 0, (RBC_IDX == dimType) ? 1 : 0) );
     399  rValDeltaDC = (Pel)absValDeltaDC;
     400
     401  if( rValDeltaDC != 0 )
     402  {
     403    UInt uiSign;
     404    m_pcTDecBinIf->decodeBinEP( uiSign );
     405    if ( uiSign )
     406    {
     407      rValDeltaDC = -rValDeltaDC;
     408    }
     409  }
     410}
     411#if H_3D_DIM_DMM
     412Void TDecSbac::xParseDmm1WedgeIdx( UInt& ruiTabIdx, Int iNumBit )
     413{
     414  UInt uiSymbol, uiIdx = 0;
     415  for( Int i = 0; i < iNumBit; i++ )
     416  {
     417    m_pcTDecBinIf->decodeBin( uiSymbol, m_cDmm1DataSCModel.get(0, 0, 0) );
     418    uiIdx += uiSymbol << i;
     419  }
     420  ruiTabIdx = uiIdx;
     421}
     422Void TDecSbac::xParseDmm2Offset( Int& riOffset )
     423{
     424  Int iDeltaEnd = 0;
     425  if( DMM2_DELTAEND_MAX > 0 )
     426  {
     427    UInt uiFlag = 0;
     428    m_pcTDecBinIf->decodeBin( uiFlag, m_cDmm2DataSCModel.get(0, 0, 0) );
     429
     430    if( uiFlag )
     431    {
     432      UInt uiAbsValMinus1;
     433      UInt uiSymbol;
     434      m_pcTDecBinIf->decodeBin( uiSymbol, m_cDmm2DataSCModel.get(0, 0, 0) ); uiAbsValMinus1  = uiSymbol;
     435      m_pcTDecBinIf->decodeBin( uiSymbol, m_cDmm2DataSCModel.get(0, 0, 0) ); uiAbsValMinus1 |= uiSymbol << 1;
     436      iDeltaEnd = uiAbsValMinus1 + 1;
     437      UInt uiSign;
     438      m_pcTDecBinIf->decodeBinEP( uiSign );
     439      if( uiSign )
     440      {
     441        iDeltaEnd = -iDeltaEnd;
     442      }
     443    }
     444  }
     445  riOffset = iDeltaEnd;
     446}
     447Void TDecSbac::xParseDmm3WedgeIdx( UInt& ruiIntraIdx, Int iNumBit )
     448{
     449  UInt uiSymbol, uiIdx = 0;
     450  for( Int i = 0; i < iNumBit; i++ )
     451  {
     452    m_pcTDecBinIf->decodeBin( uiSymbol, m_cDmm3DataSCModel.get(0, 0, 0) );
     453    uiIdx += uiSymbol << i;
     454  }
     455  ruiIntraIdx = uiIdx;
     456}
     457#endif
     458#if H_3D_DIM_RBC
     459Void TDecSbac::xParseRbcEdge( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth )
     460{
     461  UInt uiSymbol = 0;
     462
     463  // 1. Top(0) or Left(1)
     464  UChar ucLeft;
     465  m_pcTDecBinIf->decodeBinEP( uiSymbol );
     466  ucLeft = uiSymbol;
     467
     468  // 2. Start position (lowest bit first)
     469  UChar ucStart = 0;
     470  for( UInt ui = 0; ui < 6 - uiDepth; ui++ )
     471  {
     472    m_pcTDecBinIf->decodeBinEP( uiSymbol );
     473    ucStart |= (uiSymbol << ui);
     474  }
     475
     476  // 3. Number of edges
     477  UChar ucMax = 0;
     478  for( UInt ui = 0; ui < 7 - uiDepth; ui++ )
     479  {
     480    m_pcTDecBinIf->decodeBinEP( uiSymbol );
     481    ucMax |= (uiSymbol << ui);
     482  }
     483  ucMax++; // +1
     484
     485  // 4. Edges
     486  UChar* pucSymbolList = (UChar*) xMalloc( UChar, 256 * RBC_MAX_EDGE_NUM_PER_4x4 );
     487  for( Int iPtr = 0; iPtr < ucMax; iPtr++ )
     488  {
     489    UChar ucEdge = 0;
     490    UInt  uiReorderEdge = 0;
     491    for( UInt ui = 0; ui < 6; ui++ )
     492    {
     493      m_pcTDecBinIf->decodeBin( uiSymbol, m_cRbcDataSCModel.get( 0, 0, 0 ) );
     494      ucEdge <<= 1;
     495      ucEdge |= uiSymbol;
     496      if( uiSymbol == 0 )
     497        break;
     498    }
     499
     500    switch( ucEdge )
     501    {
     502    case 0 :  // "0"       
     503      uiReorderEdge = 0;
     504      break;
     505    case 2 :  // "10"
     506      uiReorderEdge = 1;
     507      break;
     508    case 6 :  // "110"
     509      uiReorderEdge = 2;
     510      break;
     511    case 14 : // "1110"
     512      uiReorderEdge = 3;
     513      break;
     514    case 30 : // "11110"
     515      uiReorderEdge = 4;
     516      break;
     517    case 62 : // "111110"
     518      uiReorderEdge = 5;
     519      break;
     520    case 63 : // "111111"
     521      uiReorderEdge = 6;
     522      break;
     523    default :
     524      printf("parseIntraEdgeChain: error (unknown code %d)\n",ucEdge);
     525      assert(false);
     526      break;
     527    }
     528    pucSymbolList[iPtr] = uiReorderEdge;
     529  }
     530  /////////////////////
     531  // Edge Reconstruction
     532  Bool* pbRegion = pcCU->getEdgePartition( uiAbsPartIdx );
     533  pcCU->reconPartition( uiAbsPartIdx, uiDepth, ucLeft == 1, ucStart, ucMax, pucSymbolList, pbRegion );
     534  xFree( pucSymbolList );
     535}
     536#endif
     537#if H_3D_DIM_SDC
     538Void TDecSbac::xParseSDCResidualData ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt uiSegment )
     539{
     540  assert( pcCU->getSlice()->getIsDepth() );
     541  assert( pcCU->getPartitionSize(uiAbsPartIdx) == SIZE_2Nx2N );
     542  assert( pcCU->getSDCFlag(uiAbsPartIdx) );
     543  assert( uiSegment < 2 );
     544 
     545  UInt uiResidual = 0;
     546  UInt uiBit      = 0;
     547  UInt uiAbsIdx   = 0;
     548  UInt uiSign     = 0;
     549  Int  iIdx       = 0;
     550 
     551#if H_3D_DIM_DLT
     552  UInt uiMaxResidualBits = pcCU->getSlice()->getVPS()->getBitsPerDepthValue( pcCU->getSlice()->getLayerIdInVps() );
     553#else
     554  UInt uiMaxResidualBits = g_bitDepthY;
     555#endif
     556  assert( uiMaxResidualBits <= g_bitDepthY );
     557 
     558  m_pcTDecBinIf->decodeBin(uiResidual, m_cSDCResidualFlagSCModel.get( 0, 0, 0 ) );
     559 
     560  if (uiResidual)
     561  {
     562    // decode residual sign bit
     563    m_pcTDecBinIf->decodeBinEP(uiSign);
     564   
     565    // decode residual magnitude
     566    // prefix part
     567    UInt uiCount = 0;
     568#if H_3D_DIM_DLT
     569    UInt uiNumDepthValues = pcCU->getSlice()->getVPS()->getNumDepthValues( pcCU->getSlice()->getLayerIdInVps() );
     570#else
     571    UInt uiNumDepthValues = ((1 << g_bitDepthY)-1);
     572#endif
     573    UInt uiPrefixThreshold = ((uiNumDepthValues * 3) >> 2);
     574    for ( UInt ui = 0; ui < uiPrefixThreshold; ui++)
     575    {
     576      m_pcTDecBinIf->decodeBin( uiBit, m_cSDCResidualSCModel.get(0, 0, 0) );
     577      if ( uiBit == 0 )
     578        break;
     579      else
     580        uiCount++;
     581    }
     582    // suffix part
     583    if ( uiCount == uiPrefixThreshold )
     584    {
     585      for ( UInt ui = 0; ui < numBitsForValue(uiNumDepthValues - uiPrefixThreshold); ui++ )
     586      {
     587        m_pcTDecBinIf->decodeBinEP( uiBit );
     588        uiAbsIdx |= uiBit << ui;
     589      }
     590      uiAbsIdx += uiCount;
     591    }
     592    else
     593      uiAbsIdx = uiCount;
     594   
     595    uiAbsIdx += 1;
     596    iIdx =(Int)(uiSign ? -1 : 1)*uiAbsIdx;
     597  }
     598 
     599  pcCU->setSDCSegmentDCOffset(iIdx, uiSegment, uiAbsPartIdx);
     600}
     601#endif
     602#endif
    317603
    318604/** Parse I_PCM information.
     
    671957  for (j=0;j<partNum;j++)
    672958  {
     959#if H_3D_DIM
     960    if( pcCU->getSlice()->getVpsDepthModesFlag() )
     961    {
     962      parseIntraDepth( pcCU, absPartIdx+partOffset*j, depth );
     963    }
     964    if( pcCU->getLumaIntraDir( absPartIdx+partOffset*j ) < NUM_INTRA_MODE )
     965#if H_3D_DIM_SDC
     966      if( !pcCU->getSDCFlag( absPartIdx+partOffset*j ) )
     967#endif
     968    {
     969#endif
    673970    m_pcTDecBinIf->decodeBin( symbol, m_cCUIntraPredSCModel.get( 0, 0, 0) );
    674971    mpmPred[j] = symbol;
     
    676973    DTRACE_CU("prev_intra_luma_pred_flag", symbol)
    677974#endif
     975#if H_3D_DIM
     976    }
     977#endif
    678978  }
    679979  for (j=0;j<partNum;j++)
    680980  {
     981#if H_3D_DIM
     982    if( pcCU->getLumaIntraDir( absPartIdx+partOffset*j ) < NUM_INTRA_MODE )
     983#if H_3D_DIM_SDC
     984      if( !pcCU->getSDCFlag( absPartIdx+partOffset*j ) )
     985#endif
     986    {
     987#endif
    681988    Int preds[3] = {-1, -1, -1};
    682989    Int predNum = pcCU->getIntraDirLumaPredictor(absPartIdx+partOffset*j, preds); 
     
    7211028    }
    7221029    pcCU->setLumaIntraDirSubParts( (UChar)intraPredMode, absPartIdx+partOffset*j, depth );
     1030#if H_3D_DIM
     1031    }
     1032#endif
    7231033  }
    7241034}
     
    7531063  return;
    7541064}
     1065
     1066#if H_3D_DIM
     1067Void TDecSbac::parseIntraDepth( TComDataCU* pcCU, UInt absPartIdx, UInt depth )
     1068{
     1069  parseIntraDepthMode( pcCU, absPartIdx, depth );
     1070
     1071  UInt dir     = pcCU->getLumaIntraDir( absPartIdx );
     1072  UInt dimType = getDimType( dir );
     1073
     1074  switch( dimType )
     1075  {
     1076#if H_3D_DIM_DMM
     1077  case( DMM1_IDX ):
     1078    {
     1079      UInt uiTabIdx = 0;
     1080      xParseDmm1WedgeIdx( uiTabIdx, g_dmm1TabIdxBits[pcCU->getIntraSizeIdx(absPartIdx)] );
     1081      pcCU->setDmmWedgeTabIdxSubParts( uiTabIdx, dimType, absPartIdx, depth );
     1082    } break;
     1083  case( DMM2_IDX ):
     1084    {
     1085      Int iOffset = 0;
     1086      xParseDmm2Offset( iOffset );
     1087      pcCU->setDmm2DeltaEndSubParts( iOffset, absPartIdx, depth );
     1088    } break;
     1089  case( DMM3_IDX ):
     1090    {
     1091      UInt uiIntraIdx = 0;
     1092      xParseDmm3WedgeIdx( uiIntraIdx, g_dmm3IntraTabIdxBits[pcCU->getIntraSizeIdx(absPartIdx)] );
     1093      pcCU->setDmm3IntraTabIdxSubParts( uiIntraIdx, absPartIdx, depth );
     1094    } break;
     1095  case( DMM4_IDX ): break;
     1096#endif
     1097#if H_3D_DIM_RBC
     1098  case( RBC_IDX ):
     1099    {
     1100      xParseRbcEdge( pcCU, absPartIdx, depth );
     1101    } break;
     1102#endif
     1103  default: break;
     1104  }
     1105
     1106#if H_3D_DIM_SDC
     1107  if( pcCU->getSDCFlag(absPartIdx) )
     1108  {
     1109    assert(pcCU->getPartitionSize(absPartIdx)==SIZE_2Nx2N);
     1110    pcCU->setTrIdxSubParts(0, absPartIdx, depth);
     1111    pcCU->setCbfSubParts(1, 1, 1, absPartIdx, depth);
     1112
     1113    UInt uiNumSegments = ( dir == DC_IDX || dir == PLANAR_IDX )? 1 : 2;
     1114    for (UInt uiSeg=0; uiSeg<uiNumSegments; uiSeg++)
     1115    {
     1116      xParseSDCResidualData(pcCU, absPartIdx, depth, uiSeg);
     1117    }
     1118  }
     1119  else
     1120  {
     1121#endif
     1122    if( dimType < DIM_NUM_TYPE )
     1123    {
     1124      UInt symbol;
     1125      m_pcTDecBinIf->decodeBin( symbol, m_cDdcFlagSCModel.get(0, 0, (RBC_IDX == dimType) ? 1 : 0) );
     1126      if( symbol )
     1127      {
     1128        dir += symbol;
     1129        for( UInt segment = 0; segment < 2; segment++ )
     1130        {
     1131          Pel valDeltaDC = 0;
     1132          xParseDimDeltaDC( valDeltaDC, dimType );
     1133          pcCU->setDimDeltaDC( dimType, segment, absPartIdx, valDeltaDC );
     1134        }
     1135      }
     1136    }
     1137#if H_3D_DIM_SDC
     1138  }
     1139#endif
     1140
     1141  pcCU->setLumaIntraDirSubParts( (UChar)dir, absPartIdx, depth );
     1142}
     1143
     1144Void TDecSbac::parseIntraDepthMode( TComDataCU* pcCU, UInt absPartIdx, UInt depth )
     1145{
     1146  UInt puIdx = (pcCU->getWidth(absPartIdx) == 64) ? 2 : ( (pcCU->getPartitionSize(absPartIdx) == SIZE_NxN && pcCU->getWidth(absPartIdx) == 8) ? 0 : 1 );
     1147  UInt dir = 0;
     1148  Bool sdcFlag = 0;
     1149  UInt symbol = 1;
     1150  UInt modeCode = 0 ;
     1151  UInt binNum = 0;
     1152  UInt ctxDepthMode = 0;
     1153
     1154  if( puIdx == 2 )
     1155  {
     1156    while( binNum < 2 && symbol )
     1157    {
     1158      ctxDepthMode = puIdx*3 + binNum;
     1159      m_pcTDecBinIf->decodeBin( symbol, m_cDepthIntraModeSCModel.get(0,0,ctxDepthMode) );
     1160      modeCode = (modeCode<<1) + symbol;
     1161      binNum++;
     1162    }
     1163         if( modeCode == 0 ) { dir = PLANAR_IDX; sdcFlag = 1;}
     1164    else if( modeCode == 2 ) { dir = 0;          sdcFlag = 0;}
     1165    else if( modeCode == 3 ) { dir =     DC_IDX; sdcFlag = 1;}
     1166  }
     1167  else if( puIdx == 0 )
     1168  {
     1169    while( binNum < 3 && symbol )
     1170    {
     1171      ctxDepthMode = puIdx*3 + ((binNum >= 2) ? 2 : binNum);
     1172      m_pcTDecBinIf->decodeBin( symbol, m_cDepthIntraModeSCModel.get(0,0,ctxDepthMode) );
     1173      modeCode = (modeCode<<1) + symbol;
     1174      binNum++;
     1175    }
     1176         if( modeCode == 0 ) { dir = 0;                       sdcFlag = 0;}
     1177    else if( modeCode == 2 ) { dir = (2*DMM1_IDX+DIM_OFFSET); sdcFlag = 0;}
     1178    else if( modeCode == 6 ) { dir = (2*DMM3_IDX+DIM_OFFSET); sdcFlag = 0;}
     1179    else if( modeCode == 7 ) { dir = (2* RBC_IDX+DIM_OFFSET); sdcFlag = 0;}
     1180  }
     1181  else
     1182  {
     1183    ctxDepthMode = puIdx*3 ;
     1184    m_pcTDecBinIf->decodeBin( symbol, m_cDepthIntraModeSCModel.get(0,0,ctxDepthMode) );
     1185    modeCode = (modeCode<<1) + symbol;
     1186    if( !symbol )
     1187    {
     1188      ctxDepthMode = puIdx*3 + 1;
     1189      m_pcTDecBinIf->decodeBin( symbol, m_cDepthIntraModeSCModel.get(0,0,ctxDepthMode) );
     1190      modeCode = (modeCode<<1) + symbol;
     1191      if( symbol )
     1192      {
     1193        ctxDepthMode = puIdx*3 + 2;
     1194        m_pcTDecBinIf->decodeBin( symbol, m_cDepthIntraModeSCModel.get(0,0,ctxDepthMode) );
     1195        modeCode = (modeCode<<1) + symbol;
     1196      }
     1197    }
     1198    else
     1199    {
     1200      ctxDepthMode = puIdx*3 + 1;
     1201      m_pcTDecBinIf->decodeBin( symbol, m_cDepthIntraModeSCModel.get(0,0,ctxDepthMode) );
     1202      modeCode = (modeCode<<1) + symbol;
     1203      if( !symbol )
     1204      {
     1205        ctxDepthMode = puIdx*3 + 2;
     1206        m_pcTDecBinIf->decodeBin( symbol, m_cDepthIntraModeSCModel.get(0,0,ctxDepthMode) );
     1207        modeCode = (modeCode<<1) + symbol;
     1208      }
     1209      else
     1210      {
     1211        binNum = 0;
     1212        while( symbol && binNum < 3 )
     1213        {
     1214          ctxDepthMode = puIdx*3 + 2;
     1215          m_pcTDecBinIf->decodeBin( symbol, m_cDepthIntraModeSCModel.get(0,0,ctxDepthMode) );
     1216          modeCode = (modeCode<<1) + symbol;
     1217          binNum++;
     1218        }
     1219      }
     1220    }
     1221         if( modeCode == 0  ) { dir =  PLANAR_IDX;             sdcFlag = 1;}
     1222    else if( modeCode == 2  ) { dir = 5;                       sdcFlag = 0;}
     1223    else if( modeCode == 3  ) { dir = (2*DMM1_IDX+DIM_OFFSET); sdcFlag = 1;}
     1224    else if( modeCode == 4  ) { dir = (2*DMM1_IDX+DIM_OFFSET); sdcFlag = 0;}
     1225    else if( modeCode == 5  ) { dir = (2*DMM4_IDX+DIM_OFFSET); sdcFlag = 0;}
     1226    else if( modeCode == 6  ) { dir = (2*DMM3_IDX+DIM_OFFSET); sdcFlag = 0;}
     1227    else if( modeCode == 14 ) { dir =      DC_IDX;             sdcFlag = 1;}
     1228    else if( modeCode == 30 ) { dir = (2* RBC_IDX+DIM_OFFSET); sdcFlag = 0;}
     1229    else if( modeCode == 31 ) { dir = (2*DMM2_IDX+DIM_OFFSET); sdcFlag = 0;}
     1230  }
     1231  pcCU->setLumaIntraDirSubParts( (UChar)dir, absPartIdx, depth );
     1232#if H_3D_DIM_SDC
     1233  pcCU->setSDCFlagSubParts( sdcFlag, absPartIdx, depth );
     1234#endif
     1235}
     1236#endif
    7551237
    7561238Void TDecSbac::parseInterDir( TComDataCU* pcCU, UInt& ruiInterDir, UInt uiAbsPartIdx )
  • branches/HTM-DEV-0.3-dev2/source/Lib/TLibDecoder/TDecSbac.h

    r504 r531  
    9797  Void  xReadEpExGolomb     ( UInt& ruiSymbol, UInt uiCount );
    9898  Void  xReadCoefRemainExGolomb ( UInt &rSymbol, UInt &rParam );
     99#if H_3D_DIM
     100  Void  xReadExGolombLevel   ( UInt& ruiSymbol, ContextModel& rcSCModel  );
     101  Void  xParseDimDeltaDC     ( Pel& rValDeltaDC, UInt dimType );
     102#if H_3D_DIM_DMM
     103  Void  xParseDmm1WedgeIdx   ( UInt& ruiTabIdx, Int iNumBit );
     104  Void  xParseDmm2Offset     ( Int& riOffset );
     105  Void  xParseDmm3WedgeIdx   ( UInt& ruiIntraIdx, Int iNumBit );
     106#endif
     107#if H_3D_DIM_RBC
     108  Void  xParseRbcEdge        ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
     109#endif
     110#if H_3D_DIM_SDC
     111  Void  xParseSDCResidualData     ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt uiPart );
     112#endif
     113#endif
    99114private:
    100115  TComInputBitstream* m_pcBitstream;
     
    121136  Void parseIntraDirChroma( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
    122137 
     138#if H_3D_DIM
     139  Void parseIntraDepth     ( TComDataCU* pcCU, UInt absPartIdx, UInt depth );
     140  Void parseIntraDepthMode ( TComDataCU* pcCU, UInt absPartIdx, UInt depth );
     141#endif
     142
    123143  Void parseInterDir      ( TComDataCU* pcCU, UInt& ruiInterDir, UInt uiAbsPartIdx );
    124144  Void parseRefFrmIdx     ( TComDataCU* pcCU, Int& riRefFrmIdx, RefPicList eRefList );
     
    183203  ContextModel3DBuffer m_cTransformSkipSCModel;
    184204  ContextModel3DBuffer m_CUTransquantBypassFlagSCModel;
     205
     206#if H_3D_DIM
     207  ContextModel3DBuffer m_cDepthIntraModeSCModel;
     208  ContextModel3DBuffer m_cDdcFlagSCModel;
     209  ContextModel3DBuffer m_cDdcDataSCModel;
     210#if H_3D_DIM_DMM
     211  ContextModel3DBuffer m_cDmm1DataSCModel;
     212  ContextModel3DBuffer m_cDmm2DataSCModel;
     213  ContextModel3DBuffer m_cDmm3DataSCModel;
     214#endif
     215#if H_3D_DIM_RBC
     216  ContextModel3DBuffer m_cRbcDataSCModel;
     217#endif
     218#if H_3D_DIM_SDC 
     219  ContextModel3DBuffer m_cSDCResidualFlagSCModel;
     220  ContextModel3DBuffer m_cSDCResidualSCModel;
     221#endif
     222#endif
    185223};
    186224
  • branches/HTM-DEV-0.3-dev2/source/Lib/TLibDecoder/TDecTop.cpp

    r521 r531  
    5252  m_aaiCodedScale          = new Int* [ MAX_NUM_LAYERS ];
    5353  m_aiViewId               = new Int  [ MAX_NUM_LAYERS ];
     54#if !H_3D_FIX 
    5455  m_aiLayerIdx             = new Int  [ MAX_NUM_LAYERS ];
     56#endif
    5557
    5658  m_bViewReceived          = new Bool [ MAX_NUM_LAYERS ];
     
    915917
    916918#endif
     919#if H_3D
     920    pcSlice->setPicLists( m_ivPicLists );
     921#endif
     922
    917923#if H_3D_GEN
    918924    pcSlice->setIvPicLists( m_ivPicLists );         
  • branches/HTM-DEV-0.3-dev2/source/Lib/TLibDecoder/TDecTop.h

    r479 r531  
    8989  Int**   m_aaiCodedScale;
    9090  Int*    m_aiViewId; 
     91#if !H_3D_FIX 
    9192  Int*    m_aiLayerIdx;
     93#endif
    9294
    9395  Bool*   m_bViewReceived;
Note: See TracChangeset for help on using the changeset viewer.