Changeset 1537 in SHVCSoftware
- Timestamp:
- 22 Mar 2016, 22:51:23 (9 years ago)
- Location:
- branches/SHM-dev/source/Lib
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/SHM-dev/source/Lib/TLibCommon/TypeDef.h
r1534 r1537 205 205 206 206 #define U0132_TARGET_BITS_SATURATION 1 ///< Rate control with target bits saturation method 207 #ifdef U0132_TARGET_BITS_SATURATION 208 #define V0078_ADAPTIVE_LOWER_BOUND 1 ///< Target bits saturation with adaptive lower bound 209 #endif 207 210 208 211 // ==================================================================================================================== -
branches/SHM-dev/source/Lib/TLibDecoder/TDecGop.cpp
r1502 r1537 82 82 } 83 83 84 84 85 Void TDecGop::destroy() 85 86 { -
branches/SHM-dev/source/Lib/TLibEncoder/TEncGOP.cpp
r1534 r1537 2304 2304 estimatedCpbFullness -= m_pcRateCtrl->getBufferingRate(); 2305 2305 // prevent underflow 2306 #if V0078_ADAPTIVE_LOWER_BOUND 2307 if (estimatedCpbFullness - estimatedBits < m_pcRateCtrl->getRCPic()->getLowerBound()) 2308 { 2309 estimatedBits = max(200, estimatedCpbFullness - m_pcRateCtrl->getRCPic()->getLowerBound()); 2310 } 2311 #else 2306 2312 if (estimatedCpbFullness - estimatedBits < (Int)(m_pcRateCtrl->getCpbSize()*0.1f)) 2307 2313 { 2308 2314 estimatedBits = max(200, estimatedCpbFullness - (Int)(m_pcRateCtrl->getCpbSize()*0.1f)); 2309 2315 } 2316 #endif 2310 2317 2311 2318 m_pcRateCtrl->getRCPic()->setTargetBits(estimatedBits); … … 2350 2357 estimatedCpbFullness -= m_pcRateCtrl->getBufferingRate(); 2351 2358 // prevent underflow 2359 #if V0078_ADAPTIVE_LOWER_BOUND 2360 if (estimatedCpbFullness - bits < m_pcRateCtrl->getRCPic()->getLowerBound()) 2361 { 2362 bits = estimatedCpbFullness - m_pcRateCtrl->getRCPic()->getLowerBound(); 2363 } 2364 #else 2352 2365 if (estimatedCpbFullness - bits < (Int)(m_pcRateCtrl->getCpbSize()*0.1f)) 2353 2366 { 2354 2367 bits = estimatedCpbFullness - (Int)(m_pcRateCtrl->getCpbSize()*0.1f); 2355 2368 } 2369 #endif 2356 2370 } 2357 2371 #endif -
branches/SHM-dev/source/Lib/TLibEncoder/TEncRateCtrl.cpp
r1433 r1537 546 546 } 547 547 548 #if V0078_ADAPTIVE_LOWER_BOUND 549 Int TEncRCPic::xEstPicLowerBound(TEncRCSeq* encRCSeq, TEncRCGOP* encRCGOP) 550 { 551 Int lowerBound = 0; 552 Int GOPbitsLeft = encRCGOP->getBitsLeft(); 553 554 const Int nextPicPosition = (encRCGOP->getNumPic() - encRCGOP->getPicLeft() + 1) % encRCGOP->getNumPic(); 555 const Int nextPicRatio = encRCSeq->getBitRatio(nextPicPosition); 556 557 Int totalPicRatio = 0; 558 for (Int i = nextPicPosition; i < encRCGOP->getNumPic(); i++) 559 { 560 totalPicRatio += encRCSeq->getBitRatio(i); 561 } 562 563 if (nextPicPosition == 0) 564 { 565 GOPbitsLeft = encRCGOP->getTargetBits(); 566 } 567 else 568 { 569 GOPbitsLeft -= m_targetBits; 570 } 571 572 lowerBound = Int(((Double)GOPbitsLeft) * nextPicRatio / totalPicRatio); 573 574 if (lowerBound < 100) 575 { 576 lowerBound = 100; // at least allocate 100 bits for one picture 577 } 578 579 if (m_encRCSeq->getFramesLeft() > 16) 580 { 581 lowerBound = Int(g_RCWeightPicRargetBitInBuffer * lowerBound + g_RCWeightPicTargetBitInGOP * m_encRCGOP->getTargetBitInGOP(nextPicPosition)); 582 } 583 584 return lowerBound; 585 } 586 #endif 587 548 588 Void TEncRCPic::addToPictureLsit( list<TEncRCPic*>& listPreviousPictures ) 549 589 { … … 586 626 Int picWidthInLCU = ( picWidth % LCUWidth ) == 0 ? picWidth / LCUWidth : picWidth / LCUWidth + 1; 587 627 Int picHeightInLCU = ( picHeight % LCUHeight ) == 0 ? picHeight / LCUHeight : picHeight / LCUHeight + 1; 628 #if V0078_ADAPTIVE_LOWER_BOUND 629 m_lowerBound = xEstPicLowerBound( encRCSeq, encRCGOP ); 630 #endif 588 631 589 632 m_LCULeft = m_numberOfLCU; -
branches/SHM-dev/source/Lib/TLibEncoder/TEncRateCtrl.h
r1433 r1537 247 247 Int xEstPicTargetBits( TEncRCSeq* encRCSeq, TEncRCGOP* encRCGOP ); 248 248 Int xEstPicHeaderBits( list<TEncRCPic*>& listPreviousPictures, Int frameLevel ); 249 #if V0078_ADAPTIVE_LOWER_BOUND 250 Int xEstPicLowerBound( TEncRCSeq* encRCSeq, TEncRCGOP* encRCGOP ); 251 #endif 249 252 250 253 public: … … 262 265 Int getBitsCoded() { return m_targetBits - m_estHeaderBits - m_bitsLeft; } 263 266 Int getLCUCoded() { return m_numberOfLCU - m_LCULeft; } 267 #if V0078_ADAPTIVE_LOWER_BOUND 268 Int getLowerBound() { return m_lowerBound; } 269 #endif 264 270 TRCLCU* getLCU() { return m_LCUs; } 265 271 TRCLCU& getLCU( Int LCUIdx ) { return m_LCUs[LCUIdx]; } … … 290 296 Int m_estHeaderBits; 291 297 Int m_estPicQP; 298 #if V0078_ADAPTIVE_LOWER_BOUND 299 Int m_lowerBound; 300 #endif 292 301 Double m_estPicLambda; 293 302
Note: See TracChangeset for help on using the changeset viewer.