From patchwork Wed Aug 31 12:51:06 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: real.zhurui@gmail.com X-Patchwork-Id: 37573 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:139a:b0:8f:1db5:eae2 with SMTP id w26csp329934pzh; Wed, 31 Aug 2022 05:51:30 -0700 (PDT) X-Google-Smtp-Source: AA6agR7Xjj7tynSoqSUOEK+V4w6tvkNSYIXwjks6eVMjUz4v8SU1WWmdEnwGXI1BoiHkoIhjUrjX X-Received: by 2002:a17:906:fc6:b0:72f:d080:416 with SMTP id c6-20020a1709060fc600b0072fd0800416mr20245052ejk.1.1661950289842; Wed, 31 Aug 2022 05:51:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661950289; cv=none; d=google.com; s=arc-20160816; b=o9YXIXeRtlxueKuL/CSHgrQOyadAs4MpG0rXCUIYK5IbO3FSYJ/aWvGdCg86UYWoru ybE3fZ0iTTDM8k3daTm6ZMoLw2En7SrR9RJRNnDpMlTYRelLaofxwvqoSVH1SO4TXo77 Z3rpyZ28u/QerED7jeycFLTfj2b99C60TO/T0I0RLAUP4s0ubPwo0sdgq6gI7TINko5V 818MF+4q7nVBfmCtwxwg0WRoQeZoJxFFoAQ91XB2kbmwDbxG2cHRr2VanblyT0pJ/C/Q NjA4VZdhZ0rUu78s2p1hywL/GitntkjbQxlXx5cgFz5o8b2k9pTtGvE58ota3e9xZzSj MxMw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:mime-version:message-id:date:to:from :dkim-signature:delivered-to; bh=Dy4hscpXR+I8o8r0zuwwWZ2IOIfo44oSkkf0YzxyUno=; b=Tq3Yclk5D0k4QX6jPw/OsCqyg1vlO67X/59Aw7qkrj2fl5Re3FTS803o/baekxCgVo Asm0G5cJ5WRCewIQqxRbkRmXXGYF0SXMXfGy0UESFVaEvdXU71okOFhSwCh/2MFoPyao 2tfGY4Ik0Nyu+ME19ei9/uBabD7SWNFYT6uPk6JCVUtQ2oZYNj2rl2Bz5AfnRmsBBHHh J02cbBu8ziOF/AWb3w+AAsmRsem76yjxKvTl3tVZk/DLMDaOlJee16vsKxprSo00Q38h qKbl7k4IYZDH8imRJNXxx336ivUfm6b3g4LnhaYFV3mgS0ytvRMm61hlVvR9CP/zEHyt tFLw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20210112 header.b=QxS3nkb5; 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 sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id m6-20020a056402510600b00447c220a3desi13323953edd.167.2022.08.31.05.51.28; Wed, 31 Aug 2022 05:51:29 -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=@gmail.com header.s=20210112 header.b=QxS3nkb5; 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 sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 4B42268B9DC; Wed, 31 Aug 2022 15:51:25 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-pf1-f170.google.com (mail-pf1-f170.google.com [209.85.210.170]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id EDE7668B8E5 for ; Wed, 31 Aug 2022 15:51:17 +0300 (EEST) Received: by mail-pf1-f170.google.com with SMTP id p185so14287576pfb.13 for ; Wed, 31 Aug 2022 05:51:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date; bh=pLD2iCee4cDL27HeSuq5MXestakBEaX/8PCiAN2ehEQ=; b=QxS3nkb5HWamb6slYgTAdOt5Nwm12YBupgXdGjHxXMZwfVShF/eH/ZXLaNMEmlWWO3 30WkReCbGZTLxOrVEAqbS1jj1s8A5SDaLEVPa92I2Umdwv2ylwCQwmQxMsdfnA5DoF3y n9sX8sowK6Wfib+8xjOtmS3x8FA4roX0GbEkwDZnTYzC4oWD4XbiqzfxHmwnFNe0xBE/ BYFmsNEIxsIYSCN9wPH0KUidj/OKGfHjvxsgyUsJAulw/TAWgfw/2VQNMCFebtNnlVaA HHCQYy15wcqmYfsuZYECj22UDLYqXT+yhG5Q5BaqZeYN4xSAMifeLGLg54OnB6k2Wzro OvnQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date; bh=pLD2iCee4cDL27HeSuq5MXestakBEaX/8PCiAN2ehEQ=; b=OjyjgK4z1v9lua36ffJ9uhOet/Pw8pXwwYZ6ycHMPGJrJnDhskfd/E4OgGHpdGcEYd 7sTht8Bxvip6Ca5Ou7q2fqo3CdTsihWpIOYXZpu11neArgM6Q2PUdTW+zBz6QsPS7g8y dmKQX+CfAsUe2Nb5suRNPNOaOzXP10av5O5vOlil62se5hMnHx2cbxndHCiIe0/+C0Vd PQB1QdfKxJXeLeSYc6LseNt3cUjV8hgoz1QgeCu1ZYPQezF1ak3sj44+4MUotNSzwCGJ +J7w6xwhSkhTncmXsmTQvu60kFnvRJFpNQPHbBGWpBxEFUqRAGhobc2I3ooaPxd5dLbh hR1Q== X-Gm-Message-State: ACgBeo0+dcjXlPKTOkrjq7+FP/xDzrGU/pzAg7W7beDl6IDWFfywyOiW clz5xmodJrXfJVBjhksCJCC8o19FH2SpKz3QxOdg31n2 X-Received: by 2002:a05:6a00:2393:b0:53a:c7a3:16f3 with SMTP id f19-20020a056a00239300b0053ac7a316f3mr2179998pfc.17.1661950276072; Wed, 31 Aug 2022 05:51:16 -0700 (PDT) Received: from localhost.localdomain ([103.7.29.6]) by smtp.gmail.com with ESMTPSA id w85-20020a627b58000000b00535d094d6ecsm11248123pfc.108.2022.08.31.05.51.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 Aug 2022 05:51:15 -0700 (PDT) From: real.zhurui@gmail.com To: ffmpeg-devel@ffmpeg.org Date: Wed, 31 Aug 2022 20:51:06 +0800 Message-Id: <20220831125106.21978-1-real.zhurui@gmail.com> X-Mailer: git-send-email 2.32.1 (Apple Git-133) MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v1] avfilter/af_loudnorm: fix incorrect gain when audio is shorter than 3s X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 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: Rui Zhu Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: eUedgQp+RhZW From: Rui Zhu The input data is multiplied by `s->offset` to get normalized output. `s->target_tp` and `true_peak` is not in dB, so `s->offset` should be calculated by division instead of subtraction. Signed-off-by: Rui Zhu --- libavfilter/af_loudnorm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavfilter/af_loudnorm.c b/libavfilter/af_loudnorm.c index 8d2379f14e..ce61e985b1 100644 --- a/libavfilter/af_loudnorm.c +++ b/libavfilter/af_loudnorm.c @@ -455,7 +455,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) offset = pow(10., (s->target_i - global) / 20.); offset_tp = true_peak * offset; - s->offset = offset_tp < s->target_tp ? offset : s->target_tp - true_peak; + s->offset = offset_tp < s->target_tp ? offset : s->target_tp / true_peak; s->frame_type = LINEAR_MODE; }