Branch Coverage

lib/PDL/ImageRGB/ppm_quant.c
Criterion Covered Total %
branch 0 140 0.0


line true false branch
173 0 0 if (DEBUG) fprintf(stderr,"%s: remapping to ppm-style internal fmt\n", fn);
177 0 0 if (!pixels) FatalError("couldn't allocate 'pixels' array");
178 0 0 for (row=0; row
180 0 0 if (!pixels[row]) FatalError("couldn't allocate a row of pixels array");
183 0 0 for (col=0, pP=pixels[row]; col
190 0 0 for (col=0, pP=pixels[row]; col
197 0 0 for (col=0, pP=pixels[row]; col
209 0 0 if (DEBUG) fprintf(stderr,"%s: done format remapping\n", fn);
223 0 0 if (DEBUG) fprintf(stderr, "%s: making histogram\n", fn);
226 0 0 if (chv != (chist_vec) 0) break;
228 0 0 if (DEBUG) fprintf(stderr, "%s: too many colors!\n", fn);
230 0 0 if (DEBUG) fprintf(stderr, "%s: rescaling colors (maxval=%d) %s\n",
233 0 0 for (row=0; row
234 0 0 for (col=0, pP=pixels[row]; col
239 0 0 if (DEBUG) fprintf(stderr,"%s: %d colors found\n", fn, colors);
248 0 0 if (DEBUG) fprintf(stderr, "%s: choosing %d colors\n", fn, newcolors);
259 0 0 if (DEBUG) fprintf(stderr,"%s: mapping image to new colors\n", fn);
263 0 0 for (row = 0; row < rows; ++row) {
274 0 0 for (chl = cht[hash]; chl; chl = chl->next)
275 0 0 if (PPM_EQUAL(chl->ch.color, *pP)) {index = chl->ch.value; break;}
0 0 if (PPM_EQUAL(chl->ch.color, *pP)) {index = chl->ch.value; break;}
0 0 if (PPM_EQUAL(chl->ch.color, *pP)) {index = chl->ch.value; break;}
277 0 0 if (!chl /*index = -1*/) {/* No; search colormap for closest match. */
286 0 0 for (i=0; i
295 0 0 if (newdist
300 0 0 if (!chl) FatalError("ran out of memory adding to hash table");
313 0 0 while (col != limitcol);
318 0 0 for (i=0; i
326 0 0 for (i=0; i
358 0 0 if (!bv || !colormap) FatalError("unable to malloc in mediancut()");
0 0 if (!bv || !colormap) FatalError("unable to malloc in mediancut()");
360 0 0 for (i=0; i
376 0 0 while ( boxes < newcolors ) {
385 0 0 for (bi=0; bv[bi].colors<2 && bi
0 0 for (bi=0; bv[bi].colors<2 && bi
386 0 0 if (bi == boxes) break; /* ran out of colors! */
400 0 0 for (i=1; i
402 0 0 if (v < minr) minr = v;
403 0 0 if (v > maxr) maxr = v;
406 0 0 if (v < ming) ming = v;
407 0 0 if (v > maxg) maxg = v;
410 0 0 if (v < minb) minb = v;
411 0 0 if (v > maxb) maxb = v;
437 0 0 if (rl >= gl && rl >= bl)
0 0 if (rl >= gl && rl >= bl)
440 0 0 else if (gl >= bl)
454 0 0 for (i=1; i
455 0 0 if (lowersum >= halfsum) break;
482 0 0 for (bi=0; bi
488 0 0 for (i=0; i
495 0 0 r = r / sum; if (r>maxval) r = maxval; /* avoid math errors */
496 0 0 g = g / sum; if (g>maxval) g = maxval;
497 0 0 b = b / sum; if (b>maxval) b = maxval;
544 0 0 if (!cht) return (chist_vec) 0;
565 0 0 for (row=0; row
566 0 0 for (col=0, pP=pixels[row]; col
569 0 0 for (chl = cht[hash]; chl != (chist_list) 0; chl = chl->next)
570 0 0 if (PPM_EQUAL(chl->ch.color, *pP)) break;
0 0 if (PPM_EQUAL(chl->ch.color, *pP)) break;
0 0 if (PPM_EQUAL(chl->ch.color, *pP)) break;
572 0 0 if (chl != (chist_list) 0) ++(chl->ch.value);
574 0 0 if ((*colorsP)++ > maxcolors) {
580 0 0 if (!chl) FatalError("ran out of memory computing hash table");
600 0 0 if (!cht) FatalError("ran out of memory allocating hash table");
602 0 0 for (i=0; i
620 0 0 if (!chv) FatalError("ran out of memory generating histogram");
624 0 0 for (i=0; i
625 0 0 for (chl = cht[i]; chl != (chist_list) 0; chl = chl->next) {
648 0 0 for (i=0; i
649 0 0 for (chl = cht[i]; chl != (chist_list) 0; chl = chlnext) {