[FFmpeg-devel] [PATCH] fix compilation in cygwin

Måns Rullgård mans
Sat Jan 16 00:45:11 CET 2010


Vitor Sessak <vitor1001 at gmail.com> writes:

> M?ns Rullg?rd wrote:
>> Vitor Sessak <vitor1001 at gmail.com> writes:
>>
>>> M?ns Rullg?rd wrote:
>>>> Vitor Sessak <vitor1001 at gmail.com> writes:
>>>>
>>>>> M?ns Rullg?rd wrote:
>>>>>> Michael Kostylev <michael.kostylev at gmail.com> writes:
>>>>>>
>>>>>>> On Sun Jan 10 21:55:50 2010
>>>>>>> Vitor Sessak wrote:
>>>>>>>
>>>>>>>>>> +#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...
>>>>>>> exp2() is missing in NetBSD and DragonFly.
>>>>>> We have a replacement for it, so it's OK.
>>>>> We have a replacement for log2(), but not for exp2().
>>>>>
>>>>> I'm slightly favorable of adding a replacement for exp2() (as
>>>>> attached) as we do for log2(), since we can get some speed gain in
>>>>> platforms where exp2() is supported and we'll eventually need exp2()
>>>>> sooner or later.
>>>>>
>>>>> [...]
>>>> Well, this caused things to break in new and interesting ways:
>>>> libavutil/internal.h:275: error: static declaration of 'exp2f'
>>>> follows non-static declaration
>>>> libavutil/internal.h:296: error: static declaration of 'log2f' follows non-static declaration
>>>> uClibc apparently has declarations for those functions, but no actual
>>>> implementations.  This is truly the week of idiots.
>>> BTW, wouldn't compilation fail if log2f() is a macro?
>> No.  The functions are required to be available as actual functions,
>> even if a macro is also defined.
>
> What about if we define them as macros? Should work on any case.
>
> -Vitor
> Index: libavutil/internal.h
> ===================================================================
> --- libavutil/internal.h	(revision 21155)
> +++ libavutil/internal.h	(working copy)
> @@ -264,17 +264,13 @@
>  }
>  
>  #if !HAVE_EXP2
> -static av_always_inline av_const double exp2(double x)
> -{
> -    return exp(x * 0.693147180559945);
> -}
> +#undef exp2
> +#define exp2(x) exp((x) * 0.693147180559945)
>  #endif /* HAVE_EXP2 */
>  
>  #if !HAVE_EXP2F
> -static av_always_inline av_const float exp2f(float x)
> -{
> -    return exp2(x);
> -}
> +#undef exp2f
> +#define exp2f(x) exp2(x)
>  #endif /* HAVE_EXP2F */
>  
>  #if !HAVE_LLRINT
> @@ -285,17 +281,13 @@
>  #endif /* HAVE_LLRINT */
>  
>  #if !HAVE_LOG2
> -static av_always_inline av_const double log2(double x)
> -{
> -    return log(x) * 1.44269504088896340736;
> -}
> +#undef log2
> +#define log2(x) (log(x) * 1.44269504088896340736)
>  #endif /* HAVE_LOG2 */
>  
>  #if !HAVE_LOG2F
> -static av_always_inline av_const float log2f(float x)
> -{
> -    return log2(x);
> -}
> +#undef log2f
> +#define log2f(x) log2(x)
>  #endif /* HAVE_LOG2F */
>  
>  #if !HAVE_LRINT

Patch OK, I'm tired of having this broken.

-- 
M?ns Rullg?rd
mans at mansr.com



More information about the ffmpeg-devel mailing list