diff options
Diffstat (limited to 'core/fxcodec')
-rw-r--r-- | core/fxcodec/jbig2/JBig2_SddProc.cpp | 17 | ||||
-rw-r--r-- | core/fxcodec/jbig2/JBig2_SddProc.h | 18 |
2 files changed, 22 insertions, 13 deletions
diff --git a/core/fxcodec/jbig2/JBig2_SddProc.cpp b/core/fxcodec/jbig2/JBig2_SddProc.cpp index 29c604f1c7..7bdcf5c5f9 100644 --- a/core/fxcodec/jbig2/JBig2_SddProc.cpp +++ b/core/fxcodec/jbig2/JBig2_SddProc.cpp @@ -22,6 +22,10 @@ #include "core/fxcodec/jbig2/JBig2_TrdProc.h" #include "third_party/base/ptr_util.h" +CJBig2_SDDProc::CJBig2_SDDProc() = default; + +CJBig2_SDDProc::~CJBig2_SDDProc() = default; + std::unique_ptr<CJBig2_SymbolDict> CJBig2_SDDProc::DecodeArith( CJBig2_ArithDecoder* pArithDecoder, std::vector<JBig2ArithCtx>* gbContext, @@ -289,7 +293,7 @@ std::unique_ptr<CJBig2_SymbolDict> CJBig2_SDDProc::DecodeHuffman( NSYMSDECODED = 0; std::unique_ptr<CJBig2_Image> BS; while (NSYMSDECODED < SDNUMNEWSYMS) { - if (pHuffmanDecoder->DecodeAValue(SDHUFFDH, &HCDH) != 0) + if (pHuffmanDecoder->DecodeAValue(SDHUFFDH.Get(), &HCDH) != 0) return nullptr; HCHEIGHT = HCHEIGHT + HCDH; @@ -300,7 +304,7 @@ std::unique_ptr<CJBig2_SymbolDict> CJBig2_SDDProc::DecodeHuffman( TOTWIDTH = 0; HCFIRSTSYM = NSYMSDECODED; for (;;) { - nVal = pHuffmanDecoder->DecodeAValue(SDHUFFDW, &DW); + nVal = pHuffmanDecoder->DecodeAValue(SDHUFFDW.Get(), &DW); if (nVal == JBIG2_OOB) break; if (nVal != 0) @@ -319,8 +323,8 @@ std::unique_ptr<CJBig2_SymbolDict> CJBig2_SDDProc::DecodeHuffman( } TOTWIDTH = TOTWIDTH + SYMWIDTH; if (SDREFAGG == 1) { - if (pHuffmanDecoder->DecodeAValue(SDHUFFAGGINST, (int*)&REFAGGNINST) != - 0) { + if (pHuffmanDecoder->DecodeAValue(SDHUFFAGGINST.Get(), + (int*)&REFAGGNINST) != 0) { return nullptr; } BS = nullptr; @@ -440,9 +444,10 @@ std::unique_ptr<CJBig2_SymbolDict> CJBig2_SDDProc::DecodeHuffman( NSYMSDECODED = NSYMSDECODED + 1; } if (SDREFAGG == 0) { - if (pHuffmanDecoder->DecodeAValue(SDHUFFBMSIZE, (int32_t*)&BMSIZE) != 0) + if (pHuffmanDecoder->DecodeAValue(SDHUFFBMSIZE.Get(), + (int32_t*)&BMSIZE) != 0) { return nullptr; - + } pStream->alignByte(); std::unique_ptr<CJBig2_Image> BHC; if (BMSIZE == 0) { diff --git a/core/fxcodec/jbig2/JBig2_SddProc.h b/core/fxcodec/jbig2/JBig2_SddProc.h index a6fb039cac..abef010868 100644 --- a/core/fxcodec/jbig2/JBig2_SddProc.h +++ b/core/fxcodec/jbig2/JBig2_SddProc.h @@ -12,6 +12,7 @@ #include "core/fxcodec/jbig2/JBig2_ArithDecoder.h" #include "core/fxcrt/fx_system.h" +#include "core/fxcrt/unowned_ptr.h" class CJBig2_BitStream; class CJBig2_HuffmanTable; @@ -20,6 +21,9 @@ class CJBig2_SymbolDict; class CJBig2_SDDProc { public: + CJBig2_SDDProc(); + ~CJBig2_SDDProc(); + std::unique_ptr<CJBig2_SymbolDict> DecodeArith( CJBig2_ArithDecoder* pArithDecoder, std::vector<JBig2ArithCtx>* gbContext, @@ -32,17 +36,17 @@ class CJBig2_SDDProc { bool SDHUFF; bool SDREFAGG; + bool SDRTEMPLATE; + uint8_t SDTEMPLATE; uint32_t SDNUMINSYMS; - CJBig2_Image** SDINSYMS; uint32_t SDNUMNEWSYMS; uint32_t SDNUMEXSYMS; - const CJBig2_HuffmanTable* SDHUFFDH; - const CJBig2_HuffmanTable* SDHUFFDW; - const CJBig2_HuffmanTable* SDHUFFBMSIZE; - const CJBig2_HuffmanTable* SDHUFFAGGINST; - uint8_t SDTEMPLATE; + CJBig2_Image** SDINSYMS; + UnownedPtr<const CJBig2_HuffmanTable> SDHUFFDH; + UnownedPtr<const CJBig2_HuffmanTable> SDHUFFDW; + UnownedPtr<const CJBig2_HuffmanTable> SDHUFFBMSIZE; + UnownedPtr<const CJBig2_HuffmanTable> SDHUFFAGGINST; int8_t SDAT[8]; - bool SDRTEMPLATE; int8_t SDRAT[4]; }; |