[vlc-commits] [Git][videolan/vlc][master] filter: avoid casting void* to/from p_sys

Jean-Baptiste Kempf (@jbk) gitlab at videolan.org
Sat Feb 11 20:21:33 UTC 2023



Jean-Baptiste Kempf pushed to branch master at VideoLAN / VLC


Commits:
4acab97b by Steve Lhomme at 2023-02-11T13:19:46+00:00
filter: avoid casting void* to/from p_sys

The p_sys has been a void since 4c8b741e4844a80fb824caccd9606259d5958aa0

- - - - -


29 changed files:

- modules/audio_filter/channel_mixer/mono.c
- modules/audio_filter/channel_mixer/remap.c
- modules/audio_filter/channel_mixer/simple.c
- modules/audio_filter/chorus_flanger.c
- modules/audio_filter/resampler/speex.c
- modules/audio_filter/resampler/src.c
- modules/audio_filter/stereo_pan.c
- modules/audio_filter/stereo_widen.c
- modules/hw/d3d11/d3d11_filters.c
- modules/hw/d3d9/d3d9_filters.c
- modules/hw/d3d9/dxa9.c
- modules/spu/dynamicoverlay/dynamicoverlay.c
- modules/spu/logo.c
- modules/spu/marq.c
- modules/spu/mosaic.c
- modules/spu/subsdelay.c
- modules/video_filter/antiflicker.c
- modules/video_filter/ball.c
- modules/video_filter/bluescreen.c
- modules/video_filter/canvas.c
- modules/video_filter/croppadd.c
- modules/video_filter/erase.c
- modules/video_filter/extract.c
- modules/video_filter/gradient.c
- modules/video_filter/hqdn3d.c
- modules/video_filter/motionblur.c
- modules/video_filter/puzzle/puzzle.c
- modules/video_filter/scene.c
- modules/video_filter/sharpen.c


Changes:

