summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/opus_projection_decoder.c2
-rw-r--r--src/opus_projection_encoder.c14
2 files changed, 10 insertions, 6 deletions
diff --git a/src/opus_projection_decoder.c b/src/opus_projection_decoder.c
index a9b1d65c..0d1ee41f 100644
--- a/src/opus_projection_decoder.c
+++ b/src/opus_projection_decoder.c
@@ -103,7 +103,7 @@ int opus_projection_decoder_init(OpusProjectionDecoder *st, opus_int32 Fs,
/* Assign demixing matrix. */
st->demixing_matrix_size_in_bytes = expected_matrix_size;
- mapping_matrix_init(get_demixing_matrix(st), nb_input_streams, channels, 0,
+ mapping_matrix_init(get_demixing_matrix(st), channels, nb_input_streams, 0,
buf, demixing_matrix_size);
/* Set trivial mapping so each input channel pairs with a matrix column. */
diff --git a/src/opus_projection_encoder.c b/src/opus_projection_encoder.c
index e34b0e57..a2c2f353 100644
--- a/src/opus_projection_encoder.c
+++ b/src/opus_projection_encoder.c
@@ -361,7 +361,7 @@ int opus_projection_encoder_ctl(OpusProjectionEncoder *st, int request, ...)
break;
case OPUS_PROJECTION_GET_DEMIXING_MATRIX_REQUEST:
{
- int i;
+ int i, j, k, l;
int nb_input_streams;
int nb_output_streams;
unsigned char *external_char;
@@ -388,10 +388,14 @@ int opus_projection_encoder_ctl(OpusProjectionEncoder *st, int request, ...)
}
/* Copy demixing matrix subset to output destination. */
- for (i = 0; i < nb_input_streams * nb_output_streams; i++)
- {
- external_char[2*i] = (unsigned char)internal_short[i];
- external_char[2*i+1] = (unsigned char)(internal_short[i] >> 8);
+ l = 0;
+ for (i = 0; i < nb_input_streams; i++) {
+ for (j = 0; j < nb_output_streams; j++) {
+ k = demixing_matrix->rows * i + j;
+ external_char[2*l] = (unsigned char)internal_short[k];
+ external_char[2*l+1] = (unsigned char)(internal_short[k] >> 8);
+ l++;
+ }
}
}
break;