Changeset 1313 in 3DVCSoftware for trunk/source/Lib/TLibEncoder/TEncEntropy.h
- Timestamp:
- 13 Aug 2015, 17:38:13 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/source/Lib/TLibEncoder/TEncEntropy.h
r1196 r1313 2 2 * License, included below. This software may be subject to other third party 3 3 * and contributor rights, including patent rights, and no such rights are 4 * granted under this license. 5 * 6 * Copyright (c) 2010-2015, ITU/ISO/IEC4 * granted under this license. 5 * 6 * Copyright (c) 2010-2015, ITU/ISO/IEC 7 7 * All rights reserved. 8 8 * … … 46 46 #include "TLibCommon/TComTrQuant.h" 47 47 #include "TLibCommon/TComSampleAdaptiveOffset.h" 48 #include "TLibCommon/TComChromaFormat.h" 48 49 49 50 class TEncSbac; … … 59 60 { 60 61 public: 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; 63 64 virtual Void setBitstream ( TComBitIf* p ) = 0; 64 virtual Void setSlice ( TComSlice* p ) = 0;65 65 virtual Void resetBits () = 0; 66 virtual Void resetCoeffCost () = 0;67 66 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; 73 71 virtual Void codeSliceHeader ( TComSlice* pcSlice ) = 0; 74 72 … … 76 74 virtual Void codeTerminatingBit ( UInt uilsLast ) = 0; 77 75 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 81 78 public: 82 79 virtual Void codeCUTransquantBypassFlag( TComDataCU* pcCU, UInt uiAbsPartIdx ) = 0; 83 80 virtual Void codeSkipFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx ) = 0; 84 #if H_3D81 #if NH_3D_DIS 85 82 virtual Void codeDIS ( TComDataCU* pcCU, UInt uiAbsPartIdx ) = 0; 86 83 #endif 87 84 virtual Void codeMergeFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx ) = 0; 88 85 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 90 90 virtual Void codeARPW ( TComDataCU* pcCU, UInt uiAbsPartIdx ) = 0; 91 91 #endif 92 #if H_3D_IC92 #if NH_3D_IC 93 93 virtual Void codeICFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx ) = 0; 94 94 #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 97 96 virtual Void codeSDCFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx ) = 0; 98 97 #endif 99 #if H_3D_DBBP98 #if NH_3D_DBBP 100 99 virtual Void codeDBBPFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx ) = 0; 101 100 #endif 102 101 virtual Void codeSplitFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) = 0; 103 102 104 103 virtual Void codePartSize ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth ) = 0; 105 104 virtual Void codePredMode ( TComDataCU* pcCU, UInt uiAbsPartIdx ) = 0; 106 105 107 106 virtual Void codeIPCMInfo ( TComDataCU* pcCU, UInt uiAbsPartIdx ) = 0; 108 107 109 108 virtual Void codeTransformSubdivFlag( UInt uiSymbol, UInt uiCtx ) = 0; 110 virtual Void codeQtCbf ( TCom DataCU* pcCU, UInt uiAbsPartIdx, TextType eType, UInt uiTrDepth) = 0;109 virtual Void codeQtCbf ( TComTU &rTu, const ComponentID compID, const Bool lowestLevel ) = 0; 111 110 virtual Void codeQtRootCbf ( TComDataCU* pcCU, UInt uiAbsPartIdx ) = 0; 112 virtual Void codeQtCbfZero ( TCom DataCU* 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; 114 113 virtual Void codeIntraDirLumaAng( TComDataCU* pcCU, UInt uiAbsPartIdx, Bool isMultiplePU ) = 0; 115 114 116 115 virtual Void codeIntraDirChroma( TComDataCU* pcCU, UInt uiAbsPartIdx ) = 0; 117 116 virtual Void codeInterDir ( TComDataCU* pcCU, UInt uiAbsPartIdx ) = 0; 118 117 virtual Void codeRefFrmIdx ( TComDataCU* pcCU, UInt uiAbsPartIdx, RefPicList eRefList ) = 0; 119 118 virtual Void codeMvd ( TComDataCU* pcCU, UInt uiAbsPartIdx, RefPicList eRefList ) = 0; 119 120 virtual Void codeCrossComponentPrediction( TComTU &rTu, ComponentID compID ) = 0; 121 120 122 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; 131 130 132 131 virtual ~TEncEntropyIf() {} 133 134 132 }; 135 133 … … 137 135 class TEncEntropy 138 136 { 139 private: 140 UInt m_uiBakAbsPartIdx; 141 UInt m_uiBakChromaOffset; 142 UInt m_bakAbsPartIdxCU; 143 144 public: 145 Void setEntropyCoder ( TEncEntropyIf* e, TComSlice* pcSlice ); 137 public: 138 Void setEntropyCoder ( TEncEntropyIf* e ); 146 139 Void setBitstream ( TComBitIf* p ) { m_pcEntropyCoderIf->setBitstream(p); } 147 140 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 163 147 Void encodeSliceHeader ( TComSlice* pcSlice ); 164 148 Void encodeTilesWPPEntryPoint( TComSlice* pSlice ); … … 166 150 Void encodeSliceFinish (); 167 151 TEncEntropyIf* m_pcEntropyCoderIf; 168 169 public: 170 Void encodeVPS ( TComVPS* pcVPS);152 153 public: 154 Void encodeVPS ( const TComVPS* pcVPS); 171 155 // SPS 172 Void encodeSPS ( TComSPS* pcSPS );173 Void encodePPS ( TComPPS* pcPPS );156 Void encodeSPS ( const TComSPS* pcSPS ); 157 Void encodePPS ( const TComPPS* pcPPS ); 174 158 Void encodeSplitFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, Bool bRD = false ); 175 159 Void encodeCUTransquantBypassFlag( TComDataCU* pcCU, UInt uiAbsPartIdx, Bool bRD = false ); 176 160 Void encodeSkipFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, Bool bRD = false ); 177 #if H_3D161 #if NH_3D_DIS 178 162 Void encodeDIS ( TComDataCU* pcCU, UInt uiAbsPartIdx, Bool bRD=false ); 179 163 #endif 180 Void encodePUWise ( TComDataCU* pcCU, UInt uiAbsPartIdx , Bool bRD = false);164 Void encodePUWise ( TComDataCU* pcCU, UInt uiAbsPartIdx ); 181 165 Void encodeInterDirPU ( TComDataCU* pcSubCU, UInt uiAbsPartIdx ); 182 166 Void encodeRefFrmIdxPU ( TComDataCU* pcSubCU, UInt uiAbsPartIdx, RefPicList eRefList ); … … 185 169 Void encodeMergeFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx ); 186 170 Void encodeMergeIndex ( TComDataCU* pcCU, UInt uiAbsPartIdx, Bool bRD = false ); 187 #if H_3D_ARP171 #if NH_3D_ARP 188 172 Void encodeARPW ( TComDataCU* pcCU, UInt uiAbspartIdx ); 189 173 #endif 190 #if H_3D_IC174 #if NH_3D_IC 191 175 Void encodeICFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, Bool bRD = false ); 192 176 #endif 193 #if H_3D_INTER_SDC177 #if NH_3D_DMM || NH_3D_SDC_INTRA || NH_3D_SDC_INTER 194 178 Void encodeDeltaDC ( TComDataCU* pcCU, UInt absPartIdx ); 179 #endif 180 #if NH_3D_SDC_INTRA || NH_3D_SDC_INTER 195 181 Void encodeSDCFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, Bool bRD = false ); 196 182 #endif 197 #if H_3D_DBBP183 #if NH_3D_DBBP 198 184 Void encodeDBBPFlag ( TComDataCU* pcCU, UInt uiAbsPartIdx, Bool bRD = false ); 199 185 #endif … … 201 187 Void encodePartSize ( TComDataCU* pcCU, UInt uiAbsPartIdx, UInt uiDepth, Bool bRD = false ); 202 188 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 ); 204 190 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 208 194 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 ( ); 212 199 Void encodeQtRootCbf ( TComDataCU* pcCU, UInt uiAbsPartIdx ); 213 200 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 ); 218 204 219 205 private: 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 208 public: 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 234 217 static Int countNonZeroCoeffs( TCoeff* pcCoef, UInt uiSize ); 235 218
Note: See TracChangeset for help on using the changeset viewer.