[FFmpeg-devel] [PATCH 3/4] avcodec/codec: Reorder elements to make AVCodec smaller

Hendrik Leppkes h.leppkes at gmail.com
Wed Aug 4 19:45:52 EEST 2021


On Wed, Aug 4, 2021 at 6:36 PM Nicolas George <george at nsup.org> wrote:
>
> Andreas Rheinhardt (12021-08-04):
> > Reordering max_lowres is an ABI break.
> >
> > Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at outlook.com>
> > ---
> >  libavcodec/codec.h | 13 +++++++------
> >  1 file changed, 7 insertions(+), 6 deletions(-)
>
> If it breaks API, then I would rather see it done properly rather than
> fortuitously: move capabilities and max_lowres after all the pointers.
>
> For reference, the robust way of avoiding padding in structures is to
> order fields by decreasing size. Since the public part of AVCodec
> changes rarely, once it is done, it should mostly hold.
>

This seems rather drastic for a change with barely any noticeable
improvement. I would rather see elements properly grouped by their
semantics as makes sense, rather than arbitrarily by size.
Related elements appearing together in the header is overall a more
important part for readability of the headers, then a few bytes saved.

- Hendrik


More information about the ffmpeg-devel mailing list