Revision a959e247 libswscale/swscale_template.c

View differences:

libswscale/swscale_template.c
954 954
#if COMPILE_TEMPLATE_MMX
955 955
    if(!(c->flags & SWS_BITEXACT)) {
956 956
        long p= 4;
957
        uint8_t *src[4]= {alpSrc + dstW, lumSrc + dstW, chrSrc + chrDstW, chrSrc + VOFW + chrDstW};
957
        const uint8_t *src[4]= {alpSrc + dstW, lumSrc + dstW, chrSrc + chrDstW, chrSrc + VOFW + chrDstW};
958 958
        uint8_t *dst[4]= {aDest, dest, uDest, vDest};
959 959
        x86_reg counter[4]= {dstW, dstW, chrDstW, chrDstW};
960 960

  
......
1235 1235
                    : "%r8"
1236 1236
                );
1237 1237
#else
1238
                *(uint16_t **)(&c->u_temp)=abuf0;
1239
                *(uint16_t **)(&c->v_temp)=abuf1;
1238
                *(const uint16_t **)(&c->u_temp)=abuf0;
1239
                *(const uint16_t **)(&c->v_temp)=abuf1;
1240 1240
                __asm__ volatile(
1241 1241
                    "mov %%"REG_b", "ESP_OFFSET"(%5)        \n\t"
1242 1242
                    "mov        %4, %%"REG_b"               \n\t"
......
2145 2145
#endif
2146 2146
        );
