comparison crc.c @ 377:c31bd8d4962f libavutil

Additional documentation for CRC functions
author reimar
date Mon, 20 Aug 2007 16:54:47 +0000
parents b1953daf424e
children f9a4c04ebb0e
comparison
equal deleted inserted replaced
376:b1953daf424e 377:c31bd8d4962f
35 35
36 /** 36 /**
37 * Inits a crc table. 37 * Inits a crc table.
38 * @param ctx must be an array of sizeof(AVCRC)*257 or sizeof(AVCRC)*1024 38 * @param ctx must be an array of sizeof(AVCRC)*257 or sizeof(AVCRC)*1024
39 * @param cts_size size of ctx in bytes 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 << (32-bits))
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 * @return <0 on failure 49 * @return <0 on failure
41 */ 50 */
42 int av_crc_init(AVCRC *ctx, int le, int bits, uint32_t poly, int ctx_size){ 51 int av_crc_init(AVCRC *ctx, int le, int bits, uint32_t poly, int ctx_size){
43 int i, j; 52 int i, j;
44 uint32_t c; 53 uint32_t c;
68 #endif 77 #endif
69 78
70 return 0; 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 uint32_t av_crc(const AVCRC *ctx, uint32_t crc, const uint8_t *buffer, size_t length){ 89 uint32_t av_crc(const AVCRC *ctx, uint32_t crc, const uint8_t *buffer, size_t length){
74 const uint8_t *end= buffer+length; 90 const uint8_t *end= buffer+length;
75 91
76 #ifndef CONFIG_SMALL 92 #ifndef CONFIG_SMALL
77 if(!ctx[256]) 93 if(!ctx[256])