21#ifndef AVUTIL_X86_CRC_H
22#define AVUTIL_X86_CRC_H
33#if HAVE_CLMUL_EXTERNAL
37uint32_t ff_crc_clmul(
const AVCRC *
ctx, uint32_t crc,
38 const uint8_t *
buffer,
size_t length);
39uint32_t ff_crc_le_clmul(
const AVCRC *
ctx, uint32_t crc,
40 const uint8_t *
buffer,
size_t length);
52 0x32000000, 0x0, 0xbc000000, 0x0,
53 0xc4000000, 0x0, 0x94000000, 0x0,
54 0x62000000, 0x0, 0x79000000, 0x0,
55 0x07156a16, 0x1, 0x07000000, 0x1,
59 0xb5000000, 0x0, 0xf3000000, 0x0,
60 0xfc000000, 0x0, 0x0d000000, 0x0,
61 0x6a000000, 0x0, 0x65000000, 0x0,
62 0x1c4b8192, 0x1, 0x1d000000, 0x1,
66 0xf9e30000, 0x0, 0x807d0000, 0x0,
67 0xf9130000, 0x0, 0xff830000, 0x0,
68 0x807b0000, 0x0, 0x86630000, 0x0,
69 0xfffbffe7, 0x1, 0x80050000, 0x1,
73 0x60190000, 0x0, 0x59b00000, 0x0,
74 0xd5f60000, 0x0, 0x45630000, 0x0,
75 0xaa510000, 0x0, 0xeb230000, 0x0,
76 0x11303471, 0x1, 0x10210000, 0x1,
80 0x1f428700, 0x0, 0x467d2400, 0x0,
81 0x2c8c9d00, 0x0, 0x64e4d700, 0x0,
82 0xd9fe8c00, 0x0, 0xfd7e0c00, 0x0,
83 0xf845fe24, 0x1, 0x864cfb00, 0x1,
87 0x8833794c, 0x0, 0xe6228b11, 0x0,
88 0xc5b9cd4c, 0x0, 0xe8a45605, 0x0,
89 0x490d678d, 0x0, 0xf200aa66, 0x0,
90 0x04d101df, 0x1, 0x04c11db7, 0x1,
94 0xc6e41596, 0x1, 0x54442bd4, 0x1,
95 0xccaa009e, 0x0, 0x751997d0, 0x1,
96 0xccaa009e, 0x0, 0x63cd6124, 0x1,
97 0xf7011640, 0x1, 0xdb710641, 0x1,
101 0x0000bffa, 0x0, 0x1b0c2, 0x0,
102 0x00018cc2, 0x0, 0x1d0c2, 0x0,
103 0x00018cc2, 0x0, 0x1bc02, 0x0,
104 0xcfffbffe, 0x1, 0x14003, 0x0,
108static inline void crc_init_x86(
AVCRC *
ctx,
int le,
int bits, uint32_t poly,
int ctx_size)
116 poly_ = ((uint64_t)poly) << (32 -
bits);
119 uint8_t *
dst = (uint8_t*)(
ctx + 1);
124 uint64_t
tmp =
xnmodp(128 - 32, poly_, 32, &div, le);
147#if HAVE_CLMUL_EXTERNAL
151 return crc_table_clmul[crc_id];
159#if HAVE_CLMUL_EXTERNAL
163 crc_init_x86(
ctx, le,
bits, poly, ctx_size);
171 const uint8_t *
buffer,
size_t length)
174#if HAVE_CLMUL_EXTERNAL
175 case CLMUL_BE:
return ff_crc_clmul(
ctx, crc,
buffer, length);
176 case CLMUL_LE:
return ff_crc_le_clmul(
ctx, crc,
buffer, length);
178 default:
av_unreachable(
"x86 CRC only uses CLMUL_BE and CLMUL_LE");
uint8_t ptrdiff_t const uint8_t ptrdiff_t int intptr_t intptr_t int int16_t * dst
static AVFormatContext * ctx
#define FF_VISIBILITY_PUSH_HIDDEN
#define FF_VISIBILITY_POP_HIDDEN
simple assert() macros that are a bit more flexible than ISO C assert().
#define av_unreachable(msg)
Asserts that are used as compiler optimization hints depending upon ASSERT_LEVEL and NBDEBUG.
Public header for CRC hash function implementation.
static av_unused uint64_t xnmodp(unsigned n, uint64_t poly, unsigned deg, uint64_t *div, int bitreverse)
static uint64_t reverse(uint64_t p, unsigned int deg)
static const uint8_t bits[8]
Macro definitions for various function/variable attributes.
static atomic_int cpu_flags
int av_get_cpu_flags(void)
Return the flags which specify extensions supported by the CPU.
#define EXTERNAL_CLMUL(flags)
static const AVCRC * ff_crc_get_table_x86(AVCRCId crc_id)
static uint32_t ff_crc_x86(const AVCRC *ctx, uint32_t crc, const uint8_t *buffer, size_t length)
static av_cold int ff_crc_init_x86(AVCRC *ctx, int le, int bits, uint32_t poly, int ctx_size)