diff interplayvideo.c @ 5089:bff60ecc02f9 libavcodec

Use AV_xx throughout libavcodec
author ramiro
date Sat, 02 Jun 2007 01:41:07 +0000
parents f99e40a7155b
children 2b72f9bc4f06
line wrap: on
line diff
--- a/interplayvideo.c	Fri Jun 01 21:17:05 2007 +0000
+++ b/interplayvideo.c	Sat Jun 02 01:41:07 2007 +0000
@@ -41,6 +41,7 @@
 #include <unistd.h>
 
 #include "avcodec.h"
+#include "bytestream.h"
 #include "dsputil.h"
 
 #define PALETTE_COUNT 256
@@ -297,10 +298,8 @@
 
         /* need 2 more bytes from the stream */
         CHECK_STREAM_PTR(2);
-        B[0] = *s->stream_ptr++;
-        B[1] = *s->stream_ptr++;
 
-        flags = (B[1] << 8) | B[0];
+        flags = bytestream_get_le16(&s->stream_ptr);
         bitmask = 0x0001;
         for (y = 0; y < 8; y += 2) {
             for (x = 0; x < 8; x += 2, bitmask <<= 1) {
@@ -478,7 +477,6 @@
 {
     int x, y;
     unsigned char P[4];
-    unsigned char B[4];
     unsigned int flags = 0;
     int shifter = 0;
     unsigned char pix;
@@ -496,8 +494,7 @@
 
         for (y = 0; y < 8; y++) {
             /* get the next set of 8 2-bit flags */
-            flags = (s->stream_ptr[1] << 8) | s->stream_ptr[0];
-            s->stream_ptr += 2;
+            flags = bytestream_get_le16(&s->stream_ptr);
             for (x = 0, shifter = 0; x < 8; x++, shifter += 2) {
                 *s->pixel_ptr++ = P[(flags >> shifter) & 0x03];
             }
@@ -509,11 +506,7 @@
         /* 1 of 4 colors for each 2x2 block, need 4 more bytes */
         CHECK_STREAM_PTR(4);
 
-        B[0] = *s->stream_ptr++;
-        B[1] = *s->stream_ptr++;
-        B[2] = *s->stream_ptr++;
-        B[3] = *s->stream_ptr++;
-        flags = (B[3] << 24) | (B[2] << 16) | (B[1] << 8) | B[0];
+        flags = bytestream_get_le32(&s->stream_ptr);
         shifter = 0;
 
         for (y = 0; y < 8; y += 2) {
@@ -535,11 +528,7 @@
         for (y = 0; y < 8; y++) {
             /* time to reload flags? */
             if ((y == 0) || (y == 4)) {
-                B[0] = *s->stream_ptr++;
-                B[1] = *s->stream_ptr++;
-                B[2] = *s->stream_ptr++;
-                B[3] = *s->stream_ptr++;
-                flags = (B[3] << 24) | (B[2] << 16) | (B[1] << 8) | B[0];
+                flags = bytestream_get_le32(&s->stream_ptr);
                 shifter = 0;
             }
             for (x = 0; x < 8; x += 2, shifter += 2) {
@@ -558,11 +547,7 @@
         for (y = 0; y < 8; y += 2) {
             /* time to reload flags? */
             if ((y == 0) || (y == 4)) {
-                B[0] = *s->stream_ptr++;
-                B[1] = *s->stream_ptr++;
-                B[2] = *s->stream_ptr++;
-                B[3] = *s->stream_ptr++;
-                flags = (B[3] << 24) | (B[2] << 16) | (B[1] << 8) | B[0];
+                flags = bytestream_get_le32(&s->stream_ptr);
                 shifter = 0;
             }
             for (x = 0; x < 8; x++, shifter += 2) {