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

Side by Side Diff: core/fxcodec/jbig2/JBig2_GrdProc.cpp

Issue 1832173003: Remove FX_DWORD from core/ and delete definition (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: 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 | « core/fxcodec/jbig2/JBig2_GrdProc.h ('k') | core/fxcodec/jbig2/JBig2_GrrdProc.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 2015 PDFium Authors. All rights reserved. 1 // Copyright 2015 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 6
7 #include "core/fxcodec/jbig2/JBig2_GrdProc.h" 7 #include "core/fxcodec/jbig2/JBig2_GrdProc.h"
8 8
9 #include <memory> 9 #include <memory>
10 10
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 } else { 59 } else {
60 if (UseTemplate23Opt3()) 60 if (UseTemplate23Opt3())
61 return decode_Arith_Template3_opt3(pArithDecoder, gbContext); 61 return decode_Arith_Template3_opt3(pArithDecoder, gbContext);
62 return decode_Arith_Template3_unopt(pArithDecoder, gbContext); 62 return decode_Arith_Template3_unopt(pArithDecoder, gbContext);
63 } 63 }
64 } 64 }
65 CJBig2_Image* CJBig2_GRDProc::decode_Arith_Template0_opt3( 65 CJBig2_Image* CJBig2_GRDProc::decode_Arith_Template0_opt3(
66 CJBig2_ArithDecoder* pArithDecoder, 66 CJBig2_ArithDecoder* pArithDecoder,
67 JBig2ArithCtx* gbContext) { 67 JBig2ArithCtx* gbContext) {
68 FX_BOOL LTP, SLTP, bVal; 68 FX_BOOL LTP, SLTP, bVal;
69 FX_DWORD CONTEXT; 69 uint32_t CONTEXT;
70 FX_DWORD line1, line2; 70 uint32_t line1, line2;
71 uint8_t *pLine, *pLine1, *pLine2, cVal; 71 uint8_t *pLine, *pLine1, *pLine2, cVal;
72 int32_t nStride, nStride2, k; 72 int32_t nStride, nStride2, k;
73 int32_t nLineBytes, nBitsLeft, cc; 73 int32_t nLineBytes, nBitsLeft, cc;
74 LTP = 0; 74 LTP = 0;
75 std::unique_ptr<CJBig2_Image> GBREG(new CJBig2_Image(GBW, GBH)); 75 std::unique_ptr<CJBig2_Image> GBREG(new CJBig2_Image(GBW, GBH));
76 if (!GBREG->m_pData) 76 if (!GBREG->m_pData)
77 return nullptr; 77 return nullptr;
78 78
79 pLine = GBREG->m_pData; 79 pLine = GBREG->m_pData;
80 nStride = GBREG->m_nStride; 80 nStride = GBREG->m_nStride;
81 nStride2 = nStride << 1; 81 nStride2 = nStride << 1;
82 nLineBytes = ((GBW + 7) >> 3) - 1; 82 nLineBytes = ((GBW + 7) >> 3) - 1;
83 nBitsLeft = GBW - (nLineBytes << 3); 83 nBitsLeft = GBW - (nLineBytes << 3);
84 FX_DWORD height = GBH & 0x7fffffff; 84 uint32_t height = GBH & 0x7fffffff;
85 for (FX_DWORD h = 0; h < height; h++) { 85 for (uint32_t h = 0; h < height; h++) {
86 if (TPGDON) { 86 if (TPGDON) {
87 SLTP = pArithDecoder->DECODE(&gbContext[0x9b25]); 87 SLTP = pArithDecoder->DECODE(&gbContext[0x9b25]);
88 LTP = LTP ^ SLTP; 88 LTP = LTP ^ SLTP;
89 } 89 }
90 if (LTP == 1) { 90 if (LTP == 1) {
91 GBREG->copyLine(h, h - 1); 91 GBREG->copyLine(h, h - 1);
92 } else { 92 } else {
93 if (h > 1) { 93 if (h > 1) {
94 pLine1 = pLine - nStride2; 94 pLine1 = pLine - nStride2;
95 pLine2 = pLine - nStride; 95 pLine2 = pLine - nStride;
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 } 149 }
150 pLine += nStride; 150 pLine += nStride;
151 } 151 }
152 return GBREG.release(); 152 return GBREG.release();
153 } 153 }
154 154
155 CJBig2_Image* CJBig2_GRDProc::decode_Arith_Template0_unopt( 155 CJBig2_Image* CJBig2_GRDProc::decode_Arith_Template0_unopt(
156 CJBig2_ArithDecoder* pArithDecoder, 156 CJBig2_ArithDecoder* pArithDecoder,
157 JBig2ArithCtx* gbContext) { 157 JBig2ArithCtx* gbContext) {
158 FX_BOOL LTP, SLTP, bVal; 158 FX_BOOL LTP, SLTP, bVal;
159 FX_DWORD CONTEXT; 159 uint32_t CONTEXT;
160 FX_DWORD line1, line2, line3; 160 uint32_t line1, line2, line3;
161 LTP = 0; 161 LTP = 0;
162 std::unique_ptr<CJBig2_Image> GBREG(new CJBig2_Image(GBW, GBH)); 162 std::unique_ptr<CJBig2_Image> GBREG(new CJBig2_Image(GBW, GBH));
163 GBREG->fill(0); 163 GBREG->fill(0);
164 for (FX_DWORD h = 0; h < GBH; h++) { 164 for (uint32_t h = 0; h < GBH; h++) {
165 if (TPGDON) { 165 if (TPGDON) {
166 SLTP = pArithDecoder->DECODE(&gbContext[0x9b25]); 166 SLTP = pArithDecoder->DECODE(&gbContext[0x9b25]);
167 LTP = LTP ^ SLTP; 167 LTP = LTP ^ SLTP;
168 } 168 }
169 if (LTP == 1) { 169 if (LTP == 1) {
170 GBREG->copyLine(h, h - 1); 170 GBREG->copyLine(h, h - 1);
171 } else { 171 } else {
172 line1 = GBREG->getPixel(1, h - 2); 172 line1 = GBREG->getPixel(1, h - 2);
173 line1 |= GBREG->getPixel(0, h - 2) << 1; 173 line1 |= GBREG->getPixel(0, h - 2) << 1;
174 line2 = GBREG->getPixel(2, h - 1); 174 line2 = GBREG->getPixel(2, h - 1);
175 line2 |= GBREG->getPixel(1, h - 1) << 1; 175 line2 |= GBREG->getPixel(1, h - 1) << 1;
176 line2 |= GBREG->getPixel(0, h - 1) << 2; 176 line2 |= GBREG->getPixel(0, h - 1) << 2;
177 line3 = 0; 177 line3 = 0;
178 for (FX_DWORD w = 0; w < GBW; w++) { 178 for (uint32_t w = 0; w < GBW; w++) {
179 if (USESKIP && SKIP->getPixel(w, h)) { 179 if (USESKIP && SKIP->getPixel(w, h)) {
180 bVal = 0; 180 bVal = 0;
181 } else { 181 } else {
182 CONTEXT = line3; 182 CONTEXT = line3;
183 CONTEXT |= GBREG->getPixel(w + GBAT[0], h + GBAT[1]) << 4; 183 CONTEXT |= GBREG->getPixel(w + GBAT[0], h + GBAT[1]) << 4;
184 CONTEXT |= line2 << 5; 184 CONTEXT |= line2 << 5;
185 CONTEXT |= GBREG->getPixel(w + GBAT[2], h + GBAT[3]) << 10; 185 CONTEXT |= GBREG->getPixel(w + GBAT[2], h + GBAT[3]) << 10;
186 CONTEXT |= GBREG->getPixel(w + GBAT[4], h + GBAT[5]) << 11; 186 CONTEXT |= GBREG->getPixel(w + GBAT[4], h + GBAT[5]) << 11;
187 CONTEXT |= line1 << 12; 187 CONTEXT |= line1 << 12;
188 CONTEXT |= GBREG->getPixel(w + GBAT[6], h + GBAT[7]) << 15; 188 CONTEXT |= GBREG->getPixel(w + GBAT[6], h + GBAT[7]) << 15;
189 bVal = pArithDecoder->DECODE(&gbContext[CONTEXT]); 189 bVal = pArithDecoder->DECODE(&gbContext[CONTEXT]);
190 } 190 }
191 if (bVal) { 191 if (bVal) {
192 GBREG->setPixel(w, h, bVal); 192 GBREG->setPixel(w, h, bVal);
193 } 193 }
194 line1 = ((line1 << 1) | GBREG->getPixel(w + 2, h - 2)) & 0x07; 194 line1 = ((line1 << 1) | GBREG->getPixel(w + 2, h - 2)) & 0x07;
195 line2 = ((line2 << 1) | GBREG->getPixel(w + 3, h - 1)) & 0x1f; 195 line2 = ((line2 << 1) | GBREG->getPixel(w + 3, h - 1)) & 0x1f;
196 line3 = ((line3 << 1) | bVal) & 0x0f; 196 line3 = ((line3 << 1) | bVal) & 0x0f;
197 } 197 }
198 } 198 }
199 } 199 }
200 return GBREG.release(); 200 return GBREG.release();
201 } 201 }
202 202
203 CJBig2_Image* CJBig2_GRDProc::decode_Arith_Template1_opt3( 203 CJBig2_Image* CJBig2_GRDProc::decode_Arith_Template1_opt3(
204 CJBig2_ArithDecoder* pArithDecoder, 204 CJBig2_ArithDecoder* pArithDecoder,
205 JBig2ArithCtx* gbContext) { 205 JBig2ArithCtx* gbContext) {
206 FX_BOOL LTP, SLTP, bVal; 206 FX_BOOL LTP, SLTP, bVal;
207 FX_DWORD CONTEXT; 207 uint32_t CONTEXT;
208 FX_DWORD line1, line2; 208 uint32_t line1, line2;
209 uint8_t *pLine, *pLine1, *pLine2, cVal; 209 uint8_t *pLine, *pLine1, *pLine2, cVal;
210 int32_t nStride, nStride2, k; 210 int32_t nStride, nStride2, k;
211 int32_t nLineBytes, nBitsLeft, cc; 211 int32_t nLineBytes, nBitsLeft, cc;
212 LTP = 0; 212 LTP = 0;
213 std::unique_ptr<CJBig2_Image> GBREG(new CJBig2_Image(GBW, GBH)); 213 std::unique_ptr<CJBig2_Image> GBREG(new CJBig2_Image(GBW, GBH));
214 if (!GBREG->m_pData) 214 if (!GBREG->m_pData)
215 return nullptr; 215 return nullptr;
216 216
217 pLine = GBREG->m_pData; 217 pLine = GBREG->m_pData;
218 nStride = GBREG->m_nStride; 218 nStride = GBREG->m_nStride;
219 nStride2 = nStride << 1; 219 nStride2 = nStride << 1;
220 nLineBytes = ((GBW + 7) >> 3) - 1; 220 nLineBytes = ((GBW + 7) >> 3) - 1;
221 nBitsLeft = GBW - (nLineBytes << 3); 221 nBitsLeft = GBW - (nLineBytes << 3);
222 for (FX_DWORD h = 0; h < GBH; h++) { 222 for (uint32_t h = 0; h < GBH; h++) {
223 if (TPGDON) { 223 if (TPGDON) {
224 SLTP = pArithDecoder->DECODE(&gbContext[0x0795]); 224 SLTP = pArithDecoder->DECODE(&gbContext[0x0795]);
225 LTP = LTP ^ SLTP; 225 LTP = LTP ^ SLTP;
226 } 226 }
227 if (LTP == 1) { 227 if (LTP == 1) {
228 GBREG->copyLine(h, h - 1); 228 GBREG->copyLine(h, h - 1);
229 } else { 229 } else {
230 if (h > 1) { 230 if (h > 1) {
231 pLine1 = pLine - nStride2; 231 pLine1 = pLine - nStride2;
232 pLine2 = pLine - nStride; 232 pLine2 = pLine - nStride;
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
286 } 286 }
287 pLine += nStride; 287 pLine += nStride;
288 } 288 }
289 return GBREG.release(); 289 return GBREG.release();
290 } 290 }
291 291
292 CJBig2_Image* CJBig2_GRDProc::decode_Arith_Template1_unopt( 292 CJBig2_Image* CJBig2_GRDProc::decode_Arith_Template1_unopt(
293 CJBig2_ArithDecoder* pArithDecoder, 293 CJBig2_ArithDecoder* pArithDecoder,
294 JBig2ArithCtx* gbContext) { 294 JBig2ArithCtx* gbContext) {
295 FX_BOOL LTP, SLTP, bVal; 295 FX_BOOL LTP, SLTP, bVal;
296 FX_DWORD CONTEXT; 296 uint32_t CONTEXT;
297 FX_DWORD line1, line2, line3; 297 uint32_t line1, line2, line3;
298 LTP = 0; 298 LTP = 0;
299 std::unique_ptr<CJBig2_Image> GBREG(new CJBig2_Image(GBW, GBH)); 299 std::unique_ptr<CJBig2_Image> GBREG(new CJBig2_Image(GBW, GBH));
300 GBREG->fill(0); 300 GBREG->fill(0);
301 for (FX_DWORD h = 0; h < GBH; h++) { 301 for (uint32_t h = 0; h < GBH; h++) {
302 if (TPGDON) { 302 if (TPGDON) {
303 SLTP = pArithDecoder->DECODE(&gbContext[0x0795]); 303 SLTP = pArithDecoder->DECODE(&gbContext[0x0795]);
304 LTP = LTP ^ SLTP; 304 LTP = LTP ^ SLTP;
305 } 305 }
306 if (LTP == 1) { 306 if (LTP == 1) {
307 GBREG->copyLine(h, h - 1); 307 GBREG->copyLine(h, h - 1);
308 } else { 308 } else {
309 line1 = GBREG->getPixel(2, h - 2); 309 line1 = GBREG->getPixel(2, h - 2);
310 line1 |= GBREG->getPixel(1, h - 2) << 1; 310 line1 |= GBREG->getPixel(1, h - 2) << 1;
311 line1 |= GBREG->getPixel(0, h - 2) << 2; 311 line1 |= GBREG->getPixel(0, h - 2) << 2;
312 line2 = GBREG->getPixel(2, h - 1); 312 line2 = GBREG->getPixel(2, h - 1);
313 line2 |= GBREG->getPixel(1, h - 1) << 1; 313 line2 |= GBREG->getPixel(1, h - 1) << 1;
314 line2 |= GBREG->getPixel(0, h - 1) << 2; 314 line2 |= GBREG->getPixel(0, h - 1) << 2;
315 line3 = 0; 315 line3 = 0;
316 for (FX_DWORD w = 0; w < GBW; w++) { 316 for (uint32_t w = 0; w < GBW; w++) {
317 if (USESKIP && SKIP->getPixel(w, h)) { 317 if (USESKIP && SKIP->getPixel(w, h)) {
318 bVal = 0; 318 bVal = 0;
319 } else { 319 } else {
320 CONTEXT = line3; 320 CONTEXT = line3;
321 CONTEXT |= GBREG->getPixel(w + GBAT[0], h + GBAT[1]) << 3; 321 CONTEXT |= GBREG->getPixel(w + GBAT[0], h + GBAT[1]) << 3;
322 CONTEXT |= line2 << 4; 322 CONTEXT |= line2 << 4;
323 CONTEXT |= line1 << 9; 323 CONTEXT |= line1 << 9;
324 bVal = pArithDecoder->DECODE(&gbContext[CONTEXT]); 324 bVal = pArithDecoder->DECODE(&gbContext[CONTEXT]);
325 } 325 }
326 if (bVal) { 326 if (bVal) {
327 GBREG->setPixel(w, h, bVal); 327 GBREG->setPixel(w, h, bVal);
328 } 328 }
329 line1 = ((line1 << 1) | GBREG->getPixel(w + 3, h - 2)) & 0x0f; 329 line1 = ((line1 << 1) | GBREG->getPixel(w + 3, h - 2)) & 0x0f;
330 line2 = ((line2 << 1) | GBREG->getPixel(w + 3, h - 1)) & 0x1f; 330 line2 = ((line2 << 1) | GBREG->getPixel(w + 3, h - 1)) & 0x1f;
331 line3 = ((line3 << 1) | bVal) & 0x07; 331 line3 = ((line3 << 1) | bVal) & 0x07;
332 } 332 }
333 } 333 }
334 } 334 }
335 return GBREG.release(); 335 return GBREG.release();
336 } 336 }
337 CJBig2_Image* CJBig2_GRDProc::decode_Arith_Template2_opt3( 337 CJBig2_Image* CJBig2_GRDProc::decode_Arith_Template2_opt3(
338 CJBig2_ArithDecoder* pArithDecoder, 338 CJBig2_ArithDecoder* pArithDecoder,
339 JBig2ArithCtx* gbContext) { 339 JBig2ArithCtx* gbContext) {
340 FX_BOOL LTP, SLTP, bVal; 340 FX_BOOL LTP, SLTP, bVal;
341 FX_DWORD CONTEXT; 341 uint32_t CONTEXT;
342 FX_DWORD line1, line2; 342 uint32_t line1, line2;
343 uint8_t *pLine, *pLine1, *pLine2, cVal; 343 uint8_t *pLine, *pLine1, *pLine2, cVal;
344 int32_t nStride, nStride2, k; 344 int32_t nStride, nStride2, k;
345 int32_t nLineBytes, nBitsLeft, cc; 345 int32_t nLineBytes, nBitsLeft, cc;
346 LTP = 0; 346 LTP = 0;
347 std::unique_ptr<CJBig2_Image> GBREG(new CJBig2_Image(GBW, GBH)); 347 std::unique_ptr<CJBig2_Image> GBREG(new CJBig2_Image(GBW, GBH));
348 if (!GBREG->m_pData) 348 if (!GBREG->m_pData)
349 return nullptr; 349 return nullptr;
350 350
351 pLine = GBREG->m_pData; 351 pLine = GBREG->m_pData;
352 nStride = GBREG->m_nStride; 352 nStride = GBREG->m_nStride;
353 nStride2 = nStride << 1; 353 nStride2 = nStride << 1;
354 nLineBytes = ((GBW + 7) >> 3) - 1; 354 nLineBytes = ((GBW + 7) >> 3) - 1;
355 nBitsLeft = GBW - (nLineBytes << 3); 355 nBitsLeft = GBW - (nLineBytes << 3);
356 for (FX_DWORD h = 0; h < GBH; h++) { 356 for (uint32_t h = 0; h < GBH; h++) {
357 if (TPGDON) { 357 if (TPGDON) {
358 SLTP = pArithDecoder->DECODE(&gbContext[0x00e5]); 358 SLTP = pArithDecoder->DECODE(&gbContext[0x00e5]);
359 LTP = LTP ^ SLTP; 359 LTP = LTP ^ SLTP;
360 } 360 }
361 if (LTP == 1) { 361 if (LTP == 1) {
362 GBREG->copyLine(h, h - 1); 362 GBREG->copyLine(h, h - 1);
363 } else { 363 } else {
364 if (h > 1) { 364 if (h > 1) {
365 pLine1 = pLine - nStride2; 365 pLine1 = pLine - nStride2;
366 pLine2 = pLine - nStride; 366 pLine2 = pLine - nStride;
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
420 } 420 }
421 pLine += nStride; 421 pLine += nStride;
422 } 422 }
423 return GBREG.release(); 423 return GBREG.release();
424 } 424 }
425 425
426 CJBig2_Image* CJBig2_GRDProc::decode_Arith_Template2_unopt( 426 CJBig2_Image* CJBig2_GRDProc::decode_Arith_Template2_unopt(
427 CJBig2_ArithDecoder* pArithDecoder, 427 CJBig2_ArithDecoder* pArithDecoder,
428 JBig2ArithCtx* gbContext) { 428 JBig2ArithCtx* gbContext) {
429 FX_BOOL LTP, SLTP, bVal; 429 FX_BOOL LTP, SLTP, bVal;
430 FX_DWORD CONTEXT; 430 uint32_t CONTEXT;
431 FX_DWORD line1, line2, line3; 431 uint32_t line1, line2, line3;
432 LTP = 0; 432 LTP = 0;
433 std::unique_ptr<CJBig2_Image> GBREG(new CJBig2_Image(GBW, GBH)); 433 std::unique_ptr<CJBig2_Image> GBREG(new CJBig2_Image(GBW, GBH));
434 GBREG->fill(0); 434 GBREG->fill(0);
435 for (FX_DWORD h = 0; h < GBH; h++) { 435 for (uint32_t h = 0; h < GBH; h++) {
436 if (TPGDON) { 436 if (TPGDON) {
437 SLTP = pArithDecoder->DECODE(&gbContext[0x00e5]); 437 SLTP = pArithDecoder->DECODE(&gbContext[0x00e5]);
438 LTP = LTP ^ SLTP; 438 LTP = LTP ^ SLTP;
439 } 439 }
440 if (LTP == 1) { 440 if (LTP == 1) {
441 GBREG->copyLine(h, h - 1); 441 GBREG->copyLine(h, h - 1);
442 } else { 442 } else {
443 line1 = GBREG->getPixel(1, h - 2); 443 line1 = GBREG->getPixel(1, h - 2);
444 line1 |= GBREG->getPixel(0, h - 2) << 1; 444 line1 |= GBREG->getPixel(0, h - 2) << 1;
445 line2 = GBREG->getPixel(1, h - 1); 445 line2 = GBREG->getPixel(1, h - 1);
446 line2 |= GBREG->getPixel(0, h - 1) << 1; 446 line2 |= GBREG->getPixel(0, h - 1) << 1;
447 line3 = 0; 447 line3 = 0;
448 for (FX_DWORD w = 0; w < GBW; w++) { 448 for (uint32_t w = 0; w < GBW; w++) {
449 if (USESKIP && SKIP->getPixel(w, h)) { 449 if (USESKIP && SKIP->getPixel(w, h)) {
450 bVal = 0; 450 bVal = 0;
451 } else { 451 } else {
452 CONTEXT = line3; 452 CONTEXT = line3;
453 CONTEXT |= GBREG->getPixel(w + GBAT[0], h + GBAT[1]) << 2; 453 CONTEXT |= GBREG->getPixel(w + GBAT[0], h + GBAT[1]) << 2;
454 CONTEXT |= line2 << 3; 454 CONTEXT |= line2 << 3;
455 CONTEXT |= line1 << 7; 455 CONTEXT |= line1 << 7;
456 bVal = pArithDecoder->DECODE(&gbContext[CONTEXT]); 456 bVal = pArithDecoder->DECODE(&gbContext[CONTEXT]);
457 } 457 }
458 if (bVal) { 458 if (bVal) {
459 GBREG->setPixel(w, h, bVal); 459 GBREG->setPixel(w, h, bVal);
460 } 460 }
461 line1 = ((line1 << 1) | GBREG->getPixel(w + 2, h - 2)) & 0x07; 461 line1 = ((line1 << 1) | GBREG->getPixel(w + 2, h - 2)) & 0x07;
462 line2 = ((line2 << 1) | GBREG->getPixel(w + 2, h - 1)) & 0x0f; 462 line2 = ((line2 << 1) | GBREG->getPixel(w + 2, h - 1)) & 0x0f;
463 line3 = ((line3 << 1) | bVal) & 0x03; 463 line3 = ((line3 << 1) | bVal) & 0x03;
464 } 464 }
465 } 465 }
466 } 466 }
467 return GBREG.release(); 467 return GBREG.release();
468 } 468 }
469 469
470 CJBig2_Image* CJBig2_GRDProc::decode_Arith_Template3_opt3( 470 CJBig2_Image* CJBig2_GRDProc::decode_Arith_Template3_opt3(
471 CJBig2_ArithDecoder* pArithDecoder, 471 CJBig2_ArithDecoder* pArithDecoder,
472 JBig2ArithCtx* gbContext) { 472 JBig2ArithCtx* gbContext) {
473 FX_BOOL LTP, SLTP, bVal; 473 FX_BOOL LTP, SLTP, bVal;
474 FX_DWORD CONTEXT; 474 uint32_t CONTEXT;
475 FX_DWORD line1; 475 uint32_t line1;
476 uint8_t *pLine, *pLine1, cVal; 476 uint8_t *pLine, *pLine1, cVal;
477 int32_t nStride, k; 477 int32_t nStride, k;
478 int32_t nLineBytes, nBitsLeft, cc; 478 int32_t nLineBytes, nBitsLeft, cc;
479 LTP = 0; 479 LTP = 0;
480 std::unique_ptr<CJBig2_Image> GBREG(new CJBig2_Image(GBW, GBH)); 480 std::unique_ptr<CJBig2_Image> GBREG(new CJBig2_Image(GBW, GBH));
481 if (!GBREG->m_pData) 481 if (!GBREG->m_pData)
482 return nullptr; 482 return nullptr;
483 483
484 pLine = GBREG->m_pData; 484 pLine = GBREG->m_pData;
485 nStride = GBREG->m_nStride; 485 nStride = GBREG->m_nStride;
486 nLineBytes = ((GBW + 7) >> 3) - 1; 486 nLineBytes = ((GBW + 7) >> 3) - 1;
487 nBitsLeft = GBW - (nLineBytes << 3); 487 nBitsLeft = GBW - (nLineBytes << 3);
488 for (FX_DWORD h = 0; h < GBH; h++) { 488 for (uint32_t h = 0; h < GBH; h++) {
489 if (TPGDON) { 489 if (TPGDON) {
490 SLTP = pArithDecoder->DECODE(&gbContext[0x0195]); 490 SLTP = pArithDecoder->DECODE(&gbContext[0x0195]);
491 LTP = LTP ^ SLTP; 491 LTP = LTP ^ SLTP;
492 } 492 }
493 if (LTP == 1) { 493 if (LTP == 1) {
494 GBREG->copyLine(h, h - 1); 494 GBREG->copyLine(h, h - 1);
495 } else { 495 } else {
496 if (h > 0) { 496 if (h > 0) {
497 pLine1 = pLine - nStride; 497 pLine1 = pLine - nStride;
498 line1 = *pLine1++; 498 line1 = *pLine1++;
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
539 } 539 }
540 pLine += nStride; 540 pLine += nStride;
541 } 541 }
542 return GBREG.release(); 542 return GBREG.release();
543 } 543 }
544 544
545 CJBig2_Image* CJBig2_GRDProc::decode_Arith_Template3_unopt( 545 CJBig2_Image* CJBig2_GRDProc::decode_Arith_Template3_unopt(
546 CJBig2_ArithDecoder* pArithDecoder, 546 CJBig2_ArithDecoder* pArithDecoder,
547 JBig2ArithCtx* gbContext) { 547 JBig2ArithCtx* gbContext) {
548 FX_BOOL LTP, SLTP, bVal; 548 FX_BOOL LTP, SLTP, bVal;
549 FX_DWORD CONTEXT; 549 uint32_t CONTEXT;
550 FX_DWORD line1, line2; 550 uint32_t line1, line2;
551 LTP = 0; 551 LTP = 0;
552 std::unique_ptr<CJBig2_Image> GBREG(new CJBig2_Image(GBW, GBH)); 552 std::unique_ptr<CJBig2_Image> GBREG(new CJBig2_Image(GBW, GBH));
553 GBREG->fill(0); 553 GBREG->fill(0);
554 for (FX_DWORD h = 0; h < GBH; h++) { 554 for (uint32_t h = 0; h < GBH; h++) {
555 if (TPGDON) { 555 if (TPGDON) {
556 SLTP = pArithDecoder->DECODE(&gbContext[0x0195]); 556 SLTP = pArithDecoder->DECODE(&gbContext[0x0195]);
557 LTP = LTP ^ SLTP; 557 LTP = LTP ^ SLTP;
558 } 558 }
559 if (LTP == 1) { 559 if (LTP == 1) {
560 GBREG->copyLine(h, h - 1); 560 GBREG->copyLine(h, h - 1);
561 } else { 561 } else {
562 line1 = GBREG->getPixel(1, h - 1); 562 line1 = GBREG->getPixel(1, h - 1);
563 line1 |= GBREG->getPixel(0, h - 1) << 1; 563 line1 |= GBREG->getPixel(0, h - 1) << 1;
564 line2 = 0; 564 line2 = 0;
565 for (FX_DWORD w = 0; w < GBW; w++) { 565 for (uint32_t w = 0; w < GBW; w++) {
566 if (USESKIP && SKIP->getPixel(w, h)) { 566 if (USESKIP && SKIP->getPixel(w, h)) {
567 bVal = 0; 567 bVal = 0;
568 } else { 568 } else {
569 CONTEXT = line2; 569 CONTEXT = line2;
570 CONTEXT |= GBREG->getPixel(w + GBAT[0], h + GBAT[1]) << 4; 570 CONTEXT |= GBREG->getPixel(w + GBAT[0], h + GBAT[1]) << 4;
571 CONTEXT |= line1 << 5; 571 CONTEXT |= line1 << 5;
572 bVal = pArithDecoder->DECODE(&gbContext[CONTEXT]); 572 bVal = pArithDecoder->DECODE(&gbContext[CONTEXT]);
573 } 573 }
574 if (bVal) { 574 if (bVal) {
575 GBREG->setPixel(w, h, bVal); 575 GBREG->setPixel(w, h, bVal);
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
666 if (!(*pImage)->m_pData) { 666 if (!(*pImage)->m_pData) {
667 delete (*pImage); 667 delete (*pImage);
668 (*pImage) = nullptr; 668 (*pImage) = nullptr;
669 m_ProssiveStatus = FXCODEC_STATUS_ERROR; 669 m_ProssiveStatus = FXCODEC_STATUS_ERROR;
670 return m_ProssiveStatus; 670 return m_ProssiveStatus;
671 } 671 }
672 bitpos = (int)pStream->getBitPos(); 672 bitpos = (int)pStream->getBitPos();
673 FaxG4Decode(pStream->getBuf(), pStream->getLength(), &bitpos, 673 FaxG4Decode(pStream->getBuf(), pStream->getLength(), &bitpos,
674 (*pImage)->m_pData, GBW, GBH, (*pImage)->m_nStride); 674 (*pImage)->m_pData, GBW, GBH, (*pImage)->m_nStride);
675 pStream->setBitPos(bitpos); 675 pStream->setBitPos(bitpos);
676 for (i = 0; (FX_DWORD)i < (*pImage)->m_nStride * GBH; i++) { 676 for (i = 0; (uint32_t)i < (*pImage)->m_nStride * GBH; i++) {
677 (*pImage)->m_pData[i] = ~(*pImage)->m_pData[i]; 677 (*pImage)->m_pData[i] = ~(*pImage)->m_pData[i];
678 } 678 }
679 m_ProssiveStatus = FXCODEC_STATUS_DECODE_FINISH; 679 m_ProssiveStatus = FXCODEC_STATUS_DECODE_FINISH;
680 return m_ProssiveStatus; 680 return m_ProssiveStatus;
681 } 681 }
682 682
683 FXCODEC_STATUS CJBig2_GRDProc::Continue_decode(IFX_Pause* pPause) { 683 FXCODEC_STATUS CJBig2_GRDProc::Continue_decode(IFX_Pause* pPause) {
684 if (m_ProssiveStatus != FXCODEC_STATUS_DECODE_TOBECONTINUE) 684 if (m_ProssiveStatus != FXCODEC_STATUS_DECODE_TOBECONTINUE)
685 return m_ProssiveStatus; 685 return m_ProssiveStatus;
686 686
687 if (m_DecodeType != 1) { 687 if (m_DecodeType != 1) {
688 m_ProssiveStatus = FXCODEC_STATUS_ERROR; 688 m_ProssiveStatus = FXCODEC_STATUS_ERROR;
689 return m_ProssiveStatus; 689 return m_ProssiveStatus;
690 } 690 }
691 691
692 return decode_Arith(pPause); 692 return decode_Arith(pPause);
693 } 693 }
694 694
695 FXCODEC_STATUS CJBig2_GRDProc::decode_Arith_Template0_opt3( 695 FXCODEC_STATUS CJBig2_GRDProc::decode_Arith_Template0_opt3(
696 CJBig2_Image* pImage, 696 CJBig2_Image* pImage,
697 CJBig2_ArithDecoder* pArithDecoder, 697 CJBig2_ArithDecoder* pArithDecoder,
698 JBig2ArithCtx* gbContext, 698 JBig2ArithCtx* gbContext,
699 IFX_Pause* pPause) { 699 IFX_Pause* pPause) {
700 FX_BOOL SLTP, bVal; 700 FX_BOOL SLTP, bVal;
701 FX_DWORD CONTEXT; 701 uint32_t CONTEXT;
702 FX_DWORD line1, line2; 702 uint32_t line1, line2;
703 uint8_t *pLine1, *pLine2, cVal; 703 uint8_t *pLine1, *pLine2, cVal;
704 int32_t nStride, nStride2, k; 704 int32_t nStride, nStride2, k;
705 int32_t nLineBytes, nBitsLeft, cc; 705 int32_t nLineBytes, nBitsLeft, cc;
706 if (!m_pLine) { 706 if (!m_pLine) {
707 m_pLine = pImage->m_pData; 707 m_pLine = pImage->m_pData;
708 } 708 }
709 nStride = pImage->m_nStride; 709 nStride = pImage->m_nStride;
710 nStride2 = nStride << 1; 710 nStride2 = nStride << 1;
711 nLineBytes = ((GBW + 7) >> 3) - 1; 711 nLineBytes = ((GBW + 7) >> 3) - 1;
712 nBitsLeft = GBW - (nLineBytes << 3); 712 nBitsLeft = GBW - (nLineBytes << 3);
713 FX_DWORD height = GBH & 0x7fffffff; 713 uint32_t height = GBH & 0x7fffffff;
714 for (; m_loopIndex < height; m_loopIndex++) { 714 for (; m_loopIndex < height; m_loopIndex++) {
715 if (TPGDON) { 715 if (TPGDON) {
716 SLTP = pArithDecoder->DECODE(&gbContext[0x9b25]); 716 SLTP = pArithDecoder->DECODE(&gbContext[0x9b25]);
717 LTP = LTP ^ SLTP; 717 LTP = LTP ^ SLTP;
718 } 718 }
719 if (LTP == 1) { 719 if (LTP == 1) {
720 pImage->copyLine(m_loopIndex, m_loopIndex - 1); 720 pImage->copyLine(m_loopIndex, m_loopIndex - 1);
721 } else { 721 } else {
722 if (m_loopIndex > 1) { 722 if (m_loopIndex > 1) {
723 pLine1 = m_pLine - nStride2; 723 pLine1 = m_pLine - nStride2;
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
786 m_ProssiveStatus = FXCODEC_STATUS_DECODE_FINISH; 786 m_ProssiveStatus = FXCODEC_STATUS_DECODE_FINISH;
787 return FXCODEC_STATUS_DECODE_FINISH; 787 return FXCODEC_STATUS_DECODE_FINISH;
788 } 788 }
789 789
790 FXCODEC_STATUS CJBig2_GRDProc::decode_Arith_Template0_unopt( 790 FXCODEC_STATUS CJBig2_GRDProc::decode_Arith_Template0_unopt(
791 CJBig2_Image* pImage, 791 CJBig2_Image* pImage,
792 CJBig2_ArithDecoder* pArithDecoder, 792 CJBig2_ArithDecoder* pArithDecoder,
793 JBig2ArithCtx* gbContext, 793 JBig2ArithCtx* gbContext,
794 IFX_Pause* pPause) { 794 IFX_Pause* pPause) {
795 FX_BOOL SLTP, bVal; 795 FX_BOOL SLTP, bVal;
796 FX_DWORD CONTEXT; 796 uint32_t CONTEXT;
797 FX_DWORD line1, line2, line3; 797 uint32_t line1, line2, line3;
798 for (; m_loopIndex < GBH; m_loopIndex++) { 798 for (; m_loopIndex < GBH; m_loopIndex++) {
799 if (TPGDON) { 799 if (TPGDON) {
800 SLTP = pArithDecoder->DECODE(&gbContext[0x9b25]); 800 SLTP = pArithDecoder->DECODE(&gbContext[0x9b25]);
801 LTP = LTP ^ SLTP; 801 LTP = LTP ^ SLTP;
802 } 802 }
803 if (LTP == 1) { 803 if (LTP == 1) {
804 pImage->copyLine(m_loopIndex, m_loopIndex - 1); 804 pImage->copyLine(m_loopIndex, m_loopIndex - 1);
805 } else { 805 } else {
806 line1 = pImage->getPixel(1, m_loopIndex - 2); 806 line1 = pImage->getPixel(1, m_loopIndex - 2);
807 line1 |= pImage->getPixel(0, m_loopIndex - 2) << 1; 807 line1 |= pImage->getPixel(0, m_loopIndex - 2) << 1;
808 line2 = pImage->getPixel(2, m_loopIndex - 1); 808 line2 = pImage->getPixel(2, m_loopIndex - 1);
809 line2 |= pImage->getPixel(1, m_loopIndex - 1) << 1; 809 line2 |= pImage->getPixel(1, m_loopIndex - 1) << 1;
810 line2 |= pImage->getPixel(0, m_loopIndex - 1) << 2; 810 line2 |= pImage->getPixel(0, m_loopIndex - 1) << 2;
811 line3 = 0; 811 line3 = 0;
812 for (FX_DWORD w = 0; w < GBW; w++) { 812 for (uint32_t w = 0; w < GBW; w++) {
813 if (USESKIP && SKIP->getPixel(w, m_loopIndex)) { 813 if (USESKIP && SKIP->getPixel(w, m_loopIndex)) {
814 bVal = 0; 814 bVal = 0;
815 } else { 815 } else {
816 CONTEXT = line3; 816 CONTEXT = line3;
817 CONTEXT |= pImage->getPixel(w + GBAT[0], m_loopIndex + GBAT[1]) << 4; 817 CONTEXT |= pImage->getPixel(w + GBAT[0], m_loopIndex + GBAT[1]) << 4;
818 CONTEXT |= line2 << 5; 818 CONTEXT |= line2 << 5;
819 CONTEXT |= pImage->getPixel(w + GBAT[2], m_loopIndex + GBAT[3]) << 10; 819 CONTEXT |= pImage->getPixel(w + GBAT[2], m_loopIndex + GBAT[3]) << 10;
820 CONTEXT |= pImage->getPixel(w + GBAT[4], m_loopIndex + GBAT[5]) << 11; 820 CONTEXT |= pImage->getPixel(w + GBAT[4], m_loopIndex + GBAT[5]) << 11;
821 CONTEXT |= line1 << 12; 821 CONTEXT |= line1 << 12;
822 CONTEXT |= pImage->getPixel(w + GBAT[6], m_loopIndex + GBAT[7]) << 15; 822 CONTEXT |= pImage->getPixel(w + GBAT[6], m_loopIndex + GBAT[7]) << 15;
(...skipping 18 matching lines...) Expand all
841 m_ProssiveStatus = FXCODEC_STATUS_DECODE_FINISH; 841 m_ProssiveStatus = FXCODEC_STATUS_DECODE_FINISH;
842 return FXCODEC_STATUS_DECODE_FINISH; 842 return FXCODEC_STATUS_DECODE_FINISH;
843 } 843 }
844 844
845 FXCODEC_STATUS CJBig2_GRDProc::decode_Arith_Template1_opt3( 845 FXCODEC_STATUS CJBig2_GRDProc::decode_Arith_Template1_opt3(
846 CJBig2_Image* pImage, 846 CJBig2_Image* pImage,
847 CJBig2_ArithDecoder* pArithDecoder, 847 CJBig2_ArithDecoder* pArithDecoder,
848 JBig2ArithCtx* gbContext, 848 JBig2ArithCtx* gbContext,
849 IFX_Pause* pPause) { 849 IFX_Pause* pPause) {
850 FX_BOOL SLTP, bVal; 850 FX_BOOL SLTP, bVal;
851 FX_DWORD CONTEXT; 851 uint32_t CONTEXT;
852 FX_DWORD line1, line2; 852 uint32_t line1, line2;
853 uint8_t *pLine1, *pLine2, cVal; 853 uint8_t *pLine1, *pLine2, cVal;
854 int32_t nStride, nStride2, k; 854 int32_t nStride, nStride2, k;
855 int32_t nLineBytes, nBitsLeft, cc; 855 int32_t nLineBytes, nBitsLeft, cc;
856 if (!m_pLine) { 856 if (!m_pLine) {
857 m_pLine = pImage->m_pData; 857 m_pLine = pImage->m_pData;
858 } 858 }
859 nStride = pImage->m_nStride; 859 nStride = pImage->m_nStride;
860 nStride2 = nStride << 1; 860 nStride2 = nStride << 1;
861 nLineBytes = ((GBW + 7) >> 3) - 1; 861 nLineBytes = ((GBW + 7) >> 3) - 1;
862 nBitsLeft = GBW - (nLineBytes << 3); 862 nBitsLeft = GBW - (nLineBytes << 3);
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
935 m_ProssiveStatus = FXCODEC_STATUS_DECODE_FINISH; 935 m_ProssiveStatus = FXCODEC_STATUS_DECODE_FINISH;
936 return FXCODEC_STATUS_DECODE_FINISH; 936 return FXCODEC_STATUS_DECODE_FINISH;
937 } 937 }
938 938
939 FXCODEC_STATUS CJBig2_GRDProc::decode_Arith_Template1_unopt( 939 FXCODEC_STATUS CJBig2_GRDProc::decode_Arith_Template1_unopt(
940 CJBig2_Image* pImage, 940 CJBig2_Image* pImage,
941 CJBig2_ArithDecoder* pArithDecoder, 941 CJBig2_ArithDecoder* pArithDecoder,
942 JBig2ArithCtx* gbContext, 942 JBig2ArithCtx* gbContext,
943 IFX_Pause* pPause) { 943 IFX_Pause* pPause) {
944 FX_BOOL SLTP, bVal; 944 FX_BOOL SLTP, bVal;
945 FX_DWORD CONTEXT; 945 uint32_t CONTEXT;
946 FX_DWORD line1, line2, line3; 946 uint32_t line1, line2, line3;
947 for (FX_DWORD h = 0; h < GBH; h++) { 947 for (uint32_t h = 0; h < GBH; h++) {
948 if (TPGDON) { 948 if (TPGDON) {
949 SLTP = pArithDecoder->DECODE(&gbContext[0x0795]); 949 SLTP = pArithDecoder->DECODE(&gbContext[0x0795]);
950 LTP = LTP ^ SLTP; 950 LTP = LTP ^ SLTP;
951 } 951 }
952 if (LTP == 1) { 952 if (LTP == 1) {
953 pImage->copyLine(h, h - 1); 953 pImage->copyLine(h, h - 1);
954 } else { 954 } else {
955 line1 = pImage->getPixel(2, h - 2); 955 line1 = pImage->getPixel(2, h - 2);
956 line1 |= pImage->getPixel(1, h - 2) << 1; 956 line1 |= pImage->getPixel(1, h - 2) << 1;
957 line1 |= pImage->getPixel(0, h - 2) << 2; 957 line1 |= pImage->getPixel(0, h - 2) << 2;
958 line2 = pImage->getPixel(2, h - 1); 958 line2 = pImage->getPixel(2, h - 1);
959 line2 |= pImage->getPixel(1, h - 1) << 1; 959 line2 |= pImage->getPixel(1, h - 1) << 1;
960 line2 |= pImage->getPixel(0, h - 1) << 2; 960 line2 |= pImage->getPixel(0, h - 1) << 2;
961 line3 = 0; 961 line3 = 0;
962 for (FX_DWORD w = 0; w < GBW; w++) { 962 for (uint32_t w = 0; w < GBW; w++) {
963 if (USESKIP && SKIP->getPixel(w, h)) { 963 if (USESKIP && SKIP->getPixel(w, h)) {
964 bVal = 0; 964 bVal = 0;
965 } else { 965 } else {
966 CONTEXT = line3; 966 CONTEXT = line3;
967 CONTEXT |= pImage->getPixel(w + GBAT[0], h + GBAT[1]) << 3; 967 CONTEXT |= pImage->getPixel(w + GBAT[0], h + GBAT[1]) << 3;
968 CONTEXT |= line2 << 4; 968 CONTEXT |= line2 << 4;
969 CONTEXT |= line1 << 9; 969 CONTEXT |= line1 << 9;
970 bVal = pArithDecoder->DECODE(&gbContext[CONTEXT]); 970 bVal = pArithDecoder->DECODE(&gbContext[CONTEXT]);
971 } 971 }
972 if (bVal) { 972 if (bVal) {
(...skipping 13 matching lines...) Expand all
986 m_ProssiveStatus = FXCODEC_STATUS_DECODE_FINISH; 986 m_ProssiveStatus = FXCODEC_STATUS_DECODE_FINISH;
987 return FXCODEC_STATUS_DECODE_FINISH; 987 return FXCODEC_STATUS_DECODE_FINISH;
988 } 988 }
989 989
990 FXCODEC_STATUS CJBig2_GRDProc::decode_Arith_Template2_opt3( 990 FXCODEC_STATUS CJBig2_GRDProc::decode_Arith_Template2_opt3(
991 CJBig2_Image* pImage, 991 CJBig2_Image* pImage,
992 CJBig2_ArithDecoder* pArithDecoder, 992 CJBig2_ArithDecoder* pArithDecoder,
993 JBig2ArithCtx* gbContext, 993 JBig2ArithCtx* gbContext,
994 IFX_Pause* pPause) { 994 IFX_Pause* pPause) {
995 FX_BOOL SLTP, bVal; 995 FX_BOOL SLTP, bVal;
996 FX_DWORD CONTEXT; 996 uint32_t CONTEXT;
997 FX_DWORD line1, line2; 997 uint32_t line1, line2;
998 uint8_t *pLine1, *pLine2, cVal; 998 uint8_t *pLine1, *pLine2, cVal;
999 int32_t nStride, nStride2, k; 999 int32_t nStride, nStride2, k;
1000 int32_t nLineBytes, nBitsLeft, cc; 1000 int32_t nLineBytes, nBitsLeft, cc;
1001 if (!m_pLine) { 1001 if (!m_pLine) {
1002 m_pLine = pImage->m_pData; 1002 m_pLine = pImage->m_pData;
1003 } 1003 }
1004 nStride = pImage->m_nStride; 1004 nStride = pImage->m_nStride;
1005 nStride2 = nStride << 1; 1005 nStride2 = nStride << 1;
1006 nLineBytes = ((GBW + 7) >> 3) - 1; 1006 nLineBytes = ((GBW + 7) >> 3) - 1;
1007 nBitsLeft = GBW - (nLineBytes << 3); 1007 nBitsLeft = GBW - (nLineBytes << 3);
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
1080 m_ProssiveStatus = FXCODEC_STATUS_DECODE_FINISH; 1080 m_ProssiveStatus = FXCODEC_STATUS_DECODE_FINISH;
1081 return FXCODEC_STATUS_DECODE_FINISH; 1081 return FXCODEC_STATUS_DECODE_FINISH;
1082 } 1082 }
1083 1083
1084 FXCODEC_STATUS CJBig2_GRDProc::decode_Arith_Template2_unopt( 1084 FXCODEC_STATUS CJBig2_GRDProc::decode_Arith_Template2_unopt(
1085 CJBig2_Image* pImage, 1085 CJBig2_Image* pImage,
1086 CJBig2_ArithDecoder* pArithDecoder, 1086 CJBig2_ArithDecoder* pArithDecoder,
1087 JBig2ArithCtx* gbContext, 1087 JBig2ArithCtx* gbContext,
1088 IFX_Pause* pPause) { 1088 IFX_Pause* pPause) {
1089 FX_BOOL SLTP, bVal; 1089 FX_BOOL SLTP, bVal;
1090 FX_DWORD CONTEXT; 1090 uint32_t CONTEXT;
1091 FX_DWORD line1, line2, line3; 1091 uint32_t line1, line2, line3;
1092 for (; m_loopIndex < GBH; m_loopIndex++) { 1092 for (; m_loopIndex < GBH; m_loopIndex++) {
1093 if (TPGDON) { 1093 if (TPGDON) {
1094 SLTP = pArithDecoder->DECODE(&gbContext[0x00e5]); 1094 SLTP = pArithDecoder->DECODE(&gbContext[0x00e5]);
1095 LTP = LTP ^ SLTP; 1095 LTP = LTP ^ SLTP;
1096 } 1096 }
1097 if (LTP == 1) { 1097 if (LTP == 1) {
1098 pImage->copyLine(m_loopIndex, m_loopIndex - 1); 1098 pImage->copyLine(m_loopIndex, m_loopIndex - 1);
1099 } else { 1099 } else {
1100 line1 = pImage->getPixel(1, m_loopIndex - 2); 1100 line1 = pImage->getPixel(1, m_loopIndex - 2);
1101 line1 |= pImage->getPixel(0, m_loopIndex - 2) << 1; 1101 line1 |= pImage->getPixel(0, m_loopIndex - 2) << 1;
1102 line2 = pImage->getPixel(1, m_loopIndex - 1); 1102 line2 = pImage->getPixel(1, m_loopIndex - 1);
1103 line2 |= pImage->getPixel(0, m_loopIndex - 1) << 1; 1103 line2 |= pImage->getPixel(0, m_loopIndex - 1) << 1;
1104 line3 = 0; 1104 line3 = 0;
1105 for (FX_DWORD w = 0; w < GBW; w++) { 1105 for (uint32_t w = 0; w < GBW; w++) {
1106 if (USESKIP && SKIP->getPixel(w, m_loopIndex)) { 1106 if (USESKIP && SKIP->getPixel(w, m_loopIndex)) {
1107 bVal = 0; 1107 bVal = 0;
1108 } else { 1108 } else {
1109 CONTEXT = line3; 1109 CONTEXT = line3;
1110 CONTEXT |= pImage->getPixel(w + GBAT[0], m_loopIndex + GBAT[1]) << 2; 1110 CONTEXT |= pImage->getPixel(w + GBAT[0], m_loopIndex + GBAT[1]) << 2;
1111 CONTEXT |= line2 << 3; 1111 CONTEXT |= line2 << 3;
1112 CONTEXT |= line1 << 7; 1112 CONTEXT |= line1 << 7;
1113 bVal = pArithDecoder->DECODE(&gbContext[CONTEXT]); 1113 bVal = pArithDecoder->DECODE(&gbContext[CONTEXT]);
1114 } 1114 }
1115 if (bVal) { 1115 if (bVal) {
(...skipping 15 matching lines...) Expand all
1131 m_ProssiveStatus = FXCODEC_STATUS_DECODE_FINISH; 1131 m_ProssiveStatus = FXCODEC_STATUS_DECODE_FINISH;
1132 return FXCODEC_STATUS_DECODE_FINISH; 1132 return FXCODEC_STATUS_DECODE_FINISH;
1133 } 1133 }
1134 1134
1135 FXCODEC_STATUS CJBig2_GRDProc::decode_Arith_Template3_opt3( 1135 FXCODEC_STATUS CJBig2_GRDProc::decode_Arith_Template3_opt3(
1136 CJBig2_Image* pImage, 1136 CJBig2_Image* pImage,
1137 CJBig2_ArithDecoder* pArithDecoder, 1137 CJBig2_ArithDecoder* pArithDecoder,
1138 JBig2ArithCtx* gbContext, 1138 JBig2ArithCtx* gbContext,
1139 IFX_Pause* pPause) { 1139 IFX_Pause* pPause) {
1140 FX_BOOL SLTP, bVal; 1140 FX_BOOL SLTP, bVal;
1141 FX_DWORD CONTEXT; 1141 uint32_t CONTEXT;
1142 FX_DWORD line1; 1142 uint32_t line1;
1143 uint8_t *pLine1, cVal; 1143 uint8_t *pLine1, cVal;
1144 int32_t nStride, k; 1144 int32_t nStride, k;
1145 int32_t nLineBytes, nBitsLeft, cc; 1145 int32_t nLineBytes, nBitsLeft, cc;
1146 if (!m_pLine) { 1146 if (!m_pLine) {
1147 m_pLine = pImage->m_pData; 1147 m_pLine = pImage->m_pData;
1148 } 1148 }
1149 nStride = pImage->m_nStride; 1149 nStride = pImage->m_nStride;
1150 nLineBytes = ((GBW + 7) >> 3) - 1; 1150 nLineBytes = ((GBW + 7) >> 3) - 1;
1151 nBitsLeft = GBW - (nLineBytes << 3); 1151 nBitsLeft = GBW - (nLineBytes << 3);
1152 for (; m_loopIndex < GBH; m_loopIndex++) { 1152 for (; m_loopIndex < GBH; m_loopIndex++) {
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
1211 m_ProssiveStatus = FXCODEC_STATUS_DECODE_FINISH; 1211 m_ProssiveStatus = FXCODEC_STATUS_DECODE_FINISH;
1212 return FXCODEC_STATUS_DECODE_FINISH; 1212 return FXCODEC_STATUS_DECODE_FINISH;
1213 } 1213 }
1214 1214
1215 FXCODEC_STATUS CJBig2_GRDProc::decode_Arith_Template3_unopt( 1215 FXCODEC_STATUS CJBig2_GRDProc::decode_Arith_Template3_unopt(
1216 CJBig2_Image* pImage, 1216 CJBig2_Image* pImage,
1217 CJBig2_ArithDecoder* pArithDecoder, 1217 CJBig2_ArithDecoder* pArithDecoder,
1218 JBig2ArithCtx* gbContext, 1218 JBig2ArithCtx* gbContext,
1219 IFX_Pause* pPause) { 1219 IFX_Pause* pPause) {
1220 FX_BOOL SLTP, bVal; 1220 FX_BOOL SLTP, bVal;
1221 FX_DWORD CONTEXT; 1221 uint32_t CONTEXT;
1222 FX_DWORD line1, line2; 1222 uint32_t line1, line2;
1223 for (; m_loopIndex < GBH; m_loopIndex++) { 1223 for (; m_loopIndex < GBH; m_loopIndex++) {
1224 if (TPGDON) { 1224 if (TPGDON) {
1225 SLTP = pArithDecoder->DECODE(&gbContext[0x0195]); 1225 SLTP = pArithDecoder->DECODE(&gbContext[0x0195]);
1226 LTP = LTP ^ SLTP; 1226 LTP = LTP ^ SLTP;
1227 } 1227 }
1228 if (LTP == 1) { 1228 if (LTP == 1) {
1229 pImage->copyLine(m_loopIndex, m_loopIndex - 1); 1229 pImage->copyLine(m_loopIndex, m_loopIndex - 1);
1230 } else { 1230 } else {
1231 line1 = pImage->getPixel(1, m_loopIndex - 1); 1231 line1 = pImage->getPixel(1, m_loopIndex - 1);
1232 line1 |= pImage->getPixel(0, m_loopIndex - 1) << 1; 1232 line1 |= pImage->getPixel(0, m_loopIndex - 1) << 1;
1233 line2 = 0; 1233 line2 = 0;
1234 for (FX_DWORD w = 0; w < GBW; w++) { 1234 for (uint32_t w = 0; w < GBW; w++) {
1235 if (USESKIP && SKIP->getPixel(w, m_loopIndex)) { 1235 if (USESKIP && SKIP->getPixel(w, m_loopIndex)) {
1236 bVal = 0; 1236 bVal = 0;
1237 } else { 1237 } else {
1238 CONTEXT = line2; 1238 CONTEXT = line2;
1239 CONTEXT |= pImage->getPixel(w + GBAT[0], m_loopIndex + GBAT[1]) << 4; 1239 CONTEXT |= pImage->getPixel(w + GBAT[0], m_loopIndex + GBAT[1]) << 4;
1240 CONTEXT |= line1 << 5; 1240 CONTEXT |= line1 << 5;
1241 bVal = pArithDecoder->DECODE(&gbContext[CONTEXT]); 1241 bVal = pArithDecoder->DECODE(&gbContext[CONTEXT]);
1242 } 1242 }
1243 if (bVal) { 1243 if (bVal) {
1244 pImage->setPixel(w, m_loopIndex, bVal); 1244 pImage->setPixel(w, m_loopIndex, bVal);
1245 } 1245 }
1246 line1 = 1246 line1 =
1247 ((line1 << 1) | pImage->getPixel(w + 2, m_loopIndex - 1)) & 0x1f; 1247 ((line1 << 1) | pImage->getPixel(w + 2, m_loopIndex - 1)) & 0x1f;
1248 line2 = ((line2 << 1) | bVal) & 0x0f; 1248 line2 = ((line2 << 1) | bVal) & 0x0f;
1249 } 1249 }
1250 } 1250 }
1251 if (pPause && pPause->NeedToPauseNow()) { 1251 if (pPause && pPause->NeedToPauseNow()) {
1252 m_loopIndex++; 1252 m_loopIndex++;
1253 m_ProssiveStatus = FXCODEC_STATUS_DECODE_TOBECONTINUE; 1253 m_ProssiveStatus = FXCODEC_STATUS_DECODE_TOBECONTINUE;
1254 return FXCODEC_STATUS_DECODE_TOBECONTINUE; 1254 return FXCODEC_STATUS_DECODE_TOBECONTINUE;
1255 } 1255 }
1256 } 1256 }
1257 m_ProssiveStatus = FXCODEC_STATUS_DECODE_FINISH; 1257 m_ProssiveStatus = FXCODEC_STATUS_DECODE_FINISH;
1258 return FXCODEC_STATUS_DECODE_FINISH; 1258 return FXCODEC_STATUS_DECODE_FINISH;
1259 } 1259 }
OLDNEW
« no previous file with comments | « core/fxcodec/jbig2/JBig2_GrdProc.h ('k') | core/fxcodec/jbig2/JBig2_GrrdProc.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698