diff options
author | michael <michael@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2002-10-30 21:02:21 +0000 |
---|---|---|
committer | michael <michael@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2002-10-30 21:02:21 +0000 |
commit | ad5a3a16da862383748a80b144e3379321554337 (patch) | |
tree | f567158294f2431596a8abfe6952583f17bbca19 | |
parent | 31642e274476f8a068e0110675b2ad16b345ec78 (diff) | |
download | mpv-ad5a3a16da862383748a80b144e3379321554337.tar.bz2 mpv-ad5a3a16da862383748a80b144e3379321554337.tar.xz |
per context cpuCaps (idea by kabi)
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@7986 b3059339-0415-0410-9bf9-f77b7e298cf2
-rw-r--r-- | libmpcodecs/vf_pp.c | 12 | ||||
-rw-r--r-- | postproc/postprocess.c | 22 | ||||
-rw-r--r-- | postproc/postprocess.h | 3 |
3 files changed, 15 insertions, 22 deletions
diff --git a/libmpcodecs/vf_pp.c b/libmpcodecs/vf_pp.c index 15bd9200dd..fe05d170c2 100644 --- a/libmpcodecs/vf_pp.c +++ b/libmpcodecs/vf_pp.c @@ -27,7 +27,11 @@ struct vf_priv_s { static int config(struct vf_instance_s* vf, int width, int height, int d_width, int d_height, unsigned int voflags, unsigned int outfmt){ - vf->priv->context= pp_get_context(width, height); + vf->priv->context= pp_get_context(width, height, + (gCpuCaps.hasMMX ? PP_CPU_CAPS_MMX : 0) + | (gCpuCaps.hasMMX2 ? PP_CPU_CAPS_MMX2 : 0) + | (gCpuCaps.has3DNow ? PP_CPU_CAPS_3DNOW : 0) + ); return vf_next_config(vf,width,height,d_width,d_height,voflags,vf->priv->outfmt); } @@ -131,12 +135,6 @@ static int open(vf_instance_t *vf, char* args){ 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); diff --git a/postproc/postprocess.c b/postproc/postprocess.c index 42c8fc820c..b46309df59 100644 --- a/postproc/postprocess.c +++ b/postproc/postprocess.c @@ -104,8 +104,6 @@ static int verbose= 0; static const int deringThreshold= 20; -static int cpuCaps=0; - struct PPFilter{ char *shortName; char *longName; @@ -150,6 +148,8 @@ typedef struct PPContext{ int nonBQP; int frameNum; + + int cpuCaps; PPMode ppMode; } PPContext; @@ -221,12 +221,6 @@ static inline void prefetcht2(void *p) } #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 /** @@ -495,7 +489,7 @@ static inline void horizX1Filter(uint8_t *src, int stride, int QP) // minor note: the HAVE_xyz is messed up after that line so dont use it static inline void postProcess(uint8_t src[], int srcStride, uint8_t dst[], int dstStride, int width, int height, - QP_STORE_T QPs[], int QPStride, int isColor, PPMode *ppMode, void *vc) + QP_STORE_T QPs[], int QPStride, int isColor, PPMode *ppMode, pp_context *vc) { PPContext *c= (PPContext *)vc; c->ppMode= *ppMode; //FIXME @@ -506,11 +500,11 @@ static inline void postProcess(uint8_t src[], int srcStride, uint8_t dst[], int #ifdef RUNTIME_CPUDETECT #ifdef ARCH_X86 // ordered per speed fasterst first - if(cpuCaps & PP_CPU_CAPS_MMX2) + if(c->cpuCaps & PP_CPU_CAPS_MMX2) postProcess_MMX2(src, srcStride, dst, dstStride, width, height, QPs, QPStride, isColor, c); - else if(cpuCaps & PP_CPU_CAPS_3DNOW) + else if(c->cpuCaps & PP_CPU_CAPS_3DNOW) postProcess_3DNow(src, srcStride, dst, dstStride, width, height, QPs, QPStride, isColor, c); - else if(cpuCaps & PP_CPU_CAPS_MMX) + else if(c->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); @@ -759,11 +753,13 @@ struct PPMode pp_get_mode_by_name_and_quality(char *name, int quality) return ppMode; } -void *pp_get_context(int width, int height){ +void *pp_get_context(int width, int height, int cpuCaps){ PPContext *c= memalign(32, sizeof(PPContext)); int i; int mbWidth = (width+15)>>4; int mbHeight= (height+15)>>4; + + c->cpuCaps= cpuCaps; c->tempBlocks= (uint8_t*)memalign(8, 2*16*8); c->yHistogram= (uint64_t*)memalign(8, 256*sizeof(uint64_t)); diff --git a/postproc/postprocess.h b/postproc/postprocess.h index 36f3566b6a..f638ad60e1 100644 --- a/postproc/postprocess.h +++ b/postproc/postprocess.h @@ -95,10 +95,9 @@ void pp_postprocess(uint8_t * src[3], int srcStride[3], // name is the stuff after "-pp" on the command line PPMode pp_get_mode_by_name_and_quality(char *name, int quality); -pp_context *pp_get_context(int width, int height); +pp_context *pp_get_context(int width, int height, int cpuCaps); void pp_free_context(pp_context *ppContext); -int pp_init(int cpuCaps); #define PP_CPU_CAPS_MMX 0x80000000 #define PP_CPU_CAPS_MMX2 0x20000000 #define PP_CPU_CAPS_3DNOW 0x40000000 |