[FFmpeg-devel] [PATCH 07/12] lpc: remove VLA in ff_lpc_compute_autocorr

Justin Ruggles justin.ruggles
Wed Jun 23 23:08:14 CEST 2010


Mans Rullgard wrote:

> ---
>  libavcodec/lpc.c |    4 +++-
>  1 files changed, 3 insertions(+), 1 deletions(-)
> 
> diff --git a/libavcodec/lpc.c b/libavcodec/lpc.c
> index 49e41d8..6b3cf01 100644
> --- a/libavcodec/lpc.c
> +++ b/libavcodec/lpc.c
> @@ -59,7 +59,7 @@ void ff_lpc_compute_autocorr(const int32_t *data, int len, int lag,
>                               double *autoc)
>  {
>      int i, j;
> -    double tmp[len + lag + 1];
> +    double *tmp = av_malloc((len + lag + 1) * sizeof(*tmp));
>      double *data1= tmp + lag;
>  
>      apply_welch_window(data, len, data1);
> @@ -86,6 +86,8 @@ void ff_lpc_compute_autocorr(const int32_t *data, int len, int lag,
>          }
>          autoc[j] = sum;
>      }
> +
> +    av_free(tmp);
>  }

looks fine to me.  But I think the sse2 version of this function also
has the same VLA.

-Justin




More information about the ffmpeg-devel mailing list