~ubuntu-branches/ubuntu/jaunty/xvidcap/jaunty-proposed

« back to all changes in this revision

Viewing changes to ffmpeg/libswscale/swscale_template.c

  • Committer: Bazaar Package Importer
  • Author(s): Lionel Le Folgoc, Andrew Starr-Bochicchio, Lionel Le Folgoc
  • Date: 2008-12-26 00:10:06 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20081226001006-2040ls9680bd1blt
Tags: 1.1.7-0.2ubuntu1
[ Andrew Starr-Bochicchio ]
* Merge from debian-multimedia (LP: #298547), Ubuntu Changes:
 - For ffmpeg-related build-deps, fix versionized dependencies
   as the ubuntu versioning is different than debian-multimedia's.

[ Lionel Le Folgoc ]
* LP: #311412 is fixed since the 1.1.7~rc1-0.1 revision.
* debian/patches/03_ffmpeg.diff: updated to fix FTBFS due to libswscale API
  change (cherry-pick from Gentoo #234383).

Show diffs side-by-side

added added

removed removed

Lines of Context:
15
15
 *
16
16
 * You should have received a copy of the GNU General Public License
17
17
 * along with FFmpeg; if not, write to the Free Software
18
 
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
 
18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19
19
 *
20
20
 * the C code (not assembly, mmx, ...) of this file can be used
21
21
 * under the LGPL license too
39
39
#ifdef HAVE_3DNOW
40
40
#define PREFETCH  "prefetch"
41
41
#define PREFETCHW "prefetchw"
42
 
#elif defined ( HAVE_MMX2 )
 
42
#elif defined (HAVE_MMX2)
43
43
#define PREFETCH "prefetchnta"
44
44
#define PREFETCHW "prefetcht0"
45
45
#else
80
80
    ASMALIGN(4) /* FIXME Unroll? */\
81
81
    "1:                                                 \n\t"\
82
82
    "movq                      8(%%"REG_d"), %%mm0      \n\t" /* filterCoeff */\
83
 
    "movq   " #x "(%%"REG_S", %%"REG_a", 2), %%mm2      \n\t" /* srcData */\
84
 
    "movq 8+" #x "(%%"REG_S", %%"REG_a", 2), %%mm5      \n\t" /* srcData */\
 
83
    "movq   "  x "(%%"REG_S", %%"REG_a", 2), %%mm2      \n\t" /* srcData */\
 
84
    "movq 8+"  x "(%%"REG_S", %%"REG_a", 2), %%mm5      \n\t" /* srcData */\
85
85
    "add                                $16, %%"REG_d"  \n\t"\
86
86
    "mov                        (%%"REG_d"), %%"REG_S"  \n\t"\
87
87
    "test                         %%"REG_S", %%"REG_S"  \n\t"\
117
117
    "mov                        (%%"REG_d"), %%"REG_S"  \n\t"\
118
118
    ASMALIGN(4) \
119
119
    "1:                                                 \n\t"\
120
 
    "movq   " #x "(%%"REG_S", %%"REG_a", 2), %%mm0      \n\t" /* srcData */\
121
 
    "movq 8+" #x "(%%"REG_S", %%"REG_a", 2), %%mm2      \n\t" /* srcData */\
 
120
    "movq   "  x "(%%"REG_S", %%"REG_a", 2), %%mm0      \n\t" /* srcData */\
 
121
    "movq 8+"  x "(%%"REG_S", %%"REG_a", 2), %%mm2      \n\t" /* srcData */\
122
122
    "mov                       4(%%"REG_d"), %%"REG_S"  \n\t"\
123
 
    "movq   " #x "(%%"REG_S", %%"REG_a", 2), %%mm1      \n\t" /* srcData */\
 
123
    "movq   "  x "(%%"REG_S", %%"REG_a", 2), %%mm1      \n\t" /* srcData */\
124
124
    "movq                             %%mm0, %%mm3      \n\t"\
125
125
    "punpcklwd                        %%mm1, %%mm0      \n\t"\
126
126
    "punpckhwd                        %%mm1, %%mm3      \n\t"\
129
129
    "pmaddwd                          %%mm1, %%mm3      \n\t"\
130
130
    "paddd                            %%mm0, %%mm4      \n\t"\
131
131
    "paddd                            %%mm3, %%mm5      \n\t"\
132
 
    "movq 8+" #x "(%%"REG_S", %%"REG_a", 2), %%mm3      \n\t" /* srcData */\
 
132
    "movq 8+"  x "(%%"REG_S", %%"REG_a", 2), %%mm3      \n\t" /* srcData */\
133
133
    "mov                      16(%%"REG_d"), %%"REG_S"  \n\t"\
134
134
    "add                                $16, %%"REG_d"  \n\t"\
135
135
    "test                         %%"REG_S", %%"REG_S"  \n\t"\
202
202
    "2:                                             \n\t"\
203
203
    "movq               8(%%"REG_d"), %%mm0         \n\t" /* filterCoeff */\
204
204
    "movq     (%%"REG_S", %%"REG_a"), %%mm2         \n\t" /* UsrcData */\
205
 
    "movq 4096(%%"REG_S", %%"REG_a"), %%mm5         \n\t" /* VsrcData */\
 
205
    "movq "AV_STRINGIFY(VOF)"(%%"REG_S", %%"REG_a"), %%mm5         \n\t" /* VsrcData */\
206
206
    "add                         $16, %%"REG_d"     \n\t"\
207
207
    "mov                 (%%"REG_d"), %%"REG_S"     \n\t"\
208
208
    "pmulhw                    %%mm0, %%mm2         \n\t"\
252
252
    ASMALIGN(4)\
253
253
    "2:                                             \n\t"\
254
254
    "movq     (%%"REG_S", %%"REG_a"), %%mm0         \n\t" /* UsrcData */\
255
 
    "movq 4096(%%"REG_S", %%"REG_a"), %%mm2         \n\t" /* VsrcData */\
 
255
    "movq "AV_STRINGIFY(VOF)"(%%"REG_S", %%"REG_a"), %%mm2         \n\t" /* VsrcData */\
256
256
    "mov                4(%%"REG_d"), %%"REG_S"     \n\t"\
257
257
    "movq     (%%"REG_S", %%"REG_a"), %%mm1         \n\t" /* UsrcData */\
258
258
    "movq                      %%mm0, %%mm3         \n\t"\
263
263
    "pmaddwd                   %%mm1, %%mm3         \n\t"\
264
264
    "paddd                     %%mm0, %%mm4         \n\t"\
265
265
    "paddd                     %%mm3, %%mm5         \n\t"\
266
 
    "movq 4096(%%"REG_S", %%"REG_a"), %%mm3         \n\t" /* VsrcData */\
 
266
    "movq "AV_STRINGIFY(VOF)"(%%"REG_S", %%"REG_a"), %%mm3         \n\t" /* VsrcData */\
267
267
    "mov               16(%%"REG_d"), %%"REG_S"     \n\t"\
268
268
    "add                         $16, %%"REG_d"     \n\t"\
269
269
    "test                  %%"REG_S", %%"REG_S"     \n\t"\
388
388
    "pmulhw               %%mm6, %%mm0  \n\t" /* (buf0[eax] - buf1[eax])yalpha1>>16*/\
389
389
    "pmulhw               %%mm5, %%mm2  \n\t" /* (uvbuf0[eax] - uvbuf1[eax])uvalpha1>>16*/\
390
390
    "psraw                   $4, %%mm1  \n\t" /* buf0[eax] - buf1[eax] >>4*/\
391
 
    "movq 4096(%2, %%"REG_a",2), %%mm4  \n\t" /* uvbuf0[eax+2048]*/\
 
391
    "movq "AV_STRINGIFY(VOF)"(%2, %%"REG_a",2), %%mm4  \n\t" /* uvbuf0[eax+2048]*/\
392
392
    "psraw                   $4, %%mm3  \n\t" /* uvbuf0[eax] - uvbuf1[eax] >>4*/\
393
393
    "paddw                %%mm0, %%mm1  \n\t" /* buf0[eax]yalpha1 + buf1[eax](1-yalpha1) >>16*/\
394
 
    "movq 4096(%3, %%"REG_a",2), %%mm0  \n\t" /* uvbuf1[eax+2048]*/\
 
394
    "movq "AV_STRINGIFY(VOF)"(%3, %%"REG_a",2), %%mm0  \n\t" /* uvbuf1[eax+2048]*/\
395
395
    "paddw                %%mm2, %%mm3  \n\t" /* uvbuf0[eax]uvalpha1 - uvbuf1[eax](1-uvalpha1)*/\
396
396
    "psubw                %%mm0, %%mm4  \n\t" /* uvbuf0[eax+2048] - uvbuf1[eax+2048]*/\
397
397
    "psubw        "MANGLE(w80)", %%mm1  \n\t" /* 8(Y-16)*/\
434
434
    "1:                                 \n\t"\
435
435
    "movq     (%2, "#index"), %%mm2     \n\t" /* uvbuf0[eax]*/\
436
436
    "movq     (%3, "#index"), %%mm3     \n\t" /* uvbuf1[eax]*/\
437
 
    "movq 4096(%2, "#index"), %%mm5     \n\t" /* uvbuf0[eax+2048]*/\
438
 
    "movq 4096(%3, "#index"), %%mm4     \n\t" /* uvbuf1[eax+2048]*/\
 
437
    "movq "AV_STRINGIFY(VOF)"(%2, "#index"), %%mm5     \n\t" /* uvbuf0[eax+2048]*/\
 
438
    "movq "AV_STRINGIFY(VOF)"(%3, "#index"), %%mm4     \n\t" /* uvbuf1[eax+2048]*/\
439
439
    "psubw             %%mm3, %%mm2     \n\t" /* uvbuf0[eax] - uvbuf1[eax]*/\
440
440
    "psubw             %%mm4, %%mm5     \n\t" /* uvbuf0[eax+2048] - uvbuf1[eax+2048]*/\
441
441
    "movq "CHR_MMX_FILTER_OFFSET"+8("#c"), %%mm0    \n\t"\
466
466
    "1:                                 \n\t"\
467
467
    "movq     (%2, "#index"), %%mm2     \n\t" /* uvbuf0[eax]*/\
468
468
    "movq     (%3, "#index"), %%mm3     \n\t" /* uvbuf1[eax]*/\
469
 
    "movq 4096(%2, "#index"), %%mm5     \n\t" /* uvbuf0[eax+2048]*/\
470
 
    "movq 4096(%3, "#index"), %%mm4     \n\t" /* uvbuf1[eax+2048]*/\
 
469
    "movq "AV_STRINGIFY(VOF)"(%2, "#index"), %%mm5     \n\t" /* uvbuf0[eax+2048]*/\
 
470
    "movq "AV_STRINGIFY(VOF)"(%3, "#index"), %%mm4     \n\t" /* uvbuf1[eax+2048]*/\
471
471
    "psubw             %%mm3, %%mm2     \n\t" /* uvbuf0[eax] - uvbuf1[eax]*/\
472
472
    "psubw             %%mm4, %%mm5     \n\t" /* uvbuf0[eax+2048] - uvbuf1[eax+2048]*/\
473
473
    "movq "CHR_MMX_FILTER_OFFSET"+8("#c"), %%mm0    \n\t"\
531
531
    ASMALIGN(4)\
532
532
    "1:                                 \n\t"\
533
533
    "movq     (%2, "#index"), %%mm3     \n\t" /* uvbuf0[eax]*/\
534
 
    "movq 4096(%2, "#index"), %%mm4     \n\t" /* uvbuf0[eax+2048]*/\
 
534
    "movq "AV_STRINGIFY(VOF)"(%2, "#index"), %%mm4     \n\t" /* uvbuf0[eax+2048]*/\
535
535
    "psraw                $7, %%mm3     \n\t" \
536
536
    "psraw                $7, %%mm4     \n\t" \
537
537
    "movq  (%0, "#index", 2), %%mm1     \n\t" /*buf0[eax]*/\
546
546
    ASMALIGN(4)\
547
547
    "1:                                 \n\t"\
548
548
    "movq     (%2, "#index"), %%mm3     \n\t" /* uvbuf0[eax]*/\
549
 
    "movq 4096(%2, "#index"), %%mm4     \n\t" /* uvbuf0[eax+2048]*/\
 
549
    "movq "AV_STRINGIFY(VOF)"(%2, "#index"), %%mm4     \n\t" /* uvbuf0[eax+2048]*/\
550
550
    "psraw                $4, %%mm3     \n\t" /* uvbuf0[eax] - uvbuf1[eax] >>4*/\
551
551
    "psraw                $4, %%mm4     \n\t" /* uvbuf0[eax+2048] - uvbuf1[eax+2048] >>4*/\
552
552
    "psubw  "U_OFFSET"("#c"), %%mm3     \n\t" /* (U-128)8*/\
596
596
    "1:                                 \n\t"\
597
597
    "movq     (%2, "#index"), %%mm2     \n\t" /* uvbuf0[eax]*/\
598
598
    "movq     (%3, "#index"), %%mm3     \n\t" /* uvbuf1[eax]*/\
599
 
    "movq 4096(%2, "#index"), %%mm5     \n\t" /* uvbuf0[eax+2048]*/\
600
 
    "movq 4096(%3, "#index"), %%mm4     \n\t" /* uvbuf1[eax+2048]*/\
 
599
    "movq "AV_STRINGIFY(VOF)"(%2, "#index"), %%mm5     \n\t" /* uvbuf0[eax+2048]*/\
 
600
    "movq "AV_STRINGIFY(VOF)"(%3, "#index"), %%mm4     \n\t" /* uvbuf1[eax+2048]*/\
601
601
    "paddw             %%mm2, %%mm3     \n\t" /* uvbuf0[eax] + uvbuf1[eax]*/\
602
602
    "paddw             %%mm5, %%mm4     \n\t" /* uvbuf0[eax+2048] + uvbuf1[eax+2048]*/\
603
603
    "psrlw                $8, %%mm3     \n\t" \
615
615
    "1:                                 \n\t"\
616
616
    "movq     (%2, "#index"), %%mm2     \n\t" /* uvbuf0[eax]*/\
617
617
    "movq     (%3, "#index"), %%mm3     \n\t" /* uvbuf1[eax]*/\
618
 
    "movq 4096(%2, "#index"), %%mm5     \n\t" /* uvbuf0[eax+2048]*/\
619
 
    "movq 4096(%3, "#index"), %%mm4     \n\t" /* uvbuf1[eax+2048]*/\
 
618
    "movq "AV_STRINGIFY(VOF)"(%2, "#index"), %%mm5     \n\t" /* uvbuf0[eax+2048]*/\
 
619
    "movq "AV_STRINGIFY(VOF)"(%3, "#index"), %%mm4     \n\t" /* uvbuf1[eax+2048]*/\
620
620
    "paddw             %%mm2, %%mm3     \n\t" /* uvbuf0[eax] + uvbuf1[eax]*/\
621
621
    "paddw             %%mm5, %%mm4     \n\t" /* uvbuf0[eax+2048] + uvbuf1[eax+2048]*/\
622
622
    "psrlw                $5, %%mm3     \n\t" /*FIXME might overflow*/\
855
855
 
856
856
#define WRITEBGR24MMX2(dst, dstw, index) \
857
857
    /* mm2=B, %%mm4=G, %%mm5=R, %%mm7=0 */\
858
 
    "movq "MANGLE(M24A)", %%mm0 \n\t"\
859
 
    "movq "MANGLE(M24C)", %%mm7 \n\t"\
 
858
    "movq "MANGLE(ff_M24A)", %%mm0 \n\t"\
 
859
    "movq "MANGLE(ff_M24C)", %%mm7 \n\t"\
860
860
    "pshufw $0x50, %%mm2, %%mm1 \n\t" /* B3 B2 B3 B2  B1 B0 B1 B0 */\
861
861
    "pshufw $0x50, %%mm4, %%mm3 \n\t" /* G3 G2 G3 G2  G1 G0 G1 G0 */\
862
862
    "pshufw $0x00, %%mm5, %%mm6 \n\t" /* R1 R0 R1 R0  R1 R0 R1 R0 */\
875
875
    "pshufw $0x55, %%mm4, %%mm3 \n\t" /* G4 G3 G4 G3  G4 G3 G4 G3 */\
876
876
    "pshufw $0xA5, %%mm5, %%mm6 \n\t" /* R5 R4 R5 R4  R3 R2 R3 R2 */\
877
877
\
878
 
    "pand "MANGLE(M24B)", %%mm1 \n\t" /* B5       B4        B3    */\
 
878
    "pand "MANGLE(ff_M24B)", %%mm1 \n\t" /* B5       B4        B3    */\
879
879
    "pand   %%mm7, %%mm3        \n\t" /*       G4        G3       */\
880
880
    "pand   %%mm0, %%mm6        \n\t" /*    R4        R3       R2 */\
881
881
\
889
889
\
890
890
    "pand   %%mm7, %%mm1        \n\t" /*       B7        B6       */\
891
891
    "pand   %%mm0, %%mm3        \n\t" /*    G7        G6       G5 */\
892
 
    "pand "MANGLE(M24B)", %%mm6 \n\t" /* R7       R6        R5    */\
 
892
    "pand "MANGLE(ff_M24B)", %%mm6 \n\t" /* R7       R6        R5    */\
893
893
\
894
894
    "por    %%mm1, %%mm3        \n\t"\
895
895
    "por    %%mm3, %%mm6        \n\t"\
934
934
#ifdef HAVE_MMX
935
935
    if (c->flags & SWS_ACCURATE_RND){
936
936
        if (uDest){
937
 
            YSCALEYUV2YV12X_ACCURATE(   0, CHR_MMX_FILTER_OFFSET, uDest, chrDstW)
938
 
            YSCALEYUV2YV12X_ACCURATE(4096, CHR_MMX_FILTER_OFFSET, vDest, chrDstW)
 
937
            YSCALEYUV2YV12X_ACCURATE(   "0", CHR_MMX_FILTER_OFFSET, uDest, chrDstW)
 
938
            YSCALEYUV2YV12X_ACCURATE(AV_STRINGIFY(VOF), CHR_MMX_FILTER_OFFSET, vDest, chrDstW)
939
939
        }
940
940
 
941
 
        YSCALEYUV2YV12X_ACCURATE(0, LUM_MMX_FILTER_OFFSET, dest, dstW)
 
941
        YSCALEYUV2YV12X_ACCURATE("0", LUM_MMX_FILTER_OFFSET, dest, dstW)
942
942
    }else{
943
943
        if (uDest){
944
 
            YSCALEYUV2YV12X(   0, CHR_MMX_FILTER_OFFSET, uDest, chrDstW)
945
 
            YSCALEYUV2YV12X(4096, CHR_MMX_FILTER_OFFSET, vDest, chrDstW)
 
944
            YSCALEYUV2YV12X(   "0", CHR_MMX_FILTER_OFFSET, uDest, chrDstW)
 
945
            YSCALEYUV2YV12X(AV_STRINGIFY(VOF), CHR_MMX_FILTER_OFFSET, vDest, chrDstW)
946
946
        }
947
947
 
948
 
        YSCALEYUV2YV12X(0, LUM_MMX_FILTER_OFFSET, dest, dstW)
 
948
        YSCALEYUV2YV12X("0", LUM_MMX_FILTER_OFFSET, dest, dstW)
949
949
    }
950
950
#else
951
951
#ifdef HAVE_ALTIVEC
957
957
            chrFilter, chrSrc, chrFilterSize,
958
958
            dest, uDest, vDest, dstW, chrDstW);
959
959
#endif //!HAVE_ALTIVEC
960
 
#endif
 
960
#endif /* HAVE_MMX */
961
961
}
962
962
 
