gst_plugins_base/gst/videoscale/vs_image.c
branchRCL_3
changeset 30 7e817e7e631c
parent 29 567bb019e3e3
--- a/gst_plugins_base/gst/videoscale/vs_image.c	Tue Aug 31 15:30:33 2010 +0300
+++ b/gst_plugins_base/gst/videoscale/vs_image.c	Wed Sep 01 12:16:41 2010 +0100
@@ -49,16 +49,8 @@
   int x;
   int xacc;
 
-  if (dest->height == 1)
-    y_increment = 0;
-  else
-    y_increment = ((src->height - 1) << 16) / (dest->height - 1);
-
-  if (dest->width == 1)
-    x_increment = 0;
-  else
-    x_increment = ((src->width - 1) << 16) / (dest->width - 1);
-
+  y_increment = ((src->height - 1) << 16) / (dest->height - 1);
+  x_increment = ((src->width - 1) << 16) / (dest->width - 1);
 
   acc = 0;
   for (i = 0; i < dest->height; i++) {
@@ -67,8 +59,7 @@
 
     xacc = 0;
     vs_scanline_resample_nearest_RGBA (dest->pixels + i * dest->stride,
-        src->pixels + j * src->stride, src->width, dest->width, &xacc,
-        x_increment);
+        src->pixels + j * src->stride, dest->width, &xacc, x_increment);
 
     acc += y_increment;
   }
@@ -95,15 +86,8 @@
   int dest_size;
   int xacc;
 
-  if (dest->height == 1)
-    y_increment = 0;
-  else
-    y_increment = ((src->height - 1) << 16) / (dest->height - 1);
-
-  if (dest->width == 1)
-    x_increment = 0;
-  else
-    x_increment = ((src->width - 1) << 16) / (dest->width - 1);
+  y_increment = ((src->height - 1) << 16) / (dest->height - 1);
+  x_increment = ((src->width - 1) << 16) / (dest->width - 1);
 
   dest_size = dest->width * 4;
 
@@ -113,8 +97,8 @@
   acc = 0;
   xacc = 0;
   y2 = -1;
-  vs_scanline_resample_linear_RGBA (tmp1, src->pixels, src->width, dest->width,
-      &xacc, x_increment);
+  vs_scanline_resample_linear_RGBA (tmp1, src->pixels, dest->width, &xacc,
+      x_increment);
   y1 = 0;
   for (i = 0; i < dest->height; i++) {
     j = acc >> 16;
@@ -128,7 +112,7 @@
       } else {
         xacc = 0;
         vs_scanline_resample_linear_RGBA (tmp1, src->pixels + j * src->stride,
-            src->width, dest->width, &xacc, x_increment);
+            dest->width, &xacc, x_increment);
         y1 = j;
         memcpy (dest->pixels + i * dest->stride, tmp1, dest_size);
       }
@@ -137,8 +121,8 @@
         if (j + 1 != y2) {
           xacc = 0;
           vs_scanline_resample_linear_RGBA (tmp2,
-              src->pixels + (j + 1) * src->stride, src->width, dest->width,
-              &xacc, x_increment);
+              src->pixels + (j + 1) * src->stride, dest->width, &xacc,
+              x_increment);
           y2 = j + 1;
         }
         vs_scanline_merge_linear_RGBA (dest->pixels + i * dest->stride,
@@ -147,8 +131,8 @@
         if (j + 1 != y1) {
           xacc = 0;
           vs_scanline_resample_linear_RGBA (tmp1,
-              src->pixels + (j + 1) * src->stride, src->width, dest->width,
-              &xacc, x_increment);
+              src->pixels + (j + 1) * src->stride, dest->width, &xacc,
+              x_increment);
           y1 = j + 1;
         }
         vs_scanline_merge_linear_RGBA (dest->pixels + i * dest->stride,
@@ -156,11 +140,11 @@
       } else {
         xacc = 0;
         vs_scanline_resample_linear_RGBA (tmp1, src->pixels + j * src->stride,
-            src->width, dest->width, &xacc, x_increment);
+            dest->width, &xacc, x_increment);
         y1 = j;
         xacc = 0;
         vs_scanline_resample_linear_RGBA (tmp2,
-            src->pixels + (j + 1) * src->stride, src->width, dest->width, &xacc,
+            src->pixels + (j + 1) * src->stride, dest->width, &xacc,
             x_increment);
         y2 = (j + 1);
         vs_scanline_merge_linear_RGBA (dest->pixels + i * dest->stride,
@@ -189,15 +173,8 @@
   int x;
   int xacc;
 
-  if (dest->height == 1)
-    y_increment = 0;
-  else
-    y_increment = ((src->height - 1) << 16) / (dest->height - 1);
-
-  if (dest->width == 1)
-    x_increment = 0;
-  else
-    x_increment = ((src->width - 1) << 16) / (dest->width - 1);
+  y_increment = ((src->height - 1) << 16) / (dest->height - 1);
+  x_increment = ((src->width - 1) << 16) / (dest->width - 1);
 
   acc = 0;
   for (i = 0; i < dest->height; i++) {
@@ -206,8 +183,7 @@
 
     xacc = 0;
     vs_scanline_resample_nearest_RGB (dest->pixels + i * dest->stride,
-        src->pixels + j * src->stride, src->width, dest->width, &xacc,
-        x_increment);
+        src->pixels + j * src->stride, dest->width, &xacc, x_increment);
 
     acc += y_increment;
   }
