[FFmpeg-cvslog] x86: Add and use more convenience macros to check CPU extension availability
Diego Biurrun
git at videolan.org
Fri Aug 30 12:06:36 CEST 2013
ffmpeg | branch: master | Diego Biurrun <diego at biurrun.de> | Tue Aug 20 14:39:36 2013 +0200| [79aec43ce813a3e270743ca64fa3f31fa43df80b] | committer: Diego Biurrun
x86: Add and use more convenience macros to check CPU extension availability
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=79aec43ce813a3e270743ca64fa3f31fa43df80b
---
libavutil/x86/cpu.h | 13 +++++++++++++
libswscale/utils.c | 10 ++++------
2 files changed, 17 insertions(+), 6 deletions(-)
diff --git a/libavutil/x86/cpu.h b/libavutil/x86/cpu.h
index 5a3ad8a..e5153bb 100644
--- a/libavutil/x86/cpu.h
+++ b/libavutil/x86/cpu.h
@@ -26,6 +26,19 @@
#define AV_CPU_FLAG_AMD3DNOW AV_CPU_FLAG_3DNOW
#define AV_CPU_FLAG_AMD3DNOWEXT AV_CPU_FLAG_3DNOWEXT
+#define X86_AMD3DNOW(flags) CPUEXT(flags, AMD3DNOW)
+#define X86_AMD3DNOWEXT(flags) CPUEXT(flags, AMD3DNOWEXT)
+#define X86_MMX(flags) CPUEXT(flags, MMX)
+#define X86_MMXEXT(flags) CPUEXT(flags, MMXEXT)
+#define X86_SSE(flags) CPUEXT(flags, SSE)
+#define X86_SSE2(flags) CPUEXT(flags, SSE2)
+#define X86_SSE3(flags) CPUEXT(flags, SSE3)
+#define X86_SSSE3(flags) CPUEXT(flags, SSSE3)
+#define X86_SSE4(flags) CPUEXT(flags, SSE4)
+#define X86_SSE42(flags) CPUEXT(flags, SSE42)
+#define X86_AVX(flags) CPUEXT(flags, AVX)
+#define X86_FMA4(flags) CPUEXT(flags, FMA4)
+
#define EXTERNAL_AMD3DNOW(flags) CPUEXT_SUFFIX(flags, _EXTERNAL, AMD3DNOW)
#define EXTERNAL_AMD3DNOWEXT(flags) CPUEXT_SUFFIX(flags, _EXTERNAL, AMD3DNOWEXT)
#define EXTERNAL_MMX(flags) CPUEXT_SUFFIX(flags, _EXTERNAL, MMX)
diff --git a/libswscale/utils.c b/libswscale/utils.c
index 403c138..2781985 100644
--- a/libswscale/utils.c
+++ b/libswscale/utils.c
@@ -1120,9 +1120,8 @@ av_cold int sws_init_context(SwsContext *c, SwsFilter *srcFilter,
} else
#endif /* HAVE_MMXEXT_INLINE */
{
- const int filterAlign =
- (HAVE_MMX && cpu_flags & AV_CPU_FLAG_MMX) ? 4 :
- PPC_ALTIVEC(cpu_flags) ? 8 : 1;
+ const int filterAlign = X86_MMX(cpu_flags) ? 4 :
+ PPC_ALTIVEC(cpu_flags) ? 8 : 1;
if (initFilter(&c->hLumFilter, &c->hLumFilterPos,
&c->hLumFilterSize, c->lumXInc,
@@ -1143,9 +1142,8 @@ av_cold int sws_init_context(SwsContext *c, SwsFilter *srcFilter,
/* precalculate vertical scaler filter coefficients */
{
- const int filterAlign =
- (HAVE_MMX && cpu_flags & AV_CPU_FLAG_MMX) ? 2 :
- PPC_ALTIVEC(cpu_flags) ? 8 : 1;
+ const int filterAlign = X86_MMX(cpu_flags) ? 2 :
+ PPC_ALTIVEC(cpu_flags) ? 8 : 1;
if (initFilter(&c->vLumFilter, &c->vLumFilterPos, &c->vLumFilterSize,
c->lumYInc, srcH, dstH, filterAlign, (1 << 12),
More information about the ffmpeg-cvslog
mailing list