[Libav-user] h264,h265: maximum referenced frames vs. GOP size

Heiner Mueller ffmpeg at mxwendler.net
Thu Sep 10 21:11:52 CEST 2015


Hi All,

i found this in the DXVA code, and i would like to optimize it a bit:
('s' is AVCodecContext* .. )

----------------

/* add surfaces based on number of possible refs */
if (s->codec_id == AV_CODEC_ID_H264 || s->codec_id == AV_CODEC_ID_HEVC)
ctx->num_surfaces += 16;

-----------------

Would it be correct to say

-----------------

if (s->codec_id == AV_CODEC_ID_H264 || s->codec_id == AV_CODEC_ID_HEVC)
ctx->num_surfaces += min( 16, s->gop_size );

-----------------

In some situations this can save memory, when the GOP size
is lower than 16. I assume there cannot be more pictures
referenced than GOP size, since GOP is defined to be completely
self-dependent?

Thank you,
Heiner



_______________________________________________
Libav-user mailing list
Libav-user at ffmpeg.org
http://ffmpeg.org/mailman/listinfo/libav-user


More information about the Libav-user mailing list