36
36
AV_CRC_MAX, /*< Not part of public API! Do not use outside libavutil. */
40
* Initialize a CRC table.
41
* @param ctx must be an array of size sizeof(AVCRC)*257 or sizeof(AVCRC)*1024
42
* @param le If 1, the lowest bit represents the coefficient for the highest
43
* exponent of the corresponding polynomial (both for poly and
45
* If 0, you must swap the CRC parameter and the result of av_crc
46
* if you need the standard representation (can be simplified in
47
* most cases to e.g. bswap16):
48
* av_bswap32(crc << (32-bits))
49
* @param bits number of bits for the CRC
50
* @param poly generator polynomial without the x**bits coefficient, in the
51
* representation as specified by le
52
* @param ctx_size size of ctx in bytes
53
* @return <0 on failure
39
55
int av_crc_init(AVCRC *ctx, int le, int bits, uint32_t poly, int ctx_size);
58
* Get an initialized standard CRC table.
59
* @param crc_id ID of a standard CRC
60
* @return a pointer to the CRC table or NULL on failure
40
62
const AVCRC *av_crc_get_table(AVCRCId crc_id);
41
uint32_t av_crc(const AVCRC *ctx, uint32_t start_crc, const uint8_t *buffer, size_t length) av_pure;
65
* Calculate the CRC of a block.
66
* @param crc CRC of previous blocks if any or initial value for CRC
67
* @return CRC updated with the data from the given block
69
* @see av_crc_init() "le" parameter
71
uint32_t av_crc(const AVCRC *ctx, uint32_t crc,
72
const uint8_t *buffer, size_t length) av_pure;
43
74
#endif /* AVUTIL_CRC_H */