Browse code

simplify

Originally committed as revision 5786 to svn://svn.ffmpeg.org/ffmpeg/trunk

Michael Niedermayer authored on 2006/07/19 17:39:50
Showing 2 changed files
... ...
@@ -29,7 +29,7 @@ static int crc_write_header(struct AVFormatContext *s)
29 29
     CRCState *crc = s->priv_data;
30 30
 
31 31
     /* init CRC */
32
-    crc->crcval = av_adler32_update(0, NULL, 0);
32
+    crc->crcval = 1;
33 33
 
34 34
     return 0;
35 35
 }
... ...
@@ -11,21 +11,16 @@
11 11
 /* NMAX is the largest n such that 255n(n+1)/2 + (n+1)(BASE-1) <= 2^32-1 */
12 12
 
13 13
 #define DO1(buf)  {s1 += *buf++; s2 += s1;}
14
-#define DO2(buf)  DO1(buf); DO1(buf);
15
-#define DO4(buf)  DO2(buf); DO2(buf);
16
-#define DO8(buf)  DO4(buf); DO4(buf);
17
-#define DO16(buf) DO8(buf); DO8(buf);
14
+#define DO4(buf)  DO1(buf); DO1(buf); DO1(buf); DO1(buf);
15
+#define DO16(buf) DO4(buf); DO4(buf); DO4(buf); DO4(buf);
18 16
 
19 17
 unsigned long av_adler32_update(unsigned long adler, const uint8_t *buf, unsigned int len)
20 18
 {
21 19
     unsigned long s1 = adler & 0xffff;
22 20
     unsigned long s2 = (adler >> 16) & 0xffff;
23
-    int k;
24
-
25
-    if (buf == NULL) return 1L;
26 21
 
27 22
     while (len > 0) {
28
-        k = FFMIN(len, NMAX);
23
+        int k = FFMIN(len, NMAX);
29 24
         len -= k;
30 25
 #ifndef CONFIG_SMALL
31 26
         while (k >= 16) {