This is an automated email from the git hooks/post-receive script.

Git pushed a commit to branch master
in repository ffmpeg.

commit abe157fbf2bc34f99ef87e55abfdf5fe74d5651e
Author:     Lynne <[email protected]>
AuthorDate: Fri Jul 17 14:19:15 2026 +0800
Commit:     Lynne <[email protected]>
CommitDate: Sun Jul 19 20:41:52 2026 +0800

    avcodec/aaccoder: widen PNS candidacy to near-masked bands
    
    Bands whose energy sits between threshold/4 and 2x threshold are
    deletion candidates for the trellis: coded, they round to silence under
    pressure, and an audible hole is worse than energy-matched noise. Let
    them qualify for PNS with a relaxed uniformity requirement, so the
    noise substitution keeps the texture the allocator was about to delete.
---
 libavcodec/aaccoder.c | 18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)

diff --git a/libavcodec/aaccoder.c b/libavcodec/aaccoder.c
index 7aead4d8b4..086e5e2f0a 100644
--- a/libavcodec/aaccoder.c
+++ b/libavcodec/aaccoder.c
@@ -664,10 +664,20 @@ 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) {
-                sce->can_pns[w*16+g] = 0;
-            } else {
-                sce->can_pns[w*16+g] = 1;
+            {
+                /* near-mask PNS class (E in [thr/4, 2*thr]): deletion
+                 * candidates go to noise, not silence (AAC_PNSHOLE) */
+                int near = sfb_energy < 2.0f * threshold &&
+                           sfb_energy > threshold * 0.25f;
+                if (near) {
+                    /* deletion candidate: noise beats the ~silent rendition */
+                    sce->can_pns[w*16+g] = spread >= spread_threshold &&
+                                           min_energy >= 0.2f * max_energy;
+                } else if (sfb_energy < threshold*sqrtf(1.5f/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;
+                }
             }
         }
     }

_______________________________________________
ffmpeg-cvslog mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to