Mercurial > libavutil.hg
comparison crc.h @ 420:40ef1f81f445 libavutil
improve CRC API
- don't export any global var
- provide either generated or hardcoded tables
author | aurel |
---|---|
date | Fri, 04 Jan 2008 23:09:58 +0000 |
parents | d0f3bb6e367e |
children | 0e6deb0081fd |
comparison
equal
deleted
inserted
replaced
419:290f5853797a | 420:40ef1f81f445 |
---|---|
24 #include <stdint.h> | 24 #include <stdint.h> |
25 #include <sys/types.h> | 25 #include <sys/types.h> |
26 | 26 |
27 typedef uint32_t AVCRC; | 27 typedef uint32_t AVCRC; |
28 | 28 |
29 #define AV_CRC_8_ATM 0x07 | 29 typedef enum { |
30 #define AV_CRC_16 0x8005 | 30 AV_CRC_8_ATM, |
31 #define AV_CRC_16_CCITT 0x1021 | 31 AV_CRC_16_ANSI, |
32 #define AV_CRC_32_IEEE 0x04C11DB7L | 32 AV_CRC_16_CCITT, |
33 //! reversed bitorder version of AV_CRC_32_IEEE | 33 AV_CRC_32_IEEE, |
34 #define AV_CRC_32_IEEE_LE 0xEDB88320L | 34 AV_CRC_32_IEEE_LE, /*< reversed bitorder version of AV_CRC_32_IEEE */ |
35 | 35 AV_CRC_MAX, /*< not part of public API! don't use outside lavu */ |
36 #if LIBAVUTIL_VERSION_INT < (50<<16) | 36 }AVCRCId; |
37 extern AVCRC *av_crcEDB88320; | |
38 extern AVCRC *av_crc04C11DB7; | |
39 extern AVCRC *av_crc8005 ; | |
40 extern AVCRC *av_crc07 ; | |
41 #else | |
42 extern AVCRC av_crcEDB88320[]; | |
43 extern AVCRC av_crc04C11DB7[]; | |
44 extern AVCRC av_crc8005 []; | |
45 extern AVCRC av_crc07 []; | |
46 #endif | |
47 | 37 |
48 int av_crc_init(AVCRC *ctx, int le, int bits, uint32_t poly, int ctx_size); | 38 int av_crc_init(AVCRC *ctx, int le, int bits, uint32_t poly, int ctx_size); |
39 const AVCRC *av_crc_get_table(AVCRCId crc_id); | |
49 uint32_t av_crc(const AVCRC *ctx, uint32_t start_crc, const uint8_t *buffer, size_t length); | 40 uint32_t av_crc(const AVCRC *ctx, uint32_t start_crc, const uint8_t *buffer, size_t length); |
50 | 41 |
51 #endif /* FFMPEG_CRC_H */ | 42 #endif /* FFMPEG_CRC_H */ |
52 | 43 |