OSDN Git Service

Simplify rotate_block()
authorVitor Sessak <vitor1001@gmail.com>
Thu, 15 May 2008 18:42:05 +0000 (18:42 +0000)
committerVitor Sessak <vitor1001@gmail.com>
Thu, 15 May 2008 18:42:05 +0000 (18:42 +0000)
Originally committed as revision 13167 to svn://svn.ffmpeg.org/ffmpeg/trunk

libavcodec/ra144.c

index 10a812b..bf384b9 100644 (file)
@@ -141,19 +141,14 @@ static void do_output_subblock(Real144_internal *glob, const unsigned short  *gs
 /* rotate block */
 static void rotate_block(const short *source, short *target, int offset)
 {
-    short *end;
-    const short *ptr1;
-    const short *ptr2;
-    const short *ptr3;
-    ptr2 = source + BUFFERSIZE;
-    ptr3 = ptr1 = ptr2 - offset;
-    end = target + BLOCKSIZE;
-
-    while (target < end) {
-        *(target++) = *(ptr3++);
-
-        if (ptr3 == ptr2)
-            ptr3 = ptr1;
+    int i=0, k=0;
+    const short *ptr1 = source + BUFFERSIZE - offset;
+
+    while (i<BLOCKSIZE) {
+        target[i++] = ptr1[k++];
+
+        if (k == offset)
+            k = 0;
     }
 }