1
0
mirror of https://git.ffmpeg.org/ffmpeg.git synced 2026-10-24 02:09:03 +03:00

ffplay: compute 1/sqrt(nb_freq) once outside the row loop

The value is the same for every row. No change in behaviour.

Found during a code review sweep of ffmpeg using an LLM.
This commit is contained in:
romainhedouin
2026-10-15 13:02:30 +02:00
committed by Baptiste Coudurier
parent 94b8431a55
commit 231ce8136e

View File

@@ -2005,10 +2005,10 @@ static void video_audio_display(VideoState *s)
/* Least efficient way to do this, we should of course
* directly access it but it is more than fast enough. */
if (!SDL_LockTexture(s->vis_texture, &rect, (void **)&pixels, &pitch)) {
double w = 1 / sqrt(nb_freq);
pitch >>= 2;
pixels += pitch * s->height;
for (y = 0; y < s->height; y++) {
double w = 1 / sqrt(nb_freq);
int a = sqrt(w * sqrt(data[0][y].re * data[0][y].re + data[0][y].im * data[0][y].im));
int b = (nb_display_channels == 2 ) ? sqrt(w * hypot(data[1][y].re, data[1][y].im))
: a;