simplify
Originally committed as revision 5786 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
parent
cfc4bd4695
commit
1d94a6620f
@ -29,7 +29,7 @@ static int crc_write_header(struct AVFormatContext *s)
|
|||||||
CRCState *crc = s->priv_data;
|
CRCState *crc = s->priv_data;
|
||||||
|
|
||||||
/* init CRC */
|
/* init CRC */
|
||||||
crc->crcval = av_adler32_update(0, NULL, 0);
|
crc->crcval = 1;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -11,21 +11,16 @@
|
|||||||
/* NMAX is the largest n such that 255n(n+1)/2 + (n+1)(BASE-1) <= 2^32-1 */
|
/* NMAX is the largest n such that 255n(n+1)/2 + (n+1)(BASE-1) <= 2^32-1 */
|
||||||
|
|
||||||
#define DO1(buf) {s1 += *buf++; s2 += s1;}
|
#define DO1(buf) {s1 += *buf++; s2 += s1;}
|
||||||
#define DO2(buf) DO1(buf); DO1(buf);
|
#define DO4(buf) DO1(buf); DO1(buf); DO1(buf); DO1(buf);
|
||||||
#define DO4(buf) DO2(buf); DO2(buf);
|
#define DO16(buf) DO4(buf); DO4(buf); DO4(buf); DO4(buf);
|
||||||
#define DO8(buf) DO4(buf); DO4(buf);
|
|
||||||
#define DO16(buf) DO8(buf); DO8(buf);
|
|
||||||
|
|
||||||
unsigned long av_adler32_update(unsigned long adler, const uint8_t *buf, unsigned int len)
|
unsigned long av_adler32_update(unsigned long adler, const uint8_t *buf, unsigned int len)
|
||||||
{
|
{
|
||||||
unsigned long s1 = adler & 0xffff;
|
unsigned long s1 = adler & 0xffff;
|
||||||
unsigned long s2 = (adler >> 16) & 0xffff;
|
unsigned long s2 = (adler >> 16) & 0xffff;
|
||||||
int k;
|
|
||||||
|
|
||||||
if (buf == NULL) return 1L;
|
|
||||||
|
|
||||||
while (len > 0) {
|
while (len > 0) {
|
||||||
k = FFMIN(len, NMAX);
|
int k = FFMIN(len, NMAX);
|
||||||
len -= k;
|
len -= k;
|
||||||
#ifndef CONFIG_SMALL
|
#ifndef CONFIG_SMALL
|
||||||
while (k >= 16) {
|
while (k >= 16) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user