[FFmpeg-devel] [PATCH 001/114] avcodec/bitstream: Add second function to create VLCs

Derek Buitenhuis derek.buitenhuis at gmail.com
Thu Nov 12 22:04:19 EET 2020


On 10/11/2020 10:46, Andreas Rheinhardt wrote:
>  
> +#define INIT_VLC_STATIC_FROM_LENGTHS(vlc, bits, nb_codes, lens, len_wrap,  \
> +                                     symbols, symbols_wrap, symbols_size,  \
> +                                     offset, flags, static_size)           \
> +    do {                                                                   \
> +        static VLC_TYPE table[static_size][2];                             \
> +        (vlc)->table           = table;                                    \
> +        (vlc)->table_allocated = static_size;                              \
> +        ff_init_vlc_from_lengths(vlc, bits, nb_codes, lens, len_wrap,      \
> +                                 symbols, symbols_wrap, symbols_size,      \
> +                                 offset, flags | INIT_VLC_USE_NEW_STATIC); \
> +    } while (0)

If I am reading correctly, wherever you add/use this, you are adding non-thread
safe global init code to a decoder. This is a huge step back and not acceptable.

It should be made to properly use ff_thread_once if possible, or reworked.

- Derek


More information about the ffmpeg-devel mailing list