From 0b5e203b19959d096a1dd84a30c668a8c6c5538e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim-Philipp=20M=C3=BCller?= Date: Thu, 21 Apr 2011 14:11:49 +0100 Subject: [PATCH 01/10] tests: add unit test for basetransform/videoscale negotiation regression Turn Rene's test pipeline into a unit test. https://bugzilla.gnome.org/show_bug.cgi?id=648220 --- tests/check/elements/videoscale.c | 55 ++++++++++++++++++++++++++++--- 1 file changed, 51 insertions(+), 4 deletions(-) diff --git a/tests/check/elements/videoscale.c b/tests/check/elements/videoscale.c index 75f16dfdca..276261f3b0 100644 --- a/tests/check/elements/videoscale.c +++ b/tests/check/elements/videoscale.c @@ -650,12 +650,8 @@ static void gst_test_reverse_negotiation_sink_class_init (GstTestReverseNegotiationSinkClass * klass) { - GObjectClass *gobject_class; - GstElementClass *gstelement_class; GstBaseSinkClass *gstbase_sink_class; - gobject_class = G_OBJECT_CLASS (klass); - gstelement_class = GST_ELEMENT_CLASS (klass); gstbase_sink_class = GST_BASE_SINK_CLASS (klass); gstbase_sink_class->buffer_alloc = @@ -764,6 +760,56 @@ GST_START_TEST (test_reverse_negotiation) GST_END_TEST; +GST_START_TEST (test_basetransform_negotiation) +{ + GstElement *pipeline, *src, *sink, *scale, *capsfilter1, *capsfilter2; + GstMessage *msg; + GstCaps *caps; + + pipeline = gst_pipeline_new (NULL); + src = gst_element_factory_make ("videotestsrc", NULL); + capsfilter1 = gst_element_factory_make ("capsfilter", NULL); + scale = gst_element_factory_make ("videoscale", NULL); + capsfilter2 = gst_element_factory_make ("capsfilter", NULL); + sink = gst_element_factory_make ("fakesink", NULL); + fail_unless (pipeline && src && capsfilter1 && scale && capsfilter2 && sink); + + g_object_set (src, "num-buffers", 3, NULL); + + caps = gst_caps_new_simple ("video/x-raw-yuv", "format", GST_TYPE_FOURCC, + GST_MAKE_FOURCC ('U', 'Y', 'V', 'Y'), "width", G_TYPE_INT, 352, + "height", G_TYPE_INT, 288, "framerate", GST_TYPE_FRACTION, 30, 1, + "pixel-aspect-ratio", GST_TYPE_FRACTION, 1, 1, NULL); + g_object_set (capsfilter1, "caps", caps, NULL); + gst_caps_unref (caps); + + /* same caps, just different pixel-aspect-ratio */ + caps = gst_caps_new_simple ("video/x-raw-yuv", "format", GST_TYPE_FOURCC, + GST_MAKE_FOURCC ('U', 'Y', 'V', 'Y'), "width", G_TYPE_INT, 352, + "height", G_TYPE_INT, 288, "framerate", GST_TYPE_FRACTION, 30, 1, + "pixel-aspect-ratio", GST_TYPE_FRACTION, 12, 11, NULL); + g_object_set (capsfilter2, "caps", caps, NULL); + gst_caps_unref (caps); + + gst_bin_add_many (GST_BIN (pipeline), src, capsfilter1, scale, capsfilter2, + sink, NULL); + fail_unless (gst_element_link_many (src, capsfilter1, scale, capsfilter2, + sink, NULL)); + + fail_unless_equals_int (gst_element_set_state (pipeline, GST_STATE_PLAYING), + GST_STATE_CHANGE_ASYNC); + + msg = gst_bus_timed_pop_filtered (GST_ELEMENT_BUS (pipeline), -1, + GST_MESSAGE_EOS | GST_MESSAGE_ERROR); + fail_unless_equals_int (GST_MESSAGE_TYPE (msg), GST_MESSAGE_EOS); + gst_message_unref (msg); + + gst_element_set_state (pipeline, GST_STATE_NULL); + gst_object_unref (pipeline); +} + +GST_END_TEST; + static Suite * videoscale_suite (void) { @@ -811,6 +857,7 @@ videoscale_suite (void) tcase_add_test (tc_chain, test_upscale_1x240_640x480_method_2); tcase_add_test (tc_chain, test_negotiation); tcase_add_test (tc_chain, test_reverse_negotiation); + tcase_add_test (tc_chain, test_basetransform_negotiation); GST_ERROR ("FIXME: test 64-bpp formats as well"); return s; From f78a50ed4f7ad21fc23de206356f6d0ce1146914 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim-Philipp=20M=C3=BCller?= Date: Sun, 24 Apr 2011 12:16:47 +0100 Subject: [PATCH 02/10] tag: update some FIXMEs for 0.11 --- gst-libs/gst/tag/tag.h | 2 +- gst-libs/gst/tag/tags.c | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/gst-libs/gst/tag/tag.h b/gst-libs/gst/tag/tag.h index e9877ed853..219fe85aa5 100644 --- a/gst-libs/gst/tag/tag.h +++ b/gst-libs/gst/tag/tag.h @@ -517,7 +517,7 @@ GstBuffer * gst_tag_image_data_to_image_buffer (const guint8 * ima guint image_data_len, GstTagImageType image_type); -/* FIXME 0.11: replace with a more general gst_tag_library_init() */ +/* FIXME 0.11: get rid of this awkward register/init function, see tags.c */ void gst_tag_register_musicbrainz_tags (void); diff --git a/gst-libs/gst/tag/tags.c b/gst-libs/gst/tag/tags.c index a8e867c0e0..51f3bc7011 100644 --- a/gst-libs/gst/tag/tags.c +++ b/gst-libs/gst/tag/tags.c @@ -192,7 +192,11 @@ gst_tag_register_tags_internal (gpointer unused) return NULL; } -/* FIXME 0.11: rename this to gst_tag_init() or gst_tag_register_tags() */ +/* FIXME 0.11: rename this to gst_tag_init() or gst_tag_register_tags() or + * even better: make tags auto-register themselves, either by defining them + * to a wrapper func that does the initing, or by adding tag factories so + * that the core can load+register tags automatically when needed. */ + /** * gst_tag_register_musicbrainz_tags * From 35c1cf16d9a0750cd98d9202126ced7654272ac0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Manuel=20J=C3=A1quez=20Leal?= Date: Fri, 22 Apr 2011 13:55:20 +0200 Subject: [PATCH 03/10] tag: exif: register common tags from tag library Exif uses tags like image-vertical-ppi or image-horizontal-ppi which are registered in gst_tag_register_musicbrainz_tags(), but neither GstExifReader nor GstExifWriter register them. https://bugzilla.gnome.org/show_bug.cgi?id=648459 --- gst-libs/gst/tag/gstexiftag.c | 4 ++++ gst-libs/gst/tag/gsttageditingprivate.h | 2 ++ 2 files changed, 6 insertions(+) diff --git a/gst-libs/gst/tag/gstexiftag.c b/gst-libs/gst/tag/gstexiftag.c index 9f2d76e1bf..c97901c6b0 100644 --- a/gst-libs/gst/tag/gstexiftag.c +++ b/gst-libs/gst/tag/gstexiftag.c @@ -456,6 +456,8 @@ static void gst_exif_reader_init (GstExifReader * reader, gint byte_order, const GstBuffer * buf, guint32 base_offset) { + ensure_exif_tags (); + reader->taglist = gst_tag_list_new (); reader->buffer = buf; reader->base_offset = base_offset; @@ -524,6 +526,8 @@ gst_exif_reader_reset (GstExifReader * reader, gboolean return_taglist) static void gst_exif_writer_init (GstExifWriter * writer, gint byte_order) { + ensure_exif_tags (); + gst_byte_writer_init (&writer->tagwriter); gst_byte_writer_init (&writer->datawriter); diff --git a/gst-libs/gst/tag/gsttageditingprivate.h b/gst-libs/gst/tag/gsttageditingprivate.h index 29e39f13d6..0cc70d05b3 100644 --- a/gst-libs/gst/tag/gsttageditingprivate.h +++ b/gst-libs/gst/tag/gsttageditingprivate.h @@ -68,6 +68,8 @@ const gchar * __exif_tag_capturing_metering_mode_from_exif_value (gint value); gint __exif_tag_capturing_source_to_exif_value (const gchar * str); const gchar * __exif_tag_capturing_source_from_exif_value (gint value); +#define ensure_exif_tags gst_tag_register_musicbrainz_tags + G_END_DECLS #endif /* __GST_TAG_EDIT_PRIVATE_H__ */ From 2ccd243d5533b46047a44263037645b97e00cd65 Mon Sep 17 00:00:00 2001 From: Marc Plano-Lesay Date: Thu, 14 Apr 2011 09:32:19 +0200 Subject: [PATCH 04/10] audioresample: fix unused-but-set-variable warnings with gcc 4.6 https://bugzilla.gnome.org/show_bug.cgi?id=647294 --- gst/audioresample/gstaudioresample.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gst/audioresample/gstaudioresample.c b/gst/audioresample/gstaudioresample.c index 8f9ea3be81..9364a8666c 100644 --- a/gst/audioresample/gstaudioresample.c +++ b/gst/audioresample/gstaudioresample.c @@ -1464,7 +1464,7 @@ gst_audio_resample_get_property (GObject * object, guint prop_id, static gboolean _benchmark_int_float (SpeexResamplerState * st) { - gint16 in[BENCHMARK_SIZE] = { 0, }, out[BENCHMARK_SIZE / 2]; + gint16 in[BENCHMARK_SIZE] = { 0, }, G_GNUC_UNUSED out[BENCHMARK_SIZE / 2]; gfloat in_tmp[BENCHMARK_SIZE], out_tmp[BENCHMARK_SIZE / 2]; gint i; guint32 inlen = BENCHMARK_SIZE, outlen = BENCHMARK_SIZE / 2; From 8264d59aab396c287c86e24d6b5096ca83c472b9 Mon Sep 17 00:00:00 2001 From: David Schleef Date: Sat, 23 Apr 2011 12:44:50 -0700 Subject: [PATCH 05/10] videoscale: use simpler scaling method for small images https://bugzilla.gnome.org/show_bug.cgi?id=633837 --- gst/videoscale/gstvideoscale.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/gst/videoscale/gstvideoscale.c b/gst/videoscale/gstvideoscale.c index ac2968a5b0..b941ed001c 100644 --- a/gst/videoscale/gstvideoscale.c +++ b/gst/videoscale/gstvideoscale.c @@ -1022,6 +1022,14 @@ gst_video_scale_transform (GstBaseTransform * trans, GstBuffer * in, add_borders = videoscale->add_borders; GST_OBJECT_UNLOCK (videoscale); + if (videoscale->from_width == 1) { + method = GST_VIDEO_SCALE_NEAREST; + } + if (method == GST_VIDEO_SCALE_4TAP && + (videoscale->from_width < 4 || videoscale->from_height < 4)) { + method = GST_VIDEO_SCALE_BILINEAR; + } + gst_video_scale_setup_vs_image (&src, videoscale->format, 0, videoscale->from_width, videoscale->from_height, 0, 0, GST_BUFFER_DATA (in)); From 9eac814c986b1bc6a668c6a330e524f4af5aa9f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim-Philipp=20M=C3=BCller?= Date: Sun, 24 Apr 2011 14:03:12 +0100 Subject: [PATCH 06/10] Automatic update of common submodule From c3cafe1 to 46dfcea --- common | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common b/common index c3cafe123f..46dfcea233 160000 --- a/common +++ b/common @@ -1 +1 @@ -Subproject commit c3cafe123f3a363d337a29ad32fdd6d3631f52c0 +Subproject commit 46dfcea233cf6df83e3771d8a8066e87d614f893 From ce9406f4d631ab90446107772e3cee6b9edaf4f1 Mon Sep 17 00:00:00 2001 From: David Schleef Date: Sat, 23 Apr 2011 12:46:09 -0700 Subject: [PATCH 07/10] videoscale: protect 4tap from out-of-bounds reads https://bugzilla.gnome.org/show_bug.cgi?id=633837 --- gst/videoscale/vs_4tap.c | 52 ++++++++++++++++++++-------------------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/gst/videoscale/vs_4tap.c b/gst/videoscale/vs_4tap.c index e582f7c304..f983df27cf 100644 --- a/gst/videoscale/vs_4tap.c +++ b/gst/videoscale/vs_4tap.c @@ -165,8 +165,8 @@ vs_image_scale_4tap_Y (const VSImage * dest, const VSImage * src, for (i = 0; i < 4; i++) { xacc = 0; vs_scanline_resample_4tap_Y (tmpbuf + i * dest->width, - src->pixels + i * src->stride, dest->width, src->width, - &xacc, x_increment); + src->pixels + CLAMP (i, 0, src->height - 1) * src->stride, dest->width, + src->width, &xacc, x_increment); } yacc = 0; @@ -282,8 +282,8 @@ vs_image_scale_4tap_Y16 (const VSImage * dest, const VSImage * src, for (i = 0; i < 4; i++) { xacc = 0; vs_scanline_resample_4tap_Y16 (tmpbuf + i * dest->stride, - src->pixels + i * src->stride, dest->width, src->width, - &xacc, x_increment); + src->pixels + CLAMP (i, 0, src->height - 1) * src->stride, dest->width, + src->width, &xacc, x_increment); } yacc = 0; @@ -336,14 +336,14 @@ vs_scanline_resample_4tap_RGBA (uint8_t * dest, uint8_t * src, y += vs_4tap_taps[x][2] * src[(j + 1) * 4 + off]; y += vs_4tap_taps[x][3] * src[(j + 2) * 4 + off]; } else { - y = vs_4tap_taps[x][0] * src[CLAMP ((j - 1) * 4 + off, 0, - 4 * (src_width - 1) + off)]; - y += vs_4tap_taps[x][1] * src[CLAMP (j * 4 + off, 0, - 4 * (src_width - 1) + off)]; - y += vs_4tap_taps[x][2] * src[CLAMP ((j + 1) * 4 + off, 0, - 4 * (src_width - 1) + off)]; - y += vs_4tap_taps[x][3] * src[CLAMP ((j + 2) * 4 + off, 0, - 4 * (src_width - 1) + off)]; + y = vs_4tap_taps[x][0] * + src[CLAMP ((j - 1), 0, src_width - 1) * 4 + off]; + y += vs_4tap_taps[x][1] * + src[CLAMP ((j + 0), 0, src_width - 1) * 4 + off]; + y += vs_4tap_taps[x][2] * + src[CLAMP ((j + 1), 0, src_width - 1) * 4 + off]; + y += vs_4tap_taps[x][3] * + src[CLAMP ((j + 2), 0, src_width - 1) * 4 + off]; } y += (1 << (SHIFT - 1)); dest[i * 4 + off] = CLAMP (y >> SHIFT, 0, 255); @@ -405,8 +405,8 @@ vs_image_scale_4tap_RGBA (const VSImage * dest, const VSImage * src, for (i = 0; i < 4; i++) { xacc = 0; vs_scanline_resample_4tap_RGBA (tmpbuf + i * dest->stride, - src->pixels + i * src->stride, dest->width, src->width, - &xacc, x_increment); + src->pixels + CLAMP (i, 0, src->height) * src->stride, + dest->width, src->width, &xacc, x_increment); } yacc = 0; @@ -528,8 +528,8 @@ vs_image_scale_4tap_RGB (const VSImage * dest, const VSImage * src, for (i = 0; i < 4; i++) { xacc = 0; vs_scanline_resample_4tap_RGB (tmpbuf + i * dest->stride, - src->pixels + i * src->stride, dest->width, src->width, - &xacc, x_increment); + src->pixels + CLAMP (i, 0, src->height - 1) * src->stride, dest->width, + src->width, &xacc, x_increment); } yacc = 0; @@ -726,8 +726,8 @@ vs_image_scale_4tap_YUYV (const VSImage * dest, const VSImage * src, for (i = 0; i < 4; i++) { xacc = 0; vs_scanline_resample_4tap_YUYV (tmpbuf + i * dest->stride, - src->pixels + i * src->stride, dest->width, src->width, - &xacc, x_increment); + src->pixels + CLAMP (i, 0, src->height - 1) * src->stride, dest->width, + src->width, &xacc, x_increment); } yacc = 0; @@ -924,8 +924,8 @@ vs_image_scale_4tap_UYVY (const VSImage * dest, const VSImage * src, for (i = 0; i < 4; i++) { xacc = 0; vs_scanline_resample_4tap_UYVY (tmpbuf + i * dest->stride, - src->pixels + i * src->stride, dest->width, src->width, - &xacc, x_increment); + src->pixels + CLAMP (i, 0, src->height - 1) * src->stride, dest->width, + src->width, &xacc, x_increment); } yacc = 0; @@ -1109,8 +1109,8 @@ vs_image_scale_4tap_RGB565 (const VSImage * dest, const VSImage * src, for (i = 0; i < 4; i++) { xacc = 0; vs_scanline_resample_4tap_RGB565 (tmpbuf + i * dest->stride, - src->pixels + i * src->stride, dest->width, src->width, - &xacc, x_increment); + src->pixels + CLAMP (i, 0, src->height - 1) * src->stride, dest->width, + src->width, &xacc, x_increment); } yacc = 0; @@ -1294,8 +1294,8 @@ vs_image_scale_4tap_RGB555 (const VSImage * dest, const VSImage * src, for (i = 0; i < 4; i++) { xacc = 0; vs_scanline_resample_4tap_RGB555 (tmpbuf + i * dest->stride, - src->pixels + i * src->stride, dest->width, src->width, - &xacc, x_increment); + src->pixels + CLAMP (i, 0, src->height - 1) * src->stride, dest->width, + src->width, &xacc, x_increment); } yacc = 0; @@ -1418,8 +1418,8 @@ vs_image_scale_4tap_AYUV64 (const VSImage * dest, const VSImage * src, for (i = 0; i < 4; i++) { xacc = 0; vs_scanline_resample_4tap_AYUV64 ((guint16 *) (tmpbuf + i * dest->stride), - (guint16 *) (src->pixels + i * src->stride), dest->width, src->width, - &xacc, x_increment); + (guint16 *) (src->pixels + CLAMP (i, 0, src->height - 1) * src->stride), + dest->width, src->width, &xacc, x_increment); } yacc = 0; From d4dbebc606bdae6a765eada22e49787b47e277f1 Mon Sep 17 00:00:00 2001 From: David Schleef Date: Sat, 23 Apr 2011 13:42:23 -0700 Subject: [PATCH 08/10] videoscale: hack to fix invalid reads in linear https://bugzilla.gnome.org/show_bug.cgi?id=633837 --- gst/videoscale/vs_image.c | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/gst/videoscale/vs_image.c b/gst/videoscale/vs_image.c index 691914453f..6716ebad17 100644 --- a/gst/videoscale/vs_image.c +++ b/gst/videoscale/vs_image.c @@ -93,12 +93,12 @@ vs_image_scale_linear_RGBA (const VSImage * dest, const VSImage * src, if (dest->height == 1) y_increment = 0; else - y_increment = ((src->height - 1) << 16) / (dest->height - 1); + y_increment = ((src->height - 1) << 16) / (dest->height - 1) - 1; if (dest->width == 1) x_increment = 0; else - x_increment = ((src->width - 1) << 16) / (dest->width - 1); + x_increment = ((src->width - 1) << 16) / (dest->width - 1) - 1; dest_size = dest->width * 4; @@ -191,12 +191,12 @@ vs_image_scale_linear_RGB (const VSImage * dest, const VSImage * src, if (dest->height == 1) y_increment = 0; else - y_increment = ((src->height - 1) << 16) / (dest->height - 1); + y_increment = ((src->height - 1) << 16) / (dest->height - 1) - 1; if (dest->width == 1) x_increment = 0; else - x_increment = ((src->width - 1) << 16) / (dest->width - 1); + x_increment = ((src->width - 1) << 16) / (dest->width - 1) - 1; dest_size = dest->width * 3; @@ -321,12 +321,12 @@ vs_image_scale_linear_YUYV (const VSImage * dest, const VSImage * src, if (dest->height == 1) y_increment = 0; else - y_increment = ((src->height - 1) << 16) / (dest->height - 1); + y_increment = ((src->height - 1) << 16) / (dest->height - 1) - 1; if (dest->width == 1) x_increment = 0; else - x_increment = ((src->width - 1) << 16) / (dest->width - 1); + x_increment = ((src->width - 1) << 16) / (dest->width - 1) - 1; dest_size = ROUND_UP_4 (dest->width * 2); @@ -451,12 +451,12 @@ vs_image_scale_linear_UYVY (const VSImage * dest, const VSImage * src, if (dest->height == 1) y_increment = 0; else - y_increment = ((src->height - 1) << 16) / (dest->height - 1); + y_increment = ((src->height - 1) << 16) / (dest->height - 1) - 1; if (dest->width == 1) x_increment = 0; else - x_increment = ((src->width - 1) << 16) / (dest->width - 1); + x_increment = ((src->width - 1) << 16) / (dest->width - 1) - 1; dest_size = ROUND_UP_4 (dest->width * 2); @@ -576,12 +576,12 @@ vs_image_scale_linear_Y (const VSImage * dest, const VSImage * src, if (dest->height == 1) y_increment = 0; else - y_increment = ((src->height - 1) << 16) / (dest->height - 1); + y_increment = ((src->height - 1) << 16) / (dest->height - 1) - 1; if (dest->width == 1) x_increment = 0; else - x_increment = ((src->width - 1) << 16) / (dest->width - 1); + x_increment = ((src->width - 1) << 16) / (dest->width - 1) - 1; dest_size = dest->width; @@ -707,12 +707,12 @@ vs_image_scale_linear_Y16 (const VSImage * dest, const VSImage * src, if (dest->height == 1) y_increment = 0; else - y_increment = ((src->height - 1) << 16) / (dest->height - 1); + y_increment = ((src->height - 1) << 16) / (dest->height - 1) - 1; if (dest->width == 1) x_increment = 0; else - x_increment = ((src->width - 1) << 16) / (dest->width - 1); + x_increment = ((src->width - 1) << 16) / (dest->width - 1) - 1; dest_size = 2 * dest->width; @@ -837,12 +837,12 @@ vs_image_scale_linear_RGB565 (const VSImage * dest, const VSImage * src, if (dest->height == 1) y_increment = 0; else - y_increment = ((src->height - 1) << 16) / (dest->height - 1); + y_increment = ((src->height - 1) << 16) / (dest->height - 1) - 1; if (dest->width == 1) x_increment = 0; else - x_increment = ((src->width - 1) << 16) / (dest->width - 1); + x_increment = ((src->width - 1) << 16) / (dest->width - 1) - 1; dest_size = dest->width * 2; @@ -967,12 +967,12 @@ vs_image_scale_linear_RGB555 (const VSImage * dest, const VSImage * src, if (dest->height == 1) y_increment = 0; else - y_increment = ((src->height - 1) << 16) / (dest->height - 1); + y_increment = ((src->height - 1) << 16) / (dest->height - 1) - 1; if (dest->width == 1) x_increment = 0; else - x_increment = ((src->width - 1) << 16) / (dest->width - 1); + x_increment = ((src->width - 1) << 16) / (dest->width - 1) - 1; dest_size = dest->width * 2; @@ -1100,12 +1100,12 @@ vs_image_scale_linear_AYUV64 (const VSImage * dest, const VSImage * src, if (dest->height == 1) y_increment = 0; else - y_increment = ((src->height - 1) << 16) / (dest->height - 1); + y_increment = ((src->height - 1) << 16) / (dest->height - 1) - 1; if (dest->width == 1) x_increment = 0; else - x_increment = ((src->width - 1) << 16) / (dest->width - 1); + x_increment = ((src->width - 1) << 16) / (dest->width - 1) - 1; dest_size = dest->width * 8; From 7c0b702e14f81b68dd341109af9efcbd714dbf32 Mon Sep 17 00:00:00 2001 From: David Schleef Date: Sun, 24 Apr 2011 18:16:20 -0700 Subject: [PATCH 09/10] videoscale: Fix ARGB bilinear scaling Fixes #648548. Orc generates bad code for gst_videoscale_orc_resample_merge_bilinear_u32, so we'll use the slightly slower two-stage process. I'd fix Orc, but it's hard to get excited about fixing a feature that I'm planning to deprecate and replace. --- gst/videoscale/vs_image.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/gst/videoscale/vs_image.c b/gst/videoscale/vs_image.c index 6716ebad17..e2368fe6a6 100644 --- a/gst/videoscale/vs_image.c +++ b/gst/videoscale/vs_image.c @@ -121,15 +121,12 @@ vs_image_scale_linear_RGBA (const VSImage * dest, const VSImage * src, y1++; } if (j >= y1) { - gst_videoscale_orc_resample_merge_bilinear_u32 (dest->pixels + - i * dest->stride, LINE (j + 1), LINE (j), - src->pixels + (j + 1) * src->stride, (x >> 8), 0, x_increment, - dest->width); + gst_videoscale_orc_resample_bilinear_u32 (LINE (j), + src->pixels + j * src->stride, 0, x_increment, dest->width); y1++; - } else { - orc_merge_linear_u8 (dest->pixels + i * dest->stride, - LINE (j), LINE (j + 1), (x >> 8), dest->width * 4); } + orc_merge_linear_u8 (dest->pixels + i * dest->stride, + LINE (j), LINE (j + 1), (x >> 8), dest->width * 4); } acc += y_increment; From fc31f355eac764d8a9d1518f334df4e2b8e7c407 Mon Sep 17 00:00:00 2001 From: David Schleef Date: Sun, 24 Apr 2011 18:45:40 -0700 Subject: [PATCH 10/10] videoscale: Fix off-by-one error in previous commit Fix for 7c0b702e. It helps to get your j+1's right. --- gst/videoscale/vs_image.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gst/videoscale/vs_image.c b/gst/videoscale/vs_image.c index e2368fe6a6..c28b0d8ff3 100644 --- a/gst/videoscale/vs_image.c +++ b/gst/videoscale/vs_image.c @@ -121,8 +121,8 @@ vs_image_scale_linear_RGBA (const VSImage * dest, const VSImage * src, y1++; } if (j >= y1) { - gst_videoscale_orc_resample_bilinear_u32 (LINE (j), - src->pixels + j * src->stride, 0, x_increment, dest->width); + gst_videoscale_orc_resample_bilinear_u32 (LINE (j + 1), + src->pixels + (j + 1) * src->stride, 0, x_increment, dest->width); y1++; } orc_merge_linear_u8 (dest->pixels + i * dest->stride,