Revision 45e3c163
libavutil/crc.c  

37  37 
* Inits a crc table. 
38  38 
* @param ctx must be an array of sizeof(AVCRC)*257 or sizeof(AVCRC)*1024 
39  39 
* @param cts_size size of ctx in bytes 
40 
* @param le if 1, lowest bit represents coefficient for highest exponent 

41 
* of corresponding polynomial (both for poly and actual CRC). 

42 
* If 0, you must swap the crc parameter and the result of av_crc 

43 
* if you need the standard representation (can be simplified in 

44 
* most cases to e.g. bswap16): 

45 
* bswap_32(crc << (32bits)) 

46 
* @param bits number of bits for the CRC 

47 
* @param poly generator polynomial without the x**bits coefficient, in the 

48 
* representation as specified by le 

40  49 
* @return <0 on failure 
41  50 
*/ 
42  51 
int av_crc_init(AVCRC *ctx, int le, int bits, uint32_t poly, int ctx_size){ 
...  ...  
70  79 
return 0; 
71  80 
} 
72  81  
82 
/** 

83 
* Calculate the CRC of a block 

84 
* @param crc CRC of previous blocks if any or initial value for CRC. 

85 
* @return CRC updated with the data from the given block 

86 
* 

87 
* @see av_crc_init() "le" parameter 

88 
*/ 

73  89 
uint32_t av_crc(const AVCRC *ctx, uint32_t crc, const uint8_t *buffer, size_t length){ 
74  90 
const uint8_t *end= buffer+length; 
75  91 
Also available in: Unified diff