From 8b6298459d6d2c6eec8205b2b7fef8ccf47aba04 Mon Sep 17 00:00:00 2001 From: ramiro Date: Sat, 4 Apr 2009 22:41:46 +0000 Subject: swscale: Add const to some swScale functions' parameters. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@29143 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libswscale/swscale.c | 24 ++++----- libswscale/swscale_template.c | 118 +++++++++++++++++++++--------------------- 2 files changed, 72 insertions(+), 70 deletions(-) diff --git a/libswscale/swscale.c b/libswscale/swscale.c index 316f4517e4..a226c1f2a1 100644 --- a/libswscale/swscale.c +++ b/libswscale/swscale.c @@ -472,9 +472,9 @@ const char *sws_format_name(enum PixelFormat format) } } -static inline void yuv2yuvXinC(int16_t *lumFilter, int16_t **lumSrc, int lumFilterSize, - int16_t *chrFilter, int16_t **chrSrc, int chrFilterSize, - int16_t **alpSrc, uint8_t *dest, uint8_t *uDest, uint8_t *vDest, uint8_t *aDest, int dstW, int chrDstW) +static inline void yuv2yuvXinC(const int16_t *lumFilter, const int16_t **lumSrc, int lumFilterSize, + const int16_t *chrFilter, const int16_t **chrSrc, int chrFilterSize, + const int16_t **alpSrc, uint8_t *dest, uint8_t *uDest, uint8_t *vDest, uint8_t *aDest, int dstW, int chrDstW) { //FIXME Optimize (just quickly written not optimized..) int i; @@ -516,8 +516,8 @@ static inline void yuv2yuvXinC(int16_t *lumFilter, int16_t **lumSrc, int lumFilt } -static inline void yuv2nv12XinC(int16_t *lumFilter, int16_t **lumSrc, int lumFilterSize, - int16_t *chrFilter, int16_t **chrSrc, int chrFilterSize, +static inline void yuv2nv12XinC(const int16_t *lumFilter, const int16_t **lumSrc, int lumFilterSize, + const int16_t *chrFilter, const int16_t **chrSrc, int chrFilterSize, uint8_t *dest, uint8_t *uDest, int dstW, int chrDstW, int dstFormat) { //FIXME Optimize (just quickly written not optimized..) @@ -993,17 +993,17 @@ static inline void yuv2nv12XinC(int16_t *lumFilter, int16_t **lumSrc, int lumFil }\ -static inline void yuv2packedXinC(SwsContext *c, int16_t *lumFilter, int16_t **lumSrc, int lumFilterSize, - int16_t *chrFilter, int16_t **chrSrc, int chrFilterSize, - int16_t **alpSrc, uint8_t *dest, int dstW, int y) +static inline void yuv2packedXinC(SwsContext *c, const int16_t *lumFilter, const int16_t **lumSrc, int lumFilterSize, + const int16_t *chrFilter, const int16_t **chrSrc, int chrFilterSize, + const int16_t **alpSrc, uint8_t *dest, int dstW, int y) { int i; YSCALE_YUV_2_ANYRGB_C(YSCALE_YUV_2_RGBX_C, YSCALE_YUV_2_PACKEDX_C(void,0), YSCALE_YUV_2_GRAY16_C, YSCALE_YUV_2_MONOX_C) } -static inline void yuv2rgbXinC_full(SwsContext *c, int16_t *lumFilter, int16_t **lumSrc, int lumFilterSize, - int16_t *chrFilter, int16_t **chrSrc, int chrFilterSize, - int16_t **alpSrc, uint8_t *dest, int dstW, int y) +static inline void yuv2rgbXinC_full(SwsContext *c, const int16_t *lumFilter, const int16_t **lumSrc, int lumFilterSize, + const int16_t *chrFilter, const int16_t **chrSrc, int chrFilterSize, + const int16_t **alpSrc, uint8_t *dest, int dstW, int y) { int i; int step= fmt_depth(c->dstFormat)/8; @@ -1823,7 +1823,7 @@ static int PlanarToNV12Wrapper(SwsContext *c, uint8_t* src[], int srcStride[], i else { int i; - uint8_t *srcPtr= src[0]; + const uint8_t *srcPtr= src[0]; uint8_t *dstPtr= dst; for (i=0; i>shb)&maskb;\ - int g= (((type*)src)[i]>>shg)&maskg;\ - int r= (((type*)src)[i]>>shr)&maskr;\ + int b= (((const type*)src)[i]>>shb)&maskb;\ + int g= (((const type*)src)[i]>>shg)&maskg;\ + int r= (((const type*)src)[i]>>shr)&maskr;\ \ dst[i]= (((RY)*r + (GY)*g + (BY)*b + (33<<((S)-1)))>>(S));\ }\ @@ -1753,7 +1753,7 @@ BGR2Y(uint16_t, bgr15ToY, 0, 0, 0, 0x001F, 0x03E0, 0x7C00, RY<<10, GY<<5, BY BGR2Y(uint16_t, rgb16ToY, 0, 0, 0, 0xF800, 0x07E0, 0x001F, RY , GY<<5, BY<<11, RGB2YUV_SHIFT+8) BGR2Y(uint16_t, rgb15ToY, 0, 0, 0, 0x7C00, 0x03E0, 0x001F, RY , GY<<5, BY<<10, RGB2YUV_SHIFT+7) -static inline void RENAME(abgrToA)(uint8_t *dst, uint8_t *src, long width, uint32_t *unused){ +static inline void RENAME(abgrToA)(uint8_t *dst, const uint8_t *src, long width, uint32_t *unused){ int i; for (i=0; i>shb;\ - int g= (((type*)src)[i]&maskg)>>shg;\ - int r= (((type*)src)[i]&maskr)>>shr;\ + int b= (((const type*)src)[i]&maskb)>>shb;\ + int g= (((const type*)src)[i]&maskg)>>shg;\ + int r= (((const type*)src)[i]&maskr)>>shr;\ \ dstU[i]= ((RU)*r + (GU)*g + (BU)*b + (257<<((S)-1)))>>(S);\ dstV[i]= ((RV)*r + (GV)*g + (BV)*b + (257<<((S)-1)))>>(S);\ }\ }\ -static inline void RENAME(name ## _half)(uint8_t *dstU, uint8_t *dstV, uint8_t *src, uint8_t *dummy, long width, uint32_t *unused)\ +static inline void RENAME(name ## _half)(uint8_t *dstU, uint8_t *dstV, const uint8_t *src, const uint8_t *dummy, long width, uint32_t *unused)\ {\ int i;\ for (i=0; i>shb;\ int r= ((pix0+pix1-g)&(maskr|(2*maskr)))>>shr;\ @@ -1801,7 +1801,7 @@ BGR2UV(uint16_t, rgb16ToUV, 0, 0, 0, 0, 0xF800, 0x07E0, 0x001F, RU BGR2UV(uint16_t, rgb15ToUV, 0, 0, 0, 0, 0x7C00, 0x03E0, 0x001F, RU , GU<<5, BU<<10, RV , GV<<5, BV<<10, RGB2YUV_SHIFT+7) #if HAVE_MMX -static inline void RENAME(bgr24ToY_mmx)(uint8_t *dst, uint8_t *src, long width, int srcFormat) +static inline void RENAME(bgr24ToY_mmx)(uint8_t *dst, const uint8_t *src, long width, int srcFormat) { if(srcFormat == PIX_FMT_BGR24){ @@ -1854,7 +1854,7 @@ static inline void RENAME(bgr24ToY_mmx)(uint8_t *dst, uint8_t *src, long width, ); } -static inline void RENAME(bgr24ToUV_mmx)(uint8_t *dstU, uint8_t *dstV, uint8_t *src, long width, int srcFormat) +static inline void RENAME(bgr24ToUV_mmx)(uint8_t *dstU, uint8_t *dstV, const uint8_t *src, long width, int srcFormat) { __asm__ volatile( "movq 24+%4, %%mm6 \n\t" @@ -1913,7 +1913,7 @@ static inline void RENAME(bgr24ToUV_mmx)(uint8_t *dstU, uint8_t *dstV, uint8_t * } #endif -static inline void RENAME(bgr24ToY)(uint8_t *dst, uint8_t *src, long width, uint32_t *unused) +static inline void RENAME(bgr24ToY)(uint8_t *dst, const uint8_t *src, long width, uint32_t *unused) { #if HAVE_MMX RENAME(bgr24ToY_mmx)(dst, src, width, PIX_FMT_BGR24); @@ -1930,7 +1930,7 @@ static inline void RENAME(bgr24ToY)(uint8_t *dst, uint8_t *src, long width, uint #endif /* HAVE_MMX */ } -static inline void RENAME(bgr24ToUV)(uint8_t *dstU, uint8_t *dstV, uint8_t *src1, uint8_t *src2, long width, uint32_t *unused) +static inline void RENAME(bgr24ToUV)(uint8_t *dstU, uint8_t *dstV, const uint8_t *src1, const uint8_t *src2, long width, uint32_t *unused) { #if HAVE_MMX RENAME(bgr24ToUV_mmx)(dstU, dstV, src1, width, PIX_FMT_BGR24); @@ -1949,7 +1949,7 @@ static inline void RENAME(bgr24ToUV)(uint8_t *dstU, uint8_t *dstV, uint8_t *src1 assert(src1 == src2); } -static inline void RENAME(bgr24ToUV_half)(uint8_t *dstU, uint8_t *dstV, uint8_t *src1, uint8_t *src2, long width, uint32_t *unused) +static inline void RENAME(bgr24ToUV_half)(uint8_t *dstU, uint8_t *dstV, const uint8_t *src1, const uint8_t *src2, long width, uint32_t *unused) { int i; for (i=0; i0); @@ -2245,7 +2247,7 @@ static inline void RENAME(hScale)(int16_t *dst, int dstW, uint8_t *src, int srcW } static inline void RENAME(hyscale_fast)(SwsContext *c, int16_t *dst, - int dstWidth, uint8_t *src, int srcW, + int dstWidth, const uint8_t *src, int srcW, int xInc) { int i; @@ -2260,9 +2262,9 @@ static inline void RENAME(hyscale_fast)(SwsContext *c, int16_t *dst, } // *** horizontal scale Y line to temp buffer -static inline void RENAME(hyscale)(SwsContext *c, uint16_t *dst, long dstWidth, uint8_t *src, int srcW, int xInc, - int flags, int16_t *hLumFilter, - int16_t *hLumFilterPos, int hLumFilterSize, +static inline void RENAME(hyscale)(SwsContext *c, uint16_t *dst, long dstWidth, const uint8_t *src, int srcW, int xInc, + int flags, const int16_t *hLumFilter, + const int16_t *hLumFilterPos, int hLumFilterSize, int srcFormat, uint8_t *formatConvBuffer, uint32_t *pal, int isAlpha) { @@ -2505,8 +2507,8 @@ FUNNY_Y_CODE } static inline void RENAME(hcscale_fast)(SwsContext *c, int16_t *dst, - int dstWidth, uint8_t *src1, - uint8_t *src2, int srcW, int xInc) + int dstWidth, const uint8_t *src1, + const uint8_t *src2, int srcW, int xInc) { int i; unsigned int xpos=0; @@ -2524,9 +2526,9 @@ static inline void RENAME(hcscale_fast)(SwsContext *c, int16_t *dst, } } -inline static void RENAME(hcscale)(SwsContext *c, uint16_t *dst, long dstWidth, uint8_t *src1, uint8_t *src2, - int srcW, int xInc, int flags, int16_t *hChrFilter, - int16_t *hChrFilterPos, int hChrFilterSize, +inline static void RENAME(hcscale)(SwsContext *c, uint16_t *dst, long dstWidth, const uint8_t *src1, const uint8_t *src2, + int srcW, int xInc, int flags, const int16_t *hChrFilter, + const int16_t *hChrFilterPos, int hChrFilterSize, int srcFormat, uint8_t *formatConvBuffer, uint32_t *pal) { @@ -3039,9 +3041,9 @@ static int RENAME(swScale)(SwsContext *c, uint8_t* src[], int srcStride[], int s #endif if (dstY < dstH-2) { - int16_t **lumSrcPtr= lumPixBuf + lumBufIndex + firstLumSrcY - lastInLumBuf + vLumBufSize; - int16_t **chrSrcPtr= chrPixBuf + chrBufIndex + firstChrSrcY - lastInChrBuf + vChrBufSize; - int16_t **alpSrcPtr= (CONFIG_SWSCALE_ALPHA && alpPixBuf) ? alpPixBuf + lumBufIndex + firstLumSrcY - lastInLumBuf + vLumBufSize : NULL; + const int16_t **lumSrcPtr= (const int16_t **) lumPixBuf + lumBufIndex + firstLumSrcY - lastInLumBuf + vLumBufSize; + const int16_t **chrSrcPtr= (const int16_t **) chrPixBuf + chrBufIndex + firstChrSrcY - lastInChrBuf + vChrBufSize; + const int16_t **alpSrcPtr= (CONFIG_SWSCALE_ALPHA && alpPixBuf) ? (const int16_t **) alpPixBuf + lumBufIndex + firstLumSrcY - lastInLumBuf + vLumBufSize : NULL; #if HAVE_MMX int i; if (flags & SWS_ACCURATE_RND){ @@ -3173,9 +3175,9 @@ static int RENAME(swScale)(SwsContext *c, uint8_t* src[], int srcStride[], int s } else // hmm looks like we can't use MMX here without overwriting this array's tail { - int16_t **lumSrcPtr= lumPixBuf + lumBufIndex + firstLumSrcY - lastInLumBuf + vLumBufSize; - int16_t **chrSrcPtr= chrPixBuf + chrBufIndex + firstChrSrcY - lastInChrBuf + vChrBufSize; - int16_t **alpSrcPtr= (CONFIG_SWSCALE_ALPHA && alpPixBuf) ? alpPixBuf + lumBufIndex + firstLumSrcY - lastInLumBuf + vLumBufSize : NULL; + const int16_t **lumSrcPtr= (const int16_t **)lumPixBuf + lumBufIndex + firstLumSrcY - lastInLumBuf + vLumBufSize; + const int16_t **chrSrcPtr= (const int16_t **)chrPixBuf + chrBufIndex + firstChrSrcY - lastInChrBuf + vChrBufSize; + const int16_t **alpSrcPtr= (CONFIG_SWSCALE_ALPHA && alpPixBuf) ? (const int16_t **)alpPixBuf + lumBufIndex + firstLumSrcY - lastInLumBuf + vLumBufSize : NULL; if (dstFormat == PIX_FMT_NV12 || dstFormat == PIX_FMT_NV21){ const int chrSkipMask= (1<chrDstVSubSample)-1; if (dstY&chrSkipMask) uDest= NULL; //FIXME split functions in lumi / chromi -- cgit v1.2.3