diff options
Diffstat (limited to 'core/src/fxcodec/jbig2')
-rw-r--r-- | core/src/fxcodec/jbig2/JBig2_Context.cpp | 80 | ||||
-rw-r--r-- | core/src/fxcodec/jbig2/JBig2_Context.h | 12 | ||||
-rw-r--r-- | core/src/fxcodec/jbig2/JBig2_GrdProc.cpp | 19 | ||||
-rw-r--r-- | core/src/fxcodec/jbig2/JBig2_GrrdProc.cpp | 11 | ||||
-rw-r--r-- | core/src/fxcodec/jbig2/JBig2_GsidProc.cpp | 13 | ||||
-rw-r--r-- | core/src/fxcodec/jbig2/JBig2_HtrdProc.cpp | 13 | ||||
-rw-r--r-- | core/src/fxcodec/jbig2/JBig2_PddProc.cpp | 11 | ||||
-rw-r--r-- | core/src/fxcodec/jbig2/JBig2_SddProc.cpp | 118 | ||||
-rw-r--r-- | core/src/fxcodec/jbig2/JBig2_SymbolDict.cpp | 4 | ||||
-rw-r--r-- | core/src/fxcodec/jbig2/JBig2_SymbolDict.h | 4 | ||||
-rw-r--r-- | core/src/fxcodec/jbig2/JBig2_TrdProc.cpp | 15 |
11 files changed, 150 insertions, 150 deletions
diff --git a/core/src/fxcodec/jbig2/JBig2_Context.cpp b/core/src/fxcodec/jbig2/JBig2_Context.cpp index 9503fed95e..566b84e54d 100644 --- a/core/src/fxcodec/jbig2/JBig2_Context.cpp +++ b/core/src/fxcodec/jbig2/JBig2_Context.cpp @@ -138,7 +138,7 @@ int32_t CJBig2_Context::decode_EmbedOrgnazation(IFX_Pause* pPause) { int32_t CJBig2_Context::decode_RandomOrgnazation_FirstPage(IFX_Pause* pPause) { int32_t nRet; while (m_pStream->getByteLeft() > JBIG2_MIN_SEGMENT_SIZE) { - nonstd::unique_ptr<CJBig2_Segment> pSegment(new CJBig2_Segment); + std::unique_ptr<CJBig2_Segment> pSegment(new CJBig2_Segment); nRet = parseSegmentHeader(pSegment.get()); if (nRet != JBIG2_SUCCESS) { return nRet; @@ -377,7 +377,7 @@ int32_t CJBig2_Context::ProcessingParseSegmentData(CJBig2_Segment* pSegment, return parseGenericRefinementRegion(pSegment); case 48: { FX_WORD wTemp; - nonstd::unique_ptr<JBig2PageInfo> pPageInfo(new JBig2PageInfo); + std::unique_ptr<JBig2PageInfo> pPageInfo(new JBig2PageInfo); if (m_pStream->readInteger(&pPageInfo->m_dwWidth) != 0 || m_pStream->readInteger(&pPageInfo->m_dwHeight) != 0 || m_pStream->readInteger(&pPageInfo->m_dwResolutionX) != 0 || @@ -436,7 +436,7 @@ int32_t CJBig2_Context::parseSymbolDict(CJBig2_Segment* pSegment, if (m_pStream->readShortInteger(&wFlags) != 0) return JBIG2_ERROR_TOO_SHORT; - nonstd::unique_ptr<CJBig2_SDDProc> pSymbolDictDecoder(new CJBig2_SDDProc); + std::unique_ptr<CJBig2_SDDProc> pSymbolDictDecoder(new CJBig2_SDDProc); pSymbolDictDecoder->SDHUFF = wFlags & 0x0001; pSymbolDictDecoder->SDREFAGG = (wFlags >> 1) & 0x0001; pSymbolDictDecoder->SDTEMPLATE = (wFlags >> 10) & 0x0003; @@ -482,7 +482,7 @@ int32_t CJBig2_Context::parseSymbolDict(CJBig2_Segment* pSegment, } } - nonstd::unique_ptr<CJBig2_Image*, FxFreeDeleter> SDINSYMS; + std::unique_ptr<CJBig2_Image*, FxFreeDeleter> SDINSYMS; if (pSymbolDictDecoder->SDNUMINSYMS != 0) { SDINSYMS.reset(FX_Alloc(CJBig2_Image*, pSymbolDictDecoder->SDNUMINSYMS)); FX_DWORD dwTemp = 0; @@ -499,11 +499,11 @@ int32_t CJBig2_Context::parseSymbolDict(CJBig2_Segment* pSegment, } pSymbolDictDecoder->SDINSYMS = SDINSYMS.get(); - nonstd::unique_ptr<CJBig2_HuffmanTable> Table_B1; - nonstd::unique_ptr<CJBig2_HuffmanTable> Table_B2; - nonstd::unique_ptr<CJBig2_HuffmanTable> Table_B3; - nonstd::unique_ptr<CJBig2_HuffmanTable> Table_B4; - nonstd::unique_ptr<CJBig2_HuffmanTable> Table_B5; + std::unique_ptr<CJBig2_HuffmanTable> Table_B1; + std::unique_ptr<CJBig2_HuffmanTable> Table_B2; + std::unique_ptr<CJBig2_HuffmanTable> Table_B3; + std::unique_ptr<CJBig2_HuffmanTable> Table_B4; + std::unique_ptr<CJBig2_HuffmanTable> Table_B5; if (pSymbolDictDecoder->SDHUFF == 1) { if (cSDHUFFDH == 2 || cSDHUFFDW == 2) return JBIG2_ERROR_FATAL; @@ -607,7 +607,7 @@ int32_t CJBig2_Context::parseSymbolDict(CJBig2_Segment* pSegment, for (auto it = m_pSymbolDictCache->begin(); it != m_pSymbolDictCache->end(); ++it) { if (it->first == key) { - nonstd::unique_ptr<CJBig2_SymbolDict> copy(it->second->DeepCopy()); + std::unique_ptr<CJBig2_SymbolDict> copy(it->second->DeepCopy()); pSegment->m_Result.sd = copy.release(); m_pSymbolDictCache->push_front(*it); m_pSymbolDictCache->erase(it); @@ -618,7 +618,7 @@ int32_t CJBig2_Context::parseSymbolDict(CJBig2_Segment* pSegment, } if (!cache_hit) { if (bUseGbContext) { - nonstd::unique_ptr<CJBig2_ArithDecoder> pArithDecoder( + std::unique_ptr<CJBig2_ArithDecoder> pArithDecoder( new CJBig2_ArithDecoder(m_pStream.get())); pSegment->m_Result.sd = pSymbolDictDecoder->decode_Arith( pArithDecoder.get(), &gbContext, &grContext); @@ -635,7 +635,7 @@ int32_t CJBig2_Context::parseSymbolDict(CJBig2_Segment* pSegment, m_pStream->alignByte(); } if (m_bIsGlobal && kSymbolDictCacheMaxSize > 0) { - nonstd::unique_ptr<CJBig2_SymbolDict> value = + std::unique_ptr<CJBig2_SymbolDict> value = pSegment->m_Result.sd->DeepCopy(); while (m_pSymbolDictCache->size() >= kSymbolDictCacheMaxSize) { delete m_pSymbolDictCache->back().second; @@ -661,7 +661,7 @@ int32_t CJBig2_Context::parseTextRegion(CJBig2_Segment* pSegment) { return JBIG2_ERROR_TOO_SHORT; } - nonstd::unique_ptr<CJBig2_TRDProc> pTRD(new CJBig2_TRDProc); + std::unique_ptr<CJBig2_TRDProc> pTRD(new CJBig2_TRDProc); pTRD->SBW = ri.width; pTRD->SBH = ri.height; pTRD->SBHUFF = wFlags & 0x0001; @@ -722,7 +722,7 @@ int32_t CJBig2_Context::parseTextRegion(CJBig2_Segment* pSegment) { } } - nonstd::unique_ptr<CJBig2_Image*, FxFreeDeleter> SBSYMS; + std::unique_ptr<CJBig2_Image*, FxFreeDeleter> SBSYMS; if (pTRD->SBNUMSYMS > 0) { SBSYMS.reset(FX_Alloc(CJBig2_Image*, pTRD->SBNUMSYMS)); dwTemp = 0; @@ -741,7 +741,7 @@ int32_t CJBig2_Context::parseTextRegion(CJBig2_Segment* pSegment) { pTRD->SBSYMS = NULL; } - nonstd::unique_ptr<JBig2HuffmanCode, FxFreeDeleter> SBSYMCODES; + std::unique_ptr<JBig2HuffmanCode, FxFreeDeleter> SBSYMCODES; if (pTRD->SBHUFF == 1) { SBSYMCODES.reset( decodeSymbolIDHuffmanTable(m_pStream.get(), pTRD->SBNUMSYMS)); @@ -758,17 +758,17 @@ int32_t CJBig2_Context::parseTextRegion(CJBig2_Segment* pSegment) { pTRD->SBSYMCODELEN = (uint8_t)dwTemp; } - nonstd::unique_ptr<CJBig2_HuffmanTable> Table_B1; - nonstd::unique_ptr<CJBig2_HuffmanTable> Table_B6; - nonstd::unique_ptr<CJBig2_HuffmanTable> Table_B7; - nonstd::unique_ptr<CJBig2_HuffmanTable> Table_B8; - nonstd::unique_ptr<CJBig2_HuffmanTable> Table_B9; - nonstd::unique_ptr<CJBig2_HuffmanTable> Table_B10; - nonstd::unique_ptr<CJBig2_HuffmanTable> Table_B11; - nonstd::unique_ptr<CJBig2_HuffmanTable> Table_B12; - nonstd::unique_ptr<CJBig2_HuffmanTable> Table_B13; - nonstd::unique_ptr<CJBig2_HuffmanTable> Table_B14; - nonstd::unique_ptr<CJBig2_HuffmanTable> Table_B15; + std::unique_ptr<CJBig2_HuffmanTable> Table_B1; + std::unique_ptr<CJBig2_HuffmanTable> Table_B6; + std::unique_ptr<CJBig2_HuffmanTable> Table_B7; + std::unique_ptr<CJBig2_HuffmanTable> Table_B8; + std::unique_ptr<CJBig2_HuffmanTable> Table_B9; + std::unique_ptr<CJBig2_HuffmanTable> Table_B10; + std::unique_ptr<CJBig2_HuffmanTable> Table_B11; + std::unique_ptr<CJBig2_HuffmanTable> Table_B12; + std::unique_ptr<CJBig2_HuffmanTable> Table_B13; + std::unique_ptr<CJBig2_HuffmanTable> Table_B14; + std::unique_ptr<CJBig2_HuffmanTable> Table_B15; if (pTRD->SBHUFF == 1) { if (cSBHUFFFS == 2 || cSBHUFFRDW == 2 || cSBHUFFRDH == 2 || cSBHUFFRDX == 2 || cSBHUFFRDY == 2) { @@ -929,14 +929,14 @@ int32_t CJBig2_Context::parseTextRegion(CJBig2_Segment* pSegment) { pTRD->SBHUFFRSIZE = pSeg->m_Result.ht; } } - nonstd::unique_ptr<JBig2ArithCtx, FxFreeDeleter> grContext; + std::unique_ptr<JBig2ArithCtx, FxFreeDeleter> grContext; if (pTRD->SBREFINE == 1) { const size_t size = GetRefAggContextSize(pTRD->SBRTEMPLATE); grContext.reset(FX_Alloc(JBig2ArithCtx, size)); JBIG2_memset(grContext.get(), 0, sizeof(JBig2ArithCtx) * size); } if (pTRD->SBHUFF == 0) { - nonstd::unique_ptr<CJBig2_ArithDecoder> pArithDecoder( + std::unique_ptr<CJBig2_ArithDecoder> pArithDecoder( new CJBig2_ArithDecoder(m_pStream.get())); pSegment->m_nResultType = JBIG2_IMAGE_POINTER; pSegment->m_Result.im = @@ -972,7 +972,7 @@ int32_t CJBig2_Context::parseTextRegion(CJBig2_Segment* pSegment) { int32_t CJBig2_Context::parsePatternDict(CJBig2_Segment* pSegment, IFX_Pause* pPause) { uint8_t cFlags; - nonstd::unique_ptr<CJBig2_PDDProc> pPDD(new CJBig2_PDDProc); + std::unique_ptr<CJBig2_PDDProc> pPDD(new CJBig2_PDDProc); if (m_pStream->read1Byte(&cFlags) != 0 || m_pStream->read1Byte(&pPDD->HDPW) != 0 || m_pStream->read1Byte(&pPDD->HDPH) != 0 || @@ -987,10 +987,10 @@ int32_t CJBig2_Context::parsePatternDict(CJBig2_Segment* pSegment, pSegment->m_nResultType = JBIG2_PATTERN_DICT_POINTER; if (pPDD->HDMMR == 0) { const size_t size = GetHuffContextSize(pPDD->HDTEMPLATE); - nonstd::unique_ptr<JBig2ArithCtx, FxFreeDeleter> gbContext( + std::unique_ptr<JBig2ArithCtx, FxFreeDeleter> gbContext( FX_Alloc(JBig2ArithCtx, size)); JBIG2_memset(gbContext.get(), 0, sizeof(JBig2ArithCtx) * size); - nonstd::unique_ptr<CJBig2_ArithDecoder> pArithDecoder( + std::unique_ptr<CJBig2_ArithDecoder> pArithDecoder( new CJBig2_ArithDecoder(m_pStream.get())); pSegment->m_Result.pd = pPDD->decode_Arith(pArithDecoder.get(), gbContext.get(), pPause); @@ -1012,7 +1012,7 @@ int32_t CJBig2_Context::parseHalftoneRegion(CJBig2_Segment* pSegment, IFX_Pause* pPause) { uint8_t cFlags; JBig2RegionInfo ri; - nonstd::unique_ptr<CJBig2_HTRDProc> pHRD(new CJBig2_HTRDProc); + std::unique_ptr<CJBig2_HTRDProc> pHRD(new CJBig2_HTRDProc); if (parseRegionInfo(&ri) != JBIG2_SUCCESS || m_pStream->read1Byte(&cFlags) != 0 || m_pStream->readInteger(&pHRD->HGW) != 0 || @@ -1053,10 +1053,10 @@ int32_t CJBig2_Context::parseHalftoneRegion(CJBig2_Segment* pSegment, pSegment->m_nResultType = JBIG2_IMAGE_POINTER; if (pHRD->HMMR == 0) { const size_t size = GetHuffContextSize(pHRD->HTEMPLATE); - nonstd::unique_ptr<JBig2ArithCtx, FxFreeDeleter> gbContext( + std::unique_ptr<JBig2ArithCtx, FxFreeDeleter> gbContext( FX_Alloc(JBig2ArithCtx, size)); JBIG2_memset(gbContext.get(), 0, sizeof(JBig2ArithCtx) * size); - nonstd::unique_ptr<CJBig2_ArithDecoder> pArithDecoder( + std::unique_ptr<CJBig2_ArithDecoder> pArithDecoder( new CJBig2_ArithDecoder(m_pStream.get())); pSegment->m_Result.im = pHRD->decode_Arith(pArithDecoder.get(), gbContext.get(), pPause); @@ -1090,7 +1090,7 @@ int32_t CJBig2_Context::parseHalftoneRegion(CJBig2_Segment* pSegment, int32_t CJBig2_Context::parseGenericRegion(CJBig2_Segment* pSegment, IFX_Pause* pPause) { if (!m_pGRD) { - nonstd::unique_ptr<CJBig2_GRDProc> pGRD(new CJBig2_GRDProc); + std::unique_ptr<CJBig2_GRDProc> pGRD(new CJBig2_GRDProc); uint8_t cFlags; if (parseRegionInfo(&m_ri) != JBIG2_SUCCESS || m_pStream->read1Byte(&cFlags) != 0) { @@ -1203,7 +1203,7 @@ int32_t CJBig2_Context::parseGenericRefinementRegion(CJBig2_Segment* pSegment) { m_pStream->read1Byte(&cFlags) != 0) { return JBIG2_ERROR_TOO_SHORT; } - nonstd::unique_ptr<CJBig2_GRRDProc> pGRRD(new CJBig2_GRRDProc); + std::unique_ptr<CJBig2_GRRDProc> pGRRD(new CJBig2_GRRDProc); pGRRD->GRW = ri.width; pGRRD->GRH = ri.height; pGRRD->GRTEMPLATE = cFlags & 0x01; @@ -1237,10 +1237,10 @@ int32_t CJBig2_Context::parseGenericRefinementRegion(CJBig2_Segment* pSegment) { pGRRD->GRREFERENCEDX = 0; pGRRD->GRREFERENCEDY = 0; const size_t size = GetRefAggContextSize(pGRRD->GRTEMPLATE); - nonstd::unique_ptr<JBig2ArithCtx, FxFreeDeleter> grContext( + std::unique_ptr<JBig2ArithCtx, FxFreeDeleter> grContext( FX_Alloc(JBig2ArithCtx, size)); JBIG2_memset(grContext.get(), 0, sizeof(JBig2ArithCtx) * size); - nonstd::unique_ptr<CJBig2_ArithDecoder> pArithDecoder( + std::unique_ptr<CJBig2_ArithDecoder> pArithDecoder( new CJBig2_ArithDecoder(m_pStream.get())); pSegment->m_nResultType = JBIG2_IMAGE_POINTER; pSegment->m_Result.im = pGRRD->decode(pArithDecoder.get(), grContext.get()); @@ -1268,7 +1268,7 @@ int32_t CJBig2_Context::parseGenericRefinementRegion(CJBig2_Segment* pSegment) { int32_t CJBig2_Context::parseTable(CJBig2_Segment* pSegment) { pSegment->m_nResultType = JBIG2_HUFFMAN_TABLE_POINTER; pSegment->m_Result.ht = nullptr; - nonstd::unique_ptr<CJBig2_HuffmanTable> pHuff( + std::unique_ptr<CJBig2_HuffmanTable> pHuff( new CJBig2_HuffmanTable(m_pStream.get())); if (!pHuff->IsOK()) return JBIG2_ERROR_FATAL; @@ -1301,7 +1301,7 @@ JBig2HuffmanCode* CJBig2_Context::decodeSymbolIDHuffmanTable( } huffman_assign_code(runcodes, runcodes_len, kRunCodesSize); - nonstd::unique_ptr<JBig2HuffmanCode, FxFreeDeleter> SBSYMCODES( + std::unique_ptr<JBig2HuffmanCode, FxFreeDeleter> SBSYMCODES( FX_Alloc(JBig2HuffmanCode, SBNUMSYMS)); int32_t run; int32_t i = 0; diff --git a/core/src/fxcodec/jbig2/JBig2_Context.h b/core/src/fxcodec/jbig2/JBig2_Context.h index 1b8b391f9d..dd63bcd1b0 100644 --- a/core/src/fxcodec/jbig2/JBig2_Context.h +++ b/core/src/fxcodec/jbig2/JBig2_Context.h @@ -8,6 +8,7 @@ #define CORE_SRC_FXCODEC_JBIG2_JBIG2_CONTEXT_H_ #include <list> +#include <memory> #include <utility> #include "JBig2_List.h" @@ -15,7 +16,6 @@ #include "JBig2_Segment.h" #include "core/include/fpdfapi/fpdf_objects.h" #include "core/include/fxcodec/fx_codec_def.h" -#include "third_party/base/nonstd_unique_ptr.h" class CJBig2_ArithDecoder; class CJBig2_GRDProc; @@ -110,20 +110,20 @@ class CJBig2_Context { private: CJBig2_Context* m_pGlobalContext; - nonstd::unique_ptr<CJBig2_BitStream> m_pStream; + std::unique_ptr<CJBig2_BitStream> m_pStream; CJBig2_List<CJBig2_Segment> m_SegmentList; CJBig2_List<JBig2PageInfo> m_PageInfoList; - nonstd::unique_ptr<CJBig2_Image> m_pPage; + std::unique_ptr<CJBig2_Image> m_pPage; size_t m_nSegmentDecoded; bool m_bInPage; bool m_bBufSpecified; int32_t m_PauseStep; IFX_Pause* m_pPause; FXCODEC_STATUS m_ProcessingStatus; - nonstd::unique_ptr<CJBig2_ArithDecoder> m_pArithDecoder; - nonstd::unique_ptr<CJBig2_GRDProc> m_pGRD; + std::unique_ptr<CJBig2_ArithDecoder> m_pArithDecoder; + std::unique_ptr<CJBig2_GRDProc> m_pGRD; JBig2ArithCtx* m_gbContext; - nonstd::unique_ptr<CJBig2_Segment> m_pSegment; + std::unique_ptr<CJBig2_Segment> m_pSegment; FX_DWORD m_dwOffset; JBig2RegionInfo m_ri; std::list<CJBig2_CachePair>* const m_pSymbolDictCache; diff --git a/core/src/fxcodec/jbig2/JBig2_GrdProc.cpp b/core/src/fxcodec/jbig2/JBig2_GrdProc.cpp index fc654c0da8..803e4a70d4 100644 --- a/core/src/fxcodec/jbig2/JBig2_GrdProc.cpp +++ b/core/src/fxcodec/jbig2/JBig2_GrdProc.cpp @@ -6,11 +6,12 @@ #include "JBig2_GrdProc.h" +#include <memory> + #include "JBig2_ArithDecoder.h" #include "JBig2_BitStream.h" #include "JBig2_Image.h" #include "core/include/fxcodec/fx_codec.h" -#include "third_party/base/nonstd_unique_ptr.h" CJBig2_GRDProc::CJBig2_GRDProc() : m_loopIndex(0), @@ -71,7 +72,7 @@ CJBig2_Image* CJBig2_GRDProc::decode_Arith_Template0_opt3( int32_t nStride, nStride2, k; int32_t nLineBytes, nBitsLeft, cc; LTP = 0; - nonstd::unique_ptr<CJBig2_Image> GBREG(new CJBig2_Image(GBW, GBH)); + std::unique_ptr<CJBig2_Image> GBREG(new CJBig2_Image(GBW, GBH)); if (!GBREG->m_pData) return nullptr; @@ -158,7 +159,7 @@ CJBig2_Image* CJBig2_GRDProc::decode_Arith_Template0_unopt( FX_DWORD CONTEXT; FX_DWORD line1, line2, line3; LTP = 0; - nonstd::unique_ptr<CJBig2_Image> GBREG(new CJBig2_Image(GBW, GBH)); + std::unique_ptr<CJBig2_Image> GBREG(new CJBig2_Image(GBW, GBH)); GBREG->fill(0); for (FX_DWORD h = 0; h < GBH; h++) { if (TPGDON) { @@ -209,7 +210,7 @@ CJBig2_Image* CJBig2_GRDProc::decode_Arith_Template1_opt3( int32_t nStride, nStride2, k; int32_t nLineBytes, nBitsLeft, cc; LTP = 0; - nonstd::unique_ptr<CJBig2_Image> GBREG(new CJBig2_Image(GBW, GBH)); + std::unique_ptr<CJBig2_Image> GBREG(new CJBig2_Image(GBW, GBH)); if (!GBREG->m_pData) return nullptr; @@ -295,7 +296,7 @@ CJBig2_Image* CJBig2_GRDProc::decode_Arith_Template1_unopt( FX_DWORD CONTEXT; FX_DWORD line1, line2, line3; LTP = 0; - nonstd::unique_ptr<CJBig2_Image> GBREG(new CJBig2_Image(GBW, GBH)); + std::unique_ptr<CJBig2_Image> GBREG(new CJBig2_Image(GBW, GBH)); GBREG->fill(0); for (FX_DWORD h = 0; h < GBH; h++) { if (TPGDON) { @@ -343,7 +344,7 @@ CJBig2_Image* CJBig2_GRDProc::decode_Arith_Template2_opt3( int32_t nStride, nStride2, k; int32_t nLineBytes, nBitsLeft, cc; LTP = 0; - nonstd::unique_ptr<CJBig2_Image> GBREG(new CJBig2_Image(GBW, GBH)); + std::unique_ptr<CJBig2_Image> GBREG(new CJBig2_Image(GBW, GBH)); if (!GBREG->m_pData) return nullptr; @@ -429,7 +430,7 @@ CJBig2_Image* CJBig2_GRDProc::decode_Arith_Template2_unopt( FX_DWORD CONTEXT; FX_DWORD line1, line2, line3; LTP = 0; - nonstd::unique_ptr<CJBig2_Image> GBREG(new CJBig2_Image(GBW, GBH)); + std::unique_ptr<CJBig2_Image> GBREG(new CJBig2_Image(GBW, GBH)); GBREG->fill(0); for (FX_DWORD h = 0; h < GBH; h++) { if (TPGDON) { @@ -476,7 +477,7 @@ CJBig2_Image* CJBig2_GRDProc::decode_Arith_Template3_opt3( int32_t nStride, k; int32_t nLineBytes, nBitsLeft, cc; LTP = 0; - nonstd::unique_ptr<CJBig2_Image> GBREG(new CJBig2_Image(GBW, GBH)); + std::unique_ptr<CJBig2_Image> GBREG(new CJBig2_Image(GBW, GBH)); if (!GBREG->m_pData) return nullptr; @@ -548,7 +549,7 @@ CJBig2_Image* CJBig2_GRDProc::decode_Arith_Template3_unopt( FX_DWORD CONTEXT; FX_DWORD line1, line2; LTP = 0; - nonstd::unique_ptr<CJBig2_Image> GBREG(new CJBig2_Image(GBW, GBH)); + std::unique_ptr<CJBig2_Image> GBREG(new CJBig2_Image(GBW, GBH)); GBREG->fill(0); for (FX_DWORD h = 0; h < GBH; h++) { if (TPGDON) { diff --git a/core/src/fxcodec/jbig2/JBig2_GrrdProc.cpp b/core/src/fxcodec/jbig2/JBig2_GrrdProc.cpp index 549669a72f..e1c5e19fa6 100644 --- a/core/src/fxcodec/jbig2/JBig2_GrrdProc.cpp +++ b/core/src/fxcodec/jbig2/JBig2_GrrdProc.cpp @@ -6,10 +6,11 @@ #include "JBig2_GrrdProc.h" +#include <memory> + #include "JBig2_ArithDecoder.h" #include "JBig2_BitStream.h" #include "JBig2_Image.h" -#include "third_party/base/nonstd_unique_ptr.h" CJBig2_Image* CJBig2_GRRDProc::decode(CJBig2_ArithDecoder* pArithDecoder, JBig2ArithCtx* grContext) { @@ -37,7 +38,7 @@ CJBig2_Image* CJBig2_GRRDProc::decode_Template0_unopt( FX_DWORD CONTEXT; FX_DWORD line1, line2, line3, line4, line5; LTP = 0; - nonstd::unique_ptr<CJBig2_Image> GRREG(new CJBig2_Image(GRW, GRH)); + std::unique_ptr<CJBig2_Image> GRREG(new CJBig2_Image(GRW, GRH)); GRREG->fill(0); for (FX_DWORD h = 0; h < GRH; h++) { if (TPGRON) { @@ -162,7 +163,7 @@ CJBig2_Image* CJBig2_GRRDProc::decode_Template0_opt( GRW = (int32_t)CJBig2_GRRDProc::GRW; GRH = (int32_t)CJBig2_GRRDProc::GRH; LTP = 0; - nonstd::unique_ptr<CJBig2_Image> GRREG(new CJBig2_Image(GRW, GRH)); + std::unique_ptr<CJBig2_Image> GRREG(new CJBig2_Image(GRW, GRH)); if (!GRREG->m_pData) return nullptr; @@ -289,7 +290,7 @@ CJBig2_Image* CJBig2_GRRDProc::decode_Template1_unopt( FX_DWORD CONTEXT; FX_DWORD line1, line2, line3, line4, line5; LTP = 0; - nonstd::unique_ptr<CJBig2_Image> GRREG(new CJBig2_Image(GRW, GRH)); + std::unique_ptr<CJBig2_Image> GRREG(new CJBig2_Image(GRW, GRH)); GRREG->fill(0); for (FX_DWORD h = 0; h < GRH; h++) { if (TPGRON) { @@ -400,7 +401,7 @@ CJBig2_Image* CJBig2_GRRDProc::decode_Template1_opt( GRW = (int32_t)CJBig2_GRRDProc::GRW; GRH = (int32_t)CJBig2_GRRDProc::GRH; LTP = 0; - nonstd::unique_ptr<CJBig2_Image> GRREG(new CJBig2_Image(GRW, GRH)); + std::unique_ptr<CJBig2_Image> GRREG(new CJBig2_Image(GRW, GRH)); if (!GRREG->m_pData) return nullptr; diff --git a/core/src/fxcodec/jbig2/JBig2_GsidProc.cpp b/core/src/fxcodec/jbig2/JBig2_GsidProc.cpp index 53af1fd16e..5871efb16d 100644 --- a/core/src/fxcodec/jbig2/JBig2_GsidProc.cpp +++ b/core/src/fxcodec/jbig2/JBig2_GsidProc.cpp @@ -6,17 +6,18 @@ #include "JBig2_GsidProc.h" +#include <memory> + #include "JBig2_BitStream.h" #include "JBig2_GrdProc.h" #include "JBig2_Image.h" #include "JBig2_List.h" #include "core/include/fxcrt/fx_basic.h" -#include "third_party/base/nonstd_unique_ptr.h" FX_DWORD* CJBig2_GSIDProc::decode_Arith(CJBig2_ArithDecoder* pArithDecoder, JBig2ArithCtx* gbContext, IFX_Pause* pPause) { - nonstd::unique_ptr<CJBig2_GRDProc> pGRD(new CJBig2_GRDProc()); + std::unique_ptr<CJBig2_GRDProc> pGRD(new CJBig2_GRDProc()); pGRD->MMR = GSMMR; pGRD->GBW = GSW; pGRD->GBH = GSH; @@ -55,7 +56,7 @@ FX_DWORD* CJBig2_GSIDProc::decode_Arith(CJBig2_ArithDecoder* pArithDecoder, if (i < GSBPP - 1) pImage->composeFrom(0, 0, GSPLANES.get(i + 1), JBIG2_COMPOSE_XOR); } - nonstd::unique_ptr<FX_DWORD, FxFreeDeleter> GSVALS( + std::unique_ptr<FX_DWORD, FxFreeDeleter> GSVALS( FX_Alloc2D(FX_DWORD, GSW, GSH)); JBIG2_memset(GSVALS.get(), 0, sizeof(FX_DWORD) * GSW * GSH); for (FX_DWORD y = 0; y < GSH; ++y) { @@ -70,12 +71,12 @@ FX_DWORD* CJBig2_GSIDProc::decode_Arith(CJBig2_ArithDecoder* pArithDecoder, FX_DWORD* CJBig2_GSIDProc::decode_MMR(CJBig2_BitStream* pStream, IFX_Pause* pPause) { - nonstd::unique_ptr<CJBig2_GRDProc> pGRD(new CJBig2_GRDProc()); + std::unique_ptr<CJBig2_GRDProc> pGRD(new CJBig2_GRDProc()); pGRD->MMR = GSMMR; pGRD->GBW = GSW; pGRD->GBH = GSH; - nonstd::unique_ptr<CJBig2_Image*> GSPLANES(FX_Alloc(CJBig2_Image*, GSBPP)); + std::unique_ptr<CJBig2_Image*> GSPLANES(FX_Alloc(CJBig2_Image*, GSBPP)); JBIG2_memset(GSPLANES.get(), 0, sizeof(CJBig2_Image*) * GSBPP); FXCODEC_STATUS status = pGRD->Start_decode_MMR(&GSPLANES.get()[GSBPP - 1], pStream, nullptr); @@ -106,7 +107,7 @@ FX_DWORD* CJBig2_GSIDProc::decode_MMR(CJBig2_BitStream* pStream, JBIG2_COMPOSE_XOR); J = J - 1; } - nonstd::unique_ptr<FX_DWORD> GSVALS(FX_Alloc2D(FX_DWORD, GSW, GSH)); + std::unique_ptr<FX_DWORD> GSVALS(FX_Alloc2D(FX_DWORD, GSW, GSH)); JBIG2_memset(GSVALS.get(), 0, sizeof(FX_DWORD) * GSW * GSH); for (FX_DWORD y = 0; y < GSH; ++y) { for (FX_DWORD x = 0; x < GSW; ++x) { diff --git a/core/src/fxcodec/jbig2/JBig2_HtrdProc.cpp b/core/src/fxcodec/jbig2/JBig2_HtrdProc.cpp index 127ef0333c..377af58dfa 100644 --- a/core/src/fxcodec/jbig2/JBig2_HtrdProc.cpp +++ b/core/src/fxcodec/jbig2/JBig2_HtrdProc.cpp @@ -6,9 +6,10 @@ #include "JBig2_HtrdProc.h" +#include <memory> + #include "JBig2_GsidProc.h" #include "core/include/fxcrt/fx_basic.h" -#include "third_party/base/nonstd_unique_ptr.h" CJBig2_Image* CJBig2_HTRDProc::decode_Arith(CJBig2_ArithDecoder* pArithDecoder, JBig2ArithCtx* gbContext, @@ -17,8 +18,8 @@ CJBig2_Image* CJBig2_HTRDProc::decode_Arith(CJBig2_ArithDecoder* pArithDecoder, int32_t x, y; FX_DWORD HBPP; FX_DWORD* GI; - nonstd::unique_ptr<CJBig2_Image> HSKIP; - nonstd::unique_ptr<CJBig2_Image> HTREG(new CJBig2_Image(HBW, HBH)); + std::unique_ptr<CJBig2_Image> HSKIP; + std::unique_ptr<CJBig2_Image> HTREG(new CJBig2_Image(HBW, HBH)); HTREG->fill(HDEFPIXEL); if (HENABLESKIP == 1) { HSKIP.reset(new CJBig2_Image(HGW, HGH)); @@ -39,7 +40,7 @@ CJBig2_Image* CJBig2_HTRDProc::decode_Arith(CJBig2_ArithDecoder* pArithDecoder, while ((FX_DWORD)(1 << HBPP) < HNUMPATS) { HBPP++; } - nonstd::unique_ptr<CJBig2_GSIDProc> pGID(new CJBig2_GSIDProc()); + std::unique_ptr<CJBig2_GSIDProc> pGID(new CJBig2_GSIDProc()); pGID->GSMMR = HMMR; pGID->GSW = HGW; pGID->GSH = HGH; @@ -71,13 +72,13 @@ CJBig2_Image* CJBig2_HTRDProc::decode_MMR(CJBig2_BitStream* pStream, FX_DWORD ng, mg; int32_t x, y; FX_DWORD* GI; - nonstd::unique_ptr<CJBig2_Image> HTREG(new CJBig2_Image(HBW, HBH)); + std::unique_ptr<CJBig2_Image> HTREG(new CJBig2_Image(HBW, HBH)); HTREG->fill(HDEFPIXEL); FX_DWORD HBPP = 1; while ((FX_DWORD)(1 << HBPP) < HNUMPATS) { HBPP++; } - nonstd::unique_ptr<CJBig2_GSIDProc> pGID(new CJBig2_GSIDProc()); + std::unique_ptr<CJBig2_GSIDProc> pGID(new CJBig2_GSIDProc()); pGID->GSMMR = HMMR; pGID->GSW = HGW; pGID->GSH = HGH; diff --git a/core/src/fxcodec/jbig2/JBig2_PddProc.cpp b/core/src/fxcodec/jbig2/JBig2_PddProc.cpp index fbe9e4b17f..179077466c 100644 --- a/core/src/fxcodec/jbig2/JBig2_PddProc.cpp +++ b/core/src/fxcodec/jbig2/JBig2_PddProc.cpp @@ -6,10 +6,11 @@ #include "JBig2_PddProc.h" +#include <memory> + #include "JBig2_GrdProc.h" #include "JBig2_Image.h" #include "JBig2_PatternDict.h" -#include "third_party/base/nonstd_unique_ptr.h" CJBig2_PatternDict* CJBig2_PDDProc::decode_Arith( CJBig2_ArithDecoder* pArithDecoder, @@ -17,12 +18,12 @@ CJBig2_PatternDict* CJBig2_PDDProc::decode_Arith( IFX_Pause* pPause) { FX_DWORD GRAY; CJBig2_Image* BHDC = nullptr; - nonstd::unique_ptr<CJBig2_PatternDict> pDict(new CJBig2_PatternDict()); + std::unique_ptr<CJBig2_PatternDict> pDict(new CJBig2_PatternDict()); pDict->NUMPATS = GRAYMAX + 1; pDict->HDPATS = FX_Alloc(CJBig2_Image*, pDict->NUMPATS); JBIG2_memset(pDict->HDPATS, 0, sizeof(CJBig2_Image*) * pDict->NUMPATS); - nonstd::unique_ptr<CJBig2_GRDProc> pGRD(new CJBig2_GRDProc()); + std::unique_ptr<CJBig2_GRDProc> pGRD(new CJBig2_GRDProc()); pGRD->MMR = HDMMR; pGRD->GBW = (GRAYMAX + 1) * HDPW; pGRD->GBH = HDPH; @@ -60,12 +61,12 @@ CJBig2_PatternDict* CJBig2_PDDProc::decode_MMR(CJBig2_BitStream* pStream, IFX_Pause* pPause) { FX_DWORD GRAY; CJBig2_Image* BHDC = nullptr; - nonstd::unique_ptr<CJBig2_PatternDict> pDict(new CJBig2_PatternDict()); + std::unique_ptr<CJBig2_PatternDict> pDict(new CJBig2_PatternDict()); pDict->NUMPATS = GRAYMAX + 1; pDict->HDPATS = FX_Alloc(CJBig2_Image*, pDict->NUMPATS); JBIG2_memset(pDict->HDPATS, 0, sizeof(CJBig2_Image*) * pDict->NUMPATS); - nonstd::unique_ptr<CJBig2_GRDProc> pGRD(new CJBig2_GRDProc()); + std::unique_ptr<CJBig2_GRDProc> pGRD(new CJBig2_GRDProc()); pGRD->MMR = HDMMR; pGRD->GBW = (GRAYMAX + 1) * HDPW; pGRD->GBH = HDPH; diff --git a/core/src/fxcodec/jbig2/JBig2_SddProc.cpp b/core/src/fxcodec/jbig2/JBig2_SddProc.cpp index e9ce932d91..faa70621ab 100644 --- a/core/src/fxcodec/jbig2/JBig2_SddProc.cpp +++ b/core/src/fxcodec/jbig2/JBig2_SddProc.cpp @@ -6,6 +6,7 @@ #include "core/src/fxcodec/jbig2/JBig2_SddProc.h" +#include <memory> #include <vector> #include "core/include/fxcrt/fx_basic.h" @@ -17,7 +18,6 @@ #include "core/src/fxcodec/jbig2/JBig2_HuffmanTable_Standard.h" #include "core/src/fxcodec/jbig2/JBig2_SymbolDict.h" #include "core/src/fxcodec/jbig2/JBig2_TrdProc.h" -#include "third_party/base/nonstd_unique_ptr.h" CJBig2_SymbolDict* CJBig2_SDDProc::decode_Arith( CJBig2_ArithDecoder* pArithDecoder, @@ -39,21 +39,21 @@ CJBig2_SymbolDict* CJBig2_SDDProc::decode_Arith( uint8_t SBSYMCODELEN; int32_t RDXI, RDYI; CJBig2_Image** SBSYMS; - nonstd::unique_ptr<CJBig2_ArithIaidDecoder> IAID; - nonstd::unique_ptr<CJBig2_SymbolDict> pDict; - nonstd::unique_ptr<CJBig2_ArithIntDecoder> IADH(new CJBig2_ArithIntDecoder); - nonstd::unique_ptr<CJBig2_ArithIntDecoder> IADW(new CJBig2_ArithIntDecoder); - nonstd::unique_ptr<CJBig2_ArithIntDecoder> IAAI(new CJBig2_ArithIntDecoder); - nonstd::unique_ptr<CJBig2_ArithIntDecoder> IARDX(new CJBig2_ArithIntDecoder); - nonstd::unique_ptr<CJBig2_ArithIntDecoder> IARDY(new CJBig2_ArithIntDecoder); - nonstd::unique_ptr<CJBig2_ArithIntDecoder> IAEX(new CJBig2_ArithIntDecoder); - nonstd::unique_ptr<CJBig2_ArithIntDecoder> IADT(new CJBig2_ArithIntDecoder); - nonstd::unique_ptr<CJBig2_ArithIntDecoder> IAFS(new CJBig2_ArithIntDecoder); - nonstd::unique_ptr<CJBig2_ArithIntDecoder> IADS(new CJBig2_ArithIntDecoder); - nonstd::unique_ptr<CJBig2_ArithIntDecoder> IAIT(new CJBig2_ArithIntDecoder); - nonstd::unique_ptr<CJBig2_ArithIntDecoder> IARI(new CJBig2_ArithIntDecoder); - nonstd::unique_ptr<CJBig2_ArithIntDecoder> IARDW(new CJBig2_ArithIntDecoder); - nonstd::unique_ptr<CJBig2_ArithIntDecoder> IARDH(new CJBig2_ArithIntDecoder); + std::unique_ptr<CJBig2_ArithIaidDecoder> IAID; + std::unique_ptr<CJBig2_SymbolDict> pDict; + std::unique_ptr<CJBig2_ArithIntDecoder> IADH(new CJBig2_ArithIntDecoder); + std::unique_ptr<CJBig2_ArithIntDecoder> IADW(new CJBig2_ArithIntDecoder); + std::unique_ptr<CJBig2_ArithIntDecoder> IAAI(new CJBig2_ArithIntDecoder); + std::unique_ptr<CJBig2_ArithIntDecoder> IARDX(new CJBig2_ArithIntDecoder); + std::unique_ptr<CJBig2_ArithIntDecoder> IARDY(new CJBig2_ArithIntDecoder); + std::unique_ptr<CJBig2_ArithIntDecoder> IAEX(new CJBig2_ArithIntDecoder); + std::unique_ptr<CJBig2_ArithIntDecoder> IADT(new CJBig2_ArithIntDecoder); + std::unique_ptr<CJBig2_ArithIntDecoder> IAFS(new CJBig2_ArithIntDecoder); + std::unique_ptr<CJBig2_ArithIntDecoder> IADS(new CJBig2_ArithIntDecoder); + std::unique_ptr<CJBig2_ArithIntDecoder> IAIT(new CJBig2_ArithIntDecoder); + std::unique_ptr<CJBig2_ArithIntDecoder> IARI(new CJBig2_ArithIntDecoder); + std::unique_ptr<CJBig2_ArithIntDecoder> IARDW(new CJBig2_ArithIntDecoder); + std::unique_ptr<CJBig2_ArithIntDecoder> IARDH(new CJBig2_ArithIntDecoder); nTmp = 0; while ((FX_DWORD)(1 << nTmp) < (SDNUMINSYMS + SDNUMNEWSYMS)) { nTmp++; @@ -92,7 +92,7 @@ CJBig2_SymbolDict* CJBig2_SDDProc::decode_Arith( } TOTWIDTH = TOTWIDTH + SYMWIDTH; if (SDREFAGG == 0) { - nonstd::unique_ptr<CJBig2_GRDProc> pGRD(new CJBig2_GRDProc()); + std::unique_ptr<CJBig2_GRDProc> pGRD(new CJBig2_GRDProc()); pGRD->MMR = 0; pGRD->GBW = SYMWIDTH; pGRD->GBH = HCHEIGHT; @@ -114,7 +114,7 @@ CJBig2_SymbolDict* CJBig2_SDDProc::decode_Arith( } else { IAAI->decode(pArithDecoder, (int*)&REFAGGNINST); if (REFAGGNINST > 1) { - nonstd::unique_ptr<CJBig2_TRDProc> pDecoder(new CJBig2_TRDProc()); + std::unique_ptr<CJBig2_TRDProc> pDecoder(new CJBig2_TRDProc()); pDecoder->SBHUFF = SDHUFF; pDecoder->SBREFINE = 1; pDecoder->SBW = SYMWIDTH; @@ -139,35 +139,32 @@ CJBig2_SymbolDict* CJBig2_SDDProc::decode_Arith( pDecoder->TRANSPOSED = 0; pDecoder->REFCORNER = JBIG2_CORNER_TOPLEFT; pDecoder->SBDSOFFSET = 0; - nonstd::unique_ptr<CJBig2_HuffmanTable> SBHUFFFS( - new CJBig2_HuffmanTable(HuffmanTable_B6, - FX_ArraySize(HuffmanTable_B6), - HuffmanTable_HTOOB_B6)); - nonstd::unique_ptr<CJBig2_HuffmanTable> SBHUFFDS( - new CJBig2_HuffmanTable(HuffmanTable_B8, - FX_ArraySize(HuffmanTable_B8), - HuffmanTable_HTOOB_B8)); - nonstd::unique_ptr<CJBig2_HuffmanTable> SBHUFFDT( - new CJBig2_HuffmanTable(HuffmanTable_B11, - FX_ArraySize(HuffmanTable_B11), - HuffmanTable_HTOOB_B11)); - nonstd::unique_ptr<CJBig2_HuffmanTable> SBHUFFRDW( + std::unique_ptr<CJBig2_HuffmanTable> SBHUFFFS(new CJBig2_HuffmanTable( + HuffmanTable_B6, FX_ArraySize(HuffmanTable_B6), + HuffmanTable_HTOOB_B6)); + std::unique_ptr<CJBig2_HuffmanTable> SBHUFFDS(new CJBig2_HuffmanTable( + HuffmanTable_B8, FX_ArraySize(HuffmanTable_B8), + HuffmanTable_HTOOB_B8)); + std::unique_ptr<CJBig2_HuffmanTable> SBHUFFDT(new CJBig2_HuffmanTable( + HuffmanTable_B11, FX_ArraySize(HuffmanTable_B11), + HuffmanTable_HTOOB_B11)); + std::unique_ptr<CJBig2_HuffmanTable> SBHUFFRDW( new CJBig2_HuffmanTable(HuffmanTable_B15, FX_ArraySize(HuffmanTable_B15), HuffmanTable_HTOOB_B15)); - nonstd::unique_ptr<CJBig2_HuffmanTable> SBHUFFRDH( + std::unique_ptr<CJBig2_HuffmanTable> SBHUFFRDH( new CJBig2_HuffmanTable(HuffmanTable_B15, FX_ArraySize(HuffmanTable_B15), HuffmanTable_HTOOB_B15)); - nonstd::unique_ptr<CJBig2_HuffmanTable> SBHUFFRDX( + std::unique_ptr<CJBig2_HuffmanTable> SBHUFFRDX( new CJBig2_HuffmanTable(HuffmanTable_B15, FX_ArraySize(HuffmanTable_B15), HuffmanTable_HTOOB_B15)); - nonstd::unique_ptr<CJBig2_HuffmanTable> SBHUFFRDY( + std::unique_ptr<CJBig2_HuffmanTable> SBHUFFRDY( new CJBig2_HuffmanTable(HuffmanTable_B15, FX_ArraySize(HuffmanTable_B15), HuffmanTable_HTOOB_B15)); - nonstd::unique_ptr<CJBig2_HuffmanTable> SBHUFFRSIZE( + std::unique_ptr<CJBig2_HuffmanTable> SBHUFFRSIZE( new CJBig2_HuffmanTable(HuffmanTable_B1, FX_ArraySize(HuffmanTable_B1), HuffmanTable_HTOOB_B1)); @@ -218,7 +215,7 @@ CJBig2_SymbolDict* CJBig2_SDDProc::decode_Arith( FX_Free(SBSYMS); goto failed; } - nonstd::unique_ptr<CJBig2_GRRDProc> pGRRD(new CJBig2_GRRDProc()); + std::unique_ptr<CJBig2_GRRDProc> pGRRD(new CJBig2_GRRDProc()); pGRRD->GRW = SYMWIDTH; pGRRD->GRH = HCHEIGHT; pGRRD->GRTEMPLATE = SDRTEMPLATE; @@ -315,7 +312,7 @@ CJBig2_SymbolDict* CJBig2_SDDProc::decode_Huffman( FX_DWORD BMSIZE; FX_DWORD stride; CJBig2_Image** SBSYMS; - nonstd::unique_ptr<CJBig2_HuffmanDecoder> pHuffmanDecoder( + std::unique_ptr<CJBig2_HuffmanDecoder> pHuffmanDecoder( new CJBig2_HuffmanDecoder(pStream)); SDNEWSYMS = FX_Alloc(CJBig2_Image*, SDNUMNEWSYMS); FXSYS_memset(SDNEWSYMS, 0, SDNUMNEWSYMS * sizeof(CJBig2_Image*)); @@ -325,8 +322,8 @@ CJBig2_SymbolDict* CJBig2_SDDProc::decode_Huffman( SDNEWSYMWIDTHS = FX_Alloc(FX_DWORD, SDNUMNEWSYMS); FXSYS_memset(SDNEWSYMWIDTHS, 0, SDNUMNEWSYMS * sizeof(FX_DWORD)); } - nonstd::unique_ptr<CJBig2_SymbolDict> pDict(new CJBig2_SymbolDict()); - nonstd::unique_ptr<CJBig2_HuffmanTable> pTable; + std::unique_ptr<CJBig2_SymbolDict> pDict(new CJBig2_SymbolDict()); + std::unique_ptr<CJBig2_HuffmanTable> pTable; HCHEIGHT = 0; NSYMSDECODED = 0; @@ -370,7 +367,7 @@ CJBig2_SymbolDict* CJBig2_SDDProc::decode_Huffman( } BS = nullptr; if (REFAGGNINST > 1) { - nonstd::unique_ptr<CJBig2_TRDProc> pDecoder(new CJBig2_TRDProc()); + std::unique_ptr<CJBig2_TRDProc> pDecoder(new CJBig2_TRDProc()); pDecoder->SBHUFF = SDHUFF; pDecoder->SBREFINE = 1; pDecoder->SBW = SYMWIDTH; @@ -399,35 +396,32 @@ CJBig2_SymbolDict* CJBig2_SDDProc::decode_Huffman( pDecoder->TRANSPOSED = 0; pDecoder->REFCORNER = JBIG2_CORNER_TOPLEFT; pDecoder->SBDSOFFSET = 0; - nonstd::unique_ptr<CJBig2_HuffmanTable> SBHUFFFS( - new CJBig2_HuffmanTable(HuffmanTable_B6, - FX_ArraySize(HuffmanTable_B6), - HuffmanTable_HTOOB_B6)); - nonstd::unique_ptr<CJBig2_HuffmanTable> SBHUFFDS( - new CJBig2_HuffmanTable(HuffmanTable_B8, - FX_ArraySize(HuffmanTable_B8), - HuffmanTable_HTOOB_B8)); - nonstd::unique_ptr<CJBig2_HuffmanTable> SBHUFFDT( - new CJBig2_HuffmanTable(HuffmanTable_B11, - FX_ArraySize(HuffmanTable_B11), - HuffmanTable_HTOOB_B11)); - nonstd::unique_ptr<CJBig2_HuffmanTable> SBHUFFRDW( + std::unique_ptr<CJBig2_HuffmanTable> SBHUFFFS(new CJBig2_HuffmanTable( + HuffmanTable_B6, FX_ArraySize(HuffmanTable_B6), + HuffmanTable_HTOOB_B6)); + std::unique_ptr<CJBig2_HuffmanTable> SBHUFFDS(new CJBig2_HuffmanTable( + HuffmanTable_B8, FX_ArraySize(HuffmanTable_B8), + HuffmanTable_HTOOB_B8)); + std::unique_ptr<CJBig2_HuffmanTable> SBHUFFDT(new CJBig2_HuffmanTable( + HuffmanTable_B11, FX_ArraySize(HuffmanTable_B11), + HuffmanTable_HTOOB_B11)); + std::unique_ptr<CJBig2_HuffmanTable> SBHUFFRDW( new CJBig2_HuffmanTable(HuffmanTable_B15, FX_ArraySize(HuffmanTable_B15), HuffmanTable_HTOOB_B15)); - nonstd::unique_ptr<CJBig2_HuffmanTable> SBHUFFRDH( + std::unique_ptr<CJBig2_HuffmanTable> SBHUFFRDH( new CJBig2_HuffmanTable(HuffmanTable_B15, FX_ArraySize(HuffmanTable_B15), HuffmanTable_HTOOB_B15)); - nonstd::unique_ptr<CJBig2_HuffmanTable> SBHUFFRDX( + std::unique_ptr<CJBig2_HuffmanTable> SBHUFFRDX( new CJBig2_HuffmanTable(HuffmanTable_B15, FX_ArraySize(HuffmanTable_B15), HuffmanTable_HTOOB_B15)); - nonstd::unique_ptr<CJBig2_HuffmanTable> SBHUFFRDY( + std::unique_ptr<CJBig2_HuffmanTable> SBHUFFRDY( new CJBig2_HuffmanTable(HuffmanTable_B15, FX_ArraySize(HuffmanTable_B15), HuffmanTable_HTOOB_B15)); - nonstd::unique_ptr<CJBig2_HuffmanTable> SBHUFFRSIZE( + std::unique_ptr<CJBig2_HuffmanTable> SBHUFFRSIZE( new CJBig2_HuffmanTable(HuffmanTable_B1, FX_ArraySize(HuffmanTable_B1), HuffmanTable_HTOOB_B1)); @@ -483,11 +477,11 @@ CJBig2_SymbolDict* CJBig2_SDDProc::decode_Huffman( } } FX_Free(SBSYMCODES); - nonstd::unique_ptr<CJBig2_HuffmanTable> SBHUFFRDX( + std::unique_ptr<CJBig2_HuffmanTable> SBHUFFRDX( new CJBig2_HuffmanTable(HuffmanTable_B15, FX_ArraySize(HuffmanTable_B15), HuffmanTable_HTOOB_B15)); - nonstd::unique_ptr<CJBig2_HuffmanTable> SBHUFFRSIZE( + std::unique_ptr<CJBig2_HuffmanTable> SBHUFFRSIZE( new CJBig2_HuffmanTable(HuffmanTable_B1, FX_ArraySize(HuffmanTable_B1), HuffmanTable_HTOOB_B1)); @@ -502,7 +496,7 @@ CJBig2_SymbolDict* CJBig2_SDDProc::decode_Huffman( JBIG2_memcpy(SBSYMS, SDINSYMS, SDNUMINSYMS * sizeof(CJBig2_Image*)); JBIG2_memcpy(SBSYMS + SDNUMINSYMS, SDNEWSYMS, NSYMSDECODED * sizeof(CJBig2_Image*)); - nonstd::unique_ptr<CJBig2_GRRDProc> pGRRD(new CJBig2_GRRDProc()); + std::unique_ptr<CJBig2_GRRDProc> pGRRD(new CJBig2_GRRDProc()); pGRRD->GRW = SYMWIDTH; pGRRD->GRH = HCHEIGHT; pGRRD->GRTEMPLATE = SDRTEMPLATE; @@ -514,7 +508,7 @@ CJBig2_SymbolDict* CJBig2_SDDProc::decode_Huffman( pGRRD->GRAT[1] = SDRAT[1]; pGRRD->GRAT[2] = SDRAT[2]; pGRRD->GRAT[3] = SDRAT[3]; - nonstd::unique_ptr<CJBig2_ArithDecoder> pArithDecoder( + std::unique_ptr<CJBig2_ArithDecoder> pArithDecoder( new CJBig2_ArithDecoder(pStream)); BS = pGRRD->decode(pArithDecoder.get(), grContext->data()); if (!BS) { @@ -555,7 +549,7 @@ CJBig2_SymbolDict* CJBig2_SDDProc::decode_Huffman( goto failed; } } else { - nonstd::unique_ptr<CJBig2_GRDProc> pGRD(new CJBig2_GRDProc()); + std::unique_ptr<CJBig2_GRDProc> pGRD(new CJBig2_GRDProc()); pGRD->MMR = 1; pGRD->GBW = TOTWIDTH; pGRD->GBH = HCHEIGHT; diff --git a/core/src/fxcodec/jbig2/JBig2_SymbolDict.cpp b/core/src/fxcodec/jbig2/JBig2_SymbolDict.cpp index b1e56c0061..1e949c5d26 100644 --- a/core/src/fxcodec/jbig2/JBig2_SymbolDict.cpp +++ b/core/src/fxcodec/jbig2/JBig2_SymbolDict.cpp @@ -15,9 +15,9 @@ CJBig2_SymbolDict::CJBig2_SymbolDict() { CJBig2_SymbolDict::~CJBig2_SymbolDict() { } -nonstd::unique_ptr<CJBig2_SymbolDict> CJBig2_SymbolDict::DeepCopy() const { +std::unique_ptr<CJBig2_SymbolDict> CJBig2_SymbolDict::DeepCopy() const { const CJBig2_SymbolDict* src = this; - nonstd::unique_ptr<CJBig2_SymbolDict> dst(new CJBig2_SymbolDict); + std::unique_ptr<CJBig2_SymbolDict> dst(new CJBig2_SymbolDict); for (size_t i = 0; i < src->m_SDEXSYMS.size(); ++i) { CJBig2_Image* image = src->m_SDEXSYMS.get(i); dst->m_SDEXSYMS.push_back(image ? new CJBig2_Image(*image) : nullptr); diff --git a/core/src/fxcodec/jbig2/JBig2_SymbolDict.h b/core/src/fxcodec/jbig2/JBig2_SymbolDict.h index 5c7fe3c479..6f6b303640 100644 --- a/core/src/fxcodec/jbig2/JBig2_SymbolDict.h +++ b/core/src/fxcodec/jbig2/JBig2_SymbolDict.h @@ -7,12 +7,12 @@ #ifndef CORE_SRC_FXCODEC_JBIG2_JBIG2_SYMBOLDICT_H_ #define CORE_SRC_FXCODEC_JBIG2_JBIG2_SYMBOLDICT_H_ +#include <memory> #include <vector> #include "JBig2_ArithDecoder.h" #include "JBig2_List.h" #include "core/include/fxcrt/fx_basic.h" -#include "third_party/base/nonstd_unique_ptr.h" class CJBig2_Image; @@ -21,7 +21,7 @@ class CJBig2_SymbolDict { CJBig2_SymbolDict(); ~CJBig2_SymbolDict(); - nonstd::unique_ptr<CJBig2_SymbolDict> DeepCopy() const; + std::unique_ptr<CJBig2_SymbolDict> DeepCopy() const; // Takes ownership of |image|. void AddImage(CJBig2_Image* image) { m_SDEXSYMS.push_back(image); } diff --git a/core/src/fxcodec/jbig2/JBig2_TrdProc.cpp b/core/src/fxcodec/jbig2/JBig2_TrdProc.cpp index d76beea8e2..e3fd47894e 100644 --- a/core/src/fxcodec/jbig2/JBig2_TrdProc.cpp +++ b/core/src/fxcodec/jbig2/JBig2_TrdProc.cpp @@ -6,11 +6,12 @@ #include "JBig2_TrdProc.h" +#include <memory> + #include "JBig2_ArithDecoder.h" #include "JBig2_ArithIntDecoder.h" #include "JBig2_GrrdProc.h" #include "JBig2_HuffmanDecoder.h" -#include "third_party/base/nonstd_unique_ptr.h" CJBig2_Image* CJBig2_TRDProc::decode_Huffman(CJBig2_BitStream* pStream, JBig2ArithCtx* grContext) { @@ -28,9 +29,9 @@ CJBig2_Image* CJBig2_TRDProc::decode_Huffman(CJBig2_BitStream* pStream, FX_BOOL bFirst; FX_DWORD nTmp; int32_t nVal, nBits; - nonstd::unique_ptr<CJBig2_HuffmanDecoder> pHuffmanDecoder( + std::unique_ptr<CJBig2_HuffmanDecoder> pHuffmanDecoder( new CJBig2_HuffmanDecoder(pStream)); - nonstd::unique_ptr<CJBig2_Image> SBREG(new CJBig2_Image(SBW, SBH)); + std::unique_ptr<CJBig2_Image> SBREG(new CJBig2_Image(SBW, SBH)); SBREG->fill(SBDEFPIXEL); if (pHuffmanDecoder->decodeAValue(SBHUFFDT, &STRIPT) != 0) return nullptr; @@ -123,7 +124,7 @@ CJBig2_Image* CJBig2_TRDProc::decode_Huffman(CJBig2_BitStream* pStream, if ((int)(WOI + RDWI) < 0 || (int)(HOI + RDHI) < 0) return nullptr; - nonstd::unique_ptr<CJBig2_GRRDProc> pGRRD(new CJBig2_GRRDProc()); + std::unique_ptr<CJBig2_GRRDProc> pGRRD(new CJBig2_GRRDProc()); pGRRD->GRW = WOI + RDWI; pGRRD->GRH = HOI + RDHI; pGRRD->GRTEMPLATE = SBRTEMPLATE; @@ -137,7 +138,7 @@ CJBig2_Image* CJBig2_TRDProc::decode_Huffman(CJBig2_BitStream* pStream, pGRRD->GRAT[3] = SBRAT[3]; { - nonstd::unique_ptr<CJBig2_ArithDecoder> pArithDecoder( + std::unique_ptr<CJBig2_ArithDecoder> pArithDecoder( new CJBig2_ArithDecoder(pStream)); IBI = pGRRD->decode(pArithDecoder.get(), grContext); if (!IBI) @@ -255,7 +256,7 @@ CJBig2_Image* CJBig2_TRDProc::decode_Arith(CJBig2_ArithDecoder* pArithDecoder, IAID = new CJBig2_ArithIaidDecoder(SBSYMCODELEN); bRetained = FALSE; } - nonstd::unique_ptr<CJBig2_Image> SBREG(new CJBig2_Image(SBW, SBH)); + std::unique_ptr<CJBig2_Image> SBREG(new CJBig2_Image(SBW, SBH)); SBREG->fill(SBDEFPIXEL); IADT->decode(pArithDecoder, &STRIPT); STRIPT *= SBSTRIPS; @@ -312,7 +313,7 @@ CJBig2_Image* CJBig2_TRDProc::decode_Arith(CJBig2_ArithDecoder* pArithDecoder, if ((int)(WOI + RDWI) < 0 || (int)(HOI + RDHI) < 0) { goto failed; } - nonstd::unique_ptr<CJBig2_GRRDProc> pGRRD(new CJBig2_GRRDProc()); + std::unique_ptr<CJBig2_GRRDProc> pGRRD(new CJBig2_GRRDProc()); pGRRD->GRW = WOI + RDWI; pGRRD->GRH = HOI + RDHI; pGRRD->GRTEMPLATE = SBRTEMPLATE; |