963
963
static inline void RENAME(yuv2nv12X)(SwsContext *c, int16_t *lumFilter, int16_t **lumSrc, int lumFilterSize,
973
973
                                    uint8_t *dest, uint8_t *uDest, uint8_t *vDest, long dstW, long chrDstW)
974
974
{
975
975
#ifdef HAVE_MMX
976
 
    if (uDest != NULL)
 
976
    if (uDest)
977
977
    {
978
978
        asm volatile(
979
979
            YSCALEYUV2YV121
984
984
 
985
985
        asm volatile(
986
986
            YSCALEYUV2YV121
987
 
            :: "r" (chrSrc + 2048 + chrDstW), "r" (vDest + chrDstW),
 
987
            :: "r" (chrSrc + VOFW + chrDstW), "r" (vDest + chrDstW),
988
988
            "g" (-chrDstW)
989
989
            : "%"REG_a
990
990
        );
1010
1010
        dest[i]= val;
1011
1011
    }
1012
1012
 
1013
 
    if (uDest != NULL)
 
1013
    if (uDest)
1014
1014
        for (i=0; i<chrDstW; i++)
1015
1015
        {
1016
1016
            int u=chrSrc[i]>>7;
1017
 
            int v=chrSrc[i + 2048]>>7;
 
1017
            int v=chrSrc[i + VOFW]>>7;
1018
1018
 
1019
1019
            if ((u|v)&256){
1020
1020
                if (u<0)        u=0;
1161
1161
            return;
1162
1162
        }
1163
1163
    }
1164
 
#endif
 
1164
#endif /* HAVE_MMX */
1165
1165
#ifdef HAVE_ALTIVEC
1166
1166
    /* The following list of supported dstFormat values should
1167
1167
       match what's found in the body of altivec_yuv2packedX() */
1333
1333
            : "%"REG_a
1334
1334
            );
1335
1335
            break;
1336
 
#endif
 
1336
#endif /* HAVE_MMX */
1337
1337
        case PIX_FMT_BGR32:
1338
1338
#ifndef HAVE_MMX
1339
1339
        case PIX_FMT_RGB32:
1348
1348
                    // vertical linear interpolation && yuv2rgb in a single step:
1349
1349
                    int Y=yuvtab_2568[((buf0[i]*yalpha1+buf1[i]*yalpha)>>19)];
1350
1350
                    int U=((uvbuf0[i]*uvalpha1+uvbuf1[i]*uvalpha)>>19);
1351
 
                    int V=((uvbuf0[i+2048]*uvalpha1+uvbuf1[i+2048]*uvalpha)>>19);
 
1351
                    int V=((uvbuf0[i+VOFW]*uvalpha1+uvbuf1[i+VOFW]*uvalpha)>>19);
1352
1352
                    dest[0]=clip_table[((Y + yuvtab_40cf[U]) >>13)];
1353
1353
                    dest[1]=clip_table[((Y + yuvtab_1a1e[V] + yuvtab_0c92[U]) >>13)];
1354
1354
                    dest[2]=clip_table[((Y + yuvtab_3343[V]) >>13)];
1362
1362
                    // vertical linear interpolation && yuv2rgb in a single step:
1363
1363
                    int Y=yuvtab_2568[((buf0[i]*yalpha1+buf1[i]*yalpha)>>19)];
1364
1364
                    int U=((uvbuf0[i]*uvalpha1+uvbuf1[i]*uvalpha)>>19);
1365
 
                    int V=((uvbuf0[i+2048]*uvalpha1+uvbuf1[i+2048]*uvalpha)>>19);
 
1365
                    int V=((uvbuf0[i+VOFW]*uvalpha1+uvbuf1[i+VOFW]*uvalpha)>>19);
1366
1366
                    dest[0]=clip_table[((Y + yuvtab_40cf[U]) >>13)];
1367
1367
                    dest[1]=clip_table[((Y + yuvtab_1a1e[V] + yuvtab_0c92[U]) >>13)];
1368
1368
                    dest[2]=clip_table[((Y + yuvtab_3343[V]) >>13)];
1376
1376
                    // vertical linear interpolation && yuv2rgb in a single step:
1377
1377
                    int Y=yuvtab_2568[((buf0[i]*yalpha1+buf1[i]*yalpha)>>19)];
1378
1378
                    int U=((uvbuf0[i]*uvalpha1+uvbuf1[i]*uvalpha)>>19);
1379
 
                    int V=((uvbuf0[i+2048]*uvalpha1+uvbuf1[i+2048]*uvalpha)>>19);
 
1379
                    int V=((uvbuf0[i+VOFW]*uvalpha1+uvbuf1[i+VOFW]*uvalpha)>>19);
1380
1380
 
1381
1381
                    ((uint16_t*)dest)[i] =
1382
1382
                        clip_table16b[(Y + yuvtab_40cf[U]) >>13] |
1391
1391
                    // vertical linear interpolation && yuv2rgb in a single step:
1392
1392
                    int Y=yuvtab_2568[((buf0[i]*yalpha1+buf1[i]*yalpha)>>19)];
1393
1393
                    int U=((uvbuf0[i]*uvalpha1+uvbuf1[i]*uvalpha)>>19);
1394
 
                    int V=((uvbuf0[i+2048]*uvalpha1+uvbuf1[i+2048]*uvalpha)>>19);
 
1394
                    int V=((uvbuf0[i+VOFW]*uvalpha1+uvbuf1[i+VOFW]*uvalpha)>>19);
1395
1395
 
1396
1396
                    ((uint16_t*)dest)[i] =
1397
1397
                        clip_table15b[(Y + yuvtab_40cf[U]) >>13] |
1513
1513
    }
