Revision 40fa5140

View differences:

libswscale/swscale.c
1776 1776
    }
1777 1777
}
1778 1778

  
1779
static SwsFunc getSwsFunc(int flags)
1779
static SwsFunc getSwsFunc(SwsContext *c)
1780 1780
{
1781
    int flags = c->flags;
1781 1782

  
1782 1783
#if defined(RUNTIME_CPUDETECT) && CONFIG_GPL
1783 1784
#if ARCH_X86
1784 1785
    // ordered per speed fastest first
1785 1786
    if (flags & SWS_CPU_CAPS_MMX2) {
1787
        sws_init_swScale_MMX2(c);
1786 1788
        return swScale_MMX2;
1787 1789
    } else if (flags & SWS_CPU_CAPS_3DNOW) {
1790
        sws_init_swScale_3DNow(c);
1788 1791
        return swScale_3DNow;
1789 1792
    } else if (flags & SWS_CPU_CAPS_MMX) {
1793
        sws_init_swScale_MMX(c);
1790 1794
        return swScale_MMX;
1791 1795
    } else {
1796
        sws_init_swScale_C(c);
1792 1797
        return swScale_C;
1793 1798
    }
1794 1799

  
1795 1800
#else
1796 1801
#if ARCH_PPC
1797 1802
    if (flags & SWS_CPU_CAPS_ALTIVEC) {
1803
        sws_init_swScale_altivec(c);
1798 1804
        return swScale_altivec;
1799 1805
    } else {
1806
        sws_init_swScale_C(c);
1800 1807
        return swScale_C;
1801 1808
    }
1802 1809
#endif
1810
    sws_init_swScale_C(c);
1803 1811
    return swScale_C;
1804 1812
#endif /* ARCH_X86 */
1805 1813
#else //RUNTIME_CPUDETECT
1806 1814
#if   HAVE_MMX2
1815
    sws_init_swScale_MMX2(c);
1807 1816
    return swScale_MMX2;
1808 1817
#elif HAVE_AMD3DNOW
1818
    sws_init_swScale_3DNow(c);
1809 1819
    return swScale_3DNow;
1810 1820
#elif HAVE_MMX
1821
    sws_init_swScale_MMX(c);
1811 1822
    return swScale_MMX;
1812 1823
#elif HAVE_ALTIVEC
1824
    sws_init_swScale_altivec(c);
1813 1825
    return swScale_altivec;
1814 1826
#else
1827
    sws_init_swScale_C(c);
1815 1828
    return swScale_C;
1816 1829
#endif
1817 1830
#endif //!RUNTIME_CPUDETECT
......
2932 2945
               c->chrSrcW, c->chrSrcH, c->chrDstW, c->chrDstH, c->chrXInc, c->chrYInc);
2933 2946
    }
2934 2947

  
2935
    c->swScale= getSwsFunc(flags);
2948
    c->swScale= getSwsFunc(c);
2936 2949
    return c;
2937 2950
}
2938 2951

  
libswscale/swscale_internal.h
214 214
    uint64_t sparc_coeffs[10] __attribute__((aligned(8)));
215 215
#endif
216 216

  
217
    /* function pointers for swScale() */
218
    void (*yuv2nv12X  )(struct SwsContext *c,
219
                        const int16_t *lumFilter, const int16_t **lumSrc, int lumFilterSize,
220
                        const int16_t *chrFilter, const int16_t **chrSrc, int chrFilterSize,
221
                        uint8_t *dest, uint8_t *uDest,
222
                        int dstW, int chrDstW, int dstFormat);
223
    void (*yuv2yuv1   )(struct SwsContext *c,
224
                        const int16_t *lumSrc, const int16_t *chrSrc, const int16_t *alpSrc,
225
                        uint8_t *dest,
226
                        uint8_t *uDest, uint8_t *vDest, uint8_t *aDest,
227
                        long dstW, long chrDstW);
228
    void (*yuv2yuvX   )(struct SwsContext *c,
229
                        const int16_t *lumFilter, const int16_t **lumSrc, int lumFilterSize,
230
                        const int16_t *chrFilter, const int16_t **chrSrc, int chrFilterSize,
231
                        const int16_t **alpSrc,
232
                        uint8_t *dest,
233
                        uint8_t *uDest, uint8_t *vDest, uint8_t *aDest,
234
                        long dstW, long chrDstW);
235
    void (*yuv2packed1)(struct SwsContext *c,
236
                        const uint16_t *buf0,
237
                        const uint16_t *uvbuf0, const uint16_t *uvbuf1,
238
                        const uint16_t *abuf0,
239
                        uint8_t *dest,
240
                        int dstW, int uvalpha, int dstFormat, int flags, int y);
241
    void (*yuv2packed2)(struct SwsContext *c,
242
                        const uint16_t *buf0, const uint16_t *buf1,
243
                        const uint16_t *uvbuf0, const uint16_t *uvbuf1,
244
                        const uint16_t *abuf0, const uint16_t *abuf1,
245
                        uint8_t *dest,
246
                        int dstW, int yalpha, int uvalpha, int y);
247
    void (*yuv2packedX)(struct SwsContext *c,
248
                        const int16_t *lumFilter, const int16_t **lumSrc, int lumFilterSize,
249
                        const int16_t *chrFilter, const int16_t **chrSrc, int chrFilterSize,
250
                        const int16_t **alpSrc, uint8_t *dest,
251
                        long dstW, long dstY);
252

  
253
    void (*hyscale_internal)(uint8_t *dst, const uint8_t *src,
254
                             long width, uint32_t *pal);
255
    void (*hcscale_internal)(uint8_t *dstU, uint8_t *dstV,
256
                             const uint8_t *src1, const uint8_t *src2,
257
                             long width, uint32_t *pal);
258
    void (*hyscale_fast)(struct SwsContext *c,
259
                         int16_t *dst, int dstWidth,
260
                         const uint8_t *src, int srcW, int xInc);
261
    void (*hcscale_fast)(struct SwsContext *c,
262
                         int16_t *dst, int dstWidth,
263
                         const uint8_t *src1, const uint8_t *src2, int srcW, int xInc);
264

  
265
    void (*hScale)(int16_t *dst, int dstW, const uint8_t *src, int srcW,
266
                   int xInc, const int16_t *filter, const int16_t *filterPos, long filterSize);
267

  
217 268
} SwsContext;
218 269
//FIXME check init (where 0)
219 270

  
libswscale/swscale_template.c
1375 1375

  
1376 1376
    if (flags&SWS_FULL_CHR_H_INT)
1377 1377
    {
1378
        RENAME(yuv2packed2)(c, buf0, buf0, uvbuf0, uvbuf1, abuf0, abuf0, dest, dstW, 0, uvalpha, y);
1378
        c->yuv2packed2(c, buf0, buf0, uvbuf0, uvbuf1, abuf0, abuf0, dest, dstW, 0, uvalpha, y);
1379 1379
        return;
1380 1380
    }
1381 1381

  
......
2273 2273
    int canMMX2BeUsed = c->canMMX2BeUsed;
2274 2274
    void *funnyYCode = c->funnyYCode;
2275 2275

  
2276
    if (srcFormat==PIX_FMT_YUYV422 || srcFormat==PIX_FMT_GRAY16BE)
2277
    {
2278
        RENAME(yuy2ToY)(formatConvBuffer, src, srcW, pal);
2279
        src= formatConvBuffer;
2280
    }
2281
    else if (srcFormat==PIX_FMT_UYVY422 || srcFormat==PIX_FMT_GRAY16LE)
2282
    {
2283
        RENAME(uyvyToY)(formatConvBuffer, src, srcW, pal);
2284
        src= formatConvBuffer;
2285
    }
2286
    else if (srcFormat==PIX_FMT_RGB32)
2287
    {
2288
        if (isAlpha)
2289
            RENAME(abgrToA)(formatConvBuffer, src+3, srcW, pal);
2290
        else
2291
            RENAME(bgr32ToY)(formatConvBuffer, src, srcW, pal);
2292
        src= formatConvBuffer;
2293
    }
2294
    else if (srcFormat==PIX_FMT_RGB32_1)
2295
    {
2296
        if (isAlpha)
2297
            RENAME(abgrToA)(formatConvBuffer, src, srcW, pal);
2298
        else
2299
            RENAME(bgr32ToY)(formatConvBuffer, src+ALT32_CORR, srcW, pal);
2300
        src= formatConvBuffer;
2301
    }
2302
    else if (srcFormat==PIX_FMT_BGR24)
2303
    {
2304
        RENAME(bgr24ToY)(formatConvBuffer, src, srcW, pal);
2305
        src= formatConvBuffer;
2306
    }
2307
    else if (srcFormat==PIX_FMT_BGR565)
2308
    {
2309
        RENAME(bgr16ToY)(formatConvBuffer, src, srcW, pal);
2310
        src= formatConvBuffer;
2311
    }
2312
    else if (srcFormat==PIX_FMT_BGR555)
2313
    {
2314
        RENAME(bgr15ToY)(formatConvBuffer, src, srcW, pal);
2315
        src= formatConvBuffer;
2316
    }
2317
    else if (srcFormat==PIX_FMT_BGR32)
2318
    {
2319
        if (isAlpha)
2320
            RENAME(abgrToA)(formatConvBuffer, src+3, srcW, pal);
2321
        else
2322
            RENAME(rgb32ToY)(formatConvBuffer, src, srcW, pal);
2323
        src= formatConvBuffer;
2324
    }
2325
    else if (srcFormat==PIX_FMT_BGR32_1)
2326
    {
2327
        if (isAlpha)
2328
            RENAME(abgrToA)(formatConvBuffer, src, srcW, pal);
2329
        else
2330
            RENAME(rgb32ToY)(formatConvBuffer, src+ALT32_CORR, srcW, pal);
2331
        src= formatConvBuffer;
2276
    if (isAlpha) {
2277
        if (srcFormat == PIX_FMT_RGB32   || srcFormat == PIX_FMT_BGR32  )
2278
            src += 3;
2279
    } else {
2280
        if (srcFormat == PIX_FMT_RGB32_1 || srcFormat == PIX_FMT_BGR32_1)
2281
            src += ALT32_CORR;
2332 2282
    }
2333
    else if (srcFormat==PIX_FMT_RGB24)
2334
    {
2335
        RENAME(rgb24ToY)(formatConvBuffer, src, srcW, pal);
2336
        src= formatConvBuffer;
2337
    }
2338
    else if (srcFormat==PIX_FMT_RGB565)
2339
    {
2340
        RENAME(rgb16ToY)(formatConvBuffer, src, srcW, pal);
2341
        src= formatConvBuffer;
2342
    }
2343
    else if (srcFormat==PIX_FMT_RGB555)
2344
    {
2345
        RENAME(rgb15ToY)(formatConvBuffer, src, srcW, pal);
2346
        src= formatConvBuffer;
2347
    }
2348
    else if (srcFormat==PIX_FMT_RGB8 || srcFormat==PIX_FMT_BGR8 || srcFormat==PIX_FMT_PAL8 || srcFormat==PIX_FMT_BGR4_BYTE  || srcFormat==PIX_FMT_RGB4_BYTE)
2349
    {
2350
        RENAME(palToY)(formatConvBuffer, src, srcW, pal);
2351
        src= formatConvBuffer;
2352
    }
2353
    else if (srcFormat==PIX_FMT_MONOBLACK)
2354
    {
2355
        RENAME(monoblack2Y)(formatConvBuffer, src, srcW, pal);
2356
        src= formatConvBuffer;
2357
    }
2358
    else if (srcFormat==PIX_FMT_MONOWHITE)
2359
    {
2360
        RENAME(monowhite2Y)(formatConvBuffer, src, srcW, pal);
2283

  
2284
    if (c->hyscale_internal) {
2285
        c->hyscale_internal(formatConvBuffer, src, srcW, pal);
2361 2286
        src= formatConvBuffer;
2362 2287
    }
2363 2288

  
......
2368 2293
    if (!(flags&SWS_FAST_BILINEAR))
2369 2294
#endif
2370 2295
    {
2371
        RENAME(hScale)(dst, dstWidth, src, srcW, xInc, hLumFilter, hLumFilterPos, hLumFilterSize);
2296
        c->hScale(dst, dstWidth, src, srcW, xInc, hLumFilter, hLumFilterPos, hLumFilterSize);
2372 2297
    }
2373 2298
    else // fast bilinear upscale / crap downscale
2374 2299
    {
......
2488 2413
        } //if MMX2 can't be used
2489 2414
#endif
2490 2415
#else
2491
        RENAME(hyscale_fast)(c, dst, dstWidth, src, srcW, xInc);
2416
        c->hyscale_fast(c, dst, dstWidth, src, srcW, xInc);
2492 2417
#endif /* ARCH_X86 */
2493 2418
    }
2494 2419

  
......
2537 2462
    int canMMX2BeUsed = c->canMMX2BeUsed;
2538 2463
    void *funnyUVCode = c->funnyUVCode;
2539 2464

  
2540
    if (srcFormat==PIX_FMT_YUYV422)
2541
    {
2542
        RENAME(yuy2ToUV)(formatConvBuffer, formatConvBuffer+VOFW, src1, src2, srcW, pal);
2543
        src1= formatConvBuffer;
2544
        src2= formatConvBuffer+VOFW;
2545
    }
2546
    else if (srcFormat==PIX_FMT_UYVY422)
2547
    {
2548
        RENAME(uyvyToUV)(formatConvBuffer, formatConvBuffer+VOFW, src1, src2, srcW, pal);
2549
        src1= formatConvBuffer;
2550
        src2= formatConvBuffer+VOFW;
2551
    }
2552
    else if (srcFormat==PIX_FMT_RGB32)
2553
    {
2554
        if(c->chrSrcHSubSample)
2555
            RENAME(bgr32ToUV_half)(formatConvBuffer, formatConvBuffer+VOFW, src1, src2, srcW, pal);
2556
        else
2557
            RENAME(bgr32ToUV)(formatConvBuffer, formatConvBuffer+VOFW, src1, src2, srcW, pal);
2558
        src1= formatConvBuffer;
2559
        src2= formatConvBuffer+VOFW;
2560
    }
2561
    else if (srcFormat==PIX_FMT_RGB32_1)
2562
    {
2563
        if(c->chrSrcHSubSample)
2564
            RENAME(bgr32ToUV_half)(formatConvBuffer, formatConvBuffer+VOFW, src1+ALT32_CORR, src2+ALT32_CORR, srcW, pal);
2565
        else
2566
            RENAME(bgr32ToUV)(formatConvBuffer, formatConvBuffer+VOFW, src1+ALT32_CORR, src2+ALT32_CORR, srcW, pal);
2567
        src1= formatConvBuffer;
2568
        src2= formatConvBuffer+VOFW;
2569
    }
2570
    else if (srcFormat==PIX_FMT_BGR24)
2571
    {
2572
        if(c->chrSrcHSubSample)
2573
            RENAME(bgr24ToUV_half)(formatConvBuffer, formatConvBuffer+VOFW, src1, src2, srcW, pal);
2574
        else
2575
            RENAME(bgr24ToUV)(formatConvBuffer, formatConvBuffer+VOFW, src1, src2, srcW, pal);
2576
        src1= formatConvBuffer;
2577
        src2= formatConvBuffer+VOFW;
2578
    }
2579
    else if (srcFormat==PIX_FMT_BGR565)
2580
    {
2581
        if(c->chrSrcHSubSample)
2582
            RENAME(bgr16ToUV_half)(formatConvBuffer, formatConvBuffer+VOFW, src1, src2, srcW, pal);
2583
        else
2584
            RENAME(bgr16ToUV)(formatConvBuffer, formatConvBuffer+VOFW, src1, src2, srcW, pal);
2585
        src1= formatConvBuffer;
2586
        src2= formatConvBuffer+VOFW;
2587
    }
2588
    else if (srcFormat==PIX_FMT_BGR555)
2589
    {
2590
        if(c->chrSrcHSubSample)
2591
            RENAME(bgr15ToUV_half)(formatConvBuffer, formatConvBuffer+VOFW, src1, src2, srcW, pal);
2592
        else
2593
            RENAME(bgr15ToUV)(formatConvBuffer, formatConvBuffer+VOFW, src1, src2, srcW, pal);
2594
        src1= formatConvBuffer;
2595
        src2= formatConvBuffer+VOFW;
2596
    }
2597
    else if (srcFormat==PIX_FMT_BGR32)
2598
    {
2599
        if(c->chrSrcHSubSample)
2600
            RENAME(rgb32ToUV_half)(formatConvBuffer, formatConvBuffer+VOFW, src1, src2, srcW, pal);
2601
        else
2602
            RENAME(rgb32ToUV)(formatConvBuffer, formatConvBuffer+VOFW, src1, src2, srcW, pal);
2603
        src1= formatConvBuffer;
2604
        src2= formatConvBuffer+VOFW;
2605
    }
2606
    else if (srcFormat==PIX_FMT_BGR32_1)
2607
    {
2608
        if(c->chrSrcHSubSample)
2609
            RENAME(rgb32ToUV_half)(formatConvBuffer, formatConvBuffer+VOFW, src1+ALT32_CORR, src2+ALT32_CORR, srcW, pal);
2610
        else
2611
            RENAME(rgb32ToUV)(formatConvBuffer, formatConvBuffer+VOFW, src1+ALT32_CORR, src2+ALT32_CORR, srcW, pal);
2612
        src1= formatConvBuffer;
2613
        src2= formatConvBuffer+VOFW;
2614
    }
2615
    else if (srcFormat==PIX_FMT_RGB24)
2616
    {
2617
        if(c->chrSrcHSubSample)
2618
            RENAME(rgb24ToUV_half)(formatConvBuffer, formatConvBuffer+VOFW, src1, src2, srcW, pal);
2619
        else
2620
            RENAME(rgb24ToUV)(formatConvBuffer, formatConvBuffer+VOFW, src1, src2, srcW, pal);
2621
        src1= formatConvBuffer;
2622
        src2= formatConvBuffer+VOFW;
2623
    }
2624
    else if (srcFormat==PIX_FMT_RGB565)
2625
    {
2626
        if(c->chrSrcHSubSample)
2627
            RENAME(rgb16ToUV_half)(formatConvBuffer, formatConvBuffer+VOFW, src1, src2, srcW, pal);
2628
        else
2629
            RENAME(rgb16ToUV)(formatConvBuffer, formatConvBuffer+VOFW, src1, src2, srcW, pal);
2630
        src1= formatConvBuffer;
2631
        src2= formatConvBuffer+VOFW;
2632
    }
2633
    else if (srcFormat==PIX_FMT_RGB555)
2634
    {
2635
        if(c->chrSrcHSubSample)
2636
            RENAME(rgb15ToUV_half)(formatConvBuffer, formatConvBuffer+VOFW, src1, src2, srcW, pal);
2637
        else
2638
            RENAME(rgb15ToUV)(formatConvBuffer, formatConvBuffer+VOFW, src1, src2, srcW, pal);
2639
        src1= formatConvBuffer;
2640
        src2= formatConvBuffer+VOFW;
2641
    }
2642
    else if (isGray(srcFormat) || srcFormat==PIX_FMT_MONOBLACK || srcFormat==PIX_FMT_MONOWHITE)
2643
    {
2465
    if (isGray(srcFormat) || srcFormat==PIX_FMT_MONOBLACK || srcFormat==PIX_FMT_MONOWHITE)
2644 2466
        return;
2467

  
2468
    if (srcFormat==PIX_FMT_RGB32_1) {
2469
        src1 += ALT32_CORR;
2470
        src2 += ALT32_CORR;
2645 2471
    }
2646
    else if (srcFormat==PIX_FMT_RGB8 || srcFormat==PIX_FMT_BGR8 || srcFormat==PIX_FMT_PAL8 || srcFormat==PIX_FMT_BGR4_BYTE  || srcFormat==PIX_FMT_RGB4_BYTE)
2647
    {
2648
        RENAME(palToUV)(formatConvBuffer, formatConvBuffer+VOFW, src1, src2, srcW, pal);
2472

  
2473
    if (c->hcscale_internal) {
2474
        c->hcscale_internal(formatConvBuffer, formatConvBuffer+VOFW, src1, src2, srcW, pal);
2649 2475
        src1= formatConvBuffer;
2650 2476
        src2= formatConvBuffer+VOFW;
2651 2477
    }
......
2657 2483
    if (!(flags&SWS_FAST_BILINEAR))
2658 2484
#endif
2659 2485
    {
2660
        RENAME(hScale)(dst     , dstWidth, src1, srcW, xInc, hChrFilter, hChrFilterPos, hChrFilterSize);
2661
        RENAME(hScale)(dst+VOFW, dstWidth, src2, srcW, xInc, hChrFilter, hChrFilterPos, hChrFilterSize);
2486
        c->hScale(dst     , dstWidth, src1, srcW, xInc, hChrFilter, hChrFilterPos, hChrFilterSize);
2487
        c->hScale(dst+VOFW, dstWidth, src2, srcW, xInc, hChrFilter, hChrFilterPos, hChrFilterSize);
2662 2488
    }
2663 2489
    else // fast bilinear upscale / crap downscale
2664 2490
    {
......
2794 2620
        } //if MMX2 can't be used
2795 2621
#endif
2796 2622
#else
2797
        RENAME(hcscale_fast)(c, dst, dstWidth, src1, src2, srcW, xInc);
2623
        c->hcscale_fast(c, dst, dstWidth, src1, src2, srcW, xInc);
2798 2624
#endif /* ARCH_X86 */
2799 2625
    }
2800 2626
    if(c->srcRange != c->dstRange && !(isRGB(c->dstFormat) || isBGR(c->dstFormat))){
......
3096 2922
            if (dstFormat == PIX_FMT_NV12 || dstFormat == PIX_FMT_NV21){
3097 2923
                const int chrSkipMask= (1<<c->chrDstVSubSample)-1;
3098 2924
                if (dstY&chrSkipMask) uDest= NULL; //FIXME split functions in lumi / chromi
3099
                RENAME(yuv2nv12X)(c,
2925
                c->yuv2nv12X(c,
3100 2926
                    vLumFilter+dstY*vLumFilterSize   , lumSrcPtr, vLumFilterSize,
3101 2927
                    vChrFilter+chrDstY*vChrFilterSize, chrSrcPtr, vChrFilterSize,
3102 2928
                    dest, uDest, dstW, chrDstW, dstFormat);
......
3110 2936
                    int16_t *lumBuf = lumPixBuf[0];
3111 2937
                    int16_t *chrBuf= chrPixBuf[0];
3112 2938
                    int16_t *alpBuf= (CONFIG_SWSCALE_ALPHA && alpPixBuf) ? alpPixBuf[0] : NULL;
3113
                    RENAME(yuv2yuv1)(c, lumBuf, chrBuf, alpBuf, dest, uDest, vDest, aDest, dstW, chrDstW);
2939
                    c->yuv2yuv1(c, lumBuf, chrBuf, alpBuf, dest, uDest, vDest, aDest, dstW, chrDstW);
3114 2940
                }
3115 2941
                else //General YV12
3116 2942
                {
3117
                    RENAME(yuv2yuvX)(c,
2943
                    c->yuv2yuvX(c,
3118 2944
                        vLumFilter+dstY*vLumFilterSize   , lumSrcPtr, vLumFilterSize,
3119 2945
                        vChrFilter+chrDstY*vChrFilterSize, chrSrcPtr, vChrFilterSize,
3120 2946
                        alpSrcPtr, dest, uDest, vDest, aDest, dstW, chrDstW);
......
3133 2959
                            vChrFilter+dstY*vChrFilterSize, chrSrcPtr, vChrFilterSize,
3134 2960
                            alpSrcPtr, dest, dstW, dstY);
3135 2961
                    }else{
3136
                        RENAME(yuv2packed1)(c, *lumSrcPtr, *chrSrcPtr, *(chrSrcPtr+1),
2962
                        c->yuv2packed1(c, *lumSrcPtr, *chrSrcPtr, *(chrSrcPtr+1),
3137 2963
                            alpPixBuf ? *alpSrcPtr : NULL,
3138 2964
                            dest, dstW, chrAlpha, dstFormat, flags, dstY);
3139 2965
                    }
......
3152 2978
                            vChrFilter+dstY*vChrFilterSize, chrSrcPtr, vChrFilterSize,
3153 2979
                            alpSrcPtr, dest, dstW, dstY);
3154 2980
                    }else{
3155
                        RENAME(yuv2packed2)(c, *lumSrcPtr, *(lumSrcPtr+1), *chrSrcPtr, *(chrSrcPtr+1),
2981
                        c->yuv2packed2(c, *lumSrcPtr, *(lumSrcPtr+1), *chrSrcPtr, *(chrSrcPtr+1),
3156 2982
                            alpPixBuf ? *alpSrcPtr : NULL, alpPixBuf ? *(alpSrcPtr+1) : NULL,
3157 2983
                            dest, dstW, lumAlpha, chrAlpha, dstY);
3158 2984
                    }
......
3165 2991
                            vChrFilter+dstY*vChrFilterSize, chrSrcPtr, vChrFilterSize,
3166 2992
                            alpSrcPtr, dest, dstW, dstY);
3167 2993
                    }else{
3168
                        RENAME(yuv2packedX)(c,
2994
                        c->yuv2packedX(c,
3169 2995
                            vLumFilter+dstY*vLumFilterSize, lumSrcPtr, vLumFilterSize,
3170 2996
                            vChrFilter+dstY*vChrFilterSize, chrSrcPtr, vChrFilterSize,
3171 2997
                            alpSrcPtr, dest, dstW, dstY);
......
3232 3058

  
3233 3059
    return dstY - lastDstY;
3234 3060
}
3061

  
3062
static void RENAME(sws_init_swScale)(SwsContext *c)
3063
{
3064
    enum PixelFormat srcFormat = c->srcFormat;
3065

  
3066
    c->yuv2nv12X    = RENAME(yuv2nv12X   );
3067
    c->yuv2yuv1     = RENAME(yuv2yuv1    );
3068
    c->yuv2yuvX     = RENAME(yuv2yuvX    );
3069
    c->yuv2packed1  = RENAME(yuv2packed1 );
3070
    c->yuv2packed2  = RENAME(yuv2packed2 );
3071
    c->yuv2packedX  = RENAME(yuv2packedX );
3072

  
3073
    c->hScale       = RENAME(hScale      );
3074

  
3075
    c->hyscale_fast = RENAME(hyscale_fast);
3076
    c->hcscale_fast = RENAME(hcscale_fast);
3077

  
3078
    c->hcscale_internal = NULL;
3079
    switch(srcFormat) {
3080
        case PIX_FMT_YUYV422  : c->hcscale_internal = RENAME(yuy2ToUV); break;
3081
        case PIX_FMT_UYVY422  : c->hcscale_internal = RENAME(uyvyToUV); break;
3082
        case PIX_FMT_RGB8     :
3083
        case PIX_FMT_BGR8     :
3084
        case PIX_FMT_PAL8     :
3085
        case PIX_FMT_BGR4_BYTE:
3086
        case PIX_FMT_RGB4_BYTE: c->hcscale_internal = RENAME(palToUV); break;
3087
    }
3088
    if (c->chrSrcHSubSample) {
3089
        switch(srcFormat) {
3090
        case PIX_FMT_RGB32  :
3091
        case PIX_FMT_RGB32_1: c->hcscale_internal = RENAME(bgr32ToUV_half); break;
3092
        case PIX_FMT_BGR24  : c->hcscale_internal = RENAME(bgr24ToUV_half); break;
3093
        case PIX_FMT_BGR565 : c->hcscale_internal = RENAME(bgr16ToUV_half); break;
3094
        case PIX_FMT_BGR555 : c->hcscale_internal = RENAME(bgr15ToUV_half); break;
3095
        case PIX_FMT_BGR32  :
3096
        case PIX_FMT_BGR32_1: c->hcscale_internal = RENAME(rgb32ToUV_half); break;
3097
        case PIX_FMT_RGB24  : c->hcscale_internal = RENAME(rgb24ToUV_half); break;
3098
        case PIX_FMT_RGB565 : c->hcscale_internal = RENAME(rgb16ToUV_half); break;
3099
        case PIX_FMT_RGB555 : c->hcscale_internal = RENAME(rgb15ToUV_half); break;
3100
        }
3101
    } else {
3102
        switch(srcFormat) {
3103
        case PIX_FMT_RGB32  :
3104
        case PIX_FMT_RGB32_1: c->hcscale_internal = RENAME(bgr32ToUV); break;
3105
        case PIX_FMT_BGR24  : c->hcscale_internal = RENAME(bgr24ToUV); break;
3106
        case PIX_FMT_BGR565 : c->hcscale_internal = RENAME(bgr16ToUV); break;
3107
        case PIX_FMT_BGR555 : c->hcscale_internal = RENAME(bgr15ToUV); break;
3108
        case PIX_FMT_BGR32  :
3109
        case PIX_FMT_BGR32_1: c->hcscale_internal = RENAME(rgb32ToUV); break;
3110
        case PIX_FMT_RGB24  : c->hcscale_internal = RENAME(rgb24ToUV); break;
3111
        case PIX_FMT_RGB565 : c->hcscale_internal = RENAME(rgb16ToUV); break;
3112
        case PIX_FMT_RGB555 : c->hcscale_internal = RENAME(rgb15ToUV); break;
3113
        }
3114
    }
3115

  
3116
    c->hyscale_internal = NULL;
3117
    switch (srcFormat) {
3118
    case PIX_FMT_YUYV422  :
3119
    case PIX_FMT_GRAY16BE : c->hyscale_internal = RENAME(yuy2ToY); break;
3120
    case PIX_FMT_UYVY422  :
3121
    case PIX_FMT_GRAY16LE : c->hyscale_internal = RENAME(uyvyToY); break;
3122
    case PIX_FMT_BGR24    : c->hyscale_internal = RENAME(bgr24ToY); break;
3123
    case PIX_FMT_BGR565   : c->hyscale_internal = RENAME(bgr16ToY); break;
3124
    case PIX_FMT_BGR555   : c->hyscale_internal = RENAME(bgr15ToY); break;
3125
    case PIX_FMT_RGB24    : c->hyscale_internal = RENAME(rgb24ToY); break;
3126
    case PIX_FMT_RGB565   : c->hyscale_internal = RENAME(rgb16ToY); break;
3127
    case PIX_FMT_RGB555   : c->hyscale_internal = RENAME(rgb15ToY); break;
3128
    case PIX_FMT_RGB8     :
3129
    case PIX_FMT_BGR8     :
3130
    case PIX_FMT_PAL8     :
3131
    case PIX_FMT_BGR4_BYTE:
3132
    case PIX_FMT_RGB4_BYTE: c->hyscale_internal = RENAME(palToY); break;
3133
    case PIX_FMT_MONOBLACK: c->hyscale_internal = RENAME(monoblack2Y); break;
3134
    case PIX_FMT_MONOWHITE: c->hyscale_internal = RENAME(monowhite2Y); break;
3135
    }
3136
    if (c->alpPixBuf) {
3137
        switch (srcFormat) {
3138
        case PIX_FMT_RGB32  :
3139
        case PIX_FMT_RGB32_1:
3140
        case PIX_FMT_BGR32  :
3141
        case PIX_FMT_BGR32_1: c->hyscale_internal = RENAME(abgrToA); break;
3142
        }
3143
    } else {
3144
        switch (srcFormat) {
3145
        case PIX_FMT_RGB32  :
3146
        case PIX_FMT_RGB32_1: c->hyscale_internal = RENAME(bgr32ToY); break;
3147
        case PIX_FMT_BGR32  :
3148
        case PIX_FMT_BGR32_1: c->hyscale_internal = RENAME(rgb32ToY); break;
3149
        }
3150
    }
3151
}

Also available in: Unified diff