[vlc-commits] sharpen: remove SharpenCallback, precalc_table, and mutex

Victorien Le Couviour--Tuffet git at videolan.org
Mon Apr 10 16:33:57 CEST 2017


vlc | branch: master | Victorien Le Couviour--Tuffet <victorien.lecouviour.tuffet at gmail.com> | Wed Apr  5 21:19:10 2017 +0200| [d04581b3deec3afc3bd757438252d0ea9aa10e1b] | committer: Thomas Guillem

sharpen: remove SharpenCallback, precalc_table, and mutex

tab_precalc that is set from the callback is not used since
32466e668505f25097e2811a563a19d16de5fbb7

Signed-off-by: Thomas Guillem <thomas at gllm.fr>

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

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

diff --git a/modules/video_filter/sharpen.c b/modules/video_filter/sharpen.c
index 6ca9020195..0f51ed6535 100644
--- a/modules/video_filter/sharpen.c
+++ b/modules/video_filter/sharpen.c
@@ -50,11 +50,8 @@
  * Local prototypes
  *****************************************************************************/
 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-"
@@ -72,7 +69,7 @@ vlc_module_begin ()
     add_float_with_range( "sharpen-sigma", 0.05, 0.0, 2.0,
         SIG_TEXT, SIG_LONGTEXT, false )
     add_shortcut( "sharpen" )
-    set_callbacks( Create, Destroy )
+    set_callbacks( Create, NULL )
 vlc_module_end ()
 
 static const char *const ppsz_filter_options[] = {
@@ -80,27 +77,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,42 +95,14 @@ 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;
 }
 
-
-/*****************************************************************************
- * Destroy: destroy Sharpen video thread output method
- *****************************************************************************
- * Terminate an output method created by SharpenCreateOutputMethod
- *****************************************************************************/
-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 );
-}
-
 /*****************************************************************************
  * Render: displays previously rendered output
  *****************************************************************************
@@ -218,9 +166,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 +179,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;
-}



More information about the vlc-commits mailing list