From df4e712ca2489a70360f672f95c12af92a8ec100 Mon Sep 17 00:00:00 2001 From: Julien Isorce Date: Thu, 25 Jun 2009 01:30:44 +0200 Subject: [PATCH] [354/906] fix and add gldeinterlace filter to the builds --- gst/gl/CMakeLists.txt | 1 + gst/gl/Makefile.am | 2 ++ gst/gl/gstgldeinterlace.c | 18 +++++++++--------- gst/gl/gstopengl.c | 8 +++++++- 4 files changed, 19 insertions(+), 10 deletions(-) diff --git a/gst/gl/CMakeLists.txt b/gst/gl/CMakeLists.txt index 84808097b2..c8481b1184 100644 --- a/gst/gl/CMakeLists.txt +++ b/gst/gl/CMakeLists.txt @@ -37,6 +37,7 @@ add_library (gstopengl SHARED gltestsrc.c gstgltestsrc.c gstgloverlay.c + gstgldeinterlace.c gstgldifferencematte.c gstglbumper.c gstgleffects.c diff --git a/gst/gl/Makefile.am b/gst/gl/Makefile.am index 10624a343d..6f1f3017e6 100644 --- a/gst/gl/Makefile.am +++ b/gst/gl/Makefile.am @@ -26,6 +26,8 @@ libgstopengl_la_SOURCES = \ gstglfilterapp.h \ gstglcolorscale.c \ gstglcolorscale.h \ + gstgldeinterlace.c \ + gstgldeinterlace.h \ gstgldifferencematte.c \ gstgloverlay.c \ gltestsrc.c \ diff --git a/gst/gl/gstgldeinterlace.c b/gst/gl/gstgldeinterlace.c index da1c5451b8..c96d4ae0a4 100644 --- a/gst/gl/gstgldeinterlace.c +++ b/gst/gl/gstgldeinterlace.c @@ -151,12 +151,12 @@ static const gchar *greedyh_fragment_source = "" "" //STEP 3 " vec3 mov;\n" - " mov.r = 256.0 * min(max(abs(L2.r - LP2.r) - motion_threshold, 0.0) * motion_sense, 1.0);\n" //no equivalent to 256 so we put 1.0 * 256.0 - " last.r = (last.r * (256.0 - mov.r) + avg_sc.r * mov.r) / 256.0;\n" - " mov.g = 256.0 * min(max(abs(L2.g - LP2.g) - motion_threshold, 0.0) * motion_sense, 1.0);\n" - " last.g = (last.g * (256.0 - mov.g) + avg_sc.g * mov.g) / 256.0;\n" - " mov.b = 256.0 * min(max(abs(L2.b - LP2.b) - motion_threshold, 0.0) * motion_sense, 1.0);\n" - " last.b = (last.b * (256.0 - mov.b) + avg_sc.b * mov.b) / 256.0;\n" + " mov.r = min(max(abs(L2.r - LP2.r) - motion_threshold, 0.0) * motion_sense, 1.0);\n" + " last.r = (last.r * (1.0 - mov.r) + avg_sc.r * mov.r);\n" + " mov.g = min(max(abs(L2.g - LP2.g) - motion_threshold, 0.0) * motion_sense, 1.0);\n" + " last.g = (last.g * (1.0 - mov.g) + avg_sc.g * mov.g);\n" + " mov.b = min(max(abs(L2.b - LP2.b) - motion_threshold, 0.0) * motion_sense, 1.0);\n" + " last.b = last.b * (1.0 - mov.b) + avg_sc.b * mov.b;\n" "" " gl_FragColor = vec4(last, 1.0);\n" " }\n" @@ -289,9 +289,9 @@ gst_gl_deinterlace_callback (gint width, gint height, guint texture, gst_gl_shader_set_uniform_1i (deinterlace_filter->shader, "tex", 0); glBindTexture (GL_TEXTURE_RECTANGLE_ARB, texture); - gst_gl_shader_set_uniform_1f (deinterlace_filter->shader, "max_comb", 5.0/255.0); - gst_gl_shader_set_uniform_1f (deinterlace_filter->shader, "motion_threshold", 25.0/255.0); - gst_gl_shader_set_uniform_1f (deinterlace_filter->shader, "motion_sense", 30.0/255.0); + gst_gl_shader_set_uniform_1f (deinterlace_filter->shader, "max_comb", 5.0f/255.0f); + gst_gl_shader_set_uniform_1f (deinterlace_filter->shader, "motion_threshold", 25.0f/255.0f); + gst_gl_shader_set_uniform_1f (deinterlace_filter->shader, "motion_sense", 30.0f/255.0f); gst_gl_shader_set_uniform_1i (deinterlace_filter->shader, "width", filter->width); gst_gl_shader_set_uniform_1i (deinterlace_filter->shader, "height", filter->height); diff --git a/gst/gl/gstopengl.c b/gst/gl/gstopengl.c index edc99493ba..0adb5c1b10 100644 --- a/gst/gl/gstopengl.c +++ b/gst/gl/gstopengl.c @@ -57,14 +57,15 @@ GType gst_gl_filter_cube_get_type (void); #include "gstglfilterglass.h" #include "gstglfilterapp.h" #include "gstglcolorscale.h" +#include "gstgldeinterlace.h" #include "gstgleffects.h" #include "gstglbumper.h" GType gst_gl_effects_get_type (void); +GType gst_gl_deinterlace_get_type (void); GType gst_gl_filter_app_get_type (void); GType gst_gl_filterblur_get_type (void); GType gst_gl_filtersobel_get_type (void); -GType gst_gl_filter_edge_get_type (void); GType gst_gl_filter_laplacian_get_type (void); GType gst_gl_filter_glass_get_type (void); GType gst_gl_overlay_get_type (void); @@ -150,6 +151,11 @@ plugin_init (GstPlugin * plugin) return FALSE; } + if (!gst_element_register (plugin, "gldeinterlace", + GST_RANK_NONE, GST_TYPE_GL_DEINTERLACE)) { + return FALSE; + } + if (!gst_element_register (plugin, "glcolorscale", GST_RANK_NONE, GST_TYPE_GL_COLORSCALE)) { return FALSE;