x265: Why do P and B frames have different encoding time?

2k Views Asked by At

I'm using x265 encoder for HEVC.

I have 3 different configurations. Have

  1. 4 B frames (B4)
  2. 2 B frames (B2)
  3. 0 B frames (B0 - all P frames)

Their encoding times are different.

B4 and B2 need much less encoding time than B0 that contains only P frames. Do you have any idea why?

Both P and B frames have equal QP using parameter --pbratio 1.0.

You can see the three different output files here using QP 36: B4, B2 and B0.

2

There are 2 best solutions below

0
On

With the development of HEVC, B frames became more popular for general use and basically replaced P frames in all use cases.

My expectation is simply that the x265 developers just spend more time and effort on optimizing the fast coding algorithms of B pictures, because these are used in the default configuration.

Although HM uses some shortcuts, the encoding time basically increases linearly with the number of reference pictures.

2
On

You could argue that encoding B-frames is simpler because interpolating is simpler then extrapolating (as in the case of P-frames). Interpolating tends to give smaller errors then extrapolating, which reduces the amount of bits that needs to be encoded.

enter image description here

As for the results using the HM 15.0 reference software, this is reference software so performance is not the main priority. Quote from the HM software manual:

It is not meant to be a particularly efficient implementation of anything, and one may notice its apparent unsuitability for a particular use.