Changeset 1313 in 3DVCSoftware for trunk/source/Lib/TLibEncoder/TEncSbac.h


Ignore:
Timestamp:
13 Aug 2015, 17:38:13 (9 years ago)
Author:
tech
Message:

Merged 14.1-update-dev1@1312.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/source/Lib/TLibEncoder/TEncSbac.h

    r1196 r1313  
    22 * License, included below. This software may be subject to other third party
    33 * and contributor rights, including patent rights, and no such rights are
    4  * granted under this license. 
    5  *
    6 * Copyright (c) 2010-2015, ITU/ISO/IEC
     4 * granted under this license.
     5 *
     6 * Copyright (c) 2010-2015, ITU/ISO/IEC
    77 * All rights reserved.
    88 *
     
    6969  TEncSbac();
    7070  virtual ~TEncSbac();
    71  
     71
    7272  Void  init                   ( TEncBinIf* p )  { m_pcBinIf = p; }
    7373  Void  uninit                 ()                { m_pcBinIf = 0; }
    7474
    7575  //  Virtual list
    76   Void  resetEntropy           ();
    77   Void  determineCabacInitIdx  ();
     76  Void  resetEntropy           (const TComSlice *pSlice);
     77  SliceType determineCabacInitIdx  (const TComSlice *pSlice);
    7878  Void  setBitstream           ( TComBitIf* p )  { m_pcBitIf = p; m_pcBinIf->init( p ); }
    79   Void  setSlice               ( TComSlice* p )  { m_pcSlice = p;                       }
    80   // SBAC RD
    81   Void  resetCoeffCost         ()                { m_uiCoeffCost = 0;  }
    82   UInt  getCoeffCost           ()                { return  m_uiCoeffCost;  }
    83  
    84   Void  load                   ( TEncSbac* pScr  );
    85   Void  loadIntraDirModeLuma   ( TEncSbac* pScr  );
    86 #if H_3D_DIM
    87   Void  loadIntraDepthMode     ( TEncSbac* pScr  );
    88 #endif
    89   Void  store                  ( TEncSbac* pDest );
    90   Void  loadContexts           ( TEncSbac* pScr  );
     79
     80  Void  load                   ( const TEncSbac* pSrc  );
     81  Void  loadIntraDirMode       ( const TEncSbac* pScr, const ChannelType chType  );
     82#if NH_3D_DMM
     83  Void  loadIntraDepthDmm      ( const TEncSbac* pSrc );
     84#endif
     85  Void  store                  ( TEncSbac* pDest ) const;
     86  Void  loadContexts           ( const TEncSbac* pSrc  );
    9187  Void  resetBits              ()                { m_pcBinIf->resetBits(); m_pcBitIf->resetBits(); }
    9288  UInt  getNumberOfWrittenBits ()                { return m_pcBinIf->getNumWrittenBits(); }
    9389  //--SBAC RD
    9490
    95   Void  codeVPS                 ( TComVPS* pcVPS );
    96   Void  codeSPS                 ( TComSPS* pcSPS     );
    97   Void  codePPS                 ( TComPPS* pcPPS     );
    98   Void  codeSliceHeader         ( TComSlice* pcSlice );
    99   Void  codeTilesWPPEntryPoint( TComSlice* pSlice );
    100   Void  codeTerminatingBit      ( UInt uilsLast      );
    101   Void  codeSliceFinish         ();
    102   Void  codeSaoMaxUvlc    ( UInt code, UInt maxSymbol );
    103   Void  codeSaoMerge  ( UInt  uiCode );
    104   Void  codeSaoTypeIdx    ( UInt  uiCode);
    105   Void  codeSaoUflc       ( UInt uiLength, UInt  uiCode );
    106   Void  codeSAOSign       ( UInt  uiCode);  //<! code SAO offset sign
    107   Void  codeScalingList      ( TComScalingList* /*scalingList*/     ){ assert (0);  return;};
    108 
    109   Void codeSAOOffsetParam(Int compIdx, SAOOffset& ctbParam, Bool sliceEnabled);
    110   Void codeSAOBlkParam(SAOBlkParam& saoBlkParam
     91  Void  codeVPS                ( const TComVPS* pcVPS );
     92  Void  codeSPS                ( const TComSPS* pcSPS     );
     93  Void  codePPS                ( const TComPPS* pcPPS     );
     94  Void  codeSliceHeader        ( TComSlice* pcSlice );
     95  Void  codeTilesWPPEntryPoint ( TComSlice* pSlice );
     96  Void  codeTerminatingBit     ( UInt uilsLast      );
     97  Void  codeSliceFinish        ();
     98  Void  codeSaoMaxUvlc       ( UInt code, UInt maxSymbol );
     99  Void  codeSaoMerge         ( UInt  uiCode );
     100  Void  codeSaoTypeIdx       ( UInt  uiCode);
     101  Void  codeSaoUflc          ( UInt uiLength, UInt  uiCode );
     102  Void  codeSAOSign          ( UInt  uiCode);  //<! code SAO offset sign
     103
     104  Void codeSAOOffsetParam(ComponentID compIdx, SAOOffset& ctbParam, Bool sliceEnabled, const Int channelBitDepth);
     105  Void codeSAOBlkParam(SAOBlkParam& saoBlkParam, const BitDepths &bitDepths
    111106                    , Bool* sliceEnabled
    112107                    , Bool leftMergeAvail
     
    119114  Void  xWriteUnaryMaxSymbol ( UInt uiSymbol, ContextModel* pcSCModel, Int iOffset, UInt uiMaxSymbol );
    120115  Void  xWriteEpExGolomb     ( UInt uiSymbol, UInt uiCount );
    121   Void  xWriteCoefRemainExGolomb ( UInt symbol, UInt &rParam );
    122 #if H_3D_DIM
    123   Void  xWriteExGolombLevel  ( UInt uiSymbol, ContextModel& rcSCModel  );
    124   Void  xCodeDimDeltaDC      ( Pel valDeltaDC, UInt uiNumSeg );
    125 #if H_3D_DIM_DMM
     116  Void  xWriteCoefRemainExGolomb ( UInt symbol, UInt &rParam, const Bool useLimitedPrefixLength, const Int maxLog2TrDynamicRange );
     117#if NH_3D_DMM || NH_3D_SDC_INTRA || NH_3D_SDC_INTER
     118  Void  xWriteExGolombLevelDdc( UInt uiSymbol );
     119  Void  xCodeDeltaDC         ( Pel valDeltaDC, UInt uiNumSeg );
     120#endif
     121#if NH_3D_DMM
     122  Void  xCodeIntraDepthMode  ( TComDataCU* pcCU, UInt absPartIdx );
     123  Void  xCodeDmmData         ( TComDataCU* pcCU, UInt absPartIdx );
    126124  Void  xCodeDmm1WedgeIdx    ( UInt uiTabIdx, Int iNumBit );
    127125#endif
    128 #endif
    129  
    130   Void  xCopyFrom            ( TEncSbac* pSrc );
    131   Void  xCopyContextsFrom    ( TEncSbac* pSrc ); 
    132  
    133   Void codeDFFlag( UInt /*uiCode*/, const Char* /*pSymbolName*/ )       {printf("Not supported in codeDFFlag()\n"); assert(0); exit(1);};
    134   Void codeDFSvlc( Int /*iCode*/, const Char* /*pSymbolName*/ )         {printf("Not supported in codeDFSvlc()\n"); assert(0); exit(1);};
     126
     127
     128  Void  xCopyFrom            ( const TEncSbac* pSrc );
     129  Void  xCopyContextsFrom    ( const TEncSbac* pSrc );
    135130
    136131protected:
    137132  TComBitIf*    m_pcBitIf;
    138   TComSlice*    m_pcSlice;
    139133  TEncBinIf*    m_pcBinIf;
    140   //SBAC RD
    141   UInt          m_uiCoeffCost;
    142134
    143135  //--Adaptive loop filter
    144  
     136
    145137public:
    146138  Void codeCUTransquantBypassFlag( TComDataCU* pcCU, UInt uiAbsPartIdx );
    147139  Void codeSkipFlag      ( TComDataCU* pcCU, UInt uiAbsPartIdx );
    148 #if H_3D
     140#if NH_3D_DIS
    149141  Void codeDIS           ( TComDataCU* pcCU, UInt uiAbsPartIdx );
    150142#endif
    151143  Void codeMergeFlag     ( TComDataCU* pcCU, UInt uiAbsPartIdx );
    152144  Void codeMergeIndex    ( TComDataCU* pcCU, UInt uiAbsPartIdx );
    153 #if H_3D_ARP
     145#if NH_3D_ARP
    154146  Void codeARPW          ( TComDataCU* pcCU, UInt uiAbsPartIdx );
    155147#endif
    156 #if H_3D_IC
     148#if NH_3D_IC
    157149  Void codeICFlag        ( TComDataCU* pcCU, UInt uiAbsPartIdx );
    158150#endif
    159 #if H_3D_INTER_SDC
    160   Void codeDeltaDC       ( TComDataCU* pcCU, UInt absPartIdx );
     151#if NH_3D_DMM || NH_3D_SDC_INTRA || NH_3D_SDC_INTER
     152  Void  codeDeltaDC      ( TComDataCU* pcCU, UInt absPartIdx );
     153#endif
     154#if NH_3D_SDC_INTRA || NH_3D_SDC_INTER
    161155  Void codeSDCFlag       ( TComDataCU* pcCU, UInt uiAbsPartIdx );
    162156#endif
    163 #if H_3D_DBBP
     157#if NH_3D_DBBP
    164158  Void codeDBBPFlag      ( TComDataCU* pcCU, UInt uiAbsPartIdx );
    165159#endif
    166160  Void codeSplitFlag     ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
    167161  Void codeMVPIdx        ( TComDataCU* pcCU, UInt uiAbsPartIdx, RefPicList eRefList );
    168  
     162
    169163  Void codePartSize      ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
    170164  Void codePredMode      ( TComDataCU* pcCU, UInt uiAbsPartIdx );
    171165  Void codeIPCMInfo      ( TComDataCU* pcCU, UInt uiAbsPartIdx );
    172166  Void codeTransformSubdivFlag ( UInt uiSymbol, UInt uiCtx );
    173   Void codeQtCbf               ( TComDataCU* pcCU, UInt uiAbsPartIdx, TextType eType, UInt uiTrDepth );
     167  Void codeQtCbf               ( TComTU & rTu, const ComponentID compID, const Bool lowestLevel );
    174168  Void codeQtRootCbf           ( TComDataCU* pcCU, UInt uiAbsPartIdx );
    175   Void codeQtCbfZero           ( TComDataCU* pcCU, TextType eType, UInt uiTrDepth );
    176   Void codeQtRootCbfZero       ( TComDataCU* pcCU );
     169  Void codeQtCbfZero           ( TComTU &rTu, const ChannelType chType );
     170  Void codeQtRootCbfZero       ( );
    177171  Void codeIntraDirLumaAng     ( TComDataCU* pcCU, UInt absPartIdx, Bool isMultiple);
    178  
    179172  Void codeIntraDirChroma      ( TComDataCU* pcCU, UInt uiAbsPartIdx );
    180 
    181 #if H_3D_DIM
    182   Void codeIntraDepth          ( TComDataCU* pcCU, UInt absPartIdx );
    183   Void codeIntraDepthMode      ( TComDataCU* pcCU, UInt absPartIdx );
    184 #endif
    185 
    186173  Void codeInterDir            ( TComDataCU* pcCU, UInt uiAbsPartIdx );
    187174  Void codeRefFrmIdx           ( TComDataCU* pcCU, UInt uiAbsPartIdx, RefPicList eRefList );
    188175  Void codeMvd                 ( TComDataCU* pcCU, UInt uiAbsPartIdx, RefPicList eRefList );
    189  
     176
     177  Void codeCrossComponentPrediction( TComTU &rTu, ComponentID compID );
     178
    190179  Void codeDeltaQP             ( TComDataCU* pcCU, UInt uiAbsPartIdx );
    191  
    192   Void codeLastSignificantXY ( UInt uiPosX, UInt uiPosY, Int width, Int height, TextType eTType, UInt uiScanIdx );
    193   Void codeCoeffNxN            ( TComDataCU* pcCU, TCoeff* pcCoef, UInt uiAbsPartIdx, UInt uiWidth, UInt uiHeight, UInt uiDepth, TextType eTType );
    194   void codeTransformSkipFlags ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt width, UInt height, TextType eTType );
     180  Void codeChromaQpAdjustment  ( TComDataCU* cu, UInt absPartIdx );
     181
     182  Void codeLastSignificantXY ( UInt uiPosX, UInt uiPosY, Int width, Int height, ComponentID component, UInt uiScanIdx );
     183  Void codeCoeffNxN            ( TComTU &rTu, TCoeff* pcCoef, const ComponentID compID );
     184  Void codeTransformSkipFlags ( TComTU &rTu, ComponentID component );
    195185
    196186  // -------------------------------------------------------------------------------------------------------------------
    197187  // for RD-optimizatioon
    198188  // -------------------------------------------------------------------------------------------------------------------
    199  
    200   Void estBit               (estBitsSbacStruct* pcEstBitsSbac, Int width, Int height, TextType eTType);
     189
     190  Void estBit               (estBitsSbacStruct* pcEstBitsSbac, Int width, Int height, ChannelType chType);
    201191  Void estCBFBit                     ( estBitsSbacStruct* pcEstBitsSbac );
    202   Void estSignificantCoeffGroupMapBit( estBitsSbacStruct* pcEstBitsSbac, TextType eTType );
    203   Void estSignificantMapBit          ( estBitsSbacStruct* pcEstBitsSbac, Int width, Int height, TextType eTType );
    204   Void estSignificantCoefficientsBit ( estBitsSbacStruct* pcEstBitsSbac, TextType eTType );
    205  
    206   Void updateContextTables           ( SliceType eSliceType, Int iQp, Bool bExecuteFinish=true  );
    207   Void updateContextTables           ( SliceType eSliceType, Int iQp  ) { this->updateContextTables( eSliceType, iQp, true); };
    208  
     192  Void estSignificantCoeffGroupMapBit( estBitsSbacStruct* pcEstBitsSbac, ChannelType chType );
     193  Void estSignificantMapBit          ( estBitsSbacStruct* pcEstBitsSbac, Int width, Int height, ChannelType chType );
     194  Void estLastSignificantPositionBit ( estBitsSbacStruct* pcEstBitsSbac, Int width, Int height, ChannelType chType );
     195  Void estSignificantCoefficientsBit ( estBitsSbacStruct* pcEstBitsSbac, ChannelType chType );
     196
     197  Void codeExplicitRdpcmMode            ( TComTU &rTu, const ComponentID compID );
     198
     199
    209200  TEncBinIf* getEncBinIf()  { return m_pcBinIf; }
    210201private:
    211   UInt                 m_uiLastQp;
    212  
    213202  ContextModel         m_contextModels[MAX_NUM_CTX_MOD];
    214203  Int                  m_numContextModels;
    215204  ContextModel3DBuffer m_cCUSplitFlagSCModel;
    216205  ContextModel3DBuffer m_cCUSkipFlagSCModel;
    217 #if H_3D
     206#if NH_3D_DIS
    218207  ContextModel3DBuffer m_cCUDISFlagSCModel;
    219208  ContextModel3DBuffer m_cCUDISTypeSCModel;
     
    221210  ContextModel3DBuffer m_cCUMergeFlagExtSCModel;
    222211  ContextModel3DBuffer m_cCUMergeIdxExtSCModel;
    223 #if H_3D_ARP
     212#if NH_3D_ARP
    224213  ContextModel3DBuffer m_cCUPUARPWSCModel;
    225214#endif
    226 #if H_3D_IC
     215#if NH_3D_IC
    227216  ContextModel3DBuffer m_cCUICFlagSCModel;
    228217#endif
     
    238227  ContextModel3DBuffer m_cCUTransSubdivFlagSCModel;
    239228  ContextModel3DBuffer m_cCUQtRootCbfSCModel;
    240  
     229
    241230  ContextModel3DBuffer m_cCUSigCoeffGroupSCModel;
    242231  ContextModel3DBuffer m_cCUSigSCModel;
     
    245234  ContextModel3DBuffer m_cCUOneSCModel;
    246235  ContextModel3DBuffer m_cCUAbsSCModel;
    247  
     236
    248237  ContextModel3DBuffer m_cMVPIdxSCModel;
    249  
     238
    250239  ContextModel3DBuffer m_cSaoMergeSCModel;
    251240  ContextModel3DBuffer m_cSaoTypeIdxSCModel;
    252241  ContextModel3DBuffer m_cTransformSkipSCModel;
    253242  ContextModel3DBuffer m_CUTransquantBypassFlagSCModel;
    254 
    255 #if H_3D_DIM
    256   ContextModel3DBuffer m_cDepthIntraModeSCModel;
    257   ContextModel3DBuffer m_cDdcFlagSCModel;
     243  ContextModel3DBuffer m_explicitRdpcmFlagSCModel;
     244  ContextModel3DBuffer m_explicitRdpcmDirSCModel;
     245  ContextModel3DBuffer m_cCrossComponentPredictionSCModel;
     246
     247  ContextModel3DBuffer m_ChromaQpAdjFlagSCModel;
     248  ContextModel3DBuffer m_ChromaQpAdjIdcSCModel;
     249
     250#if NH_3D_DMM
     251  ContextModel3DBuffer m_cNotDmmFlagSCModel;
     252  ContextModel3DBuffer m_cDmmModeSCModel;
     253#endif
     254#if NH_3D_DMM || NH_3D_SDC_INTRA || NH_3D_SDC_INTER
    258255  ContextModel3DBuffer m_cDdcDataSCModel;
    259   ContextModel3DBuffer m_cAngleFlagSCModel;
    260 #if H_3D_DIM_SDC 
     256  ContextModel3DBuffer m_cSDCFlagSCModel;
     257#endif
     258#if NH_3D_SDC_INTRA 
    261259  ContextModel3DBuffer m_cSDCResidualFlagSCModel;
    262260  ContextModel3DBuffer m_cSDCResidualSCModel;
    263 #endif
    264 #endif
    265 #if H_3D_DIM_SDC
    266   ContextModel3DBuffer m_cSDCFlagSCModel;
    267 #endif
    268 #if H_3D_DBBP
     261  ContextModel3DBuffer m_cDdcFlagSCModel;
     262#endif
     263#if NH_3D_DBBP
    269264  ContextModel3DBuffer m_cDBBPFlagSCModel;
    270265#endif
     266
     267  UInt m_golombRiceAdaptationStatistics[RExt__GOLOMB_RICE_ADAPTATION_STATISTICS_SETS];
    271268};
    272269
Note: See TracChangeset for help on using the changeset viewer.