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

Git pushed a commit to branch release/5.0
in repository ffmpeg.

The following commit(s) were added to refs/heads/release/5.0 by this push:
     new 58c6e020b4 swscale/x86/yuv2rgb_template: Add emms to MMX(EXT) functions
58c6e020b4 is described below

commit 58c6e020b43708a3afbe6782db3f9edef3d0a726
Author:     Andreas Rheinhardt <[email protected]>
AuthorDate: Sun Mar 1 14:57:21 2026 +0100
Commit:     Andreas Rheinhardt <[email protected]>
CommitDate: Thu Mar 5 14:54:19 2026 +0100

    swscale/x86/yuv2rgb_template: Add emms to MMX(EXT) functions
    
    Fixes issue #22333.
    Note: These functions have been removed in commit
    61e851381f3c039dd8c06073f22da12fcc7409b0, so the issue
    only affects releases 7.0 and older.
    
    Signed-off-by: Andreas Rheinhardt <[email protected]>
    (cherry picked from commit 5e6c584b98cea9b9d78b037728b915887758666d)
---
 libswscale/x86/yuv2rgb_template.c | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

diff --git a/libswscale/x86/yuv2rgb_template.c 
b/libswscale/x86/yuv2rgb_template.c
index 344e61abe8..7f8573093d 100644
--- a/libswscale/x86/yuv2rgb_template.c
+++ b/libswscale/x86/yuv2rgb_template.c
@@ -26,6 +26,23 @@
 #include "libavutil/x86/asm.h"
 #include "libswscale/swscale_internal.h"
 
+#undef EMMS_IF_MMX
+
+#if defined(COMPILE_TEMPLATE_MMX) || defined(COMPILE_TEMPLATE_MMXEXT)
+// Don't use emms_c() directly as it may entail an av_get_cpu_flags() call.
+#if HAVE_MMX_INLINE
+#   define EMMS_IF_MMX __asm__ volatile ("emms" ::: "memory");
+#elif HAVE_MM_EMPTY
+#   include <mmintrin.h>
+#   define EMMS_IF_MMX _mm_empty();
+#else
+#   include "libavutil/x86/emms.h"
+#   define EMMS_IF_MMX emms_c();
+#endif
+#else
+#define EMMS_IF_MMX
+#endif
+
 #define YUV2RGB_LOOP(depth)                                          \
     h_size = (c->dstW + 7) & ~7;                                     \
     if (h_size * depth > FFABS(dstStride[0]))                        \
@@ -84,6 +101,7 @@ static inline int RENAME(yuv420_rgb15)(SwsContext *c, const 
uint8_t *src[],
 
         RENAME(ff_yuv_420_rgb15)(index, image, pu - index, pv - index, 
&(c->redDither), py - 2 * index);
     }
+    EMMS_IF_MMX
     return srcSliceH;
 }
 
@@ -104,6 +122,7 @@ static inline int RENAME(yuv420_rgb16)(SwsContext *c, const 
uint8_t *src[],
 
         RENAME(ff_yuv_420_rgb16)(index, image, pu - index, pv - index, 
&(c->redDither), py - 2 * index);
     }
+    EMMS_IF_MMX
     return srcSliceH;
 }
 
@@ -118,6 +137,7 @@ static inline int RENAME(yuv420_rgb32)(SwsContext *c, const 
uint8_t *src[],
 
         RENAME(ff_yuv_420_rgb32)(index, image, pu - index, pv - index, 
&(c->redDither), py - 2 * index);
     }
+    EMMS_IF_MMX
     return srcSliceH;
 }
 
@@ -132,6 +152,7 @@ static inline int RENAME(yuv420_bgr32)(SwsContext *c, const 
uint8_t *src[],
 
         RENAME(ff_yuv_420_bgr32)(index, image, pu - index, pv - index, 
&(c->redDither), py - 2 * index);
     }
+    EMMS_IF_MMX
     return srcSliceH;
 }
 
@@ -146,6 +167,7 @@ static inline int RENAME(yuva420_rgb32)(SwsContext *c, 
const uint8_t *src[],
         const uint8_t *pa = src[3] + y * srcStride[3];
         RENAME(ff_yuva_420_rgb32)(index, image, pu - index, pv - index, 
&(c->redDither), py - 2 * index, pa - 2 * index);
     }
+    EMMS_IF_MMX
     return srcSliceH;
 }
 
@@ -161,6 +183,7 @@ static inline int RENAME(yuva420_bgr32)(SwsContext *c, 
const uint8_t *src[],
         const uint8_t *pa = src[3] + y * srcStride[3];
         RENAME(ff_yuva_420_bgr32)(index, image, pu - index, pv - index, 
&(c->redDither), py - 2 * index, pa - 2 * index);
     }
+    EMMS_IF_MMX
     return srcSliceH;
 }
 #endif
@@ -176,6 +199,7 @@ static inline int RENAME(yuv420_rgb24)(SwsContext *c, const 
uint8_t *src[],
 
         RENAME(ff_yuv_420_rgb24)(index, image, pu - index, pv - index, 
&(c->redDither), py - 2 * index);
     }
+    EMMS_IF_MMX
     return srcSliceH;
 }
 
@@ -190,5 +214,6 @@ static inline int RENAME(yuv420_bgr24)(SwsContext *c, const 
uint8_t *src[],
 
         RENAME(ff_yuv_420_bgr24)(index, image, pu - index, pv - index, 
&(c->redDither), py - 2 * index);
     }
+    EMMS_IF_MMX
     return srcSliceH;
 }

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

Reply via email to