2 * Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
3 * Copyright (C) 2005 David Schleef <ds@schleef.org>
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Library General Public License for more details.
15 * You should have received a copy of the GNU Library General Public
16 * License along with this library; if not, write to the
17 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 * Boston, MA 02111-1307, USA.
22 * SECTION:element-videoscale
23 * @see_also: videorate, videoconvert
25 * This element resizes video frames. By default the element will try to
26 * negotiate to the same size on the source and sinkpad so that no scaling
27 * is needed. It is therefore safe to insert this element in a pipeline to
28 * get more robust behaviour without any cost if no scaling is needed.
30 * This element supports a wide range of color spaces including various YUV and
31 * RGB formats and is therefore generally able to operate anywhere in a
35 * <title>Example pipelines</title>
37 * gst-launch -v filesrc location=videotestsrc.ogg ! oggdemux ! theoradec ! videoconvert ! videoscale ! ximagesink
38 * ]| Decode an Ogg/Theora and display the video using ximagesink. Since
39 * ximagesink cannot perform scaling, the video scaling will be performed by
40 * videoscale when you resize the video window.
41 * To create the test Ogg/Theora file refer to the documentation of theoraenc.
43 * gst-launch -v filesrc location=videotestsrc.ogg ! oggdemux ! theoradec ! videoscale ! video/x-raw, width=50 ! xvimagesink
44 * ]| Decode an Ogg/Theora and display the video using xvimagesink with a width
48 * Last reviewed on 2006-03-02 (0.10.4)
52 * Formulas for PAR, DAR, width and height relations:
63 * w = h * ----- * -----
67 * h = w * ----- * -----
79 #include <gst/video/video.h>
81 #include "gstvideoscale.h"
82 #include "gstvideoscaleorc.h"
85 #include "vs_fill_borders.h"
87 /* debug variable definition */
88 GST_DEBUG_CATEGORY (video_scale_debug);
90 #define DEFAULT_PROP_METHOD GST_VIDEO_SCALE_BILINEAR
91 #define DEFAULT_PROP_ADD_BORDERS FALSE
101 #undef GST_VIDEO_SIZE_RANGE
102 #define GST_VIDEO_SIZE_RANGE "(int) [ 1, 32767]"
104 #define GST_VIDEO_FORMATS "{ \"I420\", \"YV12\", \"YUY2\", \"UYVY\", \"AYUV\", \"RGBx\", " \
105 "\"BGRx\", \"xRGB\", \"xBGR\", \"RGBA\", \"BGRA\", \"ARGB\", \"ABGR\", \"RGB\", " \
106 "\"BGR\", \"Y41B\", \"Y42B\", \"YVYU\", \"Y444\", \"GRAY8\", \"GRAY16_BE\", \"GRAY16_LE\", " \
107 "\"v308\", \"Y800\", \"Y16\", \"RGB16\", \"RGB15\", \"ARGB64\", \"AYUV64\" } "
110 static GstStaticCaps gst_video_scale_format_caps[] = {
111 GST_STATIC_CAPS (GST_VIDEO_CAPS_MAKE (GST_VIDEO_FORMATS))
114 #define GST_TYPE_VIDEO_SCALE_METHOD (gst_video_scale_method_get_type())
116 gst_video_scale_method_get_type (void)
118 static GType video_scale_method_type = 0;
120 static const GEnumValue video_scale_methods[] = {
121 {GST_VIDEO_SCALE_NEAREST, "Nearest Neighbour", "nearest-neighbour"},
122 {GST_VIDEO_SCALE_BILINEAR, "Bilinear", "bilinear"},
123 {GST_VIDEO_SCALE_4TAP, "4-tap", "4-tap"},
127 if (!video_scale_method_type) {
128 video_scale_method_type =
129 g_enum_register_static ("GstVideoScaleMethod", video_scale_methods);
131 return video_scale_method_type;
135 gst_video_scale_get_capslist (void)
137 static GstCaps *caps = NULL;
138 static volatile gsize inited = 0;
140 if (g_once_init_enter (&inited)) {
143 g_assert (caps == NULL);
145 caps = gst_caps_new_empty ();
146 for (i = 0; i < G_N_ELEMENTS (gst_video_scale_format_caps); i++)
147 gst_caps_append (caps,
148 gst_caps_make_writable
149 (gst_static_caps_get (&gst_video_scale_format_caps[i])));
150 g_once_init_leave (&inited, 1);
156 static GstPadTemplate *
157 gst_video_scale_src_template_factory (void)
159 return gst_pad_template_new ("src", GST_PAD_SRC, GST_PAD_ALWAYS,
160 gst_video_scale_get_capslist ());
163 static GstPadTemplate *
164 gst_video_scale_sink_template_factory (void)
166 return gst_pad_template_new ("sink", GST_PAD_SINK, GST_PAD_ALWAYS,
167 gst_video_scale_get_capslist ());
171 static void gst_video_scale_finalize (GstVideoScale * videoscale);
172 static gboolean gst_video_scale_src_event (GstBaseTransform * trans,
175 /* base transform vmethods */
176 static GstCaps *gst_video_scale_transform_caps (GstBaseTransform * trans,
177 GstPadDirection direction, GstCaps * caps, GstCaps * filter);
178 static gboolean gst_video_scale_set_caps (GstBaseTransform * trans,
179 GstCaps * in, GstCaps * out);
180 static gboolean gst_video_scale_get_unit_size (GstBaseTransform * trans,
181 GstCaps * caps, gsize * size);
182 static GstFlowReturn gst_video_scale_transform (GstBaseTransform * trans,
183 GstBuffer * in, GstBuffer * out);
184 static void gst_video_scale_fixate_caps (GstBaseTransform * base,
185 GstPadDirection direction, GstCaps * caps, GstCaps * othercaps);
187 static void gst_video_scale_set_property (GObject * object, guint prop_id,
188 const GValue * value, GParamSpec * pspec);
189 static void gst_video_scale_get_property (GObject * object, guint prop_id,
190 GValue * value, GParamSpec * pspec);
192 #define gst_video_scale_parent_class parent_class
193 G_DEFINE_TYPE (GstVideoScale, gst_video_scale, GST_TYPE_VIDEO_FILTER);
196 gst_video_scale_class_init (GstVideoScaleClass * klass)
198 GObjectClass *gobject_class = (GObjectClass *) klass;
199 GstElementClass *element_class = (GstElementClass *) klass;
200 GstBaseTransformClass *trans_class = (GstBaseTransformClass *) klass;
202 gobject_class->finalize = (GObjectFinalizeFunc) gst_video_scale_finalize;
203 gobject_class->set_property = gst_video_scale_set_property;
204 gobject_class->get_property = gst_video_scale_get_property;
206 g_object_class_install_property (gobject_class, PROP_METHOD,
207 g_param_spec_enum ("method", "method", "method",
208 GST_TYPE_VIDEO_SCALE_METHOD, DEFAULT_PROP_METHOD,
209 G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
211 g_object_class_install_property (gobject_class, PROP_ADD_BORDERS,
212 g_param_spec_boolean ("add-borders", "Add Borders",
213 "Add black borders if necessary to keep the display aspect ratio",
214 DEFAULT_PROP_ADD_BORDERS,
215 G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
217 gst_element_class_set_details_simple (element_class,
218 "Video scaler", "Filter/Converter/Video/Scaler",
219 "Resizes video", "Wim Taymans <wim.taymans@chello.be>");
221 gst_element_class_add_pad_template (element_class,
222 gst_video_scale_sink_template_factory ());
223 gst_element_class_add_pad_template (element_class,
224 gst_video_scale_src_template_factory ());
226 trans_class->transform_caps =
227 GST_DEBUG_FUNCPTR (gst_video_scale_transform_caps);
228 trans_class->set_caps = GST_DEBUG_FUNCPTR (gst_video_scale_set_caps);
229 trans_class->get_unit_size =
230 GST_DEBUG_FUNCPTR (gst_video_scale_get_unit_size);
231 trans_class->transform = GST_DEBUG_FUNCPTR (gst_video_scale_transform);
232 trans_class->fixate_caps = GST_DEBUG_FUNCPTR (gst_video_scale_fixate_caps);
233 trans_class->src_event = GST_DEBUG_FUNCPTR (gst_video_scale_src_event);
237 gst_video_scale_init (GstVideoScale * videoscale)
239 videoscale->tmp_buf = NULL;
240 videoscale->method = DEFAULT_PROP_METHOD;
241 videoscale->add_borders = DEFAULT_PROP_ADD_BORDERS;
245 gst_video_scale_finalize (GstVideoScale * videoscale)
247 if (videoscale->tmp_buf)
248 g_free (videoscale->tmp_buf);
250 G_OBJECT_CLASS (parent_class)->finalize (G_OBJECT (videoscale));
254 gst_video_scale_set_property (GObject * object, guint prop_id,
255 const GValue * value, GParamSpec * pspec)
257 GstVideoScale *vscale = GST_VIDEO_SCALE (object);
261 GST_OBJECT_LOCK (vscale);
262 vscale->method = g_value_get_enum (value);
263 GST_OBJECT_UNLOCK (vscale);
265 case PROP_ADD_BORDERS:
266 GST_OBJECT_LOCK (vscale);
267 vscale->add_borders = g_value_get_boolean (value);
268 GST_OBJECT_UNLOCK (vscale);
269 gst_base_transform_reconfigure (GST_BASE_TRANSFORM_CAST (vscale));
272 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
278 gst_video_scale_get_property (GObject * object, guint prop_id, GValue * value,
281 GstVideoScale *vscale = GST_VIDEO_SCALE (object);
285 GST_OBJECT_LOCK (vscale);
286 g_value_set_enum (value, vscale->method);
287 GST_OBJECT_UNLOCK (vscale);
289 case PROP_ADD_BORDERS:
290 GST_OBJECT_LOCK (vscale);
291 g_value_set_boolean (value, vscale->add_borders);
292 GST_OBJECT_UNLOCK (vscale);
295 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
301 gst_video_scale_transform_caps (GstBaseTransform * trans,
302 GstPadDirection direction, GstCaps * caps, GstCaps * filter)
305 GstStructure *structure;
308 GST_DEBUG_OBJECT (trans,
309 "Transforming caps %" GST_PTR_FORMAT " in direction %s", caps,
310 (direction == GST_PAD_SINK) ? "sink" : "src");
312 ret = gst_caps_new_empty ();
313 n = gst_caps_get_size (caps);
314 for (i = 0; i < n; i++) {
315 structure = gst_caps_get_structure (caps, i);
317 /* If this is already expressed by the existing caps
318 * skip this structure */
319 if (i > 0 && gst_caps_is_subset_structure (ret, structure))
322 structure = gst_structure_copy (structure);
323 gst_structure_set (structure,
324 "width", GST_TYPE_INT_RANGE, 1, G_MAXINT,
325 "height", GST_TYPE_INT_RANGE, 1, G_MAXINT, NULL);
327 /* if pixel aspect ratio, make a range of it */
328 if (gst_structure_has_field (structure, "pixel-aspect-ratio")) {
329 gst_structure_set (structure, "pixel-aspect-ratio",
330 GST_TYPE_FRACTION_RANGE, 1, G_MAXINT, G_MAXINT, 1, NULL);
332 gst_caps_append_structure (ret, structure);
336 GstCaps *intersection;
339 gst_caps_intersect_full (filter, ret, GST_CAPS_INTERSECT_FIRST);
340 gst_caps_unref (ret);
344 GST_DEBUG_OBJECT (trans, "returning caps: %" GST_PTR_FORMAT, ret);
350 gst_video_scale_set_caps (GstBaseTransform * trans, GstCaps * in, GstCaps * out)
352 GstVideoScale *videoscale = GST_VIDEO_SCALE (trans);
354 gint from_dar_n, from_dar_d, to_dar_n, to_dar_d;
355 gint from_par_n, from_par_d, to_par_n, to_par_d;
358 gst_video_format_parse_caps (in, &videoscale->format,
359 &videoscale->from_width, &videoscale->from_height);
361 gst_video_format_parse_caps (out, NULL, &videoscale->to_width,
362 &videoscale->to_height);
366 videoscale->src_size = gst_video_format_get_size (videoscale->format,
367 videoscale->from_width, videoscale->from_height);
368 videoscale->dest_size = gst_video_format_get_size (videoscale->format,
369 videoscale->to_width, videoscale->to_height);
371 if (!gst_video_parse_caps_pixel_aspect_ratio (in, &from_par_n, &from_par_d))
372 from_par_n = from_par_d = 1;
373 if (!gst_video_parse_caps_pixel_aspect_ratio (out, &to_par_n, &to_par_d))
374 to_par_n = to_par_d = 1;
376 if (!gst_util_fraction_multiply (videoscale->from_width,
377 videoscale->from_height, from_par_n, from_par_d, &from_dar_n,
379 from_dar_n = from_dar_d = -1;
382 if (!gst_util_fraction_multiply (videoscale->to_width,
383 videoscale->to_height, to_par_n, to_par_d, &to_dar_n, &to_dar_d)) {
384 to_dar_n = to_dar_d = -1;
387 videoscale->borders_w = videoscale->borders_h = 0;
388 if (to_dar_n != from_dar_n || to_dar_d != from_dar_d) {
389 if (videoscale->add_borders) {
390 gint n, d, to_h, to_w;
392 if (from_dar_n != -1 && from_dar_d != -1
393 && gst_util_fraction_multiply (from_dar_n, from_dar_d, to_par_n,
395 to_h = gst_util_uint64_scale_int (videoscale->to_width, d, n);
396 if (to_h <= videoscale->to_height) {
397 videoscale->borders_h = videoscale->to_height - to_h;
398 videoscale->borders_w = 0;
400 to_w = gst_util_uint64_scale_int (videoscale->to_height, n, d);
401 g_assert (to_w <= videoscale->to_width);
402 videoscale->borders_h = 0;
403 videoscale->borders_w = videoscale->to_width - to_w;
406 GST_WARNING_OBJECT (videoscale, "Can't calculate borders");
409 GST_WARNING_OBJECT (videoscale, "Can't keep DAR!");
413 if (videoscale->tmp_buf)
414 g_free (videoscale->tmp_buf);
415 videoscale->tmp_buf = g_malloc (videoscale->to_width * 8 * 4);
417 gst_base_transform_set_passthrough (trans,
418 (videoscale->from_width == videoscale->to_width
419 && videoscale->from_height == videoscale->to_height));
421 GST_DEBUG_OBJECT (videoscale, "from=%dx%d (par=%d/%d dar=%d/%d), size %d "
422 "-> to=%dx%d (par=%d/%d dar=%d/%d borders=%d:%d), size %d",
423 videoscale->from_width, videoscale->from_height, from_par_n, from_par_d,
424 from_dar_n, from_dar_d, videoscale->src_size, videoscale->to_width,
425 videoscale->to_height, to_par_n, to_par_d, to_dar_n, to_dar_d,
426 videoscale->borders_w, videoscale->borders_h, videoscale->dest_size);
433 gst_video_scale_get_unit_size (GstBaseTransform * trans, GstCaps * caps,
436 GstVideoFormat format;
439 if (!gst_video_format_parse_caps (caps, &format, &width, &height))
442 *size = gst_video_format_get_size (format, width, height);
448 gst_video_scale_fixate_caps (GstBaseTransform * base, GstPadDirection direction,
449 GstCaps * caps, GstCaps * othercaps)
451 GstStructure *ins, *outs;
452 const GValue *from_par, *to_par;
453 GValue fpar = { 0, }, tpar = {
456 g_return_if_fail (gst_caps_is_fixed (caps));
458 GST_DEBUG_OBJECT (base, "trying to fixate othercaps %" GST_PTR_FORMAT
459 " based on caps %" GST_PTR_FORMAT, othercaps, caps);
461 ins = gst_caps_get_structure (caps, 0);
462 outs = gst_caps_get_structure (othercaps, 0);
464 from_par = gst_structure_get_value (ins, "pixel-aspect-ratio");
465 to_par = gst_structure_get_value (outs, "pixel-aspect-ratio");
467 /* If we're fixating from the sinkpad we always set the PAR and
468 * assume that missing PAR on the sinkpad means 1/1 and
469 * missing PAR on the srcpad means undefined
471 if (direction == GST_PAD_SINK) {
473 g_value_init (&fpar, GST_TYPE_FRACTION);
474 gst_value_set_fraction (&fpar, 1, 1);
478 g_value_init (&tpar, GST_TYPE_FRACTION_RANGE);
479 gst_value_set_fraction_range_full (&tpar, 1, G_MAXINT, G_MAXINT, 1);
484 g_value_init (&tpar, GST_TYPE_FRACTION);
485 gst_value_set_fraction (&tpar, 1, 1);
488 gst_structure_set (outs, "pixel-aspect-ratio", GST_TYPE_FRACTION, 1, 1,
492 g_value_init (&fpar, GST_TYPE_FRACTION);
493 gst_value_set_fraction (&fpar, 1, 1);
498 /* we have both PAR but they might not be fixated */
500 gint from_w, from_h, from_par_n, from_par_d, to_par_n, to_par_d;
502 gint from_dar_n, from_dar_d;
505 /* from_par should be fixed */
506 g_return_if_fail (gst_value_is_fixed (from_par));
508 from_par_n = gst_value_get_fraction_numerator (from_par);
509 from_par_d = gst_value_get_fraction_denominator (from_par);
511 gst_structure_get_int (ins, "width", &from_w);
512 gst_structure_get_int (ins, "height", &from_h);
514 gst_structure_get_int (outs, "width", &w);
515 gst_structure_get_int (outs, "height", &h);
517 /* if both width and height are already fixed, we can't do anything
518 * about it anymore */
522 GST_DEBUG_OBJECT (base, "dimensions already set to %dx%d, not fixating",
524 if (!gst_value_is_fixed (to_par)) {
525 if (gst_video_calculate_display_ratio (&n, &d, from_w, from_h,
526 from_par_n, from_par_d, w, h)) {
527 GST_DEBUG_OBJECT (base, "fixating to_par to %dx%d", n, d);
528 if (gst_structure_has_field (outs, "pixel-aspect-ratio"))
529 gst_structure_fixate_field_nearest_fraction (outs,
530 "pixel-aspect-ratio", n, d);
532 gst_structure_set (outs, "pixel-aspect-ratio", GST_TYPE_FRACTION,
539 /* Calculate input DAR */
540 if (!gst_util_fraction_multiply (from_w, from_h, from_par_n, from_par_d,
541 &from_dar_n, &from_dar_d)) {
542 GST_ELEMENT_ERROR (base, CORE, NEGOTIATION, (NULL),
543 ("Error calculating the output scaled size - integer overflow"));
547 GST_DEBUG_OBJECT (base, "Input DAR is %d/%d", from_dar_n, from_dar_d);
549 /* If either width or height are fixed there's not much we
550 * can do either except choosing a height or width and PAR
551 * that matches the DAR as good as possible
555 gint set_w, set_par_n, set_par_d;
557 GST_DEBUG_OBJECT (base, "height is fixed (%d)", h);
559 /* If the PAR is fixed too, there's not much to do
560 * except choosing the width that is nearest to the
561 * width with the same DAR */
562 if (gst_value_is_fixed (to_par)) {
563 to_par_n = gst_value_get_fraction_numerator (to_par);
564 to_par_d = gst_value_get_fraction_denominator (to_par);
566 GST_DEBUG_OBJECT (base, "PAR is fixed %d/%d", to_par_n, to_par_d);
568 if (!gst_util_fraction_multiply (from_dar_n, from_dar_d, to_par_d,
569 to_par_n, &num, &den)) {
570 GST_ELEMENT_ERROR (base, CORE, NEGOTIATION, (NULL),
571 ("Error calculating the output scaled size - integer overflow"));
575 w = (guint) gst_util_uint64_scale_int (h, num, den);
576 gst_structure_fixate_field_nearest_int (outs, "width", w);
581 /* The PAR is not fixed and it's quite likely that we can set
582 * an arbitrary PAR. */
584 /* Check if we can keep the input width */
585 tmp = gst_structure_copy (outs);
586 gst_structure_fixate_field_nearest_int (tmp, "width", from_w);
587 gst_structure_get_int (tmp, "width", &set_w);
589 /* Might have failed but try to keep the DAR nonetheless by
590 * adjusting the PAR */
591 if (!gst_util_fraction_multiply (from_dar_n, from_dar_d, h, set_w,
592 &to_par_n, &to_par_d)) {
593 GST_ELEMENT_ERROR (base, CORE, NEGOTIATION, (NULL),
594 ("Error calculating the output scaled size - integer overflow"));
595 gst_structure_free (tmp);
599 if (!gst_structure_has_field (tmp, "pixel-aspect-ratio"))
600 gst_structure_set_value (tmp, "pixel-aspect-ratio", to_par);
601 gst_structure_fixate_field_nearest_fraction (tmp, "pixel-aspect-ratio",
603 gst_structure_get_fraction (tmp, "pixel-aspect-ratio", &set_par_n,
605 gst_structure_free (tmp);
607 /* Check if the adjusted PAR is accepted */
608 if (set_par_n == to_par_n && set_par_d == to_par_d) {
609 if (gst_structure_has_field (outs, "pixel-aspect-ratio") ||
610 set_par_n != set_par_d)
611 gst_structure_set (outs, "width", G_TYPE_INT, set_w,
612 "pixel-aspect-ratio", GST_TYPE_FRACTION, set_par_n, set_par_d,
617 /* Otherwise scale the width to the new PAR and check if the
618 * adjusted with is accepted. If all that fails we can't keep
620 if (!gst_util_fraction_multiply (from_dar_n, from_dar_d, set_par_d,
621 set_par_n, &num, &den)) {
622 GST_ELEMENT_ERROR (base, CORE, NEGOTIATION, (NULL),
623 ("Error calculating the output scaled size - integer overflow"));
627 w = (guint) gst_util_uint64_scale_int (h, num, den);
628 gst_structure_fixate_field_nearest_int (outs, "width", w);
629 if (gst_structure_has_field (outs, "pixel-aspect-ratio") ||
630 set_par_n != set_par_d)
631 gst_structure_set (outs, "pixel-aspect-ratio", GST_TYPE_FRACTION,
632 set_par_n, set_par_d, NULL);
637 gint set_h, set_par_n, set_par_d;
639 GST_DEBUG_OBJECT (base, "width is fixed (%d)", w);
641 /* If the PAR is fixed too, there's not much to do
642 * except choosing the height that is nearest to the
643 * height with the same DAR */
644 if (gst_value_is_fixed (to_par)) {
645 to_par_n = gst_value_get_fraction_numerator (to_par);
646 to_par_d = gst_value_get_fraction_denominator (to_par);
648 GST_DEBUG_OBJECT (base, "PAR is fixed %d/%d", to_par_n, to_par_d);
650 if (!gst_util_fraction_multiply (from_dar_n, from_dar_d, to_par_d,
651 to_par_n, &num, &den)) {
652 GST_ELEMENT_ERROR (base, CORE, NEGOTIATION, (NULL),
653 ("Error calculating the output scaled size - integer overflow"));
657 h = (guint) gst_util_uint64_scale_int (w, den, num);
658 gst_structure_fixate_field_nearest_int (outs, "height", h);
663 /* The PAR is not fixed and it's quite likely that we can set
664 * an arbitrary PAR. */
666 /* Check if we can keep the input height */
667 tmp = gst_structure_copy (outs);
668 gst_structure_fixate_field_nearest_int (tmp, "height", from_h);
669 gst_structure_get_int (tmp, "height", &set_h);
671 /* Might have failed but try to keep the DAR nonetheless by
672 * adjusting the PAR */
673 if (!gst_util_fraction_multiply (from_dar_n, from_dar_d, set_h, w,
674 &to_par_n, &to_par_d)) {
675 GST_ELEMENT_ERROR (base, CORE, NEGOTIATION, (NULL),
676 ("Error calculating the output scaled size - integer overflow"));
677 gst_structure_free (tmp);
680 if (!gst_structure_has_field (tmp, "pixel-aspect-ratio"))
681 gst_structure_set_value (tmp, "pixel-aspect-ratio", to_par);
682 gst_structure_fixate_field_nearest_fraction (tmp, "pixel-aspect-ratio",
684 gst_structure_get_fraction (tmp, "pixel-aspect-ratio", &set_par_n,
686 gst_structure_free (tmp);
688 /* Check if the adjusted PAR is accepted */
689 if (set_par_n == to_par_n && set_par_d == to_par_d) {
690 if (gst_structure_has_field (outs, "pixel-aspect-ratio") ||
691 set_par_n != set_par_d)
692 gst_structure_set (outs, "height", G_TYPE_INT, set_h,
693 "pixel-aspect-ratio", GST_TYPE_FRACTION, set_par_n, set_par_d,
698 /* Otherwise scale the height to the new PAR and check if the
699 * adjusted with is accepted. If all that fails we can't keep
701 if (!gst_util_fraction_multiply (from_dar_n, from_dar_d, set_par_d,
702 set_par_n, &num, &den)) {
703 GST_ELEMENT_ERROR (base, CORE, NEGOTIATION, (NULL),
704 ("Error calculating the output scaled size - integer overflow"));
708 h = (guint) gst_util_uint64_scale_int (w, den, num);
709 gst_structure_fixate_field_nearest_int (outs, "height", h);
710 if (gst_structure_has_field (outs, "pixel-aspect-ratio") ||
711 set_par_n != set_par_d)
712 gst_structure_set (outs, "pixel-aspect-ratio", GST_TYPE_FRACTION,
713 set_par_n, set_par_d, NULL);
716 } else if (gst_value_is_fixed (to_par)) {
718 gint set_h, set_w, f_h, f_w;
720 to_par_n = gst_value_get_fraction_numerator (to_par);
721 to_par_d = gst_value_get_fraction_denominator (to_par);
723 /* Calculate scale factor for the PAR change */
724 if (!gst_util_fraction_multiply (from_dar_n, from_dar_d, to_par_n,
725 to_par_d, &num, &den)) {
726 GST_ELEMENT_ERROR (base, CORE, NEGOTIATION, (NULL),
727 ("Error calculating the output scaled size - integer overflow"));
731 /* Try to keep the input height (because of interlacing) */
732 tmp = gst_structure_copy (outs);
733 gst_structure_fixate_field_nearest_int (tmp, "height", from_h);
734 gst_structure_get_int (tmp, "height", &set_h);
736 /* This might have failed but try to scale the width
737 * to keep the DAR nonetheless */
738 w = (guint) gst_util_uint64_scale_int (set_h, num, den);
739 gst_structure_fixate_field_nearest_int (tmp, "width", w);
740 gst_structure_get_int (tmp, "width", &set_w);
741 gst_structure_free (tmp);
743 /* We kept the DAR and the height is nearest to the original height */
745 gst_structure_set (outs, "width", G_TYPE_INT, set_w, "height",
746 G_TYPE_INT, set_h, NULL);
753 /* If the former failed, try to keep the input width at least */
754 tmp = gst_structure_copy (outs);
755 gst_structure_fixate_field_nearest_int (tmp, "width", from_w);
756 gst_structure_get_int (tmp, "width", &set_w);
758 /* This might have failed but try to scale the width
759 * to keep the DAR nonetheless */
760 h = (guint) gst_util_uint64_scale_int (set_w, den, num);
761 gst_structure_fixate_field_nearest_int (tmp, "height", h);
762 gst_structure_get_int (tmp, "height", &set_h);
763 gst_structure_free (tmp);
765 /* We kept the DAR and the width is nearest to the original width */
767 gst_structure_set (outs, "width", G_TYPE_INT, set_w, "height",
768 G_TYPE_INT, set_h, NULL);
772 /* If all this failed, keep the height that was nearest to the orignal
773 * height and the nearest possible width. This changes the DAR but
774 * there's not much else to do here.
776 gst_structure_set (outs, "width", G_TYPE_INT, f_w, "height", G_TYPE_INT,
781 gint set_h, set_w, set_par_n, set_par_d, tmp2;
783 /* width, height and PAR are not fixed but passthrough is not possible */
785 /* First try to keep the height and width as good as possible
787 tmp = gst_structure_copy (outs);
788 gst_structure_fixate_field_nearest_int (tmp, "height", from_h);
789 gst_structure_get_int (tmp, "height", &set_h);
790 gst_structure_fixate_field_nearest_int (tmp, "width", from_w);
791 gst_structure_get_int (tmp, "width", &set_w);
793 if (!gst_util_fraction_multiply (from_dar_n, from_dar_d, set_h, set_w,
794 &to_par_n, &to_par_d)) {
795 GST_ELEMENT_ERROR (base, CORE, NEGOTIATION, (NULL),
796 ("Error calculating the output scaled size - integer overflow"));
800 if (!gst_structure_has_field (tmp, "pixel-aspect-ratio"))
801 gst_structure_set_value (tmp, "pixel-aspect-ratio", to_par);
802 gst_structure_fixate_field_nearest_fraction (tmp, "pixel-aspect-ratio",
804 gst_structure_get_fraction (tmp, "pixel-aspect-ratio", &set_par_n,
806 gst_structure_free (tmp);
808 if (set_par_n == to_par_n && set_par_d == to_par_d) {
809 gst_structure_set (outs, "width", G_TYPE_INT, set_w, "height",
810 G_TYPE_INT, set_h, NULL);
812 if (gst_structure_has_field (outs, "pixel-aspect-ratio") ||
813 set_par_n != set_par_d)
814 gst_structure_set (outs, "pixel-aspect-ratio", GST_TYPE_FRACTION,
815 set_par_n, set_par_d, NULL);
819 /* Otherwise try to scale width to keep the DAR with the set
821 if (!gst_util_fraction_multiply (from_dar_n, from_dar_d, set_par_d,
822 set_par_n, &num, &den)) {
823 GST_ELEMENT_ERROR (base, CORE, NEGOTIATION, (NULL),
824 ("Error calculating the output scaled size - integer overflow"));
828 w = (guint) gst_util_uint64_scale_int (set_h, num, den);
829 tmp = gst_structure_copy (outs);
830 gst_structure_fixate_field_nearest_int (tmp, "width", w);
831 gst_structure_get_int (tmp, "width", &tmp2);
832 gst_structure_free (tmp);
835 gst_structure_set (outs, "width", G_TYPE_INT, tmp2, "height",
836 G_TYPE_INT, set_h, NULL);
837 if (gst_structure_has_field (outs, "pixel-aspect-ratio") ||
838 set_par_n != set_par_d)
839 gst_structure_set (outs, "pixel-aspect-ratio", GST_TYPE_FRACTION,
840 set_par_n, set_par_d, NULL);
844 /* ... or try the same with the height */
845 h = (guint) gst_util_uint64_scale_int (set_w, den, num);
846 tmp = gst_structure_copy (outs);
847 gst_structure_fixate_field_nearest_int (tmp, "height", h);
848 gst_structure_get_int (tmp, "height", &tmp2);
849 gst_structure_free (tmp);
852 gst_structure_set (outs, "width", G_TYPE_INT, set_w, "height",
853 G_TYPE_INT, tmp2, NULL);
854 if (gst_structure_has_field (outs, "pixel-aspect-ratio") ||
855 set_par_n != set_par_d)
856 gst_structure_set (outs, "pixel-aspect-ratio", GST_TYPE_FRACTION,
857 set_par_n, set_par_d, NULL);
861 /* If all fails we can't keep the DAR and take the nearest values
862 * for everything from the first try */
863 gst_structure_set (outs, "width", G_TYPE_INT, set_w, "height",
864 G_TYPE_INT, set_h, NULL);
865 if (gst_structure_has_field (outs, "pixel-aspect-ratio") ||
866 set_par_n != set_par_d)
867 gst_structure_set (outs, "pixel-aspect-ratio", GST_TYPE_FRACTION,
868 set_par_n, set_par_d, NULL);
873 GST_DEBUG_OBJECT (base, "fixated othercaps to %" GST_PTR_FORMAT, othercaps);
875 if (from_par == &fpar)
876 g_value_unset (&fpar);
878 g_value_unset (&tpar);
882 gst_video_scale_setup_vs_image (VSImage * image, GstVideoFormat format,
883 gint component, gint width, gint height, gint b_w, gint b_h, uint8_t * data)
886 gst_video_format_get_component_width (format, component, width);
888 gst_video_format_get_component_height (format, component, height);
890 gst_video_format_get_component_width (format, component, MAX (1,
893 gst_video_format_get_component_height (format, component, MAX (1,
895 image->stride = gst_video_format_get_row_stride (format, component, width);
897 image->border_top = (image->real_height - image->height) / 2;
898 image->border_bottom = image->real_height - image->height - image->border_top;
900 if (format == GST_VIDEO_FORMAT_YUY2 || format == GST_VIDEO_FORMAT_YVYU
901 || format == GST_VIDEO_FORMAT_UYVY) {
902 g_assert (component == 0);
904 image->border_left = (image->real_width - image->width) / 2;
906 if (image->border_left % 2 == 1)
907 image->border_left--;
908 image->border_right = image->real_width - image->width - image->border_left;
910 image->border_left = (image->real_width - image->width) / 2;
911 image->border_right = image->real_width - image->width - image->border_left;
914 if (format == GST_VIDEO_FORMAT_I420
915 || format == GST_VIDEO_FORMAT_YV12
916 || format == GST_VIDEO_FORMAT_Y444
917 || format == GST_VIDEO_FORMAT_Y42B || format == GST_VIDEO_FORMAT_Y41B) {
918 image->real_pixels = data + gst_video_format_get_component_offset (format,
919 component, width, height);
921 g_assert (component == 0);
922 image->real_pixels = data;
926 image->real_pixels + image->border_top * image->stride +
927 image->border_left * gst_video_format_get_pixel_stride (format,
931 static const guint8 *
932 _get_black_for_format (GstVideoFormat format)
934 static const guint8 black[][4] = {
935 {255, 0, 0, 0}, /* 0 = ARGB, ABGR, xRGB, xBGR */
936 {0, 0, 0, 255}, /* 1 = RGBA, BGRA, RGBx, BGRx */
937 {255, 16, 128, 128}, /* 2 = AYUV */
938 {0, 0, 0, 0}, /* 3 = RGB and BGR */
939 {16, 128, 128, 0}, /* 4 = v301 */
940 {16, 128, 16, 128}, /* 5 = YUY2, YUYV */
941 {128, 16, 128, 16}, /* 6 = UYVY */
942 {16, 0, 0, 0}, /* 7 = Y */
943 {0, 0, 0, 0} /* 8 = RGB565, RGB666 */
947 case GST_VIDEO_FORMAT_ARGB:
948 case GST_VIDEO_FORMAT_ABGR:
949 case GST_VIDEO_FORMAT_xRGB:
950 case GST_VIDEO_FORMAT_xBGR:
951 case GST_VIDEO_FORMAT_ARGB64:
953 case GST_VIDEO_FORMAT_RGBA:
954 case GST_VIDEO_FORMAT_BGRA:
955 case GST_VIDEO_FORMAT_RGBx:
956 case GST_VIDEO_FORMAT_BGRx:
958 case GST_VIDEO_FORMAT_AYUV:
959 case GST_VIDEO_FORMAT_AYUV64:
961 case GST_VIDEO_FORMAT_RGB:
962 case GST_VIDEO_FORMAT_BGR:
964 case GST_VIDEO_FORMAT_v308:
966 case GST_VIDEO_FORMAT_YUY2:
967 case GST_VIDEO_FORMAT_YVYU:
969 case GST_VIDEO_FORMAT_UYVY:
971 case GST_VIDEO_FORMAT_Y800:
972 case GST_VIDEO_FORMAT_GRAY8:
974 case GST_VIDEO_FORMAT_GRAY16_LE:
975 case GST_VIDEO_FORMAT_GRAY16_BE:
976 case GST_VIDEO_FORMAT_Y16:
977 return NULL; /* Handled by the caller */
978 case GST_VIDEO_FORMAT_I420:
979 case GST_VIDEO_FORMAT_YV12:
980 case GST_VIDEO_FORMAT_Y444:
981 case GST_VIDEO_FORMAT_Y42B:
982 case GST_VIDEO_FORMAT_Y41B:
983 return black[4]; /* Y, U, V, 0 */
984 case GST_VIDEO_FORMAT_RGB16:
985 case GST_VIDEO_FORMAT_RGB15:
993 gst_video_scale_transform (GstBaseTransform * trans, GstBuffer * in,
996 GstVideoScale *videoscale = GST_VIDEO_SCALE (trans);
997 GstFlowReturn ret = GST_FLOW_OK;
998 VSImage dest = { NULL, };
999 VSImage src = { NULL, };
1000 VSImage dest_u = { NULL, };
1001 VSImage dest_v = { NULL, };
1002 VSImage src_u = { NULL, };
1003 VSImage src_v = { NULL, };
1005 const guint8 *black = _get_black_for_format (videoscale->format);
1006 gboolean add_borders;
1007 guint8 *in_data, *out_data;
1008 gsize in_size, out_size;
1010 GST_OBJECT_LOCK (videoscale);
1011 method = videoscale->method;
1012 add_borders = videoscale->add_borders;
1013 GST_OBJECT_UNLOCK (videoscale);
1015 if (videoscale->from_width == 1) {
1016 method = GST_VIDEO_SCALE_NEAREST;
1018 if (method == GST_VIDEO_SCALE_4TAP &&
1019 (videoscale->from_width < 4 || videoscale->from_height < 4)) {
1020 method = GST_VIDEO_SCALE_BILINEAR;
1023 in_data = gst_buffer_map (in, &in_size, NULL, GST_MAP_READ);
1024 out_data = gst_buffer_map (out, &out_size, NULL, GST_MAP_WRITE);
1026 gst_video_scale_setup_vs_image (&src, videoscale->format, 0,
1027 videoscale->from_width, videoscale->from_height, 0, 0, in_data);
1028 gst_video_scale_setup_vs_image (&dest, videoscale->format, 0,
1029 videoscale->to_width, videoscale->to_height, videoscale->borders_w,
1030 videoscale->borders_h, out_data);
1032 if (videoscale->format == GST_VIDEO_FORMAT_I420
1033 || videoscale->format == GST_VIDEO_FORMAT_YV12
1034 || videoscale->format == GST_VIDEO_FORMAT_Y444
1035 || videoscale->format == GST_VIDEO_FORMAT_Y42B
1036 || videoscale->format == GST_VIDEO_FORMAT_Y41B) {
1037 gst_video_scale_setup_vs_image (&src_u, videoscale->format, 1,
1038 videoscale->from_width, videoscale->from_height, 0, 0, in_data);
1039 gst_video_scale_setup_vs_image (&src_v, videoscale->format, 2,
1040 videoscale->from_width, videoscale->from_height, 0, 0, in_data);
1041 gst_video_scale_setup_vs_image (&dest_u, videoscale->format, 1,
1042 videoscale->to_width, videoscale->to_height, videoscale->borders_w,
1043 videoscale->borders_h, out_data);
1044 gst_video_scale_setup_vs_image (&dest_v, videoscale->format, 2,
1045 videoscale->to_width, videoscale->to_height, videoscale->borders_w,
1046 videoscale->borders_h, out_data);
1049 switch (videoscale->format) {
1050 case GST_VIDEO_FORMAT_RGBx:
1051 case GST_VIDEO_FORMAT_xRGB:
1052 case GST_VIDEO_FORMAT_BGRx:
1053 case GST_VIDEO_FORMAT_xBGR:
1054 case GST_VIDEO_FORMAT_RGBA:
1055 case GST_VIDEO_FORMAT_ARGB:
1056 case GST_VIDEO_FORMAT_BGRA:
1057 case GST_VIDEO_FORMAT_ABGR:
1058 case GST_VIDEO_FORMAT_AYUV:
1060 vs_fill_borders_RGBA (&dest, black);
1062 case GST_VIDEO_SCALE_NEAREST:
1063 vs_image_scale_nearest_RGBA (&dest, &src, videoscale->tmp_buf);
1065 case GST_VIDEO_SCALE_BILINEAR:
1066 vs_image_scale_linear_RGBA (&dest, &src, videoscale->tmp_buf);
1068 case GST_VIDEO_SCALE_4TAP:
1069 vs_image_scale_4tap_RGBA (&dest, &src, videoscale->tmp_buf);
1075 case GST_VIDEO_FORMAT_ARGB64:
1076 case GST_VIDEO_FORMAT_AYUV64:
1078 vs_fill_borders_AYUV64 (&dest, black);
1080 case GST_VIDEO_SCALE_NEAREST:
1081 vs_image_scale_nearest_AYUV64 (&dest, &src, videoscale->tmp_buf);
1083 case GST_VIDEO_SCALE_BILINEAR:
1084 vs_image_scale_linear_AYUV64 (&dest, &src, videoscale->tmp_buf);
1086 case GST_VIDEO_SCALE_4TAP:
1087 vs_image_scale_4tap_AYUV64 (&dest, &src, videoscale->tmp_buf);
1093 case GST_VIDEO_FORMAT_RGB:
1094 case GST_VIDEO_FORMAT_BGR:
1095 case GST_VIDEO_FORMAT_v308:
1097 vs_fill_borders_RGB (&dest, black);
1099 case GST_VIDEO_SCALE_NEAREST:
1100 vs_image_scale_nearest_RGB (&dest, &src, videoscale->tmp_buf);
1102 case GST_VIDEO_SCALE_BILINEAR:
1103 vs_image_scale_linear_RGB (&dest, &src, videoscale->tmp_buf);
1105 case GST_VIDEO_SCALE_4TAP:
1106 vs_image_scale_4tap_RGB (&dest, &src, videoscale->tmp_buf);
1112 case GST_VIDEO_FORMAT_YUY2:
1113 case GST_VIDEO_FORMAT_YVYU:
1115 vs_fill_borders_YUYV (&dest, black);
1117 case GST_VIDEO_SCALE_NEAREST:
1118 vs_image_scale_nearest_YUYV (&dest, &src, videoscale->tmp_buf);
1120 case GST_VIDEO_SCALE_BILINEAR:
1121 vs_image_scale_linear_YUYV (&dest, &src, videoscale->tmp_buf);
1123 case GST_VIDEO_SCALE_4TAP:
1124 vs_image_scale_4tap_YUYV (&dest, &src, videoscale->tmp_buf);
1130 case GST_VIDEO_FORMAT_UYVY:
1132 vs_fill_borders_UYVY (&dest, black);
1134 case GST_VIDEO_SCALE_NEAREST:
1135 vs_image_scale_nearest_UYVY (&dest, &src, videoscale->tmp_buf);
1137 case GST_VIDEO_SCALE_BILINEAR:
1138 vs_image_scale_linear_UYVY (&dest, &src, videoscale->tmp_buf);
1140 case GST_VIDEO_SCALE_4TAP:
1141 vs_image_scale_4tap_UYVY (&dest, &src, videoscale->tmp_buf);
1147 case GST_VIDEO_FORMAT_Y800:
1148 case GST_VIDEO_FORMAT_GRAY8:
1150 vs_fill_borders_Y (&dest, black);
1152 case GST_VIDEO_SCALE_NEAREST:
1153 vs_image_scale_nearest_Y (&dest, &src, videoscale->tmp_buf);
1155 case GST_VIDEO_SCALE_BILINEAR:
1156 vs_image_scale_linear_Y (&dest, &src, videoscale->tmp_buf);
1158 case GST_VIDEO_SCALE_4TAP:
1159 vs_image_scale_4tap_Y (&dest, &src, videoscale->tmp_buf);
1165 case GST_VIDEO_FORMAT_GRAY16_LE:
1166 case GST_VIDEO_FORMAT_GRAY16_BE:
1167 case GST_VIDEO_FORMAT_Y16:
1169 vs_fill_borders_Y16 (&dest, 0);
1171 case GST_VIDEO_SCALE_NEAREST:
1172 vs_image_scale_nearest_Y16 (&dest, &src, videoscale->tmp_buf);
1174 case GST_VIDEO_SCALE_BILINEAR:
1175 vs_image_scale_linear_Y16 (&dest, &src, videoscale->tmp_buf);
1177 case GST_VIDEO_SCALE_4TAP:
1178 vs_image_scale_4tap_Y16 (&dest, &src, videoscale->tmp_buf);
1184 case GST_VIDEO_FORMAT_I420:
1185 case GST_VIDEO_FORMAT_YV12:
1186 case GST_VIDEO_FORMAT_Y444:
1187 case GST_VIDEO_FORMAT_Y42B:
1188 case GST_VIDEO_FORMAT_Y41B:
1190 vs_fill_borders_Y (&dest, black);
1191 vs_fill_borders_Y (&dest_u, black + 1);
1192 vs_fill_borders_Y (&dest_v, black + 2);
1195 case GST_VIDEO_SCALE_NEAREST:
1196 vs_image_scale_nearest_Y (&dest, &src, videoscale->tmp_buf);
1197 vs_image_scale_nearest_Y (&dest_u, &src_u, videoscale->tmp_buf);
1198 vs_image_scale_nearest_Y (&dest_v, &src_v, videoscale->tmp_buf);
1200 case GST_VIDEO_SCALE_BILINEAR:
1201 vs_image_scale_linear_Y (&dest, &src, videoscale->tmp_buf);
1202 vs_image_scale_linear_Y (&dest_u, &src_u, videoscale->tmp_buf);
1203 vs_image_scale_linear_Y (&dest_v, &src_v, videoscale->tmp_buf);
1205 case GST_VIDEO_SCALE_4TAP:
1206 vs_image_scale_4tap_Y (&dest, &src, videoscale->tmp_buf);
1207 vs_image_scale_4tap_Y (&dest_u, &src_u, videoscale->tmp_buf);
1208 vs_image_scale_4tap_Y (&dest_v, &src_v, videoscale->tmp_buf);
1214 case GST_VIDEO_FORMAT_RGB16:
1216 vs_fill_borders_RGB565 (&dest, black);
1218 case GST_VIDEO_SCALE_NEAREST:
1219 vs_image_scale_nearest_RGB565 (&dest, &src, videoscale->tmp_buf);
1221 case GST_VIDEO_SCALE_BILINEAR:
1222 vs_image_scale_linear_RGB565 (&dest, &src, videoscale->tmp_buf);
1224 case GST_VIDEO_SCALE_4TAP:
1225 vs_image_scale_4tap_RGB565 (&dest, &src, videoscale->tmp_buf);
1231 case GST_VIDEO_FORMAT_RGB15:
1233 vs_fill_borders_RGB555 (&dest, black);
1235 case GST_VIDEO_SCALE_NEAREST:
1236 vs_image_scale_nearest_RGB555 (&dest, &src, videoscale->tmp_buf);
1238 case GST_VIDEO_SCALE_BILINEAR:
1239 vs_image_scale_linear_RGB555 (&dest, &src, videoscale->tmp_buf);
1241 case GST_VIDEO_SCALE_4TAP:
1242 vs_image_scale_4tap_RGB555 (&dest, &src, videoscale->tmp_buf);
1252 GST_LOG_OBJECT (videoscale, "pushing buffer of %d bytes",
1253 gst_buffer_get_size (out));
1256 gst_buffer_unmap (in, in_data, in_size);
1257 gst_buffer_unmap (out, out_data, out_size);
1264 GST_ELEMENT_ERROR (videoscale, STREAM, NOT_IMPLEMENTED, (NULL),
1265 ("Unsupported format %d for scaling method %d",
1266 videoscale->format, method));
1267 ret = GST_FLOW_ERROR;
1272 GST_ELEMENT_ERROR (videoscale, STREAM, NOT_IMPLEMENTED, (NULL),
1273 ("Unknown scaling method %d", videoscale->method));
1274 ret = GST_FLOW_ERROR;
1280 gst_video_scale_src_event (GstBaseTransform * trans, GstEvent * event)
1282 GstVideoScale *videoscale = GST_VIDEO_SCALE (trans);
1285 GstStructure *structure;
1287 GST_DEBUG_OBJECT (videoscale, "handling %s event",
1288 GST_EVENT_TYPE_NAME (event));
1290 switch (GST_EVENT_TYPE (event)) {
1291 case GST_EVENT_NAVIGATION:
1293 GST_EVENT (gst_mini_object_make_writable (GST_MINI_OBJECT (event)));
1295 structure = (GstStructure *) gst_event_get_structure (event);
1296 if (gst_structure_get_double (structure, "pointer_x", &a)) {
1297 gst_structure_set (structure, "pointer_x", G_TYPE_DOUBLE,
1298 a * videoscale->from_width / videoscale->to_width, NULL);
1300 if (gst_structure_get_double (structure, "pointer_y", &a)) {
1301 gst_structure_set (structure, "pointer_y", G_TYPE_DOUBLE,
1302 a * videoscale->from_height / videoscale->to_height, NULL);
1309 ret = GST_BASE_TRANSFORM_CLASS (parent_class)->src_event (trans, event);
1315 plugin_init (GstPlugin * plugin)
1317 gst_videoscale_orc_init ();
1319 if (!gst_element_register (plugin, "videoscale", GST_RANK_NONE,
1320 GST_TYPE_VIDEO_SCALE))
1323 GST_DEBUG_CATEGORY_INIT (video_scale_debug, "videoscale", 0,
1324 "videoscale element");
1331 GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
1334 "Resizes video", plugin_init, VERSION, GST_LICENSE, GST_PACKAGE_NAME,