Commit 8ec53394 authored by michael's avatar michael

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


git-svn-id: file:///var/local/repositories/mplayer/trunk/postproc@12699 b3059339-0415-0410-9bf9-f77b7e298cf2
parent bad3e79d
...@@ -4,8 +4,13 @@ include ../config.mak ...@@ -4,8 +4,13 @@ include ../config.mak
SWSLIB = libswscale.a SWSLIB = libswscale.a
SWSSRCS=swscale.c rgb2rgb.c yuv2rgb.c SWSSRCS=swscale.c rgb2rgb.c yuv2rgb.c
SWSOBJS=$(SWSSRCS:.c=.o) SWSOBJS=$(SWSSRCS:.c=.o)
ifeq ($(TARGET_ALTIVEC),yes)
SWSOBJS += yuv2rgb_altivec.o
endif
CFLAGS = $(OPTFLAGS) $(MLIB_INC) -I. -I.. $(EXTRA_INC) CFLAGS = $(OPTFLAGS) $(MLIB_INC) -I. -I.. $(EXTRA_INC)
# -I/usr/X11R6/include/ # -I/usr/X11R6/include/
...@@ -44,3 +49,4 @@ swscale-example: swscale-example.o $(SWSLIB) ...@@ -44,3 +49,4 @@ swscale-example: swscale-example.o $(SWSLIB)
ifneq ($(wildcard .depend),) ifneq ($(wildcard .depend),)
include .depend include .depend
endif endif
...@@ -28,6 +28,10 @@ ...@@ -28,6 +28,10 @@
#define srcByte 0x55 #define srcByte 0x55
#define dstByte 0xBB #define dstByte 0xBB
#ifdef __APPLE_CC__
#define memalign(x,y) malloc(y)
#endif
static int get_sws_cpuflags() static int get_sws_cpuflags()
{ {
return (gCpuCaps.hasMMX ? SWS_CPU_CAPS_MMX : 0) | return (gCpuCaps.hasMMX ? SWS_CPU_CAPS_MMX : 0) |
...@@ -281,4 +285,4 @@ main(int argc, char **argv) ...@@ -281,4 +285,4 @@ main(int argc, char **argv)
printf("%d converters passed, %d converters randomly overwrote memory\n", passedNum, failedNum); printf("%d converters passed, %d converters randomly overwrote memory\n", passedNum, failedNum);
return 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 ...@@ -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); yuv2rgb_c_init_tables(c, inv_table, srcRange, brightness, contrast, saturation);
//FIXME factorize //FIXME factorize
#ifdef HAVE_ALTIVEC
yuv2rgb_altivec_init_tables (c, inv_table);
#endif
return 0; return 0;
} }
......
...@@ -132,6 +132,19 @@ typedef struct SwsContext{ ...@@ -132,6 +132,19 @@ typedef struct SwsContext{
int dstW; int dstW;
int esp; int esp;
uint64_t vRounder __attribute__((aligned(8))); 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; } SwsContext;
//FIXME check init (where 0) //FIXME check init (where 0)
......
...@@ -943,9 +943,15 @@ static inline void RENAME(yuv2packedX)(SwsContext *c, int16_t *lumFilter, int16_ ...@@ -943,9 +943,15 @@ static inline void RENAME(yuv2packedX)(SwsContext *c, int16_t *lumFilter, int16_
break; break;
#endif #endif
default: default:
#ifdef HAVE_ALTIVEC
altivec_yuv2packedX (c, lumFilter, lumSrc, lumFilterSize,
chrFilter, chrSrc, chrFilterSize,
dest, dstW, dstY);
#else
yuv2packedXinC(c, lumFilter, lumSrc, lumFilterSize, yuv2packedXinC(c, lumFilter, lumSrc, lumFilterSize,
chrFilter, chrSrc, chrFilterSize, chrFilter, chrSrc, chrFilterSize,
dest, dstW, dstY); dest, dstW, dstY);
#endif
break; break;
} }
} }
......
...@@ -607,6 +607,14 @@ SwsFunc yuv2rgb_get_func_ptr (SwsContext *c) ...@@ -607,6 +607,14 @@ SwsFunc yuv2rgb_get_func_ptr (SwsContext *c)
if(t) return t; if(t) return t;
} }
#endif #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"); MSG_WARN("No accelerated colorspace conversion found\n");
switch(c->dstFormat){ switch(c->dstFormat){
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment