Commit 84ec78bd authored by Wim Taymans's avatar Wim Taymans

videomixer: use video library code instead of copy

parent 323683db
......@@ -6,8 +6,6 @@ include $(top_srcdir)/common/orc.mak
libgstvideomixer_la_SOURCES = \
blend.c \
videoconvert.c \
gstcms.c \
videomixer2.c
nodist_libgstvideomixer_la_SOURCES = $(ORC_NODIST_SOURCES)
......@@ -23,9 +21,7 @@ libgstvideomixer_la_LIBTOOLFLAGS = $(GST_PLUGIN_LIBTOOLFLAGS)
noinst_HEADERS = \
blend.h \
videomixer2.h \
videomixer2pad.h \
videoconvert.h \
gstcms.h
videomixer2pad.h
Android.mk: Makefile.am $(BUILT_SOURCES)
androgenizer \
......
This diff is collapsed.
/* GStreamer
* Copyright (C) 2008 David Schleef <ds@entropywave.com>
*
* 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., 51 Franklin St, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef _GST_CMS_H_
#define _GST_CMS_H_
#include <gst/gst.h>
G_BEGIN_DECLS
typedef struct _Color Color;
typedef struct _ColorMatrix ColorMatrix;
struct _Color
{
double v[3];
};
struct _ColorMatrix
{
double m[4][4];
};
void videomixer_color_xyY_to_XYZ (Color * c);
void videomixer_color_XYZ_to_xyY (Color * c);
void videomixer_color_set (Color * c, double x, double y, double z);
void videomixer_color_matrix_set_identity (ColorMatrix * m);
void videomixer_color_matrix_dump (ColorMatrix * m);
void videomixer_color_matrix_multiply (ColorMatrix * dst, ColorMatrix * a, ColorMatrix * b);
void videomixer_color_matrix_apply (ColorMatrix * m, Color * dest, Color * src);
void videomixer_color_matrix_offset_components (ColorMatrix * m, double a1, double a2,
double a3);
void videomixer_color_matrix_scale_components (ColorMatrix * m, double a1, double a2, double a3);
void videomixer_color_matrix_YCbCr_to_RGB (ColorMatrix * m, double Kr, double Kb);
void videomixer_color_matrix_RGB_to_YCbCr (ColorMatrix * m, double Kr, double Kb);
void videomixer_color_matrix_build_yuv_to_rgb_601 (ColorMatrix * dst);
void videomixer_color_matrix_build_bt709_to_bt601 (ColorMatrix * dst);
void videomixer_color_matrix_build_rgb_to_yuv_601 (ColorMatrix * dst);
void videomixer_color_matrix_invert (ColorMatrix * m);
void videomixer_color_matrix_copy (ColorMatrix * dest, ColorMatrix * src);
void videomixer_color_matrix_transpose (ColorMatrix * m);
void videomixer_color_matrix_build_XYZ (ColorMatrix * dst,
double rx, double ry,
double gx, double gy, double bx, double by, double wx, double wy);
void videomixer_color_matrix_build_rgb_to_XYZ_601 (ColorMatrix * dst);
void videomixer_color_matrix_build_XYZ_to_rgb_709 (ColorMatrix * dst);
void videomixer_color_matrix_build_XYZ_to_rgb_dell (ColorMatrix * dst);
void videomixer_color_transfer_function_apply (Color * dest, Color * src);
void videomixer_color_transfer_function_unapply (Color * dest, Color * src);
void videomixer_color_gamut_clamp (Color * dest, Color * src);
G_END_DECLS
#endif
This diff is collapsed.
/* Video conversion functions
* Copyright (C) 2010 David Schleef <ds@schleef.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., 51 Franklin St, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef __COLORSPACE_H__
#define __COLORSPACE_H__
#include <gst/video/video.h>
#include "gstcms.h"
G_BEGIN_DECLS
typedef struct _VideoConvert VideoConvert;
typedef enum {
DITHER_NONE,
DITHER_VERTERR,
DITHER_HALFTONE
} ColorSpaceDitherMethod;
struct _VideoConvert {
GstVideoInfo in_info;
GstVideoInfo out_info;
gint width;
gint height;
gint in_bits;
gint out_bits;
gint cmatrix[4][4];
ColorSpaceDitherMethod dither;
guint lines;
guint n_tmplines;
gpointer *tmplines;
guint16 *errline;
GstVideoChromaResample *upsample;
guint up_n_lines;
gint up_offset;
GstVideoChromaResample *downsample;
guint down_n_lines;
gint down_offset;
void (*convert) (VideoConvert *convert, GstVideoFrame *dest, const GstVideoFrame *src);
void (*matrix) (VideoConvert *convert, gpointer pixels);
void (*dither16) (VideoConvert *convert, guint16 * pixels, int j);
};
VideoConvert * videomixer_videoconvert_convert_new (GstVideoInfo *in_info,
GstVideoInfo *out_info);
void videomixer_videoconvert_convert_free (VideoConvert * convert);
void videomixer_videoconvert_convert_set_dither (VideoConvert * convert, int type);
void videomixer_videoconvert_convert_convert (VideoConvert * convert,
GstVideoFrame *dest, const GstVideoFrame *src);
G_END_DECLS
#endif /* __GST_COLORSPACE_H__ */
......@@ -84,7 +84,6 @@
#include "videomixer2.h"
#include "videomixer2pad.h"
#include "videoconvert.h"
#ifdef DISABLE_ORC
#define orc_memset memset
......@@ -435,7 +434,7 @@ gst_videomixer2_update_converters (GstVideoMixer2 * mix)
continue;
if (pad->convert)
videomixer_videoconvert_convert_free (pad->convert);
gst_video_converter_free (pad->convert);
pad->convert = NULL;
......@@ -448,8 +447,7 @@ gst_videomixer2_update_converters (GstVideoMixer2 * mix)
GST_DEBUG_OBJECT (pad, "This pad will be converted from %d to %d",
GST_VIDEO_INFO_FORMAT (&pad->info),
GST_VIDEO_INFO_FORMAT (&best_info));
pad->convert =
videomixer_videoconvert_convert_new (&pad->info, &best_info);
pad->convert = gst_video_converter_new (&pad->info, &best_info, NULL);
pad->need_conversion_update = TRUE;
if (!pad->convert) {
g_free (colorimetry);
......@@ -1140,8 +1138,7 @@ gst_videomixer2_blend_buffers (GstVideoMixer2 * mix,
gst_video_frame_map (&converted_frame, &(pad->conversion_info),
converted_buf, GST_MAP_READWRITE);
videomixer_videoconvert_convert_convert (pad->convert, &converted_frame,
&frame);
gst_video_converter_frame (pad->convert, &converted_frame, &frame);
gst_video_frame_unmap (&frame);
} else {
converted_frame = frame;
......@@ -2132,7 +2129,7 @@ gst_videomixer2_release_pad (GstElement * element, GstPad * pad)
mixpad = GST_VIDEO_MIXER2_PAD (pad);
if (mixpad->convert)
videomixer_videoconvert_convert_free (mixpad->convert);
gst_video_converter_free (mixpad->convert);
mixpad->convert = NULL;
mix->sinkpads = g_slist_remove (mix->sinkpads, pad);
......@@ -2181,7 +2178,7 @@ gst_videomixer2_dispose (GObject * o)
GstVideoMixer2Pad *mixpad = tmp->data;
if (mixpad->convert)
videomixer_videoconvert_convert_free (mixpad->convert);
gst_video_converter_free (mixpad->convert);
mixpad->convert = NULL;
}
......
......@@ -26,8 +26,6 @@
#include <gst/base/gstcollectpads.h>
#include "videoconvert.h"
G_BEGIN_DECLS
#define GST_TYPE_VIDEO_MIXER2_PAD (gst_videomixer2_pad_get_type())
......@@ -69,7 +67,7 @@ struct _GstVideoMixer2Pad
GstVideoInfo conversion_info;
/* Converter, if NULL no conversion is done */
VideoConvert *convert;
GstVideoConverter *convert;
gboolean need_conversion_update;
};
......
This diff is collapsed.
......@@ -87,41 +87,6 @@ void video_mixer_orc_blend_argb (guint8 * ORC_RESTRICT d1, int d1_stride, const
void video_mixer_orc_blend_bgra (guint8 * ORC_RESTRICT d1, int d1_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, int p1, int n, int m);
void video_mixer_orc_overlay_argb (guint8 * ORC_RESTRICT d1, int d1_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, int p1, int n, int m);
void video_mixer_orc_overlay_bgra (guint8 * ORC_RESTRICT d1, int d1_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, int p1, int n, int m);
void videomixer_video_convert_orc_memcpy_2d (guint8 * ORC_RESTRICT d1, int d1_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m);
void videomixer_video_convert_orc_convert_I420_UYVY (guint8 * ORC_RESTRICT d1, guint8 * ORC_RESTRICT d2, const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, const guint8 * ORC_RESTRICT s3, const guint8 * ORC_RESTRICT s4, int n);
void videomixer_video_convert_orc_convert_I420_YUY2 (guint8 * ORC_RESTRICT d1, guint8 * ORC_RESTRICT d2, const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, const guint8 * ORC_RESTRICT s3, const guint8 * ORC_RESTRICT s4, int n);
void videomixer_video_convert_orc_convert_I420_AYUV (guint8 * ORC_RESTRICT d1, guint8 * ORC_RESTRICT d2, const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, const guint8 * ORC_RESTRICT s3, const guint8 * ORC_RESTRICT s4, int n);
void videomixer_video_convert_orc_convert_YUY2_I420 (guint8 * ORC_RESTRICT d1, guint8 * ORC_RESTRICT d2, guint8 * ORC_RESTRICT d3, guint8 * ORC_RESTRICT d4, const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, int n);
void videomixer_video_convert_orc_convert_UYVY_YUY2 (guint8 * ORC_RESTRICT d1, int d1_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m);
void videomixer_video_convert_orc_planar_chroma_420_422 (guint8 * ORC_RESTRICT d1, int d1_stride, guint8 * ORC_RESTRICT d2, int d2_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m);
void videomixer_video_convert_orc_planar_chroma_420_444 (guint8 * ORC_RESTRICT d1, int d1_stride, guint8 * ORC_RESTRICT d2, int d2_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m);
void videomixer_video_convert_orc_planar_chroma_422_444 (guint8 * ORC_RESTRICT d1, int d1_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m);
void videomixer_video_convert_orc_planar_chroma_444_422 (guint8 * ORC_RESTRICT d1, int d1_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m);
void videomixer_video_convert_orc_planar_chroma_444_420 (guint8 * ORC_RESTRICT d1, int d1_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, const guint8 * ORC_RESTRICT s2, int s2_stride, int n, int m);
void videomixer_video_convert_orc_planar_chroma_422_420 (guint8 * ORC_RESTRICT d1, int d1_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, const guint8 * ORC_RESTRICT s2, int s2_stride, int n, int m);
void videomixer_video_convert_orc_convert_YUY2_AYUV (guint8 * ORC_RESTRICT d1, int d1_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m);
void videomixer_video_convert_orc_convert_UYVY_AYUV (guint8 * ORC_RESTRICT d1, int d1_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m);
void videomixer_video_convert_orc_convert_YUY2_Y42B (guint8 * ORC_RESTRICT d1, int d1_stride, guint8 * ORC_RESTRICT d2, int d2_stride, guint8 * ORC_RESTRICT d3, int d3_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m);
void videomixer_video_convert_orc_convert_UYVY_Y42B (guint8 * ORC_RESTRICT d1, int d1_stride, guint8 * ORC_RESTRICT d2, int d2_stride, guint8 * ORC_RESTRICT d3, int d3_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m);
void videomixer_video_convert_orc_convert_YUY2_Y444 (guint8 * ORC_RESTRICT d1, int d1_stride, guint8 * ORC_RESTRICT d2, int d2_stride, guint8 * ORC_RESTRICT d3, int d3_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m);
void videomixer_video_convert_orc_convert_UYVY_Y444 (guint8 * ORC_RESTRICT d1, int d1_stride, guint8 * ORC_RESTRICT d2, int d2_stride, guint8 * ORC_RESTRICT d3, int d3_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m);
void videomixer_video_convert_orc_convert_UYVY_I420 (guint8 * ORC_RESTRICT d1, guint8 * ORC_RESTRICT d2, guint8 * ORC_RESTRICT d3, guint8 * ORC_RESTRICT d4, const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, int n);
void videomixer_video_convert_orc_convert_AYUV_I420 (guint8 * ORC_RESTRICT d1, int d1_stride, guint8 * ORC_RESTRICT d2, int d2_stride, guint8 * ORC_RESTRICT d3, int d3_stride, guint8 * ORC_RESTRICT d4, int d4_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, const guint8 * ORC_RESTRICT s2, int s2_stride, int n, int m);
void videomixer_video_convert_orc_convert_AYUV_YUY2 (guint8 * ORC_RESTRICT d1, int d1_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m);
void videomixer_video_convert_orc_convert_AYUV_UYVY (guint8 * ORC_RESTRICT d1, int d1_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m);
void videomixer_video_convert_orc_convert_AYUV_Y42B (guint8 * ORC_RESTRICT d1, int d1_stride, guint8 * ORC_RESTRICT d2, int d2_stride, guint8 * ORC_RESTRICT d3, int d3_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m);
void videomixer_video_convert_orc_convert_AYUV_Y444 (guint8 * ORC_RESTRICT d1, int d1_stride, guint8 * ORC_RESTRICT d2, int d2_stride, guint8 * ORC_RESTRICT d3, int d3_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, int n, int m);
void videomixer_video_convert_orc_convert_Y42B_YUY2 (guint8 * ORC_RESTRICT d1, int d1_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, const guint8 * ORC_RESTRICT s2, int s2_stride, const guint8 * ORC_RESTRICT s3, int s3_stride, int n, int m);
void videomixer_video_convert_orc_convert_Y42B_UYVY (guint8 * ORC_RESTRICT d1, int d1_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, const guint8 * ORC_RESTRICT s2, int s2_stride, const guint8 * ORC_RESTRICT s3, int s3_stride, int n, int m);
void videomixer_video_convert_orc_convert_Y42B_AYUV (guint8 * ORC_RESTRICT d1, int d1_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, const guint8 * ORC_RESTRICT s2, int s2_stride, const guint8 * ORC_RESTRICT s3, int s3_stride, int n, int m);
void videomixer_video_convert_orc_convert_Y444_YUY2 (guint8 * ORC_RESTRICT d1, int d1_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, const guint8 * ORC_RESTRICT s2, int s2_stride, const guint8 * ORC_RESTRICT s3, int s3_stride, int n, int m);
void videomixer_video_convert_orc_convert_Y444_UYVY (guint8 * ORC_RESTRICT d1, int d1_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, const guint8 * ORC_RESTRICT s2, int s2_stride, const guint8 * ORC_RESTRICT s3, int s3_stride, int n, int m);
void videomixer_video_convert_orc_convert_Y444_AYUV (guint8 * ORC_RESTRICT d1, int d1_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, const guint8 * ORC_RESTRICT s2, int s2_stride, const guint8 * ORC_RESTRICT s3, int s3_stride, int n, int m);
void videomixer_video_convert_orc_convert_AYUV_ARGB (guint8 * ORC_RESTRICT d1, int d1_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, int p1, int p2, int p3, int p4, int p5, int n, int m);
void videomixer_video_convert_orc_convert_AYUV_BGRA (guint8 * ORC_RESTRICT d1, int d1_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, int p1, int p2, int p3, int p4, int p5, int n, int m);
void videomixer_video_convert_orc_convert_AYUV_ABGR (guint8 * ORC_RESTRICT d1, int d1_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, int p1, int p2, int p3, int p4, int p5, int n, int m);
void videomixer_video_convert_orc_convert_AYUV_RGBA (guint8 * ORC_RESTRICT d1, int d1_stride, const guint8 * ORC_RESTRICT s1, int s1_stride, int p1, int p2, int p3, int p4, int p5, int n, int m);
void videomixer_video_convert_orc_convert_I420_BGRA (guint8 * ORC_RESTRICT d1, const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2, const guint8 * ORC_RESTRICT s3, int p1, int p2, int p3, int p4, int p5, int n);
#ifdef __cplusplus
}
......
This diff is collapsed.
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