[vlc-devel] [PATCH] chorus_flanger.c : bit of cleanup
Jean-Baptiste Kempf
jb at videolan.org
Mon Mar 12 11:10:01 CET 2012
I think most of this code you remove was pending for future
improvements. Therefore, I am not sure this is a good idea to remove
them. See FIXME and TODO in the code.
On Wed, Mar 07, 2012 at 03:54:12PM -0800, Sukrit Sangwan wrote :
> diff --git a/modules/audio_filter/chorus_flanger.c
> b/modules/audio_filter/chorus_flanger.c
> index efeade6..f85451d 100644
> --- a/modules/audio_filter/chorus_flanger.c
> +++ b/modules/audio_filter/chorus_flanger.c
> @@ -51,7 +51,6 @@ static block_t *DoWork( filter_t *, block_t * );
> struct filter_sys_t
> {
> /* TODO: Cleanup and optimise */
> - int i_cumulative;
> int i_channels, i_sampleRate;
> float f_delayTime, f_feedbackGain; /* delayTime is in milliseconds */
> float f_wetLevel, f_dryLevel;
> @@ -59,8 +58,6 @@ struct filter_sys_t
>
> float f_step,f_offset;
> int i_step,i_offset;
> - float f_temp;
> - float f_sinMultiplier;
>
> /* This data is for the the circular queue which stores the samples. */
> int i_bufferLength;
> @@ -188,24 +185,14 @@ static int Open( vlc_object_t *p_this )
> return VLC_ENOMEM;
> }
>
> - p_sys->i_cumulative = 0;
> p_sys->f_step = p_sys->f_sweepRate / 1000.0;
> p_sys->i_step = p_sys->f_sweepRate > 0 ? 1 : 0;
> p_sys->f_offset = 0;
> p_sys->i_offset = 0;
> - p_sys->f_temp = 0;
>
> p_sys->pf_delayLineEnd = p_sys->pf_delayLineStart +
> p_sys->i_bufferLength;
> p_sys->pf_write = p_sys->pf_delayLineStart;
>
> - if( p_sys->f_sweepDepth < small_value() ||
> - p_filter->fmt_in.audio.i_rate < small_value() ) {
> - p_sys->f_sinMultiplier = 0.0;
> - }
> - else {
> - p_sys->f_sinMultiplier = 11 * p_sys->f_sweepRate /
> - ( 7 * p_sys->f_sweepDepth * p_filter->fmt_in.audio.i_rate ) ;
> - }
> p_sys->i_sampleRate = p_filter->fmt_in.audio.i_rate;
>
> return VLC_SUCCESS;
> @@ -239,7 +226,7 @@ static block_t *DoWork( filter_t *p_filter, block_t
> *p_in_buf )
> float *p_out = (float*)p_in_buf->p_buffer;
> float *p_in = (float*)p_in_buf->p_buffer;
>
> - float *pf_ptr, f_diff = 0, f_frac = 0, f_temp = 0 ;
> + float *pf_ptr, f_temp = 0 ;
>
> /* Process each sample */
> for( unsigned i = 0; i < i_samples ; i++ )
> @@ -269,8 +256,7 @@ static block_t *DoWork( filter_t *p_filter, block_t
> *p_in_buf )
> }
> /* Calculate position in delay */
> int offset = floor( p_sys->f_offset );
> - pf_ptr = p_sys->pf_write + i_maxOffset * p_sys->i_channels +
> - offset * p_sys->i_channels;
> + pf_ptr = p_sys->pf_write + (i_maxOffset + offset) *
> p_sys->i_channels;
>
> /* Handle Overflow */
> if( pf_ptr < p_sys->pf_delayLineStart )
> @@ -282,12 +268,9 @@ static block_t *DoWork( filter_t *p_filter, block_t
> *p_in_buf )
> pf_ptr -= p_sys->i_bufferLength - p_sys->i_channels;
> }
> /* For interpolation */
> - f_frac = ( p_sys->f_offset - (int)p_sys->f_offset );
> for( i_chan = 0; i_chan < p_sys->i_channels; i_chan++ )
> {
> - f_diff = *( pf_ptr + p_sys->i_channels + i_chan )
> - - *( pf_ptr + i_chan );
> - f_temp = ( *( pf_ptr + i_chan ) );//+ f_diff * f_frac);
> + f_temp = *( pf_ptr + i_chan );
> /*Linear Interpolation. FIXME. This creates LOTS of noise */
> sanitize(&f_temp);
> p_out[i_chan] = p_sys->f_dryLevel * p_in[i_chan] +
>
>
>
> --
> Regards
> Sukrit Sangwan
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> http://mailman.videolan.org/listinfo/vlc-devel
--
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