]> git.sesse.net Git - ffmpeg/commit
avfilter/af_headphone: Fix channel assignment
authorAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
Wed, 26 Aug 2020 02:24:26 +0000 (04:24 +0200)
committerAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
Wed, 9 Sep 2020 11:47:24 +0000 (13:47 +0200)
commit0952f8f909fa723d790ceb43e562e316efbf99dd
tree5d843a12f2d1a579ace560e14bdc187d54f4c65e
parentd883bca0f0f15bd4b86d57fb64c172b3c0c8850f
avfilter/af_headphone: Fix channel assignment

The documentation of the map argument of the headphone filter states:

"Set mapping of input streams for convolution. The argument is a
’|’-separated list of channel names in order as they are given as
additional stream inputs for filter."

Yet this has not been honoured at all. Instead for the kth given HRIR
channel pair it was checked whether there was a kth mapping and if the
channel position so given was present in the channel layout of the main
input; if so, then the given HRIR channel pair was matched to the kth
channel of the main input. It should actually have been matched to the
channel given by the kth mapping. A consequence of the current algorithm
is that if N additional HRIR channel pairs are given, a permutation of
the first N entries of the mapping does not affect the output at all.

The old code might even set arrays belonging to streams that don't exist
(i.e. whose index is >= the number of channels of the main input
stream); these parts were not read lateron at all. The new code doesn't
do this any longer and therefore the number of elements of some of the
allocated arrays has been reduced (in case the number of mappings was
bigger than the number of channels of the first input stream).

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
libavfilter/af_headphone.c