comparison dsp/segmentation/cluster_segmenter.c @ 41:6fc20388d29e

* Avoid uninitialised values in histogram when running with (pathologically?) small frame count
author cannam
date Fri, 01 Feb 2008 16:46:29 +0000
parents 8bdbda7fb893
children d72fcd34d9a7
comparison
equal deleted inserted replaced
40:163f6e03e9e7 41:6fc20388d29e
85 /* for historical reasons we normalise the histograms by their norm (not to sum to one) */ 85 /* for historical reasons we normalise the histograms by their norm (not to sum to one) */
86 void create_histograms(int* x, int nx, int m, int hlen, double* h) 86 void create_histograms(int* x, int nx, int m, int hlen, double* h)
87 { 87 {
88 int i, j, t; 88 int i, j, t;
89 double norm; 89 double norm;
90
91 for (i = 0; i < nx*m; i++)
92 h[i] = 0;
93
90 for (i = hlen/2; i < nx-hlen/2; i++) 94 for (i = hlen/2; i < nx-hlen/2; i++)
91 { 95 {
92 for (j = 0; j < m; j++) 96 for (j = 0; j < m; j++)
93 h[i*m+j] = 0; 97 h[i*m+j] = 0;
94 for (t = i-hlen/2; t <= i+hlen/2; t++) 98 for (t = i-hlen/2; t <= i+hlen/2; t++)