1514
1514
 
1515
1515
#ifdef HAVE_MMX
1516
 
    if ( uvalpha < 2048 ) // note this is not correct (shifts chrominance by 0.5 pixels) but its a bit faster
 
1516
    if (uvalpha < 2048) // note this is not correct (shifts chrominance by 0.5 pixels) but it is a bit faster
1517
1517
    {
1518
1518
        switch(dstFormat)
1519
1519
        {
1691
1691
            return;
1692
1692
        }
1693
1693
    }
1694
 
#endif
1695
 
    if ( uvalpha < 2048 )
 
1694
#endif /* HAVE_MMX */
 
1695
    if (uvalpha < 2048)
1696
1696
    {
1697
1697
        YSCALE_YUV_2_ANYRGB_C(YSCALE_YUV_2_RGB1_C, YSCALE_YUV_2_PACKED1_C)
1698
1698
    }else{
1762
1762
    assert(src1 == src2);
1763
1763
}
1764
1764
 
1765
 
//this is allmost identical to the previous, end exists only cuz yuy2ToY/UV)(dst, src+1, ...) would have 100% unaligned accesses
 
1765
/* This is almost identical to the previous, end exists only because
 
1766
 * yuy2ToY/UV)(dst, src+1, ...) would have 100% unaligned accesses. */
1766
1767
static inline void RENAME(uyvyToY)(uint8_t *dst, uint8_t *src, long width)
1767
1768
{
1768
1769
#ifdef HAVE_MMX
1831
1832
        int g= (((uint32_t*)src)[i]>>8)&0xFF;
1832
1833
        int r= (((uint32_t*)src)[i]>>16)&0xFF;
1833
1834
 
1834
 
        dst[i]= ((RY*r + GY*g + BY*b + (33<<(RGB2YUV_SHIFT-1)) )>>RGB2YUV_SHIFT);
 
1835
        dst[i]= ((RY*r + GY*g + BY*b + (33<<(RGB2YUV_SHIFT-1)))>>RGB2YUV_SHIFT);
1835
1836
    }
1836
1837
}
1837
1838
 
1859
1860
#ifdef HAVE_MMX
1860
1861
    asm volatile(
1861
1862
    "mov                        %2, %%"REG_a"   \n\t"
1862
 
    "movq     "MANGLE(bgr2YCoeff)", %%mm6       \n\t"
1863
 
    "movq          "MANGLE(w1111)", %%mm5       \n\t"
 
1863
    "movq  "MANGLE(ff_bgr2YCoeff)", %%mm6       \n\t"
 
1864
    "movq       "MANGLE(ff_w1111)", %%mm5       \n\t"
1864
1865
    "pxor                    %%mm7, %%mm7       \n\t"
1865
1866
    "lea (%%"REG_a", %%"REG_a", 2), %%"REG_d"   \n\t"
1866
1867
    ASMALIGN(4)
1918
1919
    "psraw                      $7, %%mm4       \n\t"
1919
1920
 
1920
1921
    "packuswb                %%mm4, %%mm0       \n\t"
1921
 
    "paddusb "MANGLE(bgr2YOffset)", %%mm0       \n\t"
 
1922
    "paddusb "MANGLE(ff_bgr2YOffset)", %%mm0    \n\t"
1922
1923
 
1923
1924
    "movq                    %%mm0, (%1, %%"REG_a") \n\t"
1924
1925
    "add                        $8, %%"REG_a"   \n\t"
1934
1935
        int g= src[i*3+1];
1935
1936
        int r= src[i*3+2];
1936
1937
 
1937
 
        dst[i]= ((RY*r + GY*g + BY*b + (33<<(RGB2YUV_SHIFT-1)) )>>RGB2YUV_SHIFT);
 
1938
        dst[i]= ((RY*r + GY*g + BY*b + (33<<(RGB2YUV_SHIFT-1)))>>RGB2YUV_SHIFT);
1938
1939
    }
