| 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_ArithIntDecoder.h" | 7 #include "JBig2_ArithIntDecoder.h" |
| 8 | 8 |
| 9 #include "../../../include/fxcrt/fx_memory.h" | 9 #include "../../../include/fxcrt/fx_memory.h" |
| 10 #include "JBig2_Define.h" |
| 10 | 11 |
| 11 CJBig2_ArithIntDecoder::CJBig2_ArithIntDecoder() { | 12 CJBig2_ArithIntDecoder::CJBig2_ArithIntDecoder() { |
| 12 IAx = FX_Alloc(JBig2ArithCtx, 512); | 13 IAx = FX_Alloc(JBig2ArithCtx, 512); |
| 13 JBIG2_memset(IAx, 0, sizeof(JBig2ArithCtx) * 512); | 14 JBIG2_memset(IAx, 0, sizeof(JBig2ArithCtx) * 512); |
| 14 } | 15 } |
| 15 CJBig2_ArithIntDecoder::~CJBig2_ArithIntDecoder() { | 16 CJBig2_ArithIntDecoder::~CJBig2_ArithIntDecoder() { |
| 16 FX_Free(IAx); | 17 FX_Free(IAx); |
| 17 } | 18 } |
| 18 int CJBig2_ArithIntDecoder::decode(CJBig2_ArithDecoder* pArithDecoder, | 19 int CJBig2_ArithIntDecoder::decode(CJBig2_ArithDecoder* pArithDecoder, |
| 19 int* nResult) { | 20 int* nResult) { |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 int i; | 96 int i; |
| 96 PREV = 1; | 97 PREV = 1; |
| 97 for (i = 0; i < SBSYMCODELEN; i++) { | 98 for (i = 0; i < SBSYMCODELEN; i++) { |
| 98 D = pArithDecoder->DECODE(IAID + PREV); | 99 D = pArithDecoder->DECODE(IAID + PREV); |
| 99 PREV = (PREV << 1) | D; | 100 PREV = (PREV << 1) | D; |
| 100 } | 101 } |
| 101 PREV = PREV - (1 << SBSYMCODELEN); | 102 PREV = PREV - (1 << SBSYMCODELEN); |
| 102 *nResult = PREV; | 103 *nResult = PREV; |
| 103 return 0; | 104 return 0; |
| 104 } | 105 } |
| OLD | NEW |