mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 04:01:08 +00:00
videoaggregator: Create a new GstVideoAggregator baseclass
This base class has been added to a newly created libgstbadvideo library Co-Authored by: Thibault Saunier <tsaunier@gnome.org> https://bugzilla.gnome.org/show_bug.cgi?id=731918
This commit is contained in:
parent
55c65d079f
commit
7cf66e7c07
17 changed files with 14260 additions and 2 deletions
|
@ -3222,6 +3222,7 @@ gst-libs/gst/mpegts/Makefile
|
|||
gst-libs/gst/uridownloader/Makefile
|
||||
gst-libs/gst/wayland/Makefile
|
||||
gst-libs/gst/base/Makefile
|
||||
gst-libs/gst/video/Makefile
|
||||
sys/Makefile
|
||||
sys/dshowdecwrapper/Makefile
|
||||
sys/acmenc/Makefile
|
||||
|
@ -3362,6 +3363,8 @@ pkgconfig/gstreamer-wayland.pc
|
|||
pkgconfig/gstreamer-wayland-uninstalled.pc
|
||||
pkgconfig/gstreamer-bad-base.pc
|
||||
pkgconfig/gstreamer-bad-base-uninstalled.pc
|
||||
pkgconfig/gstreamer-bad-video.pc
|
||||
pkgconfig/gstreamer-bad-video-uninstalled.pc
|
||||
tools/Makefile
|
||||
m4/Makefile
|
||||
)
|
||||
|
|
|
@ -63,6 +63,12 @@
|
|||
<xi:include href="xml/gstaggregatorpad.xml" />
|
||||
</chapter>
|
||||
|
||||
<chapter id="video">
|
||||
<title>Video helpers and baseclasses</title>
|
||||
<xi:include href="xml/gstvideoaggregator.xml" />
|
||||
<xi:include href="xml/gstvideoaggregatorpad.xml" />
|
||||
</chapter>
|
||||
|
||||
<chapter id="gl">
|
||||
<title>OpenGL Helper Library</title>
|
||||
<xi:include href="xml/gstglapi.xml"/>
|
||||
|
|
|
@ -1325,3 +1325,34 @@ GST_AGGREGATOR_PAD_CLASS
|
|||
GST_AGGREGATOR_PAD_GET_CLASS
|
||||
gst_aggregator_pad_get_type
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>gstvideoaggregator</FILE>
|
||||
<TITLE>GstVideoAggregator</TITLE>
|
||||
GstVideoAggregator
|
||||
GstVideoAggregatorClass
|
||||
<SUBSECTION Standard>
|
||||
GST_IS_VIDEO_AGGREGATOR
|
||||
GST_IS_VIDEO_AGGREGATOR_CLASS
|
||||
GST_TYPE_VIDEO_AGGREGATOR
|
||||
GST_VIDEO_AGGREGATOR
|
||||
GST_VIDEO_AGGREGATOR_CLASS
|
||||
GST_VIDEO_AGGREGATOR_GET_CLASS
|
||||
gst_videoaggregator_get_type
|
||||
GstVideoAggregatorPrivate
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>gstvideoaggregatorpad</FILE>
|
||||
<TITLE>GstVideoAggregatorPad</TITLE>
|
||||
GstVideoAggregatorPad
|
||||
GstVideoAggregatorPadClass
|
||||
<SUBSECTION Standard>
|
||||
GST_IS_VIDEO_AGGREGATOR_PAD
|
||||
GST_IS_VIDEO_AGGREGATOR_PADCLASS
|
||||
GST_TYPE_VIDEO_AGGREGATOR_PAD
|
||||
GST_VIDEO_AGGREGATOR_PAD
|
||||
GST_VIDEO_AGGREGATOR_PAD_CLASS
|
||||
GST_VIDEO_AGGREGATOR_PAD_GET_CLASS
|
||||
gst_videoaggregator_pad_get_type
|
||||
</SECTION>
|
||||
|
|
|
@ -11,8 +11,8 @@ WAYLAND_DIR=wayland
|
|||
endif
|
||||
|
||||
SUBDIRS = interfaces basecamerabinsrc codecparsers \
|
||||
insertbin uridownloader mpegts base $(GL_DIR) $(WAYLAND_DIR)
|
||||
insertbin uridownloader mpegts base video $(GL_DIR) $(WAYLAND_DIR)
|
||||
|
||||
noinst_HEADERS = gst-i18n-plugin.h gettext.h glib-compat-private.h
|
||||
DIST_SUBDIRS = interfaces gl basecamerabinsrc codecparsers \
|
||||
insertbin uridownloader mpegts wayland base
|
||||
insertbin uridownloader mpegts wayland base video
|
||||
|
|
24
gst-libs/gst/video/Makefile.am
Normal file
24
gst-libs/gst/video/Makefile.am
Normal file
|
@ -0,0 +1,24 @@
|
|||
# variables used for enum generation
|
||||
ORC_SOURCE=bad-video-orc
|
||||
include $(top_srcdir)/common/orc.mak
|
||||
|
||||
lib_LTLIBRARIES = libgstbadvideo-@GST_API_VERSION@.la
|
||||
|
||||
CLEANFILES =
|
||||
|
||||
libgstbadvideo_@GST_API_VERSION@_la_SOURCES = \
|
||||
videoconvert.c gstvideoaggregator.c gstcms.c
|
||||
|
||||
nodist_libgstbadvideo_@GST_API_VERSION@_la_SOURCES = $(BUILT_SOURCES)
|
||||
|
||||
libgstbadvideo_@GST_API_VERSION@includedir = $(includedir)/gstreamer-@GST_API_VERSION@/gst/video
|
||||
libgstbadvideo_@GST_API_VERSION@include_HEADERS = \
|
||||
gstvideoaggregator.h
|
||||
|
||||
nodist_libgstbadvideo_@GST_API_VERSION@include_HEADERS = $(built_headers)
|
||||
|
||||
libgstbadvideo_@GST_API_VERSION@_la_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_BASE_CFLAGS) $(GST_CFLAGS) $(ORC_CFLAGS) -I$(top_builddir)/gst-libs
|
||||
libgstbadvideo_@GST_API_VERSION@_la_LIBADD = $(GST_BASE_LIBS) $(GST_LIBS) $(ORC_LIBS) -lgstvideo-$(GST_API_VERSION)
|
||||
libgstbadvideo_@GST_API_VERSION@_la_LDFLAGS = $(GST_LIB_LDFLAGS) $(GST_ALL_LDFLAGS) $(GST_LT_LDFLAGS)
|
||||
|
||||
noinst_HEADERS = gstcms.h videoconvert.h
|
8958
gst-libs/gst/video/bad-video-orc-dist.c
Normal file
8958
gst-libs/gst/video/bad-video-orc-dist.c
Normal file
File diff suppressed because it is too large
Load diff
124
gst-libs/gst/video/bad-video-orc-dist.h
Normal file
124
gst-libs/gst/video/bad-video-orc-dist.h
Normal file
|
@ -0,0 +1,124 @@
|
|||
|
||||
/* autogenerated from bad-video-orc.orc */
|
||||
|
||||
#ifndef _BAD_VIDEO_ORC_H_
|
||||
#define _BAD_VIDEO_ORC_H_
|
||||
|
||||
#include <glib.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#ifndef _ORC_INTEGER_TYPEDEFS_
|
||||
#define _ORC_INTEGER_TYPEDEFS_
|
||||
#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
|
||||
#include <stdint.h>
|
||||
typedef int8_t orc_int8;
|
||||
typedef int16_t orc_int16;
|
||||
typedef int32_t orc_int32;
|
||||
typedef int64_t orc_int64;
|
||||
typedef uint8_t orc_uint8;
|
||||
typedef uint16_t orc_uint16;
|
||||
typedef uint32_t orc_uint32;
|
||||
typedef uint64_t orc_uint64;
|
||||
#define ORC_UINT64_C(x) UINT64_C(x)
|
||||
#elif defined(_MSC_VER)
|
||||
typedef signed __int8 orc_int8;
|
||||
typedef signed __int16 orc_int16;
|
||||
typedef signed __int32 orc_int32;
|
||||
typedef signed __int64 orc_int64;
|
||||
typedef unsigned __int8 orc_uint8;
|
||||
typedef unsigned __int16 orc_uint16;
|
||||
typedef unsigned __int32 orc_uint32;
|
||||
typedef unsigned __int64 orc_uint64;
|
||||
#define ORC_UINT64_C(x) (x##Ui64)
|
||||
#define inline __inline
|
||||
#else
|
||||
#include <limits.h>
|
||||
typedef signed char orc_int8;
|
||||
typedef short orc_int16;
|
||||
typedef int orc_int32;
|
||||
typedef unsigned char orc_uint8;
|
||||
typedef unsigned short orc_uint16;
|
||||
typedef unsigned int orc_uint32;
|
||||
#if INT_MAX == LONG_MAX
|
||||
typedef long long orc_int64;
|
||||
typedef unsigned long long orc_uint64;
|
||||
#define ORC_UINT64_C(x) (x##ULL)
|
||||
#else
|
||||
typedef long orc_int64;
|
||||
typedef unsigned long orc_uint64;
|
||||
#define ORC_UINT64_C(x) (x##UL)
|
||||
#endif
|
||||
#endif
|
||||
typedef union { orc_int16 i; orc_int8 x2[2]; } orc_union16;
|
||||
typedef union { orc_int32 i; float f; orc_int16 x2[2]; orc_int8 x4[4]; } orc_union32;
|
||||
typedef union { orc_int64 i; double f; orc_int32 x2[2]; float x2f[2]; orc_int16 x4[4]; } orc_union64;
|
||||
#endif
|
||||
#ifndef ORC_RESTRICT
|
||||
#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
|
||||
#define ORC_RESTRICT restrict
|
||||
#elif defined(__GNUC__) && __GNUC__ >= 4
|
||||
#define ORC_RESTRICT __restrict__
|
||||
#else
|
||||
#define ORC_RESTRICT
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef ORC_INTERNAL
|
||||
#if defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590)
|
||||
#define ORC_INTERNAL __attribute__((visibility("hidden")))
|
||||
#elif defined(__SUNPRO_C) && (__SUNPRO_C >= 0x550)
|
||||
#define ORC_INTERNAL __hidden
|
||||
#elif defined (__GNUC__)
|
||||
#define ORC_INTERNAL __attribute__((visibility("hidden")))
|
||||
#else
|
||||
#define ORC_INTERNAL
|
||||
#endif
|
||||
#endif
|
||||
|
||||
void 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
729
gst-libs/gst/video/bad-video-orc.orc
Normal file
729
gst-libs/gst/video/bad-video-orc.orc
Normal file
|
@ -0,0 +1,729 @@
|
|||
.function video_convert_orc_memcpy_2d
|
||||
.flags 2d
|
||||
.dest 1 d1 guint8
|
||||
.source 1 s1 guint8
|
||||
|
||||
copyb d1, s1
|
||||
|
||||
.function video_convert_orc_convert_I420_UYVY
|
||||
.dest 4 d1 guint8
|
||||
.dest 4 d2 guint8
|
||||
.source 2 y1 guint8
|
||||
.source 2 y2 guint8
|
||||
.source 1 u guint8
|
||||
.source 1 v guint8
|
||||
.temp 2 uv
|
||||
|
||||
mergebw uv, u, v
|
||||
x2 mergebw d1, uv, y1
|
||||
x2 mergebw d2, uv, y2
|
||||
|
||||
|
||||
.function video_convert_orc_convert_I420_YUY2
|
||||
.dest 4 d1 guint8
|
||||
.dest 4 d2 guint8
|
||||
.source 2 y1 guint8
|
||||
.source 2 y2 guint8
|
||||
.source 1 u guint8
|
||||
.source 1 v guint8
|
||||
.temp 2 uv
|
||||
|
||||
mergebw uv, u, v
|
||||
x2 mergebw d1, y1, uv
|
||||
x2 mergebw d2, y2, uv
|
||||
|
||||
|
||||
|
||||
.function video_convert_orc_convert_I420_AYUV
|
||||
.dest 4 d1 guint8
|
||||
.dest 4 d2 guint8
|
||||
.source 1 y1 guint8
|
||||
.source 1 y2 guint8
|
||||
.source 1 u guint8
|
||||
.source 1 v guint8
|
||||
.const 1 c255 255
|
||||
.temp 2 uv
|
||||
.temp 2 ay
|
||||
.temp 1 tu
|
||||
.temp 1 tv
|
||||
|
||||
loadupdb tu, u
|
||||
loadupdb tv, v
|
||||
mergebw uv, tu, tv
|
||||
mergebw ay, c255, y1
|
||||
mergewl d1, ay, uv
|
||||
mergebw ay, c255, y2
|
||||
mergewl d2, ay, uv
|
||||
|
||||
|
||||
.function video_convert_orc_convert_YUY2_I420
|
||||
.dest 2 y1 guint8
|
||||
.dest 2 y2 guint8
|
||||
.dest 1 u guint8
|
||||
.dest 1 v guint8
|
||||
.source 4 yuv1 guint8
|
||||
.source 4 yuv2 guint8
|
||||
.temp 2 t1
|
||||
.temp 2 t2
|
||||
.temp 2 ty
|
||||
|
||||
x2 splitwb t1, ty, yuv1
|
||||
storew y1, ty
|
||||
x2 splitwb t2, ty, yuv2
|
||||
storew y2, ty
|
||||
x2 avgub t1, t1, t2
|
||||
splitwb v, u, t1
|
||||
|
||||
|
||||
.function video_convert_orc_convert_UYVY_YUY2
|
||||
.flags 2d
|
||||
.dest 4 yuy2 guint8
|
||||
.source 4 uyvy guint8
|
||||
|
||||
x2 swapw yuy2, uyvy
|
||||
|
||||
|
||||
.function video_convert_orc_planar_chroma_420_422
|
||||
.flags 2d
|
||||
.dest 1 d1 guint8
|
||||
.dest 1 d2 guint8
|
||||
.source 1 s guint8
|
||||
|
||||
copyb d1, s
|
||||
copyb d2, s
|
||||
|
||||
|
||||
.function video_convert_orc_planar_chroma_420_444
|
||||
.flags 2d
|
||||
.dest 2 d1 guint8
|
||||
.dest 2 d2 guint8
|
||||
.source 1 s guint8
|
||||
.temp 2 t
|
||||
|
||||
splatbw t, s
|
||||
storew d1, t
|
||||
storew d2, t
|
||||
|
||||
|
||||
.function video_convert_orc_planar_chroma_422_444
|
||||
.flags 2d
|
||||
.dest 2 d1 guint8
|
||||
.source 1 s guint8
|
||||
.temp 2 t
|
||||
|
||||
splatbw t, s
|
||||
storew d1, t
|
||||
|
||||
|
||||
.function video_convert_orc_planar_chroma_444_422
|
||||
.flags 2d
|
||||
.dest 1 d guint8
|
||||
.source 2 s guint8
|
||||
.temp 1 t1
|
||||
.temp 1 t2
|
||||
|
||||
splitwb t1, t2, s
|
||||
avgub d, t1, t2
|
||||
|
||||
|
||||
.function video_convert_orc_planar_chroma_444_420
|
||||
.flags 2d
|
||||
.dest 1 d guint8
|
||||
.source 2 s1 guint8
|
||||
.source 2 s2 guint8
|
||||
.temp 2 t
|
||||
.temp 1 t1
|
||||
.temp 1 t2
|
||||
|
||||
x2 avgub t, s1, s2
|
||||
splitwb t1, t2, t
|
||||
avgub d, t1, t2
|
||||
|
||||
|
||||
.function video_convert_orc_planar_chroma_422_420
|
||||
.flags 2d
|
||||
.dest 1 d guint8
|
||||
.source 1 s1 guint8
|
||||
.source 1 s2 guint8
|
||||
|
||||
avgub d, s1, s2
|
||||
|
||||
|
||||
.function video_convert_orc_convert_YUY2_AYUV
|
||||
.flags 2d
|
||||
.dest 8 ayuv guint8
|
||||
.source 4 yuy2 guint8
|
||||
.const 2 c255 0xff
|
||||
.temp 2 yy
|
||||
.temp 2 uv
|
||||
.temp 4 ayay
|
||||
.temp 4 uvuv
|
||||
|
||||
x2 splitwb uv, yy, yuy2
|
||||
x2 mergebw ayay, c255, yy
|
||||
mergewl uvuv, uv, uv
|
||||
x2 mergewl ayuv, ayay, uvuv
|
||||
|
||||
|
||||
.function video_convert_orc_convert_UYVY_AYUV
|
||||
.flags 2d
|
||||
.dest 8 ayuv guint8
|
||||
.source 4 uyvy guint8
|
||||
.const 2 c255 0xff
|
||||
.temp 2 yy
|
||||
.temp 2 uv
|
||||
.temp 4 ayay
|
||||
.temp 4 uvuv
|
||||
|
||||
x2 splitwb yy, uv, uyvy
|
||||
x2 mergebw ayay, c255, yy
|
||||
mergewl uvuv, uv, uv
|
||||
x2 mergewl ayuv, ayay, uvuv
|
||||
|
||||
|
||||
.function video_convert_orc_convert_YUY2_Y42B
|
||||
.flags 2d
|
||||
.dest 2 y guint8
|
||||
.dest 1 u guint8
|
||||
.dest 1 v guint8
|
||||
.source 4 yuy2 guint8
|
||||
.temp 2 uv
|
||||
|
||||
x2 splitwb uv, y, yuy2
|
||||
splitwb v, u, uv
|
||||
|
||||
|
||||
.function video_convert_orc_convert_UYVY_Y42B
|
||||
.flags 2d
|
||||
.dest 2 y guint8
|
||||
.dest 1 u guint8
|
||||
.dest 1 v guint8
|
||||
.source 4 uyvy guint8
|
||||
.temp 2 uv
|
||||
|
||||
x2 splitwb y, uv, uyvy
|
||||
splitwb v, u, uv
|
||||
|
||||
|
||||
.function video_convert_orc_convert_YUY2_Y444
|
||||
.flags 2d
|
||||
.dest 2 y guint8
|
||||
.dest 2 uu guint8
|
||||
.dest 2 vv guint8
|
||||
.source 4 yuy2 guint8
|
||||
.temp 2 uv
|
||||
.temp 1 u
|
||||
.temp 1 v
|
||||
|
||||
x2 splitwb uv, y, yuy2
|
||||
splitwb v, u, uv
|
||||
splatbw uu, u
|
||||
splatbw vv, v
|
||||
|
||||
|
||||
.function video_convert_orc_convert_UYVY_Y444
|
||||
.flags 2d
|
||||
.dest 2 y guint8
|
||||
.dest 2 uu guint8
|
||||
.dest 2 vv guint8
|
||||
.source 4 uyvy guint8
|
||||
.temp 2 uv
|
||||
.temp 1 u
|
||||
.temp 1 v
|
||||
|
||||
x2 splitwb y, uv, uyvy
|
||||
splitwb v, u, uv
|
||||
splatbw uu, u
|
||||
splatbw vv, v
|
||||
|
||||
|
||||
.function video_convert_orc_convert_UYVY_I420
|
||||
.dest 2 y1 guint8
|
||||
.dest 2 y2 guint8
|
||||
.dest 1 u guint8
|
||||
.dest 1 v guint8
|
||||
.source 4 yuv1 guint8
|
||||
.source 4 yuv2 guint8
|
||||
.temp 2 t1
|
||||
.temp 2 t2
|
||||
.temp 2 ty
|
||||
|
||||
x2 splitwb ty, t1, yuv1
|
||||
storew y1, ty
|
||||
x2 splitwb ty, t2, yuv2
|
||||
storew y2, ty
|
||||
x2 avgub t1, t1, t2
|
||||
splitwb v, u, t1
|
||||
|
||||
|
||||
|
||||
.function video_convert_orc_convert_AYUV_I420
|
||||
.flags 2d
|
||||
.dest 2 y1 guint8
|
||||
.dest 2 y2 guint8
|
||||
.dest 1 u guint8
|
||||
.dest 1 v guint8
|
||||
.source 8 ayuv1 guint8
|
||||
.source 8 ayuv2 guint8
|
||||
.temp 4 ay
|
||||
.temp 4 uv1
|
||||
.temp 4 uv2
|
||||
.temp 4 uv
|
||||
.temp 2 uu
|
||||
.temp 2 vv
|
||||
.temp 1 t1
|
||||
.temp 1 t2
|
||||
|
||||
x2 splitlw uv1, ay, ayuv1
|
||||
x2 select1wb y1, ay
|
||||
x2 splitlw uv2, ay, ayuv2
|
||||
x2 select1wb y2, ay
|
||||
x4 avgub uv, uv1, uv2
|
||||
x2 splitwb vv, uu, uv
|
||||
splitwb t1, t2, uu
|
||||
avgub u, t1, t2
|
||||
splitwb t1, t2, vv
|
||||
avgub v, t1, t2
|
||||
|
||||
|
||||
|
||||
.function video_convert_orc_convert_AYUV_YUY2
|
||||
.flags 2d
|
||||
.dest 4 yuy2 guint8
|
||||
.source 8 ayuv guint8
|
||||
.temp 2 yy
|
||||
.temp 2 uv1
|
||||
.temp 2 uv2
|
||||
.temp 4 ayay
|
||||
.temp 4 uvuv
|
||||
|
||||
x2 splitlw uvuv, ayay, ayuv
|
||||
splitlw uv1, uv2, uvuv
|
||||
x2 avgub uv1, uv1, uv2
|
||||
x2 select1wb yy, ayay
|
||||
x2 mergebw yuy2, yy, uv1
|
||||
|
||||
|
||||
.function video_convert_orc_convert_AYUV_UYVY
|
||||
.flags 2d
|
||||
.dest 4 yuy2 guint8
|
||||
.source 8 ayuv guint8
|
||||
.temp 2 yy
|
||||
.temp 2 uv1
|
||||
.temp 2 uv2
|
||||
.temp 4 ayay
|
||||
.temp 4 uvuv
|
||||
|
||||
x2 splitlw uvuv, ayay, ayuv
|
||||
splitlw uv1, uv2, uvuv
|
||||
x2 avgub uv1, uv1, uv2
|
||||
x2 select1wb yy, ayay
|
||||
x2 mergebw yuy2, uv1, yy
|
||||
|
||||
|
||||
|
||||
.function video_convert_orc_convert_AYUV_Y42B
|
||||
.flags 2d
|
||||
.dest 2 y guint8
|
||||
.dest 1 u guint8
|
||||
.dest 1 v guint8
|
||||
.source 8 ayuv guint8
|
||||
.temp 4 ayay
|
||||
.temp 4 uvuv
|
||||
.temp 2 uv1
|
||||
.temp 2 uv2
|
||||
|
||||
x2 splitlw uvuv, ayay, ayuv
|
||||
splitlw uv1, uv2, uvuv
|
||||
x2 avgub uv1, uv1, uv2
|
||||
splitwb v, u, uv1
|
||||
x2 select1wb y, ayay
|
||||
|
||||
|
||||
.function video_convert_orc_convert_AYUV_Y444
|
||||
.flags 2d
|
||||
.dest 1 y guint8
|
||||
.dest 1 u guint8
|
||||
.dest 1 v guint8
|
||||
.source 4 ayuv guint8
|
||||
.temp 2 ay
|
||||
.temp 2 uv
|
||||
|
||||
splitlw uv, ay, ayuv
|
||||
splitwb v, u, uv
|
||||
select1wb y, ay
|
||||
|
||||
|
||||
.function video_convert_orc_convert_Y42B_YUY2
|
||||
.flags 2d
|
||||
.dest 4 yuy2 guint8
|
||||
.source 2 y guint8
|
||||
.source 1 u guint8
|
||||
.source 1 v guint8
|
||||
.temp 2 uv
|
||||
|
||||
mergebw uv, u, v
|
||||
x2 mergebw yuy2, y, uv
|
||||
|
||||
|
||||
.function video_convert_orc_convert_Y42B_UYVY
|
||||
.flags 2d
|
||||
.dest 4 uyvy guint8
|
||||
.source 2 y guint8
|
||||
.source 1 u guint8
|
||||
.source 1 v guint8
|
||||
.temp 2 uv
|
||||
|
||||
mergebw uv, u, v
|
||||
x2 mergebw uyvy, uv, y
|
||||
|
||||
|
||||
.function video_convert_orc_convert_Y42B_AYUV
|
||||
.flags 2d
|
||||
.dest 8 ayuv guint8
|
||||
.source 2 yy guint8
|
||||
.source 1 u guint8
|
||||
.source 1 v guint8
|
||||
.const 1 c255 255
|
||||
.temp 2 uv
|
||||
.temp 2 ay
|
||||
.temp 4 uvuv
|
||||
.temp 4 ayay
|
||||
|
||||
mergebw uv, u, v
|
||||
x2 mergebw ayay, c255, yy
|
||||
mergewl uvuv, uv, uv
|
||||
x2 mergewl ayuv, ayay, uvuv
|
||||
|
||||
|
||||
.function video_convert_orc_convert_Y444_YUY2
|
||||
.flags 2d
|
||||
.dest 4 yuy2 guint8
|
||||
.source 2 y guint8
|
||||
.source 2 u guint8
|
||||
.source 2 v guint8
|
||||
.temp 2 uv
|
||||
.temp 4 uvuv
|
||||
.temp 2 uv1
|
||||
.temp 2 uv2
|
||||
|
||||
x2 mergebw uvuv, u, v
|
||||
splitlw uv1, uv2, uvuv
|
||||
x2 avgub uv, uv1, uv2
|
||||
x2 mergebw yuy2, y, uv
|
||||
|
||||
|
||||
.function video_convert_orc_convert_Y444_UYVY
|
||||
.flags 2d
|
||||
.dest 4 uyvy guint8
|
||||
.source 2 y guint8
|
||||
.source 2 u guint8
|
||||
.source 2 v guint8
|
||||
.temp 2 uv
|
||||
.temp 4 uvuv
|
||||
.temp 2 uv1
|
||||
.temp 2 uv2
|
||||
|
||||
x2 mergebw uvuv, u, v
|
||||
splitlw uv1, uv2, uvuv
|
||||
x2 avgub uv, uv1, uv2
|
||||
x2 mergebw uyvy, uv, y
|
||||
|
||||
|
||||
.function video_convert_orc_convert_Y444_AYUV
|
||||
.flags 2d
|
||||
.dest 4 ayuv guint8
|
||||
.source 1 yy guint8
|
||||
.source 1 u guint8
|
||||
.source 1 v guint8
|
||||
.const 1 c255 255
|
||||
.temp 2 uv
|
||||
.temp 2 ay
|
||||
|
||||
mergebw uv, u, v
|
||||
mergebw ay, c255, yy
|
||||
mergewl ayuv, ay, uv
|
||||
|
||||
|
||||
|
||||
.function video_convert_orc_convert_AYUV_ARGB
|
||||
.flags 2d
|
||||
.dest 4 argb guint8
|
||||
.source 4 ayuv guint8
|
||||
.param 2 p1
|
||||
.param 2 p2
|
||||
.param 2 p3
|
||||
.param 2 p4
|
||||
.param 2 p5
|
||||
.temp 1 a
|
||||
.temp 1 y
|
||||
.temp 1 u
|
||||
.temp 1 v
|
||||
.temp 2 wy
|
||||
.temp 2 wu
|
||||
.temp 2 wv
|
||||
.temp 2 wr
|
||||
.temp 2 wg
|
||||
.temp 2 wb
|
||||
.temp 1 r
|
||||
.temp 1 g
|
||||
.temp 1 b
|
||||
.temp 4 x
|
||||
.const 1 c128 128
|
||||
|
||||
x4 subb x, ayuv, c128
|
||||
splitlw wv, wy, x
|
||||
splitwb y, a, wy
|
||||
splitwb v, u, wv
|
||||
|
||||
splatbw wy, y
|
||||
splatbw wu, u
|
||||
splatbw wv, v
|
||||
|
||||
mulhsw wy, wy, p1
|
||||
|
||||
mulhsw wr, wv, p2
|
||||
addssw wr, wy, wr
|
||||
|
||||
mulhsw wb, wu, p3
|
||||
addssw wb, wy, wb
|
||||
|
||||
mulhsw wg, wu, p4
|
||||
addssw wg, wy, wg
|
||||
mulhsw wy, wv, p5
|
||||
addssw wg, wg, wy
|
||||
|
||||
convssswb r, wr
|
||||
convssswb g, wg
|
||||
convssswb b, wb
|
||||
|
||||
mergebw wr, a, r
|
||||
mergebw wb, g, b
|
||||
mergewl x, wr, wb
|
||||
x4 addb argb, x, c128
|
||||
|
||||
.function video_convert_orc_convert_AYUV_BGRA
|
||||
.flags 2d
|
||||
.dest 4 bgra guint8
|
||||
.source 4 ayuv guint8
|
||||
.param 2 p1
|
||||
.param 2 p2
|
||||
.param 2 p3
|
||||
.param 2 p4
|
||||
.param 2 p5
|
||||
.temp 1 a
|
||||
.temp 1 y
|
||||
.temp 1 u
|
||||
.temp 1 v
|
||||
.temp 2 wy
|
||||
.temp 2 wu
|
||||
.temp 2 wv
|
||||
.temp 2 wr
|
||||
.temp 2 wg
|
||||
.temp 2 wb
|
||||
.temp 1 r
|
||||
.temp 1 g
|
||||
.temp 1 b
|
||||
.temp 4 x
|
||||
.const 1 c128 128
|
||||
|
||||
x4 subb x, ayuv, c128
|
||||
splitlw wv, wy, x
|
||||
splitwb y, a, wy
|
||||
splitwb v, u, wv
|
||||
|
||||
splatbw wy, y
|
||||
splatbw wu, u
|
||||
splatbw wv, v
|
||||
|
||||
mulhsw wy, wy, p1
|
||||
|
||||
mulhsw wr, wv, p2
|
||||
addssw wr, wy, wr
|
||||
|
||||
mulhsw wb, wu, p3
|
||||
addssw wb, wy, wb
|
||||
|
||||
mulhsw wg, wu, p4
|
||||
addssw wg, wy, wg
|
||||
mulhsw wy, wv, p5
|
||||
addssw wg, wg, wy
|
||||
|
||||
convssswb r, wr
|
||||
convssswb g, wg
|
||||
convssswb b, wb
|
||||
|
||||
mergebw wb, b, g
|
||||
mergebw wr, r, a
|
||||
mergewl x, wb, wr
|
||||
x4 addb bgra, x, c128
|
||||
|
||||
|
||||
.function video_convert_orc_convert_AYUV_ABGR
|
||||
.flags 2d
|
||||
.dest 4 argb guint8
|
||||
.source 4 ayuv guint8
|
||||
.param 2 p1
|
||||
.param 2 p2
|
||||
.param 2 p3
|
||||
.param 2 p4
|
||||
.param 2 p5
|
||||
.temp 1 a
|
||||
.temp 1 y
|
||||
.temp 1 u
|
||||
.temp 1 v
|
||||
.temp 2 wy
|
||||
.temp 2 wu
|
||||
.temp 2 wv
|
||||
.temp 2 wr
|
||||
.temp 2 wg
|
||||
.temp 2 wb
|
||||
.temp 1 r
|
||||
.temp 1 g
|
||||
.temp 1 b
|
||||
.temp 4 x
|
||||
.const 1 c128 128
|
||||
|
||||
x4 subb x, ayuv, c128
|
||||
splitlw wv, wy, x
|
||||
splitwb y, a, wy
|
||||
splitwb v, u, wv
|
||||
|
||||
splatbw wy, y
|
||||
splatbw wu, u
|
||||
splatbw wv, v
|
||||
|
||||
mulhsw wy, wy, p1
|
||||
|
||||
mulhsw wr, wv, p2
|
||||
addssw wr, wy, wr
|
||||
|
||||
mulhsw wb, wu, p3
|
||||
addssw wb, wy, wb
|
||||
|
||||
mulhsw wg, wu, p4
|
||||
addssw wg, wy, wg
|
||||
mulhsw wy, wv, p5
|
||||
addssw wg, wg, wy
|
||||
|
||||
convssswb r, wr
|
||||
convssswb g, wg
|
||||
convssswb b, wb
|
||||
|
||||
mergebw wb, a, b
|
||||
mergebw wr, g, r
|
||||
mergewl x, wb, wr
|
||||
x4 addb argb, x, c128
|
||||
|
||||
.function video_convert_orc_convert_AYUV_RGBA
|
||||
.flags 2d
|
||||
.dest 4 argb guint8
|
||||
.source 4 ayuv guint8
|
||||
.param 2 p1
|
||||
.param 2 p2
|
||||
.param 2 p3
|
||||
.param 2 p4
|
||||
.param 2 p5
|
||||
.temp 1 a
|
||||
.temp 1 y
|
||||
.temp 1 u
|
||||
.temp 1 v
|
||||
.temp 2 wy
|
||||
.temp 2 wu
|
||||
.temp 2 wv
|
||||
.temp 2 wr
|
||||
.temp 2 wg
|
||||
.temp 2 wb
|
||||
.temp 1 r
|
||||
.temp 1 g
|
||||
.temp 1 b
|
||||
.temp 4 x
|
||||
.const 1 c128 128
|
||||
|
||||
x4 subb x, ayuv, c128
|
||||
splitlw wv, wy, x
|
||||
splitwb y, a, wy
|
||||
splitwb v, u, wv
|
||||
|
||||
splatbw wy, y
|
||||
splatbw wu, u
|
||||
splatbw wv, v
|
||||
|
||||
mulhsw wy, wy, p1
|
||||
|
||||
mulhsw wr, wv, p2
|
||||
addssw wr, wy, wr
|
||||
|
||||
mulhsw wb, wu, p3
|
||||
addssw wb, wy, wb
|
||||
|
||||
mulhsw wg, wu, p4
|
||||
addssw wg, wy, wg
|
||||
mulhsw wy, wv, p5
|
||||
addssw wg, wg, wy
|
||||
|
||||
convssswb r, wr
|
||||
convssswb g, wg
|
||||
convssswb b, wb
|
||||
|
||||
mergebw wr, r, g
|
||||
mergebw wb, b, a
|
||||
mergewl x, wr, wb
|
||||
x4 addb argb, x, c128
|
||||
|
||||
|
||||
|
||||
.function video_convert_orc_convert_I420_BGRA
|
||||
.dest 4 argb guint8
|
||||
.source 1 y guint8
|
||||
.source 1 u guint8
|
||||
.source 1 v guint8
|
||||
.param 2 p1
|
||||
.param 2 p2
|
||||
.param 2 p3
|
||||
.param 2 p4
|
||||
.param 2 p5
|
||||
.temp 2 wy
|
||||
.temp 2 wu
|
||||
.temp 2 wv
|
||||
.temp 2 wr
|
||||
.temp 2 wg
|
||||
.temp 2 wb
|
||||
.temp 1 r
|
||||
.temp 1 g
|
||||
.temp 1 b
|
||||
.temp 4 x
|
||||
.const 1 c128 128
|
||||
|
||||
subb r, y, c128
|
||||
splatbw wy, r
|
||||
loadupdb r, u
|
||||
subb r, r, c128
|
||||
splatbw wu, r
|
||||
loadupdb r, v
|
||||
subb r, r, c128
|
||||
splatbw wv, r
|
||||
|
||||
mulhsw wy, wy, p1
|
||||
|
||||
mulhsw wr, wv, p2
|
||||
addssw wr, wy, wr
|
||||
|
||||
mulhsw wb, wu, p3
|
||||
addssw wb, wy, wb
|
||||
|
||||
mulhsw wg, wu, p4
|
||||
addssw wg, wy, wg
|
||||
mulhsw wy, wv, p5
|
||||
addssw wg, wg, wy
|
||||
|
||||
convssswb r, wr
|
||||
convssswb g, wg
|
||||
convssswb b, wb
|
||||
|
||||
mergebw wb, b, g
|
||||
mergebw wr, r, 127
|
||||
mergewl x, wb, wr
|
||||
x4 addb argb, x, c128
|
||||
|
||||
|
573
gst-libs/gst/video/gstcms.c
Normal file
573
gst-libs/gst/video/gstcms.c
Normal file
|
@ -0,0 +1,573 @@
|
|||
/* 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.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <gst/gst.h>
|
||||
#include <gst/math-compat.h>
|
||||
#include "gstcms.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
|
||||
|
||||
/* our simple CMS */
|
||||
|
||||
void
|
||||
color_xyY_to_XYZ (Color * c)
|
||||
{
|
||||
if (c->v[1] == 0) {
|
||||
c->v[0] = 0;
|
||||
c->v[1] = 0;
|
||||
c->v[2] = 0;
|
||||
} else {
|
||||
double X, Y, Z;
|
||||
X = c->v[0] * c->v[2] / c->v[1];
|
||||
Y = c->v[2];
|
||||
Z = (1.0 - c->v[0] - c->v[1]) * c->v[2] / c->v[1];
|
||||
c->v[0] = X;
|
||||
c->v[1] = Y;
|
||||
c->v[2] = Z;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
color_XYZ_to_xyY (Color * c)
|
||||
{
|
||||
double d;
|
||||
d = c->v[0] + c->v[1] + c->v[2];
|
||||
if (d == 0) {
|
||||
c->v[0] = 0.3128;
|
||||
c->v[1] = 0.3290;
|
||||
c->v[2] = 0;
|
||||
} else {
|
||||
double x, y, Y;
|
||||
x = c->v[0] / d;
|
||||
y = c->v[1] / d;
|
||||
Y = c->v[1];
|
||||
c->v[0] = x;
|
||||
c->v[1] = y;
|
||||
c->v[2] = Y;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
color_set (Color * c, double x, double y, double z)
|
||||
{
|
||||
c->v[0] = x;
|
||||
c->v[1] = y;
|
||||
c->v[2] = z;
|
||||
}
|
||||
|
||||
void
|
||||
color_matrix_set_identity (ColorMatrix * m)
|
||||
{
|
||||
int i, j;
|
||||
|
||||
for (i = 0; i < 4; i++) {
|
||||
for (j = 0; j < 4; j++) {
|
||||
m->m[i][j] = (i == j);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Prettyprint a 4x4 matrix @m@ */
|
||||
void
|
||||
color_matrix_dump (ColorMatrix * m)
|
||||
{
|
||||
int i, j;
|
||||
|
||||
printf ("[\n");
|
||||
for (i = 0; i < 4; i++) {
|
||||
printf (" ");
|
||||
for (j = 0; j < 4; j++) {
|
||||
printf (" %8.5g", m->m[i][j]);
|
||||
}
|
||||
printf ("\n");
|
||||
}
|
||||
printf ("]\n");
|
||||
}
|
||||
|
||||
/* Perform 4x4 matrix multiplication:
|
||||
* - @dst@ = @a@ * @b@
|
||||
* - @dst@ may be a pointer to @a@ andor @b@
|
||||
*/
|
||||
void
|
||||
color_matrix_multiply (ColorMatrix * dst, ColorMatrix * a, ColorMatrix * b)
|
||||
{
|
||||
ColorMatrix tmp;
|
||||
int i, j, k;
|
||||
|
||||
for (i = 0; i < 4; i++) {
|
||||
for (j = 0; j < 4; j++) {
|
||||
double x = 0;
|
||||
for (k = 0; k < 4; k++) {
|
||||
x += a->m[i][k] * b->m[k][j];
|
||||
}
|
||||
tmp.m[i][j] = x;
|
||||
}
|
||||
}
|
||||
|
||||
memcpy (dst, &tmp, sizeof (ColorMatrix));
|
||||
}
|
||||
|
||||
void
|
||||
color_matrix_apply (ColorMatrix * m, Color * dest, Color * src)
|
||||
{
|
||||
int i;
|
||||
Color tmp;
|
||||
|
||||
for (i = 0; i < 3; i++) {
|
||||
double x = 0;
|
||||
x += m->m[i][0] * src->v[0];
|
||||
x += m->m[i][1] * src->v[1];
|
||||
x += m->m[i][2] * src->v[2];
|
||||
x += m->m[i][3];
|
||||
tmp.v[i] = x;
|
||||
}
|
||||
memcpy (dest, &tmp, sizeof (tmp));
|
||||
}
|
||||
|
||||
void
|
||||
color_matrix_offset_components (ColorMatrix * m, double a1, double a2,
|
||||
double a3)
|
||||
{
|
||||
ColorMatrix a;
|
||||
|
||||
color_matrix_set_identity (&a);
|
||||
a.m[0][3] = a1;
|
||||
a.m[1][3] = a2;
|
||||
a.m[2][3] = a3;
|
||||
color_matrix_multiply (m, &a, m);
|
||||
}
|
||||
|
||||
void
|
||||
color_matrix_scale_components (ColorMatrix * m, double a1, double a2, double a3)
|
||||
{
|
||||
ColorMatrix a;
|
||||
|
||||
color_matrix_set_identity (&a);
|
||||
a.m[0][0] = a1;
|
||||
a.m[1][1] = a2;
|
||||
a.m[2][2] = a3;
|
||||
color_matrix_multiply (m, &a, m);
|
||||
}
|
||||
|
||||
void
|
||||
color_matrix_YCbCr_to_RGB (ColorMatrix * m, double Kr, double Kb)
|
||||
{
|
||||
double Kg = 1.0 - Kr - Kb;
|
||||
ColorMatrix k = {
|
||||
{
|
||||
{1., 0., 2 * (1 - Kr), 0.},
|
||||
{1., -2 * Kb * (1 - Kb) / Kg, -2 * Kr * (1 - Kr) / Kg, 0.},
|
||||
{1., 2 * (1 - Kb), 0., 0.},
|
||||
{0., 0., 0., 1.},
|
||||
}
|
||||
};
|
||||
|
||||
color_matrix_multiply (m, &k, m);
|
||||
}
|
||||
|
||||
void
|
||||
color_matrix_RGB_to_YCbCr (ColorMatrix * m, double Kr, double Kb)
|
||||
{
|
||||
double Kg = 1.0 - Kr - Kb;
|
||||
ColorMatrix k;
|
||||
double x;
|
||||
|
||||
k.m[0][0] = Kr;
|
||||
k.m[0][1] = Kg;
|
||||
k.m[0][2] = Kb;
|
||||
k.m[0][3] = 0;
|
||||
|
||||
x = 1 / (2 * (1 - Kb));
|
||||
k.m[1][0] = -x * Kr;
|
||||
k.m[1][1] = -x * Kg;
|
||||
k.m[1][2] = x * (1 - Kb);
|
||||
k.m[1][3] = 0;
|
||||
|
||||
x = 1 / (2 * (1 - Kr));
|
||||
k.m[2][0] = x * (1 - Kr);
|
||||
k.m[2][1] = -x * Kg;
|
||||
k.m[2][2] = -x * Kb;
|
||||
k.m[2][3] = 0;
|
||||
|
||||
k.m[3][0] = 0;
|
||||
k.m[3][1] = 0;
|
||||
k.m[3][2] = 0;
|
||||
k.m[3][3] = 1;
|
||||
|
||||
color_matrix_multiply (m, &k, m);
|
||||
}
|
||||
|
||||
void
|
||||
color_matrix_build_yuv_to_rgb_601 (ColorMatrix * dst)
|
||||
{
|
||||
/*
|
||||
* At this point, everything is in YCbCr
|
||||
* All components are in the range [0,255]
|
||||
*/
|
||||
color_matrix_set_identity (dst);
|
||||
|
||||
/* offset required to get input video black to (0.,0.,0.) */
|
||||
color_matrix_offset_components (dst, -16, -128, -128);
|
||||
|
||||
/* scale required to get input video black to (0.,0.,0.) */
|
||||
color_matrix_scale_components (dst, (1 / 219.0), (1 / 224.0), (1 / 224.0));
|
||||
|
||||
/* colour matrix, YCbCr -> RGB */
|
||||
/* Requires Y in [0,1.0], Cb&Cr in [-0.5,0.5] */
|
||||
color_matrix_YCbCr_to_RGB (dst, 0.2990, 0.1140); /* SD */
|
||||
|
||||
/*
|
||||
* We are now in RGB space
|
||||
*/
|
||||
|
||||
#if 0
|
||||
/* scale to output range. */
|
||||
color_matrix_scale_components (dst, 255.0, 255.0, 255.0);
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
color_matrix_build_bt709_to_bt601 (ColorMatrix * dst)
|
||||
{
|
||||
color_matrix_set_identity (dst);
|
||||
|
||||
/* offset required to get input video black to (0.,0.,0.) */
|
||||
color_matrix_offset_components (dst, -16, -128, -128);
|
||||
|
||||
/* scale required to get input video black to (0.,0.,0.) */
|
||||
color_matrix_scale_components (dst, (1 / 219.0), (1 / 224.0), (1 / 224.0));
|
||||
|
||||
/* colour matrix, YCbCr -> RGB */
|
||||
/* Requires Y in [0,1.0], Cb&Cr in [-0.5,0.5] */
|
||||
color_matrix_YCbCr_to_RGB (dst, 0.2126, 0.0722); /* HD */
|
||||
|
||||
color_matrix_RGB_to_YCbCr (dst, 0.2990, 0.1140); /* SD */
|
||||
|
||||
color_matrix_scale_components (dst, 219.0, 224.0, 224.0);
|
||||
|
||||
color_matrix_offset_components (dst, 16, 128, 128);
|
||||
}
|
||||
|
||||
void
|
||||
color_matrix_build_rgb_to_yuv_601 (ColorMatrix * dst)
|
||||
{
|
||||
color_matrix_set_identity (dst);
|
||||
|
||||
color_matrix_RGB_to_YCbCr (dst, 0.2990, 0.1140); /* SD */
|
||||
|
||||
color_matrix_scale_components (dst, 219.0, 224.0, 224.0);
|
||||
|
||||
color_matrix_offset_components (dst, 16, 128, 128);
|
||||
|
||||
{
|
||||
Color c;
|
||||
int i;
|
||||
for (i = 7; i >= 0; i--) {
|
||||
color_set (&c, (i & 2) ? 0.75 : 0.0, (i & 4) ? 0.75 : 0.0,
|
||||
(i & 1) ? 0.75 : 0.0);
|
||||
color_matrix_apply (dst, &c, &c);
|
||||
g_print (" { %g, %g, %g },\n", rint (c.v[0]), rint (c.v[1]),
|
||||
rint (c.v[2]));
|
||||
}
|
||||
color_set (&c, -0.075, -0.075, -0.075);
|
||||
color_matrix_apply (dst, &c, &c);
|
||||
g_print (" { %g, %g, %g },\n", rint (c.v[0]), rint (c.v[1]),
|
||||
rint (c.v[2]));
|
||||
color_set (&c, 0.075, 0.075, 0.075);
|
||||
color_matrix_apply (dst, &c, &c);
|
||||
g_print (" { %g, %g, %g },\n", rint (c.v[0]), rint (c.v[1]),
|
||||
rint (c.v[2]));
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
color_matrix_invert (ColorMatrix * m)
|
||||
{
|
||||
ColorMatrix tmp;
|
||||
int i, j;
|
||||
double det;
|
||||
|
||||
color_matrix_set_identity (&tmp);
|
||||
for (j = 0; j < 3; j++) {
|
||||
for (i = 0; i < 3; i++) {
|
||||
tmp.m[j][i] =
|
||||
m->m[(i + 1) % 3][(j + 1) % 3] * m->m[(i + 2) % 3][(j + 2) % 3] -
|
||||
m->m[(i + 1) % 3][(j + 2) % 3] * m->m[(i + 2) % 3][(j + 1) % 3];
|
||||
}
|
||||
}
|
||||
det =
|
||||
tmp.m[0][0] * m->m[0][0] + tmp.m[0][1] * m->m[1][0] +
|
||||
tmp.m[0][2] * m->m[2][0];
|
||||
for (j = 0; j < 3; j++) {
|
||||
for (i = 0; i < 3; i++) {
|
||||
tmp.m[i][j] /= det;
|
||||
}
|
||||
}
|
||||
memcpy (m, &tmp, sizeof (tmp));
|
||||
}
|
||||
|
||||
void
|
||||
color_matrix_copy (ColorMatrix * dest, ColorMatrix * src)
|
||||
{
|
||||
memcpy (dest, src, sizeof (ColorMatrix));
|
||||
}
|
||||
|
||||
void
|
||||
color_matrix_transpose (ColorMatrix * m)
|
||||
{
|
||||
int i, j;
|
||||
ColorMatrix tmp;
|
||||
|
||||
color_matrix_set_identity (&tmp);
|
||||
for (i = 0; i < 3; i++) {
|
||||
for (j = 0; j < 3; j++) {
|
||||
tmp.m[i][j] = m->m[j][i];
|
||||
}
|
||||
}
|
||||
memcpy (m, &tmp, sizeof (ColorMatrix));
|
||||
}
|
||||
|
||||
void
|
||||
color_matrix_build_XYZ (ColorMatrix * dst,
|
||||
double rx, double ry,
|
||||
double gx, double gy, double bx, double by, double wx, double wy)
|
||||
{
|
||||
Color r, g, b, w, scale;
|
||||
ColorMatrix m;
|
||||
|
||||
color_set (&r, rx, ry, 1.0);
|
||||
color_xyY_to_XYZ (&r);
|
||||
color_set (&g, gx, gy, 1.0);
|
||||
color_xyY_to_XYZ (&g);
|
||||
color_set (&b, bx, by, 1.0);
|
||||
color_xyY_to_XYZ (&b);
|
||||
color_set (&w, wx, wy, 1.0);
|
||||
color_xyY_to_XYZ (&w);
|
||||
|
||||
color_matrix_set_identity (dst);
|
||||
|
||||
dst->m[0][0] = r.v[0];
|
||||
dst->m[0][1] = r.v[1];
|
||||
dst->m[0][2] = r.v[2];
|
||||
dst->m[1][0] = g.v[0];
|
||||
dst->m[1][1] = g.v[1];
|
||||
dst->m[1][2] = g.v[2];
|
||||
dst->m[2][0] = b.v[0];
|
||||
dst->m[2][1] = b.v[1];
|
||||
dst->m[2][2] = b.v[2];
|
||||
|
||||
color_matrix_dump (dst);
|
||||
color_matrix_copy (&m, dst);
|
||||
color_matrix_invert (&m);
|
||||
color_matrix_dump (&m);
|
||||
|
||||
color_matrix_transpose (&m);
|
||||
color_matrix_apply (&m, &scale, &w);
|
||||
g_print ("%g %g %g\n", scale.v[0], scale.v[1], scale.v[2]);
|
||||
|
||||
dst->m[0][0] = r.v[0] * scale.v[0];
|
||||
dst->m[0][1] = r.v[1] * scale.v[0];
|
||||
dst->m[0][2] = r.v[2] * scale.v[0];
|
||||
dst->m[1][0] = g.v[0] * scale.v[1];
|
||||
dst->m[1][1] = g.v[1] * scale.v[1];
|
||||
dst->m[1][2] = g.v[2] * scale.v[1];
|
||||
dst->m[2][0] = b.v[0] * scale.v[2];
|
||||
dst->m[2][1] = b.v[1] * scale.v[2];
|
||||
dst->m[2][2] = b.v[2] * scale.v[2];
|
||||
|
||||
color_matrix_transpose (dst);
|
||||
color_matrix_dump (dst);
|
||||
|
||||
color_set (&scale, 1, 1, 1);
|
||||
color_matrix_apply (dst, &scale, &scale);
|
||||
color_XYZ_to_xyY (&scale);
|
||||
g_print ("white %g %g %g\n", scale.v[0], scale.v[1], scale.v[2]);
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
color_matrix_build_rgb_to_XYZ_601 (ColorMatrix * dst)
|
||||
{
|
||||
/* SMPTE C primaries, SMPTE 170M-2004 */
|
||||
color_matrix_build_XYZ (dst,
|
||||
0.630, 0.340, 0.310, 0.595, 0.155, 0.070, 0.3127, 0.3290);
|
||||
#if 0
|
||||
/* NTSC 1953 primaries, SMPTE 170M-2004 */
|
||||
color_matrix_build_XYZ (dst,
|
||||
0.67, 0.33, 0.21, 0.71, 0.14, 0.08, 0.3127, 0.3290);
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
color_matrix_build_XYZ_to_rgb_709 (ColorMatrix * dst)
|
||||
{
|
||||
/* Rec. ITU-R BT.709-5 */
|
||||
color_matrix_build_XYZ (dst,
|
||||
0.640, 0.330, 0.300, 0.600, 0.150, 0.060, 0.3127, 0.3290);
|
||||
}
|
||||
|
||||
void
|
||||
color_matrix_build_XYZ_to_rgb_dell (ColorMatrix * dst)
|
||||
{
|
||||
/* Dell monitor */
|
||||
#if 1
|
||||
color_matrix_build_XYZ (dst,
|
||||
0.662, 0.329, 0.205, 0.683, 0.146, 0.077, 0.3135, 0.3290);
|
||||
#endif
|
||||
#if 0
|
||||
color_matrix_build_XYZ (dst,
|
||||
0.630, 0.340, 0.310, 0.595, 0.155, 0.070, 0.3127, 0.3290);
|
||||
#endif
|
||||
color_matrix_invert (dst);
|
||||
}
|
||||
|
||||
void
|
||||
color_transfer_function_apply (Color * dest, Color * src)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < 3; i++) {
|
||||
if (src->v[i] < 0.0812) {
|
||||
dest->v[i] = src->v[i] / 4.500;
|
||||
} else {
|
||||
dest->v[i] = pow (src->v[i] + 0.099, 1 / 0.4500);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
color_transfer_function_unapply (Color * dest, Color * src)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < 3; i++) {
|
||||
if (src->v[i] < 0.0812 / 4.500) {
|
||||
dest->v[i] = src->v[i] * 4.500;
|
||||
} else {
|
||||
dest->v[i] = pow (src->v[i], 0.4500) - 0.099;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
color_gamut_clamp (Color * dest, Color * src)
|
||||
{
|
||||
dest->v[0] = CLAMP (src->v[0], 0.0, 1.0);
|
||||
dest->v[1] = CLAMP (src->v[1], 0.0, 1.0);
|
||||
dest->v[2] = CLAMP (src->v[2], 0.0, 1.0);
|
||||
}
|
||||
|
||||
#if 0
|
||||
static guint8 *
|
||||
get_color_transform_table (void)
|
||||
{
|
||||
static guint8 *color_transform_table = NULL;
|
||||
|
||||
#if 1
|
||||
if (!color_transform_table) {
|
||||
ColorMatrix bt601_to_rgb;
|
||||
ColorMatrix bt601_to_yuv;
|
||||
ColorMatrix bt601_rgb_to_XYZ;
|
||||
ColorMatrix dell_XYZ_to_rgb;
|
||||
guint8 *table_y;
|
||||
guint8 *table_u;
|
||||
guint8 *table_v;
|
||||
int y, u, v;
|
||||
|
||||
color_matrix_build_yuv_to_rgb_601 (&bt601_to_rgb);
|
||||
color_matrix_build_rgb_to_yuv_601 (&bt601_to_yuv);
|
||||
color_matrix_build_rgb_to_XYZ_601 (&bt601_rgb_to_XYZ);
|
||||
color_matrix_build_XYZ_to_rgb_dell (&dell_XYZ_to_rgb);
|
||||
|
||||
color_transform_table = g_malloc (0x1000000 * 3);
|
||||
|
||||
table_y = COG_OFFSET (color_transform_table, 0 * 0x1000000);
|
||||
table_u = COG_OFFSET (color_transform_table, 1 * 0x1000000);
|
||||
table_v = COG_OFFSET (color_transform_table, 2 * 0x1000000);
|
||||
|
||||
for (y = 0; y < 256; y++) {
|
||||
for (u = 0; u < 256; u++) {
|
||||
for (v = 0; v < 256; v++) {
|
||||
Color c;
|
||||
|
||||
c.v[0] = y;
|
||||
c.v[1] = u;
|
||||
c.v[2] = v;
|
||||
color_matrix_apply (&bt601_to_rgb, &c, &c);
|
||||
color_gamut_clamp (&c, &c);
|
||||
color_transfer_function_apply (&c, &c);
|
||||
color_matrix_apply (&bt601_rgb_to_XYZ, &c, &c);
|
||||
color_matrix_apply (&dell_XYZ_to_rgb, &c, &c);
|
||||
color_transfer_function_unapply (&c, &c);
|
||||
color_gamut_clamp (&c, &c);
|
||||
color_matrix_apply (&bt601_to_yuv, &c, &c);
|
||||
|
||||
table_y[(y << 16) | (u << 8) | (v)] = rint (c.v[0]);
|
||||
table_u[(y << 16) | (u << 8) | (v)] = rint (c.v[1]);
|
||||
table_v[(y << 16) | (u << 8) | (v)] = rint (c.v[2]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#if 0
|
||||
if (!color_transform_table) {
|
||||
ColorMatrix bt709_to_bt601;
|
||||
guint8 *table_y;
|
||||
guint8 *table_u;
|
||||
guint8 *table_v;
|
||||
int y, u, v;
|
||||
|
||||
color_matrix_build_bt709_to_bt601 (&bt709_to_bt601);
|
||||
|
||||
color_transform_table = g_malloc (0x1000000 * 3);
|
||||
|
||||
table_y = COG_OFFSET (color_transform_table, 0 * 0x1000000);
|
||||
table_u = COG_OFFSET (color_transform_table, 1 * 0x1000000);
|
||||
table_v = COG_OFFSET (color_transform_table, 2 * 0x1000000);
|
||||
|
||||
for (y = 0; y < 256; y++) {
|
||||
for (u = 0; u < 256; u++) {
|
||||
for (v = 0; v < 256; v++) {
|
||||
Color c;
|
||||
|
||||
c.v[0] = y;
|
||||
c.v[1] = u;
|
||||
c.v[2] = v;
|
||||
color_matrix_apply (&bt709_to_bt601, &c, &c);
|
||||
|
||||
table_y[(y << 16) | (u << 8) | (v)] = rint (c.v[0]);
|
||||
table_u[(y << 16) | (u << 8) | (v)] = rint (c.v[1]);
|
||||
table_v[(y << 16) | (u << 8) | (v)] = rint (c.v[2]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
return color_transform_table;
|
||||
}
|
||||
#endif
|
71
gst-libs/gst/video/gstcms.h
Normal file
71
gst-libs/gst/video/gstcms.h
Normal file
|
@ -0,0 +1,71 @@
|
|||
/* 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 color_xyY_to_XYZ (Color * c);
|
||||
void color_XYZ_to_xyY (Color * c);
|
||||
void color_set (Color * c, double x, double y, double z);
|
||||
void color_matrix_set_identity (ColorMatrix * m);
|
||||
void color_matrix_dump (ColorMatrix * m);
|
||||
void color_matrix_multiply (ColorMatrix * dst, ColorMatrix * a, ColorMatrix * b);
|
||||
void color_matrix_apply (ColorMatrix * m, Color * dest, Color * src);
|
||||
void color_matrix_offset_components (ColorMatrix * m, double a1, double a2,
|
||||
double a3);
|
||||
void color_matrix_scale_components (ColorMatrix * m, double a1, double a2, double a3);
|
||||
void color_matrix_YCbCr_to_RGB (ColorMatrix * m, double Kr, double Kb);
|
||||
void color_matrix_RGB_to_YCbCr (ColorMatrix * m, double Kr, double Kb);
|
||||
void color_matrix_build_yuv_to_rgb_601 (ColorMatrix * dst);
|
||||
void color_matrix_build_bt709_to_bt601 (ColorMatrix * dst);
|
||||
void color_matrix_build_rgb_to_yuv_601 (ColorMatrix * dst);
|
||||
void color_matrix_invert (ColorMatrix * m);
|
||||
void color_matrix_copy (ColorMatrix * dest, ColorMatrix * src);
|
||||
void color_matrix_transpose (ColorMatrix * m);
|
||||
void color_matrix_build_XYZ (ColorMatrix * dst,
|
||||
double rx, double ry,
|
||||
double gx, double gy, double bx, double by, double wx, double wy);
|
||||
void color_matrix_build_rgb_to_XYZ_601 (ColorMatrix * dst);
|
||||
void color_matrix_build_XYZ_to_rgb_709 (ColorMatrix * dst);
|
||||
void color_matrix_build_XYZ_to_rgb_dell (ColorMatrix * dst);
|
||||
void color_transfer_function_apply (Color * dest, Color * src);
|
||||
void color_transfer_function_unapply (Color * dest, Color * src);
|
||||
void color_gamut_clamp (Color * dest, Color * src);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif
|
||||
|
1928
gst-libs/gst/video/gstvideoaggregator.c
Normal file
1928
gst-libs/gst/video/gstvideoaggregator.c
Normal file
File diff suppressed because it is too large
Load diff
109
gst-libs/gst/video/gstvideoaggregator.h
Normal file
109
gst-libs/gst/video/gstvideoaggregator.h
Normal file
|
@ -0,0 +1,109 @@
|
|||
/* Generic video aggregator plugin
|
||||
* Copyright (C) 2008 Wim Taymans <wim@fluendo.com>
|
||||
* Copyright (C) 2010 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., 51 Franklin St, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifndef __GST_VIDEO_AGGREGATOR_H__
|
||||
#define __GST_VIDEO_AGGREGATOR_H__
|
||||
|
||||
#include <gst/gst.h>
|
||||
#include <gst/video/video.h>
|
||||
#include <gst/base/gstaggregator.h>
|
||||
|
||||
#include "gstvideoaggregatorpad.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GST_TYPE_VIDEO_AGGREGATOR (gst_videoaggregator_get_type())
|
||||
#define GST_VIDEO_AGGREGATOR(obj) \
|
||||
(G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_VIDEO_AGGREGATOR, GstVideoAggregator))
|
||||
#define GST_VIDEO_AGGREGATOR_CLASS(klass) \
|
||||
(G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_VIDEO_AGGREGATOR, GstVideoAggregatorClass))
|
||||
#define GST_IS_VIDEO_AGGREGATOR(obj) \
|
||||
(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_VIDEO_AGGREGATOR))
|
||||
#define GST_IS_VIDEO_AGGREGATOR_CLASS(klass) \
|
||||
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_VIDEO_AGGREGATOR))
|
||||
#define GST_VIDEO_AGGREGATOR_GET_CLASS(obj) \
|
||||
(G_TYPE_INSTANCE_GET_CLASS((obj),GST_TYPE_VIDEO_AGGREGATOR,GstVideoAggregatorClass))
|
||||
|
||||
typedef struct _GstVideoAggregator GstVideoAggregator;
|
||||
typedef struct _GstVideoAggregatorClass GstVideoAggregatorClass;
|
||||
typedef struct _GstVideoAggregatorPrivate GstVideoAggregatorPrivate;
|
||||
|
||||
/**
|
||||
* GstVideoAggregator:
|
||||
* @info: The #GstVideoInfo representing the currently set
|
||||
* srcpad caps.
|
||||
*/
|
||||
struct _GstVideoAggregator
|
||||
{
|
||||
GstAggregator aggregator;
|
||||
|
||||
/*< public >*/
|
||||
/* Output caps */
|
||||
GstVideoInfo info;
|
||||
|
||||
/* < private > */
|
||||
GstVideoAggregatorPrivate *priv;
|
||||
gpointer _gst_reserved[GST_PADDING];
|
||||
};
|
||||
|
||||
/**
|
||||
* GstVideoAggregatorClass:
|
||||
* @disable_frame_conversion: Optional.
|
||||
* Allows subclasses to disable the frame colorspace
|
||||
* conversion feature
|
||||
* @update_info: Optional.
|
||||
* Lets subclasses update the src #GstVideoInfo representing
|
||||
* the src pad caps before usage.
|
||||
* @aggregate_frames: Lets subclasses aggregate frames that are ready. Subclasses
|
||||
* should iterate the GstElement.sinkpads and use the already
|
||||
* mapped #GstVideoFrame from GstVideoAggregatorPad.aggregated_frame
|
||||
* or directly use the #GstBuffer from GstVideoAggregatorPad.buffer
|
||||
* if it needs to map the buffer in a special way. The result of the
|
||||
* aggregation should land in @outbuffer.
|
||||
* @get_output_buffer: Optional.
|
||||
* Lets subclasses provide a #GstBuffer to be used as @outbuffer of
|
||||
* the #aggregate_frames vmethod.
|
||||
* @negotiated_caps: Optional.
|
||||
* Notifies subclasses what caps format has been negotiated
|
||||
**/
|
||||
struct _GstVideoAggregatorClass
|
||||
{
|
||||
/*< private >*/
|
||||
GstAggregatorClass parent_class;
|
||||
|
||||
/*< public >*/
|
||||
gboolean disable_frame_conversion;
|
||||
|
||||
gboolean (*update_info) (GstVideoAggregator * videoaggregator,
|
||||
GstVideoInfo * info);
|
||||
GstFlowReturn (*aggregate_frames) (GstVideoAggregator * videoaggregator,
|
||||
GstBuffer * outbuffer);
|
||||
GstFlowReturn (*get_output_buffer) (GstVideoAggregator * videoaggregator,
|
||||
GstBuffer ** outbuffer);
|
||||
gboolean (*negotiated_caps) (GstVideoAggregator * videoaggregator,
|
||||
GstCaps * caps);
|
||||
/* < private > */
|
||||
gpointer _gst_reserved[GST_PADDING];
|
||||
};
|
||||
|
||||
GType gst_videoaggregator_get_type (void);
|
||||
|
||||
G_END_DECLS
|
||||
#endif /* __GST_VIDEO_AGGREGATOR_H__ */
|
90
gst-libs/gst/video/gstvideoaggregatorpad.h
Normal file
90
gst-libs/gst/video/gstvideoaggregatorpad.h
Normal file
|
@ -0,0 +1,90 @@
|
|||
/* Generic video aggregator plugin
|
||||
* Copyright (C) 2008 Wim Taymans <wim@fluendo.com>
|
||||
* Copyright (C) 2010 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., 51 Franklin St, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifndef __GST_VIDEO_AGGREGATOR_PAD_H__
|
||||
#define __GST_VIDEO_AGGREGATOR_PAD_H__
|
||||
|
||||
#include <gst/gst.h>
|
||||
#include <gst/video/video.h>
|
||||
|
||||
#include <gst/base/gstaggregator.h>
|
||||
|
||||
#include "videoconvert.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GST_TYPE_VIDEO_AGGREGATOR_PAD (gst_videoaggregator_pad_get_type())
|
||||
#define GST_VIDEO_AGGREGATOR_PAD(obj) \
|
||||
(G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_VIDEO_AGGREGATOR_PAD, GstVideoAggregatorPad))
|
||||
#define GST_VIDEO_AGGREGATOR_PAD_CLASS(klass) \
|
||||
(G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_COMPOSITOR_PAD, GstVideoAggregatorPadClass))
|
||||
#define GST_IS_VIDEO_AGGREGATOR_PAD(obj) \
|
||||
(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_VIDEO_AGGREGATOR_PAD))
|
||||
#define GST_IS_VIDEO_AGGREGATOR_PAD_CLASS(klass) \
|
||||
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_VIDEO_AGGREGATOR_PAD))
|
||||
|
||||
typedef struct _GstVideoAggregatorPad GstVideoAggregatorPad;
|
||||
typedef struct _GstVideoAggregatorPadClass GstVideoAggregatorPadClass;
|
||||
typedef struct _GstVideoAggregatorCollect GstVideoAggregatorCollect;
|
||||
|
||||
/**
|
||||
* GstVideoAggregatorPad:
|
||||
*
|
||||
* The opaque #GstVideoAggregatorPad structure.
|
||||
*/
|
||||
struct _GstVideoAggregatorPad
|
||||
{
|
||||
GstAggregatorPad parent;
|
||||
|
||||
/* < private > */
|
||||
|
||||
/* caps */
|
||||
GstVideoInfo info;
|
||||
|
||||
/* properties */
|
||||
guint zorder;
|
||||
|
||||
/* caps used for conversion if needed */
|
||||
GstVideoInfo conversion_info;
|
||||
|
||||
/* Converter, if NULL no conversion is done */
|
||||
VideoConvert *convert;
|
||||
gboolean need_conversion_update;
|
||||
GstBuffer *converted_buffer;
|
||||
|
||||
GstBuffer *buffer;
|
||||
GstVideoInfo queued_vinfo;
|
||||
GstBuffer *queued;
|
||||
GstVideoInfo buffer_vinfo;
|
||||
|
||||
GstClockTime start_time;
|
||||
GstClockTime end_time;
|
||||
GstVideoFrame *aggregated_frame;
|
||||
};
|
||||
|
||||
struct _GstVideoAggregatorPadClass
|
||||
{
|
||||
GstAggregatorPadClass parent_class;
|
||||
};
|
||||
|
||||
GType gst_videoaggregator_pad_get_type (void);
|
||||
|
||||
G_END_DECLS
|
||||
#endif /* __GST_VIDEO_AGGREGATOR_PAD_H__ */
|
1502
gst-libs/gst/video/videoconvert.c
Normal file
1502
gst-libs/gst/video/videoconvert.c
Normal file
File diff suppressed because it is too large
Load diff
80
gst-libs/gst/video/videoconvert.h
Normal file
80
gst-libs/gst/video/videoconvert.h
Normal file
|
@ -0,0 +1,80 @@
|
|||
/* 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__
|
||||
|
||||
typedef struct _VideoConvert VideoConvert;
|
||||
|
||||
#include <gst/video/video.h>
|
||||
#include "gstcms.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
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 * videoconvert_convert_new (GstVideoInfo *in_info,
|
||||
GstVideoInfo *out_info);
|
||||
void videoconvert_convert_free (VideoConvert * convert);
|
||||
|
||||
void videoconvert_convert_set_dither (VideoConvert * convert, int type);
|
||||
|
||||
void videoconvert_convert_convert (VideoConvert * convert,
|
||||
GstVideoFrame *dest, const GstVideoFrame *src);
|
||||
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GST_COLORSPACE_H__ */
|
15
pkgconfig/gstreamer-bad-video-uninstalled.pc.in
Normal file
15
pkgconfig/gstreamer-bad-video-uninstalled.pc.in
Normal file
|
@ -0,0 +1,15 @@
|
|||
prefix=
|
||||
exec_prefix=
|
||||
libdir=${pcfiledir}/../gst-libs/gst/video
|
||||
includedir=${pcfiledir}/../gst-libs
|
||||
pluginsdir=${pcfiledir}/..
|
||||
|
||||
Name: GStreamer bad video library, uninstalled
|
||||
Description: Bad video library for GStreamer, Not Installed
|
||||
Version: @VERSION@
|
||||
Requires: gstreamer-@GST_API_VERSION@
|
||||
|
||||
Libs: -L${libdir} ${libdir}/libgstbadvideo-@GST_API_VERSION@.la @BADBASE_LIBS@
|
||||
Cflags: -I${includedir} -I@srcdir@/.. @BADBASE_CFLAGS@
|
||||
|
||||
libraries=badvideo
|
15
pkgconfig/gstreamer-bad-video.pc.in
Normal file
15
pkgconfig/gstreamer-bad-video.pc.in
Normal file
|
@ -0,0 +1,15 @@
|
|||
prefix=@prefix@
|
||||
exec_prefix=@exec_prefix@
|
||||
libdir=@libdir@
|
||||
includedir=@includedir@/gstreamer-@GST_API_VERSION@
|
||||
pluginsdir=@libdir@/gstreamer-@GST_API_VERSION@
|
||||
|
||||
Name: GStreamer bad video library, uninstalled
|
||||
Description: Bad video library for GStreamer elements, Not Installed
|
||||
Version: @VERSION@
|
||||
Requires: gstreamer-@GST_API_VERSION@
|
||||
|
||||
Libs: -L${libdir} ${libdir}/libgstbadvideo-@GST_API_VERSION@.la @BADBASE_LIBS@
|
||||
Cflags: -I${includedir} -I@srcdir@/.. @BADBASE_CFLAGS@
|
||||
|
||||
libraries=badvideo
|
Loading…
Reference in a new issue