[vlc-commits] hqdn3d: allow live modification of params

Jean-Baptiste Kempf git at videolan.org
Sun Sep 29 19:36:37 CEST 2013


vlc | branch: master | Jean-Baptiste Kempf <jb at videolan.org> | Sun Sep 29 19:31:05 2013 +0200| [2ec43b29667c1c814f1ff793db25d9f94cf872f8] | committer: Jean-Baptiste Kempf

hqdn3d: allow live modification of params

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=2ec43b29667c1c814f1ff793db25d9f94cf872f8
---

 modules/video_filter/hqdn3d.c |   29 +++++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)

diff --git a/modules/video_filter/hqdn3d.c b/modules/video_filter/hqdn3d.c
index a332cc2..0899388 100644
--- a/modules/video_filter/hqdn3d.c
+++ b/modules/video_filter/hqdn3d.c
@@ -43,6 +43,9 @@
 static int  Open         (vlc_object_t *);
 static void Close        (vlc_object_t *);
 static picture_t *Filter (filter_t *, picture_t *);
+static int DenoiseCallback( vlc_object_t *p_this, char const *psz_var,
+                            vlc_value_t oldval, vlc_value_t newval,
+                            void *p_data );
 
 /*****************************************************************************
  * Module descriptor
@@ -162,6 +165,11 @@ static int Open(vlc_object_t *this)
     PrecalcCoefs(cfg->Coefs[2], sys->chroma_spat);
     PrecalcCoefs(cfg->Coefs[3], sys->chroma_temp);
 
+    var_AddCallback( filter, FILTER_PREFIX "luma-spat", DenoiseCallback, cfg );
+    var_AddCallback( filter, FILTER_PREFIX "chroma-spat", DenoiseCallback, cfg );
+    var_AddCallback( filter, FILTER_PREFIX "luma-temp", DenoiseCallback, cfg );
+    var_AddCallback( filter, FILTER_PREFIX "chroma-temp", DenoiseCallback, cfg );
+
     return VLC_SUCCESS;
 }
 
@@ -219,3 +227,24 @@ static picture_t *Filter(filter_t *filter, picture_t *src)
 
     return CopyInfoAndRelease(dst, src);
 }
+
+
+static int DenoiseCallback( vlc_object_t *p_this, char const *psz_var,
+                            vlc_value_t oldval, vlc_value_t newval,
+                            void *p_data )
+{
+    VLC_UNUSED(p_this); VLC_UNUSED(oldval);
+
+    struct vf_priv_s *cfg = (struct vf_priv_s *)p_data;
+
+    if( !strcmp( psz_var, FILTER_PREFIX "luma-spat" ) )
+        PrecalcCoefs(cfg->Coefs[0], newval.f_float);
+    else if( !strcmp( psz_var, FILTER_PREFIX "luma-temp" ) )
+        PrecalcCoefs(cfg->Coefs[1], newval.f_float);
+    else if( !strcmp( psz_var, FILTER_PREFIX "chroma-spat") )
+        PrecalcCoefs(cfg->Coefs[2], newval.f_float);
+    else if( !strcmp( psz_var, FILTER_PREFIX "chroma-temp") )
+        PrecalcCoefs(cfg->Coefs[3], newval.f_float);
+
+    return VLC_SUCCESS;
+}



More information about the vlc-commits mailing list