Reference Frames in Video Codec

Poby’s Home
2 min readJul 24, 2021

# of reference frames in various video codecs

AVC

https://www.ibc.org/download?ac=14095

AVC allows up to 16 reference frames to be used, but in practice, it
is rare to use more than 5.

HEVC

From x265 manual https://x265.readthedocs.io/en/2.5/cli.html#cmdoption-ref

— ref <1..16>
Max number of L0 references to be allowed. This number has a linear multiplier effect on the amount of work performed in motion search, but will generally have a beneficial affect on compression and distortion.

Note that x265 allows up to 16 L0 references but the HEVC specification only allows a maximum of 8 total reference frames.
- if you have B frames enabled only 7 L0 refs are valid
- if you have — b-pyramid enabled (which is enabled by default in all presets), then only 6 L0 refs are the maximum allowed by the HEVC specification.
If x265 detects that the total reference count is greater than 8, it will issue a warning that the resulting stream is non-compliant and it signals the stream as profile NONE and level NONE and will abort the encode unless — allow-non-conformance it specified. Compliant HEVC decoders may refuse to decode such streams.

Default 3

VP9

https://www.cambridge.org/core/journals/apsipa-transactions-on-signal-and-information-processing/article/an-overview-of-coding-tools-in-av1-the-first-video-codec-from-the-alliance-for-open-media/5972E00494363BE37E3439FAE382DB10

In VP9, up to two references, amongst up to three candidate reference frames, are allowed

AV1

same link as VP9 above

AV1 extends the number of references for each frame to 7

Appendix

Hierarchical (Pyramidal) GOP structure

--

--