Revision 9326d3f3 libswscale/rgb2rgb_template.c

View differences:

libswscale/rgb2rgb_template.c
1339 1339

  
1340 1340
static inline void RENAME(rgb32tobgr32)(const uint8_t *src, uint8_t *dst, long src_size)
1341 1341
{
1342
#if HAVE_MMX
1343
    x86_reg
1344
#else
1345
    long
1346
#endif
1347
        idx = 15 - src_size;
1342
    x86_reg idx = 15 - src_size;
1348 1343
    const uint8_t *s = src-idx;
1349 1344
    uint8_t *d = dst-idx;
1350 1345
#if HAVE_MMX
......
1481 1476
                                           long lumStride, long chromStride, long dstStride, long vertLumPerChroma)
1482 1477
{
1483 1478
    long y;
1484
    const long chromWidth= width>>1;
1479
    const x86_reg chromWidth= width>>1;
1485 1480
    for (y=0; y<height; y++)
1486 1481
    {
1487 1482
#if HAVE_MMX
1488
        x86_reg cw = chromWidth;
1489 1483
//FIXME handle 2 lines at once (fewer prefetches, reuse some chroma, but very likely memory-limited anyway)
1490 1484
        __asm__ volatile(
1491 1485
        "xor                 %%"REG_a", %%"REG_a"   \n\t"
......
1517 1511
        "add                        $8, %%"REG_a"   \n\t"
1518 1512
        "cmp                        %4, %%"REG_a"   \n\t"
1519 1513
        " jb                        1b              \n\t"
1520
        ::"r"(dst), "r"(ysrc), "r"(usrc), "r"(vsrc), "g" (cw)
1514
        ::"r"(dst), "r"(ysrc), "r"(usrc), "r"(vsrc), "g" (chromWidth)
1521 1515
        : "%"REG_a
1522 1516
        );
1523 1517
#else
......
1634 1628
                                           long lumStride, long chromStride, long dstStride, long vertLumPerChroma)
1635 1629
{
1636 1630
    long y;
1637
    const long chromWidth= width>>1;
1631
    const x86_reg chromWidth= width>>1;
1638 1632
    for (y=0; y<height; y++)
1639 1633
    {
1640 1634
#if HAVE_MMX
1641
        x86_reg cw = chromWidth;
1642 1635
//FIXME handle 2 lines at once (fewer prefetches, reuse some chroma, but very likely memory-limited anyway)
1643 1636
        __asm__ volatile(
1644 1637
        "xor                %%"REG_a", %%"REG_a"    \n\t"
......
1670 1663
        "add                       $8, %%"REG_a"    \n\t"
1671 1664
        "cmp                       %4, %%"REG_a"    \n\t"
1672 1665
        " jb                       1b               \n\t"
1673
        ::"r"(dst), "r"(ysrc), "r"(usrc), "r"(vsrc), "g" (cw)
1666
        ::"r"(dst), "r"(ysrc), "r"(usrc), "r"(vsrc), "g" (chromWidth)
1674 1667
        : "%"REG_a
1675 1668
        );
1676 1669
#else
......
1765 1758
                                      long lumStride, long chromStride, long srcStride)
1766 1759
{
1767 1760
    long y;
1768
    const long chromWidth= width>>1;
1761
    const x86_reg chromWidth= width>>1;
1769 1762
    for (y=0; y<height; y+=2)
1770 1763
    {
1771 1764
#if HAVE_MMX
1772
        x86_reg cw = chromWidth;
1773 1765
        __asm__ volatile(
1774 1766
        "xor                 %%"REG_a", %%"REG_a"   \n\t"
1775 1767
        "pcmpeqw                 %%mm7, %%mm7       \n\t"
......
1818 1810
        "add                        $8, %%"REG_a"   \n\t"
1819 1811
        "cmp                        %4, %%"REG_a"   \n\t"
1820 1812
        " jb                        1b              \n\t"
1821
        ::"r"(src), "r"(ydst), "r"(udst), "r"(vdst), "g" (cw)
1813
        ::"r"(src), "r"(ydst), "r"(udst), "r"(vdst), "g" (chromWidth)
1822 1814
        : "memory", "%"REG_a
1823 1815
        );
1824 1816

  
......
1848 1840
        "cmp                        %4, %%"REG_a"   \n\t"
1849 1841
        " jb                        1b              \n\t"
1850 1842

  
1851
        ::"r"(src), "r"(ydst), "r"(udst), "r"(vdst), "g" (cw)
1843
        ::"r"(src), "r"(ydst), "r"(udst), "r"(vdst), "g" (chromWidth)
1852 1844
        : "memory", "%"REG_a
1853 1845
        );
1854 1846
#else
......
1952 1944

  
1953 1945
        );
1954 1946
#else
1955
        const long mmxSize=1;
1947
        const x86_reg mmxSize=1;
1956 1948
#endif
1957 1949
        dst[0        ]= (3*src[0] +   src[srcStride])>>2;
1958 1950
        dst[dstStride]= (  src[0] + 3*src[srcStride])>>2;
......
2004 1996
                                      long lumStride, long chromStride, long srcStride)
2005 1997
{
2006 1998
    long y;
2007
    const long chromWidth= width>>1;
1999
    const x86_reg chromWidth= width>>1;
2008 2000
    for (y=0; y<height; y+=2)
2009 2001
    {
2010 2002
#if HAVE_MMX
2011
        x86_reg cw = chromWidth;
2012 2003
        __asm__ volatile(
2013 2004
        "xor                 %%"REG_a", %%"REG_a"   \n\t"
2014 2005
        "pcmpeqw             %%mm7, %%mm7   \n\t"
......
2057 2048
        "add                    $8, %%"REG_a"   \n\t"
2058 2049
        "cmp                    %4, %%"REG_a"   \n\t"
2059 2050
        " jb                    1b          \n\t"
2060
        ::"r"(src), "r"(ydst), "r"(udst), "r"(vdst), "g" (cw)
2051
        ::"r"(src), "r"(ydst), "r"(udst), "r"(vdst), "g" (chromWidth)
2061 2052
        : "memory", "%"REG_a
2062 2053
        );
2063 2054

  
......
2087 2078
        "cmp                    %4, %%"REG_a"   \n\t"
2088 2079
        " jb                    1b          \n\t"
2089 2080

  
2090
        ::"r"(src), "r"(ydst), "r"(udst), "r"(vdst), "g" (cw)
2081
        ::"r"(src), "r"(ydst), "r"(udst), "r"(vdst), "g" (chromWidth)
2091 2082
        : "memory", "%"REG_a
2092 2083
        );
2093 2084
#else
......
2132 2123
                                       long lumStride, long chromStride, long srcStride)
2133 2124
{
2134 2125
    long y;
2135
    const long chromWidth= width>>1;
2126
    const x86_reg chromWidth= width>>1;
2136 2127
#if HAVE_MMX
2137
    x86_reg cw = chromWidth;
2138 2128
    for (y=0; y<height-2; y+=2)
2139 2129
    {
2140 2130
        long i;
......
2358 2348
        "movd                    %%mm0, (%3, %%"REG_a") \n\t"
2359 2349
        "add                        $4, %%"REG_a"       \n\t"
2360 2350
        " js                        1b                  \n\t"
2361
        : : "r" (src+cw*6), "r" (src+srcStride+cw*6), "r" (udst+cw), "r" (vdst+cw), "g" (-cw)
2351
        : : "r" (src+chromWidth*6), "r" (src+srcStride+chromWidth*6), "r" (udst+chromWidth), "r" (vdst+chromWidth), "g" (-chromWidth)
2362 2352
        : "%"REG_a, "%"REG_d
2363 2353
        );
2364 2354

  
......
2511 2501
                                       long srcStride1, long srcStride2,
2512 2502
                                       long dstStride1, long dstStride2)
2513 2503
{
2514
    long x,y,w,h;
2504
    x86_reg y;
2505
    long x,w,h;
2515 2506
    w=width/2; h=height/2;
2516 2507
#if HAVE_MMX
2517 2508
    __asm__ volatile(
......
2614 2605
                                        long srcStride1, long srcStride2,
2615 2606
                                        long srcStride3, long dstStride)
2616 2607
{
2608
    x86_reg x;
2617 2609
    long y,w,h;
2618 2610
    w=width/2; h=height;
2619 2611
    for (y=0;y<h;y++){
......
2621 2613
    const uint8_t* up=src2+srcStride2*(y>>2);
2622 2614
    const uint8_t* vp=src3+srcStride3*(y>>2);
2623 2615
    uint8_t* d=dst+dstStride*y;
2616
    x=0;
2624 2617
#if HAVE_MMX
2625
    x86_reg x = 0;
2626 2618
    for (;x<w-7;x+=8)
2627 2619
    {
2628 2620
        __asm__ volatile(
......
2676 2668
        : "r"(yp), "r" (up), "r"(vp), "r"(d)
2677 2669
        :"memory");
2678 2670
    }
2679
#else
2680
    long x = 0;
2681 2671
#endif
2682 2672
    for (; x<w; x++)
2683 2673
    {

Also available in: Unified diff