diff --git a/configure b/configure
index 9a736ce2a4bcc298ba47b5bb85ba13448f5c530a..4a288364a3b2819a6b043c7bf6935d225fbc0e04 100755
--- a/configure
+++ b/configure
@@ -1773,6 +1773,7 @@ MATH_FUNCS="
     exp2
     exp2f
     expf
+    hypot
     isinf
     isnan
     ldexpf
@@ -5308,6 +5309,7 @@ disabled crystalhd || check_lib libcrystalhd/libcrystalhd_if.h DtsCrystalHDVersi
 
 atan2f_args=2
 copysign_args=2
+hypot_args=2
 ldexpf_args=2
 powf_args=2
 
diff --git a/libavutil/libm.h b/libavutil/libm.h
index 221c2867c58b6273077670635e79a65535f33725..9e5ec5d43cb7597f5a07c36687cad61faf5fdfc3 100644
--- a/libavutil/libm.h
+++ b/libavutil/libm.h
@@ -132,6 +132,29 @@ static av_always_inline av_const int avpriv_isnan(double x)
         : avpriv_isnan(x))
 #endif /* HAVE_ISNAN */
 
+#if !HAVE_HYPOT
+#undef hypot
+static inline av_const double hypot(double x, double y)
+{
+    double ret, temp;
+    x = fabs(x);
+    y = fabs(y);
+
+    if (isinf(x) || isinf(y))
+        return av_int2double(0x7ff0000000000000);
+    if (x == 0 || y == 0)
+        return x + y;
+    if (x < y) {
+        temp = x;
+        x = y;
+        y = temp;
+    }
+
+    y = y/x;
+    return x*sqrt(1 + y*y);
+}
+#endif /* HAVE_HYPOT */
+
 #if !HAVE_LDEXPF
 #undef ldexpf
 #define ldexpf(x, exp) ((float)ldexp(x, exp))