changeset 28951:788a99558cf2

Add a fillPlane function to fill a plane with one constant value
author sdrik
date Tue, 17 Mar 2009 19:53:36 +0000
parents 15d4b1684953
children 4c44f716c9da
files libswscale/swscale.c
diffstat 1 files changed, 11 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/libswscale/swscale.c	Tue Mar 17 19:51:52 2009 +0000
+++ b/libswscale/swscale.c	Tue Mar 17 19:53:36 2009 +0000
@@ -953,6 +953,15 @@
     }
 }
 
+static void fillPlane(uint8_t* plane, int stride, int width, int height, int y, uint8_t val){
+    int i;
+    uint8_t *ptr = plane + stride*y;
+    for (i=0; i<height; i++){
+        memset(ptr, val, width);
+        ptr += stride;
+    }
+}
+
 //Note: we have C, X86, MMX, MMX2, 3DNOW versions, there is no 3DNOW+MMX2 one
 //Plain C versions
 #if !HAVE_MMX || defined (RUNTIME_CPUDETECT) || !CONFIG_GPL
@@ -1934,14 +1943,8 @@
 
         if ((isGray(c->srcFormat) || isGray(c->dstFormat)) && plane>0)
         {
-            if (!isGray(c->dstFormat)){
-                int i;
-                uint8_t *ptr = dst[plane] + dstStride[plane]*y;
-                for (i=0; i<height; i++){
-                    memset(ptr, 128, length);
-                    ptr += dstStride[plane];
-                }
-            }
+            if (!isGray(c->dstFormat))
+                fillPlane(dst[plane], dstStride[plane], length, height, y, 128);
         }
         else
         {