[FFmpeg-devel] [PATCH] fix compilation in cygwin
Måns Rullgård
mans
Mon Jan 11 15:41:40 CET 2010
Vitor Sessak <vitor1001 at gmail.com> writes:
> M?ns Rullg?rd wrote:
>> Vitor Sessak <vitor1001 at gmail.com> writes:
>>
>>> +#if !HAVE_LOG2F
>>> +static av_always_inline av_const float log2f(float x)
>>> +{
>>> + return log(x) * 1.44269504088896340736;
>>> +}
>>> +#endif /* HAVE_LOG2F */
>> Calling log2() should be better. Most of the bad libs have a full
>> set
>> of double-precision functions. It's the single-precision ones, which
>> were added in C99 that are often missing.
>
> Fine, even thought NetBSD lacks it (thats why we have a configure
> check for it, so no problem there).
>
>>> +#if !HAVE_EXP2F
>>> +static av_always_inline av_const float exp2f(float x)
>>> +{
>>> + return exp(x) * 0.693147180559945;
>>> +}
>>> +#endif /* HAVE_EXP2F */
>> Same again. exp2() should be preferred.
>
> Let's hope that at least exp2() is supported...
>
> -Vitor
> Index: configure
> ===================================================================
> --- configure (revision 21124)
> +++ configure (working copy)
> @@ -950,6 +950,7 @@
> dos_paths
> ebp_available
> ebx_available
> + exp2f
> fast_64bit
> fast_cmov
> fast_unaligned
> @@ -965,6 +966,7 @@
> libdc1394_2
> llrint
> log2
> + log2f
> loongson
> lrint
> lrintf
> @@ -2370,8 +2372,10 @@
> check_lib math.h sin -lm
> check_lib va/va.h vaInitialize -lva
>
> +check_func exp2f
> check_func llrint
> check_func log2
> +check_func log2f
> check_func lrint
> check_func lrintf
> check_func round
OK
> Index: libavutil/internal.h
> ===================================================================
> --- libavutil/internal.h (revision 21124)
> +++ libavutil/internal.h (working copy)
> @@ -263,6 +263,13 @@
> }\
> }
>
> +#if !HAVE_EXP2F
> +static av_always_inline av_const float exp2f(float x)
> +{
> + return exp2(x);
> +}
> +#endif /* HAVE_EXP2F */
> +
> #if !HAVE_LLRINT
> static av_always_inline av_const long long llrint(double x)
> {
> @@ -277,6 +284,13 @@
> }
> #endif /* HAVE_LOG2 */
>
> +#if !HAVE_LOG2F
> +static av_always_inline av_const float log2f(float x)
> +{
> + return log2(x);
> +}
> +#endif /* HAVE_LOG2F */
> +
> #if !HAVE_LRINT
> static av_always_inline av_const long int lrint(double x)
> {
Approved by Michael, and looks good to me.
--
M?ns Rullg?rd
mans at mansr.com
More information about the ffmpeg-devel
mailing list