[608] | 1 | /* The copyright in this software is being made available under the BSD |
---|
| 2 | * License, included below. This software may be subject to other third party |
---|
| 3 | * and contributor rights, including patent rights, and no such rights are |
---|
[1313] | 4 | * granted under this license. |
---|
[608] | 5 | * |
---|
[1401] | 6 | * Copyright (c) 2010-2016, ITU/ISO/IEC |
---|
[608] | 7 | * All rights reserved. |
---|
| 8 | * |
---|
| 9 | * Redistribution and use in source and binary forms, with or without |
---|
| 10 | * modification, are permitted provided that the following conditions are met: |
---|
| 11 | * |
---|
| 12 | * * Redistributions of source code must retain the above copyright notice, |
---|
| 13 | * this list of conditions and the following disclaimer. |
---|
| 14 | * * Redistributions in binary form must reproduce the above copyright notice, |
---|
| 15 | * this list of conditions and the following disclaimer in the documentation |
---|
| 16 | * and/or other materials provided with the distribution. |
---|
| 17 | * * Neither the name of the ITU/ISO/IEC nor the names of its contributors may |
---|
| 18 | * be used to endorse or promote products derived from this software without |
---|
| 19 | * specific prior written permission. |
---|
| 20 | * |
---|
| 21 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
---|
| 22 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
---|
| 23 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
---|
| 24 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS |
---|
| 25 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
---|
| 26 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
---|
| 27 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
---|
| 28 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
---|
| 29 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
---|
| 30 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF |
---|
| 31 | * THE POSSIBILITY OF SUCH DAMAGE. |
---|
| 32 | */ |
---|
| 33 | |
---|
| 34 | /** \file TEncRateCtrl.h |
---|
| 35 | \brief Rate control manager class |
---|
| 36 | */ |
---|
| 37 | |
---|
[1313] | 38 | #ifndef __TENCRATECTRL__ |
---|
| 39 | #define __TENCRATECTRL__ |
---|
[608] | 40 | |
---|
| 41 | #if _MSC_VER > 1000 |
---|
| 42 | #pragma once |
---|
| 43 | #endif // _MSC_VER > 1000 |
---|
| 44 | |
---|
| 45 | |
---|
| 46 | #include "../TLibCommon/CommonDef.h" |
---|
| 47 | #include "../TLibCommon/TComDataCU.h" |
---|
| 48 | |
---|
| 49 | #include <vector> |
---|
| 50 | #include <algorithm> |
---|
| 51 | |
---|
| 52 | using namespace std; |
---|
| 53 | |
---|
| 54 | //! \ingroup TLibEncoder |
---|
| 55 | //! \{ |
---|
| 56 | |
---|
| 57 | #include "../TLibEncoder/TEncCfg.h" |
---|
| 58 | #include <list> |
---|
| 59 | #include <cassert> |
---|
| 60 | |
---|
| 61 | const Int g_RCInvalidQPValue = -999; |
---|
| 62 | const Int g_RCSmoothWindowSize = 40; |
---|
| 63 | const Int g_RCMaxPicListSize = 32; |
---|
| 64 | const Double g_RCWeightPicTargetBitInGOP = 0.9; |
---|
| 65 | const Double g_RCWeightPicRargetBitInBuffer = 1.0 - g_RCWeightPicTargetBitInGOP; |
---|
| 66 | const Int g_RCIterationNum = 20; |
---|
| 67 | const Double g_RCWeightHistoryLambda = 0.5; |
---|
| 68 | const Double g_RCWeightCurrentLambda = 1.0 - g_RCWeightHistoryLambda; |
---|
| 69 | const Int g_RCLCUSmoothWindowSize = 4; |
---|
| 70 | const Double g_RCAlphaMinValue = 0.05; |
---|
| 71 | const Double g_RCAlphaMaxValue = 500.0; |
---|
| 72 | const Double g_RCBetaMinValue = -3.0; |
---|
| 73 | const Double g_RCBetaMaxValue = -0.1; |
---|
| 74 | |
---|
| 75 | #define ALPHA 6.7542; |
---|
| 76 | #define BETA1 1.2517 |
---|
| 77 | #define BETA2 1.7860 |
---|
| 78 | |
---|
| 79 | struct TRCLCU |
---|
| 80 | { |
---|
| 81 | Int m_actualBits; |
---|
| 82 | Int m_QP; // QP of skip mode is set to g_RCInvalidQPValue |
---|
| 83 | Int m_targetBits; |
---|
| 84 | Double m_lambda; |
---|
| 85 | Double m_bitWeight; |
---|
| 86 | Int m_numberOfPixel; |
---|
| 87 | Double m_costIntra; |
---|
| 88 | Int m_targetBitsLeft; |
---|
[655] | 89 | #if KWU_RC_MADPRED_E0227 |
---|
| 90 | Double m_MAD; |
---|
| 91 | Int m_CUWidth; |
---|
| 92 | Int m_CUHeight; |
---|
| 93 | Double m_IVMAD; |
---|
| 94 | #endif |
---|
[608] | 95 | }; |
---|
| 96 | |
---|
| 97 | struct TRCParameter |
---|
| 98 | { |
---|
| 99 | Double m_alpha; |
---|
| 100 | Double m_beta; |
---|
| 101 | }; |
---|
| 102 | |
---|
| 103 | class TEncRCSeq |
---|
| 104 | { |
---|
| 105 | public: |
---|
| 106 | TEncRCSeq(); |
---|
| 107 | ~TEncRCSeq(); |
---|
| 108 | |
---|
| 109 | public: |
---|
| 110 | Void create( Int totalFrames, Int targetBitrate, Int frameRate, Int GOPSize, Int picWidth, Int picHeight, Int LCUWidth, Int LCUHeight, Int numberOfLevel, Bool useLCUSeparateModel, Int adaptiveBit ); |
---|
| 111 | Void destroy(); |
---|
| 112 | Void initBitsRatio( Int bitsRatio[] ); |
---|
| 113 | Void initGOPID2Level( Int GOPID2Level[] ); |
---|
| 114 | Void initPicPara( TRCParameter* picPara = NULL ); // NULL to initial with default value |
---|
| 115 | Void initLCUPara( TRCParameter** LCUPara = NULL ); // NULL to initial with default value |
---|
| 116 | Void updateAfterPic ( Int bits ); |
---|
| 117 | Void setAllBitRatio( Double basicLambda, Double* equaCoeffA, Double* equaCoeffB ); |
---|
| 118 | |
---|
| 119 | public: |
---|
| 120 | Int getTotalFrames() { return m_totalFrames; } |
---|
| 121 | Int getTargetRate() { return m_targetRate; } |
---|
| 122 | Int getFrameRate() { return m_frameRate; } |
---|
| 123 | Int getGOPSize() { return m_GOPSize; } |
---|
| 124 | Int getPicWidth() { return m_picWidth; } |
---|
[1313] | 125 | Int getPicHeight() { return m_picHeight; } |
---|
[608] | 126 | Int getLCUWidth() { return m_LCUWidth; } |
---|
| 127 | Int getLCUHeight() { return m_LCUHeight; } |
---|
| 128 | Int getNumberOfLevel() { return m_numberOfLevel; } |
---|
| 129 | Int getAverageBits() { return m_averageBits; } |
---|
| 130 | Int getLeftAverageBits() { assert( m_framesLeft > 0 ); return (Int)(m_bitsLeft / m_framesLeft); } |
---|
| 131 | Bool getUseLCUSeparateModel() { return m_useLCUSeparateModel; } |
---|
| 132 | |
---|
| 133 | Int getNumPixel() { return m_numberOfPixel; } |
---|
| 134 | Int64 getTargetBits() { return m_targetBits; } |
---|
| 135 | Int getNumberOfLCU() { return m_numberOfLCU; } |
---|
| 136 | Int* getBitRatio() { return m_bitsRatio; } |
---|
| 137 | Int getBitRatio( Int idx ) { assert( idx<m_GOPSize); return m_bitsRatio[idx]; } |
---|
| 138 | Int* getGOPID2Level() { return m_GOPID2Level; } |
---|
| 139 | Int getGOPID2Level( Int ID ) { assert( ID < m_GOPSize ); return m_GOPID2Level[ID]; } |
---|
| 140 | TRCParameter* getPicPara() { return m_picPara; } |
---|
| 141 | TRCParameter getPicPara( Int level ) { assert( level < m_numberOfLevel ); return m_picPara[level]; } |
---|
| 142 | Void setPicPara( Int level, TRCParameter para ) { assert( level < m_numberOfLevel ); m_picPara[level] = para; } |
---|
| 143 | TRCParameter** getLCUPara() { return m_LCUPara; } |
---|
| 144 | TRCParameter* getLCUPara( Int level ) { assert( level < m_numberOfLevel ); return m_LCUPara[level]; } |
---|
| 145 | TRCParameter getLCUPara( Int level, Int LCUIdx ) { assert( LCUIdx < m_numberOfLCU ); return getLCUPara(level)[LCUIdx]; } |
---|
| 146 | Void setLCUPara( Int level, Int LCUIdx, TRCParameter para ) { assert( level < m_numberOfLevel ); assert( LCUIdx < m_numberOfLCU ); m_LCUPara[level][LCUIdx] = para; } |
---|
| 147 | |
---|
| 148 | Int getFramesLeft() { return m_framesLeft; } |
---|
| 149 | Int64 getBitsLeft() { return m_bitsLeft; } |
---|
| 150 | |
---|
| 151 | Double getSeqBpp() { return m_seqTargetBpp; } |
---|
| 152 | Double getAlphaUpdate() { return m_alphaUpdate; } |
---|
| 153 | Double getBetaUpdate() { return m_betaUpdate; } |
---|
| 154 | |
---|
| 155 | Int getAdaptiveBits() { return m_adaptiveBit; } |
---|
| 156 | Double getLastLambda() { return m_lastLambda; } |
---|
| 157 | Void setLastLambda( Double lamdba ) { m_lastLambda = lamdba; } |
---|
| 158 | |
---|
| 159 | private: |
---|
| 160 | Int m_totalFrames; |
---|
| 161 | Int m_targetRate; |
---|
[1313] | 162 | Int m_frameRate; |
---|
[608] | 163 | Int m_GOPSize; |
---|
| 164 | Int m_picWidth; |
---|
| 165 | Int m_picHeight; |
---|
| 166 | Int m_LCUWidth; |
---|
| 167 | Int m_LCUHeight; |
---|
| 168 | Int m_numberOfLevel; |
---|
| 169 | Int m_averageBits; |
---|
| 170 | |
---|
| 171 | Int m_numberOfPixel; |
---|
| 172 | Int64 m_targetBits; |
---|
| 173 | Int m_numberOfLCU; |
---|
| 174 | Int* m_bitsRatio; |
---|
| 175 | Int* m_GOPID2Level; |
---|
| 176 | TRCParameter* m_picPara; |
---|
| 177 | TRCParameter** m_LCUPara; |
---|
| 178 | |
---|
| 179 | Int m_framesLeft; |
---|
| 180 | Int64 m_bitsLeft; |
---|
| 181 | Double m_seqTargetBpp; |
---|
| 182 | Double m_alphaUpdate; |
---|
| 183 | Double m_betaUpdate; |
---|
| 184 | Bool m_useLCUSeparateModel; |
---|
| 185 | |
---|
| 186 | Int m_adaptiveBit; |
---|
| 187 | Double m_lastLambda; |
---|
| 188 | }; |
---|
| 189 | |
---|
| 190 | class TEncRCGOP |
---|
| 191 | { |
---|
| 192 | public: |
---|
| 193 | TEncRCGOP(); |
---|
| 194 | ~TEncRCGOP(); |
---|
| 195 | |
---|
| 196 | public: |
---|
| 197 | Void create( TEncRCSeq* encRCSeq, Int numPic ); |
---|
| 198 | Void destroy(); |
---|
| 199 | Void updateAfterPicture( Int bitsCost ); |
---|
| 200 | |
---|
| 201 | private: |
---|
| 202 | Int xEstGOPTargetBits( TEncRCSeq* encRCSeq, Int GOPSize ); |
---|
| 203 | Void xCalEquaCoeff( TEncRCSeq* encRCSeq, Double* lambdaRatio, Double* equaCoeffA, Double* equaCoeffB, Int GOPSize ); |
---|
| 204 | Double xSolveEqua( Double targetBpp, Double* equaCoeffA, Double* equaCoeffB, Int GOPSize ); |
---|
| 205 | |
---|
| 206 | public: |
---|
| 207 | TEncRCSeq* getEncRCSeq() { return m_encRCSeq; } |
---|
| 208 | Int getNumPic() { return m_numPic;} |
---|
| 209 | Int getTargetBits() { return m_targetBits; } |
---|
| 210 | Int getPicLeft() { return m_picLeft; } |
---|
| 211 | Int getBitsLeft() { return m_bitsLeft; } |
---|
| 212 | Int getTargetBitInGOP( Int i ) { return m_picTargetBitInGOP[i]; } |
---|
| 213 | |
---|
| 214 | private: |
---|
| 215 | TEncRCSeq* m_encRCSeq; |
---|
| 216 | Int* m_picTargetBitInGOP; |
---|
| 217 | Int m_numPic; |
---|
| 218 | Int m_targetBits; |
---|
| 219 | Int m_picLeft; |
---|
| 220 | Int m_bitsLeft; |
---|
| 221 | }; |
---|
| 222 | |
---|
| 223 | class TEncRCPic |
---|
| 224 | { |
---|
| 225 | public: |
---|
| 226 | TEncRCPic(); |
---|
| 227 | ~TEncRCPic(); |
---|
| 228 | |
---|
| 229 | public: |
---|
[655] | 230 | #if KWU_RC_MADPRED_E0227 |
---|
| 231 | Void create( TEncRCSeq* encRCSeq, TEncRCGOP* encRCGOP, Int frameLevel, list<TEncRCPic*>& listPreviousPictures, Int layerID ); |
---|
| 232 | #else |
---|
[608] | 233 | Void create( TEncRCSeq* encRCSeq, TEncRCGOP* encRCGOP, Int frameLevel, list<TEncRCPic*>& listPreviousPictures ); |
---|
[655] | 234 | #endif |
---|
[608] | 235 | Void destroy(); |
---|
| 236 | |
---|
[655] | 237 | #if KWU_RC_MADPRED_E0227 |
---|
| 238 | Double estimatePicLambdaIV( list<TEncRCPic*>& listPreviousPictures, Int curPOC ); |
---|
| 239 | #endif |
---|
[608] | 240 | Int estimatePicQP ( Double lambda, list<TEncRCPic*>& listPreviousPictures ); |
---|
| 241 | Int getRefineBitsForIntra(Int orgBits); |
---|
[1313] | 242 | Double calculateLambdaIntra(Double alpha, Double beta, Double MADPerPixel, Double bitsPerPixel); |
---|
[608] | 243 | Double estimatePicLambda( list<TEncRCPic*>& listPreviousPictures, SliceType eSliceType); |
---|
| 244 | |
---|
[1313] | 245 | Void updateAlphaBetaIntra(Double *alpha, Double *beta); |
---|
[608] | 246 | |
---|
| 247 | Double getLCUTargetBpp(SliceType eSliceType); |
---|
| 248 | Double getLCUEstLambdaAndQP(Double bpp, Int clipPicQP, Int *estQP); |
---|
[655] | 249 | #if KWU_RC_MADPRED_E0227 |
---|
| 250 | Double getLCUTargetBppforInterView( list<TEncRCPic*>& listPreviousPictures, TComDataCU* pcCU, Double basePos, Double curPos, Double focalLen, Double znear, Double zfar, Int direction, Int* disparity ); |
---|
| 251 | #endif |
---|
[608] | 252 | Double getLCUEstLambda( Double bpp ); |
---|
| 253 | Int getLCUEstQP( Double lambda, Int clipPicQP ); |
---|
| 254 | |
---|
[1313] | 255 | Void updateAfterCTU( Int LCUIdx, Int bits, Int QP, Double lambda, Bool updateLCUParameter = true ); |
---|
[608] | 256 | Void updateAfterPicture( Int actualHeaderBits, Int actualTotalBits, Double averageQP, Double averageLambda, SliceType eSliceType); |
---|
| 257 | |
---|
| 258 | Void addToPictureLsit( list<TEncRCPic*>& listPreviousPictures ); |
---|
[655] | 259 | #if KWU_RC_MADPRED_E0227 |
---|
| 260 | Void addToPictureLsitIV( list<TEncRCPic*>& listPreviousPictures ); |
---|
| 261 | Void setIVPic( TEncRCPic* baseRCPic ); |
---|
| 262 | #endif |
---|
[608] | 263 | Double calAverageQP(); |
---|
| 264 | Double calAverageLambda(); |
---|
| 265 | |
---|
| 266 | private: |
---|
| 267 | Int xEstPicTargetBits( TEncRCSeq* encRCSeq, TEncRCGOP* encRCGOP ); |
---|
| 268 | Int xEstPicHeaderBits( list<TEncRCPic*>& listPreviousPictures, Int frameLevel ); |
---|
[1402] | 269 | #if V0078_ADAPTIVE_LOWER_BOUND |
---|
| 270 | Int xEstPicLowerBound( TEncRCSeq* encRCSeq, TEncRCGOP* encRCGOP ); |
---|
| 271 | #endif |
---|
[608] | 272 | |
---|
| 273 | public: |
---|
| 274 | TEncRCSeq* getRCSequence() { return m_encRCSeq; } |
---|
| 275 | TEncRCGOP* getRCGOP() { return m_encRCGOP; } |
---|
| 276 | |
---|
| 277 | Int getFrameLevel() { return m_frameLevel; } |
---|
| 278 | Int getNumberOfPixel() { return m_numberOfPixel; } |
---|
| 279 | Int getNumberOfLCU() { return m_numberOfLCU; } |
---|
| 280 | Int getTargetBits() { return m_targetBits; } |
---|
| 281 | Int getEstHeaderBits() { return m_estHeaderBits; } |
---|
| 282 | Int getLCULeft() { return m_LCULeft; } |
---|
| 283 | Int getBitsLeft() { return m_bitsLeft; } |
---|
| 284 | Int getPixelsLeft() { return m_pixelsLeft; } |
---|
| 285 | Int getBitsCoded() { return m_targetBits - m_estHeaderBits - m_bitsLeft; } |
---|
| 286 | Int getLCUCoded() { return m_numberOfLCU - m_LCULeft; } |
---|
[1402] | 287 | #if V0078_ADAPTIVE_LOWER_BOUND |
---|
| 288 | Int getLowerBound() { return m_lowerBound; } |
---|
| 289 | #endif |
---|
[608] | 290 | TRCLCU* getLCU() { return m_LCUs; } |
---|
| 291 | TRCLCU& getLCU( Int LCUIdx ) { return m_LCUs[LCUIdx]; } |
---|
| 292 | Int getPicActualHeaderBits() { return m_picActualHeaderBits; } |
---|
[1386] | 293 | #if U0132_TARGET_BITS_SATURATION |
---|
| 294 | Void setBitLeft(Int bits) { m_bitsLeft = bits; } |
---|
| 295 | #endif |
---|
[608] | 296 | Void setTargetBits( Int bits ) { m_targetBits = bits; m_bitsLeft = bits;} |
---|
| 297 | Void setTotalIntraCost(Double cost) { m_totalCostIntra = cost; } |
---|
| 298 | Void getLCUInitTargetBits(); |
---|
[655] | 299 | #if KWU_RC_MADPRED_E0227 |
---|
| 300 | Double getTotalMAD() { return m_totalMAD; } |
---|
| 301 | Void setTotalMAD( Double MAD ) { m_totalMAD = MAD; } |
---|
| 302 | |
---|
| 303 | Double getIVTotalMAD() { return m_IVtotalMAD; } |
---|
| 304 | Void setIVTotalMAD( Double MAD ) { m_IVtotalMAD = MAD; } |
---|
| 305 | #endif |
---|
| 306 | |
---|
[608] | 307 | Int getPicActualBits() { return m_picActualBits; } |
---|
| 308 | Int getPicActualQP() { return m_picQP; } |
---|
| 309 | Double getPicActualLambda() { return m_picLambda; } |
---|
| 310 | Int getPicEstQP() { return m_estPicQP; } |
---|
| 311 | Void setPicEstQP( Int QP ) { m_estPicQP = QP; } |
---|
| 312 | Double getPicEstLambda() { return m_estPicLambda; } |
---|
| 313 | Void setPicEstLambda( Double lambda ) { m_picLambda = lambda; } |
---|
| 314 | |
---|
[655] | 315 | #if KWU_RC_MADPRED_E0227 |
---|
| 316 | Int getLayerID() { return m_LayerID; } |
---|
| 317 | Void setLayerID(Int layerid) { m_LayerID = layerid; } |
---|
| 318 | #endif |
---|
[608] | 319 | private: |
---|
| 320 | TEncRCSeq* m_encRCSeq; |
---|
| 321 | TEncRCGOP* m_encRCGOP; |
---|
| 322 | |
---|
| 323 | Int m_frameLevel; |
---|
| 324 | Int m_numberOfPixel; |
---|
| 325 | Int m_numberOfLCU; |
---|
| 326 | Int m_targetBits; |
---|
| 327 | Int m_estHeaderBits; |
---|
| 328 | Int m_estPicQP; |
---|
[1402] | 329 | #if V0078_ADAPTIVE_LOWER_BOUND |
---|
| 330 | Int m_lowerBound; |
---|
| 331 | #endif |
---|
[608] | 332 | Double m_estPicLambda; |
---|
| 333 | |
---|
| 334 | Int m_LCULeft; |
---|
| 335 | Int m_bitsLeft; |
---|
| 336 | Int m_pixelsLeft; |
---|
| 337 | |
---|
| 338 | TRCLCU* m_LCUs; |
---|
| 339 | Int m_picActualHeaderBits; // only SH and potential APS |
---|
[1313] | 340 | Double m_totalCostIntra; |
---|
[608] | 341 | Double m_remainingCostIntra; |
---|
| 342 | Int m_picActualBits; // the whole picture, including header |
---|
| 343 | Int m_picQP; // in integer form |
---|
| 344 | Double m_picLambda; |
---|
[655] | 345 | #if KWU_RC_MADPRED_E0227 |
---|
| 346 | Double m_totalMAD; |
---|
| 347 | TEncRCPic* m_lastPicture; |
---|
| 348 | Int m_LayerID; |
---|
| 349 | TEncRCPic* m_lastIVPicture; |
---|
| 350 | Double m_IVtotalMAD; |
---|
| 351 | #endif |
---|
[608] | 352 | }; |
---|
| 353 | |
---|
| 354 | class TEncRateCtrl |
---|
| 355 | { |
---|
| 356 | public: |
---|
| 357 | TEncRateCtrl(); |
---|
| 358 | ~TEncRateCtrl(); |
---|
| 359 | |
---|
| 360 | public: |
---|
[655] | 361 | #if KWU_RC_MADPRED_E0227 |
---|
| 362 | Void init( Int totalFrames, Int targetBitrate, Int frameRate, Int GOPSize, Int picWidth, Int picHeight, Int LCUWidth, Int LCUHeight, Bool keepHierBits, Bool useLCUSeparateModel, GOPEntry GOPList[MAX_GOP], Int layerID ); |
---|
| 363 | #else |
---|
[608] | 364 | Void init( Int totalFrames, Int targetBitrate, Int frameRate, Int GOPSize, Int picWidth, Int picHeight, Int LCUWidth, Int LCUHeight, Int keepHierBits, Bool useLCUSeparateModel, GOPEntry GOPList[MAX_GOP] ); |
---|
[655] | 365 | #endif |
---|
[608] | 366 | Void destroy(); |
---|
| 367 | Void initRCPic( Int frameLevel ); |
---|
| 368 | Void initRCGOP( Int numberOfPictures ); |
---|
| 369 | Void destroyRCGOP(); |
---|
| 370 | |
---|
| 371 | public: |
---|
| 372 | Void setRCQP ( Int QP ) { m_RCQP = QP; } |
---|
| 373 | Int getRCQP () { return m_RCQP; } |
---|
| 374 | TEncRCSeq* getRCSeq() { assert ( m_encRCSeq != NULL ); return m_encRCSeq; } |
---|
| 375 | TEncRCGOP* getRCGOP() { assert ( m_encRCGOP != NULL ); return m_encRCGOP; } |
---|
| 376 | TEncRCPic* getRCPic() { assert ( m_encRCPic != NULL ); return m_encRCPic; } |
---|
| 377 | list<TEncRCPic*>& getPicList() { return m_listRCPictures; } |
---|
| 378 | |
---|
[655] | 379 | #if KWU_RC_MADPRED_E0227 |
---|
| 380 | Int getLayerID() { return m_LayerID; } |
---|
| 381 | Void setLayerID(Int layerid) { m_LayerID = layerid; } |
---|
| 382 | #endif |
---|
[1386] | 383 | #if U0132_TARGET_BITS_SATURATION |
---|
| 384 | Bool getCpbSaturationEnabled() { return m_CpbSaturationEnabled; } |
---|
| 385 | UInt getCpbState() { return m_cpbState; } |
---|
| 386 | UInt getCpbSize() { return m_cpbSize; } |
---|
| 387 | UInt getBufferingRate() { return m_bufferingRate; } |
---|
| 388 | Int updateCpbState(Int actualBits); |
---|
| 389 | Void initHrdParam(const TComHRD* pcHrd, Int iFrameRate, Double fInitialCpbFullness); |
---|
| 390 | #endif |
---|
| 391 | |
---|
[608] | 392 | private: |
---|
| 393 | TEncRCSeq* m_encRCSeq; |
---|
| 394 | TEncRCGOP* m_encRCGOP; |
---|
| 395 | TEncRCPic* m_encRCPic; |
---|
| 396 | list<TEncRCPic*> m_listRCPictures; |
---|
| 397 | Int m_RCQP; |
---|
[1386] | 398 | #if U0132_TARGET_BITS_SATURATION |
---|
| 399 | Bool m_CpbSaturationEnabled; // Enable target bits saturation to avoid CPB overflow and underflow |
---|
| 400 | Int m_cpbState; // CPB State |
---|
| 401 | UInt m_cpbSize; // CPB size |
---|
| 402 | UInt m_bufferingRate; // Buffering rate |
---|
| 403 | #endif |
---|
| 404 | |
---|
[655] | 405 | #if KWU_RC_MADPRED_E0227 |
---|
| 406 | Int m_LayerID; |
---|
| 407 | #endif |
---|
[608] | 408 | }; |
---|
| 409 | |
---|
[655] | 410 | #endif |
---|
[608] | 411 | |
---|
| 412 | |
---|