~ubuntu-branches/ubuntu/utopic/libav/utopic

« back to all changes in this revision

Viewing changes to libavutil/crc.h

  • Committer: Package Import Robot
  • Author(s): Reinhard Tartler
  • Date: 2012-12-21 15:32:13 UTC
  • mto: (1.2.18)
  • mto: This revision was merged to the branch mainline in revision 34.
  • Revision ID: package-import@ubuntu.com-20121221153213-fudzrugjzivtv0wp
Tags: upstream-9~beta3
ImportĀ upstreamĀ versionĀ 9~beta3

Show diffs side-by-side

added added

removed removed

Lines of Context:
36
36
    AV_CRC_MAX,         /*< Not part of public API! Do not use outside libavutil. */
37
37
}AVCRCId;
38
38
 
 
39
/**
 
40
 * Initialize a CRC table.
 
41
 * @param ctx must be an array of size sizeof(AVCRC)*257 or sizeof(AVCRC)*1024
 
42
 * @param le If 1, the lowest bit represents the coefficient for the highest
 
43
 *           exponent of the corresponding polynomial (both for poly and
 
44
 *           actual CRC).
 
45
 *           If 0, you must swap the CRC parameter and the result of av_crc
 
46
 *           if you need the standard representation (can be simplified in
 
47
 *           most cases to e.g. bswap16):
 
48
 *           av_bswap32(crc << (32-bits))
 
49
 * @param bits number of bits for the CRC
 
50
 * @param poly generator polynomial without the x**bits coefficient, in the
 
51
 *             representation as specified by le
 
52
 * @param ctx_size size of ctx in bytes
 
53
 * @return <0 on failure
 
54
 */
39
55
int av_crc_init(AVCRC *ctx, int le, int bits, uint32_t poly, int ctx_size);
 
56
 
 
57
/**
 
58
 * Get an initialized standard CRC table.
 
59
 * @param crc_id ID of a standard CRC
 
60
 * @return a pointer to the CRC table or NULL on failure
 
61
 */
40
62
const AVCRC *av_crc_get_table(AVCRCId crc_id);
41
 
uint32_t av_crc(const AVCRC *ctx, uint32_t start_crc, const uint8_t *buffer, size_t length) av_pure;
 
63
 
 
64
/**
 
65
 * Calculate the CRC of a block.
 
66
 * @param crc CRC of previous blocks if any or initial value for CRC
 
67
 * @return CRC updated with the data from the given block
 
68
 *
 
69
 * @see av_crc_init() "le" parameter
 
70
 */
 
71
uint32_t av_crc(const AVCRC *ctx, uint32_t crc,
 
72
                const uint8_t *buffer, size_t length) av_pure;
42
73
 
43
74
#endif /* AVUTIL_CRC_H */