diff options
Diffstat (limited to 'core/fxcodec/jbig2')
-rw-r--r-- | core/fxcodec/jbig2/JBig2_Context.cpp | 30 | ||||
-rw-r--r-- | core/fxcodec/jbig2/JBig2_Context.h | 5 |
2 files changed, 17 insertions, 18 deletions
diff --git a/core/fxcodec/jbig2/JBig2_Context.cpp b/core/fxcodec/jbig2/JBig2_Context.cpp index ce18375d88..9b866d75d0 100644 --- a/core/fxcodec/jbig2/JBig2_Context.cpp +++ b/core/fxcodec/jbig2/JBig2_Context.cpp @@ -223,15 +223,15 @@ CJBig2_Segment* CJBig2_Context::FindSegmentByNumber(uint32_t dwNumber) { return nullptr; } -CJBig2_Segment* CJBig2_Context::FindReferredSegmentByTypeAndIndex( +CJBig2_Segment* CJBig2_Context::FindReferredTableSegmentByIndex( CJBig2_Segment* pSegment, - uint8_t cType, int32_t nIndex) { + static const uint8_t kTableType = 53; 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]); - if (pSeg && pSeg->m_cFlags.s.type == cType) { + if (pSeg && pSeg->m_cFlags.s.type == kTableType) { if (count == nIndex) return pSeg; ++count; @@ -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++); + FindReferredTableSegmentByIndex(pSegment, 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++); + FindReferredTableSegmentByIndex(pSegment, 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++); + FindReferredTableSegmentByIndex(pSegment, 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++); + FindReferredTableSegmentByIndex(pSegment, nIndex++); if (!pSeg) return JBIG2_ERROR_FATAL; pSymbolDictDecoder->SDHUFFAGGINST = pSeg->m_HuffmanTable.get(); @@ -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++); + FindReferredTableSegmentByIndex(pSegment, 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++); + FindReferredTableSegmentByIndex(pSegment, 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++); + FindReferredTableSegmentByIndex(pSegment, 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++); + FindReferredTableSegmentByIndex(pSegment, 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++); + FindReferredTableSegmentByIndex(pSegment, 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++); + FindReferredTableSegmentByIndex(pSegment, 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++); + FindReferredTableSegmentByIndex(pSegment, 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++); + FindReferredTableSegmentByIndex(pSegment, nIndex++); if (!pSeg) return JBIG2_ERROR_FATAL; pTRD->SBHUFFRSIZE = pSeg->m_HuffmanTable.get(); diff --git a/core/fxcodec/jbig2/JBig2_Context.h b/core/fxcodec/jbig2/JBig2_Context.h index 117999eb00..d5dbbd22a6 100644 --- a/core/fxcodec/jbig2/JBig2_Context.h +++ b/core/fxcodec/jbig2/JBig2_Context.h @@ -60,9 +60,8 @@ class CJBig2_Context { int32_t DecodeRandom(PauseIndicatorIface* pPause); CJBig2_Segment* FindSegmentByNumber(uint32_t dwNumber); - CJBig2_Segment* FindReferredSegmentByTypeAndIndex(CJBig2_Segment* pSegment, - uint8_t cType, - int32_t nIndex); + CJBig2_Segment* FindReferredTableSegmentByIndex(CJBig2_Segment* pSegment, + int32_t nIndex); int32_t ParseSegmentHeader(CJBig2_Segment* pSegment); int32_t ParseSegmentData(CJBig2_Segment* pSegment, |