Simplify rotate_buffer()
authorVitor Sessak <vitor1001@gmail.com>
Mon, 23 Jun 2008 19:59:42 +0000 (19:59 +0000)
committerVitor Sessak <vitor1001@gmail.com>
Mon, 23 Jun 2008 19:59:42 +0000 (19:59 +0000)
Originally committed as revision 13914 to svn://svn.ffmpeg.org/ffmpeg/trunk

libavcodec/ra144.c

index 7059c50..e6895ce 100644 (file)
@@ -97,14 +97,13 @@ static void eval_coefs(const int *refl, int *coefs)
 /* rotate block */
 static void rotate_block(const int16_t *source, int16_t *target, int offset)
 {
-    int i=0, k=0;
     source += BUFFERSIZE - offset;
 
-    while (i<BLOCKSIZE) {
-        target[i++] = source[k++];
-
-        if (k == offset)
-            k = 0;
+    if (offset > BLOCKSIZE) {
+        memcpy(target, source, BLOCKSIZE*sizeof(*target));
+    } else {
+        memcpy(target, source, offset*sizeof(*target));
+        memcpy(target + offset, source, (BLOCKSIZE - offset)*sizeof(*target));
     }
 }