Changeset 56 in 3DVCSoftware for trunk/source/Lib/TLibEncoder/TEncCavlc.h


Ignore:
Timestamp:
11 May 2012, 21:20:17 (13 years ago)
Author:
hschwarz
Message:

updated trunk (move to HM6.1)

File:
1 edited

Legend:

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

    r42 r56  
    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-2011, ISO/IEC
     4 * granted under this license. 
     5 *
     6 * Copyright (c) 2010-2012, ITU/ISO/IEC
    77 * All rights reserved.
    88 *
     
    1515 *    this list of conditions and the following disclaimer in the documentation
    1616 *    and/or other materials provided with the distribution.
    17  *  * Neither the name of the ISO/IEC nor the names of its contributors may
     17 *  * Neither the name of the ITU/ISO/IEC nor the names of its contributors may
    1818 *    be used to endorse or promote products derived from this software without
    1919 *    specific prior written permission.
     
    3232 */
    3333
    34 
    35 
    3634/** \file     TEncCavlc.h
    3735    \brief    CAVLC encoder class (header)
     
    4543#endif // _MSC_VER > 1000
    4644
    47 #include "../TLibCommon/CommonDef.h"
    48 #include "../TLibCommon/TComBitStream.h"
     45#include "TLibCommon/CommonDef.h"
     46#include "TLibCommon/TComBitStream.h"
    4947#include "TEncEntropy.h"
    50 #if QC_MOD_LCEC
    51 #include "../TLibCommon/TComRom.h"
    52 #endif
     48#include "TLibCommon/TComRom.h"
     49
     50//! \ingroup TLibEncoder
     51//! \{
    5352
    5453class TEncTop;
     
    6160class TEncCavlc : public TEncEntropyIf
    6261{
    63 private:
    64   Bool m_bAdaptFlag;
    65  
    66  
    6762public:
    6863  TEncCavlc();
     
    7368  TComSlice*    m_pcSlice;
    7469  UInt          m_uiCoeffCost;
    75   Bool          m_bRunLengthCoding;
    76   UInt          m_uiRun;
    7770  Bool          m_bAlfCtrl;
    7871  UInt          m_uiMaxAlfCtrlDepth;
    79   UInt          m_uiLPTableE4[3][32];
    80   UInt          m_uiLPTableD4[3][32];
    81 #if !CAVLC_COEF_LRG_BLK
    82   UInt          m_uiLPTableE8[10][128];
    83   UInt          m_uiLPTableD8[10][128];
    84 #endif
    85   UInt          m_uiLastPosVlcIndex[10];
    86  
    87 #if LCEC_INTRA_MODE
    88  #if MTK_DCM_MPM
    89   UInt          m_uiIntraModeTableD17[2][16];
    90   UInt          m_uiIntraModeTableE17[2][16];
    91 
    92   UInt          m_uiIntraModeTableD34[2][33];
    93   UInt          m_uiIntraModeTableE34[2][33];
    94 #else
    95   UInt          m_uiIntraModeTableD17[16];
    96   UInt          m_uiIntraModeTableE17[16];
    97 
    98   UInt          m_uiIntraModeTableD34[33];
    99   UInt          m_uiIntraModeTableE34[33];
    100 #endif
    101 #endif
    102  
    103 #if CAVLC_RQT_CBP
    104   UInt          m_uiCBP_YUV_TableE[4][8];
    105   UInt          m_uiCBP_YUV_TableD[4][8];
    106   UInt          m_uiCBP_YS_TableE[2][4];
    107   UInt          m_uiCBP_YS_TableD[2][4];
    108   UInt          m_uiCBP_YCS_TableE[2][8];
    109   UInt          m_uiCBP_YCS_TableD[2][8];
    110   UInt          m_uiCBP_4Y_TableE[2][15];
    111   UInt          m_uiCBP_4Y_TableD[2][15];
    112   UInt          m_uiCBP_4Y_VlcIdx;
    113 #else
    114   UInt          m_uiCBPTableE[2][8];
    115   UInt          m_uiCBPTableD[2][8];
    116   UInt          m_uiBlkCBPTableE[2][15];
    117   UInt          m_uiBlkCBPTableD[2][15];
    118   UInt          m_uiCbpVlcIdx[2];
    119   UInt          m_uiBlkCbpVlcIdx;
    120 #endif
    121 
    122 
    123  
    124 #if MS_LCEC_LOOKUP_TABLE_EXCEPTION
    125   UInt          m_uiMI1TableE[9];
    126   UInt          m_uiMI1TableD[9];
    127 #else
    128   UInt          m_uiMI1TableE[8];
    129   UInt          m_uiMI1TableD[8];
    130 #endif
    131   UInt          m_uiMI2TableE[15];
    132   UInt          m_uiMI2TableD[15];
    133  
    134   UInt          m_uiMITableVlcIdx;
    135 #if QC_LCEC_INTER_MODE
    136   UInt          m_uiSplitTableE[4][7];
    137   UInt          m_uiSplitTableD[4][7];
    138 #endif
    139 
    140 #if CAVLC_COUNTER_ADAPT
    141 #if CAVLC_RQT_CBP
    142   UChar         m_ucCBP_YUV_TableCounter[4][4];
    143   UChar         m_ucCBP_4Y_TableCounter[2][2];
    144   UChar         m_ucCBP_YS_TableCounter[2][3];
    145   UChar         m_ucCBP_YCS_TableCounter[2][4];
    146   UChar         m_ucCBP_YUV_TableCounterSum[4];
    147   UChar         m_ucCBP_4Y_TableCounterSum[2];
    148   UChar         m_ucCBP_YS_TableCounterSum[2];
    149   UChar         m_ucCBP_YCS_TableCounterSum[2];
    150 #else
    151   UChar         m_ucCBFTableCounter    [2][4];
    152   UChar         m_ucBlkCBPTableCounter [2][2];
    153   UChar         m_ucCBFTableCounterSum[2];
    154   UChar         m_ucBlkCBPTableCounterSum[2];
    155 #endif
    156   UChar         m_ucMI1TableCounter       [4];
    157   UChar         m_ucSplitTableCounter  [4][4];
    158 
    159   UChar         m_ucSplitTableCounterSum[4];
    160   UChar         m_ucMI1TableCounterSum;
    161 #endif
    162 
    163   Void  xCheckCoeff( TCoeff* pcCoef, UInt uiSize, UInt uiDepth, UInt& uiNumofCoeff, UInt& uiPart );
     72  Int           m_iSliceGranularity;  //!< slice granularity
    16473 
    16574  Void  xWriteCode            ( UInt uiCode, UInt uiLength );
    16675  Void  xWriteUvlc            ( UInt uiCode );
    167   Void  xWriteSvlc            ( Int iCode   );
     76  Void  xWriteSvlc            ( Int  iCode   );
    16877  Void  xWriteFlag            ( UInt uiCode );
     78#if ENC_DEC_TRACE
     79  Void  xWriteCodeTr          ( UInt value, UInt  length, const Char *pSymbolName);
     80  Void  xWriteUvlcTr          ( UInt value,               const Char *pSymbolName);
     81  Void  xWriteSvlcTr          ( Int  value,               const Char *pSymbolName);
     82  Void  xWriteFlagTr          ( UInt value,               const Char *pSymbolName);
     83#endif
     84 
     85  Void  xWritePCMAlignZero    ();
    16986  Void  xWriteEpExGolomb      ( UInt uiSymbol, UInt uiCount );
    17087  Void  xWriteExGolombLevel    ( UInt uiSymbol );
    17188  Void  xWriteUnaryMaxSymbol  ( UInt uiSymbol, UInt uiMaxSymbol );
    172 #if !QC_MOD_LCEC_RDOQ
    173   UInt  xLeadingZeros         ( UInt uiCode );
    174 #endif
    175   Void  xWriteVlc             ( UInt uiTableNumber, UInt uiCodeNumber );
    176 
    177 #if CAVLC_COEF_LRG_BLK
    178   Void  xCodeCoeff             ( TCoeff* scoeff, Int n, Int blSize);
    179 #else
    180   Void  xCodeCoeff4x4          ( TCoeff* scoeff, Int iTableNumber );
    181   Void  xCodeCoeff8x8          ( TCoeff* scoeff, Int iTableNumber );
     89
     90#if RPS_IN_SPS
     91  Void codeShortTermRefPicSet              ( TComSPS* pcSPS, TComReferencePictureSet* pcRPS );
     92#else
     93  Void codeShortTermRefPicSet              ( TComPPS* pcPPS, TComReferencePictureSet* pcRPS );
    18294#endif
    18395 
     
    18799 
    188100  Void  resetEntropy          ();
    189 
    190 #if !CAVLC_COEF_LRG_BLK
    191   UInt* GetLP8Table();
    192 #endif
    193   UInt* GetLP4Table();
    194 #if QC_MOD_LCEC
    195   UInt* GetLastPosVlcIndexTable();
    196 #endif
     101#if CABAC_INIT_FLAG
     102  Void  determineCabacInitIdx  () {};
     103#endif
     104
    197105  Void  setBitstream          ( TComBitIf* p )  { m_pcBitIf = p;  }
    198106  Void  setSlice              ( TComSlice* p )  { m_pcSlice = p;  }
     
    206114  UInt  getCoeffCost          ()                { return  m_uiCoeffCost;  }
    207115 
    208 #if BITSTREAM_EXTRACTION
    209   Void  codeNALUnitHeader       ( NalUnitType eNalUnitType, NalRefIdc eNalRefIdc, UInt TemporalId = 0, UInt uiLayerId = 0 );
    210 #else
    211   Void  codeNALUnitHeader       ( NalUnitType eNalUnitType, NalRefIdc eNalRefIdc, UInt TemporalId = 0, Bool bOutputFlag = true );
    212 #endif
    213  
     116#if HHI_MPI
     117  Void  codeSPS                 ( TComSPS* pcSPS, Bool bIsDepth );
     118#else
    214119  Void  codeSPS                 ( TComSPS* pcSPS );
     120#endif
    215121  Void  codePPS                 ( TComPPS* pcPPS );
    216122  void codeSEI(const SEI&);
    217123  Void  codeSliceHeader         ( TComSlice* pcSlice );
     124
     125  Void codeTileMarkerFlag(TComSlice* pcSlice);
     126
     127#if TILES_WPP_ENTRY_POINT_SIGNALLING
     128  Void  codeTilesWPPEntryPoint( TComSlice* pSlice );
     129#else
     130  Void  codeSliceHeaderSubstreamTable( TComSlice* pcSlice );
     131#endif
    218132  Void  codeTerminatingBit      ( UInt uilsLast );
    219133  Void  codeSliceFinish         ();
    220  
     134  Void  codeFlush               () {}
     135  Void  encodeStart             () {}
     136 
     137#if HHI_INTER_VIEW_MOTION_PRED
     138  Void codeMVPIdx ( TComDataCU* pcCU, UInt uiAbsPartIdx, RefPicList eRefList, Int iNum );
     139#else
    221140  Void codeMVPIdx ( TComDataCU* pcCU, UInt uiAbsPartIdx, RefPicList eRefList );
     141#endif
    222142  Void codeAlfFlag       ( UInt uiCode );
    223143  Void codeAlfUvlc       ( UInt uiCode );
    224144  Void codeAlfSvlc       ( Int   iCode );
    225145  Void codeAlfCtrlDepth();
    226 #if MTK_SAO
    227   Void codeAoFlag       ( UInt uiCode );
    228   Void codeAoUvlc       ( UInt uiCode );
    229   Void codeAoSvlc       ( Int   iCode );
    230 #endif
     146#if LCU_SYNTAX_ALF
     147  Void codeAPSAlflag(UInt uiCode);
     148  Void codeAlfFixedLengthIdx( UInt idx, UInt numFilterSetsInBuffer);
     149#endif
     150  Void codeSaoFlag       ( UInt uiCode );
     151  Void codeSaoUvlc       ( UInt uiCode );
     152  Void codeSaoSvlc       ( Int   iCode );
     153#if SAO_UNIT_INTERLEAVING
     154  Void codeSaoRun        ( UInt uiCode, UInt maxValue  );
     155  Void codeSaoMergeLeft  ( UInt uiCode, UInt compIdx ){;}
     156  Void codeSaoMergeUp    ( UInt uiCode ){;}
     157  Void codeSaoTypeIdx    ( UInt uiCode ){ xWriteUvlc(uiCode   );}
     158  Void codeSaoUflc       ( UInt uiCode ){ assert(uiCode < 32); xWriteCode(uiCode, 5);}
     159#endif
     160
    231161  Void codeSkipFlag      ( TComDataCU* pcCU, UInt uiAbsPartIdx );
    232162  Void codeMergeFlag     ( TComDataCU* pcCU, UInt uiAbsPartIdx );
    233163  Void codeMergeIndex    ( TComDataCU* pcCU, UInt uiAbsPartIdx );
    234 #if HHI_INTER_VIEW_MOTION_PRED || HHI_MPI
    235   Void codeMergeIndexMV  ( TComDataCU* pcCU, UInt uiAbsPartIdx );
    236 #endif
    237164#if HHI_INTER_VIEW_RESIDUAL_PRED
    238165  Void codeResPredFlag   ( TComDataCU* pcCU, UInt uiAbsPartIdx );
    239166#endif
    240167  Void codeAlfCtrlFlag   ( TComDataCU* pcCU, UInt uiAbsPartIdx );
    241 #if TSB_ALF_HEADER
    242   Void codeAlfFlagNum    ( UInt uiCode, UInt minValue );
     168
     169  Void codeApsExtensionFlag ();
     170
     171  /// set slice granularity
     172  Void setSliceGranularity(Int iSliceGranularity)  {m_iSliceGranularity = iSliceGranularity;}
     173
     174  ///get slice granularity
     175  Int  getSliceGranularity()                       {return m_iSliceGranularity;             }
     176
    243177  Void codeAlfCtrlFlag   ( UInt uiSymbol );
    244 #endif
    245 #if QC_LCEC_INTER_MODE
    246178  Void codeInterModeFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, UInt uiEncMode );
    247 #endif 
    248179  Void codeSplitFlag     ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
    249180 
     
    251182  Void codePredMode      ( TComDataCU* pcCU, UInt uiAbsPartIdx );
    252183 
     184#if BURST_IPCM
     185  Void codeIPCMInfo      ( TComDataCU* pcCU, UInt uiAbsPartIdx, Int numIPCM, Bool firstIPCMFlag);
     186#else
     187  Void codeIPCMInfo      ( TComDataCU* pcCU, UInt uiAbsPartIdx );
     188#endif
     189
    253190  Void codeTransformSubdivFlag( UInt uiSymbol, UInt uiCtx );
    254191  Void codeQtCbf         ( TComDataCU* pcCU, UInt uiAbsPartIdx, TextType eType, UInt uiTrDepth );
     
    263200 
    264201  Void codeDeltaQP       ( TComDataCU* pcCU, UInt uiAbsPartIdx );
    265 
    266   Void codeViewIdx       ( Int iViewIdx );
    267 #if CAVLC_RQT_CBP
    268   Void codeCbfTrdiv      ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
    269   UInt xGetFlagPattern   ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth );
    270 #endif
    271   Void codeCbf           ( TComDataCU* pcCU, UInt uiAbsPartIdx, TextType eType, UInt uiTrDepth );
    272   Void codeBlockCbf      ( TComDataCU* pcCU, UInt uiAbsPartIdx, TextType eType, UInt uiTrDepth, UInt uiQPartNum, Bool bRD = false);
    273  
    274   Void codeCoeffNxN      ( TComDataCU* pcCU, TCoeff* pcCoef, UInt uiAbsPartIdx, UInt uiWidth, UInt uiHeight, UInt uiDepth, TextType eTType, Bool bRD = false );
    275 
    276 #ifdef WEIGHT_PRED
    277   Void codeWeightPredTable( TComSlice* pcSlice );
    278 #endif
    279  
    280   Void estBit             (estBitsSbacStruct* pcEstBitsSbac, UInt uiCTXIdx, TextType eTType);
    281  
    282   Bool  getAdaptFlag          ()          { return m_bAdaptFlag; }
    283   Void  setAdaptFlag          ( Bool b )  { m_bAdaptFlag = b;     }
     202 
     203  Void codeCoeffNxN      ( TComDataCU* pcCU, TCoeff* pcCoef, UInt uiAbsPartIdx, UInt uiWidth, UInt uiHeight, UInt uiDepth, TextType eTType );
     204 
     205  Void estBit               (estBitsSbacStruct* pcEstBitsSbac, Int width, Int height, TextType eTType);
     206 
     207  Void xCodePredWeightTable          ( TComSlice* pcSlice );
     208  Void updateContextTables           ( SliceType eSliceType, Int iQp, Bool bExecuteFinish=true ) { return;   }
     209  Void updateContextTables           ( SliceType eSliceType, Int iQp  )                          { return;   }
     210  Void writeTileMarker               ( UInt uiTileIdx, UInt uiBitsUsed );
     211
     212  Void  codeAPSInitInfo(TComAPS* pcAPS);  //!< code APS flags before encoding SAO and ALF parameters
     213  Void  codeFinish(Bool bEnd) { /*do nothing*/}
     214  Void codeScalingList  ( TComScalingList* scalingList );
     215  Void xCodeScalingList ( TComScalingList* scalingList, UInt sizeId, UInt listId);
     216  Void codeDFFlag       ( UInt uiCode, const Char *pSymbolName );
     217  Void codeDFSvlc       ( Int   iCode, const Char *pSymbolName );
     218
    284219};
    285220
     221//! \}
     222
    286223#endif // !defined(AFX_TENCCAVLC_H__EE8A0B30_945B_4169_B290_24D3AD52296F__INCLUDED_)
    287224
Note: See TracChangeset for help on using the changeset viewer.