@@ -234,15 +210,8 @@
   int dest_size;
   int xacc;
 
-  if (dest->height == 1)
-    y_increment = 0;
-  else
-    y_increment = ((src->height - 1) << 16) / (dest->height - 1);
-
-  if (dest->width == 1)
-    x_increment = 0;
-  else
-    x_increment = ((src->width - 1) << 16) / (dest->width - 1);
+  y_increment = ((src->height - 1) << 16) / (dest->height - 1);
+  x_increment = ((src->width - 1) << 16) / (dest->width - 1);
 
   dest_size = dest->width * 3;
 
@@ -252,8 +221,8 @@
   acc = 0;
   xacc = 0;
   y2 = -1;
-  vs_scanline_resample_linear_RGB (tmp1, src->pixels, src->width, dest->width,
-      &xacc, x_increment);
+  vs_scanline_resample_linear_RGB (tmp1, src->pixels, dest->width, &xacc,
+      x_increment);
   y1 = 0;
   for (i = 0; i < dest->height; i++) {
     j = acc >> 16;
@@ -267,7 +236,7 @@
       } else {
         xacc = 0;
         vs_scanline_resample_linear_RGB (tmp1, src->pixels + j * src->stride,
-            src->width, dest->width, &xacc, x_increment);
+            dest->width, &xacc, x_increment);
         y1 = j;
         memcpy (dest->pixels + i * dest->stride, tmp1, dest_size);
       }
@@ -276,8 +245,8 @@
         if (j + 1 != y2) {
           xacc = 0;
           vs_scanline_resample_linear_RGB (tmp2,
-              src->pixels + (j + 1) * src->stride, src->width, dest->width,
-              &xacc, x_increment);
+              src->pixels + (j + 1) * src->stride, dest->width, &xacc,
+              x_increment);
           y2 = j + 1;
         }
         vs_scanline_merge_linear_RGB (dest->pixels + i * dest->stride,
@@ -286,8 +255,8 @@
         if (j + 1 != y1) {
           xacc = 0;
           vs_scanline_resample_linear_RGB (tmp1,
-              src->pixels + (j + 1) * src->stride, src->width, dest->width,
-              &xacc, x_increment);
+              src->pixels + (j + 1) * src->stride, dest->width, &xacc,
+              x_increment);
           y1 = j + 1;
         }
         vs_scanline_merge_linear_RGB (dest->pixels + i * dest->stride,
@@ -295,11 +264,11 @@
       } else {
         xacc = 0;
         vs_scanline_resample_linear_RGB (tmp1, src->pixels + j * src->stride,
-            src->width, dest->width, &xacc, x_increment);
+            dest->width, &xacc, x_increment);
         y1 = j;
         xacc = 0;
         vs_scanline_resample_linear_RGB (tmp2,
-            src->pixels + (j + 1) * src->stride, src->width, dest->width, &xacc,
+            src->pixels + (j + 1) * src->stride, dest->width, &xacc,
             x_increment);
         y2 = (j + 1);
         vs_scanline_merge_linear_RGB (dest->pixels + i * dest->stride,
@@ -328,17 +297,12 @@
   int j;
   int x;
   int xacc;
-
-  if (dest->height == 1)
-    y_increment = 0;
-  else
-    y_increment = ((src->height - 1) << 16) / (dest->height - 1);
+  int n_quads;
 
-  if (dest->width == 1)
-    x_increment = 0;
-  else
-    x_increment = ((src->width - 1) << 16) / (dest->width - 1);
+  y_increment = ((src->height - 1) << 16) / (dest->height - 1);
+  x_increment = ((src->width - 1) << 16) / (dest->width - 1);
 
+  n_quads = ROUND_UP_2 (dest->width) / 2;
   acc = 0;
   for (i = 0; i < dest->height; i++) {
     j = acc >> 16;
@@ -346,8 +310,7 @@
 
     xacc = 0;
     vs_scanline_resample_nearest_YUYV (dest->pixels + i * dest->stride,
-        src->pixels + j * src->stride, src->width, dest->width, &xacc,
-        x_increment);
+        src->pixels + j * src->stride, n_quads, &xacc, x_increment);
 
     acc += y_increment;
   }
@@ -372,19 +335,14 @@
   int j;
   int x;
   int dest_size;
+  int n_quads;
   int xacc;
 
-  if (dest->height == 1)
-    y_increment = 0;
-  else
-    y_increment = ((src->height - 1) << 16) / (dest->height - 1);
-
-  if (dest->width == 1)
-    x_increment = 0;
-  else
-    x_increment = ((src->width - 1) << 16) / (dest->width - 1);
+  y_increment = ((src->height - 1) << 16) / (dest->height - 1);
+  x_increment = ((src->width - 1) << 16) / (dest->width - 1);
 
   dest_size = ROUND_UP_4 (dest->width * 2);
+  n_quads = ROUND_UP_2 (dest->width) / 2;
 
   tmp1 = tmpbuf;
   tmp2 = tmpbuf + dest_size;
@@ -392,8 +350,8 @@
   acc = 0;
   xacc = 0;
   y2 = -1;
-  vs_scanline_resample_linear_YUYV (tmp1, src->pixels, src->width, dest->width,
-      &xacc, x_increment);
+  vs_scanline_resample_linear_YUYV (tmp1, src->pixels, n_quads, &xacc,
+      x_increment);
   y1 = 0;
   for (i = 0; i < dest->height; i++) {
     j = acc >> 16;
@@ -407,7 +365,7 @@
       } else {
         xacc = 0;
         vs_scanline_resample_linear_YUYV (tmp1, src->pixels + j * src->stride,
-            src->width, dest->width, &xacc, x_increment);
+            n_quads, &xacc, x_increment);
         y1 = j;
         memcpy (dest->pixels + i * dest->stride, tmp1, dest_size);
       }
@@ -416,34 +374,31 @@
         if (j + 1 != y2) {
           xacc = 0;
           vs_scanline_resample_linear_YUYV (tmp2,
-              src->pixels + (j + 1) * src->stride, src->width, dest->width,
-              &xacc, x_increment);
+              src->pixels + (j + 1) * src->stride, n_quads, &xacc, x_increment);
           y2 = j + 1;
         }
         vs_scanline_merge_linear_YUYV (dest->pixels + i * dest->stride,
-            tmp1, tmp2, dest->width, x);
+            tmp1, tmp2, n_quads, x);
       } else if (j == y2) {
         if (j + 1 != y1) {
           xacc = 0;
           vs_scanline_resample_linear_YUYV (tmp1,
-              src->pixels + (j + 1) * src->stride, src->width, dest->width,
-              &xacc, x_increment);
+              src->pixels + (j + 1) * src->stride, n_quads, &xacc, x_increment);
           y1 = j + 1;
         }
         vs_scanline_merge_linear_YUYV (dest->pixels + i * dest->stride,
-            tmp2, tmp1, dest->width, x);
+            tmp2, tmp1, n_quads, x);
       } else {
         xacc = 0;
         vs_scanline_resample_linear_YUYV (tmp1, src->pixels + j * src->stride,
-            src->width, dest->width, &xacc, x_increment);
+            n_quads, &xacc, x_increment);
         y1 = j;
         xacc = 0;
         vs_scanline_resample_linear_YUYV (tmp2,
-            src->pixels + (j + 1) * src->stride, src->width, dest->width,
-            &xacc, x_increment);
+            src->pixels + (j + 1) * src->stride, n_quads, &xacc, x_increment);
         y2 = (j + 1);
         vs_scanline_merge_linear_YUYV (dest->pixels + i * dest->stride,
-            tmp1, tmp2, dest->width, x);
+            tmp1, tmp2, n_quads, x);
       }
     }
 
@@ -468,17 +423,12 @@
   int j;
   int x;
   int xacc;
-
-  if (dest->height == 1)
-    y_increment = 0;
-  else
-    y_increment = ((src->height - 1) << 16) / (dest->height - 1);
+  int n_quads;
 
-  if (dest->width == 1)
-    x_increment = 0;
-  else
-    x_increment = ((src->width - 1) << 16) / (dest->width - 1);
+  y_increment = ((src->height - 1) << 16) / (dest->height - 1);
+  x_increment = ((src->width - 1) << 16) / (dest->width - 1);
 
+  n_quads = (dest->width + 1) / 2;
   acc = 0;
   for (i = 0; i < dest->height; i++) {
     j = acc >> 16;
@@ -486,8 +436,7 @@
 
     xacc = 0;
     vs_scanline_resample_nearest_UYVY (dest->pixels + i * dest->stride,
-        src->pixels + j * src->stride, src->width, dest->width, &xacc,
-        x_increment);
+        src->pixels + j * src->stride, n_quads, &xacc, x_increment);
 
     acc += y_increment;
   }
@@ -512,19 +461,14 @@
   int j;
   int x;
   int dest_size;
+  int n_quads;
   int xacc;
 
-  if (dest->height == 1)
-    y_increment = 0;
-  else
-    y_increment = ((src->height - 1) << 16) / (dest->height - 1);
-
-  if (dest->width == 1)
-    x_increment = 0;
-  else
-    x_increment = ((src->width - 1) << 16) / (dest->width - 1);
+  y_increment = ((src->height - 1) << 16) / (dest->height - 1);
+  x_increment = ((src->width - 1) << 16) / (dest->width - 1);
 
   dest_size = ROUND_UP_4 (dest->width * 2);
+  n_quads = ROUND_UP_2 (dest->width) / 2;
 
   tmp1 = tmpbuf;
   tmp2 = tmpbuf + dest_size;
@@ -532,8 +476,8 @@
   acc = 0;
   xacc = 0;
   y2 = -1;
-  vs_scanline_resample_linear_UYVY (tmp1, src->pixels, src->width, dest->width,
-      &xacc, x_increment);
+  vs_scanline_resample_linear_UYVY (tmp1, src->pixels, n_quads, &xacc,
+      x_increment);
   y1 = 0;
   for (i = 0; i < dest->height; i++) {
     j = acc >> 16;
@@ -547,7 +491,7 @@
       } else {
         xacc = 0;
         vs_scanline_resample_linear_UYVY (tmp1, src->pixels + j * src->stride,
-            src->width, dest->width, &xacc, x_increment);
+            n_quads, &xacc, x_increment);
         y1 = j;
         memcpy (dest->pixels + i * dest->stride, tmp1, dest_size);
       }
@@ -556,34 +500,31 @@
         if (j + 1 != y2) {
           xacc = 0;
           vs_scanline_resample_linear_UYVY (tmp2,
-              src->pixels + (j + 1) * src->stride, src->width, dest->width,
-              &xacc, x_increment);
+              src->pixels + (j + 1) * src->stride, n_quads, &xacc, x_increment);
           y2 = j + 1;
         }
         vs_scanline_merge_linear_UYVY (dest->pixels + i * dest->stride,
-            tmp1, tmp2, dest->width, x);
+            tmp1, tmp2, n_quads, x);
       } else if (j == y2) {
         if (j + 1 != y1) {
           xacc = 0;
           vs_scanline_resample_linear_UYVY (tmp1,
-              src->pixels + (j + 1) * src->stride, src->width, dest->width,
-              &xacc, x_increment);
+              src->pixels + (j + 1) * src->stride, n_quads, &xacc, x_increment);
           y1 = j + 1;
         }
         vs_scanline_merge_linear_UYVY (dest->pixels + i * dest->stride,
-            tmp2, tmp1, dest->width, x);
+            tmp2, tmp1, n_quads, x);
       } else {
         xacc = 0;
         vs_scanline_resample_linear_UYVY (tmp1, src->pixels + j * src->stride,
-            src->width, dest->width, &xacc, x_increment);
+            n_quads, &xacc, x_increment);
         y1 = j;
         xacc = 0;
         vs_scanline_resample_linear_UYVY (tmp2,
-            src->pixels + (j + 1) * src->stride, src->width, dest->width,
-            &xacc, x_increment);
+            src->pixels + (j + 1) * src->stride, n_quads, &xacc, x_increment);
         y2 = (j + 1);
         vs_scanline_merge_linear_UYVY (dest->pixels + i * dest->stride,
-            tmp1, tmp2, dest->width, x);
+            tmp1, tmp2, n_quads, x);
       }
     }
 
