diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2012-10-06 14:03:15 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2012-10-06 14:03:15 +0200 |
commit | 24702a91e4f0455030d03b0489a3149ee6db01a4 (patch) | |
tree | e8287191036ec4b91d83a2765342546ab0042b09 | |
parent | 56d7f7d955826959b2d3b97d6ef352b7917c98ea (diff) | |
download | ffmpeg-24702a91e4f0455030d03b0489a3149ee6db01a4.tar.gz |
pca: get rid of VLA
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r-- | libavutil/pca.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/libavutil/pca.c b/libavutil/pca.c index 0839d68ed2..54927a2cb3 100644 --- a/libavutil/pca.c +++ b/libavutil/pca.c @@ -32,6 +32,7 @@ typedef struct PCA{ int n; double *covariance; double *mean; + double *z; }PCA; PCA *ff_pca_init(int n){ @@ -41,6 +42,7 @@ PCA *ff_pca_init(int n){ pca= av_mallocz(sizeof(PCA)); pca->n= n; + pca->z = av_malloc(sizeof(*pca->z) * n); pca->count=0; pca->covariance= av_mallocz(sizeof(double)*n*n); pca->mean= av_mallocz(sizeof(double)*n); @@ -51,6 +53,7 @@ PCA *ff_pca_init(int n){ void ff_pca_free(PCA *pca){ av_freep(&pca->covariance); av_freep(&pca->mean); + av_freep(&pca->z); av_free(pca); } @@ -70,7 +73,7 @@ int ff_pca(PCA *pca, double *eigenvector, double *eigenvalue){ int i, j, pass; int k=0; const int n= pca->n; - double z[n]; + double *z = pca->z; memset(eigenvector, 0, sizeof(double)*n*n); |