Changeset 302 in SHVCSoftware for branches/SHM-2.1-dev/source/Lib/TLibEncoder/TEncRateCtrl.h
- Timestamp:
- 28 Jun 2013, 00:40:00 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/SHM-2.1-dev/source/Lib/TLibEncoder/TEncRateCtrl.h
r191 r302 65 65 const Double g_RCWeightPicTargetBitInGOP = 0.9; 66 66 const Double g_RCWeightPicRargetBitInBuffer = 1.0 - g_RCWeightPicTargetBitInGOP; 67 #if M0036_RC_IMPROVEMENT 68 const Int g_RCIterationNum = 20; 69 const Double g_RCWeightHistoryLambda = 0.5; 70 const Double g_RCWeightCurrentLambda = 1.0 - g_RCWeightHistoryLambda; 71 const Int g_RCLCUSmoothWindowSize = 4; 72 const Double g_RCAlphaMinValue = 0.05; 73 const Double g_RCAlphaMaxValue = 500.0; 74 const Double g_RCBetaMinValue = -3.0; 75 const Double g_RCBetaMaxValue = -0.1; 76 #endif 77 78 #if RATE_CONTROL_INTRA 79 #define ALPHA 6.7542; 80 #define BETA1 1.2517 81 #define BETA2 1.7860 82 #endif 67 83 68 84 struct TRCLCU … … 72 88 Int m_targetBits; 73 89 Double m_lambda; 90 #if M0036_RC_IMPROVEMENT 91 Double m_bitWeight; 92 #else 74 93 Double m_MAD; 94 #endif 75 95 Int m_numberOfPixel; 96 #if RATE_CONTROL_INTRA 97 Double m_costIntra; 98 Int m_targetBitsLeft; 99 #endif 76 100 }; 77 101 … … 89 113 90 114 public: 115 #if M0036_RC_IMPROVEMENT 116 Void create( Int totalFrames, Int targetBitrate, Int frameRate, Int GOPSize, Int picWidth, Int picHeight, Int LCUWidth, Int LCUHeight, Int numberOfLevel, Bool useLCUSeparateModel, Int adaptiveBit ); 117 #else 91 118 Void create( Int totalFrames, Int targetBitrate, Int frameRate, Int GOPSize, Int picWidth, Int picHeight, Int LCUWidth, Int LCUHeight, Int numberOfLevel, Bool useLCUSeparateModel ); 119 #endif 92 120 Void destroy(); 93 121 Void initBitsRatio( Int bitsRatio[] ); … … 96 124 Void initLCUPara( TRCParameter** LCUPara = NULL ); // NULL to initial with default value 97 125 Void updateAfterPic ( Int bits ); 126 #if !RATE_CONTROL_INTRA 98 127 Int getRefineBitsForIntra( Int orgBits ); 128 #endif 129 #if M0036_RC_IMPROVEMENT 130 Void setAllBitRatio( Double basicLambda, Double* equaCoeffA, Double* equaCoeffB ); 131 #endif 99 132 100 133 public: … … 134 167 Double getBetaUpdate() { return m_betaUpdate; } 135 168 169 #if M0036_RC_IMPROVEMENT 170 Int getAdaptiveBits() { return m_adaptiveBit; } 171 Double getLastLambda() { return m_lastLambda; } 172 Void setLastLambda( Double lamdba ) { m_lastLambda = lamdba; } 173 #endif 174 136 175 private: 137 176 Int m_totalFrames; … … 160 199 Double m_betaUpdate; 161 200 Bool m_useLCUSeparateModel; 201 202 #if M0036_RC_IMPROVEMENT 203 Int m_adaptiveBit; 204 Double m_lastLambda; 205 #endif 162 206 }; 163 207 … … 175 219 private: 176 220 Int xEstGOPTargetBits( TEncRCSeq* encRCSeq, Int GOPSize ); 221 #if M0036_RC_IMPROVEMENT 222 Void xCalEquaCoeff( TEncRCSeq* encRCSeq, Double* lambdaRatio, Double* equaCoeffA, Double* equaCoeffB, Int GOPSize ); 223 Double xSolveEqua( Double targetBpp, Double* equaCoeffA, Double* equaCoeffB, Int GOPSize ); 224 #endif 177 225 178 226 public: … … 203 251 Void destroy(); 204 252 253 #if !RATE_CONTROL_INTRA 205 254 Double estimatePicLambda( list<TEncRCPic*>& listPreviousPictures ); 255 #endif 206 256 Int estimatePicQP ( Double lambda, list<TEncRCPic*>& listPreviousPictures ); 257 #if RATE_CONTROL_INTRA 258 Int getRefineBitsForIntra(Int orgBits); 259 Double calculateLambdaIntra(double alpha, double beta, double MADPerPixel, double bitsPerPixel); 260 Double estimatePicLambda( list<TEncRCPic*>& listPreviousPictures, SliceType eSliceType); 261 262 Void updateAlphaBetaIntra(double *alpha, double *beta); 263 264 Double getLCUTargetBpp(SliceType eSliceType); 265 Double getLCUEstLambdaAndQP(Double bpp, Int clipPicQP, Int *estQP); 266 #else 207 267 Double getLCUTargetBpp(); 268 #endif 208 269 Double getLCUEstLambda( Double bpp ); 209 270 Int getLCUEstQP( Double lambda, Int clipPicQP ); 210 271 211 272 Void updateAfterLCU( Int LCUIdx, Int bits, Int QP, Double lambda, Bool updateLCUParameter = true ); 273 #if M0036_RC_IMPROVEMENT 274 #if RATE_CONTROL_INTRA 275 Void updateAfterPicture( Int actualHeaderBits, Int actualTotalBits, Double averageQP, Double averageLambda, SliceType eSliceType); 276 #else 277 Void updateAfterPicture( Int actualHeaderBits, Int actualTotalBits, Double averageQP, Double averageLambda ); 278 #endif 279 #else 212 280 Void updateAfterPicture( Int actualHeaderBits, Int actualTotalBits, Double averageQP, Double averageLambda, Double effectivePercentage ); 281 #endif 213 282 214 283 Void addToPictureLsit( list<TEncRCPic*>& listPreviousPictures ); 284 #if !M0036_RC_IMPROVEMENT 215 285 Double getEffectivePercentage(); 286 #endif 216 287 Double calAverageQP(); 217 288 Double calAverageLambda(); … … 229 300 Int getNumberOfLCU() { return m_numberOfLCU; } 230 301 Int getTargetBits() { return m_targetBits; } 302 #if !RATE_CONTROL_INTRA 231 303 Void setTargetBits( Int bits ) { m_targetBits = bits; } 304 #endif 232 305 Int getEstHeaderBits() { return m_estHeaderBits; } 233 306 Int getLCULeft() { return m_LCULeft; } … … 239 312 TRCLCU& getLCU( Int LCUIdx ) { return m_LCUs[LCUIdx]; } 240 313 Int getPicActualHeaderBits() { return m_picActualHeaderBits; } 314 #if !M0036_RC_IMPROVEMENT 241 315 Double getTotalMAD() { return m_totalMAD; } 242 316 Void setTotalMAD( Double MAD ) { m_totalMAD = MAD; } 317 #endif 318 #if RATE_CONTROL_INTRA 319 Void setTargetBits( Int bits ) { m_targetBits = bits; m_bitsLeft = bits;} 320 Void setTotalIntraCost(Double cost) { m_totalCostIntra = cost; } 321 Void getLCUInitTargetBits(); 322 #endif 323 243 324 Int getPicActualBits() { return m_picActualBits; } 244 325 Int getPicActualQP() { return m_picQP; } … … 267 348 TRCLCU* m_LCUs; 268 349 Int m_picActualHeaderBits; // only SH and potential APS 350 #if !M0036_RC_IMPROVEMENT 269 351 Double m_totalMAD; 352 #endif 353 #if RATE_CONTROL_INTRA 354 Double m_totalCostIntra; 355 Double m_remainingCostIntra; 356 #endif 270 357 Int m_picActualBits; // the whole picture, including header 271 358 Int m_picQP; // in integer form 272 359 Double m_picLambda; 360 #if !M0036_RC_IMPROVEMENT 273 361 TEncRCPic* m_lastPicture; 362 #endif 274 363 }; 275 364 … … 281 370 282 371 public: 372 #if M0036_RC_IMPROVEMENT 373 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] ); 374 #else 283 375 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] ); 376 #endif 284 377 Void destroy(); 285 378 Void initRCPic( Int frameLevel );
Note: See TracChangeset for help on using the changeset viewer.