line |
true |
false |
branch |
50
|
0 |
22 |
if (quant->translate == pt_giflib) { |
127
|
1 |
17 |
if (quant->mc_count == 0) { |
133
|
0 |
17 |
if (bytes / img->ysize != img->xsize) { |
146
|
0 |
5 |
if (!translate_errdiff(quant, img, result)) { |
213
|
22380 |
247920 |
if (in>255) { return 255; } |
214
|
43265 |
204655 |
else if (in>0) return in; |
315
|
0 |
0 |
if (makemap_palette(quant, imgs, count)) |
322
|
0 |
0 |
for (i=0; i < quant->mc_count; ++i) { |
330
|
0 |
0 |
for (; i < quant->mc_size; ++i) { |
341
|
0 |
0 |
for (img_num = 0; img_num < count; ++img_num) { |
342
|
0 |
0 |
if (imgs[img_num]->xsize > maxwidth) |
350
|
0 |
0 |
for(iter=0;iter<3;iter++) { |
353
|
0 |
0 |
for (img_num = 0; img_num < count; ++img_num) { |
355
|
0 |
0 |
sample_indices = im->channels >= 3 ? NULL : gray_samples; |
356
|
0 |
0 |
for(y=0;yysize;y++) { |
359
|
0 |
0 |
for(x=0;xxsize;x++) { |
364
|
0 |
0 |
for(i=0;i
|
368
|
0 |
0 |
if (cd
|
385
|
0 |
0 |
for(i=0;i
|
386
|
0 |
0 |
if (clr[i].mcount) { |
397
|
0 |
0 |
for(i=0;i
|
398
|
0 |
0 |
if (clr[i].fixed) continue; /* skip reserved colors */ |
400
|
0 |
0 |
if (clr[i].mcount) { |
438
|
0 |
0 |
for (i = 0; i < cnum; ++i) { |
439
|
0 |
0 |
if (clr[i].fixed || clr[i].used) { |
|
0 |
0 |
if (clr[i].fixed || clr[i].used) { |
511
|
0 |
0 |
for (ch = 0; ch < 3; ++ch) { |
515
|
0 |
0 |
for (i = part->start; i < part->start + part->size; ++i) { |
516
|
0 |
0 |
for (ch = 0; ch < 3; ++ch) { |
517
|
0 |
0 |
if (part->min[ch] > colors[i].rgb[ch]) |
519
|
0 |
0 |
if (part->max[ch] < colors[i].rgb[ch]) |
523
|
0 |
0 |
for (ch = 0; ch < 3; ++ch) { |
572
|
0 |
5 |
if (makemap_palette(quant, imgs, count)) |
578
|
163840 |
5 |
for (i = 0; i < MEDIAN_CUT_COLORS; ++i) { |
586
|
5 |
5 |
for (imgn = 0; imgn < count; ++imgn) { |
587
|
5 |
0 |
if (imgs[imgn]->xsize > max_width) |
595
|
5 |
5 |
for (imgn = 0; imgn < count; ++imgn) { |
597
|
447 |
5 |
for (y = 0; y < imgs[imgn]->ysize; ++y) { |
599
|
447 |
0 |
if (imgs[imgn]->channels > 2) { |
601
|
57674 |
447 |
for (x = 0; x < imgs[imgn]->xsize; ++x) { |
607
|
0 |
0 |
for (x = 0; x < imgs[imgn]->xsize; ++x) { |
616
|
163840 |
5 |
for (in = 0; in < MEDIAN_CUT_COLORS; ++in) { |
617
|
374 |
163466 |
if (colors[in].count) { |
630
|
5 |
0 |
if (out < quant->mc_size) { |
632
|
374 |
5 |
for (i = 0; i < out; ++i) { |
633
|
1122 |
374 |
for (ch = 0; ch < 3; ++ch) { |
649
|
0 |
0 |
while (color_count < quant->mc_size) { |
660
|
0 |
0 |
for (i = 0; i < color_count; ++i) { |
661
|
0 |
0 |
for (ch = 0; ch < chan_count; ++ch) { |
662
|
0 |
0 |
if (parts[i].width[ch] > max_size |
663
|
0 |
0 |
&& parts[i].size > 1) { |
672
|
0 |
0 |
if (max_size == -1) |
687
|
0 |
0 |
while (i < workpart->start + workpart->size - 1 |
688
|
0 |
0 |
&& cum_total < half) { |
708
|
0 |
0 |
for (part_num = 0; part_num < color_count; ++part_num) { |
713
|
0 |
0 |
for (ch = 0; ch < 3; ++ch) |
716
|
0 |
0 |
for (i = workpart->start; i < workpart->start + workpart->size; ++i) { |
717
|
0 |
0 |
for (ch = 0; ch < 3; ++ch) { |
721
|
0 |
0 |
for (ch = 0; ch < 3; ++ch) { |
752
|
276 |
3 |
while (gray < 256) { |
765
|
24 |
4 |
for (r = 0; r < 256; r+=0x33) |
766
|
144 |
24 |
for (g = 0; g < 256; g+=0x33) |
767
|
864 |
144 |
for (b = 0; b < 256; b += 0x33) |
776
|
0 |
0 |
for (i = 0; i < size; ++i) { |
777
|
0 |
0 |
if (c->channel[0] == quant->mc_colors[i].channel[0] |
778
|
0 |
0 |
&& c->channel[1] == quant->mc_colors[i].channel[1] |
779
|
0 |
0 |
&& c->channel[2] == quant->mc_colors[i].channel[2]) { |
811
|
5 |
0 |
for (imgn = 0; imgn < count; ++imgn) { |
813
|
5 |
0 |
if (imgs[imgn]->type != i_palette_type) { |
818
|
0 |
0 |
if (!i_tags_get_int(&imgs[imgn]->tags, "gif_eliminate_unused", 0, |
823
|
0 |
0 |
if (eliminate_unused) { |
828
|
0 |
0 |
for (y = 0; y < imgs[imgn]->ysize; ++y) { |
829
|
0 |
0 |
i_gpal(imgs[imgn], 0, imgs[imgn]->xsize, y, line); |
830
|
0 |
0 |
for (x = 0; x < imgs[imgn]->xsize; ++x) |
841
|
0 |
0 |
col_count = i_colorcount(imgs[imgn]); |
842
|
0 |
0 |
for (i = 0; i < col_count; ++i) { |
845
|
0 |
0 |
i_getcolors(imgs[imgn], i, &c, 1); |
846
|
0 |
0 |
if (used[i]) { |
847
|
0 |
0 |
if (in_palette(&c, quant, size) < 0) { |
848
|
0 |
0 |
if (size < quant->mc_size) { |
910
|
10 |
1 |
for (i = 0; i < quant->mc_count; ++i) { |
911
|
8 |
2 |
if (quant->mc_colors[i].rgb.r != quant->mc_colors[i].rgb.g |
912
|
2 |
6 |
|| quant->mc_colors[i].rgb.r != quant->mc_colors[i].rgb.b) { |
942
|
1740270 |
2047058 |
if (ra < rb) |
944
|
1944402 |
102656 |
else if (ra > rb) |
969
|
136 |
17 |
for (cr = 0; cr < 8; ++cr) { |
970
|
1088 |
136 |
for (cg = 0; cg < 8; ++cg) { |
971
|
8704 |
1088 |
for (cb = 0; cb < 8; ++cb) { |
979
|
653824 |
8704 |
for (i = 0; i < quant->mc_count; ++i) { |
995
|
49753 |
460 |
while (i < quant->mc_count && dists[indices[i]] < maxd) { |
|
41509 |
8244 |
while (i < quant->mc_count && dists[indices[i]] < maxd) { |
1282
|
12 |
0 |
if (img->channels >= 3) { |
1283
|
0 |
12 |
if (pixdev) { |
1285
|
0 |
0 |
for(y=0;yysize;y++) for(x=0;xxsize;x++) { |
|
0 |
0 |
for(y=0;yysize;y++) for(x=0;xxsize;x++) { |
1290
|
0 |
0 |
CF_FIND; |
|
0 |
0 |
CF_FIND; |
1295
|
198074 |
1359 |
for(y=0;yysize;y++) for(x=0;xxsize;x++) { |
|
1359 |
12 |
for(y=0;yysize;y++) for(x=0;xxsize;x++) { |
1297
|
317121 |
842551 |
CF_FIND; |
|
1159672 |
198074 |
CF_FIND; |
1303
|
0 |
0 |
if (pixdev) { |
1305
|
0 |
0 |
for(y=0;yysize;y++) for(x=0;xxsize;x++) { |
|
0 |
0 |
for(y=0;yysize;y++) for(x=0;xxsize;x++) { |
1309
|
0 |
0 |
CF_FIND; |
|
0 |
0 |
CF_FIND; |
1314
|
0 |
0 |
for(y=0;yysize;y++) for(x=0;xxsize;x++) { |
|
0 |
0 |
for(y=0;yysize;y++) for(x=0;xxsize;x++) { |
1317
|
0 |
0 |
CF_FIND; |
|
0 |
0 |
CF_FIND; |
1375
|
0 |
5 |
if ((quant->errdiff & ed_mask) == ed_custom) { |
1383
|
0 |
5 |
if (index >= ed_custom) index = ed_floyd; |
1391
|
30 |
5 |
for (i = 0; i < maph * mapw; ++i) { |
1392
|
0 |
30 |
if (map[i] < 0) { |
1399
|
0 |
5 |
if (!difftotal) { |
1419
|
610 |
5 |
for (y = 0; y < img->ysize; ++y) { |
1420
|
90100 |
610 |
for (x = 0; x < img->xsize; ++x) { |
1424
|
0 |
90100 |
if (img->channels < 3) { |
1427
|
100 |
90000 |
else if (is_gray) { |
1432
|
9002 |
81098 |
perr.r = perr.r < 0 ? -((-perr.r)/difftotal) : perr.r/difftotal; |
1433
|
18200 |
71900 |
perr.g = perr.g < 0 ? -((-perr.g)/difftotal) : perr.g/difftotal; |
1434
|
17780 |
72320 |
perr.b = perr.b < 0 ? -((-perr.b)/difftotal) : perr.b/difftotal; |
1439
|
104242 |
275108 |
CF_FIND; |
|
379350 |
90100 |
CF_FIND; |
1445
|
270300 |
90100 |
for (dx = 0; dx < mapw; ++dx) { |
1446
|
540600 |
270300 |
for (dy = 0; dy < maph; ++dy) { |
1455
|
610 |
610 |
for (dy = 0; dy < maph-1; ++dy) { |
1481
|
0 |
0 |
for(i=0;i<512;i++) { |
1488
|
0 |
0 |
for (i = 0; i < count; ++i) { |
1490
|
0 |
0 |
chans = im->channels >= 3 ? NULL : gray_samples; |
1491
|
0 |
0 |
for(y=0;yysize;y++) { |
1494
|
0 |
0 |
for(x=0;xxsize;x++) { |
1500
|
0 |
0 |
for(i=0;i<512;i++) prebox[i].pdc=prebox[i].pixcnt; |
1503
|
0 |
0 |
for(i=0;i
|
1515
|
0 |
0 |
while(i
|
1517
|
0 |
0 |
if (clr[i].fixed) { i++; continue; } /* reserved go to next */ |
1518
|
0 |
0 |
if (j>=prebox[k].cand) { k++; j=1; } else { |
1519
|
0 |
0 |
if (prebox[k].cand == 2) boxcenter(prebox[k].boxnum,&(clr[i])); |
1539
|
0 |
0 |
while(nidx < 511 && c.pdc < prescan[nidx+1].pdc) { |
|
0 |
0 |
while(nidx < 511 && c.pdc < prescan[nidx+1].pdc) { |
1548
|
0 |
0 |
if (a->pixcnt > b->pixcnt) return -1; |
1549
|
0 |
0 |
if (a->pixcnt < b->pixcnt) return 1; |
1584
|
0 |
0 |
while (w >= 1 || w == 0) { |
|
0 |
0 |
while (w >= 1 || w == 0) { |
1603
|
0 |
0 |
for(bx=0; bx<512; bx++) { |
1605
|
0 |
0 |
for(i=0; i
|
1607
|
0 |
0 |
if (cd < mind) { mind=cd; } |
1611
|
0 |
0 |
for(i=0;i
|
|
0 |
0 |
for(i=0;i
|
1651
|
0 |
0 |
if (r0<=r && r<=r1 && g0<=g && g<=g1 && b0<=b && b<=b1) return 0; |
|
0 |
0 |
if (r0<=r && r<=r1 && g0<=g && g<=g1 && b0<=b && b<=b1) return 0; |
|
0 |
0 |
if (r0<=r && r<=r1 && g0<=g && g<=g1 && b0<=b && b<=b1) return 0; |
|
0 |
0 |
if (r0<=r && r<=r1 && g0<=g && g<=g1 && b0<=b && b<=b1) return 0; |
|
0 |
0 |
if (r0<=r && r<=r1 && g0<=g && g<=g1 && b0<=b && b<=b1) return 0; |
|
0 |
0 |
if (r0<=r && r<=r1 && g0<=g && g<=g1 && b0<=b && b<=b1) return 0; |
1661
|
0 |
0 |
if (r0<=r && r<=r1 && g0<=g && g<=g1) return mb; |
|
0 |
0 |
if (r0<=r && r<=r1 && g0<=g && g<=g1) return mb; |
|
0 |
0 |
if (r0<=r && r<=r1 && g0<=g && g<=g1) return mb; |
|
0 |
0 |
if (r0<=r && r<=r1 && g0<=g && g<=g1) return mb; |
1662
|
0 |
0 |
if (r0<=r && r<=r1 && b0<=b && b<=b1) return mg; |
|
0 |
0 |
if (r0<=r && r<=r1 && b0<=b && b<=b1) return mg; |
|
0 |
0 |
if (r0<=r && r<=r1 && b0<=b && b<=b1) return mg; |
|
0 |
0 |
if (r0<=r && r<=r1 && b0<=b && b<=b1) return mg; |
1663
|
0 |
0 |
if (b0<=b && b<=b1 && g0<=g && g<=g1) return mr; |
|
0 |
0 |
if (b0<=b && b<=b1 && g0<=g && g<=g1) return mr; |
|
0 |
0 |
if (b0<=b && b<=b1 && g0<=g && g<=g1) return mr; |
|
0 |
0 |
if (b0<=b && b<=b1 && g0<=g && g<=g1) return mr; |
1665
|
0 |
0 |
if (r0<=r && r<=r1) return mg+mb; |
|
0 |
0 |
if (r0<=r && r<=r1) return mg+mb; |
1666
|
0 |
0 |
if (g0<=g && g<=g1) return mr+mb; |
|
0 |
0 |
if (g0<=g && g<=g1) return mr+mb; |
1667
|
0 |
0 |
if (b0<=b && b<=b1) return mg+mr; |
|
0 |
0 |
if (b0<=b && b<=b1) return mg+mr; |
1720
|
0 |
0 |
int trans_chan = img->channels > 2 ? 3 : 1; |
1722
|
0 |
0 |
for (y = 0; y < img->ysize; ++y) { |
1724
|
0 |
0 |
for (x = 0; x < img->xsize; ++x) { |
1725
|
0 |
0 |
if (line[x] < quant->tr_threshold) |
1744
|
0 |
0 |
int trans_chan = img->channels > 2 ? 3 : 1; |
1748
|
0 |
0 |
if (index >= ed_custom) index = ed_floyd; |
1761
|
0 |
0 |
for (i = 0; i < maph * mapw; ++i) |
1763
|
0 |
0 |
for (y = 0; y < img->ysize; ++y) { |
1765
|
0 |
0 |
for (x = 0; x < img->xsize; ++x) { |
1767
|
0 |
0 |
if (line[x] < 128) { |
1775
|
0 |
0 |
for (dx = 0; dx < mapw; ++dx) { |
1776
|
0 |
0 |
for (dy = 0; dy < maph; ++dy) { |
1782
|
0 |
0 |
for (dy = 0; dy < maph-1; ++dy) |
1903
|
0 |
0 |
int trans_chan = img->channels > 2 ? 3 : 1; |
1904
|
0 |
0 |
if (quant->tr_orddith == od_custom) |
1910
|
0 |
0 |
for (y = 0; y < img->ysize; ++y) { |
1912
|
0 |
0 |
for (x = 0; x < img->xsize; ++x) { |
1913
|
0 |
0 |
if (line[x] < spot[(x&7)+(y&7)*8]) |