Chromium Code Reviews| 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 CORE_SRC_FXCODEC_JBIG2_JBIG2_CONTEXT_H_ | 7 #ifndef CORE_SRC_FXCODEC_JBIG2_JBIG2_CONTEXT_H_ |
| 8 #define CORE_SRC_FXCODEC_JBIG2_JBIG2_CONTEXT_H_ | 8 #define CORE_SRC_FXCODEC_JBIG2_JBIG2_CONTEXT_H_ |
| 9 | 9 |
| 10 #include <list> | 10 #include <list> |
| 11 #include <utility> | 11 #include <utility> |
| 12 | 12 |
| 13 #include "../../../../third_party/base/nonstd_unique_ptr.h" | 13 #include "../../../../third_party/base/nonstd_unique_ptr.h" |
| 14 #include "../../../include/fpdfapi/fpdf_objects.h" | |
| 14 #include "../../../include/fxcodec/fx_codec_def.h" | 15 #include "../../../include/fxcodec/fx_codec_def.h" |
| 15 #include "JBig2_List.h" | 16 #include "JBig2_List.h" |
| 16 #include "JBig2_Page.h" | 17 #include "JBig2_Page.h" |
| 17 #include "JBig2_Segment.h" | 18 #include "JBig2_Segment.h" |
| 18 | 19 |
| 19 class CJBig2_GRDProc; | 20 class CJBig2_GRDProc; |
| 20 class IFX_Pause; | 21 class IFX_Pause; |
| 21 | 22 |
| 22 using CJBig2_CachePair = std::pair<const uint8_t*, CJBig2_SymbolDict*>; | 23 using CJBig2_CacheKey = std::pair<FX_DWORD, FX_DWORD>; |
|
Lei Zhang
2015/10/06 22:40:24
Can you document what the key / value is?
David Lattimore
2015/10/07 22:41:53
Done.
| |
| 24 using CJBig2_CachePair = std::pair<CJBig2_CacheKey, CJBig2_SymbolDict*>; | |
|
Lei Zhang
2015/10/06 22:40:24
CJBig2_CachePair owns the CJBig2_SymbolDict* right
David Lattimore
2015/10/07 22:41:53
Done.
| |
| 23 | 25 |
| 24 #define JBIG2_SUCCESS 0 | 26 #define JBIG2_SUCCESS 0 |
| 25 #define JBIG2_FAILED -1 | 27 #define JBIG2_FAILED -1 |
| 26 #define JBIG2_ERROR_TOO_SHORT -2 | 28 #define JBIG2_ERROR_TOO_SHORT -2 |
| 27 #define JBIG2_ERROR_FATAL -3 | 29 #define JBIG2_ERROR_FATAL -3 |
| 28 #define JBIG2_END_OF_PAGE 2 | 30 #define JBIG2_END_OF_PAGE 2 |
| 29 #define JBIG2_END_OF_FILE 3 | 31 #define JBIG2_END_OF_FILE 3 |
| 30 #define JBIG2_ERROR_FILE_FORMAT -4 | 32 #define JBIG2_ERROR_FILE_FORMAT -4 |
| 31 #define JBIG2_ERROR_STREAM_TYPE -5 | 33 #define JBIG2_ERROR_STREAM_TYPE -5 |
| 32 #define JBIG2_ERROR_LIMIT -6 | 34 #define JBIG2_ERROR_LIMIT -6 |
| 33 #define JBIG2_MIN_SEGMENT_SIZE 11 | 35 #define JBIG2_MIN_SEGMENT_SIZE 11 |
| 34 | 36 |
| 35 class CJBig2_Context { | 37 class CJBig2_Context { |
| 36 public: | 38 public: |
| 37 static CJBig2_Context* CreateContext( | 39 static CJBig2_Context* CreateContext( |
| 38 const uint8_t* pGlobalData, | 40 CPDF_StreamAcc* pGlobalStream, |
| 39 FX_DWORD dwGlobalLength, | 41 CPDF_StreamAcc* pSrcStream, |
| 40 const uint8_t* pData, | |
| 41 FX_DWORD dwLength, | |
| 42 std::list<CJBig2_CachePair>* pSymbolDictCache, | 42 std::list<CJBig2_CachePair>* pSymbolDictCache, |
| 43 IFX_Pause* pPause = NULL); | 43 IFX_Pause* pPause = NULL); |
| 44 | 44 |
| 45 static void DestroyContext(CJBig2_Context* pContext); | 45 static void DestroyContext(CJBig2_Context* pContext); |
| 46 | 46 |
| 47 int32_t getFirstPage(uint8_t* pBuf, | 47 int32_t getFirstPage(uint8_t* pBuf, |
| 48 int32_t width, | 48 int32_t width, |
| 49 int32_t height, | 49 int32_t height, |
| 50 int32_t stride, | 50 int32_t stride, |
| 51 IFX_Pause* pPause); | 51 IFX_Pause* pPause); |
| 52 | 52 |
| 53 int32_t Continue(IFX_Pause* pPause); | 53 int32_t Continue(IFX_Pause* pPause); |
| 54 FXCODEC_STATUS GetProcessingStatus() { return m_ProcessingStatus; } | 54 FXCODEC_STATUS GetProcessingStatus() { return m_ProcessingStatus; } |
| 55 | 55 |
| 56 private: | 56 private: |
| 57 CJBig2_Context(const uint8_t* pGlobalData, | 57 CJBig2_Context(CPDF_StreamAcc* pGlobalStream, |
| 58 FX_DWORD dwGlobalLength, | 58 CPDF_StreamAcc* pSrcStream, |
| 59 const uint8_t* pData, | |
| 60 FX_DWORD dwLength, | |
| 61 std::list<CJBig2_CachePair>* pSymbolDictCache, | 59 std::list<CJBig2_CachePair>* pSymbolDictCache, |
| 62 IFX_Pause* pPause); | 60 IFX_Pause* pPause, |
| 61 bool isGlobal); | |
|
Lei Zhang
2015/10/06 22:40:24
bIsGlobal if you want to be consistent with the re
David Lattimore
2015/10/07 22:41:53
Done.
| |
| 63 | 62 |
| 64 ~CJBig2_Context(); | 63 ~CJBig2_Context(); |
| 65 | 64 |
| 66 int32_t decode_SquentialOrgnazation(IFX_Pause* pPause); | 65 int32_t decode_SquentialOrgnazation(IFX_Pause* pPause); |
| 67 | 66 |
| 68 int32_t decode_EmbedOrgnazation(IFX_Pause* pPause); | 67 int32_t decode_EmbedOrgnazation(IFX_Pause* pPause); |
| 69 | 68 |
| 70 int32_t decode_RandomOrgnazation_FirstPage(IFX_Pause* pPause); | 69 int32_t decode_RandomOrgnazation_FirstPage(IFX_Pause* pPause); |
| 71 | 70 |
| 72 int32_t decode_RandomOrgnazation(IFX_Pause* pPause); | 71 int32_t decode_RandomOrgnazation(IFX_Pause* pPause); |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 118 int32_t m_PauseStep; | 117 int32_t m_PauseStep; |
| 119 IFX_Pause* m_pPause; | 118 IFX_Pause* m_pPause; |
| 120 FXCODEC_STATUS m_ProcessingStatus; | 119 FXCODEC_STATUS m_ProcessingStatus; |
| 121 CJBig2_ArithDecoder* m_pArithDecoder; | 120 CJBig2_ArithDecoder* m_pArithDecoder; |
| 122 nonstd::unique_ptr<CJBig2_GRDProc> m_pGRD; | 121 nonstd::unique_ptr<CJBig2_GRDProc> m_pGRD; |
| 123 JBig2ArithCtx* m_gbContext; | 122 JBig2ArithCtx* m_gbContext; |
| 124 nonstd::unique_ptr<CJBig2_Segment> m_pSegment; | 123 nonstd::unique_ptr<CJBig2_Segment> m_pSegment; |
| 125 FX_DWORD m_dwOffset; | 124 FX_DWORD m_dwOffset; |
| 126 JBig2RegionInfo m_ri; | 125 JBig2RegionInfo m_ri; |
| 127 std::list<CJBig2_CachePair>* const m_pSymbolDictCache; | 126 std::list<CJBig2_CachePair>* const m_pSymbolDictCache; |
| 127 bool m_IsGlobal; | |
| 128 }; | 128 }; |
| 129 | 129 |
| 130 #endif // CORE_SRC_FXCODEC_JBIG2_JBIG2_CONTEXT_H_ | 130 #endif // CORE_SRC_FXCODEC_JBIG2_JBIG2_CONTEXT_H_ |
| OLD | NEW |