OLD | NEW |
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 "core/fxcodec/jbig2/JBig2_Context.h" | 7 #include "core/fxcodec/jbig2/JBig2_Context.h" |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <list> | 10 #include <list> |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
194 m_bBufSpecified = true; | 194 m_bBufSpecified = true; |
195 if (pPause && pPause->NeedToPauseNow()) { | 195 if (pPause && pPause->NeedToPauseNow()) { |
196 m_PauseStep = 1; | 196 m_PauseStep = 1; |
197 m_ProcessingStatus = FXCODEC_STATUS_DECODE_TOBECONTINUE; | 197 m_ProcessingStatus = FXCODEC_STATUS_DECODE_TOBECONTINUE; |
198 return nRet; | 198 return nRet; |
199 } | 199 } |
200 return Continue(pPause); | 200 return Continue(pPause); |
201 } | 201 } |
202 int32_t CJBig2_Context::Continue(IFX_Pause* pPause) { | 202 int32_t CJBig2_Context::Continue(IFX_Pause* pPause) { |
203 m_ProcessingStatus = FXCODEC_STATUS_DECODE_READY; | 203 m_ProcessingStatus = FXCODEC_STATUS_DECODE_READY; |
204 int32_t nRet; | 204 int32_t nRet = 0; |
205 if (m_PauseStep <= 1) { | 205 if (m_PauseStep <= 1) { |
206 nRet = decode_EmbedOrgnazation(pPause); | 206 nRet = decode_EmbedOrgnazation(pPause); |
207 } else if (m_PauseStep == 2) { | 207 } else if (m_PauseStep == 2) { |
208 nRet = decode_SquentialOrgnazation(pPause); | 208 nRet = decode_SquentialOrgnazation(pPause); |
209 } else if (m_PauseStep == 3) { | 209 } else if (m_PauseStep == 3) { |
210 nRet = decode_RandomOrgnazation_FirstPage(pPause); | 210 nRet = decode_RandomOrgnazation_FirstPage(pPause); |
211 } else if (m_PauseStep == 4) { | 211 } else if (m_PauseStep == 4) { |
212 nRet = decode_RandomOrgnazation(pPause); | 212 nRet = decode_RandomOrgnazation(pPause); |
213 } else if (m_PauseStep == 5) { | 213 } else if (m_PauseStep == 5) { |
214 m_ProcessingStatus = FXCODEC_STATUS_DECODE_FINISH; | 214 m_ProcessingStatus = FXCODEC_STATUS_DECODE_FINISH; |
(...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
676 pTRD->REFCORNER = (JBig2Corner)((wFlags >> 4) & 0x0003); | 676 pTRD->REFCORNER = (JBig2Corner)((wFlags >> 4) & 0x0003); |
677 pTRD->TRANSPOSED = (wFlags >> 6) & 0x0001; | 677 pTRD->TRANSPOSED = (wFlags >> 6) & 0x0001; |
678 pTRD->SBCOMBOP = (JBig2ComposeOp)((wFlags >> 7) & 0x0003); | 678 pTRD->SBCOMBOP = (JBig2ComposeOp)((wFlags >> 7) & 0x0003); |
679 pTRD->SBDEFPIXEL = (wFlags >> 9) & 0x0001; | 679 pTRD->SBDEFPIXEL = (wFlags >> 9) & 0x0001; |
680 pTRD->SBDSOFFSET = (wFlags >> 10) & 0x001f; | 680 pTRD->SBDSOFFSET = (wFlags >> 10) & 0x001f; |
681 if (pTRD->SBDSOFFSET >= 0x0010) { | 681 if (pTRD->SBDSOFFSET >= 0x0010) { |
682 pTRD->SBDSOFFSET = pTRD->SBDSOFFSET - 0x0020; | 682 pTRD->SBDSOFFSET = pTRD->SBDSOFFSET - 0x0020; |
683 } | 683 } |
684 pTRD->SBRTEMPLATE = (wFlags >> 15) & 0x0001; | 684 pTRD->SBRTEMPLATE = (wFlags >> 15) & 0x0001; |
685 | 685 |
686 uint8_t cSBHUFFFS; | 686 uint8_t cSBHUFFFS = 0; |
687 uint8_t cSBHUFFDS; | 687 uint8_t cSBHUFFDS = 0; |
688 uint8_t cSBHUFFDT; | 688 uint8_t cSBHUFFDT = 0; |
689 uint8_t cSBHUFFRDW; | 689 uint8_t cSBHUFFRDW = 0; |
690 uint8_t cSBHUFFRDH; | 690 uint8_t cSBHUFFRDH = 0; |
691 uint8_t cSBHUFFRDX; | 691 uint8_t cSBHUFFRDX = 0; |
692 uint8_t cSBHUFFRDY; | 692 uint8_t cSBHUFFRDY = 0; |
693 uint8_t cSBHUFFRSIZE; | 693 uint8_t cSBHUFFRSIZE = 0; |
694 if (pTRD->SBHUFF == 1) { | 694 if (pTRD->SBHUFF == 1) { |
695 if (m_pStream->readShortInteger(&wFlags) != 0) | 695 if (m_pStream->readShortInteger(&wFlags) != 0) |
696 return JBIG2_ERROR_TOO_SHORT; | 696 return JBIG2_ERROR_TOO_SHORT; |
697 | 697 |
698 cSBHUFFFS = wFlags & 0x0003; | 698 cSBHUFFFS = wFlags & 0x0003; |
699 cSBHUFFDS = (wFlags >> 2) & 0x0003; | 699 cSBHUFFDS = (wFlags >> 2) & 0x0003; |
700 cSBHUFFDT = (wFlags >> 4) & 0x0003; | 700 cSBHUFFDT = (wFlags >> 4) & 0x0003; |
701 cSBHUFFRDW = (wFlags >> 6) & 0x0003; | 701 cSBHUFFRDW = (wFlags >> 6) & 0x0003; |
702 cSBHUFFRDH = (wFlags >> 8) & 0x0003; | 702 cSBHUFFRDH = (wFlags >> 8) & 0x0003; |
703 cSBHUFFRDX = (wFlags >> 10) & 0x0003; | 703 cSBHUFFRDX = (wFlags >> 10) & 0x0003; |
(...skipping 727 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1431 SBSYMCODES[CURTEMP].code = CURCODE; | 1431 SBSYMCODES[CURTEMP].code = CURCODE; |
1432 CURCODE = CURCODE + 1; | 1432 CURCODE = CURCODE + 1; |
1433 } | 1433 } |
1434 CURTEMP = CURTEMP + 1; | 1434 CURTEMP = CURTEMP + 1; |
1435 } | 1435 } |
1436 CURLEN = CURLEN + 1; | 1436 CURLEN = CURLEN + 1; |
1437 } | 1437 } |
1438 FX_Free(LENCOUNT); | 1438 FX_Free(LENCOUNT); |
1439 FX_Free(FIRSTCODE); | 1439 FX_Free(FIRSTCODE); |
1440 } | 1440 } |
OLD | NEW |