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 3853448120 for ; Sun, 14 Sep 2025 21:13:08 +0000 (UTC) Authentication-Results: ffbox; dkim=fail (body hash mismatch (got b'O+v5deLWcBhqa7G8D5p3UN/yqGbLotMX3gDyZS0efxQ=', expected b'n43eabLR+YYqHe5ouQ/YSJMM+pgQAAEcQr2FG+lrAhA=')) 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=1757884382; 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=O+v5deLWcBhqa7G8D5p3UN/yqGbLotMX3gDyZS0efxQ=; b=FdVdjvu9S+0he73dXGpGXFC7y/aCoSUYoXLBNb3zik5z//VFNn7SOOIIrfSZoQP9dvv8j 5GdS4JXEv9SvHPRcdUnlmMKTLDCREI+wnDs8+CPNoubc0L/c2vePn1Ms4wIVPw6iCTJqR9T MKeCB3qeoIRuaUUgrNWb/Vjno5+OGHbC9/ZzxmYDCVv3CyBenfDTZQBJdMS6pgIl44YRSj5 jwnD1dJ7SJmvtGAZp9RR0rL0rP/btcXMoS5NP4LUuX3QvOca3J/8oticvRQA5YIG6zViNNr NA6LVMdra/vYZtzP4W1QoQwXGfRRwoiof6fo8WteW8UAT+o33ByidrneZgzQ== Received: from [172.19.0.4] (unknown [172.19.0.4]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTP id 7952668E7DC; Mon, 15 Sep 2025 00:13:02 +0300 (EEST) ARC-Seal: i=1; cv=none; a=rsa-sha256; d=ffmpeg.org; s=arc; t=1757884381; b=bV/wGJlwJJL9D4j8fBUfPRQON8H+nS4ZsWHchR4/lSzCq2P47vBXAWJt3/bm8xYjVC/lw Phulmo7xEIjyiwF7pYWgrihezEw+LOoOThlqH2rvBmlK1Rys4XAX06ln0flrC9HCUBvDsCl lW5LcwuXNB3uCyD0ynv7CH3ZVy+L1kKou4Wa46Gos+h8VIyNd4PAH6tzBufRZ0XFL7kh1Kj y4tgpBImUXCNg8xffVVb84Nw8vUNL2Bt3EsEPdWKHqsnoCWmNhDu8YwpZkyDmMrCjMO3xe2 x2C32RQZ6B/n/UlAhKpzIOOw+UPcyNtodQU/zAs6HbGj3/iGqqTEsjQkcLeg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=ffmpeg.org; s=arc; t=1757884381; 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=c27FWTNERa7x12S7Ef0SMdSvtfQtunJGeOlbPvxrsUs=; b=hOcyJz0A8QMFBRUIMFk5q8YMQEylWpKuw8VtHXtrBigD4qG3rsn+L3vt4+a/mPPYWCrXg Ax7B0UaS5Hdy1ihZo4NysETtx9yo2tz4whWdtD+zDKf671fXBMnhHNA7S7B67V1vTdZQxTR 8/5f1iJdi/H8RXqYiPEdBA/8f1q7xXxhE7U4Y19GMIkv8oGlmArTBG3UXLTG6N1KSYKpMMb 5GuWMqBYlTMa9+0WecIjx7BsudmuxAq4Ft/E1VxUjk2a1N7nx3G8AydXLMTzvfxPBKy7OPc 5TgJFI8LUBiyO+XzIxVoc6F+/fPcg6QS/AkiZjhaU3XsMmyCfw7c4BrEqT8Q== ARC-Authentication-Results: i=1; ffmpeg.org; dkim=pass header.d=ffmpeg.org header.i=@ffmpeg.org; arc=none; dmarc=none Authentication-Results: ffmpeg.org; dkim=pass header.d=ffmpeg.org header.i=@ffmpeg.org; arc=none (Message is not ARC signed); dmarc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ffmpeg.org; i=@ffmpeg.org; q=dns/txt; s=mail; t=1757884371; h=content-type : mime-version : content-transfer-encoding : from : to : reply-to : subject : date : from; bh=n43eabLR+YYqHe5ouQ/YSJMM+pgQAAEcQr2FG+lrAhA=; b=EtVqUQ0xSEJOdhYf2h6OYIcyXsgSnkHM3dchG+jraeVsWE0eAspEEHP7u4+dUpGwRPSDL ZkKbhEJVqUujL8M4CKa1UIftrI8DynT2gEQWTEHBv0E07Y2XeK2jKS01zpBpQicIJLiVjHR BS1yL2bpzHAwe37/dwiGCRIBe2qdj4rN6xh3p4euCcJ4ABmN3g/7cN2yh/VZilM/aV5jL+x /E8VWBcVRrd8ZRfiw7g8lY4JLQVSelHuZuDWudfaKJhok7dUhs3WA/FNNoyXOaSfedzGAtC fwBE5g2e+fC2oH2mWp6Q9yV8Jcg7poIttzzn7nHUGxQYf962ixGCLAjEgoMQ== Received: from ed19c606a818 (code.ffmpeg.org [188.245.149.3]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTPS id A409868E7C4 for ; Mon, 15 Sep 2025 00:12:51 +0300 (EEST) MIME-Version: 1.0 To: ffmpeg-devel@ffmpeg.org Date: Sun, 14 Sep 2025 21:12:51 -0000 Message-ID: <175788437184.25.1881772988305524450@463a07221176> Message-ID-Hash: O64NNLMDGDOCSKOPGP3RXVVMPMV5DY4A X-Message-ID-Hash: O64NNLMDGDOCSKOPGP3RXVVMPMV5DY4A X-MailFrom: code@ffmpeg.org 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; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list Reply-To: FFmpeg development discussions and patches Subject: [FFmpeg-devel] [PATCH] avcodec/aacenc: add high energy check to exclude unsuitable bands from PNS (PR #20521) 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: Agent45 via ffmpeg-devel Cc: Agent45 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Archived-At: List-Archive: List-Post: PR #20521 opened by Agent45 URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/20521 Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/20521.patch Add a maximum energy check in mark_pns() , adapted from search_for_pns(). Extremely high-energy bands should be excluded early from PNS to prevent harsh artifacts. This resolves issue #20200. >>From b116bf897cb68a076f19304e728d957835d32b2a Mon Sep 17 00:00:00 2001 From: Agent45 Date: Sun, 14 Sep 2025 21:03:37 +0000 Subject: [PATCH] avcodec/aacenc: add high energy check to exclude unsuitable bands from PNS Add a maximum energy check in mark_pns() , adapted from search_for_pns(). Extremely high-energy bands should be excluded early from PNS to prevent harsh artifacts. This resolves issue #20200. --- libavcodec/aaccoder.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/libavcodec/aaccoder.c b/libavcodec/aaccoder.c index 7f1c4cdcc1..346338331d 100644 --- a/libavcodec/aaccoder.c +++ b/libavcodec/aaccoder.c @@ -636,6 +636,7 @@ static void mark_pns(AACEncContext *s, AVCodecContext *avctx, SingleChannelEleme int bandwidth, cutoff; const float lambda = s->lambda; const float freq_mult = avctx->sample_rate*0.5f/wlen; + const float thr_mult = NOISE_LAMBDA_REPLACE*(100.0f/lambda); const float spread_threshold = FFMIN(0.75f, NOISE_SPREAD_THRESHOLD*FFMAX(0.5f, lambda/100.f)); const float pns_transient_energy_r = FFMIN(0.7f, lambda / 140.f); @@ -690,7 +691,10 @@ static void mark_pns(AACEncContext *s, AVCodecContext *avctx, SingleChannelEleme * 3. on short window groups, all windows have similar energy (variations in energy would be destroyed by PNS) */ sce->pns_ener[w*16+g] = sfb_energy; - if (sfb_energy < threshold*sqrtf(1.5f/freq_boost) || spread < spread_threshold || min_energy < pns_transient_energy_r * max_energy) { + if (sfb_energy < threshold*sqrtf(1.5f/freq_boost) || + sfb_energy > 100.0f * threshold*thr_mult*freq_boost || + spread < spread_threshold || + min_energy < pns_transient_energy_r * max_energy) { sce->can_pns[w*16+g] = 0; } else { sce->can_pns[w*16+g] = 1; -- 2.49.1 _______________________________________________ ffmpeg-devel mailing list -- ffmpeg-devel@ffmpeg.org To unsubscribe send an email to ffmpeg-devel-leave@ffmpeg.org