gst/videoscale/: Support 1x1 images as input and output as for example the BBC HQ...
authorSebastian Dröge <slomo@circular-chaos.org>
Fri, 2 May 2008 10:02:05 +0000 (10:02 +0000)
committerSebastian Dröge <slomo@circular-chaos.org>
Fri, 2 May 2008 10:02:05 +0000 (10:02 +0000)
Original commit message from CVS:
* gst/videoscale/gstvideoscale.c:
* gst/videoscale/vs_4tap.c: (vs_image_scale_4tap_Y):
* gst/videoscale/vs_image.c: (vs_image_scale_nearest_RGBA),
(vs_image_scale_linear_RGBA), (vs_image_scale_nearest_RGB),
(vs_image_scale_linear_RGB), (vs_image_scale_nearest_YUYV),
(vs_image_scale_linear_YUYV), (vs_image_scale_nearest_UYVY),
(vs_image_scale_linear_UYVY), (vs_image_scale_nearest_Y),
(vs_image_scale_linear_Y), (vs_image_scale_nearest_RGB565),
(vs_image_scale_linear_RGB565), (vs_image_scale_nearest_RGB555),
(vs_image_scale_linear_RGB555):
Support 1x1 images as input and output as for example the BBC HQ new
streams have 1x1 GIFs in the playlists for some reason.

ChangeLog
gst/videoscale/gstvideoscale.c
gst/videoscale/vs_4tap.c
gst/videoscale/vs_image.c

index 7f314b6..f790657 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,18 @@
+2008-05-02  Sebastian Dröge  <slomo@circular-chaos.org>
+
+       * gst/videoscale/gstvideoscale.c:
+       * gst/videoscale/vs_4tap.c: (vs_image_scale_4tap_Y):
+       * gst/videoscale/vs_image.c: (vs_image_scale_nearest_RGBA),
+       (vs_image_scale_linear_RGBA), (vs_image_scale_nearest_RGB),
+       (vs_image_scale_linear_RGB), (vs_image_scale_nearest_YUYV),
+       (vs_image_scale_linear_YUYV), (vs_image_scale_nearest_UYVY),
+       (vs_image_scale_linear_UYVY), (vs_image_scale_nearest_Y),
+       (vs_image_scale_linear_Y), (vs_image_scale_nearest_RGB565),
+       (vs_image_scale_linear_RGB565), (vs_image_scale_nearest_RGB555),
+       (vs_image_scale_linear_RGB555):
+       Support 1x1 images as input and output as for example the BBC HQ new
+       streams have 1x1 GIFs in the playlists for some reason.
+
 2008-05-01  Tim-Philipp Müller  <tim.muller at collabora co uk>
 
        * gst/playback/gstdecodebin.c: (free_pad_probe_for_element),
index fc121e0..f99643e 100644 (file)
@@ -89,10 +89,6 @@ enum
       /* FILL ME */
 };
 