1939
 
#endif
 
1940
#endif /* HAVE_MMX */
1940
1941
}
1941
1942
 
1942
1943
static inline void RENAME(bgr24ToUV)(uint8_t *dstU, uint8_t *dstV, uint8_t *src1, uint8_t *src2, long width)
1944
1945
#ifdef HAVE_MMX
1945
1946
    asm volatile(
1946
1947
    "mov                        %3, %%"REG_a"   \n\t"
1947
 
    "movq          "MANGLE(w1111)", %%mm5       \n\t"
1948
 
    "movq     "MANGLE(bgr2UCoeff)", %%mm6       \n\t"
 
1948
    "movq       "MANGLE(ff_w1111)", %%mm5       \n\t"
 
1949
    "movq  "MANGLE(ff_bgr2UCoeff)", %%mm6       \n\t"
1949
1950
    "pxor                    %%mm7, %%mm7       \n\t"
1950
1951
    "lea (%%"REG_a", %%"REG_a", 2), %%"REG_d"   \n\t"
1951
1952
    "add                 %%"REG_d", %%"REG_d"   \n\t"
1977
1978
    "psrlw                      $1, %%mm0       \n\t"
1978
1979
    "psrlw                      $1, %%mm2       \n\t"
1979
1980
#endif
1980
 
    "movq     "MANGLE(bgr2VCoeff)", %%mm1       \n\t"
1981
 
    "movq     "MANGLE(bgr2VCoeff)", %%mm3       \n\t"
 
1981
    "movq  "MANGLE(ff_bgr2VCoeff)", %%mm1       \n\t"
 
1982
    "movq  "MANGLE(ff_bgr2VCoeff)", %%mm3       \n\t"
1982
1983
 
1983
1984
    "pmaddwd                 %%mm0, %%mm1       \n\t"
1984
1985
    "pmaddwd                 %%mm2, %%mm3       \n\t"
2019
2020
    "punpcklbw              %%mm7, %%mm5       \n\t"
2020
2021
    "punpcklbw              %%mm7, %%mm2       \n\t"
2021
2022
    "paddw                  %%mm5, %%mm2       \n\t"
2022
 
    "movq         "MANGLE(w1111)", %%mm5       \n\t"
 
2023
    "movq      "MANGLE(ff_w1111)", %%mm5       \n\t"
2023
2024
    "psrlw                     $2, %%mm4       \n\t"
2024
2025
    "psrlw                     $2, %%mm2       \n\t"
2025
2026
#endif
2026
 
    "movq    "MANGLE(bgr2VCoeff)", %%mm1       \n\t"
2027
 
    "movq    "MANGLE(bgr2VCoeff)", %%mm3       \n\t"
 
2027
    "movq "MANGLE(ff_bgr2VCoeff)", %%mm1       \n\t"
 
2028
    "movq "MANGLE(ff_bgr2VCoeff)", %%mm3       \n\t"
2028
2029
 
2029
2030
    "pmaddwd                %%mm4, %%mm1       \n\t"
2030
2031
    "pmaddwd                %%mm2, %%mm3       \n\t"
2048
2049
    "punpckldq              %%mm4, %%mm0       \n\t"
2049
2050
    "punpckhdq              %%mm4, %%mm1       \n\t"
2050
2051
    "packsswb               %%mm1, %%mm0       \n\t"
2051
 
    "paddb "MANGLE(bgr2UVOffset)", %%mm0       \n\t"
 
2052
    "paddb "MANGLE(ff_bgr2UVOffset)", %%mm0    \n\t"
2052
2053
 
2053
2054
    "movd                   %%mm0, (%1, %%"REG_a")  \n\t"
2054
2055
    "punpckhdq              %%mm0, %%mm0            \n\t"
2069
2070
        dstU[i]= ((RU*r + GU*g + BU*b)>>(RGB2YUV_SHIFT+1)) + 128;
2070
2071
        dstV[i]= ((RV*r + GV*g + BV*b)>>(RGB2YUV_SHIFT+1)) + 128;
2071
2072
    }
2072
 
#endif
 
2073
#endif /* HAVE_MMX */
2073
2074
    assert(src1 == src2);
2074
2075
}
2075
2076
 
2076
 
static inline void RENAME(bgr16ToY)(uint8_t *dst, uint8_t *src, int width)
 
2077
static inline void RENAME(rgb16ToY)(uint8_t *dst, uint8_t *src, int width)
2077
2078
{
2078
2079
    int i;
2079
2080
    for (i=0; i<width; i++)
2087
2088
    }
2088
2089
}
2089
2090
 
2090
 
static inline void RENAME(bgr16ToUV)(uint8_t *dstU, uint8_t *dstV, uint8_t *src1, uint8_t *src2, int width)
 
2091
static inline void RENAME(rgb16ToUV)(uint8_t *dstU, uint8_t *dstV, uint8_t *src1, uint8_t *src2, int width)
2091
2092
{
2092
2093
    int i;
2093
2094
    assert(src1==src2);
2109
2110
    }
2110
2111
}
2111
2112
 
2112
 
