PR #25092 opened by romainhedouin
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/25092
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/25092.patch

It only depends on the function arguments, not on the window being
processed. No change in output.
This technically improves performance a tiny little bit.

Found during a code review sweep of ffmpeg using an LLM.

# Summary of changes

Briefly describe what this PR does and why.

<!--
If this PR requires new FATE test samples, attach them to the PR and
list their target paths below (relative to the fate-suite root).

Attached filenames must match the sample's filename:

```fate-samples
# e.g. vorbis/new-sample.ogg
```
-->



>From 6d6aca4ff2089f9a483fe6189da9d4a84c9d7861 Mon Sep 17 00:00:00 2001
From: romainhedouin <[email protected]>
Date: Thu, 15 Oct 2026 13:02:31 +0200
Subject: [PATCH] avcodec/aacenc_is: compute e01_34 once outside the loop

It only depends on the function arguments, not on the window being
processed. No change in output.

Found during a code review sweep of ffmpeg using an LLM.
---
 libavcodec/aacenc_is.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/aacenc_is.c b/libavcodec/aacenc_is.c
index 4e711382dc..1446099820 100644
--- a/libavcodec/aacenc_is.c
+++ b/libavcodec/aacenc_is.c
@@ -61,11 +61,11 @@ static struct AACISError aac_is_encoding_err(AACEncContext 
*s, ChannelElement *c
         return is_error;
     }
 
+    float e01_34 = phase*pos_pow34(ener1/ener0);
     for (w2 = 0; w2 < sce0->ics.group_len[w]; w2++) {
         FFPsyBand *band0 = &s->psy.ch[s->cur_channel+0].psy_bands[(w+w2)*16+g];
         FFPsyBand *band1 = &s->psy.ch[s->cur_channel+1].psy_bands[(w+w2)*16+g];
         int is_band_type, is_sf_idx = FFMAX(1, sce0->sf_idx[w*16+g]-4);
-        float e01_34 = phase*pos_pow34(ener1/ener0);
         float maxval, dist_spec_err = 0.0f;
         float minthr = FFMIN(band0->threshold, band1->threshold);
         for (i = 0; i < sce0->ics.swb_sizes[g]; i++)
-- 
2.52.0

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

Reply via email to