mirror of
https://github.com/Xevion/easy7zip.git
synced 2025-12-10 08:07:09 -06:00
4.44 beta
This commit is contained in:
committed by
Kornel Lesiński
parent
804edc5756
commit
d9666cf046
109
CPP/7zip/Compress/LZMA/DllExports.cpp
Executable file
109
CPP/7zip/Compress/LZMA/DllExports.cpp
Executable file
@@ -0,0 +1,109 @@
|
||||
// DLLExports.cpp
|
||||
|
||||
#include "StdAfx.h"
|
||||
|
||||
#include "../../../Common/MyInitGuid.h"
|
||||
#include "../../../Common/ComTry.h"
|
||||
#ifdef _WIN32
|
||||
#include "../../../Common/Alloc.h"
|
||||
#endif
|
||||
|
||||
#include "LZMAEncoder.h"
|
||||
#include "LZMADecoder.h"
|
||||
|
||||
#ifdef CRC_GENERATE_TABLE
|
||||
extern "C"
|
||||
{
|
||||
#include "../../../../C/7zCrc.h"
|
||||
}
|
||||
#endif
|
||||
|
||||
// {23170F69-40C1-278B-0301-010000000000}
|
||||
DEFINE_GUID(CLSID_CLZMADecoder,
|
||||
0x23170F69, 0x40C1, 0x278B, 0x03, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00);
|
||||
|
||||
// {23170F69-40C1-278B-0301-010000000100}
|
||||
DEFINE_GUID(CLSID_CLZMAEncoder,
|
||||
0x23170F69, 0x40C1, 0x278B, 0x03, 0x01, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00);
|
||||
|
||||
extern "C"
|
||||
BOOL WINAPI DllMain(HINSTANCE /* hInstance */, DWORD dwReason, LPVOID /*lpReserved*/)
|
||||
{
|
||||
if (dwReason == DLL_PROCESS_ATTACH)
|
||||
{
|
||||
// NCompress::NRangeCoder::g_PriceTables.Init();
|
||||
#ifdef CRC_GENERATE_TABLE
|
||||
CrcGenerateTable();
|
||||
#endif
|
||||
#ifdef _WIN32
|
||||
SetLargePageSize();
|
||||
#endif
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
STDAPI CreateObject(const GUID *clsid, const GUID *iid, void **outObject)
|
||||
{
|
||||
// NCompress::NRangeCoder::g_PriceTables.Init();
|
||||
// CCRC::InitTable();
|
||||
COM_TRY_BEGIN
|
||||
*outObject = 0;
|
||||
int correctInterface = (*iid == IID_ICompressCoder);
|
||||
CMyComPtr<ICompressCoder> coder;
|
||||
if (*clsid == CLSID_CLZMADecoder)
|
||||
{
|
||||
if (!correctInterface)
|
||||
return E_NOINTERFACE;
|
||||
coder = (ICompressCoder *)new NCompress::NLZMA::CDecoder();
|
||||
}
|
||||
else if (*clsid == CLSID_CLZMAEncoder)
|
||||
{
|
||||
if (!correctInterface)
|
||||
return E_NOINTERFACE;
|
||||
coder = (ICompressCoder *)new NCompress::NLZMA::CEncoder();
|
||||
}
|
||||
else
|
||||
return CLASS_E_CLASSNOTAVAILABLE;
|
||||
*outObject = coder.Detach();
|
||||
COM_TRY_END
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDAPI GetNumberOfMethods(UINT32 *numMethods)
|
||||
{
|
||||
*numMethods = 1;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDAPI GetMethodProperty(UINT32 index, PROPID propID, PROPVARIANT *value)
|
||||
{
|
||||
if (index != 0)
|
||||
return E_INVALIDARG;
|
||||
// ::VariantClear((tagVARIANT *)value);
|
||||
switch(propID)
|
||||
{
|
||||
case NMethodPropID::kID:
|
||||
{
|
||||
const char id[] = { 0x03, 0x01, 0x01 };
|
||||
if ((value->bstrVal = ::SysAllocStringByteLen(id, sizeof(id))) != 0)
|
||||
value->vt = VT_BSTR;
|
||||
return S_OK;
|
||||
}
|
||||
case NMethodPropID::kName:
|
||||
if ((value->bstrVal = ::SysAllocString(L"LZMA")) != 0)
|
||||
value->vt = VT_BSTR;
|
||||
return S_OK;
|
||||
case NMethodPropID::kDecoder:
|
||||
if ((value->bstrVal = ::SysAllocStringByteLen(
|
||||
(const char *)&CLSID_CLZMADecoder, sizeof(GUID))) != 0)
|
||||
value->vt = VT_BSTR;
|
||||
return S_OK;
|
||||
case NMethodPropID::kEncoder:
|
||||
if ((value->bstrVal = ::SysAllocStringByteLen(
|
||||
(const char *)&CLSID_CLZMAEncoder, sizeof(GUID))) != 0)
|
||||
value->vt = VT_BSTR;
|
||||
return S_OK;
|
||||
}
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
478
CPP/7zip/Compress/LZMA/LZMA.dsp
Executable file
478
CPP/7zip/Compress/LZMA/LZMA.dsp
Executable file
@@ -0,0 +1,478 @@
|
||||
# Microsoft Developer Studio Project File - Name="LZMA" - Package Owner=<4>
|
||||
# Microsoft Developer Studio Generated Build File, Format Version 6.00
|
||||
# ** DO NOT EDIT **
|
||||
|
||||
# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
|
||||
|
||||
CFG=LZMA - Win32 Debug
|
||||
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
|
||||
!MESSAGE use the Export Makefile command and run
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "LZMA.mak".
|
||||
!MESSAGE
|
||||
!MESSAGE You can specify a configuration when running NMAKE
|
||||
!MESSAGE by defining the macro CFG on the command line. For example:
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "LZMA.mak" CFG="LZMA - Win32 Debug"
|
||||
!MESSAGE
|
||||
!MESSAGE Possible choices for configuration are:
|
||||
!MESSAGE
|
||||
!MESSAGE "LZMA - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
|
||||
!MESSAGE "LZMA - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
|
||||
!MESSAGE
|
||||
|
||||
# Begin Project
|
||||
# PROP AllowPerConfigDependencies 0
|
||||
# PROP Scc_ProjName ""
|
||||
# PROP Scc_LocalPath ""
|
||||
CPP=cl.exe
|
||||
MTL=midl.exe
|
||||
RSC=rc.exe
|
||||
|
||||
!IF "$(CFG)" == "LZMA - Win32 Release"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 0
|
||||
# PROP BASE Output_Dir "Release"
|
||||
# PROP BASE Intermediate_Dir "Release"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 0
|
||||
# PROP Output_Dir "Release"
|
||||
# PROP Intermediate_Dir "Release"
|
||||
# PROP Ignore_Export_Lib 1
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LZMA_EXPORTS" /YX /FD /c
|
||||
# ADD CPP /nologo /Gz /MD /W3 /GX /O1 /I "../../../" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LZMA_EXPORTS" /D "COMPRESS_MF_MT" /D "_ST_MODE" /Yu"StdAfx.h" /FD /c
|
||||
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
|
||||
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
|
||||
# ADD BASE RSC /l 0x419 /d "NDEBUG"
|
||||
# ADD RSC /l 0x419 /d "NDEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
|
||||
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"C:\Program Files\7-zip\Codecs\LZMA.dll" /opt:NOWIN98
|
||||
# SUBTRACT LINK32 /pdb:none /debug
|
||||
|
||||
!ELSEIF "$(CFG)" == "LZMA - Win32 Debug"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 1
|
||||
# PROP BASE Output_Dir "Debug"
|
||||
# PROP BASE Intermediate_Dir "Debug"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 1
|
||||
# PROP Output_Dir "Debug"
|
||||
# PROP Intermediate_Dir "Debug"
|
||||
# PROP Ignore_Export_Lib 1
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LZMA_EXPORTS" /YX /FD /GZ /c
|
||||
# ADD CPP /nologo /Gz /MTd /W3 /Gm /GX /ZI /Od /I "../../../" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LZMA_EXPORTS" /D "COMPRESS_MF_MT" /D "_ST_MODE" /Yu"StdAfx.h" /FD /GZ /c
|
||||
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
|
||||
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
|
||||
# ADD BASE RSC /l 0x419 /d "_DEBUG"
|
||||
# ADD RSC /l 0x419 /d "_DEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
|
||||
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"C:\Program Files\7-zip\Codecs\LZMA.dll" /pdbtype:sept
|
||||
|
||||
!ENDIF
|
||||
|
||||
# Begin Target
|
||||
|
||||
# Name "LZMA - Win32 Release"
|
||||
# Name "LZMA - Win32 Debug"
|
||||
# Begin Group "Spec"
|
||||
|
||||
# PROP Default_Filter ""
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\Codec.def
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\DllExports.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\resource.rc
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\StdAfx.cpp
|
||||
# ADD CPP /Yc"StdAfx.h"
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\StdAfx.h
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "7-zip Common"
|
||||
|
||||
# PROP Default_Filter ""
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\Common\InBuffer.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\Common\InBuffer.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\Common\OutBuffer.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\Common\OutBuffer.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\Common\StreamUtils.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\Common\StreamUtils.h
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "RangeCoder"
|
||||
|
||||
# PROP Default_Filter ""
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\RangeCoder\RangeCoder.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\RangeCoder\RangeCoderBit.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\RangeCoder\RangeCoderBit.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\RangeCoder\RangeCoderBitTree.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\RangeCoder\RangeCoderOpt.h
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Interface"
|
||||
|
||||
# PROP Default_Filter ""
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\ICoder.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\MatchFinders\IMatchFinder.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\IStream.h
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "LZ"
|
||||
|
||||
# PROP Default_Filter ""
|
||||
# Begin Group "BT"
|
||||
|
||||
# PROP Default_Filter ""
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\LZ\BinTree\BinTree.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\LZ\BinTree\BinTree2.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\LZ\BinTree\BinTree3.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\LZ\BinTree\BinTree4.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\LZ\BinTree\BinTreeBase.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\LZ\BinTree\BinTreeD.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\LZ\BinTree\BinTreeD4.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\LZ\BinTree\BinTreeDMain.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\LZ\BinTree\BinTreeMain.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\LZ\BinTree\BinTreeR.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\LZ\BinTree\BinTreeR4.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\LZ\BinTree\BinTreeRMain.h
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "HC"
|
||||
|
||||
# PROP Default_Filter ""
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\LZ\HashChain\HC4.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\LZ\HashChain\HCMain.h
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\LZ\IMatchFinder.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\LZ\LZInWindow.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\LZ\LZOutWindow.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\LZ\LZOutWindow.h
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Common"
|
||||
|
||||
# PROP Default_Filter ""
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Common\AlignedBuffer.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Common\AlignedBuffer.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Common\Alloc.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Common\Alloc.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Common\ComTry.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Common\CRC.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Common\CRC.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Common\Defs.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Common\Exception.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Common\MyCom.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Common\MyUnknown.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Common\MyWindows.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Common\NewHandler.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Common\NewHandler.h
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Windows"
|
||||
|
||||
# PROP Default_Filter ""
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Windows\Handle.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Windows\Synchronization.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Windows\Synchronization.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\Windows\Thread.h
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "C"
|
||||
|
||||
# PROP Default_Filter ""
|
||||
# Begin Group "C_Lz"
|
||||
|
||||
# PROP Default_Filter ""
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\..\C\Compress\Lz\LzHash.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\..\C\Compress\Lz\MatchFinder.c
|
||||
|
||||
!IF "$(CFG)" == "LZMA - Win32 Release"
|
||||
|
||||
# ADD CPP /O2
|
||||
# SUBTRACT CPP /YX /Yc /Yu
|
||||
|
||||
!ELSEIF "$(CFG)" == "LZMA - Win32 Debug"
|
||||
|
||||
# SUBTRACT CPP /YX /Yc /Yu
|
||||
|
||||
!ENDIF
|
||||
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\..\C\Compress\Lz\MatchFinder.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\..\C\Compress\Lz\MatchFinderMt.c
|
||||
|
||||
!IF "$(CFG)" == "LZMA - Win32 Release"
|
||||
|
||||
# ADD CPP /O2
|
||||
# SUBTRACT CPP /YX /Yc /Yu
|
||||
|
||||
!ELSEIF "$(CFG)" == "LZMA - Win32 Debug"
|
||||
|
||||
# SUBTRACT CPP /YX /Yc /Yu
|
||||
|
||||
!ENDIF
|
||||
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\..\C\Compress\Lz\MatchFinderMt.h
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\..\C\7zCrc.c
|
||||
|
||||
!IF "$(CFG)" == "LZMA - Win32 Release"
|
||||
|
||||
# ADD CPP /O2
|
||||
# SUBTRACT CPP /YX /Yc /Yu
|
||||
|
||||
!ELSEIF "$(CFG)" == "LZMA - Win32 Debug"
|
||||
|
||||
# SUBTRACT CPP /YX /Yc /Yu
|
||||
|
||||
!ENDIF
|
||||
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\..\C\7zCrc.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\..\C\IStream.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\..\C\Threads.c
|
||||
# SUBTRACT CPP /YX /Yc /Yu
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\..\C\Threads.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\..\C\Types.h
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\LZMA.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\LZMADecoder.cpp
|
||||
|
||||
!IF "$(CFG)" == "LZMA - Win32 Release"
|
||||
|
||||
# ADD CPP /O2
|
||||
# SUBTRACT CPP /YX /Yc /Yu
|
||||
|
||||
!ELSEIF "$(CFG)" == "LZMA - Win32 Debug"
|
||||
|
||||
!ENDIF
|
||||
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\LZMADecoder.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\LZMAEncoder.cpp
|
||||
|
||||
!IF "$(CFG)" == "LZMA - Win32 Release"
|
||||
|
||||
# ADD CPP /O2 /FAs
|
||||
# SUBTRACT CPP /YX /Yc /Yu
|
||||
|
||||
!ELSEIF "$(CFG)" == "LZMA - Win32 Debug"
|
||||
|
||||
!ENDIF
|
||||
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\LZMAEncoder.h
|
||||
# End Source File
|
||||
# End Target
|
||||
# End Project
|
||||
29
CPP/7zip/Compress/LZMA/LZMA.dsw
Executable file
29
CPP/7zip/Compress/LZMA/LZMA.dsw
Executable file
@@ -0,0 +1,29 @@
|
||||
Microsoft Developer Studio Workspace File, Format Version 6.00
|
||||
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
|
||||
|
||||
###############################################################################
|
||||
|
||||
Project: "LZMA"=".\LZMA.dsp" - Package Owner=<4>
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<4>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
Global:
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<3>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
82
CPP/7zip/Compress/LZMA/LZMA.h
Executable file
82
CPP/7zip/Compress/LZMA/LZMA.h
Executable file
@@ -0,0 +1,82 @@
|
||||
// LZMA.h
|
||||
|
||||
#ifndef __LZMA_H
|
||||
#define __LZMA_H
|
||||
|
||||
namespace NCompress {
|
||||
namespace NLZMA {
|
||||
|
||||
const UInt32 kNumRepDistances = 4;
|
||||
|
||||
const int kNumStates = 12;
|
||||
|
||||
const Byte kLiteralNextStates[kNumStates] = {0, 0, 0, 0, 1, 2, 3, 4, 5, 6, 4, 5};
|
||||
const Byte kMatchNextStates[kNumStates] = {7, 7, 7, 7, 7, 7, 7, 10, 10, 10, 10, 10};
|
||||
const Byte kRepNextStates[kNumStates] = {8, 8, 8, 8, 8, 8, 8, 11, 11, 11, 11, 11};
|
||||
const Byte kShortRepNextStates[kNumStates]= {9, 9, 9, 9, 9, 9, 9, 11, 11, 11, 11, 11};
|
||||
|
||||
class CState
|
||||
{
|
||||
public:
|
||||
Byte Index;
|
||||
void Init() { Index = 0; }
|
||||
void UpdateChar() { Index = kLiteralNextStates[Index]; }
|
||||
void UpdateMatch() { Index = kMatchNextStates[Index]; }
|
||||
void UpdateRep() { Index = kRepNextStates[Index]; }
|
||||
void UpdateShortRep() { Index = kShortRepNextStates[Index]; }
|
||||
bool IsCharState() const { return Index < 7; }
|
||||
};
|
||||
|
||||
const int kNumPosSlotBits = 6;
|
||||
const int kDicLogSizeMin = 0;
|
||||
const int kDicLogSizeMax = 32;
|
||||
const int kDistTableSizeMax = kDicLogSizeMax * 2;
|
||||
|
||||
const UInt32 kNumLenToPosStates = 4;
|
||||
|
||||
inline UInt32 GetLenToPosState(UInt32 len)
|
||||
{
|
||||
len -= 2;
|
||||
if (len < kNumLenToPosStates)
|
||||
return len;
|
||||
return kNumLenToPosStates - 1;
|
||||
}
|
||||
|
||||
namespace NLength {
|
||||
|
||||
const int kNumPosStatesBitsMax = 4;
|
||||
const UInt32 kNumPosStatesMax = (1 << kNumPosStatesBitsMax);
|
||||
|
||||
const int kNumPosStatesBitsEncodingMax = 4;
|
||||
const UInt32 kNumPosStatesEncodingMax = (1 << kNumPosStatesBitsEncodingMax);
|
||||
|
||||
const int kNumLowBits = 3;
|
||||
const int kNumMidBits = 3;
|
||||
const int kNumHighBits = 8;
|
||||
const UInt32 kNumLowSymbols = 1 << kNumLowBits;
|
||||
const UInt32 kNumMidSymbols = 1 << kNumMidBits;
|
||||
const UInt32 kNumSymbolsTotal = kNumLowSymbols + kNumMidSymbols + (1 << kNumHighBits);
|
||||
|
||||
}
|
||||
|
||||
const UInt32 kMatchMinLen = 2;
|
||||
const UInt32 kMatchMaxLen = kMatchMinLen + NLength::kNumSymbolsTotal - 1;
|
||||
|
||||
const int kNumAlignBits = 4;
|
||||
const UInt32 kAlignTableSize = 1 << kNumAlignBits;
|
||||
const UInt32 kAlignMask = (kAlignTableSize - 1);
|
||||
|
||||
const UInt32 kStartPosModelIndex = 4;
|
||||
const UInt32 kEndPosModelIndex = 14;
|
||||
const UInt32 kNumPosModels = kEndPosModelIndex - kStartPosModelIndex;
|
||||
|
||||
const UInt32 kNumFullDistances = 1 << (kEndPosModelIndex / 2);
|
||||
|
||||
const int kNumLitPosStatesBitsEncodingMax = 4;
|
||||
const int kNumLitContextBitsMax = 8;
|
||||
|
||||
const int kNumMoveBits = 5;
|
||||
|
||||
}}
|
||||
|
||||
#endif
|
||||
338
CPP/7zip/Compress/LZMA/LZMADecoder.cpp
Executable file
338
CPP/7zip/Compress/LZMA/LZMADecoder.cpp
Executable file
@@ -0,0 +1,338 @@
|
||||
// LZMADecoder.cpp
|
||||
|
||||
#include "StdAfx.h"
|
||||
|
||||
#include "LZMADecoder.h"
|
||||
#include "../../../Common/Defs.h"
|
||||
|
||||
namespace NCompress {
|
||||
namespace NLZMA {
|
||||
|
||||
const int kLenIdFinished = -1;
|
||||
const int kLenIdNeedInit = -2;
|
||||
|
||||
void CDecoder::Init()
|
||||
{
|
||||
{
|
||||
for(int i = 0; i < kNumStates; i++)
|
||||
{
|
||||
for (UInt32 j = 0; j <= _posStateMask; j++)
|
||||
{
|
||||
_isMatch[i][j].Init();
|
||||
_isRep0Long[i][j].Init();
|
||||
}
|
||||
_isRep[i].Init();
|
||||
_isRepG0[i].Init();
|
||||
_isRepG1[i].Init();
|
||||
_isRepG2[i].Init();
|
||||
}
|
||||
}
|
||||
{
|
||||
for (UInt32 i = 0; i < kNumLenToPosStates; i++)
|
||||
_posSlotDecoder[i].Init();
|
||||
}
|
||||
{
|
||||
for(UInt32 i = 0; i < kNumFullDistances - kEndPosModelIndex; i++)
|
||||
_posDecoders[i].Init();
|
||||
}
|
||||
_posAlignDecoder.Init();
|
||||
_lenDecoder.Init(_posStateMask + 1);
|
||||
_repMatchLenDecoder.Init(_posStateMask + 1);
|
||||
_literalDecoder.Init();
|
||||
|
||||
_state.Init();
|
||||
_reps[0] = _reps[1] = _reps[2] = _reps[3] = 0;
|
||||
}
|
||||
|
||||
HRESULT CDecoder::CodeSpec(UInt32 curSize)
|
||||
{
|
||||
if (_outSizeDefined)
|
||||
{
|
||||
const UInt64 rem = _outSize - _outWindowStream.GetProcessedSize();
|
||||
if (curSize > rem)
|
||||
curSize = (UInt32)rem;
|
||||
}
|
||||
|
||||
if (_remainLen == kLenIdFinished)
|
||||
return S_OK;
|
||||
if (_remainLen == kLenIdNeedInit)
|
||||
{
|
||||
_rangeDecoder.Init();
|
||||
Init();
|
||||
_remainLen = 0;
|
||||
}
|
||||
if (curSize == 0)
|
||||
return S_OK;
|
||||
|
||||
UInt32 rep0 = _reps[0];
|
||||
UInt32 rep1 = _reps[1];
|
||||
UInt32 rep2 = _reps[2];
|
||||
UInt32 rep3 = _reps[3];
|
||||
CState state = _state;
|
||||
Byte previousByte;
|
||||
|
||||
while(_remainLen > 0 && curSize > 0)
|
||||
{
|
||||
previousByte = _outWindowStream.GetByte(rep0);
|
||||
_outWindowStream.PutByte(previousByte);
|
||||
_remainLen--;
|
||||
curSize--;
|
||||
}
|
||||
UInt64 nowPos64 = _outWindowStream.GetProcessedSize();
|
||||
if (nowPos64 == 0)
|
||||
previousByte = 0;
|
||||
else
|
||||
previousByte = _outWindowStream.GetByte(0);
|
||||
|
||||
while(curSize > 0)
|
||||
{
|
||||
{
|
||||
#ifdef _NO_EXCEPTIONS
|
||||
if (_rangeDecoder.Stream.ErrorCode != S_OK)
|
||||
return _rangeDecoder.Stream.ErrorCode;
|
||||
#endif
|
||||
if (_rangeDecoder.Stream.WasFinished())
|
||||
return S_FALSE;
|
||||
UInt32 posState = UInt32(nowPos64) & _posStateMask;
|
||||
if (_isMatch[state.Index][posState].Decode(&_rangeDecoder) == 0)
|
||||
{
|
||||
if(!state.IsCharState())
|
||||
previousByte = _literalDecoder.DecodeWithMatchByte(&_rangeDecoder,
|
||||
(UInt32)nowPos64, previousByte, _outWindowStream.GetByte(rep0));
|
||||
else
|
||||
previousByte = _literalDecoder.DecodeNormal(&_rangeDecoder,
|
||||
(UInt32)nowPos64, previousByte);
|
||||
_outWindowStream.PutByte(previousByte);
|
||||
state.UpdateChar();
|
||||
curSize--;
|
||||
nowPos64++;
|
||||
}
|
||||
else
|
||||
{
|
||||
UInt32 len;
|
||||
if(_isRep[state.Index].Decode(&_rangeDecoder) == 1)
|
||||
{
|
||||
len = 0;
|
||||
if(_isRepG0[state.Index].Decode(&_rangeDecoder) == 0)
|
||||
{
|
||||
if(_isRep0Long[state.Index][posState].Decode(&_rangeDecoder) == 0)
|
||||
{
|
||||
state.UpdateShortRep();
|
||||
len = 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
UInt32 distance;
|
||||
if(_isRepG1[state.Index].Decode(&_rangeDecoder) == 0)
|
||||
distance = rep1;
|
||||
else
|
||||
{
|
||||
if (_isRepG2[state.Index].Decode(&_rangeDecoder) == 0)
|
||||
distance = rep2;
|
||||
else
|
||||
{
|
||||
distance = rep3;
|
||||
rep3 = rep2;
|
||||
}
|
||||
rep2 = rep1;
|
||||
}
|
||||
rep1 = rep0;
|
||||
rep0 = distance;
|
||||
}
|
||||
if (len == 0)
|
||||
{
|
||||
len = _repMatchLenDecoder.Decode(&_rangeDecoder, posState) + kMatchMinLen;
|
||||
state.UpdateRep();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
rep3 = rep2;
|
||||
rep2 = rep1;
|
||||
rep1 = rep0;
|
||||
len = kMatchMinLen + _lenDecoder.Decode(&_rangeDecoder, posState);
|
||||
state.UpdateMatch();
|
||||
UInt32 posSlot = _posSlotDecoder[GetLenToPosState(len)].Decode(&_rangeDecoder);
|
||||
if (posSlot >= kStartPosModelIndex)
|
||||
{
|
||||
UInt32 numDirectBits = (posSlot >> 1) - 1;
|
||||
rep0 = ((2 | (posSlot & 1)) << numDirectBits);
|
||||
|
||||
if (posSlot < kEndPosModelIndex)
|
||||
rep0 += NRangeCoder::ReverseBitTreeDecode(_posDecoders +
|
||||
rep0 - posSlot - 1, &_rangeDecoder, numDirectBits);
|
||||
else
|
||||
{
|
||||
rep0 += (_rangeDecoder.DecodeDirectBits(
|
||||
numDirectBits - kNumAlignBits) << kNumAlignBits);
|
||||
rep0 += _posAlignDecoder.ReverseDecode(&_rangeDecoder);
|
||||
if (rep0 == 0xFFFFFFFF)
|
||||
{
|
||||
_remainLen = kLenIdFinished;
|
||||
return S_OK;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
rep0 = posSlot;
|
||||
}
|
||||
UInt32 locLen = len;
|
||||
if (len > curSize)
|
||||
locLen = (UInt32)curSize;
|
||||
if (!_outWindowStream.CopyBlock(rep0, locLen))
|
||||
return S_FALSE;
|
||||
previousByte = _outWindowStream.GetByte(0);
|
||||
curSize -= locLen;
|
||||
nowPos64 += locLen;
|
||||
len -= locLen;
|
||||
if (len != 0)
|
||||
{
|
||||
_remainLen = (Int32)len;
|
||||
break;
|
||||
}
|
||||
|
||||
#ifdef _NO_EXCEPTIONS
|
||||
if (_outWindowStream.ErrorCode != S_OK)
|
||||
return _outWindowStream.ErrorCode;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
if (_rangeDecoder.Stream.WasFinished())
|
||||
return S_FALSE;
|
||||
_reps[0] = rep0;
|
||||
_reps[1] = rep1;
|
||||
_reps[2] = rep2;
|
||||
_reps[3] = rep3;
|
||||
_state = state;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP CDecoder::CodeReal(ISequentialInStream *inStream,
|
||||
ISequentialOutStream *outStream,
|
||||
const UInt64 *, const UInt64 *outSize,
|
||||
ICompressProgressInfo *progress)
|
||||
{
|
||||
SetInStream(inStream);
|
||||
_outWindowStream.SetStream(outStream);
|
||||
SetOutStreamSize(outSize);
|
||||
CDecoderFlusher flusher(this);
|
||||
|
||||
for (;;)
|
||||
{
|
||||
UInt32 curSize = 1 << 18;
|
||||
RINOK(CodeSpec(curSize));
|
||||
if (_remainLen == kLenIdFinished)
|
||||
break;
|
||||
if (progress != NULL)
|
||||
{
|
||||
UInt64 inSize = _rangeDecoder.GetProcessedSize();
|
||||
UInt64 nowPos64 = _outWindowStream.GetProcessedSize();
|
||||
RINOK(progress->SetRatioInfo(&inSize, &nowPos64));
|
||||
}
|
||||
if (_outSizeDefined)
|
||||
if (_outWindowStream.GetProcessedSize() >= _outSize)
|
||||
break;
|
||||
}
|
||||
flusher.NeedFlush = false;
|
||||
return Flush();
|
||||
}
|
||||
|
||||
|
||||
#ifdef _NO_EXCEPTIONS
|
||||
|
||||
#define LZMA_TRY_BEGIN
|
||||
#define LZMA_TRY_END
|
||||
|
||||
#else
|
||||
|
||||
#define LZMA_TRY_BEGIN try {
|
||||
#define LZMA_TRY_END } \
|
||||
catch(const CInBufferException &e) { return e.ErrorCode; } \
|
||||
catch(const CLZOutWindowException &e) { return e.ErrorCode; } \
|
||||
catch(...) { return S_FALSE; }
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
STDMETHODIMP CDecoder::Code(ISequentialInStream *inStream,
|
||||
ISequentialOutStream *outStream, const UInt64 *inSize, const UInt64 *outSize,
|
||||
ICompressProgressInfo *progress)
|
||||
{
|
||||
LZMA_TRY_BEGIN
|
||||
return CodeReal(inStream, outStream, inSize, outSize, progress);
|
||||
LZMA_TRY_END
|
||||
}
|
||||
|
||||
STDMETHODIMP CDecoder::SetDecoderProperties2(const Byte *properties, UInt32 size)
|
||||
{
|
||||
if (size < 5)
|
||||
return E_INVALIDARG;
|
||||
int lc = properties[0] % 9;
|
||||
Byte remainder = (Byte)(properties[0] / 9);
|
||||
int lp = remainder % 5;
|
||||
int pb = remainder / 5;
|
||||
if (pb > NLength::kNumPosStatesBitsMax)
|
||||
return E_INVALIDARG;
|
||||
_posStateMask = (1 << pb) - 1;
|
||||
UInt32 dictionarySize = 0;
|
||||
for (int i = 0; i < 4; i++)
|
||||
dictionarySize += ((UInt32)(properties[1 + i])) << (i * 8);
|
||||
if (!_outWindowStream.Create(dictionarySize))
|
||||
return E_OUTOFMEMORY;
|
||||
if (!_literalDecoder.Create(lp, lc))
|
||||
return E_OUTOFMEMORY;
|
||||
if (!_rangeDecoder.Create(1 << 20))
|
||||
return E_OUTOFMEMORY;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP CDecoder::GetInStreamProcessedSize(UInt64 *value)
|
||||
{
|
||||
*value = _rangeDecoder.GetProcessedSize();
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP CDecoder::SetInStream(ISequentialInStream *inStream)
|
||||
{
|
||||
_rangeDecoder.SetStream(inStream);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP CDecoder::ReleaseInStream()
|
||||
{
|
||||
_rangeDecoder.ReleaseStream();
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP CDecoder::SetOutStreamSize(const UInt64 *outSize)
|
||||
{
|
||||
_outSizeDefined = (outSize != NULL);
|
||||
if (_outSizeDefined)
|
||||
_outSize = *outSize;
|
||||
_remainLen = kLenIdNeedInit;
|
||||
_outWindowStream.Init();
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
#ifdef _ST_MODE
|
||||
|
||||
STDMETHODIMP CDecoder::Read(void *data, UInt32 size, UInt32 *processedSize)
|
||||
{
|
||||
LZMA_TRY_BEGIN
|
||||
if (processedSize)
|
||||
*processedSize = 0;
|
||||
const UInt64 startPos = _outWindowStream.GetProcessedSize();
|
||||
_outWindowStream.SetMemStream((Byte *)data);
|
||||
RINOK(CodeSpec(size));
|
||||
if (processedSize)
|
||||
*processedSize = (UInt32)(_outWindowStream.GetProcessedSize() - startPos);
|
||||
return Flush();
|
||||
LZMA_TRY_END
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
}}
|
||||
251
CPP/7zip/Compress/LZMA/LZMADecoder.h
Executable file
251
CPP/7zip/Compress/LZMA/LZMADecoder.h
Executable file
@@ -0,0 +1,251 @@
|
||||
// LZMA/Decoder.h
|
||||
|
||||
#ifndef __LZMA_DECODER_H
|
||||
#define __LZMA_DECODER_H
|
||||
|
||||
#include "../../../Common/MyCom.h"
|
||||
#include "../../../Common/Alloc.h"
|
||||
#include "../../ICoder.h"
|
||||
#include "../LZ/LZOutWindow.h"
|
||||
#include "../RangeCoder/RangeCoderBitTree.h"
|
||||
|
||||
#include "LZMA.h"
|
||||
|
||||
namespace NCompress {
|
||||
namespace NLZMA {
|
||||
|
||||
typedef NRangeCoder::CBitDecoder<kNumMoveBits> CMyBitDecoder;
|
||||
|
||||
class CLiteralDecoder2
|
||||
{
|
||||
CMyBitDecoder _decoders[0x300];
|
||||
public:
|
||||
void Init()
|
||||
{
|
||||
for (int i = 0; i < 0x300; i++)
|
||||
_decoders[i].Init();
|
||||
}
|
||||
Byte DecodeNormal(NRangeCoder::CDecoder *rangeDecoder)
|
||||
{
|
||||
UInt32 symbol = 1;
|
||||
RC_INIT_VAR
|
||||
do
|
||||
{
|
||||
// symbol = (symbol << 1) | _decoders[0][symbol].Decode(rangeDecoder);
|
||||
RC_GETBIT(kNumMoveBits, _decoders[symbol].Prob, symbol)
|
||||
}
|
||||
while (symbol < 0x100);
|
||||
RC_FLUSH_VAR
|
||||
return (Byte)symbol;
|
||||
}
|
||||
Byte DecodeWithMatchByte(NRangeCoder::CDecoder *rangeDecoder, Byte matchByte)
|
||||
{
|
||||
UInt32 symbol = 1;
|
||||
RC_INIT_VAR
|
||||
do
|
||||
{
|
||||
UInt32 matchBit = (matchByte >> 7) & 1;
|
||||
matchByte <<= 1;
|
||||
// UInt32 bit = _decoders[1 + matchBit][symbol].Decode(rangeDecoder);
|
||||
// symbol = (symbol << 1) | bit;
|
||||
UInt32 bit;
|
||||
RC_GETBIT2(kNumMoveBits, _decoders[0x100 + (matchBit << 8) + symbol].Prob, symbol,
|
||||
bit = 0, bit = 1)
|
||||
if (matchBit != bit)
|
||||
{
|
||||
while (symbol < 0x100)
|
||||
{
|
||||
// symbol = (symbol << 1) | _decoders[0][symbol].Decode(rangeDecoder);
|
||||
RC_GETBIT(kNumMoveBits, _decoders[symbol].Prob, symbol)
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
while (symbol < 0x100);
|
||||
RC_FLUSH_VAR
|
||||
return (Byte)symbol;
|
||||
}
|
||||
};
|
||||
|
||||
class CLiteralDecoder
|
||||
{
|
||||
CLiteralDecoder2 *_coders;
|
||||
int _numPrevBits;
|
||||
int _numPosBits;
|
||||
UInt32 _posMask;
|
||||
public:
|
||||
CLiteralDecoder(): _coders(0) {}
|
||||
~CLiteralDecoder() { Free(); }
|
||||
void Free()
|
||||
{
|
||||
MyFree(_coders);
|
||||
_coders = 0;
|
||||
}
|
||||
bool Create(int numPosBits, int numPrevBits)
|
||||
{
|
||||
if (_coders == 0 || (numPosBits + numPrevBits) !=
|
||||
(_numPrevBits + _numPosBits) )
|
||||
{
|
||||
Free();
|
||||
UInt32 numStates = 1 << (numPosBits + numPrevBits);
|
||||
_coders = (CLiteralDecoder2 *)MyAlloc(numStates * sizeof(CLiteralDecoder2));
|
||||
}
|
||||
_numPosBits = numPosBits;
|
||||
_posMask = (1 << numPosBits) - 1;
|
||||
_numPrevBits = numPrevBits;
|
||||
return (_coders != 0);
|
||||
}
|
||||
void Init()
|
||||
{
|
||||
UInt32 numStates = 1 << (_numPrevBits + _numPosBits);
|
||||
for (UInt32 i = 0; i < numStates; i++)
|
||||
_coders[i].Init();
|
||||
}
|
||||
UInt32 GetState(UInt32 pos, Byte prevByte) const
|
||||
{ return ((pos & _posMask) << _numPrevBits) + (prevByte >> (8 - _numPrevBits)); }
|
||||
Byte DecodeNormal(NRangeCoder::CDecoder *rangeDecoder, UInt32 pos, Byte prevByte)
|
||||
{ return _coders[GetState(pos, prevByte)].DecodeNormal(rangeDecoder); }
|
||||
Byte DecodeWithMatchByte(NRangeCoder::CDecoder *rangeDecoder, UInt32 pos, Byte prevByte, Byte matchByte)
|
||||
{ return _coders[GetState(pos, prevByte)].DecodeWithMatchByte(rangeDecoder, matchByte); }
|
||||
};
|
||||
|
||||
namespace NLength {
|
||||
|
||||
class CDecoder
|
||||
{
|
||||
CMyBitDecoder _choice;
|
||||
CMyBitDecoder _choice2;
|
||||
NRangeCoder::CBitTreeDecoder<kNumMoveBits, kNumLowBits> _lowCoder[kNumPosStatesMax];
|
||||
NRangeCoder::CBitTreeDecoder<kNumMoveBits, kNumMidBits> _midCoder[kNumPosStatesMax];
|
||||
NRangeCoder::CBitTreeDecoder<kNumMoveBits, kNumHighBits> _highCoder;
|
||||
public:
|
||||
void Init(UInt32 numPosStates)
|
||||
{
|
||||
_choice.Init();
|
||||
_choice2.Init();
|
||||
for (UInt32 posState = 0; posState < numPosStates; posState++)
|
||||
{
|
||||
_lowCoder[posState].Init();
|
||||
_midCoder[posState].Init();
|
||||
}
|
||||
_highCoder.Init();
|
||||
}
|
||||
UInt32 Decode(NRangeCoder::CDecoder *rangeDecoder, UInt32 posState)
|
||||
{
|
||||
if(_choice.Decode(rangeDecoder) == 0)
|
||||
return _lowCoder[posState].Decode(rangeDecoder);
|
||||
if(_choice2.Decode(rangeDecoder) == 0)
|
||||
return kNumLowSymbols + _midCoder[posState].Decode(rangeDecoder);
|
||||
return kNumLowSymbols + kNumMidSymbols + _highCoder.Decode(rangeDecoder);
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
class CDecoder:
|
||||
public ICompressCoder,
|
||||
public ICompressSetDecoderProperties2,
|
||||
public ICompressGetInStreamProcessedSize,
|
||||
#ifdef _ST_MODE
|
||||
public ICompressSetInStream,
|
||||
public ICompressSetOutStreamSize,
|
||||
public ISequentialInStream,
|
||||
#endif
|
||||
public CMyUnknownImp
|
||||
{
|
||||
CLZOutWindow _outWindowStream;
|
||||
NRangeCoder::CDecoder _rangeDecoder;
|
||||
|
||||
CMyBitDecoder _isMatch[kNumStates][NLength::kNumPosStatesMax];
|
||||
CMyBitDecoder _isRep[kNumStates];
|
||||
CMyBitDecoder _isRepG0[kNumStates];
|
||||
CMyBitDecoder _isRepG1[kNumStates];
|
||||
CMyBitDecoder _isRepG2[kNumStates];
|
||||
CMyBitDecoder _isRep0Long[kNumStates][NLength::kNumPosStatesMax];
|
||||
|
||||
NRangeCoder::CBitTreeDecoder<kNumMoveBits, kNumPosSlotBits> _posSlotDecoder[kNumLenToPosStates];
|
||||
|
||||
CMyBitDecoder _posDecoders[kNumFullDistances - kEndPosModelIndex];
|
||||
NRangeCoder::CBitTreeDecoder<kNumMoveBits, kNumAlignBits> _posAlignDecoder;
|
||||
|
||||
NLength::CDecoder _lenDecoder;
|
||||
NLength::CDecoder _repMatchLenDecoder;
|
||||
|
||||
CLiteralDecoder _literalDecoder;
|
||||
|
||||
UInt32 _posStateMask;
|
||||
|
||||
///////////////////
|
||||
// State
|
||||
UInt32 _reps[4];
|
||||
CState _state;
|
||||
Int32 _remainLen; // -1 means end of stream. // -2 means need Init
|
||||
UInt64 _outSize;
|
||||
bool _outSizeDefined;
|
||||
|
||||
void Init();
|
||||
HRESULT CodeSpec(UInt32 size);
|
||||
public:
|
||||
|
||||
#ifdef _ST_MODE
|
||||
MY_UNKNOWN_IMP5(
|
||||
ICompressSetDecoderProperties2,
|
||||
ICompressGetInStreamProcessedSize,
|
||||
ICompressSetInStream,
|
||||
ICompressSetOutStreamSize,
|
||||
ISequentialInStream)
|
||||
#else
|
||||
MY_UNKNOWN_IMP2(
|
||||
ICompressSetDecoderProperties2,
|
||||
ICompressGetInStreamProcessedSize)
|
||||
#endif
|
||||
|
||||
void ReleaseStreams()
|
||||
{
|
||||
_outWindowStream.ReleaseStream();
|
||||
ReleaseInStream();
|
||||
}
|
||||
|
||||
class CDecoderFlusher
|
||||
{
|
||||
CDecoder *_decoder;
|
||||
public:
|
||||
bool NeedFlush;
|
||||
CDecoderFlusher(CDecoder *decoder): _decoder(decoder), NeedFlush(true) {}
|
||||
~CDecoderFlusher()
|
||||
{
|
||||
if (NeedFlush)
|
||||
_decoder->Flush();
|
||||
_decoder->ReleaseStreams();
|
||||
}
|
||||
};
|
||||
|
||||
HRESULT Flush() { return _outWindowStream.Flush(); }
|
||||
|
||||
STDMETHOD(CodeReal)(ISequentialInStream *inStream,
|
||||
ISequentialOutStream *outStream, const UInt64 *inSize, const UInt64 *outSize,
|
||||
ICompressProgressInfo *progress);
|
||||
|
||||
STDMETHOD(Code)(ISequentialInStream *inStream,
|
||||
ISequentialOutStream *outStream, const UInt64 *inSize, const UInt64 *outSize,
|
||||
ICompressProgressInfo *progress);
|
||||
|
||||
STDMETHOD(SetDecoderProperties2)(const Byte *data, UInt32 size);
|
||||
|
||||
STDMETHOD(GetInStreamProcessedSize)(UInt64 *value);
|
||||
|
||||
STDMETHOD(SetInStream)(ISequentialInStream *inStream);
|
||||
STDMETHOD(ReleaseInStream)();
|
||||
STDMETHOD(SetOutStreamSize)(const UInt64 *outSize);
|
||||
|
||||
#ifdef _ST_MODE
|
||||
STDMETHOD(Read)(void *data, UInt32 size, UInt32 *processedSize);
|
||||
#endif
|
||||
|
||||
CDecoder(): _outSizeDefined(false) {}
|
||||
virtual ~CDecoder() {}
|
||||
};
|
||||
|
||||
}}
|
||||
|
||||
#endif
|
||||
1530
CPP/7zip/Compress/LZMA/LZMAEncoder.cpp
Executable file
1530
CPP/7zip/Compress/LZMA/LZMAEncoder.cpp
Executable file
File diff suppressed because it is too large
Load Diff
435
CPP/7zip/Compress/LZMA/LZMAEncoder.h
Executable file
435
CPP/7zip/Compress/LZMA/LZMAEncoder.h
Executable file
@@ -0,0 +1,435 @@
|
||||
// LZMA/Encoder.h
|
||||
|
||||
#ifndef __LZMA_ENCODER_H
|
||||
#define __LZMA_ENCODER_H
|
||||
|
||||
#include "../../../Common/MyCom.h"
|
||||
#include "../../../Common/Alloc.h"
|
||||
#include "../../ICoder.h"
|
||||
|
||||
extern "C"
|
||||
{
|
||||
#include "../../../../C/Compress/Lz/MatchFinder.h"
|
||||
#ifdef COMPRESS_MF_MT
|
||||
#include "../../../../C/Compress/Lz/MatchFinderMt.h"
|
||||
#endif
|
||||
}
|
||||
|
||||
#include "../RangeCoder/RangeCoderBitTree.h"
|
||||
|
||||
#include "LZMA.h"
|
||||
|
||||
namespace NCompress {
|
||||
namespace NLZMA {
|
||||
|
||||
typedef NRangeCoder::CBitEncoder<kNumMoveBits> CMyBitEncoder;
|
||||
|
||||
class CBaseState
|
||||
{
|
||||
protected:
|
||||
CState _state;
|
||||
Byte _previousByte;
|
||||
UInt32 _repDistances[kNumRepDistances];
|
||||
void Init()
|
||||
{
|
||||
_state.Init();
|
||||
_previousByte = 0;
|
||||
for(UInt32 i = 0 ; i < kNumRepDistances; i++)
|
||||
_repDistances[i] = 0;
|
||||
}
|
||||
};
|
||||
|
||||
struct COptimal
|
||||
{
|
||||
CState State;
|
||||
|
||||
bool Prev1IsChar;
|
||||
bool Prev2;
|
||||
|
||||
UInt32 PosPrev2;
|
||||
UInt32 BackPrev2;
|
||||
|
||||
UInt32 Price;
|
||||
UInt32 PosPrev; // posNext;
|
||||
UInt32 BackPrev;
|
||||
UInt32 Backs[kNumRepDistances];
|
||||
void MakeAsChar() { BackPrev = UInt32(-1); Prev1IsChar = false; }
|
||||
void MakeAsShortRep() { BackPrev = 0; ; Prev1IsChar = false; }
|
||||
bool IsShortRep() { return (BackPrev == 0); }
|
||||
};
|
||||
|
||||
|
||||
extern Byte g_FastPos[1 << 11];
|
||||
inline UInt32 GetPosSlot(UInt32 pos)
|
||||
{
|
||||
if (pos < (1 << 11))
|
||||
return g_FastPos[pos];
|
||||
if (pos < (1 << 21))
|
||||
return g_FastPos[pos >> 10] + 20;
|
||||
return g_FastPos[pos >> 20] + 40;
|
||||
}
|
||||
|
||||
inline UInt32 GetPosSlot2(UInt32 pos)
|
||||
{
|
||||
if (pos < (1 << 17))
|
||||
return g_FastPos[pos >> 6] + 12;
|
||||
if (pos < (1 << 27))
|
||||
return g_FastPos[pos >> 16] + 32;
|
||||
return g_FastPos[pos >> 26] + 52;
|
||||
}
|
||||
|
||||
const UInt32 kIfinityPrice = 0xFFFFFFF;
|
||||
|
||||
const UInt32 kNumOpts = 1 << 12;
|
||||
|
||||
|
||||
class CLiteralEncoder2
|
||||
{
|
||||
CMyBitEncoder _encoders[0x300];
|
||||
public:
|
||||
void Init()
|
||||
{
|
||||
for (int i = 0; i < 0x300; i++)
|
||||
_encoders[i].Init();
|
||||
}
|
||||
void Encode(NRangeCoder::CEncoder *rangeEncoder, Byte symbol);
|
||||
void EncodeMatched(NRangeCoder::CEncoder *rangeEncoder, Byte matchByte, Byte symbol);
|
||||
UInt32 GetPrice(bool matchMode, Byte matchByte, Byte symbol) const;
|
||||
};
|
||||
|
||||
class CLiteralEncoder
|
||||
{
|
||||
CLiteralEncoder2 *_coders;
|
||||
int _numPrevBits;
|
||||
int _numPosBits;
|
||||
UInt32 _posMask;
|
||||
public:
|
||||
CLiteralEncoder(): _coders(0) {}
|
||||
~CLiteralEncoder() { Free(); }
|
||||
void Free()
|
||||
{
|
||||
MyFree(_coders);
|
||||
_coders = 0;
|
||||
}
|
||||
bool Create(int numPosBits, int numPrevBits)
|
||||
{
|
||||
if (_coders == 0 || (numPosBits + numPrevBits) != (_numPrevBits + _numPosBits))
|
||||
{
|
||||
Free();
|
||||
UInt32 numStates = 1 << (numPosBits + numPrevBits);
|
||||
_coders = (CLiteralEncoder2 *)MyAlloc(numStates * sizeof(CLiteralEncoder2));
|
||||
}
|
||||
_numPosBits = numPosBits;
|
||||
_posMask = (1 << numPosBits) - 1;
|
||||
_numPrevBits = numPrevBits;
|
||||
return (_coders != 0);
|
||||
}
|
||||
void Init()
|
||||
{
|
||||
UInt32 numStates = 1 << (_numPrevBits + _numPosBits);
|
||||
for (UInt32 i = 0; i < numStates; i++)
|
||||
_coders[i].Init();
|
||||
}
|
||||
CLiteralEncoder2 *GetSubCoder(UInt32 pos, Byte prevByte)
|
||||
{ return &_coders[((pos & _posMask) << _numPrevBits) + (prevByte >> (8 - _numPrevBits))]; }
|
||||
};
|
||||
|
||||
namespace NLength {
|
||||
|
||||
class CEncoder
|
||||
{
|
||||
CMyBitEncoder _choice;
|
||||
CMyBitEncoder _choice2;
|
||||
NRangeCoder::CBitTreeEncoder<kNumMoveBits, kNumLowBits> _lowCoder[kNumPosStatesEncodingMax];
|
||||
NRangeCoder::CBitTreeEncoder<kNumMoveBits, kNumMidBits> _midCoder[kNumPosStatesEncodingMax];
|
||||
NRangeCoder::CBitTreeEncoder<kNumMoveBits, kNumHighBits> _highCoder;
|
||||
public:
|
||||
void Init(UInt32 numPosStates);
|
||||
void Encode(NRangeCoder::CEncoder *rangeEncoder, UInt32 symbol, UInt32 posState);
|
||||
void SetPrices(UInt32 posState, UInt32 numSymbols, UInt32 *prices) const;
|
||||
};
|
||||
|
||||
const UInt32 kNumSpecSymbols = kNumLowSymbols + kNumMidSymbols;
|
||||
|
||||
class CPriceTableEncoder: public CEncoder
|
||||
{
|
||||
UInt32 _prices[kNumPosStatesEncodingMax][kNumSymbolsTotal];
|
||||
UInt32 _tableSize;
|
||||
UInt32 _counters[kNumPosStatesEncodingMax];
|
||||
public:
|
||||
void SetTableSize(UInt32 tableSize) { _tableSize = tableSize; }
|
||||
UInt32 GetPrice(UInt32 symbol, UInt32 posState) const { return _prices[posState][symbol]; }
|
||||
void UpdateTable(UInt32 posState)
|
||||
{
|
||||
SetPrices(posState, _tableSize, _prices[posState]);
|
||||
_counters[posState] = _tableSize;
|
||||
}
|
||||
void UpdateTables(UInt32 numPosStates)
|
||||
{
|
||||
for (UInt32 posState = 0; posState < numPosStates; posState++)
|
||||
UpdateTable(posState);
|
||||
}
|
||||
void Encode(NRangeCoder::CEncoder *rangeEncoder, UInt32 symbol, UInt32 posState, bool updatePrice)
|
||||
{
|
||||
CEncoder::Encode(rangeEncoder, symbol, posState);
|
||||
if (updatePrice)
|
||||
if (--_counters[posState] == 0)
|
||||
UpdateTable(posState);
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
typedef struct _CSeqInStream
|
||||
{
|
||||
ISeqInStream SeqInStream;
|
||||
CMyComPtr<ISequentialInStream> RealStream;
|
||||
} CSeqInStream;
|
||||
|
||||
|
||||
class CEncoder :
|
||||
public ICompressCoder,
|
||||
public ICompressSetOutStream,
|
||||
public ICompressSetCoderProperties,
|
||||
public ICompressWriteCoderProperties,
|
||||
public CBaseState,
|
||||
public CMyUnknownImp
|
||||
{
|
||||
NRangeCoder::CEncoder _rangeEncoder;
|
||||
|
||||
IMatchFinder _matchFinder;
|
||||
void *_matchFinderObj;
|
||||
|
||||
#ifdef COMPRESS_MF_MT
|
||||
Bool _multiThread;
|
||||
Bool _mtMode;
|
||||
CMatchFinderMt _matchFinderMt;
|
||||
#endif
|
||||
|
||||
CMatchFinder _matchFinderBase;
|
||||
#ifdef COMPRESS_MF_MT
|
||||
Byte _pad1[kMtCacheLineDummy];
|
||||
#endif
|
||||
|
||||
COptimal _optimum[kNumOpts];
|
||||
|
||||
CMyBitEncoder _isMatch[kNumStates][NLength::kNumPosStatesEncodingMax];
|
||||
CMyBitEncoder _isRep[kNumStates];
|
||||
CMyBitEncoder _isRepG0[kNumStates];
|
||||
CMyBitEncoder _isRepG1[kNumStates];
|
||||
CMyBitEncoder _isRepG2[kNumStates];
|
||||
CMyBitEncoder _isRep0Long[kNumStates][NLength::kNumPosStatesEncodingMax];
|
||||
|
||||
NRangeCoder::CBitTreeEncoder<kNumMoveBits, kNumPosSlotBits> _posSlotEncoder[kNumLenToPosStates];
|
||||
|
||||
CMyBitEncoder _posEncoders[kNumFullDistances - kEndPosModelIndex];
|
||||
NRangeCoder::CBitTreeEncoder<kNumMoveBits, kNumAlignBits> _posAlignEncoder;
|
||||
|
||||
NLength::CPriceTableEncoder _lenEncoder;
|
||||
NLength::CPriceTableEncoder _repMatchLenEncoder;
|
||||
|
||||
CLiteralEncoder _literalEncoder;
|
||||
|
||||
UInt32 _matchDistances[kMatchMaxLen * 2 + 2 + 1];
|
||||
|
||||
bool _fastMode;
|
||||
// bool _maxMode;
|
||||
UInt32 _numFastBytes;
|
||||
UInt32 _longestMatchLength;
|
||||
UInt32 _numDistancePairs;
|
||||
|
||||
UInt32 _additionalOffset;
|
||||
|
||||
UInt32 _optimumEndIndex;
|
||||
UInt32 _optimumCurrentIndex;
|
||||
|
||||
bool _longestMatchWasFound;
|
||||
|
||||
UInt32 _posSlotPrices[kNumLenToPosStates][kDistTableSizeMax];
|
||||
|
||||
UInt32 _distancesPrices[kNumLenToPosStates][kNumFullDistances];
|
||||
|
||||
UInt32 _alignPrices[kAlignTableSize];
|
||||
UInt32 _alignPriceCount;
|
||||
|
||||
UInt32 _distTableSize;
|
||||
|
||||
UInt32 _posStateBits;
|
||||
UInt32 _posStateMask;
|
||||
UInt32 _numLiteralPosStateBits;
|
||||
UInt32 _numLiteralContextBits;
|
||||
|
||||
UInt32 _dictionarySize;
|
||||
|
||||
UInt32 _matchPriceCount;
|
||||
UInt64 nowPos64;
|
||||
bool _finished;
|
||||
ISequentialInStream *_inStream;
|
||||
|
||||
CSeqInStream _seqInStream;
|
||||
|
||||
UInt32 _matchFinderCycles;
|
||||
// int _numSkip
|
||||
|
||||
bool _writeEndMark;
|
||||
|
||||
bool _needReleaseMFStream;
|
||||
|
||||
void ReleaseMatchFinder()
|
||||
{
|
||||
_matchFinder.Init = 0;
|
||||
_seqInStream.RealStream.Release();
|
||||
}
|
||||
|
||||
void ReleaseMFStream()
|
||||
{
|
||||
if (_matchFinderObj && _needReleaseMFStream)
|
||||
{
|
||||
#ifdef COMPRESS_MF_MT
|
||||
if (_mtMode)
|
||||
MatchFinderMt_ReleaseStream(&_matchFinderMt);
|
||||
#endif
|
||||
_needReleaseMFStream = false;
|
||||
}
|
||||
_seqInStream.RealStream.Release();
|
||||
}
|
||||
|
||||
UInt32 ReadMatchDistances(UInt32 &numDistancePairs);
|
||||
|
||||
void MovePos(UInt32 num);
|
||||
UInt32 GetRepLen1Price(CState state, UInt32 posState) const
|
||||
{
|
||||
return _isRepG0[state.Index].GetPrice0() +
|
||||
_isRep0Long[state.Index][posState].GetPrice0();
|
||||
}
|
||||
|
||||
UInt32 GetPureRepPrice(UInt32 repIndex, CState state, UInt32 posState) const
|
||||
{
|
||||
UInt32 price;
|
||||
if(repIndex == 0)
|
||||
{
|
||||
price = _isRepG0[state.Index].GetPrice0();
|
||||
price += _isRep0Long[state.Index][posState].GetPrice1();
|
||||
}
|
||||
else
|
||||
{
|
||||
price = _isRepG0[state.Index].GetPrice1();
|
||||
if (repIndex == 1)
|
||||
price += _isRepG1[state.Index].GetPrice0();
|
||||
else
|
||||
{
|
||||
price += _isRepG1[state.Index].GetPrice1();
|
||||
price += _isRepG2[state.Index].GetPrice(repIndex - 2);
|
||||
}
|
||||
}
|
||||
return price;
|
||||
}
|
||||
UInt32 GetRepPrice(UInt32 repIndex, UInt32 len, CState state, UInt32 posState) const
|
||||
{
|
||||
return _repMatchLenEncoder.GetPrice(len - kMatchMinLen, posState) +
|
||||
GetPureRepPrice(repIndex, state, posState);
|
||||
}
|
||||
/*
|
||||
UInt32 GetPosLen2Price(UInt32 pos, UInt32 posState) const
|
||||
{
|
||||
if (pos >= kNumFullDistances)
|
||||
return kIfinityPrice;
|
||||
return _distancesPrices[0][pos] + _lenEncoder.GetPrice(0, posState);
|
||||
}
|
||||
UInt32 GetPosLen3Price(UInt32 pos, UInt32 len, UInt32 posState) const
|
||||
{
|
||||
UInt32 price;
|
||||
UInt32 lenToPosState = GetLenToPosState(len);
|
||||
if (pos < kNumFullDistances)
|
||||
price = _distancesPrices[lenToPosState][pos];
|
||||
else
|
||||
price = _posSlotPrices[lenToPosState][GetPosSlot2(pos)] +
|
||||
_alignPrices[pos & kAlignMask];
|
||||
return price + _lenEncoder.GetPrice(len - kMatchMinLen, posState);
|
||||
}
|
||||
*/
|
||||
UInt32 GetPosLenPrice(UInt32 pos, UInt32 len, UInt32 posState) const
|
||||
{
|
||||
UInt32 price;
|
||||
UInt32 lenToPosState = GetLenToPosState(len);
|
||||
if (pos < kNumFullDistances)
|
||||
price = _distancesPrices[lenToPosState][pos];
|
||||
else
|
||||
price = _posSlotPrices[lenToPosState][GetPosSlot2(pos)] +
|
||||
_alignPrices[pos & kAlignMask];
|
||||
return price + _lenEncoder.GetPrice(len - kMatchMinLen, posState);
|
||||
}
|
||||
|
||||
UInt32 Backward(UInt32 &backRes, UInt32 cur);
|
||||
UInt32 GetOptimum(UInt32 position, UInt32 &backRes);
|
||||
UInt32 GetOptimumFast(UInt32 &backRes);
|
||||
|
||||
void FillDistancesPrices();
|
||||
void FillAlignPrices();
|
||||
|
||||
void ReleaseStreams()
|
||||
{
|
||||
ReleaseMFStream();
|
||||
ReleaseOutStream();
|
||||
}
|
||||
|
||||
HRESULT Flush(UInt32 nowPos);
|
||||
class CCoderReleaser
|
||||
{
|
||||
CEncoder *_coder;
|
||||
public:
|
||||
CCoderReleaser(CEncoder *coder): _coder(coder) {}
|
||||
~CCoderReleaser() { _coder->ReleaseStreams(); }
|
||||
};
|
||||
friend class CCoderReleaser;
|
||||
|
||||
void WriteEndMarker(UInt32 posState);
|
||||
|
||||
public:
|
||||
CEncoder();
|
||||
void SetWriteEndMarkerMode(bool writeEndMarker)
|
||||
{ _writeEndMark= writeEndMarker; }
|
||||
|
||||
HRESULT Create();
|
||||
|
||||
MY_UNKNOWN_IMP3(
|
||||
ICompressSetOutStream,
|
||||
ICompressSetCoderProperties,
|
||||
ICompressWriteCoderProperties
|
||||
)
|
||||
|
||||
HRESULT Init();
|
||||
|
||||
// ICompressCoder interface
|
||||
HRESULT SetStreams(ISequentialInStream *inStream,
|
||||
ISequentialOutStream *outStream,
|
||||
const UInt64 *inSize, const UInt64 *outSize);
|
||||
HRESULT CodeOneBlock(UInt64 *inSize, UInt64 *outSize, Int32 *finished);
|
||||
|
||||
HRESULT CodeReal(ISequentialInStream *inStream,
|
||||
ISequentialOutStream *outStream,
|
||||
const UInt64 *inSize, const UInt64 *outSize,
|
||||
ICompressProgressInfo *progress);
|
||||
|
||||
// ICompressCoder interface
|
||||
STDMETHOD(Code)(ISequentialInStream *inStream,
|
||||
ISequentialOutStream *outStream,
|
||||
const UInt64 *inSize, const UInt64 *outSize,
|
||||
ICompressProgressInfo *progress);
|
||||
|
||||
// ICompressSetCoderProperties2
|
||||
STDMETHOD(SetCoderProperties)(const PROPID *propIDs,
|
||||
const PROPVARIANT *properties, UInt32 numProperties);
|
||||
|
||||
// ICompressWriteCoderProperties
|
||||
STDMETHOD(WriteCoderProperties)(ISequentialOutStream *outStream);
|
||||
|
||||
STDMETHOD(SetOutStream)(ISequentialOutStream *outStream);
|
||||
STDMETHOD(ReleaseOutStream)();
|
||||
|
||||
virtual ~CEncoder();
|
||||
};
|
||||
|
||||
}}
|
||||
|
||||
#endif
|
||||
3
CPP/7zip/Compress/LZMA/StdAfx.cpp
Executable file
3
CPP/7zip/Compress/LZMA/StdAfx.cpp
Executable file
@@ -0,0 +1,3 @@
|
||||
// StdAfx.cpp
|
||||
|
||||
#include "StdAfx.h"
|
||||
8
CPP/7zip/Compress/LZMA/StdAfx.h
Executable file
8
CPP/7zip/Compress/LZMA/StdAfx.h
Executable file
@@ -0,0 +1,8 @@
|
||||
// StdAfx.h
|
||||
|
||||
#ifndef __STDAFX_H
|
||||
#define __STDAFX_H
|
||||
|
||||
#include "../../../Common/MyWindows.h"
|
||||
|
||||
#endif
|
||||
69
CPP/7zip/Compress/LZMA/makefile
Executable file
69
CPP/7zip/Compress/LZMA/makefile
Executable file
@@ -0,0 +1,69 @@
|
||||
PROG = LZMA.dll
|
||||
DEF_FILE = ../Codec.def
|
||||
CFLAGS = $(CFLAGS) -I ../../../ -DCOMPRESS_MF_MT -D_ST_MODE
|
||||
LIBS = $(LIBS) oleaut32.lib
|
||||
|
||||
LZMA_OBJS = \
|
||||
$O\DllExports.obj \
|
||||
|
||||
LZMA_OPT_OBJS = \
|
||||
$O\LZMADecoder.obj \
|
||||
$O\LZMAEncoder.obj \
|
||||
|
||||
COMMON_OBJS = \
|
||||
$O\Alloc.obj \
|
||||
$O\CRC.obj \
|
||||
|
||||
WIN_OBJS = \
|
||||
$O\Synchronization.obj
|
||||
|
||||
7ZIP_COMMON_OBJS = \
|
||||
$O\InBuffer.obj \
|
||||
$O\OutBuffer.obj \
|
||||
$O\StreamUtils.obj \
|
||||
|
||||
LZ_OBJS = \
|
||||
$O\LZOutWindow.obj \
|
||||
|
||||
C_OBJS = \
|
||||
$O\7zCrc.obj \
|
||||
$O\Sort.obj \
|
||||
$O\Threads.obj \
|
||||
|
||||
C_LZ_OBJS = \
|
||||
$O\MatchFinder.obj \
|
||||
$O\MatchFinderMt.obj \
|
||||
|
||||
OBJS = \
|
||||
$O\StdAfx.obj \
|
||||
$(LZMA_OBJS) \
|
||||
$(LZMA_OPT_OBJS) \
|
||||
$(COMMON_OBJS) \
|
||||
$(WIN_OBJS) \
|
||||
$(7ZIP_COMMON_OBJS) \
|
||||
$(LZ_OBJS) \
|
||||
$(C_OBJS) \
|
||||
$(C_LZ_OBJS) \
|
||||
$O\RangeCoderBit.obj \
|
||||
$O\resource.res
|
||||
|
||||
!include "../../../Build.mak"
|
||||
|
||||
$(LZMA_OBJS): $(*B).cpp
|
||||
$(COMPL)
|
||||
$(LZMA_OPT_OBJS): $(*B).cpp
|
||||
$(COMPL_O2)
|
||||
$(COMMON_OBJS): ../../../Common/$(*B).cpp
|
||||
$(COMPL)
|
||||
$(WIN_OBJS): ../../../Windows/$(*B).cpp
|
||||
$(COMPL)
|
||||
$(7ZIP_COMMON_OBJS): ../../Common/$(*B).cpp
|
||||
$(COMPL)
|
||||
$(LZ_OBJS): ../LZ/$(*B).cpp
|
||||
$(COMPL)
|
||||
$O\RangeCoderBit.obj: ../RangeCoder/$(*B).cpp
|
||||
$(COMPL)
|
||||
$(C_OBJS): ../../../../C/$(*B).c
|
||||
$(COMPL_O2)
|
||||
$(C_LZ_OBJS): ../../../../C/Compress/Lz/$(*B).c
|
||||
$(COMPL_O2)
|
||||
3
CPP/7zip/Compress/LZMA/resource.rc
Executable file
3
CPP/7zip/Compress/LZMA/resource.rc
Executable file
@@ -0,0 +1,3 @@
|
||||
#include "../../MyVersionInfo.rc"
|
||||
|
||||
MY_VERSION_INFO_DLL("LZMA Codec", "LZMA")
|
||||
Reference in New Issue
Block a user