mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-12-23 12:43:46 +02:00
pca: get rid of VLA
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
parent
56d7f7d955
commit
24702a91e4
@ -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);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user