mirror of
https://mirror.skon.top/https://github.com/FFmpeg/FFmpeg
synced 2026-04-20 12:50:49 +08:00
swscale/ops_backend: disable FP contraction where possible
In particular, Clang defaults to FP contraction enabled. GCC defaults to off in standard C mode (-std=c11), but the C standard does not actually require any particular default. The #pragma STDC pragma, despite its name, warns on anything except Clang. Fixes: https://code.ffmpeg.org/FFmpeg/FFmpeg/issues/22796 See-also: https://discourse.llvm.org/t/fp-contraction-fma-on-by-default/64975 Signed-off-by: Niklas Haas <git@haasn.dev>
This commit is contained in:
@@ -20,6 +20,18 @@
|
||||
|
||||
#include "ops_backend.h"
|
||||
|
||||
/**
|
||||
* We want to disable FP contraction because this is a reference backend that
|
||||
* establishes a bit-exact reference result.
|
||||
*/
|
||||
#ifdef __clang__
|
||||
#pragma STDC FP_CONTRACT OFF
|
||||
#elif AV_GCC_VERSION_AT_LEAST(4, 8)
|
||||
#pragma GCC optimize ("fp-contract=off")
|
||||
#elif defined(_MSC_VER)
|
||||
#pragma fp_contract (off)
|
||||
#endif
|
||||
|
||||
#if AV_GCC_VERSION_AT_LEAST(4, 4)
|
||||
#pragma GCC optimize ("finite-math-only")
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user