From patchwork Thu Oct 20 03:57:35 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: v0lt r X-Patchwork-Id: 1091 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.103.140.133 with SMTP id o127csp754069vsd; Thu, 20 Oct 2016 11:19:24 -0700 (PDT) X-Received: by 10.194.138.232 with SMTP id qt8mr1087226wjb.131.1476987564854; Thu, 20 Oct 2016 11:19:24 -0700 (PDT) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id 18si62915359wjz.280.2016.10.20.11.19.24; Thu, 20 Oct 2016 11:19:24 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@rambler.ru; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE dis=NONE) header.from=rambler.ru Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 69594689B78; Thu, 20 Oct 2016 21:19:19 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mxout4.rambler.ru (mxout4.rambler.ru [81.19.78.103]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 60F06689942 for ; Thu, 20 Oct 2016 06:57:33 +0300 (EEST) Received: from saddam3.rambler.ru (saddam3.rambler.ru [10.32.16.3]) by mxout4.rambler.ru (Postfix) with ESMTP id A5B2914026B for ; Thu, 20 Oct 2016 06:57:35 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rambler.ru; s=mail; t=1476935855; bh=5ETo2/JfS+lDE4wepKcmsEQDNVU8uk+ts+qHAMJZWpo=; h=From:To:Reply-To:Subject:Date; b=g1ZAlfcRWcshTzjmhqE+ocEQDKt39LbaEvevMG/LodYwDrGYz+v11s6N9yKuw8hgk E5rl9Lk5vLdHkKyWTANGAMe8On4OPoj9/IJNR4MRRsdmiImlHAIEnVFnYicbcGpzec av2ffwXfa7kRUvFEeHO66Wwpy1GdjRwennHrjLyg= Received: from localhost.localdomain (localhost [127.0.0.1]) by saddam3.rambler.ru (Postfix) with ESMTP id 8926E81459EC for ; Thu, 20 Oct 2016 06:57:35 +0300 (MSK) Received: from [46.147.73.161] by mail.rambler.ru with HTTP; Thu, 20 Oct 2016 06:57:35 +0300 From: "v0lt r" To: ffmpeg-devel@ffmpeg.org Date: Thu, 20 Oct 2016 06:57:35 +0300 Content-Disposition: inline Message-Id: <1476935855.458503.20580.33011@mail.rambler.ru> MIME-Version: 1.0 X-Mailer: Rambler WebMail, http://mail.rambler.ru/ X-Rambler-User: v0lt@rambler.ru/46.147.73.161 X-Mailman-Approved-At: Thu, 20 Oct 2016 21:19:18 +0300 Subject: [FFmpeg-devel] Ticket #5897. swresample. Incorrect work of swr_set_matrix() if the SwrContext was never initialized X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" 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(-) 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;