Mercurial > mplayer.hg
changeset 7972:6d1103afba1c
cleanly passing the cpuCaps
author | michael |
---|---|
date | Wed, 30 Oct 2002 01:51:14 +0000 |
parents | b6d3ada27931 |
children | ade6eb7abc2a |
files | libmpcodecs/vf_pp.c postproc/postprocess.c postproc/postprocess.h |
diffstat | 3 files changed, 24 insertions(+), 15 deletions(-) [+] |
line wrap: on
line diff
--- a/libmpcodecs/vf_pp.c Tue Oct 29 23:43:23 2002 +0000 +++ b/libmpcodecs/vf_pp.c Wed Oct 30 01:51:14 2002 +0000 @@ -6,6 +6,7 @@ #include "../config.h" #include "../mp_msg.h" +#include "../cpudetect.h" #include "img_format.h" #include "mp_image.h" @@ -97,7 +98,6 @@ &vf->priv->ppMode[ vf->priv->pp ], vf->priv->context, mpi->pict_type); } - return vf_next_put_image(vf,vf->priv->dmpi); } @@ -131,6 +131,12 @@ vf->priv->outfmt=vf_match_csp(&vf->next,fmt_list,IMGFMT_YV12); if(!vf->priv->outfmt) return 0; // no csp match :( + pp_init( + (gCpuCaps.hasMMX ? PP_CPU_CAPS_MMX : 0) + | (gCpuCaps.hasMMX2 ? PP_CPU_CAPS_MMX2 : 0) + | (gCpuCaps.has3DNow ? PP_CPU_CAPS_3DNOW : 0) + ); + if(args){ if(!strcmp("help", args)){ printf("%s", pp_help); @@ -145,7 +151,7 @@ }else{ name="de"; } - + if(name){ for(i=0; i<=GET_PP_QUALITY_MAX; i++){ vf->priv->ppMode[i]= pp_get_mode_by_name_and_quality(name, i);
--- a/postproc/postprocess.c Tue Oct 29 23:43:23 2002 +0000 +++ b/postproc/postprocess.c Wed Oct 30 01:51:14 2002 +0000 @@ -77,7 +77,6 @@ //#define DEBUG_BRIGHTNESS #include "../libvo/fastmemcpy.h" #include "postprocess.h" -#include "../cpudetect.h" #include "../mangle.h" #define MIN(a,b) ((a) > (b) ? (b) : (a)) @@ -105,6 +104,8 @@ static const int deringThreshold= 20; +static int cpuCaps=0; + struct PPFilter{ char *shortName; char *longName; @@ -189,15 +190,6 @@ } #endif -static inline long long rdtsc() -{ - long long l; - asm volatile( "rdtsc\n\t" - : "=A" (l) - ); -// printf("%d\n", int(l/1000)); - return l; -} #ifdef ARCH_X86 static inline void prefetchnta(void *p) @@ -229,6 +221,12 @@ } #endif +int pp_init(int caps){ + cpuCaps= caps; + + return 0; +} + // The horizontal Functions exist only in C cuz the MMX code is faster with vertical filters and transposing /** @@ -508,11 +506,11 @@ #ifdef RUNTIME_CPUDETECT #ifdef ARCH_X86 // ordered per speed fasterst first - if(gCpuCaps.hasMMX2) + if(cpuCaps & PP_CPU_CAPS_MMX2) postProcess_MMX2(src, srcStride, dst, dstStride, width, height, QPs, QPStride, isColor, c); - else if(gCpuCaps.has3DNow) + else if(cpuCaps & PP_CPU_CAPS_3DNOW) postProcess_3DNow(src, srcStride, dst, dstStride, width, height, QPs, QPStride, isColor, c); - else if(gCpuCaps.hasMMX) + else if(cpuCaps & PP_CPU_CAPS_MMX) postProcess_MMX(src, srcStride, dst, dstStride, width, height, QPs, QPStride, isColor, c); else postProcess_C(src, srcStride, dst, dstStride, width, height, QPs, QPStride, isColor, c);
--- a/postproc/postprocess.h Tue Oct 29 23:43:23 2002 +0000 +++ b/postproc/postprocess.h Wed Oct 30 01:51:14 2002 +0000 @@ -96,4 +96,9 @@ void *pp_get_context(int width, int height); void pp_free_context(void *ppContext); +int pp_init(int cpuCaps); +#define PP_CPU_CAPS_MMX 1 +#define PP_CPU_CAPS_MMX2 2 +#define PP_CPU_CAPS_3DNOW 4 + #endif