This is an automated email from the git hooks/post-receive script.

Git pushed a commit to branch master
in repository ffmpeg.

The following commit(s) were added to refs/heads/master by this push:
     new 1764683668 swscale/ops_backend: disable FP contraction where possible
1764683668 is described below

commit 17646836686369ea5bea1c71c488b94f7c7c775a
Author:     Niklas Haas <[email protected]>
AuthorDate: Sun Apr 12 16:14:38 2026 +0200
Commit:     Niklas Haas <[email protected]>
CommitDate: Thu Apr 16 17:19:51 2026 +0000

    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 <[email protected]>
---
 libswscale/ops_backend.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/libswscale/ops_backend.c b/libswscale/ops_backend.c
index e7aaeda9d4..62b6262a1f 100644
--- a/libswscale/ops_backend.c
+++ b/libswscale/ops_backend.c
@@ -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

_______________________________________________
ffmpeg-cvslog mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to