OSDN Git Service

Merge remote-tracking branch 'qatar/master' into master
[coroid/ffmpeg_saccubus.git] / libswscale / ppc / swscale_template.c
1 /*
2  * Copyright (C) 2001-2003 Michael Niedermayer <michaelni@gmx.at>
3  *
4  * This file is part of FFmpeg.
5  *
6  * FFmpeg is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * FFmpeg is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with FFmpeg; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19  */
20
21
22 #if COMPILE_TEMPLATE_ALTIVEC
23 #include "swscale_altivec_template.c"
24 #endif
25
26 #if COMPILE_TEMPLATE_ALTIVEC
27 static inline void RENAME(yuv2yuvX)(SwsContext *c, const int16_t *lumFilter,
28                                     const int16_t **lumSrc, int lumFilterSize,
29                                     const int16_t *chrFilter, const int16_t **chrUSrc,
30                                     const int16_t **chrVSrc, int chrFilterSize,
31                                     const int16_t **alpSrc,
32                                     uint8_t *dest, uint8_t *uDest, uint8_t *vDest,
33                                     uint8_t *aDest, int dstW, int chrDstW)
34 {
35     yuv2yuvX_altivec_real(lumFilter, lumSrc, lumFilterSize,
36                           chrFilter, chrUSrc, chrVSrc, chrFilterSize,
37                           dest, uDest, vDest, dstW, chrDstW);
38 }
39
40 /**
41  * vertical scale YV12 to RGB
42  */
43 static inline void RENAME(yuv2packedX)(SwsContext *c, const int16_t *lumFilter,
44                                        const int16_t **lumSrc, int lumFilterSize,
45                                        const int16_t *chrFilter, const int16_t **chrUSrc,
46                                        const int16_t **chrVSrc, int chrFilterSize,
47                                        const int16_t **alpSrc, uint8_t *dest,
48                                        int dstW, int dstY)
49 {
50     /* The following list of supported dstFormat values should
51        match what's found in the body of ff_yuv2packedX_altivec() */
52     if (!(c->flags & SWS_BITEXACT) && !c->alpPixBuf &&
53          (c->dstFormat==PIX_FMT_ABGR  || c->dstFormat==PIX_FMT_BGRA  ||
54           c->dstFormat==PIX_FMT_BGR24 || c->dstFormat==PIX_FMT_RGB24 ||
55           c->dstFormat==PIX_FMT_RGBA  || c->dstFormat==PIX_FMT_ARGB))
56             ff_yuv2packedX_altivec(c, lumFilter, lumSrc, lumFilterSize,
57                                    chrFilter, chrUSrc, chrVSrc, chrFilterSize,
58                                    dest, dstW, dstY);
59     else
60         yuv2packedXinC(c, lumFilter, lumSrc, lumFilterSize,
61                        chrFilter, chrUSrc, chrVSrc, chrFilterSize,
62                        alpSrc, dest, dstW, dstY);
63 }
64 #endif
65
66
67 static void RENAME(sws_init_swScale)(SwsContext *c)
68 {
69     enum PixelFormat srcFormat = c->srcFormat;
70
71     c->yuv2yuvX     = RENAME(yuv2yuvX    );
72     c->yuv2packedX  = RENAME(yuv2packedX );
73 }