[MPlayer-cvslog] r35304 - trunk/libaf/af_hrtf.c

upsuper subversion at mplayerhq.hu
Wed Oct 31 05:23:39 CET 2012


Author: upsuper
Date: Wed Oct 31 05:23:38 2012
New Revision: 35304

Log:
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.

Modified:
   trunk/libaf/af_hrtf.c

Modified: trunk/libaf/af_hrtf.c
==============================================================================
--- trunk/libaf/af_hrtf.c	Tue Oct 30 19:53:58 2012	(r35303)
+++ trunk/libaf/af_hrtf.c	Wed Oct 31 05:23:38 2012	(r35304)
@@ -26,6 +26,7 @@
 #include <inttypes.h>
 
 #include <math.h>
+#include <libavutil/common.h>
 
 #include "mp_msg.h"
 #include "af.h"
@@ -542,16 +543,16 @@ static af_data_t* play(struct af_instanc
 	      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;
 	}
 


More information about the MPlayer-cvslog mailing list