[vlc-devel] [PATCH 1/2] Anti-flicker filter initial version

dharani prabhu dharani.prabhu.s at gmail.com
Sat Apr 9 20:41:40 CEST 2011


Hi,

    I have attached the patch addressing the review comments mentioned
below. I have developed the video filter based on virtualdub. Pls see
http://neuron2.net/deflick/flick.html for more details about the video
filter and sample videos

-Dharani

On Sun, Apr 3, 2011 at 1:18 PM, Rémi Duraffort <ivoire at videolan.org> wrote:

> Some small remarks.
>
> >
> +/*****************************************************************************
> > + * antiflicker.c : antiflicker video effect plugin for vlc
> > +
> *****************************************************************************
> > + * Copyright (C) 2000-2008 the VideoLAN team
> Wrong date.
>
> > + * $Id:
> > + *
> > + * Authors: S Dharani Prabhu
> > + * Email:   dharani.prabhu.s at gmail.com
> We usually write "Authors: name <email>
>
> >
> +/*****************************************************************************
> > + * filter_sys_t: Distort video output method descriptor
> > +
> *****************************************************************************
> > + * This structure is part of the video output thread descriptor.
> > + * It describes the Distort specific properties of an output thread.
> > +
> *****************************************************************************/
> > +struct filter_sys_t
> > +{
> > +    vlc_mutex_t lock;
> > +    uint8_t i_window_size;
> > +    uint8_t i_softening;
> > +    uint8_t* p_old_data;
> > +    uint32_t ia_luminance_data[MAX_WINDOW_SZ];
> > +};
> Not really important here, but that's better to have bigger struc
> members at the begining and smaller ones at the end (help avoiding hole
> in the structure).
>
> >
> +/*****************************************************************************
> > + * Destroy: destroy Distort video thread output method
> > +
> *****************************************************************************
> > + * Terminate an output method created by DistortCreateOutputMethod
> > +
> *****************************************************************************/
> > +static void Destroy( vlc_object_t *p_this )
> > +{
> > +    filter_t *p_filter = (filter_t *)p_this;
> > +
> > +    var_DelCallback(p_filter,FILTER_PREFIX "winsz",
> > +        AntiFlickerCallback, p_filter->p_sys);
> > +    var_DelCallback(p_filter,FILTER_PREFIX "sftn",
> > +        AntiFlickerCallback, p_filter->p_sys);
> > +    vlc_mutex_destroy( &p_filter->p_sys->lock );
>
> p_filter->p_sys->p_old_data is never freed AFAIK.
>
> > +    free( p_filter->p_sys );
> > +}
>
>
> >
> +/*****************************************************************************
> > + * Filter: adjust the luminance value and renders
> > +
> *****************************************************************************
> > + * The function uses moving average of past frames to adjust the
> luminance
> > + * of current frame also applies temporaral smoothening if enabled.
> > +
> *****************************************************************************/
> > +static picture_t *Filter( filter_t *p_filter, picture_t *p_pic )
> > +{
> > [...]
> > +    /******* Temporal softening phase. Adapted from code by Steven Don
> ******/
> > +    uint8_t *src1, *src2;
> > +    long diff, ofs, sum;
> > +
> > +    if( !p_filter->p_sys->p_old_data )
> > +    {
> > +        p_filter->p_sys->p_old_data =
> > +          malloc( (i_num_lines * i_out_pitch + i_num_cols) *
> sizeof(uint8_t) );
> > +        memset( p_filter->p_sys->p_old_data, 0,
> > +                  (i_num_lines * i_out_pitch + i_num_cols) *
> sizeof(uint8_t) );
> > +
> You can use calloc instead of malloc+memset(0)
> Moreover I cannot find where p_old_data is freed.
>
>
> I cannot judge for the algorithm itself.
>
>
> Best regards
>
> --
> Rémi Duraffort | ivoire
> http://ivoire.dinauz.org/blog/
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> http://mailman.videolan.org/listinfo/vlc-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20110410/3da74221/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Anti-flicker-filter-initial-version.patch
Type: application/octet-stream
Size: 14427 bytes
Desc: not available
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20110410/3da74221/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-Anti-flicker-filter-initial-version.patch
Type: application/octet-stream
Size: 4263 bytes
Desc: not available
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20110410/3da74221/attachment-0001.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0003-Addressed-the-review-comments.patch
Type: application/octet-stream
Size: 2514 bytes
Desc: not available
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20110410/3da74221/attachment-0002.obj>


More information about the vlc-devel mailing list