Commit 24702a91 authored by Michael Niedermayer's avatar Michael Niedermayer

pca: get rid of VLA

Signed-off-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parent 56d7f7d9
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment