[x264-devel] one question about calculate_durations()

BugMaster BugMaster at narod.ru
Fri Jan 17 21:44:43 CET 2020


On Wed, 15 Jan 2020 17:21:46 +0800 (CST), qw wrote:
> Hi,

> I read x264 source code, and have one question:

> https://code.videolan.org/videolan/x264/blob/master/encoder/slicetype.c#L1203

> in the function of calculate_durations(), if
> cur_frame->i_dpb_output_delay < 0, cur_frame->i_dpb_output_delay is
> set to 0, and previous frame's i_cpb_duration is adjusted via
> 'prev_frame->i_cpb_duration+=cur_frame->i_dpb_output_delay'.

> Before previous frame's i_cpb_duration is adjusted,
> cur_frame->i_dpb_output_delay is set to 0. Therefore, I think, there
> is no need adjusting prev_frame->i_cpb_duration like
> 'prev_frame->i_cpb_duration += cur_frame->i_dpb_output_delay'.

> Is that right?

> Thanks!

> Regards

> Andrew

Hi.

Yes, that code looks strange (to adjust prev_frame->i_cpb_duration by
zero value). May be it is supposed to adjust it before zeroing
cur_frame->i_dpb_output_delay but I can't be sure and need to look at
the specs or ask authors of this patch:
https://code.videolan.org/videolan/x264/commit/bb9b16b4722a1273885367f13f448516efe47ed1



More information about the x264-devel mailing list