From c1985c2acc43f5d2c23e1e736588c5ef3a398a17 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Fri, 9 Nov 2007 14:20:12 +0000 Subject: replace a few CLAMPs by PA_CLAMP_UNLIKELY git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@2040 fefdeb5f-60dc-0310-8127-8f9354f1896f --- src/modules/module-ladspa-sink.c | 4 ++-- src/pulsecore/sample-util.c | 6 +++--- src/pulsecore/sconv.c | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/modules/module-ladspa-sink.c b/src/modules/module-ladspa-sink.c index 0265d971..6ed392ce 100644 --- a/src/modules/module-ladspa-sink.c +++ b/src/modules/module-ladspa-sink.c @@ -177,14 +177,14 @@ static int sink_input_peek_cb(pa_sink_input *i, size_t length, pa_memchunk *chun p = src + c; q = u->input; for (j = 0; j < n; j++, p += u->channels, q++) - *q = CLAMP(*p, -1.0, 1.0); + *q = PA_CLAMP_UNLIKELY(*p, -1.0, 1.0); u->descriptor->run(u->handle[c], n); q = u->output; p = dst + c; for (j = 0; j < n; j++, q++, p += u->channels) - *p = CLAMP(*q, -1.0, 1.0); + *p = PA_CLAMP_UNLIKELY(*q, -1.0, 1.0); } pa_memblock_release(tchunk.memblock); diff --git a/src/pulsecore/sample-util.c b/src/pulsecore/sample-util.c index 0383b567..001a997e 100644 --- a/src/pulsecore/sample-util.c +++ b/src/pulsecore/sample-util.c @@ -178,7 +178,7 @@ size_t pa_mix( if (volume->values[channel] != PA_VOLUME_NORM) sum = (int32_t) (sum * pa_sw_volume_to_linear(volume->values[channel])); - sum = CLAMP(sum, -0x8000, 0x7FFF); + sum = PA_CLAMP_UNLIKELY(sum, -0x8000, 0x7FFF); } *((int16_t*) data) = (int16_t) sum; @@ -225,7 +225,7 @@ size_t pa_mix( if (volume->values[channel] != PA_VOLUME_NORM) sum = (int32_t) (sum * pa_sw_volume_to_linear(volume->values[channel])); - sum = CLAMP(sum, -0x8000, 0x7FFF); + sum = PA_CLAMP_UNLIKELY(sum, -0x8000, 0x7FFF); } *((int16_t*) data) = PA_INT16_SWAP((int16_t) sum); @@ -272,7 +272,7 @@ size_t pa_mix( if (volume->values[channel] != PA_VOLUME_NORM) sum = (int32_t) (sum * pa_sw_volume_to_linear(volume->values[channel])); - sum = CLAMP(sum, -0x80, 0x7F); + sum = PA_CLAMP_UNLIKELY(sum, -0x80, 0x7F); } *((uint8_t*) data) = (uint8_t) (sum + 0x80); diff --git a/src/pulsecore/sconv.c b/src/pulsecore/sconv.c index 8a3e830a..ebd74586 100644 --- a/src/pulsecore/sconv.c +++ b/src/pulsecore/sconv.c @@ -130,7 +130,7 @@ static void ulaw_from_float32ne(unsigned n, const float *a, uint8_t *b) { for (; n > 0; n--) { float v = *(a++); - v = CLAMP(v, -1, 1); + v = PA_CLAMP_UNLIKELY(v, -1, 1); v *= 0x1FFF; *(b++) = st_14linear2ulaw((int16_t) v); } @@ -168,7 +168,7 @@ static void alaw_from_float32ne(unsigned n, const float *a, uint8_t *b) { for (; n > 0; n--, a++, b++) { float v = *a; - v = CLAMP(v, -1, 1); + v = PA_CLAMP_UNLIKELY(v, -1, 1); v *= 0xFFF; *b = st_13linear2alaw((int16_t) v); } -- cgit