Changeset 1313 in 3DVCSoftware for trunk/source/Lib/TLibEncoder/TEncEntropy.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/TEncEntropy.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 *
     
    4646#include "TLibCommon/TComTrQuant.h"
    4747#include "TLibCommon/TComSampleAdaptiveOffset.h"
     48#include "TLibCommon/TComChromaFormat.h"
    4849
    4950class TEncSbac;
     
    5960{
    6061public:
    61   virtual Void  resetEntropy          ()                = 0;
    62   virtual Void  determineCabacInitIdx ()                = 0;
     62  virtual Void  resetEntropy          (const TComSlice *pSlice)                = 0;
     63  virtual SliceType determineCabacInitIdx (const TComSlice *pSlice)                = 0;
    6364  virtual Void  setBitstream          ( TComBitIf* p )  = 0;
    64   virtual Void  setSlice              ( TComSlice* p )  = 0;
    6565  virtual Void  resetBits             ()                = 0;
    66   virtual Void  resetCoeffCost        ()                = 0;
    6766  virtual UInt  getNumberOfWrittenBits()                = 0;
    68   virtual UInt  getCoeffCost          ()                = 0;
    69 
    70   virtual Void  codeVPS                 ( TComVPS* pcVPS )                                      = 0;
    71   virtual Void  codeSPS                 ( TComSPS* pcSPS )                                      = 0;
    72   virtual Void  codePPS                 ( TComPPS* pcPPS )                                      = 0;
     67
     68  virtual Void  codeVPS                 ( const TComVPS* pcVPS )                                      = 0;
     69  virtual Void  codeSPS                 ( const TComSPS* pcSPS )                                      = 0;
     70  virtual Void  codePPS                 ( const TComPPS* pcPPS )                                      = 0;
    7371  virtual Void  codeSliceHeader         ( TComSlice* pcSlice )                                  = 0;
    7472
     
    7674  virtual Void  codeTerminatingBit      ( UInt uilsLast )                                       = 0;
    7775  virtual Void  codeSliceFinish         ()                                                      = 0;
    78   virtual Void codeMVPIdx ( TComDataCU* pcCU, UInt uiAbsPartIdx, RefPicList eRefList ) = 0;
    79   virtual Void codeScalingList   ( TComScalingList* scalingList )      = 0;
    80  
     76  virtual Void  codeMVPIdx ( TComDataCU* pcCU, UInt uiAbsPartIdx, RefPicList eRefList ) = 0;
     77
    8178public:
    8279  virtual Void codeCUTransquantBypassFlag( TComDataCU* pcCU, UInt uiAbsPartIdx ) = 0;
    8380  virtual Void codeSkipFlag      ( TComDataCU* pcCU, UInt uiAbsPartIdx ) = 0;
    84 #if H_3D
     81#if NH_3D_DIS
    8582  virtual Void codeDIS          ( TComDataCU* pcCU, UInt uiAbsPartIdx ) = 0;
    8683#endif
    8784  virtual Void codeMergeFlag     ( TComDataCU* pcCU, UInt uiAbsPartIdx ) = 0;
    8885  virtual Void codeMergeIndex    ( TComDataCU* pcCU, UInt uiAbsPartIdx ) = 0;
    89 #if H_3D_ARP
     86#if NH_3D_DMM || NH_3D_SDC_INTRA || NH_3D_SDC_INTER
     87  virtual Void codeDeltaDC       ( TComDataCU* pcCU, UInt uiAbsPartIdx ) = 0;
     88#endif
     89#if NH_3D_ARP 
    9090  virtual Void codeARPW          ( TComDataCU* pcCU, UInt uiAbsPartIdx ) = 0;
    9191#endif
    92 #if H_3D_IC
     92#if NH_3D_IC
    9393  virtual Void codeICFlag        ( TComDataCU* pcCU, UInt uiAbsPartIdx ) = 0;
    9494#endif
    95 #if H_3D_INTER_SDC
    96   virtual Void codeDeltaDC       ( TComDataCU* pcCU, UInt uiAbsPartIdx ) = 0;
     95#if NH_3D_SDC_INTRA || NH_3D_SDC_INTER
    9796  virtual Void codeSDCFlag       ( TComDataCU* pcCU, UInt uiAbsPartIdx ) = 0;
    9897#endif
    99 #if H_3D_DBBP
     98#if NH_3D_DBBP
    10099  virtual Void codeDBBPFlag      ( TComDataCU* pcCU, UInt uiAbsPartIdx ) = 0;
    101100#endif
    102101  virtual Void codeSplitFlag     ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) = 0;
    103  
     102
    104103  virtual Void codePartSize      ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) = 0;
    105104  virtual Void codePredMode      ( TComDataCU* pcCU, UInt uiAbsPartIdx ) = 0;
    106  
     105
    107106  virtual Void codeIPCMInfo      ( TComDataCU* pcCU, UInt uiAbsPartIdx ) = 0;
    108107
    109108  virtual Void codeTransformSubdivFlag( UInt uiSymbol, UInt uiCtx ) = 0;
    110   virtual Void codeQtCbf         ( TComDataCU* pcCU, UInt uiAbsPartIdx, TextType eType, UInt uiTrDepth ) = 0;
     109  virtual Void codeQtCbf         ( TComTU &rTu, const ComponentID compID, const Bool lowestLevel ) = 0;
    111110  virtual Void codeQtRootCbf     ( TComDataCU* pcCU, UInt uiAbsPartIdx ) = 0;
    112   virtual Void codeQtCbfZero     ( TComDataCU* pcCU, TextType eType, UInt uiTrDepth ) = 0;
    113   virtual Void codeQtRootCbfZero ( TComDataCU* pcCU ) = 0;
     111  virtual Void codeQtCbfZero     ( TComTU &rTu, const ChannelType chType ) = 0;
     112  virtual Void codeQtRootCbfZero ( ) = 0;
    114113  virtual Void codeIntraDirLumaAng( TComDataCU* pcCU, UInt uiAbsPartIdx, Bool isMultiplePU ) = 0;
    115  
     114
    116115  virtual Void codeIntraDirChroma( TComDataCU* pcCU, UInt uiAbsPartIdx ) = 0;
    117116  virtual Void codeInterDir      ( TComDataCU* pcCU, UInt uiAbsPartIdx ) = 0;
    118117  virtual Void codeRefFrmIdx     ( TComDataCU* pcCU, UInt uiAbsPartIdx, RefPicList eRefList )      = 0;
    119118  virtual Void codeMvd           ( TComDataCU* pcCU, UInt uiAbsPartIdx, RefPicList eRefList )      = 0;
     119
     120  virtual Void codeCrossComponentPrediction( TComTU &rTu, ComponentID compID ) = 0;
     121
    120122  virtual Void codeDeltaQP       ( TComDataCU* pcCU, UInt uiAbsPartIdx ) = 0;
    121   virtual Void codeCoeffNxN      ( TComDataCU* pcCU, TCoeff* pcCoef, UInt uiAbsPartIdx, UInt uiWidth, UInt uiHeight, UInt uiDepth, TextType eTType ) = 0;
    122   virtual Void codeTransformSkipFlags ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt width, UInt height, TextType eTType ) = 0;
    123   virtual Void codeSAOBlkParam(SAOBlkParam& saoBlkParam, Bool* sliceEnabled, Bool leftMergeAvail, Bool aboveMergeAvail, Bool onlyEstMergeInfo = false)    =0;
    124   virtual Void estBit               (estBitsSbacStruct* pcEstBitsSbac, Int width, Int height, TextType eTType) = 0;
    125  
    126   virtual Void updateContextTables ( SliceType eSliceType, Int iQp, Bool bExecuteFinish )   = 0;
    127   virtual Void updateContextTables ( SliceType eSliceType, Int iQp )   = 0;
    128 
    129   virtual Void codeDFFlag (UInt uiCode, const Char *pSymbolName) = 0;
    130   virtual Void codeDFSvlc (Int iCode, const Char *pSymbolName)   = 0;
     123  virtual Void codeChromaQpAdjustment( TComDataCU* pcCU, UInt uiAbsPartIdx ) = 0;
     124  virtual Void codeCoeffNxN      ( TComTU &rTu, TCoeff* pcCoef, const ComponentID compID ) = 0;
     125  virtual Void codeTransformSkipFlags ( TComTU &rTu, ComponentID component ) = 0;
     126  virtual Void codeSAOBlkParam   (SAOBlkParam& saoBlkParam, const BitDepths &bitDepths, Bool* sliceEnabled, Bool leftMergeAvail, Bool aboveMergeAvail, Bool onlyEstMergeInfo = false)    =0;
     127  virtual Void estBit               (estBitsSbacStruct* pcEstBitsSbac, Int width, Int height, ChannelType chType) = 0;
     128
     129  virtual Void codeExplicitRdpcmMode ( TComTU &rTu, const ComponentID compID ) = 0;
    131130
    132131  virtual ~TEncEntropyIf() {}
    133 
    134132};
    135133
     
    137135class TEncEntropy
    138136{
    139 private:
    140   UInt    m_uiBakAbsPartIdx;
    141   UInt    m_uiBakChromaOffset;
    142   UInt    m_bakAbsPartIdxCU;
    143 
    144 public:
    145   Void    setEntropyCoder           ( TEncEntropyIf* e, TComSlice* pcSlice );
     137public:
     138  Void    setEntropyCoder           ( TEncEntropyIf* e );
    146139  Void    setBitstream              ( TComBitIf* p )          { m_pcEntropyCoderIf->setBitstream(p);  }
    147140  Void    resetBits                 ()                        { m_pcEntropyCoderIf->resetBits();      }
    148   Void    resetCoeffCost            ()                        { m_pcEntropyCoderIf->resetCoeffCost(); }
    149   UInt    getNumberOfWrittenBits    ()
    150   {
    151 #if ENC_DEC_TRACE && H_MV_ENC_DEC_TRAC
    152     Bool oldJustDoIt = g_bJustDoIt;
    153     g_bJustDoIt = true;
    154     writeToTraceFile( "NumberOfWrittenBits", m_pcEntropyCoderIf->getNumberOfWrittenBits(), g_encNumberOfWrittenBits );
    155     g_bJustDoIt = oldJustDoIt;
    156 #endif
    157     return m_pcEntropyCoderIf->getNumberOfWrittenBits();
    158   }
    159   UInt    getCoeffCost              ()                        { return  m_pcEntropyCoderIf->getCoeffCost(); }
    160   Void    resetEntropy              ()                        { m_pcEntropyCoderIf->resetEntropy();  }
    161   Void    determineCabacInitIdx     ()                        { m_pcEntropyCoderIf->determineCabacInitIdx(); }
    162  
     141  UInt    getNumberOfWrittenBits    ()                        {
     142      D_PRINT_INDENT(g_encNumberOfWrittenBits,  "NumBits: " +  n2s( m_pcEntropyCoderIf->getNumberOfWrittenBits() ))
     143 return m_pcEntropyCoderIf->getNumberOfWrittenBits(); }
     144  Void    resetEntropy              (const TComSlice *pSlice) { m_pcEntropyCoderIf->resetEntropy(pSlice);  }
     145  SliceType determineCabacInitIdx   (const TComSlice *pSlice) { return m_pcEntropyCoderIf->determineCabacInitIdx(pSlice); }
     146
    163147  Void    encodeSliceHeader         ( TComSlice* pcSlice );
    164148  Void    encodeTilesWPPEntryPoint( TComSlice* pSlice );
     
    166150  Void    encodeSliceFinish         ();
    167151  TEncEntropyIf*      m_pcEntropyCoderIf;
    168  
    169 public:
    170   Void encodeVPS               ( TComVPS* pcVPS);
     152
     153public:
     154  Void encodeVPS               ( const TComVPS* pcVPS);
    171155  // SPS
    172   Void encodeSPS               ( TComSPS* pcSPS );
    173   Void encodePPS               ( TComPPS* pcPPS );
     156  Void encodeSPS               ( const TComSPS* pcSPS );
     157  Void encodePPS               ( const TComPPS* pcPPS );
    174158  Void encodeSplitFlag         ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, Bool bRD = false );
    175159  Void encodeCUTransquantBypassFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, Bool bRD = false );
    176160  Void encodeSkipFlag          ( TComDataCU* pcCU, UInt uiAbsPartIdx, Bool bRD = false );
    177 #if H_3D
     161#if NH_3D_DIS
    178162  Void encodeDIS               ( TComDataCU* pcCU, UInt uiAbsPartIdx, Bool bRD=false );
    179163#endif
    180   Void encodePUWise       ( TComDataCU* pcCU, UInt uiAbsPartIdx, Bool bRD = false );
     164  Void encodePUWise       ( TComDataCU* pcCU, UInt uiAbsPartIdx );
    181165  Void encodeInterDirPU   ( TComDataCU* pcSubCU, UInt uiAbsPartIdx  );
    182166  Void encodeRefFrmIdxPU  ( TComDataCU* pcSubCU, UInt uiAbsPartIdx, RefPicList eRefList );
     
    185169  Void encodeMergeFlag    ( TComDataCU* pcCU, UInt uiAbsPartIdx );
    186170  Void encodeMergeIndex   ( TComDataCU* pcCU, UInt uiAbsPartIdx, Bool bRD = false );
    187 #if H_3D_ARP
     171#if NH_3D_ARP
    188172  Void encodeARPW         ( TComDataCU* pcCU, UInt uiAbspartIdx );
    189173#endif
    190 #if H_3D_IC
     174#if NH_3D_IC
    191175  Void encodeICFlag       ( TComDataCU* pcCU, UInt uiAbsPartIdx, Bool bRD = false );
    192176#endif
    193 #if H_3D_INTER_SDC
     177#if NH_3D_DMM || NH_3D_SDC_INTRA || NH_3D_SDC_INTER
    194178  Void encodeDeltaDC      ( TComDataCU* pcCU, UInt absPartIdx );
     179#endif
     180#if NH_3D_SDC_INTRA || NH_3D_SDC_INTER
    195181  Void encodeSDCFlag      ( TComDataCU* pcCU, UInt uiAbsPartIdx, Bool bRD = false );
    196182#endif
    197 #if H_3D_DBBP
     183#if NH_3D_DBBP
    198184  Void encodeDBBPFlag     ( TComDataCU* pcCU, UInt uiAbsPartIdx, Bool bRD = false );
    199185#endif
     
    201187  Void encodePartSize          ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, Bool bRD = false );
    202188  Void encodeIPCMInfo          ( TComDataCU* pcCU, UInt uiAbsPartIdx, Bool bRD = false );
    203   Void encodePredInfo          ( TComDataCU* pcCU, UInt uiAbsPartIdx, Bool bRD = false );
     189  Void encodePredInfo          ( TComDataCU* pcCU, UInt uiAbsPartIdx );
    204190  Void encodeIntraDirModeLuma  ( TComDataCU* pcCU, UInt absPartIdx, Bool isMultiplePU = false );
    205  
    206   Void encodeIntraDirModeChroma( TComDataCU* pcCU, UInt uiAbsPartIdx, Bool bRD = false );
    207  
     191
     192  Void encodeIntraDirModeChroma( TComDataCU* pcCU, UInt uiAbsPartIdx );
     193
    208194  Void encodeTransformSubdivFlag( UInt uiSymbol, UInt uiCtx );
    209   Void encodeQtCbf             ( TComDataCU* pcCU, UInt uiAbsPartIdx, TextType eType, UInt uiTrDepth );
    210   Void encodeQtCbfZero         ( TComDataCU* pcCU, TextType eType, UInt uiTrDepth );
    211   Void encodeQtRootCbfZero     ( TComDataCU* pcCU );
     195  Void encodeQtCbf             ( TComTU &rTu, const ComponentID compID, const Bool lowestLevel );
     196
     197  Void encodeQtCbfZero         ( TComTU &rTu, const ChannelType chType );
     198  Void encodeQtRootCbfZero     ( );
    212199  Void encodeQtRootCbf         ( TComDataCU* pcCU, UInt uiAbsPartIdx );
    213200  Void encodeQP                ( TComDataCU* pcCU, UInt uiAbsPartIdx, Bool bRD = false );
    214   Void updateContextTables     ( SliceType eSliceType, Int iQp, Bool bExecuteFinish )   { m_pcEntropyCoderIf->updateContextTables( eSliceType, iQp, bExecuteFinish );     }
    215   Void updateContextTables     ( SliceType eSliceType, Int iQp )                        { m_pcEntropyCoderIf->updateContextTables( eSliceType, iQp, true );               }
    216 
    217   Void encodeScalingList       ( TComScalingList* scalingList );
     201  Void encodeChromaQpAdjustment ( TComDataCU* pcCU, UInt uiAbsPartIdx, Bool bRD = false );
     202
     203  Void encodeCrossComponentPrediction( TComTU &rTu, ComponentID compID );
    218204
    219205private:
    220 #if H_3D_DISABLE_CHROMA
    221   Void xEncodeTransform        ( TComDataCU* pcCU,UInt offsetLumaOffset, UInt offsetChroma, UInt uiAbsPartIdx, UInt uiDepth, UInt width, UInt height, UInt uiTrIdx, Bool& bCodeDQP, Bool rd );
    222 public:
    223   Void encodeCoeff             ( TComDataCU* pcCU,                 UInt uiAbsPartIdx, UInt uiDepth, UInt uiWidth, UInt uiHeight, Bool& bCodeDQP, Bool rd );
    224 #else
    225   Void xEncodeTransform        ( TComDataCU* pcCU,UInt offsetLumaOffset, UInt offsetChroma, UInt uiAbsPartIdx, UInt uiDepth, UInt width, UInt height, UInt uiTrIdx, Bool& bCodeDQP );
    226 public:
    227   Void encodeCoeff             ( TComDataCU* pcCU,                 UInt uiAbsPartIdx, UInt uiDepth, UInt uiWidth, UInt uiHeight, Bool& bCodeDQP );
    228 #endif
    229  
    230   Void encodeCoeffNxN         ( TComDataCU* pcCU, TCoeff* pcCoeff, UInt uiAbsPartIdx, UInt uiTrWidth, UInt uiTrHeight, UInt uiDepth, TextType eType );
    231  
    232   Void estimateBit             ( estBitsSbacStruct* pcEstBitsSbac, Int width, Int height, TextType eTType);
    233   Void encodeSAOBlkParam(SAOBlkParam& saoBlkParam, Bool* sliceEnabled, Bool leftMergeAvail, Bool aboveMergeAvail){m_pcEntropyCoderIf->codeSAOBlkParam(saoBlkParam, sliceEnabled, leftMergeAvail, aboveMergeAvail, false);}
     206  Void xEncodeTransform        ( Bool& bCodeDQP, Bool& codeChromaQpAdj, TComTU &rTu );
     207
     208public:
     209  Void encodeCoeff             ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, Bool& bCodeDQP, Bool& codeChromaQpAdj );
     210
     211  Void encodeCoeffNxN         ( TComTU &rTu, TCoeff* pcCoef, const ComponentID compID );
     212
     213  Void estimateBit             ( estBitsSbacStruct* pcEstBitsSbac, Int width, Int height, ChannelType chType );
     214
     215  Void encodeSAOBlkParam(SAOBlkParam& saoBlkParam, const BitDepths &bitDepths, Bool* sliceEnabled, Bool leftMergeAvail, Bool aboveMergeAvail){m_pcEntropyCoderIf->codeSAOBlkParam(saoBlkParam, bitDepths, sliceEnabled, leftMergeAvail, aboveMergeAvail, false);}
     216
    234217  static Int countNonZeroCoeffs( TCoeff* pcCoef, UInt uiSize );
    235218
Note: See TracChangeset for help on using the changeset viewer.