From patchwork Sun Oct 9 01:49:15 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Moritz Barsnick X-Patchwork-Id: 917 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.103.140.66 with SMTP id o63csp1963281vsd; Sat, 8 Oct 2016 18:55:30 -0700 (PDT) X-Received: by 10.28.207.77 with SMTP id f74mr4172186wmg.35.1475978130191; Sat, 08 Oct 2016 18:55:30 -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 w143si9775464wmd.147.2016.10.08.18.55.27; Sat, 08 Oct 2016 18:55:30 -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; 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 Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id E97D96898B1; Sun, 9 Oct 2016 04:55:08 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mout.gmx.net (mout.gmx.net [212.227.15.18]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 070A7689744 for ; Sun, 9 Oct 2016 04:55:02 +0300 (EEST) Received: from paradise.fritz.box ([80.144.19.106]) by mail.gmx.com (mrgmx003) with ESMTPSA (Nemesis) id 0LqRKT-1bF3nX2fWz-00e76j; Sun, 09 Oct 2016 03:50:10 +0200 From: Moritz Barsnick To: FFmpeg development discussions and patches Date: Sun, 9 Oct 2016 03:49:15 +0200 Message-Id: <72239e255853a51dde84e70351d059df4bef5acd.1475977585.git.barsnick@gmx.net> X-Mailer: git-send-email 2.7.4 In-Reply-To: References: In-Reply-To: References: X-Provags-ID: V03:K0:Dz2XvxwKGJ5OJwqB9WD3iXfT81tXvdb6xkTSEjuXtg4c6/kvMDX fWrsAIbAsjeIQjmGdBfYLLTES/12d+rSIiAdA4swDbC6I/kOfFi8+Vik8udNTVHE8EDdinG piji7fsHfmcKw2YCQ+Gidq0rseBs/VChozWiamo1IDlnz+MeyXkcQQd4ZyL27QPcZd9cJS+ eY5VQMHWIeLgN+UXX3XoA== X-UI-Out-Filterresults: notjunk:1; V01:K0:+683sQZe4N8=:FfUfAniJzeA4jGo5Z8hnAC FA2vZBjVkLyME7R7EF2bib5MUtVvFtCqx7mwd822JLDrsM3n+7/8nwrMmnoaSjJzlTES/I9fu cgdVukfLwI7SseEOgAVuAKLgUMtwxcrpbcF64TFDW3mAZyG9EcvgMlBljfLlwtbnpuj2DILzi m/kF8UCRPxbV1ysNnRGcXcKebmFA4hQQPmlEOx/v45MaM/hxYnkfhRUyEyssuksH3UWj5LM0B wbOsZfu/LYrRrbqKwe4iZD1ifC8HD0qklsEfbVKQhCB5X4JaAQBYb0DAKhz8BclC20x1eQznn Lp1YqV6DtudtyL8ccySW0SAVCRtdihMM6qpzJNzVKXssv3xIlLxaz0XgEo7wKfrDhrXk/p8Bz VqjJm0bA/79emJrOxgKBbbuiz19oifFn7b6xUZrwKEga5v7iv65hiPB+Hx0BlK07OTA/nJdoW MugiAHfcD8HB567rwhbNqFciwycIi4nw/4InaLU95OwyoCyCVmarvfBiok3vcAwB19/MBm/rh +Y12N8ihZ/l9E6nUBHlDJLyE5QXdATXj9ay1iCj6AkiteWFxrrRolGFvSCVfLwkv96MXD+XvM E1OzOyPFEUFKMT21CKJOFx+3/iPYIvFACCn0STX2F0d5LoG6NdJbQ2TDrZT1/1AvrBNJqgBcn oFLMWFQ4oLbq3ojlOslfuddExa6PCO1Ik2ROKHJkXY1UPGfZyJgLjXrekvoGalXZ8KsA9fX6A eIxYwj0z1WWwpf1SZslHcxG8tjNTBxT3QRAHQlkPy+WgsziGGXdl+ygjujs= Subject: [FFmpeg-devel] [PATCH] lavfi/pan: renormalize negative gain coefficients properly 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 Cc: Moritz Barsnick MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" The parser for the outdef will accept a negative value for the first named channel's gain. As negative values effectively only invert the phase of the signal, and not negate the level, the gains' absolute values must be used to correctly accumulate the levels. Signed-off-by: Moritz Barsnick --- libavfilter/af_pan.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavfilter/af_pan.c b/libavfilter/af_pan.c index 1eb102c..3037864 100644 --- a/libavfilter/af_pan.c +++ b/libavfilter/af_pan.c @@ -322,7 +322,7 @@ static int config_props(AVFilterLink *link) continue; t = 0; for (j = 0; j < link->channels; j++) - t += pan->gain[i][j]; + t += fabs(pan->gain[i][j]); if (t > -1E-5 && t < 1E-5) { // t is almost 0 but not exactly, this is probably a mistake if (t)