Mercurial > mplayer.hg
comparison libswscale/swscale_template.c @ 30264:1032ff2e83f1
Const correctness for src pointer. Remove all constness related warnings in
libswscale.
author | zuxy |
---|---|
date | Fri, 15 Jan 2010 08:51:51 +0000 |
parents | 2de25e76d331 |
children | 042ec58ab0e2 |
comparison
equal
deleted
inserted
replaced
30263:98cc153d1726 | 30264:1032ff2e83f1 |
---|---|
952 { | 952 { |
953 int i; | 953 int i; |
954 #if COMPILE_TEMPLATE_MMX | 954 #if COMPILE_TEMPLATE_MMX |
955 if(!(c->flags & SWS_BITEXACT)) { | 955 if(!(c->flags & SWS_BITEXACT)) { |
956 long p= 4; | 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 uint8_t *dst[4]= {aDest, dest, uDest, vDest}; | 958 uint8_t *dst[4]= {aDest, dest, uDest, vDest}; |
959 x86_reg counter[4]= {dstW, dstW, chrDstW, chrDstW}; | 959 x86_reg counter[4]= {dstW, dstW, chrDstW, chrDstW}; |
960 | 960 |
961 if (c->flags & SWS_ACCURATE_RND) { | 961 if (c->flags & SWS_ACCURATE_RND) { |
962 while(p--) { | 962 while(p--) { |
1233 "a" (&c->redDither) | 1233 "a" (&c->redDither) |
1234 ,"r" (abuf0), "r" (abuf1) | 1234 ,"r" (abuf0), "r" (abuf1) |
1235 : "%r8" | 1235 : "%r8" |
1236 ); | 1236 ); |
1237 #else | 1237 #else |
1238 *(uint16_t **)(&c->u_temp)=abuf0; | 1238 *(const uint16_t **)(&c->u_temp)=abuf0; |
1239 *(uint16_t **)(&c->v_temp)=abuf1; | 1239 *(const uint16_t **)(&c->v_temp)=abuf1; |
1240 __asm__ volatile( | 1240 __asm__ volatile( |
1241 "mov %%"REG_b", "ESP_OFFSET"(%5) \n\t" | 1241 "mov %%"REG_b", "ESP_OFFSET"(%5) \n\t" |
1242 "mov %4, %%"REG_b" \n\t" | 1242 "mov %4, %%"REG_b" \n\t" |
1243 "push %%"REG_BP" \n\t" | 1243 "push %%"REG_BP" \n\t" |
1244 YSCALEYUV2RGB(%%REGBP, %5) | 1244 YSCALEYUV2RGB(%%REGBP, %5) |
2143 #if !defined(PIC) | 2143 #if !defined(PIC) |
2144 : "%"REG_b | 2144 : "%"REG_b |
2145 #endif | 2145 #endif |
2146 ); | 2146 ); |
2147 } else { | 2147 } else { |
2148 uint8_t *offset = src+filterSize; | 2148 const uint8_t *offset = src+filterSize; |
2149 x86_reg counter= -2*dstW; | 2149 x86_reg counter= -2*dstW; |
2150 //filter-= counter*filterSize/2; | 2150 //filter-= counter*filterSize/2; |
2151 filterPos-= counter/2; | 2151 filterPos-= counter/2; |
2152 dst-= counter/2; | 2152 dst-= counter/2; |
2153 __asm__ volatile( | 2153 __asm__ volatile( |
2552 } | 2552 } |
2553 | 2553 |
2554 #define DEBUG_SWSCALE_BUFFERS 0 | 2554 #define DEBUG_SWSCALE_BUFFERS 0 |
2555 #define DEBUG_BUFFERS(...) if (DEBUG_SWSCALE_BUFFERS) av_log(c, AV_LOG_DEBUG, __VA_ARGS__) | 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 int srcSliceH, uint8_t* dst[], int dstStride[]) | 2558 int srcSliceH, uint8_t* dst[], int dstStride[]) |
2559 { | 2559 { |
2560 /* load a few things into local vars to make the code more readable? and faster */ | 2560 /* load a few things into local vars to make the code more readable? and faster */ |
2561 const int srcW= c->srcW; | 2561 const int srcW= c->srcW; |
2562 const int dstW= c->dstW; | 2562 const int dstW= c->dstW; |
2675 DEBUG_BUFFERS("\tfirstChrSrcY: %d lastChrSrcY: %d lastInChrBuf: %d\n", | 2675 DEBUG_BUFFERS("\tfirstChrSrcY: %d lastChrSrcY: %d lastInChrBuf: %d\n", |
2676 firstChrSrcY, lastChrSrcY, lastInChrBuf); | 2676 firstChrSrcY, lastChrSrcY, lastInChrBuf); |
2677 | 2677 |
2678 //Do horizontal scaling | 2678 //Do horizontal scaling |
2679 while(lastInLumBuf < lastLumSrcY) { | 2679 while(lastInLumBuf < lastLumSrcY) { |
2680 uint8_t *src1= src[0]+(lastInLumBuf + 1 - srcSliceY)*srcStride[0]; | 2680 const uint8_t *src1= src[0]+(lastInLumBuf + 1 - srcSliceY)*srcStride[0]; |
2681 uint8_t *src2= src[3]+(lastInLumBuf + 1 - srcSliceY)*srcStride[3]; | 2681 const uint8_t *src2= src[3]+(lastInLumBuf + 1 - srcSliceY)*srcStride[3]; |
2682 lumBufIndex++; | 2682 lumBufIndex++; |
2683 DEBUG_BUFFERS("\t\tlumBufIndex %d: lastInLumBuf: %d\n", | 2683 DEBUG_BUFFERS("\t\tlumBufIndex %d: lastInLumBuf: %d\n", |
2684 lumBufIndex, lastInLumBuf); | 2684 lumBufIndex, lastInLumBuf); |
2685 assert(lumBufIndex < 2*vLumBufSize); | 2685 assert(lumBufIndex < 2*vLumBufSize); |
2686 assert(lastInLumBuf + 1 - srcSliceY < srcSliceH); | 2686 assert(lastInLumBuf + 1 - srcSliceY < srcSliceH); |
2695 formatConvBuffer, | 2695 formatConvBuffer, |
2696 pal, 1); | 2696 pal, 1); |
2697 lastInLumBuf++; | 2697 lastInLumBuf++; |
2698 } | 2698 } |
2699 while(lastInChrBuf < lastChrSrcY) { | 2699 while(lastInChrBuf < lastChrSrcY) { |
2700 uint8_t *src1= src[1]+(lastInChrBuf + 1 - chrSrcSliceY)*srcStride[1]; | 2700 const uint8_t *src1= src[1]+(lastInChrBuf + 1 - chrSrcSliceY)*srcStride[1]; |
2701 uint8_t *src2= src[2]+(lastInChrBuf + 1 - chrSrcSliceY)*srcStride[2]; | 2701 const uint8_t *src2= src[2]+(lastInChrBuf + 1 - chrSrcSliceY)*srcStride[2]; |
2702 chrBufIndex++; | 2702 chrBufIndex++; |
2703 DEBUG_BUFFERS("\t\tchrBufIndex %d: lastInChrBuf: %d\n", | 2703 DEBUG_BUFFERS("\t\tchrBufIndex %d: lastInChrBuf: %d\n", |
2704 chrBufIndex, lastInChrBuf); | 2704 chrBufIndex, lastInChrBuf); |
2705 assert(chrBufIndex < 2*vChrBufSize); | 2705 assert(chrBufIndex < 2*vChrBufSize); |
2706 assert(lastInChrBuf + 1 - chrSrcSliceY < (chrSrcSliceH)); | 2706 assert(lastInChrBuf + 1 - chrSrcSliceY < (chrSrcSliceH)); |
2735 #if COMPILE_TEMPLATE_MMX | 2735 #if COMPILE_TEMPLATE_MMX |
2736 int i; | 2736 int i; |
2737 if (flags & SWS_ACCURATE_RND) { | 2737 if (flags & SWS_ACCURATE_RND) { |
2738 int s= APCK_SIZE / 8; | 2738 int s= APCK_SIZE / 8; |
2739 for (i=0; i<vLumFilterSize; i+=2) { | 2739 for (i=0; i<vLumFilterSize; i+=2) { |
2740 *(void**)&lumMmxFilter[s*i ]= lumSrcPtr[i ]; | 2740 *(const void**)&lumMmxFilter[s*i ]= lumSrcPtr[i ]; |
2741 *(void**)&lumMmxFilter[s*i+APCK_PTR2/4 ]= lumSrcPtr[i+(vLumFilterSize>1)]; | 2741 *(const void**)&lumMmxFilter[s*i+APCK_PTR2/4 ]= lumSrcPtr[i+(vLumFilterSize>1)]; |
2742 lumMmxFilter[s*i+APCK_COEF/4 ]= | 2742 lumMmxFilter[s*i+APCK_COEF/4 ]= |
2743 lumMmxFilter[s*i+APCK_COEF/4+1]= vLumFilter[dstY*vLumFilterSize + i ] | 2743 lumMmxFilter[s*i+APCK_COEF/4+1]= vLumFilter[dstY*vLumFilterSize + i ] |
2744 + (vLumFilterSize>1 ? vLumFilter[dstY*vLumFilterSize + i + 1]<<16 : 0); | 2744 + (vLumFilterSize>1 ? vLumFilter[dstY*vLumFilterSize + i + 1]<<16 : 0); |
2745 if (CONFIG_SWSCALE_ALPHA && alpPixBuf) { | 2745 if (CONFIG_SWSCALE_ALPHA && alpPixBuf) { |
2746 *(void**)&alpMmxFilter[s*i ]= alpSrcPtr[i ]; | 2746 *(const void**)&alpMmxFilter[s*i ]= alpSrcPtr[i ]; |
2747 *(void**)&alpMmxFilter[s*i+APCK_PTR2/4 ]= alpSrcPtr[i+(vLumFilterSize>1)]; | 2747 *(const void**)&alpMmxFilter[s*i+APCK_PTR2/4 ]= alpSrcPtr[i+(vLumFilterSize>1)]; |
2748 alpMmxFilter[s*i+APCK_COEF/4 ]= | 2748 alpMmxFilter[s*i+APCK_COEF/4 ]= |
2749 alpMmxFilter[s*i+APCK_COEF/4+1]= lumMmxFilter[s*i+APCK_COEF/4 ]; | 2749 alpMmxFilter[s*i+APCK_COEF/4+1]= lumMmxFilter[s*i+APCK_COEF/4 ]; |
2750 } | 2750 } |
2751 } | 2751 } |
2752 for (i=0; i<vChrFilterSize; i+=2) { | 2752 for (i=0; i<vChrFilterSize; i+=2) { |
2753 *(void**)&chrMmxFilter[s*i ]= chrSrcPtr[i ]; | 2753 *(const void**)&chrMmxFilter[s*i ]= chrSrcPtr[i ]; |
2754 *(void**)&chrMmxFilter[s*i+APCK_PTR2/4 ]= chrSrcPtr[i+(vChrFilterSize>1)]; | 2754 *(const void**)&chrMmxFilter[s*i+APCK_PTR2/4 ]= chrSrcPtr[i+(vChrFilterSize>1)]; |
2755 chrMmxFilter[s*i+APCK_COEF/4 ]= | 2755 chrMmxFilter[s*i+APCK_COEF/4 ]= |
2756 chrMmxFilter[s*i+APCK_COEF/4+1]= vChrFilter[chrDstY*vChrFilterSize + i ] | 2756 chrMmxFilter[s*i+APCK_COEF/4+1]= vChrFilter[chrDstY*vChrFilterSize + i ] |
2757 + (vChrFilterSize>1 ? vChrFilter[chrDstY*vChrFilterSize + i + 1]<<16 : 0); | 2757 + (vChrFilterSize>1 ? vChrFilter[chrDstY*vChrFilterSize + i + 1]<<16 : 0); |
2758 } | 2758 } |
2759 } else { | 2759 } else { |
2794 vLumFilter+dstY*vLumFilterSize , lumSrcPtr, vLumFilterSize, | 2794 vLumFilter+dstY*vLumFilterSize , lumSrcPtr, vLumFilterSize, |
2795 vChrFilter+chrDstY*vChrFilterSize, chrSrcPtr, vChrFilterSize, | 2795 vChrFilter+chrDstY*vChrFilterSize, chrSrcPtr, vChrFilterSize, |
2796 alpSrcPtr, (uint16_t *) dest, (uint16_t *) uDest, (uint16_t *) vDest, (uint16_t *) aDest, dstW, chrDstW, | 2796 alpSrcPtr, (uint16_t *) dest, (uint16_t *) uDest, (uint16_t *) vDest, (uint16_t *) aDest, dstW, chrDstW, |
2797 dstFormat); | 2797 dstFormat); |
2798 } else if (vLumFilterSize == 1 && vChrFilterSize == 1) { // unscaled YV12 | 2798 } else if (vLumFilterSize == 1 && vChrFilterSize == 1) { // unscaled YV12 |
2799 int16_t *lumBuf = lumSrcPtr[0]; | 2799 const int16_t *lumBuf = lumSrcPtr[0]; |
2800 int16_t *chrBuf= chrSrcPtr[0]; | 2800 const int16_t *chrBuf= chrSrcPtr[0]; |
2801 int16_t *alpBuf= (CONFIG_SWSCALE_ALPHA && alpPixBuf) ? alpSrcPtr[0] : NULL; | 2801 const int16_t *alpBuf= (CONFIG_SWSCALE_ALPHA && alpPixBuf) ? alpSrcPtr[0] : NULL; |
2802 c->yuv2yuv1(c, lumBuf, chrBuf, alpBuf, dest, uDest, vDest, aDest, dstW, chrDstW); | 2802 c->yuv2yuv1(c, lumBuf, chrBuf, alpBuf, dest, uDest, vDest, aDest, dstW, chrDstW); |
2803 } else { //General YV12 | 2803 } else { //General YV12 |
2804 c->yuv2yuvX(c, | 2804 c->yuv2yuvX(c, |
2805 vLumFilter+dstY*vLumFilterSize , lumSrcPtr, vLumFilterSize, | 2805 vLumFilter+dstY*vLumFilterSize , lumSrcPtr, vLumFilterSize, |
2806 vChrFilter+chrDstY*vChrFilterSize, chrSrcPtr, vChrFilterSize, | 2806 vChrFilter+chrDstY*vChrFilterSize, chrSrcPtr, vChrFilterSize, |