@@ -609,15 +550,8 @@
   int x;
   int xacc;
 
-  if (dest->height == 1)
-    y_increment = 0;
-  else
-    y_increment = ((src->height - 1) << 16) / (dest->height - 1);
-
-  if (dest->width == 1)
-    x_increment = 0;
-  else
-    x_increment = ((src->width - 1) << 16) / (dest->width - 1);
+  y_increment = ((src->height - 1) << 16) / (dest->height - 1);
+  x_increment = ((src->width - 1) << 16) / (dest->width - 1);
 
   acc = 0;
   for (i = 0; i < dest->height; i++) {
@@ -626,8 +560,7 @@
 
     xacc = 0;
     vs_scanline_resample_nearest_Y (dest->pixels + i * dest->stride,
-        src->pixels + j * src->stride, src->width, dest->width, &xacc,
-        x_increment);
+        src->pixels + j * src->stride, dest->width, &xacc, x_increment);
 
     acc += y_increment;
   }
@@ -654,15 +587,8 @@
   int dest_size;
   int xacc;
 
-  if (dest->height == 1)
-    y_increment = 0;
-  else
-    y_increment = ((src->height - 1) << 16) / (dest->height - 1);
-
-  if (dest->width == 1)
-    x_increment = 0;
-  else
-    x_increment = ((src->width - 1) << 16) / (dest->width - 1);
+  y_increment = ((src->height - 1) << 16) / (dest->height - 1);
+  x_increment = ((src->width - 1) << 16) / (dest->width - 1);
 
   dest_size = dest->width;
 
@@ -672,8 +598,8 @@
   acc = 0;
   xacc = 0;
   y2 = -1;
-  vs_scanline_resample_linear_Y (tmp1, src->pixels, src->width, dest->width,
-      &xacc, x_increment);
+  vs_scanline_resample_linear_Y (tmp1, src->pixels, dest->width, &xacc,
+      x_increment);
   y1 = 0;
   for (i = 0; i < dest->height; i++) {
     j = acc >> 16;
@@ -687,7 +613,7 @@
       } else {
         xacc = 0;
         vs_scanline_resample_linear_Y (tmp1, src->pixels + j * src->stride,
-            src->width, dest->width, &xacc, x_increment);
+            dest->width, &xacc, x_increment);
         y1 = j;
         memcpy (dest->pixels + i * dest->stride, tmp1, dest_size);
       }
@@ -696,8 +622,8 @@
         if (j + 1 != y2) {
           xacc = 0;
           vs_scanline_resample_linear_Y (tmp2,
-              src->pixels + (j + 1) * src->stride, src->width, dest->width,
-              &xacc, x_increment);
+              src->pixels + (j + 1) * src->stride, dest->width, &xacc,
+              x_increment);
           y2 = j + 1;
         }
         vs_scanline_merge_linear_Y (dest->pixels + i * dest->stride,
@@ -706,8 +632,8 @@
         if (j + 1 != y1) {
           xacc = 0;
           vs_scanline_resample_linear_Y (tmp1,
-              src->pixels + (j + 1) * src->stride, src->width, dest->width,
-              &xacc, x_increment);
+              src->pixels + (j + 1) * src->stride, dest->width, &xacc,
+              x_increment);
           y1 = j + 1;
         }
         vs_scanline_merge_linear_Y (dest->pixels + i * dest->stride,
@@ -715,11 +641,11 @@
       } else {
         xacc = 0;
         vs_scanline_resample_linear_Y (tmp1, src->pixels + j * src->stride,
-            src->width, dest->width, &xacc, x_increment);
+            dest->width, &xacc, x_increment);
         y1 = j;
         xacc = 0;
         vs_scanline_resample_linear_Y (tmp2,
-            src->pixels + (j + 1) * src->stride, src->width, dest->width, &xacc,
+            src->pixels + (j + 1) * src->stride, dest->width, &xacc,
             x_increment);
         y2 = (j + 1);
         vs_scanline_merge_linear_Y (dest->pixels + i * dest->stride,
@@ -730,142 +656,6 @@
     acc += y_increment;
   }
 }
