1 /*
2 * Copyright (C) 2002 Billy Biggs <vektor@dumbterm.net>.
3 * Copyright (C) 2008,2010 Sebastian Dröge <slomo@collabora.co.uk>
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the
17 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
18 * Boston, MA 02110-1301, USA.
19 */
20
21 /*
22 * Relicensed for GStreamer from GPL to LGPL with permit from Billy Biggs.
23 * See: http://bugzilla.gnome.org/show_bug.cgi?id=163578
24 */
25
26 #ifdef HAVE_CONFIG_H
27 # include "config.h"
28 #endif
29
30 #include "gstdeinterlacemethod.h"
31 #include <string.h>
32 #ifdef HAVE_ORC
33 #include <orc/orc.h>
34 #endif
35 #include "tvtime.h"
36
37 #define GST_TYPE_DEINTERLACE_METHOD_LINEAR (gst_deinterlace_method_linear_get_type ())
38 #define GST_IS_DEINTERLACE_METHOD_LINEAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_DEINTERLACE_METHOD_LINEAR))
39 #define GST_IS_DEINTERLACE_METHOD_LINEAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_DEINTERLACE_METHOD_LINEAR))
40 #define GST_DEINTERLACE_METHOD_LINEAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_DEINTERLACE_METHOD_LINEAR, GstDeinterlaceMethodLinearClass))
41 #define GST_DEINTERLACE_METHOD_LINEAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_DEINTERLACE_METHOD_LINEAR, GstDeinterlaceMethodLinear))
42 #define GST_DEINTERLACE_METHOD_LINEAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_DEINTERLACE_METHOD_LINEAR, GstDeinterlaceMethodLinearClass))
43 #define GST_DEINTERLACE_METHOD_LINEAR_CAST(obj) ((GstDeinterlaceMethodLinear*)(obj))
44
45 GType gst_deinterlace_method_linear_get_type (void);
46
47 typedef GstDeinterlaceSimpleMethod GstDeinterlaceMethodLinear;
48 typedef GstDeinterlaceSimpleMethodClass GstDeinterlaceMethodLinearClass;
49
50 static void
deinterlace_scanline_linear_c(GstDeinterlaceSimpleMethod * self,guint8 * out,const guint8 * s1,const guint8 * s2,gint size)51 deinterlace_scanline_linear_c (GstDeinterlaceSimpleMethod * self,
52 guint8 * out, const guint8 * s1, const guint8 * s2, gint size)
53 {
54 deinterlace_line_linear (out, s1, s2, size);
55 }
56
57 static void
deinterlace_scanline_linear_packed_c(GstDeinterlaceSimpleMethod * self,guint8 * out,const GstDeinterlaceScanlineData * scanlines,guint size)58 deinterlace_scanline_linear_packed_c (GstDeinterlaceSimpleMethod * self,
59 guint8 * out, const GstDeinterlaceScanlineData * scanlines, guint size)
60 {
61 deinterlace_scanline_linear_c (self, out, scanlines->t0, scanlines->b0, size);
62 }
63
64 static void
deinterlace_scanline_linear_planar_y_c(GstDeinterlaceSimpleMethod * self,guint8 * out,const GstDeinterlaceScanlineData * scanlines,guint size)65 deinterlace_scanline_linear_planar_y_c (GstDeinterlaceSimpleMethod * self,
66 guint8 * out, const GstDeinterlaceScanlineData * scanlines, guint size)
67 {
68 deinterlace_scanline_linear_c (self, out, scanlines->t0, scanlines->b0, size);
69 }
70
71 static void
deinterlace_scanline_linear_planar_u_c(GstDeinterlaceSimpleMethod * self,guint8 * out,const GstDeinterlaceScanlineData * scanlines,guint size)72 deinterlace_scanline_linear_planar_u_c (GstDeinterlaceSimpleMethod * self,
73 guint8 * out, const GstDeinterlaceScanlineData * scanlines, guint size)
74 {
75 deinterlace_scanline_linear_c (self, out, scanlines->t0, scanlines->b0, size);
76 }
77
78 static void
deinterlace_scanline_linear_planar_v_c(GstDeinterlaceSimpleMethod * self,guint8 * out,const GstDeinterlaceScanlineData * scanlines,guint size)79 deinterlace_scanline_linear_planar_v_c (GstDeinterlaceSimpleMethod * self,
80 guint8 * out, const GstDeinterlaceScanlineData * scanlines, guint size)
81 {
82 deinterlace_scanline_linear_c (self, out, scanlines->t0, scanlines->b0, size);
83 }
84
85 G_DEFINE_TYPE (GstDeinterlaceMethodLinear, gst_deinterlace_method_linear,
86 GST_TYPE_DEINTERLACE_SIMPLE_METHOD);
87
88 static void
gst_deinterlace_method_linear_class_init(GstDeinterlaceMethodLinearClass * klass)89 gst_deinterlace_method_linear_class_init (GstDeinterlaceMethodLinearClass *
90 klass)
91 {
92 GstDeinterlaceMethodClass *dim_class = (GstDeinterlaceMethodClass *) klass;
93 GstDeinterlaceSimpleMethodClass *dism_class =
94 (GstDeinterlaceSimpleMethodClass *) klass;
95
96 dim_class->fields_required = 1;
97 dim_class->name = "Television: Full resolution";
98 dim_class->nick = "linear";
99 dim_class->latency = 0;
100
101 dism_class->interpolate_scanline_yuy2 = deinterlace_scanline_linear_packed_c;
102 dism_class->interpolate_scanline_yvyu = deinterlace_scanline_linear_packed_c;
103 dism_class->interpolate_scanline_uyvy = deinterlace_scanline_linear_packed_c;
104 dism_class->interpolate_scanline_ayuv = deinterlace_scanline_linear_packed_c;
105 dism_class->interpolate_scanline_argb = deinterlace_scanline_linear_packed_c;
106 dism_class->interpolate_scanline_abgr = deinterlace_scanline_linear_packed_c;
107 dism_class->interpolate_scanline_rgba = deinterlace_scanline_linear_packed_c;
108 dism_class->interpolate_scanline_bgra = deinterlace_scanline_linear_packed_c;
109 dism_class->interpolate_scanline_rgb = deinterlace_scanline_linear_packed_c;
110 dism_class->interpolate_scanline_bgr = deinterlace_scanline_linear_packed_c;
111 dism_class->interpolate_scanline_nv12 = deinterlace_scanline_linear_packed_c;
112 dism_class->interpolate_scanline_nv21 = deinterlace_scanline_linear_packed_c;
113 dism_class->interpolate_scanline_planar_y =
114 deinterlace_scanline_linear_planar_y_c;
115 dism_class->interpolate_scanline_planar_u =
116 deinterlace_scanline_linear_planar_u_c;
117 dism_class->interpolate_scanline_planar_v =
118 deinterlace_scanline_linear_planar_v_c;
119
120 }
121
122 static void
gst_deinterlace_method_linear_init(GstDeinterlaceMethodLinear * self)123 gst_deinterlace_method_linear_init (GstDeinterlaceMethodLinear * self)
124 {
125 }
126