[vlc-devel] [PATCH 1/3] spacialaudio: discard non diegetic channels

Francois Cartegnie fcvlcdev at free.fr
Tue May 22 17:17:30 CEST 2018


Le 22/05/2018 à 16:53, Pierre Lamot a écrit :
> ---
>  modules/audio_filter/channel_mixer/spatialaudio.cpp | 13 +++++++++++--
>  1 file changed, 11 insertions(+), 2 deletions(-)
> 
> diff --git a/modules/audio_filter/channel_mixer/spatialaudio.cpp b/modules/audio_filter/channel_mixer/spatialaudio.cpp
> index 6448585e37..f1f60453db 100644
> --- a/modules/audio_filter/channel_mixer/spatialaudio.cpp
> +++ b/modules/audio_filter/channel_mixer/spatialaudio.cpp
> @@ -123,6 +123,7 @@ struct filter_spatialaudio
>      mtime_t i_inputPTS;
>      mtime_t i_last_input_pts;
>      unsigned i_order;
> +    unsigned i_nondiegetic;
>  
>      float** inBuf;
>      float** outBuf;
> @@ -220,7 +221,7 @@ static block_t *Mix( filter_t *p_filter, block_t *p_buf )
>                  CBFormat inData;
>                  inData.Configure(p_sys->i_order, true, AMB_BLOCK_TIME_LEN);
>  
> -                for (unsigned i = 0; i < p_sys->i_inputNb; ++i)
> +                for (unsigned i = 0; i < p_sys->i_inputNb - p_sys->i_nondiegetic; ++i)
>                      inData.InsertStream(p_sys->inBuf[i], i, AMB_BLOCK_TIME_LEN);
>  
>                  Orientation ori(p_sys->f_teta, p_sys->f_phi, p_sys->f_roll);
> @@ -420,6 +421,7 @@ static int Open(vlc_object_t *p_this)
>      }
>  
>      p_sys->i_order = sqrt(infmt->i_channels) - 1;
> +    p_sys->i_nondiegetic = infmt->i_channels - ( (p_sys->i_order + 1) * (p_sys->i_order + 1) );
>  

Since this is used to compute offsets,
I does seem to lack channels count check somewhere to do this.
ex: sqrt(2) and upper rounding



-- 
Francois Cartegnie
VideoLAN - VLC Developer


More information about the vlc-devel mailing list