aboutsummaryrefslogtreecommitdiff
path: root/libavutil/crc.c
diff options
context:
space:
mode:
authorReimar Döffinger2007-08-20 16:54:47 +0000
committerReimar Döffinger2007-08-20 16:54:47 +0000
commit45e3c163a95cc006e6dceefef4fe7b720adf7f6e (patch)
treec4efdcf92ff44b0c0829ee745aca5ea491d0cb7d /libavutil/crc.c
parent6d1ba1ac836898b35b212f7687563cf0eef82c16 (diff)
Additional documentation for CRC functions
Originally committed as revision 10151 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavutil/crc.c')
-rw-r--r--libavutil/crc.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/libavutil/crc.c b/libavutil/crc.c
index b519ac43de..91257d2b8c 100644
--- a/libavutil/crc.c
+++ b/libavutil/crc.c
@@ -37,6 +37,15 @@ AVCRC av_crc07 [257];
* Inits a crc table.
* @param ctx must be an array of sizeof(AVCRC)*257 or sizeof(AVCRC)*1024
* @param cts_size size of ctx in bytes
+ * @param le if 1, lowest bit represents coefficient for highest exponent
+ * of corresponding polynomial (both for poly and actual CRC).
+ * If 0, you must swap the crc parameter and the result of av_crc
+ * if you need the standard representation (can be simplified in
+ * most cases to e.g. bswap16):
+ * bswap_32(crc << (32-bits))
+ * @param bits number of bits for the CRC
+ * @param poly generator polynomial without the x**bits coefficient, in the
+ * representation as specified by le
* @return <0 on failure
*/
int av_crc_init(AVCRC *ctx, int le, int bits, uint32_t poly, int ctx_size){
@@ -70,6 +79,13 @@ int av_crc_init(AVCRC *ctx, int le, int bits, uint32_t poly, int ctx_size){
return 0;
}
+/**
+ * Calculate the CRC of a block
+ * @param crc CRC of previous blocks if any or initial value for CRC.
+ * @return CRC updated with the data from the given block
+ *
+ * @see av_crc_init() "le" parameter
+ */
uint32_t av_crc(const AVCRC *ctx, uint32_t crc, const uint8_t *buffer, size_t length){
const uint8_t *end= buffer+length;