[vlc-devel] [PATCH] chorus_flanger.c : bit of cleanup

Jean-Baptiste Kempf jb at videolan.org
Wed Mar 14 11:34:00 CET 2012


On Tue, Mar 13, 2012 at 06:16:36PM -0700, Sukrit Sangwan wrote :
>   * Author: Srikanth Raju < srikiraju at gmail dot com >
> + * Modified : Sukrit Sangwan < sukritsangwan at gmail dot com >

You are an Author or you are not. You are not a modified.

> *****************************************************************************/
> -
Why?

> +    /* Used if callback fails to allocate buffer, *
> +     * in that case dont free the buffer twice    */
> +    bool b_free_buf;

Seems overly kludgy.

> -
> -
Why?

> 
idem.

> &p_filter->fmt_in.audio );
> -    p_sys->f_delayTime      = var_CreateGetFloat( p_this, "delay-time" );
> -    p_sys->f_sweepDepth     = var_CreateGetFloat( p_this, "sweep-depth" );
> -    p_sys->f_sweepRate      = var_CreateGetFloat( p_this, "sweep-rate" );
> -    p_sys->f_feedbackGain   = var_CreateGetFloat( p_this, "feedback-gain"
> );
> -    p_sys->f_dryLevel       = var_CreateGetFloat( p_this, "dry-mix" );
> -    p_sys->f_wetLevel       = var_CreateGetFloat( p_this, "wet-mix" );
> +
> +#define CREATE_VAR( stor, var ) \
> +        p_sys->stor = var_CreateGetFloat( p_filter, var ); \
> +        var_AddCallback( p_filter, var, paramCallback, p_sys );
> +    CREATE_VAR( f_delayTime,    "delay-time" );
> +    CREATE_VAR( f_sweepDepth,   "sweep-depth" );
> +    CREATE_VAR( f_sweepRate,    "sweep-rate" );
> +    CREATE_VAR( f_feedbackGain, "feedback-gain" );
> +    CREATE_VAR( f_dryLevel,     "dry-mix" );
> +    CREATE_VAR( f_wetLevel,     "wet-mix" );

This does not really help lisibility and is unrelated to the main patch.

> +            if( pf_ptr <= p_sys->pf_delayLineStart + p_sys->i_channels )
> +                f_diff = *(p_sys->pf_delayLineEnd + i_chan) - *(pf_ptr +
> i_chan);
> +            else
> +                f_diff = *( pf_ptr - p_sys->i_channels + i_chan )
> +                            - *( pf_ptr + i_chan );
> *>>> although it was written to fix linear interpolation, i have still used
> it because it wasn't the cause of noise.*
> +            /* Linear Interpolation. */
> +            f_temp = *( pf_ptr + i_chan ) + f_diff * f_frac;
>              sanitize(&f_temp);
> +            *( p_sys->pf_write + i_chan ) = p_in[i_chan] +
> +                p_sys->f_feedbackGain * *(pf_ptr + i_chan);

This needs further checking. Rem?


> +    if( !strcmp( psz_var, "delay-time" ) )

strncmp ?

> +    p_sys->pf_delayLineStart = calloc( p_sys->i_bufferLength, sizeof(
> float ) );

Does it need to be calloced?


Please use pf_ for pointer on functions...


> *>>> I have also added a small patch for stereo_widen.c

Split it.

Best regards,

-- 
Jean-Baptiste Kempf
http://www.jbkempf.com/ - +33 672 704 734
Sent from my Electronic Device



More information about the vlc-devel mailing list