core: replace filter_sys_t* by void*
authorRomain Vimont <rom1v@videolabs.io>
Mon, 23 Apr 2018 17:40:10 +0000 (19:40 +0200)
committerJean-Baptiste Kempf <jb@videolan.org>
Wed, 25 Apr 2018 23:35:44 +0000 (01:35 +0200)
See #17078

Signed-off-by: Jean-Baptiste Kempf <jb@videolan.org>
52 files changed:
include/vlc_filter.h
modules/audio_filter/channel_mixer/headphone.c
modules/audio_filter/channel_mixer/mono.c
modules/audio_filter/channel_mixer/trivial.c
modules/audio_filter/converter/tospdif.c
modules/audio_filter/normvol.c
modules/audio_filter/param_eq.c
modules/audio_filter/scaletempo.c
modules/audio_filter/spatializer/spatializer.cpp
modules/hw/d3d11/d3d11_deinterlace.c
modules/hw/d3d11/d3d11_surface.c
modules/hw/d3d9/dxa9.c
modules/hw/d3d9/dxva2_deinterlace.c
modules/hw/vaapi/chroma.c
modules/hw/vaapi/filters.c
modules/spu/subsdelay.c
modules/text_renderer/freetype/fonts/dwrite.cpp
modules/text_renderer/freetype/freetype.c
modules/text_renderer/freetype/text_layout.c
modules/text_renderer/sapi.cpp
modules/text_renderer/svg.c
modules/video_chroma/chain.c
modules/video_chroma/cvpx.c
modules/video_chroma/i420_rgb.c
modules/video_chroma/i420_rgb16.c
modules/video_chroma/i420_rgb16_x86.c
modules/video_chroma/i420_rgb8.c
modules/video_filter/alphamask.c
modules/video_filter/antiflicker.c
modules/video_filter/ball.c
modules/video_filter/blend.cpp
modules/video_filter/canvas.c
modules/video_filter/ci_filters.m
modules/video_filter/deinterlace/algo_basic.c
modules/video_filter/deinterlace/deinterlace.c
modules/video_filter/deinterlace/helpers.c
modules/video_filter/deinterlace/merge.h
modules/video_filter/erase.c
modules/video_filter/extract.c
modules/video_filter/fps.c
modules/video_filter/gaussianblur.c
modules/video_filter/gradient.c
modules/video_filter/motionblur.c
modules/video_filter/psychedelic.c
modules/video_filter/puzzle_mgt.c
modules/video_filter/puzzle_pce.c
modules/video_filter/ripple.c
modules/video_filter/sharpen.c
modules/video_filter/wave.c
modules/visualization/glspectrum.c
modules/visualization/projectm.cpp
modules/visualization/visual/visual.c

index 301ca94..eb7624a 100644 (file)
@@ -68,7 +68,7 @@ struct filter_t
 
     /* Module properties */
     module_t *          p_module;
-    filter_sys_t *      p_sys;
+    void               *p_sys;
 
     /* Input format */
     es_format_t         fmt_in;
index 8e79bcd..918b687 100644 (file)
@@ -494,10 +494,11 @@ static int OpenFilter( vlc_object_t *p_this )
 static void CloseFilter( vlc_object_t *p_this )
 {
     filter_t *p_filter = (filter_t *)p_this;
+    filter_sys_t *p_sys = p_filter->p_sys;
 
-    free( p_filter->p_sys->p_overflow_buffer );
-    free( p_filter->p_sys->p_atomic_operations );
-    free( p_filter->p_sys );
+    free( p_sys->p_overflow_buffer );
+    free( p_sys->p_atomic_operations );
+    free( p_sys );
 }
 
 static block_t *Convert( filter_t *p_filter, block_t *p_block )
index 45b64b7..c54d56f 100644 (file)
@@ -432,7 +432,8 @@ static block_t *Convert( filter_t *p_filter, block_t *p_block )
         return NULL;
     }
 
-    i_out_size = p_block->i_nb_samples * p_filter->p_sys->i_bitspersample/8 *
+    filter_sys_t *p_sys = p_filter->p_sys;
+    i_out_size = p_block->i_nb_samples * p_sys->i_bitspersample/8 *
                  aout_FormatNbChannels( &(p_filter->fmt_out.audio) );
 
     p_out = block_Alloc( i_out_size );
@@ -443,11 +444,11 @@ static block_t *Convert( filter_t *p_filter, block_t *p_block )
         return NULL;
     }
     p_out->i_nb_samples =
-                  (p_block->i_nb_samples / p_filter->p_sys->i_nb_channels) *
+                  (p_block->i_nb_samples / p_sys->i_nb_channels) *
                        aout_FormatNbChannels( &(p_filter->fmt_out.audio) );
 
 #if 0
