From 35291b8ad9590f000f89ec37dc85aa6f5e9741a7 Mon Sep 17 00:00:00 2001 From: wm4 Date: Sun, 29 Jul 2012 17:34:42 +0200 Subject: [PATCH] vf_scale: don't pass CPU flags anymore libav detects them automatically. Also fix a bunch of other VFs, which use the get_sws_cpuflags() function defined by vf_scale.c. --- libmpcodecs/vf_halfpack.c | 2 +- libmpcodecs/vf_sab.c | 2 +- libmpcodecs/vf_scale.c | 17 +++-------------- libmpcodecs/vf_scale.h | 1 - libmpcodecs/vf_smartblur.c | 2 +- 5 files changed, 6 insertions(+), 18 deletions(-) diff --git a/libmpcodecs/vf_halfpack.c b/libmpcodecs/vf_halfpack.c index 5f5a49611a..b67f8237b2 100644 --- a/libmpcodecs/vf_halfpack.c +++ b/libmpcodecs/vf_halfpack.c @@ -200,7 +200,7 @@ static int config(struct vf_instance *vf, vf->priv->ctx = sws_getContext(width, height / 2, PIX_FMT_YUV422P, width, height / 2, PIX_FMT_YUYV422, - SWS_POINT | SWS_PRINT_INFO | get_sws_cpuflags(), + SWS_POINT | SWS_PRINT_INFO, NULL, NULL, NULL); } /* FIXME - also support UYVY output? */ diff --git a/libmpcodecs/vf_sab.c b/libmpcodecs/vf_sab.c index 2773ed3109..6610ea1565 100644 --- a/libmpcodecs/vf_sab.c +++ b/libmpcodecs/vf_sab.c @@ -75,7 +75,7 @@ static int allocStuff(FilterParam *f, int width, int height){ swsF.lumH= swsF.lumV= vec; swsF.chrH= swsF.chrV= NULL; f->preFilterContext= sws_getContext( - width, height, PIX_FMT_GRAY8, width, height, PIX_FMT_GRAY8, get_sws_cpuflags()|SWS_POINT, &swsF, NULL, NULL); + width, height, PIX_FMT_GRAY8, width, height, PIX_FMT_GRAY8, SWS_POINT, &swsF, NULL, NULL); sws_freeVec(vec); vec = sws_getGaussianVec(f->strength, 5.0); diff --git a/libmpcodecs/vf_scale.c b/libmpcodecs/vf_scale.c index 66434d0d56..ca30decd94 100644 --- a/libmpcodecs/vf_scale.c +++ b/libmpcodecs/vf_scale.c @@ -24,7 +24,6 @@ #include "config.h" #include "mp_msg.h" -#include "cpudetect.h" #include "options.h" #include "img_format.h" @@ -316,13 +315,13 @@ static int config(struct vf_instance *vf, sfmt, vf->priv->w, vf->priv->h >> vf->priv->interlaced, dfmt, - int_sws_flags | get_sws_cpuflags(), srcFilter, dstFilter, vf->priv->param); + int_sws_flags, srcFilter, dstFilter, vf->priv->param); if(vf->priv->interlaced){ vf->priv->ctx2=sws_getContext(width, height >> 1, sfmt, vf->priv->w, vf->priv->h >> 1, dfmt, - int_sws_flags | get_sws_cpuflags(), srcFilter, dstFilter, vf->priv->param); + int_sws_flags, srcFilter, dstFilter, vf->priv->param); } if(!vf->priv->ctx){ // error... @@ -658,21 +657,11 @@ int sws_chr_hshift= 0; float sws_chr_sharpen= 0.0; float sws_lum_sharpen= 0.0; -int get_sws_cpuflags(void){ - return - (gCpuCaps.hasMMX ? SWS_CPU_CAPS_MMX : 0) - | (gCpuCaps.hasMMX2 ? SWS_CPU_CAPS_MMX2 : 0); -} - void sws_getFlagsAndFilterFromCmdLine(int *flags, SwsFilter **srcFilterParam, SwsFilter **dstFilterParam) { static int firstTime=1; *flags=0; -#if ARCH_X86 - if(gCpuCaps.hasMMX) - __asm__ volatile("emms\n\t"::: "memory"); //FIXME this should not be required but it IS (even for non-MMX versions) -#endif if(firstTime) { firstTime=0; @@ -719,7 +708,7 @@ static struct SwsContext *sws_getContextFromCmdLine2(int srcW, int srcH, int src if (srcFormat == IMGFMT_RGB8 || srcFormat == IMGFMT_BGR8) sfmt = PIX_FMT_PAL8; sws_getFlagsAndFilterFromCmdLine(&flags, &srcFilterParam, &dstFilterParam); - return sws_getContext(srcW, srcH, sfmt, dstW, dstH, dfmt, flags | extraflags | get_sws_cpuflags(), srcFilterParam, dstFilterParam, NULL); + return sws_getContext(srcW, srcH, sfmt, dstW, dstH, dfmt, flags | extraflags, srcFilterParam, dstFilterParam, NULL); } struct SwsContext *sws_getContextFromCmdLine(int srcW, int srcH, int srcFormat, int dstW, int dstH, int dstFormat) diff --git a/libmpcodecs/vf_scale.h b/libmpcodecs/vf_scale.h index 08d651ce16..575d4f3640 100644 --- a/libmpcodecs/vf_scale.h +++ b/libmpcodecs/vf_scale.h @@ -19,7 +19,6 @@ #ifndef MPLAYER_VF_SCALE_H #define MPLAYER_VF_SCALE_H -int get_sws_cpuflags(void); struct SwsContext *sws_getContextFromCmdLine(int srcW, int srcH, int srcFormat, int dstW, int dstH, int dstFormat); struct SwsContext *sws_getContextFromCmdLine_hq(int srcW, int srcH, int srcFormat, int dstW, int dstH, int dstFormat); diff --git a/libmpcodecs/vf_smartblur.c b/libmpcodecs/vf_smartblur.c index 7c54231e40..da6f3547bf 100644 --- a/libmpcodecs/vf_smartblur.c +++ b/libmpcodecs/vf_smartblur.c @@ -61,7 +61,7 @@ static int allocStuff(FilterParam *f, int width, int height){ swsF.lumH= swsF.lumV= vec; swsF.chrH= swsF.chrV= NULL; f->filterContext= sws_getContext( - width, height, PIX_FMT_GRAY8, width, height, PIX_FMT_GRAY8, SWS_BICUBIC | get_sws_cpuflags(), &swsF, NULL, NULL); + width, height, PIX_FMT_GRAY8, width, height, PIX_FMT_GRAY8, SWS_BICUBIC, &swsF, NULL, NULL); sws_freeVec(vec);