1173
1177
sw->oversample, sw->vmod,
1174
1178
sw->vmod * sw->virtual_jets * sw->bitwidth *
1175
1179
sw->ncolors * sw->horizontal_width, page_height);
1180
stp_dprintf(STP_DBG_WEAVE_PARAMS, v,
1181
" ***Buffer limit %d (vj %d bw %d hw %d)\n",
1182
sw->virtual_jets * sw->bitwidth * sw->horizontal_width,
1183
sw->virtual_jets, sw->bitwidth, sw->horizontal_width);
1176
1184
stp_allocate_component_data(v, "Weave", NULL, stpi_destroy_weave, sw);
1499
1507
size_t count = linecount->v[color];
1500
1508
if (place + nbytes > sw->virtual_jets * sw->bitwidth * sw->horizontal_width)
1502
stp_eprintf(v, "Buffer overflow: limit %d, actual %ld, count %ld\n",
1511
stp_eprintf(v, "ERROR: %s\n", _("Fatal error!"));
1512
stp_eprintf(v, "ERROR: Static weave data follows:\n");
1513
stp_eprintf(v, "ERROR: jets: %d\n", sw->jets);
1514
stp_eprintf(v, "ERROR: virtual_jets: %d\n", sw->virtual_jets);
1515
stp_eprintf(v, "ERROR: separation: %d\n", sw->separation);
1516
stp_eprintf(v, "ERROR: horizontal_weave: %d\n", sw->horizontal_weave);
1517
stp_eprintf(v, "ERROR: vertical_subpasses: %d\n", sw->vertical_subpasses);
1518
stp_eprintf(v, "ERROR: vmod: %d\n", sw->vmod);
1519
stp_eprintf(v, "ERROR: oversample: %d\n", sw->oversample);
1520
stp_eprintf(v, "ERROR: repeat_count: %d\n", sw->repeat_count);
1521
stp_eprintf(v, "ERROR: ncolors: %d\n", sw->ncolors);
1522
stp_eprintf(v, "ERROR: linewidth: %d\n", sw->linewidth);
1523
stp_eprintf(v, "ERROR: vertical_height: %d\n", sw->vertical_height);
1524
stp_eprintf(v, "ERROR: firstline: %d\n", sw->firstline);
1525
stp_eprintf(v, "ERROR: bitwidth: %d\n", sw->bitwidth);
1526
stp_eprintf(v, "ERROR: vertical_oversample: %d\n", sw->vertical_oversample);
1527
stp_eprintf(v, "ERROR: horizontal_width: %d\n", sw->horizontal_width);
1528
if (sw->head_offset)
1530
stp_eprintf(v, "ERROR: head_offset:\n");
1531
for (i = 0; i < sw->ncolors; i++)
1532
stp_eprintf(v, "ERROR: head %d: %d\n", i, sw->head_offset[i]);
1534
stp_eprintf(v, "ERROR: Dynamic weave data follows:\n");
1535
stp_eprintf(v, "ERROR: last_pass_offset: %d\n", sw->last_pass_offset);
1536
stp_eprintf(v, "ERROR: last_pass: %d\n", sw->last_pass);
1537
stp_eprintf(v, "ERROR: lineno: %d\n", sw->lineno);
1538
stp_eprintf(v, "ERROR: current_vertical_subpass: %d\n", sw->current_vertical_subpass);
1539
stp_eprintf(v, "ERROR: rcache: %d\n", sw->rcache);
1540
stp_eprintf(v, "ERROR: vcache: %d\n", sw->vcache);
1541
stp_eprintf(v, "ERROR: Other parameters: row %d color %d setactive %d hpass %d\n",
1542
row, color, setactive, h_pass);
1543
stp_eprintf(v, "ERROR: Buffer overflow: limit %d (jets %d bits %d horizontal %d), actual %ld (current %d added %d), count %ld\n",
1503
1544
sw->virtual_jets * sw->bitwidth * sw->horizontal_width,
1504
(long)(place + nbytes), (long)count);
1545
sw->virtual_jets, sw->bitwidth, sw->horizontal_width,
1546
(long) (place + nbytes), (int) place, (int) nbytes, (long) count);
1547
stp_eprintf(v, "ERROR: %s\n", _("Please report the above information to gimp-print-devel@lists.sourceforge.net"));
1507
1550
memcpy(bufs->v[color] + lineoffs->v[color], buf, nbytes);
1582
1625
int cpass = sw->current_vertical_subpass * h_passes;
1584
1627
if (!sw->fold_buf)
1585
sw->fold_buf = stp_zalloc(sw->bitwidth * ylength);
1629
stp_dprintf(STP_DBG_WEAVE_PARAMS, v,
1630
"fold buffer allocation: length %d lw %d weave %d xlength %d ylength %d\n",
1631
length, sw->linewidth, sw->horizontal_weave, xlength, ylength);
1632
stp_dprintf(STP_DBG_WEAVE_PARAMS, v,
1633
"Allocating fold buf %d * %d (%d)\n", ylength, sw->bitwidth,
1634
sw->bitwidth * ylength);
1635
sw->fold_buf = stp_zalloc(sw->bitwidth * ylength);
1586
1637
if (!sw->comp_buf)
1587
sw->comp_buf = stp_zalloc(sw->bitwidth *
1588
(sw->compute_linewidth)(v,ylength));
1639
stp_dprintf(STP_DBG_WEAVE_PARAMS, v,
1640
"Allocating compression buffer based on %d, %d\n",
1641
sw->bitwidth, ylength);
1642
sw->comp_buf = stp_zalloc(sw->bitwidth *
1643
(sw->compute_linewidth)(v,ylength));
1589
1645
if (sw->current_vertical_subpass == 0)
1590
1646
initialize_row(v, sw, sw->lineno, xlength, cols);
1625
switch (sw->horizontal_weave)
1628
memcpy(sw->s[0], in, length * sw->bitwidth);
1631
stp_unpack_2(length, sw->bitwidth, in, sw->s[0], sw->s[1]);
1634
stp_unpack_4(length, sw->bitwidth, in,
1635
sw->s[0], sw->s[1], sw->s[2], sw->s[3]);
1638
stp_unpack_8(length, sw->bitwidth, in,
1639
sw->s[0], sw->s[1], sw->s[2], sw->s[3],
1640
sw->s[4], sw->s[5], sw->s[6], sw->s[7]);
1643
stp_unpack_16(length, sw->bitwidth, in,
1644
sw->s[0], sw->s[1], sw->s[2], sw->s[3],
1645
sw->s[4], sw->s[5], sw->s[6], sw->s[7],
1646
sw->s[8], sw->s[9], sw->s[10], sw->s[11],
1647
sw->s[12], sw->s[13], sw->s[14], sw->s[15]);
1650
switch (sw->vertical_subpasses)
1653
for (idx = 0; idx < sw->horizontal_weave; idx++)
1654
stp_split_4(length, sw->bitwidth, sw->s[idx], sw->s[idx],
1655
sw->s[idx + sw->horizontal_weave],
1656
sw->s[idx + sw->horizontal_weave * 2],
1657
sw->s[idx + sw->horizontal_weave * 3]);
1660
for (idx = 0; idx < sw->horizontal_weave; idx++)
1661
stp_split_2(length, sw->bitwidth, sw->s[idx], sw->s[idx],
1662
sw->s[idx + sw->horizontal_weave]);
1664
/* case 1 is taken care of because the various unpack */
1665
/* functions will do the trick themselves */
1681
if (sw->horizontal_weave == 1)
1682
memcpy(sw->s[0], in, length * sw->bitwidth);
1684
stp_unpack(length, sw->bitwidth, sw->horizontal_weave, in, sw->s);
1685
if (sw->vertical_subpasses > 1)
1687
for (idx = 0; idx < sw->horizontal_weave; idx++)
1688
stp_split(length, sw->bitwidth, sw->vertical_subpasses,
1689
sw->s[idx], sw->horizontal_weave, &(sw->s[idx]));
1667
1691
for (i = 0; i < h_passes; i++)