[FFmpeg-devel] [PATCH] avutil/crc: always use precalculated CRC tables for known polynomials
jamrial at gmail.com
Sun Oct 22 16:11:48 EEST 2017
On 10/22/2017 10:08 AM, Derek Buitenhuis wrote:
> On 10/22/2017 2:03 PM, James Almer wrote:
>> This prevents data races in av_crc_get_table()
>> Signed-off-by: James Almer <jamrial at gmail.com>
>> libavutil/Makefile | 1 +
>> libavutil/crc.c | 295 +-------------
>> libavutil/crc_tables.c | 1030 ++++++++++++++++++++++++++++++++++++++++++++++++
>> libavutil/crc_tables.h | 33 ++
>> 4 files changed, 1066 insertions(+), 293 deletions(-)
>> create mode 100644 libavutil/crc_tables.c
>> create mode 100644 libavutil/crc_tables.h
> Can this be generated at init, or lazily, using ff_thread_once instead of
> hardcoding huge tables?
> - Derek
It was suggested, but nobody gave it a try (Or they did but found it
wasn't as simple as first thought?).
Thread sanitizer complains about this in every other run, and the tables
are at most 1k each, so this is not a bad solution and can be replaced
by ff_thread_once in the future.
More information about the ffmpeg-devel