mirror of
https://github.com/alsa-project/alsa-lib.git
synced 2025-12-18 08:56:42 -05:00
Fixed normalization
This commit is contained in:
parent
c4a0be5c5c
commit
a81bf16bc9
1 changed files with 3 additions and 3 deletions
|
|
@ -789,14 +789,14 @@ static inline void _norms(const void *src, void *dst,
|
||||||
int32_t s;
|
int32_t s;
|
||||||
switch (src_wid) {
|
switch (src_wid) {
|
||||||
case 8:
|
case 8:
|
||||||
s = *(int8_t*)src;
|
s = *(int32_t*)src;
|
||||||
if (s >= 0x7f)
|
if (s >= 0x7f)
|
||||||
goto _max;
|
goto _max;
|
||||||
else if (s <= -0x80)
|
else if (s <= -0x80)
|
||||||
goto _min;
|
goto _min;
|
||||||
break;
|
break;
|
||||||
case 16:
|
case 16:
|
||||||
s = *(int16_t*)src;
|
s = *(int32_t*)src;
|
||||||
if (s >= 0x7fff)
|
if (s >= 0x7fff)
|
||||||
goto _max;
|
goto _max;
|
||||||
else if (s <= -0x8000)
|
else if (s <= -0x8000)
|
||||||
|
|
@ -829,7 +829,7 @@ static inline void _norms(const void *src, void *dst,
|
||||||
s *= 1 << bits;
|
s *= 1 << bits;
|
||||||
} else if (src_wid > dst_wid) {
|
} else if (src_wid > dst_wid) {
|
||||||
unsigned int bits = src_wid - dst_wid;
|
unsigned int bits = src_wid - dst_wid;
|
||||||
s = (s + (1 << (bits - 1)))/ (1 << bits);
|
s = (s + (1 << (bits - 1))) / (1 << bits);
|
||||||
}
|
}
|
||||||
if (!dst_sign)
|
if (!dst_sign)
|
||||||
s += (1U << (dst_wid - 1));
|
s += (1U << (dst_wid - 1));
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue