summaryrefslogtreecommitdiff
path: root/libswscale/ppc
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2011-06-29 04:08:31 +0200
committerMichael Niedermayer <michaelni@gmx.at>2011-06-29 05:23:12 +0200
commitbb9d5171a7352205ac9f09c970e24938fab57165 (patch)
tree2abd874837de6e7cc0f21d1f84e13555b2eeb755 /libswscale/ppc
parentdbe5f0172b4f123b15bc8ada82dd17b13c4bbbd7 (diff)
parent4578435f35888c95b12a53a12cdab612ac3fef04 (diff)
Merge remote-tracking branch 'qatar/master'
* qatar/master: (21 commits) swscale: Add Doxygen for hyscale_fast/hScale. fate: enable lavfi-pixmt tests on big endian systems PPC: swscale: disable altivec functions for unsupported formats fate: merge identical pixdesc_be/le tests swscale: Add Doxygen for yuv2planar*/yuv2packed* functions. build: call texi2pod.pl with full path instead of symlink build: include sub-makefiles using full path instead of symlinks swscale: update big endian reference values after dff5a835. wavpack: skip blocks with no samples cosmetics: remove outdated comment that is no longer true build: replace some addprefix/addsuffix with substitution refs avutil: Remove unused arbitrary precision integer code. configure: Drop check for availability of ten assembler operands. aacenc: Save channel configuration for later use. aacenc: Fix codebook trellising for zeroed bands. swscale: change prototypes of scaled YUV output functions. swscale: re-add support for non-native endianness. swscale: disentangle yuv2rgbX_c_full() into small functions. swscale: split yuv2packed[12X]_c() remainders into small functions. swscale: split yuv2packedX_altivec in smaller functions. ... Conflicts: Makefile configure libavcodec/x86/dsputil_mmx.c libavfilter/Makefile libavformat/Makefile libavutil/integer.c libavutil/integer.h libswscale/swscale.c libswscale/swscale_internal.h libswscale/x86/swscale_template.c tests/ref/lavfi/pixdesc_le tests/ref/lavfi/pixfmts_scale Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libswscale/ppc')
-rw-r--r--libswscale/ppc/swscale_altivec.c25
-rw-r--r--libswscale/ppc/yuv2rgb_altivec.c28
-rw-r--r--libswscale/ppc/yuv2rgb_altivec.h18
3 files changed, 52 insertions, 19 deletions
diff --git a/libswscale/ppc/swscale_altivec.c b/libswscale/ppc/swscale_altivec.c
index 08f10d2c18..924c67d191 100644
--- a/libswscale/ppc/swscale_altivec.c
+++ b/libswscale/ppc/swscale_altivec.c
@@ -98,10 +98,9 @@ yuv2yuvX_altivec_real(SwsContext *c,
int lumFilterSize, const int16_t *chrFilter,
const int16_t **chrUSrc, const int16_t **chrVSrc,
int chrFilterSize, const int16_t **alpSrc,
- uint8_t *dest, uint8_t *uDest,
- uint8_t *vDest, uint8_t *aDest,
- int dstW, int chrDstW)
+ uint8_t *dest[4], int dstW, int chrDstW)
{
+ uint8_t *yDest = dest[0], *uDest = dest[1], *vDest = dest[2];
const vector signed int vini = {(1 << 18), (1 << 18), (1 << 18), (1 << 18)};
register int i, j;
{
@@ -150,7 +149,7 @@ yuv2yuvX_altivec_real(SwsContext *c,
val[i] += lumSrc[j][i] * lumFilter[j];
}
}
- altivec_packIntArrayToCharArray(val, dest, dstW);
+ altivec_packIntArrayToCharArray(val, yDest, dstW);
}
if (uDest != 0) {
DECLARE_ALIGNED(16, int, u)[chrDstW];
@@ -408,16 +407,22 @@ void ff_sws_init_swScale_altivec(SwsContext *c)
return;
c->hScale = hScale_altivec_real;
- if (!is16BPS(dstFormat) && !is9_OR_10BPS(dstFormat)) {
+ if (!is16BPS(dstFormat) && !is9_OR_10BPS(dstFormat) &&
+ dstFormat != PIX_FMT_NV12 && dstFormat != PIX_FMT_NV21 &&
+ !c->alpPixBuf) {
c->yuv2yuvX = yuv2yuvX_altivec_real;
}
/* The following list of supported dstFormat values should
* match what's found in the body of ff_yuv2packedX_altivec() */
- if (!(c->flags & (SWS_BITEXACT | SWS_FULL_CHR_H_INT)) && !c->alpPixBuf &&
- (c->dstFormat==PIX_FMT_ABGR || c->dstFormat==PIX_FMT_BGRA ||
- c->dstFormat==PIX_FMT_BGR24 || c->dstFormat==PIX_FMT_RGB24 ||
- c->dstFormat==PIX_FMT_RGBA || c->dstFormat==PIX_FMT_ARGB)) {
- c->yuv2packedX = ff_yuv2packedX_altivec;
+ if (!(c->flags & (SWS_BITEXACT | SWS_FULL_CHR_H_INT)) && !c->alpPixBuf) {
+ switch (c->dstFormat) {
+ case PIX_FMT_ABGR: c->yuv2packedX = ff_yuv2abgr_X_altivec; break;
+ case PIX_FMT_BGRA: c->yuv2packedX = ff_yuv2bgra_X_altivec; break;
+ case PIX_FMT_ARGB: c->yuv2packedX = ff_yuv2argb_X_altivec; break;
+ case PIX_FMT_RGBA: c->yuv2packedX = ff_yuv2rgba_X_altivec; break;
+ case PIX_FMT_BGR24: c->yuv2packedX = ff_yuv2bgr24_X_altivec; break;
+ case PIX_FMT_RGB24: c->yuv2packedX = ff_yuv2rgb24_X_altivec; break;
}
+ }
}
diff --git a/libswscale/ppc/yuv2rgb_altivec.c b/libswscale/ppc/yuv2rgb_altivec.c
index e13702b100..8e84c26382 100644
--- a/libswscale/ppc/yuv2rgb_altivec.c
+++ b/libswscale/ppc/yuv2rgb_altivec.c
@@ -627,13 +627,13 @@ void ff_yuv2rgb_init_tables_altivec(SwsContext *c, const int inv_table[4], int b
}
-void
+static av_always_inline void
ff_yuv2packedX_altivec(SwsContext *c, const int16_t *lumFilter,
const int16_t **lumSrc, int lumFilterSize,
const int16_t *chrFilter, const int16_t **chrUSrc,
const int16_t **chrVSrc, int chrFilterSize,
const int16_t **alpSrc, uint8_t *dest,
- int dstW, int dstY)
+ int dstW, int dstY, enum PixelFormat target)
{
int i,j;
vector signed short X,X0,X1,Y0,U0,V0,Y1,U1,V1,U,V;
@@ -707,7 +707,7 @@ ff_yuv2packedX_altivec(SwsContext *c, const int16_t *lumFilter,
G = vec_packclp (G0,G1);
B = vec_packclp (B0,B1);
- switch(c->dstFormat) {
+ switch(target) {
case PIX_FMT_ABGR: out_abgr (R,G,B,out); break;
case PIX_FMT_BGRA: out_bgra (R,G,B,out); break;
case PIX_FMT_RGBA: out_rgba (R,G,B,out); break;
@@ -786,7 +786,7 @@ ff_yuv2packedX_altivec(SwsContext *c, const int16_t *lumFilter,
B = vec_packclp (B0,B1);
nout = (vector unsigned char *)scratch;
- switch(c->dstFormat) {
+ switch(target) {
case PIX_FMT_ABGR: out_abgr (R,G,B,nout); break;
case PIX_FMT_BGRA: out_bgra (R,G,B,nout); break;
case PIX_FMT_RGBA: out_rgba (R,G,B,nout); break;
@@ -804,3 +804,23 @@ ff_yuv2packedX_altivec(SwsContext *c, const int16_t *lumFilter,
}
}
+
+#define YUV2PACKEDX_WRAPPER(suffix, pixfmt) \
+void ff_yuv2 ## suffix ## _X_altivec(SwsContext *c, const int16_t *lumFilter, \
+ const int16_t **lumSrc, int lumFilterSize, \
+ const int16_t *chrFilter, const int16_t **chrUSrc, \
+ const int16_t **chrVSrc, int chrFilterSize, \
+ const int16_t **alpSrc, uint8_t *dest, \
+ int dstW, int dstY) \
+{ \
+ ff_yuv2packedX_altivec(c, lumFilter, lumSrc, lumFilterSize, \
+ chrFilter, chrUSrc, chrVSrc, chrFilterSize, \
+ alpSrc, dest, dstW, dstY, pixfmt); \
+}
+
+YUV2PACKEDX_WRAPPER(abgr, PIX_FMT_ABGR);
+YUV2PACKEDX_WRAPPER(bgra, PIX_FMT_BGRA);
+YUV2PACKEDX_WRAPPER(argb, PIX_FMT_ARGB);
+YUV2PACKEDX_WRAPPER(rgba, PIX_FMT_RGBA);
+YUV2PACKEDX_WRAPPER(rgb24, PIX_FMT_RGB24);
+YUV2PACKEDX_WRAPPER(bgr24, PIX_FMT_BGR24);
diff --git a/libswscale/ppc/yuv2rgb_altivec.h b/libswscale/ppc/yuv2rgb_altivec.h
index 15385b1d3b..163eba6eb7 100644
--- a/libswscale/ppc/yuv2rgb_altivec.h
+++ b/libswscale/ppc/yuv2rgb_altivec.h
@@ -24,11 +24,19 @@
#ifndef PPC_YUV2RGB_ALTIVEC_H
#define PPC_YUV2RGB_ALTIVEC_H 1
-void ff_yuv2packedX_altivec(SwsContext *c, const int16_t *lumFilter,
- const int16_t **lumSrc, int lumFilterSize,
- const int16_t *chrFilter, const int16_t **chrUSrc,
- const int16_t **chrVSrc, int chrFilterSize,
- const int16_t **alpSrc, uint8_t *dest,
+#define YUV2PACKEDX_HEADER(suffix) \
+void ff_yuv2 ## suffix ## _X_altivec(SwsContext *c, const int16_t *lumFilter, \
+ const int16_t **lumSrc, int lumFilterSize, \
+ const int16_t *chrFilter, const int16_t **chrUSrc, \
+ const int16_t **chrVSrc, int chrFilterSize, \
+ const int16_t **alpSrc, uint8_t *dest, \
int dstW, int dstY);
+YUV2PACKEDX_HEADER(abgr);
+YUV2PACKEDX_HEADER(bgra);
+YUV2PACKEDX_HEADER(argb);
+YUV2PACKEDX_HEADER(rgba);
+YUV2PACKEDX_HEADER(rgb24);
+YUV2PACKEDX_HEADER(bgr24);
+
#endif /* PPC_YUV2RGB_ALTIVEC_H */