user lrint() and friends in inner loops instead of normal C casts to speed up a few things

This commit is contained in:
Lennart Poettering 2008-10-03 02:34:59 +02:00
parent 1bb5e58fb3
commit 33b186e74d
5 changed files with 13 additions and 13 deletions

View file

@ -130,7 +130,7 @@ static void ulaw_from_float32ne(unsigned n, const float *a, uint8_t *b) {
float v = *(a++);
v = PA_CLAMP_UNLIKELY(v, -1.0f, 1.0f);
v *= 0x1FFF;
*(b++) = st_14linear2ulaw((int16_t) v);
*(b++) = st_14linear2ulaw((int16_t) lrintf(v));
}
}
@ -168,7 +168,7 @@ static void alaw_from_float32ne(unsigned n, const float *a, uint8_t *b) {
float v = *a;
v = PA_CLAMP_UNLIKELY(v, -1.0f, 1.0f);
v *= 0xFFF;
*b = st_13linear2alaw((int16_t) v);
*b = st_13linear2alaw((int16_t) lrintf(v));
}
}