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

Git pushed a commit to branch master
in repository ffmpeg.

commit 93a0f9df9dd3f2252bcdbaaadbb0fcef561701a6
Author:     Nathan Moinvaziri <[email protected]>
AuthorDate: Sun Oct 18 12:50:28 2026 -0700
Commit:     Lynne <[email protected]>
CommitDate: Tue Oct 20 00:36:03 2026 +0000

    avcodec/aacencdsp: bound the trellis predecessors by the sf difference
    
    Each step tested the scalefactor difference of every previous candidate
    inside the loop. Computing the range of predecessors within the allowed
    difference first keeps the output identical and makes AAC encoding about
    3.5% faster.
---
 libavcodec/aacencdsp.c | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/libavcodec/aacencdsp.c b/libavcodec/aacencdsp.c
index 5ccc7e8fc8..bd9827b804 100644
--- a/libavcodec/aacencdsp.c
+++ b/libavcodec/aacencdsp.c
@@ -21,6 +21,7 @@
 
 #include "config.h"
 
+#include "libavutil/common.h"
 #include "libavutil/macros.h"
 #include "aacencdsp.h"
 
@@ -53,15 +54,17 @@ static void nmr_trellis_step_c(float *dp, uint8_t *bp, 
const float *dpp,
                                const float *node, const float *lamsf,
                                int n_cur, int n_prev, int base, int step, int 
mdiff)
 {
+    /* d = base + (o - op) * step lies in [-mdiff, mdiff] for op in [o - dlo, 
o + dhi] */
+    const int dlo = FFUDIV(mdiff - base, step);
+    const int dhi = FFUDIV(mdiff + base, step);
+
     for (int o = 0; o < n_cur; o++) {
+        const int op_end = FFMIN(n_prev, o + dhi + 1);
+        const int edge   = base + o * step + mdiff;
         int best = -1;
         float bestc = FLT_MAX;
-        for (int op = 0; op < n_prev; op++) {
-            int d = base + (o - op) * step;
-            float c;
-            if (d < -mdiff || d > mdiff)
-                continue;
-            c = dpp[op] + lamsf[d + mdiff];
+        for (int op = FFMAX(0, o - dlo); op < op_end; op++) {
+            float c = dpp[op] + lamsf[edge - op * step];
             if (c < bestc) {
                 bestc = c;
                 best  = op;

-- 
To stop receiving notification emails like this one, please contact
[email protected].
_______________________________________________
ffmpeg-cvslog mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to