diff options
author | Max Kellermann <max@duempel.org> | 2011-10-09 12:37:32 +0200 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2011-10-10 10:24:06 +0200 |
commit | 20c6159c041cc5ec644c51009503cf6801b6fcab (patch) | |
tree | 55e38810c32ca6059bafd61578705172feb299e2 /src/pcm_dither.c | |
parent | a47e9d1a4b5bd6b999eaec33624d7c96a29f24e6 (diff) | |
download | mpd-20c6159c041cc5ec644c51009503cf6801b6fcab.tar.gz mpd-20c6159c041cc5ec644c51009503cf6801b6fcab.tar.xz mpd-20c6159c041cc5ec644c51009503cf6801b6fcab.zip |
pcm_dither: pass an "end" pointer instead of a sample count
This is easier and more efficient to loop on, because only two
variables get modified (src and dest).
Diffstat (limited to 'src/pcm_dither.c')
-rw-r--r-- | src/pcm_dither.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/src/pcm_dither.c b/src/pcm_dither.c index a75b07e5d..4811946c8 100644 --- a/src/pcm_dither.c +++ b/src/pcm_dither.c @@ -72,10 +72,9 @@ pcm_dither_sample_24_to_16(int32_t sample, struct pcm_dither *dither) void pcm_dither_24_to_16(struct pcm_dither *dither, - int16_t *dest, const int32_t *src, - unsigned num_samples) + int16_t *dest, const int32_t *src, const int32_t *src_end) { - while (num_samples-- > 0) + while (src < src_end) *dest++ = pcm_dither_sample_24_to_16(*src++, dither); } @@ -87,9 +86,8 @@ pcm_dither_sample_32_to_16(int32_t sample, struct pcm_dither *dither) void pcm_dither_32_to_16(struct pcm_dither *dither, - int16_t *dest, const int32_t *src, - unsigned num_samples) + int16_t *dest, const int32_t *src, const int32_t *src_end) { - while (num_samples-- > 0) + while (src < src_end) *dest++ = pcm_dither_sample_32_to_16(*src++, dither); } |