changeset 6781:2f505f532aa8 libavcodec

Replace some hardcoded swapping with FFSWAP. Patch by Vitor Sessak (vitor1001 gmail com)
author astrange
date Sun, 11 May 2008 18:43:11 +0000
parents 6b0dfbe7b7f9
children 781bfad6e40e
files ra144.c
diffstat 1 files changed, 9 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- a/ra144.c	Sun May 11 18:39:13 2008 +0000
+++ b/ra144.c	Sun May 11 18:43:11 2008 +0000
@@ -108,7 +108,7 @@
     int buffer[10];
     int *b1, *b2;
     int x, y;
-    int *ptr, *tmp;
+    int *ptr;
 
     b1 = buffer;
     b2 = a2;
@@ -121,9 +121,7 @@
             for (y=0; y <= x - 1; y++)
                 b1[y] = (((*a1) * (*(--ptr))) >> 12) + b2[y];
         }
-        tmp = b1;
-        b1 = b2;
-        b2 = tmp;
+        FFSWAP(int *, b1, b2);
         a1++;
     }
     ptr = a2 + 10;
@@ -359,7 +357,7 @@
     unsigned int u;
     short *sptr;
     int *ptr1, *ptr2, *ptr3;
-    int *bp1, *bp2, *temp;
+    int *bp1, *bp2;
 
     retval = 0;
     bp1 = glob->buffer1;
@@ -403,9 +401,7 @@
         if ((u + 0x1000) > 0x1fff)
             retval = 1;
 
-        temp = bp2;
-        bp2 = bp1;
-        bp1 = temp;
+        FFSWAP(unsigned int *, bp1, bp2);
     }
     return retval;
 }
@@ -454,7 +450,7 @@
 {
     unsigned int a, b, c;
     signed short *shptr;
-    unsigned int *lptr, *temp;
+    unsigned int *lptr;
     const short **dptr;
     int16_t *datao;
     int16_t *data = vdata;
@@ -513,12 +509,10 @@
     }
 
     glob->oldval = glob->val;
-    temp = glob->swapbuf1alt;
-    glob->swapbuf1alt = glob->swapbuf1;
-    glob->swapbuf1 = temp;
-    temp = glob->swapbuf2alt;
-    glob->swapbuf2alt = glob->swapbuf2;
-    glob->swapbuf2 = temp;
+
+    FFSWAP(unsigned int *, glob->swapbuf1alt, glob->swapbuf1);
+    FFSWAP(unsigned int *, glob->swapbuf2alt, glob->swapbuf2);
+
     *data_size = (data-datao)*sizeof(*data);
     return 20;
 }