19 #ifndef AVUTIL_AARCH64_CRC_H
20 #define AVUTIL_AARCH64_CRC_H
36 uint32_t ff_crc32_aarch64(
const AVCRC *
ctx, uint32_t crc,
const uint8_t *
buffer,
41 #if HAVE_PMULL && HAVE_EOR3
45 uint32_t ff_crc_neon_pmull(
const AVCRC *
ctx, uint32_t crc,
const uint8_t *
buffer,
47 uint32_t ff_crc_le_neon_pmull(
const AVCRC *
ctx, uint32_t crc,
const uint8_t *
buffer,
61 0xbc000000, 0x0, 0x32000000, 0x0,
62 0x94000000, 0x0, 0xc4000000, 0x0,
63 0x62000000, 0x0, 0x79000000, 0x0,
64 0x07156a16, 0x1, 0x07000000, 0x1,
68 0xf3000000, 0x0, 0xb5000000, 0x0,
69 0x0d000000, 0x0, 0xfc000000, 0x0,
70 0x6a000000, 0x0, 0x65000000, 0x0,
71 0x1c4b8192, 0x1, 0x1d000000, 0x1,
75 0x807d0000, 0x0, 0xf9e30000, 0x0,
76 0xff830000, 0x0, 0xf9130000, 0x0,
77 0x807b0000, 0x0, 0x86630000, 0x0,
78 0xfffbffe7, 0x1, 0x80050000, 0x1,
82 0x59b00000, 0x0, 0x60190000, 0x0,
83 0x45630000, 0x0, 0xd5f60000, 0x0,
84 0xaa510000, 0x0, 0xeb230000, 0x0,
85 0x11303471, 0x1, 0x10210000, 0x1,
89 0x467d2400, 0x0, 0x1f428700, 0x0,
90 0x64e4d700, 0x0, 0x2c8c9d00, 0x0,
91 0xd9fe8c00, 0x0, 0xfd7e0c00, 0x0,
92 0xf845fe24, 0x1, 0x864cfb00, 0x1,
96 0xe6228b11, 0x0, 0x8833794c, 0x0,
97 0xe8a45605, 0x0, 0xc5b9cd4c, 0x0,
98 0x490d678d, 0x0, 0xf200aa66, 0x0,
99 0x04d101df, 0x1, 0x04c11db7, 0x1,
103 0x54442bd4, 0x1, 0xc6e41596, 0x1,
104 0x751997d0, 0x1, 0xccaa009e, 0x0,
105 0xccaa009e, 0x0, 0x63cd6124, 0x1,
106 0xf7011640, 0x1, 0xdb710641, 0x1,
110 0x1b0c2, 0x0, 0x0000bffa, 0x0,
111 0x1d0c2, 0x0, 0x00018cc2, 0x0,
112 0x00018cc2, 0x0, 0x1bc02, 0x0,
113 0xcfffbffe, 0x1, 0x14003, 0x0,
118 static inline void crc_init_aarch64(
AVCRC *
ctx,
int le,
int bits, uint32_t poly,
int ctx_size)
126 poly_ = ((uint64_t)poly) << (32 -
bits);
129 uint8_t *
dst = (uint8_t*)(
ctx + 1);
134 uint64_t
tmp =
xnmodp(128 - 32, poly_, 32, &div, le);
156 uint32_t ff_crc32_pmull_eor3_aarch64(
const AVCRC *
ctx, uint32_t crc,
const uint8_t *
buffer,
159 static const AVCRC crc_table_crc32_pmull[] = {
161 0x26b70c3d, 0x0, 0x3f41287a, 0x0,
162 0xae689191, 0x0, 0xccaa009e, 0x0,
163 0xf1da05aa, 0x0, 0x81256527, 0x0,
164 0x8f352d95, 0x0, 0x1d9513d7, 0x0,
165 0x54442bd4, 0x1, 0xc6e41596, 0x1,
166 0x751997d0, 0x1, 0xccaa009e, 0x0,
167 0xccaa009e, 0x0, 0x63cd6124, 0x1,
168 0xf7011640, 0x1, 0xdb710641, 0x1,
175 #if HAVE_PMULL && HAVE_EOR3
179 crc_init_aarch64(
ctx, le,
bits, poly, ctx_size);
187 const uint8_t *
buffer,
size_t length)
190 #if HAVE_PMULL && HAVE_EOR3
192 case CRC32_PMULL_LE:
return ff_crc32_pmull_eor3_aarch64(
ctx, crc,
buffer, length);
194 case PMULL_BE:
return ff_crc_neon_pmull(
ctx, crc,
buffer, length);
195 case PMULL_LE:
return ff_crc_le_neon_pmull(
ctx, crc,
buffer, length);
200 default:
av_unreachable(
"AARCH64 has PMULL_LE, PMULL_BE, CRC32_PMULL_LE, and AV_CRC_32_IEEE_LE arch-specific CRC code");
208 #if HAVE_PMULL && HAVE_EOR3
212 return crc_table_crc32_pmull;
215 return crc_table_pmull[crc_id];
219 static const AVCRC crc32_ieee_le_ctx[] = {
227 return crc32_ieee_le_ctx;