Commit 29502621 authored by Sebastian Dröge's avatar Sebastian Dröge

videomixer: Refactor processing functions

This allows easier plugging of optimized processing functions
in the future, like for SSE or AltiVec.
parent 5975b01b
plugin_LTLIBRARIES = libgstvideomixer.la
libgstvideomixer_la_SOURCES = videomixer.c blend_ayuv.c blend_bgra.c blend_i420.c blend_rgb.c
libgstvideomixer_la_SOURCES = videomixer.c blend.c
libgstvideomixer_la_CFLAGS = $(GST_CFLAGS) $(GST_BASE_CFLAGS) $(GST_CONTROLLER_CFLAGS) $(GST_PLUGINS_BASE_CFLAGS) $(LIBOIL_CFLAGS)
libgstvideomixer_la_LIBADD = $(GST_LIBS) $(GST_BASE_LIBS) $(GST_CONTROLLER_LIBS) $(GST_PLUGINS_BASE_LIBS) -lgstvideo-@GST_MAJORMINOR@ $(LIBOIL_LIBS)
libgstvideomixer_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
libgstvideomixer_la_LIBTOOLFLAGS = --tag=disable-static
# headers we need but don't want installed
noinst_HEADERS = videomixer.h videomixerpad.h
noinst_HEADERS = videomixer.h videomixerpad.h blend.h blend_mmx.h
This diff is collapsed.
/*
* Copyright (C) 2009 Sebastian Dröge <sebastian.droege@collabora.co.uk>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef __BLEND_H__
#define __BLEND_H__
#include <gst/gst.h>
typedef void (*BlendFunction) (const guint8 * src, gint xpos, gint ypos, gint src_width, gint src_height, gdouble src_alpha, guint8 * dest, gint dest_width, gint dest_height);
typedef void (*FillCheckerFunction) (guint8 * dest, gint width, gint height);
typedef void (*FillColorFunction) (guint8 * dest, gint width, gint height, gint c1, gint c2, gint c3);
extern BlendFunction gst_video_mixer_blend_argb;
extern BlendFunction gst_video_mixer_blend_bgra;
#define gst_video_mixer_blend_ayuv gst_video_mixer_blend_argb
extern BlendFunction gst_video_mixer_blend_i420;
extern BlendFunction gst_video_mixer_blend_rgb;
#define gst_video_mixer_blend_bgr gst_video_mixer_blend_rgb
extern BlendFunction gst_video_mixer_blend_rgbx;
#define gst_video_mixer_blend_bgrx gst_video_mixer_blend_rgbx
#define gst_video_mixer_blend_xrgb gst_video_mixer_blend_rgbx
#define gst_video_mixer_blend_xbgr gst_video_mixer_blend_rgbx
extern FillCheckerFunction gst_video_mixer_fill_checker_argb;
extern FillCheckerFunction gst_video_mixer_fill_checker_bgra;
extern FillCheckerFunction gst_video_mixer_fill_checker_ayuv;
extern FillCheckerFunction gst_video_mixer_fill_checker_i420;
extern FillCheckerFunction gst_video_mixer_fill_checker_rgb;
#define gst_video_mixer_fill_checker_bgr gst_video_mixer_fill_checker_rgb
extern FillCheckerFunction gst_video_mixer_fill_checker_rgbx;
#define gst_video_mixer_fill_checker_bgrx gst_video_mixer_fill_checker_rgbx
#define gst_video_mixer_fill_checker_xrgb gst_video_mixer_fill_checker_rgbx
#define gst_video_mixer_fill_checker_xbgr gst_video_mixer_fill_checker_rgbx
extern FillColorFunction gst_video_mixer_fill_color_argb;
extern FillColorFunction gst_video_mixer_fill_color_bgra;
extern FillColorFunction gst_video_mixer_fill_color_ayuv;
extern FillColorFunction gst_video_mixer_fill_color_i420;
extern FillColorFunction gst_video_mixer_fill_color_rgb;
extern FillColorFunction gst_video_mixer_fill_color_bgr;
extern FillColorFunction gst_video_mixer_fill_color_xrgb;
extern FillColorFunction gst_video_mixer_fill_color_xbgr;
extern FillColorFunction gst_video_mixer_fill_color_rgbx;
extern FillColorFunction gst_video_mixer_fill_color_bgrx;
void gst_video_mixer_init_blend (void);
#endif /* __BLEND_H__ */
/*
* Copyright (C) 2009 Alex Ugarte <augarte@vicomtech.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#include <gst/gst.h>
#define BLEND_NORMAL(B1,G1,R1,B2,G2,R2,B,G,R,alpha) \
B = ((B1*(255-alpha))+(B2*alpha))>>8; \
G = ((G1*(255-alpha))+(G2*alpha))>>8; \
R = ((R1*(255-alpha))+(R2*alpha))>>8;
#define BLEND_MODE BLEND_NORMAL
#define CREATE_FUNCTIONS(name, a, r, g, b) \
void \
gst_videomixer_blend_##name##_##name (guint8 * src, gint xpos, gint ypos, \
gint src_width, gint src_height, gdouble src_alpha, \
guint8 * dest, gint dest_width, gint dest_height) \
{ \
gint alpha, s_alpha; \
gint i, j; \
gint src_stride, dest_stride; \
gint src_add, dest_add; \
gint B, G, R; \
\
src_stride = src_width * 4; \
dest_stride = dest_width * 4; \
\
s_alpha = CLAMP ((gint) (src_alpha * 256), 0, 256); \
\
/* adjust src pointers for negative sizes */ \
if (xpos < 0) { \
src += -xpos * 4; \
src_width -= -xpos; \
xpos = 0; \
} \
if (ypos < 0) { \
src += -ypos * src_stride; \
src_height -= -ypos; \
ypos = 0; \
} \
/* adjust width/height if the src is bigger than dest */ \
if (xpos + src_width > dest_width) { \
src_width = dest_width - xpos; \
} \
if (ypos + src_height > dest_height) { \
src_height = dest_height - ypos; \
} \
\
src_add = src_stride - (4 * src_width); \
dest_add = dest_stride - (4 * src_width); \
\
dest = dest + 4 * xpos + (ypos * dest_stride); \
\
for (i = 0; i < src_height; i++) { \
for (j = 0; j < src_width; j++) { \
alpha = (src[a] * s_alpha) >> 8; \
BLEND_MODE (dest[b], dest[g], dest[r], src[b], src[g], src[r], \
B, G, R, alpha); \
dest[b] = B; \
dest[g] = G; \
dest[r] = R; \
dest[a] = 0xff; \
\
src += 4; \
dest += 4; \
} \
src += src_add; \
dest += dest_add; \
} \
} \
\
/* fill a buffer with a checkerboard pattern */ \
void \
gst_videomixer_fill_##name##_checker (guint8 * dest, gint width, gint height) \
{ \
gint i, j; \
static const int tab[] = { 80, 160, 80, 160 }; \
\
for (i = 0; i < height; i++) { \
for (j = 0; j < width; j++) { \
dest[b] = tab[((i & 0x8) >> 3) + ((j & 0x8) >> 3)]; /* blue */ \
dest[g] = tab[((i & 0x8) >> 3) + ((j & 0x8) >> 3)]; /* green */ \
dest[r] = tab[((i & 0x8) >> 3) + ((j & 0x8) >> 3)]; /* red */ \
dest[a] = 0xFF; /* alpha */ \
dest += 4; \
} \
} \
} \
\
void \
gst_videomixer_fill_##name##_color (guint8 * dest, gint width, gint height, \
gint colY, gint colU, gint colV) \
{ \
gint red, green, blue; \
gint i, j; \
\
red = CLAMP (1.164 * (colY - 16) + 1.596 * (colV - 128), 0, 255); \
green = \
CLAMP (1.164 * (colY - 16) - 0.813 * (colV - 128) - 0.391 * (colU - 128), \
0, 255); \
blue = CLAMP (1.164 * (colY - 16) + 2.018 * (colU - 128), 0, 255); \
\
for (i = 0; i < height; i++) { \
for (j = 0; j < width; j++) { \
dest[b] = blue; \
dest[g] = green; \
dest[r] = red; \
dest[a] = 0xff; \
dest += 4; \
} \
} \
}
CREATE_FUNCTIONS (argb, 0, 1, 2, 3);
CREATE_FUNCTIONS (bgra, 3, 2, 1, 0);
#undef BLEND_MODE
This diff is collapsed.
/*
* Copyright (C) 2009 Alex Ugarte <augarte@vicomtech.org>
* Copyright (C) 2009 Sebastian Dröge <sebastian.droege@collabora.co.uk>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#include <gst/gst.h>
#include <string.h>
#include "videomixer.h"
#define BLEND_NORMAL(R1,G1,B1,R2,G2,B2,alpha,R,G,B) \
R = ((R1*(255-alpha))+(R2*alpha))>>8; \
G = ((G1*(255-alpha))+(G2*alpha))>>8; \
B = ((B1*(255-alpha))+(B2*alpha))>>8;
#define BLEND_MODE BLEND_NORMAL
#define CREATE_FUNCTIONS(name, bpp, r, g, b) \
void \
gst_videomixer_blend_##name##_##name (guint8 * src, gint xpos, gint ypos, \
gint src_width, gint src_height, gdouble src_alpha, \
guint8 * dest, gint dest_width, gint dest_height) \
{ \
gint b_alpha; \
gint i, j; \
gint src_stride, dest_stride; \
gint src_add, dest_add; \
gint R, G, B; \
\
src_stride = GST_ROUND_UP_4 (src_width * bpp); \
dest_stride = GST_ROUND_UP_4 (dest_width * bpp); \
\
b_alpha = CLAMP ((gint) (src_alpha * 255), 0, 255); \
\
/* adjust src pointers for negative sizes */ \
if (xpos < 0) { \
src += -xpos * bpp; \
src_width -= -xpos; \
xpos = 0; \
} \
if (ypos < 0) { \
src += -ypos * src_stride; \
src_height -= -ypos; \
ypos = 0; \
} \
/* adjust width/height if the src is bigger than dest */ \
if (xpos + src_width > dest_width) { \
src_width = dest_width - xpos; \
} \
if (ypos + src_height > dest_height) { \
src_height = dest_height - ypos; \
} \
\
src_add = src_stride - (bpp * src_width); \
dest_add = dest_stride - (bpp * src_width); \
\
dest = dest + bpp * xpos + (ypos * dest_stride); \
/* If it's completely transparent... we just return */ \
if (G_UNLIKELY (src_alpha == 0.0)) { \
GST_INFO ("Fast copy (alpha == 0.0)"); \
return; \
} \
\
/* If it's completely opaque, we do a fast copy */ \
if (G_UNLIKELY (src_alpha == 1.0)) { \
GST_INFO ("Fast copy (alpha == 1.0)"); \
for (i = 0; i < src_height; i++) { \
memcpy (dest, src, bpp * src_width); \
src += src_stride; \
dest += dest_stride; \
} \
return; \
} \
\
for (i = 0; i < src_height; i++) { \
for (j = 0; j < src_width; j++) { \
BLEND_MODE (dest[r], dest[g], dest[b], src[r], src[g], src[b], \
b_alpha, R, G, B); \
dest[r] = R; \
dest[g] = G; \
dest[b] = B; \
\
src += bpp; \
dest += bpp; \
} \
src += src_add; \
dest += dest_add; \
} \
} \
\
/* fill a buffer with a checkerboard pattern */ \
void \
gst_videomixer_fill_##name##_checker (guint8 * dest, gint width, gint height) \
{ \
gint i, j; \
static const int tab[] = { 80, 160, 80, 160 }; \
gint dest_add = GST_ROUND_UP_4 (width * bpp) - width * bpp; \
\
for (i = 0; i < height; i++) { \
for (j = 0; j < width; j++) { \
dest[r] = tab[((i & 0x8) >> 3) + ((j & 0x8) >> 3)]; /* red */ \
dest[g] = tab[((i & 0x8) >> 3) + ((j & 0x8) >> 3)]; /* green */ \
dest[b] = tab[((i & 0x8) >> 3) + ((j & 0x8) >> 3)]; /* blue */ \
dest += bpp; \
} \
dest += dest_add; \
} \
} \
\
void \
gst_videomixer_fill_##name##_color (guint8 * dest, gint width, gint height, \
gint colY, gint colU, gint colV) \
{ \
gint red, green, blue; \
gint i, j; \
gint dest_add = GST_ROUND_UP_4 (width * bpp) - width * bpp; \
\
red = CLAMP (1.164 * (colY - 16) + 1.596 * (colV - 128), 0, 255); \
green = \
CLAMP (1.164 * (colY - 16) - 0.813 * (colV - 128) - 0.391 * (colU - 128), \
0, 255); \
blue = CLAMP (1.164 * (colY - 16) + 2.018 * (colU - 128), 0, 255); \
\
for (i = 0; i < height; i++) { \
for (j = 0; j < width; j++) { \
dest[r] = red; \
dest[g] = green; \
dest[b] = blue; \
dest += bpp; \
} \
dest += dest_add; \
} \
}
CREATE_FUNCTIONS (rgb, 3, 0, 1, 2);
CREATE_FUNCTIONS (bgr, 3, 2, 1, 0);
CREATE_FUNCTIONS (xrgb, 4, 1, 2, 3);
CREATE_FUNCTIONS (xbgr, 4, 3, 2, 1);
CREATE_FUNCTIONS (rgbx, 4, 0, 1, 2);
CREATE_FUNCTIONS (bgrx, 4, 2, 1, 0);
......@@ -68,10 +68,6 @@
#include <gst/controller/gstcontroller.h>
#include <gst/video/video.h>
#include <liboil/liboil.h>
#include <liboil/liboilcpu.h>
#include <liboil/liboilfunction.h>
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
#endif
......@@ -105,79 +101,6 @@ static gboolean gst_videomixer_sink_event (GstPad * pad, GstEvent * event);
static void gst_videomixer_sort_pads (GstVideoMixer * mix);
/*AYUV function definitions see file: blend_ayuv*/
void gst_videomixer_blend_ayuv_ayuv (guint8 * src, gint xpos, gint ypos,
gint src_width, gint src_height, gdouble src_alpha,
guint8 * dest, gint dest_width, gint dest_height);
void gst_videomixer_fill_ayuv_checker (guint8 * dest, gint width, gint height);
void gst_videomixer_fill_ayuv_color (guint8 * dest, gint width, gint height,
gint colY, gint colU, gint colV);
/*BGRA/ARGB function definitions see file: blend_bgra*/
void gst_videomixer_blend_bgra_bgra (guint8 * src, gint xpos, gint ypos,
gint src_width, gint src_height, gdouble src_alpha,
guint8 * dest, gint dest_width, gint dest_height);
void gst_videomixer_fill_bgra_checker (guint8 * dest, gint width, gint height);
void gst_videomixer_fill_bgra_color (guint8 * dest, gint width, gint height,
gint colY, gint colU, gint colV);
void gst_videomixer_blend_argb_argb (guint8 * src, gint xpos, gint ypos,
gint src_width, gint src_height, gdouble src_alpha,
guint8 * dest, gint dest_width, gint dest_height);
void gst_videomixer_fill_argb_checker (guint8 * dest, gint width, gint height);
void gst_videomixer_fill_argb_color (guint8 * dest, gint width, gint height,
gint colY, gint colU, gint colV);
/* RGB function definitions see file: blend_rgb.c */
void gst_videomixer_blend_rgb_rgb (guint8 * src, gint xpos, gint ypos,
gint src_width, gint src_height, gdouble src_alpha,
guint8 * dest, gint dest_width, gint dest_height);
void gst_videomixer_fill_rgb_checker (guint8 * dest, gint width, gint height);
void gst_videomixer_fill_rgb_color (guint8 * dest, gint width, gint height,
gint colY, gint colU, gint colV);
void gst_videomixer_blend_bgr_bgr (guint8 * src, gint xpos, gint ypos,
gint src_width, gint src_height, gdouble src_alpha,
guint8 * dest, gint dest_width, gint dest_height);
void gst_videomixer_fill_bgr_checker (guint8 * dest, gint width, gint height);
void gst_videomixer_fill_bgr_color (guint8 * dest, gint width, gint height,
gint colY, gint colU, gint colV);
void gst_videomixer_blend_xrgb_xrgb (guint8 * src, gint xpos, gint ypos,
gint src_width, gint src_height, gdouble src_alpha,
guint8 * dest, gint dest_width, gint dest_height);
void gst_videomixer_fill_xrgb_checker (guint8 * dest, gint width, gint height);
void gst_videomixer_fill_xrgb_color (guint8 * dest, gint width, gint height,
gint colY, gint colU, gint colV);
void gst_videomixer_blend_xbgr_xbgr (guint8 * src, gint xpos, gint ypos,
gint src_width, gint src_height, gdouble src_alpha,
guint8 * dest, gint dest_width, gint dest_height);
void gst_videomixer_fill_xbgr_checker (guint8 * dest, gint width, gint height);
void gst_videomixer_fill_xbgr_color (guint8 * dest, gint width, gint height,
gint colY, gint colU, gint colV);
void gst_videomixer_blend_rgbx_rgbx (guint8 * src, gint xpos, gint ypos,
gint src_width, gint src_height, gdouble src_alpha,
guint8 * dest, gint dest_width, gint dest_height);
void gst_videomixer_fill_rgbx_checker (guint8 * dest, gint width, gint height);
void gst_videomixer_fill_rgbx_color (guint8 * dest, gint width, gint height,
gint colY, gint colU, gint colV);
void gst_videomixer_blend_bgrx_bgrx (guint8 * src, gint xpos, gint ypos,
gint src_width, gint src_height, gdouble src_alpha,
guint8 * dest, gint dest_width, gint dest_height);
void gst_videomixer_fill_bgrx_checker (guint8 * dest, gint width, gint height);
void gst_videomixer_fill_bgrx_color (guint8 * dest, gint width, gint height,
gint colY, gint colU, gint colV);
/*I420 function definitions see file: blend_i420.c*/
void gst_videomixer_blend_i420_i420 (guint8 * src, gint xpos, gint ypos,
gint src_width, gint src_height, gdouble src_alpha,
guint8 * dest, gint dest_width, gint dest_heighty);
void gst_videomixer_fill_i420_checker (guint8 * dest, gint width, gint height);
void gst_videomixer_fill_i420_color (guint8 * dest, gint width, gint height,
gint colY, gint colU, gint colV);
#ifdef BUILD_X86_ASM
void gst_videomixer_blend_ayuv_ayuv_mmx (guint8 * src, gint xpos, gint ypos,
gint src_width, gint src_height, gdouble src_alpha,
guint8 * dest, gint dest_width, gint dest_height);
void gst_videomixer_fill_ayuv_color_mmx (guint8 * dest, gint width, gint height,
gint colY, gint colU, gint colV);
#endif
#define DEFAULT_PAD_ZORDER 0
#define DEFAULT_PAD_XPOS 0
#define DEFAULT_PAD_YPOS 0
......@@ -938,77 +861,64 @@ gst_videomixer_setcaps (GstPad * pad, GstCaps * caps)
goto done;
switch (mixer->fmt) {
case GST_VIDEO_FORMAT_AYUV:{
#ifdef BUILD_X86_ASM
guint cpu_flags = oil_cpu_get_flags ();
mixer->blend =
(cpu_flags & OIL_IMPL_FLAG_MMX) ? gst_videomixer_blend_ayuv_ayuv_mmx :
gst_videomixer_blend_ayuv_ayuv;
mixer->fill_checker = gst_videomixer_fill_ayuv_checker;
mixer->fill_color =
(cpu_flags & OIL_IMPL_FLAG_MMX) ? gst_videomixer_fill_ayuv_color_mmx :
gst_videomixer_fill_ayuv_color;
#else
mixer->blend = gst_videomixer_blend_ayuv_ayuv;
mixer->fill_checker = gst_videomixer_fill_ayuv_checker;
mixer->fill_color = gst_videomixer_fill_ayuv_color;
#endif
case GST_VIDEO_FORMAT_AYUV:
mixer->blend = gst_video_mixer_blend_ayuv;
mixer->fill_checker = gst_video_mixer_fill_checker_ayuv;
mixer->fill_color = gst_video_mixer_fill_color_ayuv;
ret = TRUE;
break;
}
case GST_VIDEO_FORMAT_I420:
mixer->blend = gst_videomixer_blend_i420_i420;
mixer->fill_checker = gst_videomixer_fill_i420_checker;
mixer->fill_color = gst_videomixer_fill_i420_color;
case GST_VIDEO_FORMAT_ARGB:
mixer->blend = gst_video_mixer_blend_argb;
mixer->fill_checker = gst_video_mixer_fill_checker_argb;
mixer->fill_color = gst_video_mixer_fill_color_argb;
ret = TRUE;
break;
case GST_VIDEO_FORMAT_BGRA:
mixer->blend = gst_videomixer_blend_bgra_bgra;
mixer->fill_checker = gst_videomixer_fill_bgra_checker;
mixer->fill_color = gst_videomixer_fill_bgra_color;
mixer->blend = gst_video_mixer_blend_bgra;
mixer->fill_checker = gst_video_mixer_fill_checker_bgra;
mixer->fill_color = gst_video_mixer_fill_color_bgra;
ret = TRUE;
break;
case GST_VIDEO_FORMAT_ARGB:
mixer->blend = gst_videomixer_blend_argb_argb;
mixer->fill_checker = gst_videomixer_fill_argb_checker;
mixer->fill_color = gst_videomixer_fill_argb_color;
case GST_VIDEO_FORMAT_I420:
mixer->blend = gst_video_mixer_blend_i420;
mixer->fill_checker = gst_video_mixer_fill_checker_i420;
mixer->fill_color = gst_video_mixer_fill_color_i420;
ret = TRUE;
break;
case GST_VIDEO_FORMAT_RGB:
mixer->blend = gst_videomixer_blend_rgb_rgb;
mixer->fill_checker = gst_videomixer_fill_rgb_checker;
mixer->fill_color = gst_videomixer_fill_rgb_color;
mixer->blend = gst_video_mixer_blend_rgb;
mixer->fill_checker = gst_video_mixer_fill_checker_rgb;
mixer->fill_color = gst_video_mixer_fill_color_rgb;
ret = TRUE;
break;
case GST_VIDEO_FORMAT_BGR:
mixer->blend = gst_videomixer_blend_bgr_bgr;
mixer->fill_checker = gst_videomixer_fill_bgr_checker;
mixer->fill_color = gst_videomixer_fill_bgr_color;
mixer->blend = gst_video_mixer_blend_bgr;
mixer->fill_checker = gst_video_mixer_fill_checker_bgr;
mixer->fill_color = gst_video_mixer_fill_color_bgr;
ret = TRUE;
break;
case GST_VIDEO_FORMAT_xRGB:
mixer->blend = gst_videomixer_blend_xrgb_xrgb;
mixer->fill_checker = gst_videomixer_fill_xrgb_checker;
mixer->fill_color = gst_videomixer_fill_xrgb_color;
mixer->blend = gst_video_mixer_blend_xrgb;
mixer->fill_checker = gst_video_mixer_fill_checker_xrgb;
mixer->fill_color = gst_video_mixer_fill_color_xrgb;
ret = TRUE;
break;
case GST_VIDEO_FORMAT_xBGR:
mixer->blend = gst_videomixer_blend_xbgr_xbgr;
mixer->fill_checker = gst_videomixer_fill_xbgr_checker;
mixer->fill_color = gst_videomixer_fill_xbgr_color;
mixer->blend = gst_video_mixer_blend_xbgr;
mixer->fill_checker = gst_video_mixer_fill_checker_xbgr;
mixer->fill_color = gst_video_mixer_fill_color_xbgr;
ret = TRUE;
break;
case GST_VIDEO_FORMAT_RGBx:
mixer->blend = gst_videomixer_blend_rgbx_rgbx;
mixer->fill_checker = gst_videomixer_fill_rgbx_checker;
mixer->fill_color = gst_videomixer_fill_rgbx_color;
mixer->blend = gst_video_mixer_blend_rgbx;
mixer->fill_checker = gst_video_mixer_fill_checker_rgbx;
mixer->fill_color = gst_video_mixer_fill_color_rgbx;
ret = TRUE;
break;
case GST_VIDEO_FORMAT_BGRx:
mixer->blend = gst_videomixer_blend_bgrx_bgrx;
mixer->fill_checker = gst_videomixer_fill_bgrx_checker;
mixer->fill_color = gst_videomixer_fill_bgrx_color;
mixer->blend = gst_video_mixer_blend_bgrx;
mixer->fill_checker = gst_video_mixer_fill_checker_bgrx;
mixer->fill_color = gst_video_mixer_fill_color_bgrx;
ret = TRUE;
break;
default:
......@@ -1649,7 +1559,7 @@ plugin_init (GstPlugin * plugin)
GST_DEBUG_CATEGORY_INIT (gst_videomixer_debug, "videomixer", 0,
"video mixer");
oil_init ();
gst_video_mixer_init_blend ();
return gst_element_register (plugin, "videomixer", GST_RANK_PRIMARY,
GST_TYPE_VIDEO_MIXER);
......
......@@ -23,6 +23,7 @@
#include <gst/gst.h>
#include <gst/video/video.h>
#include "videomixerpad.h"
#include "blend.h"
GST_DEBUG_CATEGORY_EXTERN (gst_videomixer_debug);
#define GST_CAT_DEFAULT gst_videomixer_debug
......@@ -105,11 +106,9 @@ struct _GstVideoMixer
guint64 segment_position;
gdouble segment_rate;
void (*blend) (guint8 * src, gint xpos, gint ypos, gint src_width, gint src_height, gdouble src_alpha,
guint8 * dest, gint dest_width, gint dest_height);
void (*fill_checker) (guint8 * dest, gint width, gint height);
void (*fill_color) (guint8 * dest, gint width, gint height, gint colY, gint colU, gint colV);
BlendFunction blend;
FillCheckerFunction fill_checker;
FillColorFunction fill_color;
};
struct _GstVideoMixerClass
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment