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

The cos() value only depends on the row, yet it was computed for every pixel in 
the row.
No change in output.
This technically improves performance a tiny little bit.

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

<!--
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 f15e2da8a7cf5b5b92c61f8c419fc17ad8cbaeb7 Mon Sep 17 00:00:00 2001
From: romainhedouin <[email protected]>
Date: Thu, 15 Oct 2026 13:02:32 +0200
Subject: [PATCH] avfilter/vf_ssim360: compute the barrel density once per row

The cos() value only depends on the row, but it was computed for every
pixel in the row. No change in output.

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

diff --git a/libavfilter/vf_ssim360.c b/libavfilter/vf_ssim360.c
index 64e260e9fd..97bd275c6a 100644
--- a/libavfilter/vf_ssim360.c
+++ b/libavfilter/vf_ssim360.c
@@ -1498,8 +1498,8 @@ static int generate_density_map(SSIM360Context *s, int w, 
int h)
     case PROJECTION_BARREL:
         // side face
         for (int i = 0; i < h; i++) {
+            d = cos(((0.5 + i) / h - 0.5) * DEFAULT_EXPANSION_COEF * M_PI_2);
             for (int j = 0; j < w * 4 / 5; j++) {
-                d = cos(((0.5 + i) / h - 0.5) * DEFAULT_EXPANSION_COEF * 
M_PI_2);
                 s->density.value[i * w + j] = d * d * d;
             }
         }
-- 
2.52.0

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

Reply via email to