diff options
author | Justin Ruggles <justin.ruggles@gmail.com> | 2011-09-12 10:04:37 -0400 |
---|---|---|
committer | Justin Ruggles <justin.ruggles@gmail.com> | 2011-09-26 16:23:14 -0400 |
commit | 618b067d2132b0336e609bc311e85c557ffb30ed (patch) | |
tree | 7006edbd19b9704ee397cc80864050d9ecfcb06b | |
parent | 6896aa7a382fdabdb81330f21208aaeb04e8cef7 (diff) | |
download | ffmpeg-618b067d2132b0336e609bc311e85c557ffb30ed.tar.gz |
ws_snd: use memcpy() and memset() instead of loops
-rw-r--r-- | libavcodec/ws-snd1.c | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/libavcodec/ws-snd1.c b/libavcodec/ws-snd1.c index 3842ec9b32..57902a8243 100644 --- a/libavcodec/ws-snd1.c +++ b/libavcodec/ws-snd1.c @@ -60,7 +60,6 @@ static int ws_snd_decode_frame(AVCodecContext *avctx, int in_size, out_size; int sample = 128; - int i; uint8_t *samples = data; uint8_t *samples_end; @@ -87,8 +86,7 @@ static int ws_snd_decode_frame(AVCodecContext *avctx, samples_end = samples + out_size; if (in_size == out_size) { - for (i = 0; i < out_size; i++) - *samples++ = *buf++; + memcpy(samples, buf, out_size); *data_size = out_size; return buf_size; } @@ -153,16 +151,15 @@ static int ws_snd_decode_frame(AVCodecContext *avctx, sample = av_clip_uint8(sample); *samples++ = sample; } else { /* copy */ - for (count++; count > 0; count--) { - *samples++ = *buf++; - } + memcpy(samples, buf, smp); + samples += smp; + buf += smp; sample = buf[-1]; } break; default: /* run */ - for(count++; count > 0; count--) { - *samples++ = sample; - } + memset(samples, sample, smp); + samples += smp; } } |