[x264-devel] Need help to understand a piece of code
BugMaster
BugMaster at narod.ru
Mon Feb 1 19:39:36 UTC 2021
On Mon, 1 Feb 2021 23:04:12 +0800, Lingjiang Fang wrote:
> The code below puzzled me for a long time, can any give an explanation
> for it ?
> ...
> I think this code want to solve the vbv overflow after
> the current miniGOP, space is the predicted overflow size if there is
> no consumption.
> But if we discard the cost of bbits, it means we tend
> to decrease q and leak more bits from vbv buffer, won't it leads to vbv
> underflow?
Hi. By discard of the bbits do you mean this part?
if( bbits * nb > bframe_cpb_duration * rcc->vbv_max_rate )
nb = 0;
Yes, this part looks incorrect and was broken in:
https://code.videolan.org/videolan/x264/-/commit/bb9b16b4722a1273885367f13f448516efe47ed1#2774abc5b23616ba88d9b08fa263902575a84d75_1714_1865
It zeros B-frame bits in pbbits but doesn't zeros their duration in
minigop_cpb_duration. Here is patch to fix it:
https://code.videolan.org/BugMaster/x264/-/commit/a7e2c6ab8ff884e90f47a03258756fb0ad9f2e06
More information about the x264-devel
mailing list