Nicolas George: > Andreas Rheinhardt (12021-08-04): >> Reordering max_lowres is an ABI break. >> >> Signed-off-by: Andreas Rheinhardt <andreas.rheinha...@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. > It is about more than just padding; I'd like to see elements that belong together to be together in the structure (like a pointer and a size field, even if the size field is only four bytes); and commonly used elements should be at the front. This makes it easier for API users to get to the important points, it is better for cache locality and it also means that one can sometimes use a smaller instruction in pointer + offset addressing. E.g. on x86 offsets up to 128B need only one byte to encode. Moving caps_internal (the most commonly used of the private fields) to the front of the private part therefore resulted in savings of 48B for me (tiny (actually negligible), I know, but this is already enough to show that ordering everything by decreasing size is not everything).
- Andreas _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".