static inline void RENAME(bgr15ToY)(uint8_t *dst, uint8_t *src, int width)
 
2113
static inline void RENAME(rgb15ToY)(uint8_t *dst, uint8_t *src, int width)
2113
2114
{
2114
2115
    int i;
2115
2116
    for (i=0; i<width; i++)
2123
2124
    }
2124
2125
}
2125
2126
 
2126
 
static inline void RENAME(bgr15ToUV)(uint8_t *dstU, uint8_t *dstV, uint8_t *src1, uint8_t *src2, int width)
 
2127
static inline void RENAME(rgb15ToUV)(uint8_t *dstU, uint8_t *dstV, uint8_t *src1, uint8_t *src2, int width)
2127
2128
{
2128
2129
    int i;
2129
2130
    assert(src1==src2);
2155
2156
        int g= (((uint32_t*)src)[i]>>8)&0xFF;
2156
2157
        int b= (((uint32_t*)src)[i]>>16)&0xFF;
2157
2158
 
2158
 
        dst[i]= ((RY*r + GY*g + BY*b + (33<<(RGB2YUV_SHIFT-1)) )>>RGB2YUV_SHIFT);
 
2159
        dst[i]= ((RY*r + GY*g + BY*b + (33<<(RGB2YUV_SHIFT-1)))>>RGB2YUV_SHIFT);
2159
2160
    }
2160
2161
}
2161
2162
 
2187
2188
        int g= src[i*3+1];
2188
2189
        int b= src[i*3+2];
2189
2190
 
2190
 
        dst[i]= ((RY*r + GY*g + BY*b + (33<<(RGB2YUV_SHIFT-1)) )>>RGB2YUV_SHIFT);
 
2191
        dst[i]= ((RY*r + GY*g + BY*b + (33<<(RGB2YUV_SHIFT-1)))>>RGB2YUV_SHIFT);
2191
2192
    }
2192
2193
}
2193
2194
 
2206
2207
    }
2207
2208
}
2208
2209
 
2209
 
static inline void RENAME(rgb16ToY)(uint8_t *dst, uint8_t *src, int width)
 
2210
static inline void RENAME(bgr16ToY)(uint8_t *dst, uint8_t *src, int width)
2210
2211
{
2211
2212
    int i;
2212
2213
    for (i=0; i<width; i++)
2220
2221
    }
2221
2222
}
2222
2223
 
2223
 
static inline void RENAME(rgb16ToUV)(uint8_t *dstU, uint8_t *dstV, uint8_t *src1, uint8_t *src2, int width)
 
2224
static inline void RENAME(bgr16ToUV)(uint8_t *dstU, uint8_t *dstV, uint8_t *src1, uint8_t *src2, int width)
2224
2225
{
2225
2226
    int i;
2226
2227
    assert(src1 == src2);
2239
2240
    }
2240
2241
}
2241
2242
 
2242
 
static inline void RENAME(rgb15ToY)(uint8_t *dst, uint8_t *src, int width)
 
2243
static inline void RENAME(bgr15ToY)(uint8_t *dst, uint8_t *src, int width)
2243
2244
{
2244
2245
    int i;
2245
2246
    for (i=0; i<width; i++)
2253
2254
    }
2254
2255
}
2255
2256
 
2256
 
static inline void RENAME(rgb15ToUV)(uint8_t *dstU, uint8_t *dstV, uint8_t *src1, uint8_t *src2, int width)
 
2257
static inline void RENAME(bgr15ToUV)(uint8_t *dstU, uint8_t *dstV, uint8_t *src1, uint8_t *src2, int width)
2257
2258
{
2258
2259
    int i;
2259
2260
    assert(src1 == src2);
2476
2477
        dst[i] = av_clip(val>>7, 0, (1<<15)-1); // the cubic equation does overflow ...
2477
2478
        //dst[i] = val>>7;
2478
2479
    }
2479
 
#endif
2480
 
#endif
 
2480
#endif /* HAVE_ALTIVEC */
 
2481
#endif /* HAVE_MMX */
2481
2482
}
2482
2483
      // *** horizontal scale Y line to temp buffer
2483
2484
static inline void RENAME(hyscale)(uint16_t *dst, long dstWidth, uint8_t *src, int srcW, int xInc,
2543
2544
    }
2544
2545
 
2545
2546
#ifdef HAVE_MMX
2546
 
    // use the new MMX scaler if the mmx2 can't be used (its faster than the x86asm one)
 
2547
    // use the new MMX scaler if the mmx2 can't be used (it is faster than the x86 ASM one)
2547
2548
    if (!(flags&SWS_FAST_BILINEAR) || (!canMMX2BeUsed))
2548
2549
#else
2549
2550
    if (!(flags&SWS_FAST_BILINEAR))
2594
2595
            "add               %%"REG_a", %%"REG_D" \n\t"\
2595
2596
            "xor               %%"REG_a", %%"REG_a" \n\t"\
2596
2597
 
2597
 
#endif
 
2598
#endif /* ARCH_X86_64 */
2598
2599
 
2599
2600
FUNNY_Y_CODE
2600
2601
FUNNY_Y_CODE
2622
2623
        }
2623
2624
        else
2624
2625
        {
2625
 
#endif
 
2626
#endif /* HAVE_MMX2 */
2626
2627
        long xInc_shr16 = xInc >> 16;
2627
2628
        uint16_t xInc_mask = xInc & 0xffff;
2628
2629
        //NO MMX just normal asm ...
2678
2679
            dst[i]= (src[xx]<<7) + (src[xx+1] - src[xx])*xalpha;
2679
2680
            xpos+=xInc;
2680
2681
        }
2681
 
#endif
 
2682
#endif /* defined(ARCH_X86) */
2682
2683
    }
2683
2684
}
2684
2685
 
