Skip to content

Commit

Permalink
audio: fix saturation nonlinearity in clip_* functions
Browse files Browse the repository at this point in the history
The current positive limit for the saturation nonlinearity is
only correct if the type of the result has 8 bits or less.

Signed-off-by: Volker Rümelin <[email protected]>
Message-id: [email protected]
Signed-off-by: Gerd Hoffmann <[email protected]>
  • Loading branch information
Volker Rümelin authored and kraxel committed Mar 16, 2020
1 parent 4218fdd commit 194bdf5
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions audio/mixeng_template.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,9 @@ static inline int64_t glue (conv_, ET) (IN_T v)

static inline IN_T glue (clip_, ET) (int64_t v)
{
if (v >= 0x7f000000) {
if (v >= 0x7fffffffLL) {
return IN_MAX;
}
else if (v < -2147483648LL) {
} else if (v < -2147483648LL) {
return IN_MIN;
}

Expand Down

0 comments on commit 194bdf5

Please sign in to comment.