|
|
@ -195,12 +195,12 @@ static void subband_scale(int *dst, int *src, int scale, int offset, int len, vo |
|
|
|
|
|
|
|
|
|
|
|
static void noise_scale(int *coefs, int scale, int band_energy, int len) |
|
|
|
static void noise_scale(int *coefs, int scale, int band_energy, int len) |
|
|
|
{ |
|
|
|
{ |
|
|
|
int ssign = scale < 0 ? -1 : 1; |
|
|
|
int s = -scale; |
|
|
|
int s = FFABS(scale); |
|
|
|
|
|
|
|
unsigned int round; |
|
|
|
unsigned int round; |
|
|
|
int i, out, c = exp2tab[s & 3]; |
|
|
|
int i, out, c = exp2tab[s & 3]; |
|
|
|
int nlz = 0; |
|
|
|
int nlz = 0; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
av_assert0(s >= 0); |
|
|
|
while (band_energy > 0x7fff) { |
|
|
|
while (band_energy > 0x7fff) { |
|
|
|
band_energy >>= 1; |
|
|
|
band_energy >>= 1; |
|
|
|
nlz++; |
|
|
|
nlz++; |
|
|
@ -216,7 +216,7 @@ static void noise_scale(int *coefs, int scale, int band_energy, int len) |
|
|
|
round = s ? 1 << (s-1) : 0; |
|
|
|
round = s ? 1 << (s-1) : 0; |
|
|
|
for (i=0; i<len; i++) { |
|
|
|
for (i=0; i<len; i++) { |
|
|
|
out = (int)(((int64_t)coefs[i] * c) >> 32); |
|
|
|
out = (int)(((int64_t)coefs[i] * c) >> 32); |
|
|
|
coefs[i] = ((int)(out+round) >> s) * ssign; |
|
|
|
coefs[i] = -((int)(out+round) >> s); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
else { |
|
|
|
else { |
|
|
@ -224,7 +224,7 @@ static void noise_scale(int *coefs, int scale, int band_energy, int len) |
|
|
|
round = s ? 1 << (s-1) : 0; |
|
|
|
round = s ? 1 << (s-1) : 0; |
|
|
|
for (i=0; i<len; i++) { |
|
|
|
for (i=0; i<len; i++) { |
|
|
|
out = (int)((int64_t)((int64_t)coefs[i] * c + round) >> s); |
|
|
|
out = (int)((int64_t)((int64_t)coefs[i] * c + round) >> s); |
|
|
|
coefs[i] = out * ssign; |
|
|
|
coefs[i] = -out; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|