* commit 'cc976a75dffa148d655b52604331679ff669e8a2':
audio_mix: print (SKIP) instead of 0.0 for matrix columns removed along with output zeroing
Merged-by: Michael Niedermayer <michaelni@gmx.at>
* commit 'fc6a3ef40d34ce8443ae57c2452f3f273d7d4891':
audio_mix: fix zeroing output channels in certain cases
Merged-by: Michael Niedermayer <michaelni@gmx.at>
Specifically, when the corresponding input channel exists and its matrix
column is all-zero (which is necessary for zeroing the output), the
matrix column must be removed from the matrix.
This is not done currently, so the mixing code would end up using
uninitialized pointers from stack.
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
This should make it easier to catch problems where some of those
pointers are used uninitialized, since reading from NULL should always
crash, while random numbers from stack can turn out to be valid
pointers, so random memory may be silently overwritten.
* commit 'df6737a55f5dc7c0ae5272bc5fa6182836d5481c':
audio_mix: fix channel order in mix_1_to_2_fltp_flt_c
Merged-by: Michael Niedermayer <michaelni@gmx.at>
In some cases when an input contributes fully to the corresponding
output, other inputs may also contribute to the same output. This is the
case, for example, for the default 5.1 to stereo downmix matrix without
normalization.
This is needed if a custom matrix is set by the user after opening the
AVAudioResampleContext because the matrix channel count can change if
different mixing coefficients are used.
CC:libav-stable@libav.org
If the matrix results in an output channel not getting a contribution
from any input channel and the corresponding input channel does not
contribute to any outputs, we can skip the channel during mixing and
silence it after mixing.
If the matrix results in an input channel not contributing to any output
channels and it is not in the output mix, or if the input channel only
contributes fully to the same output channel, we can skip the channel
during mixing.
If the matrix results in an output channel only getting full
contribution from the corresponding input channel and that input channel
does not contribute to any other output channels, we can skip the
channel during mixing.
This allows AudioMix to be treated the same way as other conversion contexts
and removes the requirement to allocate it at the same time as the
AVAudioResampleContext.
The current matrix get/set functions are split between the public interface
and AudioMix private functions.