changeset 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 98cc153d1726
children a70cdb4450f5
files libswscale/rgb2rgb.c libswscale/rgb2rgb.h libswscale/rgb2rgb_template.c libswscale/swscale.c libswscale/swscale.h libswscale/swscale_internal.h libswscale/swscale_template.c libswscale/x86/yuv2rgb_template.c libswscale/yuv2rgb.c
diffstat 9 files changed, 69 insertions(+), 69 deletions(-) [+]
line wrap: on
line diff
--- a/libswscale/rgb2rgb.c	Fri Jan 15 07:55:07 2010 +0000
+++ b/libswscale/rgb2rgb.c	Fri Jan 15 08:51:51 2010 +0000
@@ -74,7 +74,7 @@
                     long lumStride, long chromStride, long srcStride);
 void (*planar2x)(const uint8_t *src, uint8_t *dst, long width, long height,
                  long srcStride, long dstStride);
-void (*interleaveBytes)(uint8_t *src1, uint8_t *src2, uint8_t *dst,
+void (*interleaveBytes)(const uint8_t *src1, const uint8_t *src2, uint8_t *dst,
                         long width, long height, long src1Stride,
                         long src2Stride, long dstStride);
 void (*vu9_to_vu12)(const uint8_t *src1, const uint8_t *src2,
--- a/libswscale/rgb2rgb.h	Fri Jan 15 07:55:07 2010 +0000
+++ b/libswscale/rgb2rgb.h	Fri Jan 15 08:51:51 2010 +0000
@@ -126,7 +126,7 @@
 extern void (*planar2x)(const uint8_t *src, uint8_t *dst, long width, long height,
                         long srcStride, long dstStride);
 
-extern void (*interleaveBytes)(uint8_t *src1, uint8_t *src2, uint8_t *dst,
+extern void (*interleaveBytes)(const uint8_t *src1, const uint8_t *src2, uint8_t *dst,
                                long width, long height, long src1Stride,
                                long src2Stride, long dstStride);
 
--- a/libswscale/rgb2rgb_template.c	Fri Jan 15 07:55:07 2010 +0000
+++ b/libswscale/rgb2rgb_template.c	Fri Jan 15 08:51:51 2010 +0000
@@ -2352,7 +2352,7 @@
     }
 }
 
-static void RENAME(interleaveBytes)(uint8_t *src1, uint8_t *src2, uint8_t *dest,
+static void RENAME(interleaveBytes)(const uint8_t *src1, const uint8_t *src2, uint8_t *dest,
                              long width, long height, long src1Stride,
                              long src2Stride, long dstStride)
 {
--- a/libswscale/swscale.c	Fri Jan 15 07:55:07 2010 +0000
+++ b/libswscale/swscale.c	Fri Jan 15 08:51:51 2010 +0000
@@ -1901,7 +1901,7 @@
 #endif //!CONFIG_RUNTIME_CPUDETECT
 }
 
-static int PlanarToNV12Wrapper(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY,
+static int PlanarToNV12Wrapper(SwsContext *c, const uint8_t* src[], int srcStride[], int srcSliceY,
                                int srcSliceH, uint8_t* dstParam[], int dstStride[])
 {
     uint8_t *dst=dstParam[0] + dstStride[0]*srcSliceY;
@@ -1927,7 +1927,7 @@
     return srcSliceH;
 }
 
-static int PlanarToYuy2Wrapper(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY,
+static int PlanarToYuy2Wrapper(SwsContext *c, const uint8_t* src[], int srcStride[], int srcSliceY,
                                int srcSliceH, uint8_t* dstParam[], int dstStride[])
 {
     uint8_t *dst=dstParam[0] + dstStride[0]*srcSliceY;
@@ -1937,7 +1937,7 @@
     return srcSliceH;
 }
 
-static int PlanarToUyvyWrapper(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY,
+static int PlanarToUyvyWrapper(SwsContext *c, const uint8_t* src[], int srcStride[], int srcSliceY,
                                int srcSliceH, uint8_t* dstParam[], int dstStride[])
 {
     uint8_t *dst=dstParam[0] + dstStride[0]*srcSliceY;
@@ -1947,7 +1947,7 @@
     return srcSliceH;
 }
 
-static int YUV422PToYuy2Wrapper(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY,
+static int YUV422PToYuy2Wrapper(SwsContext *c, const uint8_t* src[], int srcStride[], int srcSliceY,
                                 int srcSliceH, uint8_t* dstParam[], int dstStride[])
 {
     uint8_t *dst=dstParam[0] + dstStride[0]*srcSliceY;
@@ -1957,7 +1957,7 @@
     return srcSliceH;
 }
 
-static int YUV422PToUyvyWrapper(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY,
+static int YUV422PToUyvyWrapper(SwsContext *c, const uint8_t* src[], int srcStride[], int srcSliceY,
                                 int srcSliceH, uint8_t* dstParam[], int dstStride[])
 {
     uint8_t *dst=dstParam[0] + dstStride[0]*srcSliceY;
@@ -1967,7 +1967,7 @@
     return srcSliceH;
 }
 
-static int YUYV2YUV420Wrapper(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY,
+static int YUYV2YUV420Wrapper(SwsContext *c, const uint8_t* src[], int srcStride[], int srcSliceY,
                                int srcSliceH, uint8_t* dstParam[], int dstStride[])
 {
     uint8_t *ydst=dstParam[0] + dstStride[0]*srcSliceY;
@@ -1982,7 +1982,7 @@
     return srcSliceH;
 }
 
-static int YUYV2YUV422Wrapper(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY,
+static int YUYV2YUV422Wrapper(SwsContext *c, const uint8_t* src[], int srcStride[], int srcSliceY,
                                int srcSliceH, uint8_t* dstParam[], int dstStride[])
 {
     uint8_t *ydst=dstParam[0] + dstStride[0]*srcSliceY;
@@ -1994,7 +1994,7 @@
     return srcSliceH;
 }
 
-static int UYVY2YUV420Wrapper(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY,
+static int UYVY2YUV420Wrapper(SwsContext *c, const uint8_t* src[], int srcStride[], int srcSliceY,
                                int srcSliceH, uint8_t* dstParam[], int dstStride[])
 {
     uint8_t *ydst=dstParam[0] + dstStride[0]*srcSliceY;
@@ -2009,7 +2009,7 @@
     return srcSliceH;
 }
 
-static int UYVY2YUV422Wrapper(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY,
+static int UYVY2YUV422Wrapper(SwsContext *c, const uint8_t* src[], int srcStride[], int srcSliceY,
                                int srcSliceH, uint8_t* dstParam[], int dstStride[])
 {
     uint8_t *ydst=dstParam[0] + dstStride[0]*srcSliceY;
@@ -2021,7 +2021,7 @@
     return srcSliceH;
 }
 
-static int pal2rgbWrapper(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY,
+static int pal2rgbWrapper(SwsContext *c, const uint8_t* src[], int srcStride[], int srcSliceY,
                           int srcSliceH, uint8_t* dst[], int dstStride[])
 {
     const enum PixelFormat srcFormat= c->srcFormat;
@@ -2030,7 +2030,7 @@
                  const uint8_t *palette)=NULL;
     int i;
     uint8_t *dstPtr= dst[0] + dstStride[0]*srcSliceY;
-    uint8_t *srcPtr= src[0];
+    const uint8_t *srcPtr= src[0];
 
     if (!usePal(srcFormat))
         av_log(c, AV_LOG_ERROR, "internal error %s -> %s converter\n",
@@ -2058,7 +2058,7 @@
 }
 
 /* {RGB,BGR}{15,16,24,32,32_1} -> {RGB,BGR}{15,16,24,32} */
-static int rgb2rgbWrapper(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY,
+static int rgb2rgbWrapper(SwsContext *c, const uint8_t* src[], int srcStride[], int srcSliceY,
                           int srcSliceH, uint8_t* dst[], int dstStride[])
 {
     const enum PixelFormat srcFormat= c->srcFormat;
@@ -2116,7 +2116,7 @@
     }
 
     if(conv) {
-        uint8_t *srcPtr= src[0];
+        const uint8_t *srcPtr= src[0];
         if(srcFormat == PIX_FMT_RGB32_1 || srcFormat == PIX_FMT_BGR32_1)
             srcPtr += ALT32_CORR;
 
@@ -2136,7 +2136,7 @@
     return srcSliceH;
 }
 
-static int bgr24toyv12Wrapper(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY,
+static int bgr24toyv12Wrapper(SwsContext *c, const uint8_t* src[], int srcStride[], int srcSliceY,
                               int srcSliceH, uint8_t* dst[], int dstStride[])
 {
 
@@ -2152,7 +2152,7 @@
     return srcSliceH;
 }
 
-static int yvu9toyv12Wrapper(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY,
+static int yvu9toyv12Wrapper(SwsContext *c, const const uint8_t* src[], int srcStride[], int srcSliceY,
                              int srcSliceH, uint8_t* dst[], int dstStride[])
 {
     int i;
@@ -2161,7 +2161,7 @@
     if (srcStride[0]==dstStride[0] && srcStride[0] > 0)
         memcpy(dst[0]+ srcSliceY*dstStride[0], src[0], srcStride[0]*srcSliceH);
     else {
-        uint8_t *srcPtr= src[0];
+        const uint8_t *srcPtr= src[0];
         uint8_t *dstPtr= dst[0] + dstStride[0]*srcSliceY;
 
         for (i=0; i<srcSliceH; i++) {
@@ -2188,14 +2188,14 @@
 }
 
 /* unscaled copy like stuff (assumes nearly identical formats) */
-static int packedCopy(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY,
+static int packedCopy(SwsContext *c, const uint8_t* src[], int srcStride[], int srcSliceY,
                       int srcSliceH, uint8_t* dst[], int dstStride[])
 {
     if (dstStride[0]==srcStride[0] && srcStride[0] > 0)
         memcpy(dst[0] + dstStride[0]*srcSliceY, src[0], srcSliceH*dstStride[0]);
     else {
         int i;
-        uint8_t *srcPtr= src[0];
+        const uint8_t *srcPtr= src[0];
         uint8_t *dstPtr= dst[0] + dstStride[0]*srcSliceY;
         int length=0;
 
@@ -2213,7 +2213,7 @@
     return srcSliceH;
 }
 
-static int planarCopy(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY,
+static int planarCopy(SwsContext *c, const uint8_t* src[], int srcStride[], int srcSliceY,
                       int srcSliceH, uint8_t* dst[], int dstStride[])
 {
     int plane, i, j;
@@ -2221,7 +2221,7 @@
         int length= (plane==0 || plane==3) ? c->srcW  : -((-c->srcW  )>>c->chrDstHSubSample);
         int y=      (plane==0 || plane==3) ? srcSliceY: -((-srcSliceY)>>c->chrDstVSubSample);
         int height= (plane==0 || plane==3) ? srcSliceH: -((-srcSliceH)>>c->chrDstVSubSample);
-        uint8_t *srcPtr= src[plane];
+        const uint8_t *srcPtr= src[plane];
         uint8_t *dstPtr= dst[plane] + dstStride[plane]*y;
 
         if (!dst[plane]) continue;
@@ -2928,7 +2928,7 @@
     return NULL;
 }
 
-static void reset_ptr(uint8_t* src[], int format)
+static void reset_ptr(const uint8_t* src[], int format)
 {
     if(!isALPHA(format))
         src[3]=NULL;
@@ -2948,11 +2948,11 @@
  * swscale wrapper, so we don't need to export the SwsContext.
  * Assumes planar YUV to be in YUV order instead of YVU.
  */
-int sws_scale(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY,
+int sws_scale(SwsContext *c, const uint8_t* src[], int srcStride[], int srcSliceY,
               int srcSliceH, uint8_t* dst[], int dstStride[])
 {
     int i;
-    uint8_t* src2[4]= {src[0], src[1], src[2], src[3]};
+    const uint8_t* src2[4]= {src[0], src[1], src[2], src[3]};
     uint8_t* dst2[4]= {dst[0], dst[1], dst[2], dst[3]};
 
     // do not mess up sliceDir if we have a "trailing" 0-size slice
@@ -3035,7 +3035,7 @@
         int dstStride2[4]= {dstStride[0], dstStride[1], dstStride[2], dstStride[3]};
 
         reset_ptr(src2, c->srcFormat);
-        reset_ptr(dst2, c->dstFormat);
+        reset_ptr((const uint8_t**)dst2, c->dstFormat);
 
         /* reset slice direction at end of frame */
         if (srcSliceY + srcSliceH == c->srcH)
@@ -3058,7 +3058,7 @@
         dst2[3] += ( c->dstH                      -1)*dstStride[3];
 
         reset_ptr(src2, c->srcFormat);
-        reset_ptr(dst2, c->dstFormat);
+        reset_ptr((const uint8_t**)dst2, c->dstFormat);
 
         /* reset slice direction at end of frame */
         if (!srcSliceY)
@@ -3069,7 +3069,7 @@
 }
 
 #if LIBSWSCALE_VERSION_MAJOR < 1
-int sws_scale_ordered(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY,
+int sws_scale_ordered(SwsContext *c, const uint8_t* src[], int srcStride[], int srcSliceY,
                       int srcSliceH, uint8_t* dst[], int dstStride[])
 {
     return sws_scale(c, src, srcStride, srcSliceY, srcSliceH, dst, dstStride);
--- a/libswscale/swscale.h	Fri Jan 15 07:55:07 2010 +0000
+++ b/libswscale/swscale.h	Fri Jan 15 08:51:51 2010 +0000
@@ -184,13 +184,13 @@
  *                  the destination image
  * @return          the height of the output slice
  */
-int sws_scale(struct SwsContext *context, uint8_t* srcSlice[], int srcStride[],
+int sws_scale(struct SwsContext *context, const uint8_t* srcSlice[], int srcStride[],
               int srcSliceY, int srcSliceH, uint8_t* dst[], int dstStride[]);
 #if LIBSWSCALE_VERSION_MAJOR < 1
 /**
  * @deprecated Use sws_scale() instead.
  */
-int sws_scale_ordered(struct SwsContext *context, uint8_t* src[],
+int sws_scale_ordered(struct SwsContext *context, const uint8_t* src[],
                       int srcStride[], int srcSliceY, int srcSliceH,
                       uint8_t* dst[], int dstStride[]) attribute_deprecated;
 #endif
--- a/libswscale/swscale_internal.h	Fri Jan 15 07:55:07 2010 +0000
+++ b/libswscale/swscale_internal.h	Fri Jan 15 08:51:51 2010 +0000
@@ -59,7 +59,7 @@
 
 struct SwsContext;
 
-typedef int (*SwsFunc)(struct SwsContext *context, uint8_t* src[],
+typedef int (*SwsFunc)(struct SwsContext *context, const uint8_t* src[],
                        int srcStride[], int srcSliceY, int srcSliceH,
                        uint8_t* dst[], int dstStride[]);
 
--- a/libswscale/swscale_template.c	Fri Jan 15 07:55:07 2010 +0000
+++ b/libswscale/swscale_template.c	Fri Jan 15 08:51:51 2010 +0000
@@ -954,7 +954,7 @@
 #if COMPILE_TEMPLATE_MMX
     if(!(c->flags & SWS_BITEXACT)) {
         long p= 4;
-        uint8_t *src[4]= {alpSrc + dstW, lumSrc + dstW, chrSrc + chrDstW, chrSrc + VOFW + chrDstW};
+        const uint8_t *src[4]= {alpSrc + dstW, lumSrc + dstW, chrSrc + chrDstW, chrSrc + VOFW + chrDstW};
         uint8_t *dst[4]= {aDest, dest, uDest, vDest};
         x86_reg counter[4]= {dstW, dstW, chrDstW, chrDstW};
 
@@ -1235,8 +1235,8 @@
                     : "%r8"
                 );
 #else
-                *(uint16_t **)(&c->u_temp)=abuf0;
-                *(uint16_t **)(&c->v_temp)=abuf1;
+                *(const uint16_t **)(&c->u_temp)=abuf0;
+                *(const uint16_t **)(&c->v_temp)=abuf1;
                 __asm__ volatile(
                     "mov %%"REG_b", "ESP_OFFSET"(%5)        \n\t"
                     "mov        %4, %%"REG_b"               \n\t"
@@ -2145,7 +2145,7 @@
 #endif
         );
     } else {
-        uint8_t *offset = src+filterSize;
+        const uint8_t *offset = src+filterSize;
         x86_reg counter= -2*dstW;
         //filter-= counter*filterSize/2;
         filterPos-= counter/2;
@@ -2554,7 +2554,7 @@
 #define DEBUG_SWSCALE_BUFFERS 0
 #define DEBUG_BUFFERS(...) if (DEBUG_SWSCALE_BUFFERS) av_log(c, AV_LOG_DEBUG, __VA_ARGS__)
 
-static int RENAME(swScale)(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY,
+static int RENAME(swScale)(SwsContext *c, const uint8_t* src[], int srcStride[], int srcSliceY,
                            int srcSliceH, uint8_t* dst[], int dstStride[])
 {
     /* load a few things into local vars to make the code more readable? and faster */
@@ -2677,8 +2677,8 @@
 
         //Do horizontal scaling
         while(lastInLumBuf < lastLumSrcY) {
-            uint8_t *src1= src[0]+(lastInLumBuf + 1 - srcSliceY)*srcStride[0];
-            uint8_t *src2= src[3]+(lastInLumBuf + 1 - srcSliceY)*srcStride[3];
+            const uint8_t *src1= src[0]+(lastInLumBuf + 1 - srcSliceY)*srcStride[0];
+            const uint8_t *src2= src[3]+(lastInLumBuf + 1 - srcSliceY)*srcStride[3];
             lumBufIndex++;
             DEBUG_BUFFERS("\t\tlumBufIndex %d: lastInLumBuf: %d\n",
                                lumBufIndex,    lastInLumBuf);
@@ -2697,8 +2697,8 @@
             lastInLumBuf++;
         }
         while(lastInChrBuf < lastChrSrcY) {
-            uint8_t *src1= src[1]+(lastInChrBuf + 1 - chrSrcSliceY)*srcStride[1];
-            uint8_t *src2= src[2]+(lastInChrBuf + 1 - chrSrcSliceY)*srcStride[2];
+            const uint8_t *src1= src[1]+(lastInChrBuf + 1 - chrSrcSliceY)*srcStride[1];
+            const uint8_t *src2= src[2]+(lastInChrBuf + 1 - chrSrcSliceY)*srcStride[2];
             chrBufIndex++;
             DEBUG_BUFFERS("\t\tchrBufIndex %d: lastInChrBuf: %d\n",
                                chrBufIndex,    lastInChrBuf);
@@ -2737,21 +2737,21 @@
             if (flags & SWS_ACCURATE_RND) {
                 int s= APCK_SIZE / 8;
                 for (i=0; i<vLumFilterSize; i+=2) {
-                    *(void**)&lumMmxFilter[s*i              ]= lumSrcPtr[i  ];
-                    *(void**)&lumMmxFilter[s*i+APCK_PTR2/4  ]= lumSrcPtr[i+(vLumFilterSize>1)];
+                    *(const void**)&lumMmxFilter[s*i              ]= lumSrcPtr[i  ];
+                    *(const void**)&lumMmxFilter[s*i+APCK_PTR2/4  ]= lumSrcPtr[i+(vLumFilterSize>1)];
                               lumMmxFilter[s*i+APCK_COEF/4  ]=
                               lumMmxFilter[s*i+APCK_COEF/4+1]= vLumFilter[dstY*vLumFilterSize + i    ]
                         + (vLumFilterSize>1 ? vLumFilter[dstY*vLumFilterSize + i + 1]<<16 : 0);
                     if (CONFIG_SWSCALE_ALPHA && alpPixBuf) {
-                        *(void**)&alpMmxFilter[s*i              ]= alpSrcPtr[i  ];
-                        *(void**)&alpMmxFilter[s*i+APCK_PTR2/4  ]= alpSrcPtr[i+(vLumFilterSize>1)];
+                        *(const void**)&alpMmxFilter[s*i              ]= alpSrcPtr[i  ];
+                        *(const void**)&alpMmxFilter[s*i+APCK_PTR2/4  ]= alpSrcPtr[i+(vLumFilterSize>1)];
                                   alpMmxFilter[s*i+APCK_COEF/4  ]=
                                   alpMmxFilter[s*i+APCK_COEF/4+1]= lumMmxFilter[s*i+APCK_COEF/4  ];
                     }
                 }
                 for (i=0; i<vChrFilterSize; i+=2) {
-                    *(void**)&chrMmxFilter[s*i              ]= chrSrcPtr[i  ];
-                    *(void**)&chrMmxFilter[s*i+APCK_PTR2/4  ]= chrSrcPtr[i+(vChrFilterSize>1)];
+                    *(const void**)&chrMmxFilter[s*i              ]= chrSrcPtr[i  ];
+                    *(const void**)&chrMmxFilter[s*i+APCK_PTR2/4  ]= chrSrcPtr[i+(vChrFilterSize>1)];
                               chrMmxFilter[s*i+APCK_COEF/4  ]=
                               chrMmxFilter[s*i+APCK_COEF/4+1]= vChrFilter[chrDstY*vChrFilterSize + i    ]
                         + (vChrFilterSize>1 ? vChrFilter[chrDstY*vChrFilterSize + i + 1]<<16 : 0);
@@ -2796,9 +2796,9 @@
                                   alpSrcPtr, (uint16_t *) dest, (uint16_t *) uDest, (uint16_t *) vDest, (uint16_t *) aDest, dstW, chrDstW,
                                   dstFormat);
                 } else if (vLumFilterSize == 1 && vChrFilterSize == 1) { // unscaled YV12
-                    int16_t *lumBuf = lumSrcPtr[0];
-                    int16_t *chrBuf= chrSrcPtr[0];
-                    int16_t *alpBuf= (CONFIG_SWSCALE_ALPHA && alpPixBuf) ? alpSrcPtr[0] : NULL;
+                    const int16_t *lumBuf = lumSrcPtr[0];
+                    const int16_t *chrBuf= chrSrcPtr[0];
+                    const int16_t *alpBuf= (CONFIG_SWSCALE_ALPHA && alpPixBuf) ? alpSrcPtr[0] : NULL;
                     c->yuv2yuv1(c, lumBuf, chrBuf, alpBuf, dest, uDest, vDest, aDest, dstW, chrDstW);
                 } else { //General YV12
                     c->yuv2yuvX(c,
--- a/libswscale/x86/yuv2rgb_template.c	Fri Jan 15 07:55:07 2010 +0000
+++ b/libswscale/x86/yuv2rgb_template.c	Fri Jan 15 08:51:51 2010 +0000
@@ -134,9 +134,9 @@
     __asm__ volatile ("pxor %mm4, %mm4;" /* zero mm4 */ );    \
     for (y= 0; y<srcSliceH; y++ ) {                           \
         uint8_t *image = dst[0] + (y+srcSliceY)*dstStride[0]; \
-        uint8_t *py = src[0] + y*srcStride[0];                \
-        uint8_t *pu = src[1] + (y>>1)*srcStride[1];           \
-        uint8_t *pv = src[2] + (y>>1)*srcStride[2];           \
+        const uint8_t *py = src[0] + y*srcStride[0];          \
+        const uint8_t *pu = src[1] + (y>>1)*srcStride[1];     \
+        const uint8_t *pv = src[2] + (y>>1)*srcStride[2];     \
         x86_reg index= -h_size/2;                                \
 
 #define YUV2RGB_INIT                                                       \
@@ -179,7 +179,7 @@
     __asm__ volatile (SFENCE"\n\t"EMMS); \
     return srcSliceH; \
 
-static inline int RENAME(yuv420_rgb16)(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY,
+static inline int RENAME(yuv420_rgb16)(SwsContext *c, const uint8_t* src[], int srcStride[], int srcSliceY,
                                        int srcSliceH, uint8_t* dst[], int dstStride[])
 {
     int y, h_size;
@@ -236,7 +236,7 @@
     YUV2RGB_OPERANDS
 }
 
-static inline int RENAME(yuv420_rgb15)(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY,
+static inline int RENAME(yuv420_rgb15)(SwsContext *c, const uint8_t* src[], int srcStride[], int srcSliceY,
                                        int srcSliceH, uint8_t* dst[], int dstStride[])
 {
     int y, h_size;
@@ -396,7 +396,7 @@
         "pxor      %%mm4, %%mm4     \n\t"
 #endif
 
-static inline int RENAME(yuv420_rgb24)(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY,
+static inline int RENAME(yuv420_rgb24)(SwsContext *c, const uint8_t* src[], int srcStride[], int srcSliceY,
                                        int srcSliceH, uint8_t* dst[], int dstStride[])
 {
     int y, h_size;
@@ -413,7 +413,7 @@
     YUV2RGB_OPERANDS
 }
 
-static inline int RENAME(yuv420_bgr24)(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY,
+static inline int RENAME(yuv420_bgr24)(SwsContext *c, const uint8_t* src[], int srcStride[], int srcSliceY,
                                        int srcSliceH, uint8_t* dst[], int dstStride[])
 {
     int y, h_size;
@@ -491,7 +491,7 @@
     "pxor         %%mm4, %%mm4;" /* zero mm4 */                         \
     "movq 8 (%5, %0, 2), %%mm6;" /* Load 8 Y Y7 Y6 Y5 Y4 Y3 Y2 Y1 Y0 */ \
 
-static inline int RENAME(yuv420_rgb32)(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY,
+static inline int RENAME(yuv420_rgb32)(SwsContext *c, const uint8_t* src[], int srcStride[], int srcSliceY,
                                        int srcSliceH, uint8_t* dst[], int dstStride[])
 {
     int y, h_size;
@@ -508,7 +508,7 @@
     YUV2RGB_OPERANDS
 }
 
-static inline int RENAME(yuva420_rgb32)(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY,
+static inline int RENAME(yuva420_rgb32)(SwsContext *c, const uint8_t* src[], int srcStride[], int srcSliceY,
                                         int srcSliceH, uint8_t* dst[], int dstStride[])
 {
 #if HAVE_7REGS
@@ -516,7 +516,7 @@
 
     YUV2RGB_LOOP(4)
 
-        uint8_t *pa = src[3] + y*srcStride[3];
+        const uint8_t *pa = src[3] + y*srcStride[3];
         YUV2RGB_INIT
         YUV2RGB
         "movq     (%6, %0, 2), %%mm3;"            /* Load 8 A A7 A6 A5 A4 A3 A2 A1 A0 */
@@ -527,7 +527,7 @@
 #endif
 }
 
-static inline int RENAME(yuv420_bgr32)(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY,
+static inline int RENAME(yuv420_bgr32)(SwsContext *c, const uint8_t* src[], int srcStride[], int srcSliceY,
                                        int srcSliceH, uint8_t* dst[], int dstStride[])
 {
     int y, h_size;
@@ -544,7 +544,7 @@
     YUV2RGB_OPERANDS
 }
 
-static inline int RENAME(yuva420_bgr32)(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY,
+static inline int RENAME(yuva420_bgr32)(SwsContext *c, const uint8_t* src[], int srcStride[], int srcSliceY,
                                         int srcSliceH, uint8_t* dst[], int dstStride[])
 {
 #if HAVE_7REGS
@@ -552,7 +552,7 @@
 
     YUV2RGB_LOOP(4)
 
-        uint8_t *pa = src[3] + y*srcStride[3];
+        const uint8_t *pa = src[3] + y*srcStride[3];
         YUV2RGB_INIT
         YUV2RGB
         "movq     (%6, %0, 2), %%mm3;"            /* Load 8 A A7 A6 A5 A4 A3 A2 A1 A0 */
--- a/libswscale/yuv2rgb.c	Fri Jan 15 07:55:07 2010 +0000
+++ b/libswscale/yuv2rgb.c	Fri Jan 15 08:51:51 2010 +0000
@@ -91,7 +91,7 @@
     dst[12*i+10] = dst[12*i+11] = b[Y];
 
 #define YUV2RGBFUNC(func_name, dst_type, alpha) \
-static int func_name(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY, \
+static int func_name(SwsContext *c, const uint8_t* src[], int srcStride[], int srcSliceY, \
                      int srcSliceH, uint8_t* dst[], int dstStride[]) \
 {\
     int y;\
@@ -105,11 +105,11 @@
         dst_type *dst_2 = (dst_type*)(dst[0] + (y+srcSliceY+1)*dstStride[0]);\
         dst_type av_unused *r, *b;\
         dst_type *g;\
-        uint8_t *py_1 = src[0] + y*srcStride[0];\
-        uint8_t *py_2 = py_1 + srcStride[0];\
-        uint8_t *pu = src[1] + (y>>1)*srcStride[1];\
-        uint8_t *pv = src[2] + (y>>1)*srcStride[2];\
-        uint8_t av_unused *pa_1, *pa_2;\
+        const uint8_t *py_1 = src[0] + y*srcStride[0];\
+        const uint8_t *py_2 = py_1 + srcStride[0];\
+        const uint8_t *pu = src[1] + (y>>1)*srcStride[1];\
+        const uint8_t *pv = src[2] + (y>>1)*srcStride[2];\
+        const uint8_t av_unused *pa_1, *pa_2;\
         unsigned int h_size = c->dstW>>3;\
         if (alpha) {\
             pa_1 = src[3] + y*srcStride[3];\