[FFmpeg-devel] [PATCH 2/2] avutil/eval: change sqrt to hypot

Ganesh Ajjanagadde gajjanagadde at gmail.com
Sat Nov 14 18:11:20 CET 2015


This improves the mathematical behavior of hypotenuse computation.

Signed-off-by: Ganesh Ajjanagadde <gajjanagadde at gmail.com>
---
 libavutil/eval.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavutil/eval.c b/libavutil/eval.c
index 7642b91..44129d6 100644
--- a/libavutil/eval.c
+++ b/libavutil/eval.c
@@ -299,7 +299,7 @@ static double eval_expr(Parser *p, AVExpr *e)
                 case e_add: return e->value * (d + d2);
                 case e_last:return e->value * d2;
                 case e_st : return e->value * (p->var[av_clip(d, 0, VARS-1)]= d2);
-                case e_hypot:return e->value * (sqrt(d*d + d2*d2));
+                case e_hypot:return e->value * hypot(d, d2);
                 case e_bitand: return isnan(d) || isnan(d2) ? NAN : e->value * ((long int)d & (long int)d2);
                 case e_bitor:  return isnan(d) || isnan(d2) ? NAN : e->value * ((long int)d | (long int)d2);
             }
-- 
2.6.2



More information about the ffmpeg-devel mailing list