summaryrefslogtreecommitdiff
path: root/core/fxcodec/jbig2/JBig2_GrdProc.h
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2018-05-01 14:37:54 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-05-01 14:37:54 +0000
commit1599b465904a312f0d0455cd26cdc9b0fe7b7d0c (patch)
tree38a7a3c997c642e91fe9a6e00086dfdf34382f73 /core/fxcodec/jbig2/JBig2_GrdProc.h
parentea603b9f0baf33462b61fa4ee6364e4f4161f55a (diff)
downloadpdfium-1599b465904a312f0d0455cd26cdc9b0fe7b7d0c.tar.xz
Add struct CJBig2_GRDProc::ProgressiveArithDecodeState.
Track the decode state in one data structure. Also grab pointers to data structure members before tight loops when decoding. It turns out referring to this->foo in tight loops can actually slow down decoding. Change-Id: I6a09b08ca06ef05968966055b5ad20f8c89896af Reviewed-on: https://pdfium-review.googlesource.com/31790 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Diffstat (limited to 'core/fxcodec/jbig2/JBig2_GrdProc.h')
-rw-r--r--core/fxcodec/jbig2/JBig2_GrdProc.h52
1 files changed, 22 insertions, 30 deletions
diff --git a/core/fxcodec/jbig2/JBig2_GrdProc.h b/core/fxcodec/jbig2/JBig2_GrdProc.h
index 08081dde3d..67d83ddec6 100644
--- a/core/fxcodec/jbig2/JBig2_GrdProc.h
+++ b/core/fxcodec/jbig2/JBig2_GrdProc.h
@@ -22,20 +22,23 @@ struct JBig2ArithCtx;
class CJBig2_GRDProc {
public:
+ struct ProgressiveArithDecodeState {
+ std::unique_ptr<CJBig2_Image>* pImage;
+ CJBig2_ArithDecoder* pArithDecoder;
+ JBig2ArithCtx* gbContext;
+ PauseIndicatorIface* pPause;
+ };
+
CJBig2_GRDProc();
~CJBig2_GRDProc();
std::unique_ptr<CJBig2_Image> DecodeArith(CJBig2_ArithDecoder* pArithDecoder,
JBig2ArithCtx* gbContext);
- FXCODEC_STATUS StartDecodeArith(std::unique_ptr<CJBig2_Image>* pImage,
- CJBig2_ArithDecoder* pArithDecoder,
- JBig2ArithCtx* gbContext,
- PauseIndicatorIface* pPause);
+ FXCODEC_STATUS StartDecodeArith(ProgressiveArithDecodeState* pState);
FXCODEC_STATUS StartDecodeMMR(std::unique_ptr<CJBig2_Image>* pImage,
CJBig2_BitStream* pStream);
- FXCODEC_STATUS ContinueDecode(PauseIndicatorIface* pPause,
- CJBig2_ArithDecoder* pArithDecoder);
+ FXCODEC_STATUS ContinueDecode(ProgressiveArithDecodeState* pState);
const FX_RECT& GetReplaceRect() const { return m_ReplaceRect; }
bool MMR;
@@ -52,32 +55,23 @@ class CJBig2_GRDProc {
bool UseTemplate1Opt3() const;
bool UseTemplate23Opt3() const;
- FXCODEC_STATUS ProgressiveDecodeArith(PauseIndicatorIface* pPause,
- CJBig2_ArithDecoder* pArithDecoder);
+ FXCODEC_STATUS ProgressiveDecodeArith(ProgressiveArithDecodeState* pState);
FXCODEC_STATUS ProgressiveDecodeArithTemplate0Opt3(
- CJBig2_ArithDecoder* pArithDecoder,
- PauseIndicatorIface* pPause);
+ ProgressiveArithDecodeState* pState);
FXCODEC_STATUS ProgressiveDecodeArithTemplate0Unopt(
- CJBig2_ArithDecoder* pArithDecoder,
- PauseIndicatorIface* pPause);
+ ProgressiveArithDecodeState* pState);
FXCODEC_STATUS ProgressiveDecodeArithTemplate1Opt3(
- CJBig2_ArithDecoder* pArithDecoder,
- PauseIndicatorIface* pPause);
+ ProgressiveArithDecodeState* pState);
FXCODEC_STATUS ProgressiveDecodeArithTemplate1Unopt(
- CJBig2_ArithDecoder* pArithDecoder,
- PauseIndicatorIface* pPause);
+ ProgressiveArithDecodeState* pState);
FXCODEC_STATUS ProgressiveDecodeArithTemplate2Opt3(
- CJBig2_ArithDecoder* pArithDecoder,
- PauseIndicatorIface* pPause);
+ ProgressiveArithDecodeState* pState);
FXCODEC_STATUS ProgressiveDecodeArithTemplate2Unopt(
- CJBig2_ArithDecoder* pArithDecoder,
- PauseIndicatorIface* pPause);
+ ProgressiveArithDecodeState* pState);
FXCODEC_STATUS ProgressiveDecodeArithTemplate3Opt3(
- CJBig2_ArithDecoder* pArithDecoder,
- PauseIndicatorIface* pPause);
+ ProgressiveArithDecodeState* pState);
FXCODEC_STATUS ProgressiveDecodeArithTemplate3Unopt(
- CJBig2_ArithDecoder* pArithDecoder,
- PauseIndicatorIface* pPause);
+ ProgressiveArithDecodeState* pState);
std::unique_ptr<CJBig2_Image> DecodeArithTemplate0Opt3(
CJBig2_ArithDecoder* pArithDecoder,
@@ -104,13 +98,11 @@ class CJBig2_GRDProc {
CJBig2_ArithDecoder* pArithDecoder,
JBig2ArithCtx* gbContext);
- uint32_t m_loopIndex;
- uint8_t* m_pLine;
+ uint32_t m_loopIndex = 0;
+ uint8_t* m_pLine = nullptr;
FXCODEC_STATUS m_ProssiveStatus;
- CJBig2_Image* m_pImage;
- JBig2ArithCtx* m_gbContext;
- uint16_t m_DecodeType;
- int m_LTP;
+ uint16_t m_DecodeType = 0;
+ int m_LTP = 0;
FX_RECT m_ReplaceRect;
};