mirror of
https://gitee.com/openharmony/third_party_ffmpeg
synced 2024-11-23 19:30:05 +00:00
per context cpuCaps (idea by kabi)
Originally committed as revision 7986 to svn://svn.mplayerhq.hu/mplayer/trunk/postproc
This commit is contained in:
parent
4407a3c47a
commit
fa6ea14e40
@ -104,8 +104,6 @@ static int verbose= 0;
|
|||||||
|
|
||||||
static const int deringThreshold= 20;
|
static const int deringThreshold= 20;
|
||||||
|
|
||||||
static int cpuCaps=0;
|
|
||||||
|
|
||||||
struct PPFilter{
|
struct PPFilter{
|
||||||
char *shortName;
|
char *shortName;
|
||||||
char *longName;
|
char *longName;
|
||||||
@ -151,6 +149,8 @@ typedef struct PPContext{
|
|||||||
|
|
||||||
int frameNum;
|
int frameNum;
|
||||||
|
|
||||||
|
int cpuCaps;
|
||||||
|
|
||||||
PPMode ppMode;
|
PPMode ppMode;
|
||||||
} PPContext;
|
} PPContext;
|
||||||
|
|
||||||
@ -221,12 +221,6 @@ static inline void prefetcht2(void *p)
|
|||||||
}
|
}
|
||||||
#endif
|
#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
|
// 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
|
// 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,
|
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;
|
PPContext *c= (PPContext *)vc;
|
||||||
c->ppMode= *ppMode; //FIXME
|
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 RUNTIME_CPUDETECT
|
||||||
#ifdef ARCH_X86
|
#ifdef ARCH_X86
|
||||||
// ordered per speed fasterst first
|
// 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);
|
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);
|
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);
|
postProcess_MMX(src, srcStride, dst, dstStride, width, height, QPs, QPStride, isColor, c);
|
||||||
else
|
else
|
||||||
postProcess_C(src, srcStride, dst, dstStride, width, height, QPs, QPStride, isColor, c);
|
postProcess_C(src, srcStride, dst, dstStride, width, height, QPs, QPStride, isColor, c);
|
||||||
@ -759,12 +753,14 @@ struct PPMode pp_get_mode_by_name_and_quality(char *name, int quality)
|
|||||||
return ppMode;
|
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));
|
PPContext *c= memalign(32, sizeof(PPContext));
|
||||||
int i;
|
int i;
|
||||||
int mbWidth = (width+15)>>4;
|
int mbWidth = (width+15)>>4;
|
||||||
int mbHeight= (height+15)>>4;
|
int mbHeight= (height+15)>>4;
|
||||||
|
|
||||||
|
c->cpuCaps= cpuCaps;
|
||||||
|
|
||||||
c->tempBlocks= (uint8_t*)memalign(8, 2*16*8);
|
c->tempBlocks= (uint8_t*)memalign(8, 2*16*8);
|
||||||
c->yHistogram= (uint64_t*)memalign(8, 256*sizeof(uint64_t));
|
c->yHistogram= (uint64_t*)memalign(8, 256*sizeof(uint64_t));
|
||||||
for(i=0; i<256; i++)
|
for(i=0; i<256; i++)
|
||||||
|
@ -95,10 +95,9 @@ void pp_postprocess(uint8_t * src[3], int srcStride[3],
|
|||||||
// name is the stuff after "-pp" on the command line
|
// name is the stuff after "-pp" on the command line
|
||||||
PPMode pp_get_mode_by_name_and_quality(char *name, int quality);
|
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);
|
void pp_free_context(pp_context *ppContext);
|
||||||
|
|
||||||
int pp_init(int cpuCaps);
|
|
||||||
#define PP_CPU_CAPS_MMX 0x80000000
|
#define PP_CPU_CAPS_MMX 0x80000000
|
||||||
#define PP_CPU_CAPS_MMX2 0x20000000
|
#define PP_CPU_CAPS_MMX2 0x20000000
|
||||||
#define PP_CPU_CAPS_3DNOW 0x40000000
|
#define PP_CPU_CAPS_3DNOW 0x40000000
|
||||||
|
Loading…
Reference in New Issue
Block a user