Mercurial > libavcodec.hg
changeset 7100:a17b3a67a719 libavcodec
Simplify rotate_buffer()
author | vitor |
---|---|
date | Mon, 23 Jun 2008 19:59:42 +0000 |
parents | 07172377ec9f |
children | 6ee204e8d9ae |
files | ra144.c |
diffstat | 1 files changed, 5 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/ra144.c Mon Jun 23 19:47:10 2008 +0000 +++ b/ra144.c Mon Jun 23 19:59:42 2008 +0000 @@ -97,14 +97,13 @@ /* 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)); } }