/src/ghostpdl/base/scfetab.c
Line | Count | Source (jump to first uncovered line) |
1 | | /* Copyright (C) 2001-2023 Artifex Software, Inc. |
2 | | All Rights Reserved. |
3 | | |
4 | | This software is provided AS-IS with no warranty, either express or |
5 | | implied. |
6 | | |
7 | | This software is distributed under license and may not be copied, |
8 | | modified or distributed except as expressly authorized under the terms |
9 | | of the license contained in the file LICENSE in this distribution. |
10 | | |
11 | | Refer to licensing information at http://www.artifex.com or contact |
12 | | Artifex Software, Inc., 39 Mesa Street, Suite 108A, San Francisco, |
13 | | CA 94129, USA, for further information. |
14 | | */ |
15 | | |
16 | | |
17 | | /* Tables for CCITTFaxEncode filter */ |
18 | | #include "std.h" |
19 | | #include "scommon.h" /* for scf.h */ |
20 | | #include "scf.h" |
21 | | |
22 | | /* We make this a separate file so that it can be used by */ |
23 | | /* the program that generates the tables for the CCITTFaxDecode filter. */ |
24 | | |
25 | | /* ------ Run encoding tables ------ */ |
26 | | |
27 | | /* Abbreviate hce_entry to make the file smaller. */ |
28 | | #define RUN(c,len) hce_entry(c,len) |
29 | | |
30 | | /* Define the end-of-line code. */ |
31 | | /* Code in scfd.c and scfdgen.c knows that the run value is 1. */ |
32 | | const cfe_run cf_run_eol = |
33 | | RUN(run_eol_code_value, run_eol_code_length); |
34 | | |
35 | | /* Define the 1-D code that signals uncompressed data. */ |
36 | | const cfe_run cf1_run_uncompressed = |
37 | | RUN(0xf, 12); |
38 | | |
39 | | /* Define the 2-D run codes. */ |
40 | | const cfe_run cf2_run_pass = |
41 | | RUN(cf2_run_pass_value, cf2_run_pass_length); |
42 | | const cfe_run cf2_run_vertical[7] = |
43 | | { |
44 | | RUN(0x3, 7), |
45 | | RUN(0x3, 6), |
46 | | RUN(0x3, 3), |
47 | | RUN(0x1, 1), |
48 | | RUN(0x2, 3), |
49 | | RUN(0x2, 6), |
50 | | RUN(0x2, 7) |
51 | | }; |
52 | | const cfe_run cf2_run_horizontal = |
53 | | RUN(cf2_run_horizontal_value, cf2_run_horizontal_length); |
54 | | const cfe_run cf2_run_uncompressed = |
55 | | RUN(0xf, 10); |
56 | | |
57 | | /* EOL codes for Group 3 2-D. */ |
58 | | /* Code in scfd.c knows that these are 0...01x. */ |
59 | | const cfe_run cf2_run_eol_1d = |
60 | | RUN((run_eol_code_value << 1) + 1, run_eol_code_length + 1); |
61 | | const cfe_run cf2_run_eol_2d = |
62 | | RUN((run_eol_code_value << 1) + 0, run_eol_code_length + 1); |
63 | | |
64 | | /* White run codes. */ |
65 | | const cf_runs cf_white_runs = |
66 | | { |
67 | | { /* Termination codes */ |
68 | | RUN(0x35, 8), RUN(0x7, 6), RUN(0x7, 4), RUN(0x8, 4), |
69 | | RUN(0xb, 4), RUN(0xc, 4), RUN(0xe, 4), RUN(0xf, 4), |
70 | | RUN(0x13, 5), RUN(0x14, 5), RUN(0x7, 5), RUN(0x8, 5), |
71 | | RUN(0x8, 6), RUN(0x3, 6), RUN(0x34, 6), RUN(0x35, 6), |
72 | | RUN(0x2a, 6), RUN(0x2b, 6), RUN(0x27, 7), RUN(0xc, 7), |
73 | | RUN(0x8, 7), RUN(0x17, 7), RUN(0x3, 7), RUN(0x4, 7), |
74 | | RUN(0x28, 7), RUN(0x2b, 7), RUN(0x13, 7), RUN(0x24, 7), |
75 | | RUN(0x18, 7), RUN(0x2, 8), RUN(0x3, 8), RUN(0x1a, 8), |
76 | | RUN(0x1b, 8), RUN(0x12, 8), RUN(0x13, 8), RUN(0x14, 8), |
77 | | RUN(0x15, 8), RUN(0x16, 8), RUN(0x17, 8), RUN(0x28, 8), |
78 | | RUN(0x29, 8), RUN(0x2a, 8), RUN(0x2b, 8), RUN(0x2c, 8), |
79 | | RUN(0x2d, 8), RUN(0x4, 8), RUN(0x5, 8), RUN(0xa, 8), |
80 | | RUN(0xb, 8), RUN(0x52, 8), RUN(0x53, 8), RUN(0x54, 8), |
81 | | RUN(0x55, 8), RUN(0x24, 8), RUN(0x25, 8), RUN(0x58, 8), |
82 | | RUN(0x59, 8), RUN(0x5a, 8), RUN(0x5b, 8), RUN(0x4a, 8), |
83 | | RUN(0x4b, 8), RUN(0x32, 8), RUN(0x33, 8), RUN(0x34, 8) |
84 | | }, |
85 | | { /* Make-up codes */ |
86 | | RUN(0, 0) /* dummy */ , RUN(0x1b, 5), RUN(0x12, 5), RUN(0x17, 6), |
87 | | RUN(0x37, 7), RUN(0x36, 8), RUN(0x37, 8), RUN(0x64, 8), |
88 | | RUN(0x65, 8), RUN(0x68, 8), RUN(0x67, 8), RUN(0xcc, 9), |
89 | | RUN(0xcd, 9), RUN(0xd2, 9), RUN(0xd3, 9), RUN(0xd4, 9), |
90 | | RUN(0xd5, 9), RUN(0xd6, 9), RUN(0xd7, 9), RUN(0xd8, 9), |
91 | | RUN(0xd9, 9), RUN(0xda, 9), RUN(0xdb, 9), RUN(0x98, 9), |
92 | | RUN(0x99, 9), RUN(0x9a, 9), RUN(0x18, 6), RUN(0x9b, 9), |
93 | | RUN(0x8, 11), RUN(0xc, 11), RUN(0xd, 11), RUN(0x12, 12), |
94 | | RUN(0x13, 12), RUN(0x14, 12), RUN(0x15, 12), RUN(0x16, 12), |
95 | | RUN(0x17, 12), RUN(0x1c, 12), RUN(0x1d, 12), RUN(0x1e, 12), |
96 | | RUN(0x1f, 12) |
97 | | } |
98 | | }; |
99 | | |
100 | | /* Black run codes. */ |
101 | | const cf_runs cf_black_runs = |
102 | | { |
103 | | { /* Termination codes */ |
104 | | RUN(0x37, 10), RUN(0x2, 3), RUN(0x3, 2), RUN(0x2, 2), |
105 | | RUN(0x3, 3), RUN(0x3, 4), RUN(0x2, 4), RUN(0x3, 5), |
106 | | RUN(0x5, 6), RUN(0x4, 6), RUN(0x4, 7), RUN(0x5, 7), |
107 | | RUN(0x7, 7), RUN(0x4, 8), RUN(0x7, 8), RUN(0x18, 9), |
108 | | RUN(0x17, 10), RUN(0x18, 10), RUN(0x8, 10), RUN(0x67, 11), |
109 | | RUN(0x68, 11), RUN(0x6c, 11), RUN(0x37, 11), RUN(0x28, 11), |
110 | | RUN(0x17, 11), RUN(0x18, 11), RUN(0xca, 12), RUN(0xcb, 12), |
111 | | RUN(0xcc, 12), RUN(0xcd, 12), RUN(0x68, 12), RUN(0x69, 12), |
112 | | RUN(0x6a, 12), RUN(0x6b, 12), RUN(0xd2, 12), RUN(0xd3, 12), |
113 | | RUN(0xd4, 12), RUN(0xd5, 12), RUN(0xd6, 12), RUN(0xd7, 12), |
114 | | RUN(0x6c, 12), RUN(0x6d, 12), RUN(0xda, 12), RUN(0xdb, 12), |
115 | | RUN(0x54, 12), RUN(0x55, 12), RUN(0x56, 12), RUN(0x57, 12), |
116 | | RUN(0x64, 12), RUN(0x65, 12), RUN(0x52, 12), RUN(0x53, 12), |
117 | | RUN(0x24, 12), RUN(0x37, 12), RUN(0x38, 12), RUN(0x27, 12), |
118 | | RUN(0x28, 12), RUN(0x58, 12), RUN(0x59, 12), RUN(0x2b, 12), |
119 | | RUN(0x2c, 12), RUN(0x5a, 12), RUN(0x66, 12), RUN(0x67, 12) |
120 | | }, |
121 | | { /* Make-up codes. */ |
122 | | RUN(0, 0) /* dummy */ , RUN(0xf, 10), RUN(0xc8, 12), RUN(0xc9, 12), |
123 | | RUN(0x5b, 12), RUN(0x33, 12), RUN(0x34, 12), RUN(0x35, 12), |
124 | | RUN(0x6c, 13), RUN(0x6d, 13), RUN(0x4a, 13), RUN(0x4b, 13), |
125 | | RUN(0x4c, 13), RUN(0x4d, 13), RUN(0x72, 13), RUN(0x73, 13), |
126 | | RUN(0x74, 13), RUN(0x75, 13), RUN(0x76, 13), RUN(0x77, 13), |
127 | | RUN(0x52, 13), RUN(0x53, 13), RUN(0x54, 13), RUN(0x55, 13), |
128 | | RUN(0x5a, 13), RUN(0x5b, 13), RUN(0x64, 13), RUN(0x65, 13), |
129 | | RUN(0x8, 11), RUN(0xc, 11), RUN(0xd, 11), RUN(0x12, 12), |
130 | | RUN(0x13, 12), RUN(0x14, 12), RUN(0x15, 12), RUN(0x16, 12), |
131 | | RUN(0x17, 12), RUN(0x1c, 12), RUN(0x1d, 12), RUN(0x1e, 12), |
132 | | RUN(0x1f, 12) |
133 | | } |
134 | | }; |
135 | | |
136 | | /* Uncompressed codes. */ |
137 | | const cfe_run cf_uncompressed[6] = |
138 | | { |
139 | | RUN(1, 1), |
140 | | RUN(1, 2), |
141 | | RUN(1, 3), |
142 | | RUN(1, 4), |
143 | | RUN(1, 5), |
144 | | RUN(1, 6) |
145 | | }; |
146 | | |
147 | | /* Uncompressed exit codes. */ |
148 | | const cfe_run cf_uncompressed_exit[10] = |
149 | | { |
150 | | RUN(2, 8), RUN(3, 8), |
151 | | RUN(2, 9), RUN(3, 9), |
152 | | RUN(2, 10), RUN(3, 10), |
153 | | RUN(2, 11), RUN(3, 11), |
154 | | RUN(2, 12), RUN(3, 12) |
155 | | }; |
156 | | |
157 | | /* Some C compilers insist on having executable code in every file.... */ |
158 | | void scfetab_dummy(void); /* for picky compilers */ |
159 | | void |
160 | | scfetab_dummy(void) |
161 | 0 | { |
162 | 0 | } |