Chromium Code Reviews| Index: core/src/fxcodec/jbig2/JBig2_Context.cpp |
| diff --git a/core/src/fxcodec/jbig2/JBig2_Context.cpp b/core/src/fxcodec/jbig2/JBig2_Context.cpp |
| index 142611dff557cacec9cdaeb89751c87afa2bb4aa..384ba43776c95cdb5898c5329440e8af41a99978 100644 |
| --- a/core/src/fxcodec/jbig2/JBig2_Context.cpp |
| +++ b/core/src/fxcodec/jbig2/JBig2_Context.cpp |
| @@ -17,7 +17,6 @@ |
| const int kSymbolDictCacheMaxSize = 2; |
| CJBig2_Context* CJBig2_Context::CreateContext( |
| - CJBig2_Module* pModule, |
| uint8_t* pGlobalData, |
| FX_DWORD dwGlobalLength, |
| uint8_t* pData, |
| @@ -25,9 +24,8 @@ CJBig2_Context* CJBig2_Context::CreateContext( |
| int32_t nStreamType, |
| std::list<CJBig2_CachePair>* pSymbolDictCache, |
| IFX_Pause* pPause) { |
| - return new (pModule) |
| - CJBig2_Context(pGlobalData, dwGlobalLength, pData, dwLength, nStreamType, |
| - pSymbolDictCache, pPause); |
| + return new CJBig2_Context(pGlobalData, dwGlobalLength, pData, dwLength, |
| + nStreamType, pSymbolDictCache, pPause); |
| } |
| void CJBig2_Context::DestroyContext(CJBig2_Context* pContext) { |
| delete pContext; |
| @@ -40,9 +38,9 @@ CJBig2_Context::CJBig2_Context(uint8_t* pGlobalData, |
| std::list<CJBig2_CachePair>* pSymbolDictCache, |
| IFX_Pause* pPause) { |
| if (pGlobalData && (dwGlobalLength > 0)) { |
| - JBIG2_ALLOC(m_pGlobalContext, |
| - CJBig2_Context(NULL, 0, pGlobalData, dwGlobalLength, |
| - JBIG2_EMBED_STREAM, pSymbolDictCache, pPause)); |
| + m_pGlobalContext = |
| + new CJBig2_Context(NULL, 0, pGlobalData, dwGlobalLength, |
| + JBIG2_EMBED_STREAM, pSymbolDictCache, pPause); |
| } else { |
| m_pGlobalContext = NULL; |
| } |
| @@ -66,9 +64,7 @@ CJBig2_Context::~CJBig2_Context() { |
| m_pArithDecoder = NULL; |
| delete m_pGRD; |
| m_pGRD = NULL; |
| - if (m_gbContext) { |
| - m_pModule->JBig2_Free(m_gbContext); |
| - } |
| + FX_Free(m_gbContext); |
| m_gbContext = NULL; |
| delete m_pGlobalContext; |
| m_pGlobalContext = NULL; |
| @@ -219,7 +215,7 @@ int32_t CJBig2_Context::getFirstPage(uint8_t* pBuf, |
| m_bFirstPage = TRUE; |
| m_PauseStep = 0; |
| delete m_pPage; |
| - JBIG2_ALLOC(m_pPage, CJBig2_Image(width, height, stride, pBuf)); |
| + m_pPage = new CJBig2_Image(width, height, stride, pBuf); |
| m_bBufSpecified = TRUE; |
| if (m_pPage && pPause && pPause->NeedToPauseNow()) { |
| m_PauseStep = 1; |
| @@ -359,9 +355,8 @@ int32_t CJBig2_Context::parseSegmentHeader(CJBig2_Segment* pSegment) { |
| pSegment->m_dwNumber > 65536 ? 4 : pSegment->m_dwNumber > 256 ? 2 : 1; |
| cPSize = pSegment->m_cFlags.s.page_association_size ? 4 : 1; |
| if (pSegment->m_nReferred_to_segment_count) { |
| - pSegment->m_pReferred_to_segment_numbers = |
| - (FX_DWORD*)m_pModule->JBig2_Malloc2( |
| - sizeof(FX_DWORD), pSegment->m_nReferred_to_segment_count); |
| + pSegment->m_pReferred_to_segment_numbers = (FX_DWORD*)FX_Alloc2D( |
|
Tom Sepez
2015/09/04 01:26:47
Hmm. I think we can use a lower "D" allocator and
Lei Zhang
2015/09/04 21:34:59
Sure. This was all straight up JBig2_Malloc2 -> FX
|
| + uint8_t, sizeof(FX_DWORD), pSegment->m_nReferred_to_segment_count); |
| for (int32_t i = 0; i < pSegment->m_nReferred_to_segment_count; i++) { |
| switch (cSSize) { |
| case 1: |
| @@ -475,11 +470,11 @@ int32_t CJBig2_Context::ProcessiveParseSegmentData(CJBig2_Segment* pSegment, |
| if (!m_bBufSpecified) { |
| delete m_pPage; |
| if (pPageInfo->m_dwHeight == 0xffffffff) { |
| - JBIG2_ALLOC(m_pPage, CJBig2_Image(pPageInfo->m_dwWidth, |
| - pPageInfo->m_wMaxStripeSize)); |
| + m_pPage = new CJBig2_Image(pPageInfo->m_dwWidth, |
| + pPageInfo->m_wMaxStripeSize); |
| } else { |
| - JBIG2_ALLOC(m_pPage, CJBig2_Image(pPageInfo->m_dwWidth, |
| - pPageInfo->m_dwHeight)); |
| + m_pPage = |
| + new CJBig2_Image(pPageInfo->m_dwWidth, pPageInfo->m_dwHeight); |
| } |
| } |
| m_pPage->fill((pPageInfo->m_cFlags & 4) ? 1 : 0); |
| @@ -523,10 +518,9 @@ int32_t CJBig2_Context::parseSymbolDict(CJBig2_Segment* pSegment, |
| CJBig2_Segment *pSeg = NULL, *pLRSeg = NULL; |
| FX_BOOL bUsed; |
| CJBig2_Image** SDINSYMS = NULL; |
| - CJBig2_SDDProc* pSymbolDictDecoder; |
| JBig2ArithCtx *gbContext = NULL, *grContext = NULL; |
| CJBig2_ArithDecoder* pArithDecoder; |
| - JBIG2_ALLOC(pSymbolDictDecoder, CJBig2_SDDProc()); |
| + CJBig2_SDDProc* pSymbolDictDecoder = new CJBig2_SDDProc(); |
| uint8_t* key = pSegment->m_pData; |
| FX_BOOL cache_hit = false; |
| if (m_pStream->readShortInteger(&wFlags) != 0) { |
| @@ -590,8 +584,8 @@ int32_t CJBig2_Context::parseSymbolDict(CJBig2_Segment* pSegment, |
| if (pSymbolDictDecoder->SDNUMINSYMS == 0) { |
| SDINSYMS = NULL; |
| } else { |
| - SDINSYMS = (CJBig2_Image**)m_pModule->JBig2_Malloc2( |
| - sizeof(CJBig2_Image*), pSymbolDictDecoder->SDNUMINSYMS); |
| + SDINSYMS = (CJBig2_Image**)FX_Alloc2D(uint8_t, sizeof(CJBig2_Image*), |
| + pSymbolDictDecoder->SDNUMINSYMS); |
| dwTemp = 0; |
| for (i = 0; i < pSegment->m_nReferred_to_segment_count; i++) { |
| pSeg = findSegmentByNumber(pSegment->m_pReferred_to_segment_numbers[i]); |
| @@ -681,15 +675,15 @@ int32_t CJBig2_Context::parseSymbolDict(CJBig2_Segment* pSegment, |
| dwTemp = pSymbolDictDecoder->SDTEMPLATE == 0 |
| ? 65536 |
| : pSymbolDictDecoder->SDTEMPLATE == 1 ? 8192 : 1024; |
| - gbContext = (JBig2ArithCtx*)m_pModule->JBig2_Malloc2( |
| - sizeof(JBig2ArithCtx), dwTemp); |
| + gbContext = |
| + (JBig2ArithCtx*)FX_Alloc2D(uint8_t, sizeof(JBig2ArithCtx), dwTemp); |
| JBIG2_memcpy(gbContext, pLRSeg->m_Result.sd->m_gbContext, |
| sizeof(JBig2ArithCtx) * dwTemp); |
| } |
| if (pSymbolDictDecoder->SDREFAGG == 1) { |
| dwTemp = pSymbolDictDecoder->SDRTEMPLATE ? 1 << 10 : 1 << 13; |
| - grContext = (JBig2ArithCtx*)m_pModule->JBig2_Malloc2( |
| - sizeof(JBig2ArithCtx), dwTemp); |
| + grContext = |
| + (JBig2ArithCtx*)FX_Alloc2D(uint8_t, sizeof(JBig2ArithCtx), dwTemp); |
| JBIG2_memcpy(grContext, pLRSeg->m_Result.sd->m_grContext, |
| sizeof(JBig2ArithCtx) * dwTemp); |
| } |
| @@ -698,14 +692,14 @@ int32_t CJBig2_Context::parseSymbolDict(CJBig2_Segment* pSegment, |
| dwTemp = pSymbolDictDecoder->SDTEMPLATE == 0 |
| ? 65536 |
| : pSymbolDictDecoder->SDTEMPLATE == 1 ? 8192 : 1024; |
| - gbContext = (JBig2ArithCtx*)m_pModule->JBig2_Malloc2( |
| - sizeof(JBig2ArithCtx), dwTemp); |
| + gbContext = |
| + (JBig2ArithCtx*)FX_Alloc2D(uint8_t, sizeof(JBig2ArithCtx), dwTemp); |
| JBIG2_memset(gbContext, 0, sizeof(JBig2ArithCtx) * dwTemp); |
| } |
| if (pSymbolDictDecoder->SDREFAGG == 1) { |
| dwTemp = pSymbolDictDecoder->SDRTEMPLATE ? 1 << 10 : 1 << 13; |
| - grContext = (JBig2ArithCtx*)m_pModule->JBig2_Malloc2( |
| - sizeof(JBig2ArithCtx), dwTemp); |
| + grContext = |
| + (JBig2ArithCtx*)FX_Alloc2D(uint8_t, sizeof(JBig2ArithCtx), dwTemp); |
| JBIG2_memset(grContext, 0, sizeof(JBig2ArithCtx) * dwTemp); |
| } |
| } |
| @@ -763,39 +757,27 @@ int32_t CJBig2_Context::parseSymbolDict(CJBig2_Segment* pSegment, |
| bUsed = FALSE; |
| } |
| delete pSymbolDictDecoder; |
| - if (SDINSYMS) { |
| - m_pModule->JBig2_Free(SDINSYMS); |
| - } |
| + FX_Free(SDINSYMS); |
| delete Table_B1; |
| delete Table_B2; |
| delete Table_B3; |
| delete Table_B4; |
| delete Table_B5; |
| if (bUsed == FALSE) { |
| - if (gbContext) { |
| - m_pModule->JBig2_Free(gbContext); |
| - } |
| - if (grContext) { |
| - m_pModule->JBig2_Free(grContext); |
| - } |
| + FX_Free(gbContext); |
| + FX_Free(grContext); |
| } |
| return JBIG2_SUCCESS; |
| failed: |
| delete pSymbolDictDecoder; |
| - if (SDINSYMS) { |
| - m_pModule->JBig2_Free(SDINSYMS); |
| - } |
| + FX_Free(SDINSYMS); |
| delete Table_B1; |
| delete Table_B2; |
| delete Table_B3; |
| delete Table_B4; |
| delete Table_B5; |
| - if (gbContext) { |
| - m_pModule->JBig2_Free(gbContext); |
| - } |
| - if (grContext) { |
| - m_pModule->JBig2_Free(grContext); |
| - } |
| + FX_Free(gbContext); |
| + FX_Free(grContext); |
| return nRet; |
| } |
| @@ -815,8 +797,7 @@ int32_t CJBig2_Context::parseTextRegion(CJBig2_Segment* pSegment) { |
| *Table_B14 = NULL, *Table_B15 = NULL; |
| JBig2ArithCtx* grContext = NULL; |
| CJBig2_ArithDecoder* pArithDecoder; |
| - CJBig2_TRDProc* pTRD; |
| - JBIG2_ALLOC(pTRD, CJBig2_TRDProc()); |
| + CJBig2_TRDProc* pTRD = new CJBig2_TRDProc(); |
| if ((parseRegionInfo(&ri) != JBIG2_SUCCESS) || |
| (m_pStream->readShortInteger(&wFlags) != 0)) { |
| nRet = JBIG2_ERROR_TOO_SHORT; |
| @@ -877,8 +858,8 @@ int32_t CJBig2_Context::parseTextRegion(CJBig2_Segment* pSegment) { |
| } |
| } |
| if (pTRD->SBNUMSYMS > 0) { |
| - SBSYMS = (CJBig2_Image**)m_pModule->JBig2_Malloc2(sizeof(CJBig2_Image*), |
| - pTRD->SBNUMSYMS); |
| + SBSYMS = (CJBig2_Image**)FX_Alloc2D(uint8_t, sizeof(CJBig2_Image*), |
| + pTRD->SBNUMSYMS); |
| dwTemp = 0; |
| for (i = 0; i < pSegment->m_nReferred_to_segment_count; i++) { |
| pSeg = findSegmentByNumber(pSegment->m_pReferred_to_segment_numbers[i]); |
| @@ -1079,7 +1060,7 @@ int32_t CJBig2_Context::parseTextRegion(CJBig2_Segment* pSegment) { |
| if (pTRD->SBREFINE == 1) { |
| dwTemp = pTRD->SBRTEMPLATE ? 1 << 10 : 1 << 13; |
| grContext = |
| - (JBig2ArithCtx*)m_pModule->JBig2_Malloc2(sizeof(JBig2ArithCtx), dwTemp); |
| + (JBig2ArithCtx*)FX_Alloc2D(uint8_t, sizeof(JBig2ArithCtx), dwTemp); |
| JBIG2_memset(grContext, 0, sizeof(JBig2ArithCtx) * dwTemp); |
| } |
| if (pTRD->SBHUFF == 0) { |
| @@ -1116,15 +1097,9 @@ int32_t CJBig2_Context::parseTextRegion(CJBig2_Segment* pSegment) { |
| pSegment->m_Result.im = NULL; |
| } |
| delete pTRD; |
| - if (SBSYMS) { |
| - m_pModule->JBig2_Free(SBSYMS); |
| - } |
| - if (SBSYMCODES) { |
| - m_pModule->JBig2_Free(SBSYMCODES); |
| - } |
| - if (grContext) { |
| - m_pModule->JBig2_Free(grContext); |
| - } |
| + FX_Free(SBSYMS); |
| + FX_Free(SBSYMCODES); |
| + FX_Free(grContext); |
| delete Table_B1; |
| delete Table_B6; |
| delete Table_B7; |
| @@ -1139,15 +1114,9 @@ int32_t CJBig2_Context::parseTextRegion(CJBig2_Segment* pSegment) { |
| return JBIG2_SUCCESS; |
| failed: |
| delete pTRD; |
| - if (SBSYMS) { |
| - m_pModule->JBig2_Free(SBSYMS); |
| - } |
| - if (SBSYMCODES) { |
| - m_pModule->JBig2_Free(SBSYMCODES); |
| - } |
| - if (grContext) { |
| - m_pModule->JBig2_Free(grContext); |
| - } |
| + FX_Free(SBSYMS); |
| + FX_Free(SBSYMCODES); |
| + FX_Free(grContext); |
| delete Table_B1; |
| delete Table_B6; |
| delete Table_B7; |
| @@ -1168,9 +1137,8 @@ int32_t CJBig2_Context::parsePatternDict(CJBig2_Segment* pSegment, |
| uint8_t cFlags; |
| JBig2ArithCtx* gbContext; |
| CJBig2_ArithDecoder* pArithDecoder; |
| - CJBig2_PDDProc* pPDD; |
| int32_t nRet; |
| - JBIG2_ALLOC(pPDD, CJBig2_PDDProc()); |
| + CJBig2_PDDProc* pPDD = new CJBig2_PDDProc(); |
| if ((m_pStream->read1Byte(&cFlags) != 0) || |
| (m_pStream->read1Byte(&pPDD->HDPW) != 0) || |
| (m_pStream->read1Byte(&pPDD->HDPH) != 0) || |
| @@ -1189,18 +1157,18 @@ int32_t CJBig2_Context::parsePatternDict(CJBig2_Segment* pSegment, |
| dwTemp = |
| pPDD->HDTEMPLATE == 0 ? 65536 : pPDD->HDTEMPLATE == 1 ? 8192 : 1024; |
| gbContext = |
| - (JBig2ArithCtx*)m_pModule->JBig2_Malloc2(sizeof(JBig2ArithCtx), dwTemp); |
| + (JBig2ArithCtx*)FX_Alloc2D(uint8_t, sizeof(JBig2ArithCtx), dwTemp); |
| JBIG2_memset(gbContext, 0, sizeof(JBig2ArithCtx) * dwTemp); |
| pArithDecoder = new CJBig2_ArithDecoder(m_pStream); |
| pSegment->m_Result.pd = |
| pPDD->decode_Arith(pArithDecoder, gbContext, pPause); |
| delete pArithDecoder; |
| if (pSegment->m_Result.pd == NULL) { |
| - m_pModule->JBig2_Free(gbContext); |
| + FX_Free(gbContext); |
| nRet = JBIG2_ERROR_FATAL; |
| goto failed; |
| } |
| - m_pModule->JBig2_Free(gbContext); |
| + FX_Free(gbContext); |
| m_pStream->alignByte(); |
| m_pStream->offset(2); |
| } else { |
| @@ -1226,9 +1194,8 @@ int32_t CJBig2_Context::parseHalftoneRegion(CJBig2_Segment* pSegment, |
| CJBig2_PatternDict* pPatternDict; |
| JBig2ArithCtx* gbContext; |
| CJBig2_ArithDecoder* pArithDecoder; |
| - CJBig2_HTRDProc* pHRD; |
| int32_t nRet; |
| - JBIG2_ALLOC(pHRD, CJBig2_HTRDProc()); |
| + CJBig2_HTRDProc* pHRD = new CJBig2_HTRDProc(); |
| if ((parseRegionInfo(&ri) != JBIG2_SUCCESS) || |
| (m_pStream->read1Byte(&cFlags) != 0) || |
| (m_pStream->readInteger(&pHRD->HGW) != 0) || |
| @@ -1269,18 +1236,18 @@ int32_t CJBig2_Context::parseHalftoneRegion(CJBig2_Segment* pSegment, |
| if (pHRD->HMMR == 0) { |
| dwTemp = pHRD->HTEMPLATE == 0 ? 65536 : pHRD->HTEMPLATE == 1 ? 8192 : 1024; |
| gbContext = |
| - (JBig2ArithCtx*)m_pModule->JBig2_Malloc2(sizeof(JBig2ArithCtx), dwTemp); |
| + (JBig2ArithCtx*)FX_Alloc2D(uint8_t, sizeof(JBig2ArithCtx), dwTemp); |
| JBIG2_memset(gbContext, 0, sizeof(JBig2ArithCtx) * dwTemp); |
| pArithDecoder = new CJBig2_ArithDecoder(m_pStream); |
| pSegment->m_Result.im = |
| pHRD->decode_Arith(pArithDecoder, gbContext, pPause); |
| delete pArithDecoder; |
| if (pSegment->m_Result.im == NULL) { |
| - m_pModule->JBig2_Free(gbContext); |
| + FX_Free(gbContext); |
| nRet = JBIG2_ERROR_FATAL; |
| goto failed; |
| } |
| - m_pModule->JBig2_Free(gbContext); |
| + FX_Free(gbContext); |
| m_pStream->alignByte(); |
| m_pStream->offset(2); |
| } else { |
| @@ -1317,7 +1284,7 @@ int32_t CJBig2_Context::parseGenericRegion(CJBig2_Segment* pSegment, |
| uint8_t cFlags; |
| int32_t i, nRet; |
| if (m_pGRD == NULL) { |
| - JBIG2_ALLOC(m_pGRD, CJBig2_GRDProc()); |
| + m_pGRD = new CJBig2_GRDProc(); |
| if ((parseRegionInfo(&m_ri) != JBIG2_SUCCESS) || |
| (m_pStream->read1Byte(&cFlags) != 0)) { |
| nRet = JBIG2_ERROR_TOO_SHORT; |
| @@ -1356,8 +1323,8 @@ int32_t CJBig2_Context::parseGenericRegion(CJBig2_Segment* pSegment, |
| dwTemp = |
| m_pGRD->GBTEMPLATE == 0 ? 65536 : m_pGRD->GBTEMPLATE == 1 ? 8192 : 1024; |
| if (m_gbContext == NULL) { |
| - m_gbContext = (JBig2ArithCtx*)m_pModule->JBig2_Malloc( |
| - sizeof(JBig2ArithCtx) * dwTemp); |
| + m_gbContext = |
| + (JBig2ArithCtx*)FX_Alloc2D(uint8_t, sizeof(JBig2ArithCtx), dwTemp); |
| JBIG2_memset(m_gbContext, 0, sizeof(JBig2ArithCtx) * dwTemp); |
| } |
| if (m_pArithDecoder == NULL) { |
| @@ -1387,13 +1354,13 @@ int32_t CJBig2_Context::parseGenericRegion(CJBig2_Segment* pSegment, |
| delete m_pArithDecoder; |
| m_pArithDecoder = NULL; |
| if (pSegment->m_Result.im == NULL) { |
| - m_pModule->JBig2_Free(m_gbContext); |
| + FX_Free(m_gbContext); |
| nRet = JBIG2_ERROR_FATAL; |
| m_gbContext = NULL; |
| m_ProcessiveStatus = FXCODEC_STATUS_ERROR; |
| goto failed; |
| } |
| - m_pModule->JBig2_Free(m_gbContext); |
| + FX_Free(m_gbContext); |
| m_gbContext = NULL; |
| m_pStream->alignByte(); |
| m_pStream->offset(2); |
| @@ -1442,9 +1409,8 @@ int32_t CJBig2_Context::parseGenericRefinementRegion(CJBig2_Segment* pSegment) { |
| int32_t i, nRet; |
| uint8_t cFlags; |
| JBig2ArithCtx* grContext; |
| - CJBig2_GRRDProc* pGRRD; |
| CJBig2_ArithDecoder* pArithDecoder; |
| - JBIG2_ALLOC(pGRRD, CJBig2_GRRDProc()); |
| + CJBig2_GRRDProc* pGRRD = new CJBig2_GRRDProc(); |
| if ((parseRegionInfo(&ri) != JBIG2_SUCCESS) || |
| (m_pStream->read1Byte(&cFlags) != 0)) { |
| nRet = JBIG2_ERROR_TOO_SHORT; |
| @@ -1487,18 +1453,18 @@ int32_t CJBig2_Context::parseGenericRefinementRegion(CJBig2_Segment* pSegment) { |
| pGRRD->GRREFERENCEDY = 0; |
| dwTemp = pGRRD->GRTEMPLATE ? 1 << 10 : 1 << 13; |
| grContext = |
| - (JBig2ArithCtx*)m_pModule->JBig2_Malloc2(sizeof(JBig2ArithCtx), dwTemp); |
| + (JBig2ArithCtx*)FX_Alloc2D(uint8_t, sizeof(JBig2ArithCtx), dwTemp); |
| JBIG2_memset(grContext, 0, sizeof(JBig2ArithCtx) * dwTemp); |
| pArithDecoder = new CJBig2_ArithDecoder(m_pStream); |
| pSegment->m_nResultType = JBIG2_IMAGE_POINTER; |
| pSegment->m_Result.im = pGRRD->decode(pArithDecoder, grContext); |
| delete pArithDecoder; |
| if (pSegment->m_Result.im == NULL) { |
| - m_pModule->JBig2_Free(grContext); |
| + FX_Free(grContext); |
| nRet = JBIG2_ERROR_FATAL; |
| goto failed; |
| } |
| - m_pModule->JBig2_Free(grContext); |
| + FX_Free(grContext); |
| m_pStream->alignByte(); |
| m_pStream->offset(2); |
| if (pSegment->m_cFlags.s.type != 40) { |
| @@ -1554,8 +1520,8 @@ JBig2HuffmanCode* CJBig2_Context::decodeSymbolIDHuffmanTable( |
| int32_t nBits; |
| int32_t run; |
| FX_DWORD nTemp; |
| - SBSYMCODES = (JBig2HuffmanCode*)m_pModule->JBig2_Malloc2( |
| - sizeof(JBig2HuffmanCode), SBNUMSYMS); |
| + SBSYMCODES = (JBig2HuffmanCode*)FX_Alloc2D(uint8_t, sizeof(JBig2HuffmanCode), |
| + SBNUMSYMS); |
| for (i = 0; i < 35; i++) { |
| if (pStream->readNBits(4, &runcodes_len[i]) != 0) { |
| goto failed; |
| @@ -1620,7 +1586,7 @@ JBig2HuffmanCode* CJBig2_Context::decodeSymbolIDHuffmanTable( |
| huffman_assign_code(SBSYMCODES, SBNUMSYMS); |
| return SBSYMCODES; |
| failed: |
| - m_pModule->JBig2_Free(SBSYMCODES); |
| + FX_Free(SBSYMCODES); |
| return NULL; |
| } |
| void CJBig2_Context::huffman_assign_code(int* CODES, int* PREFLEN, int NTEMP) { |
| @@ -1633,9 +1599,9 @@ void CJBig2_Context::huffman_assign_code(int* CODES, int* PREFLEN, int NTEMP) { |
| LENMAX = PREFLEN[i]; |
| } |
| } |
| - LENCOUNT = (int*)m_pModule->JBig2_Malloc2(sizeof(int), (LENMAX + 1)); |
| + LENCOUNT = (int*)FX_Alloc2D(uint8_t, sizeof(int), (LENMAX + 1)); |
| JBIG2_memset(LENCOUNT, 0, sizeof(int) * (LENMAX + 1)); |
| - FIRSTCODE = (int*)m_pModule->JBig2_Malloc2(sizeof(int), (LENMAX + 1)); |
| + FIRSTCODE = (int*)FX_Alloc2D(uint8_t, sizeof(int), (LENMAX + 1)); |
| for (i = 0; i < NTEMP; i++) { |
| LENCOUNT[PREFLEN[i]]++; |
| } |
| @@ -1655,8 +1621,8 @@ void CJBig2_Context::huffman_assign_code(int* CODES, int* PREFLEN, int NTEMP) { |
| } |
| CURLEN = CURLEN + 1; |
| } |
| - m_pModule->JBig2_Free(LENCOUNT); |
| - m_pModule->JBig2_Free(FIRSTCODE); |
| + FX_Free(LENCOUNT); |
| + FX_Free(FIRSTCODE); |
| } |
| void CJBig2_Context::huffman_assign_code(JBig2HuffmanCode* SBSYMCODES, |
| int NTEMP) { |
| @@ -1669,9 +1635,9 @@ void CJBig2_Context::huffman_assign_code(JBig2HuffmanCode* SBSYMCODES, |
| LENMAX = SBSYMCODES[i].codelen; |
| } |
| } |
| - LENCOUNT = (int*)m_pModule->JBig2_Malloc2(sizeof(int), (LENMAX + 1)); |
| + LENCOUNT = (int*)FX_Alloc2D(uint8_t, sizeof(int), (LENMAX + 1)); |
| JBIG2_memset(LENCOUNT, 0, sizeof(int) * (LENMAX + 1)); |
| - FIRSTCODE = (int*)m_pModule->JBig2_Malloc2(sizeof(int), (LENMAX + 1)); |
| + FIRSTCODE = (int*)FX_Alloc2D(uint8_t, sizeof(int), (LENMAX + 1)); |
| for (i = 0; i < NTEMP; i++) { |
| LENCOUNT[SBSYMCODES[i].codelen]++; |
| } |
| @@ -1691,6 +1657,6 @@ void CJBig2_Context::huffman_assign_code(JBig2HuffmanCode* SBSYMCODES, |
| } |
| CURLEN = CURLEN + 1; |
| } |
| - m_pModule->JBig2_Free(LENCOUNT); |
| - m_pModule->JBig2_Free(FIRSTCODE); |
| + FX_Free(LENCOUNT); |
| + FX_Free(FIRSTCODE); |
| } |