| 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 #ifndef _JBIG2_BIT_STREAM_H_ | 7 #ifndef _JBIG2_BIT_STREAM_H_ |
| 8 #define _JBIG2_BIT_STREAM_H_ | 8 #define _JBIG2_BIT_STREAM_H_ |
| 9 #include "JBig2_Define.h" | 9 #include "JBig2_Define.h" |
| 10 class CJBig2_BitStream : public CJBig2_Object | 10 class CJBig2_BitStream : public CJBig2_Object |
| 11 { | 11 { |
| 12 public: | 12 public: |
| 13 | 13 |
| 14 CJBig2_BitStream(uint8_t *pBuffer, FX_DWORD dwLength); | 14 CJBig2_BitStream(uint8_t *pBuffer, FX_DWORD dwLength); |
| 15 | 15 |
| 16 CJBig2_BitStream(CJBig2_BitStream &bs); | 16 CJBig2_BitStream(CJBig2_BitStream &bs); |
| 17 | 17 |
| 18 ~CJBig2_BitStream(); | 18 ~CJBig2_BitStream(); |
| 19 | 19 |
| 20 int32_t readNBits(FX_DWORD nBits, FX_DWORD *dwResult); | 20 int32_t readNBits(FX_DWORD nBits, FX_DWORD *dwResult); |
| 21 | 21 |
| 22 int32_t readNBits(FX_DWORD nBits, int32_t *nResult); | 22 int32_t readNBits(FX_DWORD nBits, int32_t *nResult); |
| 23 | 23 |
| 24 int32_t read1Bit(FX_DWORD *dwResult); | 24 int32_t read1Bit(FX_DWORD *dwResult); |
| 25 | 25 |
| 26 int32_t read1Bit(FX_BOOL *bResult); | 26 int32_t read1Bit(bool *bResult); |
| 27 | 27 |
| 28 int32_t read1Byte(uint8_t *cResult); | 28 int32_t read1Byte(uint8_t *cResult); |
| 29 | 29 |
| 30 int32_t readInteger(FX_DWORD *dwResult); | 30 int32_t readInteger(FX_DWORD *dwResult); |
| 31 | 31 |
| 32 int32_t readShortInteger(FX_WORD *wResult); | 32 int32_t readShortInteger(FX_WORD *wResult); |
| 33 | 33 |
| 34 void alignByte(); | 34 void alignByte(); |
| 35 | 35 |
| 36 void align4Byte(); | 36 void align4Byte(); |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 m_dwBitIdx = 0; | 158 m_dwBitIdx = 0; |
| 159 } else { | 159 } else { |
| 160 m_dwBitIdx ++; | 160 m_dwBitIdx ++; |
| 161 } | 161 } |
| 162 return 0; | 162 return 0; |
| 163 } else { | 163 } else { |
| 164 return -1; | 164 return -1; |
| 165 } | 165 } |
| 166 } | 166 } |
| 167 | 167 |
| 168 inline int32_t CJBig2_BitStream::read1Bit(FX_BOOL *bResult) | 168 inline int32_t CJBig2_BitStream::read1Bit(bool *bResult) |
| 169 { | 169 { |
| 170 if(m_dwByteIdx < m_dwLength) { | 170 if(m_dwByteIdx < m_dwLength) { |
| 171 *bResult = (m_pBuf[m_dwByteIdx] >> (7 - m_dwBitIdx)) & 0x01; | 171 *bResult = (m_pBuf[m_dwByteIdx] >> (7 - m_dwBitIdx)) & 0x01; |
| 172 if(m_dwBitIdx == 7) { | 172 if(m_dwBitIdx == 7) { |
| 173 m_dwByteIdx ++; | 173 m_dwByteIdx ++; |
| 174 m_dwBitIdx = 0; | 174 m_dwBitIdx = 0; |
| 175 } else { | 175 } else { |
| 176 m_dwBitIdx ++; | 176 m_dwBitIdx ++; |
| 177 } | 177 } |
| 178 return 0; | 178 return 0; |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 307 } | 307 } |
| 308 inline void CJBig2_BitStream::offset(FX_DWORD dwOffset) | 308 inline void CJBig2_BitStream::offset(FX_DWORD dwOffset) |
| 309 { | 309 { |
| 310 m_dwByteIdx += dwOffset; | 310 m_dwByteIdx += dwOffset; |
| 311 } | 311 } |
| 312 inline FX_DWORD CJBig2_BitStream::getByteLeft() | 312 inline FX_DWORD CJBig2_BitStream::getByteLeft() |
| 313 { | 313 { |
| 314 return m_dwLength - m_dwByteIdx; | 314 return m_dwLength - m_dwByteIdx; |
| 315 } | 315 } |
| 316 #endif | 316 #endif |
| OLD | NEW |