2690
2691
{
2691
2692
    if (srcFormat==PIX_FMT_YUYV422)
2692
2693
    {
2693
 
        RENAME(yuy2ToUV)(formatConvBuffer, formatConvBuffer+2048, src1, src2, srcW);
 
2694
        RENAME(yuy2ToUV)(formatConvBuffer, formatConvBuffer+VOFW, src1, src2, srcW);
2694
2695
        src1= formatConvBuffer;
2695
 
        src2= formatConvBuffer+2048;
 
2696
        src2= formatConvBuffer+VOFW;
2696
2697
    }
2697
2698
    else if (srcFormat==PIX_FMT_UYVY422)
2698
2699
    {
2699
 
        RENAME(uyvyToUV)(formatConvBuffer, formatConvBuffer+2048, src1, src2, srcW);
 
2700
        RENAME(uyvyToUV)(formatConvBuffer, formatConvBuffer+VOFW, src1, src2, srcW);
2700
2701
        src1= formatConvBuffer;
2701
 
        src2= formatConvBuffer+2048;
 
2702
        src2= formatConvBuffer+VOFW;
2702
2703
    }
2703
2704
    else if (srcFormat==PIX_FMT_RGB32)
2704
2705
    {
2705
 
        RENAME(bgr32ToUV)(formatConvBuffer, formatConvBuffer+2048, src1, src2, srcW);
 
2706
        RENAME(bgr32ToUV)(formatConvBuffer, formatConvBuffer+VOFW, src1, src2, srcW);
2706
2707
        src1= formatConvBuffer;
2707
 
        src2= formatConvBuffer+2048;
 
2708
        src2= formatConvBuffer+VOFW;
2708
2709
    }
2709
2710
    else if (srcFormat==PIX_FMT_BGR24)
2710
2711
    {
2711
 
        RENAME(bgr24ToUV)(formatConvBuffer, formatConvBuffer+2048, src1, src2, srcW);
 
2712
        RENAME(bgr24ToUV)(formatConvBuffer, formatConvBuffer+VOFW, src1, src2, srcW);
2712
2713
        src1= formatConvBuffer;
2713
 
        src2= formatConvBuffer+2048;
 
2714
        src2= formatConvBuffer+VOFW;
2714
2715
    }
2715
2716
    else if (srcFormat==PIX_FMT_BGR565)
2716
2717
    {
2717
 
        RENAME(bgr16ToUV)(formatConvBuffer, formatConvBuffer+2048, src1, src2, srcW);
 
2718
        RENAME(bgr16ToUV)(formatConvBuffer, formatConvBuffer+VOFW, src1, src2, srcW);
2718
2719
        src1= formatConvBuffer;
2719
 
        src2= formatConvBuffer+2048;
 
2720
        src2= formatConvBuffer+VOFW;
2720
2721
    }
2721
2722
    else if (srcFormat==PIX_FMT_BGR555)
2722
2723
    {
2723
 
        RENAME(bgr15ToUV)(formatConvBuffer, formatConvBuffer+2048, src1, src2, srcW);
 
2724
        RENAME(bgr15ToUV)(formatConvBuffer, formatConvBuffer+VOFW, src1, src2, srcW);
2724
2725
        src1= formatConvBuffer;
2725
 
        src2= formatConvBuffer+2048;
 
2726
        src2= formatConvBuffer+VOFW;
2726
2727
    }
2727
2728
    else if (srcFormat==PIX_FMT_BGR32)
2728
2729
    {
2729
 
        RENAME(rgb32ToUV)(formatConvBuffer, formatConvBuffer+2048, src1, src2, srcW);
 
2730
        RENAME(rgb32ToUV)(formatConvBuffer, formatConvBuffer+VOFW, src1, src2, srcW);
2730
2731
        src1= formatConvBuffer;
2731
 
        src2= formatConvBuffer+2048;
 
2732
        src2= formatConvBuffer+VOFW;
2732
2733
    }
2733
2734
    else if (srcFormat==PIX_FMT_RGB24)
2734
2735
    {
2735
 
        RENAME(rgb24ToUV)(formatConvBuffer, formatConvBuffer+2048, src1, src2, srcW);
 
2736
        RENAME(rgb24ToUV)(formatConvBuffer, formatConvBuffer+VOFW, src1, src2, srcW);
2736
2737
        src1= formatConvBuffer;
2737
 
        src2= formatConvBuffer+2048;
 
2738
        src2= formatConvBuffer+VOFW;
2738
2739
    }
2739
2740
    else if (srcFormat==PIX_FMT_RGB565)
2740
2741
    {
2741
 
        RENAME(rgb16ToUV)(formatConvBuffer, formatConvBuffer+2048, src1, src2, srcW);
 
2742
        RENAME(rgb16ToUV)(formatConvBuffer, formatConvBuffer+VOFW, src1, src2, srcW);
2742
2743
        src1= formatConvBuffer;
2743
 
        src2= formatConvBuffer+2048;
 
2744
        src2= formatConvBuffer+VOFW;
2744
2745
    }
2745
2746
    else if (srcFormat==PIX_FMT_RGB555)
2746
2747
    {
2747
 
        RENAME(rgb15ToUV)(formatConvBuffer, formatConvBuffer+2048, src1, src2, srcW);
 
2748
        RENAME(rgb15ToUV)(formatConvBuffer, formatConvBuffer+VOFW, src1, src2, srcW);
2748
2749
        src1= formatConvBuffer;
2749
 
        src2= formatConvBuffer+2048;
 
2750
        src2= formatConvBuffer+VOFW;
2750
2751
    }
2751
2752
    else if (isGray(srcFormat))
2752
2753
    {
2754
2755
    }
2755
2756
    else if (srcFormat==PIX_FMT_RGB8 || srcFormat==PIX_FMT_BGR8 || srcFormat==PIX_FMT_PAL8 || srcFormat==PIX_FMT_BGR4_BYTE  || srcFormat==PIX_FMT_RGB4_BYTE)
2756
2757
    {
2757
 
        RENAME(palToUV)(formatConvBuffer, formatConvBuffer+2048, src1, src2, srcW, pal);
 
2758
        RENAME(palToUV)(formatConvBuffer, formatConvBuffer+VOFW, src1, src2, srcW, pal);
2758
2759
        src1= formatConvBuffer;
2759
 
        src2= formatConvBuffer+2048;
 
2760
        src2= formatConvBuffer+VOFW;
2760
2761
    }
2761
2762
 
2762
2763
#ifdef HAVE_MMX
2763
 
    // use the new MMX scaler if the mmx2 can't be used (its faster than the x86asm one)
 
2764
    // use the new MMX scaler if the mmx2 can't be used (it is faster than the x86 ASM one)
2764
2765
    if (!(flags&SWS_FAST_BILINEAR) || (!canMMX2BeUsed))
2765
2766
#else
2766
2767
    if (!(flags&SWS_FAST_BILINEAR))
2767
2768
#endif
2768
2769
    {
2769
2770
        RENAME(hScale)(dst     , dstWidth, src1, srcW, xInc, hChrFilter, hChrFilterPos, hChrFilterSize);
2770
 
        RENAME(hScale)(dst+2048, dstWidth, src2, srcW, xInc, hChrFilter, hChrFilterPos, hChrFilterSize);
 
2771
        RENAME(hScale)(dst+VOFW, dstWidth, src2, srcW, xInc, hChrFilter, hChrFilterPos, hChrFilterSize);
2771
2772
    }
2772
2773
    else // Fast Bilinear upscale / crap downscale
2773
2774
    {
2812
2813
            "add          %%"REG_a", %%"REG_D"  \n\t"\
2813
2814
            "xor          %%"REG_a", %%"REG_a"  \n\t"\
2814
2815
 
2815
 
#endif
 
2816
#endif /* ARCH_X86_64 */
2816
2817
 
2817
2818
FUNNY_UV_CODE
2818
2819
FUNNY_UV_CODE
2821
2822
            "xor          %%"REG_a", %%"REG_a"  \n\t" // i
2822
2823
            "mov                 %5, %%"REG_c"  \n\t" // src
2823
2824
            "mov                 %1, %%"REG_D"  \n\t" // buf1
2824
 
            "add              $4096, %%"REG_D"  \n\t"
 
2825
            "add              $"AV_STRINGIFY(VOF)", %%"REG_D"  \n\t"
2825
2826
            PREFETCH"   (%%"REG_c")             \n\t"
2826
2827
            PREFETCH" 32(%%"REG_c")             \n\t"
2827
2828
            PREFETCH" 64(%%"REG_c")             \n\t"
2848
2849
            {
2849
2850
                //printf("%d %d %d\n", dstWidth, i, srcW);
2850
2851
                dst[i] = src1[srcW-1]*128;
2851
 
                dst[i+2048] = src2[srcW-1]*128;
 
2852
                dst[i+VOFW] = src2[srcW-1]*128;
2852
2853
            }
2853
2854
        }
2854
2855
        else
2855
2856
        {
2856
 
#endif
 
2857
#endif /* HAVE_MMX2 */
2857
2858
            long xInc_shr16 = (long) (xInc >> 16);
2858
2859
            uint16_t xInc_mask = xInc & 0xffff;
2859
2860
            asm volatile(
2881
2882
            "addl    %%edi, %%esi                   \n\t" //src[xx+1]*2*xalpha + src[xx]*(1-2*xalpha)
2882
2883
            "mov        %1, %%"REG_D"               \n\t"
2883
2884
            "shrl       $9, %%esi                   \n\t"
2884
 
            "movw     %%si, 4096(%%"REG_D", %%"REG_a", 2)   \n\t"
 
2885
            "movw     %%si, "AV_STRINGIFY(VOF)"(%%"REG_D", %%"REG_a", 2)   \n\t"
2885
2886
 
2886
2887
            "addw       %4, %%cx                    \n\t" //2*xalpha += xInc&0xFF
2887
2888
            "adc        %3, %%"REG_d"               \n\t" //xx+= xInc>>8 + carry
2891
2892
 
2892
2893
/* GCC-3.3 makes MPlayer crash on IA-32 machines when using "g" operand here,
2893
2894
   which is needed to support GCC-4.0 */
2894
 
#if defined(ARCH_X86_64) && ((__GNUC__ > 3) || ( __GNUC__ == 3 && __GNUC_MINOR__ >= 4))
 
2895
#if defined(ARCH_X86_64) && ((__GNUC__ > 3) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
2895
2896
            :: "m" (src1), "m" (dst), "g" ((long)dstWidth), "m" (xInc_shr16), "m" (xInc_mask),
2896
2897
#else
2897
2898
            :: "m" (src1), "m" (dst), "m" ((long)dstWidth), "m" (xInc_shr16), "m" (xInc_mask),
2910
2911
            register unsigned int xx=xpos>>16;
2911
2912
            register unsigned int xalpha=(xpos&0xFFFF)>>9;
2912
2913
            dst[i]=(src1[xx]*(xalpha^127)+src1[xx+1]*xalpha);
2913
 
            dst[i+2048]=(src2[xx]*(xalpha^127)+src2[xx+1]*xalpha);
 
2914
            dst[i+VOFW]=(src2[xx]*(xalpha^127)+src2[xx+1]*xalpha);
2914
2915
            /* slower
2915
2916
            dst[i]= (src1[xx]<<7) + (src1[xx+1] - src1[xx])*xalpha;
2916
 
            dst[i+2048]=(src2[xx]<<7) + (src2[xx+1] - src2[xx])*xalpha;
 
2917
            dst[i+VOFW]=(src2[xx]<<7) + (src2[xx+1] - src2[xx])*xalpha;
2917
2918
            */
2918
2919
            xpos+=xInc;
2919
2920
        }
2920
 
#endif
 
2921
#endif /* defined(ARCH_X86) */
2921
2922
    }
2922
2923
}
2923
2924
 
