]> git.sesse.net Git - ffmpeg/commitdiff
Detect and check for CMOV.
authorReimar Döffinger <Reimar.Doeffinger@gmx.de>
Sat, 11 Feb 2012 15:04:43 +0000 (16:04 +0100)
committerReimar Döffinger <Reimar.Doeffinger@gmx.de>
Sun, 12 Feb 2012 17:56:06 +0000 (18:56 +0100)
Some MMX-only CPUs do not have support for CMOV.
All SSE/MMX2 CPUs should be fine, thus no check was
added to those functions.
See also https://sourceforge.net/tracker/?func=detail&aid=3358347&group_id=205275&atid=992986

Signed-off-by: Reimar Döffinger <Reimar.Doeffinger@gmx.de>
libavcodec/x86/h264_intrapred_init.c
libavcodec/x86/h264dsp_mmx.c
libavutil/cpu.h
libavutil/x86/cpu.c

index 540ec87ad3c33232474bcf86bd3c2e1d69f21d10..58740e2ed160231503685dc20f40ba7c222aac9b 100644 (file)
@@ -188,7 +188,8 @@ void ff_h264_pred_init_x86(H264PredContext *h, int codec_id, const int bit_depth
                 if (chroma_format_idc == 1)
                     h->pred8x8  [PLANE_PRED8x8] = ff_pred8x8_plane_mmx;
                 if (codec_id == CODEC_ID_SVQ3) {
-                    h->pred16x16[PLANE_PRED8x8] = ff_pred16x16_plane_svq3_mmx;
+                    if (mm_flags & AV_CPU_FLAG_CMOV)
+                        h->pred16x16[PLANE_PRED8x8] = ff_pred16x16_plane_svq3_mmx;
                 } else if (codec_id == CODEC_ID_RV40) {
                     h->pred16x16[PLANE_PRED8x8] = ff_pred16x16_plane_rv40_mmx;
                 } else {
index b337462aec6f22ba66ff8be40128f06488fc6c85..063e3de5aa12a060ebbb0b2b2076380d47e01b3b 100644 (file)
@@ -361,7 +361,8 @@ void ff_h264dsp_init_x86(H264DSPContext *c, const int bit_depth, const int chrom
         if (chroma_format_idc == 1)
             c->h264_idct_add8       = ff_h264_idct_add8_8_mmx;
         c->h264_idct_add16intra     = ff_h264_idct_add16intra_8_mmx;
-        c->h264_luma_dc_dequant_idct= ff_h264_luma_dc_dequant_idct_mmx;
+        if (mm_flags & AV_CPU_FLAG_CMOV)
+            c->h264_luma_dc_dequant_idct= ff_h264_luma_dc_dequant_idct_mmx;
 
         if (mm_flags & AV_CPU_FLAG_MMX2) {
             c->h264_idct_dc_add    = ff_h264_idct_dc_add_8_mmx2;
index 5f7eed2b60db8cb7fcf69732d86040bc5cbfd82c..691ee9c8c1be77b9abe41a6c6b1de9e7f06c8132 100644 (file)
@@ -38,6 +38,7 @@
 #define AV_CPU_FLAG_SSE4         0x0100 ///< Penryn SSE4.1 functions
 #define AV_CPU_FLAG_SSE42        0x0200 ///< Nehalem SSE4.2 functions
 #define AV_CPU_FLAG_AVX          0x4000 ///< AVX functions: requires OS support even if YMM registers aren't used
+#define AV_CPU_FLAG_CMOV      0x1000000 ///< supports cmov instruction
 #define AV_CPU_FLAG_XOP          0x0400 ///< Bulldozer XOP functions
 #define AV_CPU_FLAG_FMA4         0x0800 ///< Bulldozer FMA4 functions
 #define AV_CPU_FLAG_IWMMXT       0x0100 ///< XScale IWMMXT
index 93df737c280b01a4e360a6da8ac5cea023f3ff86..b53379bbd3dc35e7699105e85308ce62510c8cb7 100644 (file)
@@ -83,6 +83,8 @@ int ff_get_cpu_flags_x86(void)
         cpuid(1, eax, ebx, ecx, std_caps);
         family = ((eax>>8)&0xf) + ((eax>>20)&0xff);
         model  = ((eax>>4)&0xf) + ((eax>>12)&0xf0);
+        if (std_caps & (1<<15))
+            rval |= AV_CPU_FLAG_CMOV;
         if (std_caps & (1<<23))
             rval |= AV_CPU_FLAG_MMX;
         if (std_caps & (1<<25))