[MPlayer-dev-eng] [PATCH] Fix hrtf for stereo source

Reimar Döffinger Reimar.Doeffinger at gmx.de
Tue Dec 2 20:17:16 CET 2014


On Tue, Dec 02, 2014 at 09:47:20PM +0300, Yuriy Kaminskiy wrote:
> In stereo mode (nch = 2) hrtf filter feeds junk (in[2]..in[4]) into "bass
> compensation delay line" (and access past end of buffer while reading last
> sample(s), resulting in periodic clicks in some cases).
> This looks like regression from svn r15385 ("actually output 2 channel audio
> (instead of 6 channel with 4 empty channels)"), before that (dummy) 5-channel
> input was forced (or so it looks).
> Attached patch should fix this.

Sure that is the right way?
Should that statement sum up the matrix-decoded values or should it
only sum the raw input values?
Or to put it differently: is your version more correct or something like
this:
@@ -278,8 +278,12 @@ static inline void update_ch(af_hrtf_t *s, short *in, const int k)
     }
 
     /* We need to update the bass compensation delay line, too. */
-    s->ba_l[k] = in[0] + in[4] + in[2];
-    s->ba_r[k] = in[4] + in[1] + in[3];
+    s->ba_l[k] = in[0];
+    s->ba_r[k] = in[1];
+    if(data->nch >= 5) {
+        s->ba_l[k] += in[4] + in[2];
+        s->ba_r[k] += in[4] + in[3];
+    }
 }
 
 /* Initialization and runtime control */


More information about the MPlayer-dev-eng mailing list