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 "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 3009 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3020 } | 3020 } |
3021 m_pModule->JBig2_Free(EXFLAGS); | 3021 m_pModule->JBig2_Free(EXFLAGS); |
3022 m_pModule->JBig2_Free(SDNEWSYMS); | 3022 m_pModule->JBig2_Free(SDNEWSYMS); |
3023 if(SDREFAGG == 0) { | 3023 if(SDREFAGG == 0) { |
3024 m_pModule->JBig2_Free(SDNEWSYMWIDTHS); | 3024 m_pModule->JBig2_Free(SDNEWSYMWIDTHS); |
3025 } | 3025 } |
3026 delete pHuffmanDecoder; | 3026 delete pHuffmanDecoder; |
3027 return pDict; | 3027 return pDict; |
3028 failed: | 3028 failed: |
3029 for(I = 0; I < NSYMSDECODED; I++) { | 3029 for(I = 0; I < NSYMSDECODED; I++) { |
3030 if (SDNEWSYMS[I]) { | 3030 delete SDNEWSYMS[I]; |
3031 delete SDNEWSYMS[I]; | |
3032 } | |
3033 } | 3031 } |
3034 m_pModule->JBig2_Free(SDNEWSYMS); | 3032 m_pModule->JBig2_Free(SDNEWSYMS); |
3035 if(SDREFAGG == 0) { | 3033 if(SDREFAGG == 0) { |
3036 m_pModule->JBig2_Free(SDNEWSYMWIDTHS); | 3034 m_pModule->JBig2_Free(SDNEWSYMWIDTHS); |
3037 } | 3035 } |
3038 delete pHuffmanDecoder; | 3036 delete pHuffmanDecoder; |
3039 return NULL; | 3037 return NULL; |
3040 } | 3038 } |
3041 CJBig2_Image *CJBig2_HTRDProc::decode_Arith(CJBig2_ArithDecoder *pArithDecoder, | 3039 CJBig2_Image *CJBig2_HTRDProc::decode_Arith(CJBig2_ArithDecoder *pArithDecoder, |
3042 JBig2ArithCtx *gbContext, IFX_Pause* pPause) | 3040 JBig2ArithCtx *gbContext, IFX_Pause* pPause) |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3087 x = (HGX + mg * HRY + ng * HRX) >> 8; | 3085 x = (HGX + mg * HRY + ng * HRX) >> 8; |
3088 y = (HGY + mg * HRX - ng * HRY) >> 8; | 3086 y = (HGY + mg * HRX - ng * HRY) >> 8; |
3089 FX_DWORD pat_index = GI[mg * HGW + ng]; | 3087 FX_DWORD pat_index = GI[mg * HGW + ng]; |
3090 if (pat_index >= HNUMPATS) { | 3088 if (pat_index >= HNUMPATS) { |
3091 pat_index = HNUMPATS - 1; | 3089 pat_index = HNUMPATS - 1; |
3092 } | 3090 } |
3093 HTREG->composeFrom(x, y, HPATS[pat_index], HCOMBOP); | 3091 HTREG->composeFrom(x, y, HPATS[pat_index], HCOMBOP); |
3094 } | 3092 } |
3095 } | 3093 } |
3096 m_pModule->JBig2_Free(GI); | 3094 m_pModule->JBig2_Free(GI); |
3097 if(HSKIP) { | 3095 delete HSKIP; |
3098 delete HSKIP; | |
3099 } | |
3100 delete pGID; | 3096 delete pGID; |
3101 return HTREG; | 3097 return HTREG; |
3102 failed: | 3098 failed: |
3103 if(HSKIP) { | 3099 delete HSKIP; |
3104 delete HSKIP; | |
3105 } | |
3106 delete pGID; | 3100 delete pGID; |
3107 delete HTREG; | 3101 delete HTREG; |
3108 return NULL; | 3102 return NULL; |
3109 } | 3103 } |
3110 CJBig2_Image *CJBig2_HTRDProc::decode_MMR(CJBig2_BitStream *pStream, IFX_Pause*
pPause) | 3104 CJBig2_Image *CJBig2_HTRDProc::decode_MMR(CJBig2_BitStream *pStream, IFX_Pause*
pPause) |
3111 { | 3105 { |
3112 FX_DWORD ng, mg; | 3106 FX_DWORD ng, mg; |
3113 int32_t x, y; | 3107 int32_t x, y; |
3114 FX_DWORD HBPP; | 3108 FX_DWORD HBPP; |
3115 FX_DWORD *GI; | 3109 FX_DWORD *GI; |
(...skipping 1212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4328 } | 4322 } |
4329 if(pPause && pPause->NeedToPauseNow()) { | 4323 if(pPause && pPause->NeedToPauseNow()) { |
4330 m_loopIndex++; | 4324 m_loopIndex++; |
4331 m_ProssiveStatus = FXCODEC_STATUS_DECODE_TOBECONTINUE; | 4325 m_ProssiveStatus = FXCODEC_STATUS_DECODE_TOBECONTINUE; |
4332 return FXCODEC_STATUS_DECODE_TOBECONTINUE; | 4326 return FXCODEC_STATUS_DECODE_TOBECONTINUE; |
4333 } | 4327 } |
4334 } | 4328 } |
4335 m_ProssiveStatus = FXCODEC_STATUS_DECODE_FINISH; | 4329 m_ProssiveStatus = FXCODEC_STATUS_DECODE_FINISH; |
4336 return FXCODEC_STATUS_DECODE_FINISH; | 4330 return FXCODEC_STATUS_DECODE_FINISH; |
4337 } | 4331 } |
OLD | NEW |