提交 e78e6c37 编写于 作者: K Kostya Shishkov

g723_1: clip argument for 15-bit version of normalize_bits()

It expects maximum value to be 32767 but calculations in scale_vector()
which uses this function can give it ABS(-32768) which leads to wrong
result and thus clipping is needed.
上级 f86b2f36
...@@ -290,6 +290,7 @@ static int scale_vector(int16_t *vector, int length) ...@@ -290,6 +290,7 @@ static int scale_vector(int16_t *vector, int length)
for (i = 0; i < length; i++) for (i = 0; i < length; i++)
max = FFMAX(max, FFABS(vector[i])); max = FFMAX(max, FFABS(vector[i]));
max = FFMIN(max, 0x7FFF);
bits = normalize_bits(max, 15); bits = normalize_bits(max, 15);
scale = (bits == 15) ? 0x7FFF : (1 << bits); scale = (bits == 15) ? 0x7FFF : (1 << bits);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册