summaryrefslogtreecommitdiffstats
path: root/gst/deinterlace2/tvtime/tomsmocomp.c
diff options
context:
space:
mode:
authorMartin Eikermann <meiker@upb.de>2008-06-11 11:12:14 +0000
committerSebastian Dröge <slomo@circular-chaos.org>2008-06-11 11:12:14 +0000
commit70ff21342117866ee939f9f7597ee487bae31757 (patch)
tree84c75fd8ce74451d34424c41a793e5462fb86a6b /gst/deinterlace2/tvtime/tomsmocomp.c
parenta14d311c96c21ae1c700917d4007ae0d3f9a02a8 (diff)
downloadgst-plugins-bad-70ff21342117866ee939f9f7597ee487bae31757.tar.gz
gst-plugins-bad-70ff21342117866ee939f9f7597ee487bae31757.tar.bz2
gst-plugins-bad-70ff21342117866ee939f9f7597ee487bae31757.zip
gst/deinterlace2/: Add a deinterlacer plugin based on the tvtime/DScaler deinterlacer, which was relicensed to LGPL f...
Original commit message from CVS: Based on a patch by: Martin Eikermann <meiker at upb dot de> * gst/deinterlace2/Makefile.am: * gst/deinterlace2/gstdeinterlace2.c: (gst_deinterlace2_method_get_type), (gst_deinterlace2_fields_get_type), (gst_deinterlace2_field_layout_get_type), (gst_deinterlace2_base_init), (gst_deinterlace2_class_init), (gst_deinterlace2_init), (gst_deinterlace2_set_method), (gst_deinterlace2_set_property), (gst_deinterlace2_get_property), (gst_deinterlace2_finalize), (gst_deinterlace2_pop_history), (gst_deinterlace2_head_history), (gst_deinterlace2_push_history), (gst_deinterlace2_deinterlace_scanlines), (gst_deinterlace2_chain), (gst_deinterlace2_setcaps), (gst_deinterlace2_sink_event), (gst_deinterlace2_change_state), (gst_deinterlace2_src_event), (gst_deinterlace2_src_query), (gst_deinterlace2_src_query_types), (plugin_init): * gst/deinterlace2/gstdeinterlace2.h: * gst/deinterlace2/tvtime/greedy.c: (copy_scanline), (deinterlace_greedy_packed422_scanline_mmxext), (dscaler_greedyl_get_method): * gst/deinterlace2/tvtime/greedyh.asm: * gst/deinterlace2/tvtime/greedyh.c: (deinterlace_frame_di_greedyh), (dscaler_greedyh_get_method), (greedyh_init), (greedyh_filter_mmx), (greedyh_filter_3dnow), (greedyh_filter_sse): * gst/deinterlace2/tvtime/greedyh.h: * gst/deinterlace2/tvtime/greedyhmacros.h: * gst/deinterlace2/tvtime/mmx.h: * gst/deinterlace2/tvtime/plugins.h: * gst/deinterlace2/tvtime/speedtools.h: * gst/deinterlace2/tvtime/speedy.c: (multiply_alpha), (clip255), (comb_factor_packed422_scanline_mmx), (diff_factor_packed422_scanline_c), (diff_factor_packed422_scanline_mmx), (diff_packed422_block8x8_mmx), (diff_packed422_block8x8_c), (packed444_to_packed422_scanline_c), (packed422_to_packed444_scanline_c), (packed422_to_packed444_rec601_scanline_c), (vfilter_chroma_121_packed422_scanline_mmx), (vfilter_chroma_121_packed422_scanline_c), (vfilter_chroma_332_packed422_scanline_mmx), (vfilter_chroma_332_packed422_scanline_c), (kill_chroma_packed422_inplace_scanline_mmx), (kill_chroma_packed422_inplace_scanline_c), (invert_colour_packed422_inplace_scanline_mmx), (invert_colour_packed422_inplace_scanline_c), (mirror_packed422_inplace_scanline_c), (interpolate_packed422_scanline_c), (convert_uyvy_to_yuyv_scanline_mmx), (convert_uyvy_to_yuyv_scanline_c), (interpolate_packed422_scanline_mmx), (interpolate_packed422_scanline_mmxext), (blit_colour_packed422_scanline_c), (blit_colour_packed422_scanline_mmx), (blit_colour_packed422_scanline_mmxext), (blit_colour_packed4444_scanline_c), (blit_colour_packed4444_scanline_mmx), (blit_colour_packed4444_scanline_mmxext), (small_memcpy), (speedy_memcpy_c), (speedy_memcpy_mmx), (speedy_memcpy_mmxext), (blit_packed422_scanline_c), (blit_packed422_scanline_mmx), (blit_packed422_scanline_mmxext), (composite_colour4444_alpha_to_packed422_scanline_c), (composite_colour4444_alpha_to_packed422_scanline_mmxext), (composite_packed4444_alpha_to_packed422_scanline_c), (composite_packed4444_alpha_to_packed422_scanline_mmxext), (composite_packed4444_to_packed422_scanline_c), (composite_packed4444_to_packed422_scanline_mmxext), (composite_alphamask_to_packed4444_scanline_c), (composite_alphamask_to_packed4444_scanline_mmxext), (composite_alphamask_alpha_to_packed4444_scanline_c), (premultiply_packed4444_scanline_c), (premultiply_packed4444_scanline_mmxext), (blend_packed422_scanline_c), (blend_packed422_scanline_mmxext), (quarter_blit_vertical_packed422_scanline_mmxext), (quarter_blit_vertical_packed422_scanline_c), (subpix_blit_vertical_packed422_scanline_c), (a8_subpix_blit_scanline_c), (myround), (init_RGB_to_YCbCr_tables), (init_YCbCr_to_RGB_tables), (rgb24_to_packed444_rec601_scanline_c), (rgba32_to_packed4444_rec601_scanline_c), (packed444_to_rgb24_rec601_scanline_c), (packed444_to_nonpremultiplied_packed4444_scanline_c), (aspect_adjust_packed4444_scanline_c), (setup_speedy_calls), (speedy_get_accel): * gst/deinterlace2/tvtime/speedy.h: * gst/deinterlace2/tvtime/sse.h: * gst/deinterlace2/tvtime/tomsmocomp.c: (Fieldcopy), (deinterlace_frame_di_tomsmocomp), (dscaler_tomsmocomp_get_method), (tomsmocomp_init), (tomsmocomp_filter_mmx), (tomsmocomp_filter_3dnow), (tomsmocomp_filter_sse): * gst/deinterlace2/tvtime/tomsmocomp.h: * gst/deinterlace2/tvtime/tomsmocomp/SearchLoop0A.inc: * gst/deinterlace2/tvtime/tomsmocomp/SearchLoopBottom.inc: * gst/deinterlace2/tvtime/tomsmocomp/SearchLoopEdgeA.inc: * gst/deinterlace2/tvtime/tomsmocomp/SearchLoopEdgeA8.inc: * gst/deinterlace2/tvtime/tomsmocomp/SearchLoopOddA.inc: * gst/deinterlace2/tvtime/tomsmocomp/SearchLoopOddA2.inc: * gst/deinterlace2/tvtime/tomsmocomp/SearchLoopOddA6.inc: * gst/deinterlace2/tvtime/tomsmocomp/SearchLoopOddAH.inc: * gst/deinterlace2/tvtime/tomsmocomp/SearchLoopOddAH2.inc: * gst/deinterlace2/tvtime/tomsmocomp/SearchLoopTop.inc: * gst/deinterlace2/tvtime/tomsmocomp/SearchLoopVA.inc: * gst/deinterlace2/tvtime/tomsmocomp/SearchLoopVAH.inc: * gst/deinterlace2/tvtime/tomsmocomp/StrangeBob.inc: * gst/deinterlace2/tvtime/tomsmocomp/TomsMoCompAll.inc: * gst/deinterlace2/tvtime/tomsmocomp/TomsMoCompAll2.inc: * gst/deinterlace2/tvtime/tomsmocomp/WierdBob.inc: * gst/deinterlace2/tvtime/vfir.c: (deinterlace_line), (deinterlace_scanline_vfir), (copy_scanline), (dscaler_vfir_get_method): * gst/deinterlace2/tvtime/x86-64_macros.inc: Add a deinterlacer plugin based on the tvtime/DScaler deinterlacer, which was relicensed to LGPL for GStreamer and in theory provides better and faster results than the simple deinterlace element. Fixes bug #163578. Ported to GStreamer 0.10 but still not enabled or included in the build system by default because of bad artefacts caused by a bug somewhere and as it can be only build on x86/amd64 ATM and requires special CFLAGS. Will be fixed soon.
Diffstat (limited to 'gst/deinterlace2/tvtime/tomsmocomp.c')
-rw-r--r--gst/deinterlace2/tvtime/tomsmocomp.c187
1 files changed, 187 insertions, 0 deletions
diff --git a/gst/deinterlace2/tvtime/tomsmocomp.c b/gst/deinterlace2/tvtime/tomsmocomp.c
new file mode 100644
index 00000000..f0b73677
--- /dev/null
+++ b/gst/deinterlace2/tvtime/tomsmocomp.c
@@ -0,0 +1,187 @@
+/**
+ * Copyright (C) 2004 Billy Biggs <vektor@dumbterm.net>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <stdint.h>
+#include <string.h>
+
+#include "gst/gst.h"
+#include "gstdeinterlace2.h"
+#include "plugins.h"
+#include "speedy.h"
+
+#include "tomsmocomp.h"
+#include "tomsmocomp/tomsmocompmacros.h"
+#include "x86-64_macros.inc"
+
+
+#define SearchEffortDefault 5
+#define UseStrangeBobDefault 0
+
+long SearchEffort;
+
+int UseStrangeBob;
+
+MEMCPY_FUNC *pMyMemcpy;
+
+int IsOdd;
+
+const unsigned char *pWeaveSrc;
+
+const unsigned char *pWeaveSrcP;
+
+unsigned char *pWeaveDest;
+
+const unsigned char *pCopySrc;
+
+const unsigned char *pCopySrcP;
+
+unsigned char *pCopyDest;
+
+int src_pitch;
+
+int dst_pitch;
+
+int rowsize;
+
+int height;
+
+int FldHeight;
+
+int
+Fieldcopy (void *dest, const void *src, size_t count,
+ int rows, int dst_pitch, int src_pitch)
+{
+ unsigned char *pDest = (unsigned char *) dest;
+
+ unsigned char *pSrc = (unsigned char *) src;
+
+ int i;
+
+ for (i = 0; i < rows; i++) {
+ pMyMemcpy (pDest, pSrc, count);
+ pSrc += src_pitch;
+ pDest += dst_pitch;
+ }
+ return 0;
+}
+
+
+#define IS_MMX
+#define SSE_TYPE MMX
+#define FUNCT_NAME tomsmocompDScaler_MMX
+#include "tomsmocomp/TomsMoCompAll.inc"
+#undef IS_MMX
+#undef SSE_TYPE
+#undef FUNCT_NAME
+
+#define IS_3DNOW
+#define SSE_TYPE 3DNOW
+#define FUNCT_NAME tomsmocompDScaler_3DNOW
+#include "tomsmocomp/TomsMoCompAll.inc"
+#undef IS_3DNOW
+#undef SSE_TYPE
+#undef FUNCT_NAME
+
+#define IS_SSE
+#define SSE_TYPE SSE
+#define FUNCT_NAME tomsmocompDScaler_SSE
+#include "tomsmocomp/TomsMoCompAll.inc"
+#undef IS_SSE
+#undef SSE_TYPE
+#undef FUNCT_NAME
+
+
+
+void
+deinterlace_frame_di_tomsmocomp (GstDeinterlace2 * object)
+{
+ if (object->cpu_feature_flags & OIL_IMPL_FLAG_SSE) {
+ tomsmocomp_filter_sse (object);
+ } else if (object->cpu_feature_flags & OIL_IMPL_FLAG_3DNOW) {
+ tomsmocomp_filter_3dnow (object);
+ } else {
+ tomsmocomp_filter_mmx (object);
+ }
+}
+
+static deinterlace_method_t tomsmocompmethod = {
+ 0, //DEINTERLACE_PLUGIN_API_VERSION,
+ "Motion Adaptive: Motion Search",
+ "AdaptiveSearch",
+ 4,
+ OIL_IMPL_FLAG_MMX,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ 0,
+ deinterlace_frame_di_tomsmocomp,
+ {"Uses heuristics to detect motion in the input",
+ "frames and reconstruct image detail where",
+ "possible. Use this for high quality output",
+ "even on monitors set to an arbitrary refresh",
+ "rate.",
+ "",
+ "Motion search mode finds and follows motion",
+ "vectors for accurate interpolation. This is",
+ "the TomsMoComp deinterlacer from DScaler.",
+ ""}
+};
+
+
+
+deinterlace_method_t *
+dscaler_tomsmocomp_get_method (void)
+{
+ tomsmocomp_init ();
+ return &tomsmocompmethod;
+}
+
+
+
+void
+tomsmocomp_init (void)
+{
+ SearchEffort = SearchEffortDefault;
+ UseStrangeBob = UseStrangeBobDefault;
+}
+
+void
+tomsmocomp_filter_mmx (GstDeinterlace2 * object)
+{
+ tomsmocompDScaler_MMX (object);
+}
+
+void
+tomsmocomp_filter_3dnow (GstDeinterlace2 * object)
+{
+ tomsmocompDScaler_3DNOW (object);
+}
+
+void
+tomsmocomp_filter_sse (GstDeinterlace2 * object)
+{
+ tomsmocompDScaler_SSE (object);
+}