swscale: cleanup unused code
authorPedro Arthur <bygrandao@gmail.com>
Mon, 28 Mar 2016 16:25:18 +0000 (13:25 -0300)
committerPedro Arthur <bygrandao@gmail.com>
Thu, 31 Mar 2016 19:36:16 +0000 (16:36 -0300)
Removed previous swscale code under '#ifndef NEW_FILTER'
and removed unused fields of SwsContext

libswscale/input.c
libswscale/output.c
libswscale/ppc/swscale_altivec.c
libswscale/slice.c
libswscale/swscale.c
libswscale/swscale_internal.h
libswscale/utils.c
libswscale/vscale.c
libswscale/x86/swscale.c
libswscale/x86/swscale_template.c

index 16314b6..eed0f49 100644 (file)
@@ -1482,7 +1482,7 @@ av_cold void ff_sws_init_input_funcs(SwsContext *c)
         c->lumToYV12 = p010BEToY_c;
         break;
     }
-    if (c->alpPixBuf) {
+    if (c->needAlpha) {
         if (is16BPS(srcFormat) || isNBPS(srcFormat)) {
             if (HAVE_BIGENDIAN == !isBE(srcFormat))
                 c->alpToYV12 = bswap16Y_c;
index 0c763c3..e9bbb3d 100644 (file)
@@ -1513,8 +1513,8 @@ static void name ## ext ## _1_c(SwsContext *c, const int16_t *buf0, \
 }
 
 #if CONFIG_SMALL
-YUV2RGBWRAPPER(yuv2rgb,,  32_1,  AV_PIX_FMT_RGB32_1,   CONFIG_SWSCALE_ALPHA && c->alpPixBuf)
-YUV2RGBWRAPPER(yuv2rgb,,  32,    AV_PIX_FMT_RGB32,     CONFIG_SWSCALE_ALPHA && c->alpPixBuf)
+YUV2RGBWRAPPER(yuv2rgb,,  32_1,  AV_PIX_FMT_RGB32_1,   CONFIG_SWSCALE_ALPHA && c->needAlpha)
+YUV2RGBWRAPPER(yuv2rgb,,  32,    AV_PIX_FMT_RGB32,     CONFIG_SWSCALE_ALPHA && c->needAlpha)
 #else
 #if CONFIG_SWSCALE_ALPHA
 YUV2RGBWRAPPER(yuv2rgb,, a32_1,  AV_PIX_FMT_RGB32_1,   1)
@@ -1823,10 +1823,10 @@ yuv2rgb_full_1_c_template(SwsContext *c, const int16_t *buf0,
 }
 
 #if CONFIG_SMALL
-YUV2RGBWRAPPER(yuv2, rgb_full, bgra32_full, AV_PIX_FMT_BGRA,  CONFIG_SWSCALE_ALPHA && c->alpPixBuf)
-YUV2RGBWRAPPER(yuv2, rgb_full, abgr32_full, AV_PIX_FMT_ABGR,  CONFIG_SWSCALE_ALPHA && c->alpPixBuf)
-YUV2RGBWRAPPER(yuv2, rgb_full, rgba32_full, AV_PIX_FMT_RGBA,  CONFIG_SWSCALE_ALPHA && c->alpPixBuf)
-YUV2RGBWRAPPER(yuv2, rgb_full, argb32_full, AV_PIX_FMT_ARGB,  CONFIG_SWSCALE_ALPHA && c->alpPixBuf)
+YUV2RGBWRAPPER(yuv2, rgb_full, bgra32_full, AV_PIX_FMT_BGRA,  CONFIG_SWSCALE_ALPHA && c->needAlpha)
+YUV2RGBWRAPPER(yuv2, rgb_full, abgr32_full, AV_PIX_FMT_ABGR,  CONFIG_SWSCALE_ALPHA && c->needAlpha)
+YUV2RGBWRAPPER(yuv2, rgb_full, rgba32_full, AV_PIX_FMT_RGBA,  CONFIG_SWSCALE_ALPHA && c->needAlpha)
+YUV2RGBWRAPPER(yuv2, rgb_full, argb32_full, AV_PIX_FMT_ARGB,  CONFIG_SWSCALE_ALPHA && c->needAlpha)
 #else
 #if CONFIG_SWSCALE_ALPHA
 YUV2RGBWRAPPER(yuv2, rgb_full, bgra32_full, AV_PIX_FMT_BGRA,  1)
@@ -2119,7 +2119,7 @@ av_cold void ff_sws_init_output_funcs(SwsContext *c,
                 *yuv2packed1 = yuv2rgba32_full_1_c;
 #else
 #if CONFIG_SWSCALE_ALPHA
-                if (c->alpPixBuf) {
+                if (c->needAlpha) {
                     *yuv2packedX = yuv2rgba32_full_X_c;
                     *yuv2packed2 = yuv2rgba32_full_2_c;
                     *yuv2packed1 = yuv2rgba32_full_1_c;
@@ -2139,7 +2139,7 @@ av_cold void ff_sws_init_output_funcs(SwsContext *c,
                 *yuv2packed1 = yuv2argb32_full_1_c;
 #else
 #if CONFIG_SWSCALE_ALPHA
-                if (c->alpPixBuf) {
+                if (c->needAlpha) {
                     *yuv2packedX = yuv2argb32_full_X_c;
                     *yuv2packed2 = yuv2argb32_full_2_c;
                     *yuv2packed1 = yuv2argb32_full_1_c;
@@ -2159,7 +2159,7 @@ av_cold void ff_sws_init_output_funcs(SwsContext *c,
                 *yuv2packed1 = yuv2bgra32_full_1_c;
 #else
 #if CONFIG_SWSCALE_ALPHA
-                if (c->alpPixBuf) {
+                if (c->needAlpha) {
                     *yuv2packedX = yuv2bgra32_full_X_c;
                     *yuv2packed2 = yuv2bgra32_full_2_c;
                     *yuv2packed1 = yuv2bgra32_full_1_c;
@@ -2179,7 +2179,7 @@ av_cold void ff_sws_init_output_funcs(SwsContext *c,
                 *yuv2packed1 = yuv2abgr32_full_1_c;
 #else
 #if CONFIG_SWSCALE_ALPHA
-                if (c->alpPixBuf) {
+                if (c->needAlpha) {
                     *yuv2packedX = yuv2abgr32_full_X_c;
                     *yuv2packed2 = yuv2abgr32_full_2_c;
                     *yuv2packed1 = yuv2abgr32_full_1_c;
@@ -2194,7 +2194,7 @@ av_cold void ff_sws_init_output_funcs(SwsContext *c,
                 break;
         case AV_PIX_FMT_RGBA64LE:
 #if CONFIG_SWSCALE_ALPHA
-            if (c->alpPixBuf) {
+            if (c->needAlpha) {
                 *yuv2packedX = yuv2rgba64le_full_X_c;
                 *yuv2packed2 = yuv2rgba64le_full_2_c;
                 *yuv2packed1 = yuv2rgba64le_full_1_c;
@@ -2208,7 +2208,7 @@ av_cold void ff_sws_init_output_funcs(SwsContext *c,
             break;
         case AV_PIX_FMT_RGBA64BE:
 #if CONFIG_SWSCALE_ALPHA
-            if (c->alpPixBuf) {
+            if (c->needAlpha) {
                 *yuv2packedX = yuv2rgba64be_full_X_c;
                 *yuv2packed2 = yuv2rgba64be_full_2_c;
                 *yuv2packed1 = yuv2rgba64be_full_1_c;
@@ -2222,7 +2222,7 @@ av_cold void ff_sws_init_output_funcs(SwsContext *c,
             break;
         case AV_PIX_FMT_BGRA64LE:
 #if CONFIG_SWSCALE_ALPHA
-            if (c->alpPixBuf) {
+            if (c->needAlpha) {
                 *yuv2packedX = yuv2bgra64le_full_X_c;
                 *yuv2packed2 = yuv2bgra64le_full_2_c;
                 *yuv2packed1 = yuv2bgra64le_full_1_c;
@@ -2236,7 +2236,7 @@ av_cold void ff_sws_init_output_funcs(SwsContext *c,
             break;
         case AV_PIX_FMT_BGRA64BE:
 #if CONFIG_SWSCALE_ALPHA
-            if (c->alpPixBuf) {
+            if (c->needAlpha) {
                 *yuv2packedX = yuv2bgra64be_full_X_c;
                 *yuv2packed2 = yuv2bgra64be_full_2_c;
                 *yuv2packed1 = yuv2bgra64be_full_1_c;
@@ -2321,7 +2321,7 @@ av_cold void ff_sws_init_output_funcs(SwsContext *c,
         switch (dstFormat) {
         case AV_PIX_FMT_RGBA64LE:
 #if CONFIG_SWSCALE_ALPHA
-            if (c->alpPixBuf) {
+            if (c->needAlpha) {
                 *yuv2packed1 = yuv2rgba64le_1_c;
                 *yuv2packed2 = yuv2rgba64le_2_c;
                 *yuv2packedX = yuv2rgba64le_X_c;
@@ -2335,7 +2335,7 @@ av_cold void ff_sws_init_output_funcs(SwsContext *c,
             break;
         case AV_PIX_FMT_RGBA64BE:
 #if CONFIG_SWSCALE_ALPHA
-            if (c->alpPixBuf) {
+            if (c->needAlpha) {
                 *yuv2packed1 = yuv2rgba64be_1_c;
                 *yuv2packed2 = yuv2rgba64be_2_c;
                 *yuv2packedX = yuv2rgba64be_X_c;
@@ -2349,7 +2349,7 @@ av_cold void ff_sws_init_output_funcs(SwsContext *c,
             break;
         case AV_PIX_FMT_BGRA64LE:
 #if CONFIG_SWSCALE_ALPHA
-            if (c->alpPixBuf) {
+            if (c->needAlpha) {
                 *yuv2packed1 = yuv2bgra64le_1_c;
                 *yuv2packed2 = yuv2bgra64le_2_c;
                 *yuv2packedX = yuv2bgra64le_X_c;
@@ -2363,7 +2363,7 @@ av_cold void ff_sws_init_output_funcs(SwsContext *c,
             break;
         case AV_PIX_FMT_BGRA64BE:
 #if CONFIG_SWSCALE_ALPHA
-            if (c->alpPixBuf) {
+            if (c->needAlpha) {
                 *yuv2packed1 = yuv2bgra64be_1_c;
                 *yuv2packed2 = yuv2bgra64be_2_c;
                 *yuv2packedX = yuv2bgra64be_X_c;
@@ -2403,7 +2403,7 @@ av_cold void ff_sws_init_output_funcs(SwsContext *c,
             *yuv2packedX = yuv2rgb32_X_c;
 #else
 #if CONFIG_SWSCALE_ALPHA
-                if (c->alpPixBuf) {
+                if (c->needAlpha) {
                     *yuv2packed1 = yuv2rgba32_1_c;
                     *yuv2packed2 = yuv2rgba32_2_c;
                     *yuv2packedX = yuv2rgba32_X_c;
@@ -2424,7 +2424,7 @@ av_cold void ff_sws_init_output_funcs(SwsContext *c,
                 *yuv2packedX = yuv2rgb32_1_X_c;
 #else
 #if CONFIG_SWSCALE_ALPHA
-                if (c->alpPixBuf) {
+                if (c->needAlpha) {
                     *yuv2packed1 = yuv2rgba32_1_1_c;
                     *yuv2packed2 = yuv2rgba32_1_2_c;
                     *yuv2packedX = yuv2rgba32_1_X_c;
index af9fc88..35a08c4 100644 (file)
@@ -339,13 +339,13 @@ av_cold void ff_sws_init_swscale_ppc(SwsContext *c)
     }
     if (!is16BPS(dstFormat) && !is9_OR_10BPS(dstFormat) &&
         dstFormat != AV_PIX_FMT_NV12 && dstFormat != AV_PIX_FMT_NV21 &&
-        !c->alpPixBuf) {
+        !c->needAlpha) {
         c->yuv2planeX = yuv2planeX_altivec;
     }
 
     /* The following list of supported dstFormat values should
      * match what's found in the body of ff_yuv2packedX_altivec() */
-    if (!(c->flags & (SWS_BITEXACT | SWS_FULL_CHR_H_INT)) && !c->alpPixBuf) {
+    if (!(c->flags & (SWS_BITEXACT | SWS_FULL_CHR_H_INT)) && !c->needAlpha) {
         switch (c->dstFormat) {
         case AV_PIX_FMT_ABGR:
             c->yuv2packedX = ff_yuv2abgr_X_altivec;
index a701487..0159a73 100644 (file)
@@ -279,7 +279,7 @@ int ff_init_filters(SwsContext * c)
     if (need_lum_conv) {
         res = ff_init_desc_fmt_convert(&c->desc[index], &c->slice[srcIdx], &c->slice[dstIdx], pal);
         if (res < 0) goto cleanup;
-        c->desc[index].alpha = c->alpPixBuf != 0;
+        c->desc[index].alpha = c->needAlpha;
         ++index;
         srcIdx = dstIdx;
     }
@@ -288,7 +288,7 @@ int ff_init_filters(SwsContext * c)
     dstIdx = FFMAX(num_ydesc, num_cdesc);
     res = ff_init_desc_hscale(&c->desc[index], &c->slice[srcIdx], &c->slice[dstIdx], c->hLumFilter, c->hLumFilterPos, c->hLumFilterSize, c->lumXInc);
     if (res < 0) goto cleanup;
-    c->desc[index].alpha = c->alpPixBuf != 0;
+    c->desc[index].alpha = c->needAlpha;
 
 
     ++index;
index 2de5ad4..76b0317 100644 (file)
@@ -52,24 +52,6 @@ DECLARE_ALIGNED(8, static const uint8_t, sws_pb_64)[8] = {
     64, 64, 64, 64, 64, 64, 64, 64
 };
 
-#ifndef NEW_FILTER
-static void gamma_convert(uint8_t * src[], int width, uint16_t *gamma)
-{
-    int i;
-    uint16_t *src1 = (uint16_t*)src[0];
-
-    for (i = 0; i < width; ++i) {
-        uint16_t r = AV_RL16(src1 + i*4 + 0);
-        uint16_t g = AV_RL16(src1 + i*4 + 1);
-        uint16_t b = AV_RL16(src1 + i*4 + 2);
-
-        AV_WL16(src1 + i*4 + 0, gamma[r]);
-        AV_WL16(src1 + i*4 + 1, gamma[g]);
-        AV_WL16(src1 + i*4 + 2, gamma[b]);
-    }
-}
-#endif
-
 static av_always_inline void fillPlane(uint8_t *plane, int stride, int width,
                                        int height, int y, uint8_t val)
 {
@@ -240,79 +222,6 @@ static void lumRangeFromJpeg16_c(int16_t *_dst, int width)
         dst[i] = (dst[i]*(14071/4) + (33561947<<4)/4)>>12;
 }
 
-#ifndef NEW_FILTER
-// *** horizontal scale Y line to temp buffer
-static av_always_inline void hyscale(SwsContext *c, int16_t *dst, int dstWidth,
-                                     const uint8_t *src_in[4],
-                                     int srcW, int xInc,
-                                     const int16_t *hLumFilter,
-                                     const int32_t *hLumFilterPos,
-                                     int hLumFilterSize,
-                                     uint8_t *formatConvBuffer,
-                                     uint32_t *pal, int isAlpha)
-{
-    void (*toYV12)(uint8_t *, const uint8_t *, const uint8_t *, const uint8_t *, int, uint32_t *) =
-        isAlpha ? c->alpToYV12 : c->lumToYV12;
-    void (*convertRange)(int16_t *, int) = isAlpha ? NULL : c->lumConvertRange;
-    const uint8_t *src = src_in[isAlpha ? 3 : 0];
-
-    if (toYV12) {
-        toYV12(formatConvBuffer, src, src_in[1], src_in[2], srcW, pal);
-        src = formatConvBuffer;
-    } else if (c->readLumPlanar && !isAlpha) {
-        c->readLumPlanar(formatConvBuffer, src_in, srcW, c->input_rgb2yuv_table);
-        src = formatConvBuffer;
-    } else if (c->readAlpPlanar && isAlpha) {
-        c->readAlpPlanar(formatConvBuffer, src_in, srcW, NULL);
-        src = formatConvBuffer;
-    }
-
-    if (!c->hyscale_fast) {
-        c->hyScale(c, dst, dstWidth, src, hLumFilter,
-                   hLumFilterPos, hLumFilterSize);
-    } else { // fast bilinear upscale / crap downscale
-        c->hyscale_fast(c, dst, dstWidth, src, srcW, xInc);
-    }
-
-    if (convertRange)
-        convertRange(dst, dstWidth);
-}
-
-static av_always_inline void hcscale(SwsContext *c, int16_t *dst1,
-                                     int16_t *dst2, int dstWidth,
-                                     const uint8_t *src_in[4],
-                                     int srcW, int xInc,
-                                     const int16_t *hChrFilter,
-                                     const int32_t *hChrFilterPos,
-                                     int hChrFilterSize,
-                                     uint8_t *formatConvBuffer, uint32_t *pal)
-{
-    const uint8_t *src1 = src_in[1], *src2 = src_in[2];
-    if (c->chrToYV12) {
-        uint8_t *buf2 = formatConvBuffer +
-                        FFALIGN(srcW*2+78, 16);
-        c->chrToYV12(formatConvBuffer, buf2, src_in[0], src1, src2, srcW, pal);
-        src1= formatConvBuffer;
-        src2= buf2;
-    } else if (c->readChrPlanar) {
-        uint8_t *buf2 = formatConvBuffer +
-                        FFALIGN(srcW*2+78, 16);
-        c->readChrPlanar(formatConvBuffer, buf2, src_in, srcW, c->input_rgb2yuv_table);
-        src1 = formatConvBuffer;
-        src2 = buf2;
-    }
-
-    if (!c->hcscale_fast) {
-        c->hcScale(c, dst1, dstWidth, src1, hChrFilter, hChrFilterPos, hChrFilterSize);
-        c->hcScale(c, dst2, dstWidth, src2, hChrFilter, hChrFilterPos, hChrFilterSize);
-    } else { // fast bilinear upscale / crap downscale
-        c->hcscale_fast(c, dst1, dst2, dstWidth, src1, src2, srcW, xInc);
-    }
-
-    if (c->chrConvertRange)
-        c->chrConvertRange(dst1, dst2, dstWidth);
-}
-#endif /* NEW_FILTER */
 
 #define DEBUG_SWSCALE_BUFFERS 0
 #define DEBUG_BUFFERS(...)                      \
@@ -325,46 +234,17 @@ static int swscale(SwsContext *c, const uint8_t *src[],
 {
     /* load a few things into local vars to make the code more readable?
      * and faster */
-#ifndef NEW_FILTER
-    const int srcW                   = c->srcW;
-#endif
     const int dstW                   = c->dstW;
     const int dstH                   = c->dstH;
-#ifndef NEW_FILTER
-    const int chrDstW                = c->chrDstW;
-    const int chrSrcW                = c->chrSrcW;
-    const int lumXInc                = c->lumXInc;
-    const int chrXInc                = c->chrXInc;
-#endif
+
     const enum AVPixelFormat dstFormat = c->dstFormat;
     const int flags                  = c->flags;
     int32_t *vLumFilterPos           = c->vLumFilterPos;
     int32_t *vChrFilterPos           = c->vChrFilterPos;
-#ifndef NEW_FILTER
-    int32_t *hLumFilterPos           = c->hLumFilterPos;
-    int32_t *hChrFilterPos           = c->hChrFilterPos;
-    int16_t *hLumFilter              = c->hLumFilter;
-    int16_t *hChrFilter              = c->hChrFilter;
-    int32_t *lumMmxFilter            = c->lumMmxFilter;
-    int32_t *chrMmxFilter            = c->chrMmxFilter;
-#endif
+
     const int vLumFilterSize         = c->vLumFilterSize;
     const int vChrFilterSize         = c->vChrFilterSize;
-#ifndef NEW_FILTER
-    const int hLumFilterSize         = c->hLumFilterSize;
-    const int hChrFilterSize         = c->hChrFilterSize;
-    int16_t **lumPixBuf              = c->lumPixBuf;
-    int16_t **chrUPixBuf             = c->chrUPixBuf;
-    int16_t **chrVPixBuf             = c->chrVPixBuf;
-#endif
-    int16_t **alpPixBuf              = c->alpPixBuf;
-    const int vLumBufSize            = c->vLumBufSize;
-    const int vChrBufSize            = c->vChrBufSize;
-#ifndef NEW_FILTER
-    uint8_t *formatConvBuffer        = c->formatConvBuffer;
-    uint32_t *pal                    = c->pal_yuv;
-    int perform_gamma = c->is_internal_gamma;
-#endif
+
     yuv2planar1_fn yuv2plane1        = c->yuv2plane1;
     yuv2planarX_fn yuv2planeX        = c->yuv2planeX;
     yuv2interleavedX_fn yuv2nv12cX   = c->yuv2nv12cX;
@@ -385,7 +265,7 @@ static int swscale(SwsContext *c, const uint8_t *src[],
     int lastInLumBuf = c->lastInLumBuf;
     int lastInChrBuf = c->lastInChrBuf;
 
-#ifdef NEW_FILTER
+
     int lumStart = 0;
     int lumEnd = c->descIndex[0];
     int chrStart = lumEnd;
@@ -397,15 +277,12 @@ static int swscale(SwsContext *c, const uint8_t *src[],
     SwsSlice *vout_slice = &c->slice[c->numSlice-1];
     SwsFilterDescriptor *desc = c->desc;
 
+
+    int needAlpha = c->needAlpha;
+
     int hasLumHoles = 1;
     int hasChrHoles = 1;
-#endif
 
-#ifndef NEW_FILTER
-    if (!usePal(c->srcFormat)) {
-        pal = c->input_rgb2yuv_table;
-    }
-#endif
 
     if (isPacked(c->srcFormat)) {
         src[0] =
@@ -427,8 +304,8 @@ static int swscale(SwsContext *c, const uint8_t *src[],
                   dst[2], dstStride[2], dst[3], dstStride[3]);
     DEBUG_BUFFERS("srcSliceY: %d srcSliceH: %d dstY: %d dstH: %d\n",
                   srcSliceY, srcSliceH, dstY, dstH);
-    DEBUG_BUFFERS("vLumFilterSize: %d vLumBufSize: %d vChrFilterSize: %d vChrBufSize: %d\n",
-                  vLumFilterSize, vLumBufSize, vChrFilterSize, vChrBufSize);
+    DEBUG_BUFFERS("vLumFilterSize: %d vChrFilterSize: %d\n",
+                  vLumFilterSize, vChrFilterSize);
 
     if (dstStride[0]&15 || dstStride[1]&15 ||
         dstStride[2]&15 || dstStride[3]&15) {
@@ -470,7 +347,6 @@ static int swscale(SwsContext *c, const uint8_t *src[],
     }
     lastDstY = dstY;
 
-#ifdef NEW_FILTER
     ff_init_vscale_pfn(c, yuv2plane1, yuv2planeX, yuv2nv12cX,
                    yuv2packed1, yuv2packed2, yuv2packedX, yuv2anyX, c->use_mmx_vfilter);
 
@@ -492,18 +368,9 @@ static int swscale(SwsContext *c, const uint8_t *src[],
         hout_slice->plane[3].sliceH = 0;
         hout_slice->width = dstW;
     }
-#endif
 
     for (; dstY < dstH; dstY++) {
         const int chrDstY = dstY >> c->chrDstVSubSample;
-#ifndef NEW_FILTER
-        uint8_t *dest[4]  = {
-            dst[0] + dstStride[0] * dstY,
-            dst[1] + dstStride[1] * chrDstY,
-            dst[2] + dstStride[2] * chrDstY,
-            (CONFIG_SWSCALE_ALPHA && alpPixBuf) ? dst[3] + dstStride[3] * dstY : NULL,
-        };
-#endif
         int use_mmx_vfilter= c->use_mmx_vfilter;
 
         // First line needed as input
@@ -517,14 +384,13 @@ static int swscale(SwsContext *c, const uint8_t *src[],
         int lastLumSrcY2 = FFMIN(c->srcH,    firstLumSrcY2 + vLumFilterSize) - 1;
         int lastChrSrcY  = FFMIN(c->chrSrcH, firstChrSrcY  + vChrFilterSize) - 1;
         int enough_lines;
-#ifdef NEW_FILTER
+
         int i;
         int posY, cPosY, firstPosY, lastPosY, firstCPosY, lastCPosY;
-#endif
 
         // handle holes (FAST_BILINEAR & weird filters)
         if (firstLumSrcY > lastInLumBuf) {
-#ifdef NEW_FILTER
+
             hasLumHoles = lastInLumBuf != firstLumSrcY - 1;
             if (hasLumHoles) {
                 hout_slice->plane[0].sliceY = firstLumSrcY;
@@ -532,11 +398,11 @@ static int swscale(SwsContext *c, const uint8_t *src[],
                 hout_slice->plane[0].sliceH =
                 hout_slice->plane[3].sliceH = 0;
             }
-#endif
+
             lastInLumBuf = firstLumSrcY - 1;
         }
         if (firstChrSrcY > lastInChrBuf) {
-#ifdef NEW_FILTER
+
             hasChrHoles = lastInChrBuf != firstChrSrcY - 1;
             if (hasChrHoles) {
                 hout_slice->plane[1].sliceY = firstChrSrcY;
@@ -544,11 +410,11 @@ static int swscale(SwsContext *c, const uint8_t *src[],
                 hout_slice->plane[1].sliceH =
                 hout_slice->plane[2].sliceH = 0;
             }
-#endif
+
             lastInChrBuf = firstChrSrcY - 1;
         }
-        av_assert0(firstLumSrcY >= lastInLumBuf - vLumBufSize + 1);
-        av_assert0(firstChrSrcY >= lastInChrBuf - vChrBufSize + 1);
+        av_assert0(firstLumSrcY >= lastInLumBuf - vLumFilterSize + 1);
+        av_assert0(firstChrSrcY >= lastInChrBuf - vChrFilterSize + 1);
 
         DEBUG_BUFFERS("dstY: %d\n", dstY);
         DEBUG_BUFFERS("\tfirstLumSrcY: %d lastLumSrcY: %d lastInLumBuf: %d\n",
@@ -567,7 +433,6 @@ static int swscale(SwsContext *c, const uint8_t *src[],
                           lastLumSrcY, lastChrSrcY);
         }
 
-#ifdef NEW_FILTER
         posY = hout_slice->plane[0].sliceY + hout_slice->plane[0].sliceH;
         if (posY <= lastLumSrcY && !hasLumHoles) {
             firstPosY = FFMAX(firstLumSrcY, posY);
@@ -604,62 +469,11 @@ static int swscale(SwsContext *c, const uint8_t *src[],
         chrBufIndex += lastChrSrcY - lastInChrBuf;
         lastInChrBuf = lastChrSrcY;
 
-#else
-        // Do horizontal scaling
-        while (lastInLumBuf < lastLumSrcY) {
-            const uint8_t *src1[4] = {
-                src[0] + (lastInLumBuf + 1 - srcSliceY) * srcStride[0],
-                src[1] + (lastInLumBuf + 1 - srcSliceY) * srcStride[1],
-                src[2] + (lastInLumBuf + 1 - srcSliceY) * srcStride[2],
-                src[3] + (lastInLumBuf + 1 - srcSliceY) * srcStride[3],
-            };
-            lumBufIndex++;
-            av_assert0(lumBufIndex < 2 * vLumBufSize);
-            av_assert0(lastInLumBuf + 1 - srcSliceY < srcSliceH);
-            av_assert0(lastInLumBuf + 1 - srcSliceY >= 0);
-
-            if (perform_gamma)
-                gamma_convert((uint8_t **)src1, srcW, c->inv_gamma);
-
-            hyscale(c, lumPixBuf[lumBufIndex], dstW, src1, srcW, lumXInc,
-                    hLumFilter, hLumFilterPos, hLumFilterSize,
-                    formatConvBuffer, pal, 0);
-            if (CONFIG_SWSCALE_ALPHA && alpPixBuf)
-                hyscale(c, alpPixBuf[lumBufIndex], dstW, src1, srcW,
-                        lumXInc, hLumFilter, hLumFilterPos, hLumFilterSize,
-                        formatConvBuffer, pal, 1);
-            lastInLumBuf++;
-            DEBUG_BUFFERS("\t\tlumBufIndex %d: lastInLumBuf: %d\n",
-                          lumBufIndex, lastInLumBuf);
-        }
-        while (lastInChrBuf < lastChrSrcY) {
-            const uint8_t *src1[4] = {
-                src[0] + (lastInChrBuf + 1 - chrSrcSliceY) * srcStride[0],
-                src[1] + (lastInChrBuf + 1 - chrSrcSliceY) * srcStride[1],
-                src[2] + (lastInChrBuf + 1 - chrSrcSliceY) * srcStride[2],
-                src[3] + (lastInChrBuf + 1 - chrSrcSliceY) * srcStride[3],
-            };
-            chrBufIndex++;
-            av_assert0(chrBufIndex < 2 * vChrBufSize);
-            av_assert0(lastInChrBuf + 1 - chrSrcSliceY < (chrSrcSliceH));
-            av_assert0(lastInChrBuf + 1 - chrSrcSliceY >= 0);
-            // FIXME replace parameters through context struct (some at least)
-
-            if (c->needs_hcscale)
-                hcscale(c, chrUPixBuf[chrBufIndex], chrVPixBuf[chrBufIndex],
-                        chrDstW, src1, chrSrcW, chrXInc,
-                        hChrFilter, hChrFilterPos, hChrFilterSize,
-                        formatConvBuffer, pal);
-            lastInChrBuf++;
-            DEBUG_BUFFERS("\t\tchrBufIndex %d: lastInChrBuf: %d\n",
-                          chrBufIndex, lastInChrBuf);
-        }
-#endif
         // wrap buf index around to stay inside the ring buffer
-        if (lumBufIndex >= vLumBufSize)
-            lumBufIndex -= vLumBufSize;
-        if (chrBufIndex >= vChrBufSize)
-            chrBufIndex -= vChrBufSize;
+        if (lumBufIndex >= vLumFilterSize)
+            lumBufIndex -= vLumFilterSize;
+        if (chrBufIndex >= vChrFilterSize)
+            chrBufIndex -= vChrFilterSize;
         if (!enough_lines)
             break;  // we can't output a dstY line so let's try with the next slice
 
@@ -682,119 +496,11 @@ static int swscale(SwsContext *c, const uint8_t *src[],
         }
 
         {
-#ifdef NEW_FILTER
             for (i = vStart; i < vEnd; ++i)
                 desc[i].process(c, &desc[i], dstY, 1);
-#else
-            const int16_t **lumSrcPtr  = (const int16_t **)(void*) lumPixBuf  + lumBufIndex + firstLumSrcY - lastInLumBuf + vLumBufSize;
-            const int16_t **chrUSrcPtr = (const int16_t **)(void*) chrUPixBuf + chrBufIndex + firstChrSrcY - lastInChrBuf + vChrBufSize;
-            const int16_t **chrVSrcPtr = (const int16_t **)(void*) chrVPixBuf + chrBufIndex + firstChrSrcY - lastInChrBuf + vChrBufSize;
-            const int16_t **alpSrcPtr  = (CONFIG_SWSCALE_ALPHA && alpPixBuf) ?
-                                         (const int16_t **)(void*) alpPixBuf + lumBufIndex + firstLumSrcY - lastInLumBuf + vLumBufSize : NULL;
-            int16_t *vLumFilter = c->vLumFilter;
-            int16_t *vChrFilter = c->vChrFilter;
-
-            if (isPlanarYUV(dstFormat) ||
-                (isGray(dstFormat) && !isALPHA(dstFormat))) { // YV12 like
-                const int chrSkipMask = (1 << c->chrDstVSubSample) - 1;
-
-                vLumFilter +=    dstY * vLumFilterSize;
-                vChrFilter += chrDstY * vChrFilterSize;
-
-//                 av_assert0(use_mmx_vfilter != (
-//                                yuv2planeX == yuv2planeX_10BE_c
-//                             || yuv2planeX == yuv2planeX_10LE_c
-//                             || yuv2planeX == yuv2planeX_9BE_c
-//                             || yuv2planeX == yuv2planeX_9LE_c
-//                             || yuv2planeX == yuv2planeX_16BE_c
-//                             || yuv2planeX == yuv2planeX_16LE_c
-//                             || yuv2planeX == yuv2planeX_8_c) || !ARCH_X86);
-
-                if(use_mmx_vfilter){
-                    vLumFilter= (int16_t *)c->lumMmxFilter;
-                    vChrFilter= (int16_t *)c->chrMmxFilter;
-                }
-
-                if (vLumFilterSize == 1) {
-                    yuv2plane1(lumSrcPtr[0], dest[0], dstW, c->lumDither8, 0);
-                } else {
-                    yuv2planeX(vLumFilter, vLumFilterSize,
-                               lumSrcPtr, dest[0],
-                               dstW, c->lumDither8, 0);
-                }
-
-                if (!((dstY & chrSkipMask) || isGray(dstFormat))) {
-                    if (yuv2nv12cX) {
-                        yuv2nv12cX(c, vChrFilter,
-                                   vChrFilterSize, chrUSrcPtr, chrVSrcPtr,
-                                   dest[1], chrDstW);
-                    } else if (vChrFilterSize == 1) {
-                        yuv2plane1(chrUSrcPtr[0], dest[1], chrDstW, c->chrDither8, 0);
-                        yuv2plane1(chrVSrcPtr[0], dest[2], chrDstW, c->chrDither8, 3);
-                    } else {
-                        yuv2planeX(vChrFilter,
-                                   vChrFilterSize, chrUSrcPtr, dest[1],
-                                   chrDstW, c->chrDither8, 0);
-                        yuv2planeX(vChrFilter,
-                                   vChrFilterSize, chrVSrcPtr, dest[2],
-                                   chrDstW, c->chrDither8, use_mmx_vfilter ? (c->uv_offx2 >> 1) : 3);
-                    }
-                }
-
-                if (CONFIG_SWSCALE_ALPHA && alpPixBuf) {
-                    if(use_mmx_vfilter){
-                        vLumFilter= (int16_t *)c->alpMmxFilter;
-                    }
-                    if (vLumFilterSize == 1) {
-                        yuv2plane1(alpSrcPtr[0], dest[3], dstW,
-                                   c->lumDither8, 0);
-                    } else {
-                        yuv2planeX(vLumFilter,
-                                   vLumFilterSize, alpSrcPtr, dest[3],
-                                   dstW, c->lumDither8, 0);
-                    }
-                }
-            } else if (yuv2packedX) {
-                av_assert1(lumSrcPtr  + vLumFilterSize - 1 < (const int16_t **)lumPixBuf  + vLumBufSize * 2);
-                av_assert1(chrUSrcPtr + vChrFilterSize - 1 < (const int16_t **)chrUPixBuf + vChrBufSize * 2);
-                if (c->yuv2packed1 && vLumFilterSize == 1 &&
-                    vChrFilterSize <= 2) { // unscaled RGB
-                    int chrAlpha = vChrFilterSize == 1 ? 0 : vChrFilter[2 * dstY + 1];
-                    yuv2packed1(c, *lumSrcPtr, chrUSrcPtr, chrVSrcPtr,
-                                alpPixBuf ? *alpSrcPtr : NULL,
-                                dest[0], dstW, chrAlpha, 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;
-                    yuv2packed2(c, lumSrcPtr, chrUSrcPtr, chrVSrcPtr,
-                                alpPixBuf ? alpSrcPtr : NULL,
-                                dest[0], dstW, lumAlpha, chrAlpha, dstY);
-                } else { // general RGB
-                    yuv2packedX(c, vLumFilter + dstY * vLumFilterSize,
-                                lumSrcPtr, vLumFilterSize,
-                                vChrFilter + dstY * vChrFilterSize,
-                                chrUSrcPtr, chrVSrcPtr, vChrFilterSize,
-                                alpSrcPtr, dest[0], dstW, dstY);
-                }
-            } else {
-                av_assert1(!yuv2packed1 && !yuv2packed2);
-                yuv2anyX(c, vLumFilter + dstY * vLumFilterSize,
-                         lumSrcPtr, vLumFilterSize,
-                         vChrFilter + dstY * vChrFilterSize,
-                         chrUSrcPtr, chrVSrcPtr, vChrFilterSize,
-                         alpSrcPtr, dest, dstW, dstY);
-            }
-            if (perform_gamma)
-                gamma_convert(dest, dstW, c->gamma);
-#endif
         }
     }
-    if (isPlanar(dstFormat) && isALPHA(dstFormat) && !alpPixBuf) {
+    if (isPlanar(dstFormat) && isALPHA(dstFormat) && !needAlpha) {
         int length = dstW;
         int height = dstY - lastDstY;
 
index f48cbac..6647c72 100644 (file)
@@ -350,12 +350,6 @@ typedef struct SwsContext {
      * vertical scaler is called.
      */
     //@{
-    int16_t **lumPixBuf;          ///< Ring buffer for scaled horizontal luma   plane lines to be fed to the vertical scaler.
-    int16_t **chrUPixBuf;         ///< Ring buffer for scaled horizontal chroma plane lines to be fed to the vertical scaler.
-    int16_t **chrVPixBuf;         ///< Ring buffer for scaled horizontal chroma plane lines to be fed to the vertical scaler.
-    int16_t **alpPixBuf;          ///< Ring buffer for scaled horizontal alpha  plane lines to be fed to the vertical scaler.
-    int vLumBufSize;              ///< Number of vertical luma/alpha lines allocated in the ring buffer.
-    int vChrBufSize;              ///< Number of vertical chroma     lines allocated in the ring buffer.
     int lastInLumBuf;             ///< Last scaled horizontal luma/alpha line from source in the ring buffer.
     int lastInChrBuf;             ///< Last scaled horizontal chroma     line from source in the ring buffer.
     int lumBufIndex;              ///< Index in ring buffer of the last scaled horizontal luma/alpha line from source.
@@ -363,6 +357,7 @@ typedef struct SwsContext {
     //@}
 
     uint8_t *formatConvBuffer;
+    int needAlpha;
 
     /**
      * @name Horizontal and vertical filters.
@@ -1038,7 +1033,4 @@ void ff_init_vscale_pfn(SwsContext *c, yuv2planar1_fn yuv2plane1, yuv2planarX_fn
 //number of extra lines to process
 #define MAX_LINES_AHEAD 4
 
-// enable use of refactored scaler code
-#define NEW_FILTER
-
 #endif /* SWSCALE_SWSCALE_INTERNAL_H */
index 1891c22..2507195 100644 (file)
@@ -1696,69 +1696,14 @@ av_cold int sws_init_context(SwsContext *c, SwsFilter *srcFilter,
 #endif
     }
 
-    // calculate buffer sizes so that they won't run out while handling these damn slices
-    c->vLumBufSize = c->vLumFilterSize;
-    c->vChrBufSize = c->vChrFilterSize;
-    for (i = 0; i < dstH; i++) {
-        int chrI      = (int64_t)i * c->chrDstH / dstH;
-        int nextSlice = FFMAX(c->vLumFilterPos[i] + c->vLumFilterSize - 1,
-                              ((c->vChrFilterPos[chrI] + c->vChrFilterSize - 1)
-                               << c->chrSrcVSubSample));
-
-        nextSlice >>= c->chrSrcVSubSample;
-        nextSlice <<= c->chrSrcVSubSample;
-        if (c->vLumFilterPos[i] + c->vLumBufSize < nextSlice)
-            c->vLumBufSize = nextSlice - c->vLumFilterPos[i];
-        if (c->vChrFilterPos[chrI] + c->vChrBufSize <
-            (nextSlice >> c->chrSrcVSubSample))
-            c->vChrBufSize = (nextSlice >> c->chrSrcVSubSample) -
-                             c->vChrFilterPos[chrI];
-    }
-
     for (i = 0; i < 4; i++)
         FF_ALLOCZ_OR_GOTO(c, c->dither_error[i], (c->dstW+2) * sizeof(int), fail);
 
-    /* Allocate pixbufs (we use dynamic allocation because otherwise we would
-     * need to allocate several megabytes to handle all possible cases) */
-    FF_ALLOCZ_OR_GOTO(c, c->lumPixBuf,  c->vLumBufSize * 3 * sizeof(int16_t *), fail);
-    FF_ALLOCZ_OR_GOTO(c, c->chrUPixBuf, c->vChrBufSize * 3 * sizeof(int16_t *), fail);
-    FF_ALLOCZ_OR_GOTO(c, c->chrVPixBuf, c->vChrBufSize * 3 * sizeof(int16_t *), fail);
-    if (CONFIG_SWSCALE_ALPHA && isALPHA(c->srcFormat) && isALPHA(c->dstFormat))
-        FF_ALLOCZ_OR_GOTO(c, c->alpPixBuf, c->vLumBufSize * 3 * sizeof(int16_t *), fail);
-    /* Note we need at least one pixel more at the end because of the MMX code
-     * (just in case someone wants to replace the 4000/8000). */
-    /* align at 16 bytes for AltiVec */
-    for (i = 0; i < c->vLumBufSize; i++) {
-        FF_ALLOCZ_OR_GOTO(c, c->lumPixBuf[i + c->vLumBufSize],
-                          dst_stride + 16, fail);
-        c->lumPixBuf[i] = c->lumPixBuf[i + c->vLumBufSize];
-    }
+    c->needAlpha = (CONFIG_SWSCALE_ALPHA && isALPHA(c->srcFormat) && isALPHA(c->dstFormat)) ? 1 : 0;
+
     // 64 / c->scalingBpp is the same as 16 / sizeof(scaling_intermediate)
     c->uv_off   = (dst_stride>>1) + 64 / (c->dstBpc &~ 7);
     c->uv_offx2 = dst_stride + 16;
-    for (i = 0; i < c->vChrBufSize; i++) {
-        FF_ALLOC_OR_GOTO(c, c->chrUPixBuf[i + c->vChrBufSize],
-                         dst_stride * 2 + 32, fail);
-        c->chrUPixBuf[i] = c->chrUPixBuf[i + c->vChrBufSize];
-        c->chrVPixBuf[i] = c->chrVPixBuf[i + c->vChrBufSize]
-                         = c->chrUPixBuf[i] + (dst_stride >> 1) + 8;
-    }
-    if (CONFIG_SWSCALE_ALPHA && c->alpPixBuf)
-        for (i = 0; i < c->vLumBufSize; i++) {
-            FF_ALLOCZ_OR_GOTO(c, c->alpPixBuf[i + c->vLumBufSize],
-                              dst_stride + 16, fail);
-            c->alpPixBuf[i] = c->alpPixBuf[i + c->vLumBufSize];
-        }
-
-    // try to avoid drawing green stuff between the right end and the stride end
-    for (i = 0; i < c->vChrBufSize; i++)
-        if(desc_dst->comp[0].depth == 16){
-            av_assert0(c->dstBpc > 14);
-            for(j=0; j<dst_stride/2+1; j++)
-                ((int32_t*)(c->chrUPixBuf[i]))[j] = 1<<18;
-        } else
-            for(j=0; j<dst_stride+1; j++)
-                ((int16_t*)(c->chrUPixBuf[i]))[j] = 1<<14;
 
     av_assert0(c->chrDstH <= dstH);
 
@@ -2325,25 +2270,6 @@ void sws_freeContext(SwsContext *c)
     if (!c)
         return;
 
-    if (c->lumPixBuf) {
-        for (i = 0; i < c->vLumBufSize; i++)
-            av_freep(&c->lumPixBuf[i]);
-        av_freep(&c->lumPixBuf);
-    }
-
-    if (c->chrUPixBuf) {
-        for (i = 0; i < c->vChrBufSize; i++)
-            av_freep(&c->chrUPixBuf[i]);
-        av_freep(&c->chrUPixBuf);
-        av_freep(&c->chrVPixBuf);
-    }
-
-    if (CONFIG_SWSCALE_ALPHA && c->alpPixBuf) {
-        for (i = 0; i < c->vLumBufSize; i++)
-            av_freep(&c->alpPixBuf[i]);
-        av_freep(&c->alpPixBuf);
-    }
-
     for (i = 0; i < 4; i++)
         av_freep(&c->dither_error[i]);
 
index 72f799d..72352de 100644 (file)
@@ -218,7 +218,7 @@ int ff_init_vscale(SwsContext *c, SwsFilterDescriptor *desc, SwsSlice *src, SwsS
         desc[0].instance = lumCtx;
         desc[0].src = src;
         desc[0].dst = dst;
-        desc[0].alpha = c->alpPixBuf != 0;
+        desc[0].alpha = c->needAlpha;
 
         if (!isGray(c->dstFormat)) {
             chrCtx = av_mallocz(sizeof(VScalerContext));
@@ -239,7 +239,7 @@ int ff_init_vscale(SwsContext *c, SwsFilterDescriptor *desc, SwsSlice *src, SwsS
         desc[0].instance = lumCtx;
         desc[0].src = src;
         desc[0].dst = dst;
-        desc[0].alpha = c->alpPixBuf != 0;
+        desc[0].alpha = c->needAlpha;
     }
 
     ff_init_vscale_pfn(c, c->yuv2plane1, c->yuv2planeX, c->yuv2nv12cX,
index 66ac7d5..3b370be 100644 (file)
@@ -85,18 +85,12 @@ void ff_updateMMXDitherTables(SwsContext *c, int dstY, int lumBufIndex, int chrB
 {
     const int dstH= c->dstH;
     const int flags= c->flags;
-#ifdef NEW_FILTER
+
     SwsPlane *lumPlane = &c->slice[c->numSlice-2].plane[0];
     SwsPlane *chrUPlane = &c->slice[c->numSlice-2].plane[1];
     SwsPlane *alpPlane = &c->slice[c->numSlice-2].plane[3];
-#else
-    int16_t **lumPixBuf= c->lumPixBuf;
-    int16_t **chrUPixBuf= c->chrUPixBuf;
-    int16_t **alpPixBuf= c->alpPixBuf;
-    const int vLumBufSize= c->vLumBufSize;
-    const int vChrBufSize= c->vChrBufSize;
-#endif
-    int hasAlpha = c->alpPixBuf != NULL;
+
+    int hasAlpha = c->needAlpha;
     int32_t *vLumFilterPos= c->vLumFilterPos;
     int32_t *vChrFilterPos= c->vChrFilterPos;
     int16_t *vLumFilter= c->vLumFilter;
@@ -117,22 +111,14 @@ void ff_updateMMXDitherTables(SwsContext *c, int dstY, int lumBufIndex, int chrB
         c->greenDither= ff_dither4[dstY&1];
     c->redDither= ff_dither8[(dstY+1)&1];
     if (dstY < dstH - 2) {
-#ifdef NEW_FILTER
         const int16_t **lumSrcPtr  = (const int16_t **)(void*) lumPlane->line + firstLumSrcY - lumPlane->sliceY;
         const int16_t **chrUSrcPtr = (const int16_t **)(void*) chrUPlane->line + firstChrSrcY - chrUPlane->sliceY;
-        const int16_t **alpSrcPtr  = (CONFIG_SWSCALE_ALPHA && c->alpPixBuf) ? (const int16_t **)(void*) alpPlane->line + firstLumSrcY - alpPlane->sliceY : NULL;
-#else
-        const int16_t **lumSrcPtr= (const int16_t **)(void*) lumPixBuf + lumBufIndex + firstLumSrcY - lastInLumBuf + vLumBufSize;
-        const int16_t **chrUSrcPtr= (const int16_t **)(void*) chrUPixBuf + chrBufIndex + firstChrSrcY - lastInChrBuf + vChrBufSize;
-        const int16_t **alpSrcPtr= (CONFIG_SWSCALE_ALPHA && alpPixBuf) ? (const int16_t **)(void*) alpPixBuf + lumBufIndex + firstLumSrcY - lastInLumBuf + vLumBufSize : NULL;
-#endif
+        const int16_t **alpSrcPtr  = (CONFIG_SWSCALE_ALPHA && hasAlpha) ? (const int16_t **)(void*) alpPlane->line + firstLumSrcY - alpPlane->sliceY : NULL;
+
         int i;
         if (firstLumSrcY < 0 || firstLumSrcY + vLumFilterSize > c->srcH) {
-#ifdef NEW_FILTER
             const int16_t **tmpY = (const int16_t **) lumPlane->tmp;
-#else
-            const int16_t **tmpY = (const int16_t **) lumPixBuf + 2 * vLumBufSize;
-#endif
+
             int neg = -firstLumSrcY, i, end = FFMIN(c->srcH - firstLumSrcY, vLumFilterSize);
             for (i = 0; i < neg;            i++)
                 tmpY[i] = lumSrcPtr[neg];
@@ -143,11 +129,7 @@ void ff_updateMMXDitherTables(SwsContext *c, int dstY, int lumBufIndex, int chrB
             lumSrcPtr = tmpY;
 
             if (alpSrcPtr) {
-#ifdef NEW_FILTER
                 const int16_t **tmpA = (const int16_t **) alpPlane->tmp;
-#else
-                const int16_t **tmpA = (const int16_t **) alpPixBuf + 2 * vLumBufSize;
-#endif
                 for (i = 0; i < neg;            i++)
                     tmpA[i] = alpSrcPtr[neg];
                 for (     ; i < end;            i++)
@@ -158,11 +140,7 @@ void ff_updateMMXDitherTables(SwsContext *c, int dstY, int lumBufIndex, int chrB
             }
         }
         if (firstChrSrcY < 0 || firstChrSrcY + vChrFilterSize > c->chrSrcH) {
-#ifdef NEW_FILTER
             const int16_t **tmpU = (const int16_t **) chrUPlane->tmp;
-#else
-            const int16_t **tmpU = (const int16_t **) chrUPixBuf + 2 * vChrBufSize;
-#endif
             int neg = -firstChrSrcY, i, end = FFMIN(c->chrSrcH - firstChrSrcY, vChrFilterSize);
             for (i = 0; i < neg;            i++) {
                 tmpU[i] = chrUSrcPtr[neg];
@@ -479,7 +457,7 @@ switch(c->dstBpc){ \
         switch (c->srcFormat) {
         case AV_PIX_FMT_YA8:
             c->lumToYV12 = ff_yuyvToY_mmx;
-            if (c->alpPixBuf)
+            if (c->needAlpha)
                 c->alpToYV12 = ff_uyvyToY_mmx;
             break;
         case AV_PIX_FMT_YUYV422:
@@ -528,7 +506,7 @@ switch(c->dstBpc){ \
         switch (c->srcFormat) {
         case AV_PIX_FMT_YA8:
             c->lumToYV12 = ff_yuyvToY_sse2;
-            if (c->alpPixBuf)
+            if (c->needAlpha)
                 c->alpToYV12 = ff_uyvyToY_sse2;
             break;
         case AV_PIX_FMT_YUYV422:
index bbda6d0..3b38e98 100644 (file)
@@ -348,7 +348,7 @@ static void RENAME(yuv2rgb32_X_ar)(SwsContext *c, const int16_t *lumFilter,
     x86_reg dstW_reg = dstW;
     x86_reg uv_off = c->uv_offx2;
 
-    if (CONFIG_SWSCALE_ALPHA && c->alpPixBuf) {
+    if (CONFIG_SWSCALE_ALPHA && c->needAlpha) {
         YSCALEYUV2PACKEDX_ACCURATE
         YSCALEYUV2RGBX
         "movq                      %%mm2, "U_TEMP"(%0)  \n\t"
@@ -381,7 +381,7 @@ static void RENAME(yuv2rgb32_X)(SwsContext *c, const int16_t *lumFilter,
     x86_reg dstW_reg = dstW;
     x86_reg uv_off = c->uv_offx2;
 
-    if (CONFIG_SWSCALE_ALPHA && c->alpPixBuf) {
+    if (CONFIG_SWSCALE_ALPHA && c->needAlpha) {
         YSCALEYUV2PACKEDX
         YSCALEYUV2RGBX
         YSCALEYUV2PACKEDX_YA(ALP_MMX_FILTER_OFFSET, %%mm0, %%mm3, %%mm6, %%mm1, %%mm7)
@@ -410,7 +410,7 @@ static void RENAME(yuv2bgr32_X)(SwsContext *c, const int16_t *lumFilter,
     x86_reg dstW_reg = dstW;
     x86_reg uv_off = c->uv_offx2;
 
-    if (CONFIG_SWSCALE_ALPHA && c->alpPixBuf) {
+    if (CONFIG_SWSCALE_ALPHA && c->needAlpha) {
         YSCALEYUV2PACKEDX
         YSCALEYUV2RGBX
         YSCALEYUV2PACKEDX_YA(ALP_MMX_FILTER_OFFSET, %%mm0, %%mm3, %%mm6, %%mm1, %%mm7)
@@ -889,7 +889,7 @@ static void RENAME(yuv2rgb32_2)(SwsContext *c, const int16_t *buf[2],
     const int16_t *buf0  = buf[0],  *buf1  = buf[1],
                   *ubuf0 = ubuf[0], *ubuf1 = ubuf[1];
 
-    if (CONFIG_SWSCALE_ALPHA && c->alpPixBuf) {
+    if (CONFIG_SWSCALE_ALPHA && c->needAlpha) {
         const int16_t *abuf0 = abuf[0], *abuf1 = abuf[1];
 #if ARCH_X86_64
         __asm__ volatile(
@@ -1215,7 +1215,7 @@ static void RENAME(yuv2rgb32_1)(SwsContext *c, const int16_t *buf0,
 
     if (uvalpha < 2048) { // note this is not correct (shifts chrominance by 0.5 pixels) but it is a bit faster
         const int16_t *ubuf1 = ubuf[0];
-        if (CONFIG_SWSCALE_ALPHA && c->alpPixBuf) {
+        if (CONFIG_SWSCALE_ALPHA && c->needAlpha) {
             __asm__ volatile(
                 "mov %%"REG_b", "ESP_OFFSET"(%5)        \n\t"
                 "mov        %4, %%"REG_b"               \n\t"
@@ -1244,7 +1244,7 @@ static void RENAME(yuv2rgb32_1)(SwsContext *c, const int16_t *buf0,
         }
     } else {
         const int16_t *ubuf1 = ubuf[1];
-        if (CONFIG_SWSCALE_ALPHA && c->alpPixBuf) {
+        if (CONFIG_SWSCALE_ALPHA && c->needAlpha) {
             __asm__ volatile(
                 "mov %%"REG_b", "ESP_OFFSET"(%5)        \n\t"
                 "mov        %4, %%"REG_b"               \n\t"