diff options
author | Mans Rullgard <mans@mansr.com> | 2012-06-22 15:37:46 +0100 |
---|---|---|
committer | Mans Rullgard <mans@mansr.com> | 2012-06-26 15:56:38 +0100 |
commit | 153335625c429d2e4ab6a4d2d704d7eb91293290 (patch) | |
tree | 3bd83196a58c2397edd517709e8918ccdb3e731a /libavutil | |
parent | 4b1b1449d95b3567d055fc410a1db137c811229c (diff) | |
download | ffmpeg-streaming-153335625c429d2e4ab6a4d2d704d7eb91293290.zip ffmpeg-streaming-153335625c429d2e4ab6a4d2d704d7eb91293290.tar.gz |
libm: provide fallback definition for cbrtf() using powf()
This adds a fallback for cbrtf() using powf(x, 1/3). Since
powf() with a non-integer exponent requires a non-negative
base, special handling of negative inputs is needed.
Signed-off-by: Mans Rullgard <mans@mansr.com>
Diffstat (limited to 'libavutil')
-rw-r--r-- | libavutil/libm.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/libavutil/libm.h b/libavutil/libm.h index 783f3cd..b6d8a94 100644 --- a/libavutil/libm.h +++ b/libavutil/libm.h @@ -28,6 +28,13 @@ #include "config.h" #include "attributes.h" +#if !HAVE_CBRTF +static av_always_inline float cbrtf(float x) +{ + return x < 0 ? -powf(-x, 1.0 / 3.0) : powf(x, 1.0 / 3.0); +} +#endif + #if !HAVE_EXP2 #undef exp2 #define exp2(x) exp((x) * 0.693147180559945) |