diff --git a/libswscale/ppc/swscale_altivec.c b/libswscale/ppc/swscale_altivec.c index 423297a8f0..42e965de95 100644 --- a/libswscale/ppc/swscale_altivec.c +++ b/libswscale/ppc/swscale_altivec.c @@ -415,7 +415,7 @@ void ff_sws_init_swScale_altivec(SwsContext *c) /* The following list of supported dstFormat values should * match what's found in the body of ff_yuv2packedX_altivec() */ - if (!(c->flags & SWS_BITEXACT) && !c->alpPixBuf && + if (!(c->flags & (SWS_BITEXACT | SWS_FULL_CHR_H_INT)) && !c->alpPixBuf && (c->dstFormat==PIX_FMT_ABGR || c->dstFormat==PIX_FMT_BGRA || c->dstFormat==PIX_FMT_BGR24 || c->dstFormat==PIX_FMT_RGB24 || c->dstFormat==PIX_FMT_RGBA || c->dstFormat==PIX_FMT_ARGB)) { diff --git a/libswscale/swscale.c b/libswscale/swscale.c index f6ed45382e..9705b14d00 100644 --- a/libswscale/swscale.c +++ b/libswscale/swscale.c @@ -1770,50 +1770,28 @@ static int swScale(SwsContext *c, const uint8_t* src[], } else { assert(lumSrcPtr + vLumFilterSize - 1 < lumPixBuf + vLumBufSize*2); assert(chrUSrcPtr + vChrFilterSize - 1 < chrUPixBuf + vChrBufSize*2); - if (vLumFilterSize == 1 && vChrFilterSize == 2) { //unscaled RGB + if (c->yuv2packed1 && vLumFilterSize == 1 && vChrFilterSize == 2) { //unscaled RGB int chrAlpha= vChrFilter[2*dstY+1]; - if(flags & SWS_FULL_CHR_H_INT) { - 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), - alpPixBuf ? *alpSrcPtr : NULL, - dest, dstW, chrAlpha, dstFormat, flags, dstY); - } - } else if (vLumFilterSize == 2 && vChrFilterSize == 2) { //bilinear upscale RGB + c->yuv2packed1(c, *lumSrcPtr, *chrUSrcPtr, *(chrUSrcPtr+1), + *chrVSrcPtr, *(chrVSrcPtr+1), + alpPixBuf ? *alpSrcPtr : NULL, + dest, dstW, chrAlpha, dstFormat, flags, dstY); + } else if (c->yuv2packed2 && vLumFilterSize == 2 && vChrFilterSize == 2) { //bilinear upscale RGB int lumAlpha= vLumFilter[2*dstY+1]; int chrAlpha= vChrFilter[2*dstY+1]; lumMmxFilter[2]= lumMmxFilter[3]= vLumFilter[2*dstY ]*0x10001; chrMmxFilter[2]= chrMmxFilter[3]= vChrFilter[2*chrDstY]*0x10001; - if(flags & SWS_FULL_CHR_H_INT) { - 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), - alpPixBuf ? *alpSrcPtr : NULL, alpPixBuf ? *(alpSrcPtr+1) : NULL, - dest, dstW, lumAlpha, chrAlpha, dstY); - } + c->yuv2packed2(c, *lumSrcPtr, *(lumSrcPtr+1), *chrUSrcPtr, *(chrUSrcPtr+1), + *chrVSrcPtr, *(chrVSrcPtr+1), + alpPixBuf ? *alpSrcPtr : NULL, alpPixBuf ? *(alpSrcPtr+1) : NULL, + dest, dstW, lumAlpha, chrAlpha, dstY); } else { //general RGB - if(flags & SWS_FULL_CHR_H_INT) { - 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, - vChrFilter+dstY*vChrFilterSize, chrUSrcPtr, chrVSrcPtr, vChrFilterSize, - alpSrcPtr, dest, dstW, dstY); - } + c->yuv2packedX(c, + vLumFilter+dstY*vLumFilterSize, lumSrcPtr, vLumFilterSize, + vChrFilter+dstY*vChrFilterSize, chrUSrcPtr, chrVSrcPtr, vChrFilterSize, + alpSrcPtr, dest, dstW, dstY); } } } else { // hmm looks like we can't use MMX here without overwriting this array's tail @@ -1900,9 +1878,13 @@ static void sws_init_swScale_c(SwsContext *c) c->yuv2yuv1 = yuv2yuv1_c; c->yuv2yuvX = yuv2yuvX_c; } - c->yuv2packed1 = yuv2packed1_c; - c->yuv2packed2 = yuv2packed2_c; - c->yuv2packedX = yuv2packedX_c; + if(c->flags & SWS_FULL_CHR_H_INT) { + c->yuv2packedX = yuv2rgbX_c_full; + } else { + c->yuv2packed1 = yuv2packed1_c; + c->yuv2packed2 = yuv2packed2_c; + c->yuv2packedX = yuv2packedX_c; + } c->hScale = hScale_c; diff --git a/libswscale/x86/swscale_template.c b/libswscale/x86/swscale_template.c index 174c3fbfd6..bd72b75326 100644 --- a/libswscale/x86/swscale_template.c +++ b/libswscale/x86/swscale_template.c @@ -2193,6 +2193,7 @@ static void RENAME(sws_init_swScale)(SwsContext *c) if (c->flags & SWS_ACCURATE_RND) { c->yuv2yuv1 = RENAME(yuv2yuv1_ar ); c->yuv2yuvX = RENAME(yuv2yuvX_ar ); + if (!(c->flags & SWS_FULL_CHR_H_INT)) { switch (c->dstFormat) { case PIX_FMT_RGB32: c->yuv2packedX = RENAME(yuv2rgb32_X_ar); break; case PIX_FMT_BGR24: c->yuv2packedX = RENAME(yuv2bgr24_X_ar); break; @@ -2201,9 +2202,11 @@ static void RENAME(sws_init_swScale)(SwsContext *c) case PIX_FMT_YUYV422: c->yuv2packedX = RENAME(yuv2yuyv422_X_ar); break; default: break; } + } } else { c->yuv2yuv1 = RENAME(yuv2yuv1 ); c->yuv2yuvX = RENAME(yuv2yuvX ); + if (!(c->flags & SWS_FULL_CHR_H_INT)) { switch (c->dstFormat) { case PIX_FMT_RGB32: c->yuv2packedX = RENAME(yuv2rgb32_X); break; case PIX_FMT_BGR24: c->yuv2packedX = RENAME(yuv2bgr24_X); break; @@ -2212,7 +2215,10 @@ static void RENAME(sws_init_swScale)(SwsContext *c) case PIX_FMT_YUYV422: c->yuv2packedX = RENAME(yuv2yuyv422_X); break; default: break; } + } } + } + if (!(c->flags & SWS_FULL_CHR_H_INT)) { switch (c->dstFormat) { case PIX_FMT_RGB32: c->yuv2packed1 = RENAME(yuv2rgb32_1);