2147 2147
    } else {
2148
        uint8_t *offset = src+filterSize;
2148
        const uint8_t *offset = src+filterSize;
2149 2149
        x86_reg counter= -2*dstW;
2150 2150
        //filter-= counter*filterSize/2;
2151 2151
        filterPos-= counter/2;
......
2554 2554
#define DEBUG_SWSCALE_BUFFERS 0
2555 2555
#define DEBUG_BUFFERS(...) if (DEBUG_SWSCALE_BUFFERS) av_log(c, AV_LOG_DEBUG, __VA_ARGS__)
2556 2556

  
2557
static int RENAME(swScale)(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY,
2557
static int RENAME(swScale)(SwsContext *c, const uint8_t* src[], int srcStride[], int srcSliceY,
2558 2558
                           int srcSliceH, uint8_t* dst[], int dstStride[])
2559 2559
{
2560 2560
    /* load a few things into local vars to make the code more readable? and faster */
......
2677 2677

  
2678 2678
        //Do horizontal scaling
2679 2679
        while(lastInLumBuf < lastLumSrcY) {
2680
            uint8_t *src1= src[0]+(lastInLumBuf + 1 - srcSliceY)*srcStride[0];
2681
            uint8_t *src2= src[3]+(lastInLumBuf + 1 - srcSliceY)*srcStride[3];
2680
            const uint8_t *src1= src[0]+(lastInLumBuf + 1 - srcSliceY)*srcStride[0];
2681
            const uint8_t *src2= src[3]+(lastInLumBuf + 1 - srcSliceY)*srcStride[3];
2682 2682
            lumBufIndex++;
2683 2683
            DEBUG_BUFFERS("\t\tlumBufIndex %d: lastInLumBuf: %d\n",
2684 2684
                               lumBufIndex,    lastInLumBuf);
......
2697 2697
            lastInLumBuf++;
2698 2698
        }
2699 2699
        while(lastInChrBuf < lastChrSrcY) {
2700
            uint8_t *src1= src[1]+(lastInChrBuf + 1 - chrSrcSliceY)*srcStride[1];
2701
            uint8_t *src2= src[2]+(lastInChrBuf + 1 - chrSrcSliceY)*srcStride[2];
2700
            const uint8_t *src1= src[1]+(lastInChrBuf + 1 - chrSrcSliceY)*srcStride[1];
2701
            const uint8_t *src2= src[2]+(lastInChrBuf + 1 - chrSrcSliceY)*srcStride[2];
2702 2702
            chrBufIndex++;
2703 2703
            DEBUG_BUFFERS("\t\tchrBufIndex %d: lastInChrBuf: %d\n",
2704 2704
                               chrBufIndex,    lastInChrBuf);
......
2737 2737
            if (flags & SWS_ACCURATE_RND) {
2738 2738
                int s= APCK_SIZE / 8;
2739 2739
                for (i=0; i<vLumFilterSize; i+=2) {
2740
                    *(void**)&lumMmxFilter[s*i              ]= lumSrcPtr[i  ];
2741
                    *(void**)&lumMmxFilter[s*i+APCK_PTR2/4  ]= lumSrcPtr[i+(vLumFilterSize>1)];
2740
                    *(const void**)&lumMmxFilter[s*i              ]= lumSrcPtr[i  ];
2741
                    *(const void**)&lumMmxFilter[s*i+APCK_PTR2/4  ]= lumSrcPtr[i+(vLumFilterSize>1)];
2742 2742
                              lumMmxFilter[s*i+APCK_COEF/4  ]=
2743 2743
                              lumMmxFilter[s*i+APCK_COEF/4+1]= vLumFilter[dstY*vLumFilterSize + i    ]
2744 2744
                        + (vLumFilterSize>1 ? vLumFilter[dstY*vLumFilterSize + i + 1]<<16 : 0);
2745 2745
                    if (CONFIG_SWSCALE_ALPHA && alpPixBuf) {
2746
                        *(void**)&alpMmxFilter[s*i              ]= alpSrcPtr[i  ];
2747
                        *(void**)&alpMmxFilter[s*i+APCK_PTR2/4  ]= alpSrcPtr[i+(vLumFilterSize>1)];
2746
                        *(const void**)&alpMmxFilter[s*i              ]= alpSrcPtr[i  ];
2747
                        *(const void**)&alpMmxFilter[s*i+APCK_PTR2/4  ]= alpSrcPtr[i+(vLumFilterSize>1)];
2748 2748
                                  alpMmxFilter[s*i+APCK_COEF/4  ]=
2749 2749
                                  alpMmxFilter[s*i+APCK_COEF/4+1]= lumMmxFilter[s*i+APCK_COEF/4  ];
2750 2750
                    }
2751 2751
                }
2752 2752
                for (i=0; i<vChrFilterSize; i+=2) {
2753
                    *(void**)&chrMmxFilter[s*i              ]= chrSrcPtr[i  ];
2754
                    *(void**)&chrMmxFilter[s*i+APCK_PTR2/4  ]= chrSrcPtr[i+(vChrFilterSize>1)];
2753
                    *(const void**)&chrMmxFilter[s*i              ]= chrSrcPtr[i  ];
2754
                    *(const void**)&chrMmxFilter[s*i+APCK_PTR2/4  ]= chrSrcPtr[i+(vChrFilterSize>1)];
2755 2755
                              chrMmxFilter[s*i+APCK_COEF/4  ]=
2756 2756
                              chrMmxFilter[s*i+APCK_COEF/4+1]= vChrFilter[chrDstY*vChrFilterSize + i    ]
2757 2757
                        + (vChrFilterSize>1 ? vChrFilter[chrDstY*vChrFilterSize + i + 1]<<16 : 0);
......
2796 2796
                                  alpSrcPtr, (uint16_t *) dest, (uint16_t *) uDest, (uint16_t *) vDest, (uint16_t *) aDest, dstW, chrDstW,
2797 2797
                                  dstFormat);
2798 2798
                } else if (vLumFilterSize == 1 && vChrFilterSize == 1) { // unscaled YV12
2799
                    int16_t *lumBuf = lumSrcPtr[0];
2800
                    int16_t *chrBuf= chrSrcPtr[0];
2801
                    int16_t *alpBuf= (CONFIG_SWSCALE_ALPHA && alpPixBuf) ? alpSrcPtr[0] : NULL;
2799
                    const int16_t *lumBuf = lumSrcPtr[0];
2800
                    const int16_t *chrBuf= chrSrcPtr[0];
2801
                    const int16_t *alpBuf= (CONFIG_SWSCALE_ALPHA && alpPixBuf) ? alpSrcPtr[0] : NULL;
2802 2802
                    c->yuv2yuv1(c, lumBuf, chrBuf, alpBuf, dest, uDest, vDest, aDest, dstW, chrDstW);
2803 2803
                } else { //General YV12
2804 2804
                    c->yuv2yuvX(c,

Also available in: Unified diff