Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(275)

Side by Side Diff: xfa/fxbarcode/datamatrix/BC_ErrorCorrection.cpp

Issue 1807373002: Reduce size of several PDFium constant tables. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Found another one. Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « xfa/fxbarcode/datamatrix/BC_ErrorCorrection.h ('k') | xfa/fxbarcode/pdf417/BC_PDF417.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 PDFium Authors. All rights reserved. 1 // Copyright 2014 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 // Original code is licensed as follows: 6 // Original code is licensed as follows:
7 /* 7 /*
8 * Copyright 2006 Jeremias Maerki. 8 * Copyright 2006 Jeremias Maerki.
9 * 9 *
10 * Licensed under the Apache License, Version 2.0 (the "License"); 10 * Licensed under the Apache License, Version 2.0 (the "License");
11 * you may not use this file except in compliance with the License. 11 * you may not use this file except in compliance with the License.
12 * You may obtain a copy of the License at 12 * You may obtain a copy of the License at
13 * 13 *
14 * http://www.apache.org/licenses/LICENSE-2.0 14 * http://www.apache.org/licenses/LICENSE-2.0
15 * 15 *
16 * Unless required by applicable law or agreed to in writing, software 16 * Unless required by applicable law or agreed to in writing, software
17 * distributed under the License is distributed on an "AS IS" BASIS, 17 * distributed under the License is distributed on an "AS IS" BASIS,
18 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19 * See the License for the specific language governing permissions and 19 * See the License for the specific language governing permissions and
20 * limitations under the License. 20 * limitations under the License.
21 */ 21 */
22 22
23 #include "xfa/fxbarcode/datamatrix/BC_Encoder.h" 23 #include "xfa/fxbarcode/datamatrix/BC_Encoder.h"
24 #include "xfa/fxbarcode/datamatrix/BC_ErrorCorrection.h" 24 #include "xfa/fxbarcode/datamatrix/BC_ErrorCorrection.h"
25 #include "xfa/fxbarcode/datamatrix/BC_SymbolInfo.h" 25 #include "xfa/fxbarcode/datamatrix/BC_SymbolInfo.h"
26 #include "xfa/fxbarcode/datamatrix/BC_SymbolShapeHint.h" 26 #include "xfa/fxbarcode/datamatrix/BC_SymbolShapeHint.h"
27 27
28 int32_t CBC_ErrorCorrection::FACTOR_SETS[] = {5, 7, 10, 11, 12, 14, 18, 20, 28 namespace {
29 24, 28, 36, 42, 48, 56, 62, 68}; 29
30 int32_t CBC_ErrorCorrection::FACTORS[][100] = { 30 const uint8_t FACTOR_SETS[] = {5, 7, 10, 11, 12, 14, 18, 20,
31 {228, 48, 15, 111, 62}, 31 24, 28, 36, 42, 48, 56, 62, 68};
32 {23, 68, 144, 134, 240, 92, 254}, 32
33 {28, 24, 185, 166, 223, 248, 116, 255, 110, 61}, 33 const uint8_t FACTORS_0[5] = {228, 48, 15, 111, 62};
34 {175, 138, 205, 12, 194, 168, 39, 245, 60, 97, 120}, 34 const uint8_t FACTORS_1[7] = {23, 68, 144, 134, 240, 92, 254};
35 {41, 153, 158, 91, 61, 42, 142, 213, 97, 178, 100, 242}, 35 const uint8_t FACTORS_2[10] = {28, 24, 185, 166, 223, 248, 116, 255, 110, 61};
36 {156, 97, 192, 252, 95, 9, 157, 119, 138, 45, 18, 186, 83, 185}, 36 const uint8_t FACTORS_3[11] = {175, 138, 205, 12, 194, 168,
37 {83, 195, 100, 39, 188, 75, 66, 61, 241, 213, 109, 129, 94, 254, 225, 48, 37 39, 245, 60, 97, 120};
38 90, 188}, 38
39 {15, 195, 244, 9, 233, 71, 168, 2, 188, 160, 153, 145, 253, 79, 108, 82, 27, 39 const uint8_t FACTORS_4[12] = {41, 153, 158, 91, 61, 42,
40 174, 186, 172}, 40 142, 213, 97, 178, 100, 242};
41 {52, 190, 88, 205, 109, 39, 176, 21, 155, 197, 251, 223, 155, 21, 5, 172, 41
42 254, 124, 12, 181, 184, 96, 50, 193}, 42 const uint8_t FACTORS_5[14] = {156, 97, 192, 252, 95, 9, 157,
43 {211, 231, 43, 97, 71, 96, 103, 174, 37, 151, 170, 53, 75, 34, 249, 121, 17, 43 119, 138, 45, 18, 186, 83, 185};
44 138, 110, 213, 141, 136, 120, 151, 233, 168, 93, 255}, 44
45 {245, 127, 242, 218, 130, 250, 162, 181, 102, 120, 84, 179, 220, 251, 80, 45 const uint8_t FACTORS_6[18] = {83, 195, 100, 39, 188, 75, 66, 61, 241,
46 182, 229, 18, 2, 4, 68, 33, 101, 137, 95, 119, 115, 44, 175, 184, 59, 25, 46 213, 109, 129, 94, 254, 225, 48, 90, 188};
47 225, 98, 81, 112}, 47
48 {77, 193, 137, 31, 19, 38, 22, 153, 247, 105, 122, 2, 245, 133, 242, 8, 175, 48 const uint8_t FACTORS_7[20] = {15, 195, 244, 9, 233, 71, 168, 2, 188, 160,
49 95, 100, 9, 167, 105, 214, 111, 57, 121, 21, 1, 253, 57, 54, 101, 248, 202, 49 153, 145, 253, 79, 108, 82, 27, 174, 186, 172};
50 69, 50, 150, 177, 226, 5, 9, 5}, 50
51 {245, 132, 172, 223, 96, 32, 117, 22, 238, 133, 238, 231, 205, 188, 237, 87, 51 const uint8_t FACTORS_8[24] = {52, 190, 88, 205, 109, 39, 176, 21,
52 191, 106, 16, 147, 118, 23, 37, 90, 170, 205, 131, 88, 120, 100, 66, 138, 52 155, 197, 251, 223, 155, 21, 5, 172,
53 186, 240, 82, 44, 176, 87, 187, 147, 160, 175, 69, 213, 92, 253, 225, 19}, 53 254, 124, 12, 181, 184, 96, 50, 193};
54 {175, 9, 223, 238, 12, 17, 220, 208, 100, 29, 175, 170, 230, 192, 215, 235, 54
55 150, 159, 36, 223, 38, 200, 132, 54, 228, 146, 218, 234, 117, 203, 29, 232, 55 const uint8_t FACTORS_9[28] = {211, 231, 43, 97, 71, 96, 103, 174, 37, 151,
56 144, 238, 22, 150, 201, 117, 62, 207, 164, 13, 137, 245, 127, 67, 247, 28, 56 170, 53, 75, 34, 249, 121, 17, 138, 110, 213,
57 155, 43, 203, 107, 233, 53, 143, 46}, 57 141, 136, 120, 151, 233, 168, 93, 255};
58 {242, 93, 169, 50, 144, 210, 39, 118, 202, 188, 201, 189, 143, 108, 196, 37, 58
59 185, 112, 134, 230, 245, 63, 197, 190, 250, 106, 185, 221, 175, 64, 114, 59 const uint8_t FACTORS_10[36] = {245, 127, 242, 218, 130, 250, 162, 181, 102,
60 71, 161, 44, 147, 6, 27, 218, 51, 63, 87, 10, 40, 130, 188, 17, 163, 31, 60 120, 84, 179, 220, 251, 80, 182, 229, 18,
61 176, 170, 4, 107, 232, 7, 94, 166, 224, 124, 86, 47, 11, 204}, 61 2, 4, 68, 33, 101, 137, 95, 119, 115,
62 {220, 228, 173, 89, 251, 149, 159, 56, 89, 33, 147, 244, 154, 36, 73, 127, 62 44, 175, 184, 59, 25, 225, 98, 81, 112};
63 213, 136, 248, 180, 234, 197, 158, 177, 68, 122, 93, 213, 15, 160, 227, 63
64 236, 66, 139, 153, 185, 202, 167, 179, 25, 220, 232, 96, 210, 231, 136, 64 const uint8_t FACTORS_11[42] = {
65 223, 239, 181, 241, 59, 52, 172, 25, 49, 232, 211, 189, 64, 54, 108, 153, 65 77, 193, 137, 31, 19, 38, 22, 153, 247, 105, 122, 2, 245, 133,
66 132, 63, 96, 103, 82, 186}}; 66 242, 8, 175, 95, 100, 9, 167, 105, 214, 111, 57, 121, 21, 1,
67 253, 57, 54, 101, 248, 202, 69, 50, 150, 177, 226, 5, 9, 5};
68
69 const uint8_t FACTORS_12[48] = {
70 245, 132, 172, 223, 96, 32, 117, 22, 238, 133, 238, 231,
71 205, 188, 237, 87, 191, 106, 16, 147, 118, 23, 37, 90,
72 170, 205, 131, 88, 120, 100, 66, 138, 186, 240, 82, 44,
73 176, 87, 187, 147, 160, 175, 69, 213, 92, 253, 225, 19};
74
75 const uint8_t FACTORS_13[56] = {
76 175, 9, 223, 238, 12, 17, 220, 208, 100, 29, 175, 170, 230, 192,
77 215, 235, 150, 159, 36, 223, 38, 200, 132, 54, 228, 146, 218, 234,
78 117, 203, 29, 232, 144, 238, 22, 150, 201, 117, 62, 207, 164, 13,
79 137, 245, 127, 67, 247, 28, 155, 43, 203, 107, 233, 53, 143, 46};
80
81 const uint8_t FACTORS_14[62] = {
82 242, 93, 169, 50, 144, 210, 39, 118, 202, 188, 201, 189, 143,
83 108, 196, 37, 185, 112, 134, 230, 245, 63, 197, 190, 250, 106,
84 185, 221, 175, 64, 114, 71, 161, 44, 147, 6, 27, 218, 51,
85 63, 87, 10, 40, 130, 188, 17, 163, 31, 176, 170, 4, 107,
86 232, 7, 94, 166, 224, 124, 86, 47, 11, 204};
87
88 const uint8_t FACTORS_15[68] = {
89 220, 228, 173, 89, 251, 149, 159, 56, 89, 33, 147, 244, 154, 36,
90 73, 127, 213, 136, 248, 180, 234, 197, 158, 177, 68, 122, 93, 213,
91 15, 160, 227, 236, 66, 139, 153, 185, 202, 167, 179, 25, 220, 232,
92 96, 210, 231, 136, 223, 239, 181, 241, 59, 52, 172, 25, 49, 232,
93 211, 189, 64, 54, 108, 153, 132, 63, 96, 103, 82, 186};
94
95 const uint8_t* const FACTORS[16] = {
96 FACTORS_0, FACTORS_1, FACTORS_2, FACTORS_3, FACTORS_4, FACTORS_5,
97 FACTORS_6, FACTORS_7, FACTORS_8, FACTORS_9, FACTORS_10, FACTORS_11,
98 FACTORS_12, FACTORS_13, FACTORS_14, FACTORS_15};
99
100 } // namespace
101
67 int32_t CBC_ErrorCorrection::MODULO_VALUE = 0x12D; 102 int32_t CBC_ErrorCorrection::MODULO_VALUE = 0x12D;
68 int32_t CBC_ErrorCorrection::LOG[256] = {0}; 103 int32_t CBC_ErrorCorrection::LOG[256] = {0};
69 int32_t CBC_ErrorCorrection::ALOG[256] = {0}; 104 int32_t CBC_ErrorCorrection::ALOG[256] = {0};
70 void CBC_ErrorCorrection::Initialize() { 105 void CBC_ErrorCorrection::Initialize() {
71 int32_t p = 1; 106 int32_t p = 1;
72 for (int32_t i = 0; i < 255; i++) { 107 for (int32_t i = 0; i < 255; i++) {
73 ALOG[i] = p; 108 ALOG[i] = p;
74 LOG[p] = i; 109 LOG[p] = i;
75 p <<= 1; 110 p <<= 1;
76 if (p >= 256) { 111 if (p >= 256) {
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 ecc[0] = 0; 201 ecc[0] = 0;
167 } 202 }
168 } 203 }
169 CFX_WideString strecc; 204 CFX_WideString strecc;
170 for (int32_t j = 0; j < numECWords; j++) { 205 for (int32_t j = 0; j < numECWords; j++) {
171 strecc += (FX_WCHAR)ecc[numECWords - j - 1]; 206 strecc += (FX_WCHAR)ecc[numECWords - j - 1];
172 } 207 }
173 FX_Free(ecc); 208 FX_Free(ecc);
174 return strecc; 209 return strecc;
175 } 210 }
OLDNEW
« no previous file with comments | « xfa/fxbarcode/datamatrix/BC_ErrorCorrection.h ('k') | xfa/fxbarcode/pdf417/BC_PDF417.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698