diff options
author | Max Kellermann <max@duempel.org> | 2008-10-23 20:01:37 +0200 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2008-10-23 20:01:37 +0200 |
commit | 1dcb946fb0ea3efe03bafce17ac1c5ed4d3b06fc (patch) | |
tree | 7fca43744455b5e67b2e3d80eb4b13f373bb1bf8 | |
parent | 124f79a2a69d2103bcaf460d38868c1718a5a1e3 (diff) | |
download | mpd-1dcb946fb0ea3efe03bafce17ac1c5ed4d3b06fc.tar.gz mpd-1dcb946fb0ea3efe03bafce17ac1c5ed4d3b06fc.tar.xz mpd-1dcb946fb0ea3efe03bafce17ac1c5ed4d3b06fc.zip |
pcm_resample: eliminated "sample" local variables
Copy from source to destination buffer directly, don't use the
temporary variables "lsample" and "rsample".
-rw-r--r-- | src/pcm_resample_fallback.c | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/src/pcm_resample_fallback.c b/src/pcm_resample_fallback.c index 59d095b66..0a913406c 100644 --- a/src/pcm_resample_fallback.c +++ b/src/pcm_resample_fallback.c @@ -33,7 +33,6 @@ pcm_resample_16(uint8_t channels, { unsigned src_pos, dest_pos = 0; unsigned dest_samples = dest_size / sizeof(*dest_buffer); - int16_t lsample, rsample; assert((src_size % (sizeof(*src_buffer) * channels)) == 0); assert((dest_size % (sizeof(*dest_buffer) * channels)) == 0); @@ -43,9 +42,7 @@ pcm_resample_16(uint8_t channels, while (dest_pos < dest_samples) { src_pos = dest_pos * src_rate / dest_rate; - lsample = src_buffer[src_pos++]; - - dest_buffer[dest_pos++] = lsample; + dest_buffer[dest_pos++] = src_buffer[src_pos]; } break; case 2: @@ -53,11 +50,8 @@ pcm_resample_16(uint8_t channels, src_pos = dest_pos * src_rate / dest_rate; src_pos &= ~1; - lsample = src_buffer[src_pos++]; - rsample = src_buffer[src_pos++]; - - dest_buffer[dest_pos++] = lsample; - dest_buffer[dest_pos++] = rsample; + dest_buffer[dest_pos++] = src_buffer[src_pos]; + dest_buffer[dest_pos++] = src_buffer[src_pos + 1]; } break; } |