Browse code

Replace some hardcoded swapping with FFSWAP. Patch by Vitor Sessak (vitor1001 gmail com)

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

Vitor Sessak authored on 2008/05/12 03:43:11
Showing 1 changed files
... ...
@@ -108,7 +108,7 @@ static void do_voice(int *a1, int *a2)
108 108
     int buffer[10];
109 109
     int *b1, *b2;
110 110
     int x, y;
111
-    int *ptr, *tmp;
111
+    int *ptr;
112 112
 
113 113
     b1 = buffer;
114 114
     b2 = a2;
... ...
@@ -121,9 +121,7 @@ static void do_voice(int *a1, int *a2)
121 121
             for (y=0; y <= x - 1; y++)
122 122
                 b1[y] = (((*a1) * (*(--ptr))) >> 12) + b2[y];
123 123
         }
124
-        tmp = b1;
125
-        b1 = b2;
126
-        b2 = tmp;
124
+        FFSWAP(int *, b1, b2);
127 125
         a1++;
128 126
     }
129 127
     ptr = a2 + 10;
... ...
@@ -359,7 +357,7 @@ static int eq(Real144_internal *glob, short *in, int *target)
359 359
     unsigned int u;
360 360
     short *sptr;
361 361
     int *ptr1, *ptr2, *ptr3;
362
-    int *bp1, *bp2, *temp;
362
+    int *bp1, *bp2;
363 363
 
364 364
     retval = 0;
365 365
     bp1 = glob->buffer1;
... ...
@@ -403,9 +401,7 @@ static int eq(Real144_internal *glob, short *in, int *target)
403 403
         if ((u + 0x1000) > 0x1fff)
404 404
             retval = 1;
405 405
 
406
-        temp = bp2;
407
-        bp2 = bp1;
408
-        bp1 = temp;
406
+        FFSWAP(unsigned int *, bp1, bp2);
409 407
     }
410 408
     return retval;
411 409
 }
... ...
@@ -454,7 +450,7 @@ static int ra144_decode_frame(AVCodecContext * avctx,
454 454
 {
455 455
     unsigned int a, b, c;
456 456
     signed short *shptr;
457
-    unsigned int *lptr, *temp;
457
+    unsigned int *lptr;
458 458
     const short **dptr;
459 459
     int16_t *datao;
460 460
     int16_t *data = vdata;
... ...
@@ -513,12 +509,10 @@ static int ra144_decode_frame(AVCodecContext * avctx,
513 513
     }
514 514
 
515 515
     glob->oldval = glob->val;
516
-    temp = glob->swapbuf1alt;
517
-    glob->swapbuf1alt = glob->swapbuf1;
518
-    glob->swapbuf1 = temp;
519
-    temp = glob->swapbuf2alt;
520
-    glob->swapbuf2alt = glob->swapbuf2;
521
-    glob->swapbuf2 = temp;
516
+
517
+    FFSWAP(unsigned int *, glob->swapbuf1alt, glob->swapbuf1);
518
+    FFSWAP(unsigned int *, glob->swapbuf2alt, glob->swapbuf2);
519
+
522 520
     *data_size = (data-datao)*sizeof(*data);
523 521
     return 20;
524 522
 }