[FFmpeg-devel] [PATCH 2/2] configure: Use intel math.h header.

Matt Oliver protogonoi at gmail.com
Wed May 7 19:41:35 CEST 2014

On 7 May 2014 23:52, Matt Oliver <protogonoi at gmail.com> wrote:

> icl when run under msvc12 currently generates incorrect code. This is due
> to an issue with msvc12's C99 additions to math.h. Several defines in
> msvc's math.h are not compatible with icl and will compile but generate
> erroneous results during runtime. An obvious example is that NAN from
> math.h evaluates to 0.0 under icl which is clearly not a correct value for
> NaN. This cause several errors that completly break FFmpeg.
> There are several ways to fix this. 1) Force icl's floating point
> compliance but negatively impact performance in doing so. 2) Add compiler
> specific code into FFmpeg or 3) Have icl use its own native math header
> (which can also improve performance).
> Using 1) introduces performance degradation and will break again should
> the user specify additional conflicting configure flags. Using 2) adds icl
> specific code handling into FFmpeg which is rather ugly and should probably
> be avoided. Using 3) fixes all errors and has the potential to increase
> performance through Intels optimized math routines.
> Since 3) seems to work best attached is a patch to force in the inclusion
> of icl's math.h (named mathimf.h) which will override msvc's math.h and
> avoid any issues.
> Note in order for this to work the previous patch entitled "Fix clashes
> with 'I' and 'complex' defined in complex.h" must have been previously
> applied.

Due to some issues raised about this patches sister patch [1/2] I have come
up with a cleaner alternative. Its still based on 3) from previous email
but it does it by creating a wrapper math.h that catches all header
includes and then routes those to the icl header where appropriate. It also
can then remove the clashes with 'I' and 'complex' that now makes the
previous sister patch redundant. This makes the patch alot cleaner and less
obtrusive (only affects icl) and fixes a fatal bug with icl and msvc12.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: configure-Use-intel-math.h-header.patch
Type: application/octet-stream
Size: 3004 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20140508/95419120/attachment.obj>

More information about the ffmpeg-devel mailing list