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

Side by Side Diff: core/src/fxcodec/jbig2/JBig2_GeneralDecoder.cpp

Issue 1252613002: FX_BOOL considered harmful. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Manual edits. Created 5 years, 5 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
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 6
7 #include "JBig2_GeneralDecoder.h" 7 #include "JBig2_GeneralDecoder.h"
8 #include "JBig2_ArithDecoder.h" 8 #include "JBig2_ArithDecoder.h"
9 #include "JBig2_ArithIntDecoder.h" 9 #include "JBig2_ArithIntDecoder.h"
10 #include "JBig2_HuffmanDecoder.h" 10 #include "JBig2_HuffmanDecoder.h"
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 } else { 94 } else {
95 if((GBAT[0] == 2) && (GBAT[1] == (signed char) - 1)) { 95 if((GBAT[0] == 2) && (GBAT[1] == (signed char) - 1)) {
96 return decode_Arith_Template3_opt3(pArithDecoder, gbContext); 96 return decode_Arith_Template3_opt3(pArithDecoder, gbContext);
97 } else { 97 } else {
98 return decode_Arith_Template3_unopt(pArithDecoder, gbContext); 98 return decode_Arith_Template3_unopt(pArithDecoder, gbContext);
99 } 99 }
100 } 100 }
101 } 101 }
102 CJBig2_Image *CJBig2_GRDProc::decode_Arith_Template0_opt(CJBig2_ArithDecoder *pA rithDecoder, JBig2ArithCtx *gbContext) 102 CJBig2_Image *CJBig2_GRDProc::decode_Arith_Template0_opt(CJBig2_ArithDecoder *pA rithDecoder, JBig2ArithCtx *gbContext)
103 { 103 {
104 FX_BOOL LTP, SLTP, bVal; 104 bool LTP, SLTP, bVal;
105 FX_DWORD CONTEXT; 105 FX_DWORD CONTEXT;
106 CJBig2_Image *GBREG; 106 CJBig2_Image *GBREG;
107 FX_DWORD line1, line2, line3; 107 FX_DWORD line1, line2, line3;
108 LTP = 0; 108 LTP = 0;
109 JBIG2_ALLOC(GBREG, CJBig2_Image(GBW, GBH)); 109 JBIG2_ALLOC(GBREG, CJBig2_Image(GBW, GBH));
110 GBREG->fill(0); 110 GBREG->fill(0);
111 for(FX_DWORD h = 0; h < GBH; h++) { 111 for(FX_DWORD h = 0; h < GBH; h++) {
112 if(TPGDON) { 112 if(TPGDON) {
113 SLTP = pArithDecoder->DECODE(&gbContext[0x9b25]); 113 SLTP = pArithDecoder->DECODE(&gbContext[0x9b25]);
114 LTP = LTP ^ SLTP; 114 LTP = LTP ^ SLTP;
(...skipping 24 matching lines...) Expand all
139 line1 = ((line1 << 1) | GBREG->getPixel(w + 3, h - 2)) & 0x1f; 139 line1 = ((line1 << 1) | GBREG->getPixel(w + 3, h - 2)) & 0x1f;
140 line2 = ((line2 << 1) | GBREG->getPixel(w + 4, h - 1)) & 0x7f; 140 line2 = ((line2 << 1) | GBREG->getPixel(w + 4, h - 1)) & 0x7f;
141 line3 = ((line3 << 1) | bVal) & 0x0f; 141 line3 = ((line3 << 1) | bVal) & 0x0f;
142 } 142 }
143 } 143 }
144 } 144 }
145 return GBREG; 145 return GBREG;
146 } 146 }
147 CJBig2_Image *CJBig2_GRDProc::decode_Arith_Template0_opt2(CJBig2_ArithDecoder *p ArithDecoder, JBig2ArithCtx *gbContext) 147 CJBig2_Image *CJBig2_GRDProc::decode_Arith_Template0_opt2(CJBig2_ArithDecoder *p ArithDecoder, JBig2ArithCtx *gbContext)
148 { 148 {
149 FX_BOOL LTP, SLTP, bVal; 149 bool LTP, SLTP, bVal;
150 FX_DWORD CONTEXT; 150 FX_DWORD CONTEXT;
151 CJBig2_Image *GBREG; 151 CJBig2_Image *GBREG;
152 FX_DWORD line1, line2; 152 FX_DWORD line1, line2;
153 uint8_t *pLine, cVal; 153 uint8_t *pLine, cVal;
154 intptr_t nStride, nStride2; 154 intptr_t nStride, nStride2;
155 int32_t nBits, k; 155 int32_t nBits, k;
156 LTP = 0; 156 LTP = 0;
157 JBIG2_ALLOC(GBREG, CJBig2_Image(GBW, GBH)); 157 JBIG2_ALLOC(GBREG, CJBig2_Image(GBW, GBH));
158 if (GBREG->m_pData == NULL) { 158 if (GBREG->m_pData == NULL) {
159 delete GBREG; 159 delete GBREG;
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 } 206 }
207 pLine[w >> 3] = cVal; 207 pLine[w >> 3] = cVal;
208 } 208 }
209 } 209 }
210 pLine += nStride; 210 pLine += nStride;
211 } 211 }
212 return GBREG; 212 return GBREG;
213 } 213 }
214 CJBig2_Image *CJBig2_GRDProc::decode_Arith_Template0_opt3(CJBig2_ArithDecoder *p ArithDecoder, JBig2ArithCtx *gbContext) 214 CJBig2_Image *CJBig2_GRDProc::decode_Arith_Template0_opt3(CJBig2_ArithDecoder *p ArithDecoder, JBig2ArithCtx *gbContext)
215 { 215 {
216 FX_BOOL LTP, SLTP, bVal; 216 bool LTP, SLTP, bVal;
217 FX_DWORD CONTEXT; 217 FX_DWORD CONTEXT;
218 CJBig2_Image *GBREG; 218 CJBig2_Image *GBREG;
219 FX_DWORD line1, line2; 219 FX_DWORD line1, line2;
220 uint8_t *pLine, *pLine1, *pLine2, cVal; 220 uint8_t *pLine, *pLine1, *pLine2, cVal;
221 int32_t nStride, nStride2, k; 221 int32_t nStride, nStride2, k;
222 int32_t nLineBytes, nBitsLeft, cc; 222 int32_t nLineBytes, nBitsLeft, cc;
223 LTP = 0; 223 LTP = 0;
224 JBIG2_ALLOC(GBREG, CJBig2_Image(GBW, GBH)); 224 JBIG2_ALLOC(GBREG, CJBig2_Image(GBW, GBH));
225 if (GBREG->m_pData == NULL) { 225 if (GBREG->m_pData == NULL) {
226 delete GBREG; 226 delete GBREG;
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
298 } 298 }
299 pLine[nLineBytes] = cVal; 299 pLine[nLineBytes] = cVal;
300 } 300 }
301 } 301 }
302 pLine += nStride; 302 pLine += nStride;
303 } 303 }
304 return GBREG; 304 return GBREG;
305 } 305 }
306 CJBig2_Image *CJBig2_GRDProc::decode_Arith_Template0_unopt(CJBig2_ArithDecoder * pArithDecoder, JBig2ArithCtx *gbContext) 306 CJBig2_Image *CJBig2_GRDProc::decode_Arith_Template0_unopt(CJBig2_ArithDecoder * pArithDecoder, JBig2ArithCtx *gbContext)
307 { 307 {
308 FX_BOOL LTP, SLTP, bVal; 308 bool LTP, SLTP, bVal;
309 FX_DWORD CONTEXT; 309 FX_DWORD CONTEXT;
310 CJBig2_Image *GBREG; 310 CJBig2_Image *GBREG;
311 FX_DWORD line1, line2, line3; 311 FX_DWORD line1, line2, line3;
312 LTP = 0; 312 LTP = 0;
313 JBIG2_ALLOC(GBREG, CJBig2_Image(GBW, GBH)); 313 JBIG2_ALLOC(GBREG, CJBig2_Image(GBW, GBH));
314 GBREG->fill(0); 314 GBREG->fill(0);
315 for(FX_DWORD h = 0; h < GBH; h++) { 315 for(FX_DWORD h = 0; h < GBH; h++) {
316 if(TPGDON) { 316 if(TPGDON) {
317 SLTP = pArithDecoder->DECODE(&gbContext[0x9b25]); 317 SLTP = pArithDecoder->DECODE(&gbContext[0x9b25]);
318 LTP = LTP ^ SLTP; 318 LTP = LTP ^ SLTP;
(...skipping 26 matching lines...) Expand all
345 line1 = ((line1 << 1) | GBREG->getPixel(w + 2, h - 2)) & 0x07; 345 line1 = ((line1 << 1) | GBREG->getPixel(w + 2, h - 2)) & 0x07;
346 line2 = ((line2 << 1) | GBREG->getPixel(w + 3, h - 1)) & 0x1f; 346 line2 = ((line2 << 1) | GBREG->getPixel(w + 3, h - 1)) & 0x1f;
347 line3 = ((line3 << 1) | bVal) & 0x0f; 347 line3 = ((line3 << 1) | bVal) & 0x0f;
348 } 348 }
349 } 349 }
350 } 350 }
351 return GBREG; 351 return GBREG;
352 } 352 }
353 CJBig2_Image *CJBig2_GRDProc::decode_Arith_Template1_opt(CJBig2_ArithDecoder *pA rithDecoder, JBig2ArithCtx *gbContext) 353 CJBig2_Image *CJBig2_GRDProc::decode_Arith_Template1_opt(CJBig2_ArithDecoder *pA rithDecoder, JBig2ArithCtx *gbContext)
354 { 354 {
355 FX_BOOL LTP, SLTP, bVal; 355 bool LTP, SLTP, bVal;
356 FX_DWORD CONTEXT; 356 FX_DWORD CONTEXT;
357 CJBig2_Image *GBREG; 357 CJBig2_Image *GBREG;
358 FX_DWORD line1, line2, line3; 358 FX_DWORD line1, line2, line3;
359 LTP = 0; 359 LTP = 0;
360 JBIG2_ALLOC(GBREG, CJBig2_Image(GBW, GBH)); 360 JBIG2_ALLOC(GBREG, CJBig2_Image(GBW, GBH));
361 GBREG->fill(0); 361 GBREG->fill(0);
362 for(FX_DWORD h = 0; h < GBH; h++) { 362 for(FX_DWORD h = 0; h < GBH; h++) {
363 if(TPGDON) { 363 if(TPGDON) {
364 SLTP = pArithDecoder->DECODE(&gbContext[0x0795]); 364 SLTP = pArithDecoder->DECODE(&gbContext[0x0795]);
365 LTP = LTP ^ SLTP; 365 LTP = LTP ^ SLTP;
(...skipping 24 matching lines...) Expand all
390 line1 = ((line1 << 1) | GBREG->getPixel(w + 3, h - 2)) & 0x0f; 390 line1 = ((line1 << 1) | GBREG->getPixel(w + 3, h - 2)) & 0x0f;
391 line2 = ((line2 << 1) | GBREG->getPixel(w + 4, h - 1)) & 0x3f; 391 line2 = ((line2 << 1) | GBREG->getPixel(w + 4, h - 1)) & 0x3f;
392 line3 = ((line3 << 1) | bVal) & 0x07; 392 line3 = ((line3 << 1) | bVal) & 0x07;
393 } 393 }
394 } 394 }
395 } 395 }
396 return GBREG; 396 return GBREG;
397 } 397 }
398 CJBig2_Image *CJBig2_GRDProc::decode_Arith_Template1_opt2(CJBig2_ArithDecoder *p ArithDecoder, JBig2ArithCtx *gbContext) 398 CJBig2_Image *CJBig2_GRDProc::decode_Arith_Template1_opt2(CJBig2_ArithDecoder *p ArithDecoder, JBig2ArithCtx *gbContext)
399 { 399 {
400 FX_BOOL LTP, SLTP, bVal; 400 bool LTP, SLTP, bVal;
401 FX_DWORD CONTEXT; 401 FX_DWORD CONTEXT;
402 CJBig2_Image *GBREG; 402 CJBig2_Image *GBREG;
403 FX_DWORD line1, line2; 403 FX_DWORD line1, line2;
404 uint8_t *pLine, cVal; 404 uint8_t *pLine, cVal;
405 intptr_t nStride, nStride2; 405 intptr_t nStride, nStride2;
406 int32_t nBits, k; 406 int32_t nBits, k;
407 LTP = 0; 407 LTP = 0;
408 JBIG2_ALLOC(GBREG, CJBig2_Image(GBW, GBH)); 408 JBIG2_ALLOC(GBREG, CJBig2_Image(GBW, GBH));
409 if (GBREG->m_pData == NULL) { 409 if (GBREG->m_pData == NULL) {
410 delete GBREG; 410 delete GBREG;
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
457 } 457 }
458 pLine[w >> 3] = cVal; 458 pLine[w >> 3] = cVal;
459 } 459 }
460 } 460 }
461 pLine += nStride; 461 pLine += nStride;
462 } 462 }
463 return GBREG; 463 return GBREG;
464 } 464 }
465 CJBig2_Image *CJBig2_GRDProc::decode_Arith_Template1_opt3(CJBig2_ArithDecoder *p ArithDecoder, JBig2ArithCtx *gbContext) 465 CJBig2_Image *CJBig2_GRDProc::decode_Arith_Template1_opt3(CJBig2_ArithDecoder *p ArithDecoder, JBig2ArithCtx *gbContext)
466 { 466 {
467 FX_BOOL LTP, SLTP, bVal; 467 bool LTP, SLTP, bVal;
468 FX_DWORD CONTEXT; 468 FX_DWORD CONTEXT;
469 CJBig2_Image *GBREG; 469 CJBig2_Image *GBREG;
470 FX_DWORD line1, line2; 470 FX_DWORD line1, line2;
471 uint8_t *pLine, *pLine1, *pLine2, cVal; 471 uint8_t *pLine, *pLine1, *pLine2, cVal;
472 int32_t nStride, nStride2, k; 472 int32_t nStride, nStride2, k;
473 int32_t nLineBytes, nBitsLeft, cc; 473 int32_t nLineBytes, nBitsLeft, cc;
474 LTP = 0; 474 LTP = 0;
475 JBIG2_ALLOC(GBREG, CJBig2_Image(GBW, GBH)); 475 JBIG2_ALLOC(GBREG, CJBig2_Image(GBW, GBH));
476 if (GBREG->m_pData == NULL) { 476 if (GBREG->m_pData == NULL) {
477 delete GBREG; 477 delete GBREG;
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
548 } 548 }
549 pLine[nLineBytes] = cVal; 549 pLine[nLineBytes] = cVal;
550 } 550 }
551 } 551 }
552 pLine += nStride; 552 pLine += nStride;
553 } 553 }
554 return GBREG; 554 return GBREG;
555 } 555 }
556 CJBig2_Image *CJBig2_GRDProc::decode_Arith_Template1_unopt(CJBig2_ArithDecoder * pArithDecoder, JBig2ArithCtx *gbContext) 556 CJBig2_Image *CJBig2_GRDProc::decode_Arith_Template1_unopt(CJBig2_ArithDecoder * pArithDecoder, JBig2ArithCtx *gbContext)
557 { 557 {
558 FX_BOOL LTP, SLTP, bVal; 558 bool LTP, SLTP, bVal;
559 FX_DWORD CONTEXT; 559 FX_DWORD CONTEXT;
560 CJBig2_Image *GBREG; 560 CJBig2_Image *GBREG;
561 FX_DWORD line1, line2, line3; 561 FX_DWORD line1, line2, line3;
562 LTP = 0; 562 LTP = 0;
563 JBIG2_ALLOC(GBREG, CJBig2_Image(GBW, GBH)); 563 JBIG2_ALLOC(GBREG, CJBig2_Image(GBW, GBH));
564 GBREG->fill(0); 564 GBREG->fill(0);
565 for(FX_DWORD h = 0; h < GBH; h++) { 565 for(FX_DWORD h = 0; h < GBH; h++) {
566 if(TPGDON) { 566 if(TPGDON) {
567 SLTP = pArithDecoder->DECODE(&gbContext[0x0795]); 567 SLTP = pArithDecoder->DECODE(&gbContext[0x0795]);
568 LTP = LTP ^ SLTP; 568 LTP = LTP ^ SLTP;
(...skipping 24 matching lines...) Expand all
593 line1 = ((line1 << 1) | GBREG->getPixel(w + 3, h - 2)) & 0x0f; 593 line1 = ((line1 << 1) | GBREG->getPixel(w + 3, h - 2)) & 0x0f;
594 line2 = ((line2 << 1) | GBREG->getPixel(w + 3, h - 1)) & 0x1f; 594 line2 = ((line2 << 1) | GBREG->getPixel(w + 3, h - 1)) & 0x1f;
595 line3 = ((line3 << 1) | bVal) & 0x07; 595 line3 = ((line3 << 1) | bVal) & 0x07;
596 } 596 }
597 } 597 }
598 } 598 }
599 return GBREG; 599 return GBREG;
600 } 600 }
601 CJBig2_Image *CJBig2_GRDProc::decode_Arith_Template2_opt(CJBig2_ArithDecoder *pA rithDecoder, JBig2ArithCtx *gbContext) 601 CJBig2_Image *CJBig2_GRDProc::decode_Arith_Template2_opt(CJBig2_ArithDecoder *pA rithDecoder, JBig2ArithCtx *gbContext)
602 { 602 {
603 FX_BOOL LTP, SLTP, bVal; 603 bool LTP, SLTP, bVal;
604 FX_DWORD CONTEXT; 604 FX_DWORD CONTEXT;
605 CJBig2_Image *GBREG; 605 CJBig2_Image *GBREG;
606 FX_DWORD line1, line2, line3; 606 FX_DWORD line1, line2, line3;
607 LTP = 0; 607 LTP = 0;
608 JBIG2_ALLOC(GBREG, CJBig2_Image(GBW, GBH)); 608 JBIG2_ALLOC(GBREG, CJBig2_Image(GBW, GBH));
609 GBREG->fill(0); 609 GBREG->fill(0);
610 for(FX_DWORD h = 0; h < GBH; h++) { 610 for(FX_DWORD h = 0; h < GBH; h++) {
611 if(TPGDON) { 611 if(TPGDON) {
612 SLTP = pArithDecoder->DECODE(&gbContext[0x00e5]); 612 SLTP = pArithDecoder->DECODE(&gbContext[0x00e5]);
613 LTP = LTP ^ SLTP; 613 LTP = LTP ^ SLTP;
(...skipping 22 matching lines...) Expand all
636 line1 = ((line1 << 1) | GBREG->getPixel(w + 2, h - 2)) & 0x07; 636 line1 = ((line1 << 1) | GBREG->getPixel(w + 2, h - 2)) & 0x07;
637 line2 = ((line2 << 1) | GBREG->getPixel(w + 3, h - 1)) & 0x1f; 637 line2 = ((line2 << 1) | GBREG->getPixel(w + 3, h - 1)) & 0x1f;
638 line3 = ((line3 << 1) | bVal) & 0x03; 638 line3 = ((line3 << 1) | bVal) & 0x03;
639 } 639 }
640 } 640 }
641 } 641 }
642 return GBREG; 642 return GBREG;
643 } 643 }
644 CJBig2_Image *CJBig2_GRDProc::decode_Arith_Template2_opt2(CJBig2_ArithDecoder *p ArithDecoder, JBig2ArithCtx *gbContext) 644 CJBig2_Image *CJBig2_GRDProc::decode_Arith_Template2_opt2(CJBig2_ArithDecoder *p ArithDecoder, JBig2ArithCtx *gbContext)
645 { 645 {
646 FX_BOOL LTP, SLTP, bVal; 646 bool LTP, SLTP, bVal;
647 FX_DWORD CONTEXT; 647 FX_DWORD CONTEXT;
648 CJBig2_Image *GBREG; 648 CJBig2_Image *GBREG;
649 FX_DWORD line1, line2; 649 FX_DWORD line1, line2;
650 uint8_t *pLine, cVal; 650 uint8_t *pLine, cVal;
651 intptr_t nStride, nStride2; 651 intptr_t nStride, nStride2;
652 int32_t nBits, k; 652 int32_t nBits, k;
653 LTP = 0; 653 LTP = 0;
654 JBIG2_ALLOC(GBREG, CJBig2_Image(GBW, GBH)); 654 JBIG2_ALLOC(GBREG, CJBig2_Image(GBW, GBH));
655 if (GBREG->m_pData == NULL) { 655 if (GBREG->m_pData == NULL) {
656 delete GBREG; 656 delete GBREG;
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
703 } 703 }
704 pLine[w >> 3] = cVal; 704 pLine[w >> 3] = cVal;
705 } 705 }
706 } 706 }
707 pLine += nStride; 707 pLine += nStride;
708 } 708 }
709 return GBREG; 709 return GBREG;
710 } 710 }
711 CJBig2_Image *CJBig2_GRDProc::decode_Arith_Template2_opt3(CJBig2_ArithDecoder *p ArithDecoder, JBig2ArithCtx *gbContext) 711 CJBig2_Image *CJBig2_GRDProc::decode_Arith_Template2_opt3(CJBig2_ArithDecoder *p ArithDecoder, JBig2ArithCtx *gbContext)
712 { 712 {
713 FX_BOOL LTP, SLTP, bVal; 713 bool LTP, SLTP, bVal;
714 FX_DWORD CONTEXT; 714 FX_DWORD CONTEXT;
715 CJBig2_Image *GBREG; 715 CJBig2_Image *GBREG;
716 FX_DWORD line1, line2; 716 FX_DWORD line1, line2;
717 uint8_t *pLine, *pLine1, *pLine2, cVal; 717 uint8_t *pLine, *pLine1, *pLine2, cVal;
718 int32_t nStride, nStride2, k; 718 int32_t nStride, nStride2, k;
719 int32_t nLineBytes, nBitsLeft, cc; 719 int32_t nLineBytes, nBitsLeft, cc;
720 LTP = 0; 720 LTP = 0;
721 JBIG2_ALLOC(GBREG, CJBig2_Image(GBW, GBH)); 721 JBIG2_ALLOC(GBREG, CJBig2_Image(GBW, GBH));
722 if (GBREG->m_pData == NULL) { 722 if (GBREG->m_pData == NULL) {
723 delete GBREG; 723 delete GBREG;
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
794 } 794 }
795 pLine[nLineBytes] = cVal; 795 pLine[nLineBytes] = cVal;
796 } 796 }
797 } 797 }
798 pLine += nStride; 798 pLine += nStride;
799 } 799 }
800 return GBREG; 800 return GBREG;
801 } 801 }
802 CJBig2_Image *CJBig2_GRDProc::decode_Arith_Template2_unopt(CJBig2_ArithDecoder * pArithDecoder, JBig2ArithCtx *gbContext) 802 CJBig2_Image *CJBig2_GRDProc::decode_Arith_Template2_unopt(CJBig2_ArithDecoder * pArithDecoder, JBig2ArithCtx *gbContext)
803 { 803 {
804 FX_BOOL LTP, SLTP, bVal; 804 bool LTP, SLTP, bVal;
805 FX_DWORD CONTEXT; 805 FX_DWORD CONTEXT;
806 CJBig2_Image *GBREG; 806 CJBig2_Image *GBREG;
807 FX_DWORD line1, line2, line3; 807 FX_DWORD line1, line2, line3;
808 LTP = 0; 808 LTP = 0;
809 JBIG2_ALLOC(GBREG, CJBig2_Image(GBW, GBH)); 809 JBIG2_ALLOC(GBREG, CJBig2_Image(GBW, GBH));
810 GBREG->fill(0); 810 GBREG->fill(0);
811 for(FX_DWORD h = 0; h < GBH; h++) { 811 for(FX_DWORD h = 0; h < GBH; h++) {
812 if(TPGDON) { 812 if(TPGDON) {
813 SLTP = pArithDecoder->DECODE(&gbContext[0x00e5]); 813 SLTP = pArithDecoder->DECODE(&gbContext[0x00e5]);
814 LTP = LTP ^ SLTP; 814 LTP = LTP ^ SLTP;
(...skipping 22 matching lines...) Expand all
837 line1 = ((line1 << 1) | GBREG->getPixel(w + 2, h - 2)) & 0x07; 837 line1 = ((line1 << 1) | GBREG->getPixel(w + 2, h - 2)) & 0x07;
838 line2 = ((line2 << 1) | GBREG->getPixel(w + 2, h - 1)) & 0x0f; 838 line2 = ((line2 << 1) | GBREG->getPixel(w + 2, h - 1)) & 0x0f;
839 line3 = ((line3 << 1) | bVal) & 0x03; 839 line3 = ((line3 << 1) | bVal) & 0x03;
840 } 840 }
841 } 841 }
842 } 842 }
843 return GBREG; 843 return GBREG;
844 } 844 }
845 CJBig2_Image *CJBig2_GRDProc::decode_Arith_Template3_opt(CJBig2_ArithDecoder *pA rithDecoder, JBig2ArithCtx *gbContext) 845 CJBig2_Image *CJBig2_GRDProc::decode_Arith_Template3_opt(CJBig2_ArithDecoder *pA rithDecoder, JBig2ArithCtx *gbContext)
846 { 846 {
847 FX_BOOL LTP, SLTP, bVal; 847 bool LTP, SLTP, bVal;
848 FX_DWORD CONTEXT; 848 FX_DWORD CONTEXT;
849 CJBig2_Image *GBREG; 849 CJBig2_Image *GBREG;
850 FX_DWORD line1, line2; 850 FX_DWORD line1, line2;
851 LTP = 0; 851 LTP = 0;
852 JBIG2_ALLOC(GBREG, CJBig2_Image(GBW, GBH)); 852 JBIG2_ALLOC(GBREG, CJBig2_Image(GBW, GBH));
853 GBREG->fill(0); 853 GBREG->fill(0);
854 for(FX_DWORD h = 0; h < GBH; h++) { 854 for(FX_DWORD h = 0; h < GBH; h++) {
855 if(TPGDON) { 855 if(TPGDON) {
856 SLTP = pArithDecoder->DECODE(&gbContext[0x0195]); 856 SLTP = pArithDecoder->DECODE(&gbContext[0x0195]);
857 LTP = LTP ^ SLTP; 857 LTP = LTP ^ SLTP;
(...skipping 18 matching lines...) Expand all
876 } 876 }
877 line1 = ((line1 << 1) | GBREG->getPixel(w + 3, h - 1)) & 0x3f; 877 line1 = ((line1 << 1) | GBREG->getPixel(w + 3, h - 1)) & 0x3f;
878 line2 = ((line2 << 1) | bVal) & 0x0f; 878 line2 = ((line2 << 1) | bVal) & 0x0f;
879 } 879 }
880 } 880 }
881 } 881 }
882 return GBREG; 882 return GBREG;
883 } 883 }
884 CJBig2_Image *CJBig2_GRDProc::decode_Arith_Template3_opt2(CJBig2_ArithDecoder *p ArithDecoder, JBig2ArithCtx *gbContext) 884 CJBig2_Image *CJBig2_GRDProc::decode_Arith_Template3_opt2(CJBig2_ArithDecoder *p ArithDecoder, JBig2ArithCtx *gbContext)
885 { 885 {
886 FX_BOOL LTP, SLTP, bVal; 886 bool LTP, SLTP, bVal;
887 FX_DWORD CONTEXT; 887 FX_DWORD CONTEXT;
888 CJBig2_Image *GBREG; 888 CJBig2_Image *GBREG;
889 FX_DWORD line1; 889 FX_DWORD line1;
890 uint8_t *pLine, cVal; 890 uint8_t *pLine, cVal;
891 intptr_t nStride; 891 intptr_t nStride;
892 int32_t nBits, k; 892 int32_t nBits, k;
893 LTP = 0; 893 LTP = 0;
894 JBIG2_ALLOC(GBREG, CJBig2_Image(GBW, GBH)); 894 JBIG2_ALLOC(GBREG, CJBig2_Image(GBW, GBH));
895 if (GBREG->m_pData == NULL) { 895 if (GBREG->m_pData == NULL) {
896 delete GBREG; 896 delete GBREG;
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
934 } 934 }
935 pLine[w >> 3] = cVal; 935 pLine[w >> 3] = cVal;
936 } 936 }
937 } 937 }
938 pLine += nStride; 938 pLine += nStride;
939 } 939 }
940 return GBREG; 940 return GBREG;
941 } 941 }
942 CJBig2_Image *CJBig2_GRDProc::decode_Arith_Template3_opt3(CJBig2_ArithDecoder *p ArithDecoder, JBig2ArithCtx *gbContext) 942 CJBig2_Image *CJBig2_GRDProc::decode_Arith_Template3_opt3(CJBig2_ArithDecoder *p ArithDecoder, JBig2ArithCtx *gbContext)
943 { 943 {
944 FX_BOOL LTP, SLTP, bVal; 944 bool LTP, SLTP, bVal;
945 FX_DWORD CONTEXT; 945 FX_DWORD CONTEXT;
946 CJBig2_Image *GBREG; 946 CJBig2_Image *GBREG;
947 FX_DWORD line1; 947 FX_DWORD line1;
948 uint8_t *pLine, *pLine1, cVal; 948 uint8_t *pLine, *pLine1, cVal;
949 int32_t nStride, k; 949 int32_t nStride, k;
950 int32_t nLineBytes, nBitsLeft, cc; 950 int32_t nLineBytes, nBitsLeft, cc;
951 LTP = 0; 951 LTP = 0;
952 JBIG2_ALLOC(GBREG, CJBig2_Image(GBW, GBH)); 952 JBIG2_ALLOC(GBREG, CJBig2_Image(GBW, GBH));
953 if (GBREG->m_pData == NULL) { 953 if (GBREG->m_pData == NULL) {
954 delete GBREG; 954 delete GBREG;
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
1010 } 1010 }
1011 pLine[nLineBytes] = cVal; 1011 pLine[nLineBytes] = cVal;
1012 } 1012 }
1013 } 1013 }
1014 pLine += nStride; 1014 pLine += nStride;
1015 } 1015 }
1016 return GBREG; 1016 return GBREG;
1017 } 1017 }
1018 CJBig2_Image *CJBig2_GRDProc::decode_Arith_Template3_unopt(CJBig2_ArithDecoder * pArithDecoder, JBig2ArithCtx *gbContext) 1018 CJBig2_Image *CJBig2_GRDProc::decode_Arith_Template3_unopt(CJBig2_ArithDecoder * pArithDecoder, JBig2ArithCtx *gbContext)
1019 { 1019 {
1020 FX_BOOL LTP, SLTP, bVal; 1020 bool LTP, SLTP, bVal;
1021 FX_DWORD CONTEXT; 1021 FX_DWORD CONTEXT;
1022 CJBig2_Image *GBREG; 1022 CJBig2_Image *GBREG;
1023 FX_DWORD line1, line2; 1023 FX_DWORD line1, line2;
1024 LTP = 0; 1024 LTP = 0;
1025 JBIG2_ALLOC(GBREG, CJBig2_Image(GBW, GBH)); 1025 JBIG2_ALLOC(GBREG, CJBig2_Image(GBW, GBH));
1026 GBREG->fill(0); 1026 GBREG->fill(0);
1027 for(FX_DWORD h = 0; h < GBH; h++) { 1027 for(FX_DWORD h = 0; h < GBH; h++) {
1028 if(TPGDON) { 1028 if(TPGDON) {
1029 SLTP = pArithDecoder->DECODE(&gbContext[0x0195]); 1029 SLTP = pArithDecoder->DECODE(&gbContext[0x0195]);
1030 LTP = LTP ^ SLTP; 1030 LTP = LTP ^ SLTP;
(...skipping 18 matching lines...) Expand all
1049 } 1049 }
1050 line1 = ((line1 << 1) | GBREG->getPixel(w + 2, h - 1)) & 0x1f; 1050 line1 = ((line1 << 1) | GBREG->getPixel(w + 2, h - 1)) & 0x1f;
1051 line2 = ((line2 << 1) | bVal) & 0x0f; 1051 line2 = ((line2 << 1) | bVal) & 0x0f;
1052 } 1052 }
1053 } 1053 }
1054 } 1054 }
1055 return GBREG; 1055 return GBREG;
1056 } 1056 }
1057 CJBig2_Image *CJBig2_GRDProc::decode_Arith_V2(CJBig2_ArithDecoder *pArithDecoder , JBig2ArithCtx *gbContext) 1057 CJBig2_Image *CJBig2_GRDProc::decode_Arith_V2(CJBig2_ArithDecoder *pArithDecoder , JBig2ArithCtx *gbContext)
1058 { 1058 {
1059 FX_BOOL LTP, SLTP, bVal; 1059 bool LTP, SLTP, bVal;
1060 FX_DWORD CONTEXT; 1060 FX_DWORD CONTEXT;
1061 CJBig2_Image *GBREG; 1061 CJBig2_Image *GBREG;
1062 FX_DWORD line1, line2, line3; 1062 FX_DWORD line1, line2, line3;
1063 LTP = 0; 1063 LTP = 0;
1064 JBIG2_ALLOC(GBREG, CJBig2_Image(GBW, GBH)); 1064 JBIG2_ALLOC(GBREG, CJBig2_Image(GBW, GBH));
1065 GBREG->fill(0); 1065 GBREG->fill(0);
1066 for(FX_DWORD h = 0; h < GBH; h++) { 1066 for(FX_DWORD h = 0; h < GBH; h++) {
1067 if(TPGDON) { 1067 if(TPGDON) {
1068 switch(GBTEMPLATE) { 1068 switch(GBTEMPLATE) {
1069 case 0: 1069 case 0:
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
1188 } 1188 }
1189 } 1189 }
1190 break; 1190 break;
1191 } 1191 }
1192 } 1192 }
1193 } 1193 }
1194 return GBREG; 1194 return GBREG;
1195 } 1195 }
1196 CJBig2_Image *CJBig2_GRDProc::decode_Arith_V1(CJBig2_ArithDecoder *pArithDecoder , JBig2ArithCtx *gbContext) 1196 CJBig2_Image *CJBig2_GRDProc::decode_Arith_V1(CJBig2_ArithDecoder *pArithDecoder , JBig2ArithCtx *gbContext)
1197 { 1197 {
1198 FX_BOOL LTP, SLTP, bVal; 1198 bool LTP, SLTP, bVal;
1199 FX_DWORD CONTEXT = 0; 1199 FX_DWORD CONTEXT = 0;
1200 CJBig2_Image *GBREG; 1200 CJBig2_Image *GBREG;
1201 LTP = 0; 1201 LTP = 0;
1202 JBIG2_ALLOC(GBREG, CJBig2_Image(GBW, GBH)); 1202 JBIG2_ALLOC(GBREG, CJBig2_Image(GBW, GBH));
1203 GBREG->fill(0); 1203 GBREG->fill(0);
1204 for(FX_DWORD h = 0; h < GBH; h++) { 1204 for(FX_DWORD h = 0; h < GBH; h++) {
1205 if(TPGDON) { 1205 if(TPGDON) {
1206 switch(GBTEMPLATE) { 1206 switch(GBTEMPLATE) {
1207 case 0: 1207 case 0:
1208 CONTEXT = 0x9b25; 1208 CONTEXT = 0x9b25;
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
1333 } else { 1333 } else {
1334 if((GRREFERENCEDX == 0) && (GRW == (FX_DWORD)GRREFERENCE->m_nWidth)) { 1334 if((GRREFERENCEDX == 0) && (GRW == (FX_DWORD)GRREFERENCE->m_nWidth)) {
1335 return decode_Template1_opt(pArithDecoder, grContext); 1335 return decode_Template1_opt(pArithDecoder, grContext);
1336 } else { 1336 } else {
1337 return decode_Template1_unopt(pArithDecoder, grContext); 1337 return decode_Template1_unopt(pArithDecoder, grContext);
1338 } 1338 }
1339 } 1339 }
1340 } 1340 }
1341 CJBig2_Image *CJBig2_GRRDProc::decode_Template0_unopt(CJBig2_ArithDecoder *pArit hDecoder, JBig2ArithCtx *grContext) 1341 CJBig2_Image *CJBig2_GRRDProc::decode_Template0_unopt(CJBig2_ArithDecoder *pArit hDecoder, JBig2ArithCtx *grContext)
1342 { 1342 {
1343 FX_BOOL LTP, SLTP, bVal; 1343 bool LTP, SLTP, bVal;
1344 FX_DWORD CONTEXT; 1344 FX_DWORD CONTEXT;
1345 CJBig2_Image *GRREG; 1345 CJBig2_Image *GRREG;
1346 FX_DWORD line1, line2, line3, line4, line5; 1346 FX_DWORD line1, line2, line3, line4, line5;
1347 LTP = 0; 1347 LTP = 0;
1348 JBIG2_ALLOC(GRREG, CJBig2_Image(GRW, GRH)); 1348 JBIG2_ALLOC(GRREG, CJBig2_Image(GRW, GRH));
1349 GRREG->fill(0); 1349 GRREG->fill(0);
1350 for(FX_DWORD h = 0; h < GRH; h++) { 1350 for(FX_DWORD h = 0; h < GRH; h++) {
1351 if(TPGRON) { 1351 if(TPGRON) {
1352 SLTP = pArithDecoder->DECODE(&grContext[0x0010]); 1352 SLTP = pArithDecoder->DECODE(&grContext[0x0010]);
1353 LTP = LTP ^ SLTP; 1353 LTP = LTP ^ SLTP;
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
1417 line3 = ((line3 << 1) | GRREFERENCE->getPixel(w - GRREFERENCEDX + 2, h - GRREFERENCEDY - 1)) & 0x03; 1417 line3 = ((line3 << 1) | GRREFERENCE->getPixel(w - GRREFERENCEDX + 2, h - GRREFERENCEDY - 1)) & 0x03;
1418 line4 = ((line4 << 1) | GRREFERENCE->getPixel(w - GRREFERENCEDX + 2, h - GRREFERENCEDY)) & 0x07; 1418 line4 = ((line4 << 1) | GRREFERENCE->getPixel(w - GRREFERENCEDX + 2, h - GRREFERENCEDY)) & 0x07;
1419 line5 = ((line5 << 1) | GRREFERENCE->getPixel(w - GRREFERENCEDX + 2, h - GRREFERENCEDY + 1)) & 0x07; 1419 line5 = ((line5 << 1) | GRREFERENCE->getPixel(w - GRREFERENCEDX + 2, h - GRREFERENCEDY + 1)) & 0x07;
1420 } 1420 }
1421 } 1421 }
1422 } 1422 }
1423 return GRREG; 1423 return GRREG;
1424 } 1424 }
1425 CJBig2_Image *CJBig2_GRRDProc::decode_Template0_opt(CJBig2_ArithDecoder *pArithD ecoder, JBig2ArithCtx *grContext) 1425 CJBig2_Image *CJBig2_GRRDProc::decode_Template0_opt(CJBig2_ArithDecoder *pArithD ecoder, JBig2ArithCtx *grContext)
1426 { 1426 {
1427 FX_BOOL LTP, SLTP, bVal; 1427 bool LTP, SLTP, bVal;
1428 FX_DWORD CONTEXT; 1428 FX_DWORD CONTEXT;
1429 CJBig2_Image *GRREG; 1429 CJBig2_Image *GRREG;
1430 FX_DWORD line1, line1_r, line2_r, line3_r; 1430 FX_DWORD line1, line1_r, line2_r, line3_r;
1431 uint8_t *pLine, *pLineR, cVal; 1431 uint8_t *pLine, *pLineR, cVal;
1432 intptr_t nStride, nStrideR, nOffset; 1432 intptr_t nStride, nStrideR, nOffset;
1433 int32_t k, nBits; 1433 int32_t k, nBits;
1434 int32_t GRWR, GRHR; 1434 int32_t GRWR, GRHR;
1435 int32_t GRW, GRH; 1435 int32_t GRW, GRH;
1436 GRW = (int32_t)CJBig2_GRRDProc::GRW; 1436 GRW = (int32_t)CJBig2_GRRDProc::GRW;
1437 GRH = (int32_t)CJBig2_GRRDProc::GRH; 1437 GRH = (int32_t)CJBig2_GRRDProc::GRH;
(...skipping 14 matching lines...) Expand all
1452 GRREFERENCEDY = 0; 1452 GRREFERENCEDY = 0;
1453 } 1453 }
1454 nOffset = -GRREFERENCEDY * nStrideR; 1454 nOffset = -GRREFERENCEDY * nStrideR;
1455 for (int32_t h = 0; h < GRH; h++) { 1455 for (int32_t h = 0; h < GRH; h++) {
1456 if(TPGRON) { 1456 if(TPGRON) {
1457 SLTP = pArithDecoder->DECODE(&grContext[0x0010]); 1457 SLTP = pArithDecoder->DECODE(&grContext[0x0010]);
1458 LTP = LTP ^ SLTP; 1458 LTP = LTP ^ SLTP;
1459 } 1459 }
1460 line1 = (h > 0) ? pLine[-nStride] << 4 : 0; 1460 line1 = (h > 0) ? pLine[-nStride] << 4 : 0;
1461 int32_t reference_h = h - GRREFERENCEDY; 1461 int32_t reference_h = h - GRREFERENCEDY;
1462 FX_BOOL line1_r_ok = (reference_h > 0 && reference_h < GRHR + 1); 1462 bool line1_r_ok = (reference_h > 0 && reference_h < GRHR + 1);
1463 FX_BOOL line2_r_ok = (reference_h > -1 && reference_h < GRHR); 1463 bool line2_r_ok = (reference_h > -1 && reference_h < GRHR);
1464 FX_BOOL line3_r_ok = (reference_h > -2 && reference_h < GRHR - 1); 1464 bool line3_r_ok = (reference_h > -2 && reference_h < GRHR - 1);
1465 line1_r = line1_r_ok ? pLineR[nOffset - nStrideR] : 0; 1465 line1_r = line1_r_ok ? pLineR[nOffset - nStrideR] : 0;
1466 line2_r = line2_r_ok ? pLineR[nOffset] : 0; 1466 line2_r = line2_r_ok ? pLineR[nOffset] : 0;
1467 line3_r = line3_r_ok ? pLineR[nOffset + nStrideR] : 0; 1467 line3_r = line3_r_ok ? pLineR[nOffset + nStrideR] : 0;
1468 if(LTP == 0) { 1468 if(LTP == 0) {
1469 CONTEXT = (line1 & 0x1c00) | (line1_r & 0x01c0) 1469 CONTEXT = (line1 & 0x1c00) | (line1_r & 0x01c0)
1470 | ((line2_r >> 3) & 0x0038) | ((line3_r >> 6) & 0x0007); 1470 | ((line2_r >> 3) & 0x0038) | ((line3_r >> 6) & 0x0007);
1471 for (int32_t w = 0; w < GRW; w += 8) { 1471 for (int32_t w = 0; w < GRW; w += 8) {
1472 nBits = GRW - w > 8 ? 8 : GRW - w; 1472 nBits = GRW - w > 8 ? 8 : GRW - w;
1473 if (h > 0) 1473 if (h > 0)
1474 line1 = (line1 << 8) | 1474 line1 = (line1 << 8) |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
1548 } 1548 }
1549 pLine += nStride; 1549 pLine += nStride;
1550 if (h < GRHR + GRREFERENCEDY) { 1550 if (h < GRHR + GRREFERENCEDY) {
1551 pLineR += nStrideR; 1551 pLineR += nStrideR;
1552 } 1552 }
1553 } 1553 }
1554 return GRREG; 1554 return GRREG;
1555 } 1555 }
1556 CJBig2_Image *CJBig2_GRRDProc::decode_Template1_unopt(CJBig2_ArithDecoder *pArit hDecoder, JBig2ArithCtx *grContext) 1556 CJBig2_Image *CJBig2_GRRDProc::decode_Template1_unopt(CJBig2_ArithDecoder *pArit hDecoder, JBig2ArithCtx *grContext)
1557 { 1557 {
1558 FX_BOOL LTP, SLTP, bVal; 1558 bool LTP, SLTP, bVal;
1559 FX_DWORD CONTEXT; 1559 FX_DWORD CONTEXT;
1560 CJBig2_Image *GRREG; 1560 CJBig2_Image *GRREG;
1561 FX_DWORD line1, line2, line3, line4, line5; 1561 FX_DWORD line1, line2, line3, line4, line5;
1562 LTP = 0; 1562 LTP = 0;
1563 JBIG2_ALLOC(GRREG, CJBig2_Image(GRW, GRH)); 1563 JBIG2_ALLOC(GRREG, CJBig2_Image(GRW, GRH));
1564 GRREG->fill(0); 1564 GRREG->fill(0);
1565 for(FX_DWORD h = 0; h < GRH; h++) { 1565 for(FX_DWORD h = 0; h < GRH; h++) {
1566 if(TPGRON) { 1566 if(TPGRON) {
1567 SLTP = pArithDecoder->DECODE(&grContext[0x0008]); 1567 SLTP = pArithDecoder->DECODE(&grContext[0x0008]);
1568 LTP = LTP ^ SLTP; 1568 LTP = LTP ^ SLTP;
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
1626 line3 = ((line3 << 1) | GRREFERENCE->getPixel(w - GRREFERENCEDX + 1, h - GRREFERENCEDY - 1)) & 0x01; 1626 line3 = ((line3 << 1) | GRREFERENCE->getPixel(w - GRREFERENCEDX + 1, h - GRREFERENCEDY - 1)) & 0x01;
1627 line4 = ((line4 << 1) | GRREFERENCE->getPixel(w - GRREFERENCEDX + 2, h - GRREFERENCEDY)) & 0x07; 1627 line4 = ((line4 << 1) | GRREFERENCE->getPixel(w - GRREFERENCEDX + 2, h - GRREFERENCEDY)) & 0x07;
1628 line5 = ((line5 << 1) | GRREFERENCE->getPixel(w - GRREFERENCEDX + 2, h - GRREFERENCEDY + 1)) & 0x03; 1628 line5 = ((line5 << 1) | GRREFERENCE->getPixel(w - GRREFERENCEDX + 2, h - GRREFERENCEDY + 1)) & 0x03;
1629 } 1629 }
1630 } 1630 }
1631 } 1631 }
1632 return GRREG; 1632 return GRREG;
1633 } 1633 }
1634 CJBig2_Image *CJBig2_GRRDProc::decode_Template1_opt(CJBig2_ArithDecoder *pArithD ecoder, JBig2ArithCtx *grContext) 1634 CJBig2_Image *CJBig2_GRRDProc::decode_Template1_opt(CJBig2_ArithDecoder *pArithD ecoder, JBig2ArithCtx *grContext)
1635 { 1635 {
1636 FX_BOOL LTP, SLTP, bVal; 1636 bool LTP, SLTP, bVal;
1637 FX_DWORD CONTEXT; 1637 FX_DWORD CONTEXT;
1638 CJBig2_Image *GRREG; 1638 CJBig2_Image *GRREG;
1639 FX_DWORD line1, line1_r, line2_r, line3_r; 1639 FX_DWORD line1, line1_r, line2_r, line3_r;
1640 uint8_t *pLine, *pLineR, cVal; 1640 uint8_t *pLine, *pLineR, cVal;
1641 intptr_t nStride, nStrideR, nOffset; 1641 intptr_t nStride, nStrideR, nOffset;
1642 int32_t k, nBits; 1642 int32_t k, nBits;
1643 int32_t GRWR, GRHR; 1643 int32_t GRWR, GRHR;
1644 int32_t GRW, GRH; 1644 int32_t GRW, GRH;
1645 GRW = (int32_t)CJBig2_GRRDProc::GRW; 1645 GRW = (int32_t)CJBig2_GRRDProc::GRW;
1646 GRH = (int32_t)CJBig2_GRRDProc::GRH; 1646 GRH = (int32_t)CJBig2_GRRDProc::GRH;
(...skipping 14 matching lines...) Expand all
1661 GRREFERENCEDY = 0; 1661 GRREFERENCEDY = 0;
1662 } 1662 }
1663 nOffset = -GRREFERENCEDY * nStrideR; 1663 nOffset = -GRREFERENCEDY * nStrideR;
1664 for (int32_t h = 0; h < GRH; h++) { 1664 for (int32_t h = 0; h < GRH; h++) {
1665 if(TPGRON) { 1665 if(TPGRON) {
1666 SLTP = pArithDecoder->DECODE(&grContext[0x0008]); 1666 SLTP = pArithDecoder->DECODE(&grContext[0x0008]);
1667 LTP = LTP ^ SLTP; 1667 LTP = LTP ^ SLTP;
1668 } 1668 }
1669 line1 = (h > 0) ? pLine[-nStride] << 1 : 0; 1669 line1 = (h > 0) ? pLine[-nStride] << 1 : 0;
1670 int32_t reference_h = h - GRREFERENCEDY; 1670 int32_t reference_h = h - GRREFERENCEDY;
1671 FX_BOOL line1_r_ok = (reference_h > 0 && reference_h < GRHR + 1); 1671 bool line1_r_ok = (reference_h > 0 && reference_h < GRHR + 1);
1672 FX_BOOL line2_r_ok = (reference_h > -1 && reference_h < GRHR); 1672 bool line2_r_ok = (reference_h > -1 && reference_h < GRHR);
1673 FX_BOOL line3_r_ok = (reference_h > -2 && reference_h < GRHR - 1); 1673 bool line3_r_ok = (reference_h > -2 && reference_h < GRHR - 1);
1674 line1_r = line1_r_ok ? pLineR[nOffset - nStrideR] : 0; 1674 line1_r = line1_r_ok ? pLineR[nOffset - nStrideR] : 0;
1675 line2_r = line2_r_ok ? pLineR[nOffset] : 0; 1675 line2_r = line2_r_ok ? pLineR[nOffset] : 0;
1676 line3_r = line3_r_ok ? pLineR[nOffset + nStrideR] : 0; 1676 line3_r = line3_r_ok ? pLineR[nOffset + nStrideR] : 0;
1677 if(LTP == 0) { 1677 if(LTP == 0) {
1678 CONTEXT = (line1 & 0x0380) | ((line1_r >> 2) & 0x0020) 1678 CONTEXT = (line1 & 0x0380) | ((line1_r >> 2) & 0x0020)
1679 | ((line2_r >> 4) & 0x001c) | ((line3_r >> 6) & 0x0003); 1679 | ((line2_r >> 4) & 0x001c) | ((line3_r >> 6) & 0x0003);
1680 for (int32_t w = 0; w < GRW; w += 8) { 1680 for (int32_t w = 0; w < GRW; w += 8) {
1681 nBits = GRW - w > 8 ? 8 : GRW - w; 1681 nBits = GRW - w > 8 ? 8 : GRW - w;
1682 if (h > 0) 1682 if (h > 0)
1683 line1 = (line1 << 8) | 1683 line1 = (line1 << 8) |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
1751 } 1751 }
1752 pLine += nStride; 1752 pLine += nStride;
1753 if (h < GRHR + GRREFERENCEDY) { 1753 if (h < GRHR + GRREFERENCEDY) {
1754 pLineR += nStrideR; 1754 pLineR += nStrideR;
1755 } 1755 }
1756 } 1756 }
1757 return GRREG; 1757 return GRREG;
1758 } 1758 }
1759 CJBig2_Image *CJBig2_GRRDProc::decode_V1(CJBig2_ArithDecoder *pArithDecoder, JBi g2ArithCtx *grContext) 1759 CJBig2_Image *CJBig2_GRRDProc::decode_V1(CJBig2_ArithDecoder *pArithDecoder, JBi g2ArithCtx *grContext)
1760 { 1760 {
1761 FX_BOOL LTP, SLTP, bVal; 1761 bool LTP, SLTP, bVal;
1762 FX_BOOL TPGRPIX, TPGRVAL; 1762 bool TPGRPIX, TPGRVAL;
1763 FX_DWORD CONTEXT; 1763 FX_DWORD CONTEXT;
1764 CJBig2_Image *GRREG; 1764 CJBig2_Image *GRREG;
1765 LTP = 0; 1765 LTP = 0;
1766 JBIG2_ALLOC(GRREG, CJBig2_Image(GRW, GRH)); 1766 JBIG2_ALLOC(GRREG, CJBig2_Image(GRW, GRH));
1767 GRREG->fill(0); 1767 GRREG->fill(0);
1768 for(FX_DWORD h = 0; h < GRH; h++) { 1768 for(FX_DWORD h = 0; h < GRH; h++) {
1769 if(TPGRON) { 1769 if(TPGRON) {
1770 switch(GRTEMPLATE) { 1770 switch(GRTEMPLATE) {
1771 case 0: 1771 case 0:
1772 CONTEXT = 0x0010; 1772 CONTEXT = 0x0010;
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
1874 { 1874 {
1875 int32_t STRIPT, FIRSTS; 1875 int32_t STRIPT, FIRSTS;
1876 FX_DWORD NINSTANCES; 1876 FX_DWORD NINSTANCES;
1877 int32_t DT, DFS, CURS; 1877 int32_t DT, DFS, CURS;
1878 uint8_t CURT; 1878 uint8_t CURT;
1879 int32_t SI, TI; 1879 int32_t SI, TI;
1880 FX_DWORD IDI; 1880 FX_DWORD IDI;
1881 CJBig2_Image *IBI; 1881 CJBig2_Image *IBI;
1882 FX_DWORD WI, HI; 1882 FX_DWORD WI, HI;
1883 int32_t IDS; 1883 int32_t IDS;
1884 FX_BOOL RI; 1884 bool RI;
1885 int32_t RDWI, RDHI, RDXI, RDYI; 1885 int32_t RDWI, RDHI, RDXI, RDYI;
1886 CJBig2_Image *IBOI; 1886 CJBig2_Image *IBOI;
1887 FX_DWORD WOI, HOI; 1887 FX_DWORD WOI, HOI;
1888 CJBig2_Image *SBREG; 1888 CJBig2_Image *SBREG;
1889 FX_BOOL bFirst; 1889 bool bFirst;
1890 FX_DWORD nTmp; 1890 FX_DWORD nTmp;
1891 int32_t nVal, nBits; 1891 int32_t nVal, nBits;
1892 CJBig2_HuffmanDecoder *pHuffmanDecoder; 1892 CJBig2_HuffmanDecoder *pHuffmanDecoder;
1893 CJBig2_GRRDProc *pGRRD; 1893 CJBig2_GRRDProc *pGRRD;
1894 CJBig2_ArithDecoder *pArithDecoder; 1894 CJBig2_ArithDecoder *pArithDecoder;
1895 JBIG2_ALLOC(pHuffmanDecoder, CJBig2_HuffmanDecoder(pStream)); 1895 JBIG2_ALLOC(pHuffmanDecoder, CJBig2_HuffmanDecoder(pStream));
1896 JBIG2_ALLOC(SBREG, CJBig2_Image(SBW, SBH)); 1896 JBIG2_ALLOC(SBREG, CJBig2_Image(SBW, SBH));
1897 SBREG->fill(SBDEFPIXEL); 1897 SBREG->fill(SBDEFPIXEL);
1898 if(pHuffmanDecoder->decodeAValue(SBHUFFDT, &STRIPT) != 0) { 1898 if(pHuffmanDecoder->decodeAValue(SBHUFFDT, &STRIPT) != 0) {
1899 m_pModule->JBig2_Error("text region decoding procedure (huffman): too sh ort."); 1899 m_pModule->JBig2_Error("text region decoding procedure (huffman): too sh ort.");
1900 goto failed; 1900 goto failed;
1901 } 1901 }
1902 STRIPT *= SBSTRIPS; 1902 STRIPT *= SBSTRIPS;
1903 STRIPT = -STRIPT; 1903 STRIPT = -STRIPT;
1904 FIRSTS = 0; 1904 FIRSTS = 0;
1905 NINSTANCES = 0; 1905 NINSTANCES = 0;
1906 while(NINSTANCES < SBNUMINSTANCES) { 1906 while(NINSTANCES < SBNUMINSTANCES) {
1907 if(pHuffmanDecoder->decodeAValue(SBHUFFDT, &DT) != 0) { 1907 if(pHuffmanDecoder->decodeAValue(SBHUFFDT, &DT) != 0) {
1908 m_pModule->JBig2_Error("text region decoding procedure (huffman): to o short."); 1908 m_pModule->JBig2_Error("text region decoding procedure (huffman): to o short.");
1909 goto failed; 1909 goto failed;
1910 } 1910 }
1911 DT *= SBSTRIPS; 1911 DT *= SBSTRIPS;
1912 STRIPT = STRIPT + DT; 1912 STRIPT = STRIPT + DT;
1913 bFirst = TRUE; 1913 bFirst = true;
1914 for(;;) { 1914 for(;;) {
1915 if(bFirst) { 1915 if(bFirst) {
1916 if(pHuffmanDecoder->decodeAValue(SBHUFFFS, &DFS) != 0) { 1916 if(pHuffmanDecoder->decodeAValue(SBHUFFFS, &DFS) != 0) {
1917 m_pModule->JBig2_Error("text region decoding procedure (huff man): too short."); 1917 m_pModule->JBig2_Error("text region decoding procedure (huff man): too short.");
1918 goto failed; 1918 goto failed;
1919 } 1919 }
1920 FIRSTS = FIRSTS + DFS; 1920 FIRSTS = FIRSTS + DFS;
1921 CURS = FIRSTS; 1921 CURS = FIRSTS;
1922 bFirst = FALSE; 1922 bFirst = false;
1923 } else { 1923 } else {
1924 nVal = pHuffmanDecoder->decodeAValue(SBHUFFDS, &IDS); 1924 nVal = pHuffmanDecoder->decodeAValue(SBHUFFDS, &IDS);
1925 if(nVal == JBIG2_OOB) { 1925 if(nVal == JBIG2_OOB) {
1926 break; 1926 break;
1927 } else if(nVal != 0) { 1927 } else if(nVal != 0) {
1928 m_pModule->JBig2_Error("text region decoding procedure (huff man): too short."); 1928 m_pModule->JBig2_Error("text region decoding procedure (huff man): too short.");
1929 goto failed; 1929 goto failed;
1930 } else { 1930 } else {
1931 CURS = CURS + IDS + SBDSOFFSET; 1931 CURS = CURS + IDS + SBDSOFFSET;
1932 } 1932 }
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
2094 { 2094 {
2095 int32_t STRIPT, FIRSTS; 2095 int32_t STRIPT, FIRSTS;
2096 FX_DWORD NINSTANCES; 2096 FX_DWORD NINSTANCES;
2097 int32_t DT, DFS, CURS; 2097 int32_t DT, DFS, CURS;
2098 int32_t CURT; 2098 int32_t CURT;
2099 int32_t SI, TI; 2099 int32_t SI, TI;
2100 FX_DWORD IDI; 2100 FX_DWORD IDI;
2101 CJBig2_Image *IBI; 2101 CJBig2_Image *IBI;
2102 FX_DWORD WI, HI; 2102 FX_DWORD WI, HI;
2103 int32_t IDS; 2103 int32_t IDS;
2104 FX_BOOL RI; 2104 int RI;
2105 int32_t RDWI, RDHI, RDXI, RDYI; 2105 int32_t RDWI, RDHI, RDXI, RDYI;
2106 CJBig2_Image *IBOI; 2106 CJBig2_Image *IBOI;
2107 FX_DWORD WOI, HOI; 2107 FX_DWORD WOI, HOI;
2108 CJBig2_Image *SBREG; 2108 CJBig2_Image *SBREG;
2109 FX_BOOL bFirst; 2109 bool bFirst;
2110 int32_t nRet, nVal; 2110 int32_t nRet, nVal;
2111 int32_t bRetained; 2111 int32_t bRetained;
2112 CJBig2_ArithIntDecoder *IADT, *IAFS, *IADS, *IAIT, *IARI, *IARDW, *IARDH, *I ARDX, *IARDY; 2112 CJBig2_ArithIntDecoder *IADT, *IAFS, *IADS, *IAIT, *IARI, *IARDW, *IARDH, *I ARDX, *IARDY;
2113 CJBig2_ArithIaidDecoder *IAID; 2113 CJBig2_ArithIaidDecoder *IAID;
2114 CJBig2_GRRDProc *pGRRD; 2114 CJBig2_GRRDProc *pGRRD;
2115 if(pIDS) { 2115 if(pIDS) {
2116 IADT = pIDS->IADT; 2116 IADT = pIDS->IADT;
2117 IAFS = pIDS->IAFS; 2117 IAFS = pIDS->IAFS;
2118 IADS = pIDS->IADS; 2118 IADS = pIDS->IADS;
2119 IAIT = pIDS->IAIT; 2119 IAIT = pIDS->IAIT;
2120 IARI = pIDS->IARI; 2120 IARI = pIDS->IARI;
2121 IARDW = pIDS->IARDW; 2121 IARDW = pIDS->IARDW;
2122 IARDH = pIDS->IARDH; 2122 IARDH = pIDS->IARDH;
2123 IARDX = pIDS->IARDX; 2123 IARDX = pIDS->IARDX;
2124 IARDY = pIDS->IARDY; 2124 IARDY = pIDS->IARDY;
2125 IAID = pIDS->IAID; 2125 IAID = pIDS->IAID;
2126 bRetained = TRUE; 2126 bRetained = true;
2127 } else { 2127 } else {
2128 JBIG2_ALLOC(IADT, CJBig2_ArithIntDecoder()); 2128 JBIG2_ALLOC(IADT, CJBig2_ArithIntDecoder());
2129 JBIG2_ALLOC(IAFS, CJBig2_ArithIntDecoder()); 2129 JBIG2_ALLOC(IAFS, CJBig2_ArithIntDecoder());
2130 JBIG2_ALLOC(IADS, CJBig2_ArithIntDecoder()); 2130 JBIG2_ALLOC(IADS, CJBig2_ArithIntDecoder());
2131 JBIG2_ALLOC(IAIT, CJBig2_ArithIntDecoder()); 2131 JBIG2_ALLOC(IAIT, CJBig2_ArithIntDecoder());
2132 JBIG2_ALLOC(IARI, CJBig2_ArithIntDecoder()); 2132 JBIG2_ALLOC(IARI, CJBig2_ArithIntDecoder());
2133 JBIG2_ALLOC(IARDW, CJBig2_ArithIntDecoder()); 2133 JBIG2_ALLOC(IARDW, CJBig2_ArithIntDecoder());
2134 JBIG2_ALLOC(IARDH, CJBig2_ArithIntDecoder()); 2134 JBIG2_ALLOC(IARDH, CJBig2_ArithIntDecoder());
2135 JBIG2_ALLOC(IARDX, CJBig2_ArithIntDecoder()); 2135 JBIG2_ALLOC(IARDX, CJBig2_ArithIntDecoder());
2136 JBIG2_ALLOC(IARDY, CJBig2_ArithIntDecoder()); 2136 JBIG2_ALLOC(IARDY, CJBig2_ArithIntDecoder());
2137 JBIG2_ALLOC(IAID , CJBig2_ArithIaidDecoder(SBSYMCODELEN)); 2137 JBIG2_ALLOC(IAID , CJBig2_ArithIaidDecoder(SBSYMCODELEN));
2138 bRetained = FALSE; 2138 bRetained = false;
2139 } 2139 }
2140 JBIG2_ALLOC(SBREG, CJBig2_Image(SBW, SBH)); 2140 JBIG2_ALLOC(SBREG, CJBig2_Image(SBW, SBH));
2141 SBREG->fill(SBDEFPIXEL); 2141 SBREG->fill(SBDEFPIXEL);
2142 if(IADT->decode(pArithDecoder, &STRIPT) == -1) { 2142 if(IADT->decode(pArithDecoder, &STRIPT) == -1) {
2143 m_pModule->JBig2_Error("text region decoding procedure (arith): too shor t."); 2143 m_pModule->JBig2_Error("text region decoding procedure (arith): too shor t.");
2144 goto failed; 2144 goto failed;
2145 } 2145 }
2146 STRIPT *= SBSTRIPS; 2146 STRIPT *= SBSTRIPS;
2147 STRIPT = -STRIPT; 2147 STRIPT = -STRIPT;
2148 FIRSTS = 0; 2148 FIRSTS = 0;
2149 NINSTANCES = 0; 2149 NINSTANCES = 0;
2150 while(NINSTANCES < SBNUMINSTANCES) { 2150 while(NINSTANCES < SBNUMINSTANCES) {
2151 if(IADT->decode(pArithDecoder, &DT) == -1) { 2151 if(IADT->decode(pArithDecoder, &DT) == -1) {
2152 m_pModule->JBig2_Error("text region decoding procedure (arith): too short."); 2152 m_pModule->JBig2_Error("text region decoding procedure (arith): too short.");
2153 goto failed; 2153 goto failed;
2154 } 2154 }
2155 DT *= SBSTRIPS; 2155 DT *= SBSTRIPS;
2156 STRIPT = STRIPT + DT; 2156 STRIPT = STRIPT + DT;
2157 bFirst = TRUE; 2157 bFirst = true;
2158 for(;;) { 2158 for(;;) {
2159 if(bFirst) { 2159 if(bFirst) {
2160 if(IAFS->decode(pArithDecoder, &DFS) == -1) { 2160 if(IAFS->decode(pArithDecoder, &DFS) == -1) {
2161 m_pModule->JBig2_Error("text region decoding procedure (arit h): too short."); 2161 m_pModule->JBig2_Error("text region decoding procedure (arit h): too short.");
2162 goto failed; 2162 goto failed;
2163 } 2163 }
2164 FIRSTS = FIRSTS + DFS; 2164 FIRSTS = FIRSTS + DFS;
2165 CURS = FIRSTS; 2165 CURS = FIRSTS;
2166 bFirst = FALSE; 2166 bFirst = false;
2167 } else { 2167 } else {
2168 nRet = IADS->decode(pArithDecoder, &IDS); 2168 nRet = IADS->decode(pArithDecoder, &IDS);
2169 if(nRet == JBIG2_OOB) { 2169 if(nRet == JBIG2_OOB) {
2170 break; 2170 break;
2171 } else if(nRet != 0) { 2171 } else if(nRet != 0) {
2172 m_pModule->JBig2_Error("text region decoding procedure (arit h): too short."); 2172 m_pModule->JBig2_Error("text region decoding procedure (arit h): too short.");
2173 goto failed; 2173 goto failed;
2174 } else { 2174 } else {
2175 CURS = CURS + IDS + SBDSOFFSET; 2175 CURS = CURS + IDS + SBDSOFFSET;
2176 } 2176 }
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
2292 if(TRANSPOSED == 0 && ((REFCORNER == JBIG2_CORNER_TOPLEFT) 2292 if(TRANSPOSED == 0 && ((REFCORNER == JBIG2_CORNER_TOPLEFT)
2293 || (REFCORNER == JBIG2_CORNER_BOTTOMLEFT))) { 2293 || (REFCORNER == JBIG2_CORNER_BOTTOMLEFT))) {
2294 CURS = CURS + WI - 1; 2294 CURS = CURS + WI - 1;
2295 } else if(TRANSPOSED == 1 && ((REFCORNER == JBIG2_CORNER_TOPLEFT) 2295 } else if(TRANSPOSED == 1 && ((REFCORNER == JBIG2_CORNER_TOPLEFT)
2296 || (REFCORNER == JBIG2_CORNER_TOPRIGHT ))) { 2296 || (REFCORNER == JBIG2_CORNER_TOPRIGHT ))) {
2297 CURS = CURS + HI - 1; 2297 CURS = CURS + HI - 1;
2298 } 2298 }
2299 NINSTANCES = NINSTANCES + 1; 2299 NINSTANCES = NINSTANCES + 1;
2300 } 2300 }
2301 } 2301 }
2302 if(bRetained == FALSE) { 2302 if(bRetained == false) {
2303 delete IADT; 2303 delete IADT;
2304 delete IAFS; 2304 delete IAFS;
2305 delete IADS; 2305 delete IADS;
2306 delete IAIT; 2306 delete IAIT;
2307 delete IARI; 2307 delete IARI;
2308 delete IARDW; 2308 delete IARDW;
2309 delete IARDH; 2309 delete IARDH;
2310 delete IARDX; 2310 delete IARDX;
2311 delete IARDY; 2311 delete IARDY;
2312 delete IAID; 2312 delete IAID;
2313 } 2313 }
2314 return SBREG; 2314 return SBREG;
2315 failed: 2315 failed:
2316 if(bRetained == FALSE) { 2316 if(bRetained == false) {
2317 delete IADT; 2317 delete IADT;
2318 delete IAFS; 2318 delete IAFS;
2319 delete IADS; 2319 delete IADS;
2320 delete IAIT; 2320 delete IAIT;
2321 delete IARI; 2321 delete IARI;
2322 delete IARDW; 2322 delete IARDW;
2323 delete IARDH; 2323 delete IARDH;
2324 delete IARDX; 2324 delete IARDX;
2325 delete IARDY; 2325 delete IARDY;
2326 delete IAID; 2326 delete IAID;
2327 } 2327 }
2328 delete SBREG; 2328 delete SBREG;
2329 return NULL; 2329 return NULL;
2330 } 2330 }
2331 CJBig2_SymbolDict *CJBig2_SDDProc::decode_Arith(CJBig2_ArithDecoder *pArithDecod er, 2331 CJBig2_SymbolDict *CJBig2_SDDProc::decode_Arith(CJBig2_ArithDecoder *pArithDecod er,
2332 JBig2ArithCtx *gbContext, JBig2ArithCtx *grContext) 2332 JBig2ArithCtx *gbContext, JBig2ArithCtx *grContext)
2333 { 2333 {
2334 CJBig2_Image **SDNEWSYMS; 2334 CJBig2_Image **SDNEWSYMS;
2335 FX_DWORD HCHEIGHT, NSYMSDECODED; 2335 FX_DWORD HCHEIGHT, NSYMSDECODED;
2336 int32_t HCDH; 2336 int32_t HCDH;
2337 FX_DWORD SYMWIDTH, TOTWIDTH; 2337 FX_DWORD SYMWIDTH, TOTWIDTH;
2338 int32_t DW; 2338 int32_t DW;
2339 CJBig2_Image *BS; 2339 CJBig2_Image *BS;
2340 FX_DWORD I, J, REFAGGNINST; 2340 FX_DWORD I, J, REFAGGNINST;
2341 FX_BOOL *EXFLAGS; 2341 bool *EXFLAGS;
2342 FX_DWORD EXINDEX; 2342 FX_DWORD EXINDEX;
2343 FX_BOOL CUREXFLAG; 2343 bool CUREXFLAG;
2344 FX_DWORD EXRUNLENGTH; 2344 FX_DWORD EXRUNLENGTH;
2345 int32_t nVal; 2345 int32_t nVal;
2346 FX_DWORD nTmp; 2346 FX_DWORD nTmp;
2347 FX_DWORD SBNUMSYMS; 2347 FX_DWORD SBNUMSYMS;
2348 uint8_t SBSYMCODELEN; 2348 uint8_t SBSYMCODELEN;
2349 FX_DWORD IDI; 2349 FX_DWORD IDI;
2350 int32_t RDXI, RDYI; 2350 int32_t RDXI, RDYI;
2351 CJBig2_Image **SBSYMS; 2351 CJBig2_Image **SBSYMS;
2352 CJBig2_HuffmanTable *SBHUFFFS, *SBHUFFDS, *SBHUFFDT, *SBHUFFRDW, *SBHUFFRDH, *SBHUFFRDX, *SBHUFFRDY, 2352 CJBig2_HuffmanTable *SBHUFFFS, *SBHUFFDS, *SBHUFFDT, *SBHUFFRDW, *SBHUFFRDH, *SBHUFFRDX, *SBHUFFRDY,
2353 *SBHUFFRSIZE; 2353 *SBHUFFRSIZE;
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
2578 delete pGRRD; 2578 delete pGRRD;
2579 } 2579 }
2580 } 2580 }
2581 SDNEWSYMS[NSYMSDECODED] = BS; 2581 SDNEWSYMS[NSYMSDECODED] = BS;
2582 BS = NULL; 2582 BS = NULL;
2583 NSYMSDECODED = NSYMSDECODED + 1; 2583 NSYMSDECODED = NSYMSDECODED + 1;
2584 } 2584 }
2585 } 2585 }
2586 EXINDEX = 0; 2586 EXINDEX = 0;
2587 CUREXFLAG = 0; 2587 CUREXFLAG = 0;
2588 EXFLAGS = (FX_BOOL*)m_pModule->JBig2_Malloc2(sizeof(FX_BOOL), (SDNUMINSYMS + SDNUMNEWSYMS)); 2588 EXFLAGS = (bool*)m_pModule->JBig2_Malloc2(sizeof(bool), (SDNUMINSYMS + SDNUM NEWSYMS));
2589 while(EXINDEX < SDNUMINSYMS + SDNUMNEWSYMS) { 2589 while(EXINDEX < SDNUMINSYMS + SDNUMNEWSYMS) {
2590 if(IAEX->decode(pArithDecoder, (int*)&EXRUNLENGTH) == -1) { 2590 if(IAEX->decode(pArithDecoder, (int*)&EXRUNLENGTH) == -1) {
2591 m_pModule->JBig2_Free(EXFLAGS); 2591 m_pModule->JBig2_Free(EXFLAGS);
2592 m_pModule->JBig2_Error("symbol dictionary decoding procedure (arith) : too short."); 2592 m_pModule->JBig2_Error("symbol dictionary decoding procedure (arith) : too short.");
2593 goto failed; 2593 goto failed;
2594 } 2594 }
2595 if (EXINDEX + EXRUNLENGTH > SDNUMINSYMS + SDNUMNEWSYMS) { 2595 if (EXINDEX + EXRUNLENGTH > SDNUMINSYMS + SDNUMNEWSYMS) {
2596 m_pModule->JBig2_Free(EXFLAGS); 2596 m_pModule->JBig2_Free(EXFLAGS);
2597 m_pModule->JBig2_Error("symbol dictionary decoding procedure (arith) : Invalid EXRUNLENGTH value."); 2597 m_pModule->JBig2_Error("symbol dictionary decoding procedure (arith) : Invalid EXRUNLENGTH value.");
2598 goto failed; 2598 goto failed;
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
2669 JBig2ArithCtx *gbContext, JBig2ArithCtx *grContext, IFX_Pause* pPause) 2669 JBig2ArithCtx *gbContext, JBig2ArithCtx *grContext, IFX_Pause* pPause)
2670 { 2670 {
2671 CJBig2_Image **SDNEWSYMS; 2671 CJBig2_Image **SDNEWSYMS;
2672 FX_DWORD *SDNEWSYMWIDTHS; 2672 FX_DWORD *SDNEWSYMWIDTHS;
2673 FX_DWORD HCHEIGHT, NSYMSDECODED; 2673 FX_DWORD HCHEIGHT, NSYMSDECODED;
2674 int32_t HCDH; 2674 int32_t HCDH;
2675 FX_DWORD SYMWIDTH, TOTWIDTH, HCFIRSTSYM; 2675 FX_DWORD SYMWIDTH, TOTWIDTH, HCFIRSTSYM;
2676 int32_t DW; 2676 int32_t DW;
2677 CJBig2_Image *BS, *BHC; 2677 CJBig2_Image *BS, *BHC;
2678 FX_DWORD I, J, REFAGGNINST; 2678 FX_DWORD I, J, REFAGGNINST;
2679 FX_BOOL *EXFLAGS; 2679 bool *EXFLAGS;
2680 FX_DWORD EXINDEX; 2680 FX_DWORD EXINDEX;
2681 FX_BOOL CUREXFLAG; 2681 bool CUREXFLAG;
2682 FX_DWORD EXRUNLENGTH; 2682 FX_DWORD EXRUNLENGTH;
2683 int32_t nVal, nBits; 2683 int32_t nVal, nBits;
2684 FX_DWORD nTmp; 2684 FX_DWORD nTmp;
2685 FX_DWORD SBNUMSYMS; 2685 FX_DWORD SBNUMSYMS;
2686 uint8_t SBSYMCODELEN; 2686 uint8_t SBSYMCODELEN;
2687 JBig2HuffmanCode *SBSYMCODES; 2687 JBig2HuffmanCode *SBSYMCODES;
2688 FX_DWORD IDI; 2688 FX_DWORD IDI;
2689 int32_t RDXI, RDYI; 2689 int32_t RDXI, RDYI;
2690 FX_DWORD BMSIZE; 2690 FX_DWORD BMSIZE;
2691 FX_DWORD stride; 2691 FX_DWORD stride;
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after
2969 nTmp += SDNEWSYMWIDTHS[I]; 2969 nTmp += SDNEWSYMWIDTHS[I];
2970 } 2970 }
2971 delete BHC; 2971 delete BHC;
2972 BHC = NULL; 2972 BHC = NULL;
2973 } 2973 }
2974 } 2974 }
2975 EXINDEX = 0; 2975 EXINDEX = 0;
2976 CUREXFLAG = 0; 2976 CUREXFLAG = 0;
2977 JBIG2_ALLOC(pTable, CJBig2_HuffmanTable(HuffmanTable_B1, 2977 JBIG2_ALLOC(pTable, CJBig2_HuffmanTable(HuffmanTable_B1,
2978 sizeof(HuffmanTable_B1) / sizeof(JBi g2TableLine), HuffmanTable_HTOOB_B1)); 2978 sizeof(HuffmanTable_B1) / sizeof(JBi g2TableLine), HuffmanTable_HTOOB_B1));
2979 EXFLAGS = (FX_BOOL*)m_pModule->JBig2_Malloc2(sizeof(FX_BOOL), (SDNUMINSYMS + SDNUMNEWSYMS)); 2979 EXFLAGS = (bool*)m_pModule->JBig2_Malloc2(sizeof(bool), (SDNUMINSYMS + SDNUM NEWSYMS));
2980 while(EXINDEX < SDNUMINSYMS + SDNUMNEWSYMS) { 2980 while(EXINDEX < SDNUMINSYMS + SDNUMNEWSYMS) {
2981 if(pHuffmanDecoder->decodeAValue(pTable, (int*)&EXRUNLENGTH) != 0) { 2981 if(pHuffmanDecoder->decodeAValue(pTable, (int*)&EXRUNLENGTH) != 0) {
2982 delete pTable; 2982 delete pTable;
2983 m_pModule->JBig2_Free(EXFLAGS); 2983 m_pModule->JBig2_Free(EXFLAGS);
2984 m_pModule->JBig2_Error("symbol dictionary decoding procedure (huffma n): too short."); 2984 m_pModule->JBig2_Error("symbol dictionary decoding procedure (huffma n): too short.");
2985 goto failed; 2985 goto failed;
2986 } 2986 }
2987 if (EXINDEX + EXRUNLENGTH > SDNUMINSYMS + SDNUMNEWSYMS) { 2987 if (EXINDEX + EXRUNLENGTH > SDNUMINSYMS + SDNUMNEWSYMS) {
2988 delete pTable; 2988 delete pTable;
2989 m_pModule->JBig2_Free(EXFLAGS); 2989 m_pModule->JBig2_Free(EXFLAGS);
(...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after
3470 m_pImage = pImage; 3470 m_pImage = pImage;
3471 (*m_pImage)->fill(0); 3471 (*m_pImage)->fill(0);
3472 LTP = 0; 3472 LTP = 0;
3473 m_loopIndex = 0; 3473 m_loopIndex = 0;
3474 m_pArithDecoder = pArithDecoder; 3474 m_pArithDecoder = pArithDecoder;
3475 m_gbContext = gbContext; 3475 m_gbContext = gbContext;
3476 return decode_Arith_V2(pPause); 3476 return decode_Arith_V2(pPause);
3477 } 3477 }
3478 FXCODEC_STATUS CJBig2_GRDProc::decode_Arith_V2(IFX_Pause* pPause) 3478 FXCODEC_STATUS CJBig2_GRDProc::decode_Arith_V2(IFX_Pause* pPause)
3479 { 3479 {
3480 FX_BOOL SLTP, bVal; 3480 bool SLTP, bVal;
3481 FX_DWORD CONTEXT; 3481 FX_DWORD CONTEXT;
3482 CJBig2_Image *GBREG = *m_pImage; 3482 CJBig2_Image *GBREG = *m_pImage;
3483 FX_DWORD line1, line2, line3; 3483 FX_DWORD line1, line2, line3;
3484 LTP = 0; 3484 LTP = 0;
3485 JBIG2_ALLOC(GBREG, CJBig2_Image(GBW, GBH)); 3485 JBIG2_ALLOC(GBREG, CJBig2_Image(GBW, GBH));
3486 GBREG->fill(0); 3486 GBREG->fill(0);
3487 for(; m_loopIndex < GBH; m_loopIndex++) { 3487 for(; m_loopIndex < GBH; m_loopIndex++) {
3488 if(TPGDON) { 3488 if(TPGDON) {
3489 switch(GBTEMPLATE) { 3489 switch(GBTEMPLATE) {
3490 case 0: 3490 case 0:
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
3643 m_DecodeType = 3; 3643 m_DecodeType = 3;
3644 (*m_pImage)->fill(0); 3644 (*m_pImage)->fill(0);
3645 LTP = 0; 3645 LTP = 0;
3646 m_loopIndex = 0; 3646 m_loopIndex = 0;
3647 m_pArithDecoder = pArithDecoder; 3647 m_pArithDecoder = pArithDecoder;
3648 m_gbContext = gbContext; 3648 m_gbContext = gbContext;
3649 return decode_Arith_V1(pPause); 3649 return decode_Arith_V1(pPause);
3650 } 3650 }
3651 FXCODEC_STATUS CJBig2_GRDProc::decode_Arith_V1(IFX_Pause* pPause) 3651 FXCODEC_STATUS CJBig2_GRDProc::decode_Arith_V1(IFX_Pause* pPause)
3652 { 3652 {
3653 FX_BOOL SLTP, bVal; 3653 bool SLTP, bVal;
3654 FX_DWORD CONTEXT = 0; 3654 FX_DWORD CONTEXT = 0;
3655 CJBig2_Image *GBREG = (*m_pImage); 3655 CJBig2_Image *GBREG = (*m_pImage);
3656 for(; m_loopIndex < GBH; m_loopIndex++) { 3656 for(; m_loopIndex < GBH; m_loopIndex++) {
3657 if(TPGDON) { 3657 if(TPGDON) {
3658 switch(GBTEMPLATE) { 3658 switch(GBTEMPLATE) {
3659 case 0: 3659 case 0:
3660 CONTEXT = 0x9b25; 3660 CONTEXT = 0x9b25;
3661 break; 3661 break;
3662 case 1: 3662 case 1:
3663 CONTEXT = 0x0795; 3663 CONTEXT = 0x0795;
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
3792 case 3: 3792 case 3:
3793 return decode_Arith_V1(pPause); 3793 return decode_Arith_V1(pPause);
3794 case 4: 3794 case 4:
3795 return decode_MMR(); 3795 return decode_MMR();
3796 } 3796 }
3797 m_ProssiveStatus = FXCODEC_STATUS_ERROR; 3797 m_ProssiveStatus = FXCODEC_STATUS_ERROR;
3798 return m_ProssiveStatus; 3798 return m_ProssiveStatus;
3799 } 3799 }
3800 FXCODEC_STATUS CJBig2_GRDProc::decode_Arith_Template0_opt3(CJBig2_Image *pImage, CJBig2_ArithDecoder *pArithDecoder, JBig2ArithCtx *gbContext, IFX_Pause* pPause ) 3800 FXCODEC_STATUS CJBig2_GRDProc::decode_Arith_Template0_opt3(CJBig2_Image *pImage, CJBig2_ArithDecoder *pArithDecoder, JBig2ArithCtx *gbContext, IFX_Pause* pPause )
3801 { 3801 {
3802 FX_BOOL SLTP, bVal; 3802 bool SLTP, bVal;
3803 FX_DWORD CONTEXT; 3803 FX_DWORD CONTEXT;
3804 FX_DWORD line1, line2; 3804 FX_DWORD line1, line2;
3805 uint8_t *pLine1, *pLine2, cVal; 3805 uint8_t *pLine1, *pLine2, cVal;
3806 int32_t nStride, nStride2, k; 3806 int32_t nStride, nStride2, k;
3807 int32_t nLineBytes, nBitsLeft, cc; 3807 int32_t nLineBytes, nBitsLeft, cc;
3808 if(m_pLine == NULL) { 3808 if(m_pLine == NULL) {
3809 m_pLine = pImage->m_pData; 3809 m_pLine = pImage->m_pData;
3810 } 3810 }
3811 nStride = pImage->m_nStride; 3811 nStride = pImage->m_nStride;
3812 nStride2 = nStride << 1; 3812 nStride2 = nStride << 1;
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
3884 m_loopIndex++; 3884 m_loopIndex++;
3885 m_ProssiveStatus = FXCODEC_STATUS_DECODE_TOBECONTINUE; 3885 m_ProssiveStatus = FXCODEC_STATUS_DECODE_TOBECONTINUE;
3886 return FXCODEC_STATUS_DECODE_TOBECONTINUE; 3886 return FXCODEC_STATUS_DECODE_TOBECONTINUE;
3887 } 3887 }
3888 } 3888 }
3889 m_ProssiveStatus = FXCODEC_STATUS_DECODE_FINISH; 3889 m_ProssiveStatus = FXCODEC_STATUS_DECODE_FINISH;
3890 return FXCODEC_STATUS_DECODE_FINISH; 3890 return FXCODEC_STATUS_DECODE_FINISH;
3891 } 3891 }
3892 FXCODEC_STATUS CJBig2_GRDProc::decode_Arith_Template0_unopt(CJBig2_Image * pImag e, CJBig2_ArithDecoder *pArithDecoder, JBig2ArithCtx *gbContext, IFX_Pause* pPau se) 3892 FXCODEC_STATUS CJBig2_GRDProc::decode_Arith_Template0_unopt(CJBig2_Image * pImag e, CJBig2_ArithDecoder *pArithDecoder, JBig2ArithCtx *gbContext, IFX_Pause* pPau se)
3893 { 3893 {
3894 FX_BOOL SLTP, bVal; 3894 bool SLTP, bVal;
3895 FX_DWORD CONTEXT; 3895 FX_DWORD CONTEXT;
3896 FX_DWORD line1, line2, line3; 3896 FX_DWORD line1, line2, line3;
3897 for(; m_loopIndex < GBH; m_loopIndex++) { 3897 for(; m_loopIndex < GBH; m_loopIndex++) {
3898 if(TPGDON) { 3898 if(TPGDON) {
3899 SLTP = pArithDecoder->DECODE(&gbContext[0x9b25]); 3899 SLTP = pArithDecoder->DECODE(&gbContext[0x9b25]);
3900 LTP = LTP ^ SLTP; 3900 LTP = LTP ^ SLTP;
3901 } 3901 }
3902 if(LTP == 1) { 3902 if(LTP == 1) {
3903 pImage->copyLine(m_loopIndex, m_loopIndex - 1); 3903 pImage->copyLine(m_loopIndex, m_loopIndex - 1);
3904 } else { 3904 } else {
(...skipping 28 matching lines...) Expand all
3933 m_loopIndex++; 3933 m_loopIndex++;
3934 m_ProssiveStatus = FXCODEC_STATUS_DECODE_TOBECONTINUE; 3934 m_ProssiveStatus = FXCODEC_STATUS_DECODE_TOBECONTINUE;
3935 return FXCODEC_STATUS_DECODE_TOBECONTINUE; 3935 return FXCODEC_STATUS_DECODE_TOBECONTINUE;
3936 } 3936 }
3937 } 3937 }
3938 m_ProssiveStatus = FXCODEC_STATUS_DECODE_FINISH; 3938 m_ProssiveStatus = FXCODEC_STATUS_DECODE_FINISH;
3939 return FXCODEC_STATUS_DECODE_FINISH; 3939 return FXCODEC_STATUS_DECODE_FINISH;
3940 } 3940 }
3941 FXCODEC_STATUS CJBig2_GRDProc::decode_Arith_Template1_opt3(CJBig2_Image *pImage, CJBig2_ArithDecoder *pArithDecoder, JBig2ArithCtx *gbContext, IFX_Pause* pPause ) 3941 FXCODEC_STATUS CJBig2_GRDProc::decode_Arith_Template1_opt3(CJBig2_Image *pImage, CJBig2_ArithDecoder *pArithDecoder, JBig2ArithCtx *gbContext, IFX_Pause* pPause )
3942 { 3942 {
3943 FX_BOOL SLTP, bVal; 3943 bool SLTP, bVal;
3944 FX_DWORD CONTEXT; 3944 FX_DWORD CONTEXT;
3945 FX_DWORD line1, line2; 3945 FX_DWORD line1, line2;
3946 uint8_t *pLine1, *pLine2, cVal; 3946 uint8_t *pLine1, *pLine2, cVal;
3947 int32_t nStride, nStride2, k; 3947 int32_t nStride, nStride2, k;
3948 int32_t nLineBytes, nBitsLeft, cc; 3948 int32_t nLineBytes, nBitsLeft, cc;
3949 if (!m_pLine) { 3949 if (!m_pLine) {
3950 m_pLine = pImage->m_pData; 3950 m_pLine = pImage->m_pData;
3951 } 3951 }
3952 nStride = pImage->m_nStride; 3952 nStride = pImage->m_nStride;
3953 nStride2 = nStride << 1; 3953 nStride2 = nStride << 1;
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
4024 m_loopIndex++; 4024 m_loopIndex++;
4025 m_ProssiveStatus = FXCODEC_STATUS_DECODE_TOBECONTINUE; 4025 m_ProssiveStatus = FXCODEC_STATUS_DECODE_TOBECONTINUE;
4026 return FXCODEC_STATUS_DECODE_TOBECONTINUE; 4026 return FXCODEC_STATUS_DECODE_TOBECONTINUE;
4027 } 4027 }
4028 } 4028 }
4029 m_ProssiveStatus = FXCODEC_STATUS_DECODE_FINISH; 4029 m_ProssiveStatus = FXCODEC_STATUS_DECODE_FINISH;
4030 return FXCODEC_STATUS_DECODE_FINISH; 4030 return FXCODEC_STATUS_DECODE_FINISH;
4031 } 4031 }
4032 FXCODEC_STATUS CJBig2_GRDProc::decode_Arith_Template1_unopt(CJBig2_Image * pImag e, CJBig2_ArithDecoder *pArithDecoder, JBig2ArithCtx *gbContext, IFX_Pause* pPau se) 4032 FXCODEC_STATUS CJBig2_GRDProc::decode_Arith_Template1_unopt(CJBig2_Image * pImag e, CJBig2_ArithDecoder *pArithDecoder, JBig2ArithCtx *gbContext, IFX_Pause* pPau se)
4033 { 4033 {
4034 FX_BOOL SLTP, bVal; 4034 bool SLTP, bVal;
4035 FX_DWORD CONTEXT; 4035 FX_DWORD CONTEXT;
4036 FX_DWORD line1, line2, line3; 4036 FX_DWORD line1, line2, line3;
4037 for(FX_DWORD h = 0; h < GBH; h++) { 4037 for(FX_DWORD h = 0; h < GBH; h++) {
4038 if(TPGDON) { 4038 if(TPGDON) {
4039 SLTP = pArithDecoder->DECODE(&gbContext[0x0795]); 4039 SLTP = pArithDecoder->DECODE(&gbContext[0x0795]);
4040 LTP = LTP ^ SLTP; 4040 LTP = LTP ^ SLTP;
4041 } 4041 }
4042 if(LTP == 1) { 4042 if(LTP == 1) {
4043 pImage->copyLine(h, h - 1); 4043 pImage->copyLine(h, h - 1);
4044 } else { 4044 } else {
(...skipping 26 matching lines...) Expand all
4071 m_loopIndex++; 4071 m_loopIndex++;
4072 m_ProssiveStatus = FXCODEC_STATUS_DECODE_TOBECONTINUE; 4072 m_ProssiveStatus = FXCODEC_STATUS_DECODE_TOBECONTINUE;
4073 return FXCODEC_STATUS_DECODE_TOBECONTINUE; 4073 return FXCODEC_STATUS_DECODE_TOBECONTINUE;
4074 } 4074 }
4075 } 4075 }
4076 m_ProssiveStatus = FXCODEC_STATUS_DECODE_FINISH; 4076 m_ProssiveStatus = FXCODEC_STATUS_DECODE_FINISH;
4077 return FXCODEC_STATUS_DECODE_FINISH; 4077 return FXCODEC_STATUS_DECODE_FINISH;
4078 } 4078 }
4079 FXCODEC_STATUS CJBig2_GRDProc::decode_Arith_Template2_opt3(CJBig2_Image *pImage, CJBig2_ArithDecoder *pArithDecoder, JBig2ArithCtx *gbContext, IFX_Pause* pPause ) 4079 FXCODEC_STATUS CJBig2_GRDProc::decode_Arith_Template2_opt3(CJBig2_Image *pImage, CJBig2_ArithDecoder *pArithDecoder, JBig2ArithCtx *gbContext, IFX_Pause* pPause )
4080 { 4080 {
4081 FX_BOOL SLTP, bVal; 4081 bool SLTP, bVal;
4082 FX_DWORD CONTEXT; 4082 FX_DWORD CONTEXT;
4083 FX_DWORD line1, line2; 4083 FX_DWORD line1, line2;
4084 uint8_t *pLine1, *pLine2, cVal; 4084 uint8_t *pLine1, *pLine2, cVal;
4085 int32_t nStride, nStride2, k; 4085 int32_t nStride, nStride2, k;
4086 int32_t nLineBytes, nBitsLeft, cc; 4086 int32_t nLineBytes, nBitsLeft, cc;
4087 if(!m_pLine) { 4087 if(!m_pLine) {
4088 m_pLine = pImage->m_pData; 4088 m_pLine = pImage->m_pData;
4089 } 4089 }
4090 nStride = pImage->m_nStride; 4090 nStride = pImage->m_nStride;
4091 nStride2 = nStride << 1; 4091 nStride2 = nStride << 1;
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
4162 m_loopIndex++; 4162 m_loopIndex++;
4163 m_ProssiveStatus = FXCODEC_STATUS_DECODE_TOBECONTINUE; 4163 m_ProssiveStatus = FXCODEC_STATUS_DECODE_TOBECONTINUE;
4164 return FXCODEC_STATUS_DECODE_TOBECONTINUE; 4164 return FXCODEC_STATUS_DECODE_TOBECONTINUE;
4165 } 4165 }
4166 } 4166 }
4167 m_ProssiveStatus = FXCODEC_STATUS_DECODE_FINISH; 4167 m_ProssiveStatus = FXCODEC_STATUS_DECODE_FINISH;
4168 return FXCODEC_STATUS_DECODE_FINISH; 4168 return FXCODEC_STATUS_DECODE_FINISH;
4169 } 4169 }
4170 FXCODEC_STATUS CJBig2_GRDProc::decode_Arith_Template2_unopt(CJBig2_Image * pImag e, CJBig2_ArithDecoder *pArithDecoder, JBig2ArithCtx *gbContext, IFX_Pause* pPau se) 4170 FXCODEC_STATUS CJBig2_GRDProc::decode_Arith_Template2_unopt(CJBig2_Image * pImag e, CJBig2_ArithDecoder *pArithDecoder, JBig2ArithCtx *gbContext, IFX_Pause* pPau se)
4171 { 4171 {
4172 FX_BOOL SLTP, bVal; 4172 bool SLTP, bVal;
4173 FX_DWORD CONTEXT; 4173 FX_DWORD CONTEXT;
4174 FX_DWORD line1, line2, line3; 4174 FX_DWORD line1, line2, line3;
4175 for(; m_loopIndex < GBH; m_loopIndex++) { 4175 for(; m_loopIndex < GBH; m_loopIndex++) {
4176 if(TPGDON) { 4176 if(TPGDON) {
4177 SLTP = pArithDecoder->DECODE(&gbContext[0x00e5]); 4177 SLTP = pArithDecoder->DECODE(&gbContext[0x00e5]);
4178 LTP = LTP ^ SLTP; 4178 LTP = LTP ^ SLTP;
4179 } 4179 }
4180 if(LTP == 1) { 4180 if(LTP == 1) {
4181 pImage->copyLine(m_loopIndex, m_loopIndex - 1); 4181 pImage->copyLine(m_loopIndex, m_loopIndex - 1);
4182 } else { 4182 } else {
(...skipping 24 matching lines...) Expand all
4207 m_loopIndex++; 4207 m_loopIndex++;
4208 m_ProssiveStatus = FXCODEC_STATUS_DECODE_TOBECONTINUE; 4208 m_ProssiveStatus = FXCODEC_STATUS_DECODE_TOBECONTINUE;
4209 return FXCODEC_STATUS_DECODE_TOBECONTINUE; 4209 return FXCODEC_STATUS_DECODE_TOBECONTINUE;
4210 } 4210 }
4211 } 4211 }
4212 m_ProssiveStatus = FXCODEC_STATUS_DECODE_FINISH; 4212 m_ProssiveStatus = FXCODEC_STATUS_DECODE_FINISH;
4213 return FXCODEC_STATUS_DECODE_FINISH; 4213 return FXCODEC_STATUS_DECODE_FINISH;
4214 } 4214 }
4215 FXCODEC_STATUS CJBig2_GRDProc::decode_Arith_Template3_opt3(CJBig2_Image *pImage, CJBig2_ArithDecoder *pArithDecoder, JBig2ArithCtx *gbContext, IFX_Pause* pPause ) 4215 FXCODEC_STATUS CJBig2_GRDProc::decode_Arith_Template3_opt3(CJBig2_Image *pImage, CJBig2_ArithDecoder *pArithDecoder, JBig2ArithCtx *gbContext, IFX_Pause* pPause )
4216 { 4216 {
4217 FX_BOOL SLTP, bVal; 4217 bool SLTP, bVal;
4218 FX_DWORD CONTEXT; 4218 FX_DWORD CONTEXT;
4219 FX_DWORD line1; 4219 FX_DWORD line1;
4220 uint8_t *pLine1, cVal; 4220 uint8_t *pLine1, cVal;
4221 int32_t nStride, k; 4221 int32_t nStride, k;
4222 int32_t nLineBytes, nBitsLeft, cc; 4222 int32_t nLineBytes, nBitsLeft, cc;
4223 if (!m_pLine) { 4223 if (!m_pLine) {
4224 m_pLine = pImage->m_pData; 4224 m_pLine = pImage->m_pData;
4225 } 4225 }
4226 nStride = pImage->m_nStride; 4226 nStride = pImage->m_nStride;
4227 nLineBytes = ((GBW + 7) >> 3) - 1; 4227 nLineBytes = ((GBW + 7) >> 3) - 1;
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
4283 m_loopIndex++; 4283 m_loopIndex++;
4284 m_ProssiveStatus = FXCODEC_STATUS_DECODE_TOBECONTINUE; 4284 m_ProssiveStatus = FXCODEC_STATUS_DECODE_TOBECONTINUE;
4285 return FXCODEC_STATUS_DECODE_TOBECONTINUE; 4285 return FXCODEC_STATUS_DECODE_TOBECONTINUE;
4286 } 4286 }
4287 } 4287 }
4288 m_ProssiveStatus = FXCODEC_STATUS_DECODE_FINISH; 4288 m_ProssiveStatus = FXCODEC_STATUS_DECODE_FINISH;
4289 return FXCODEC_STATUS_DECODE_FINISH; 4289 return FXCODEC_STATUS_DECODE_FINISH;
4290 } 4290 }
4291 FXCODEC_STATUS CJBig2_GRDProc::decode_Arith_Template3_unopt(CJBig2_Image * pImag e, CJBig2_ArithDecoder *pArithDecoder, JBig2ArithCtx *gbContext, IFX_Pause* pPau se) 4291 FXCODEC_STATUS CJBig2_GRDProc::decode_Arith_Template3_unopt(CJBig2_Image * pImag e, CJBig2_ArithDecoder *pArithDecoder, JBig2ArithCtx *gbContext, IFX_Pause* pPau se)
4292 { 4292 {
4293 FX_BOOL SLTP, bVal; 4293 bool SLTP, bVal;
4294 FX_DWORD CONTEXT; 4294 FX_DWORD CONTEXT;
4295 FX_DWORD line1, line2; 4295 FX_DWORD line1, line2;
4296 for(; m_loopIndex < GBH; m_loopIndex++) { 4296 for(; m_loopIndex < GBH; m_loopIndex++) {
4297 if(TPGDON) { 4297 if(TPGDON) {
4298 SLTP = pArithDecoder->DECODE(&gbContext[0x0195]); 4298 SLTP = pArithDecoder->DECODE(&gbContext[0x0195]);
4299 LTP = LTP ^ SLTP; 4299 LTP = LTP ^ SLTP;
4300 } 4300 }
4301 if(LTP == 1) { 4301 if(LTP == 1) {
4302 pImage->copyLine(m_loopIndex, m_loopIndex - 1); 4302 pImage->copyLine(m_loopIndex, m_loopIndex - 1);
4303 } else { 4303 } else {
(...skipping 18 matching lines...) Expand all
4322 } 4322 }
4323 if(pPause && pPause->NeedToPauseNow()) { 4323 if(pPause && pPause->NeedToPauseNow()) {
4324 m_loopIndex++; 4324 m_loopIndex++;
4325 m_ProssiveStatus = FXCODEC_STATUS_DECODE_TOBECONTINUE; 4325 m_ProssiveStatus = FXCODEC_STATUS_DECODE_TOBECONTINUE;
4326 return FXCODEC_STATUS_DECODE_TOBECONTINUE; 4326 return FXCODEC_STATUS_DECODE_TOBECONTINUE;
4327 } 4327 }
4328 } 4328 }
4329 m_ProssiveStatus = FXCODEC_STATUS_DECODE_FINISH; 4329 m_ProssiveStatus = FXCODEC_STATUS_DECODE_FINISH;
4330 return FXCODEC_STATUS_DECODE_FINISH; 4330 return FXCODEC_STATUS_DECODE_FINISH;
4331 } 4331 }
OLDNEW
« no previous file with comments | « core/src/fxcodec/jbig2/JBig2_GeneralDecoder.h ('k') | core/src/fxcodec/jbig2/JBig2_HuffmanDecoder.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698