mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-05 13:29:57 -05:00
sconv: fix a few minor conversion issues
This commit is contained in:
parent
5caf09d4ea
commit
e0f08219bb
2 changed files with 6 additions and 6 deletions
|
|
@ -370,7 +370,7 @@ void pa_sconv_s24_32le_to_s16ne(unsigned n, const uint32_t *a, int16_t *b) {
|
||||||
pa_assert(b);
|
pa_assert(b);
|
||||||
|
|
||||||
for (; n > 0; n--) {
|
for (; n > 0; n--) {
|
||||||
*b = (int16_t) ((int32_t) (UINT32_FROM(*a) << 8) >> 16);
|
*b = (int16_t) (((int32_t) (UINT32_FROM(*a) << 8)) >> 16);
|
||||||
a++;
|
a++;
|
||||||
b++;
|
b++;
|
||||||
}
|
}
|
||||||
|
|
@ -416,8 +416,8 @@ void pa_sconv_s24_32le_to_float32ne(unsigned n, const uint32_t *a, float *b) {
|
||||||
pa_assert(b);
|
pa_assert(b);
|
||||||
|
|
||||||
for (; n > 0; n--) {
|
for (; n > 0; n--) {
|
||||||
int32_t s = (int16_t) ((int32_t) (UINT32_FROM(*a) << 8));
|
int32_t s = (int32_t) (UINT32_FROM(*a) << 8);
|
||||||
*b = ((float) s) / 0x7FFFFFFF;
|
*b = (float) s / (float) 0x7FFFFFFF;
|
||||||
a ++;
|
a ++;
|
||||||
b ++;
|
b ++;
|
||||||
}
|
}
|
||||||
|
|
@ -428,8 +428,8 @@ void pa_sconv_s24_32le_to_float32re(unsigned n, const uint32_t *a, float *b) {
|
||||||
pa_assert(b);
|
pa_assert(b);
|
||||||
|
|
||||||
for (; n > 0; n--) {
|
for (; n > 0; n--) {
|
||||||
int32_t s = (int16_t) ((int32_t) (UINT32_FROM(*a) << 8));
|
int32_t s = (int32_t) (UINT32_FROM(*a) << 8);
|
||||||
float k = ((float) s) / 0x7FFFFFFF;
|
float k = (float) s / (float) 0x7FFFFFFF;
|
||||||
*b = PA_FLOAT32_SWAP(k);
|
*b = PA_FLOAT32_SWAP(k);
|
||||||
a ++;
|
a ++;
|
||||||
b ++;
|
b ++;
|
||||||
|
|
|
||||||
|
|
@ -75,7 +75,7 @@ static void u8_from_s16ne(unsigned n, const int16_t *a, uint8_t *b) {
|
||||||
pa_assert(b);
|
pa_assert(b);
|
||||||
|
|
||||||
for (; n > 0; n--, a++, b++)
|
for (; n > 0; n--, a++, b++)
|
||||||
*b = (uint8_t) (*a / 0x100 + 0x80);
|
*b = (uint8_t) ((uint16_t) *a >> 8) + (uint8_t) 0x80U;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* float32 */
|
/* float32 */
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue