• Main Page
  • Related Pages
  • Modules
  • Data Structures
  • Files
  • Examples
  • File List
  • Globals

libswscale/x86/swscale_mmx.c

Go to the documentation of this file.
00001 /*
00002  * Copyright (C) 2001-2003 Michael Niedermayer <michaelni@gmx.at>
00003  *
00004  * This file is part of Libav.
00005  *
00006  * Libav is free software; you can redistribute it and/or
00007  * modify it under the terms of the GNU Lesser General Public
00008  * License as published by the Free Software Foundation; either
00009  * version 2.1 of the License, or (at your option) any later version.
00010  *
00011  * Libav is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014  * Lesser General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU Lesser General Public
00017  * License along with Libav; if not, write to the Free Software
00018  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
00019  */
00020 
00021 #include <inttypes.h>
00022 #include "config.h"
00023 #include "libswscale/swscale.h"
00024 #include "libswscale/swscale_internal.h"
00025 #include "libavutil/intreadwrite.h"
00026 #include "libavutil/x86_cpu.h"
00027 #include "libavutil/cpu.h"
00028 #include "libavutil/pixdesc.h"
00029 
00030 DECLARE_ASM_CONST(8, uint64_t, bF8)=       0xF8F8F8F8F8F8F8F8LL;
00031 DECLARE_ASM_CONST(8, uint64_t, bFC)=       0xFCFCFCFCFCFCFCFCLL;
00032 DECLARE_ASM_CONST(8, uint64_t, w10)=       0x0010001000100010LL;
00033 DECLARE_ASM_CONST(8, uint64_t, w02)=       0x0002000200020002LL;
00034 DECLARE_ASM_CONST(8, uint64_t, bm00001111)=0x00000000FFFFFFFFLL;
00035 DECLARE_ASM_CONST(8, uint64_t, bm00000111)=0x0000000000FFFFFFLL;
00036 DECLARE_ASM_CONST(8, uint64_t, bm11111000)=0xFFFFFFFFFF000000LL;
00037 DECLARE_ASM_CONST(8, uint64_t, bm01010101)=0x00FF00FF00FF00FFLL;
00038 
00039 const DECLARE_ALIGNED(8, uint64_t, ff_dither4)[2] = {
00040     0x0103010301030103LL,
00041     0x0200020002000200LL,};
00042 
00043 const DECLARE_ALIGNED(8, uint64_t, ff_dither8)[2] = {
00044     0x0602060206020602LL,
00045     0x0004000400040004LL,};
00046 
00047 DECLARE_ASM_CONST(8, uint64_t, b16Mask)=   0x001F001F001F001FLL;
00048 DECLARE_ASM_CONST(8, uint64_t, g16Mask)=   0x07E007E007E007E0LL;
00049 DECLARE_ASM_CONST(8, uint64_t, r16Mask)=   0xF800F800F800F800LL;
00050 DECLARE_ASM_CONST(8, uint64_t, b15Mask)=   0x001F001F001F001FLL;
00051 DECLARE_ASM_CONST(8, uint64_t, g15Mask)=   0x03E003E003E003E0LL;
00052 DECLARE_ASM_CONST(8, uint64_t, r15Mask)=   0x7C007C007C007C00LL;
00053 
00054 DECLARE_ALIGNED(8, const uint64_t, ff_M24A)         = 0x00FF0000FF0000FFLL;
00055 DECLARE_ALIGNED(8, const uint64_t, ff_M24B)         = 0xFF0000FF0000FF00LL;
00056 DECLARE_ALIGNED(8, const uint64_t, ff_M24C)         = 0x0000FF0000FF0000LL;
00057 
00058 #ifdef FAST_BGR2YV12
00059 DECLARE_ALIGNED(8, const uint64_t, ff_bgr2YCoeff)   = 0x000000210041000DULL;
00060 DECLARE_ALIGNED(8, const uint64_t, ff_bgr2UCoeff)   = 0x0000FFEEFFDC0038ULL;
00061 DECLARE_ALIGNED(8, const uint64_t, ff_bgr2VCoeff)   = 0x00000038FFD2FFF8ULL;
00062 #else
00063 DECLARE_ALIGNED(8, const uint64_t, ff_bgr2YCoeff)   = 0x000020E540830C8BULL;
00064 DECLARE_ALIGNED(8, const uint64_t, ff_bgr2UCoeff)   = 0x0000ED0FDAC23831ULL;
00065 DECLARE_ALIGNED(8, const uint64_t, ff_bgr2VCoeff)   = 0x00003831D0E6F6EAULL;
00066 #endif /* FAST_BGR2YV12 */
00067 DECLARE_ALIGNED(8, const uint64_t, ff_bgr2YOffset)  = 0x1010101010101010ULL;
00068 DECLARE_ALIGNED(8, const uint64_t, ff_bgr2UVOffset) = 0x8080808080808080ULL;
00069 DECLARE_ALIGNED(8, const uint64_t, ff_w1111)        = 0x0001000100010001ULL;
00070 
00071 DECLARE_ASM_CONST(8, uint64_t, ff_bgr24toY1Coeff) = 0x0C88000040870C88ULL;
00072 DECLARE_ASM_CONST(8, uint64_t, ff_bgr24toY2Coeff) = 0x20DE4087000020DEULL;
00073 DECLARE_ASM_CONST(8, uint64_t, ff_rgb24toY1Coeff) = 0x20DE0000408720DEULL;
00074 DECLARE_ASM_CONST(8, uint64_t, ff_rgb24toY2Coeff) = 0x0C88408700000C88ULL;
00075 DECLARE_ASM_CONST(8, uint64_t, ff_bgr24toYOffset) = 0x0008400000084000ULL;
00076 
00077 DECLARE_ASM_CONST(8, uint64_t, ff_bgr24toUV)[2][4] = {
00078     {0x38380000DAC83838ULL, 0xECFFDAC80000ECFFULL, 0xF6E40000D0E3F6E4ULL, 0x3838D0E300003838ULL},
00079     {0xECFF0000DAC8ECFFULL, 0x3838DAC800003838ULL, 0x38380000D0E33838ULL, 0xF6E4D0E30000F6E4ULL},
00080 };
00081 
00082 DECLARE_ASM_CONST(8, uint64_t, ff_bgr24toUVOffset)= 0x0040400000404000ULL;
00083 
00084 //MMX versions
00085 #if HAVE_MMX
00086 #undef RENAME
00087 #define COMPILE_TEMPLATE_MMX2 0
00088 #define RENAME(a) a ## _MMX
00089 #include "swscale_template.c"
00090 #endif
00091 
00092 //MMX2 versions
00093 #if HAVE_MMX2
00094 #undef RENAME
00095 #undef COMPILE_TEMPLATE_MMX2
00096 #define COMPILE_TEMPLATE_MMX2 1
00097 #define RENAME(a) a ## _MMX2
00098 #include "swscale_template.c"
00099 #endif
00100 
00101 void updateMMXDitherTables(SwsContext *c, int dstY, int lumBufIndex, int chrBufIndex,
00102                            int lastInLumBuf, int lastInChrBuf)
00103 {
00104     const int dstH= c->dstH;
00105     const int flags= c->flags;
00106     int16_t **lumPixBuf= c->lumPixBuf;
00107     int16_t **chrUPixBuf= c->chrUPixBuf;
00108     int16_t **alpPixBuf= c->alpPixBuf;
00109     const int vLumBufSize= c->vLumBufSize;
00110     const int vChrBufSize= c->vChrBufSize;
00111     int32_t *vLumFilterPos= c->vLumFilterPos;
00112     int32_t *vChrFilterPos= c->vChrFilterPos;
00113     int16_t *vLumFilter= c->vLumFilter;
00114     int16_t *vChrFilter= c->vChrFilter;
00115     int32_t *lumMmxFilter= c->lumMmxFilter;
00116     int32_t *chrMmxFilter= c->chrMmxFilter;
00117     int32_t av_unused *alpMmxFilter= c->alpMmxFilter;
00118     const int vLumFilterSize= c->vLumFilterSize;
00119     const int vChrFilterSize= c->vChrFilterSize;
00120     const int chrDstY= dstY>>c->chrDstVSubSample;
00121     const int firstLumSrcY= vLumFilterPos[dstY]; //First line needed as input
00122     const int firstChrSrcY= vChrFilterPos[chrDstY]; //First line needed as input
00123 
00124     c->blueDither= ff_dither8[dstY&1];
00125     if (c->dstFormat == PIX_FMT_RGB555 || c->dstFormat == PIX_FMT_BGR555)
00126         c->greenDither= ff_dither8[dstY&1];
00127     else
00128         c->greenDither= ff_dither4[dstY&1];
00129     c->redDither= ff_dither8[(dstY+1)&1];
00130     if (dstY < dstH - 2) {
00131         const int16_t **lumSrcPtr= (const int16_t **) lumPixBuf + lumBufIndex + firstLumSrcY - lastInLumBuf + vLumBufSize;
00132         const int16_t **chrUSrcPtr= (const int16_t **) chrUPixBuf + chrBufIndex + firstChrSrcY - lastInChrBuf + vChrBufSize;
00133         const int16_t **alpSrcPtr= (CONFIG_SWSCALE_ALPHA && alpPixBuf) ? (const int16_t **) alpPixBuf + lumBufIndex + firstLumSrcY - lastInLumBuf + vLumBufSize : NULL;
00134         int i;
00135 
00136         if (firstLumSrcY < 0 || firstLumSrcY + vLumFilterSize > c->srcH) {
00137             const int16_t **tmpY = (const int16_t **) lumPixBuf + 2 * vLumBufSize;
00138             int neg = -firstLumSrcY, i, end = FFMIN(c->srcH - firstLumSrcY, vLumFilterSize);
00139             for (i = 0; i < neg;            i++)
00140                 tmpY[i] = lumSrcPtr[neg];
00141             for (     ; i < end;            i++)
00142                 tmpY[i] = lumSrcPtr[i];
00143             for (     ; i < vLumFilterSize; i++)
00144                 tmpY[i] = tmpY[i-1];
00145             lumSrcPtr = tmpY;
00146 
00147             if (alpSrcPtr) {
00148                 const int16_t **tmpA = (const int16_t **) alpPixBuf + 2 * vLumBufSize;
00149                 for (i = 0; i < neg;            i++)
00150                     tmpA[i] = alpSrcPtr[neg];
00151                 for (     ; i < end;            i++)
00152                     tmpA[i] = alpSrcPtr[i];
00153                 for (     ; i < vLumFilterSize; i++)
00154                     tmpA[i] = tmpA[i - 1];
00155                 alpSrcPtr = tmpA;
00156             }
00157         }
00158         if (firstChrSrcY < 0 || firstChrSrcY + vChrFilterSize > c->chrSrcH) {
00159             const int16_t **tmpU = (const int16_t **) chrUPixBuf + 2 * vChrBufSize;
00160             int neg = -firstChrSrcY, i, end = FFMIN(c->chrSrcH - firstChrSrcY, vChrFilterSize);
00161             for (i = 0; i < neg;            i++) {
00162                 tmpU[i] = chrUSrcPtr[neg];
00163             }
00164             for (     ; i < end;            i++) {
00165                 tmpU[i] = chrUSrcPtr[i];
00166             }
00167             for (     ; i < vChrFilterSize; i++) {
00168                 tmpU[i] = tmpU[i - 1];
00169             }
00170             chrUSrcPtr = tmpU;
00171         }
00172 
00173         if (flags & SWS_ACCURATE_RND) {
00174             int s= APCK_SIZE / 8;
00175             for (i=0; i<vLumFilterSize; i+=2) {
00176                 *(const void**)&lumMmxFilter[s*i              ]= lumSrcPtr[i  ];
00177                 *(const void**)&lumMmxFilter[s*i+APCK_PTR2/4  ]= lumSrcPtr[i+(vLumFilterSize>1)];
00178                 lumMmxFilter[s*i+APCK_COEF/4  ]=
00179                 lumMmxFilter[s*i+APCK_COEF/4+1]= vLumFilter[dstY*vLumFilterSize + i    ]
00180                 + (vLumFilterSize>1 ? vLumFilter[dstY*vLumFilterSize + i + 1]<<16 : 0);
00181                 if (CONFIG_SWSCALE_ALPHA && alpPixBuf) {
00182                     *(const void**)&alpMmxFilter[s*i              ]= alpSrcPtr[i  ];
00183                     *(const void**)&alpMmxFilter[s*i+APCK_PTR2/4  ]= alpSrcPtr[i+(vLumFilterSize>1)];
00184                     alpMmxFilter[s*i+APCK_COEF/4  ]=
00185                     alpMmxFilter[s*i+APCK_COEF/4+1]= lumMmxFilter[s*i+APCK_COEF/4  ];
00186                 }
00187             }
00188             for (i=0; i<vChrFilterSize; i+=2) {
00189                 *(const void**)&chrMmxFilter[s*i              ]= chrUSrcPtr[i  ];
00190                 *(const void**)&chrMmxFilter[s*i+APCK_PTR2/4  ]= chrUSrcPtr[i+(vChrFilterSize>1)];
00191                 chrMmxFilter[s*i+APCK_COEF/4  ]=
00192                 chrMmxFilter[s*i+APCK_COEF/4+1]= vChrFilter[chrDstY*vChrFilterSize + i    ]
00193                 + (vChrFilterSize>1 ? vChrFilter[chrDstY*vChrFilterSize + i + 1]<<16 : 0);
00194             }
00195         } else {
00196             for (i=0; i<vLumFilterSize; i++) {
00197                 *(const void**)&lumMmxFilter[4*i+0]= lumSrcPtr[i];
00198                 lumMmxFilter[4*i+2]=
00199                 lumMmxFilter[4*i+3]=
00200                 ((uint16_t)vLumFilter[dstY*vLumFilterSize + i])*0x10001;
00201                 if (CONFIG_SWSCALE_ALPHA && alpPixBuf) {
00202                     *(const void**)&alpMmxFilter[4*i+0]= alpSrcPtr[i];
00203                     alpMmxFilter[4*i+2]=
00204                     alpMmxFilter[4*i+3]= lumMmxFilter[4*i+2];
00205                 }
00206             }
00207             for (i=0; i<vChrFilterSize; i++) {
00208                 *(const void**)&chrMmxFilter[4*i+0]= chrUSrcPtr[i];
00209                 chrMmxFilter[4*i+2]=
00210                 chrMmxFilter[4*i+3]=
00211                 ((uint16_t)vChrFilter[chrDstY*vChrFilterSize + i])*0x10001;
00212             }
00213         }
00214     }
00215 }
00216 
00217 #define SCALE_FUNC(filter_n, from_bpc, to_bpc, opt) \
00218 extern void ff_hscale ## from_bpc ## to ## to_bpc ## _ ## filter_n ## _ ## opt( \
00219                                                 SwsContext *c, int16_t *data, \
00220                                                 int dstW, const uint8_t *src, \
00221                                                 const int16_t *filter, \
00222                                                 const int32_t *filterPos, int filterSize)
00223 
00224 #define SCALE_FUNCS(filter_n, opt) \
00225     SCALE_FUNC(filter_n,  8, 15, opt); \
00226     SCALE_FUNC(filter_n,  9, 15, opt); \
00227     SCALE_FUNC(filter_n, 10, 15, opt); \
00228     SCALE_FUNC(filter_n, 16, 15, opt); \
00229     SCALE_FUNC(filter_n,  8, 19, opt); \
00230     SCALE_FUNC(filter_n,  9, 19, opt); \
00231     SCALE_FUNC(filter_n, 10, 19, opt); \
00232     SCALE_FUNC(filter_n, 16, 19, opt)
00233 
00234 #define SCALE_FUNCS_MMX(opt) \
00235     SCALE_FUNCS(4, opt); \
00236     SCALE_FUNCS(8, opt); \
00237     SCALE_FUNCS(X, opt)
00238 
00239 #define SCALE_FUNCS_SSE(opt) \
00240     SCALE_FUNCS(4, opt); \
00241     SCALE_FUNCS(8, opt); \
00242     SCALE_FUNCS(X4, opt); \
00243     SCALE_FUNCS(X8, opt)
00244 
00245 #if ARCH_X86_32
00246 SCALE_FUNCS_MMX(mmx);
00247 #endif
00248 SCALE_FUNCS_SSE(sse2);
00249 SCALE_FUNCS_SSE(ssse3);
00250 SCALE_FUNCS_SSE(sse4);
00251 
00252 #define VSCALEX_FUNC(size, opt) \
00253 extern void ff_yuv2planeX_ ## size ## _ ## opt(const int16_t *filter, int filterSize, \
00254                                                const int16_t **src, uint8_t *dest, int dstW, \
00255                                                const uint8_t *dither, int offset)
00256 #define VSCALEX_FUNCS(opt) \
00257     VSCALEX_FUNC(8,  opt); \
00258     VSCALEX_FUNC(9,  opt); \
00259     VSCALEX_FUNC(10, opt)
00260 
00261 #if ARCH_X86_32
00262 VSCALEX_FUNCS(mmx2);
00263 #endif
00264 VSCALEX_FUNCS(sse2);
00265 VSCALEX_FUNCS(sse4);
00266 VSCALEX_FUNC(16, sse4);
00267 VSCALEX_FUNCS(avx);
00268 
00269 #define VSCALE_FUNC(size, opt) \
00270 extern void ff_yuv2plane1_ ## size ## _ ## opt(const int16_t *src, uint8_t *dst, int dstW, \
00271                                                const uint8_t *dither, int offset)
00272 #define VSCALE_FUNCS(opt1, opt2) \
00273     VSCALE_FUNC(8,  opt1); \
00274     VSCALE_FUNC(9,  opt2); \
00275     VSCALE_FUNC(10, opt2); \
00276     VSCALE_FUNC(16, opt1)
00277 
00278 #if ARCH_X86_32
00279 VSCALE_FUNCS(mmx, mmx2);
00280 #endif
00281 VSCALE_FUNCS(sse2, sse2);
00282 VSCALE_FUNC(16, sse4);
00283 VSCALE_FUNCS(avx, avx);
00284 
00285 #define INPUT_UV_FUNC(fmt, opt) \
00286 extern void ff_ ## fmt ## ToUV_ ## opt(uint8_t *dstU, uint8_t *dstV, \
00287                                        const uint8_t *src, const uint8_t *unused1, \
00288                                        int w, uint32_t *unused2)
00289 #define INPUT_FUNC(fmt, opt) \
00290 extern void ff_ ## fmt ## ToY_  ## opt(uint8_t *dst, const uint8_t *src, \
00291                                        int w, uint32_t *unused); \
00292     INPUT_UV_FUNC(fmt, opt)
00293 #define INPUT_FUNCS(opt) \
00294     INPUT_FUNC(uyvy, opt); \
00295     INPUT_FUNC(yuyv, opt); \
00296     INPUT_UV_FUNC(nv12, opt); \
00297     INPUT_UV_FUNC(nv21, opt)
00298 
00299 #if ARCH_X86_32
00300 INPUT_FUNCS(mmx);
00301 #endif
00302 INPUT_FUNCS(sse2);
00303 INPUT_FUNCS(avx);
00304 
00305 void ff_sws_init_swScale_mmx(SwsContext *c)
00306 {
00307     int cpu_flags = av_get_cpu_flags();
00308 
00309     if (cpu_flags & AV_CPU_FLAG_MMX)
00310         sws_init_swScale_MMX(c);
00311 #if HAVE_MMX2
00312     if (cpu_flags & AV_CPU_FLAG_MMX2)
00313         sws_init_swScale_MMX2(c);
00314 #endif
00315 
00316 #if HAVE_YASM
00317 #define ASSIGN_SCALE_FUNC2(hscalefn, filtersize, opt1, opt2) do { \
00318     if (c->srcBpc == 8) { \
00319         hscalefn = c->dstBpc <= 10 ? ff_hscale8to15_ ## filtersize ## _ ## opt2 : \
00320                                      ff_hscale8to19_ ## filtersize ## _ ## opt1; \
00321     } else if (c->srcBpc == 9) { \
00322         hscalefn = c->dstBpc <= 10 ? ff_hscale9to15_ ## filtersize ## _ ## opt2 : \
00323                                      ff_hscale9to19_ ## filtersize ## _ ## opt1; \
00324     } else if (c->srcBpc == 10) { \
00325         hscalefn = c->dstBpc <= 10 ? ff_hscale10to15_ ## filtersize ## _ ## opt2 : \
00326                                      ff_hscale10to19_ ## filtersize ## _ ## opt1; \
00327     } else /* c->srcBpc == 16 */ { \
00328         hscalefn = c->dstBpc <= 10 ? ff_hscale16to15_ ## filtersize ## _ ## opt2 : \
00329                                      ff_hscale16to19_ ## filtersize ## _ ## opt1; \
00330     } \
00331 } while (0)
00332 #define ASSIGN_MMX_SCALE_FUNC(hscalefn, filtersize, opt1, opt2) \
00333     switch (filtersize) { \
00334     case 4:  ASSIGN_SCALE_FUNC2(hscalefn, 4, opt1, opt2); break; \
00335     case 8:  ASSIGN_SCALE_FUNC2(hscalefn, 8, opt1, opt2); break; \
00336     default: ASSIGN_SCALE_FUNC2(hscalefn, X, opt1, opt2); break; \
00337     }
00338 #define ASSIGN_VSCALEX_FUNC(vscalefn, opt, do_16_case) \
00339 switch(c->dstBpc){ \
00340     case 16:                          do_16_case;                          break; \
00341     case 10: if (!isBE(c->dstFormat)) vscalefn = ff_yuv2planeX_10_ ## opt; break; \
00342     case 9:  if (!isBE(c->dstFormat)) vscalefn = ff_yuv2planeX_9_  ## opt; break; \
00343     default:                          vscalefn = ff_yuv2planeX_8_  ## opt; break; \
00344     }
00345 #define ASSIGN_VSCALE_FUNC(vscalefn, opt1, opt2, opt2chk) \
00346     switch(c->dstBpc){ \
00347     case 16: if (!isBE(c->dstFormat))            vscalefn = ff_yuv2plane1_16_ ## opt1; break; \
00348     case 10: if (!isBE(c->dstFormat) && opt2chk) vscalefn = ff_yuv2plane1_10_ ## opt2; break; \
00349     case 9:  if (!isBE(c->dstFormat) && opt2chk) vscalefn = ff_yuv2plane1_9_  ## opt2;  break; \
00350     default:                                     vscalefn = ff_yuv2plane1_8_  ## opt1;  break; \
00351     }
00352 #if ARCH_X86_32
00353     if (cpu_flags & AV_CPU_FLAG_MMX) {
00354         ASSIGN_MMX_SCALE_FUNC(c->hyScale, c->hLumFilterSize, mmx, mmx);
00355         ASSIGN_MMX_SCALE_FUNC(c->hcScale, c->hChrFilterSize, mmx, mmx);
00356         ASSIGN_VSCALE_FUNC(c->yuv2plane1, mmx, mmx2, cpu_flags & AV_CPU_FLAG_MMX2);
00357 
00358         switch (c->srcFormat) {
00359         case PIX_FMT_Y400A:
00360             c->lumToYV12 = ff_yuyvToY_mmx;
00361             if (c->alpPixBuf)
00362                 c->alpToYV12 = ff_uyvyToY_mmx;
00363             break;
00364         case PIX_FMT_YUYV422:
00365             c->lumToYV12 = ff_yuyvToY_mmx;
00366             c->chrToYV12 = ff_yuyvToUV_mmx;
00367             break;
00368         case PIX_FMT_UYVY422:
00369             c->lumToYV12 = ff_uyvyToY_mmx;
00370             c->chrToYV12 = ff_uyvyToUV_mmx;
00371             break;
00372         case PIX_FMT_NV12:
00373             c->chrToYV12 = ff_nv12ToUV_mmx;
00374             break;
00375         case PIX_FMT_NV21:
00376             c->chrToYV12 = ff_nv21ToUV_mmx;
00377             break;
00378         default:
00379             break;
00380         }
00381     }
00382     if (cpu_flags & AV_CPU_FLAG_MMX2) {
00383         ASSIGN_VSCALEX_FUNC(c->yuv2planeX, mmx2,);
00384     }
00385 #endif
00386 #define ASSIGN_SSE_SCALE_FUNC(hscalefn, filtersize, opt1, opt2) \
00387     switch (filtersize) { \
00388     case 4:  ASSIGN_SCALE_FUNC2(hscalefn, 4, opt1, opt2); break; \
00389     case 8:  ASSIGN_SCALE_FUNC2(hscalefn, 8, opt1, opt2); break; \
00390     default: if (filtersize & 4) ASSIGN_SCALE_FUNC2(hscalefn, X4, opt1, opt2); \
00391              else                ASSIGN_SCALE_FUNC2(hscalefn, X8, opt1, opt2); \
00392              break; \
00393     }
00394     if (cpu_flags & AV_CPU_FLAG_SSE2) {
00395         ASSIGN_SSE_SCALE_FUNC(c->hyScale, c->hLumFilterSize, sse2, sse2);
00396         ASSIGN_SSE_SCALE_FUNC(c->hcScale, c->hChrFilterSize, sse2, sse2);
00397         ASSIGN_VSCALEX_FUNC(c->yuv2planeX, sse2,);
00398         ASSIGN_VSCALE_FUNC(c->yuv2plane1, sse2, sse2, 1);
00399 
00400         switch (c->srcFormat) {
00401         case PIX_FMT_Y400A:
00402             c->lumToYV12 = ff_yuyvToY_sse2;
00403             if (c->alpPixBuf)
00404                 c->alpToYV12 = ff_uyvyToY_sse2;
00405             break;
00406         case PIX_FMT_YUYV422:
00407             c->lumToYV12 = ff_yuyvToY_sse2;
00408             c->chrToYV12 = ff_yuyvToUV_sse2;
00409             break;
00410         case PIX_FMT_UYVY422:
00411             c->lumToYV12 = ff_uyvyToY_sse2;
00412             c->chrToYV12 = ff_uyvyToUV_sse2;
00413             break;
00414         case PIX_FMT_NV12:
00415             c->chrToYV12 = ff_nv12ToUV_sse2;
00416             break;
00417         case PIX_FMT_NV21:
00418             c->chrToYV12 = ff_nv21ToUV_sse2;
00419             break;
00420         }
00421     }
00422     if (cpu_flags & AV_CPU_FLAG_SSSE3) {
00423         ASSIGN_SSE_SCALE_FUNC(c->hyScale, c->hLumFilterSize, ssse3, ssse3);
00424         ASSIGN_SSE_SCALE_FUNC(c->hcScale, c->hChrFilterSize, ssse3, ssse3);
00425     }
00426     if (cpu_flags & AV_CPU_FLAG_SSE4) {
00427         /* Xto15 don't need special sse4 functions */
00428         ASSIGN_SSE_SCALE_FUNC(c->hyScale, c->hLumFilterSize, sse4, ssse3);
00429         ASSIGN_SSE_SCALE_FUNC(c->hcScale, c->hChrFilterSize, sse4, ssse3);
00430         ASSIGN_VSCALEX_FUNC(c->yuv2planeX, sse4,
00431                             if (!isBE(c->dstFormat)) c->yuv2planeX = ff_yuv2planeX_16_sse4);
00432         if (c->dstBpc == 16 && !isBE(c->dstFormat))
00433             c->yuv2plane1 = ff_yuv2plane1_16_sse4;
00434     }
00435 
00436     if (cpu_flags & AV_CPU_FLAG_AVX) {
00437         ASSIGN_VSCALEX_FUNC(c->yuv2planeX, avx,);
00438         ASSIGN_VSCALE_FUNC(c->yuv2plane1, avx, avx, 1);
00439 
00440         switch (c->srcFormat) {
00441         case PIX_FMT_YUYV422:
00442             c->chrToYV12 = ff_yuyvToUV_avx;
00443             break;
00444         case PIX_FMT_UYVY422:
00445             c->chrToYV12 = ff_uyvyToUV_avx;
00446             break;
00447         case PIX_FMT_NV12:
00448             c->chrToYV12 = ff_nv12ToUV_avx;
00449             break;
00450         case PIX_FMT_NV21:
00451             c->chrToYV12 = ff_nv21ToUV_avx;
00452             break;
00453         default:
00454             break;
00455         }
00456     }
00457 #endif
00458 }
Generated on Thu Jul 11 2013 15:38:25 for Libav by doxygen 1.7.1