gst/videobox/Makefile.am: Use liboil.

Original commit message from CVS:
2005-10-26  Julien MOUTTE  <julien@moutte.net>

* gst/videobox/Makefile.am: Use liboil.
* gst/videobox/gstvideobox.c: (gst_video_box_class_init),
(gst_video_box_set_property), (gst_video_box_transform_caps),
(gst_video_box_set_caps), (gst_video_box_get_unit_size),
(gst_video_box_ayuv): Lot of optimization in AYUV rendering
using liboil. Will dot the same to I420 border generation
tomorrow.
This commit is contained in:
Julien Moutte 2005-10-26 17:23:06 +00:00
parent f7d6a2f131
commit b1f244b5a6
3 changed files with 50 additions and 26 deletions

View file

@ -1,3 +1,13 @@
2005-10-26 Julien MOUTTE <julien@moutte.net>
* gst/videobox/Makefile.am: Use liboil.
* gst/videobox/gstvideobox.c: (gst_video_box_class_init),
(gst_video_box_set_property), (gst_video_box_transform_caps),
(gst_video_box_set_caps), (gst_video_box_get_unit_size),
(gst_video_box_ayuv): Lot of optimization in AYUV rendering
using liboil. Will dot the same to I420 border generation
tomorrow.
2005-10-26 Zeeshan Ali <zeenix@gmail.com> 2005-10-26 Zeeshan Ali <zeenix@gmail.com>
* gst/rtp/gstrtpg711dec.c: (gst_rtpg711dec_base_init), * gst/rtp/gstrtpg711dec.c: (gst_rtpg711dec_base_init),

View file

@ -1,8 +1,10 @@
plugin_LTLIBRARIES = libgstvideobox.la plugin_LTLIBRARIES = libgstvideobox.la
libgstvideobox_la_SOURCES = gstvideobox.c libgstvideobox_la_SOURCES = gstvideobox.c
libgstvideobox_la_CFLAGS = $(GST_CFLAGS) $(GST_PLUGINS_BASE_CFLAGS) libgstvideobox_la_CFLAGS = $(GST_CFLAGS) $(GST_PLUGINS_BASE_CFLAGS) \
libgstvideobox_la_LIBADD = $(GST_BASE_LIBS) $(LIBOIL_CFLAGS)
libgstvideobox_la_LIBADD = $(GST_BASE_LIBS) $(GST_PLUGINS_BASE_LIBS) \
$(LIBOIL_LIBS)
libgstvideobox_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS) libgstvideobox_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
EXTRA_DIST = README EXTRA_DIST = README

View file

