| 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/src/fxcodec/jbig2/JBig2_HuffmanDecoder.h" | 7 #include "core/fxcodec/jbig2/JBig2_HuffmanDecoder.h" |
| 8 | 8 |
| 9 #include "core/src/fxcodec/jbig2/JBig2_Define.h" | 9 #include "core/fxcodec/jbig2/JBig2_Define.h" |
| 10 | 10 |
| 11 CJBig2_HuffmanDecoder::CJBig2_HuffmanDecoder(CJBig2_BitStream* pStream) | 11 CJBig2_HuffmanDecoder::CJBig2_HuffmanDecoder(CJBig2_BitStream* pStream) |
| 12 : m_pStream(pStream) { | 12 : m_pStream(pStream) {} |
| 13 } | |
| 14 | 13 |
| 15 CJBig2_HuffmanDecoder::~CJBig2_HuffmanDecoder() {} | 14 CJBig2_HuffmanDecoder::~CJBig2_HuffmanDecoder() {} |
| 16 | 15 |
| 17 int CJBig2_HuffmanDecoder::decodeAValue(CJBig2_HuffmanTable* pTable, | 16 int CJBig2_HuffmanDecoder::decodeAValue(CJBig2_HuffmanTable* pTable, |
| 18 int* nResult) { | 17 int* nResult) { |
| 19 int nVal = 0; | 18 int nVal = 0; |
| 20 int nBits = 0; | 19 int nBits = 0; |
| 21 while (1) { | 20 while (1) { |
| 22 FX_DWORD nTmp; | 21 FX_DWORD nTmp; |
| 23 if (m_pStream->read1Bit(&nTmp) == -1) | 22 if (m_pStream->read1Bit(&nTmp) == -1) |
| (...skipping 13 matching lines...) Expand all Loading... |
| 37 if (i == pTable->Size() - offset) | 36 if (i == pTable->Size() - offset) |
| 38 *nResult = pTable->GetRANGELOW()[i] - nTmp; | 37 *nResult = pTable->GetRANGELOW()[i] - nTmp; |
| 39 else | 38 else |
| 40 *nResult = pTable->GetRANGELOW()[i] + nTmp; | 39 *nResult = pTable->GetRANGELOW()[i] + nTmp; |
| 41 return 0; | 40 return 0; |
| 42 } | 41 } |
| 43 } | 42 } |
| 44 } | 43 } |
| 45 return -1; | 44 return -1; |
| 46 } | 45 } |
| OLD | NEW |