diff options
author | Lei Zhang <thestig@chromium.org> | 2018-04-27 17:06:58 +0000 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2018-04-27 17:06:58 +0000 |
commit | 3241bb3e98c0b327bbd5b0dc02621e6105cf37a9 (patch) | |
tree | d015e3cb2d52c3438dd7795ec07fe2749daddfca /core/fxcodec | |
parent | 61f66c9be2abf4f2a5f8bc299ad6e1900c63dbc3 (diff) | |
download | pdfium-3241bb3e98c0b327bbd5b0dc02621e6105cf37a9.tar.xz |
Fix style for many jbig2 methods.chromium/3412
Change-Id: Ie700e132f13f2cb4851ea59b68c891e3c42af243
Reviewed-on: https://pdfium-review.googlesource.com/31531
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Diffstat (limited to 'core/fxcodec')
25 files changed, 393 insertions, 402 deletions
diff --git a/core/fxcodec/codec/fx_codec_jbig.cpp b/core/fxcodec/codec/fx_codec_jbig.cpp index 51cae38441..d8d112bab0 100644 --- a/core/fxcodec/codec/fx_codec_jbig.cpp +++ b/core/fxcodec/codec/fx_codec_jbig.cpp @@ -64,7 +64,7 @@ FXCODEC_STATUS CCodec_Jbig2Module::StartDecode( pJbig2Context->m_pContext = pdfium::MakeUnique<CJBig2_Context>( global_stream, src_stream, pJBig2DocumentContext->GetSymbolDictCache(), false); - int ret = pJbig2Context->m_pContext->getFirstPage(dest_buf, width, height, + int ret = pJbig2Context->m_pContext->GetFirstPage(dest_buf, width, height, dest_pitch, pPause); return Decode(pJbig2Context, ret); } diff --git a/core/fxcodec/jbig2/JBig2_ArithDecoder.cpp b/core/fxcodec/jbig2/JBig2_ArithDecoder.cpp index ba42644e94..7d9f8fec9e 100644 --- a/core/fxcodec/jbig2/JBig2_ArithDecoder.cpp +++ b/core/fxcodec/jbig2/JBig2_ArithDecoder.cpp @@ -67,7 +67,7 @@ CJBig2_ArithDecoder::CJBig2_ArithDecoder(CJBig2_BitStream* pStream) CJBig2_ArithDecoder::~CJBig2_ArithDecoder() {} -int CJBig2_ArithDecoder::DECODE(JBig2ArithCtx* pCX) { +int CJBig2_ArithDecoder::Decode(JBig2ArithCtx* pCX) { if (!pCX || pCX->I >= FX_ArraySize(kQeTable)) return 0; diff --git a/core/fxcodec/jbig2/JBig2_ArithDecoder.h b/core/fxcodec/jbig2/JBig2_ArithDecoder.h index c9e29a5937..250e7009ff 100644 --- a/core/fxcodec/jbig2/JBig2_ArithDecoder.h +++ b/core/fxcodec/jbig2/JBig2_ArithDecoder.h @@ -23,10 +23,9 @@ struct JBig2ArithCtx { class CJBig2_ArithDecoder { public: explicit CJBig2_ArithDecoder(CJBig2_BitStream* pStream); - ~CJBig2_ArithDecoder(); - int DECODE(JBig2ArithCtx* pCX); + int Decode(JBig2ArithCtx* pCX); bool IsComplete() const { return m_Complete; } diff --git a/core/fxcodec/jbig2/JBig2_ArithIntDecoder.cpp b/core/fxcodec/jbig2/JBig2_ArithIntDecoder.cpp index 7ed7702964..0d09b31faa 100644 --- a/core/fxcodec/jbig2/JBig2_ArithIntDecoder.cpp +++ b/core/fxcodec/jbig2/JBig2_ArithIntDecoder.cpp @@ -32,7 +32,7 @@ size_t RecursiveDecode(CJBig2_ArithDecoder* decoder, return kDepthEnd; JBig2ArithCtx* pCX = &(*context)[*prev]; - int D = decoder->DECODE(pCX); + int D = decoder->Decode(pCX); *prev = ShiftOr(*prev, D); if (!D) return depth; @@ -47,13 +47,13 @@ CJBig2_ArithIntDecoder::CJBig2_ArithIntDecoder() { CJBig2_ArithIntDecoder::~CJBig2_ArithIntDecoder() {} -bool CJBig2_ArithIntDecoder::decode(CJBig2_ArithDecoder* pArithDecoder, +bool CJBig2_ArithIntDecoder::Decode(CJBig2_ArithDecoder* pArithDecoder, int* nResult) { // This decoding algorithm is explained in "Annex A - Arithmetic Integer // Decoding Procedure" on page 113 of the JBIG2 specification (ISO/IEC FCD // 14492). int PREV = 1; - const int S = pArithDecoder->DECODE(&m_IAx[PREV]); + const int S = pArithDecoder->Decode(&m_IAx[PREV]); PREV = ShiftOr(PREV, S); const size_t nDecodeDataIndex = @@ -61,7 +61,7 @@ bool CJBig2_ArithIntDecoder::decode(CJBig2_ArithDecoder* pArithDecoder, int nTemp = 0; for (int i = 0; i < g_ArithIntDecodeData[nDecodeDataIndex].nNeedBits; ++i) { - int D = pArithDecoder->DECODE(&m_IAx[PREV]); + int D = pArithDecoder->Decode(&m_IAx[PREV]); PREV = ShiftOr(PREV, D); if (PREV >= 256) PREV = (PREV & 511) | 256; @@ -92,12 +92,12 @@ CJBig2_ArithIaidDecoder::CJBig2_ArithIaidDecoder(unsigned char SBSYMCODELENA) CJBig2_ArithIaidDecoder::~CJBig2_ArithIaidDecoder() {} -void CJBig2_ArithIaidDecoder::decode(CJBig2_ArithDecoder* pArithDecoder, +void CJBig2_ArithIaidDecoder::Decode(CJBig2_ArithDecoder* pArithDecoder, uint32_t* nResult) { int PREV = 1; for (unsigned char i = 0; i < SBSYMCODELEN; ++i) { JBig2ArithCtx* pCX = &m_IAID[PREV]; - int D = pArithDecoder->DECODE(pCX); + int D = pArithDecoder->Decode(pCX); PREV = ShiftOr(PREV, D); } *nResult = PREV - (1 << SBSYMCODELEN); diff --git a/core/fxcodec/jbig2/JBig2_ArithIntDecoder.h b/core/fxcodec/jbig2/JBig2_ArithIntDecoder.h index fd9fa89f19..2221767756 100644 --- a/core/fxcodec/jbig2/JBig2_ArithIntDecoder.h +++ b/core/fxcodec/jbig2/JBig2_ArithIntDecoder.h @@ -19,7 +19,7 @@ class CJBig2_ArithIntDecoder { // Returns true on success, and false when an OOB condition occurs. Many // callers can tolerate OOB and do not check the return value. - bool decode(CJBig2_ArithDecoder* pArithDecoder, int* nResult); + bool Decode(CJBig2_ArithDecoder* pArithDecoder, int* nResult); private: std::vector<JBig2ArithCtx> m_IAx; @@ -30,7 +30,7 @@ class CJBig2_ArithIaidDecoder { explicit CJBig2_ArithIaidDecoder(unsigned char SBSYMCODELENA); ~CJBig2_ArithIaidDecoder(); - void decode(CJBig2_ArithDecoder* pArithDecoder, uint32_t* nResult); + void Decode(CJBig2_ArithDecoder* pArithDecoder, uint32_t* nResult); private: std::vector<JBig2ArithCtx> m_IAID; diff --git a/core/fxcodec/jbig2/JBig2_Context.cpp b/core/fxcodec/jbig2/JBig2_Context.cpp index a3c6f587b4..ce18375d88 100644 --- a/core/fxcodec/jbig2/JBig2_Context.cpp +++ b/core/fxcodec/jbig2/JBig2_Context.cpp @@ -70,7 +70,7 @@ CJBig2_Context::CJBig2_Context(const RetainPtr<CPDF_StreamAcc>& pGlobalStream, CJBig2_Context::~CJBig2_Context() {} -int32_t CJBig2_Context::decodeSequential(PauseIndicatorIface* pPause) { +int32_t CJBig2_Context::DecodeSequential(PauseIndicatorIface* pPause) { int32_t nRet; if (m_pStream->getByteLeft() <= 0) return JBIG2_END_OF_FILE; @@ -78,14 +78,14 @@ int32_t CJBig2_Context::decodeSequential(PauseIndicatorIface* pPause) { while (m_pStream->getByteLeft() >= JBIG2_MIN_SEGMENT_SIZE) { if (!m_pSegment) { m_pSegment = pdfium::MakeUnique<CJBig2_Segment>(); - nRet = parseSegmentHeader(m_pSegment.get()); + nRet = ParseSegmentHeader(m_pSegment.get()); if (nRet != JBIG2_SUCCESS) { m_pSegment.reset(); return nRet; } m_dwOffset = m_pStream->getOffset(); } - nRet = parseSegmentData(m_pSegment.get(), pPause); + nRet = ParseSegmentData(m_pSegment.get(), pPause); if (m_ProcessingStatus == FXCODEC_STATUS_DECODE_TOBECONTINUE) { m_ProcessingStatus = FXCODEC_STATUS_DECODE_TOBECONTINUE; m_PauseStep = 2; @@ -119,11 +119,11 @@ int32_t CJBig2_Context::decodeSequential(PauseIndicatorIface* pPause) { return JBIG2_SUCCESS; } -int32_t CJBig2_Context::decodeRandomFirstPage(PauseIndicatorIface* pPause) { +int32_t CJBig2_Context::DecodeRandomFirstPage(PauseIndicatorIface* pPause) { int32_t nRet; while (m_pStream->getByteLeft() > JBIG2_MIN_SEGMENT_SIZE) { auto pSegment = pdfium::MakeUnique<CJBig2_Segment>(); - nRet = parseSegmentHeader(pSegment.get()); + nRet = ParseSegmentHeader(pSegment.get()); if (nRet != JBIG2_SUCCESS) return nRet; @@ -138,13 +138,13 @@ int32_t CJBig2_Context::decodeRandomFirstPage(PauseIndicatorIface* pPause) { } } m_nSegmentDecoded = 0; - return decodeRandom(pPause); + return DecodeRandom(pPause); } -int32_t CJBig2_Context::decodeRandom(PauseIndicatorIface* pPause) { +int32_t CJBig2_Context::DecodeRandom(PauseIndicatorIface* pPause) { for (; m_nSegmentDecoded < m_SegmentList.size(); ++m_nSegmentDecoded) { int32_t nRet = - parseSegmentData(m_SegmentList[m_nSegmentDecoded].get(), pPause); + ParseSegmentData(m_SegmentList[m_nSegmentDecoded].get(), pPause); if (nRet == JBIG2_END_OF_PAGE || nRet == JBIG2_END_OF_FILE) return JBIG2_SUCCESS; @@ -160,14 +160,14 @@ int32_t CJBig2_Context::decodeRandom(PauseIndicatorIface* pPause) { return JBIG2_SUCCESS; } -int32_t CJBig2_Context::getFirstPage(uint8_t* pBuf, +int32_t CJBig2_Context::GetFirstPage(uint8_t* pBuf, int32_t width, int32_t height, int32_t stride, PauseIndicatorIface* pPause) { int32_t nRet = 0; if (m_pGlobalContext) { - nRet = m_pGlobalContext->decodeSequential(pPause); + nRet = m_pGlobalContext->DecodeSequential(pPause); if (nRet != JBIG2_SUCCESS) { m_ProcessingStatus = FXCODEC_STATUS_ERROR; return nRet; @@ -188,11 +188,11 @@ int32_t CJBig2_Context::Continue(PauseIndicatorIface* pPause) { m_ProcessingStatus = FXCODEC_STATUS_DECODE_READY; int32_t nRet = 0; if (m_PauseStep <= 2) { - nRet = decodeSequential(pPause); + nRet = DecodeSequential(pPause); } else if (m_PauseStep == 3) { - nRet = decodeRandomFirstPage(pPause); + nRet = DecodeRandomFirstPage(pPause); } else if (m_PauseStep == 4) { - nRet = decodeRandom(pPause); + nRet = DecodeRandom(pPause); } else if (m_PauseStep == 5) { m_ProcessingStatus = FXCODEC_STATUS_DECODE_FINISH; return JBIG2_SUCCESS; @@ -210,9 +210,9 @@ int32_t CJBig2_Context::Continue(PauseIndicatorIface* pPause) { return nRet; } -CJBig2_Segment* CJBig2_Context::findSegmentByNumber(uint32_t dwNumber) { +CJBig2_Segment* CJBig2_Context::FindSegmentByNumber(uint32_t dwNumber) { if (m_pGlobalContext) { - CJBig2_Segment* pSeg = m_pGlobalContext->findSegmentByNumber(dwNumber); + CJBig2_Segment* pSeg = m_pGlobalContext->FindSegmentByNumber(dwNumber); if (pSeg) return pSeg; } @@ -223,14 +223,14 @@ CJBig2_Segment* CJBig2_Context::findSegmentByNumber(uint32_t dwNumber) { return nullptr; } -CJBig2_Segment* CJBig2_Context::findReferredSegmentByTypeAndIndex( +CJBig2_Segment* CJBig2_Context::FindReferredSegmentByTypeAndIndex( CJBig2_Segment* pSegment, uint8_t cType, int32_t nIndex) { int32_t count = 0; for (int32_t i = 0; i < pSegment->m_nReferred_to_segment_count; ++i) { CJBig2_Segment* pSeg = - findSegmentByNumber(pSegment->m_Referred_to_segment_numbers[i]); + FindSegmentByNumber(pSegment->m_Referred_to_segment_numbers[i]); if (pSeg && pSeg->m_cFlags.s.type == cType) { if (count == nIndex) return pSeg; @@ -240,7 +240,7 @@ CJBig2_Segment* CJBig2_Context::findReferredSegmentByTypeAndIndex( return nullptr; } -int32_t CJBig2_Context::parseSegmentHeader(CJBig2_Segment* pSegment) { +int32_t CJBig2_Context::ParseSegmentHeader(CJBig2_Segment* pSegment) { if (m_pStream->readInteger(&pSegment->m_dwNumber) != 0 || m_pStream->read1Byte(&pSegment->m_cFlags.c) != 0) { return JBIG2_ERROR_TOO_SHORT; @@ -316,7 +316,7 @@ int32_t CJBig2_Context::parseSegmentHeader(CJBig2_Segment* pSegment) { return JBIG2_SUCCESS; } -int32_t CJBig2_Context::parseSegmentData(CJBig2_Segment* pSegment, +int32_t CJBig2_Context::ParseSegmentData(CJBig2_Segment* pSegment, PauseIndicatorIface* pPause) { int32_t ret = ProcessingParseSegmentData(pSegment, pPause); while (m_ProcessingStatus == FXCODEC_STATUS_DECODE_TOBECONTINUE && @@ -331,33 +331,33 @@ int32_t CJBig2_Context::ProcessingParseSegmentData( PauseIndicatorIface* pPause) { switch (pSegment->m_cFlags.s.type) { case 0: - return parseSymbolDict(pSegment); + return ParseSymbolDict(pSegment); case 4: case 6: case 7: if (!m_bInPage) return JBIG2_ERROR_FATAL; - return parseTextRegion(pSegment); + return ParseTextRegion(pSegment); case 16: - return parsePatternDict(pSegment, pPause); + return ParsePatternDict(pSegment, pPause); case 20: case 22: case 23: if (!m_bInPage) return JBIG2_ERROR_FATAL; - return parseHalftoneRegion(pSegment, pPause); + return ParseHalftoneRegion(pSegment, pPause); case 36: case 38: case 39: if (!m_bInPage) return JBIG2_ERROR_FATAL; - return parseGenericRegion(pSegment, pPause); + return ParseGenericRegion(pSegment, pPause); case 40: case 42: case 43: if (!m_bInPage) return JBIG2_ERROR_FATAL; - return parseGenericRefinementRegion(pSegment); + return ParseGenericRefinementRegion(pSegment); case 48: { uint16_t wTemp; auto pPageInfo = pdfium::MakeUnique<JBig2PageInfo>(); @@ -404,7 +404,7 @@ int32_t CJBig2_Context::ProcessingParseSegmentData( m_pStream->offset(pSegment->m_dwData_length); break; case 53: - return parseTable(pSegment); + return ParseTable(pSegment); case 62: m_pStream->offset(pSegment->m_dwData_length); break; @@ -414,7 +414,7 @@ int32_t CJBig2_Context::ProcessingParseSegmentData( return JBIG2_SUCCESS; } -int32_t CJBig2_Context::parseSymbolDict(CJBig2_Segment* pSegment) { +int32_t CJBig2_Context::ParseSymbolDict(CJBig2_Segment* pSegment) { uint16_t wFlags; if (m_pStream->readShortInteger(&wFlags) != 0) return JBIG2_ERROR_TOO_SHORT; @@ -450,14 +450,14 @@ int32_t CJBig2_Context::parseSymbolDict(CJBig2_Segment* pSegment) { return JBIG2_ERROR_LIMIT; } for (int32_t i = 0; i < pSegment->m_nReferred_to_segment_count; ++i) { - if (!findSegmentByNumber(pSegment->m_Referred_to_segment_numbers[i])) + if (!FindSegmentByNumber(pSegment->m_Referred_to_segment_numbers[i])) return JBIG2_ERROR_FATAL; } CJBig2_Segment* pLRSeg = nullptr; pSymbolDictDecoder->SDNUMINSYMS = 0; for (int32_t i = 0; i < pSegment->m_nReferred_to_segment_count; ++i) { CJBig2_Segment* pSeg = - findSegmentByNumber(pSegment->m_Referred_to_segment_numbers[i]); + FindSegmentByNumber(pSegment->m_Referred_to_segment_numbers[i]); if (pSeg->m_cFlags.s.type == 0) { pSymbolDictDecoder->SDNUMINSYMS += pSeg->m_SymbolDict->NumImages(); pLRSeg = pSeg; @@ -470,7 +470,7 @@ int32_t CJBig2_Context::parseSymbolDict(CJBig2_Segment* pSegment) { uint32_t dwTemp = 0; for (int32_t i = 0; i < pSegment->m_nReferred_to_segment_count; ++i) { CJBig2_Segment* pSeg = - findSegmentByNumber(pSegment->m_Referred_to_segment_numbers[i]); + FindSegmentByNumber(pSegment->m_Referred_to_segment_numbers[i]); if (pSeg->m_cFlags.s.type == 0) { const CJBig2_SymbolDict& dict = *pSeg->m_SymbolDict.get(); for (size_t j = 0; j < dict.NumImages(); ++j) @@ -501,7 +501,7 @@ int32_t CJBig2_Context::parseSymbolDict(CJBig2_Segment* pSegment) { pSymbolDictDecoder->SDHUFFDH = Table_B5.get(); } else { CJBig2_Segment* pSeg = - findReferredSegmentByTypeAndIndex(pSegment, 53, nIndex++); + FindReferredSegmentByTypeAndIndex(pSegment, 53, nIndex++); if (!pSeg) return JBIG2_ERROR_FATAL; pSymbolDictDecoder->SDHUFFDH = pSeg->m_HuffmanTable.get(); @@ -516,7 +516,7 @@ int32_t CJBig2_Context::parseSymbolDict(CJBig2_Segment* pSegment) { pSymbolDictDecoder->SDHUFFDW = Table_B3.get(); } else { CJBig2_Segment* pSeg = - findReferredSegmentByTypeAndIndex(pSegment, 53, nIndex++); + FindReferredSegmentByTypeAndIndex(pSegment, 53, nIndex++); if (!pSeg) return JBIG2_ERROR_FATAL; pSymbolDictDecoder->SDHUFFDW = pSeg->m_HuffmanTable.get(); @@ -527,7 +527,7 @@ int32_t CJBig2_Context::parseSymbolDict(CJBig2_Segment* pSegment) { pSymbolDictDecoder->SDHUFFBMSIZE = Table_B1.get(); } else { CJBig2_Segment* pSeg = - findReferredSegmentByTypeAndIndex(pSegment, 53, nIndex++); + FindReferredSegmentByTypeAndIndex(pSegment, 53, nIndex++); if (!pSeg) return JBIG2_ERROR_FATAL; pSymbolDictDecoder->SDHUFFBMSIZE = pSeg->m_HuffmanTable.get(); @@ -541,7 +541,7 @@ int32_t CJBig2_Context::parseSymbolDict(CJBig2_Segment* pSegment) { pSymbolDictDecoder->SDHUFFAGGINST = Table_B1.get(); } else { CJBig2_Segment* pSeg = - findReferredSegmentByTypeAndIndex(pSegment, 53, nIndex++); + FindReferredSegmentByTypeAndIndex(pSegment, 53, nIndex++); if (!pSeg) return JBIG2_ERROR_FATAL; pSymbolDictDecoder->SDHUFFAGGINST = pSeg->m_HuffmanTable.get(); @@ -596,7 +596,7 @@ int32_t CJBig2_Context::parseSymbolDict(CJBig2_Segment* pSegment) { if (bUseGbContext) { auto pArithDecoder = pdfium::MakeUnique<CJBig2_ArithDecoder>(m_pStream.get()); - pSegment->m_SymbolDict = pSymbolDictDecoder->decode_Arith( + pSegment->m_SymbolDict = pSymbolDictDecoder->DecodeArith( pArithDecoder.get(), &gbContext, &grContext); if (!pSegment->m_SymbolDict) return JBIG2_ERROR_FATAL; @@ -604,7 +604,7 @@ int32_t CJBig2_Context::parseSymbolDict(CJBig2_Segment* pSegment) { m_pStream->alignByte(); m_pStream->offset(2); } else { - pSegment->m_SymbolDict = pSymbolDictDecoder->decode_Huffman( + pSegment->m_SymbolDict = pSymbolDictDecoder->DecodeHuffman( m_pStream.get(), &gbContext, &grContext); if (!pSegment->m_SymbolDict) return JBIG2_ERROR_FATAL; @@ -630,10 +630,10 @@ int32_t CJBig2_Context::parseSymbolDict(CJBig2_Segment* pSegment) { return JBIG2_SUCCESS; } -int32_t CJBig2_Context::parseTextRegion(CJBig2_Segment* pSegment) { +int32_t CJBig2_Context::ParseTextRegion(CJBig2_Segment* pSegment) { uint16_t wFlags; JBig2RegionInfo ri; - if (parseRegionInfo(&ri) != JBIG2_SUCCESS || + if (ParseRegionInfo(&ri) != JBIG2_SUCCESS || m_pStream->readShortInteger(&wFlags) != 0) { return JBIG2_ERROR_TOO_SHORT; } @@ -698,14 +698,14 @@ int32_t CJBig2_Context::parseTextRegion(CJBig2_Segment* pSegment) { return JBIG2_ERROR_FATAL; for (int32_t i = 0; i < pSegment->m_nReferred_to_segment_count; ++i) { - if (!findSegmentByNumber(pSegment->m_Referred_to_segment_numbers[i])) + if (!FindSegmentByNumber(pSegment->m_Referred_to_segment_numbers[i])) return JBIG2_ERROR_FATAL; } pTRD->SBNUMSYMS = 0; for (int32_t i = 0; i < pSegment->m_nReferred_to_segment_count; ++i) { CJBig2_Segment* pSeg = - findSegmentByNumber(pSegment->m_Referred_to_segment_numbers[i]); + FindSegmentByNumber(pSegment->m_Referred_to_segment_numbers[i]); if (pSeg->m_cFlags.s.type == 0) { pTRD->SBNUMSYMS += pSeg->m_SymbolDict->NumImages(); } @@ -717,7 +717,7 @@ int32_t CJBig2_Context::parseTextRegion(CJBig2_Segment* pSegment) { dwTemp = 0; for (int32_t i = 0; i < pSegment->m_nReferred_to_segment_count; ++i) { CJBig2_Segment* pSeg = - findSegmentByNumber(pSegment->m_Referred_to_segment_numbers[i]); + FindSegmentByNumber(pSegment->m_Referred_to_segment_numbers[i]); if (pSeg->m_cFlags.s.type == 0) { const CJBig2_SymbolDict& dict = *pSeg->m_SymbolDict.get(); for (size_t j = 0; j < dict.NumImages(); ++j) @@ -732,7 +732,7 @@ int32_t CJBig2_Context::parseTextRegion(CJBig2_Segment* pSegment) { if (pTRD->SBHUFF == 1) { std::vector<JBig2HuffmanCode> SBSYMCODES = - decodeSymbolIDHuffmanTable(m_pStream.get(), pTRD->SBNUMSYMS); + DecodeSymbolIDHuffmanTable(m_pStream.get(), pTRD->SBNUMSYMS); if (SBSYMCODES.empty()) return JBIG2_ERROR_FATAL; @@ -773,7 +773,7 @@ int32_t CJBig2_Context::parseTextRegion(CJBig2_Segment* pSegment) { pTRD->SBHUFFFS = Table_B7.get(); } else { CJBig2_Segment* pSeg = - findReferredSegmentByTypeAndIndex(pSegment, 53, nIndex++); + FindReferredSegmentByTypeAndIndex(pSegment, 53, nIndex++); if (!pSeg) return JBIG2_ERROR_FATAL; pTRD->SBHUFFFS = pSeg->m_HuffmanTable.get(); @@ -792,7 +792,7 @@ int32_t CJBig2_Context::parseTextRegion(CJBig2_Segment* pSegment) { pTRD->SBHUFFDS = Table_B10.get(); } else { CJBig2_Segment* pSeg = - findReferredSegmentByTypeAndIndex(pSegment, 53, nIndex++); + FindReferredSegmentByTypeAndIndex(pSegment, 53, nIndex++); if (!pSeg) return JBIG2_ERROR_FATAL; pTRD->SBHUFFDS = pSeg->m_HuffmanTable.get(); @@ -811,7 +811,7 @@ int32_t CJBig2_Context::parseTextRegion(CJBig2_Segment* pSegment) { pTRD->SBHUFFDT = Table_B13.get(); } else { CJBig2_Segment* pSeg = - findReferredSegmentByTypeAndIndex(pSegment, 53, nIndex++); + FindReferredSegmentByTypeAndIndex(pSegment, 53, nIndex++); if (!pSeg) return JBIG2_ERROR_FATAL; pTRD->SBHUFFDT = pSeg->m_HuffmanTable.get(); @@ -826,7 +826,7 @@ int32_t CJBig2_Context::parseTextRegion(CJBig2_Segment* pSegment) { pTRD->SBHUFFRDW = Table_B15.get(); } else { CJBig2_Segment* pSeg = - findReferredSegmentByTypeAndIndex(pSegment, 53, nIndex++); + FindReferredSegmentByTypeAndIndex(pSegment, 53, nIndex++); if (!pSeg) return JBIG2_ERROR_FATAL; pTRD->SBHUFFRDW = pSeg->m_HuffmanTable.get(); @@ -845,7 +845,7 @@ int32_t CJBig2_Context::parseTextRegion(CJBig2_Segment* pSegment) { pTRD->SBHUFFRDH = Table_B15.get(); } else { CJBig2_Segment* pSeg = - findReferredSegmentByTypeAndIndex(pSegment, 53, nIndex++); + FindReferredSegmentByTypeAndIndex(pSegment, 53, nIndex++); if (!pSeg) return JBIG2_ERROR_FATAL; pTRD->SBHUFFRDH = pSeg->m_HuffmanTable.get(); @@ -864,7 +864,7 @@ int32_t CJBig2_Context::parseTextRegion(CJBig2_Segment* pSegment) { pTRD->SBHUFFRDX = Table_B15.get(); } else { CJBig2_Segment* pSeg = - findReferredSegmentByTypeAndIndex(pSegment, 53, nIndex++); + FindReferredSegmentByTypeAndIndex(pSegment, 53, nIndex++); if (!pSeg) return JBIG2_ERROR_FATAL; pTRD->SBHUFFRDX = pSeg->m_HuffmanTable.get(); @@ -883,7 +883,7 @@ int32_t CJBig2_Context::parseTextRegion(CJBig2_Segment* pSegment) { pTRD->SBHUFFRDY = Table_B15.get(); } else { CJBig2_Segment* pSeg = - findReferredSegmentByTypeAndIndex(pSegment, 53, nIndex++); + FindReferredSegmentByTypeAndIndex(pSegment, 53, nIndex++); if (!pSeg) return JBIG2_ERROR_FATAL; pTRD->SBHUFFRDY = pSeg->m_HuffmanTable.get(); @@ -894,7 +894,7 @@ int32_t CJBig2_Context::parseTextRegion(CJBig2_Segment* pSegment) { pTRD->SBHUFFRSIZE = Table_B1.get(); } else { CJBig2_Segment* pSeg = - findReferredSegmentByTypeAndIndex(pSegment, 53, nIndex++); + FindReferredSegmentByTypeAndIndex(pSegment, 53, nIndex++); if (!pSeg) return JBIG2_ERROR_FATAL; pTRD->SBHUFFRSIZE = pSeg->m_HuffmanTable.get(); @@ -911,14 +911,14 @@ int32_t CJBig2_Context::parseTextRegion(CJBig2_Segment* pSegment) { pdfium::MakeUnique<CJBig2_ArithDecoder>(m_pStream.get()); pSegment->m_nResultType = JBIG2_IMAGE_POINTER; pSegment->m_Image = - pTRD->decode_Arith(pArithDecoder.get(), grContext.get(), nullptr); + pTRD->DecodeArith(pArithDecoder.get(), grContext.get(), nullptr); if (!pSegment->m_Image) return JBIG2_ERROR_FATAL; m_pStream->alignByte(); m_pStream->offset(2); } else { pSegment->m_nResultType = JBIG2_IMAGE_POINTER; - pSegment->m_Image = pTRD->decode_Huffman(m_pStream.get(), grContext.get()); + pSegment->m_Image = pTRD->DecodeHuffman(m_pStream.get(), grContext.get()); if (!pSegment->m_Image) return JBIG2_ERROR_FATAL; m_pStream->alignByte(); @@ -938,7 +938,7 @@ int32_t CJBig2_Context::parseTextRegion(CJBig2_Segment* pSegment) { return JBIG2_SUCCESS; } -int32_t CJBig2_Context::parsePatternDict(CJBig2_Segment* pSegment, +int32_t CJBig2_Context::ParsePatternDict(CJBig2_Segment* pSegment, PauseIndicatorIface* pPause) { uint8_t cFlags; auto pPDD = pdfium::MakeUnique<CJBig2_PDDProc>(); @@ -962,14 +962,14 @@ int32_t CJBig2_Context::parsePatternDict(CJBig2_Segment* pSegment, auto pArithDecoder = pdfium::MakeUnique<CJBig2_ArithDecoder>(m_pStream.get()); pSegment->m_PatternDict = - pPDD->decode_Arith(pArithDecoder.get(), gbContext.get(), pPause); + pPDD->DecodeArith(pArithDecoder.get(), gbContext.get(), pPause); if (!pSegment->m_PatternDict) return JBIG2_ERROR_FATAL; m_pStream->alignByte(); m_pStream->offset(2); } else { - pSegment->m_PatternDict = pPDD->decode_MMR(m_pStream.get()); + pSegment->m_PatternDict = pPDD->DecodeMMR(m_pStream.get()); if (!pSegment->m_PatternDict) return JBIG2_ERROR_FATAL; m_pStream->alignByte(); @@ -977,12 +977,12 @@ int32_t CJBig2_Context::parsePatternDict(CJBig2_Segment* pSegment, return JBIG2_SUCCESS; } -int32_t CJBig2_Context::parseHalftoneRegion(CJBig2_Segment* pSegment, +int32_t CJBig2_Context::ParseHalftoneRegion(CJBig2_Segment* pSegment, PauseIndicatorIface* pPause) { uint8_t cFlags; JBig2RegionInfo ri; auto pHRD = pdfium::MakeUnique<CJBig2_HTRDProc>(); - if (parseRegionInfo(&ri) != JBIG2_SUCCESS || + if (ParseRegionInfo(&ri) != JBIG2_SUCCESS || m_pStream->read1Byte(&cFlags) != 0 || m_pStream->readInteger(&pHRD->HGW) != 0 || m_pStream->readInteger(&pHRD->HGH) != 0 || @@ -1010,7 +1010,7 @@ int32_t CJBig2_Context::parseHalftoneRegion(CJBig2_Segment* pSegment, return JBIG2_ERROR_FATAL; CJBig2_Segment* pSeg = - findSegmentByNumber(pSegment->m_Referred_to_segment_numbers[0]); + FindSegmentByNumber(pSegment->m_Referred_to_segment_numbers[0]); if (!pSeg || (pSeg->m_cFlags.s.type != 16)) return JBIG2_ERROR_FATAL; @@ -1031,14 +1031,14 @@ int32_t CJBig2_Context::parseHalftoneRegion(CJBig2_Segment* pSegment, auto pArithDecoder = pdfium::MakeUnique<CJBig2_ArithDecoder>(m_pStream.get()); pSegment->m_Image = - pHRD->decode_Arith(pArithDecoder.get(), gbContext.get(), pPause); + pHRD->DecodeArith(pArithDecoder.get(), gbContext.get(), pPause); if (!pSegment->m_Image) return JBIG2_ERROR_FATAL; m_pStream->alignByte(); m_pStream->offset(2); } else { - pSegment->m_Image = pHRD->decode_MMR(m_pStream.get()); + pSegment->m_Image = pHRD->DecodeMMR(m_pStream.get()); if (!pSegment->m_Image) return JBIG2_ERROR_FATAL; m_pStream->alignByte(); @@ -1058,12 +1058,12 @@ int32_t CJBig2_Context::parseHalftoneRegion(CJBig2_Segment* pSegment, return JBIG2_SUCCESS; } -int32_t CJBig2_Context::parseGenericRegion(CJBig2_Segment* pSegment, +int32_t CJBig2_Context::ParseGenericRegion(CJBig2_Segment* pSegment, PauseIndicatorIface* pPause) { if (!m_pGRD) { auto pGRD = pdfium::MakeUnique<CJBig2_GRDProc>(); uint8_t cFlags; - if (parseRegionInfo(&m_ri) != JBIG2_SUCCESS || + if (ParseRegionInfo(&m_ri) != JBIG2_SUCCESS || m_pStream->read1Byte(&cFlags) != 0) { return JBIG2_ERROR_TOO_SHORT; } @@ -1097,11 +1097,11 @@ int32_t CJBig2_Context::parseGenericRegion(CJBig2_Segment* pSegment, if (!m_pArithDecoder) { m_pArithDecoder = pdfium::MakeUnique<CJBig2_ArithDecoder>(m_pStream.get()); - m_ProcessingStatus = m_pGRD->Start_decode_Arith( + m_ProcessingStatus = m_pGRD->StartDecodeArith( &pSegment->m_Image, m_pArithDecoder.get(), &m_gbContext[0], pPause); } else { m_ProcessingStatus = - m_pGRD->Continue_decode(pPause, m_pArithDecoder.get()); + m_pGRD->ContinueDecode(pPause, m_pArithDecoder.get()); } if (m_ProcessingStatus == FXCODEC_STATUS_DECODE_TOBECONTINUE) { if (pSegment->m_cFlags.s.type != 36) { @@ -1130,7 +1130,7 @@ int32_t CJBig2_Context::parseGenericRegion(CJBig2_Segment* pSegment, m_pStream->alignByte(); m_pStream->offset(2); } else { - m_pGRD->Start_decode_MMR(&pSegment->m_Image, m_pStream.get()); + m_pGRD->StartDecodeMMR(&pSegment->m_Image, m_pStream.get()); if (!pSegment->m_Image) { m_pGRD.reset(); return JBIG2_ERROR_FATAL; @@ -1156,10 +1156,10 @@ int32_t CJBig2_Context::parseGenericRegion(CJBig2_Segment* pSegment, return JBIG2_SUCCESS; } -int32_t CJBig2_Context::parseGenericRefinementRegion(CJBig2_Segment* pSegment) { +int32_t CJBig2_Context::ParseGenericRefinementRegion(CJBig2_Segment* pSegment) { JBig2RegionInfo ri; uint8_t cFlags; - if (parseRegionInfo(&ri) != JBIG2_SUCCESS || + if (ParseRegionInfo(&ri) != JBIG2_SUCCESS || m_pStream->read1Byte(&cFlags) != 0) { return JBIG2_ERROR_TOO_SHORT; } @@ -1181,7 +1181,7 @@ int32_t CJBig2_Context::parseGenericRefinementRegion(CJBig2_Segment* pSegment) { if (pSegment->m_nReferred_to_segment_count > 0) { int32_t i; for (i = 0; i < pSegment->m_nReferred_to_segment_count; ++i) { - pSeg = findSegmentByNumber(pSegment->m_Referred_to_segment_numbers[0]); + pSeg = FindSegmentByNumber(pSegment->m_Referred_to_segment_numbers[0]); if (!pSeg) return JBIG2_ERROR_FATAL; @@ -1205,7 +1205,7 @@ int32_t CJBig2_Context::parseGenericRefinementRegion(CJBig2_Segment* pSegment) { JBIG2_memset(grContext.get(), 0, sizeof(JBig2ArithCtx) * size); auto pArithDecoder = pdfium::MakeUnique<CJBig2_ArithDecoder>(m_pStream.get()); pSegment->m_nResultType = JBIG2_IMAGE_POINTER; - pSegment->m_Image = pGRRD->decode(pArithDecoder.get(), grContext.get()); + pSegment->m_Image = pGRRD->Decode(pArithDecoder.get(), grContext.get()); if (!pSegment->m_Image) return JBIG2_ERROR_FATAL; @@ -1226,7 +1226,7 @@ int32_t CJBig2_Context::parseGenericRefinementRegion(CJBig2_Segment* pSegment) { return JBIG2_SUCCESS; } -int32_t CJBig2_Context::parseTable(CJBig2_Segment* pSegment) { +int32_t CJBig2_Context::ParseTable(CJBig2_Segment* pSegment) { pSegment->m_nResultType = JBIG2_HUFFMAN_TABLE_POINTER; pSegment->m_HuffmanTable.reset(); auto pHuff = pdfium::MakeUnique<CJBig2_HuffmanTable>(m_pStream.get()); @@ -1238,7 +1238,7 @@ int32_t CJBig2_Context::parseTable(CJBig2_Segment* pSegment) { return JBIG2_SUCCESS; } -int32_t CJBig2_Context::parseRegionInfo(JBig2RegionInfo* pRI) { +int32_t CJBig2_Context::ParseRegionInfo(JBig2RegionInfo* pRI) { if (m_pStream->readInteger((uint32_t*)&pRI->width) != 0 || m_pStream->readInteger((uint32_t*)&pRI->height) != 0 || m_pStream->readInteger((uint32_t*)&pRI->x) != 0 || @@ -1249,7 +1249,7 @@ int32_t CJBig2_Context::parseRegionInfo(JBig2RegionInfo* pRI) { return JBIG2_SUCCESS; } -std::vector<JBig2HuffmanCode> CJBig2_Context::decodeSymbolIDHuffmanTable( +std::vector<JBig2HuffmanCode> CJBig2_Context::DecodeSymbolIDHuffmanTable( CJBig2_BitStream* pStream, uint32_t SBNUMSYMS) { const size_t kRunCodesSize = 35; @@ -1258,7 +1258,7 @@ std::vector<JBig2HuffmanCode> CJBig2_Context::decodeSymbolIDHuffmanTable( if (pStream->readNBits(4, &huffman_codes[i].codelen) != 0) return std::vector<JBig2HuffmanCode>(); } - huffman_assign_code(huffman_codes, kRunCodesSize); + HuffmanAssignCode(huffman_codes, kRunCodesSize); std::vector<JBig2HuffmanCode> SBSYMCODES(SBNUMSYMS); int32_t run = 0; @@ -1314,13 +1314,13 @@ std::vector<JBig2HuffmanCode> CJBig2_Context::decodeSymbolIDHuffmanTable( ++i; } } - huffman_assign_code(SBSYMCODES.data(), SBNUMSYMS); + HuffmanAssignCode(SBSYMCODES.data(), SBNUMSYMS); return SBSYMCODES; } -void CJBig2_Context::huffman_assign_code(JBig2HuffmanCode* SBSYMCODES, - int NTEMP) { - // TODO(thestig) CJBig2_HuffmanTable::parseFromCodedBuffer() has similar code. +void CJBig2_Context::HuffmanAssignCode(JBig2HuffmanCode* SBSYMCODES, + int NTEMP) { + // TODO(thestig) CJBig2_HuffmanTable::ParseFromCodedBuffer() has similar code. int LENMAX = 0; for (int i = 0; i < NTEMP; ++i) LENMAX = std::max(LENMAX, SBSYMCODES[i].codelen); diff --git a/core/fxcodec/jbig2/JBig2_Context.h b/core/fxcodec/jbig2/JBig2_Context.h index 9a47682a38..117999eb00 100644 --- a/core/fxcodec/jbig2/JBig2_Context.h +++ b/core/fxcodec/jbig2/JBig2_Context.h @@ -45,7 +45,7 @@ class CJBig2_Context { bool bIsGlobal); ~CJBig2_Context(); - int32_t getFirstPage(uint8_t* pBuf, + int32_t GetFirstPage(uint8_t* pBuf, int32_t width, int32_t height, int32_t stride, @@ -55,37 +55,37 @@ class CJBig2_Context { FXCODEC_STATUS GetProcessingStatus() const { return m_ProcessingStatus; } private: - int32_t decodeSequential(PauseIndicatorIface* pPause); - int32_t decodeRandomFirstPage(PauseIndicatorIface* pPause); - int32_t decodeRandom(PauseIndicatorIface* pPause); + int32_t DecodeSequential(PauseIndicatorIface* pPause); + int32_t DecodeRandomFirstPage(PauseIndicatorIface* pPause); + int32_t DecodeRandom(PauseIndicatorIface* pPause); - CJBig2_Segment* findSegmentByNumber(uint32_t dwNumber); - CJBig2_Segment* findReferredSegmentByTypeAndIndex(CJBig2_Segment* pSegment, + CJBig2_Segment* FindSegmentByNumber(uint32_t dwNumber); + CJBig2_Segment* FindReferredSegmentByTypeAndIndex(CJBig2_Segment* pSegment, uint8_t cType, int32_t nIndex); - int32_t parseSegmentHeader(CJBig2_Segment* pSegment); - int32_t parseSegmentData(CJBig2_Segment* pSegment, + int32_t ParseSegmentHeader(CJBig2_Segment* pSegment); + int32_t ParseSegmentData(CJBig2_Segment* pSegment, PauseIndicatorIface* pPause); int32_t ProcessingParseSegmentData(CJBig2_Segment* pSegment, PauseIndicatorIface* pPause); - int32_t parseSymbolDict(CJBig2_Segment* pSegment); - int32_t parseTextRegion(CJBig2_Segment* pSegment); - int32_t parsePatternDict(CJBig2_Segment* pSegment, + int32_t ParseSymbolDict(CJBig2_Segment* pSegment); + int32_t ParseTextRegion(CJBig2_Segment* pSegment); + int32_t ParsePatternDict(CJBig2_Segment* pSegment, PauseIndicatorIface* pPause); - int32_t parseHalftoneRegion(CJBig2_Segment* pSegment, + int32_t ParseHalftoneRegion(CJBig2_Segment* pSegment, PauseIndicatorIface* pPause); - int32_t parseGenericRegion(CJBig2_Segment* pSegment, + int32_t ParseGenericRegion(CJBig2_Segment* pSegment, PauseIndicatorIface* pPause); - int32_t parseGenericRefinementRegion(CJBig2_Segment* pSegment); - int32_t parseTable(CJBig2_Segment* pSegment); - int32_t parseRegionInfo(JBig2RegionInfo* pRI); + int32_t ParseGenericRefinementRegion(CJBig2_Segment* pSegment); + int32_t ParseTable(CJBig2_Segment* pSegment); + int32_t ParseRegionInfo(JBig2RegionInfo* pRI); - std::vector<JBig2HuffmanCode> decodeSymbolIDHuffmanTable( + std::vector<JBig2HuffmanCode> DecodeSymbolIDHuffmanTable( CJBig2_BitStream* pStream, uint32_t SBNUMSYMS); - void huffman_assign_code(JBig2HuffmanCode* SBSYMCODES, int NTEMP); + void HuffmanAssignCode(JBig2HuffmanCode* SBSYMCODES, int NTEMP); std::unique_ptr<CJBig2_Context> m_pGlobalContext; std::unique_ptr<CJBig2_BitStream> m_pStream; diff --git a/core/fxcodec/jbig2/JBig2_GrdProc.cpp b/core/fxcodec/jbig2/JBig2_GrdProc.cpp index 55c6bb9a97..39edbb4aa9 100644 --- a/core/fxcodec/jbig2/JBig2_GrdProc.cpp +++ b/core/fxcodec/jbig2/JBig2_GrdProc.cpp @@ -43,7 +43,7 @@ bool CJBig2_GRDProc::UseTemplate23Opt3() const { return (GBAT[0] == 2) && (GBAT[1] == -1); } -std::unique_ptr<CJBig2_Image> CJBig2_GRDProc::decode_Arith( +std::unique_ptr<CJBig2_Image> CJBig2_GRDProc::DecodeArith( CJBig2_ArithDecoder* pArithDecoder, JBig2ArithCtx* gbContext) { if (!CJBig2_Image::IsValidImageSize(GBW, GBH)) @@ -51,24 +51,24 @@ std::unique_ptr<CJBig2_Image> CJBig2_GRDProc::decode_Arith( if (GBTEMPLATE == 0) { if (UseTemplate0Opt3()) - return decode_Arith_Template0_opt3(pArithDecoder, gbContext); - return decode_Arith_Template0_unopt(pArithDecoder, gbContext); + return DecodeArithTemplate0Opt3(pArithDecoder, gbContext); + return DecodeArithTemplate0Unopt(pArithDecoder, gbContext); } else if (GBTEMPLATE == 1) { if (UseTemplate1Opt3()) - return decode_Arith_Template1_opt3(pArithDecoder, gbContext); - return decode_Arith_Template1_unopt(pArithDecoder, gbContext); + return DecodeArithTemplate1Opt3(pArithDecoder, gbContext); + return DecodeArithTemplate1Unopt(pArithDecoder, gbContext); } else if (GBTEMPLATE == 2) { if (UseTemplate23Opt3()) - return decode_Arith_Template2_opt3(pArithDecoder, gbContext); - return decode_Arith_Template2_unopt(pArithDecoder, gbContext); + return DecodeArithTemplate2Opt3(pArithDecoder, gbContext); + return DecodeArithTemplate2Unopt(pArithDecoder, gbContext); } else { if (UseTemplate23Opt3()) - return decode_Arith_Template3_opt3(pArithDecoder, gbContext); - return decode_Arith_Template3_unopt(pArithDecoder, gbContext); + return DecodeArithTemplate3Opt3(pArithDecoder, gbContext); + return DecodeArithTemplate3Unopt(pArithDecoder, gbContext); } } -std::unique_ptr<CJBig2_Image> CJBig2_GRDProc::decode_Arith_Template0_opt3( +std::unique_ptr<CJBig2_Image> CJBig2_GRDProc::DecodeArithTemplate0Opt3( CJBig2_ArithDecoder* pArithDecoder, JBig2ArithCtx* gbContext) { auto GBREG = pdfium::MakeUnique<CJBig2_Image>(GBW, GBH); @@ -87,7 +87,7 @@ std::unique_ptr<CJBig2_Image> CJBig2_GRDProc::decode_Arith_Template0_opt3( if (pArithDecoder->IsComplete()) return nullptr; - LTP = LTP ^ pArithDecoder->DECODE(&gbContext[0x9b25]); + LTP = LTP ^ pArithDecoder->Decode(&gbContext[0x9b25]); } if (LTP) { GBREG->copyLine(h, h - 1); @@ -106,7 +106,7 @@ std::unique_ptr<CJBig2_Image> CJBig2_GRDProc::decode_Arith_Template0_opt3( if (pArithDecoder->IsComplete()) return nullptr; - int bVal = pArithDecoder->DECODE(&gbContext[CONTEXT]); + int bVal = pArithDecoder->Decode(&gbContext[CONTEXT]); cVal |= bVal << k; CONTEXT = (((CONTEXT & 0x7bf7) << 1) | bVal | ((line1 >> k) & 0x0800) | ((line2 >> k) & 0x0010)); @@ -120,7 +120,7 @@ std::unique_ptr<CJBig2_Image> CJBig2_GRDProc::decode_Arith_Template0_opt3( if (pArithDecoder->IsComplete()) return nullptr; - int bVal = pArithDecoder->DECODE(&gbContext[CONTEXT]); + int bVal = pArithDecoder->Decode(&gbContext[CONTEXT]); cVal1 |= bVal << (7 - k); CONTEXT = (((CONTEXT & 0x7bf7) << 1) | bVal | @@ -140,7 +140,7 @@ std::unique_ptr<CJBig2_Image> CJBig2_GRDProc::decode_Arith_Template0_opt3( if (pArithDecoder->IsComplete()) return nullptr; - int bVal = pArithDecoder->DECODE(&gbContext[CONTEXT]); + int bVal = pArithDecoder->Decode(&gbContext[CONTEXT]); cVal |= bVal << k; CONTEXT = (((CONTEXT & 0x7bf7) << 1) | bVal | ((line2 >> k) & 0x0010)); @@ -153,7 +153,7 @@ std::unique_ptr<CJBig2_Image> CJBig2_GRDProc::decode_Arith_Template0_opt3( if (pArithDecoder->IsComplete()) return nullptr; - int bVal = pArithDecoder->DECODE(&gbContext[CONTEXT]); + int bVal = pArithDecoder->Decode(&gbContext[CONTEXT]); cVal1 |= bVal << (7 - k); CONTEXT = (((CONTEXT & 0x7bf7) << 1) | bVal | (((line2 >> (7 - k))) & 0x0010)); @@ -166,7 +166,7 @@ std::unique_ptr<CJBig2_Image> CJBig2_GRDProc::decode_Arith_Template0_opt3( return GBREG; } -std::unique_ptr<CJBig2_Image> CJBig2_GRDProc::decode_Arith_Template0_unopt( +std::unique_ptr<CJBig2_Image> CJBig2_GRDProc::DecodeArithTemplate0Unopt( CJBig2_ArithDecoder* pArithDecoder, JBig2ArithCtx* gbContext) { int LTP = 0; @@ -177,7 +177,7 @@ std::unique_ptr<CJBig2_Image> CJBig2_GRDProc::decode_Arith_Template0_unopt( if (pArithDecoder->IsComplete()) return nullptr; - LTP = LTP ^ pArithDecoder->DECODE(&gbContext[0x9b25]); + LTP = LTP ^ pArithDecoder->Decode(&gbContext[0x9b25]); } if (LTP) { GBREG->copyLine(h, h - 1); @@ -203,7 +203,7 @@ std::unique_ptr<CJBig2_Image> CJBig2_GRDProc::decode_Arith_Template0_unopt( if (pArithDecoder->IsComplete()) return nullptr; - bVal = pArithDecoder->DECODE(&gbContext[CONTEXT]); + bVal = pArithDecoder->Decode(&gbContext[CONTEXT]); } if (bVal) { GBREG->setPixel(w, h, bVal); @@ -217,7 +217,7 @@ std::unique_ptr<CJBig2_Image> CJBig2_GRDProc::decode_Arith_Template0_unopt( return GBREG; } -std::unique_ptr<CJBig2_Image> CJBig2_GRDProc::decode_Arith_Template1_opt3( +std::unique_ptr<CJBig2_Image> CJBig2_GRDProc::DecodeArithTemplate1Opt3( CJBig2_ArithDecoder* pArithDecoder, JBig2ArithCtx* gbContext) { auto GBREG = pdfium::MakeUnique<CJBig2_Image>(GBW, GBH); @@ -235,7 +235,7 @@ std::unique_ptr<CJBig2_Image> CJBig2_GRDProc::decode_Arith_Template1_opt3( if (pArithDecoder->IsComplete()) return nullptr; - LTP = LTP ^ pArithDecoder->DECODE(&gbContext[0x0795]); + LTP = LTP ^ pArithDecoder->Decode(&gbContext[0x0795]); } if (LTP) { GBREG->copyLine(h, h - 1); @@ -254,7 +254,7 @@ std::unique_ptr<CJBig2_Image> CJBig2_GRDProc::decode_Arith_Template1_opt3( if (pArithDecoder->IsComplete()) return nullptr; - int bVal = pArithDecoder->DECODE(&gbContext[CONTEXT]); + int bVal = pArithDecoder->Decode(&gbContext[CONTEXT]); cVal |= bVal << k; CONTEXT = ((CONTEXT & 0x0efb) << 1) | bVal | ((line1 >> k) & 0x0200) | ((line2 >> (k + 1)) & 0x0008); @@ -268,7 +268,7 @@ std::unique_ptr<CJBig2_Image> CJBig2_GRDProc::decode_Arith_Template1_opt3( if (pArithDecoder->IsComplete()) return nullptr; - int bVal = pArithDecoder->DECODE(&gbContext[CONTEXT]); + int bVal = pArithDecoder->Decode(&gbContext[CONTEXT]); cVal1 |= bVal << (7 - k); CONTEXT = ((CONTEXT & 0x0efb) << 1) | bVal | ((line1 >> (7 - k)) & 0x0200) | @@ -288,7 +288,7 @@ std::unique_ptr<CJBig2_Image> CJBig2_GRDProc::decode_Arith_Template1_opt3( if (pArithDecoder->IsComplete()) return nullptr; - int bVal = pArithDecoder->DECODE(&gbContext[CONTEXT]); + int bVal = pArithDecoder->Decode(&gbContext[CONTEXT]); cVal |= bVal << k; CONTEXT = ((CONTEXT & 0x0efb) << 1) | bVal | ((line2 >> (k + 1)) & 0x0008); @@ -301,7 +301,7 @@ std::unique_ptr<CJBig2_Image> CJBig2_GRDProc::decode_Arith_Template1_opt3( if (pArithDecoder->IsComplete()) return nullptr; - int bVal = pArithDecoder->DECODE(&gbContext[CONTEXT]); + int bVal = pArithDecoder->Decode(&gbContext[CONTEXT]); cVal1 |= bVal << (7 - k); CONTEXT = ((CONTEXT & 0x0efb) << 1) | bVal | ((line2 >> (8 - k)) & 0x0008); @@ -314,7 +314,7 @@ std::unique_ptr<CJBig2_Image> CJBig2_GRDProc::decode_Arith_Template1_opt3( return GBREG; } -std::unique_ptr<CJBig2_Image> CJBig2_GRDProc::decode_Arith_Template1_unopt( +std::unique_ptr<CJBig2_Image> CJBig2_GRDProc::DecodeArithTemplate1Unopt( CJBig2_ArithDecoder* pArithDecoder, JBig2ArithCtx* gbContext) { int LTP = 0; @@ -325,7 +325,7 @@ std::unique_ptr<CJBig2_Image> CJBig2_GRDProc::decode_Arith_Template1_unopt( if (pArithDecoder->IsComplete()) return nullptr; - LTP = LTP ^ pArithDecoder->DECODE(&gbContext[0x0795]); + LTP = LTP ^ pArithDecoder->Decode(&gbContext[0x0795]); } if (LTP) { GBREG->copyLine(h, h - 1); @@ -349,7 +349,7 @@ std::unique_ptr<CJBig2_Image> CJBig2_GRDProc::decode_Arith_Template1_unopt( if (pArithDecoder->IsComplete()) return nullptr; - bVal = pArithDecoder->DECODE(&gbContext[CONTEXT]); + bVal = pArithDecoder->Decode(&gbContext[CONTEXT]); } if (bVal) { GBREG->setPixel(w, h, bVal); @@ -363,7 +363,7 @@ std::unique_ptr<CJBig2_Image> CJBig2_GRDProc::decode_Arith_Template1_unopt( return GBREG; } -std::unique_ptr<CJBig2_Image> CJBig2_GRDProc::decode_Arith_Template2_opt3( +std::unique_ptr<CJBig2_Image> CJBig2_GRDProc::DecodeArithTemplate2Opt3( CJBig2_ArithDecoder* pArithDecoder, JBig2ArithCtx* gbContext) { auto GBREG = pdfium::MakeUnique<CJBig2_Image>(GBW, GBH); @@ -381,7 +381,7 @@ std::unique_ptr<CJBig2_Image> CJBig2_GRDProc::decode_Arith_Template2_opt3( if (pArithDecoder->IsComplete()) return nullptr; - LTP = LTP ^ pArithDecoder->DECODE(&gbContext[0x00e5]); + LTP = LTP ^ pArithDecoder->Decode(&gbContext[0x00e5]); } if (LTP) { GBREG->copyLine(h, h - 1); @@ -400,7 +400,7 @@ std::unique_ptr<CJBig2_Image> CJBig2_GRDProc::decode_Arith_Template2_opt3( if (pArithDecoder->IsComplete()) return nullptr; - int bVal = pArithDecoder->DECODE(&gbContext[CONTEXT]); + int bVal = pArithDecoder->Decode(&gbContext[CONTEXT]); cVal |= bVal << k; CONTEXT = ((CONTEXT & 0x01bd) << 1) | bVal | ((line1 >> k) & 0x0080) | ((line2 >> (k + 3)) & 0x0004); @@ -414,7 +414,7 @@ std::unique_ptr<CJBig2_Image> CJBig2_GRDProc::decode_Arith_Template2_opt3( if (pArithDecoder->IsComplete()) return nullptr; - int bVal = pArithDecoder->DECODE(&gbContext[CONTEXT]); + int bVal = pArithDecoder->Decode(&gbContext[CONTEXT]); cVal1 |= bVal << (7 - k); CONTEXT = ((CONTEXT & 0x01bd) << 1) | bVal | ((line1 >> (7 - k)) & 0x0080) | @@ -434,7 +434,7 @@ std::unique_ptr<CJBig2_Image> CJBig2_GRDProc::decode_Arith_Template2_opt3( if (pArithDecoder->IsComplete()) return nullptr; - int bVal = pArithDecoder->DECODE(&gbContext[CONTEXT]); + int bVal = pArithDecoder->Decode(&gbContext[CONTEXT]); cVal |= bVal << k; CONTEXT = ((CONTEXT & 0x01bd) << 1) | bVal | ((line2 >> (k + 3)) & 0x0004); @@ -447,7 +447,7 @@ std::unique_ptr<CJBig2_Image> CJBig2_GRDProc::decode_Arith_Template2_opt3( if (pArithDecoder->IsComplete()) return nullptr; - int bVal = pArithDecoder->DECODE(&gbContext[CONTEXT]); + int bVal = pArithDecoder->Decode(&gbContext[CONTEXT]); cVal1 |= bVal << (7 - k); CONTEXT = ((CONTEXT & 0x01bd) << 1) | bVal | (((line2 >> (10 - k))) & 0x0004); @@ -460,7 +460,7 @@ std::unique_ptr<CJBig2_Image> CJBig2_GRDProc::decode_Arith_Template2_opt3( return GBREG; } -std::unique_ptr<CJBig2_Image> CJBig2_GRDProc::decode_Arith_Template2_unopt( +std::unique_ptr<CJBig2_Image> CJBig2_GRDProc::DecodeArithTemplate2Unopt( CJBig2_ArithDecoder* pArithDecoder, JBig2ArithCtx* gbContext) { int LTP = 0; @@ -471,7 +471,7 @@ std::unique_ptr<CJBig2_Image> CJBig2_GRDProc::decode_Arith_Template2_unopt( if (pArithDecoder->IsComplete()) return nullptr; - LTP = LTP ^ pArithDecoder->DECODE(&gbContext[0x00e5]); + LTP = LTP ^ pArithDecoder->Decode(&gbContext[0x00e5]); } if (LTP) { GBREG->copyLine(h, h - 1); @@ -493,7 +493,7 @@ std::unique_ptr<CJBig2_Image> CJBig2_GRDProc::decode_Arith_Template2_unopt( if (pArithDecoder->IsComplete()) return nullptr; - bVal = pArithDecoder->DECODE(&gbContext[CONTEXT]); + bVal = pArithDecoder->Decode(&gbContext[CONTEXT]); } if (bVal) { GBREG->setPixel(w, h, bVal); @@ -507,7 +507,7 @@ std::unique_ptr<CJBig2_Image> CJBig2_GRDProc::decode_Arith_Template2_unopt( return GBREG; } -std::unique_ptr<CJBig2_Image> CJBig2_GRDProc::decode_Arith_Template3_opt3( +std::unique_ptr<CJBig2_Image> CJBig2_GRDProc::DecodeArithTemplate3Opt3( CJBig2_ArithDecoder* pArithDecoder, JBig2ArithCtx* gbContext) { auto GBREG = pdfium::MakeUnique<CJBig2_Image>(GBW, GBH); @@ -525,7 +525,7 @@ std::unique_ptr<CJBig2_Image> CJBig2_GRDProc::decode_Arith_Template3_opt3( if (pArithDecoder->IsComplete()) return nullptr; - LTP = LTP ^ pArithDecoder->DECODE(&gbContext[0x0195]); + LTP = LTP ^ pArithDecoder->Decode(&gbContext[0x0195]); } if (LTP) { @@ -542,7 +542,7 @@ std::unique_ptr<CJBig2_Image> CJBig2_GRDProc::decode_Arith_Template3_opt3( if (pArithDecoder->IsComplete()) return nullptr; - int bVal = pArithDecoder->DECODE(&gbContext[CONTEXT]); + int bVal = pArithDecoder->Decode(&gbContext[CONTEXT]); cVal |= bVal << k; CONTEXT = ((CONTEXT & 0x01f7) << 1) | bVal | ((line1 >> (k + 1)) & 0x0010); @@ -555,7 +555,7 @@ std::unique_ptr<CJBig2_Image> CJBig2_GRDProc::decode_Arith_Template3_opt3( if (pArithDecoder->IsComplete()) return nullptr; - int bVal = pArithDecoder->DECODE(&gbContext[CONTEXT]); + int bVal = pArithDecoder->Decode(&gbContext[CONTEXT]); cVal1 |= bVal << (7 - k); CONTEXT = ((CONTEXT & 0x01f7) << 1) | bVal | ((line1 >> (8 - k)) & 0x0010); @@ -569,7 +569,7 @@ std::unique_ptr<CJBig2_Image> CJBig2_GRDProc::decode_Arith_Template3_opt3( if (pArithDecoder->IsComplete()) return nullptr; - int bVal = pArithDecoder->DECODE(&gbContext[CONTEXT]); + int bVal = pArithDecoder->Decode(&gbContext[CONTEXT]); cVal |= bVal << k; CONTEXT = ((CONTEXT & 0x01f7) << 1) | bVal; } @@ -580,7 +580,7 @@ std::unique_ptr<CJBig2_Image> CJBig2_GRDProc::decode_Arith_Template3_opt3( if (pArithDecoder->IsComplete()) return nullptr; - int bVal = pArithDecoder->DECODE(&gbContext[CONTEXT]); + int bVal = pArithDecoder->Decode(&gbContext[CONTEXT]); cVal1 |= bVal << (7 - k); CONTEXT = ((CONTEXT & 0x01f7) << 1) | bVal; } @@ -592,7 +592,7 @@ std::unique_ptr<CJBig2_Image> CJBig2_GRDProc::decode_Arith_Template3_opt3( return GBREG; } -std::unique_ptr<CJBig2_Image> CJBig2_GRDProc::decode_Arith_Template3_unopt( +std::unique_ptr<CJBig2_Image> CJBig2_GRDProc::DecodeArithTemplate3Unopt( CJBig2_ArithDecoder* pArithDecoder, JBig2ArithCtx* gbContext) { int LTP = 0; @@ -603,7 +603,7 @@ std::unique_ptr<CJBig2_Image> CJBig2_GRDProc::decode_Arith_Template3_unopt( if (pArithDecoder->IsComplete()) return nullptr; - LTP = LTP ^ pArithDecoder->DECODE(&gbContext[0x0195]); + LTP = LTP ^ pArithDecoder->Decode(&gbContext[0x0195]); } if (LTP == 1) { GBREG->copyLine(h, h - 1); @@ -622,7 +622,7 @@ std::unique_ptr<CJBig2_Image> CJBig2_GRDProc::decode_Arith_Template3_unopt( if (pArithDecoder->IsComplete()) return nullptr; - bVal = pArithDecoder->DECODE(&gbContext[CONTEXT]); + bVal = pArithDecoder->Decode(&gbContext[CONTEXT]); } if (bVal) { GBREG->setPixel(w, h, bVal); @@ -635,7 +635,7 @@ std::unique_ptr<CJBig2_Image> CJBig2_GRDProc::decode_Arith_Template3_unopt( return GBREG; } -FXCODEC_STATUS CJBig2_GRDProc::Start_decode_Arith( +FXCODEC_STATUS CJBig2_GRDProc::StartDecodeArith( std::unique_ptr<CJBig2_Image>* pImage, CJBig2_ArithDecoder* pArithDecoder, JBig2ArithCtx* gbContext, @@ -659,44 +659,43 @@ FXCODEC_STATUS CJBig2_GRDProc::Start_decode_Arith( m_LTP = 0; m_pLine = nullptr; m_loopIndex = 0; - return decode_Arith(pPause, pArithDecoder); + return DecodeArith(pPause, pArithDecoder); } -FXCODEC_STATUS CJBig2_GRDProc::decode_Arith( - PauseIndicatorIface* pPause, - CJBig2_ArithDecoder* pArithDecoder) { +FXCODEC_STATUS CJBig2_GRDProc::DecodeArith(PauseIndicatorIface* pPause, + CJBig2_ArithDecoder* pArithDecoder) { int iline = m_loopIndex; if (GBTEMPLATE == 0) { if (UseTemplate0Opt3()) { - m_ProssiveStatus = decode_Arith_Template0_opt3(m_pImage, pArithDecoder, - m_gbContext, pPause); + m_ProssiveStatus = DecodeArithTemplate0Opt3(m_pImage, pArithDecoder, + m_gbContext, pPause); } else { - m_ProssiveStatus = decode_Arith_Template0_unopt(m_pImage, pArithDecoder, - m_gbContext, pPause); + m_ProssiveStatus = DecodeArithTemplate0Unopt(m_pImage, pArithDecoder, + m_gbContext, pPause); } } else if (GBTEMPLATE == 1) { if (UseTemplate1Opt3()) { - m_ProssiveStatus = decode_Arith_Template1_opt3(m_pImage, pArithDecoder, - m_gbContext, pPause); + m_ProssiveStatus = DecodeArithTemplate1Opt3(m_pImage, pArithDecoder, + m_gbContext, pPause); } else { - m_ProssiveStatus = decode_Arith_Template1_unopt(m_pImage, pArithDecoder, - m_gbContext, pPause); + m_ProssiveStatus = DecodeArithTemplate1Unopt(m_pImage, pArithDecoder, + m_gbContext, pPause); } } else if (GBTEMPLATE == 2) { if (UseTemplate23Opt3()) { - m_ProssiveStatus = decode_Arith_Template2_opt3(m_pImage, pArithDecoder, - m_gbContext, pPause); + m_ProssiveStatus = DecodeArithTemplate2Opt3(m_pImage, pArithDecoder, + m_gbContext, pPause); } else { - m_ProssiveStatus = decode_Arith_Template2_unopt(m_pImage, pArithDecoder, - m_gbContext, pPause); + m_ProssiveStatus = DecodeArithTemplate2Unopt(m_pImage, pArithDecoder, + m_gbContext, pPause); } } else { if (UseTemplate23Opt3()) { - m_ProssiveStatus = decode_Arith_Template3_opt3(m_pImage, pArithDecoder, - m_gbContext, pPause); + m_ProssiveStatus = DecodeArithTemplate3Opt3(m_pImage, pArithDecoder, + m_gbContext, pPause); } else { - m_ProssiveStatus = decode_Arith_Template3_unopt(m_pImage, pArithDecoder, - m_gbContext, pPause); + m_ProssiveStatus = DecodeArithTemplate3Unopt(m_pImage, pArithDecoder, + m_gbContext, pPause); } } m_ReplaceRect.left = 0; @@ -709,7 +708,7 @@ FXCODEC_STATUS CJBig2_GRDProc::decode_Arith( return m_ProssiveStatus; } -FXCODEC_STATUS CJBig2_GRDProc::Start_decode_MMR( +FXCODEC_STATUS CJBig2_GRDProc::StartDecodeMMR( std::unique_ptr<CJBig2_Image>* pImage, CJBig2_BitStream* pStream) { int bitpos, i; @@ -730,7 +729,7 @@ FXCODEC_STATUS CJBig2_GRDProc::Start_decode_MMR( return m_ProssiveStatus; } -FXCODEC_STATUS CJBig2_GRDProc::Continue_decode( +FXCODEC_STATUS CJBig2_GRDProc::ContinueDecode( PauseIndicatorIface* pPause, CJBig2_ArithDecoder* pArithDecoder) { if (m_ProssiveStatus != FXCODEC_STATUS_DECODE_TOBECONTINUE) @@ -740,10 +739,10 @@ FXCODEC_STATUS CJBig2_GRDProc::Continue_decode( m_ProssiveStatus = FXCODEC_STATUS_ERROR; return m_ProssiveStatus; } - return decode_Arith(pPause, pArithDecoder); + return DecodeArith(pPause, pArithDecoder); } -FXCODEC_STATUS CJBig2_GRDProc::decode_Arith_Template0_opt3( +FXCODEC_STATUS CJBig2_GRDProc::DecodeArithTemplate0Opt3( CJBig2_Image* pImage, CJBig2_ArithDecoder* pArithDecoder, JBig2ArithCtx* gbContext, @@ -761,7 +760,7 @@ FXCODEC_STATUS CJBig2_GRDProc::decode_Arith_Template0_opt3( if (pArithDecoder->IsComplete()) return FXCODEC_STATUS_ERROR; - m_LTP = m_LTP ^ pArithDecoder->DECODE(&gbContext[0x9b25]); + m_LTP = m_LTP ^ pArithDecoder->Decode(&gbContext[0x9b25]); } if (m_LTP) { pImage->copyLine(m_loopIndex, m_loopIndex - 1); @@ -780,7 +779,7 @@ FXCODEC_STATUS CJBig2_GRDProc::decode_Arith_Template0_opt3( if (pArithDecoder->IsComplete()) return FXCODEC_STATUS_ERROR; - int bVal = pArithDecoder->DECODE(&gbContext[CONTEXT]); + int bVal = pArithDecoder->Decode(&gbContext[CONTEXT]); cVal |= bVal << k; CONTEXT = (((CONTEXT & 0x7bf7) << 1) | bVal | ((line1 >> k) & 0x0800) | ((line2 >> k) & 0x0010)); @@ -794,7 +793,7 @@ FXCODEC_STATUS CJBig2_GRDProc::decode_Arith_Template0_opt3( if (pArithDecoder->IsComplete()) return FXCODEC_STATUS_ERROR; - int bVal = pArithDecoder->DECODE(&gbContext[CONTEXT]); + int bVal = pArithDecoder->Decode(&gbContext[CONTEXT]); cVal1 |= bVal << (7 - k); CONTEXT = (((CONTEXT & 0x7bf7) << 1) | bVal | @@ -814,7 +813,7 @@ FXCODEC_STATUS CJBig2_GRDProc::decode_Arith_Template0_opt3( if (pArithDecoder->IsComplete()) return FXCODEC_STATUS_ERROR; - int bVal = pArithDecoder->DECODE(&gbContext[CONTEXT]); + int bVal = pArithDecoder->Decode(&gbContext[CONTEXT]); cVal |= bVal << k; CONTEXT = (((CONTEXT & 0x7bf7) << 1) | bVal | ((line2 >> k) & 0x0010)); @@ -827,7 +826,7 @@ FXCODEC_STATUS CJBig2_GRDProc::decode_Arith_Template0_opt3( if (pArithDecoder->IsComplete()) return FXCODEC_STATUS_ERROR; - int bVal = pArithDecoder->DECODE(&gbContext[CONTEXT]); + int bVal = pArithDecoder->Decode(&gbContext[CONTEXT]); cVal1 |= bVal << (7 - k); CONTEXT = (((CONTEXT & 0x7bf7) << 1) | bVal | ((line2 >> (7 - k)) & 0x0010)); @@ -846,7 +845,7 @@ FXCODEC_STATUS CJBig2_GRDProc::decode_Arith_Template0_opt3( return FXCODEC_STATUS_DECODE_FINISH; } -FXCODEC_STATUS CJBig2_GRDProc::decode_Arith_Template0_unopt( +FXCODEC_STATUS CJBig2_GRDProc::DecodeArithTemplate0Unopt( CJBig2_Image* pImage, CJBig2_ArithDecoder* pArithDecoder, JBig2ArithCtx* gbContext, @@ -856,7 +855,7 @@ FXCODEC_STATUS CJBig2_GRDProc::decode_Arith_Template0_unopt( if (pArithDecoder->IsComplete()) return FXCODEC_STATUS_ERROR; - m_LTP = m_LTP ^ pArithDecoder->DECODE(&gbContext[0x9b25]); + m_LTP = m_LTP ^ pArithDecoder->Decode(&gbContext[0x9b25]); } if (m_LTP) { pImage->copyLine(m_loopIndex, m_loopIndex - 1); @@ -882,7 +881,7 @@ FXCODEC_STATUS CJBig2_GRDProc::decode_Arith_Template0_unopt( if (pArithDecoder->IsComplete()) return FXCODEC_STATUS_ERROR; - bVal = pArithDecoder->DECODE(&gbContext[CONTEXT]); + bVal = pArithDecoder->Decode(&gbContext[CONTEXT]); } if (bVal) { pImage->setPixel(w, m_loopIndex, bVal); @@ -904,7 +903,7 @@ FXCODEC_STATUS CJBig2_GRDProc::decode_Arith_Template0_unopt( return FXCODEC_STATUS_DECODE_FINISH; } -FXCODEC_STATUS CJBig2_GRDProc::decode_Arith_Template1_opt3( +FXCODEC_STATUS CJBig2_GRDProc::DecodeArithTemplate1Opt3( CJBig2_Image* pImage, CJBig2_ArithDecoder* pArithDecoder, JBig2ArithCtx* gbContext, @@ -920,7 +919,7 @@ FXCODEC_STATUS CJBig2_GRDProc::decode_Arith_Template1_opt3( if (pArithDecoder->IsComplete()) return FXCODEC_STATUS_ERROR; - m_LTP = m_LTP ^ pArithDecoder->DECODE(&gbContext[0x0795]); + m_LTP = m_LTP ^ pArithDecoder->Decode(&gbContext[0x0795]); } if (m_LTP) { pImage->copyLine(m_loopIndex, m_loopIndex - 1); @@ -939,7 +938,7 @@ FXCODEC_STATUS CJBig2_GRDProc::decode_Arith_Template1_opt3( if (pArithDecoder->IsComplete()) return FXCODEC_STATUS_ERROR; - int bVal = pArithDecoder->DECODE(&gbContext[CONTEXT]); + int bVal = pArithDecoder->Decode(&gbContext[CONTEXT]); cVal |= bVal << k; CONTEXT = ((CONTEXT & 0x0efb) << 1) | bVal | ((line1 >> k) & 0x0200) | ((line2 >> (k + 1)) & 0x0008); @@ -953,7 +952,7 @@ FXCODEC_STATUS CJBig2_GRDProc::decode_Arith_Template1_opt3( if (pArithDecoder->IsComplete()) return FXCODEC_STATUS_ERROR; - int bVal = pArithDecoder->DECODE(&gbContext[CONTEXT]); + int bVal = pArithDecoder->Decode(&gbContext[CONTEXT]); cVal1 |= bVal << (7 - k); CONTEXT = ((CONTEXT & 0x0efb) << 1) | bVal | ((line1 >> (7 - k)) & 0x0200) | @@ -973,7 +972,7 @@ FXCODEC_STATUS CJBig2_GRDProc::decode_Arith_Template1_opt3( if (pArithDecoder->IsComplete()) return FXCODEC_STATUS_ERROR; - int bVal = pArithDecoder->DECODE(&gbContext[CONTEXT]); + int bVal = pArithDecoder->Decode(&gbContext[CONTEXT]); cVal |= bVal << k; CONTEXT = ((CONTEXT & 0x0efb) << 1) | bVal | ((line2 >> (k + 1)) & 0x0008); @@ -986,7 +985,7 @@ FXCODEC_STATUS CJBig2_GRDProc::decode_Arith_Template1_opt3( if (pArithDecoder->IsComplete()) return FXCODEC_STATUS_ERROR; - int bVal = pArithDecoder->DECODE(&gbContext[CONTEXT]); + int bVal = pArithDecoder->Decode(&gbContext[CONTEXT]); cVal1 |= bVal << (7 - k); CONTEXT = ((CONTEXT & 0x0efb) << 1) | bVal | ((line2 >> (8 - k)) & 0x0008); @@ -1005,7 +1004,7 @@ FXCODEC_STATUS CJBig2_GRDProc::decode_Arith_Template1_opt3( return FXCODEC_STATUS_DECODE_FINISH; } -FXCODEC_STATUS CJBig2_GRDProc::decode_Arith_Template1_unopt( +FXCODEC_STATUS CJBig2_GRDProc::DecodeArithTemplate1Unopt( CJBig2_Image* pImage, CJBig2_ArithDecoder* pArithDecoder, JBig2ArithCtx* gbContext, @@ -1015,7 +1014,7 @@ FXCODEC_STATUS CJBig2_GRDProc::decode_Arith_Template1_unopt( if (pArithDecoder->IsComplete()) return FXCODEC_STATUS_ERROR; - m_LTP = m_LTP ^ pArithDecoder->DECODE(&gbContext[0x0795]); + m_LTP = m_LTP ^ pArithDecoder->Decode(&gbContext[0x0795]); } if (m_LTP) { pImage->copyLine(h, h - 1); @@ -1039,7 +1038,7 @@ FXCODEC_STATUS CJBig2_GRDProc::decode_Arith_Template1_unopt( if (pArithDecoder->IsComplete()) return FXCODEC_STATUS_ERROR; - bVal = pArithDecoder->DECODE(&gbContext[CONTEXT]); + bVal = pArithDecoder->Decode(&gbContext[CONTEXT]); } if (bVal) { pImage->setPixel(w, h, bVal); @@ -1059,7 +1058,7 @@ FXCODEC_STATUS CJBig2_GRDProc::decode_Arith_Template1_unopt( return FXCODEC_STATUS_DECODE_FINISH; } -FXCODEC_STATUS CJBig2_GRDProc::decode_Arith_Template2_opt3( +FXCODEC_STATUS CJBig2_GRDProc::DecodeArithTemplate2Opt3( CJBig2_Image* pImage, CJBig2_ArithDecoder* pArithDecoder, JBig2ArithCtx* gbContext, @@ -1075,7 +1074,7 @@ FXCODEC_STATUS CJBig2_GRDProc::decode_Arith_Template2_opt3( if (pArithDecoder->IsComplete()) return FXCODEC_STATUS_ERROR; - m_LTP = m_LTP ^ pArithDecoder->DECODE(&gbContext[0x00e5]); + m_LTP = m_LTP ^ pArithDecoder->Decode(&gbContext[0x00e5]); } if (m_LTP) { pImage->copyLine(m_loopIndex, m_loopIndex - 1); @@ -1094,7 +1093,7 @@ FXCODEC_STATUS CJBig2_GRDProc::decode_Arith_Template2_opt3( if (pArithDecoder->IsComplete()) return FXCODEC_STATUS_ERROR; - int bVal = pArithDecoder->DECODE(&gbContext[CONTEXT]); + int bVal = pArithDecoder->Decode(&gbContext[CONTEXT]); cVal |= bVal << k; CONTEXT = ((CONTEXT & 0x01bd) << 1) | bVal | ((line1 >> k) & 0x0080) | ((line2 >> (k + 3)) & 0x0004); @@ -1108,7 +1107,7 @@ FXCODEC_STATUS CJBig2_GRDProc::decode_Arith_Template2_opt3( if (pArithDecoder->IsComplete()) return FXCODEC_STATUS_ERROR; - int bVal = pArithDecoder->DECODE(&gbContext[CONTEXT]); + int bVal = pArithDecoder->Decode(&gbContext[CONTEXT]); cVal1 |= bVal << (7 - k); CONTEXT = ((CONTEXT & 0x01bd) << 1) | bVal | ((line1 >> (7 - k)) & 0x0080) | @@ -1128,7 +1127,7 @@ FXCODEC_STATUS CJBig2_GRDProc::decode_Arith_Template2_opt3( if (pArithDecoder->IsComplete()) return FXCODEC_STATUS_ERROR; - int bVal = pArithDecoder->DECODE(&gbContext[CONTEXT]); + int bVal = pArithDecoder->Decode(&gbContext[CONTEXT]); cVal |= bVal << k; CONTEXT = ((CONTEXT & 0x01bd) << 1) | bVal | ((line2 >> (k + 3)) & 0x0004); @@ -1141,7 +1140,7 @@ FXCODEC_STATUS CJBig2_GRDProc::decode_Arith_Template2_opt3( if (pArithDecoder->IsComplete()) return FXCODEC_STATUS_ERROR; - int bVal = pArithDecoder->DECODE(&gbContext[CONTEXT]); + int bVal = pArithDecoder->Decode(&gbContext[CONTEXT]); cVal1 |= bVal << (7 - k); CONTEXT = ((CONTEXT & 0x01bd) << 1) | bVal | (((line2 >> (10 - k))) & 0x0004); @@ -1160,7 +1159,7 @@ FXCODEC_STATUS CJBig2_GRDProc::decode_Arith_Template2_opt3( return FXCODEC_STATUS_DECODE_FINISH; } -FXCODEC_STATUS CJBig2_GRDProc::decode_Arith_Template2_unopt( +FXCODEC_STATUS CJBig2_GRDProc::DecodeArithTemplate2Unopt( CJBig2_Image* pImage, CJBig2_ArithDecoder* pArithDecoder, JBig2ArithCtx* gbContext, @@ -1170,7 +1169,7 @@ FXCODEC_STATUS CJBig2_GRDProc::decode_Arith_Template2_unopt( if (pArithDecoder->IsComplete()) return FXCODEC_STATUS_ERROR; - m_LTP = m_LTP ^ pArithDecoder->DECODE(&gbContext[0x00e5]); + m_LTP = m_LTP ^ pArithDecoder->Decode(&gbContext[0x00e5]); } if (m_LTP) { pImage->copyLine(m_loopIndex, m_loopIndex - 1); @@ -1192,7 +1191,7 @@ FXCODEC_STATUS CJBig2_GRDProc::decode_Arith_Template2_unopt( if (pArithDecoder->IsComplete()) return FXCODEC_STATUS_ERROR; - bVal = pArithDecoder->DECODE(&gbContext[CONTEXT]); + bVal = pArithDecoder->Decode(&gbContext[CONTEXT]); } if (bVal) { pImage->setPixel(w, m_loopIndex, bVal); @@ -1214,7 +1213,7 @@ FXCODEC_STATUS CJBig2_GRDProc::decode_Arith_Template2_unopt( return FXCODEC_STATUS_DECODE_FINISH; } -FXCODEC_STATUS CJBig2_GRDProc::decode_Arith_Template3_opt3( +FXCODEC_STATUS CJBig2_GRDProc::DecodeArithTemplate3Opt3( CJBig2_Image* pImage, CJBig2_ArithDecoder* pArithDecoder, JBig2ArithCtx* gbContext, @@ -1229,7 +1228,7 @@ FXCODEC_STATUS CJBig2_GRDProc::decode_Arith_Template3_opt3( if (pArithDecoder->IsComplete()) return FXCODEC_STATUS_ERROR; - m_LTP = m_LTP ^ pArithDecoder->DECODE(&gbContext[0x0195]); + m_LTP = m_LTP ^ pArithDecoder->Decode(&gbContext[0x0195]); } if (m_LTP) { pImage->copyLine(m_loopIndex, m_loopIndex - 1); @@ -1245,7 +1244,7 @@ FXCODEC_STATUS CJBig2_GRDProc::decode_Arith_Template3_opt3( if (pArithDecoder->IsComplete()) return FXCODEC_STATUS_ERROR; - int bVal = pArithDecoder->DECODE(&gbContext[CONTEXT]); + int bVal = pArithDecoder->Decode(&gbContext[CONTEXT]); cVal |= bVal << k; CONTEXT = ((CONTEXT & 0x01f7) << 1) | bVal | ((line1 >> (k + 1)) & 0x0010); @@ -1258,7 +1257,7 @@ FXCODEC_STATUS CJBig2_GRDProc::decode_Arith_Template3_opt3( if (pArithDecoder->IsComplete()) return FXCODEC_STATUS_ERROR; - int bVal = pArithDecoder->DECODE(&gbContext[CONTEXT]); + int bVal = pArithDecoder->Decode(&gbContext[CONTEXT]); cVal1 |= bVal << (7 - k); CONTEXT = ((CONTEXT & 0x01f7) << 1) | bVal | ((line1 >> (8 - k)) & 0x0010); @@ -1272,7 +1271,7 @@ FXCODEC_STATUS CJBig2_GRDProc::decode_Arith_Template3_opt3( if (pArithDecoder->IsComplete()) return FXCODEC_STATUS_ERROR; - int bVal = pArithDecoder->DECODE(&gbContext[CONTEXT]); + int bVal = pArithDecoder->Decode(&gbContext[CONTEXT]); cVal |= bVal << k; CONTEXT = ((CONTEXT & 0x01f7) << 1) | bVal; } @@ -1283,7 +1282,7 @@ FXCODEC_STATUS CJBig2_GRDProc::decode_Arith_Template3_opt3( if (pArithDecoder->IsComplete()) return FXCODEC_STATUS_ERROR; - int bVal = pArithDecoder->DECODE(&gbContext[CONTEXT]); + int bVal = pArithDecoder->Decode(&gbContext[CONTEXT]); cVal1 |= bVal << (7 - k); CONTEXT = ((CONTEXT & 0x01f7) << 1) | bVal; } @@ -1301,7 +1300,7 @@ FXCODEC_STATUS CJBig2_GRDProc::decode_Arith_Template3_opt3( return FXCODEC_STATUS_DECODE_FINISH; } -FXCODEC_STATUS CJBig2_GRDProc::decode_Arith_Template3_unopt( +FXCODEC_STATUS CJBig2_GRDProc::DecodeArithTemplate3Unopt( CJBig2_Image* pImage, CJBig2_ArithDecoder* pArithDecoder, JBig2ArithCtx* gbContext, @@ -1311,7 +1310,7 @@ FXCODEC_STATUS CJBig2_GRDProc::decode_Arith_Template3_unopt( if (pArithDecoder->IsComplete()) return FXCODEC_STATUS_ERROR; - m_LTP = m_LTP ^ pArithDecoder->DECODE(&gbContext[0x0195]); + m_LTP = m_LTP ^ pArithDecoder->Decode(&gbContext[0x0195]); } if (m_LTP) { pImage->copyLine(m_loopIndex, m_loopIndex - 1); @@ -1330,7 +1329,7 @@ FXCODEC_STATUS CJBig2_GRDProc::decode_Arith_Template3_unopt( if (pArithDecoder->IsComplete()) return FXCODEC_STATUS_ERROR; - bVal = pArithDecoder->DECODE(&gbContext[CONTEXT]); + bVal = pArithDecoder->Decode(&gbContext[CONTEXT]); } if (bVal) { pImage->setPixel(w, m_loopIndex, bVal); diff --git a/core/fxcodec/jbig2/JBig2_GrdProc.h b/core/fxcodec/jbig2/JBig2_GrdProc.h index a8329f9a00..623f8cf24b 100644 --- a/core/fxcodec/jbig2/JBig2_GrdProc.h +++ b/core/fxcodec/jbig2/JBig2_GrdProc.h @@ -25,17 +25,17 @@ class CJBig2_GRDProc { CJBig2_GRDProc(); ~CJBig2_GRDProc(); - std::unique_ptr<CJBig2_Image> decode_Arith(CJBig2_ArithDecoder* pArithDecoder, - JBig2ArithCtx* gbContext); - - FXCODEC_STATUS Start_decode_Arith(std::unique_ptr<CJBig2_Image>* pImage, - CJBig2_ArithDecoder* pArithDecoder, - JBig2ArithCtx* gbContext, - PauseIndicatorIface* pPause); - FXCODEC_STATUS Start_decode_MMR(std::unique_ptr<CJBig2_Image>* pImage, - CJBig2_BitStream* pStream); - FXCODEC_STATUS Continue_decode(PauseIndicatorIface* pPause, - CJBig2_ArithDecoder* pArithDecoder); + 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 StartDecodeMMR(std::unique_ptr<CJBig2_Image>* pImage, + CJBig2_BitStream* pStream); + FXCODEC_STATUS ContinueDecode(PauseIndicatorIface* pPause, + CJBig2_ArithDecoder* pArithDecoder); FX_RECT GetReplaceRect() const { return m_ReplaceRect; } bool MMR; @@ -52,73 +52,70 @@ class CJBig2_GRDProc { bool UseTemplate1Opt3() const; bool UseTemplate23Opt3() const; - FXCODEC_STATUS decode_Arith(PauseIndicatorIface* pPause, - CJBig2_ArithDecoder* pArithDecoder); - FXCODEC_STATUS decode_Arith_Template0_opt3(CJBig2_Image* pImage, - CJBig2_ArithDecoder* pArithDecoder, - JBig2ArithCtx* gbContext, - PauseIndicatorIface* pPause); - FXCODEC_STATUS decode_Arith_Template0_unopt( - CJBig2_Image* pImage, - CJBig2_ArithDecoder* pArithDecoder, - JBig2ArithCtx* gbContext, - PauseIndicatorIface* pPause); - FXCODEC_STATUS decode_Arith_Template1_opt3(CJBig2_Image* pImage, - CJBig2_ArithDecoder* pArithDecoder, - JBig2ArithCtx* gbContext, - PauseIndicatorIface* pPause); - FXCODEC_STATUS decode_Arith_Template1_unopt( - CJBig2_Image* pImage, - CJBig2_ArithDecoder* pArithDecoder, - JBig2ArithCtx* gbContext, - PauseIndicatorIface* pPause); - FXCODEC_STATUS decode_Arith_Template2_opt3(CJBig2_Image* pImage, - CJBig2_ArithDecoder* pArithDecoder, - JBig2ArithCtx* gbContext, - PauseIndicatorIface* pPause); - FXCODEC_STATUS decode_Arith_Template2_unopt( - CJBig2_Image* pImage, - CJBig2_ArithDecoder* pArithDecoder, - JBig2ArithCtx* gbContext, - PauseIndicatorIface* pPause); - FXCODEC_STATUS decode_Arith_Template3_opt3(CJBig2_Image* pImage, - CJBig2_ArithDecoder* pArithDecoder, - JBig2ArithCtx* gbContext, - PauseIndicatorIface* pPause); - FXCODEC_STATUS decode_Arith_Template3_unopt( - CJBig2_Image* pImage, - CJBig2_ArithDecoder* pArithDecoder, - JBig2ArithCtx* gbContext, - PauseIndicatorIface* pPause); - std::unique_ptr<CJBig2_Image> decode_Arith_Template0_opt3( + FXCODEC_STATUS DecodeArith(PauseIndicatorIface* pPause, + CJBig2_ArithDecoder* pArithDecoder); + FXCODEC_STATUS DecodeArithTemplate0Opt3(CJBig2_Image* pImage, + CJBig2_ArithDecoder* pArithDecoder, + JBig2ArithCtx* gbContext, + PauseIndicatorIface* pPause); + FXCODEC_STATUS DecodeArithTemplate0Unopt(CJBig2_Image* pImage, + CJBig2_ArithDecoder* pArithDecoder, + JBig2ArithCtx* gbContext, + PauseIndicatorIface* pPause); + FXCODEC_STATUS DecodeArithTemplate1Opt3(CJBig2_Image* pImage, + CJBig2_ArithDecoder* pArithDecoder, + JBig2ArithCtx* gbContext, + PauseIndicatorIface* pPause); + FXCODEC_STATUS DecodeArithTemplate1Unopt(CJBig2_Image* pImage, + CJBig2_ArithDecoder* pArithDecoder, + JBig2ArithCtx* gbContext, + PauseIndicatorIface* pPause); + FXCODEC_STATUS DecodeArithTemplate2Opt3(CJBig2_Image* pImage, + CJBig2_ArithDecoder* pArithDecoder, + JBig2ArithCtx* gbContext, + PauseIndicatorIface* pPause); + FXCODEC_STATUS DecodeArithTemplate2Unopt(CJBig2_Image* pImage, + CJBig2_ArithDecoder* pArithDecoder, + JBig2ArithCtx* gbContext, + PauseIndicatorIface* pPause); + FXCODEC_STATUS DecodeArithTemplate3Opt3(CJBig2_Image* pImage, + CJBig2_ArithDecoder* pArithDecoder, + JBig2ArithCtx* gbContext, + PauseIndicatorIface* pPause); + FXCODEC_STATUS DecodeArithTemplate3Unopt(CJBig2_Image* pImage, + CJBig2_ArithDecoder* pArithDecoder, + JBig2ArithCtx* gbContext, + PauseIndicatorIface* pPause); + + std::unique_ptr<CJBig2_Image> DecodeArithTemplate0Opt3( CJBig2_ArithDecoder* pArithDecoder, JBig2ArithCtx* gbContext); - std::unique_ptr<CJBig2_Image> decode_Arith_Template0_unopt( + std::unique_ptr<CJBig2_Image> DecodeArithTemplate0Unopt( CJBig2_ArithDecoder* pArithDecoder, JBig2ArithCtx* gbContext); - std::unique_ptr<CJBig2_Image> decode_Arith_Template1_opt3( + std::unique_ptr<CJBig2_Image> DecodeArithTemplate1Opt3( CJBig2_ArithDecoder* pArithDecoder, JBig2ArithCtx* gbContext); - std::unique_ptr<CJBig2_Image> decode_Arith_Template1_unopt( + std::unique_ptr<CJBig2_Image> DecodeArithTemplate1Unopt( CJBig2_ArithDecoder* pArithDecoder, JBig2ArithCtx* gbContext); - std::unique_ptr<CJBig2_Image> decode_Arith_Template2_opt3( + std::unique_ptr<CJBig2_Image> DecodeArithTemplate2Opt3( CJBig2_ArithDecoder* pArithDecoder, JBig2ArithCtx* gbContext); - std::unique_ptr<CJBig2_Image> decode_Arith_Template2_unopt( + std::unique_ptr<CJBig2_Image> DecodeArithTemplate2Unopt( CJBig2_ArithDecoder* pArithDecoder, JBig2ArithCtx* gbContext); - std::unique_ptr<CJBig2_Image> decode_Arith_Template3_opt3( + std::unique_ptr<CJBig2_Image> DecodeArithTemplate3Opt3( CJBig2_ArithDecoder* pArithDecoder, JBig2ArithCtx* gbContext); - std::unique_ptr<CJBig2_Image> decode_Arith_Template3_unopt( + std::unique_ptr<CJBig2_Image> DecodeArithTemplate3Unopt( CJBig2_ArithDecoder* pArithDecoder, JBig2ArithCtx* gbContext); diff --git a/core/fxcodec/jbig2/JBig2_GrrdProc.cpp b/core/fxcodec/jbig2/JBig2_GrrdProc.cpp index 8622090006..fa4d435a92 100644 --- a/core/fxcodec/jbig2/JBig2_GrrdProc.cpp +++ b/core/fxcodec/jbig2/JBig2_GrrdProc.cpp @@ -13,7 +13,7 @@ #include "core/fxcodec/jbig2/JBig2_Image.h" #include "third_party/base/ptr_util.h" -std::unique_ptr<CJBig2_Image> CJBig2_GRRDProc::decode( +std::unique_ptr<CJBig2_Image> CJBig2_GRRDProc::Decode( CJBig2_ArithDecoder* pArithDecoder, JBig2ArithCtx* grContext) { if (!CJBig2_Image::IsValidImageSize(GRW, GRH)) @@ -23,18 +23,18 @@ std::unique_ptr<CJBig2_Image> CJBig2_GRRDProc::decode( if ((GRAT[0] == -1) && (GRAT[1] == -1) && (GRAT[2] == -1) && (GRAT[3] == -1) && (GRREFERENCEDX == 0) && (GRW == (uint32_t)GRREFERENCE->width())) { - return decode_Template0_opt(pArithDecoder, grContext); + return DecodeTemplate0Opt(pArithDecoder, grContext); } - return decode_Template0_unopt(pArithDecoder, grContext); + return DecodeTemplate0Unopt(pArithDecoder, grContext); } if ((GRREFERENCEDX == 0) && (GRW == (uint32_t)GRREFERENCE->width())) - return decode_Template1_opt(pArithDecoder, grContext); + return DecodeTemplate1Opt(pArithDecoder, grContext); - return decode_Template1_unopt(pArithDecoder, grContext); + return DecodeTemplate1Unopt(pArithDecoder, grContext); } -std::unique_ptr<CJBig2_Image> CJBig2_GRRDProc::decode_Template0_unopt( +std::unique_ptr<CJBig2_Image> CJBig2_GRRDProc::DecodeTemplate0Unopt( CJBig2_ArithDecoder* pArithDecoder, JBig2ArithCtx* grContext) { int LTP = 0; @@ -45,7 +45,7 @@ std::unique_ptr<CJBig2_Image> CJBig2_GRRDProc::decode_Template0_unopt( if (pArithDecoder->IsComplete()) return nullptr; - LTP = LTP ^ pArithDecoder->DECODE(&grContext[0x0010]); + LTP = LTP ^ pArithDecoder->Decode(&grContext[0x0010]); } uint32_t lines[5]; lines[0] = GRREG->getPixel(1, h - 1); @@ -66,12 +66,12 @@ std::unique_ptr<CJBig2_Image> CJBig2_GRRDProc::decode_Template0_unopt( if (!LTP) { for (uint32_t w = 0; w < GRW; w++) { uint32_t CONTEXT = - decode_Template0_unopt_CalculateContext(*GRREG, lines, w, h); + DecodeTemplate0UnoptCalculateContext(*GRREG, lines, w, h); if (pArithDecoder->IsComplete()) return nullptr; - int bVal = pArithDecoder->DECODE(&grContext[CONTEXT]); - decode_Template0_unopt_SetPixel(GRREG.get(), lines, w, h, bVal); + int bVal = pArithDecoder->Decode(&grContext[CONTEXT]); + DecodeTemplate0UnoptSetPixel(GRREG.get(), lines, w, h, bVal); } } else { for (uint32_t w = 0; w < GRW; w++) { @@ -85,20 +85,20 @@ std::unique_ptr<CJBig2_Image> CJBig2_GRRDProc::decode_Template0_unopt( (bVal == GRREFERENCE->getPixel(w, h + 1)) && (bVal == GRREFERENCE->getPixel(w + 1, h + 1)))) { uint32_t CONTEXT = - decode_Template0_unopt_CalculateContext(*GRREG, lines, w, h); + DecodeTemplate0UnoptCalculateContext(*GRREG, lines, w, h); if (pArithDecoder->IsComplete()) return nullptr; - bVal = pArithDecoder->DECODE(&grContext[CONTEXT]); + bVal = pArithDecoder->Decode(&grContext[CONTEXT]); } - decode_Template0_unopt_SetPixel(GRREG.get(), lines, w, h, bVal); + DecodeTemplate0UnoptSetPixel(GRREG.get(), lines, w, h, bVal); } } } return GRREG; } -uint32_t CJBig2_GRRDProc::decode_Template0_unopt_CalculateContext( +uint32_t CJBig2_GRRDProc::DecodeTemplate0UnoptCalculateContext( const CJBig2_Image& GRREG, const uint32_t* lines, uint32_t w, @@ -115,11 +115,11 @@ uint32_t CJBig2_GRRDProc::decode_Template0_unopt_CalculateContext( return CONTEXT; } -void CJBig2_GRRDProc::decode_Template0_unopt_SetPixel(CJBig2_Image* GRREG, - uint32_t* lines, - uint32_t w, - uint32_t h, - int bVal) { +void CJBig2_GRRDProc::DecodeTemplate0UnoptSetPixel(CJBig2_Image* GRREG, + uint32_t* lines, + uint32_t w, + uint32_t h, + int bVal) { GRREG->setPixel(w, h, bVal); lines[0] = ((lines[0] << 1) | GRREG->getPixel(w + 2, h - 1)) & 0x03; lines[1] = ((lines[1] << 1) | bVal) & 0x01; @@ -134,7 +134,7 @@ void CJBig2_GRRDProc::decode_Template0_unopt_SetPixel(CJBig2_Image* GRREG, 0x07; } -std::unique_ptr<CJBig2_Image> CJBig2_GRRDProc::decode_Template0_opt( +std::unique_ptr<CJBig2_Image> CJBig2_GRRDProc::DecodeTemplate0Opt( CJBig2_ArithDecoder* pArithDecoder, JBig2ArithCtx* grContext) { if (!GRREFERENCE->data()) @@ -161,7 +161,7 @@ std::unique_ptr<CJBig2_Image> CJBig2_GRRDProc::decode_Template0_opt( if (pArithDecoder->IsComplete()) return nullptr; - LTP = LTP ^ pArithDecoder->DECODE(&grContext[0x0010]); + LTP = LTP ^ pArithDecoder->Decode(&grContext[0x0010]); } uint32_t line1 = (h > 0) ? pLine[-nStride] << 4 : 0; int32_t reference_h = h - GRREFERENCEDY; @@ -207,7 +207,7 @@ std::unique_ptr<CJBig2_Image> CJBig2_GRRDProc::decode_Template0_opt( if (pArithDecoder->IsComplete()) return nullptr; - int bVal = pArithDecoder->DECODE(&grContext[CONTEXT]); + int bVal = pArithDecoder->Decode(&grContext[CONTEXT]); cVal |= bVal << (7 - k); CONTEXT = ((CONTEXT & 0x0cdb) << 1) | (bVal << 9) | ((line1 >> (7 - k)) & 0x0400) | @@ -256,7 +256,7 @@ std::unique_ptr<CJBig2_Image> CJBig2_GRRDProc::decode_Template0_opt( if (pArithDecoder->IsComplete()) return nullptr; - bVal = pArithDecoder->DECODE(&grContext[CONTEXT]); + bVal = pArithDecoder->Decode(&grContext[CONTEXT]); } cVal |= bVal << (7 - k); CONTEXT = ((CONTEXT & 0x0cdb) << 1) | (bVal << 9) | @@ -275,7 +275,7 @@ std::unique_ptr<CJBig2_Image> CJBig2_GRRDProc::decode_Template0_opt( return GRREG; } -std::unique_ptr<CJBig2_Image> CJBig2_GRRDProc::decode_Template1_unopt( +std::unique_ptr<CJBig2_Image> CJBig2_GRRDProc::DecodeTemplate1Unopt( CJBig2_ArithDecoder* pArithDecoder, JBig2ArithCtx* grContext) { int LTP = 0; @@ -286,7 +286,7 @@ std::unique_ptr<CJBig2_Image> CJBig2_GRRDProc::decode_Template1_unopt( if (pArithDecoder->IsComplete()) return nullptr; - LTP = LTP ^ pArithDecoder->DECODE(&grContext[0x0008]); + LTP = LTP ^ pArithDecoder->Decode(&grContext[0x0008]); } if (!LTP) { uint32_t line1 = GRREG->getPixel(1, h - 1); @@ -313,7 +313,7 @@ std::unique_ptr<CJBig2_Image> CJBig2_GRRDProc::decode_Template1_unopt( if (pArithDecoder->IsComplete()) return nullptr; - int bVal = pArithDecoder->DECODE(&grContext[CONTEXT]); + int bVal = pArithDecoder->Decode(&grContext[CONTEXT]); GRREG->setPixel(w, h, bVal); line1 = ((line1 << 1) | GRREG->getPixel(w + 2, h - 1)) & 0x07; line2 = ((line2 << 1) | bVal) & 0x01; @@ -364,7 +364,7 @@ std::unique_ptr<CJBig2_Image> CJBig2_GRRDProc::decode_Template1_unopt( if (pArithDecoder->IsComplete()) return nullptr; - bVal = pArithDecoder->DECODE(&grContext[CONTEXT]); + bVal = pArithDecoder->Decode(&grContext[CONTEXT]); } GRREG->setPixel(w, h, bVal); line1 = ((line1 << 1) | GRREG->getPixel(w + 2, h - 1)) & 0x07; @@ -387,7 +387,7 @@ std::unique_ptr<CJBig2_Image> CJBig2_GRRDProc::decode_Template1_unopt( return GRREG; } -std::unique_ptr<CJBig2_Image> CJBig2_GRRDProc::decode_Template1_opt( +std::unique_ptr<CJBig2_Image> CJBig2_GRRDProc::DecodeTemplate1Opt( CJBig2_ArithDecoder* pArithDecoder, JBig2ArithCtx* grContext) { if (!GRREFERENCE->data()) @@ -415,7 +415,7 @@ std::unique_ptr<CJBig2_Image> CJBig2_GRRDProc::decode_Template1_opt( if (pArithDecoder->IsComplete()) return nullptr; - LTP = LTP ^ pArithDecoder->DECODE(&grContext[0x0008]); + LTP = LTP ^ pArithDecoder->Decode(&grContext[0x0008]); } uint32_t line1 = (h > 0) ? pLine[-nStride] << 1 : 0; int32_t reference_h = h - GRREFERENCEDY; @@ -449,7 +449,7 @@ std::unique_ptr<CJBig2_Image> CJBig2_GRRDProc::decode_Template1_opt( } uint8_t cVal = 0; for (int32_t k = 0; k < nBits; k++) { - int bVal = pArithDecoder->DECODE(&grContext[CONTEXT]); + int bVal = pArithDecoder->Decode(&grContext[CONTEXT]); cVal |= bVal << (7 - k); CONTEXT = ((CONTEXT & 0x018d) << 1) | (bVal << 6) | ((line1 >> (7 - k)) & 0x0080) | @@ -495,7 +495,7 @@ std::unique_ptr<CJBig2_Image> CJBig2_GRRDProc::decode_Template1_opt( if (pArithDecoder->IsComplete()) return nullptr; - bVal = pArithDecoder->DECODE(&grContext[CONTEXT]); + bVal = pArithDecoder->Decode(&grContext[CONTEXT]); } cVal |= bVal << (7 - k); CONTEXT = ((CONTEXT & 0x018d) << 1) | (bVal << 6) | diff --git a/core/fxcodec/jbig2/JBig2_GrrdProc.h b/core/fxcodec/jbig2/JBig2_GrrdProc.h index a9a14398fe..6ec3dd0b05 100644 --- a/core/fxcodec/jbig2/JBig2_GrrdProc.h +++ b/core/fxcodec/jbig2/JBig2_GrrdProc.h @@ -17,7 +17,7 @@ struct JBig2ArithCtx; class CJBig2_GRRDProc { public: - std::unique_ptr<CJBig2_Image> decode(CJBig2_ArithDecoder* pArithDecoder, + std::unique_ptr<CJBig2_Image> Decode(CJBig2_ArithDecoder* pArithDecoder, JBig2ArithCtx* grContext); uint32_t GRW; @@ -30,28 +30,28 @@ class CJBig2_GRRDProc { int8_t GRAT[4]; private: - std::unique_ptr<CJBig2_Image> decode_Template0_unopt( + std::unique_ptr<CJBig2_Image> DecodeTemplate0Unopt( CJBig2_ArithDecoder* pArithDecoder, JBig2ArithCtx* grContext); - uint32_t decode_Template0_unopt_CalculateContext(const CJBig2_Image& GRREG, - const uint32_t* lines, - uint32_t w, - uint32_t h) const; - void decode_Template0_unopt_SetPixel(CJBig2_Image* GRREG, - uint32_t* lines, - uint32_t w, - uint32_t h, - int bVal); - - std::unique_ptr<CJBig2_Image> decode_Template0_opt( + uint32_t DecodeTemplate0UnoptCalculateContext(const CJBig2_Image& GRREG, + const uint32_t* lines, + uint32_t w, + uint32_t h) const; + void DecodeTemplate0UnoptSetPixel(CJBig2_Image* GRREG, + uint32_t* lines, + uint32_t w, + uint32_t h, + int bVal); + + std::unique_ptr<CJBig2_Image> DecodeTemplate0Opt( CJBig2_ArithDecoder* pArithDecoder, JBig2ArithCtx* grContext); - std::unique_ptr<CJBig2_Image> decode_Template1_unopt( + std::unique_ptr<CJBig2_Image> DecodeTemplate1Unopt( CJBig2_ArithDecoder* pArithDecoder, JBig2ArithCtx* grContext); - std::unique_ptr<CJBig2_Image> decode_Template1_opt( + std::unique_ptr<CJBig2_Image> DecodeTemplate1Opt( CJBig2_ArithDecoder* pArithDecoder, JBig2ArithCtx* grContext); }; diff --git a/core/fxcodec/jbig2/JBig2_HtrdProc.cpp b/core/fxcodec/jbig2/JBig2_HtrdProc.cpp index ec692cacce..c1eaf918b5 100644 --- a/core/fxcodec/jbig2/JBig2_HtrdProc.cpp +++ b/core/fxcodec/jbig2/JBig2_HtrdProc.cpp @@ -14,7 +14,7 @@ #include "core/fxcodec/jbig2/JBig2_Image.h" #include "third_party/base/ptr_util.h" -std::unique_ptr<CJBig2_Image> CJBig2_HTRDProc::decode_Arith( +std::unique_ptr<CJBig2_Image> CJBig2_HTRDProc::DecodeArith( CJBig2_ArithDecoder* pArithDecoder, JBig2ArithCtx* gbContext, PauseIndicatorIface* pPause) { @@ -65,9 +65,9 @@ std::unique_ptr<CJBig2_Image> CJBig2_HTRDProc::decode_Arith( for (int32_t i = GSBPP - 1; i >= 0; --i) { std::unique_ptr<CJBig2_Image> pImage; FXCODEC_STATUS status = - GRD.Start_decode_Arith(&pImage, pArithDecoder, gbContext, nullptr); + GRD.StartDecodeArith(&pImage, pArithDecoder, gbContext, nullptr); while (status == FXCODEC_STATUS_DECODE_TOBECONTINUE) - status = GRD.Continue_decode(pPause, pArithDecoder); + status = GRD.ContinueDecode(pPause, pArithDecoder); if (!pImage) return nullptr; @@ -76,10 +76,10 @@ std::unique_ptr<CJBig2_Image> CJBig2_HTRDProc::decode_Arith( if (i < GSBPP - 1) GSPLANES[i]->composeFrom(0, 0, GSPLANES[i + 1].get(), JBIG2_COMPOSE_XOR); } - return decode_image(GSPLANES); + return DecodeImage(GSPLANES); } -std::unique_ptr<CJBig2_Image> CJBig2_HTRDProc::decode_MMR( +std::unique_ptr<CJBig2_Image> CJBig2_HTRDProc::DecodeMMR( CJBig2_BitStream* pStream) { uint32_t HBPP = 1; while (static_cast<uint32_t>(1 << HBPP) < HNUMPATS) @@ -92,14 +92,14 @@ std::unique_ptr<CJBig2_Image> CJBig2_HTRDProc::decode_MMR( uint8_t GSBPP = static_cast<uint8_t>(HBPP); std::vector<std::unique_ptr<CJBig2_Image>> GSPLANES(GSBPP); - GRD.Start_decode_MMR(&GSPLANES[GSBPP - 1], pStream); + GRD.StartDecodeMMR(&GSPLANES[GSBPP - 1], pStream); if (!GSPLANES[GSBPP - 1]) return nullptr; pStream->alignByte(); pStream->offset(3); for (int32_t J = GSBPP - 2; J >= 0; --J) { - GRD.Start_decode_MMR(&GSPLANES[J], pStream); + GRD.StartDecodeMMR(&GSPLANES[J], pStream); if (!GSPLANES[J]) return nullptr; @@ -107,10 +107,10 @@ std::unique_ptr<CJBig2_Image> CJBig2_HTRDProc::decode_MMR( pStream->offset(3); GSPLANES[J]->composeFrom(0, 0, GSPLANES[J + 1].get(), JBIG2_COMPOSE_XOR); } - return decode_image(GSPLANES); + return DecodeImage(GSPLANES); } -std::unique_ptr<CJBig2_Image> CJBig2_HTRDProc::decode_image( +std::unique_ptr<CJBig2_Image> CJBig2_HTRDProc::DecodeImage( const std::vector<std::unique_ptr<CJBig2_Image>>& GSPLANES) { auto HTREG = pdfium::MakeUnique<CJBig2_Image>(HBW, HBH); HTREG->fill(HDEFPIXEL); diff --git a/core/fxcodec/jbig2/JBig2_HtrdProc.h b/core/fxcodec/jbig2/JBig2_HtrdProc.h index b61a08c036..eab3f57970 100644 --- a/core/fxcodec/jbig2/JBig2_HtrdProc.h +++ b/core/fxcodec/jbig2/JBig2_HtrdProc.h @@ -20,11 +20,11 @@ struct JBig2ArithCtx; class CJBig2_HTRDProc { public: - std::unique_ptr<CJBig2_Image> decode_Arith(CJBig2_ArithDecoder* pArithDecoder, - JBig2ArithCtx* gbContext, - PauseIndicatorIface* pPause); + std::unique_ptr<CJBig2_Image> DecodeArith(CJBig2_ArithDecoder* pArithDecoder, + JBig2ArithCtx* gbContext, + PauseIndicatorIface* pPause); - std::unique_ptr<CJBig2_Image> decode_MMR(CJBig2_BitStream* pStream); + std::unique_ptr<CJBig2_Image> DecodeMMR(CJBig2_BitStream* pStream); public: uint32_t HBW; @@ -46,7 +46,7 @@ class CJBig2_HTRDProc { uint8_t HPH; private: - std::unique_ptr<CJBig2_Image> decode_image( + std::unique_ptr<CJBig2_Image> DecodeImage( const std::vector<std::unique_ptr<CJBig2_Image>>& GSPLANES); }; diff --git a/core/fxcodec/jbig2/JBig2_HuffmanDecoder.cpp b/core/fxcodec/jbig2/JBig2_HuffmanDecoder.cpp index 050b5e6074..c6dd3924b8 100644 --- a/core/fxcodec/jbig2/JBig2_HuffmanDecoder.cpp +++ b/core/fxcodec/jbig2/JBig2_HuffmanDecoder.cpp @@ -13,7 +13,7 @@ CJBig2_HuffmanDecoder::CJBig2_HuffmanDecoder(CJBig2_BitStream* pStream) CJBig2_HuffmanDecoder::~CJBig2_HuffmanDecoder() {} -int CJBig2_HuffmanDecoder::decodeAValue(CJBig2_HuffmanTable* pTable, +int CJBig2_HuffmanDecoder::DecodeAValue(CJBig2_HuffmanTable* pTable, int* nResult) { int nVal = 0; int nBits = 0; diff --git a/core/fxcodec/jbig2/JBig2_HuffmanDecoder.h b/core/fxcodec/jbig2/JBig2_HuffmanDecoder.h index ac53b4d9c0..5daf1fc812 100644 --- a/core/fxcodec/jbig2/JBig2_HuffmanDecoder.h +++ b/core/fxcodec/jbig2/JBig2_HuffmanDecoder.h @@ -14,10 +14,9 @@ class CJBig2_HuffmanDecoder { public: explicit CJBig2_HuffmanDecoder(CJBig2_BitStream* pStream); - ~CJBig2_HuffmanDecoder(); - int decodeAValue(CJBig2_HuffmanTable* pTable, int* nResult); + int DecodeAValue(CJBig2_HuffmanTable* pTable, int* nResult); private: UnownedPtr<CJBig2_BitStream> const m_pStream; diff --git a/core/fxcodec/jbig2/JBig2_HuffmanTable.h b/core/fxcodec/jbig2/JBig2_HuffmanTable.h index b49fcebc9c..4f75fba873 100644 --- a/core/fxcodec/jbig2/JBig2_HuffmanTable.h +++ b/core/fxcodec/jbig2/JBig2_HuffmanTable.h @@ -19,9 +19,7 @@ class CJBig2_HuffmanTable { CJBig2_HuffmanTable(const JBig2TableLine* pTable, uint32_t nLines, bool bHTOOB); - explicit CJBig2_HuffmanTable(CJBig2_BitStream* pStream); - ~CJBig2_HuffmanTable(); bool IsHTOOB() const { return HTOOB; } diff --git a/core/fxcodec/jbig2/JBig2_PatternDict.h b/core/fxcodec/jbig2/JBig2_PatternDict.h index ad55917d6b..ca566d08a6 100644 --- a/core/fxcodec/jbig2/JBig2_PatternDict.h +++ b/core/fxcodec/jbig2/JBig2_PatternDict.h @@ -16,7 +16,6 @@ class CJBig2_PatternDict { public: explicit CJBig2_PatternDict(uint32_t dict_size); - ~CJBig2_PatternDict(); uint32_t NUMPATS; diff --git a/core/fxcodec/jbig2/JBig2_PddProc.cpp b/core/fxcodec/jbig2/JBig2_PddProc.cpp index 68963dc584..18c50ef4cd 100644 --- a/core/fxcodec/jbig2/JBig2_PddProc.cpp +++ b/core/fxcodec/jbig2/JBig2_PddProc.cpp @@ -13,7 +13,7 @@ #include "core/fxcodec/jbig2/JBig2_PatternDict.h" #include "third_party/base/ptr_util.h" -std::unique_ptr<CJBig2_PatternDict> CJBig2_PDDProc::decode_Arith( +std::unique_ptr<CJBig2_PatternDict> CJBig2_PDDProc::DecodeArith( CJBig2_ArithDecoder* pArithDecoder, JBig2ArithCtx* gbContext, PauseIndicatorIface* pPause) { @@ -39,9 +39,9 @@ std::unique_ptr<CJBig2_PatternDict> CJBig2_PDDProc::decode_Arith( pGRD->GBAT[7] = -2; } FXCODEC_STATUS status = - pGRD->Start_decode_Arith(&BHDC, pArithDecoder, gbContext, nullptr); + pGRD->StartDecodeArith(&BHDC, pArithDecoder, gbContext, nullptr); while (status == FXCODEC_STATUS_DECODE_TOBECONTINUE) - status = pGRD->Continue_decode(pPause, pArithDecoder); + status = pGRD->ContinueDecode(pPause, pArithDecoder); if (!BHDC) return nullptr; @@ -53,7 +53,7 @@ std::unique_ptr<CJBig2_PatternDict> CJBig2_PDDProc::decode_Arith( return pDict; } -std::unique_ptr<CJBig2_PatternDict> CJBig2_PDDProc::decode_MMR( +std::unique_ptr<CJBig2_PatternDict> CJBig2_PDDProc::DecodeMMR( CJBig2_BitStream* pStream) { uint32_t GRAY; std::unique_ptr<CJBig2_Image> BHDC; @@ -63,7 +63,7 @@ std::unique_ptr<CJBig2_PatternDict> CJBig2_PDDProc::decode_MMR( pGRD->MMR = HDMMR; pGRD->GBW = (GRAYMAX + 1) * HDPW; pGRD->GBH = HDPH; - pGRD->Start_decode_MMR(&BHDC, pStream); + pGRD->StartDecodeMMR(&BHDC, pStream); if (!BHDC) return nullptr; diff --git a/core/fxcodec/jbig2/JBig2_PddProc.h b/core/fxcodec/jbig2/JBig2_PddProc.h index 0d6776cc1c..b9f4d81cf8 100644 --- a/core/fxcodec/jbig2/JBig2_PddProc.h +++ b/core/fxcodec/jbig2/JBig2_PddProc.h @@ -19,12 +19,12 @@ struct JBig2ArithCtx; class CJBig2_PDDProc { public: - std::unique_ptr<CJBig2_PatternDict> decode_Arith( + std::unique_ptr<CJBig2_PatternDict> DecodeArith( CJBig2_ArithDecoder* pArithDecoder, JBig2ArithCtx* gbContext, PauseIndicatorIface* pPause); - std::unique_ptr<CJBig2_PatternDict> decode_MMR(CJBig2_BitStream* pStream); + std::unique_ptr<CJBig2_PatternDict> DecodeMMR(CJBig2_BitStream* pStream); public: bool HDMMR; diff --git a/core/fxcodec/jbig2/JBig2_SddProc.cpp b/core/fxcodec/jbig2/JBig2_SddProc.cpp index a446dbc6c0..3677076ab2 100644 --- a/core/fxcodec/jbig2/JBig2_SddProc.cpp +++ b/core/fxcodec/jbig2/JBig2_SddProc.cpp @@ -21,7 +21,7 @@ #include "core/fxcodec/jbig2/JBig2_TrdProc.h" #include "third_party/base/ptr_util.h" -std::unique_ptr<CJBig2_SymbolDict> CJBig2_SDDProc::decode_Arith( +std::unique_ptr<CJBig2_SymbolDict> CJBig2_SDDProc::DecodeArith( CJBig2_ArithDecoder* pArithDecoder, std::vector<JBig2ArithCtx>* gbContext, std::vector<JBig2ArithCtx>* grContext) { @@ -68,7 +68,7 @@ std::unique_ptr<CJBig2_SymbolDict> CJBig2_SDDProc::decode_Arith( NSYMSDECODED = 0; while (NSYMSDECODED < SDNUMNEWSYMS) { std::unique_ptr<CJBig2_Image> BS; - IADH->decode(pArithDecoder, &HCDH); + IADH->Decode(pArithDecoder, &HCDH); HCHEIGHT = HCHEIGHT + HCDH; if ((int)HCHEIGHT < 0 || (int)HCHEIGHT > JBIG2_MAX_IMAGE_SIZE) return nullptr; @@ -76,7 +76,7 @@ std::unique_ptr<CJBig2_SymbolDict> CJBig2_SDDProc::decode_Arith( SYMWIDTH = 0; TOTWIDTH = 0; for (;;) { - if (!IADW->decode(pArithDecoder, &DW)) + if (!IADW->Decode(pArithDecoder, &DW)) break; if (NSYMSDECODED >= SDNUMNEWSYMS) @@ -109,11 +109,11 @@ std::unique_ptr<CJBig2_SymbolDict> CJBig2_SDDProc::decode_Arith( pGRD->GBAT[5] = SDAT[5]; pGRD->GBAT[6] = SDAT[6]; pGRD->GBAT[7] = SDAT[7]; - BS = pGRD->decode_Arith(pArithDecoder, gbContext->data()); + BS = pGRD->DecodeArith(pArithDecoder, gbContext->data()); if (!BS) return nullptr; } else { - IAAI->decode(pArithDecoder, (int*)&REFAGGNINST); + IAAI->Decode(pArithDecoder, (int*)&REFAGGNINST); if (REFAGGNINST > 1) { auto pDecoder = pdfium::MakeUnique<CJBig2_TRDProc>(); pDecoder->SBHUFF = SDHUFF; @@ -180,15 +180,15 @@ std::unique_ptr<CJBig2_SymbolDict> CJBig2_SDDProc::decode_Arith( ids.IARDX = IARDX.get(); ids.IARDY = IARDY.get(); ids.IAID = IAID.get(); - BS = pDecoder->decode_Arith(pArithDecoder, grContext->data(), &ids); + BS = pDecoder->DecodeArith(pArithDecoder, grContext->data(), &ids); if (!BS) return nullptr; } else if (REFAGGNINST == 1) { SBNUMSYMS = SDNUMINSYMS + NSYMSDECODED; uint32_t IDI; - IAID->decode(pArithDecoder, &IDI); - IARDX->decode(pArithDecoder, &RDXI); - IARDY->decode(pArithDecoder, &RDYI); + IAID->Decode(pArithDecoder, &IDI); + IARDX->Decode(pArithDecoder, &RDXI); + IARDY->Decode(pArithDecoder, &RDYI); if (IDI >= SBNUMSYMS) return nullptr; @@ -211,7 +211,7 @@ std::unique_ptr<CJBig2_SymbolDict> CJBig2_SDDProc::decode_Arith( pGRRD->GRAT[1] = SDRAT[1]; pGRRD->GRAT[2] = SDRAT[2]; pGRRD->GRAT[3] = SDRAT[3]; - BS = pGRRD->decode(pArithDecoder, grContext->data()); + BS = pGRRD->Decode(pArithDecoder, grContext->data()); if (!BS) return nullptr; } @@ -225,7 +225,7 @@ std::unique_ptr<CJBig2_SymbolDict> CJBig2_SDDProc::decode_Arith( EXFLAGS.resize(SDNUMINSYMS + SDNUMNEWSYMS); num_ex_syms = 0; while (EXINDEX < SDNUMINSYMS + SDNUMNEWSYMS) { - IAEX->decode(pArithDecoder, (int*)&EXRUNLENGTH); + IAEX->Decode(pArithDecoder, (int*)&EXRUNLENGTH); if (EXINDEX + EXRUNLENGTH > SDNUMINSYMS + SDNUMNEWSYMS) return nullptr; @@ -259,7 +259,7 @@ std::unique_ptr<CJBig2_SymbolDict> CJBig2_SDDProc::decode_Arith( return pDict; } -std::unique_ptr<CJBig2_SymbolDict> CJBig2_SDDProc::decode_Huffman( +std::unique_ptr<CJBig2_SymbolDict> CJBig2_SDDProc::DecodeHuffman( CJBig2_BitStream* pStream, std::vector<JBig2ArithCtx>* gbContext, std::vector<JBig2ArithCtx>* grContext) { @@ -296,7 +296,7 @@ std::unique_ptr<CJBig2_SymbolDict> CJBig2_SDDProc::decode_Huffman( NSYMSDECODED = 0; std::unique_ptr<CJBig2_Image> BS; while (NSYMSDECODED < SDNUMNEWSYMS) { - if (pHuffmanDecoder->decodeAValue(SDHUFFDH, &HCDH) != 0) + if (pHuffmanDecoder->DecodeAValue(SDHUFFDH, &HCDH) != 0) return nullptr; HCHEIGHT = HCHEIGHT + HCDH; @@ -307,7 +307,7 @@ std::unique_ptr<CJBig2_SymbolDict> CJBig2_SDDProc::decode_Huffman( TOTWIDTH = 0; HCFIRSTSYM = NSYMSDECODED; for (;;) { - nVal = pHuffmanDecoder->decodeAValue(SDHUFFDW, &DW); + nVal = pHuffmanDecoder->DecodeAValue(SDHUFFDW, &DW); if (nVal == JBIG2_OOB) break; if (nVal != 0) @@ -326,7 +326,7 @@ std::unique_ptr<CJBig2_SymbolDict> CJBig2_SDDProc::decode_Huffman( } TOTWIDTH = TOTWIDTH + SYMWIDTH; if (SDREFAGG == 1) { - if (pHuffmanDecoder->decodeAValue(SDHUFFAGGINST, (int*)&REFAGGNINST) != + if (pHuffmanDecoder->DecodeAValue(SDHUFFAGGINST, (int*)&REFAGGNINST) != 0) { return nullptr; } @@ -389,7 +389,7 @@ std::unique_ptr<CJBig2_SymbolDict> CJBig2_SDDProc::decode_Huffman( pDecoder->SBRAT[1] = SDRAT[1]; pDecoder->SBRAT[2] = SDRAT[2]; pDecoder->SBRAT[3] = SDRAT[3]; - BS = pDecoder->decode_Huffman(pStream, grContext->data()); + BS = pDecoder->DecodeHuffman(pStream, grContext->data()); if (!BS) return nullptr; @@ -417,9 +417,9 @@ std::unique_ptr<CJBig2_SymbolDict> CJBig2_SDDProc::decode_Huffman( HuffmanTable_B15, HuffmanTable_B15_Size, HuffmanTable_HTOOB_B15); auto SBHUFFRSIZE = pdfium::MakeUnique<CJBig2_HuffmanTable>( HuffmanTable_B1, HuffmanTable_B1_Size, HuffmanTable_HTOOB_B1); - if ((pHuffmanDecoder->decodeAValue(SBHUFFRDX.get(), &RDXI) != 0) || - (pHuffmanDecoder->decodeAValue(SBHUFFRDX.get(), &RDYI) != 0) || - (pHuffmanDecoder->decodeAValue(SBHUFFRSIZE.get(), &nVal) != 0)) { + if ((pHuffmanDecoder->DecodeAValue(SBHUFFRDX.get(), &RDXI) != 0) || + (pHuffmanDecoder->DecodeAValue(SBHUFFRDX.get(), &RDYI) != 0) || + (pHuffmanDecoder->DecodeAValue(SBHUFFRSIZE.get(), &nVal) != 0)) { return nullptr; } pStream->alignByte(); @@ -441,7 +441,7 @@ std::unique_ptr<CJBig2_SymbolDict> CJBig2_SDDProc::decode_Huffman( pGRRD->GRAT[2] = SDRAT[2]; pGRRD->GRAT[3] = SDRAT[3]; auto pArithDecoder = pdfium::MakeUnique<CJBig2_ArithDecoder>(pStream); - BS = pGRRD->decode(pArithDecoder.get(), grContext->data()); + BS = pGRRD->Decode(pArithDecoder.get(), grContext->data()); if (!BS) return nullptr; @@ -457,7 +457,7 @@ std::unique_ptr<CJBig2_SymbolDict> CJBig2_SDDProc::decode_Huffman( NSYMSDECODED = NSYMSDECODED + 1; } if (SDREFAGG == 0) { - if (pHuffmanDecoder->decodeAValue(SDHUFFBMSIZE, (int32_t*)&BMSIZE) != 0) + if (pHuffmanDecoder->DecodeAValue(SDHUFFBMSIZE, (int32_t*)&BMSIZE) != 0) return nullptr; pStream->alignByte(); @@ -479,7 +479,7 @@ std::unique_ptr<CJBig2_SymbolDict> CJBig2_SDDProc::decode_Huffman( pGRD->MMR = 1; pGRD->GBW = TOTWIDTH; pGRD->GBH = HCHEIGHT; - pGRD->Start_decode_MMR(&BHC, pStream); + pGRD->StartDecodeMMR(&BHC, pStream); pStream->alignByte(); } nTmp = 0; @@ -499,7 +499,7 @@ std::unique_ptr<CJBig2_SymbolDict> CJBig2_SDDProc::decode_Huffman( EXFLAGS.resize(SDNUMINSYMS + SDNUMNEWSYMS); num_ex_syms = 0; while (EXINDEX < SDNUMINSYMS + SDNUMNEWSYMS) { - if (pHuffmanDecoder->decodeAValue(pTable.get(), (int*)&EXRUNLENGTH) != 0) + if (pHuffmanDecoder->DecodeAValue(pTable.get(), (int*)&EXRUNLENGTH) != 0) return nullptr; if (EXINDEX + EXRUNLENGTH > SDNUMINSYMS + SDNUMNEWSYMS) diff --git a/core/fxcodec/jbig2/JBig2_SddProc.h b/core/fxcodec/jbig2/JBig2_SddProc.h index 80b988ef98..672c2c3e6a 100644 --- a/core/fxcodec/jbig2/JBig2_SddProc.h +++ b/core/fxcodec/jbig2/JBig2_SddProc.h @@ -20,12 +20,12 @@ class CJBig2_SymbolDict; class CJBig2_SDDProc { public: - std::unique_ptr<CJBig2_SymbolDict> decode_Arith( + std::unique_ptr<CJBig2_SymbolDict> DecodeArith( CJBig2_ArithDecoder* pArithDecoder, std::vector<JBig2ArithCtx>* gbContext, std::vector<JBig2ArithCtx>* grContext); - std::unique_ptr<CJBig2_SymbolDict> decode_Huffman( + std::unique_ptr<CJBig2_SymbolDict> DecodeHuffman( CJBig2_BitStream* pStream, std::vector<JBig2ArithCtx>* gbContext, std::vector<JBig2ArithCtx>* grContext); diff --git a/core/fxcodec/jbig2/JBig2_Segment.h b/core/fxcodec/jbig2/JBig2_Segment.h index 914115b522..45e2a3dd00 100644 --- a/core/fxcodec/jbig2/JBig2_Segment.h +++ b/core/fxcodec/jbig2/JBig2_Segment.h @@ -15,24 +15,25 @@ #include "core/fxcodec/jbig2/JBig2_PatternDict.h" #include "core/fxcodec/jbig2/JBig2_SymbolDict.h" -typedef enum { +enum JBig2_SegmentState { JBIG2_SEGMENT_HEADER_UNPARSED, JBIG2_SEGMENT_DATA_UNPARSED, JBIG2_SEGMENT_PARSE_COMPLETE, JBIG2_SEGMENT_PAUSED, JBIG2_SEGMENT_ERROR -} JBig2_SegmentState; -typedef enum { +}; + +enum JBig2_ResultType { JBIG2_VOID_POINTER = 0, JBIG2_IMAGE_POINTER, JBIG2_SYMBOL_DICT_POINTER, JBIG2_PATTERN_DICT_POINTER, JBIG2_HUFFMAN_TABLE_POINTER -} JBig2_ResultType; +}; + class CJBig2_Segment { public: CJBig2_Segment(); - ~CJBig2_Segment(); uint32_t m_dwNumber; diff --git a/core/fxcodec/jbig2/JBig2_SymbolDict.h b/core/fxcodec/jbig2/JBig2_SymbolDict.h index 49289fb650..83c419637a 100644 --- a/core/fxcodec/jbig2/JBig2_SymbolDict.h +++ b/core/fxcodec/jbig2/JBig2_SymbolDict.h @@ -22,7 +22,6 @@ class CJBig2_SymbolDict { std::unique_ptr<CJBig2_SymbolDict> DeepCopy() const; - // Takes ownership of |image|. void AddImage(std::unique_ptr<CJBig2_Image> image) { m_SDEXSYMS.push_back(std::move(image)); } diff --git a/core/fxcodec/jbig2/JBig2_TrdProc.cpp b/core/fxcodec/jbig2/JBig2_TrdProc.cpp index 332e5868ac..140d948956 100644 --- a/core/fxcodec/jbig2/JBig2_TrdProc.cpp +++ b/core/fxcodec/jbig2/JBig2_TrdProc.cpp @@ -19,14 +19,14 @@ CJBig2_TRDProc::CJBig2_TRDProc() {} CJBig2_TRDProc::~CJBig2_TRDProc() {} -std::unique_ptr<CJBig2_Image> CJBig2_TRDProc::decode_Huffman( +std::unique_ptr<CJBig2_Image> CJBig2_TRDProc::DecodeHuffman( CJBig2_BitStream* pStream, JBig2ArithCtx* grContext) { auto pHuffmanDecoder = pdfium::MakeUnique<CJBig2_HuffmanDecoder>(pStream); auto SBREG = pdfium::MakeUnique<CJBig2_Image>(SBW, SBH); SBREG->fill(SBDEFPIXEL); int32_t INITIAL_STRIPT; - if (pHuffmanDecoder->decodeAValue(SBHUFFDT, &INITIAL_STRIPT) != 0) + if (pHuffmanDecoder->DecodeAValue(SBHUFFDT, &INITIAL_STRIPT) != 0) return nullptr; FX_SAFE_INT32 STRIPT = INITIAL_STRIPT; @@ -36,7 +36,7 @@ std::unique_ptr<CJBig2_Image> CJBig2_TRDProc::decode_Huffman( uint32_t NINSTANCES = 0; while (NINSTANCES < SBNUMINSTANCES) { int32_t INITIAL_DT; - if (pHuffmanDecoder->decodeAValue(SBHUFFDT, &INITIAL_DT) != 0) + if (pHuffmanDecoder->DecodeAValue(SBHUFFDT, &INITIAL_DT) != 0) return nullptr; FX_SAFE_INT32 DT = INITIAL_DT; @@ -47,7 +47,7 @@ std::unique_ptr<CJBig2_Image> CJBig2_TRDProc::decode_Huffman( for (;;) { if (bFirst) { int32_t DFS; - if (pHuffmanDecoder->decodeAValue(SBHUFFFS, &DFS) != 0) + if (pHuffmanDecoder->DecodeAValue(SBHUFFFS, &DFS) != 0) return nullptr; FIRSTS += DFS; @@ -55,7 +55,7 @@ std::unique_ptr<CJBig2_Image> CJBig2_TRDProc::decode_Huffman( bFirst = false; } else { int32_t IDS; - int32_t nVal = pHuffmanDecoder->decodeAValue(SBHUFFDS, &IDS); + int32_t nVal = pHuffmanDecoder->DecodeAValue(SBHUFFDS, &IDS); if (nVal == JBIG2_OOB) break; @@ -117,11 +117,11 @@ std::unique_ptr<CJBig2_Image> CJBig2_TRDProc::decode_Huffman( int32_t RDXI; int32_t RDYI; int32_t HUFFRSIZE; - if ((pHuffmanDecoder->decodeAValue(SBHUFFRDW, &RDWI) != 0) || - (pHuffmanDecoder->decodeAValue(SBHUFFRDH, &RDHI) != 0) || - (pHuffmanDecoder->decodeAValue(SBHUFFRDX, &RDXI) != 0) || - (pHuffmanDecoder->decodeAValue(SBHUFFRDY, &RDYI) != 0) || - (pHuffmanDecoder->decodeAValue(SBHUFFRSIZE, &HUFFRSIZE) != 0)) { + if ((pHuffmanDecoder->DecodeAValue(SBHUFFRDW, &RDWI) != 0) || + (pHuffmanDecoder->DecodeAValue(SBHUFFRDH, &RDHI) != 0) || + (pHuffmanDecoder->DecodeAValue(SBHUFFRDX, &RDXI) != 0) || + (pHuffmanDecoder->DecodeAValue(SBHUFFRDY, &RDYI) != 0) || + (pHuffmanDecoder->DecodeAValue(SBHUFFRSIZE, &HUFFRSIZE) != 0)) { return nullptr; } pStream->alignByte(); @@ -151,7 +151,7 @@ std::unique_ptr<CJBig2_Image> CJBig2_TRDProc::decode_Huffman( pGRRD->GRAT[3] = SBRAT[3]; auto pArithDecoder = pdfium::MakeUnique<CJBig2_ArithDecoder>(pStream); - IBI = pGRRD->decode(pArithDecoder.get(), grContext); + IBI = pGRRD->Decode(pArithDecoder.get(), grContext); if (!IBI) return nullptr; @@ -220,7 +220,7 @@ std::unique_ptr<CJBig2_Image> CJBig2_TRDProc::decode_Huffman( return SBREG; } -std::unique_ptr<CJBig2_Image> CJBig2_TRDProc::decode_Arith( +std::unique_ptr<CJBig2_Image> CJBig2_TRDProc::DecodeArith( CJBig2_ArithDecoder* pArithDecoder, JBig2ArithCtx* grContext, JBig2IntDecoderState* pIDS) { @@ -260,7 +260,7 @@ std::unique_ptr<CJBig2_Image> CJBig2_TRDProc::decode_Arith( auto SBREG = pdfium::MakeUnique<CJBig2_Image>(SBW, SBH); SBREG->fill(SBDEFPIXEL); int32_t INITIAL_STRIPT; - if (!pIADT->decode(pArithDecoder, &INITIAL_STRIPT)) + if (!pIADT->Decode(pArithDecoder, &INITIAL_STRIPT)) return nullptr; FX_SAFE_INT32 STRIPT = INITIAL_STRIPT; @@ -271,7 +271,7 @@ std::unique_ptr<CJBig2_Image> CJBig2_TRDProc::decode_Arith( while (NINSTANCES < SBNUMINSTANCES) { FX_SAFE_INT32 CURS = 0; int32_t INITIAL_DT; - if (!pIADT->decode(pArithDecoder, &INITIAL_DT)) + if (!pIADT->Decode(pArithDecoder, &INITIAL_DT)) return nullptr; FX_SAFE_INT32 DT = INITIAL_DT; @@ -281,13 +281,13 @@ std::unique_ptr<CJBig2_Image> CJBig2_TRDProc::decode_Arith( for (;;) { if (bFirst) { int32_t DFS; - pIAFS->decode(pArithDecoder, &DFS); + pIAFS->Decode(pArithDecoder, &DFS); FIRSTS += DFS; CURS = FIRSTS; bFirst = false; } else { int32_t IDS; - if (!pIADS->decode(pArithDecoder, &IDS)) + if (!pIADS->Decode(pArithDecoder, &IDS)) break; CURS += IDS; @@ -298,7 +298,7 @@ std::unique_ptr<CJBig2_Image> CJBig2_TRDProc::decode_Arith( int CURT = 0; if (SBSTRIPS != 1) - pIAIT->decode(pArithDecoder, &CURT); + pIAIT->Decode(pArithDecoder, &CURT); FX_SAFE_INT32 SAFE_TI = STRIPT + CURT; if (!SAFE_TI.IsValid()) @@ -306,7 +306,7 @@ std::unique_ptr<CJBig2_Image> CJBig2_TRDProc::decode_Arith( int32_t TI = SAFE_TI.ValueOrDie(); uint32_t IDI; - pIAID->decode(pArithDecoder, &IDI); + pIAID->Decode(pArithDecoder, &IDI); if (IDI >= SBNUMSYMS) return nullptr; @@ -314,7 +314,7 @@ std::unique_ptr<CJBig2_Image> CJBig2_TRDProc::decode_Arith( if (SBREFINE == 0) RI = 0; else - pIARI->decode(pArithDecoder, &RI); + pIARI->Decode(pArithDecoder, &RI); MaybeOwned<CJBig2_Image> pIBI; if (RI == 0) { @@ -324,10 +324,10 @@ std::unique_ptr<CJBig2_Image> CJBig2_TRDProc::decode_Arith( int32_t RDHI; int32_t RDXI; int32_t RDYI; - pIARDW->decode(pArithDecoder, &RDWI); - pIARDH->decode(pArithDecoder, &RDHI); - pIARDX->decode(pArithDecoder, &RDXI); - pIARDY->decode(pArithDecoder, &RDYI); + pIARDW->Decode(pArithDecoder, &RDWI); + pIARDH->Decode(pArithDecoder, &RDHI); + pIARDX->Decode(pArithDecoder, &RDXI); + pIARDY->Decode(pArithDecoder, &RDYI); CJBig2_Image* IBOI = SBSYMS[IDI]; if (!IBOI) return nullptr; @@ -351,7 +351,7 @@ std::unique_ptr<CJBig2_Image> CJBig2_TRDProc::decode_Arith( pGRRD->GRAT[1] = SBRAT[1]; pGRRD->GRAT[2] = SBRAT[2]; pGRRD->GRAT[3] = SBRAT[3]; - pIBI = pGRRD->decode(pArithDecoder, grContext); + pIBI = pGRRD->Decode(pArithDecoder, grContext); } if (!pIBI) return nullptr; diff --git a/core/fxcodec/jbig2/JBig2_TrdProc.h b/core/fxcodec/jbig2/JBig2_TrdProc.h index a66415b0bd..df0aa1585d 100644 --- a/core/fxcodec/jbig2/JBig2_TrdProc.h +++ b/core/fxcodec/jbig2/JBig2_TrdProc.h @@ -46,12 +46,12 @@ class CJBig2_TRDProc { CJBig2_TRDProc(); ~CJBig2_TRDProc(); - std::unique_ptr<CJBig2_Image> decode_Huffman(CJBig2_BitStream* pStream, - JBig2ArithCtx* grContext); + std::unique_ptr<CJBig2_Image> DecodeHuffman(CJBig2_BitStream* pStream, + JBig2ArithCtx* grContext); - std::unique_ptr<CJBig2_Image> decode_Arith(CJBig2_ArithDecoder* pArithDecoder, - JBig2ArithCtx* grContext, - JBig2IntDecoderState* pIDS); + std::unique_ptr<CJBig2_Image> DecodeArith(CJBig2_ArithDecoder* pArithDecoder, + JBig2ArithCtx* grContext, + JBig2IntDecoderState* pIDS); bool SBHUFF; bool SBREFINE; |