diff options
Diffstat (limited to 'core')
-rw-r--r-- | core/fxcodec/jbig2/JBig2_GrdProc.cpp | 42 | ||||
-rw-r--r-- | core/fxcodec/jbig2/JBig2_GrdProc.h | 20 |
2 files changed, 36 insertions, 26 deletions
diff --git a/core/fxcodec/jbig2/JBig2_GrdProc.cpp b/core/fxcodec/jbig2/JBig2_GrdProc.cpp index c1bbc6f903..d0fe440b2d 100644 --- a/core/fxcodec/jbig2/JBig2_GrdProc.cpp +++ b/core/fxcodec/jbig2/JBig2_GrdProc.cpp @@ -35,9 +35,15 @@ constexpr uint16_t kOptConstant12[] = {0x000f, 0x0007, 0x0003}; } // namespace -CJBig2_GRDProc::CJBig2_GRDProc() {} +CJBig2_GRDProc::ProgressiveArithDecodeState::ProgressiveArithDecodeState() = + default; -CJBig2_GRDProc::~CJBig2_GRDProc() {} +CJBig2_GRDProc::ProgressiveArithDecodeState::~ProgressiveArithDecodeState() = + default; + +CJBig2_GRDProc::CJBig2_GRDProc() = default; + +CJBig2_GRDProc::~CJBig2_GRDProc() = default; bool CJBig2_GRDProc::UseTemplate0Opt3() const { return (GBAT[0] == 3) && (GBAT[1] == -1) && (GBAT[2] == -3) && @@ -478,8 +484,8 @@ FXCODEC_STATUS CJBig2_GRDProc::ContinueDecode( FXCODEC_STATUS CJBig2_GRDProc::ProgressiveDecodeArithTemplate0Opt3( ProgressiveArithDecodeState* pState) { CJBig2_Image* pImage = pState->pImage->get(); - JBig2ArithCtx* gbContext = pState->gbContext; - CJBig2_ArithDecoder* pArithDecoder = pState->pArithDecoder; + JBig2ArithCtx* gbContext = pState->gbContext.Get(); + CJBig2_ArithDecoder* pArithDecoder = pState->pArithDecoder.Get(); if (!m_pLine) m_pLine = pImage->data(); int32_t nStride = pImage->stride(); @@ -581,8 +587,8 @@ FXCODEC_STATUS CJBig2_GRDProc::ProgressiveDecodeArithTemplate0Opt3( FXCODEC_STATUS CJBig2_GRDProc::ProgressiveDecodeArithTemplate0Unopt( ProgressiveArithDecodeState* pState) { CJBig2_Image* pImage = pState->pImage->get(); - JBig2ArithCtx* gbContext = pState->gbContext; - CJBig2_ArithDecoder* pArithDecoder = pState->pArithDecoder; + JBig2ArithCtx* gbContext = pState->gbContext.Get(); + CJBig2_ArithDecoder* pArithDecoder = pState->pArithDecoder.Get(); for (; m_loopIndex < GBH; m_loopIndex++) { if (TPGDON) { if (pArithDecoder->IsComplete()) @@ -639,8 +645,8 @@ FXCODEC_STATUS CJBig2_GRDProc::ProgressiveDecodeArithTemplate0Unopt( FXCODEC_STATUS CJBig2_GRDProc::ProgressiveDecodeArithTemplate1Opt3( ProgressiveArithDecodeState* pState) { CJBig2_Image* pImage = pState->pImage->get(); - JBig2ArithCtx* gbContext = pState->gbContext; - CJBig2_ArithDecoder* pArithDecoder = pState->pArithDecoder; + JBig2ArithCtx* gbContext = pState->gbContext.Get(); + CJBig2_ArithDecoder* pArithDecoder = pState->pArithDecoder.Get(); if (!m_pLine) m_pLine = pImage->data(); int32_t nStride = pImage->stride(); @@ -740,8 +746,8 @@ FXCODEC_STATUS CJBig2_GRDProc::ProgressiveDecodeArithTemplate1Opt3( FXCODEC_STATUS CJBig2_GRDProc::ProgressiveDecodeArithTemplate1Unopt( ProgressiveArithDecodeState* pState) { CJBig2_Image* pImage = pState->pImage->get(); - JBig2ArithCtx* gbContext = pState->gbContext; - CJBig2_ArithDecoder* pArithDecoder = pState->pArithDecoder; + JBig2ArithCtx* gbContext = pState->gbContext.Get(); + CJBig2_ArithDecoder* pArithDecoder = pState->pArithDecoder.Get(); for (uint32_t h = 0; h < GBH; h++) { if (TPGDON) { if (pArithDecoder->IsComplete()) @@ -794,8 +800,8 @@ FXCODEC_STATUS CJBig2_GRDProc::ProgressiveDecodeArithTemplate1Unopt( FXCODEC_STATUS CJBig2_GRDProc::ProgressiveDecodeArithTemplate2Opt3( ProgressiveArithDecodeState* pState) { CJBig2_Image* pImage = pState->pImage->get(); - JBig2ArithCtx* gbContext = pState->gbContext; - CJBig2_ArithDecoder* pArithDecoder = pState->pArithDecoder; + JBig2ArithCtx* gbContext = pState->gbContext.Get(); + CJBig2_ArithDecoder* pArithDecoder = pState->pArithDecoder.Get(); if (!m_pLine) m_pLine = pImage->data(); int32_t nStride = pImage->stride(); @@ -896,8 +902,8 @@ FXCODEC_STATUS CJBig2_GRDProc::ProgressiveDecodeArithTemplate2Opt3( FXCODEC_STATUS CJBig2_GRDProc::ProgressiveDecodeArithTemplate2Unopt( ProgressiveArithDecodeState* pState) { CJBig2_Image* pImage = pState->pImage->get(); - JBig2ArithCtx* gbContext = pState->gbContext; - CJBig2_ArithDecoder* pArithDecoder = pState->pArithDecoder; + JBig2ArithCtx* gbContext = pState->gbContext.Get(); + CJBig2_ArithDecoder* pArithDecoder = pState->pArithDecoder.Get(); for (; m_loopIndex < GBH; m_loopIndex++) { if (TPGDON) { if (pArithDecoder->IsComplete()) @@ -950,8 +956,8 @@ FXCODEC_STATUS CJBig2_GRDProc::ProgressiveDecodeArithTemplate2Unopt( FXCODEC_STATUS CJBig2_GRDProc::ProgressiveDecodeArithTemplate3Opt3( ProgressiveArithDecodeState* pState) { CJBig2_Image* pImage = pState->pImage->get(); - JBig2ArithCtx* gbContext = pState->gbContext; - CJBig2_ArithDecoder* pArithDecoder = pState->pArithDecoder; + JBig2ArithCtx* gbContext = pState->gbContext.Get(); + CJBig2_ArithDecoder* pArithDecoder = pState->pArithDecoder.Get(); if (!m_pLine) m_pLine = pImage->data(); int32_t nStride = pImage->stride(); @@ -1037,8 +1043,8 @@ FXCODEC_STATUS CJBig2_GRDProc::ProgressiveDecodeArithTemplate3Opt3( FXCODEC_STATUS CJBig2_GRDProc::ProgressiveDecodeArithTemplate3Unopt( ProgressiveArithDecodeState* pState) { CJBig2_Image* pImage = pState->pImage->get(); - JBig2ArithCtx* gbContext = pState->gbContext; - CJBig2_ArithDecoder* pArithDecoder = pState->pArithDecoder; + JBig2ArithCtx* gbContext = pState->gbContext.Get(); + CJBig2_ArithDecoder* pArithDecoder = pState->pArithDecoder.Get(); for (; m_loopIndex < GBH; m_loopIndex++) { if (TPGDON) { if (pArithDecoder->IsComplete()) diff --git a/core/fxcodec/jbig2/JBig2_GrdProc.h b/core/fxcodec/jbig2/JBig2_GrdProc.h index 0ee52512d9..a78e8cdbc1 100644 --- a/core/fxcodec/jbig2/JBig2_GrdProc.h +++ b/core/fxcodec/jbig2/JBig2_GrdProc.h @@ -22,11 +22,15 @@ struct JBig2ArithCtx; class CJBig2_GRDProc { public: - struct ProgressiveArithDecodeState { + class ProgressiveArithDecodeState { + public: + ProgressiveArithDecodeState(); + ~ProgressiveArithDecodeState(); + std::unique_ptr<CJBig2_Image>* pImage; - CJBig2_ArithDecoder* pArithDecoder; - JBig2ArithCtx* gbContext; - PauseIndicatorIface* pPause; + UnownedPtr<CJBig2_ArithDecoder> pArithDecoder; + UnownedPtr<JBig2ArithCtx> gbContext; + UnownedPtr<PauseIndicatorIface> pPause; }; CJBig2_GRDProc(); @@ -42,12 +46,12 @@ class CJBig2_GRDProc { const FX_RECT& GetReplaceRect() const { return m_ReplaceRect; } bool MMR; - uint32_t GBW; - uint32_t GBH; - uint8_t GBTEMPLATE; bool TPGDON; bool USESKIP; - CJBig2_Image* SKIP; + uint8_t GBTEMPLATE; + uint32_t GBW; + uint32_t GBH; + UnownedPtr<CJBig2_Image> SKIP; int8_t GBAT[8]; private: |