[vlc-devel] [PATCH v3 2/2] video-filtering_sharpenning: remove SharpenCallback, precalc_table, and mutex

victorien.lecouviour.tuffet at gmail.com victorien.lecouviour.tuffet at gmail.com
Wed Apr 5 21:19:10 CEST 2017


From: Victorien Le Couviour--Tuffet <victorien.lecouviour.tuffet at gmail.com>

I removed those 'cause they weren't used.

---
 modules/video_filter/sharpen.c | 60 +-----------------------------------------
 1 file changed, 1 insertion(+), 59 deletions(-)

diff --git a/modules/video_filter/sharpen.c b/modules/video_filter/sharpen.c
index 6ca9020195..06566eca4c 100644
--- a/modules/video_filter/sharpen.c
+++ b/modules/video_filter/sharpen.c
@@ -53,8 +53,6 @@ static int  Create    ( vlc_object_t * );
 static void Destroy   ( vlc_object_t * );
 
 static picture_t *Filter( filter_t *, picture_t * );
-static int SharpenCallback( vlc_object_t *, char const *,
-                            vlc_value_t, vlc_value_t, void * );
 
 #define SHARPEN_HELP N_("Augment contrast between contours.")
 #define FILTER_PREFIX "sharpen-"
@@ -80,27 +78,6 @@ static const char *const ppsz_filter_options[] = {
 };
 
 /*****************************************************************************
- * filter_sys_t: Sharpen video filter descriptor
- *****************************************************************************
- * This structure is part of the video output thread descriptor.
- * It describes the Sharpen specific properties of an output thread.
- *****************************************************************************/
-
-struct filter_sys_t
-{
-    vlc_mutex_t lock;
-    int tab_precalc[512];
-};
-
-static void init_precalc_table(filter_sys_t *p_filter, float sigma)
-{
-    for(int i = 0; i < 512; ++i)
-    {
-        p_filter->tab_precalc[i] = (i - 256) * sigma;
-    }
-}
-
-/*****************************************************************************
  * Create: allocates Sharpen video thread output method
  *****************************************************************************
  * This function allocates and initializes a Sharpen vout method.
@@ -119,23 +96,11 @@ static int Create( vlc_object_t *p_this )
         return VLC_EGENERIC;
     }
 
-    /* Allocate structure */
-    p_filter->p_sys = malloc( sizeof( filter_sys_t ) );
-    if( p_filter->p_sys == NULL )
-        return VLC_ENOMEM;
-
     p_filter->pf_video_filter = Filter;
 
     config_ChainParse( p_filter, FILTER_PREFIX, ppsz_filter_options,
                    p_filter->p_cfg );
 
-    float sigma = var_CreateGetFloatCommand( p_filter, FILTER_PREFIX "sigma" );
-    init_precalc_table(p_filter->p_sys, sigma);
-
-    vlc_mutex_init( &p_filter->p_sys->lock );
-    var_AddCallback( p_filter, FILTER_PREFIX "sigma",
-                     SharpenCallback, p_filter->p_sys );
-
     return VLC_SUCCESS;
 }
 
@@ -147,12 +112,7 @@ static int Create( vlc_object_t *p_this )
  *****************************************************************************/
 static void Destroy( vlc_object_t *p_this )
 {
-    filter_t *p_filter = (filter_t *)p_this;
-    filter_sys_t *p_sys = p_filter->p_sys;
-
-    var_DelCallback( p_filter, FILTER_PREFIX "sigma", SharpenCallback, p_sys );
-    vlc_mutex_destroy( &p_sys->lock );
-    free( p_sys );
+    (void)p_this;
 }
 
 /*****************************************************************************
@@ -218,9 +178,6 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic )
         return NULL;
     }
 
-    /* perform convolution only on Y plane. Avoid border line. */
-    vlc_mutex_lock( &p_filter->p_sys->lock );
-
     if (!IS_YUV_420_10BITS(p_pic->format.i_chroma))
     {
         typedef uint8_t data_t;
@@ -234,23 +191,8 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic )
         SHARPEN_FRAME(1023);
     }
 
-    vlc_mutex_unlock( &p_filter->p_sys->lock );
-
     plane_CopyPixels( &p_outpic->p[U_PLANE], &p_pic->p[U_PLANE] );
     plane_CopyPixels( &p_outpic->p[V_PLANE], &p_pic->p[V_PLANE] );
 
     return CopyInfoAndRelease( p_outpic, p_pic );
 }
-
-static int SharpenCallback( 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); VLC_UNUSED(psz_var);
-    filter_sys_t *p_sys = (filter_sys_t *)p_data;
-
-    vlc_mutex_lock( &p_sys->lock );
-    init_precalc_table( p_sys,  VLC_CLIP( newval.f_float, 0.f, 2.f ) );
-    vlc_mutex_unlock( &p_sys->lock );
-    return VLC_SUCCESS;
-}
-- 
2.12.0



More information about the vlc-devel mailing list