Add filler bits when frame bits < vbv target in strict-cbr
CBR模式下,vbv池子满的情况下,即缓冲区马上上溢的情况下,就不要往池子里填数据,填oxffff,这样解码器就不会解这些空数据。
--- a/source/encoder/frameencoder.cpp Fri Jan 20 16:44:03 2017 +0530
+++ b/source/encoder/frameencoder.cpp Fri Jan 20 10:27:41 2017 +0530
@@ -969,12 +969,29 @@ void FrameEncoder::compressFrame()
}
m_accessUnitBits = bytes << 3;
- m_endCompressTime = x265_mdate();
-
+ int filler = 0;
/* rateControlEnd may also block for earlier frames to call rateControlUpdateStats */
- if (m_top->m_rateControl->rateControlEnd(m_frame, m_accessUnitBits, &m_rce) < 0)
+ if (m_top->m_rateControl->rateControlEnd(m_frame, m_accessUnitBits, &m_rce, &filler) < 0)
m_top->m_aborted = true;
+ if (filler > 0)
+ {
+ filler = (filler - FILLER_OVERHEAD * 8) >> 3;
+ m_bs.resetBits();
+ while (filler > 0)
+ {
+ m_bs.write(0xff, 8);
+ filler--;
+ }
+ m_bs.writeByteAlignment();
+ m_nalList.serialize(NAL_UNIT_FILLER_DATA, m_bs);
+ byte