[FFmpeg-devel] [PATCH 4/7] avcodec/codec_internal: Use union for FFCodec decode/encode callbacks

Andreas Rheinhardt andreas.rheinhardt at outlook.com
Tue May 3 16:44:55 EEST 2022


Michael Niedermayer:
> On Thu, Mar 31, 2022 at 12:49:55AM +0200, Andreas Rheinhardt wrote:
>> This is possible, because every given FFCodec has to implement
>> exactly one of these. Doing so decreases sizeof(FFCodec) and
>> therefore decreases the size of the binary.
>> Notice that in case of position-independent code the decrease
>> is in .data.rel.ro, so that this translates to decreased
>> memory consumption.
> 
> by how much did the space requirement decrease ?

The three patches fb59a42ef, ce7dbd048 and 4243da4ff4 together removed
four pointers from FFCodec; on 64 bit systems this amounts to savings of
32 byte per FFCodec. allcodecs.c contains 796 declarations of FFCodecs,
amounting to savings of at most 25472B. (This number is not attainable
because some codecs are only available for certain platforms.)
I get 488 decoders and 182 encoders in a build without any external
libraries explicitly enabled, leading to savings of 21440B.

> iam asking because while a single such change isnt a issue
> if we accumulate alot of this in the API, the API may become
> actually hard to understand by new developers


More information about the ffmpeg-devel mailing list