summaryrefslogtreecommitdiff
path: root/core/fxcodec/jbig2/JBig2_PddProc.cpp
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_PddProc.cpp
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_PddProc.cpp')
-rw-r--r--core/fxcodec/jbig2/JBig2_PddProc.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/core/fxcodec/jbig2/JBig2_PddProc.cpp b/core/fxcodec/jbig2/JBig2_PddProc.cpp
index 18c50ef4cd..32f29d745c 100644
--- a/core/fxcodec/jbig2/JBig2_PddProc.cpp
+++ b/core/fxcodec/jbig2/JBig2_PddProc.cpp
@@ -38,10 +38,16 @@ std::unique_ptr<CJBig2_PatternDict> CJBig2_PDDProc::DecodeArith(
pGRD->GBAT[6] = -2;
pGRD->GBAT[7] = -2;
}
- FXCODEC_STATUS status =
- pGRD->StartDecodeArith(&BHDC, pArithDecoder, gbContext, nullptr);
+ CJBig2_GRDProc::ProgressiveArithDecodeState state;
+ state.pImage = &BHDC;
+ state.pArithDecoder = pArithDecoder;
+ state.gbContext = gbContext;
+ state.pPause = nullptr;
+
+ FXCODEC_STATUS status = pGRD->StartDecodeArith(&state);
+ state.pPause = pPause;
while (status == FXCODEC_STATUS_DECODE_TOBECONTINUE)
- status = pGRD->ContinueDecode(pPause, pArithDecoder);
+ status = pGRD->ContinueDecode(&state);
if (!BHDC)
return nullptr;