=====================================
modules/audio_filter/channel_mixer/mono.c
=====================================
@@ -482,7 +482,7 @@ static block_t *Convert( filter_t *p_filter, block_t *p_block )
 static void stereo2mono_downmix( filter_t * p_filter,
                                  block_t * p_in_buf, block_t * p_out_buf )
 {
-    filter_sys_t *p_sys = (filter_sys_t *)p_filter->p_sys;
+    filter_sys_t *p_sys = p_filter->p_sys;
 
     int i_input_nb = aout_FormatNbChannels( &p_filter->fmt_in.audio );
     int i_output_nb = aout_FormatNbChannels( &p_filter->fmt_out.audio );
@@ -585,7 +585,7 @@ static void stereo2mono_downmix( filter_t * p_filter,
 static unsigned int mono( filter_t *p_filter,
                           block_t *p_output, block_t *p_input )
 {
-    filter_sys_t *p_sys = (filter_sys_t *)p_filter->p_sys;
+    filter_sys_t *p_sys = p_filter->p_sys;
     int16_t *p_in, *p_out;
     unsigned int n = 0, r = 0;
 
@@ -605,7 +605,7 @@ static unsigned int mono( filter_t *p_filter,
 static unsigned int stereo_to_mono( filter_t *p_filter,
                                     block_t *p_output, block_t *p_input )
 {
-    filter_sys_t *p_sys = (filter_sys_t *)p_filter->p_sys;
+    filter_sys_t *p_sys = p_filter->p_sys;
     int16_t *p_in, *p_out;
     unsigned int n;
 


=====================================
modules/audio_filter/channel_mixer/remap.c
=====================================
@@ -167,7 +167,7 @@ static void RemapCopy##name( filter_t *p_filter, \
                     int i_nb_samples, \
                     unsigned i_nb_in_channels, unsigned i_nb_out_channels ) \
 { \
-    filter_sys_t *p_sys = ( filter_sys_t * )p_filter->p_sys; \
+    filter_sys_t *p_sys = p_filter->p_sys; \
     const type *p_src = p_srcorig; \
     type *p_dest = p_destorig; \
  \
@@ -191,7 +191,7 @@ static void RemapAdd##name( filter_t *p_filter, \
                     int i_nb_samples, \
                     unsigned i_nb_in_channels, unsigned i_nb_out_channels ) \
 { \
-    filter_sys_t *p_sys = ( filter_sys_t * )p_filter->p_sys; \
+    filter_sys_t *p_sys = p_filter->p_sys; \
     const type *p_src = p_srcorig; \
     type *p_dest = p_destorig; \
  \
@@ -378,7 +378,7 @@ static int OpenFilter( vlc_object_t *p_this )
  *****************************************************************************/
 static block_t *Remap( filter_t *p_filter, block_t *p_block )
 {
-    filter_sys_t *p_sys = (filter_sys_t *)p_filter->p_sys;
+    filter_sys_t *p_sys = p_filter->p_sys;
     if( !p_block || !p_block->i_nb_samples )
     {
         if( p_block )


=====================================
modules/audio_filter/channel_mixer/simple.c
=====================================
@@ -357,7 +357,7 @@ static int OpenFilter( vlc_object_t *p_this )
  *****************************************************************************/
 static block_t *Filter( filter_t *p_filter, block_t *p_block )
 {
-    void (*work)(filter_t *, block_t *, block_t *) = (void *)p_filter->p_sys;
+    void (*work)(filter_t *, block_t *, block_t *) = p_filter->p_sys;
 
     if( !p_block || !p_block->i_nb_samples )
     {


=====================================
modules/audio_filter/chorus_flanger.c
=====================================
@@ -335,7 +335,7 @@ static int paramCallback( vlc_object_t *p_this, char const *psz_var,
                           vlc_value_t oldval, vlc_value_t newval, void *p_data )
 {
     filter_t *p_filter = (filter_t *)p_this;
-    filter_sys_t *p_sys = (filter_sys_t *) p_data;
+    filter_sys_t *p_sys = p_data;
 
     if( !strncmp( psz_var, "delay-time", 10 ) )
     {


=====================================
modules/audio_filter/resampler/speex.c
=====================================
@@ -112,14 +112,14 @@ static int Open (vlc_object_t *obj)
 
 static void Close (filter_t *filter)
 {
-    SpeexResamplerState *st = (SpeexResamplerState *)filter->p_sys;
+    SpeexResamplerState *st = filter->p_sys;
 
     speex_resampler_destroy (st);
 }
 
 static block_t *Resample (filter_t *filter, block_t *in)
 {
-    SpeexResamplerState *st = (SpeexResamplerState *)filter->p_sys;
+    SpeexResamplerState *st = filter->p_sys;
 
     const size_t framesize = filter->fmt_out.audio.i_bytes_per_frame;
     const unsigned irate = filter->fmt_in.audio.i_rate;


=====================================
modules/audio_filter/resampler/src.c
=====================================
@@ -114,7 +114,7 @@ static int OpenResampler (vlc_object_t *obj)
 
 static void Close (filter_t *filter)
 {
-    SRC_STATE *s = (SRC_STATE *)filter->p_sys;
+    SRC_STATE *s = filter->p_sys;
 
     src_delete (s);
 }
@@ -124,7 +124,7 @@ static block_t *Resample (filter_t *filter, block_t *in)
     block_t *out = NULL;
     const size_t framesize = filter->fmt_out.audio.i_bytes_per_frame;
 
-    SRC_STATE *s = (SRC_STATE *)filter->p_sys;
+    SRC_STATE *s = filter->p_sys;
     SRC_DATA src;
 
     src.src_ratio = (double)filter->fmt_out.audio.i_rate


=====================================
modules/audio_filter/stereo_pan.c
=====================================
@@ -60,7 +60,7 @@ static int paramCallback( vlc_object_t *p_this, char const *psz_var,
                           vlc_value_t oldval, vlc_value_t newval,
                           void *p_data)
 {
-    filter_sys_t *p_sys = (filter_sys_t *) p_data;
+    filter_sys_t *p_sys = p_data;
 
     VLC_UNUSED(oldval);
     VLC_UNUSED(p_this);


=====================================
modules/audio_filter/stereo_widen.c
=====================================
@@ -224,7 +224,7 @@ static int paramCallback( vlc_object_t *p_this, char const *psz_var,
                             void *p_data )
 {
     filter_t *p_filter = (filter_t *)p_this;
-    filter_sys_t *p_sys = (filter_sys_t *) p_data;
+    filter_sys_t *p_sys = p_data;
 
     VLC_UNUSED(oldval);
     VLC_UNUSED(p_this);


=====================================
modules/hw/d3d11/d3d11_filters.c
=====================================
@@ -317,7 +317,7 @@ static int AdjustCallback( vlc_object_t *p_this, char const *psz_var,
                            void *p_data )
 {
     VLC_UNUSED(p_this); VLC_UNUSED(oldval);
-    filter_sys_t *p_sys = (filter_sys_t *)p_data;
+    filter_sys_t *p_sys = p_data;
 
     if( !strcmp( psz_var, "contrast" ) )
         SetLevel( &p_sys->Contrast, newval.f_float );


=====================================
modules/hw/d3d9/d3d9_filters.c
=====================================
@@ -240,7 +240,7 @@ static int AdjustCallback( vlc_object_t *p_this, char const *psz_var,
                            void *p_data )
 {
     VLC_UNUSED(p_this); VLC_UNUSED(oldval);
-    filter_sys_t *p_sys = (filter_sys_t *)p_data;
+    filter_sys_t *p_sys = p_data;
 
     if( !strcmp( psz_var, "contrast" ) )
         SetLevel( &p_sys->Contrast, newval.f_float );


=====================================
modules/hw/d3d9/dxa9.c
=====================================
@@ -68,7 +68,7 @@ static bool GetLock(filter_t *p_filter, IDirect3DSurface9 *d3d,
 
 static void DXA9_YV12(filter_t *p_filter, picture_t *src, picture_t *dst)
 {
-    copy_cache_t *p_copy_cache = (copy_cache_t*) p_filter->p_sys;
+    copy_cache_t *p_copy_cache = p_filter->p_sys;
     picture_sys_d3d9_t *p_sys = ActiveD3D9PictureSys(src);
 
     D3DSURFACE_DESC desc;
@@ -138,7 +138,7 @@ static void DXA9_YV12(filter_t *p_filter, picture_t *src, picture_t *dst)
 
 static void DXA9_NV12(filter_t *p_filter, picture_t *src, picture_t *dst)
 {
-    copy_cache_t *p_copy_cache = (copy_cache_t*) p_filter->p_sys;
+    copy_cache_t *p_copy_cache = p_filter->p_sys;
     picture_sys_d3d9_t *p_sys = ActiveD3D9PictureSys(src);
 
     D3DSURFACE_DESC desc;


=====================================
modules/spu/dynamicoverlay/dynamicoverlay.c
=====================================
@@ -383,7 +383,7 @@ static int AdjustCallback( vlc_object_t *p_this, char const *psz_var,
                            vlc_value_t oldval, vlc_value_t newval,
                            void *p_data )
 {
-    filter_sys_t *p_sys = (filter_sys_t *)p_data;
+    filter_sys_t *p_sys = p_data;
     VLC_UNUSED(p_this); VLC_UNUSED(oldval);
 
     vlc_mutex_lock( &p_sys->lock );


=====================================
modules/spu/logo.c
=====================================
@@ -540,7 +540,7 @@ static int LogoCallback( vlc_object_t *p_this, char const *psz_var,
                          vlc_value_t oldval, vlc_value_t newval, void *p_data )
 {
     VLC_UNUSED(oldval);
-    filter_sys_t *p_sys = (filter_sys_t *)p_data;
+    filter_sys_t *p_sys = p_data;
     logo_list_t *p_list = &p_sys->list;
 
     vlc_mutex_lock( &p_sys->lock );


=====================================
modules/spu/marq.c
=====================================
@@ -355,7 +355,7 @@ static int MarqueeCallback( vlc_object_t *p_this, char const *psz_var,
                             vlc_value_t oldval, vlc_value_t newval,
                             void *p_data )
 {
-    filter_sys_t *p_sys = (filter_sys_t *) p_data;
+    filter_sys_t *p_sys = p_data;
 
     VLC_UNUSED(oldval);
     VLC_UNUSED(p_this);


=====================================
modules/spu/mosaic.c
=====================================
@@ -740,7 +740,7 @@ static int MosaicCallback( vlc_object_t *p_this, char const *psz_var,
                             void *p_data )
 {
     VLC_UNUSED(oldval);
-    filter_sys_t *p_sys = (filter_sys_t *) p_data;
+    filter_sys_t *p_sys = p_data;
 
 #define VAR_IS( a ) !strcmp( psz_var, CFG_PREFIX a )
     if( VAR_IS( "alpha" ) )


=====================================
modules/spu/subsdelay.c
=====================================
@@ -303,7 +303,7 @@ static int SubsdelayCreate( filter_t *p_filter )
     filter_sys_t *p_sys;
 
     /* allocate structure */
-    p_sys = (filter_sys_t*) malloc( sizeof(filter_sys_t) );
+    p_sys = malloc( sizeof(filter_sys_t) );
 
     if( !p_sys )
     {
@@ -446,7 +446,7 @@ static subpicture_t * SubsdelayFilter( filter_t *p_filter, subpicture_t* p_subpi
 static int SubsdelayCallback( vlc_object_t *p_this, char const *psz_var, vlc_value_t oldval, vlc_value_t newval,
         void *p_data )
 {
-    filter_sys_t *p_sys = (filter_sys_t *) p_data;
+    filter_sys_t *p_sys = p_data;
 
     VLC_UNUSED( oldval );
 


=====================================
modules/video_filter/antiflicker.c
=====================================
@@ -318,7 +318,7 @@ static int AntiFlickerCallback( vlc_object_t *p_this, char const *psz_var,
                            void *p_data )
 {
     VLC_UNUSED(p_this); VLC_UNUSED(oldval);
-    filter_sys_t *p_sys = (filter_sys_t *)p_data;
+    filter_sys_t *p_sys = p_data;
 
     if( !strcmp( psz_var, FILTER_PREFIX "window-size" ) )
         atomic_store( &p_sys->i_window_size, newval.i_int );


=====================================
modules/video_filter/ball.c
=====================================
@@ -792,7 +792,7 @@ static int ballCallback( vlc_object_t *p_this, char const *psz_var,
                              void *p_data )
 {
     VLC_UNUSED(oldval);
-    filter_sys_t *p_sys = (filter_sys_t *)p_data;
+    filter_sys_t *p_sys = p_data;
     msg_Err( p_this, "Test" );
 
     vlc_mutex_lock( &p_sys->lock );


=====================================
modules/video_filter/bluescreen.c
=====================================
@@ -259,7 +259,7 @@ static int BluescreenCallback( vlc_object_t *p_this, char const *psz_var,
                                void *p_data )
 {
     VLC_UNUSED(p_this); VLC_UNUSED(oldval);
-    filter_sys_t *p_sys = (filter_sys_t *) p_data;
+    filter_sys_t *p_sys = p_data;
 
     vlc_mutex_lock( &p_sys->lock );
 #define VAR_IS( a ) !strcmp( psz_var, CFG_PREFIX a )


=====================================
modules/video_filter/canvas.c
=====================================
@@ -236,7 +236,7 @@ static int Activate( filter_t *p_filter )
 
     b_padd = var_CreateGetBool( p_filter, CFG_PREFIX "padd" );
 
-    filter_sys_t *p_sys = (filter_sys_t *)malloc( sizeof( filter_sys_t ) );
+    filter_sys_t *p_sys = malloc( sizeof( filter_sys_t ) );
     if( !p_sys )
         return VLC_ENOMEM;
     p_filter->p_sys = p_sys;


=====================================
modules/video_filter/croppadd.c
=====================================
@@ -170,7 +170,7 @@ static int OpenFilter( filter_t *p_filter )
         return VLC_EGENERIC;
     }
 
-    p_filter->p_sys = (filter_sys_t *)vlc_obj_malloc( VLC_OBJECT(p_filter), sizeof( filter_sys_t ) );
+    p_filter->p_sys = vlc_obj_malloc( VLC_OBJECT(p_filter), sizeof( filter_sys_t ) );
     if( unlikely(!p_filter->p_sys) ) return VLC_ENOMEM;
 
     config_ChainParse( p_filter, CFG_PREFIX, ppsz_filter_options,


=====================================
modules/video_filter/erase.c
=====================================
@@ -388,7 +388,7 @@ static int EraseCallback( vlc_object_t *p_this, char const *psz_var,
                           vlc_value_t oldval, vlc_value_t newval, void *p_data )
 {
     VLC_UNUSED(oldval);
-    filter_sys_t *p_sys = (filter_sys_t *)p_data;
+    filter_sys_t *p_sys = p_data;
 
     if( !strcmp( psz_var, CFG_PREFIX "x" ) )
     {


=====================================
modules/video_filter/extract.c
=====================================
@@ -384,7 +384,7 @@ static int ExtractCallback( vlc_object_t *p_this, char const *psz_var,
                             void *p_data )
 {
     VLC_UNUSED(oldval);
-    filter_sys_t *p_sys = (filter_sys_t *)p_data;
+    filter_sys_t *p_sys = p_data;
 
     vlc_mutex_lock( &p_sys->lock );
     if( !strcmp( psz_var, FILTER_PREFIX "component" ) )


=====================================
modules/video_filter/gradient.c
=====================================
@@ -728,7 +728,7 @@ static int GradientCallback( vlc_object_t *p_this, char const *psz_var,
                              void *p_data )
 {
     VLC_UNUSED(oldval);
-    filter_sys_t *p_sys = (filter_sys_t *)p_data;
+    filter_sys_t *p_sys = p_data;
 
     vlc_mutex_lock( &p_sys->lock );
     if( !strcmp( psz_var, FILTER_PREFIX "mode" ) )


=====================================
modules/video_filter/hqdn3d.c
=====================================
@@ -255,7 +255,7 @@ static int DenoiseCallback( vlc_object_t *p_this, char const *psz_var,
 {
     VLC_UNUSED(p_this); VLC_UNUSED(oldval);
 
-    filter_sys_t *sys = (filter_sys_t*)p_data;
+    filter_sys_t *sys = p_data;
 
     /* Just take values and flag for recalc so we don't block UI thread calling this
      * and don't right thread safety calcing coefs in here without mutex*/


=====================================
modules/video_filter/motionblur.c
=====================================
@@ -195,7 +195,7 @@ static int MotionBlurCallback( vlc_object_t *p_this, char const *psz_var,
                                void *p_data )
 {
     VLC_UNUSED(p_this); VLC_UNUSED(psz_var); VLC_UNUSED(oldval);
-    filter_sys_t *p_sys = (filter_sys_t *)p_data;
+    filter_sys_t *p_sys = p_data;
 
     atomic_store( &p_sys->i_factor, VLC_CLIP( newval.i_int, 1, 127 ) );
     return VLC_SUCCESS;


=====================================
modules/video_filter/puzzle/puzzle.c
=====================================
@@ -582,7 +582,7 @@ int puzzle_Callback( vlc_object_t *p_this, char const *psz_var,
                            void *p_data )
 {
     VLC_UNUSED(p_this); VLC_UNUSED(oldval);
-    filter_sys_t *p_sys = (filter_sys_t *)p_data;
+    filter_sys_t *p_sys = p_data;
 
     vlc_mutex_lock( &p_sys->lock );
     if( !strcmp( psz_var, CFG_PREFIX "rows" ) ) {


=====================================
modules/video_filter/scene.c
=====================================
@@ -242,7 +242,7 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic )
 
 static void SnapshotRatio( filter_t *p_filter, picture_t *p_pic )
 {
-    filter_sys_t *p_sys = (filter_sys_t *)p_filter->p_sys;
+    filter_sys_t *p_sys = p_filter->p_sys;
 
     if( !p_pic ) return;
 
@@ -283,7 +283,7 @@ static void SnapshotRatio( filter_t *p_filter, picture_t *p_pic )
  *****************************************************************************/
 static void SavePicture( filter_t *p_filter, picture_t *p_pic )
 {
-    filter_sys_t *p_sys = (filter_sys_t *)p_filter->p_sys;
+    filter_sys_t *p_sys = p_filter->p_sys;
     video_format_t fmt_in, fmt_out;
     char *psz_filename = NULL;
     char *psz_temp = NULL;


=====================================
modules/video_filter/sharpen.c
=====================================
@@ -220,7 +220,7 @@ static int SharpenCallback( vlc_object_t *p_this, char const *psz_var,
                             void *p_data )
 {
     VLC_UNUSED(p_this); VLC_UNUSED(oldval); VLC_UNUSED(psz_var);
-    filter_sys_t *p_sys = (filter_sys_t *)p_data;
+    filter_sys_t *p_sys = p_data;
 
     atomic_store(&p_sys->sigma,
                  VLC_CLIP(newval.f_float, 0.f, 2.f) * (1 << 20));



View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/4acab97b2110dbb71267f9109411e7ede81e2277

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/4acab97b2110dbb71267f9109411e7ede81e2277
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance


More information about the vlc-commits mailing list