10 #include "TopTwenty.h"
13 * We only have room in the key for a maximum of 20 identifiers.
14 * We therefore choose to keep the top 20 bands --- these will
15 * be the most important ones, since this pass is performed after
16 * the threshold and standard deviation passes. If there are more
17 * than 20 bands, the excess are gathered together as an "OTHER" ]
18 * band which appears as band 20.
34 if (i <= TWENTY) return; /* nothing to do! */
36 other = (floatish*) xmalloc(nsamples * sizeof(floatish));
37 /* build a list of samples for "OTHER" */
39 compact = (i - TWENTY) + 1;
41 for (i = 0; i < nsamples; i++) {
45 for (i = 0; i < compact && i < nidents; i++) {
46 for (ch = identtable[i]->chk; ch; ch = ch->next) {
47 for (j = 0; j < ch->nd; j++) {
48 bucket = ch->d[j].bucket;
49 value = ch->d[j].value;
50 if (bucket >= nsamples)
51 Disaster("bucket out of range");
52 other[ bucket ] += value;
57 en = MakeEntry("OTHER");
60 for (i = 0; i < nsamples; i++) {
61 StoreSample(en, i, other[i]);
64 /* slide samples down */
65 for (i = compact; i < nidents; i++) {
66 identtable[i-compact+1] = identtable[i];