use const data - began to make code more portable
authorFabrice Bellard <fabrice@bellard.org>
Tue, 9 Sep 2003 22:56:25 +0000 (22:56 +0000)
committerFabrice Bellard <fabrice@bellard.org>
Tue, 9 Sep 2003 22:56:25 +0000 (22:56 +0000)
Originally committed as revision 2247 to svn://svn.ffmpeg.org/ffmpeg/trunk

libavcodec/indeo3.c
libavcodec/indeo3data.h

index 0cf4118..fb1c230 100644 (file)
@@ -306,8 +306,8 @@ static void iv_Decode_Chunk(Indeo3DecodeContext *s,
   long *width_tbl, width_tbl_arr[10];
   char *ref_vectors;
   unsigned char *cur_frm_pos, *ref_frm_pos, *cp, *cp2;
-  unsigned long *cur_lp, *ref_lp, *correction_lp[2], *correctionloworder_lp[2],
-    *correctionhighorder_lp[2];
+  uint32_t *cur_lp, *ref_lp;
+  const uint32_t *correction_lp[2], *correctionloworder_lp[2], *correctionhighorder_lp[2];
   unsigned short *correction_type_sp[2];
   ustr_t strip_tbl[20], *strip;
   int i, j, k, lp1, lp2, flag1, cmd, blks_width, blks_height, region_160_width,
@@ -399,7 +399,7 @@ static void iv_Decode_Chunk(Indeo3DecodeContext *s,
       if(cmd == 0 || ref_vectors != NULL) {
         for(lp1 = 0; lp1 < blks_width; lp1++) {
           for(i = 0, j = 0; i < blks_height; i++, j += width_tbl[1])
-            ((unsigned long *)cur_frm_pos)[j] = ((unsigned long *)ref_frm_pos)[j];
+            ((uint32_t *)cur_frm_pos)[j] = ((uint32_t *)ref_frm_pos)[j];
           cur_frm_pos += 4;
           ref_frm_pos += 4;
         }
@@ -414,7 +414,10 @@ static void iv_Decode_Chunk(Indeo3DecodeContext *s,
       if((lv - 8) <= 7 && (k == 0 || k == 3 || k == 10)) {
         cp2 = s->ModPred + ((lv - 8) << 7);
         cp = ref_frm_pos;
-        for(i = 0; i < blks_width << 2; i++) { *(cp++) = cp2[*cp >> 1]; }
+        for(i = 0; i < blks_width << 2; i++) { 
+            int v = *cp >> 1;
+            *(cp++) = cp2[v]; 
+        }
       }
 
       if(k == 1 || k == 4) {
@@ -438,8 +441,8 @@ static void iv_Decode_Chunk(Indeo3DecodeContext *s,
             for(lp1 = 0; lp1 < blks_width; lp1++) {
               for(lp2 = 0; lp2 < 4; ) {
                 k = *buf1++;
-                cur_lp = ((unsigned long *)cur_frm_pos) + width_tbl[lp2];
-                ref_lp = ((unsigned long *)ref_frm_pos) + width_tbl[lp2];
+                cur_lp = ((uint32_t *)cur_frm_pos) + width_tbl[lp2];
+                ref_lp = ((uint32_t *)ref_frm_pos) + width_tbl[lp2];
 
                 switch(correction_type_sp[0][k]) {
                   case 0:
@@ -540,8 +543,8 @@ static void iv_Decode_Chunk(Indeo3DecodeContext *s,
               for(lp2 = 0; lp2 < 4; ) {
                 k = *buf1++;
 
-                cur_lp = ((unsigned long *)cur_frm_pos) + width_tbl[lp2 * 2];
-                ref_lp = ((unsigned long *)cur_frm_pos) + width_tbl[(lp2 * 2) - 1];
+                cur_lp = ((uint32_t *)cur_frm_pos) + width_tbl[lp2 * 2];
+                ref_lp = ((uint32_t *)cur_frm_pos) + width_tbl[(lp2 * 2) - 1];
 
                 switch(correction_type_sp[lp2 & 0x01][k]) {
                   case 0:
@@ -652,8 +655,8 @@ static void iv_Decode_Chunk(Indeo3DecodeContext *s,
               for(lp1 = 0; lp1 < blks_width; lp1 += 2) {
                 for(lp2 = 0; lp2 < 4; ) {
                   k = *buf1++;
-                  cur_lp = ((unsigned long *)cur_frm_pos) + width_tbl[lp2 * 2];
-                  ref_lp = ((unsigned long *)cur_frm_pos) + width_tbl[(lp2 * 2) - 1];
+                  cur_lp = ((uint32_t *)cur_frm_pos) + width_tbl[lp2 * 2];
+                  ref_lp = ((uint32_t *)cur_frm_pos) + width_tbl[(lp2 * 2) - 1];
                   lv1 = ref_lp[0];
                   lv2 = ref_lp[1];
                   if(lp2 == 0 && flag1 != 0) {
@@ -814,8 +817,8 @@ static void iv_Decode_Chunk(Indeo3DecodeContext *s,
               for(lp1 = 0; lp1 < blks_width; lp1 += 2) {
                 for(lp2 = 0; lp2 < 4; ) {
                   k = *buf1++;
-                  cur_lp = ((unsigned long *)cur_frm_pos) + width_tbl[lp2 * 2];
-                  ref_lp = ((unsigned long *)ref_frm_pos) + width_tbl[lp2 * 2];
+                  cur_lp = ((uint32_t *)cur_frm_pos) + width_tbl[lp2 * 2];
+                  ref_lp = ((uint32_t *)ref_frm_pos) + width_tbl[lp2 * 2];
 
                   switch(correction_type_sp[lp2 & 0x01][k]) {
                     case 0:
@@ -862,8 +865,8 @@ static void iv_Decode_Chunk(Indeo3DecodeContext *s,
                       if(lp2 == 0) {
                         RLE_V3_CHECK(buf1,rle_v1,rle_v2,rle_v3)
                         for(i = 0, j = 0; i < 8; i++, j += width_tbl[1]) {
-                          ((unsigned long *)cur_frm_pos)[j] = ((unsigned long *)ref_frm_pos)[j];
-                          ((unsigned long *)cur_frm_pos)[j+1] = ((unsigned long *)ref_frm_pos)[j+1];
+                          ((uint32_t *)cur_frm_pos)[j] = ((uint32_t *)ref_frm_pos)[j];
+                          ((uint32_t *)cur_frm_pos)[j+1] = ((uint32_t *)ref_frm_pos)[j+1];
                         }
                         RLE_V2_CHECK(buf1,rle_v2, rle_v3,lp2)
                         break;
@@ -890,7 +893,7 @@ static void iv_Decode_Chunk(Indeo3DecodeContext *s,
                       lv += (lv << 8);
                       lv += (lv << 16);
                       for(i = 0, j = 0; i < 8; i++, j += width_tbl[1])
-                        ((unsigned long *)cur_frm_pos)[j] = ((unsigned long *)cur_frm_pos)[j+1] = lv;
+                        ((uint32_t *)cur_frm_pos)[j] = ((uint32_t *)cur_frm_pos)[j+1] = lv;
                       LV1_CHECK(buf1,rle_v3,lv1,lp2)
                       break;
 
@@ -917,8 +920,8 @@ static void iv_Decode_Chunk(Indeo3DecodeContext *s,
             for(lp1 = 0; lp1 < blks_width; lp1++) {
               for(lp2 = 0; lp2 < 4; ) {
                 k = *buf1++;
-                cur_lp = ((unsigned long *)cur_frm_pos) + width_tbl[lp2 * 2];
-                ref_lp = ((unsigned long *)ref_frm_pos) + width_tbl[lp2 * 2];
+                cur_lp = ((uint32_t *)cur_frm_pos) + width_tbl[lp2 * 2];
+                ref_lp = ((uint32_t *)ref_frm_pos) + width_tbl[lp2 * 2];
 
                 switch(correction_type_sp[lp2 & 0x01][k]) {
                   case 0:
index fd59f71..4754926 100644 (file)
@@ -1,5 +1,5 @@
 
-unsigned long correction[] = {
+static const uint32_t correction[] = {
        0x00000000, 0x00000202, 0xfffffdfe, 0x000002ff, 0xfffffd01, 0xffffff03, 0x000000fd, 0x00000404, 
        0xfffffbfc, 0x00000501, 0xfffffaff, 0x00000105, 0xfffffefb, 0x000003fc, 0xfffffc04, 0x000005fe, 
        0xfffffa02, 0xfffffe06, 0x000001fa, 0x00000904, 0xfffff6fc, 0x00000409, 0xfffffbf7, 0x00000909, 
@@ -771,7 +771,7 @@ unsigned long correction[] = {
 };
 
 
-unsigned long correctionloworder[] = {
+static const uint32_t correctionloworder[] = {
        0x00000000, 0x02020202, 0xfdfdfdfe, 0x0302feff, 0xfcfd0101, 0xfeff0303, 0x0100fcfd, 0x04040404, 
        0xfbfbfbfc, 0x05050101, 0xfafafeff, 0x01010505, 0xfefefafb, 0x0403fbfc, 0xfbfc0404, 0x0605fdfe, 
        0xf9fa0202, 0xfdfe0606, 0x0201f9fa, 0x09090404, 0xf6f6fbfc, 0x04040909, 0xfbfbf6f7, 0x09090909, 
@@ -1543,7 +1543,7 @@ unsigned long correctionloworder[] = {
 };
 
 
-unsigned long correctionhighorder[] = {
+static const uint32_t correctionhighorder[] = {
        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 
        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 
        0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef, 0xdeadbeef,