diff mbox

[FFmpeg-devel] Ticket #5897. swresample. Incorrect work of swr_set_matrix() if the SwrContext was never initialized

Message ID 1476935855.458503.20580.33011@mail.rambler.ru
State Accepted
Commit 9445e7e6d562e14a6fbc3f73cd282136a239a611
Headers show

Commit Message

v0lt r Oct. 20, 2016, 3:57 a.m. UTC
From 55a5ec258f53fc7a4bdbea200d096bd5d46625d4 Mon Sep 17 00:00:00 2001
From: Aleksoid1978
Date: Wed, 19 Oct 2016 11:38:12 +0300
Subject: [PATCH] fix swr_set_matrix()

---
 libswresample/rematrix.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

Comments

Michael Niedermayer Oct. 20, 2016, 11:56 p.m. UTC | #1
On Thu, Oct 20, 2016 at 06:57:35AM +0300, v0lt r wrote:
> 
> From 55a5ec258f53fc7a4bdbea200d096bd5d46625d4 Mon Sep 17 00:00:00 2001

> From: Aleksoid1978

is this Author name intended ?
do you not want your full name in the git history for your patch ?

If you want your full name, then please resubmit the git patch with
correctly set author

[...]
diff mbox

Patch

diff --git a/libswresample/rematrix.c b/libswresample/rematrix.c
index 1af2498..4721063 100644
--- a/libswresample/rematrix.c
+++ b/libswresample/rematrix.c
@@ -68,14 +68,12 @@  int swr_set_matrix(struct SwrContext *s, const double *matrix, int stride)
     if (!s || s->in_convert) // s needs to be allocated but not initialized
         return AVERROR(EINVAL);
     memset(s->matrix, 0, sizeof(s->matrix));
+    memset(s->matrix_flt, 0, sizeof(s->matrix_flt));
     nb_in  = av_get_channel_layout_nb_channels(s->user_in_ch_layout);
     nb_out = av_get_channel_layout_nb_channels(s->user_out_ch_layout);
     for (out = 0; out < nb_out; out++) {
         for (in = 0; in < nb_in; in++)
-            s->matrix[out][in] = matrix[in];
-        if (s->int_sample_fmt == AV_SAMPLE_FMT_FLTP)
-            for (in = 0; in < nb_in; in++)
-                s->matrix_flt[out][in] = matrix[in];
+            s->matrix_flt[out][in] = s->matrix[out][in] = matrix[in];
         matrix += stride;
     }
     s->rematrix_custom = 1;