提交 a31de956 编写于 作者: M Michael Niedermayer

altivec yuv->rgb converter

orginal patch  by (Marc Hoffman <mmh at pleasantst dot com>)
critical fixes by (Reza Jelveh <reza.jelveh at tu-harburg dot de>)

known bugs/issues, which should be fixed ASAP by someone who has a ppc:
0..255 vs. 16..235
unneeded recalculation of tables
general cleaup, like removing double initalizing of variables

Originally committed as revision 12699 to svn://svn.mplayerhq.hu/mplayer/trunk/postproc
上级 92e09c5d
......@@ -4,8 +4,13 @@ include ../config.mak
SWSLIB = libswscale.a
SWSSRCS=swscale.c rgb2rgb.c yuv2rgb.c
SWSOBJS=$(SWSSRCS:.c=.o)
ifeq ($(TARGET_ALTIVEC),yes)
SWSOBJS += yuv2rgb_altivec.o
endif
CFLAGS = $(OPTFLAGS) $(MLIB_INC) -I. -I.. $(EXTRA_INC)
# -I/usr/X11R6/include/
......@@ -44,3 +49,4 @@ swscale-example: swscale-example.o $(SWSLIB)
ifneq ($(wildcard .depend),)
include .depend
endif
......@@ -28,6 +28,10 @@
#define srcByte 0x55
#define dstByte 0xBB
#ifdef __APPLE_CC__
#define memalign(x,y) malloc(y)
#endif
static int get_sws_cpuflags()
{
return (gCpuCaps.hasMMX ? SWS_CPU_CAPS_MMX : 0) |
......@@ -281,4 +285,4 @@ main(int argc, char **argv)
printf("%d converters passed, %d converters randomly overwrote memory\n", passedNum, failedNum);
return failedNum;
}
\ No newline at end of file
}
......@@ -1726,7 +1726,10 @@ int sws_setColorspaceDetails(SwsContext *c, const int inv_table[4], int srcRange
yuv2rgb_c_init_tables(c, inv_table, srcRange, brightness, contrast, saturation);
//FIXME factorize
#ifdef HAVE_ALTIVEC
yuv2rgb_altivec_init_tables (c, inv_table);
#endif
return 0;
}
......
......@@ -132,6 +132,19 @@ typedef struct SwsContext{
int dstW;
int esp;
uint64_t vRounder __attribute__((aligned(8)));
#ifdef HAVE_ALTIVEC
vector signed short CY;
vector signed short CRV;
vector signed short CBU;
vector signed short CGU;
vector signed short CGV;
vector signed short OY;
vector unsigned short CSHIFT;
#endif
} SwsContext;
//FIXME check init (where 0)
......
......@@ -943,9 +943,15 @@ static inline void RENAME(yuv2packedX)(SwsContext *c, int16_t *lumFilter, int16_
break;
#endif
default:
#ifdef HAVE_ALTIVEC
altivec_yuv2packedX (c, lumFilter, lumSrc, lumFilterSize,
chrFilter, chrSrc, chrFilterSize,
dest, dstW, dstY);
#else
yuv2packedXinC(c, lumFilter, lumSrc, lumFilterSize,
chrFilter, chrSrc, chrFilterSize,
dest, dstW, dstY);
#endif
break;
}
}
......
......@@ -607,6 +607,14 @@ SwsFunc yuv2rgb_get_func_ptr (SwsContext *c)
if(t) return t;
}
#endif
#ifdef HAVE_ALTIVEC
if (c->flags & SWS_CPU_CAPS_ALTIVEC)
{
SwsFunc t = yuv2rgb_init_altivec(c);
if(t) return t;
}
#endif
MSG_WARN("No accelerated colorspace conversion found\n");
switch(c->dstFormat){
......
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册