Debian Codegraph @

src/main/dither-predithered.c

raw symbols SCIP
1 /*
2 *
3 * Very fast dither algorithm
4 *
5 * Copyright 1997-2003 Michael Sweet ([email protected]) and
6 * Robert Krawitz ([email protected])
7 *
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the Free
10 * Software Foundation; either version 2 of the License, or (at your option)
11 * any later version.
12 *
13 * This program is distributed in the hope that it will be useful, but
14 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
15 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
16 * for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program. If not, see <https://www.gnu.org/licenses/>.
20 *
21 * Revision History:
22 *
23 * See ChangeLog
24 */
25
26 #ifdef HAVE_CONFIG_Hcxx . . $ `<built-in>:411:9`!
27 #include <config.h>cxx . . $ `<file>/config.h`/
28 #endif
29 #include <gutenprint/gutenprint.h>cxx . . $ `<file>/include/gutenprint/gutenprint.h`/
30 #include "gutenprint-internal.h"cxx . . $ `<file>/src/main/gutenprint-internal.h`/
31 #include <gutenprint/gutenprint-intl-internal.h>cxx . . $ `<file>/include/gutenprint/gutenprint-intl-internal.h`/
32 #include "dither-impl.h"cxx . . $ `<file>/src/main/dither-impl.h`/
33 #include "dither-inlined-functions.h"cxx . . $ `<file>/src/main/dither-inlined-functions.h`/
34
35 static inlinecxx . . $ `src/main/dither-impl.h:41:9`! void
36 print_color_very_fastcxx . . $ print_color_very_fast(94ede49d82eeda2b).(const stpi_dither_tcxx . . $ stpi_dither_t# *d, stpi_dither_channel_tcxx . . $ stpi_dither_channel_t# *dc,
37 int val, int x, int y, unsigned bit, int length)
38 {
39 int i, j;
40 unsigned char *tptr = dc->ptrcxx . . $ dither_channel#ptr. + d->ptr_offsetcxx . . $ dither#ptr_offset.;
41 (void)y;
42
43 /*
44 * Lay down all of the bits in the pixel.
45 */
46 set_row_endscxx . . $ set_row_ends(64d265e6bb66a9f0).(dc, x);
47 for (i = 0, j = 1; i < dc->signif_bitscxx . . $ dither_channel#signif_bits.; i++, j += j, tptr += length)
48 {
49 if (j & val)
50 tptr[0] |= bit;
51 }
52 }
53
54 void
55 stpi_dither_preditheredcxx . . $ stpi_dither_predithered(525e4b1c00087d37).(stp_vars_tcxx . . $ stp_vars_t# *v,
56 int row,
57 const unsigned short *raw,
58 int duplicate_line,
59 int zero_mask,
60 const unsigned char *mask)
61 {
62 stpi_dither_tcxx . . $ stpi_dither_t# *d = (stpi_dither_tcxx . . $ stpi_dither_t# *) stp_get_component_datacxx . . $ stp_get_component_data(2bc0070dfdce2f04).(v, "Dither");
63 int x,
64 length;
65 unsigned char bit;
66 int i;
67 int one_bit_only = 1;
68
69 int xerror, xstep, xmod;
70 (void)duplicate_line;
71
72 if ((zero_mask & ((1 << CHANNEL_COUNTcxx . . $ `src/main/dither-impl.h:179:9`!(d)) - 1)) ==
73 ((1 << CHANNEL_COUNTcxx . . $ `src/main/dither-impl.h:179:9`!(d)) - 1))
74 return;
75
76 length = (d->dst_widthcxx . . $ dither#dst_width. + 7) / 8;
77
78 bit = 128;
79 xstep = CHANNEL_COUNTcxx . . $ `src/main/dither-impl.h:179:9`!(d) * (d->src_widthcxx . . $ dither#src_width. / d->dst_widthcxx . . $ dither#dst_width.);
80 xmod = d->src_widthcxx . . $ dither#src_width. % d->dst_widthcxx . . $ dither#dst_width.;
81 xerror = 0;
82
83 for (i = 0; i < CHANNEL_COUNTcxx . . $ `src/main/dither-impl.h:179:9`!(d); i++)
84 {
85 stpi_dither_channel_tcxx . . $ stpi_dither_channel_t# *dc = &(CHANNELcxx . . $ `src/main/dither-impl.h:178:9`!(d, i));
86 if (dc->signif_bitscxx . . $ dither_channel#signif_bits. > 1)
87 {
88 one_bit_only = 0;
89 break;
90 }
91 }
92 if (one_bit_only)
93 {
94 for (x = 0; x < d->dst_widthcxx . . $ dither#dst_width.; x ++)
95 {
96 if (!mask || (*(mask + d->ptr_offsetcxx . . $ dither#ptr_offset.) & bit))
97 {
98 for (i = 0; i < CHANNEL_COUNTcxx . . $ `src/main/dither-impl.h:179:9`!(d); i++)
99 {
100 if (raw[i] & 1)
101 {
102 set_row_endscxx . . $ set_row_ends(64d265e6bb66a9f0).(&(CHANNELcxx . . $ `src/main/dither-impl.h:178:9`!(d, i)), x);
103 CHANNELcxx . . $ `src/main/dither-impl.h:178:9`!(d, i).ptrcxx . . $ dither_channel#ptr.[d->ptr_offsetcxx . . $ dither#ptr_offset.] |= bit;
104 }
105 }
106 }
107 ADVANCE_UNIDIRECTIONALcxx . . $ `src/main/dither-impl.h:199:9`!(d, bit, raw, CHANNEL_COUNTcxx . . $ `src/main/dither-impl.h:179:9`!(d),
108 xerror, xstep, xmod);
109 }
110 }
111 else
112 {
113 for (x = 0; x < d->dst_widthcxx . . $ dither#dst_width.; x ++)
114 {
115 if (!mask || (*(mask + d->ptr_offsetcxx . . $ dither#ptr_offset.) & bit))
116 {
117 for (i = 0; i < CHANNEL_COUNTcxx . . $ `src/main/dither-impl.h:179:9`!(d); i++)
118 {
119 if (CHANNELcxx . . $ `src/main/dither-impl.h:178:9`!(d, i).ptrcxx . . $ dither_channel#ptr. && raw[i])
120 print_color_very_fastcxx . . $ print_color_very_fast(94ede49d82eeda2b).(d, &(CHANNELcxx . . $ `src/main/dither-impl.h:178:9`!(d, i)), raw[i], x, row,
121 bit, length);
122 }
123 }
124 ADVANCE_UNIDIRECTIONALcxx . . $ `src/main/dither-impl.h:199:9`!(d, bit, raw, CHANNEL_COUNTcxx . . $ `src/main/dither-impl.h:179:9`!(d),
125 xerror, xstep, xmod);
126 }
127 }
128 }