[FFmpeg-devel] [PATCH 06/10] lavc/hevc_ps/HEVCSPS: change flags into size-1 bitfields

Andreas Rheinhardt andreas.rheinhardt at outlook.com
Thu Apr 11 14:55:05 EEST 2024


Anton Khirnov:
> Reduces sizeof(HEVCSPS) by 96 bytes.
> 
> Also improve flag names: drop redundant suffixes and prefixes, and
> consistently use disabled/enabled.
> ---
>  libavcodec/dxva2_hevc.c        | 24 ++++-----
>  libavcodec/hevc_cabac.c        | 36 ++++++-------
>  libavcodec/hevc_filter.c       |  8 +--
>  libavcodec/hevc_parser.c       |  2 +-
>  libavcodec/hevc_ps.c           | 95 +++++++++++++++++-----------------
>  libavcodec/hevc_ps.h           | 62 +++++++++++-----------
>  libavcodec/hevcdec.c           | 10 ++--
>  libavcodec/hevcpred_template.c |  4 +-
>  libavcodec/mips/hevcpred_msa.c |  6 +--
>  libavcodec/nvdec_hevc.c        | 42 +++++++--------
>  libavcodec/qsvenc_hevc.c       |  2 +-
>  libavcodec/vaapi_hevc.c        | 42 +++++++--------
>  libavcodec/vdpau_hevc.c        | 36 ++++++-------
>  libavcodec/vulkan_hevc.c       | 56 ++++++++++----------
>  14 files changed, 212 insertions(+), 213 deletions(-)
> 

Making this a bitfield is not worth it. It will necessitate masking
operations on every access to these fields which may increase the size
of .text by more than 96B; it may even be that this more than offsets
the savings of 96B from using a bitfield.

- Andreas



More information about the ffmpeg-devel mailing list