Ignore:
Timestamp:
10 Nov 2012, 19:05:41 (12 years ago)
Author:
rwth
Message:
  • added RWTH_B0036 (SDC+DLT)
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/HTM-4.1-dev2-RWTH/source/Lib/TLibEncoder/TEncSbac.cpp

    r156 r177  
    4242#include <algorithm>
    4343
     44#if RWTH_SDC_DLT_B0036
     45#define GetNumDepthValues()     (pcCU->getSlice()->getSPS()->getNumDepthValues())
     46#define GetBitsPerDepthValue()  (pcCU->getSlice()->getSPS()->getBitsPerDepthValue())
     47#endif
     48
    4449//! \ingroup TLibEncoder
    4550//! \{
     
    114119, m_cEdgeIntraDeltaDCSCModel  ( 1,             1,               NUM_EDGE_INTRA_DELTA_DC_CTX   , m_contextModels + m_numContextModels, m_numContextModels)
    115120#endif
     121#endif
     122#if RWTH_SDC_DLT_B0036
     123, m_cSDCFlagSCModel             ( 1,             1,                 SDC_NUM_FLAG_CTX           , m_contextModels + m_numContextModels, m_numContextModels)
     124, m_cSDCResidualFlagSCModel     ( 1,             2,  SDC_NUM_RESIDUAL_FLAG_CTX  , m_contextModels + m_numContextModels, m_numContextModels)
     125, m_cSDCResidualSignFlagSCModel ( 1,             2,  SDC_NUM_SIGN_FLAG_CTX      , m_contextModels + m_numContextModels, m_numContextModels)
     126, m_cSDCResidualSCModel         ( 1,             2,  SDC_NUM_RESIDUAL_CTX       , m_contextModels + m_numContextModels, m_numContextModels)
     127, m_cSDCPredModeSCModel             ( 1,             3,                 SDC_NUM_PRED_MODE_CTX     , m_contextModels + m_numContextModels, m_numContextModels)
    116128#endif
    117129{
     
    199211#endif
    200212#endif
     213#if RWTH_SDC_DLT_B0036
     214  m_cSDCFlagSCModel.initBuffer              ( eSliceType, iQp, (UChar*)INIT_SDC_FLAG );
     215  m_cSDCResidualFlagSCModel.initBuffer      ( eSliceType, iQp, (UChar*)INIT_SDC_RESIDUAL_FLAG );
     216  m_cSDCResidualSCModel.initBuffer          ( eSliceType, iQp, (UChar*)INIT_SDC_RESIDUAL );
     217  m_cSDCResidualSignFlagSCModel.initBuffer  ( eSliceType, iQp, (UChar*)INIT_SDC_SIGN_FLAG );
     218  m_cSDCPredModeSCModel.initBuffer              ( eSliceType, iQp, (UChar*)INIT_SDC_PRED_MODE );
     219#endif
    201220
    202221  // new structure
     
    353372  m_cDmmDataSCModel.initBuffer           ( eSliceType, iQp, (UChar*)INIT_DMM_DATA );
    354373#endif
     374#if RWTH_SDC_DLT_B0036
     375  m_cSDCFlagSCModel.initBuffer              ( eSliceType, iQp, (UChar*)INIT_SDC_FLAG );
     376  m_cSDCResidualFlagSCModel.initBuffer      ( eSliceType, iQp, (UChar*)INIT_SDC_RESIDUAL_FLAG );
     377  m_cSDCResidualSCModel.initBuffer          ( eSliceType, iQp, (UChar*)INIT_SDC_RESIDUAL );
     378  m_cSDCResidualSignFlagSCModel.initBuffer  ( eSliceType, iQp, (UChar*)INIT_SDC_SIGN_FLAG );
     379  m_cSDCPredModeSCModel.initBuffer              ( eSliceType, iQp, (UChar*)INIT_SDC_PRED_MODE );
     380#endif
    355381 
    356382  m_pcBinIf->start();
     
    750776Void TEncSbac::codePredMode( TComDataCU* pcCU, UInt uiAbsPartIdx )
    751777{
     778#if RWTH_SDC_DLT_B0036
     779  if ( pcCU->getSlice()->isIntra() )
     780  {
     781    assert( pcCU->isIntra(uiAbsPartIdx) );
     782    return;
     783  }
     784#endif
     785 
    752786  // get context function is here
    753787  Int iPredMode = pcCU->getPredictionMode( uiAbsPartIdx );
     
    26782712}
    26792713#endif
     2714
     2715#if RWTH_SDC_DLT_B0036
     2716Void TEncSbac::codeSDCPredMode( TComDataCU* pcCU, UInt uiAbsPartIdx )
     2717{
     2718  assert( pcCU->getSlice()->getSPS()->isDepth() );
     2719  assert( pcCU->getPartitionSize(uiAbsPartIdx) == SIZE_2Nx2N );
     2720  assert( pcCU->getSDCFlag(uiAbsPartIdx) );
     2721 
     2722  UInt uiPredMode     = pcCU->getLumaIntraDir(uiAbsPartIdx);
     2723  UInt uiCtx          = 0;
     2724 
     2725  UInt uiMPModeIdx    = 0;
     2726 
     2727  for(Int i=0; i<RWTH_SDC_NUM_PRED_MODES-1; i++)
     2728  {
     2729    UInt uiBit = (uiPredMode == g_auiSDCPredModes[uiMPModeIdx]) ? 1 : 0;
     2730    m_pcBinIf->encodeBin( uiBit, m_cSDCPredModeSCModel.get( 0, i, uiCtx ) );
     2731   
     2732    // if mode is most probable mode, we are done here
     2733    if ( uiBit == 1 )
     2734      break;
     2735   
     2736    // else: get next most probable pred mode
     2737    uiMPModeIdx = (uiMPModeIdx+1)%RWTH_SDC_NUM_PRED_MODES;
     2738  }
     2739 
     2740#if HHI_DMM_WEDGE_INTRA
     2741  if( uiPredMode == DMM_WEDGE_FULL_IDX )          { xCodeWedgeFullInfo          ( pcCU, uiAbsPartIdx ); }
     2742  if( uiPredMode == DMM_WEDGE_PREDDIR_IDX )       { xCodeWedgePredDirInfo       ( pcCU, uiAbsPartIdx ); }
     2743#endif
     2744 
     2745  AOF(uiPredMode == g_auiSDCPredModes[uiMPModeIdx]);
     2746}
     2747
     2748Void TEncSbac::codeSDCFlag( TComDataCU* pcCU, UInt uiAbsPartIdx )
     2749{
     2750  // get context function is here
     2751  UInt uiSymbol = pcCU->getSDCFlag( uiAbsPartIdx ) ? 1 : 0;
     2752  UInt uiCtxSDCFlag = pcCU->getCtxSDCFlag( uiAbsPartIdx );
     2753  m_pcBinIf->encodeBin( uiSymbol, m_cSDCFlagSCModel.get( 0, 0, uiCtxSDCFlag ) );
     2754 
     2755}
     2756
     2757Void TEncSbac::codeSDCResidualData ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiSegment )
     2758{
     2759  assert( pcCU->getSlice()->getSPS()->isDepth() );
     2760  assert( pcCU->getPartitionSize(uiAbsPartIdx) == SIZE_2Nx2N );
     2761  assert( pcCU->getSDCFlag(uiAbsPartIdx) );
     2762  assert( uiSegment < 2 );
     2763 
     2764  Pel segmentDCOffset = pcCU->getSDCSegmentDCOffset(uiSegment, uiAbsPartIdx);
     2765 
     2766  UInt uiResidual = segmentDCOffset == 0 ? 0 : 1;
     2767  UInt uiSign     = segmentDCOffset < 0 ? 1 : 0;
     2768  UInt uiAbsIdx   = abs(segmentDCOffset);
     2769  UInt uiBit = 0;
     2770 
     2771  UInt uiMaxResidualBits  = GetBitsPerDepthValue();
     2772  assert( uiMaxResidualBits <= g_uiBitDepth );
     2773 
     2774  // residual flag
     2775  m_pcBinIf->encodeBin( uiResidual, m_cSDCResidualFlagSCModel.get( 0, uiSegment, 0 ) ); //TODO depthmap: more sophisticated context selection
     2776 
     2777  if (uiResidual)
     2778  {
     2779    // encode sign bit of residual
     2780    m_pcBinIf->encodeBin( uiSign, m_cSDCResidualSignFlagSCModel.get( 0, uiSegment, 0 ) ); //TODO depthmap: more sophisticated context selection
     2781       
     2782    assert(uiAbsIdx < GetNumDepthValues());
     2783   
     2784    // encode residual magnitude
     2785    uiAbsIdx -= 1;
     2786    for (Int i=0; i<uiMaxResidualBits; i++)
     2787    {
     2788      uiBit = (uiAbsIdx & (1<<i))>>i;
     2789     
     2790      m_pcBinIf->encodeBin( uiBit, m_cSDCResidualSCModel.get( 0, uiSegment, i ) ); //TODO depthmap: more sophisticated context selection
     2791    }
     2792   
     2793  }
     2794}
     2795#endif
    26802796//! \}
Note: See TracChangeset for help on using the changeset viewer.