]> git.sesse.net Git - ffmpeg/commitdiff
swresample: Use channel count in rematrix initialization
authorMarcin Gorzel <gorzel-at-google.com@ffmpeg.org>
Tue, 24 Jul 2018 13:55:47 +0000 (14:55 +0100)
committerMichael Niedermayer <michael@niedermayer.cc>
Thu, 26 Jul 2018 00:42:42 +0000 (02:42 +0200)
Rematrixing supports up to 64 channels. However, there is only a limited number of channel layouts defined. Since the in/out channel count is currently obtained from the channel layout, for undefined layouts (e.g. for 9, 10, 11 channels etc.) the rematrixing fails.

This patch changes rematrix init methods to use in (used) and out channel count directly instead of computing it from channel layout.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libswresample/rematrix.c
libswresample/x86/rematrix_init.c

index 82277300564d652cb40345e98c6be3f7df03f5ad..6b5feaa07b69e408cd99b2ba0613786656bc4c54 100644 (file)
@@ -384,8 +384,8 @@ av_cold static int auto_matrix(SwrContext *s)
 
 av_cold int swri_rematrix_init(SwrContext *s){
     int i, j;
-    int nb_in  = av_get_channel_layout_nb_channels(s->in_ch_layout);
-    int nb_out = av_get_channel_layout_nb_channels(s->out_ch_layout);
+    int nb_in  = s->used_ch_count;
+    int nb_out = s->out.ch_count;
 
     s->mix_any_f = NULL;
 
index d71b41a73e4fabb30abd4675c6d544cdd21cd2cd..d6616f83bed0848cc90cd6f8dd92669b85037d4a 100644 (file)
@@ -33,8 +33,8 @@ D(int16, sse2)
 av_cold int swri_rematrix_init_x86(struct SwrContext *s){
 #if HAVE_X86ASM
     int mm_flags = av_get_cpu_flags();
-    int nb_in  = av_get_channel_layout_nb_channels(s->in_ch_layout);
-    int nb_out = av_get_channel_layout_nb_channels(s->out_ch_layout);
+    int nb_in  = s->used_ch_count;
+    int nb_out = s->out.ch_count;
     int num    = nb_in * nb_out;
     int i,j;