diff --git a/ChangeLog b/ChangeLog index 7f314b6b54..f790657c51 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,18 @@ +2008-05-02 Sebastian Dröge + + * 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 * gst/playback/gstdecodebin.c: (free_pad_probe_for_element), diff --git a/gst/videoscale/gstvideoscale.c b/gst/videoscale/gstvideoscale.c index fc121e0a8e..f99643e262 100644 --- a/gst/videoscale/gstvideoscale.c +++ b/gst/videoscale/gstvideoscale.c @@ -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), diff --git a/gst/videoscale/vs_4tap.c b/gst/videoscale/vs_4tap.c index b25482076f..931aeec594 100644 --- a/gst/videoscale/vs_4tap.c +++ b/gst/videoscale/vs_4tap.c @@ -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++) { diff --git a/gst/videoscale/vs_image.c b/gst/videoscale/vs_image.c index d29fe8aa98..fa9afad5b9 100644 --- a/gst/videoscale/vs_image.c +++ b/gst/videoscale/vs_image.c @@ -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;