Browse Source

lavu/libm: add copysign hack

For systems with broken libms.
Tested with NAN, -NAN, INFINITY, -INFINITY, +/-x for regular double x and
combinations of these.

Old versions of MSVC need some UINT64_C hackery.

Reviewed-by: Ronald S. Bultje <rsbultje@gmail.com>
Reviewed-by: Hendrik Leppkes <h.leppkes@gmail.com>
Signed-off-by: Ganesh Ajjanagadde <gajjanagadde@gmail.com>
tags/n3.0
Ganesh Ajjanagadde 9 years ago
parent
commit
062e3e2382
2 changed files with 10 additions and 1 deletions
  1. +1
    -1
      configure
  2. +9
    -0
      libavutil/libm.h

+ 1
- 1
configure View File

@@ -2851,7 +2851,7 @@ cropdetect_filter_deps="gpl"
delogo_filter_deps="gpl"
deshake_filter_select="pixelutils"
drawtext_filter_deps="libfreetype"
dynaudnorm_filter_deps="copysign erf"
dynaudnorm_filter_deps="erf"
ebur128_filter_deps="gpl"
eq_filter_deps="gpl"
fftfilt_filter_deps="avcodec"


+ 9
- 0
libavutil/libm.h View File

@@ -62,6 +62,15 @@ static av_always_inline float cbrtf(float x)
}
#endif

#if !HAVE_COPYSIGN
static av_always_inline double copysign(double x, double y)
{
uint64_t vx = av_double2int(x);
uint64_t vy = av_double2int(y);
return av_int2double((vx & UINT64_C(0x7fffffffffffffff)) | (vy & UINT64_C(0x8000000000000000)));
}
#endif

#if !HAVE_COSF
#undef cosf
#define cosf(x) ((float)cos(x))


Loading…
Cancel
Save