-    unsigned int i_in_size = in_buf.i_nb_samples  * (p_filter->p_sys->i_bitspersample/8) *
+    unsigned int i_in_size = in_buf.i_nb_samples  * (p_sys->i_bitspersample/8) *
                              aout_FormatNbChannels( &(p_filter->fmt_in.audio) );
     if( (in_buf.i_buffer != i_in_size) && ((i_in_size % 32) != 0) ) /* is it word aligned?? */
     {
@@ -457,7 +458,7 @@ static block_t *Convert( filter_t *p_filter, block_t *p_block )
 #endif
 
     memset( p_out->p_buffer, 0, i_out_size );
-    if( p_filter->p_sys->b_downmix )
+    if( p_sys->b_downmix )
     {
         stereo2mono_downmix( p_filter, p_block, p_out );
         mono( p_filter, p_out, p_block );
index 746934c..942846e 100644 (file)
@@ -74,9 +74,11 @@ static block_t *Upmix( filter_t *p_filter, block_t *p_in_buf )
     p_out_buf->i_pts        = p_in_buf->i_pts;
     p_out_buf->i_length     = p_in_buf->i_length;
 
+    filter_sys_t *p_sys = p_filter->p_sys;
+
     float *p_dest = (float *)p_out_buf->p_buffer;
     const float *p_src = (float *)p_in_buf->p_buffer;
-    const int *channel_map = p_filter->p_sys->channel_map;
+    const int *channel_map = p_sys->channel_map;
 
     for( size_t i = 0; i < p_in_buf->i_nb_samples; i++ )
     {
@@ -101,9 +103,11 @@ static block_t *Downmix( filter_t *p_filter, block_t *p_buf )
 
     assert( i_input_nb >= i_output_nb );
 
+    filter_sys_t *p_sys = p_filter->p_sys;
+
     float *p_dest = (float *)p_buf->p_buffer;
     const float *p_src = p_dest;
-    const int *channel_map = p_filter->p_sys->channel_map;
+    const int *channel_map = p_sys->channel_map;
     /* Use an extra buffer to avoid overlapping */
     float buffer[i_output_nb];
 
@@ -293,10 +297,11 @@ static int Create( vlc_object_t *p_this )
         }
     }
 
-    p_filter->p_sys = malloc( sizeof(*p_filter->p_sys) );
-    if(! p_filter->p_sys )
+    filter_sys_t *p_sys = malloc( sizeof(*p_sys) );
+    if( !p_sys )
         return VLC_ENOMEM;
-    memcpy( p_filter->p_sys->channel_map, channel_map, sizeof(channel_map) );
+    p_filter->p_sys = p_sys;
+    memcpy( p_sys->channel_map, channel_map, sizeof(channel_map) );
 
     if( aout_FormatNbChannels( outfmt ) > aout_FormatNbChannels( infmt ) )
         p_filter->pf_audio_filter = Upmix;
index 9ca7244..8eb4d57 100644 (file)
@@ -165,9 +165,10 @@ static void write_data( filter_t *p_filter, const void *p_buf, size_t i_size,
 
 static void write_buffer( filter_t *p_filter, block_t *p_in_buf )
 {
+    filter_sys_t *p_sys = p_filter->p_sys;
     write_data( p_filter, p_in_buf->p_buffer, p_in_buf->i_buffer,
                 is_big_endian( p_filter, p_in_buf ) );
-    p_filter->p_sys->p_out_buf->i_length += p_in_buf->i_length;
+    p_sys->p_out_buf->i_length += p_in_buf->i_length;
 }
 
 static int write_init( filter_t *p_filter, block_t *p_in_buf,
@@ -389,6 +390,7 @@ static int write_buffer_truehd( filter_t *p_filter, block_t *p_in_buf )
 static int write_buffer_dts( filter_t *p_filter, block_t *p_in_buf )
 {
     uint16_t i_data_type;
+    filter_sys_t *p_sys = p_filter->p_sys;
 
     /* Only send the DTS core part */
     vlc_dts_header_t core;
@@ -429,7 +431,7 @@ static int write_buffer_dts( filter_t *p_filter, block_t *p_in_buf )
         return SPDIF_ERROR;
 
     if( i_data_type == 0 )
-        p_filter->p_sys->i_out_offset = 0;
+        p_sys->i_out_offset = 0;
 
     write_buffer( p_filter, p_in_buf );
     write_finalize( p_filter, i_data_type, 8 /* in bits */ );
@@ -481,7 +483,7 @@ static int write_buffer_dtshd( filter_t *p_filter, block_t *p_in_buf )
     size_t i_out_size = i_period * 4;
     uint16_t i_data_type = IEC61937_DTSHD | i_subtype << 8;
 
-    if( p_filter->p_sys->dtshd.b_skip
+    if( p_sys->dtshd.b_skip
      || i_in_size + SPDIF_HEADER_SIZE > i_out_size )
     {
         /* The bitrate is too high, pass only the core part */
@@ -492,7 +494,7 @@ static int write_buffer_dtshd( filter_t *p_filter, block_t *p_in_buf )
 
         /* Don't try to send substreams anymore. That way, we avoid to switch
          * back and forth between DTD and DTS-HD */
-        p_filter->p_sys->dtshd.b_skip = true;
+        p_sys->dtshd.b_skip = true;
     }
 
     if( write_init( p_filter, p_in_buf, i_out_size,
index 428529f..3b09d9d 100644 (file)
@@ -110,7 +110,7 @@ static int Open( vlc_object_t *p_this )
     if( p_sys->f_max <= 0 ) p_sys->f_max = 0.01;
 
     /* We need to store (nb_buffers+1)*nb_channels floats */
-    p_sys->p_last = calloc( i_channels * (p_filter->p_sys->i_nb + 2), sizeof(float) );
+    p_sys->p_last = calloc( i_channels * (p_sys->i_nb + 2), sizeof(float) );
     if( !p_sys->p_last )
     {
         free( p_sys );
index 9b984be..438f7ad 100644 (file)
@@ -155,8 +155,9 @@ static int Open( vlc_object_t *p_this )
 static void Close( vlc_object_t *p_this )
 {
     filter_t *p_filter = (filter_t *)p_this;
-    free( p_filter->p_sys->p_state );
-    free( p_filter->p_sys );
+    filter_sys_t *p_sys = p_filter->p_sys;
+    free( p_sys->p_state );
+    free( p_sys );
 }
 
 /*****************************************************************************
@@ -166,10 +167,11 @@ static void Close( vlc_object_t *p_this )
  *****************************************************************************/
 static block_t *DoWork( filter_t * p_filter, block_t * p_in_buf )
 {
+    filter_sys_t *p_sys = p_filter->p_sys;
     ProcessEQ( (float*)p_in_buf->p_buffer, (float*)p_in_buf->p_buffer,
-               p_filter->p_sys->p_state,
+               p_sys->p_state,
                p_filter->fmt_in.audio.i_channels, p_in_buf->i_nb_samples,
-               p_filter->p_sys->coeffs, 5 );
+               p_sys->coeffs, 5 );
     return p_in_buf;
 }
 
index 97e9b0d..f1f93bd 100644 (file)
@@ -484,12 +484,13 @@ static filter_t *ResamplerCreate(filter_t *p_filter)
     if( unlikely( p_resampler == NULL ) )
         return NULL;
 
+    filter_sys_t *p_sys = p_filter->p_sys;
     p_resampler->owner.sys = NULL;
     p_resampler->p_cfg = NULL;
     p_resampler->fmt_in = p_filter->fmt_in;
     p_resampler->fmt_out = p_filter->fmt_in;
     p_resampler->fmt_out.audio.i_rate =
-        vlc_atomic_load_float( &p_filter->p_sys->rate_shift );
+        vlc_atomic_load_float( &p_sys->rate_shift );
     aout_FormatPrepare( &p_resampler->fmt_out.audio );
     p_resampler->p_module = module_need( p_resampler, "audio resampler", NULL,
                                          false );
index 5b52527..ebb43da 100644 (file)
@@ -135,7 +135,7 @@ static int Open( vlc_object_t *p_this )
     vlc_object_t *p_aout = p_filter->obj.parent;
 
      /* Allocate structure */
-    p_sys = p_filter->p_sys = (filter_sys_t*)malloc( sizeof( *p_sys ) );
+    p_filter->p_sys = p_sys = (filter_sys_t*)malloc( sizeof( *p_sys ) );
     if( !p_sys )
         return VLC_ENOMEM;
 
@@ -172,7 +172,7 @@ static int Open( vlc_object_t *p_this )
 static void Close( vlc_object_t *p_this )
 {
     filter_t     *p_filter = (filter_t *)p_this;
-    filter_sys_t *p_sys = p_filter->p_sys;
+    filter_sys_t *p_sys = reinterpret_cast<filter_sys_t *>( p_filter->p_sys );
     vlc_object_t *p_aout = p_filter->obj.parent;
 
     /* Delete the callbacks */
@@ -196,7 +196,7 @@ static void Close( vlc_object_t *p_this )
 static void SpatFilter( filter_t *p_filter, float *out, float *in,
                         unsigned i_samples, unsigned i_channels )
 {
-    filter_sys_t *p_sys = p_filter->p_sys;
+    filter_sys_t *p_sys = reinterpret_cast<filter_sys_t *>( p_filter->p_sys );
     vlc_mutex_locker locker( &p_sys->lock );
 
     for( unsigned i = 0; i < i_samples; i++ )
index d26a144..b1db82e 100644 (file)
@@ -119,7 +119,8 @@ static int assert_ProcessorInput(filter_t *p_filter, picture_sys_t *p_sys_src)
 
 static void Flush(filter_t *filter)
 {
-    FlushDeinterlacing(&filter->p_sys->context);
+    filter_sys_t *p_sys = filter->p_sys;
+    FlushDeinterlacing(&p_sys->context);
 }
 
 static int RenderPic( filter_t *p_filter, picture_t *p_outpic, picture_t *p_pic,
@@ -274,7 +275,8 @@ static struct picture_context_t *d3d11_pic_context_copy(struct picture_context_t
 
 static picture_t *NewOutputPicture( filter_t *p_filter )
 {
-    picture_t *pic = p_filter->p_sys->buffer_new( p_filter );
+    filter_sys_t *p_sys = p_filter->p_sys;
+    picture_t *pic = p_sys->buffer_new( p_filter );
     picture_sys_t *pic_sys = pic->p_sys;
     if ( !pic->context )
     {
@@ -288,7 +290,7 @@ static picture_t *NewOutputPicture( filter_t *p_filter )
             pic->p_sys = pic_sys;
 
             D3D11_TEXTURE2D_DESC dstDesc;
-            ID3D11Texture2D_GetDesc(p_filter->p_sys->outTexture, &dstDesc);
+            ID3D11Texture2D_GetDesc(p_sys->outTexture, &dstDesc);
 
             const d3d_format_t *cfg = NULL;
             for (const d3d_format_t *output_format = GetRenderFormatList();
@@ -311,7 +313,7 @@ static picture_t *NewOutputPicture( filter_t *p_filter )
             video_format_t fmt = p_filter->fmt_out.video;
             fmt.i_width  = dstDesc.Width;
             fmt.i_height = dstDesc.Height;
-            if (AllocateTextures(VLC_OBJECT(p_filter), &p_filter->p_sys->d3d_dev, cfg,
+            if (AllocateTextures(VLC_OBJECT(p_filter), &p_sys->d3d_dev, cfg,
                                  &fmt, 1, pic_sys->texture) != VLC_SUCCESS)
             {
                 free(pic_sys);
@@ -319,7 +321,7 @@ static picture_t *NewOutputPicture( filter_t *p_filter )
             }
             b_local_texture = true;
 
-            pic_sys->context = p_filter->p_sys->d3d_dev.d3dcontext;
+            pic_sys->context = p_sys->d3d_dev.d3dcontext;
             pic_sys->formatTexture = dstDesc.Format;
 
         }
index 31aa663..5aff51f 100644 (file)
@@ -583,7 +583,8 @@ static void DeleteFilter( filter_t * p_filter )
 static picture_t *NewBuffer(filter_t *p_filter)
 {
     filter_t *p_parent = p_filter->owner.sys;
-    return p_parent->p_sys->staging_pic;
+    filter_sys_t *p_sys = p_parent->p_sys;
+    return p_sys->staging_pic;
 }
 
 static filter_t *CreateFilter( vlc_object_t *p_this, const es_format_t *p_fmt_in,
index 7235709..099dc64 100644 (file)
@@ -191,7 +191,8 @@ static void DeleteFilter( filter_t * p_filter )
 static picture_t *NewBuffer(filter_t *p_filter)
 {
     filter_t *p_parent = p_filter->owner.sys;
-    return p_parent->p_sys->staging;
+    filter_sys_t *p_sys = p_parent->p_sys;
+    return p_sys->staging;
 }
 
 static filter_t *CreateFilter( vlc_object_t *p_this, const es_format_t *p_fmt_in,
index a2f0a54..111e706 100644 (file)
@@ -81,7 +81,8 @@ static struct filter_mode_t filter_mode [] = {
 
 static void Flush(filter_t *filter)
 {
-    FlushDeinterlacing(&filter->p_sys->context);
+    filter_sys_t *p_sys = filter->p_sys;
+    FlushDeinterlacing(&p_sys->context);
 }
 
 static void FillSample( DXVA2_VideoSample *p_sample,
@@ -211,7 +212,8 @@ static int RenderSinglePic( filter_t *p_filter, picture_t *p_outpic, picture_t *
 
 static picture_t *Deinterlace(filter_t *p_filter, picture_t *p_pic)
 {
-    return DoDeinterlacing( p_filter, &p_filter->p_sys->context, p_pic );
+    filter_sys_t *p_sys = p_filter->p_sys;
+    return DoDeinterlacing( p_filter, &p_sys->context, p_pic );
 }
 
 static const struct filter_mode_t *GetFilterMode(const char *mode)
index 9009b7e..94a2d38 100644 (file)
@@ -170,7 +170,7 @@ DownloadSurface(filter_t *filter, picture_t *src_pic)
     if (vlc_vaapi_MapBuffer(VLC_OBJECT(filter), va_dpy, src_img.buf, &src_buf))
         goto error;
 
-    FillPictureFromVAImage(dest, &src_img, src_buf, &filter->p_sys->cache);
+    FillPictureFromVAImage(dest, &src_img, src_buf, &filter_sys->cache);
 
     vlc_vaapi_UnmapBuffer(VLC_OBJECT(filter), va_dpy, src_img.buf);
     vlc_vaapi_DestroyImage(VLC_OBJECT(filter), va_dpy, src_img.image_id);
@@ -239,10 +239,11 @@ FillVAImageFromPicture(VAImage *dest_img, uint8_t *dest_buf,
 static picture_t *
 UploadSurface(filter_t *filter, picture_t *src)
 {
-    VADisplay const va_dpy = filter->p_sys->dpy;
+    filter_sys_t   *p_sys = filter->p_sys;
+    VADisplay const va_dpy = p_sys->dpy;
     VAImage         dest_img;
     void *          dest_buf;
-    picture_t *     dest_pic = picture_pool_Wait(filter->p_sys->dest_pics);
+    picture_t *     dest_pic = picture_pool_Wait(p_sys->dest_pics);
 
     if (!dest_pic)
     {
@@ -259,7 +260,7 @@ UploadSurface(filter_t *filter, picture_t *src)
         goto error;
 
     FillVAImageFromPicture(&dest_img, dest_buf, dest_pic,
-                           src, &filter->p_sys->cache);
+                           src, &p_sys->cache);
 
     if (vlc_vaapi_UnmapBuffer(VLC_OBJECT(filter), va_dpy, dest_img.buf)
         || vlc_vaapi_DestroyImage(VLC_OBJECT(filter),
index 4f7305b..a3fe898 100644 (file)
@@ -961,7 +961,8 @@ error:
 static void
 Deinterlace_Flush(filter_t *filter)
 {
-    struct deint_data *const    p_deint_data = filter->p_sys->p_data;
+    filter_sys_t *p_sys = filter->p_sys;
+    struct deint_data *const p_deint_data = p_sys->p_data;
 
     while (p_deint_data->history.num_pics)
     {
index 5f05cf0..b87f901 100644 (file)
@@ -413,7 +413,8 @@ static subpicture_t * SubsdelayFilter( filter_t *p_filter, subpicture_t* p_subpi
         return NULL;
     }
 
-    p_heap = &p_filter->p_sys->heap;
+    filter_sys_t *p_sys = p_filter->p_sys;
+    p_heap = &p_sys->heap;
 
     /* add subpicture to the heap */
 
@@ -778,13 +779,15 @@ static void SubsdelayEnforceDelayRules( filter_t *p_filter )
     int64_t i_min_stop_start_interval;
     int64_t i_min_start_stop_interval;
 
-    p_list = p_filter->p_sys->heap.p_list;
-    i_count = p_filter->p_sys->heap.i_count;
+    filter_sys_t *p_sys = p_filter->p_sys;
+
+    p_list = p_sys->heap.p_list;
+    i_count = p_sys->heap.i_count;
 
-    i_overlap = p_filter->p_sys->i_overlap;
-    i_min_stops_interval = p_filter->p_sys->i_min_stops_interval;
-    i_min_stop_start_interval = p_filter->p_sys->i_min_stop_start_interval;
-    i_min_start_stop_interval = p_filter->p_sys->i_min_start_stop_interval;
+    i_overlap = p_sys->i_overlap;
+    i_min_stops_interval = p_sys->i_min_stops_interval;
+    i_min_stop_start_interval = p_sys->i_min_stop_start_interval;
+    i_min_start_stop_interval = p_sys->i_min_start_stop_interval;
 
     /* step 1 - enforce min stops interval rule (extend delays) */
 
@@ -907,7 +910,8 @@ static void SubsdelayEnforceDelayRules( filter_t *p_filter )
  *****************************************************************************/
 static void SubsdelayRecalculateDelays( filter_t *p_filter )
 {
-    for( subsdelay_heap_entry_t *p_curr = p_filter->p_sys->heap.p_head;
+    filter_sys_t *p_sys = p_filter->p_sys;
+    for( subsdelay_heap_entry_t *p_curr = p_sys->heap.p_head;
          p_curr != NULL; p_curr = p_curr->p_next )
     {
         if( !p_curr->b_update_ephemer )
@@ -1018,7 +1022,8 @@ static void SubpicDestroyWrapper( subpicture_t *p_subpic )
 
     if( p_entry->p_filter )
     {
-        p_heap = &p_entry->p_filter->p_sys->heap;
+        filter_sys_t *p_sys = p_entry->p_filter->p_sys;
+        p_heap = &p_sys->heap;
 
         SubsdelayHeapLock( p_heap );
         SubsdelayHeapRemove( p_heap, p_entry );
@@ -1046,7 +1051,8 @@ static void SubpicLocalUpdate( subpicture_t* p_subpic, mtime_t i_ts )
     }
 
     p_filter = p_entry->p_filter;
-    p_heap = &p_filter->p_sys->heap;
+    filter_sys_t *p_sys = p_filter->p_sys;
+    p_heap = &p_sys->heap;
 
     SubsdelayHeapLock( p_heap );
 
@@ -1169,8 +1175,10 @@ static int64_t SubsdelayEstimateDelay( filter_t *p_filter, subsdelay_heap_entry_
     int i_factor;
     int i_rank;
 
-    i_mode = p_filter->p_sys->i_mode;
-    i_factor = p_filter->p_sys->i_factor;
+    filter_sys_t *p_sys = p_filter->p_sys;
+
+    i_mode = p_sys->i_mode;
+    i_factor = p_sys->i_factor;
 
     if( i_mode == SUBSDELAY_MODE_ABSOLUTE )
     {
@@ -1208,14 +1216,16 @@ static int SubsdelayCalculateAlpha( filter_t *p_filter, int i_overlapping, int i
     int i_new_alpha;
     int i_min_alpha;
 
-    i_min_alpha = p_filter->p_sys->i_min_alpha;
+    filter_sys_t *p_sys = p_filter->p_sys;
+
+    i_min_alpha = p_sys->i_min_alpha;
 
-    if( i_overlapping > p_filter->p_sys->i_overlap - 1)
+    if( i_overlapping > p_sys->i_overlap - 1)
     {
-        i_overlapping = p_filter->p_sys->i_overlap - 1;
+        i_overlapping = p_sys->i_overlap - 1;
     }
 
-    switch ( p_filter->p_sys->i_overlap )
+    switch ( p_sys->i_overlap )
     {
     case 1:
         i_new_alpha = 255;
index 018a0b3..8ae1fe3 100644 (file)
@@ -132,14 +132,15 @@ extern "C" int InitDWrite( filter_t *p_filter )
         return VLC_EGENERIC;
     }
 
-    p_filter->p_sys->p_dw_sys = p_dw_sys;
+    filter_sys_t *p_sys = reinterpret_cast<filter_sys_t *>( p_filter->p_sys );
+    p_sys->p_dw_sys = p_dw_sys;
     msg_Dbg( p_filter, "Using DWrite backend" );
     return VLC_SUCCESS;
 }
 
 extern "C" int ReleaseDWrite( filter_t *p_filter )
 {
-    filter_sys_t *p_sys = p_filter->p_sys;
+    filter_sys_t *p_sys = reinterpret_cast<filter_sys_t *>( p_filter->p_sys );
     dw_sys_t *p_dw_sys = ( dw_sys_t * ) p_sys->p_dw_sys;
 
 #if VLC_WINSTORE_APP
@@ -158,7 +159,8 @@ extern "C" int ReleaseDWrite( filter_t *p_filter )
 
 extern "C" int DWrite_GetFontStream( filter_t *p_filter, int i_index, FT_Stream *pp_stream )
 {
-    dw_sys_t *p_dw_sys = ( dw_sys_t * ) p_filter->p_sys->p_dw_sys;
+    filter_sys_t *p_sys = reinterpret_cast<filter_sys_t *>( p_filter->p_sys );
+    dw_sys_t *p_dw_sys = ( dw_sys_t * ) p_sys->p_dw_sys;
 
     if( i_index < 0 || i_index >= ( int ) p_dw_sys->streams.size() )
         return VLC_ENOITEM;
@@ -394,7 +396,7 @@ static void DWrite_ParseFamily( IDWriteFontFamily *p_dw_family, vlc_family_t *p_
 
 extern "C" const vlc_family_t *DWrite_GetFamily( filter_t *p_filter, const char *psz_family )
 {
-    filter_sys_t                 *p_sys        = p_filter->p_sys;
+    filter_sys_t *p_sys = reinterpret_cast<filter_sys_t *>( p_filter->p_sys );
     dw_sys_t                     *p_dw_sys     = ( dw_sys_t * ) p_sys->p_dw_sys;
     ComPtr< IDWriteFontFamily >   p_dw_family;
 
@@ -454,7 +456,7 @@ done:
 static char *DWrite_Fallback( filter_t *p_filter, const char *psz_family,
                               uni_char_t codepoint )
 {
-    filter_sys_t                     *p_sys             = p_filter->p_sys;
+    filter_sys_t *p_sys = reinterpret_cast<filter_sys_t *>( p_filter->p_sys );
     dw_sys_t                         *p_dw_sys          = ( dw_sys_t * ) p_sys->p_dw_sys;
     wchar_t                          *pwsz_buffer       = NULL;
     char                             *psz_result        = NULL;
@@ -527,7 +529,7 @@ done:
 extern "C" vlc_family_t *DWrite_GetFallbacks( filter_t *p_filter, const char *psz_family,
                                               uni_char_t codepoint )
 {
-    filter_sys_t  *p_sys         = p_filter->p_sys;
+    filter_sys_t  *p_sys = reinterpret_cast<filter_sys_t *>( p_filter->p_sys );
     vlc_family_t  *p_family      = NULL;
     vlc_family_t  *p_fallbacks   = NULL;
     char          *psz_fallback  = NULL;
index a810816..92f90c9 100644 (file)
@@ -896,6 +896,8 @@ static inline int RenderAXYZ( filter_t *p_filter,
                               void (*FillPicture)( picture_t *p_picture, int, int, int, int ),
                               void (*BlendPixel)(picture_t *, int, int, int, int, int, int, int) )
 {
+    filter_sys_t *p_sys = p_filter->p_sys;
+
     /* Create a new subpicture region */
     video_format_t fmt;
     video_format_Init( &fmt, i_chroma );
@@ -920,7 +922,7 @@ static inline int RenderAXYZ( filter_t *p_filter,
     p_region->fmt.i_sar_den = regionden;
 
     /* Initialize the picture background */
-    const text_style_t *p_style = p_filter->p_sys->p_default_style;
+    const text_style_t *p_style = p_sys->p_default_style;
     uint8_t i_x, i_y, i_z;
 
     if (p_region->b_noregionbg) {
@@ -959,7 +961,8 @@ static inline int RenderAXYZ( filter_t *p_filter,
 
 static void UpdateDefaultLiveStyles( filter_t *p_filter )
 {
-    text_style_t *p_style = p_filter->p_sys->p_default_style;
+    filter_sys_t *p_sys = p_filter->p_sys;
+    text_style_t *p_style = p_sys->p_default_style;
 
     p_style->i_font_color = var_InheritInteger( p_filter, "freetype-color" );
 
index cf80c52..5321ffb 100644 (file)
@@ -1134,11 +1134,11 @@ static int LoadGlyphs( filter_t *p_filter, paragraph_t *p_paragraph,
 
 #undef SKIP_GLYPH
 
-            if( p_filter->p_sys->p_stroker && (p_style->i_style_flags & STYLE_OUTLINE) )
+            if( p_sys->p_stroker && (p_style->i_style_flags & STYLE_OUTLINE) )
             {
                 p_bitmaps->p_outline = p_bitmaps->p_glyph;
                 if( FT_Glyph_StrokeBorder( &p_bitmaps->p_outline,
-                                           p_filter->p_sys->p_stroker, 0, 0 ) )
+                                           p_sys->p_stroker, 0, 0 ) )
                     p_bitmaps->p_outline = 0;
             }
 
index d64545a..4275df6 100644 (file)
@@ -170,7 +170,7 @@ error:
 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;
+    filter_sys_t *p_sys = reinterpret_cast<filter_sys_t *>( p_filter->p_sys );
 
     if (p_sys->cpVoice)
         p_sys->cpVoice->Release();
@@ -184,7 +184,7 @@ static int RenderText(filter_t *p_filter,
         subpicture_region_t *p_region_in,
         const vlc_fourcc_t *)
 {
-    filter_sys_t *p_sys = p_filter->p_sys;
+    filter_sys_t *p_sys = reinterpret_cast<filter_sys_t *>( p_filter->p_sys );
     text_segment_t *p_segment = p_region_in->p_text;
 
     if (!p_segment)
index 71fe7e5..bc170bf 100644 (file)
@@ -180,9 +180,10 @@ static int Create( vlc_object_t *p_this )
 {
     filter_t *p_filter = ( filter_t * )p_this;
 
-    p_filter->p_sys = calloc( 1, sizeof(*p_filter->p_sys) );
-    if( !p_filter->p_sys )
+    filter_sys_t *p_sys = calloc( 1, sizeof(*p_sys) );
+    if( !p_sys )
         return VLC_ENOMEM;
+    p_filter->p_sys = p_sys;
 
     p_filter->pf_render = RenderText;
     svg_LoadTemplate( p_filter );
@@ -202,11 +203,12 @@ 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;
 #if (GLIB_MAJOR_VERSION < 2 || GLIB_MINOR_VERSION < 36)
     rsvg_term();
 #endif
-    free( p_filter->p_sys->psz_file_template );
-    free( p_filter->p_sys );
+    free( p_sys->psz_file_template );
+    free( p_sys );
 }
 
 static void svg_RescaletoFit( filter_t *p_filter, int *width, int *height, float *scale )
index 885676f..39db940 100644 (file)
@@ -198,7 +198,7 @@ static int Activate( filter_t *p_filter, int (*pf_build)(filter_t *) )
     {
         es_format_Clean( &p_filter->fmt_out );
         es_format_Copy( &p_filter->fmt_out,
-                        filter_chain_GetFmtOut( p_filter->p_sys->p_chain ) );
+                        filter_chain_GetFmtOut( p_sys->p_chain ) );
     }
     /* */
     p_filter->pf_video_filter = Chain;
@@ -244,12 +244,13 @@ static int ActivateFilter( 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;
 
-    if (p_filter->p_sys->p_video_filter)
-        filter_DelProxyCallbacks( p_filter, p_filter->p_sys->p_video_filter,
+    if (p_sys->p_video_filter)
+        filter_DelProxyCallbacks( p_filter, p_sys->p_video_filter,
                                   RestartFilterCallback );
-    filter_chain_Delete( p_filter->p_sys->p_chain );
-    free( p_filter->p_sys );
+    filter_chain_Delete( p_sys->p_chain );
+    free( p_sys );
 }
 
 /*****************************************************************************
@@ -257,7 +258,8 @@ static void Destroy( vlc_object_t *p_this )
  *****************************************************************************/
 static picture_t *Chain( filter_t *p_filter, picture_t *p_pic )
 {
-    return filter_chain_VideoFilter( p_filter->p_sys->p_chain, p_pic );
+    filter_sys_t *p_sys = p_filter->p_sys;
+    return filter_chain_VideoFilter( p_sys->p_chain, p_pic );
 }
 
 /*****************************************************************************
@@ -354,7 +356,8 @@ static int ChainMouse( filter_t *p_filter, vlc_mouse_t *p_mouse,
                        const vlc_mouse_t *p_old, const vlc_mouse_t *p_new )
 {
     (void) p_old;
-    return filter_chain_MouseFilter( p_filter->p_sys->p_chain, p_mouse, p_new );
+    filter_sys_t *p_sys = p_filter->p_sys;
+    return filter_chain_MouseFilter( p_sys->p_chain, p_mouse, p_new );
 }
 
 static int BuildFilterChain( filter_t *p_filter )
@@ -362,11 +365,13 @@ static int BuildFilterChain( filter_t *p_filter )
     es_format_t fmt_mid;
     int i_ret = VLC_EGENERIC;
 
+    filter_sys_t *p_sys = p_filter->p_sys;
+
     /* Now try chroma format list */
     const vlc_fourcc_t *pi_allowed_chromas = get_allowed_chromas( p_filter );
     for( int i = 0; pi_allowed_chromas[i]; i++ )
     {
-        filter_chain_Reset( p_filter->p_sys->p_chain, &p_filter->fmt_in, &p_filter->fmt_out );
+        filter_chain_Reset( p_sys->p_chain, &p_filter->fmt_in, &p_filter->fmt_out );
 
         const vlc_fourcc_t i_chroma = pi_allowed_chromas[i];
         if( i_chroma == p_filter->fmt_in.i_codec ||
@@ -384,19 +389,19 @@ static int BuildFilterChain( filter_t *p_filter )
         fmt_mid.video.i_bmask  = 0;
         video_format_FixRgb(&fmt_mid.video);
 
-        if( filter_chain_AppendConverter( p_filter->p_sys->p_chain,
+        if( filter_chain_AppendConverter( p_sys->p_chain,
                                           NULL, &fmt_mid ) == VLC_SUCCESS )
         {
-            p_filter->p_sys->p_video_filter =
-                filter_chain_AppendFilter( p_filter->p_sys->p_chain,
+            p_sys->p_video_filter =
+                filter_chain_AppendFilter( p_sys->p_chain,
                                            p_filter->psz_name, p_filter->p_cfg,
                                            &fmt_mid, &fmt_mid );
-            if( p_filter->p_sys->p_video_filter )
+            if( p_sys->p_video_filter )
             {
                 filter_AddProxyCallbacks( p_filter,
-                                          p_filter->p_sys->p_video_filter,
+                                          p_sys->p_video_filter,
                                           RestartFilterCallback );
-                if (p_filter->p_sys->p_video_filter->pf_video_mouse != NULL)
+                if (p_sys->p_video_filter->pf_video_mouse != NULL)
                     p_filter->pf_video_mouse = ChainMouse;
                 es_format_Clean( &fmt_mid );
                 i_ret = VLC_SUCCESS;
@@ -406,7 +411,7 @@ static int BuildFilterChain( filter_t *p_filter )
         es_format_Clean( &fmt_mid );
     }
     if( i_ret != VLC_SUCCESS )
-        filter_chain_Reset( p_filter->p_sys->p_chain, &p_filter->fmt_in, &p_filter->fmt_out );
+        filter_chain_Reset( p_sys->p_chain, &p_filter->fmt_in, &p_filter->fmt_out );
 
     return i_ret;
 }
@@ -416,13 +421,14 @@ static int BuildFilterChain( filter_t *p_filter )
  *****************************************************************************/
 static int CreateChain( filter_t *p_parent, const es_format_t *p_fmt_mid )
 {
-    filter_chain_Reset( p_parent->p_sys->p_chain, &p_parent->fmt_in, &p_parent->fmt_out );
+    filter_sys_t *p_sys = p_parent->p_sys;
+    filter_chain_Reset( p_sys->p_chain, &p_parent->fmt_in, &p_parent->fmt_out );
 
     filter_t *p_filter;
 
     if( p_parent->fmt_in.video.orientation != p_fmt_mid->video.orientation)
     {
-        p_filter = AppendTransform( p_parent->p_sys->p_chain, &p_parent->fmt_in, p_fmt_mid );
+        p_filter = AppendTransform( p_sys->p_chain, &p_parent->fmt_in, p_fmt_mid );
         // Check if filter was enough:
         if( p_filter == NULL )
             return VLC_EGENERIC;
@@ -431,35 +437,36 @@ static int CreateChain( filter_t *p_parent, const es_format_t *p_fmt_mid )
     }
     else
     {
-        if( filter_chain_AppendConverter( p_parent->p_sys->p_chain,
+        if( filter_chain_AppendConverter( p_sys->p_chain,
                                           NULL, p_fmt_mid ) )
             return VLC_EGENERIC;
     }
 
     if( p_fmt_mid->video.orientation != p_parent->fmt_out.video.orientation)
     {
-        if( AppendTransform( p_parent->p_sys->p_chain, p_fmt_mid,
+        if( AppendTransform( p_sys->p_chain, p_fmt_mid,
                              &p_parent->fmt_out ) == NULL )
             goto error;
     }
     else
     {
-        if( filter_chain_AppendConverter( p_parent->p_sys->p_chain,
+        if( filter_chain_AppendConverter( p_sys->p_chain,
                                           p_fmt_mid, &p_parent->fmt_out ) )
             goto error;
     }
     return VLC_SUCCESS;
 error:
     //Clean up.
-    filter_chain_Reset( p_parent->p_sys->p_chain, NULL, NULL );
+    filter_chain_Reset( p_sys->p_chain, NULL, NULL );
     return VLC_EGENERIC;
 }
 
 static int CreateResizeChromaChain( filter_t *p_parent, const es_format_t *p_fmt_mid )
 {
-    filter_chain_Reset( p_parent->p_sys->p_chain, &p_parent->fmt_in, &p_parent->fmt_out );
+    filter_sys_t *p_sys = p_parent->p_sys;
+    filter_chain_Reset( p_sys->p_chain, &p_parent->fmt_in, &p_parent->fmt_out );
 
-    int i_ret = filter_chain_AppendConverter( p_parent->p_sys->p_chain,
+    int i_ret = filter_chain_AppendConverter( p_sys->p_chain,
                                               NULL, p_fmt_mid );
     if( i_ret != VLC_SUCCESS )
         return i_ret;
@@ -472,19 +479,19 @@ static int CreateResizeChromaChain( filter_t *p_parent, const es_format_t *p_fmt
 
         es_format_t fmt_out;
         es_format_Copy( &fmt_out,
-                        filter_chain_GetFmtOut( p_parent->p_sys->p_chain ) );
+                        filter_chain_GetFmtOut( p_sys->p_chain ) );
         fmt_out.video.i_chroma = p_parent->fmt_out.video.i_chroma;
 
-        i_ret = filter_chain_AppendConverter( p_parent->p_sys->p_chain,
+        i_ret = filter_chain_AppendConverter( p_sys->p_chain,
                                               NULL, &fmt_out );
         es_format_Clean( &fmt_out );
     }
     else
-        i_ret = filter_chain_AppendConverter( p_parent->p_sys->p_chain,
+        i_ret = filter_chain_AppendConverter( p_sys->p_chain,
                                               NULL, &p_parent->fmt_out );
 
     if( i_ret != VLC_SUCCESS )
-        filter_chain_Reset( p_parent->p_sys->p_chain, NULL, NULL );
+        filter_chain_Reset( p_sys->p_chain, NULL, NULL );
     return i_ret;
 }
 
index 9c586b6..0076ec4 100644 (file)
@@ -354,7 +354,7 @@ Filter(filter_t *filter, picture_t *src)
         return NULL;
     }
 
-    if (VTPixelTransferSessionTransferImage(filter->p_sys->vttransfer,
+    if (VTPixelTransferSessionTransferImage(p_sys->vttransfer,
                                             src_cvpx, dst_cvpx) != noErr)
     {
         picture_Release(dst);
index c476cbd..1c66223 100644 (file)
@@ -206,46 +206,45 @@ static int Activate( vlc_object_t *p_this )
             return VLC_EGENERIC;
     }
 
-    p_filter->p_sys = malloc( sizeof( filter_sys_t ) );
-    if( p_filter->p_sys == NULL )
-    {
+    filter_sys_t *p_sys = malloc( sizeof( filter_sys_t ) );
+    if( p_sys == NULL )
         return VLC_EGENERIC;
-    }
+    p_filter->p_sys = p_sys;
 
     switch( p_filter->fmt_out.video.i_chroma )
     {
 #ifdef PLAIN
         case VLC_CODEC_RGB8:
-            p_filter->p_sys->p_buffer = malloc( VOUT_MAX_WIDTH );
+            p_sys->p_buffer = malloc( VOUT_MAX_WIDTH );
             break;
 #endif
         case VLC_CODEC_RGB15:
         case VLC_CODEC_RGB16:
-            p_filter->p_sys->p_buffer = malloc( VOUT_MAX_WIDTH * 2 );
+            p_sys->p_buffer = malloc( VOUT_MAX_WIDTH * 2 );
             break;
         case VLC_CODEC_RGB24:
         case VLC_CODEC_RGB32:
-            p_filter->p_sys->p_buffer = malloc( VOUT_MAX_WIDTH * 4 );
+            p_sys->p_buffer = malloc( VOUT_MAX_WIDTH * 4 );
             break;
         default:
-            p_filter->p_sys->p_buffer = NULL;
+            p_sys->p_buffer = NULL;
             break;
     }
 
-    if( p_filter->p_sys->p_buffer == NULL )
+    if( p_sys->p_buffer == NULL )
     {
-        free( p_filter->p_sys );
+        free( p_sys );
         return VLC_EGENERIC;
     }
 
-    p_filter->p_sys->p_offset = malloc( p_filter->fmt_out.video.i_width
+    p_sys->p_offset = malloc( p_filter->fmt_out.video.i_width
                     * ( ( p_filter->fmt_out.video.i_chroma
                            == VLC_CODEC_RGB8 ) ? 2 : 1 )
                     * sizeof( int ) );
-    if( p_filter->p_sys->p_offset == NULL )
+    if( p_sys->p_offset == NULL )
     {
-        free( p_filter->p_sys->p_buffer );
-        free( p_filter->p_sys );
+        free( p_sys->p_buffer );
+        free( p_sys );
         return VLC_EGENERIC;
     }
 
@@ -264,12 +263,12 @@ static int Activate( vlc_object_t *p_this )
         break;
     }
 
-    p_filter->p_sys->p_base = malloc( i_tables_size );
-    if( p_filter->p_sys->p_base == NULL )
+    p_sys->p_base = malloc( i_tables_size );
+    if( p_sys->p_base == NULL )
     {
-        free( p_filter->p_sys->p_offset );
-        free( p_filter->p_sys->p_buffer );
-        free( p_filter->p_sys );
+        free( p_sys->p_offset );
+        free( p_sys->p_buffer );
+        free( p_sys );
         return -1;
     }
 
@@ -287,13 +286,14 @@ static int Activate( vlc_object_t *p_this )
 static void Deactivate( vlc_object_t *p_this )
 {
     filter_t *p_filter = (filter_t *)p_this;
+    filter_sys_t *p_sys = p_filter->p_sys;
 
 #ifdef PLAIN
-    free( p_filter->p_sys->p_base );
+    free( p_sys->p_base );
 #endif
-    free( p_filter->p_sys->p_offset );
-    free( p_filter->p_sys->p_buffer );
-    free( p_filter->p_sys );
+    free( p_sys->p_offset );
+    free( p_sys->p_buffer );
+    free( p_sys );
 }
 
 #ifndef PLAIN
@@ -337,6 +337,8 @@ static void SetYUV( filter_t *p_filter )
                    /* We use volatile here to work around a strange gcc-3.3.4
                     * optimization bug */
 
+    filter_sys_t *p_sys = p_filter->p_sys;
+
     /* Build gamma table */
     SetGammaTable( pi_gamma, 0 ); //p_filter/*FIXME wasn't used anywhere anyway*/->f_gamma );
 
@@ -348,59 +350,59 @@ static void SetYUV( filter_t *p_filter )
     switch( p_filter->fmt_out.video.i_chroma )
     {
     case VLC_CODEC_RGB8:
-        p_filter->p_sys->p_rgb8 = (uint8_t *)p_filter->p_sys->p_base;
-        Set8bppPalette( p_filter, p_filter->p_sys->p_rgb8 );
+        p_sys->p_rgb8 = (uint8_t *)p_sys->p_base;
+        Set8bppPalette( p_filter, p_sys->p_rgb8 );
         break;
 
     case VLC_CODEC_RGB15:
     case VLC_CODEC_RGB16:
-        p_filter->p_sys->p_rgb16 = (uint16_t *)p_filter->p_sys->p_base;
+        p_sys->p_rgb16 = (uint16_t *)p_sys->p_base;
         for( i_index = 0; i_index < RED_MARGIN; i_index++ )
         {
-            p_filter->p_sys->p_rgb16[RED_OFFSET - RED_MARGIN + i_index] = RGB2PIXEL( p_filter, pi_gamma[0], 0, 0 );
-            p_filter->p_sys->p_rgb16[RED_OFFSET + 256 + i_index] =        RGB2PIXEL( p_filter, pi_gamma[255], 0, 0 );
+            p_sys->p_rgb16[RED_OFFSET - RED_MARGIN + i_index] = RGB2PIXEL( p_filter, pi_gamma[0], 0, 0 );
+            p_sys->p_rgb16[RED_OFFSET + 256 + i_index] =        RGB2PIXEL( p_filter, pi_gamma[255], 0, 0 );
         }
         for( i_index = 0; i_index < GREEN_MARGIN; i_index++ )
         {
-            p_filter->p_sys->p_rgb16[GREEN_OFFSET - GREEN_MARGIN + i_index] = RGB2PIXEL( p_filter, 0, pi_gamma[0], 0 );
-            p_filter->p_sys->p_rgb16[GREEN_OFFSET + 256 + i_index] =          RGB2PIXEL( p_filter, 0, pi_gamma[255], 0 );
+            p_sys->p_rgb16[GREEN_OFFSET - GREEN_MARGIN + i_index] = RGB2PIXEL( p_filter, 0, pi_gamma[0], 0 );
+            p_sys->p_rgb16[GREEN_OFFSET + 256 + i_index] =          RGB2PIXEL( p_filter, 0, pi_gamma[255], 0 );
         }
         for( i_index = 0; i_index < BLUE_MARGIN; i_index++ )
         {
-            p_filter->p_sys->p_rgb16[BLUE_OFFSET - BLUE_MARGIN + i_index] = RGB2PIXEL( p_filter, 0, 0, pi_gamma[0] );
-            p_filter->p_sys->p_rgb16[BLUE_OFFSET + BLUE_MARGIN + i_index] = RGB2PIXEL( p_filter, 0, 0, pi_gamma[255] );
+            p_sys->p_rgb16[BLUE_OFFSET - BLUE_MARGIN + i_index] = RGB2PIXEL( p_filter, 0, 0, pi_gamma[0] );
+            p_sys->p_rgb16[BLUE_OFFSET + BLUE_MARGIN + i_index] = RGB2PIXEL( p_filter, 0, 0, pi_gamma[255] );
         }
         for( i_index = 0; i_index < 256; i_index++ )
         {
-            p_filter->p_sys->p_rgb16[RED_OFFSET + i_index] =   RGB2PIXEL( p_filter, pi_gamma[ i_index ], 0, 0 );
-            p_filter->p_sys->p_rgb16[GREEN_OFFSET + i_index] = RGB2PIXEL( p_filter, 0, pi_gamma[ i_index ], 0 );
-            p_filter->p_sys->p_rgb16[BLUE_OFFSET + i_index] =  RGB2PIXEL( p_filter, 0, 0, pi_gamma[ i_index ] );
+            p_sys->p_rgb16[RED_OFFSET + i_index] =   RGB2PIXEL( p_filter, pi_gamma[ i_index ], 0, 0 );
+            p_sys->p_rgb16[GREEN_OFFSET + i_index] = RGB2PIXEL( p_filter, 0, pi_gamma[ i_index ], 0 );
+            p_sys->p_rgb16[BLUE_OFFSET + i_index] =  RGB2PIXEL( p_filter, 0, 0, pi_gamma[ i_index ] );
         }
         break;
 
     case VLC_CODEC_RGB24:
     case VLC_CODEC_RGB32:
-        p_filter->p_sys->p_rgb32 = (uint32_t *)p_filter->p_sys->p_base;
+        p_sys->p_rgb32 = (uint32_t *)p_sys->p_base;
         for( i_index = 0; i_index < RED_MARGIN; i_index++ )
         {
-            p_filter->p_sys->p_rgb32[RED_OFFSET - RED_MARGIN + i_index] = RGB2PIXEL( p_filter, pi_gamma[0], 0, 0 );
-            p_filter->p_sys->p_rgb32[RED_OFFSET + 256 + i_index] =        RGB2PIXEL( p_filter, pi_gamma[255], 0, 0 );
+            p_sys->p_rgb32[RED_OFFSET - RED_MARGIN + i_index] = RGB2PIXEL( p_filter, pi_gamma[0], 0, 0 );
+            p_sys->p_rgb32[RED_OFFSET + 256 + i_index] =        RGB2PIXEL( p_filter, pi_gamma[255], 0, 0 );
         }
         for( i_index = 0; i_index < GREEN_MARGIN; i_index++ )
         {
-            p_filter->p_sys->p_rgb32[GREEN_OFFSET - GREEN_MARGIN + i_index] = RGB2PIXEL( p_filter, 0, pi_gamma[0], 0 );
-            p_filter->p_sys->p_rgb32[GREEN_OFFSET + 256 + i_index] =          RGB2PIXEL( p_filter, 0, pi_gamma[255], 0 );
+            p_sys->p_rgb32[GREEN_OFFSET - GREEN_MARGIN + i_index] = RGB2PIXEL( p_filter, 0, pi_gamma[0], 0 );
+            p_sys->p_rgb32[GREEN_OFFSET + 256 + i_index] =          RGB2PIXEL( p_filter, 0, pi_gamma[255], 0 );
         }
         for( i_index = 0; i_index < BLUE_MARGIN; i_index++ )
         {
-            p_filter->p_sys->p_rgb32[BLUE_OFFSET - BLUE_MARGIN + i_index] = RGB2PIXEL( p_filter, 0, 0, pi_gamma[0] );
-            p_filter->p_sys->p_rgb32[BLUE_OFFSET + BLUE_MARGIN + i_index] = RGB2PIXEL( p_filter, 0, 0, pi_gamma[255] );
+            p_sys->p_rgb32[BLUE_OFFSET - BLUE_MARGIN + i_index] = RGB2PIXEL( p_filter, 0, 0, pi_gamma[0] );
+            p_sys->p_rgb32[BLUE_OFFSET + BLUE_MARGIN + i_index] = RGB2PIXEL( p_filter, 0, 0, pi_gamma[255] );
         }
         for( i_index = 0; i_index < 256; i_index++ )
         {
-            p_filter->p_sys->p_rgb32[RED_OFFSET + i_index] =   RGB2PIXEL( p_filter, pi_gamma[ i_index ], 0, 0 );
-            p_filter->p_sys->p_rgb32[GREEN_OFFSET + i_index] = RGB2PIXEL( p_filter, 0, pi_gamma[ i_index ], 0 );
-            p_filter->p_sys->p_rgb32[BLUE_OFFSET + i_index] =  RGB2PIXEL( p_filter, 0, 0, pi_gamma[ i_index ] );
+            p_sys->p_rgb32[RED_OFFSET + i_index] =   RGB2PIXEL( p_filter, pi_gamma[ i_index ], 0, 0 );
+            p_sys->p_rgb32[GREEN_OFFSET + i_index] = RGB2PIXEL( p_filter, 0, pi_gamma[ i_index ], 0 );
+            p_sys->p_rgb32[BLUE_OFFSET + i_index] =  RGB2PIXEL( p_filter, 0, 0, pi_gamma[ i_index ] );
         }
         break;
     }
@@ -409,13 +411,14 @@ static void SetYUV( filter_t *p_filter )
 static void Set8bppPalette( filter_t *p_filter, uint8_t *p_rgb8 )
 {
     #define CLIP( x ) ( ((x < 0) ? 0 : (x > 255) ? 255 : x) << 8 )
+    filter_sys_t *p_sys = p_filter->p_sys;
 
     int y,u,v;
     int r,g,b;
     int i = 0, j = 0;
-    uint16_t *p_cmap_r = p_filter->p_sys->p_rgb_r;
-    uint16_t *p_cmap_g = p_filter->p_sys->p_rgb_g;
-    uint16_t *p_cmap_b = p_filter->p_sys->p_rgb_b;
+    uint16_t *p_cmap_r = p_sys->p_rgb_r;
+    uint16_t *p_cmap_g = p_sys->p_rgb_g;
+    uint16_t *p_cmap_b = p_sys->p_rgb_b;
 
     unsigned char p_lookup[PALETTE_TABLE_SIZE];
 
index acf7a04..be37d8d 100644 (file)
@@ -107,6 +107,8 @@ static void SetOffset( int i_width, int i_height, int i_pic_width,
 
 void I420_RGB16( filter_t *p_filter, picture_t *p_src, picture_t *p_dest )
 {
+    filter_sys_t *p_sys = p_filter->p_sys;
+
     /* We got this one from the old arguments */
     uint16_t *p_pic = (uint16_t*)p_dest->p->p_pixels;
     uint8_t  *p_y   = p_src->Y_PIXELS;
@@ -124,15 +126,15 @@ void I420_RGB16( filter_t *p_filter, picture_t *p_src, picture_t *p_dest )
     uint16_t *  p_pic_start;       /* beginning of the current line for copy */
     int         i_uval, i_vval;                           /* U and V samples */
     int         i_red, i_green, i_blue;          /* U and V modified samples */
-    uint16_t *  p_yuv = p_filter->p_sys->p_rgb16;
+    uint16_t *  p_yuv = p_sys->p_rgb16;
     uint16_t *  p_ybase;                     /* Y dependant conversion table */
 
     /* Conversion buffer pointer */
-    uint16_t *  p_buffer_start = (uint16_t*)p_filter->p_sys->p_buffer;
+    uint16_t *  p_buffer_start = (uint16_t*)p_sys->p_buffer;
     uint16_t *  p_buffer;
 
     /* Offset array pointer */
-    int *       p_offset_start = p_filter->p_sys->p_offset;
+    int *       p_offset_start = p_sys->p_offset;
     int *       p_offset;
 
     const int i_source_margin = p_src->p[0].i_pitch
@@ -212,6 +214,8 @@ void I420_RGB16( filter_t *p_filter, picture_t *p_src, picture_t *p_dest )
 
 void I420_RGB32( filter_t *p_filter, picture_t *p_src, picture_t *p_dest )
 {
+    filter_sys_t *p_sys = p_filter->p_sys;
+
     /* We got this one from the old arguments */
     uint32_t *p_pic = (uint32_t*)p_dest->p->p_pixels;
     uint8_t  *p_y   = p_src->Y_PIXELS;
@@ -229,15 +233,15 @@ void I420_RGB32( filter_t *p_filter, picture_t *p_src, picture_t *p_dest )
     uint32_t *  p_pic_start;       /* beginning of the current line for copy */
     int         i_uval, i_vval;                           /* U and V samples */
     int         i_red, i_green, i_blue;          /* U and V modified samples */
-    uint32_t *  p_yuv = p_filter->p_sys->p_rgb32;
+    uint32_t *  p_yuv = p_sys->p_rgb32;
     uint32_t *  p_ybase;                     /* Y dependant conversion table */
 
     /* Conversion buffer pointer */
-    uint32_t *  p_buffer_start = (uint32_t*)p_filter->p_sys->p_buffer;
+    uint32_t *  p_buffer_start = (uint32_t*)p_sys->p_buffer;
     uint32_t *  p_buffer;
 
     /* Offset array pointer */
-    int *       p_offset_start = p_filter->p_sys->p_offset;
+    int *       p_offset_start = p_sys->p_offset;
     int *       p_offset;
 
     const int i_source_margin = p_src->p[0].i_pitch
index 896694c..37c425c 100644 (file)
@@ -103,6 +103,8 @@ static void SetOffset( int i_width, int i_height, int i_pic_width,
 VLC_TARGET
 void I420_R5G5B5( filter_t *p_filter, picture_t *p_src, picture_t *p_dest )
 {
+    filter_sys_t *p_sys = p_filter->p_sys;
+
     /* We got this one from the old arguments */
     uint16_t *p_pic = (uint16_t*)p_dest->p->p_pixels;
     uint8_t  *p_y   = p_src->Y_PIXELS;
@@ -120,11 +122,11 @@ void I420_R5G5B5( filter_t *p_filter, picture_t *p_src, picture_t *p_dest )
     uint16_t *  p_pic_start;       /* beginning of the current line for copy */
 
     /* Conversion buffer pointer */
-    uint16_t *  p_buffer_start = (uint16_t*)p_filter->p_sys->p_buffer;
+    uint16_t *  p_buffer_start = (uint16_t*)p_sys->p_buffer;
     uint16_t *  p_buffer;
 
     /* Offset array pointer */
-    int *       p_offset_start = p_filter->p_sys->p_offset;
+    int *       p_offset_start = p_sys->p_offset;
     int *       p_offset;
 
     const int i_source_margin = p_src->p[0].i_pitch
@@ -335,6 +337,8 @@ void I420_R5G5B5( filter_t *p_filter, picture_t *p_src, picture_t *p_dest )
 VLC_TARGET
 void I420_R5G6B5( filter_t *p_filter, picture_t *p_src, picture_t *p_dest )
 {
+    filter_sys_t *p_sys = p_filter->p_sys;
+
     /* We got this one from the old arguments */
     uint16_t *p_pic = (uint16_t*)p_dest->p->p_pixels;
     uint8_t  *p_y   = p_src->Y_PIXELS;
@@ -352,11 +356,11 @@ void I420_R5G6B5( filter_t *p_filter, picture_t *p_src, picture_t *p_dest )
     uint16_t *  p_pic_start;       /* beginning of the current line for copy */
 
     /* Conversion buffer pointer */
-    uint16_t *  p_buffer_start = (uint16_t*)p_filter->p_sys->p_buffer;
+    uint16_t *  p_buffer_start = (uint16_t*)p_sys->p_buffer;
     uint16_t *  p_buffer;
 
     /* Offset array pointer */
-    int *       p_offset_start = p_filter->p_sys->p_offset;
+    int *       p_offset_start = p_sys->p_offset;
     int *       p_offset;
 
     const int i_source_margin = p_src->p[0].i_pitch
@@ -568,6 +572,8 @@ VLC_TARGET
 void I420_A8R8G8B8( filter_t *p_filter, picture_t *p_src,
                                             picture_t *p_dest )
 {
+    filter_sys_t *p_sys = p_filter->p_sys;
+
     /* We got this one from the old arguments */
     uint32_t *p_pic = (uint32_t*)p_dest->p->p_pixels;
     uint8_t  *p_y   = p_src->Y_PIXELS;
@@ -584,11 +590,11 @@ void I420_A8R8G8B8( filter_t *p_filter, picture_t *p_src,
     int         i_chroma_width = (p_filter->fmt_in.video.i_x_offset + p_filter->fmt_in.video.i_visible_width) / 2; /* chroma width */
     uint32_t *  p_pic_start;       /* beginning of the current line for copy */
     /* Conversion buffer pointer */
-    uint32_t *  p_buffer_start = (uint32_t*)p_filter->p_sys->p_buffer;
+    uint32_t *  p_buffer_start = (uint32_t*)p_sys->p_buffer;
     uint32_t *  p_buffer;
 
     /* Offset array pointer */
-    int *       p_offset_start = p_filter->p_sys->p_offset;
+    int *       p_offset_start = p_sys->p_offset;
     int *       p_offset;
 
     const int i_source_margin = p_src->p[0].i_pitch
@@ -798,6 +804,8 @@ void I420_A8R8G8B8( filter_t *p_filter, picture_t *p_src,
 VLC_TARGET
 void I420_R8G8B8A8( filter_t *p_filter, picture_t *p_src, picture_t *p_dest )
 {
+    filter_sys_t *p_sys = p_filter->p_sys;
+
     /* We got this one from the old arguments */
     uint32_t *p_pic = (uint32_t*)p_dest->p->p_pixels;
     uint8_t  *p_y   = p_src->Y_PIXELS;
@@ -814,11 +822,11 @@ void I420_R8G8B8A8( filter_t *p_filter, picture_t *p_src, picture_t *p_dest )
     int         i_chroma_width = (p_filter->fmt_in.video.i_x_offset + p_filter->fmt_in.video.i_visible_width) / 2; /* chroma width */
     uint32_t *  p_pic_start;       /* beginning of the current line for copy */
     /* Conversion buffer pointer */
-    uint32_t *  p_buffer_start = (uint32_t*)p_filter->p_sys->p_buffer;
+    uint32_t *  p_buffer_start = (uint32_t*)p_sys->p_buffer;
     uint32_t *  p_buffer;
 
     /* Offset array pointer */
-    int *       p_offset_start = p_filter->p_sys->p_offset;
+    int *       p_offset_start = p_sys->p_offset;
     int *       p_offset;
 
     const int i_source_margin = p_src->p[0].i_pitch
@@ -1028,6 +1036,8 @@ void I420_R8G8B8A8( filter_t *p_filter, picture_t *p_src, picture_t *p_dest )
 VLC_TARGET
 void I420_B8G8R8A8( filter_t *p_filter, picture_t *p_src, picture_t *p_dest )
 {
+    filter_sys_t *p_sys = p_filter->p_sys;
+
     /* We got this one from the old arguments */
     uint32_t *p_pic = (uint32_t*)p_dest->p->p_pixels;
     uint8_t  *p_y   = p_src->Y_PIXELS;
@@ -1044,11 +1054,11 @@ void I420_B8G8R8A8( filter_t *p_filter, picture_t *p_src, picture_t *p_dest )
     int         i_chroma_width = (p_filter->fmt_in.video.i_x_offset + p_filter->fmt_in.video.i_visible_width) / 2; /* chroma width */
     uint32_t *  p_pic_start;       /* beginning of the current line for copy */
     /* Conversion buffer pointer */
-    uint32_t *  p_buffer_start = (uint32_t*)p_filter->p_sys->p_buffer;
+    uint32_t *  p_buffer_start = (uint32_t*)p_sys->p_buffer;
     uint32_t *  p_buffer;
 
     /* Offset array pointer */
-    int *       p_offset_start = p_filter->p_sys->p_offset;
+    int *       p_offset_start = p_sys->p_offset;
     int *       p_offset;
 
     const int i_source_margin = p_src->p[0].i_pitch
@@ -1255,6 +1265,8 @@ void I420_B8G8R8A8( filter_t *p_filter, picture_t *p_src, picture_t *p_dest )
 VLC_TARGET
 void I420_A8B8G8R8( filter_t *p_filter, picture_t *p_src, picture_t *p_dest )
 {
+    filter_sys_t *p_sys = p_filter->p_sys;
+
     /* We got this one from the old arguments */
     uint32_t *p_pic = (uint32_t*)p_dest->p->p_pixels;
     uint8_t  *p_y   = p_src->Y_PIXELS;
@@ -1271,11 +1283,11 @@ void I420_A8B8G8R8( filter_t *p_filter, picture_t *p_src, picture_t *p_dest )
     int         i_chroma_width = (p_filter->fmt_in.video.i_x_offset + p_filter->fmt_in.video.i_visible_width) / 2; /* chroma width */
     uint32_t *  p_pic_start;       /* beginning of the current line for copy */
     /* Conversion buffer pointer */
-    uint32_t *  p_buffer_start = (uint32_t*)p_filter->p_sys->p_buffer;
+    uint32_t *  p_buffer_start = (uint32_t*)p_sys->p_buffer;
     uint32_t *  p_buffer;
 
     /* Offset array pointer */
-    int *       p_offset_start = p_filter->p_sys->p_offset;
+    int *       p_offset_start = p_sys->p_offset;
     int *       p_offset;
 
     const int i_source_margin = p_src->p[0].i_pitch
index a012897..5ea98dd 100644 (file)
@@ -43,6 +43,8 @@ static void SetOffset( int, int, int, int, bool *, int *, int * );
  *****************************************************************************/
 void I420_RGB8( filter_t *p_filter, picture_t *p_src, picture_t *p_dest )
 {
+    filter_sys_t *p_sys = p_filter->p_sys;
+
     /* We got this one from the old arguments */
     uint8_t *p_pic = (uint8_t*)p_dest->p->p_pixels;
     uint8_t *p_y   = p_src->Y_PIXELS;
@@ -58,10 +60,10 @@ void I420_RGB8( filter_t *p_filter, picture_t *p_src, picture_t *p_dest )
     unsigned int i_chroma_width = (p_filter->fmt_in.video.i_x_offset + p_filter->fmt_in.video.i_visible_width) / 2;/* chroma width */
 
     /* Lookup table */
-    uint8_t *        p_lookup = p_filter->p_sys->p_base;
+    uint8_t *        p_lookup = p_sys->p_base;
 
     /* Offset array pointer */
-    int *       p_offset_start = p_filter->p_sys->p_offset;
+    int *       p_offset_start = p_sys->p_offset;
     int *       p_offset;
 
     const int i_source_margin = p_src->p[0].i_pitch
index 4da7531..7fbd08b 100644 (file)
@@ -174,15 +174,16 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic )
 /* copied from video_filters/erase.c . Gruik ? */
 static void LoadMask( filter_t *p_filter, const char *psz_filename )
 {
+    filter_sys_t *p_sys = p_filter->p_sys;
     image_handler_t *p_image;
     video_format_t fmt_in, fmt_out;
     video_format_Init( &fmt_in, 0 );
     video_format_Init( &fmt_out, VLC_CODEC_YUVA );
-    if( p_filter->p_sys->p_mask )
-        picture_Release( p_filter->p_sys->p_mask );
+    if( p_sys->p_mask )
+        picture_Release( p_sys->p_mask );
     p_image = image_HandlerCreate( p_filter );
     char *psz_url = vlc_path2uri( psz_filename, NULL );
-    p_filter->p_sys->p_mask =
+    p_sys->p_mask =
         image_ReadUrl( p_image, psz_url, &fmt_in, &fmt_out );
     free( psz_url );
     video_format_Clean( &fmt_in );
index 0041e2a..2dff4f2 100644 (file)
@@ -116,37 +116,38 @@ static int Create( vlc_object_t *p_this )
     }
 
     /* Allocate structure */
-    p_filter->p_sys = malloc( sizeof( *p_filter->p_sys ) );
-    if( p_filter->p_sys == NULL )
+    filter_sys_t *p_sys = malloc( sizeof( filter_sys_t ) );
+    if( p_sys == NULL )
         return VLC_ENOMEM;
+    p_filter->p_sys = p_sys;
 
     p_filter->pf_video_filter = Filter;
 
     /* Initialize the arguments */
-    atomic_init( &p_filter->p_sys->i_window_size,
+    atomic_init( &p_sys->i_window_size,
                 var_CreateGetIntegerCommand( p_filter,
                                              FILTER_PREFIX"window-size" ) );
-    atomic_init( &p_filter->p_sys->i_softening,
+    atomic_init( &p_sys->i_softening,
                  var_CreateGetIntegerCommand( p_filter,
                                              FILTER_PREFIX"softening-size" ) );
 
-    p_filter->p_sys->p_old_data = calloc( p_filter->fmt_in.video.i_width *
-     (p_filter->fmt_in.video.i_height+1),sizeof(*p_filter->p_sys->p_old_data) );
+    p_sys->p_old_data = calloc( p_filter->fmt_in.video.i_width *
+     (p_filter->fmt_in.video.i_height+1),sizeof(*p_sys->p_old_data) );
 
-    if( p_filter->p_sys->p_old_data == NULL )
+    if( p_sys->p_old_data == NULL )
     {
-        free( p_filter->p_sys );
+        free( p_sys );
         return VLC_ENOMEM;
     }
 
-    memset( p_filter->p_sys->ia_luminance_data, 0,
-                    sizeof(p_filter->p_sys->ia_luminance_data) );
-    p_filter->p_sys->ia_luminance_data[p_filter->p_sys->i_window_size - 1] = 256;
+    memset( p_sys->ia_luminance_data, 0,
+                    sizeof(p_sys->ia_luminance_data) );
+    p_sys->ia_luminance_data[p_sys->i_window_size - 1] = 256;
 
     var_AddCallback(p_filter,FILTER_PREFIX "window-size",
-        AntiFlickerCallback, p_filter->p_sys);
+        AntiFlickerCallback, p_sys);
     var_AddCallback(p_filter,FILTER_PREFIX "softening-size",
-        AntiFlickerCallback, p_filter->p_sys);
+        AntiFlickerCallback, p_sys);
 
     return VLC_SUCCESS;
 }
@@ -159,13 +160,14 @@ 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 "window-size",
-        AntiFlickerCallback, p_filter->p_sys);
+        AntiFlickerCallback, p_sys);
     var_DelCallback(p_filter,FILTER_PREFIX "softening-size",
-        AntiFlickerCallback, p_filter->p_sys);
-    free(p_filter->p_sys->p_old_data);
-    free( p_filter->p_sys );
+        AntiFlickerCallback, p_sys);
+    free( p_sys->p_old_data );
+    free( p_sys );
 }
 
 /*****************************************************************************
@@ -213,8 +215,10 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic )
 
     /****************** Get variables *************************/
 
-    int i_window_size = atomic_load( &p_filter->p_sys->i_window_size );
-    int i_softening = atomic_load( &p_filter->p_sys->i_softening );
+    filter_sys_t *p_sys = p_filter->p_sys;
+
+    int i_window_size = atomic_load( &p_sys->i_window_size );
+    int i_softening = atomic_load( &p_sys->i_softening );
 
     uint8_t *p_yplane_in = p_pic->p[Y_PLANE].p_pixels;
     uint8_t *p_yplane_out = p_outpic->p[Y_PLANE].p_pixels;
@@ -231,9 +235,9 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic )
     /*Identify as scene change if the luminance average deviates
      more than the threshold value or if it is the first frame*/
 
-    if( abs(lum_avg - p_filter->p_sys->
+    if( abs(lum_avg - p_sys->
         ia_luminance_data[i_window_size - 1]) > SCENE_CHANGE_THRESHOLD
-        || p_filter->p_sys->ia_luminance_data[i_window_size - 1] == 256)
+        || p_sys->ia_luminance_data[i_window_size - 1] == 256)
     {
         scene_changed = true;
     }
@@ -242,24 +246,24 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic )
     {
         //reset the luminance data
         for (int i = 0; i < i_window_size; ++i)
-            p_filter->p_sys->ia_luminance_data[i] = lum_avg;
+            p_sys->ia_luminance_data[i] = lum_avg;
         plane_CopyPixels( &p_outpic->p[Y_PLANE], &p_pic->p[Y_PLANE] );
     }
     else
     {
         /******* Compute the adjustment factor using moving average ********/
         for (int i = 0; i < i_window_size-1 ; ++i)
-            p_filter->p_sys->ia_luminance_data[i] =
-                           p_filter->p_sys->ia_luminance_data[i+1];
+            p_sys->ia_luminance_data[i] =
+                           p_sys->ia_luminance_data[i+1];
 
-        p_filter->p_sys->ia_luminance_data[i_window_size - 1] = lum_avg;
+        p_sys->ia_luminance_data[i_window_size - 1] = lum_avg;
 
         float scale = 1.0;
         if (lum_avg > 0)
         {
              float filt = 0;
              for (int i = 0; i < i_window_size; i++)
-                  filt += (float) p_filter->p_sys->ia_luminance_data[i];
+                  filt += (float) p_sys->ia_luminance_data[i];
              scale = filt/(i_window_size*lum_avg);
         }
 
@@ -290,7 +294,7 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic )
     }
 
     /******* Temporal softening phase. Adapted from code by Steven Don ******/
-    uint8_t *p_yplane_out_old = p_filter->p_sys->p_old_data;
+    uint8_t *p_yplane_out_old = p_sys->p_old_data;
     int i_video_width = p_filter->fmt_in.video.i_width;
 
     for( int i_line = 0 ; i_line < i_num_lines ; i_line++ )
index 2c9aa5c..c8c064e 100644 (file)
 enum { RED, GREEN, BLUE, WHITE };
 
 #define COLORS_RGB \
-    p_filter->p_sys->colorList[RED].comp1 = 255; p_filter->p_sys->colorList[RED].comp2 = 0;        \
-                                p_filter->p_sys->colorList[RED].comp3 = 0;        \
-    p_filter->p_sys->colorList[GREEN].comp1 = 0; p_filter->p_sys->colorList[GREEN].comp2 = 255;    \
-                               p_filter->p_sys->colorList[GREEN].comp3 = 0;       \
-    p_filter->p_sys->colorList[BLUE].comp1 = 0; p_filter->p_sys->colorList[BLUE].comp2 = 0;        \
-                               p_filter->p_sys->colorList[BLUE].comp3 = 255;      \
-    p_filter->p_sys->colorList[WHITE].comp1 = 255; p_filter->p_sys->colorList[WHITE].comp2 = 255;  \
-                                  p_filter->p_sys->colorList[WHITE].comp3 = 255;
+    p_sys->colorList[RED].comp1 = 255; p_sys->colorList[RED].comp2 = 0;        \
+                                p_sys->colorList[RED].comp3 = 0;        \
+    p_sys->colorList[GREEN].comp1 = 0; p_sys->colorList[GREEN].comp2 = 255;    \
+                               p_sys->colorList[GREEN].comp3 = 0;       \
+    p_sys->colorList[BLUE].comp1 = 0; p_sys->colorList[BLUE].comp2 = 0;        \
+                               p_sys->colorList[BLUE].comp3 = 255;      \
+    p_sys->colorList[WHITE].comp1 = 255; p_sys->colorList[WHITE].comp2 = 255;  \
+                                  p_sys->colorList[WHITE].comp3 = 255;
 
 #define COLORS_YUV \
-    p_filter->p_sys->colorList[RED].comp1 = 82; p_filter->p_sys->colorList[RED].comp2 = 240;        \
-                                p_filter->p_sys->colorList[RED].comp3 = 90;        \
-    p_filter->p_sys->colorList[GREEN].comp1 = 145; p_filter->p_sys->colorList[GREEN].comp2 = 34;    \
-                               p_filter->p_sys->colorList[GREEN].comp3 = 54 ;      \
-    p_filter->p_sys->colorList[BLUE].comp1 = 41; p_filter->p_sys->colorList[BLUE].comp2 = 146;      \
-                               p_filter->p_sys->colorList[BLUE].comp3 = 240;       \
-    p_filter->p_sys->colorList[WHITE].comp1 = 255; p_filter->p_sys->colorList[WHITE].comp2 = 128;   \
-                                  p_filter->p_sys->colorList[WHITE].comp3 = 128;
+    p_sys->colorList[RED].comp1 = 82; p_sys->colorList[RED].comp2 = 240;        \
+                                p_sys->colorList[RED].comp3 = 90;        \
+    p_sys->colorList[GREEN].comp1 = 145; p_sys->colorList[GREEN].comp2 = 34;    \
+                               p_sys->colorList[GREEN].comp3 = 54 ;      \
+    p_sys->colorList[BLUE].comp1 = 41; p_sys->colorList[BLUE].comp2 = 146;      \
+                               p_sys->colorList[BLUE].comp3 = 240;       \
+    p_sys->colorList[WHITE].comp1 = 255; p_sys->colorList[WHITE].comp2 = 128;   \
+                                  p_sys->colorList[WHITE].comp3 = 128;
 
 
 /*****************************************************************************
@@ -224,27 +224,28 @@ static int Create( vlc_object_t *p_this )
     char *psz_method;
 
     /* Allocate structure */
-    p_filter->p_sys = malloc( sizeof( filter_sys_t ) );
-    if( p_filter->p_sys == NULL )
+    filter_sys_t *p_sys = malloc( sizeof( filter_sys_t ) );
+    if( p_sys == NULL )
         return VLC_ENOMEM;
+    p_filter->p_sys = p_sys;
 
     switch( p_filter->fmt_in.video.i_chroma )
     {
         case VLC_CODEC_I420:
         case VLC_CODEC_J420:
-            p_filter->p_sys->drawingPixelFunction = drawPixelI420;
+            p_sys->drawingPixelFunction = drawPixelI420;
             COLORS_YUV
             break;
         CASE_PACKED_YUV_422
-            p_filter->p_sys->drawingPixelFunction = drawPixelPacked;
+            p_sys->drawingPixelFunction = drawPixelPacked;
             COLORS_YUV
             GetPackedYuvOffsets( p_filter->fmt_in.video.i_chroma,
-                                 &p_filter->p_sys->i_y_offset,
-                                 &p_filter->p_sys->i_u_offset,
-                                 &p_filter->p_sys->i_v_offset );
+                                 &p_sys->i_y_offset,
+                                 &p_sys->i_u_offset,
+                                 &p_sys->i_v_offset );
             break;
         case VLC_CODEC_RGB24:
-            p_filter->p_sys->drawingPixelFunction = drawPixelRGB24;
+            p_sys->drawingPixelFunction = drawPixelRGB24;
             COLORS_RGB
             break;
         default:
@@ -253,8 +254,8 @@ static int Create( vlc_object_t *p_this )
             return VLC_EGENERIC;
     }
 
-    p_filter->p_sys->p_image = image_HandlerCreate( p_filter );
-    if( p_filter->p_sys->p_image == NULL )
+    p_sys->p_image = image_HandlerCreate( p_filter );
+    if( p_sys->p_image == NULL )
         return VLC_EGENERIC;
 
     p_filter->pf_video_filter = Filter;
@@ -268,42 +269,42 @@ static int Create( vlc_object_t *p_this )
     {
         msg_Err( p_filter, "configuration variable "
                  FILTER_PREFIX "color empty" );
-        p_filter->p_sys->ballColor = RED;
+        p_sys->ballColor = RED;
     }
     else
-        p_filter->p_sys->ballColor = getBallColor( p_this, psz_method );
+        p_sys->ballColor = getBallColor( p_this, psz_method );
 
     free( psz_method );
 
-    p_filter->p_sys->i_ballSize =
+    p_sys->i_ballSize =
             var_CreateGetIntegerCommand( p_filter, FILTER_PREFIX "size" );
-    p_filter->p_sys->i_ballSpeed =
+    p_sys->i_ballSpeed =
             var_CreateGetIntegerCommand( p_filter, FILTER_PREFIX "speed" );
-    p_filter->p_sys->b_edgeVisible =
+    p_sys->b_edgeVisible =
             var_CreateGetBoolCommand( p_filter, FILTER_PREFIX "edge-visible" );
-    p_filter->p_sys->i_gradThresh =
+    p_sys->i_gradThresh =
             var_CreateGetIntegerCommand( p_filter, FILTER_PREFIX "gradient-threshold" );
 
-    vlc_mutex_init( &p_filter->p_sys->lock );
+    vlc_mutex_init( &p_sys->lock );
 
     var_AddCallback( p_filter, FILTER_PREFIX "color",
-                     ballCallback, p_filter->p_sys );
+                     ballCallback, p_sys );
     var_AddCallback( p_filter, FILTER_PREFIX "size",
-                     ballCallback, p_filter->p_sys );
+                     ballCallback, p_sys );
     var_AddCallback( p_filter, FILTER_PREFIX "speed",
-                     ballCallback, p_filter->p_sys );
+                     ballCallback, p_sys );
     var_AddCallback( p_filter, FILTER_PREFIX "edge-visible",
-                     ballCallback, p_filter->p_sys );
+                     ballCallback, p_sys );
 
-    p_filter->p_sys->p_smooth = NULL;
-    p_filter->p_sys->p_grad_x = NULL;
-    p_filter->p_sys->p_grad_y = NULL;
+    p_sys->p_smooth = NULL;
+    p_sys->p_grad_x = NULL;
+    p_sys->p_grad_y = NULL;
 
-    p_filter->p_sys->i_ball_x = 100;
-    p_filter->p_sys->i_ball_y = 100;
+    p_sys->i_ball_x = 100;
+    p_sys->i_ball_y = 100;
 
-    p_filter->p_sys->f_lastVect_x = 0;
-    p_filter->p_sys->f_lastVect_y = -1;
+    p_sys->f_lastVect_x = 0;
+    p_sys->f_lastVect_y = -1;
 
     return VLC_SUCCESS;
 }
@@ -360,9 +361,10 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic )
         return NULL;
     }
 
-    vlc_mutex_lock( &p_filter->p_sys->lock );
+    filter_sys_t *p_sys = p_filter->p_sys;
+    vlc_mutex_lock( &p_sys->lock );
     FilterBall( p_filter, p_pic, p_outpic );
-    vlc_mutex_unlock( &p_filter->p_sys->lock );
+    vlc_mutex_unlock( &p_sys->lock );
 
     return CopyInfoAndRelease( p_outpic, p_pic );
 }
@@ -558,7 +560,7 @@ static void FilterBall( filter_t *p_filter, picture_t *p_inpic,
             fmt_comp.i_visible_width = fmt_comp.i_width;
             fmt_comp.i_visible_height = fmt_comp.i_height;
 
-            p_converted = image_Convert( p_filter->p_sys->p_image, p_inpic,
+            p_converted = image_Convert( p_sys->p_image, p_inpic,
                                          &(p_filter->fmt_in.video),
                                          &fmt_comp );
             if( !p_converted )
@@ -574,23 +576,23 @@ static void FilterBall( filter_t *p_filter, picture_t *p_inpic,
     const int i_numCols = p_converted->p[0].i_visible_pitch;
     const int i_numLines = p_converted->p[0].i_visible_lines;
 
-    if( !p_filter->p_sys->p_smooth )
-        p_filter->p_sys->p_smooth =
+    if( !p_sys->p_smooth )
+        p_sys->p_smooth =
                 (uint32_t *)vlc_alloc( i_numLines * i_numCols,
                                        sizeof(uint32_t));
-    p_smooth = p_filter->p_sys->p_smooth;
+    p_smooth = p_sys->p_smooth;
 
-    if( !p_filter->p_sys->p_grad_x )
-        p_filter->p_sys->p_grad_x =
+    if( !p_sys->p_grad_x )
+        p_sys->p_grad_x =
                 (int32_t *)vlc_alloc( i_numLines * i_numCols,
                                       sizeof(int32_t));
-    p_grad_x = p_filter->p_sys->p_grad_x;
+    p_grad_x = p_sys->p_grad_x;
 
-    if( !p_filter->p_sys->p_grad_y )
-        p_filter->p_sys->p_grad_y =
+    if( !p_sys->p_grad_y )
+        p_sys->p_grad_y =
                 (int32_t *)vlc_alloc( i_numLines * i_numCols,
                                       sizeof(int32_t));
-    p_grad_y = p_filter->p_sys->p_grad_y;
+    p_grad_y = p_sys->p_grad_y;
 
     if( !p_smooth || !p_grad_x || !p_grad_y ) return;
 
@@ -642,9 +644,9 @@ static void FilterBall( filter_t *p_filter, picture_t *p_inpic,
                     > p_sys->i_gradThresh )
                 {
                     ( *p_sys->drawingPixelFunction )( p_sys, p_outpic,
-                                                      p_filter->p_sys->colorList[ WHITE ].comp1,
-                                                      p_filter->p_sys->colorList[ WHITE ].comp2,
-                                                      p_filter->p_sys->colorList[ WHITE ].comp3,
+                                                      p_sys->colorList[ WHITE ].comp1,
+                                                      p_sys->colorList[ WHITE ].comp2,
+                                                      p_sys->colorList[ WHITE ].comp3,
                                                       x, y, 0 );
                 }
             }
index afb4b4e..12f4115 100644 (file)
@@ -639,7 +639,7 @@ static void Blend(filter_t *filter,
                   picture_t *dst, const picture_t *src,
                   int x_offset, int y_offset, int alpha)
 {
-    filter_sys_t *sys = filter->p_sys;
+    filter_sys_t *sys = reinterpret_cast<filter_sys_t *>( filter->p_sys );
 
     if( x_offset < 0 || y_offset < 0 )
     {
@@ -693,6 +693,7 @@ static int Open(vlc_object_t *object)
 static void Close(vlc_object_t *object)
 {
     filter_t *filter = (filter_t *)object;
-    delete filter->p_sys;
+    filter_sys_t *p_sys = reinterpret_cast<filter_sys_t *>( filter->p_sys );
+    delete p_sys;
 }
 
index 41fe476..36bf8a9 100644 (file)
@@ -379,8 +379,9 @@ static int Activate( vlc_object_t *p_this )
 static void Destroy( vlc_object_t *p_this )
 {
     filter_t *p_filter = (filter_t *)p_this;
-    filter_chain_Delete( p_filter->p_sys->p_chain );
-    free( p_filter->p_sys );
+    filter_sys_t *p_sys = p_filter->p_sys;
+    filter_chain_Delete( p_sys->p_chain );
+    free( p_sys );
 }
 
 /*****************************************************************************
@@ -388,5 +389,6 @@ static void Destroy( vlc_object_t *p_this )
  *****************************************************************************/
 static picture_t *Filter( filter_t *p_filter, picture_t *p_pic )
 {
-    return filter_chain_VideoFilter( p_filter->p_sys->p_chain, p_pic );
+    filter_sys_t *p_sys = p_filter->p_sys;
+    return filter_chain_VideoFilter( p_sys->p_chain, p_pic );
 }
index 795c907..c93d0ec 100644 (file)
@@ -356,10 +356,11 @@ static void filter_PsychedelicControl(filter_t *filter, struct filter_chain *fch
 static picture_t *
 Filter(filter_t *filter, picture_t *src)
 {
-    struct ci_filters_ctx *ctx = filter->p_sys->ctx;
+    filter_sys_t *p_sys = filter->p_sys;
+    struct ci_filters_ctx *ctx = p_sys->ctx;
     enum filter_type filter_types[NUM_MAX_EQUIVALENT_VLC_FILTERS];
 
-    filter_desc_table_GetFilterTypes(filter->p_sys->psz_filter, filter_types);
+    filter_desc_table_GetFilterTypes(p_sys->psz_filter, filter_types);
     if (ctx->fchain->filter != filter_types[0])
         return src;
 
@@ -425,14 +426,14 @@ Filter(filter_t *filter, picture_t *src)
             return NULL;
     }
 
-    filter->p_sys->mouse_moved = false;
+    p_sys->mouse_moved = false;
     return dst;
 
 error:
     if (dst)
         picture_Release(dst);
     picture_Release(src);
-    filter->p_sys->mouse_moved = false;
+    p_sys->mouse_moved = false;
     return NULL;
 }
 
@@ -582,6 +583,7 @@ static int
 Open(vlc_object_t *obj, char const *psz_filter)
 {
     filter_t *filter = (filter_t *)obj;
+    filter_sys_t *p_sys = filter->p_sys;
 
     switch (filter->fmt_in.video.i_chroma)
     {
@@ -666,8 +668,8 @@ Open(vlc_object_t *obj, char const *psz_filter)
     else if (Open_CreateFilters(filter, &ctx->fchain, filter_types))
         goto error;
 
-    filter->p_sys->psz_filter = psz_filter;
-    filter->p_sys->ctx = ctx;
+    p_sys->psz_filter = psz_filter;
+    p_sys->ctx = ctx;
 
     filter->pf_video_filter = Filter;
     filter->pf_video_mouse = Mouse;
@@ -682,7 +684,7 @@ error:
             CVPixelBufferPoolRelease(ctx->cvpx_pool);
         free(ctx);
     }
-    free(filter->p_sys);
+    free(p_sys);
     return VLC_EGENERIC;
 }
 
@@ -732,10 +734,11 @@ static void
 Close(vlc_object_t *obj)
 {
     filter_t *filter = (filter_t *)obj;
-    struct ci_filters_ctx *ctx = filter->p_sys->ctx;
+    filter_sys_t *p_sys = filter->p_sys;
+    struct ci_filters_ctx *ctx = p_sys->ctx;
     enum filter_type filter_types[NUM_MAX_EQUIVALENT_VLC_FILTERS];
 
-    filter_desc_table_GetFilterTypes(filter->p_sys->psz_filter, filter_types);
+    filter_desc_table_GetFilterTypes(p_sys->psz_filter, filter_types);
     for (unsigned int i = 0;
          i < NUM_MAX_EQUIVALENT_VLC_FILTERS && filter_types[i] != FILTER_NONE;
          ++i)
@@ -749,7 +752,7 @@ Close(vlc_object_t *obj)
         free(ctx);
         var_Destroy(filter->obj.parent, "ci-filters-ctx");
     }
-    free(filter->p_sys);
+    free(p_sys);
 }
 
 #define CI_CUSTOM_FILTER_TEXT N_("Use a specific Core Image Filter")
index 6ad9b06..e8b0e2e 100644 (file)
@@ -133,10 +133,11 @@ int RenderBob( filter_t *p_filter, picture_t *p_outpic, picture_t *p_pic,
 int RenderLinear( filter_t *p_filter,
                   picture_t *p_outpic, picture_t *p_pic, int order, int i_field )
 {
-    VLC_UNUSED(p_filter);
     VLC_UNUSED(order);
     int i_plane;
 
+    filter_sys_t *p_sys = p_filter->p_sys;
+
     /* Copy image and skip lines */
     for( i_plane = 0 ; i_plane < p_pic->i_planes ; i_plane++ )
     {
@@ -190,9 +191,10 @@ int RenderLinear( filter_t *p_filter,
 
 int RenderMean( filter_t *p_filter, picture_t *p_outpic, picture_t *p_pic )
 {
-    VLC_UNUSED(p_filter);
     int i_plane;
 
+    filter_sys_t *p_sys = p_filter->p_sys;
+
     /* Copy image and skip lines */
     for( i_plane = 0 ; i_plane < p_pic->i_planes ; i_plane++ )
     {
@@ -224,9 +226,10 @@ int RenderMean( filter_t *p_filter, picture_t *p_outpic, picture_t *p_pic )
 
 int RenderBlend( filter_t *p_filter, picture_t *p_outpic, picture_t *p_pic )
 {
-    VLC_UNUSED(p_filter);
     int i_plane;
 
+    filter_sys_t *p_sys = p_filter->p_sys;
+
     /* Copy image and skip lines */
     for( i_plane = 0 ; i_plane < p_pic->i_planes ; i_plane++ )
     {
index 9f9d529..2574786 100644 (file)
@@ -434,7 +434,8 @@ static void SetFilterMethod( filter_t *p_filter, const char *mode, bool pack )
 static void GetOutputFormat( filter_t *p_filter,
                       video_format_t *p_dst, const video_format_t *p_src )
 {
-    GetDeinterlacingOutput(&p_filter->p_sys->context, p_dst, p_src);
+    filter_sys_t *p_sys = p_filter->p_sys;
+    GetDeinterlacingOutput(&p_sys->context, p_dst, p_src);
 }
 
 /*****************************************************************************
@@ -444,7 +445,8 @@ static void GetOutputFormat( filter_t *p_filter,
 /* This is the filter function. See Open(). */
 picture_t *Deinterlace( filter_t *p_filter, picture_t *p_pic )
 {
-    return DoDeinterlacing( p_filter, &p_filter->p_sys->context, p_pic );
+    filter_sys_t *p_sys = p_filter->p_sys;
+    return DoDeinterlacing( p_filter, &p_sys->context, p_pic );
 }
 
 /*****************************************************************************
@@ -453,7 +455,8 @@ picture_t *Deinterlace( filter_t *p_filter, picture_t *p_pic )
 
 void Flush( filter_t *p_filter )
 {
-    FlushDeinterlacing(&p_filter->p_sys->context);
+    filter_sys_t *p_sys = p_filter->p_sys;
+    FlushDeinterlacing(&p_sys->context);
 
     IVTCClearState( p_filter );
 }
@@ -468,7 +471,8 @@ int Mouse( filter_t *p_filter,
 {
     VLC_UNUSED(p_old);
     *p_mouse = *p_new;
-    if( p_filter->p_sys->context.settings.b_half_height )
+    filter_sys_t *p_sys = p_filter->p_sys;
+    if( p_sys->context.settings.b_half_height )
         p_mouse->i_y *= 2;
     return VLC_SUCCESS;
 }
index f13e8af..d5b5861 100644 (file)
@@ -269,6 +269,8 @@ void ComposeFrame( filter_t *p_filter,
             i_output_chroma == CC_SOURCE_BOTTOM ||
             i_output_chroma == CC_MERGE );
 
+    filter_sys_t *p_sys = p_filter->p_sys;
+
     const bool b_upconvert_chroma = i_output_chroma == CC_UPCONVERT;
 
     for( int i_plane = 0 ; i_plane < p_inpic_top->i_planes ; i_plane++ )
index 74b5ab5..70dcbef 100644 (file)
@@ -58,7 +58,7 @@
  * merge routine.
  *
  */
-#define Merge p_filter->p_sys->pf_merge
+#define Merge p_sys->pf_merge
 
 /*
  * EndMerge() macro, which must be called after the merge is
@@ -66,7 +66,7 @@
  */
 #if defined(__i386__) || defined(__x86_64__)
 # define EndMerge() \
-    if(p_filter->p_sys->pf_end_merge) (p_filter->p_sys->pf_end_merge)()
+    if(p_sys->pf_end_merge) (p_sys->pf_end_merge)()
 #else
 # define EndMerge() (void)0
 #endif
index 54d6296..3e9f36e 100644 (file)
@@ -97,26 +97,26 @@ struct filter_sys_t
 
 static void LoadMask( filter_t *p_filter, const char *psz_filename )
 {
+    filter_sys_t *p_sys = p_filter->p_sys;
     image_handler_t *p_image;
     video_format_t fmt_in, fmt_out;
-    picture_t *p_old_mask = p_filter->p_sys->p_mask;
+    picture_t *p_old_mask = p_sys->p_mask;
     video_format_Init( &fmt_in, 0 );
     video_format_Init( &fmt_out, VLC_CODEC_YUVA );
     p_image = image_HandlerCreate( p_filter );
     char *psz_url = vlc_path2uri( psz_filename, NULL );
-    p_filter->p_sys->p_mask =
-        image_ReadUrl( p_image, psz_url, &fmt_in, &fmt_out );
+    p_sys->p_mask = image_ReadUrl( p_image, psz_url, &fmt_in, &fmt_out );
     free( psz_url );
     video_format_Clean( &fmt_in );
     video_format_Clean( &fmt_out );
-    if( p_filter->p_sys->p_mask )
+    if( p_sys->p_mask )
     {
         if( p_old_mask )
             picture_Release( p_old_mask );
     }
     else if( p_old_mask )
     {
-        p_filter->p_sys->p_mask = p_old_mask;
+        p_sys->p_mask = p_old_mask;
         msg_Err( p_filter, "Error while loading new mask. Keeping old mask." );
     }
     else
index 870db76..9c265d7 100644 (file)
@@ -119,27 +119,29 @@ static int Create( vlc_object_t *p_this )
     }
 
     /* Allocate structure */
-    p_filter->p_sys = malloc( sizeof( filter_sys_t ) );
-    if( p_filter->p_sys == NULL )
+    filter_sys_t *p_sys = malloc( sizeof( filter_sys_t ) );
+    if( p_sys == NULL )
         return VLC_ENOMEM;
-    p_filter->p_sys->projection_matrix = malloc( 9 * sizeof( int ) );
-    if( !p_filter->p_sys->projection_matrix )
+    p_filter->p_sys = p_sys;
+
+    p_sys->projection_matrix = malloc( 9 * sizeof( int ) );
+    if( !p_sys->projection_matrix )
     {
-        free( p_filter->p_sys );
+        free( p_sys );
         return VLC_ENOMEM;
     }
 
     config_ChainParse( p_filter, FILTER_PREFIX, ppsz_filter_options,
                        p_filter->p_cfg );
 
-    p_filter->p_sys->i_color = var_CreateGetIntegerCommand( p_filter,
+    p_sys->i_color = var_CreateGetIntegerCommand( p_filter,
                                                FILTER_PREFIX "component" );
     /* Matrix won't be used for RED, GREEN or BLUE in planar formats */
-    make_projection_matrix( p_filter, p_filter->p_sys->i_color,
-                            p_filter->p_sys->projection_matrix );
-    vlc_mutex_init( &p_filter->p_sys->lock );
+    make_projection_matrix( p_filter, p_sys->i_color,
+                            p_sys->projection_matrix );
+    vlc_mutex_init( &p_sys->lock );
     var_AddCallback( p_filter, FILTER_PREFIX "component",
-                     ExtractCallback, p_filter->p_sys );
+                     ExtractCallback, p_sys );
 
     p_filter->pf_video_filter = Filter;
 
index d8a6c14..6fc8a0d 100644 (file)
@@ -179,7 +179,8 @@ static int Open( vlc_object_t *p_this)
 static void Close( vlc_object_t *p_this )
 {
     filter_t *p_filter = (filter_t*)p_this;
-    if( p_filter->p_sys->p_previous_pic )
-        picture_Release( p_filter->p_sys->p_previous_pic );
-    free( p_filter->p_sys );
+    filter_sys_t *p_sys = p_filter->p_sys;
+    if( p_sys->p_previous_pic )
+        picture_Release( p_sys->p_previous_pic );
+    free( p_sys );
 }
index 7f7bd3b..6e51d47 100644 (file)
@@ -148,28 +148,29 @@ static int Create( vlc_object_t *p_this )
         return VLC_EGENERIC;
     }
 
-    p_filter->p_sys = malloc( sizeof( filter_sys_t ) );
-    if( p_filter->p_sys == NULL )
+    filter_sys_t *p_sys = malloc( sizeof( filter_sys_t ) );
+    if( p_sys == NULL )
         return VLC_ENOMEM;
+    p_filter->p_sys = p_sys;
 
     config_ChainParse( p_filter, FILTER_PREFIX, ppsz_filter_options,
                        p_filter->p_cfg );
 
     p_filter->pf_video_filter = Filter;
 
-    p_filter->p_sys->f_sigma =
+    p_sys->f_sigma =
         var_CreateGetFloat( p_filter, FILTER_PREFIX "sigma" );
-    if( p_filter->p_sys->f_sigma <= 0. )
+    if( p_sys->f_sigma <= 0. )
     {
         msg_Err( p_filter, "sigma must be greater than zero" );
         return VLC_EGENERIC;
     }
-    gaussianblur_InitDistribution( p_filter->p_sys );
+    gaussianblur_InitDistribution( p_sys );
     msg_Dbg( p_filter, "gaussian distribution is %d pixels wide",
-             p_filter->p_sys->i_dim*2+1 );
+             p_sys->i_dim*2+1 );
 
-    p_filter->p_sys->pt_buffer = NULL;
-    p_filter->p_sys->pt_scale = NULL;
+    p_sys->pt_buffer = NULL;
+    p_sys->pt_scale = NULL;
 
     return VLC_SUCCESS;
 }
@@ -177,12 +178,13 @@ 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;
 
-    free( p_filter->p_sys->pt_distribution );
-    free( p_filter->p_sys->pt_buffer );
-    free( p_filter->p_sys->pt_scale );
+    free( p_sys->pt_distribution );
+    free( p_sys->pt_buffer );
+    free( p_sys->pt_scale );
 
-    free( p_filter->p_sys );
+    free( p_sys );
 }
 
 static picture_t *Filter( filter_t *p_filter, picture_t *p_pic )
index 7f9f000..9adb6da 100644 (file)
@@ -147,13 +147,14 @@ static int Create( vlc_object_t *p_this )
     }
 
     /* Allocate structure */
-    p_filter->p_sys = malloc( sizeof( filter_sys_t ) );
-    if( p_filter->p_sys == NULL )
+    filter_sys_t *p_sys = malloc( sizeof( filter_sys_t ) );
+    if( p_sys == NULL )
         return VLC_ENOMEM;
+    p_filter->p_sys = p_sys;
 
     p_filter->pf_video_filter = Filter;
 
-    p_filter->p_sys->p_pre_hough = NULL;
+    p_sys->p_pre_hough = NULL;
 
     config_ChainParse( p_filter, FILTER_PREFIX, ppsz_filter_options,
                    p_filter->p_cfg );
@@ -163,46 +164,46 @@ static int Create( vlc_object_t *p_this )
     {
         msg_Err( p_filter, "configuration variable "
                  FILTER_PREFIX "mode empty" );
-        p_filter->p_sys->i_mode = GRADIENT;
+        p_sys->i_mode = GRADIENT;
     }
     else
     {
         if( !strcmp( psz_method, "gradient" ) )
         {
-            p_filter->p_sys->i_mode = GRADIENT;
+            p_sys->i_mode = GRADIENT;
         }
         else if( !strcmp( psz_method, "edge" ) )
         {
-            p_filter->p_sys->i_mode = EDGE;
+            p_sys->i_mode = EDGE;
         }
         else if( !strcmp( psz_method, "hough" ) )
         {
-            p_filter->p_sys->i_mode = HOUGH;
+            p_sys->i_mode = HOUGH;
         }
         else
         {
             msg_Err( p_filter, "no valid gradient mode provided (%s)", psz_method );
-            p_filter->p_sys->i_mode = GRADIENT;
+            p_sys->i_mode = GRADIENT;
         }
     }
     free( psz_method );
 
-    p_filter->p_sys->i_gradient_type =
+    p_sys->i_gradient_type =
         var_CreateGetIntegerCommand( p_filter, FILTER_PREFIX "type" );
-    p_filter->p_sys->b_cartoon =
+    p_sys->b_cartoon =
         var_CreateGetBoolCommand( p_filter, FILTER_PREFIX "cartoon" );
 
-    vlc_mutex_init( &p_filter->p_sys->lock );
+    vlc_mutex_init( &p_sys->lock );
     var_AddCallback( p_filter, FILTER_PREFIX "mode",
-                     GradientCallback, p_filter->p_sys );
+                     GradientCallback, p_sys );
     var_AddCallback( p_filter, FILTER_PREFIX "type",
-                     GradientCallback, p_filter->p_sys );
+                     GradientCallback, p_sys );
     var_AddCallback( p_filter, FILTER_PREFIX "cartoon",
-                     GradientCallback, p_filter->p_sys );
+                     GradientCallback, p_sys );
 
-    p_filter->p_sys->p_buf32 = NULL;
-    p_filter->p_sys->p_buf32_bis = NULL;
-    p_filter->p_sys->p_buf8 = NULL;
+    p_sys->p_buf32 = NULL;
+    p_sys->p_buf32_bis = NULL;
+    p_sys->p_buf8 = NULL;
 
     return VLC_SUCCESS;
 }
@@ -253,8 +254,10 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic )
         return NULL;
     }
 
-    vlc_mutex_lock( &p_filter->p_sys->lock );
-    switch( p_filter->p_sys->i_mode )
+    filter_sys_t *p_sys = p_filter->p_sys;
+
+    vlc_mutex_lock( &p_sys->lock );
+    switch( p_sys->i_mode )
     {
         case EDGE:
             FilterEdge( p_filter, p_pic, p_outpic );
@@ -271,7 +274,7 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic )
         default:
             break;
     }
-    vlc_mutex_unlock( &p_filter->p_sys->lock );
+    vlc_mutex_unlock( &p_sys->lock );
 
     return CopyInfoAndRelease( p_outpic, p_pic );
 }
@@ -340,6 +343,8 @@ static void GaussianConvolution( picture_t *p_inpic, uint32_t *p_smooth )
 static void FilterGradient( filter_t *p_filter, picture_t *p_inpic,
                                                 picture_t *p_outpic )
 {
+    filter_sys_t *p_sys = p_filter->p_sys;
+
     const int i_src_pitch = p_inpic->p[Y_PLANE].i_pitch;
     const int i_src_visible = p_inpic->p[Y_PLANE].i_visible_pitch;
     const int i_dst_pitch = p_outpic->p[Y_PLANE].i_pitch;
@@ -349,14 +354,14 @@ static void FilterGradient( filter_t *p_filter, picture_t *p_inpic,
     uint8_t *p_outpix = p_outpic->p[Y_PLANE].p_pixels;
 
     uint32_t *p_smooth;
-    if( !p_filter->p_sys->p_buf32 )
-        p_filter->p_sys->p_buf32 =
+    if( !p_sys->p_buf32 )
+        p_sys->p_buf32 =
             vlc_alloc( i_num_lines * i_src_visible, sizeof(uint32_t));
-    p_smooth = p_filter->p_sys->p_buf32;
+    p_smooth = p_sys->p_buf32;
 
     if( !p_smooth ) return;
 
-    if( p_filter->p_sys->b_cartoon )
+    if( p_sys->b_cartoon )
     {
         plane_CopyPixels( &p_outpic->p[U_PLANE], &p_inpic->p[U_PLANE] );
         plane_CopyPixels( &p_outpic->p[V_PLANE], &p_inpic->p[V_PLANE] );
@@ -396,9 +401,9 @@ static void FilterGradient( filter_t *p_filter, picture_t *p_inpic,
                     + ((int)p_smooth[(y + 1) * i_src_visible + x - 1] \
                      - (int)p_smooth[(y + 1) * i_src_visible + x + 1]));
 
-    if( p_filter->p_sys->i_gradient_type )
+    if( p_sys->i_gradient_type )
     {
-        if( p_filter->p_sys->b_cartoon )
+        if( p_sys->b_cartoon )
         {
             FOR
             if( a > 60 )
@@ -459,6 +464,8 @@ static void FilterGradient( filter_t *p_filter, picture_t *p_inpic,
 static void FilterEdge( filter_t *p_filter, picture_t *p_inpic,
                                             picture_t *p_outpic )
 {
+    filter_sys_t *p_sys = p_filter->p_sys;
+
     const int i_src_pitch = p_inpic->p[Y_PLANE].i_pitch;
     const int i_src_visible = p_inpic->p[Y_PLANE].i_visible_pitch;
     const int i_dst_pitch = p_outpic->p[Y_PLANE].i_pitch;
@@ -471,24 +478,24 @@ static void FilterEdge( filter_t *p_filter, picture_t *p_inpic,
     uint32_t *p_grad;
     uint8_t *p_theta;
 
-    if( !p_filter->p_sys->p_buf32 )
-        p_filter->p_sys->p_buf32 =
+    if( !p_sys->p_buf32 )
+        p_sys->p_buf32 =
             vlc_alloc( i_num_lines * i_src_visible, sizeof(uint32_t));
-    p_smooth = p_filter->p_sys->p_buf32;
+    p_smooth = p_sys->p_buf32;
 
-    if( !p_filter->p_sys->p_buf32_bis )
-        p_filter->p_sys->p_buf32_bis =
+    if( !p_sys->p_buf32_bis )
+        p_sys->p_buf32_bis =
             vlc_alloc( i_num_lines * i_src_visible, sizeof(uint32_t));
-    p_grad = p_filter->p_sys->p_buf32_bis;
+    p_grad = p_sys->p_buf32_bis;
 
-    if( !p_filter->p_sys->p_buf8 )
-        p_filter->p_sys->p_buf8 =
+    if( !p_sys->p_buf8 )
+        p_sys->p_buf8 =
             vlc_alloc( i_num_lines * i_src_visible, sizeof(uint8_t));
-    p_theta = p_filter->p_sys->p_buf8;
+    p_theta = p_sys->p_buf8;
 
     if( !p_smooth || !p_grad || !p_theta ) return;
 
-    if( p_filter->p_sys->b_cartoon )
+    if( p_sys->b_cartoon )
     {
         plane_CopyPixels( &p_outpic->p[U_PLANE], &p_inpic->p[U_PLANE] );
         plane_CopyPixels( &p_outpic->p[V_PLANE], &p_inpic->p[V_PLANE] );
@@ -590,7 +597,7 @@ static void FilterEdge( filter_t *p_filter, picture_t *p_inpic,
             else
             {
                 colorize:
-                if( p_filter->p_sys->b_cartoon )
+                if( p_sys->b_cartoon )
                 {
                     if( p_smooth[y*i_src_visible+x] > 0xa0 )
                         p_outpix[y*i_dst_pitch+x] = (uint8_t)
@@ -613,10 +620,12 @@ static void FilterEdge( filter_t *p_filter, picture_t *p_inpic,
 /*****************************************************************************
  * FilterHough
  *****************************************************************************/
-#define p_pre_hough p_filter->p_sys->p_pre_hough
+#define p_pre_hough p_sys->p_pre_hough
 static void FilterHough( filter_t *p_filter, picture_t *p_inpic,
                                              picture_t *p_outpic )
 {
+    filter_sys_t *p_sys = p_filter->p_sys;
+
     int i_src_visible = p_inpic->p[Y_PLANE].i_visible_pitch;
     int i_dst_pitch = p_outpic->p[Y_PLANE].i_pitch;
     int i_num_lines = p_inpic->p[Y_PLANE].i_visible_lines;
index 803a288..2db07ee 100644 (file)
@@ -99,27 +99,28 @@ 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 )
+    filter_sys_t *p_sys = malloc( sizeof( filter_sys_t ) );
+    if( p_sys == NULL )
         return VLC_ENOMEM;
+    p_filter->p_sys = p_sys;
 
-    p_filter->p_sys->p_tmp = picture_NewFromFormat( &p_filter->fmt_in.video );
-    if( !p_filter->p_sys->p_tmp )
+    p_sys->p_tmp = picture_NewFromFormat( &p_filter->fmt_in.video );
+    if( !p_sys->p_tmp )
     {
-        free( p_filter->p_sys );
+        free( p_sys );
         return VLC_ENOMEM;
     }
-    p_filter->p_sys->b_first = true;
+    p_sys->b_first = true;
 
     p_filter->pf_video_filter = Filter;
 
     config_ChainParse( p_filter, FILTER_PREFIX, ppsz_filter_options,
                        p_filter->p_cfg );
 
-    atomic_init( &p_filter->p_sys->i_factor,
+    atomic_init( &p_sys->i_factor,
              var_CreateGetIntegerCommand( p_filter, FILTER_PREFIX "factor" ) );
     var_AddCallback( p_filter, FILTER_PREFIX "factor",
-                     MotionBlurCallback, p_filter->p_sys );
+                     MotionBlurCallback, p_sys );
 
 
     return VLC_SUCCESS;
@@ -131,12 +132,13 @@ 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 "factor",
-                     MotionBlurCallback, p_filter->p_sys );
+                     MotionBlurCallback, p_sys );
 
-    picture_Release( p_filter->p_sys->p_tmp );
-    free( p_filter->p_sys );
+    picture_Release( p_sys->p_tmp );
+    free( p_sys );
 }
 
 /*****************************************************************************
index 06b8b2d..285006c 100644 (file)
@@ -92,21 +92,22 @@ static int Create( vlc_object_t *p_this )
     }
 
     /* Allocate structure */
-    p_filter->p_sys = malloc( sizeof( filter_sys_t ) );
-    if( p_filter->p_sys == NULL )
+    filter_sys_t *p_sys = malloc( sizeof( filter_sys_t ) );
+    if( p_sys == NULL )
         return VLC_ENOMEM;
+    p_filter->p_sys = p_sys;
 
     p_filter->pf_video_filter = Filter;
 
-    p_filter->p_sys->x = 10;
-    p_filter->p_sys->y = 10;
-    p_filter->p_sys->scale = 1;
-    p_filter->p_sys->xinc = 1;
-    p_filter->p_sys->yinc = 1;
-    p_filter->p_sys->scaleinc = 1;
-    p_filter->p_sys->u = 0;
-    p_filter->p_sys->v = 0;
-    p_filter->p_sys->p_image = NULL;
+    p_sys->x = 10;
+    p_sys->y = 10;
+    p_sys->scale = 1;
+    p_sys->xinc = 1;
+    p_sys->yinc = 1;
+    p_sys->scaleinc = 1;
+    p_sys->u = 0;
+    p_sys->v = 0;
+    p_sys->p_image = NULL;
 
     return VLC_SUCCESS;
 }
@@ -119,12 +120,13 @@ 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;
 
-    if( p_filter->p_sys->p_image )
-        image_HandlerDelete( p_filter->p_sys->p_image );
-    p_filter->p_sys->p_image = NULL;
+    if( p_sys->p_image )
+        image_HandlerDelete( p_sys->p_image );
+    p_sys->p_image = NULL;
 
-    free( p_filter->p_sys );
+    free( p_sys );
 }
 
 /*****************************************************************************
@@ -153,12 +155,14 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic )
         return NULL;
     }
 
-    if( !p_filter->p_sys->p_image )
-        p_filter->p_sys->p_image = image_HandlerCreate( p_filter );
+    filter_sys_t *p_sys = p_filter->p_sys;
+
+    if( !p_sys->p_image )
+        p_sys->p_image = image_HandlerCreate( p_filter );
 
     /* chrominance */
-    u = p_filter->p_sys->u;
-    v = p_filter->p_sys->v;
+    u = p_sys->u;
+    v = p_sys->v;
     for( int y = 0; y < p_outpic->p[U_PLANE].i_lines; y++ )
     {
         memset(
@@ -182,11 +186,11 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic )
 
     /* image visualization */
     fmt_out = p_filter->fmt_out.video;
-    fmt_out.i_width = p_filter->fmt_out.video.i_width*p_filter->p_sys->scale/150;
-    fmt_out.i_height = p_filter->fmt_out.video.i_height*p_filter->p_sys->scale/150;
+    fmt_out.i_width = p_filter->fmt_out.video.i_width*p_sys->scale/150;
+    fmt_out.i_height = p_filter->fmt_out.video.i_height*p_sys->scale/150;
     fmt_out.i_visible_width = fmt_out.i_width;
     fmt_out.i_visible_height = fmt_out.i_height;
-    p_converted = image_Convert( p_filter->p_sys->p_image, p_pic,
+    p_converted = image_Convert( p_sys->p_image, p_pic,
                                  &(p_pic->format), &fmt_out );
 
     if( p_converted )
@@ -195,15 +199,15 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic )
         for( int y = 0; y<p_converted->p[plane].i_visible_lines; y++ ) { \
         for( int x = 0; x<p_converted->p[plane].i_visible_pitch; x++ ) { \
             int nx, ny; \
-            if( p_filter->p_sys->yinc == 1 ) \
+            if( p_sys->yinc == 1 ) \
                 ny= y; \
             else \
                 ny = p_converted->p[plane].i_visible_lines-y; \
-            if( p_filter->p_sys->xinc == 1 ) \
+            if( p_sys->xinc == 1 ) \
                 nx = x; \
             else \
                 nx = p_converted->p[plane].i_visible_pitch-x; \
-            p_outpic->p[plane].p_pixels[(p_filter->p_sys->x*b+nx)+(ny+p_filter->p_sys->y*b)*p_outpic->p[plane].i_pitch ] = p_converted->p[plane].p_pixels[y*p_converted->p[plane].i_pitch+x]; \
+            p_outpic->p[plane].p_pixels[(p_sys->x*b+nx)+(ny+p_sys->y*b)*p_outpic->p[plane].i_pitch ] = p_converted->p[plane].p_pixels[y*p_converted->p[plane].i_pitch+x]; \
         } }
         copyimage( Y_PLANE, 2 );
         copyimage( U_PLANE, 1 );
@@ -217,40 +221,40 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic )
         msg_Err( p_filter, "Image scaling failed miserably." );
     }
 
-    p_filter->p_sys->x += p_filter->p_sys->xinc;
-    p_filter->p_sys->y += p_filter->p_sys->yinc;
+    p_sys->x += p_sys->xinc;
+    p_sys->y += p_sys->yinc;
 
-    p_filter->p_sys->scale += p_filter->p_sys->scaleinc;
-    if( p_filter->p_sys->scale >= 50 ) p_filter->p_sys->scaleinc = -1;
-    if( p_filter->p_sys->scale <= 1 ) p_filter->p_sys->scaleinc = 1;
+    p_sys->scale += p_sys->scaleinc;
+    if( p_sys->scale >= 50 ) p_sys->scaleinc = -1;
+    if( p_sys->scale <= 1 ) p_sys->scaleinc = 1;
 
-    w = p_filter->fmt_out.video.i_width*p_filter->p_sys->scale/150;
-    h = p_filter->fmt_out.video.i_height*p_filter->p_sys->scale/150;
-    if( p_filter->p_sys->x*2 + w >= p_filter->fmt_out.video.i_width )
-        p_filter->p_sys->xinc = -1;
-    if( p_filter->p_sys->x <= 0 )
-        p_filter->p_sys->xinc = 1;
+    w = p_filter->fmt_out.video.i_width*p_sys->scale/150;
+    h = p_filter->fmt_out.video.i_height*p_sys->scale/150;
+    if( p_sys->x*2 + w >= p_filter->fmt_out.video.i_width )
+        p_sys->xinc = -1;
+    if( p_sys->x <= 0 )
+        p_sys->xinc = 1;
 
-    if( p_filter->p_sys->x*2 + w >= p_filter->fmt_out.video.i_width )
-        p_filter->p_sys->x = (p_filter->fmt_out.video.i_width-w)/2;
-    if( p_filter->p_sys->y*2 + h >= p_filter->fmt_out.video.i_height )
-        p_filter->p_sys->y = (p_filter->fmt_out.video.i_height-h)/2;
+    if( p_sys->x*2 + w >= p_filter->fmt_out.video.i_width )
+        p_sys->x = (p_filter->fmt_out.video.i_width-w)/2;
+    if( p_sys->y*2 + h >= p_filter->fmt_out.video.i_height )
+        p_sys->y = (p_filter->fmt_out.video.i_height-h)/2;
 
-    if( p_filter->p_sys->y*2 + h >= p_filter->fmt_out.video.i_height )
-        p_filter->p_sys->yinc = -1;
-    if( p_filter->p_sys->y <= 0 )
-        p_filter->p_sys->yinc = 1;
+    if( p_sys->y*2 + h >= p_filter->fmt_out.video.i_height )
+        p_sys->yinc = -1;
+    if( p_sys->y <= 0 )
+        p_sys->yinc = 1;
 
     for( int y = 0; y < 16; y++ )
     {
-        if( p_filter->p_sys->v == 0 && p_filter->p_sys->u != 0 )
-            p_filter->p_sys->u -= 1;
-        else if( p_filter->p_sys->u == 0xff )
-            p_filter->p_sys->v -= 1;
-        else if( p_filter->p_sys->v == 0xff )
-            p_filter->p_sys->u += 1;
-        else if( p_filter->p_sys->u == 0 )
-            p_filter->p_sys->v += 1;
+        if( p_sys->v == 0 && p_sys->u != 0 )
+            p_sys->u -= 1;
+        else if( p_sys->u == 0xff )
+            p_sys->v -= 1;
+        else if( p_sys->v == 0xff )
+            p_sys->u += 1;
+        else if( p_sys->u == 0 )
+            p_sys->v += 1;
     }
 
     return CopyInfoAndRelease( p_outpic, p_pic );
index 2e085e8..59dcdfd 100644 (file)
@@ -520,8 +520,8 @@ int puzzle_piece_foreground( filter_t *p_filter, int32_t i_piece) {
         }
     }
 
-    free( p_filter->p_sys->ps_pieces );
-    p_filter->p_sys->ps_pieces = ps_pieces_tmp;
+    free( p_sys->ps_pieces );
+    p_sys->ps_pieces = ps_pieces_tmp;
 
     return VLC_SUCCESS;
 }
@@ -715,8 +715,8 @@ int puzzle_sort_layers( filter_t *p_filter)
         }
     }
 
-    free( p_filter->p_sys->ps_pieces );
-    p_filter->p_sys->ps_pieces = p_sys->ps_pieces_tmp;
+    free( p_sys->ps_pieces );
+    p_sys->ps_pieces = p_sys->ps_pieces_tmp;
     p_sys->ps_pieces_tmp = malloc( sizeof( piece_t) * p_sys->s_allocated.i_pieces_nbr );
     if (!p_sys->ps_pieces_tmp)
         return VLC_ENOMEM;
index 9427cf3..5fd9079 100644 (file)
@@ -78,7 +78,7 @@ int puzzle_bake_pieces_shapes( filter_t *p_filter)
         p_sys->ps_pieces_shapes[i_piece] = malloc( sizeof( piece_shape_t) * p_sys->s_allocated.i_planes );
         if( !p_sys->ps_pieces_shapes[i_piece] )
             return VLC_ENOMEM;
-        for (uint8_t i_plane = 0; i_plane < p_filter->p_sys->s_allocated.i_planes; i_plane++) {
+        for (uint8_t i_plane = 0; i_plane < p_sys->s_allocated.i_planes; i_plane++) {
             p_sys->ps_pieces_shapes[i_piece][i_plane].i_row_nbr = 0;
             p_sys->ps_pieces_shapes[i_piece][i_plane].ps_piece_shape_row = NULL;
         }
@@ -86,7 +86,7 @@ int puzzle_bake_pieces_shapes( filter_t *p_filter)
 
     int32_t i_currect_shape = 0;
 
-    for (uint8_t i_plane = 0; i_plane < p_filter->p_sys->s_allocated.i_planes; i_plane++) {
+    for (uint8_t i_plane = 0; i_plane < p_sys->s_allocated.i_planes; i_plane++) {
         int i_ret;
         i_ret = puzzle_generate_sect_border( p_filter, &p_sys->ps_pieces_shapes[i_currect_shape+0][i_plane], i_plane, puzzle_SHAPE_LEFT);
         if (i_ret != VLC_SUCCESS) return i_ret;
@@ -127,7 +127,7 @@ int puzzle_bake_pieces_shapes( filter_t *p_filter)
         }
 
         int i_ret;
-        for (uint8_t i_plane = 0; i_plane < p_filter->p_sys->s_allocated.i_planes; i_plane++) {
+        for (uint8_t i_plane = 0; i_plane < p_sys->s_allocated.i_planes; i_plane++) {
             i_ret = puzzle_generate_sect_bezier( p_filter, &p_sys->ps_pieces_shapes[i_currect_shape][i_plane],   7, ps_scale_pts_V, i_plane, puzzle_SHAPE_LEFT);
             if (i_ret != VLC_SUCCESS) break;
             i_ret = puzzle_generate_sect_bezier( p_filter, &p_sys->ps_pieces_shapes[i_currect_shape+1][i_plane], 7, ps_neg_pts_V,   i_plane, puzzle_SHAPE_LEFT);
index d676e72..2157b8d 100644 (file)
@@ -87,14 +87,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 )
+    filter_sys_t *p_sys = malloc( sizeof( filter_sys_t ) );
+    if( p_sys == NULL )
         return VLC_ENOMEM;
-
+    p_filter->p_sys = p_sys;
     p_filter->pf_video_filter = Filter;
 
-    p_filter->p_sys->f_angle = 0.0;
-    p_filter->p_sys->last_date = 0;
+    p_sys->f_angle = 0.0;
+    p_sys->last_date = 0;
 
     return VLC_SUCCESS;
 }
@@ -132,9 +132,11 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic )
         return NULL;
     }
 
-    p_filter->p_sys->f_angle -= (p_filter->p_sys->last_date - new_date) / 100000.0;
-    p_filter->p_sys->last_date = new_date;
-    f_angle = p_filter->p_sys->f_angle;
+    filter_sys_t *p_sys = p_filter->p_sys;
+
+    p_sys->f_angle -= (p_sys->last_date - new_date) / 100000.0;
+    p_sys->last_date = new_date;
+    f_angle = p_sys->f_angle;
 
     for( int i_index = 0; i_index < p_pic->i_planes; i_index++ )
     {
index bd72ca6..d0d5164 100644 (file)
@@ -114,21 +114,22 @@ static int Create( vlc_object_t *p_this )
     }
 
     /* Allocate structure */
-    p_filter->p_sys = malloc( sizeof( filter_sys_t ) );
-    if( p_filter->p_sys == NULL )
+    filter_sys_t *p_sys = malloc( sizeof( filter_sys_t ) );
+    if( p_sys == NULL )
         return VLC_ENOMEM;
+    p_filter->p_sys = p_sys;
 
     p_filter->pf_video_filter = Filter;
 
     config_ChainParse( p_filter, FILTER_PREFIX, ppsz_filter_options,
                    p_filter->p_cfg );
 
-    atomic_init(&p_filter->p_sys->sigma,
+    atomic_init(&p_sys->sigma,
                 var_CreateGetFloatCommand(p_filter, FILTER_PREFIX "sigma")
                 * (1 << 20));
 
     var_AddCallback( p_filter, FILTER_PREFIX "sigma",
-                     SharpenCallback, p_filter->p_sys );
+                     SharpenCallback, p_sys );
 
     return VLC_SUCCESS;
 }
@@ -168,7 +169,7 @@ static void Destroy( vlc_object_t *p_this )
         const unsigned data_sz = sizeof(data_t);                        \
         const int i_src_line_len = p_outpic->p[Y_PLANE].i_pitch / data_sz; \
         const int i_out_line_len = p_pic->p[Y_PLANE].i_pitch / data_sz; \
-        const int sigma = atomic_load(&p_filter->p_sys->sigma);         \
+        const int sigma = atomic_load(&p_sys->sigma);         \
                                                                         \
         memcpy(p_out, p_src, i_visible_pitch);                          \
                                                                         \
@@ -219,6 +220,8 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic )
         return NULL;
     }
 
+    filter_sys_t *p_sys = p_filter->p_sys;
+
     if (!IS_YUV_420_10BITS(p_pic->format.i_chroma))
         SHARPEN_FRAME(255, uint8_t);
     else
index c3ba392..b384d6b 100644 (file)
@@ -87,14 +87,12 @@ 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;
+    filter_sys_t *p_sys = p_filter->p_sys;
 
     p_filter->pf_video_filter = Filter;
 
-    p_filter->p_sys->f_angle = 0.0;
-    p_filter->p_sys->last_date = 0;
+    p_sys->f_angle = 0.0;
+    p_sys->last_date = 0;
 
     return VLC_SUCCESS;
 }
@@ -132,9 +130,11 @@ static picture_t *Filter( filter_t *p_filter, picture_t *p_pic )
         return NULL;
     }
 
-    p_filter->p_sys->f_angle += (new_date - p_filter->p_sys->last_date) / 200000.0;
-    p_filter->p_sys->last_date = new_date;
-    f_angle = p_filter->p_sys->f_angle;
+    filter_sys_t *p_sys = p_filter->p_sys;
+
+    p_sys->f_angle += (new_date - p_sys->last_date) / 200000.0;
+    p_sys->last_date = new_date;
+    f_angle = p_sys->f_angle;
 
     for( int i_index = 0 ; i_index < p_pic->i_planes ; i_index++ )
     {
index 06f8d1b..aacde8a 100644 (file)
@@ -198,8 +198,9 @@ static void Close(vlc_object_t *p_this)
 static block_t *DoWork(filter_t *p_filter, block_t *p_in_buf)
 {
     block_t *block = block_Duplicate(p_in_buf);
+    filter_sys_t *p_sys = p_filter->p_sys;
     if (likely(block != NULL))
-        block_FifoPut(p_filter->p_sys->fifo, block);
+        block_FifoPut(p_sys->fifo, block);
     return p_in_buf;
 }
 
index 746c7c9..d42cd5a 100644 (file)
@@ -165,7 +165,7 @@ static int Open( vlc_object_t * p_this )
     filter_t     *p_filter = (filter_t *)p_this;
     filter_sys_t *p_sys;
 
-    p_sys = p_filter->p_sys = (filter_sys_t*)malloc( sizeof( *p_sys ) );
+    p_filter->p_sys = p_sys = (filter_sys_t*)malloc( sizeof( *p_sys ) );
     if( !p_sys )
         return VLC_ENOMEM;
 
@@ -215,7 +215,7 @@ error:
 static void Close( vlc_object_t *p_this )
 {
     filter_t  *p_filter = (filter_t *)p_this;
-    filter_sys_t *p_sys = p_filter->p_sys;
+    filter_sys_t *p_sys = reinterpret_cast<filter_sys_t *>( p_filter->p_sys );
 
     /* Stop the thread
      * XXX vlc_cleanup_push does not seems to work with C++ so no
@@ -243,7 +243,7 @@ static void Close( vlc_object_t *p_this )
  */
 static block_t *DoWork( filter_t *p_filter, block_t *p_in_buf )
 {
-    filter_sys_t *p_sys = p_filter->p_sys;
+    filter_sys_t *p_sys = reinterpret_cast<filter_sys_t *>( p_filter->p_sys );
 
     vlc_mutex_lock( &p_sys->lock );
     if( p_sys->i_buffer_size > 0 )
@@ -272,7 +272,7 @@ static block_t *DoWork( filter_t *p_filter, block_t *p_in_buf )
 static void *Thread( void *p_data )
 {
     filter_t  *p_filter = (filter_t*)p_data;
-    filter_sys_t *p_sys = p_filter->p_sys;
+    filter_sys_t *p_sys = reinterpret_cast<filter_sys_t *>( p_filter->p_sys );
     vlc_gl_t *gl = p_sys->gl;
     locale_t loc;
     locale_t oldloc;
index e0c47d8..702adfd 100644 (file)
@@ -388,8 +388,9 @@ static void *Thread( void *data )
 static block_t *DoWork( filter_t *p_filter, block_t *p_in_buf )
 {
     block_t *block = block_Duplicate( p_in_buf );
+    filter_sys_t *p_sys = p_filter->p_sys;
     if( likely(block != NULL) )
-        block_FifoPut( p_filter->p_sys->fifo, block );
+        block_FifoPut( p_sys->fifo, block );
     return p_in_buf;
 }
 
@@ -404,7 +405,7 @@ static void Close( vlc_object_t *p_this )
     vlc_cancel( p_sys->thread );
     vlc_join( p_sys->thread, NULL );
     block_FifoRelease( p_sys->fifo );
-    aout_filter_RequestVout( p_filter, p_filter->p_sys->p_vout, NULL );
+    aout_filter_RequestVout( p_filter, p_sys->p_vout, NULL );
 
     /* Free the list */
     for( int i = 0; i < p_sys->i_effect; i++ )