]> git.sesse.net Git - ffmpeg/blobdiff - libswscale/swscale.c
swscale/yuv2rgb: cosmetics
[ffmpeg] / libswscale / swscale.c
index 4ecfa88ff75c0705cac6fdb67a0fb2ec05f7216d..9cb7e8f6acd065ce7838ec54a1f475f5dd35dbec 100644 (file)
@@ -266,8 +266,6 @@ static int swscale(SwsContext *c, const uint8_t *src[],
 
     /* vars which will change and which we need to store back in the context */
     int dstY         = c->dstY;
-    int lumBufIndex  = c->lumBufIndex;
-    int chrBufIndex  = c->chrBufIndex;
     int lastInLumBuf = c->lastInLumBuf;
     int lastInChrBuf = c->lastInChrBuf;
 
@@ -295,8 +293,8 @@ static int swscale(SwsContext *c, const uint8_t *src[],
         srcStride[2] =
         srcStride[3] = srcStride[0];
     }
-    srcStride[1] <<= c->vChrDrop;
-    srcStride[2] <<= c->vChrDrop;
+    srcStride[1] *= 1 << c->vChrDrop;
+    srcStride[2] *= 1 << c->vChrDrop;
 
     DEBUG_BUFFERS("swscale() %p[%d] %p[%d] %p[%d] %p[%d] -> %p[%d] %p[%d] %p[%d] %p[%d]\n",
                   src[0], srcStride[0], src[1], srcStride[1],
@@ -336,8 +334,6 @@ static int swscale(SwsContext *c, const uint8_t *src[],
      * will not get executed. This is not really intended but works
      * currently, so people might do it. */
     if (srcSliceY == 0) {
-        lumBufIndex  = -1;
-        chrBufIndex  = -1;
         dstY         = 0;
         lastInLumBuf = -1;
         lastInChrBuf = -1;
@@ -461,7 +457,6 @@ static int swscale(SwsContext *c, const uint8_t *src[],
                 desc[i].process(c, &desc[i], firstPosY, lastPosY - firstPosY + 1);
         }
 
-        lumBufIndex += lastLumSrcY - lastInLumBuf;
         lastInLumBuf = lastLumSrcY;
 
         if (cPosY < lastChrSrcY + 1) {
@@ -469,20 +464,13 @@ static int swscale(SwsContext *c, const uint8_t *src[],
                 desc[i].process(c, &desc[i], firstCPosY, lastCPosY - firstCPosY + 1);
         }
 
-        chrBufIndex += lastChrSrcY - lastInChrBuf;
         lastInChrBuf = lastChrSrcY;
 
-        // wrap buf index around to stay inside the ring buffer
-        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
 
 #if HAVE_MMX_INLINE
-        ff_updateMMXDitherTables(c, dstY, lumBufIndex, chrBufIndex,
-                              lastInLumBuf, lastInChrBuf);
+        ff_updateMMXDitherTables(c, dstY);
 #endif
         if (should_dither) {
             c->chrDither8 = ff_dither_8x8_128[chrDstY & 7];
@@ -512,6 +500,11 @@ static int swscale(SwsContext *c, const uint8_t *src[],
             fillPlane16(dst[3], dstStride[3], length, height, lastDstY,
                     1, desc->comp[3].depth,
                     isBE(dstFormat));
+        } else if (is32BPS(dstFormat)) {
+            const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(dstFormat);
+            fillPlane32(dst[3], dstStride[3], length, height, lastDstY,
+                    1, desc->comp[3].depth,
+                    isBE(dstFormat), desc->flags & AV_PIX_FMT_FLAG_FLOAT);
         } else
             fillPlane(dst[3], dstStride[3], length, height, lastDstY, 255);
     }
@@ -524,8 +517,6 @@ static int swscale(SwsContext *c, const uint8_t *src[],
 
     /* store changed local vars back in the context */
     c->dstY         = dstY;
-    c->lumBufIndex  = lumBufIndex;
-    c->chrBufIndex  = chrBufIndex;
     c->lastInLumBuf = lastInLumBuf;
     c->lastInChrBuf = lastInChrBuf;