[MPlayer-dev-eng] [PATCH] Fix hrtf for stereo source
Yuriy Kaminskiy
yumkam at gmail.com
Thu Dec 4 22:49:23 CET 2014
Reimar Döffinger wrote:
> 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:
Your variant certainly better matches pre-r15385, so maybe it should be
preferred (as in "don't mingle bugfixes with semantic changes").
Which is "more correct", no idea.
Intuitively, if 4+-channel data was encoded as 2-channel, and "matrix decode"
decode them back, then "hormal hrtf" should be applied to decoded data (as in my
patch).
Another alternative - "AF_DETACH hrtf filter with 2-channel sources, it does
more harm than good on them".
Disclaimer: I've never tried to understand how hrtf/matrix decode magic works.
> @@ -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