提交 459da1c8 编写于 作者: J J.D. Purcell 提交者: jp9000

obs-filters: Fix heavy distortion in Noise Suppression filter

Noise Suppression: Clamp sample values before converting to integer.
This fixes an issue where samples exceeding full scale would overflow,
resulting in heavy distortion.

Closes jp9000/obs-studio#1113
上级 c7067420
......@@ -155,9 +155,13 @@ static inline void process(struct noise_suppress_data *ng)
/* Convert to 16bit */
for (size_t i = 0; i < ng->channels; i++)
for (size_t j = 0; j < ng->frames; j++)
for (size_t j = 0; j < ng->frames; j++) {
float s = ng->copy_buffers[i][j];
if (s > 1.0f) s = 1.0f;
else if (s < -1.0f) s = -1.0f;
ng->segment_buffers[i][j] = (spx_int16_t)
(ng->copy_buffers[i][j] * c_32_to_16);
(s * c_32_to_16);
}
/* Execute */
for (size_t i = 0; i < ng->channels; i++)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册