Log in

View Full Version : time occupation for different frame type ?


palmman
25th July 2010, 15:10
Hi guys,

In order to know roughly time occupation for different frame type, I modified x264_slices_write to measure encoding time for each frame. But this result is a bit strange, time occupation in ascending order is I,B,P. In my knowledge, B should spend more time than P. Does someone know why is this result? Thanks a lot.

Sharktooth
25th July 2010, 15:24
coz b-frames are smaller than p-frames, that means less data and MV to be encoded (think at less data that needs to be motion estimated, deblocked, arithmetically coded (cabac), etc...).

palmman
25th July 2010, 19:07
coz b-frames are smaller than p-frames, that means less data and MV to be encoded (think at less data that needs to be motion estimated, deblocked, arithmetically coded (cabac), etc...).

Hi Sharktooth,

Thanks for your response. I am still confused. P-frame is smaller than I-frame, but encoding time for P-frame is longer than I-frame. My thought is as below. In terms of frame size, I-frame is the biggest, next is P-frame, B-frame is the smallest. In other words, B-frame's compressibility is the highest. That means B-frame needs more time for encoding.

Dark Shikari
25th July 2010, 20:03
but encoding time for P-frame is longer than I-frame.That's very encoder-dependent and settings-dependent. P-frames have more modes to check.

palmman
26th July 2010, 03:13
That's very encoder-dependent and settings-dependent. P-frames have more modes to check.

Hi Dark Shikari,

Got it, thanks for your response. Another question, what causes B-frames are smaller than P-frames?

Dark Shikari
26th July 2010, 03:34
Hi Dark Shikari,

Thanks for your response. I have another question. Motion estimation is the biggest time occupation in encoding processing. P-frame is forward prediction and B-frame is bi-directional prediction, theoretically B-frame should spend more time to encode. :confused:And yes, some encoders spend more time on B-frames. Smart ones, like x264, do early terminations that make them faster.

Sharktooth
26th July 2010, 03:45
Another question, what causes B-frames are smaller than P-frames?
a simple explanation: http://www.iptvdictionary.com/iptv_dictionary_MPEG_b-frame_definition.html

palmman
26th July 2010, 07:06
Hi Dark Shikari & Sharktooth,

Thanks for your help. I think I should get the way almost. Frame size and encoding time are causality. Because B-frames are bidirectional-frames, they offer more data compression capability, i.e. B-frames are smaller than P-frames. However B-frames need more time for motion estimation. Due to x264 is a smart encoder, do early terminations. Finally B-frames can spend less time than P-frame.

Sharktooth
26th July 2010, 14:22
x264 and any other "smart" encoder. early termination is an optimization.
however you got the point.