-/* can't handle width/height of 1 yet, since we divide a lot by (n-1) */
-#undef GST_VIDEO_SIZE_RANGE
-#define GST_VIDEO_SIZE_RANGE "(int) [ 2, MAX ]"
-
 static GstStaticCaps gst_video_scale_format_caps[] = {
   GST_STATIC_CAPS (GST_VIDEO_CAPS_RGBx),
   GST_STATIC_CAPS (GST_VIDEO_CAPS_xRGB),
index b254820..931aeec 100644 (file)
@@ -163,8 +163,15 @@ vs_image_scale_4tap_Y (const VSImage * dest, const VSImage * src,
   int xacc;
   int k;
 
-  y_increment = ((src->height - 1) << 16) / (dest->height - 1);
-  x_increment = ((src->width - 1) << 16) / (dest->width - 1);
+  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);
 
   k = 0;
   for (i = 0; i < 4; i++) {
index d29fe8a..fa9afad 100644 (file)
@@ -46,8 +46,16 @@ vs_image_scale_nearest_RGBA (const VSImage * dest, const VSImage * src,
   int x;
   int xacc;
 
-  y_increment = ((src->height - 1) << 16) / (dest->height - 1);
-  x_increment = ((src->width - 1) << 16) / (dest->width - 1);
+  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++) {
@@ -79,8 +87,15 @@ vs_image_scale_linear_RGBA (const VSImage * dest, const VSImage * src,
   int dest_size;
   int xacc;
 
-  y_increment = ((src->height - 1) << 16) / (dest->height - 1);
-  x_increment = ((src->width - 1) << 16) / (dest->width - 1);
+  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 = dest->width * 4;
 
@@ -162,8 +177,15 @@ vs_image_scale_nearest_RGB (const VSImage * dest, const VSImage * src,
   int x;
   int xacc;
 
-  y_increment = ((src->height - 1) << 16) / (dest->height - 1);
-  x_increment = ((src->width - 1) << 16) / (dest->width - 1);
+  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++) {
@@ -195,8 +217,15 @@ vs_image_scale_linear_RGB (const VSImage * dest, const VSImage * src,
   int dest_size;
   int xacc;
 
-  y_increment = ((src->height - 1) << 16) / (dest->height - 1);
-  x_increment = ((src->width - 1) << 16) / (dest->width - 1);
+  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 = dest->width * 3;
 
@@ -280,8 +309,15 @@ vs_image_scale_nearest_YUYV (const VSImage * dest, const VSImage * src,
   int xacc;
   int n_quads;
 
-  y_increment = ((src->height - 1) << 16) / (dest->height - 1);
-  x_increment = ((src->width - 1) << 16) / (dest->width - 1);
+  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);
 
   n_quads = ROUND_UP_2 (dest->width) / 2;
   acc = 0;
@@ -315,8 +351,15 @@ vs_image_scale_linear_YUYV (const VSImage * dest, const VSImage * src,
   int n_quads;
   int xacc;
 
-  y_increment = ((src->height - 1) << 16) / (dest->height - 1);
-  x_increment = ((src->width - 1) << 16) / (dest->width - 1);
+  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 = ROUND_UP_4 (dest->width * 2);
   n_quads = ROUND_UP_2 (dest->width) / 2;
@@ -398,8 +441,15 @@ vs_image_scale_nearest_UYVY (const VSImage * dest, const VSImage * src,
   int xacc;
   int n_quads;
 
-  y_increment = ((src->height - 1) << 16) / (dest->height - 1);
-  x_increment = ((src->width - 1) << 16) / (dest->width - 1);
+  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);
 
   n_quads = (dest->width + 1) / 2;
   acc = 0;
@@ -433,8 +483,15 @@ vs_image_scale_linear_UYVY (const VSImage * dest, const VSImage * src,
   int n_quads;
   int xacc;
 
-  y_increment = ((src->height - 1) << 16) / (dest->height - 1);
-  x_increment = ((src->width - 1) << 16) / (dest->width - 1);
+  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 = ROUND_UP_4 (dest->width * 2);
   n_quads = ROUND_UP_2 (dest->width) / 2;
@@ -515,8 +572,15 @@ vs_image_scale_nearest_Y (const VSImage * dest, const VSImage * src,
   int x;
   int xacc;
 
-  y_increment = ((src->height - 1) << 16) / (dest->height - 1);
-  x_increment = ((src->width - 1) << 16) / (dest->width - 1);
+  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++) {
@@ -548,8 +612,15 @@ vs_image_scale_linear_Y (const VSImage * dest, const VSImage * src,
   int dest_size;
   int xacc;
 
-  y_increment = ((src->height - 1) << 16) / (dest->height - 1);
-  x_increment = ((src->width - 1) << 16) / (dest->width - 1);
+  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 = dest->width;
 
@@ -632,8 +703,15 @@ vs_image_scale_nearest_RGB565 (const VSImage * dest, const VSImage * src,
   int x;
   int xacc;
 
-  y_increment = ((src->height - 1) << 16) / (dest->height - 1);
-  x_increment = ((src->width - 1) << 16) / (dest->width - 1);
+  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++) {
@@ -665,8 +743,15 @@ vs_image_scale_linear_RGB565 (const VSImage * dest, const VSImage * src,
   int dest_size;
   int xacc;
 
-  y_increment = ((src->height - 1) << 16) / (dest->height - 1);
-  x_increment = ((src->width - 1) << 16) / (dest->width - 1);
+  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 = dest->width * 2;
 
@@ -749,8 +834,15 @@ vs_image_scale_nearest_RGB555 (const VSImage * dest, const VSImage * src,
   int x;
   int xacc;
 
-  y_increment = ((src->height - 1) << 16) / (dest->height - 1);
-  x_increment = ((src->width - 1) << 16) / (dest->width - 1);
+  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++) {
@@ -782,8 +874,15 @@ vs_image_scale_linear_RGB555 (const VSImage * dest, const VSImage * src,
   int dest_size;
   int xacc;
 
-  y_increment = ((src->height - 1) << 16) / (dest->height - 1);
-  x_increment = ((src->width - 1) << 16) / (dest->width - 1);
+  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 = dest->width * 2;