summaryrefslogtreecommitdiffstats
path: root/libaf
diff options
context:
space:
mode:
authorupsuper <upsuper@b3059339-0415-0410-9bf9-f77b7e298cf2>2012-10-31 04:23:38 +0000
committerwm4 <wm4@nowhere>2012-10-31 22:43:46 +0100
commita169aa6364ad857b174457a733ef9487a2d07188 (patch)
tree2bfb6fd62414532a62b6abd7c83c76b78b6dbade /libaf
parent78899a096f7777094516d3a0e323b2fe2315ae3c (diff)
downloadmpv-a169aa6364ad857b174457a733ef9487a2d07188.tar.bz2
mpv-a169aa6364ad857b174457a733ef9487a2d07188.tar.xz
af_hrtf: clamp output to relieve noises
This patch relieves noises from af_hrtf by using av_clip_* instead of casting directly. There are still some noises, which indicates other bugs inside this filter. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@35304 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libaf')
-rw-r--r--libaf/af_hrtf.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/libaf/af_hrtf.c b/libaf/af_hrtf.c
index d8ec33e11b..4edf224de9 100644
--- a/libaf/af_hrtf.c
+++ b/libaf/af_hrtf.c
@@ -26,6 +26,7 @@
#include <inttypes.h>
#include <math.h>
+#include <libavutil/common.h>
#include "af.h"
#include "dsp.h"
@@ -541,16 +542,16 @@ static af_data_t* play(struct af_instance_s *af, af_data_t *data)
perception. Note: Too much will destroy the acoustic space
and may even result in headaches. */
diff = STEXPAND2 * (left - right);
- out[0] = (int16_t)(left + diff);
- out[1] = (int16_t)(right - diff);
+ out[0] = av_clip_int16(left + diff);
+ out[1] = av_clip_int16(right - diff);
break;
case HRTF_MIX_MATRIX2CH:
/* Do attempt any stereo expansion with matrix encoded
sources. The L, R channels are already stereo expanded
by the steering, any further stereo expansion will sound
very unnatural. */
- out[0] = (int16_t)left;
- out[1] = (int16_t)right;
+ out[0] = av_clip_int16(left);
+ out[1] = av_clip_int16(right);
break;
}