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 _JBIG2_GENERAL_DECODER_H_ | 7 #ifndef _JBIG2_GENERAL_DECODER_H_ |
| 8 #define _JBIG2_GENERAL_DECODER_H_ | 8 #define _JBIG2_GENERAL_DECODER_H_ |
| 9 | 9 |
| 10 #include "../../../include/fxcodec/fx_codec_def.h" | 10 #include "../../../include/fxcodec/fx_codec_def.h" |
| 11 #include "../../../include/fxcrt/fx_coordinates.h" | 11 #include "../../../include/fxcrt/fx_coordinates.h" |
| 12 #include "JBig2_ArithDecoder.h" | 12 #include "JBig2_ArithDecoder.h" |
| 13 #include "JBig2_ArithIntDecoder.h" | 13 #include "JBig2_ArithIntDecoder.h" |
| 14 #include "JBig2_Define.h" | 14 #include "JBig2_Define.h" |
| 15 #include "JBig2_SymbolDict.h" | 15 #include "JBig2_SymbolDict.h" |
| 16 | 16 |
| 17 class CJBig2_HuffmanTable; | 17 class CJBig2_HuffmanTable; |
| 18 class CJBig2_Image; | 18 class CJBig2_Image; |
| 19 class CJBig2_PatternDict; | 19 class CJBig2_PatternDict; |
| 20 | |
| 20 typedef enum { | 21 typedef enum { |
|
Tom Sepez
2015/08/18 20:23:20
nit: enum JBig2Corner {
Lei Zhang
2015/08/20 21:35:48
Done.
| |
| 21 JBIG2_CORNER_BOTTOMLEFT = 0, | 22 JBIG2_CORNER_BOTTOMLEFT = 0, |
| 22 JBIG2_CORNER_TOPLEFT = 1, | 23 JBIG2_CORNER_TOPLEFT = 1, |
| 23 JBIG2_CORNER_BOTTOMRIGHT = 2, | 24 JBIG2_CORNER_BOTTOMRIGHT = 2, |
| 24 JBIG2_CORNER_TOPRIGHT = 3 | 25 JBIG2_CORNER_TOPRIGHT = 3 |
| 25 } JBig2Corner; | 26 } JBig2Corner; |
| 27 | |
| 26 class CJBig2_GRDProc : public CJBig2_Object { | 28 class CJBig2_GRDProc : public CJBig2_Object { |
| 27 public: | 29 public: |
| 28 CJBig2_GRDProc() { | 30 CJBig2_GRDProc() { |
| 29 m_loopIndex = 0; | 31 m_loopIndex = 0; |
| 30 m_pLine = NULL; | 32 m_pLine = NULL; |
| 31 m_pPause = NULL; | 33 m_pPause = NULL; |
| 32 m_DecodeType = 0; | 34 m_DecodeType = 0; |
| 33 LTP = 0; | 35 LTP = 0; |
| 34 m_ReplaceRect.left = 0; | 36 m_ReplaceRect.left = 0; |
| 35 m_ReplaceRect.bottom = 0; | 37 m_ReplaceRect.bottom = 0; |
| 36 m_ReplaceRect.top = 0; | 38 m_ReplaceRect.top = 0; |
| 37 m_ReplaceRect.right = 0; | 39 m_ReplaceRect.right = 0; |
| 38 } | 40 } |
| 39 | 41 |
| 40 CJBig2_Image* decode_Arith(CJBig2_ArithDecoder* pArithDecoder, | 42 CJBig2_Image* decode_Arith(CJBig2_ArithDecoder* pArithDecoder, |
| 41 JBig2ArithCtx* gbContext); | 43 JBig2ArithCtx* gbContext); |
| 42 | 44 |
| 43 CJBig2_Image* decode_Arith_V2(CJBig2_ArithDecoder* pArithDecoder, | |
| 44 JBig2ArithCtx* gbContext); | |
| 45 | |
| 46 CJBig2_Image* decode_Arith_V1(CJBig2_ArithDecoder* pArithDecoder, | |
| 47 JBig2ArithCtx* gbContext); | |
| 48 | |
| 49 CJBig2_Image* decode_MMR(CJBig2_BitStream* pStream); | |
| 50 FXCODEC_STATUS Start_decode_Arith(CJBig2_Image** pImage, | 45 FXCODEC_STATUS Start_decode_Arith(CJBig2_Image** pImage, |
| 51 CJBig2_ArithDecoder* pArithDecoder, | 46 CJBig2_ArithDecoder* pArithDecoder, |
| 52 JBig2ArithCtx* gbContext, | 47 JBig2ArithCtx* gbContext, |
| 53 IFX_Pause* pPause = NULL); | 48 IFX_Pause* pPause = NULL); |
| 54 FXCODEC_STATUS Start_decode_Arith_V2(CJBig2_Image** pImage, | |
| 55 CJBig2_ArithDecoder* pArithDecoder, | |
| 56 JBig2ArithCtx* gbContext, | |
| 57 IFX_Pause* pPause = NULL); | |
| 58 FXCODEC_STATUS Start_decode_Arith_V1(CJBig2_Image** pImage, | |
| 59 CJBig2_ArithDecoder* pArithDecoder, | |
| 60 JBig2ArithCtx* gbContext, | |
| 61 IFX_Pause* pPause = NULL); | |
| 62 FXCODEC_STATUS Start_decode_MMR(CJBig2_Image** pImage, | 49 FXCODEC_STATUS Start_decode_MMR(CJBig2_Image** pImage, |
| 63 CJBig2_BitStream* pStream, | 50 CJBig2_BitStream* pStream, |
| 64 IFX_Pause* pPause = NULL); | 51 IFX_Pause* pPause = NULL); |
| 65 FXCODEC_STATUS Continue_decode(IFX_Pause* pPause); | 52 FXCODEC_STATUS Continue_decode(IFX_Pause* pPause); |
| 66 FX_RECT GetReplaceRect() { return m_ReplaceRect; } | 53 FX_RECT GetReplaceRect() { return m_ReplaceRect; } |
| 67 | 54 |
| 55 FX_BOOL MMR; | |
| 56 FX_DWORD GBW; | |
| 57 FX_DWORD GBH; | |
| 58 uint8_t GBTEMPLATE; | |
| 59 FX_BOOL TPGDON; | |
| 60 FX_BOOL USESKIP; | |
| 61 CJBig2_Image* SKIP; | |
| 62 char GBAT[8]; | |
| 63 | |
| 68 private: | 64 private: |
| 69 FXCODEC_STATUS decode_Arith(IFX_Pause* pPause); | 65 FXCODEC_STATUS decode_Arith(IFX_Pause* pPause); |
| 70 FXCODEC_STATUS decode_Arith_V2(IFX_Pause* pPause); | |
| 71 FXCODEC_STATUS decode_Arith_V1(IFX_Pause* pPause); | |
| 72 FXCODEC_STATUS decode_MMR(); | |
| 73 FXCODEC_STATUS decode_Arith_Template0_opt3(CJBig2_Image* pImage, | 66 FXCODEC_STATUS decode_Arith_Template0_opt3(CJBig2_Image* pImage, |
| 74 CJBig2_ArithDecoder* pArithDecoder, | 67 CJBig2_ArithDecoder* pArithDecoder, |
| 75 JBig2ArithCtx* gbContext, | 68 JBig2ArithCtx* gbContext, |
| 76 IFX_Pause* pPause); | 69 IFX_Pause* pPause); |
| 77 FXCODEC_STATUS decode_Arith_Template0_unopt( | 70 FXCODEC_STATUS decode_Arith_Template0_unopt( |
| 78 CJBig2_Image* pImage, | 71 CJBig2_Image* pImage, |
| 79 CJBig2_ArithDecoder* pArithDecoder, | 72 CJBig2_ArithDecoder* pArithDecoder, |
| 80 JBig2ArithCtx* gbContext, | 73 JBig2ArithCtx* gbContext, |
| 81 IFX_Pause* pPause); | 74 IFX_Pause* pPause); |
| 82 FXCODEC_STATUS decode_Arith_Template1_opt3(CJBig2_Image* pImage, | 75 FXCODEC_STATUS decode_Arith_Template1_opt3(CJBig2_Image* pImage, |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 99 IFX_Pause* pPause); | 92 IFX_Pause* pPause); |
| 100 FXCODEC_STATUS decode_Arith_Template3_opt3(CJBig2_Image* pImage, | 93 FXCODEC_STATUS decode_Arith_Template3_opt3(CJBig2_Image* pImage, |
| 101 CJBig2_ArithDecoder* pArithDecoder, | 94 CJBig2_ArithDecoder* pArithDecoder, |
| 102 JBig2ArithCtx* gbContext, | 95 JBig2ArithCtx* gbContext, |
| 103 IFX_Pause* pPause); | 96 IFX_Pause* pPause); |
| 104 FXCODEC_STATUS decode_Arith_Template3_unopt( | 97 FXCODEC_STATUS decode_Arith_Template3_unopt( |
| 105 CJBig2_Image* pImage, | 98 CJBig2_Image* pImage, |
| 106 CJBig2_ArithDecoder* pArithDecoder, | 99 CJBig2_ArithDecoder* pArithDecoder, |
| 107 JBig2ArithCtx* gbContext, | 100 JBig2ArithCtx* gbContext, |
| 108 IFX_Pause* pPause); | 101 IFX_Pause* pPause); |
| 109 FX_DWORD m_loopIndex; | |
| 110 uint8_t* m_pLine; | |
| 111 IFX_Pause* m_pPause; | |
| 112 FXCODEC_STATUS m_ProssiveStatus; | |
| 113 CJBig2_Image** m_pImage; | |
| 114 CJBig2_ArithDecoder* m_pArithDecoder; | |
| 115 JBig2ArithCtx* m_gbContext; | |
| 116 FX_WORD m_DecodeType; | |
| 117 FX_BOOL LTP; | |
| 118 FX_RECT m_ReplaceRect; | |
| 119 | |
| 120 private: | |
| 121 CJBig2_Image* decode_Arith_Template0_opt(CJBig2_ArithDecoder* pArithDecoder, | 102 CJBig2_Image* decode_Arith_Template0_opt(CJBig2_ArithDecoder* pArithDecoder, |
| 122 JBig2ArithCtx* gbContext); | 103 JBig2ArithCtx* gbContext); |
| 123 | 104 |
| 124 CJBig2_Image* decode_Arith_Template0_opt2(CJBig2_ArithDecoder* pArithDecoder, | 105 CJBig2_Image* decode_Arith_Template0_opt2(CJBig2_ArithDecoder* pArithDecoder, |
| 125 JBig2ArithCtx* gbContext); | 106 JBig2ArithCtx* gbContext); |
| 126 | 107 |
| 127 CJBig2_Image* decode_Arith_Template0_opt3(CJBig2_ArithDecoder* pArithDecoder, | 108 CJBig2_Image* decode_Arith_Template0_opt3(CJBig2_ArithDecoder* pArithDecoder, |
| 128 JBig2ArithCtx* gbContext); | 109 JBig2ArithCtx* gbContext); |
| 129 | 110 |
| 130 CJBig2_Image* decode_Arith_Template0_unopt(CJBig2_ArithDecoder* pArithDecoder, | 111 CJBig2_Image* decode_Arith_Template0_unopt(CJBig2_ArithDecoder* pArithDecoder, |
| (...skipping 28 matching lines...) Expand all Loading... | |
| 159 | 140 |
| 160 CJBig2_Image* decode_Arith_Template3_opt2(CJBig2_ArithDecoder* pArithDecoder, | 141 CJBig2_Image* decode_Arith_Template3_opt2(CJBig2_ArithDecoder* pArithDecoder, |
| 161 JBig2ArithCtx* gbContext); | 142 JBig2ArithCtx* gbContext); |
| 162 | 143 |
| 163 CJBig2_Image* decode_Arith_Template3_opt3(CJBig2_ArithDecoder* pArithDecoder, | 144 CJBig2_Image* decode_Arith_Template3_opt3(CJBig2_ArithDecoder* pArithDecoder, |
| 164 JBig2ArithCtx* gbContext); | 145 JBig2ArithCtx* gbContext); |
| 165 | 146 |
| 166 CJBig2_Image* decode_Arith_Template3_unopt(CJBig2_ArithDecoder* pArithDecoder, | 147 CJBig2_Image* decode_Arith_Template3_unopt(CJBig2_ArithDecoder* pArithDecoder, |
| 167 JBig2ArithCtx* gbContext); | 148 JBig2ArithCtx* gbContext); |
| 168 | 149 |
| 169 public: | 150 FX_DWORD m_loopIndex; |
| 170 FX_BOOL MMR; | 151 uint8_t* m_pLine; |
| 171 FX_DWORD GBW; | 152 IFX_Pause* m_pPause; |
| 172 FX_DWORD GBH; | 153 FXCODEC_STATUS m_ProssiveStatus; |
| 173 uint8_t GBTEMPLATE; | 154 CJBig2_Image** m_pImage; |
| 174 FX_BOOL TPGDON; | 155 CJBig2_ArithDecoder* m_pArithDecoder; |
| 175 FX_BOOL USESKIP; | 156 JBig2ArithCtx* m_gbContext; |
| 176 CJBig2_Image* SKIP; | 157 FX_WORD m_DecodeType; |
| 177 signed char GBAT[8]; | 158 FX_BOOL LTP; |
| 159 FX_RECT m_ReplaceRect; | |
| 178 }; | 160 }; |
| 161 | |
| 179 class CJBig2_GRRDProc : public CJBig2_Object { | 162 class CJBig2_GRRDProc : public CJBig2_Object { |
| 180 public: | 163 public: |
| 181 CJBig2_Image* decode(CJBig2_ArithDecoder* pArithDecoder, | 164 CJBig2_Image* decode(CJBig2_ArithDecoder* pArithDecoder, |
| 182 JBig2ArithCtx* grContext); | 165 JBig2ArithCtx* grContext); |
| 183 | 166 |
| 184 CJBig2_Image* decode_Template0_unopt(CJBig2_ArithDecoder* pArithDecoder, | 167 CJBig2_Image* decode_Template0_unopt(CJBig2_ArithDecoder* pArithDecoder, |
| 185 JBig2ArithCtx* grContext); | 168 JBig2ArithCtx* grContext); |
| 186 | 169 |
| 187 CJBig2_Image* decode_Template0_opt(CJBig2_ArithDecoder* pArithDecoder, | 170 CJBig2_Image* decode_Template0_opt(CJBig2_ArithDecoder* pArithDecoder, |
| 188 JBig2ArithCtx* grContext); | 171 JBig2ArithCtx* grContext); |
| 189 | 172 |
| 190 CJBig2_Image* decode_Template1_unopt(CJBig2_ArithDecoder* pArithDecoder, | 173 CJBig2_Image* decode_Template1_unopt(CJBig2_ArithDecoder* pArithDecoder, |
| 191 JBig2ArithCtx* grContext); | 174 JBig2ArithCtx* grContext); |
| 192 | 175 |
| 193 CJBig2_Image* decode_Template1_opt(CJBig2_ArithDecoder* pArithDecoder, | 176 CJBig2_Image* decode_Template1_opt(CJBig2_ArithDecoder* pArithDecoder, |
| 194 JBig2ArithCtx* grContext); | 177 JBig2ArithCtx* grContext); |
| 195 | 178 |
| 196 CJBig2_Image* decode_V1(CJBig2_ArithDecoder* pArithDecoder, | |
| 197 JBig2ArithCtx* grContext); | |
| 198 | |
| 199 public: | |
| 200 FX_DWORD GRW; | 179 FX_DWORD GRW; |
| 201 FX_DWORD GRH; | 180 FX_DWORD GRH; |
| 202 FX_BOOL GRTEMPLATE; | 181 FX_BOOL GRTEMPLATE; |
| 203 CJBig2_Image* GRREFERENCE; | 182 CJBig2_Image* GRREFERENCE; |
| 204 int32_t GRREFERENCEDX; | 183 int32_t GRREFERENCEDX; |
| 205 int32_t GRREFERENCEDY; | 184 int32_t GRREFERENCEDY; |
| 206 FX_BOOL TPGRON; | 185 FX_BOOL TPGRON; |
| 207 signed char GRAT[4]; | 186 signed char GRAT[4]; |
| 208 }; | 187 }; |
| 188 | |
| 209 typedef struct { | 189 typedef struct { |
| 210 CJBig2_ArithIntDecoder *IADT, *IAFS, *IADS, *IAIT, *IARI, *IARDW, *IARDH, | 190 CJBig2_ArithIntDecoder *IADT, *IAFS, *IADS, *IAIT, *IARI, *IARDW, *IARDH, |
| 211 *IARDX, *IARDY; | 191 *IARDX, *IARDY; |
| 212 CJBig2_ArithIaidDecoder* IAID; | 192 CJBig2_ArithIaidDecoder* IAID; |
| 213 } JBig2IntDecoderState; | 193 } JBig2IntDecoderState; |
| 194 | |
| 214 class CJBig2_TRDProc : public CJBig2_Object { | 195 class CJBig2_TRDProc : public CJBig2_Object { |
| 215 public: | 196 public: |
| 216 CJBig2_Image* decode_Huffman(CJBig2_BitStream* pStream, | 197 CJBig2_Image* decode_Huffman(CJBig2_BitStream* pStream, |
| 217 JBig2ArithCtx* grContext); | 198 JBig2ArithCtx* grContext); |
| 218 | 199 |
| 219 CJBig2_Image* decode_Arith(CJBig2_ArithDecoder* pArithDecoder, | 200 CJBig2_Image* decode_Arith(CJBig2_ArithDecoder* pArithDecoder, |
| 220 JBig2ArithCtx* grContext, | 201 JBig2ArithCtx* grContext, |
| 221 JBig2IntDecoderState* pIDS = NULL); | 202 JBig2IntDecoderState* pIDS = NULL); |
| 222 | 203 |
| 223 public: | 204 public: |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 315 | 296 |
| 316 public: | 297 public: |
| 317 FX_BOOL GSMMR; | 298 FX_BOOL GSMMR; |
| 318 FX_BOOL GSUSESKIP; | 299 FX_BOOL GSUSESKIP; |
| 319 uint8_t GSBPP; | 300 uint8_t GSBPP; |
| 320 FX_DWORD GSW, GSH; | 301 FX_DWORD GSW, GSH; |
| 321 uint8_t GSTEMPLATE; | 302 uint8_t GSTEMPLATE; |
| 322 CJBig2_Image* GSKIP; | 303 CJBig2_Image* GSKIP; |
| 323 }; | 304 }; |
| 324 #endif | 305 #endif |
| OLD | NEW |