Commit 94b8431a55 for ffmpeg
commit 94b8431a55ef7d1fdc04c70889e57f32067b1623
Author: romainhedouin <romain.hedouin@epitech.eu>
Date: Thu Oct 15 13:02:32 2026 +0200
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.
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;
}
}