]> git.sesse.net Git - ffmpeg/commit
avfilter/af_headphone: Use uint64_t for channel mapping
authorAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
Mon, 24 Aug 2020 20:17:02 +0000 (22:17 +0200)
committerAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
Wed, 9 Sep 2020 11:46:30 +0000 (13:46 +0200)
commitbc533ba2ae46978a826c0ace242b3e2e4cabd9fb
treed56ed549af0c244f9011502f197fbc581d48fd7a
parent5e68727fa7265a1f2eb0faf63e0b87869cc41199
avfilter/af_headphone: Use uint64_t for channel mapping

The headphone filter has an option for the user to specify an assignment
of inputs to channels (or from pairs of channels of the second input to
channels). Up until now, these channels were stored in an int containing
the logarithm of the channel layout. Yet it is not the logarithm that is
used lateron and so a retransformation was necessary. Therefore this
commit simply stores the uint64_t as is, avoiding the retransformation.

This also has the advantage that unset channels (whose corresponding
entry is zero) can't be mistaken for valid channels any more; the old
code had to initialize the channels to -1 to solve this problem and had
to check for whether a channel is set before the retransformation
(because 1 << -1 is UB).

The only downside of this approach is that the size of the context
increases (by 256 bytes); but this is not exceedingly much.

Finally, the array has been moved to the end of the context; it is only
used a few times during the initialization process and moving it
decreased the offsets of lots of other entries, reducing codesize.

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