2 * Weave frames, top-field-first.
3 * Copyright (C) 2003 Billy Biggs <vektor@dumbterm.net>.
4 * Copyright (C) 2008,2010 Sebastian Dröge <sebastian.droege@collabora.co.uk>
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the
18 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19 * Boston, MA 02111-1307, USA.
23 * Relicensed for GStreamer from GPL to LGPL with permit from Billy Biggs.
24 * See: http://bugzilla.gnome.org/show_bug.cgi?id=163578
32 #include "gstdeinterlacemethod.h"
35 #define GST_TYPE_DEINTERLACE_METHOD_WEAVE_TFF (gst_deinterlace_method_weave_tff_get_type ())
36 #define GST_IS_DEINTERLACE_METHOD_WEAVE_TFF(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_DEINTERLACE_METHOD_WEAVE_TFF))
37 #define GST_IS_DEINTERLACE_METHOD_WEAVE_TFF_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_DEINTERLACE_METHOD_WEAVE_TFF))
38 #define GST_DEINTERLACE_METHOD_WEAVE_TFF_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_DEINTERLACE_METHOD_WEAVE_TFF, GstDeinterlaceMethodWeaveTFFClass))
39 #define GST_DEINTERLACE_METHOD_WEAVE_TFF(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_DEINTERLACE_METHOD_WEAVE_TFF, GstDeinterlaceMethodWeaveTFF))
40 #define GST_DEINTERLACE_METHOD_WEAVE_TFF_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_DEINTERLACE_METHOD_WEAVE_TFF, GstDeinterlaceMethodWeaveTFFClass))
41 #define GST_DEINTERLACE_METHOD_WEAVE_TFF_CAST(obj) ((GstDeinterlaceMethodWeaveTFF*)(obj))
43 GType gst_deinterlace_method_weave_tff_get_type (void);
45 typedef GstDeinterlaceSimpleMethod GstDeinterlaceMethodWeaveTFF;
46 typedef GstDeinterlaceSimpleMethodClass GstDeinterlaceMethodWeaveTFFClass;
49 deinterlace_scanline_weave_packed (GstDeinterlaceSimpleMethod * self,
50 guint8 * out, const GstDeinterlaceScanlineData * scanlines)
52 memcpy (out, scanlines->m1, self->parent.row_stride[0]);
56 deinterlace_scanline_weave_planar_y (GstDeinterlaceSimpleMethod * self,
57 guint8 * out, const GstDeinterlaceScanlineData * scanlines)
59 memcpy (out, scanlines->m1, self->parent.row_stride[0]);
63 deinterlace_scanline_weave_planar_u (GstDeinterlaceSimpleMethod * self,
64 guint8 * out, const GstDeinterlaceScanlineData * scanlines)
66 memcpy (out, scanlines->m1, self->parent.row_stride[1]);
70 deinterlace_scanline_weave_planar_v (GstDeinterlaceSimpleMethod * self,
71 guint8 * out, const GstDeinterlaceScanlineData * scanlines)
73 memcpy (out, scanlines->m1, self->parent.row_stride[2]);
77 copy_scanline_packed (GstDeinterlaceSimpleMethod * self,
78 guint8 * out, const GstDeinterlaceScanlineData * scanlines)
80 /* FIXME: original code used m2 and m0 but this looks really bad */
81 if (scanlines->bottom_field) {
82 memcpy (out, scanlines->bb0, self->parent.row_stride[0]);
84 memcpy (out, scanlines->bb2, self->parent.row_stride[0]);
89 copy_scanline_planar_y (GstDeinterlaceSimpleMethod * self,
90 guint8 * out, const GstDeinterlaceScanlineData * scanlines)
92 /* FIXME: original code used m2 and m0 but this looks really bad */
93 if (scanlines->bottom_field) {
94 memcpy (out, scanlines->bb0, self->parent.row_stride[0]);
96 memcpy (out, scanlines->bb2, self->parent.row_stride[0]);
101 copy_scanline_planar_u (GstDeinterlaceSimpleMethod * self,
102 guint8 * out, const GstDeinterlaceScanlineData * scanlines)
104 /* FIXME: original code used m2 and m0 but this looks really bad */
105 if (scanlines->bottom_field) {
106 memcpy (out, scanlines->bb0, self->parent.row_stride[1]);
108 memcpy (out, scanlines->bb2, self->parent.row_stride[1]);
113 copy_scanline_planar_v (GstDeinterlaceSimpleMethod * self,
114 guint8 * out, const GstDeinterlaceScanlineData * scanlines)
116 /* FIXME: original code used m2 and m0 but this looks really bad */
117 if (scanlines->bottom_field) {
118 memcpy (out, scanlines->bb0, self->parent.row_stride[2]);
120 memcpy (out, scanlines->bb2, self->parent.row_stride[2]);
124 G_DEFINE_TYPE (GstDeinterlaceMethodWeaveTFF, gst_deinterlace_method_weave_tff,
125 GST_TYPE_DEINTERLACE_SIMPLE_METHOD);
128 gst_deinterlace_method_weave_tff_class_init (GstDeinterlaceMethodWeaveTFFClass *
131 GstDeinterlaceMethodClass *dim_class = (GstDeinterlaceMethodClass *) klass;
132 GstDeinterlaceSimpleMethodClass *dism_class =
133 (GstDeinterlaceSimpleMethodClass *) klass;
135 dim_class->fields_required = 3;
136 dim_class->name = "Progressive: Top Field First";
137 dim_class->nick = "weavetff";
138 dim_class->latency = 0;
140 dism_class->interpolate_scanline_ayuv = deinterlace_scanline_weave_packed;
141 dism_class->interpolate_scanline_yuy2 = deinterlace_scanline_weave_packed;
142 dism_class->interpolate_scanline_yvyu = deinterlace_scanline_weave_packed;
143 dism_class->interpolate_scanline_uyvy = deinterlace_scanline_weave_packed;
144 dism_class->interpolate_scanline_nv12 = deinterlace_scanline_weave_packed;
145 dism_class->interpolate_scanline_nv21 = deinterlace_scanline_weave_packed;
146 dism_class->interpolate_scanline_argb = deinterlace_scanline_weave_packed;
147 dism_class->interpolate_scanline_abgr = deinterlace_scanline_weave_packed;
148 dism_class->interpolate_scanline_rgba = deinterlace_scanline_weave_packed;
149 dism_class->interpolate_scanline_bgra = deinterlace_scanline_weave_packed;
150 dism_class->interpolate_scanline_rgb = deinterlace_scanline_weave_packed;
151 dism_class->interpolate_scanline_bgr = deinterlace_scanline_weave_packed;
152 dism_class->interpolate_scanline_planar_y =
153 deinterlace_scanline_weave_planar_y;
154 dism_class->interpolate_scanline_planar_u =
155 deinterlace_scanline_weave_planar_u;
156 dism_class->interpolate_scanline_planar_v =
157 deinterlace_scanline_weave_planar_v;
159 dism_class->copy_scanline_ayuv = copy_scanline_packed;
160 dism_class->copy_scanline_yuy2 = copy_scanline_packed;
161 dism_class->copy_scanline_yvyu = copy_scanline_packed;
162 dism_class->copy_scanline_uyvy = copy_scanline_packed;
163 dism_class->copy_scanline_nv12 = copy_scanline_packed;
164 dism_class->copy_scanline_nv21 = copy_scanline_packed;
165 dism_class->copy_scanline_argb = copy_scanline_packed;
166 dism_class->copy_scanline_abgr = copy_scanline_packed;
167 dism_class->copy_scanline_rgba = copy_scanline_packed;
168 dism_class->copy_scanline_bgra = copy_scanline_packed;
169 dism_class->copy_scanline_rgb = copy_scanline_packed;
170 dism_class->copy_scanline_bgr = copy_scanline_packed;
171 dism_class->copy_scanline_planar_y = copy_scanline_planar_y;
172 dism_class->copy_scanline_planar_u = copy_scanline_planar_u;
173 dism_class->copy_scanline_planar_v = copy_scanline_planar_v;
177 gst_deinterlace_method_weave_tff_init (GstDeinterlaceMethodWeaveTFF * self)