mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-12-23 12:43:46 +02:00
ws_snd: use memcpy() and memset() instead of loops
This commit is contained in:
parent
6896aa7a38
commit
618b067d21
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user