[FFmpeg-devel] [PATCH 5/9] avcodec/vlc: Pass VLC_MULTI_ELEM directly not by pointer

Leo Izen leo.izen at gmail.com
Mon Oct 23 09:10:35 EEST 2023


On 10/22/23 17:51, Michael Niedermayer wrote:
> This makes the code more testable as uninitialized fields are 0
> and not random values from the last call
> 
> Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
> ---
>   libavcodec/vlc.c | 14 +++++++-------
>   1 file changed, 7 insertions(+), 7 deletions(-)
> 
> diff --git a/libavcodec/vlc.c b/libavcodec/vlc.c
> index 9b7a42f79a3..4adec2da705 100644
> --- a/libavcodec/vlc.c
> +++ b/libavcodec/vlc.c
> @@ -356,7 +356,7 @@ static void add_level(VLC_MULTI_ELEM *table, const int is16bit,
>                         uint32_t curcode, int curlen,
>                         int curlimit, int curlevel,
>                         const int minlen, const int max,
> -                      unsigned* levelcnt, VLC_MULTI_ELEM *info)
> +                      unsigned* levelcnt, VLC_MULTI_ELEM info)


Is passing a struct by value advisable? Did you benchmark this? How does 
it compare to memset(info, 0, sizeof(*info))?

- Leo Izen (Traneptora)



More information about the ffmpeg-devel mailing list