3002
3003
        static int firstTime=1; //FIXME move this into the context perhaps
3003
3004
        if (flags & SWS_PRINT_INFO && firstTime)
3004
3005
        {
3005
 
            av_log(c, AV_LOG_WARNING, "SwScaler: Warning: dstStride is not aligned!\n"
3006
 
                   "SwScaler:          ->cannot do aligned memory acesses anymore\n");
 
3006
            av_log(c, AV_LOG_WARNING, "Warning: dstStride is not aligned!\n"
 
3007
                   "         ->cannot do aligned memory acesses anymore\n");
3007
3008
            firstTime=0;
3008
3009
        }
3009
3010
    }
3077
3078
                lastInChrBuf++;
3078
3079
            }
3079
3080
            //wrap buf index around to stay inside the ring buffer
3080
 
            if (lumBufIndex >= vLumBufSize ) lumBufIndex-= vLumBufSize;
3081
 
            if (chrBufIndex >= vChrBufSize ) chrBufIndex-= vChrBufSize;
 
3081
            if (lumBufIndex >= vLumBufSize) lumBufIndex-= vLumBufSize;
 
3082
            if (chrBufIndex >= vChrBufSize) chrBufIndex-= vChrBufSize;
3082
3083
        }
3083
3084
        else // not enough lines left in this slice -> load the rest in the buffer
3084
3085
        {
3118
3119
                lastInChrBuf++;
3119
3120
            }
3120
3121
            //wrap buf index around to stay inside the ring buffer
3121
 
            if (lumBufIndex >= vLumBufSize ) lumBufIndex-= vLumBufSize;
3122
 
            if (chrBufIndex >= vChrBufSize ) chrBufIndex-= vChrBufSize;
 
3122
            if (lumBufIndex >= vLumBufSize) lumBufIndex-= vLumBufSize;
 
3123
            if (chrBufIndex >= vChrBufSize) chrBufIndex-= vChrBufSize;
3123
3124
            break; //we can't output a dstY line so let's try with the next slice
3124
3125
        }
3125
3126
 
3126
3127
#ifdef HAVE_MMX
3127
 
        b5Dither= dither8[dstY&1];
3128
 
        g6Dither= dither4[dstY&1];
3129
 
        g5Dither= dither8[dstY&1];
3130
 
        r5Dither= dither8[(dstY+1)&1];
 
3128
        b5Dither= ff_dither8[dstY&1];
 
3129
        g6Dither= ff_dither4[dstY&1];
 
3130
        g5Dither= ff_dither8[dstY&1];
 
3131
        r5Dither= ff_dither8[(dstY+1)&1];
3131
3132
#endif
3132
3133
        if (dstY < dstH-2)
3133
3134
        {
3259
3260
    }
3260
3261
 
3261
3262
#ifdef HAVE_MMX
3262
 
    __asm __volatile(SFENCE:::"memory");
3263
 
    __asm __volatile(EMMS:::"memory");
 
3263
    asm volatile(SFENCE:::"memory");
 
3264
    asm volatile(EMMS:::"memory");
3264
3265
#endif
3265
3266
    /* store changed local vars back in the context */
3266
3267
    c->dstY= dstY;