1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

Use defines instead of raw hex numbers to specify CRC polynomials

Originally committed as revision 10143 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
Reimar Döffinger 2007-08-19 12:36:15 +00:00
parent 4f48929248
commit 7b07d3e8fe
3 changed files with 14 additions and 7 deletions

View File

@ -1235,9 +1235,9 @@ static void init_crcs(void){
av_crc8005 = av_mallocz_static(sizeof(AVCRC) * 257); av_crc8005 = av_mallocz_static(sizeof(AVCRC) * 257);
av_crc07 = av_mallocz_static(sizeof(AVCRC) * 257); av_crc07 = av_mallocz_static(sizeof(AVCRC) * 257);
#endif #endif
av_crc_init(av_crc04C11DB7, 0, 32, 0x04c11db7, sizeof(AVCRC)*257); av_crc_init(av_crc04C11DB7, 0, 32, AV_CRC_32_IEEE, sizeof(AVCRC)*257);
av_crc_init(av_crc8005 , 0, 16, 0x8005 , sizeof(AVCRC)*257); av_crc_init(av_crc8005 , 0, 16, AV_CRC_16 , sizeof(AVCRC)*257);
av_crc_init(av_crc07 , 0, 8, 0x07 , sizeof(AVCRC)*257); av_crc_init(av_crc07 , 0, 8, AV_CRC_8_ATM , sizeof(AVCRC)*257);
} }
void avcodec_init(void) void avcodec_init(void)

View File

@ -94,10 +94,10 @@ uint32_t av_crc(const AVCRC *ctx, uint32_t crc, const uint8_t *buffer, size_t le
main(){ main(){
uint8_t buf[1999]; uint8_t buf[1999];
int i; int i;
int p[4][4]={{1, 32, 0xedb88320L, 0x3D5CDD04}, int p[4][4]={{1, 32, AV_CRC_32_IEEE_LE, 0x3D5CDD04},
{0, 32, 0x04c11db7L, 0xC0F5BAE0}, {0, 32, AV_CRC_32_IEEE , 0xC0F5BAE0},
{0, 16, 0x8005 , 0x1FBB }, {0, 16, AV_CRC_16 , 0x1FBB },
{0, 8, 0x07 , 0xE3 },}; {0, 8, AV_CRC_8_ATM , 0xE3 },};
AVCRC ctx[1 ? 1024:257]; AVCRC ctx[1 ? 1024:257];
for(i=0; i<sizeof(buf); i++) for(i=0; i<sizeof(buf); i++)

View File

@ -26,6 +26,13 @@
typedef uint32_t AVCRC; typedef uint32_t AVCRC;
#define AV_CRC_8_ATM 0x07
#define AV_CRC_16 0x8005
#define AV_CRC_16_CCITT 0x1021
#define AV_CRC_32_IEEE 0x04C11DB7L
//! reversed bitorder version of AV_CRC_32_IEEE
#define AV_CRC_32_IEEE_LE 0xEDB88320L
#if LIBAVUTIL_VERSION_INT < (50<<16) #if LIBAVUTIL_VERSION_INT < (50<<16)
extern AVCRC *av_crcEDB88320; extern AVCRC *av_crcEDB88320;
extern AVCRC *av_crc04C11DB7; extern AVCRC *av_crc04C11DB7;