diff --git a/libswscale/rgb2rgb.c b/libswscale/rgb2rgb.c index d3c3f43bde..1dc728ab9d 100644 --- a/libswscale/rgb2rgb.c +++ b/libswscale/rgb2rgb.c @@ -74,7 +74,7 @@ void (*rgb24toyv12)(const uint8_t *src, uint8_t *ydst, uint8_t *udst, uint8_t *v 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, diff --git a/libswscale/rgb2rgb.h b/libswscale/rgb2rgb.h index 9d6e6df415..740b04e1cb 100644 --- a/libswscale/rgb2rgb.h +++ b/libswscale/rgb2rgb.h @@ -126,7 +126,7 @@ extern void (*rgb24toyv12)(const uint8_t *src, uint8_t *ydst, uint8_t *udst, uin 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); diff --git a/libswscale/rgb2rgb_template.c b/libswscale/rgb2rgb_template.c index cdb5c8e7c8..8d027c1d7a 100644 --- a/libswscale/rgb2rgb_template.c +++ b/libswscale/rgb2rgb_template.c @@ -2352,7 +2352,7 @@ static inline void RENAME(rgb24toyv12)(const uint8_t *src, uint8_t *ydst, uint8_ } } -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) { diff --git a/libswscale/swscale.c b/libswscale/swscale.c index 992ff3d71f..f525420f91 100644 --- a/libswscale/swscale.c +++ b/libswscale/swscale.c @@ -1901,7 +1901,7 @@ static SwsFunc getSwsFunc(SwsContext *c) #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 @@ static int PlanarToNV12Wrapper(SwsContext *c, uint8_t* src[], int srcStride[], i 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 @@ static int PlanarToYuy2Wrapper(SwsContext *c, uint8_t* src[], int srcStride[], i 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 @@ static int PlanarToUyvyWrapper(SwsContext *c, uint8_t* src[], int srcStride[], i 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 @@ static int YUV422PToYuy2Wrapper(SwsContext *c, uint8_t* src[], int srcStride[], 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 @@ static int YUV422PToUyvyWrapper(SwsContext *c, uint8_t* src[], int srcStride[], 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 @@ static int YUYV2YUV420Wrapper(SwsContext *c, uint8_t* src[], int srcStride[], in 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 @@ static int YUYV2YUV422Wrapper(SwsContext *c, uint8_t* src[], int srcStride[], in 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 @@ static int UYVY2YUV420Wrapper(SwsContext *c, uint8_t* src[], int srcStride[], in 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 @@ static int UYVY2YUV422Wrapper(SwsContext *c, uint8_t* src[], int srcStride[], in 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 @@ static int pal2rgbWrapper(SwsContext *c, uint8_t* src[], int srcStride[], int sr 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 @@ static int pal2rgbWrapper(SwsContext *c, uint8_t* src[], int srcStride[], int sr } /* {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 @@ static int rgb2rgbWrapper(SwsContext *c, uint8_t* src[], int srcStride[], int sr } 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 @@ static int rgb2rgbWrapper(SwsContext *c, uint8_t* src[], int srcStride[], int sr 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 @@ static int bgr24toyv12Wrapper(SwsContext *c, uint8_t* src[], int srcStride[], in 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 @@ static int yvu9toyv12Wrapper(SwsContext *c, uint8_t* src[], int srcStride[], int 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 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 @@ static int packedCopy(SwsContext *c, uint8_t* src[], int srcStride[], int srcSli 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 @@ static int planarCopy(SwsContext *c, uint8_t* src[], int srcStride[], int srcSli 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 @@ fail: 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 @@ static void reset_ptr(uint8_t* src[], int format) * 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 sws_scale(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY, 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 @@ int sws_scale(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY, 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 @@ int sws_scale(SwsContext *c, uint8_t* src[], int srcStride[], int srcSliceY, } #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); diff --git a/libswscale/swscale.h b/libswscale/swscale.h index 958d0244ae..878962384c 100644 --- a/libswscale/swscale.h +++ b/libswscale/swscale.h @@ -184,13 +184,13 @@ struct SwsContext *sws_getContext(int srcW, int srcH, enum PixelFormat srcFormat * 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 diff --git a/libswscale/swscale_internal.h b/libswscale/swscale_internal.h index a4e695604d..3db7a480c8 100644 --- a/libswscale/swscale_internal.h +++ b/libswscale/swscale_internal.h @@ -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[]); diff --git a/libswscale/swscale_template.c b/libswscale/swscale_template.c index f0d47798a7..160596aebc 100644 --- a/libswscale/swscale_template.c +++ b/libswscale/swscale_template.c @@ -954,7 +954,7 @@ static inline void RENAME(yuv2yuv1)(SwsContext *c, const int16_t *lumSrc, const #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 @@ static inline void RENAME(yuv2packed2)(SwsContext *c, const uint16_t *buf0, cons : "%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 @@ static inline void RENAME(hScale)(int16_t *dst, int dstW, const uint8_t *src, in #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 @@ inline static void RENAME(hcscale)(SwsContext *c, uint16_t *dst, long dstWidth, #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 @@ static int RENAME(swScale)(SwsContext *c, uint8_t* src[], int srcStride[], int s //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 @@ static int RENAME(swScale)(SwsContext *c, uint8_t* src[], int srcStride[], int s 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 @@ static int RENAME(swScale)(SwsContext *c, uint8_t* src[], int srcStride[], int s if (flags & SWS_ACCURATE_RND) { int s= APCK_SIZE / 8; for (i=0; i1)]; + *(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; i1)]; + *(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 @@ static int RENAME(swScale)(SwsContext *c, uint8_t* src[], int srcStride[], int s 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, diff --git a/libswscale/x86/yuv2rgb_template.c b/libswscale/x86/yuv2rgb_template.c index bdc347e799..ba906899f0 100644 --- a/libswscale/x86/yuv2rgb_template.c +++ b/libswscale/x86/yuv2rgb_template.c @@ -134,9 +134,9 @@ __asm__ volatile ("pxor %mm4, %mm4;" /* zero mm4 */ ); \ for (y= 0; 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 @@ static inline int RENAME(yuv420_rgb16)(SwsContext *c, uint8_t* src[], int srcStr 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 @@ static inline int RENAME(yuv420_rgb15)(SwsContext *c, uint8_t* src[], int srcStr "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 @@ static inline int RENAME(yuv420_rgb24)(SwsContext *c, uint8_t* src[], int srcStr 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 @@ etc. "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 @@ static inline int RENAME(yuv420_rgb32)(SwsContext *c, uint8_t* src[], int srcStr 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 @@ static inline int RENAME(yuva420_rgb32)(SwsContext *c, uint8_t* src[], int srcSt 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 @@ static inline int RENAME(yuva420_rgb32)(SwsContext *c, uint8_t* src[], int srcSt #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 @@ static inline int RENAME(yuv420_bgr32)(SwsContext *c, uint8_t* src[], int srcStr 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 @@ static inline int RENAME(yuva420_bgr32)(SwsContext *c, uint8_t* src[], int srcSt 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 */ diff --git a/libswscale/yuv2rgb.c b/libswscale/yuv2rgb.c index 2d53a5f4e6..5e20dc843a 100644 --- a/libswscale/yuv2rgb.c +++ b/libswscale/yuv2rgb.c @@ -91,7 +91,7 @@ const int32_t ff_yuv2rgb_coeffs[8][4] = { 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 @@ static int func_name(SwsContext *c, uint8_t* src[], int srcStride[], int srcSlic 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];\