diff options
Diffstat (limited to 'ffmpeg/libswscale/ppc')
| -rw-r--r-- | ffmpeg/libswscale/ppc/Makefile | 6 | ||||
| -rw-r--r-- | ffmpeg/libswscale/ppc/swscale_altivec.c | 6 | ||||
| -rw-r--r-- | ffmpeg/libswscale/ppc/yuv2rgb_altivec.c | 62 | ||||
| -rw-r--r-- | ffmpeg/libswscale/ppc/yuv2yuv_altivec.c | 22 |
4 files changed, 62 insertions, 34 deletions
diff --git a/ffmpeg/libswscale/ppc/Makefile b/ffmpeg/libswscale/ppc/Makefile index 018955b..d1b596e 100644 --- a/ffmpeg/libswscale/ppc/Makefile +++ b/ffmpeg/libswscale/ppc/Makefile @@ -1,3 +1,3 @@ -ALTIVEC-OBJS += ppc/swscale_altivec.o \ - ppc/yuv2rgb_altivec.o \ - ppc/yuv2yuv_altivec.o \ +OBJS += ppc/swscale_altivec.o \ + ppc/yuv2rgb_altivec.o \ + ppc/yuv2yuv_altivec.o \ diff --git a/ffmpeg/libswscale/ppc/swscale_altivec.c b/ffmpeg/libswscale/ppc/swscale_altivec.c index 9ca2868..86f40ab 100644 --- a/ffmpeg/libswscale/ppc/swscale_altivec.c +++ b/ffmpeg/libswscale/ppc/swscale_altivec.c @@ -30,6 +30,7 @@ #include "libavutil/cpu.h" #include "yuv2rgb_altivec.h" +#if HAVE_ALTIVEC #define vzero vec_splat_s32(0) #define yuv2planeX_8(d1, d2, l1, src, x, perm, filter) do { \ @@ -284,9 +285,11 @@ static void hScale_altivec_real(SwsContext *c, int16_t *dst, int dstW, } } } +#endif /* HAVE_ALTIVEC */ -av_cold void ff_sws_init_swScale_altivec(SwsContext *c) +av_cold void ff_sws_init_swscale_ppc(SwsContext *c) { +#if HAVE_ALTIVEC enum AVPixelFormat dstFormat = c->dstFormat; if (!(av_get_cpu_flags() & AV_CPU_FLAG_ALTIVEC)) @@ -325,4 +328,5 @@ av_cold void ff_sws_init_swScale_altivec(SwsContext *c) break; } } +#endif /* HAVE_ALTIVEC */ } diff --git a/ffmpeg/libswscale/ppc/yuv2rgb_altivec.c b/ffmpeg/libswscale/ppc/yuv2rgb_altivec.c index a8501d9..25282bf 100644 --- a/ffmpeg/libswscale/ppc/yuv2rgb_altivec.c +++ b/ffmpeg/libswscale/ppc/yuv2rgb_altivec.c @@ -100,6 +100,8 @@ #include "libavutil/pixdesc.h" #include "yuv2rgb_altivec.h" +#if HAVE_ALTIVEC + #undef PROFILE_THE_BEAST #undef INC_SCALING @@ -246,8 +248,6 @@ static const vector unsigned char (vector unsigned short) \ vec_max(y, ((vector signed short) { 0 }))) -//#define out_pixels(a, b, c, ptr) vec_mstrgb32(__typeof__(a), ((__typeof__(a)) { 255 }), a, a, a, ptr) - static inline void cvtyuvtoRGB(SwsContext *c, vector signed short Y, vector signed short U, vector signed short V, vector signed short *R, vector signed short *G, @@ -526,14 +526,17 @@ static int altivec_uyvy_rgb32(SwsContext *c, const unsigned char **in, return srcSliceH; } +#endif /* HAVE_ALTIVEC */ + /* Ok currently the acceleration routine only supports * inputs of widths a multiple of 16 * and heights a multiple 2 * * So we just fall back to the C codes for this. */ -av_cold SwsFunc ff_yuv2rgb_init_altivec(SwsContext *c) +av_cold SwsFunc ff_yuv2rgb_init_ppc(SwsContext *c) { +#if HAVE_ALTIVEC if (!(av_get_cpu_flags() & AV_CPU_FLAG_ALTIVEC)) return NULL; @@ -589,20 +592,26 @@ av_cold SwsFunc ff_yuv2rgb_init_altivec(SwsContext *c) } break; } +#endif /* HAVE_ALTIVEC */ + return NULL; } -av_cold void ff_yuv2rgb_init_tables_altivec(SwsContext *c, - const int inv_table[4], - int brightness, - int contrast, - int saturation) +av_cold void ff_yuv2rgb_init_tables_ppc(SwsContext *c, + const int inv_table[4], + int brightness, + int contrast, + int saturation) { +#if HAVE_ALTIVEC union { DECLARE_ALIGNED(16, signed short, tmp)[8]; vector signed short vec; } buf; + if (!(av_get_cpu_flags() & AV_CPU_FLAG_ALTIVEC)) + return; + buf.tmp[0] = ((0xffffLL) * contrast >> 8) >> 9; // cy buf.tmp[1] = -256 * brightness; // oy buf.tmp[2] = (inv_table[0] >> 3) * (contrast >> 16) * (saturation >> 16); // crv @@ -618,20 +627,23 @@ av_cold void ff_yuv2rgb_init_tables_altivec(SwsContext *c, c->CGU = vec_splat((vector signed short) buf.vec, 4); c->CGV = vec_splat((vector signed short) buf.vec, 5); return; +#endif /* HAVE_ALTIVEC */ } -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, - enum AVPixelFormat target) +#if HAVE_ALTIVEC + +static av_always_inline void 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, + enum AVPixelFormat target) { int i, j; vector signed short X, X0, X1, Y0, U0, V0, Y1, U1, V1, U, V; @@ -840,10 +852,10 @@ void ff_yuv2 ## suffix ## _X_altivec(SwsContext *c, \ 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_altivec(c, lumFilter, lumSrc, lumFilterSize, \ + chrFilter, chrUSrc, chrVSrc, \ + chrFilterSize, alpSrc, \ + dest, dstW, dstY, pixfmt); \ } YUV2PACKEDX_WRAPPER(abgr, AV_PIX_FMT_ABGR); @@ -852,3 +864,5 @@ YUV2PACKEDX_WRAPPER(argb, AV_PIX_FMT_ARGB); YUV2PACKEDX_WRAPPER(rgba, AV_PIX_FMT_RGBA); YUV2PACKEDX_WRAPPER(rgb24, AV_PIX_FMT_RGB24); YUV2PACKEDX_WRAPPER(bgr24, AV_PIX_FMT_BGR24); + +#endif /* HAVE_ALTIVEC */ diff --git a/ffmpeg/libswscale/ppc/yuv2yuv_altivec.c b/ffmpeg/libswscale/ppc/yuv2yuv_altivec.c index 792deb9..2b1c5dd 100644 --- a/ffmpeg/libswscale/ppc/yuv2yuv_altivec.c +++ b/ffmpeg/libswscale/ppc/yuv2yuv_altivec.c @@ -24,9 +24,12 @@ #include <inttypes.h> #include "config.h" +#include "libavutil/attributes.h" +#include "libavutil/cpu.h" #include "libswscale/swscale.h" #include "libswscale/swscale_internal.h" -#include "libavutil/cpu.h" + +#if HAVE_ALTIVEC static int yv12toyuy2_unscaled_altivec(SwsContext *c, const uint8_t *src[], int srcStride[], int srcSliceY, @@ -179,16 +182,23 @@ static int yv12touyvy_unscaled_altivec(SwsContext *c, const uint8_t *src[], return srcSliceH; } -void ff_swscale_get_unscaled_altivec(SwsContext *c) +#endif /* HAVE_ALTIVEC */ + +av_cold void ff_get_unscaled_swscale_ppc(SwsContext *c) { - if ((av_get_cpu_flags() & AV_CPU_FLAG_ALTIVEC) && !(c->srcW & 15) && - !(c->flags & SWS_BITEXACT) && c->srcFormat == AV_PIX_FMT_YUV420P) { +#if HAVE_ALTIVEC + if (!(av_get_cpu_flags() & AV_CPU_FLAG_ALTIVEC)) + return; + + if (!(c->srcW & 15) && !(c->flags & SWS_BITEXACT) && + c->srcFormat == AV_PIX_FMT_YUV420P) { enum AVPixelFormat dstFormat = c->dstFormat; // unscaled YV12 -> packed YUV, we want speed if (dstFormat == AV_PIX_FMT_YUYV422) - c->swScale = yv12toyuy2_unscaled_altivec; + c->swscale = yv12toyuy2_unscaled_altivec; else if (dstFormat == AV_PIX_FMT_UYVY422) - c->swScale = yv12touyvy_unscaled_altivec; + c->swscale = yv12touyvy_unscaled_altivec; } +#endif /* HAVE_ALTIVEC */ } |