-#ifdef __SYMBIAN32__
-EXPORT_C
-#endif
-
-void
-vs_image_scale_nearest_Y16 (const VSImage * dest, const VSImage * src,
-    uint8_t * tmpbuf)
-{
-  int acc;
-  int y_increment;
-  int x_increment;
-  int i;
-  int j;
-  int x;
-  int xacc;
-
-  if (dest->height == 1)
-    y_increment = 0;
-  else
-    y_increment = ((src->height - 1) << 16) / (dest->height - 1);
-
-  if (dest->width == 1)
-    x_increment = 0;
-  else
-    x_increment = ((src->width - 1) << 16) / (dest->width - 1);
-
-  acc = 0;
-  for (i = 0; i < dest->height; i++) {
-    j = acc >> 16;
-    x = acc & 0xffff;
-
-    xacc = 0;
-    vs_scanline_resample_nearest_Y16 (dest->pixels + i * dest->stride,
-        src->pixels + j * src->stride, src->width, dest->width, &xacc,
-        x_increment);
-
-    acc += y_increment;
-  }
-}
-#ifdef __SYMBIAN32__
-EXPORT_C
-#endif
-
-void
-vs_image_scale_linear_Y16 (const VSImage * dest, const VSImage * src,
-    uint8_t * tmpbuf)
-{
-  int acc;
-  int y_increment;
-  int x_increment;
-  uint8_t *tmp1;
-  uint8_t *tmp2;
-  int y1;
-  int y2;
-  int i;
-  int j;
-  int x;
-  int dest_size;
-  int xacc;
-
-  if (dest->height == 1)
-    y_increment = 0;
-  else
-    y_increment = ((src->height - 1) << 16) / (dest->height - 1);
-
-  if (dest->width == 1)
-    x_increment = 0;
-  else
-    x_increment = ((src->width - 1) << 16) / (dest->width - 1);
-
-  dest_size = 2 * dest->width;
-
-  tmp1 = tmpbuf;
-  tmp2 = tmpbuf + dest_size;
-
-  acc = 0;
-  xacc = 0;
-  y2 = -1;
-  vs_scanline_resample_linear_Y16 (tmp1, src->pixels, src->width, dest->width,
-      &xacc, x_increment);
-  y1 = 0;
-  for (i = 0; i < dest->height; i++) {
-    j = acc >> 16;
-    x = acc & 0xffff;
-
-    if (x == 0) {
-      if (j == y1) {
-        memcpy (dest->pixels + i * dest->stride, tmp1, dest_size);
-      } else if (j == y2) {
-        memcpy (dest->pixels + i * dest->stride, tmp2, dest_size);
-      } else {
-        xacc = 0;
-        vs_scanline_resample_linear_Y16 (tmp1, src->pixels + j * src->stride,
-            src->width, dest->width, &xacc, x_increment);
-        y1 = j;
-        memcpy (dest->pixels + i * dest->stride, tmp1, dest_size);
-      }
-    } else {
-      if (j == y1) {
-        if (j + 1 != y2) {
-          xacc = 0;
-          vs_scanline_resample_linear_Y16 (tmp2,
-              src->pixels + (j + 1) * src->stride, src->width, dest->width,
-              &xacc, x_increment);
-          y2 = j + 1;
-        }
-        vs_scanline_merge_linear_Y16 (dest->pixels + i * dest->stride,
-            tmp1, tmp2, dest->width, x);
-      } else if (j == y2) {
-        if (j + 1 != y1) {
-          xacc = 0;
-          vs_scanline_resample_linear_Y16 (tmp1,
-              src->pixels + (j + 1) * src->stride, src->width, dest->width,
-              &xacc, x_increment);
-          y1 = j + 1;
-        }
-        vs_scanline_merge_linear_Y16 (dest->pixels + i * dest->stride,
-            tmp2, tmp1, dest->width, x);
-      } else {
-        xacc = 0;
-        vs_scanline_resample_linear_Y16 (tmp1, src->pixels + j * src->stride,
-            src->width, dest->width, &xacc, x_increment);
-        y1 = j;
-        xacc = 0;
-        vs_scanline_resample_linear_Y16 (tmp2,
-            src->pixels + (j + 1) * src->stride, src->width, dest->width, &xacc,
-            x_increment);
-        y2 = (j + 1);
-        vs_scanline_merge_linear_Y16 (dest->pixels + i * dest->stride,
-            tmp1, tmp2, dest->width, x);
-      }
-    }
-
-    acc += y_increment;
-  }
-}
 
 /* RGB565 */
 #ifdef __SYMBIAN32__
