summaryrefslogtreecommitdiff
path: root/ffplay.c
diff options
context:
space:
mode:
authorGanesh Ajjanagadde <gajjanagadde@gmail.com>2015-11-22 11:27:22 -0500
committerGanesh Ajjanagadde <gajjanagadde@gmail.com>2015-12-06 08:11:47 -0500
commit65440916c17d55aaee2f0bb6eb9a0678841eff1b (patch)
tree23be13a0bd993a29c23d4eaf63b68219111a8856 /ffplay.c
parent14886bebfe7a9108c4b557f455fa8af3aefd8a0c (diff)
downloadffmpeg-65440916c17d55aaee2f0bb6eb9a0678841eff1b.tar.gz
ffplay: use hypot()
Reviewed-by: Marton Balint <cus@passwd.hu> Signed-off-by: Ganesh Ajjanagadde <gajjanagadde@gmail.com>
Diffstat (limited to 'ffplay.c')
-rw-r--r--ffplay.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/ffplay.c b/ffplay.c
index 2c1817ef0b..36da8a5cbd 100644
--- a/ffplay.c
+++ b/ffplay.c
@@ -1115,9 +1115,9 @@ static void video_audio_display(VideoState *s)
* directly access it but it is more than fast enough. */
for (y = 0; y < s->height; y++) {
double w = 1 / sqrt(nb_freq);
- int a = sqrt(w * sqrt(data[0][2 * y + 0] * data[0][2 * y + 0] + data[0][2 * y + 1] * data[0][2 * y + 1]));
- int b = (nb_display_channels == 2 ) ? sqrt(w * sqrt(data[1][2 * y + 0] * data[1][2 * y + 0]
- + data[1][2 * y + 1] * data[1][2 * y + 1])) : a;
+ int a = sqrt(w * hypot(data[0][2 * y + 0], data[0][2 * y + 1]));
+ int b = (nb_display_channels == 2 ) ? sqrt(w * hypot(data[1][2 * y + 0], data[1][2 * y + 1]))
+ : a;
a = FFMIN(a, 255);
b = FFMIN(b, 255);
fgcolor = SDL_MapRGB(screen->format, a, b, (a + b) / 2);