Changeset 1537 in SHVCSoftware


Ignore:
Timestamp:
22 Mar 2016, 22:51:23 (9 years ago)
Author:
seregin
Message:

port rev 4689

Location:
branches/SHM-dev/source/Lib
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • branches/SHM-dev/source/Lib/TLibCommon/TypeDef.h

    r1534 r1537  
    205205
    206206#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
    207210
    208211// ====================================================================================================================
  • branches/SHM-dev/source/Lib/TLibDecoder/TDecGop.cpp

    r1502 r1537  
    8282}
    8383
     84
    8485Void TDecGop::destroy()
    8586{
  • branches/SHM-dev/source/Lib/TLibEncoder/TEncGOP.cpp

    r1534 r1537  
    23042304        estimatedCpbFullness -= m_pcRateCtrl->getBufferingRate();
    23052305        // 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
    23062312        if (estimatedCpbFullness - estimatedBits < (Int)(m_pcRateCtrl->getCpbSize()*0.1f))
    23072313        {
    23082314          estimatedBits = max(200, estimatedCpbFullness - (Int)(m_pcRateCtrl->getCpbSize()*0.1f));
    23092315        }
     2316#endif
    23102317
    23112318        m_pcRateCtrl->getRCPic()->setTargetBits(estimatedBits);
     
    23502357            estimatedCpbFullness -= m_pcRateCtrl->getBufferingRate();
    23512358            // 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
    23522365            if (estimatedCpbFullness - bits < (Int)(m_pcRateCtrl->getCpbSize()*0.1f))
    23532366            {
    23542367              bits = estimatedCpbFullness - (Int)(m_pcRateCtrl->getCpbSize()*0.1f);
    23552368            }
     2369#endif
    23562370          }
    23572371#endif
  • branches/SHM-dev/source/Lib/TLibEncoder/TEncRateCtrl.cpp

    r1433 r1537  
    546546}
    547547
     548#if V0078_ADAPTIVE_LOWER_BOUND
     549Int 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
    548588Void TEncRCPic::addToPictureLsit( list<TEncRCPic*>& listPreviousPictures )
    549589{
     
    586626  Int picWidthInLCU  = ( picWidth  % LCUWidth  ) == 0 ? picWidth  / LCUWidth  : picWidth  / LCUWidth  + 1;
    587627  Int picHeightInLCU = ( picHeight % LCUHeight ) == 0 ? picHeight / LCUHeight : picHeight / LCUHeight + 1;
     628#if V0078_ADAPTIVE_LOWER_BOUND
     629  m_lowerBound       = xEstPicLowerBound( encRCSeq, encRCGOP );
     630#endif
    588631
    589632  m_LCULeft         = m_numberOfLCU;
  • branches/SHM-dev/source/Lib/TLibEncoder/TEncRateCtrl.h

    r1433 r1537  
    247247  Int xEstPicTargetBits( TEncRCSeq* encRCSeq, TEncRCGOP* encRCGOP );
    248248  Int xEstPicHeaderBits( list<TEncRCPic*>& listPreviousPictures, Int frameLevel );
     249#if V0078_ADAPTIVE_LOWER_BOUND
     250  Int xEstPicLowerBound( TEncRCSeq* encRCSeq, TEncRCGOP* encRCGOP );
     251#endif
    249252
    250253public:
     
    262265  Int  getBitsCoded()                                     { return m_targetBits - m_estHeaderBits - m_bitsLeft; }
    263266  Int  getLCUCoded()                                      { return m_numberOfLCU - m_LCULeft; }
     267#if V0078_ADAPTIVE_LOWER_BOUND
     268  Int  getLowerBound()                                    { return m_lowerBound; }
     269#endif
    264270  TRCLCU* getLCU()                                        { return m_LCUs; }
    265271  TRCLCU& getLCU( Int LCUIdx )                            { return m_LCUs[LCUIdx]; }
     
    290296  Int m_estHeaderBits;
    291297  Int m_estPicQP;
     298#if V0078_ADAPTIVE_LOWER_BOUND
     299  Int m_lowerBound;
     300#endif
    292301  Double m_estPicLambda;
    293302
Note: See TracChangeset for help on using the changeset viewer.