From 2762ee30347afd3c1d2795a232c8b78d56a44b0f Mon Sep 17 00:00:00 2001 From: "Ronald S. Bultje" Date: Thu, 2 Jun 2011 22:34:13 -0700 Subject: [PATCH] swscale: cosmetics. Remove duplicate "inC" and "_c" functions that do the same thing; give each function that handles data and acts as a function pointer a "_c" suffix; remove "_c" suffix from functions that are inherently not optimizable. Remove inline keyword from functions that are only used through function pointers. --- libswscale/swscale.c | 496 ++++++++++++++++++++----------------------- 1 file changed, 236 insertions(+), 260 deletions(-) diff --git a/libswscale/swscale.c b/libswscale/swscale.c index 43d0d69055..56ceb13432 100644 --- a/libswscale/swscale.c +++ b/libswscale/swscale.c @@ -202,11 +202,14 @@ DECLARE_ALIGNED(8, const uint8_t, dither_8x8_220)[8][8]={ }; #endif -static av_always_inline void yuv2yuvX16inC_template(const int16_t *lumFilter, const int16_t **lumSrc, int lumFilterSize, - const int16_t *chrFilter, const int16_t **chrUSrc, - const int16_t **chrVSrc, int chrFilterSize, - const int16_t **alpSrc, uint16_t *dest, uint16_t *uDest, uint16_t *vDest, uint16_t *aDest, - int dstW, int chrDstW, int big_endian, int output_bits) +static av_always_inline void +yuv2yuvX16_c_template(const int16_t *lumFilter, const int16_t **lumSrc, + int lumFilterSize, const int16_t *chrFilter, + const int16_t **chrUSrc, const int16_t **chrVSrc, + int chrFilterSize, const int16_t **alpSrc, + uint16_t *dest, uint16_t *uDest, uint16_t *vDest, + uint16_t *aDest, int dstW, int chrDstW, + int big_endian, int output_bits) { //FIXME Optimize (just quickly written not optimized..) int i; @@ -274,11 +277,11 @@ static void yuv2yuvX ## bits ## BE_LE ## _c(const int16_t *lumFilter, \ uint16_t *dest, uint16_t *uDest, uint16_t *vDest, \ uint16_t *aDest, int dstW, int chrDstW) \ { \ - yuv2yuvX16inC_template(lumFilter, lumSrc, lumFilterSize, \ - chrFilter, chrUSrc, chrVSrc, chrFilterSize, \ - alpSrc, \ - dest, uDest, vDest, aDest, \ - dstW, chrDstW, is_be, bits); \ + yuv2yuvX16_c_template(lumFilter, lumSrc, lumFilterSize, \ + chrFilter, chrUSrc, chrVSrc, chrFilterSize, \ + alpSrc, \ + dest, uDest, vDest, aDest, \ + dstW, chrDstW, is_be, bits); \ } yuv2NBPS( 9, BE, 1); yuv2NBPS( 9, LE, 0); @@ -287,10 +290,10 @@ yuv2NBPS(10, LE, 0); yuv2NBPS(16, BE, 1); yuv2NBPS(16, LE, 0); -static inline void yuv2yuvX16inC(const int16_t *lumFilter, const int16_t **lumSrc, int lumFilterSize, - const int16_t *chrFilter, const int16_t **chrUSrc, const int16_t **chrVSrc, int chrFilterSize, - const int16_t **alpSrc, uint16_t *dest, uint16_t *uDest, uint16_t *vDest, uint16_t *aDest, int dstW, int chrDstW, - enum PixelFormat dstFormat) +static inline void yuv2yuvX16_c(const int16_t *lumFilter, const int16_t **lumSrc, int lumFilterSize, + const int16_t *chrFilter, const int16_t **chrUSrc, const int16_t **chrVSrc, int chrFilterSize, + const int16_t **alpSrc, uint16_t *dest, uint16_t *uDest, uint16_t *vDest, uint16_t *aDest, int dstW, int chrDstW, + enum PixelFormat dstFormat) { #define conv16(bits) \ if (isBE(dstFormat)) { \ @@ -316,10 +319,13 @@ static inline void yuv2yuvX16inC(const int16_t *lumFilter, const int16_t **lumSr #undef conv16 } -static inline void yuv2yuvXinC(const int16_t *lumFilter, const int16_t **lumSrc, int lumFilterSize, - const int16_t *chrFilter, const int16_t **chrUSrc, - const int16_t **chrVSrc, int chrFilterSize, - const int16_t **alpSrc, uint8_t *dest, uint8_t *uDest, uint8_t *vDest, uint8_t *aDest, int dstW, int chrDstW) +static inline void yuv2yuvX_c(SwsContext *c, const int16_t *lumFilter, + const int16_t **lumSrc, int lumFilterSize, + const int16_t *chrFilter, const int16_t **chrUSrc, + const int16_t **chrVSrc, + 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; @@ -358,10 +364,12 @@ static inline void yuv2yuvXinC(const int16_t *lumFilter, const int16_t **lumSrc, } -static inline void yuv2nv12XinC(const int16_t *lumFilter, const int16_t **lumSrc, int lumFilterSize, - const int16_t *chrFilter, const int16_t **chrUSrc, - const int16_t **chrVSrc, int chrFilterSize, - uint8_t *dest, uint8_t *uDest, int dstW, int chrDstW, int dstFormat) +static inline void yuv2nv12X_c(SwsContext *c, const int16_t *lumFilter, + const int16_t **lumSrc, int lumFilterSize, + const int16_t *chrFilter, const int16_t **chrUSrc, + const int16_t **chrVSrc, + int chrFilterSize, uint8_t *dest, uint8_t *uDest, + int dstW, int chrDstW, enum PixelFormat dstFormat) { //FIXME Optimize (just quickly written not optimized..) int i; @@ -870,21 +878,21 @@ static inline void yuv2nv12XinC(const int16_t *lumFilter, const int16_t **lumSrc break;\ } -static inline void yuv2packedXinC(SwsContext *c, const int16_t *lumFilter, - const int16_t **lumSrc, int lumFilterSize, - const int16_t *chrFilter, const int16_t **chrUSrc, - const int16_t **chrVSrc, int chrFilterSize, - const int16_t **alpSrc, uint8_t *dest, int dstW, int y) +static void yuv2packedX_c(SwsContext *c, const int16_t *lumFilter, + const int16_t **lumSrc, int lumFilterSize, + const int16_t *chrFilter, const int16_t **chrUSrc, + const int16_t **chrVSrc, 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, const int16_t *lumFilter, - const int16_t **lumSrc, int lumFilterSize, - const int16_t *chrFilter, const int16_t **chrUSrc, - const int16_t **chrVSrc, int chrFilterSize, - const int16_t **alpSrc, uint8_t *dest, int dstW, int y) +static inline void yuv2rgbX_c_full(SwsContext *c, const int16_t *lumFilter, + const int16_t **lumSrc, int lumFilterSize, + const int16_t *chrFilter, const int16_t **chrUSrc, + const int16_t **chrVSrc, int chrFilterSize, + const int16_t **alpSrc, uint8_t *dest, int dstW, int y) { int i; int step= c->dstFormatBpp/8; @@ -976,8 +984,8 @@ static void fillPlane(uint8_t* plane, int stride, int width, int height, int y, } } -static inline void rgb48ToY(uint8_t *dst, const uint8_t *src, int width, - uint32_t *unused) +static void rgb48ToY_c(uint8_t *dst, const uint8_t *src, int width, + uint32_t *unused) { int i; for (i = 0; i < width; i++) { @@ -989,9 +997,9 @@ static inline void rgb48ToY(uint8_t *dst, const uint8_t *src, int width, } } -static inline void rgb48ToUV(uint8_t *dstU, uint8_t *dstV, - const uint8_t *src1, const uint8_t *src2, - int width, uint32_t *unused) +static void rgb48ToUV_c(uint8_t *dstU, uint8_t *dstV, + const uint8_t *src1, const uint8_t *src2, + int width, uint32_t *unused) { int i; assert(src1==src2); @@ -1005,9 +1013,9 @@ static inline void rgb48ToUV(uint8_t *dstU, uint8_t *dstV, } } -static inline void rgb48ToUV_half(uint8_t *dstU, uint8_t *dstV, - const uint8_t *src1, const uint8_t *src2, - int width, uint32_t *unused) +static void rgb48ToUV_half_c(uint8_t *dstU, uint8_t *dstV, + const uint8_t *src1, const uint8_t *src2, + int width, uint32_t *unused) { int i; assert(src1==src2); @@ -1021,8 +1029,8 @@ static inline void rgb48ToUV_half(uint8_t *dstU, uint8_t *dstV, } } -static inline void bgr48ToY(uint8_t *dst, const uint8_t *src, int width, - uint32_t *unused) +static void bgr48ToY_c(uint8_t *dst, const uint8_t *src, int width, + uint32_t *unused) { int i; for (i = 0; i < width; i++) { @@ -1034,9 +1042,9 @@ static inline void bgr48ToY(uint8_t *dst, const uint8_t *src, int width, } } -static inline void bgr48ToUV(uint8_t *dstU, uint8_t *dstV, - const uint8_t *src1, const uint8_t *src2, - int width, uint32_t *unused) +static void bgr48ToUV_c(uint8_t *dstU, uint8_t *dstV, + const uint8_t *src1, const uint8_t *src2, + int width, uint32_t *unused) { int i; for (i = 0; i < width; i++) { @@ -1049,9 +1057,9 @@ static inline void bgr48ToUV(uint8_t *dstU, uint8_t *dstV, } } -static inline void bgr48ToUV_half(uint8_t *dstU, uint8_t *dstV, - const uint8_t *src1, const uint8_t *src2, - int width, uint32_t *unused) +static void bgr48ToUV_half_c(uint8_t *dstU, uint8_t *dstV, + const uint8_t *src1, const uint8_t *src2, + int width, uint32_t *unused) { int i; for (i = 0; i < width; i++) { @@ -1065,7 +1073,8 @@ static inline void bgr48ToUV_half(uint8_t *dstU, uint8_t *dstV, } #define BGR2Y(type, name, shr, shg, shb, maskr, maskg, maskb, RY, GY, BY, S)\ -static inline void name(uint8_t *dst, const uint8_t *src, int width, uint32_t *unused)\ +static void name ## _c(uint8_t *dst, const uint8_t *src, \ + int width, uint32_t *unused)\ {\ int i;\ for (i=0; i>(S);\ }\ }\ -static inline void name ## _half(uint8_t *dstU, uint8_t *dstV, const uint8_t *src, const uint8_t *dummy, int width, uint32_t *unused)\ +static void name ## _half_c(uint8_t *dstU, uint8_t *dstV, \ + const uint8_t *src, const uint8_t *dummy, \ + int width, uint32_t *unused)\ {\ int i;\ for (i=0; i>14; } -static inline void hyscale_fast_c(SwsContext *c, int16_t *dst, int dstWidth, - const uint8_t *src, int srcW, int xInc) +static void hyscale_fast_c(SwsContext *c, int16_t *dst, int dstWidth, + const uint8_t *src, int srcW, int xInc) { int i; unsigned int xpos=0; @@ -1553,13 +1526,13 @@ static inline void hyscale_fast_c(SwsContext *c, int16_t *dst, int dstWidth, } } - // *** horizontal scale Y line to temp buffer -static inline void hyscale_c(SwsContext *c, uint16_t *dst, int dstWidth, - const uint8_t *src, int srcW, int xInc, - const int16_t *hLumFilter, - const int16_t *hLumFilterPos, int hLumFilterSize, - uint8_t *formatConvBuffer, - uint32_t *pal, int isAlpha) +// *** horizontal scale Y line to temp buffer +static inline void hyscale(SwsContext *c, uint16_t *dst, int dstWidth, + const uint8_t *src, int srcW, int xInc, + const int16_t *hLumFilter, + const int16_t *hLumFilterPos, int hLumFilterSize, + uint8_t *formatConvBuffer, + uint32_t *pal, int isAlpha) { void (*toYV12)(uint8_t *, const uint8_t *, int, uint32_t *) = isAlpha ? c->alpToYV12 : c->lumToYV12; void (*convertRange)(uint16_t *, int) = isAlpha ? NULL : c->lumConvertRange; @@ -1581,9 +1554,9 @@ static inline void hyscale_c(SwsContext *c, uint16_t *dst, int dstWidth, convertRange(dst, dstWidth); } -static inline void hcscale_fast_c(SwsContext *c, int16_t *dst1, int16_t *dst2, - int dstWidth, const uint8_t *src1, - const uint8_t *src2, int srcW, int xInc) +static void hcscale_fast_c(SwsContext *c, int16_t *dst1, int16_t *dst2, + int dstWidth, const uint8_t *src1, + const uint8_t *src2, int srcW, int xInc) { int i; unsigned int xpos=0; @@ -1596,11 +1569,11 @@ static inline void hcscale_fast_c(SwsContext *c, int16_t *dst1, int16_t *dst2, } } -inline static void hcscale_c(SwsContext *c, uint16_t *dst1, uint16_t *dst2, int dstWidth, - const uint8_t *src1, const uint8_t *src2, - int srcW, int xInc, const int16_t *hChrFilter, - const int16_t *hChrFilterPos, int hChrFilterSize, - uint8_t *formatConvBuffer, uint32_t *pal) +static inline void hcscale(SwsContext *c, uint16_t *dst1, uint16_t *dst2, int dstWidth, + const uint8_t *src1, const uint8_t *src2, + int srcW, int xInc, const int16_t *hChrFilter, + const int16_t *hChrFilterPos, int hChrFilterSize, + uint8_t *formatConvBuffer, uint32_t *pal) { src1 += c->chrSrcOffset; @@ -1627,8 +1600,9 @@ inline static void hcscale_c(SwsContext *c, uint16_t *dst1, uint16_t *dst2, int #define DEBUG_SWSCALE_BUFFERS 0 #define DEBUG_BUFFERS(...) if (DEBUG_SWSCALE_BUFFERS) av_log(c, AV_LOG_DEBUG, __VA_ARGS__) -static int swScale_c(SwsContext *c, const uint8_t* src[], int srcStride[], - int srcSliceY, int srcSliceH, uint8_t* dst[], int dstStride[]) +static int 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 */ const int srcW= c->srcW; @@ -1762,15 +1736,15 @@ static int swScale_c(SwsContext *c, const uint8_t* src[], int srcStride[], assert(lumBufIndex < 2*vLumBufSize); assert(lastInLumBuf + 1 - srcSliceY < srcSliceH); assert(lastInLumBuf + 1 - srcSliceY >= 0); - hyscale_c(c, lumPixBuf[ lumBufIndex ], dstW, src1, srcW, lumXInc, - hLumFilter, hLumFilterPos, hLumFilterSize, - formatConvBuffer, - pal, 0); + hyscale(c, lumPixBuf[ lumBufIndex ], dstW, src1, srcW, lumXInc, + hLumFilter, hLumFilterPos, hLumFilterSize, + formatConvBuffer, + pal, 0); if (CONFIG_SWSCALE_ALPHA && alpPixBuf) - hyscale_c(c, alpPixBuf[ lumBufIndex ], dstW, src2, srcW, - lumXInc, hLumFilter, hLumFilterPos, hLumFilterSize, - formatConvBuffer, - pal, 1); + hyscale(c, alpPixBuf[ lumBufIndex ], dstW, src2, srcW, + lumXInc, hLumFilter, hLumFilterPos, hLumFilterSize, + formatConvBuffer, + pal, 1); lastInLumBuf++; DEBUG_BUFFERS("\t\tlumBufIndex %d: lastInLumBuf: %d\n", lumBufIndex, lastInLumBuf); @@ -1785,7 +1759,7 @@ static int swScale_c(SwsContext *c, const uint8_t* src[], int srcStride[], //FIXME replace parameters through context struct (some at least) if (c->needs_hcscale) - hcscale_c(c, chrUPixBuf[chrBufIndex], chrVPixBuf[chrBufIndex], + hcscale(c, chrUPixBuf[chrBufIndex], chrVPixBuf[chrBufIndex], chrDstW, src1, src2, chrSrcW, chrXInc, hChrFilter, hChrFilterPos, hChrFilterSize, formatConvBuffer, pal); @@ -1818,12 +1792,12 @@ static int swScale_c(SwsContext *c, const uint8_t* src[], int srcStride[], const int chrSkipMask= (1<chrDstVSubSample)-1; if ((dstY&chrSkipMask) || isGray(dstFormat)) uDest=vDest= NULL; //FIXME split functions in lumi / chromi if (is16BPS(dstFormat) || is9_OR_10BPS(dstFormat)) { - yuv2yuvX16inC(vLumFilter+dstY*vLumFilterSize , lumSrcPtr, vLumFilterSize, - vChrFilter+chrDstY*vChrFilterSize, chrUSrcPtr, - chrVSrcPtr, vChrFilterSize, - alpSrcPtr, (uint16_t *) dest, (uint16_t *) uDest, - (uint16_t *) vDest, (uint16_t *) aDest, dstW, chrDstW, - dstFormat); + yuv2yuvX16_c(vLumFilter+dstY*vLumFilterSize , lumSrcPtr, vLumFilterSize, + vChrFilter+chrDstY*vChrFilterSize, chrUSrcPtr, + chrVSrcPtr, vChrFilterSize, + alpSrcPtr, (uint16_t *) dest, (uint16_t *) uDest, + (uint16_t *) vDest, (uint16_t *) aDest, dstW, chrDstW, + dstFormat); } else if (vLumFilterSize == 1 && vChrFilterSize == 1) { // unscaled YV12 const int16_t *lumBuf = lumSrcPtr[0]; const int16_t *chrUBuf= chrUSrcPtr[0]; @@ -1844,11 +1818,11 @@ static int swScale_c(SwsContext *c, const uint8_t* src[], int srcStride[], if (vLumFilterSize == 1 && vChrFilterSize == 2) { //unscaled RGB int chrAlpha= vChrFilter[2*dstY+1]; if(flags & SWS_FULL_CHR_H_INT) { - yuv2rgbXinC_full(c, //FIXME write a packed1_full function - vLumFilter+dstY*vLumFilterSize, lumSrcPtr, vLumFilterSize, - vChrFilter+dstY*vChrFilterSize, chrUSrcPtr, - chrVSrcPtr, vChrFilterSize, - alpSrcPtr, dest, dstW, dstY); + yuv2rgbX_c_full(c, //FIXME write a packed1_full function + vLumFilter+dstY*vLumFilterSize, lumSrcPtr, vLumFilterSize, + vChrFilter+dstY*vChrFilterSize, chrUSrcPtr, + chrVSrcPtr, vChrFilterSize, + alpSrcPtr, dest, dstW, dstY); } else { c->yuv2packed1(c, *lumSrcPtr, *chrUSrcPtr, *(chrUSrcPtr+1), *chrVSrcPtr, *(chrVSrcPtr+1), @@ -1863,10 +1837,10 @@ static int swScale_c(SwsContext *c, const uint8_t* src[], int srcStride[], chrMmxFilter[2]= chrMmxFilter[3]= vChrFilter[2*chrDstY]*0x10001; if(flags & SWS_FULL_CHR_H_INT) { - yuv2rgbXinC_full(c, //FIXME write a packed2_full function - vLumFilter+dstY*vLumFilterSize, lumSrcPtr, vLumFilterSize, - vChrFilter+dstY*vChrFilterSize, chrUSrcPtr, chrVSrcPtr, vChrFilterSize, - alpSrcPtr, dest, dstW, dstY); + yuv2rgbX_c_full(c, //FIXME write a packed2_full function + vLumFilter+dstY*vLumFilterSize, lumSrcPtr, vLumFilterSize, + vChrFilter+dstY*vChrFilterSize, chrUSrcPtr, chrVSrcPtr, vChrFilterSize, + alpSrcPtr, dest, dstW, dstY); } else { c->yuv2packed2(c, *lumSrcPtr, *(lumSrcPtr+1), *chrUSrcPtr, *(chrUSrcPtr+1), *chrVSrcPtr, *(chrVSrcPtr+1), @@ -1875,10 +1849,10 @@ static int swScale_c(SwsContext *c, const uint8_t* src[], int srcStride[], } } else { //general RGB if(flags & SWS_FULL_CHR_H_INT) { - yuv2rgbXinC_full(c, - vLumFilter+dstY*vLumFilterSize, lumSrcPtr, vLumFilterSize, - vChrFilter+dstY*vChrFilterSize, chrUSrcPtr, chrVSrcPtr, vChrFilterSize, - alpSrcPtr, dest, dstW, dstY); + yuv2rgbX_c_full(c, + vLumFilter+dstY*vLumFilterSize, lumSrcPtr, vLumFilterSize, + vChrFilter+dstY*vChrFilterSize, chrUSrcPtr, chrVSrcPtr, vChrFilterSize, + alpSrcPtr, dest, dstW, dstY); } else { c->yuv2packedX(c, vLumFilter+dstY*vLumFilterSize, lumSrcPtr, vLumFilterSize, @@ -1895,38 +1869,40 @@ static int swScale_c(SwsContext *c, const uint8_t* src[], int srcStride[], 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 - yuv2nv12XinC( - vLumFilter+dstY*vLumFilterSize , lumSrcPtr, vLumFilterSize, - vChrFilter+chrDstY*vChrFilterSize, chrUSrcPtr, chrVSrcPtr, vChrFilterSize, - dest, uDest, dstW, chrDstW, dstFormat); + yuv2nv12X_c(c, vLumFilter+dstY*vLumFilterSize, + lumSrcPtr, vLumFilterSize, + vChrFilter+chrDstY*vChrFilterSize, + chrUSrcPtr, chrVSrcPtr, vChrFilterSize, + dest, uDest, dstW, chrDstW, dstFormat); } else if (isPlanarYUV(dstFormat) || dstFormat==PIX_FMT_GRAY8) { //YV12 const int chrSkipMask= (1<chrDstVSubSample)-1; if ((dstY&chrSkipMask) || isGray(dstFormat)) uDest=vDest= NULL; //FIXME split functions in lumi / chromi if (is16BPS(dstFormat) || is9_OR_10BPS(dstFormat)) { - yuv2yuvX16inC( - vLumFilter+dstY*vLumFilterSize , lumSrcPtr, vLumFilterSize, - vChrFilter+chrDstY*vChrFilterSize, chrUSrcPtr, chrVSrcPtr, vChrFilterSize, - alpSrcPtr, (uint16_t *) dest, (uint16_t *) uDest, (uint16_t *) vDest, (uint16_t *) aDest, dstW, chrDstW, - dstFormat); + yuv2yuvX16_c(vLumFilter+dstY*vLumFilterSize , lumSrcPtr, vLumFilterSize, + vChrFilter+chrDstY*vChrFilterSize, chrUSrcPtr, chrVSrcPtr, vChrFilterSize, + alpSrcPtr, (uint16_t *) dest, (uint16_t *) uDest, (uint16_t *) vDest, (uint16_t *) aDest, dstW, chrDstW, + dstFormat); } else { - yuv2yuvXinC( - vLumFilter+dstY*vLumFilterSize , lumSrcPtr, vLumFilterSize, - vChrFilter+chrDstY*vChrFilterSize, chrUSrcPtr, chrVSrcPtr, vChrFilterSize, - alpSrcPtr, dest, uDest, vDest, aDest, dstW, chrDstW); + yuv2yuvX_c(c, vLumFilter+dstY*vLumFilterSize, + lumSrcPtr, vLumFilterSize, + vChrFilter+chrDstY*vChrFilterSize, + chrUSrcPtr, chrVSrcPtr, vChrFilterSize, + alpSrcPtr, dest, uDest, vDest, aDest, + dstW, chrDstW); } } else { assert(lumSrcPtr + vLumFilterSize - 1 < lumPixBuf + vLumBufSize*2); assert(chrUSrcPtr + vChrFilterSize - 1 < chrUPixBuf + vChrBufSize*2); if(flags & SWS_FULL_CHR_H_INT) { - yuv2rgbXinC_full(c, - vLumFilter+dstY*vLumFilterSize, lumSrcPtr, vLumFilterSize, - vChrFilter+dstY*vChrFilterSize, chrUSrcPtr, chrVSrcPtr, vChrFilterSize, - alpSrcPtr, dest, dstW, dstY); + yuv2rgbX_c_full(c, + vLumFilter+dstY*vLumFilterSize, lumSrcPtr, vLumFilterSize, + vChrFilter+dstY*vChrFilterSize, chrUSrcPtr, chrVSrcPtr, vChrFilterSize, + alpSrcPtr, dest, dstW, dstY); } else { - yuv2packedXinC(c, - vLumFilter+dstY*vLumFilterSize, lumSrcPtr, vLumFilterSize, - vChrFilter+dstY*vChrFilterSize, chrUSrcPtr, chrVSrcPtr, vChrFilterSize, - alpSrcPtr, dest, dstW, dstY); + yuv2packedX_c(c, + vLumFilter+dstY*vLumFilterSize, lumSrcPtr, vLumFilterSize, + vChrFilter+dstY*vChrFilterSize, chrUSrcPtr, chrVSrcPtr, vChrFilterSize, + alpSrcPtr, dest, dstW, dstY); } } } @@ -1980,7 +1956,7 @@ static void sws_init_swScale_c(SwsContext *c) case PIX_FMT_BGR8 : case PIX_FMT_PAL8 : case PIX_FMT_BGR4_BYTE: - case PIX_FMT_RGB4_BYTE: c->chrToYV12 = palToUV; break; + case PIX_FMT_RGB4_BYTE: c->chrToYV12 = palToUV_c; break; case PIX_FMT_YUV420P9BE: c->chrToYV12 = BE9ToUV_c; break; case PIX_FMT_YUV420P9LE: c->chrToYV12 = LE9ToUV_c; break; case PIX_FMT_YUV420P10BE: c->chrToYV12 = BE10ToUV_c; break; @@ -1995,36 +1971,36 @@ static void sws_init_swScale_c(SwsContext *c) if (c->chrSrcHSubSample) { switch(srcFormat) { case PIX_FMT_RGB48BE: - case PIX_FMT_RGB48LE: c->chrToYV12 = rgb48ToUV_half; break; + case PIX_FMT_RGB48LE: c->chrToYV12 = rgb48ToUV_half_c; break; case PIX_FMT_BGR48BE: - case PIX_FMT_BGR48LE: c->chrToYV12 = bgr48ToUV_half; break; - case PIX_FMT_RGB32 : c->chrToYV12 = bgr32ToUV_half; break; - case PIX_FMT_RGB32_1: c->chrToYV12 = bgr321ToUV_half; break; + case PIX_FMT_BGR48LE: c->chrToYV12 = bgr48ToUV_half_c; break; + case PIX_FMT_RGB32 : c->chrToYV12 = bgr32ToUV_half_c; break; + case PIX_FMT_RGB32_1: c->chrToYV12 = bgr321ToUV_half_c; break; case PIX_FMT_BGR24 : c->chrToYV12 = bgr24ToUV_half_c; break; - case PIX_FMT_BGR565 : c->chrToYV12 = bgr16ToUV_half; break; - case PIX_FMT_BGR555 : c->chrToYV12 = bgr15ToUV_half; break; - case PIX_FMT_BGR32 : c->chrToYV12 = rgb32ToUV_half; break; - case PIX_FMT_BGR32_1: c->chrToYV12 = rgb321ToUV_half; break; + case PIX_FMT_BGR565 : c->chrToYV12 = bgr16ToUV_half_c; break; + case PIX_FMT_BGR555 : c->chrToYV12 = bgr15ToUV_half_c; break; + case PIX_FMT_BGR32 : c->chrToYV12 = rgb32ToUV_half_c; break; + case PIX_FMT_BGR32_1: c->chrToYV12 = rgb321ToUV_half_c; break; case PIX_FMT_RGB24 : c->chrToYV12 = rgb24ToUV_half_c; break; - case PIX_FMT_RGB565 : c->chrToYV12 = rgb16ToUV_half; break; - case PIX_FMT_RGB555 : c->chrToYV12 = rgb15ToUV_half; break; + case PIX_FMT_RGB565 : c->chrToYV12 = rgb16ToUV_half_c; break; + case PIX_FMT_RGB555 : c->chrToYV12 = rgb15ToUV_half_c; break; } } else { switch(srcFormat) { case PIX_FMT_RGB48BE: - case PIX_FMT_RGB48LE: c->chrToYV12 = rgb48ToUV; break; + case PIX_FMT_RGB48LE: c->chrToYV12 = rgb48ToUV_c; break; case PIX_FMT_BGR48BE: - case PIX_FMT_BGR48LE: c->chrToYV12 = bgr48ToUV; break; - case PIX_FMT_RGB32 : c->chrToYV12 = bgr32ToUV; break; - case PIX_FMT_RGB32_1: c->chrToYV12 = bgr321ToUV; break; + case PIX_FMT_BGR48LE: c->chrToYV12 = bgr48ToUV_c; break; + case PIX_FMT_RGB32 : c->chrToYV12 = bgr32ToUV_c; break; + case PIX_FMT_RGB32_1: c->chrToYV12 = bgr321ToUV_c; break; case PIX_FMT_BGR24 : c->chrToYV12 = bgr24ToUV_c; break; - case PIX_FMT_BGR565 : c->chrToYV12 = bgr16ToUV; break; - case PIX_FMT_BGR555 : c->chrToYV12 = bgr15ToUV; break; - case PIX_FMT_BGR32 : c->chrToYV12 = rgb32ToUV; break; - case PIX_FMT_BGR32_1: c->chrToYV12 = rgb321ToUV; break; + case PIX_FMT_BGR565 : c->chrToYV12 = bgr16ToUV_c; break; + case PIX_FMT_BGR555 : c->chrToYV12 = bgr15ToUV_c; break; + case PIX_FMT_BGR32 : c->chrToYV12 = rgb32ToUV_c; break; + case PIX_FMT_BGR32_1: c->chrToYV12 = rgb321ToUV_c; break; case PIX_FMT_RGB24 : c->chrToYV12 = rgb24ToUV_c; break; - case PIX_FMT_RGB565 : c->chrToYV12 = rgb16ToUV; break; - case PIX_FMT_RGB555 : c->chrToYV12 = rgb15ToUV; break; + case PIX_FMT_RGB565 : c->chrToYV12 = rgb16ToUV_c; break; + case PIX_FMT_RGB555 : c->chrToYV12 = rgb15ToUV_c; break; } } @@ -2047,33 +2023,33 @@ static void sws_init_swScale_c(SwsContext *c) case PIX_FMT_YUV444P16LE: case PIX_FMT_GRAY16LE : c->lumToYV12 = uyvyToY_c; break; case PIX_FMT_BGR24 : c->lumToYV12 = bgr24ToY_c; break; - case PIX_FMT_BGR565 : c->lumToYV12 = bgr16ToY; break; - case PIX_FMT_BGR555 : c->lumToYV12 = bgr15ToY; break; + case PIX_FMT_BGR565 : c->lumToYV12 = bgr16ToY_c; break; + case PIX_FMT_BGR555 : c->lumToYV12 = bgr15ToY_c; break; case PIX_FMT_RGB24 : c->lumToYV12 = rgb24ToY_c; break; - case PIX_FMT_RGB565 : c->lumToYV12 = rgb16ToY; break; - case PIX_FMT_RGB555 : c->lumToYV12 = rgb15ToY; break; + case PIX_FMT_RGB565 : c->lumToYV12 = rgb16ToY_c; break; + case PIX_FMT_RGB555 : c->lumToYV12 = rgb15ToY_c; break; case PIX_FMT_RGB8 : case PIX_FMT_BGR8 : case PIX_FMT_PAL8 : case PIX_FMT_BGR4_BYTE: - case PIX_FMT_RGB4_BYTE: c->lumToYV12 = palToY; break; - case PIX_FMT_MONOBLACK: c->lumToYV12 = monoblack2Y; break; - case PIX_FMT_MONOWHITE: c->lumToYV12 = monowhite2Y; break; - case PIX_FMT_RGB32 : c->lumToYV12 = bgr32ToY; break; - case PIX_FMT_RGB32_1: c->lumToYV12 = bgr321ToY; break; - case PIX_FMT_BGR32 : c->lumToYV12 = rgb32ToY; break; - case PIX_FMT_BGR32_1: c->lumToYV12 = rgb321ToY; break; + case PIX_FMT_RGB4_BYTE: c->lumToYV12 = palToY_c; break; + case PIX_FMT_MONOBLACK: c->lumToYV12 = monoblack2Y_c; break; + case PIX_FMT_MONOWHITE: c->lumToYV12 = monowhite2Y_c; break; + case PIX_FMT_RGB32 : c->lumToYV12 = bgr32ToY_c; break; + case PIX_FMT_RGB32_1: c->lumToYV12 = bgr321ToY_c; break; + case PIX_FMT_BGR32 : c->lumToYV12 = rgb32ToY_c; break; + case PIX_FMT_BGR32_1: c->lumToYV12 = rgb321ToY_c; break; case PIX_FMT_RGB48BE: - case PIX_FMT_RGB48LE: c->lumToYV12 = rgb48ToY; break; + case PIX_FMT_RGB48LE: c->lumToYV12 = rgb48ToY_c; break; case PIX_FMT_BGR48BE: - case PIX_FMT_BGR48LE: c->lumToYV12 = bgr48ToY; break; + case PIX_FMT_BGR48LE: c->lumToYV12 = bgr48ToY_c; break; } if (c->alpPixBuf) { switch (srcFormat) { case PIX_FMT_RGB32 : case PIX_FMT_RGB32_1: case PIX_FMT_BGR32 : - case PIX_FMT_BGR32_1: c->alpToYV12 = abgrToA; break; + case PIX_FMT_BGR32_1: c->alpToYV12 = abgrToA_c; break; case PIX_FMT_Y400A : c->alpToYV12 = yuy2ToY_c; break; } } @@ -2118,7 +2094,7 @@ SwsFunc ff_getSwsFunc(SwsContext *c) if (HAVE_ALTIVEC) ff_sws_init_swScale_altivec(c); - return swScale_c; + return swScale; } static void copyPlane(const uint8_t *src, int srcStride,