[FFmpeg-devel] [PATCH 09/25] avfilter/af_headphone: Use uint64_t for channel mapping

Paul B Mahol onemda at gmail.com
Wed Sep 9 04:15:28 EEST 2020


On Tue, Sep 08, 2020 at 11:18:40PM +0200, Andreas Rheinhardt wrote:
> 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.
> 
> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
> ---
>  libavfilter/af_headphone.c | 40 +++++++++++++-------------------------
>  1 file changed, 13 insertions(+), 27 deletions(-)
> 

ok, if does not break usage.


More information about the ffmpeg-devel mailing list