@ -24,6 +24,7 @@
#include <gst/base/gstbasetransform.h> #include <gst/base/gstbasetransform.h>
#include <gst/video/video.h> #include <gst/video/video.h>
#include <liboil/liboil.h>
#include <string.h> #include <string.h>
GST_DEBUG_CATEGORY (videobox_debug); GST_DEBUG_CATEGORY (videobox_debug);
@ -296,12 +297,6 @@ gst_video_box_set_property (GObject * object, guint prop_id,
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break; break;
} }
if (video_box->box_left == 0 && video_box->box_right == 0 &&
video_box->box_top == 0 && video_box->box_bottom == 0)
gst_base_transform_set_passthrough (GST_BASE_TRANSFORM (video_box), TRUE);
else
gst_base_transform_set_passthrough (GST_BASE_TRANSFORM (video_box), FALSE);
} }
static void static void
@ -381,8 +376,8 @@ gst_video_box_transform_caps (GstBaseTransform * trans,
g_value_unset (&list_value); g_value_unset (&list_value);
GST_DEBUG_OBJECT (video_box, "transformed %" GST_PTR_FORMAT GST_DEBUG_OBJECT (video_box, "direction %d, transformed %" GST_PTR_FORMAT
" to %" GST_PTR_FORMAT, from, to); " to %" GST_PTR_FORMAT, direction, from, to);
return to; return to;
} }
@ -406,7 +401,19 @@ gst_video_box_set_caps (GstBaseTransform * trans, GstCaps * in, GstCaps * out)
ret &= gst_structure_get_int (structure, "height", &video_box->out_height); ret &= gst_structure_get_int (structure, "height", &video_box->out_height);
ret &= gst_structure_get_fourcc (structure, "format", &fourcc); ret &= gst_structure_get_fourcc (structure, "format", &fourcc);
video_box->use_alpha = fourcc == GST_STR_FOURCC ("AYUV"); if (fourcc == GST_STR_FOURCC ("AYUV")) {
video_box->use_alpha = TRUE;
} else {
if (video_box->box_left == 0 && video_box->box_right == 0 &&
video_box->box_top == 0 && video_box->box_bottom == 0) {
gst_base_transform_set_passthrough (GST_BASE_TRANSFORM (video_box), TRUE);
GST_LOG ("we are using passthrough");
} else {
gst_base_transform_set_passthrough (GST_BASE_TRANSFORM (video_box),
FALSE);
GST_LOG ("we are not using passthrough");
}
}
return ret; return ret;
} }
@ -555,7 +562,6 @@ gst_video_box_i420 (GstVideoBox * video_box, guint8 * src, guint8 * dest)
/* Note the source image is always I420, we /* Note the source image is always I420, we
* are converting to AYUV on the fly here */ * are converting to AYUV on the fly here */
static void static void
gst_video_box_ayuv (GstVideoBox * video_box, guint8 * src, guint8 * dest) gst_video_box_ayuv (GstVideoBox * video_box, guint8 * src, guint8 * dest)
{ {
@ -608,24 +614,28 @@ gst_video_box_ayuv (GstVideoBox * video_box, guint8 * src, guint8 * dest)
colorV); colorV);
/* top border */ /* top border */
for (i = 0; i < bt; i++) { if (bt) {
for (j = 0; j < out_width; j++) { size_t nb_pixels = bt * out_width;
*destp++ = ayuv;
} oil_splat_u32_ns (destp, &ayuv, nb_pixels);
destp += nb_pixels;
} }
for (i = 0; i < crop_height; i++) { for (i = 0; i < crop_height; i++) {
/* left border */ /* left border */
for (j = 0; j < bl; j++) { if (bl) {
*destp++ = ayuv; oil_splat_u32_ns (destp, &ayuv, bl);
destp += bl;
} }
dest = (guint8 *) destp; dest = (guint8 *) destp;
/* center */ /* center */
/* We can splat the alpha channel for the whole line */
oil_splat_u8 (dest, 4, &i_alpha, crop_width);
for (j = 0; j < crop_width2; j++) { for (j = 0; j < crop_width2; j++) {
*dest++ = i_alpha; dest++;
*dest++ = *srcY++; *dest++ = *srcY++;
*dest++ = *srcU; *dest++ = *srcU;
*dest++ = *srcV; *dest++ = *srcV;
*dest++ = i_alpha; dest++;
*dest++ = *srcY++; *dest++ = *srcY++;
*dest++ = *srcU++; *dest++ = *srcU++;
*dest++ = *srcV++; *dest++ = *srcV++;
@ -641,15 +651,17 @@ gst_video_box_ayuv (GstVideoBox * video_box, guint8 * src, guint8 * dest)
destp = (guint32 *) dest; destp = (guint32 *) dest;
/* right border */ /* right border */
for (j = 0; j < br; j++) { if (br) {
*destp++ = ayuv; oil_splat_u32_ns (destp, &ayuv, br);
destp += br;
} }
} }
/* bottom border */ /* bottom border */
for (i = 0; i < bb; i++) { if (bb) {
for (j = 0; j < out_width; j++) { size_t nb_pixels = bb * out_width;
*destp++ = ayuv;
} oil_splat_u32_ns (destp, &ayuv, nb_pixels);
destp += nb_pixels;
} }
} }