Merge branch 'master' into 0.11

Conflicts:
	gst/videoscale/gstvideoscale.c
This commit is contained in:
Wim Taymans 2011-04-25 11:20:45 +02:00
commit 079c152e62
10 changed files with 121 additions and 59 deletions

2
common

@ -1 +1 @@
Subproject commit c3cafe123f3a363d337a29ad32fdd6d3631f52c0 Subproject commit 46dfcea233cf6df83e3771d8a8066e87d614f893

View file

@ -456,6 +456,8 @@ static void
gst_exif_reader_init (GstExifReader * reader, gint byte_order, gst_exif_reader_init (GstExifReader * reader, gint byte_order,
GstBuffer * buf, guint32 base_offset) GstBuffer * buf, guint32 base_offset)
{ {
ensure_exif_tags ();
reader->taglist = gst_tag_list_new (); reader->taglist = gst_tag_list_new ();
reader->buffer = buf; reader->buffer = buf;
reader->base_offset = base_offset; reader->base_offset = base_offset;
@ -524,6 +526,8 @@ gst_exif_reader_reset (GstExifReader * reader, gboolean return_taglist)
static void static void
gst_exif_writer_init (GstExifWriter * writer, gint byte_order) gst_exif_writer_init (GstExifWriter * writer, gint byte_order)
{ {
ensure_exif_tags ();
gst_byte_writer_init (&writer->tagwriter); gst_byte_writer_init (&writer->tagwriter);
gst_byte_writer_init (&writer->datawriter); gst_byte_writer_init (&writer->datawriter);

View file

@ -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); gint __exif_tag_capturing_source_to_exif_value (const gchar * str);
const gchar * __exif_tag_capturing_source_from_exif_value (gint value); const gchar * __exif_tag_capturing_source_from_exif_value (gint value);
#define ensure_exif_tags gst_tag_register_musicbrainz_tags
G_END_DECLS G_END_DECLS
#endif /* __GST_TAG_EDIT_PRIVATE_H__ */ #endif /* __GST_TAG_EDIT_PRIVATE_H__ */

View file

@ -522,7 +522,7 @@ GstBuffer * gst_tag_image_data_to_image_buffer (const guint8 * ima
guint image_data_len, guint image_data_len,
GstTagImageType image_type); 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); void gst_tag_register_musicbrainz_tags (void);

View file

@ -192,7 +192,11 @@ gst_tag_register_tags_internal (gpointer unused)
return NULL; 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 * gst_tag_register_musicbrainz_tags
* *

View file

@ -1379,7 +1379,7 @@ gst_audio_resample_get_property (GObject * object, guint prop_id,
static gboolean static gboolean
_benchmark_int_float (SpeexResamplerState * st) _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]; gfloat in_tmp[BENCHMARK_SIZE], out_tmp[BENCHMARK_SIZE / 2];
gint i; gint i;
guint32 inlen = BENCHMARK_SIZE, outlen = BENCHMARK_SIZE / 2; guint32 inlen = BENCHMARK_SIZE, outlen = BENCHMARK_SIZE / 2;

View file

@ -1019,6 +1019,14 @@ gst_video_scale_transform (GstBaseTransform * trans, GstBuffer * in,
add_borders = videoscale->add_borders; add_borders = videoscale->add_borders;
GST_OBJECT_UNLOCK (videoscale); 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;
}
in_data = gst_buffer_map (in, &in_size, NULL, GST_MAP_READ); in_data = gst_buffer_map (in, &in_size, NULL, GST_MAP_READ);
out_data = gst_buffer_map (out, &out_size, NULL, GST_MAP_WRITE); out_data = gst_buffer_map (out, &out_size, NULL, GST_MAP_WRITE);

View file

@ -165,8 +165,8 @@ vs_image_scale_4tap_Y (const VSImage * dest, const VSImage * src,
for (i = 0; i < 4; i++) { for (i = 0; i < 4; i++) {
xacc = 0; xacc = 0;
vs_scanline_resample_4tap_Y (tmpbuf + i * dest->width, vs_scanline_resample_4tap_Y (tmpbuf + i * dest->width,
src->pixels + i * src->stride, dest->width, src->width, src->pixels + CLAMP (i, 0, src->height - 1) * src->stride, dest->width,
&xacc, x_increment); src->width, &xacc, x_increment);
} }
yacc = 0; yacc = 0;
@ -282,8 +282,8 @@ vs_image_scale_4tap_Y16 (const VSImage * dest, const VSImage * src,
for (i = 0; i < 4; i++) { for (i = 0; i < 4; i++) {
xacc = 0; xacc = 0;
vs_scanline_resample_4tap_Y16 (tmpbuf + i * dest->stride, vs_scanline_resample_4tap_Y16 (tmpbuf + i * dest->stride,
src->pixels + i * src->stride, dest->width, src->width, src->pixels + CLAMP (i, 0, src->height - 1) * src->stride, dest->width,
&xacc, x_increment); src->width, &xacc, x_increment);
} }
yacc = 0; 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][2] * src[(j + 1) * 4 + off];
y += vs_4tap_taps[x][3] * src[(j + 2) * 4 + off]; y += vs_4tap_taps[x][3] * src[(j + 2) * 4 + off];
} else { } else {
y = vs_4tap_taps[x][0] * src[CLAMP ((j - 1) * 4 + off, 0, y = vs_4tap_taps[x][0] *
4 * (src_width - 1) + off)]; src[CLAMP ((j - 1), 0, src_width - 1) * 4 + off];
y += vs_4tap_taps[x][1] * src[CLAMP (j * 4 + off, 0, y += vs_4tap_taps[x][1] *
4 * (src_width - 1) + off)]; src[CLAMP ((j + 0), 0, src_width - 1) * 4 + off];
y += vs_4tap_taps[x][2] * src[CLAMP ((j + 1) * 4 + off, 0, y += vs_4tap_taps[x][2] *
4 * (src_width - 1) + off)]; src[CLAMP ((j + 1), 0, src_width - 1) * 4 + off];
y += vs_4tap_taps[x][3] * src[CLAMP ((j + 2) * 4 + off, 0, y += vs_4tap_taps[x][3] *
4 * (src_width - 1) + off)]; src[CLAMP ((j + 2), 0, src_width - 1) * 4 + off];
} }
y += (1 << (SHIFT - 1)); y += (1 << (SHIFT - 1));
dest[i * 4 + off] = CLAMP (y >> SHIFT, 0, 255); 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++) { for (i = 0; i < 4; i++) {
xacc = 0; xacc = 0;
vs_scanline_resample_4tap_RGBA (tmpbuf + i * dest->stride, vs_scanline_resample_4tap_RGBA (tmpbuf + i * dest->stride,
src->pixels + i * src->stride, dest->width, src->width, src->pixels + CLAMP (i, 0, src->height) * src->stride,
&xacc, x_increment); dest->width, src->width, &xacc, x_increment);
} }
yacc = 0; yacc = 0;
@ -528,8 +528,8 @@ vs_image_scale_4tap_RGB (const VSImage * dest, const VSImage * src,
for (i = 0; i < 4; i++) { for (i = 0; i < 4; i++) {
xacc = 0; xacc = 0;
vs_scanline_resample_4tap_RGB (tmpbuf + i * dest->stride, vs_scanline_resample_4tap_RGB (tmpbuf + i * dest->stride,
src->pixels + i * src->stride, dest->width, src->width, src->pixels + CLAMP (i, 0, src->height - 1) * src->stride, dest->width,
&xacc, x_increment); src->width, &xacc, x_increment);
} }
yacc = 0; yacc = 0;
@ -726,8 +726,8 @@ vs_image_scale_4tap_YUYV (const VSImage * dest, const VSImage * src,
for (i = 0; i < 4; i++) { for (i = 0; i < 4; i++) {
xacc = 0; xacc = 0;
vs_scanline_resample_4tap_YUYV (tmpbuf + i * dest->stride, vs_scanline_resample_4tap_YUYV (tmpbuf + i * dest->stride,
src->pixels + i * src->stride, dest->width, src->width, src->pixels + CLAMP (i, 0, src->height - 1) * src->stride, dest->width,
&xacc, x_increment); src->width, &xacc, x_increment);
} }
yacc = 0; yacc = 0;
@ -924,8 +924,8 @@ vs_image_scale_4tap_UYVY (const VSImage * dest, const VSImage * src,
for (i = 0; i < 4; i++) { for (i = 0; i < 4; i++) {
xacc = 0; xacc = 0;
vs_scanline_resample_4tap_UYVY (tmpbuf + i * dest->stride, vs_scanline_resample_4tap_UYVY (tmpbuf + i * dest->stride,
src->pixels + i * src->stride, dest->width, src->width, src->pixels + CLAMP (i, 0, src->height - 1) * src->stride, dest->width,
&xacc, x_increment); src->width, &xacc, x_increment);
} }
yacc = 0; yacc = 0;
@ -1109,8 +1109,8 @@ vs_image_scale_4tap_RGB565 (const VSImage * dest, const VSImage * src,
for (i = 0; i < 4; i++) { for (i = 0; i < 4; i++) {
xacc = 0; xacc = 0;
vs_scanline_resample_4tap_RGB565 (tmpbuf + i * dest->stride, vs_scanline_resample_4tap_RGB565 (tmpbuf + i * dest->stride,
src->pixels + i * src->stride, dest->width, src->width, src->pixels + CLAMP (i, 0, src->height - 1) * src->stride, dest->width,
&xacc, x_increment); src->width, &xacc, x_increment);
} }
yacc = 0; yacc = 0;
@ -1294,8 +1294,8 @@ vs_image_scale_4tap_RGB555 (const VSImage * dest, const VSImage * src,
for (i = 0; i < 4; i++) { for (i = 0; i < 4; i++) {
xacc = 0; xacc = 0;
vs_scanline_resample_4tap_RGB555 (tmpbuf + i * dest->stride, vs_scanline_resample_4tap_RGB555 (tmpbuf + i * dest->stride,
src->pixels + i * src->stride, dest->width, src->width, src->pixels + CLAMP (i, 0, src->height - 1) * src->stride, dest->width,
&xacc, x_increment); src->width, &xacc, x_increment);
} }
yacc = 0; yacc = 0;
@ -1418,8 +1418,8 @@ vs_image_scale_4tap_AYUV64 (const VSImage * dest, const VSImage * src,
for (i = 0; i < 4; i++) { for (i = 0; i < 4; i++) {
xacc = 0; xacc = 0;
vs_scanline_resample_4tap_AYUV64 ((guint16 *) (tmpbuf + i * dest->stride), vs_scanline_resample_4tap_AYUV64 ((guint16 *) (tmpbuf + i * dest->stride),
(guint16 *) (src->pixels + i * src->stride), dest->width, src->width, (guint16 *) (src->pixels + CLAMP (i, 0, src->height - 1) * src->stride),
&xacc, x_increment); dest->width, src->width, &xacc, x_increment);
} }
yacc = 0; yacc = 0;

View file

@ -93,12 +93,12 @@ vs_image_scale_linear_RGBA (const VSImage * dest, const VSImage * src,
if (dest->height == 1) if (dest->height == 1)
y_increment = 0; y_increment = 0;
else else
y_increment = ((src->height - 1) << 16) / (dest->height - 1); y_increment = ((src->height - 1) << 16) / (dest->height - 1) - 1;
if (dest->width == 1) if (dest->width == 1)
x_increment = 0; x_increment = 0;
else 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; dest_size = dest->width * 4;
@ -121,16 +121,13 @@ vs_image_scale_linear_RGBA (const VSImage * dest, const VSImage * src,
y1++; y1++;
} }
if (j >= y1) { if (j >= y1) {
gst_videoscale_orc_resample_merge_bilinear_u32 (dest->pixels + gst_videoscale_orc_resample_bilinear_u32 (LINE (j + 1),
i * dest->stride, LINE (j + 1), LINE (j), src->pixels + (j + 1) * src->stride, 0, x_increment, dest->width);
src->pixels + (j + 1) * src->stride, (x >> 8), 0, x_increment,
dest->width);
y1++; y1++;
} else { }
orc_merge_linear_u8 (dest->pixels + i * dest->stride, orc_merge_linear_u8 (dest->pixels + i * dest->stride,
LINE (j), LINE (j + 1), (x >> 8), dest->width * 4); LINE (j), LINE (j + 1), (x >> 8), dest->width * 4);
} }
}
acc += y_increment; acc += y_increment;
} }
@ -191,12 +188,12 @@ vs_image_scale_linear_RGB (const VSImage * dest, const VSImage * src,
if (dest->height == 1) if (dest->height == 1)
y_increment = 0; y_increment = 0;
else else
y_increment = ((src->height - 1) << 16) / (dest->height - 1); y_increment = ((src->height - 1) << 16) / (dest->height - 1) - 1;
if (dest->width == 1) if (dest->width == 1)
x_increment = 0; x_increment = 0;
else 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; dest_size = dest->width * 3;
@ -321,12 +318,12 @@ vs_image_scale_linear_YUYV (const VSImage * dest, const VSImage * src,
if (dest->height == 1) if (dest->height == 1)
y_increment = 0; y_increment = 0;
else else
y_increment = ((src->height - 1) << 16) / (dest->height - 1); y_increment = ((src->height - 1) << 16) / (dest->height - 1) - 1;
if (dest->width == 1) if (dest->width == 1)
x_increment = 0; x_increment = 0;
else 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); dest_size = ROUND_UP_4 (dest->width * 2);
@ -451,12 +448,12 @@ vs_image_scale_linear_UYVY (const VSImage * dest, const VSImage * src,
if (dest->height == 1) if (dest->height == 1)
y_increment = 0; y_increment = 0;
else else
y_increment = ((src->height - 1) << 16) / (dest->height - 1); y_increment = ((src->height - 1) << 16) / (dest->height - 1) - 1;
if (dest->width == 1) if (dest->width == 1)
x_increment = 0; x_increment = 0;
else 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); dest_size = ROUND_UP_4 (dest->width * 2);
@ -576,12 +573,12 @@ vs_image_scale_linear_Y (const VSImage * dest, const VSImage * src,
if (dest->height == 1) if (dest->height == 1)
y_increment = 0; y_increment = 0;
else else
y_increment = ((src->height - 1) << 16) / (dest->height - 1); y_increment = ((src->height - 1) << 16) / (dest->height - 1) - 1;
if (dest->width == 1) if (dest->width == 1)
x_increment = 0; x_increment = 0;
else else
x_increment = ((src->width - 1) << 16) / (dest->width - 1); x_increment = ((src->width - 1) << 16) / (dest->width - 1) - 1;
dest_size = dest->width; dest_size = dest->width;
@ -707,12 +704,12 @@ vs_image_scale_linear_Y16 (const VSImage * dest, const VSImage * src,
if (dest->height == 1) if (dest->height == 1)
y_increment = 0; y_increment = 0;
else else
y_increment = ((src->height - 1) << 16) / (dest->height - 1); y_increment = ((src->height - 1) << 16) / (dest->height - 1) - 1;
if (dest->width == 1) if (dest->width == 1)
x_increment = 0; x_increment = 0;
else 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; dest_size = 2 * dest->width;
@ -837,12 +834,12 @@ vs_image_scale_linear_RGB565 (const VSImage * dest, const VSImage * src,
if (dest->height == 1) if (dest->height == 1)
y_increment = 0; y_increment = 0;
else else
y_increment = ((src->height - 1) << 16) / (dest->height - 1); y_increment = ((src->height - 1) << 16) / (dest->height - 1) - 1;
if (dest->width == 1) if (dest->width == 1)
x_increment = 0; x_increment = 0;
else 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; dest_size = dest->width * 2;
@ -967,12 +964,12 @@ vs_image_scale_linear_RGB555 (const VSImage * dest, const VSImage * src,
if (dest->height == 1) if (dest->height == 1)
y_increment = 0; y_increment = 0;
else else
y_increment = ((src->height - 1) << 16) / (dest->height - 1); y_increment = ((src->height - 1) << 16) / (dest->height - 1) - 1;
if (dest->width == 1) if (dest->width == 1)
x_increment = 0; x_increment = 0;
else 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; dest_size = dest->width * 2;
@ -1100,12 +1097,12 @@ vs_image_scale_linear_AYUV64 (const VSImage * dest, const VSImage * src,
if (dest->height == 1) if (dest->height == 1)
y_increment = 0; y_increment = 0;
else else
y_increment = ((src->height - 1) << 16) / (dest->height - 1); y_increment = ((src->height - 1) << 16) / (dest->height - 1) - 1;
if (dest->width == 1) if (dest->width == 1)
x_increment = 0; x_increment = 0;
else 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; dest_size = dest->width * 8;

View file

@ -643,12 +643,8 @@ static void
gst_test_reverse_negotiation_sink_class_init (GstTestReverseNegotiationSinkClass gst_test_reverse_negotiation_sink_class_init (GstTestReverseNegotiationSinkClass
* klass) * klass)
{ {
GObjectClass *gobject_class;
GstElementClass *gstelement_class;
GstBaseSinkClass *gstbase_sink_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 = GST_BASE_SINK_CLASS (klass);
gst_element_class_set_details_simple (gstelement_class, gst_element_class_set_details_simple (gstelement_class,
@ -763,6 +759,56 @@ GST_START_TEST (test_reverse_negotiation)
GST_END_TEST; 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 * static Suite *
videoscale_suite (void) videoscale_suite (void)
{ {
@ -810,6 +856,7 @@ videoscale_suite (void)
tcase_add_test (tc_chain, test_upscale_1x240_640x480_method_2); tcase_add_test (tc_chain, test_upscale_1x240_640x480_method_2);
tcase_add_test (tc_chain, test_negotiation); tcase_add_test (tc_chain, test_negotiation);
tcase_add_test (tc_chain, test_reverse_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"); GST_ERROR ("FIXME: test 64-bpp formats as well");
return s; return s;