From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.ffmpeg.org (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTPS id 9AFEE4E168 for ; Tue, 13 Jan 2026 17:54:39 +0000 (UTC) Authentication-Results: ffbox; dkim=fail (body hash mismatch (got b'4+wgX0OwurpvyOYFQrn5o0z/U9wCe9tE5TpAVMB8oy4=', expected b'YyoGkryMcjt1hmd3SpxlLHHuCIpSIQb5r9LC5bb3vLA=')) header.d=ffmpeg.org header.i=@ffmpeg.org header.a=rsa-sha256 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ffmpeg.org; i=@ffmpeg.org; q=dns/txt; s=mail; t=1768326771; h=mime-version : to : date : message-id : reply-to : subject : list-id : list-archive : list-archive : list-help : list-owner : list-post : list-subscribe : list-unsubscribe : from : cc : content-type : content-transfer-encoding : from; bh=4+wgX0OwurpvyOYFQrn5o0z/U9wCe9tE5TpAVMB8oy4=; b=S/cd4G0/Y0a7fFlwZVCVeOrrQQUN1jZpjHIKfYVK5iytEorGOISrxYS92HyX9DvjnaVVl 77xYfB4LgHZvHuwIfRepiNN/j7Lz+mCJGEINEDJV77JgFVwHBLB0qYAIna/zEmBL7HLyUW8 xrLefPgzM739DvS+OSgx6cj3dKPWRobZtGqdCcTYOwLorBMlP/DNfp71c7n0NfEp3Kt0v9M w/gw5CRzo2RyuynPA7a1bZLO2Huds/oE15d7rtmOEEHeUHtMKpPTH5yFv/PwXhfMjY5dB7b bprnokTaORn21XJX3PMckvEC/vP4mlv7k+QPFXnWMTtshl5jMsCyLbvxRDkQ== Received: from [172.20.0.4] (unknown [172.20.0.4]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTP id ABFD5690D65; Tue, 13 Jan 2026 19:52:51 +0200 (EET) ARC-Seal: i=1; cv=none; a=rsa-sha256; d=ffmpeg.org; s=arc; t=1768326728; b=eV/USbHh/xu28Rhd/xRUJo26XGZ4mGEu9F3CfhVjUl2fWpaa+EGxvoO2emJMko78SohqF v9gqei1e2lJM+EV2+0w4r2ghSm6lnlgDLhSb66+rx9eAHsFiUIVUS0vpL2XyBVLJ0mQsGYr HhL0z8kCixtK51vl1S0AsgaW99kQ7Pj10KUbIDjl0aBMTo6D6cpmy0drlyKgVPlPki+X/hM wg1eY45/zoM9+scA3Z+JjO2bgg/aVgTNk8wqJ+Dwqwl4w3N9cLL6Rt9eOAH6XOdFcmaEXFX dRnl1WGLkbOvF4T9WBOT4/y20PCoIv/RjAWEQwa0TvkcAKuv3Dq0NrZ3pdvw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=ffmpeg.org; s=arc; t=1768326728; h=from : sender : reply-to : subject : date : message-id : to : cc : mime-version : content-type : content-transfer-encoding : content-id : content-description : resent-date : resent-from : resent-sender : resent-to : resent-cc : resent-message-id : in-reply-to : references : list-id : list-help : list-unsubscribe : list-subscribe : list-post : list-owner : list-archive; bh=ufMaPlSDsAEPBLeP0shQB3XO96/Z+0imrc1/IyImy9g=; b=q5yh3AMTeVbE9lAUQdQXxamIHr7ub+v//I0chza5ClH0nAqPguRyJF7F182sbedRsin4G VQ3U9sv0MIuzAaUttQsM38Ywe6jiLIlDOxzz375DEfYIdsbj9HBUmApy7jXukA0vGi9IQ7X HCFjOkCZdU17Z0qciRvK+acwZvoTH3gLGTMxUS1JE+cqQdTVSpOghXDBrBKdjTC6PlvDNFU Pzy3H+myriVCMFCqZP3kq9U3YC8/BBNcB7ZmmrIhg/obNtqQzmXm8xfPG6ljuCtLi1rXLSA z+Hxrwwwo9LX/e7HdArH8ve6uqCHFuGfzcstp1cSMUxUwkpQPajphIm+6bBg== ARC-Authentication-Results: i=1; ffmpeg.org; dkim=pass header.d=ffmpeg.org header.i=@ffmpeg.org; arc=none; dmarc=pass header.from=ffmpeg.org policy.dmarc=quarantine Authentication-Results: ffmpeg.org; dkim=pass header.d=ffmpeg.org header.i=@ffmpeg.org; arc=none (Message is not ARC signed); dmarc=pass (Used From Domain Record) header.from=ffmpeg.org policy.dmarc=quarantine DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ffmpeg.org; i=@ffmpeg.org; q=dns/txt; s=mail; t=1768326716; h=content-type : mime-version : content-transfer-encoding : from : to : reply-to : subject : date : from; bh=YyoGkryMcjt1hmd3SpxlLHHuCIpSIQb5r9LC5bb3vLA=; b=nU/Dt3YNBaCF3qdKdJvPNQzlc77QZ/fHLdGbQC6cqKrTxbMTXiCnmJmhA75KvD9of9ZOx fWt4AYXeS3ernqkUiygb9UHW7YVTl3pvfYCDgG24t7bK7fNx/I5ndmRznTQ7rVax6c0qxdP IULQrP6AaV/6Nr/WFwkPV/BYgWU6eyvWJtU9Z7y6Yqf76OVc2K2sCZ0W41CgQ3K/+m1qbYv gvp3uixZIu8p6HIE16Ab7m3oMTBn6eMxzlz7iTo6YwsqnGl9l+qIzp3fVyBN00zV67kH46P ygbiPOSLuXOe2yXp+iL9bXTnpvGjup9jutYAwWsxCiHYF2A1lG1MmMp2ZU3w== Received: from f7c34508609e (code.ffmpeg.org [188.245.149.3]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTPS id ED37068FEFE for ; Tue, 13 Jan 2026 19:51:55 +0200 (EET) MIME-Version: 1.0 To: ffmpeg-devel@ffmpeg.org Date: Tue, 13 Jan 2026 17:51:55 -0000 Message-ID: <176832671620.25.15101392399745361618@4457048688e7> Message-ID-Hash: ZU6B6ZLMAOCVLGA37VL4NHSK57DHT4CG X-Message-ID-Hash: ZU6B6ZLMAOCVLGA37VL4NHSK57DHT4CG X-MailFrom: code@ffmpeg.org X-Mailman-Rule-Hits: nonmember-moderation X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; header-match-ffmpeg-devel.ffmpeg.org-0; header-match-ffmpeg-devel.ffmpeg.org-1; header-match-ffmpeg-devel.ffmpeg.org-2; header-match-ffmpeg-devel.ffmpeg.org-3; emergency; member-moderation X-Mailman-Version: 3.3.10 Precedence: list Reply-To: FFmpeg development discussions and patches Subject: [FFmpeg-devel] [PR] avfilter/af_loudnorm: fix limiter buffer over-allocation (PR #21452) List-Id: FFmpeg development discussions and patches Archived-At: Archived-At: List-Archive: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: realies via ffmpeg-devel Cc: realies Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Archived-At: List-Archive: List-Post: PR #21452 opened by realies URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/21452 Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/21452.patch The limiter_buf was being allocated with buf_size (3000ms worth of samples) instead of limiter_buf_size (210ms worth of samples). This resulted in allocating approximately 14x more memory than needed for the limiter buffer. ## Memory profiling results (valgrind massif, 192kHz stereo) | Version | Peak Heap Allocation | |---------|---------------------| | Before | 87,415,378 bytes (~83.4 MB) | | After | 79,075,138 bytes (~75.4 MB) | | **Saved** | **8,340,240 bytes (~8.0 MB)** | ## Details At 192kHz stereo: - buf_size: 1,152,000 samples = 9.2 MB - limiter_buf_size: 80,640 samples = 0.6 MB - Wasted per instance: ~8.6 MB The bug was introduced when the limiter buffer was added but the wrong size variable was used in av_malloc_array(). >>From e413d357c0b8a250ccf4efb4b61fc4fd323db297 Mon Sep 17 00:00:00 2001 From: realies Date: Tue, 13 Jan 2026 19:34:00 +0200 Subject: [PATCH] avfilter/af_loudnorm: fix limiter buffer over-allocation The limiter_buf was being allocated with buf_size (3000ms worth of samples) instead of limiter_buf_size (210ms worth of samples). This resulted in allocating approximately 14x more memory than needed for the limiter buffer. At 192kHz stereo: - buf_size: 1,152,000 samples = 9.2 MB - limiter_buf_size: 80,640 samples = 0.6 MB - Wasted: ~8.2 MB per filter instance The bug was introduced when the limiter buffer was added but the wrong size variable was used in av_malloc_array(). --- 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 432b9710a5..00d0a145ae 100644 --- a/libavfilter/af_loudnorm.c +++ b/libavfilter/af_loudnorm.c @@ -774,7 +774,7 @@ static int config_input(AVFilterLink *inlink) return AVERROR(ENOMEM); s->limiter_buf_size = frame_size(inlink->sample_rate, 210) * inlink->ch_layout.nb_channels; - s->limiter_buf = av_malloc_array(s->buf_size, sizeof(*s->limiter_buf)); + s->limiter_buf = av_malloc_array(s->limiter_buf_size, sizeof(*s->limiter_buf)); if (!s->limiter_buf) return AVERROR(ENOMEM); -- 2.49.1 _______________________________________________ ffmpeg-devel mailing list -- ffmpeg-devel@ffmpeg.org To unsubscribe send an email to ffmpeg-devel-leave@ffmpeg.org