diff mbox

[FFmpeg-devel] swresample: Use channel count in rematrix initialization

Message ID 20180724135547.111499-1-gorzel@google.com
State Accepted
Commit 8b710ea5e7b8a3c3f60fb867bb104b0ec9ea4e83
Headers show

Commit Message

Marcin Gorzel July 24, 2018, 1:55 p.m. UTC
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.
---
 libswresample/rematrix.c          | 4 ++--
 libswresample/x86/rematrix_init.c | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

Comments

Michael Niedermayer July 25, 2018, 1:17 a.m. UTC | #1
On Tue, Jul 24, 2018 at 02:55:47PM +0100, Marcin Gorzel wrote:
> 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.
> ---
>  libswresample/rematrix.c          | 4 ++--
>  libswresample/x86/rematrix_init.c | 4 ++--
>  2 files changed, 4 insertions(+), 4 deletions(-)

will apply

thx

[...]
diff mbox

Patch

diff --git a/libswresample/rematrix.c b/libswresample/rematrix.c
index 8227730056..6b5feaa07b 100644
--- a/libswresample/rematrix.c
+++ b/libswresample/rematrix.c
@@ -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;
 
diff --git a/libswresample/x86/rematrix_init.c b/libswresample/x86/rematrix_init.c
index d71b41a73e..d6616f83be 100644
--- a/libswresample/x86/rematrix_init.c
+++ b/libswresample/x86/rematrix_init.c
@@ -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;