Commit 7bc58863 authored by David Schleef's avatar David Schleef Committed by Wim Taymans

[MOVED FROM BAD 31/68] colorspace: Revive element

Now based on Orc.
parent 0125cb55
plugin_LTLIBRARIES = libgstyuvtorgbcolorspace.la
plugin_LTLIBRARIES = libgstcolorspace.la
if HAVE_CPU_I386
ARCHSRCS = yuv2rgb_mmx16.s
else
ARCHSRCS =
endif
ORC_SOURCE=gstcolorspaceorc
include $(top_srcdir)/common/orc.mak
libgstcolorspace_la_SOURCES = gstcolorspace.c
nodist_libgstcolorspace_la_SOURCES = $(ORC_NODIST_SOURCES)
libgstcolorspace_la_CFLAGS = \
$(GST_PLUGINS_BASE_CFLAGS) \
$(GST_CFLAGS) \
$(ORC_CFLAGS)
libgstcolorspace_la_LIBADD = \
$(GST_PLUGINS_BASE_LIBS) -lgstvideo-$(GST_MAJORMINOR) \
$(GST_BASE_LIBS) \
$(GST_LIBS) \
$(ORC_LIBS)
libgstcolorspace_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
libgstcolorspace_la_LIBTOOLFLAGS = --tag=disable-static
noinst_HEADERS = gstcolorspace.h
libgstyuvtorgbcolorspace_la_SOURCES = gstcolorspace.c yuv2rgb.c
libgstyuvtorgbcolorspace_la_CFLAGS = $(GST_CFLAGS)
libgstyuvtorgbcolorspace_la_LIBADD =
libgstyuvtorgbcolorspace_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
libgstyuvtorgbcolorspace_la_LIBTOOLFLAGS = --tag=disable-static
noinst_HEADERS = yuv2rgb.h gstcolorspace.h
This diff is collapsed.
/* GStreamer
* Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
* This file:
* Copyright (C) 2003 Ronald Bultje <rbultje@ronald.bitfreak.net>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
......@@ -17,85 +19,46 @@
* Boston, MA 02111-1307, USA.
*/
#ifndef _GST_COLORSPACE_H_
#define _GST_COLORSPACE_H_
#ifndef __GST_COLORSPACE_H__
#define __GST_COLORSPACE_H__
#include <gst/gst.h>
#include <gst/video/video.h>
#include <gst/video/gstvideofilter.h>
G_BEGIN_DECLS
#define GST_TYPE_COLORSPACE \
(gst_colorspace_get_type())
#define GST_COLORSPACE(obj) \
(G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_COLORSPACE,GstColorspace))
#define GST_COLORSPACE_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_COLORSPACE,GstColorspaceClass))
#define GST_COLORSPACE_GET_CLASS(obj) \
(G_TYPE_INSTANCE_GET_CLASS((obj),GST_TYPE_COLORSPACE,GstColorspaceClass))
#define GST_IS_COLORSPACE(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_COLORSPACE))
#define GST_IS_COLORSPACE_CLASS(klass) \
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_COLORSPACE))
#define GST_TYPE_CSP (gst_csp_get_type())
#define GST_CSP(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_CSP,GstCsp))
#define GST_CSP_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_CSP,GstCspClass))
#define GST_IS_CSP(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_CSP))
#define GST_IS_CSP_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_CSP))
typedef struct _GstColorspace GstColorspace;
typedef struct _GstColorspaceClass GstColorspaceClass;
typedef struct _GstCsp GstCsp;
typedef struct _GstCspClass GstCspClass;
typedef enum {
GST_COLORSPACE_NONE,
GST_COLORSPACE_HERMES,
GST_COLORSPACE_YUV_RGB,
GST_COLORSPACE_YUY2_I420,
GST_COLORSPACE_RGB32_I420,
GST_COLORSPACE_RGB32_YV12,
GST_COLORSPACE_420_SWAP,
} GstColorSpaceConverterType;
struct _GstColorspace {
GstElement element;
GstPad *sinkpad,*srcpad;
int converter_index;
int src_format_index;
int sink_format_index;
int src_size;
int sink_size;
int src_stride;
int sink_stride;
/**
* GstCsp:
*
* Opaque object data structure.
*/
struct _GstCsp {
GstVideoFilter element;
gint width, height;
gdouble fps;
};
gboolean interlaced;
gfloat fps;
struct _GstColorspaceClass {
GstElementClass parent_class;
GstVideoFormat from_format;
GstVideoFormat to_format;
guint32 *palette;
};
GType gst_colorspace_get_type(void);
typedef struct _GstColorspaceFormat {
GstStaticCaps caps;
} GstColorspaceFormat;
typedef enum {
GST_COLORSPACE_I420,
GST_COLORSPACE_YV12,
GST_COLORSPACE_RGB32,
GST_COLORSPACE_RGB24,
GST_COLORSPACE_RGB16,
} GstColorSpaceFormatType;
typedef struct _GstColorspaceConverter {
GstColorSpaceFormatType from;
GstColorSpaceFormatType to;
void (*convert) (GstColorspace *colorspace, unsigned char *dest, unsigned char *src);
} GstColorspaceConverter;
struct _GstCspClass
{
GstVideoFilterClass parent_class;
};
G_END_DECLS
#endif
#endif /* __GST_COLORSPACE_H__ */
.function cogorc_memcpy_2d
.flags 2d
.dest 1 d1
.source 1 s1
copyb d1, s1
.function cogorc_downsample_horiz_cosite_1tap
.dest 1 d1
.source 2 s1
select0wb d1, s1
.function cogorc_downsample_horiz_cosite_3tap
.dest 1 d1
.source 2 s1
.source 2 s2
.temp 1 t1
.temp 1 t2
.temp 1 t3
.temp 2 t4
.temp 2 t5
.temp 2 t6
copyw t4, s1
select0wb t1, t4
select1wb t2, t4
select0wb t3, s2
convubw t4, t1
convubw t5, t2
convubw t6, t3
mullw t5, t5, 2
addw t4, t4, t6
addw t4, t4, t5
addw t4, t4, 2
shrsw t4, t4, 2
convsuswb d1, t4
.function cogorc_downsample_420_jpeg
.dest 1 d1
.source 2 s1
.source 2 s2
.temp 2 t1
.temp 1 t2
.temp 1 t3
.temp 1 t4
.temp 1 t5
copyw t1, s1
select0wb t2, t1
select1wb t3, t1
avgub t2, t2, t3
copyw t1, s2
select0wb t4, t1
select1wb t5, t1
avgub t4, t4, t5
avgub d1, t2, t4
.function cogorc_downsample_vert_halfsite_2tap
.dest 1 d1
.source 1 s1
.source 1 s2
avgub d1, s1, s2
.function cogorc_downsample_vert_cosite_3tap
.dest 1 d1
.source 1 s1
.source 1 s2
.source 1 s3
.temp 2 t1
.temp 2 t2
.temp 2 t3
convubw t1, s1
convubw t2, s2
convubw t3, s3
mullw t2, t2, 2
addw t1, t1, t3
addw t1, t1, t2
addw t1, t1, 2
shrsw t1, t1, 2
convsuswb d1, t1
.function cogorc_downsample_vert_halfsite_4tap
.dest 1 d1
.source 1 s1
.source 1 s2
.source 1 s3
.source 1 s4
.temp 2 t1
.temp 2 t2
.temp 2 t3
.temp 2 t4
convubw t1, s1
convubw t2, s2
convubw t3, s3
convubw t4, s4
addw t2, t2, t3
mullw t2, t2, 26
addw t1, t1, t4
mullw t1, t1, 6
addw t2, t2, t1
addw t2, t2, 32
shrsw t2, t2, 6
convsuswb d1, t2
.function cogorc_upsample_horiz_cosite_1tap
.dest 2 d1 guint8
.source 1 s1
.temp 1 t1
copyb t1, s1
mergebw d1, t1, t1
.function cogorc_upsample_horiz_cosite
.dest 2 d1 guint8
.source 1 s1
.source 1 s2
.temp 1 t1
.temp 1 t2
copyb t1, s1
avgub t2, t1, s2
mergebw d1, t1, t2
.function cogorc_upsample_vert_avgub
.dest 1 d1
.source 1 s1
.source 1 s2
avgub d1, s1, s2
.function orc_unpack_yuyv_y
.dest 1 d1
.source 2 s1
select0wb d1, s1
.function orc_unpack_yuyv_u
.dest 1 d1
.source 4 s1
.temp 2 t1
select0lw t1, s1
select1wb d1, t1
.function orc_unpack_yuyv_v
.dest 1 d1
.source 4 s1
.temp 2 t1
select1lw t1, s1
select1wb d1, t1
.function orc_pack_yuyv
.dest 4 d1
.source 2 s1 guint8
.source 1 s2
.source 1 s3
.temp 1 t1
.temp 1 t2
.temp 2 t3
.temp 2 t4
.temp 2 t5
copyw t5, s1
select0wb t1, t5
select1wb t2, t5
mergebw t3, t1, s2
mergebw t4, t2, s3
mergewl d1, t3, t4
.function orc_unpack_uyvy_y
.dest 1 d1
.source 2 s1
select1wb d1, s1
.function orc_unpack_uyvy_u
.dest 1 d1
.source 4 s1
.temp 2 t1
select0lw t1, s1
select0wb d1, t1
.function orc_unpack_uyvy_v
.dest 1 d1
.source 4 s1
.temp 2 t1
select1lw t1, s1
select0wb d1, t1
.function orc_pack_uyvy
.dest 4 d1
.source 2 s1 guint8
.source 1 s2
.source 1 s3
.temp 1 t1
.temp 1 t2
.temp 2 t3
.temp 2 t4
.temp 2 t5
copyw t5, s1
select0wb t1, t5
select1wb t2, t5
mergebw t3, s2, t1
mergebw t4, s3, t2
mergewl d1, t3, t4
.function orc_matrix2_u8
.dest 1 d1 guint8
.source 1 s1 guint8
.source 1 s2 guint8
.param 2 p1
.param 2 p2
.param 2 p3
.temp 2 t1
.temp 2 t2
convubw t1, s1
mullw t1, t1, p1
convubw t2, s2
mullw t2, t2, p2
addw t1, t1, t2
addw t1, t1, p3
shrsw t1, t1, 6
convsuswb d1, t1
.function orc_matrix2_11_u8
.dest 1 d1 guint8
.source 1 s1 guint8
.source 1 s2 guint8
.param 2 p1
.param 2 p2
.temp 2 t1
.temp 2 t2
.temp 2 t3
.temp 2 t4
convubw t1, s1
subw t1, t1, 16
mullw t3, t1, p1
convubw t2, s2
subw t2, t2, 128
mullw t4, t2, p2
addw t3, t3, t4
addw t3, t3, 128
shrsw t3, t3, 8
addw t3, t3, t1
addw t3, t3, t2
convsuswb d1, t3
.function orc_matrix2_12_u8
.dest 1 d1 guint8
.source 1 s1 guint8
.source 1 s2 guint8
.param 2 p1
.param 2 p2
.temp 2 t1
.temp 2 t2
.temp 2 t3
.temp 2 t4
convubw t1, s1
subw t1, t1, 16
mullw t3, t1, p1
convubw t2, s2
subw t2, t2, 128
mullw t4, t2, p2
addw t3, t3, t4
addw t3, t3, 128
shrsw t3, t3, 8
addw t3, t3, t1
addw t3, t3, t2
addw t3, t3, t2
convsuswb d1, t3
.function orc_matrix3_u8
.dest 1 d1 guint8
.source 1 s1 guint8
.source 1 s2 guint8
.source 1 s3 guint8
.param 2 p1
.param 2 p2
.param 2 p3
.param 2 p4
.temp 2 t1
.temp 2 t2
convubw t1, s1
mullw t1, t1, p1
convubw t2, s2
mullw t2, t2, p2
addw t1, t1, t2
convubw t2, s3
mullw t2, t2, p3
addw t1, t1, t2
addw t1, t1, p4
shrsw t1, t1, 6
convsuswb d1, t1
.function orc_matrix3_100_u8
.dest 1 d1 guint8
.source 1 s1 guint8
.source 1 s2 guint8
.source 1 s3 guint8
.param 2 p1
.param 2 p2
.param 2 p3
.temp 2 t1
.temp 2 t2
.temp 2 t3
#.temp 2 t4
convubw t1, s1
subw t1, t1, 16
mullw t3, t1, p1
convubw t2, s2
subw t2, t2, 128
mullw t2, t2, p2
addw t3, t3, t2
convubw t2, s3
subw t2, t2, 128
mullw t2, t2, p3
addw t3, t3, t2
addw t3, t3, 128
shrsw t3, t3, 8
addw t3, t3, t1
convsuswb d1, t3
.function orc_matrix3_100_offset_u8
.dest 1 d1 guint8
.source 1 s1 guint8
.source 1 s2 guint8
.source 1 s3 guint8
.param 2 p1
.param 2 p2
.param 2 p3
.param 2 p4
.param 2 p5
#.param 2 p6
.temp 2 t1
.temp 2 t2
.temp 2 t3
#.temp 2 t3
#.temp 2 t4
convubw t3, s1
mullw t1, t3, p1
convubw t2, s2
mullw t2, t2, p2
addw t1, t1, t2
convubw t2, s3
mullw t2, t2, p3
addw t1, t1, t2
addw t1, t1, p4
shrsw t1, t1, p5
#addw t1, t1, p6
addw t1, t1, t3
convsuswb d1, t1
.function orc_matrix3_000_u8
.dest 1 d1 guint8
.source 1 s1 guint8
.source 1 s2 guint8
.source 1 s3 guint8
.param 2 p1
.param 2 p2
.param 2 p3
.param 2 p4
.param 2 p5
#.param 2 p6
.temp 2 t1
.temp 2 t2
#.temp 2 t3
#.temp 2 t4
convubw t1, s1
mullw t1, t1, p1
convubw t2, s2
mullw t2, t2, p2
addw t1, t1, t2
convubw t2, s3
mullw t2, t2, p3
addw t1, t1, t2
addw t1, t1, p4
shrsw t1, t1, p5
#addw t1, t1, p6
convwb d1, t1
.function orc_pack_123x
.dest 4 d1 guint32
.source 1 s1
.source 1 s2
.source 1 s3
.param 1 p1
.temp 2 t1
.temp 2 t2
mergebw t1, s1, s2
mergebw t2, s3, p1
mergewl d1, t1, t2
.function orc_pack_x123
.dest 4 d1 guint32
.source 1 s1
.source 1 s2
.source 1 s3
.param 1 p1
.temp 2 t1
.temp 2 t2
mergebw t1, p1, s1
mergebw t2, s2, s3
mergewl d1, t1, t2
.function cogorc_combine2_u8
.dest 1 d1
.source 1 s1
.source 1 s2
.param 2 p1
.param 2 p2
.temp 2 t1
.temp 2 t2
convubw t1, s1
mullw t1, t1, p1
convubw t2, s2
mullw t2, t2, p2
addw t1, t1, t2
shruw t1, t1, 8
convsuswb d1, t1
.function cogorc_convert_I420_UYVY
.dest 4 d1
.dest 4 d2
.source 2 y1
.source 2 y2
.source 1 u
.source 1 v
.temp 2 uv
mergebw uv, u, v
x2 mergebw d1, uv, y1
x2 mergebw d2, uv, y2
.function cogorc_convert_I420_YUY2
.dest 4 d1
.dest 4 d2
.source 2 y1
.source 2 y2
.source 1 u
.source 1 v
.temp 2 uv
mergebw uv, u, v
x2 mergebw d1, y1, uv