@@ -885,15 +675,8 @@
   int x;
   int xacc;
 
-  if (dest->height == 1)
-    y_increment = 0;
-  else
-    y_increment = ((src->height - 1) << 16) / (dest->height - 1);
-
-  if (dest->width == 1)
-    x_increment = 0;
-  else
-    x_increment = ((src->width - 1) << 16) / (dest->width - 1);
+  y_increment = ((src->height - 1) << 16) / (dest->height - 1);
+  x_increment = ((src->width - 1) << 16) / (dest->width - 1);
 
   acc = 0;
   for (i = 0; i < dest->height; i++) {
@@ -902,8 +685,7 @@
 
     xacc = 0;
     vs_scanline_resample_nearest_RGB565 (dest->pixels + i * dest->stride,
-        src->pixels + j * src->stride, src->width, dest->width, &xacc,
-        x_increment);
+        src->pixels + j * src->stride, dest->width, &xacc, x_increment);
 
     acc += y_increment;
   }
@@ -930,15 +712,8 @@
   int dest_size;
   int xacc;
 
-  if (dest->height == 1)
-    y_increment = 0;
-  else
-    y_increment = ((src->height - 1) << 16) / (dest->height - 1);
-
-  if (dest->width == 1)
-    x_increment = 0;
-  else
-    x_increment = ((src->width - 1) << 16) / (dest->width - 1);
+  y_increment = ((src->height - 1) << 16) / (dest->height - 1);
+  x_increment = ((src->width - 1) << 16) / (dest->width - 1);
 
   dest_size = dest->width * 2;
 
@@ -948,8 +723,8 @@
   acc = 0;
   xacc = 0;
   y2 = -1;
-  vs_scanline_resample_linear_RGB565 (tmp1, src->pixels, src->width,
-      dest->width, &xacc, x_increment);
+  vs_scanline_resample_linear_RGB565 (tmp1, src->pixels, dest->width, &xacc,
+      x_increment);
   y1 = 0;
   for (i = 0; i < dest->height; i++) {
     j = acc >> 16;
@@ -963,7 +738,7 @@
       } else {
         xacc = 0;
         vs_scanline_resample_linear_RGB565 (tmp1, src->pixels + j * src->stride,
-            src->width, dest->width, &xacc, x_increment);
+            dest->width, &xacc, x_increment);
         y1 = j;
         memcpy (dest->pixels + i * dest->stride, tmp1, dest_size);
       }
@@ -972,8 +747,8 @@
         if (j + 1 != y2) {
           xacc = 0;
           vs_scanline_resample_linear_RGB565 (tmp2,
-              src->pixels + (j + 1) * src->stride, src->width, dest->width,
-              &xacc, x_increment);
+              src->pixels + (j + 1) * src->stride, dest->width, &xacc,
+              x_increment);
           y2 = j + 1;
         }
         vs_scanline_merge_linear_RGB565 (dest->pixels + i * dest->stride,
@@ -982,8 +757,8 @@
         if (j + 1 != y1) {
           xacc = 0;
           vs_scanline_resample_linear_RGB565 (tmp1,
-              src->pixels + (j + 1) * src->stride, src->width, dest->width,
-              &xacc, x_increment);
+              src->pixels + (j + 1) * src->stride, dest->width, &xacc,
+              x_increment);
           y1 = j + 1;
         }
         vs_scanline_merge_linear_RGB565 (dest->pixels + i * dest->stride,
@@ -991,11 +766,11 @@
       } else {
         xacc = 0;
         vs_scanline_resample_linear_RGB565 (tmp1, src->pixels + j * src->stride,
-            src->width, dest->width, &xacc, x_increment);
+            dest->width, &xacc, x_increment);
         y1 = j;
         xacc = 0;
         vs_scanline_resample_linear_RGB565 (tmp2,
-            src->pixels + (j + 1) * src->stride, src->width, dest->width, &xacc,
+            src->pixels + (j + 1) * src->stride, dest->width, &xacc,
             x_increment);
         y2 = (j + 1);
         vs_scanline_merge_linear_RGB565 (dest->pixels + i * dest->stride,
@@ -1025,15 +800,8 @@
   int x;
   int xacc;
 
-  if (dest->height == 1)
-    y_increment = 0;
-  else
-    y_increment = ((src->height - 1) << 16) / (dest->height - 1);
-
-  if (dest->width == 1)
-    x_increment = 0;
-  else
-    x_increment = ((src->width - 1) << 16) / (dest->width - 1);
+  y_increment = ((src->height - 1) << 16) / (dest->height - 1);
+  x_increment = ((src->width - 1) << 16) / (dest->width - 1);
 
   acc = 0;
   for (i = 0; i < dest->height; i++) {
@@ -1042,8 +810,7 @@
 
     xacc = 0;
     vs_scanline_resample_nearest_RGB555 (dest->pixels + i * dest->stride,
-        src->pixels + j * src->stride, src->width, dest->width, &xacc,
-        x_increment);
+        src->pixels + j * src->stride, dest->width, &xacc, x_increment);
 
     acc += y_increment;
   }
@@ -1070,15 +837,8 @@
   int dest_size;
   int xacc;
 
-  if (dest->height == 1)
-    y_increment = 0;
-  else
-    y_increment = ((src->height - 1) << 16) / (dest->height - 1);
-
-  if (dest->width == 1)
-    x_increment = 0;
-  else
-    x_increment = ((src->width - 1) << 16) / (dest->width - 1);
+  y_increment = ((src->height - 1) << 16) / (dest->height - 1);
+  x_increment = ((src->width - 1) << 16) / (dest->width - 1);
 
   dest_size = dest->width * 2;
 
@@ -1088,8 +848,8 @@
   acc = 0;
   xacc = 0;
   y2 = -1;
-  vs_scanline_resample_linear_RGB555 (tmp1, src->pixels, src->width,
-      dest->width, &xacc, x_increment);
+  vs_scanline_resample_linear_RGB555 (tmp1, src->pixels, dest->width, &xacc,
+      x_increment);
   y1 = 0;
   for (i = 0; i < dest->height; i++) {
     j = acc >> 16;
@@ -1103,7 +863,7 @@
       } else {
         xacc = 0;
         vs_scanline_resample_linear_RGB555 (tmp1, src->pixels + j * src->stride,
-            src->width, dest->width, &xacc, x_increment);
+            dest->width, &xacc, x_increment);
         y1 = j;
         memcpy (dest->pixels + i * dest->stride, tmp1, dest_size);
       }
@@ -1112,8 +872,8 @@
         if (j + 1 != y2) {
           xacc = 0;
           vs_scanline_resample_linear_RGB555 (tmp2,
-              src->pixels + (j + 1) * src->stride, src->width, dest->width,
-              &xacc, x_increment);
+              src->pixels + (j + 1) * src->stride, dest->width, &xacc,
+              x_increment);
           y2 = j + 1;
         }
         vs_scanline_merge_linear_RGB555 (dest->pixels + i * dest->stride,
@@ -1122,8 +882,8 @@
         if (j + 1 != y1) {
           xacc = 0;
           vs_scanline_resample_linear_RGB555 (tmp1,
-              src->pixels + (j + 1) * src->stride, src->width, dest->width,
-              &xacc, x_increment);
+              src->pixels + (j + 1) * src->stride, dest->width, &xacc,
+              x_increment);
           y1 = j + 1;
         }
         vs_scanline_merge_linear_RGB555 (dest->pixels + i * dest->stride,
@@ -1131,11 +891,11 @@
       } else {
         xacc = 0;
         vs_scanline_resample_linear_RGB555 (tmp1, src->pixels + j * src->stride,
-            src->width, dest->width, &xacc, x_increment);
+            dest->width, &xacc, x_increment);
         y1 = j;
         xacc = 0;
         vs_scanline_resample_linear_RGB555 (tmp2,
-            src->pixels + (j + 1) * src->stride, src->width, dest->width, &xacc,
+            src->pixels + (j + 1) * src->stride, dest->width, &xacc,
             x_increment);
         y2 = (j + 1);
         vs_scanline_merge_linear_RGB555 (dest->pixels + i * dest->stride,