seven-zip 1.4.2 → 1.7.0.rc1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/rake.yml +49 -0
- data/.github/workflows/release.yml +21 -0
- data/README.md +13 -2
- data/Rakefile +2 -0
- data/ext/p7zip/C/7zBuf.h +4 -8
- data/ext/p7zip/C/7zBuf2.c +9 -3
- data/ext/p7zip/C/7zCrc.c +84 -32
- data/ext/p7zip/C/7zCrc.h +2 -2
- data/ext/p7zip/C/7zCrcOpt.c +89 -8
- data/ext/p7zip/C/7zStream.c +4 -2
- data/ext/p7zip/C/{Types.h → 7zTypes.h} +8 -6
- data/ext/p7zip/C/7zVersion.h +21 -6
- data/ext/p7zip/C/Aes.c +28 -15
- data/ext/p7zip/C/Aes.h +2 -2
- data/ext/p7zip/C/Alloc.c +60 -12
- data/ext/p7zip/C/Alloc.h +6 -7
- data/ext/p7zip/C/Bcj2.c +256 -0
- data/ext/p7zip/C/Bcj2.h +146 -0
- data/ext/p7zip/C/Bcj2Enc.c +312 -0
- data/ext/p7zip/C/Blake2.h +48 -0
- data/ext/p7zip/C/Blake2s.c +244 -0
- data/ext/p7zip/C/Bra.c +2 -0
- data/ext/p7zip/C/Bra.h +4 -8
- data/ext/p7zip/C/Bra86.c +48 -51
- data/ext/p7zip/C/BraIA64.c +3 -1
- data/ext/p7zip/C/BwtSort.c +3 -4
- data/ext/p7zip/C/BwtSort.h +4 -8
- data/ext/p7zip/C/Compiler.h +32 -0
- data/ext/p7zip/C/CpuArch.c +50 -7
- data/ext/p7zip/C/CpuArch.h +112 -41
- data/ext/p7zip/C/Delta.c +2 -0
- data/ext/p7zip/C/Delta.h +4 -8
- data/ext/p7zip/C/HuffEnc.c +8 -6
- data/ext/p7zip/C/HuffEnc.h +4 -8
- data/ext/p7zip/C/LzFind.c +391 -108
- data/ext/p7zip/C/LzFind.h +20 -18
- data/ext/p7zip/C/LzFindMt.c +100 -90
- data/ext/p7zip/C/LzFindMt.h +4 -8
- data/ext/p7zip/C/LzHash.h +23 -20
- data/ext/p7zip/C/Lzma2Dec.c +48 -26
- data/ext/p7zip/C/Lzma2Dec.h +4 -8
- data/ext/p7zip/C/Lzma2Enc.c +58 -15
- data/ext/p7zip/C/Lzma2Enc.h +3 -7
- data/ext/p7zip/C/{LzmaUtil/Lzma86Enc.h → Lzma86.h} +47 -14
- data/ext/p7zip/C/{LzmaUtil/Lzma86Dec.c → Lzma86Dec.c} +6 -13
- data/ext/p7zip/C/{LzmaUtil/Lzma86Enc.c → Lzma86Enc.c} +8 -15
- data/ext/p7zip/C/LzmaDec.c +180 -79
- data/ext/p7zip/C/LzmaDec.h +4 -8
- data/ext/p7zip/C/LzmaEnc.c +230 -147
- data/ext/p7zip/C/LzmaEnc.h +6 -8
- data/ext/p7zip/C/MtCoder.c +3 -3
- data/ext/p7zip/C/Ppmd.h +5 -5
- data/ext/p7zip/C/Ppmd7.c +9 -7
- data/ext/p7zip/C/Ppmd7.h +3 -3
- data/ext/p7zip/C/Ppmd7Dec.c +2 -0
- data/ext/p7zip/C/Ppmd7Enc.c +4 -2
- data/ext/p7zip/C/Ppmd8.c +34 -31
- data/ext/p7zip/C/Ppmd8.h +5 -1
- data/ext/p7zip/C/Ppmd8Dec.c +2 -0
- data/ext/p7zip/C/Ppmd8Enc.c +2 -0
- data/ext/p7zip/C/Precomp.h +10 -0
- data/ext/p7zip/C/RotateDefs.h +11 -1
- data/ext/p7zip/C/Sha1.c +340 -0
- data/ext/p7zip/C/Sha1.h +38 -0
- data/ext/p7zip/C/Sha256.c +107 -63
- data/ext/p7zip/C/Sha256.h +2 -2
- data/ext/p7zip/C/Sort.c +59 -11
- data/ext/p7zip/C/Sort.h +8 -10
- data/ext/p7zip/C/Threads.h +1 -1
- data/ext/p7zip/C/Xz.c +7 -5
- data/ext/p7zip/C/Xz.h +40 -17
- data/ext/p7zip/C/XzCrc64.c +69 -16
- data/ext/p7zip/C/XzCrc64.h +2 -2
- data/ext/p7zip/C/XzCrc64Opt.c +69 -0
- data/ext/p7zip/C/XzDec.c +93 -55
- data/ext/p7zip/C/XzEnc.c +206 -165
- data/ext/p7zip/C/XzEnc.h +23 -9
- data/ext/p7zip/C/XzIn.c +50 -43
- data/ext/p7zip/CPP/7zip/Archive/7z/7zCompressionMode.h +37 -13
- data/ext/p7zip/CPP/7zip/Archive/7z/7zDecode.cpp +392 -181
- data/ext/p7zip/CPP/7zip/Archive/7z/7zDecode.h +29 -29
- data/ext/p7zip/CPP/7zip/Archive/7z/7zEncode.cpp +424 -212
- data/ext/p7zip/CPP/7zip/Archive/7z/7zEncode.h +53 -16
- data/ext/p7zip/CPP/7zip/Archive/7z/7zExtract.cpp +312 -174
- data/ext/p7zip/CPP/7zip/Archive/7z/7zFolderInStream.cpp +74 -61
- data/ext/p7zip/CPP/7zip/Archive/7z/7zFolderInStream.h +22 -19
- data/ext/p7zip/CPP/7zip/Archive/7z/7zHandler.cpp +505 -232
- data/ext/p7zip/CPP/7zip/Archive/7z/7zHandler.h +70 -16
- data/ext/p7zip/CPP/7zip/Archive/7z/7zHandlerOut.cpp +602 -172
- data/ext/p7zip/CPP/7zip/Archive/7z/7zHeader.cpp +5 -0
- data/ext/p7zip/CPP/7zip/Archive/7z/7zHeader.h +54 -3
- data/ext/p7zip/CPP/7zip/Archive/7z/7zIn.cpp +981 -616
- data/ext/p7zip/CPP/7zip/Archive/7z/7zIn.h +275 -89
- data/ext/p7zip/CPP/7zip/Archive/7z/7zItem.h +77 -162
- data/ext/p7zip/CPP/7zip/Archive/7z/7zOut.cpp +288 -238
- data/ext/p7zip/CPP/7zip/Archive/7z/7zOut.h +189 -20
- data/ext/p7zip/CPP/7zip/Archive/7z/7zProperties.cpp +59 -49
- data/ext/p7zip/CPP/7zip/Archive/7z/7zRegister.cpp +12 -9
- data/ext/p7zip/CPP/7zip/Archive/7z/7zSpecStream.cpp +4 -6
- data/ext/p7zip/CPP/7zip/Archive/7z/7zSpecStream.h +5 -5
- data/ext/p7zip/CPP/7zip/Archive/7z/7zUpdate.cpp +1743 -447
- data/ext/p7zip/CPP/7zip/Archive/7z/7zUpdate.h +61 -10
- data/ext/p7zip/CPP/7zip/Archive/ApmHandler.cpp +84 -120
- data/ext/p7zip/CPP/7zip/Archive/ArHandler.cpp +854 -0
- data/ext/p7zip/CPP/7zip/Archive/ArchiveExports.cpp +48 -32
- data/ext/p7zip/CPP/7zip/Archive/ArjHandler.cpp +519 -340
- data/ext/p7zip/CPP/7zip/Archive/Bz2Handler.cpp +223 -203
- data/ext/p7zip/CPP/7zip/Archive/Cab/CabBlockInStream.cpp +50 -139
- data/ext/p7zip/CPP/7zip/Archive/Cab/CabBlockInStream.h +17 -18
- data/ext/p7zip/CPP/7zip/Archive/Cab/CabHandler.cpp +566 -234
- data/ext/p7zip/CPP/7zip/Archive/Cab/CabHandler.h +10 -1
- data/ext/p7zip/CPP/7zip/Archive/Cab/CabHeader.cpp +2 -2
- data/ext/p7zip/CPP/7zip/Archive/Cab/CabHeader.h +12 -15
- data/ext/p7zip/CPP/7zip/Archive/Cab/CabIn.cpp +341 -122
- data/ext/p7zip/CPP/7zip/Archive/Cab/CabIn.h +81 -66
- data/ext/p7zip/CPP/7zip/Archive/Cab/CabItem.h +17 -14
- data/ext/p7zip/CPP/7zip/Archive/Cab/CabRegister.cpp +10 -4
- data/ext/p7zip/CPP/7zip/Archive/Chm/ChmHandler.cpp +190 -83
- data/ext/p7zip/CPP/7zip/Archive/Chm/ChmHandler.h +7 -1
- data/ext/p7zip/CPP/7zip/Archive/Chm/ChmIn.cpp +292 -174
- data/ext/p7zip/CPP/7zip/Archive/Chm/ChmIn.h +73 -47
- data/ext/p7zip/CPP/7zip/Archive/ComHandler.cpp +886 -0
- data/ext/p7zip/CPP/7zip/Archive/Common/CoderMixer2.cpp +994 -71
- data/ext/p7zip/CPP/7zip/Archive/Common/CoderMixer2.h +364 -101
- data/ext/p7zip/CPP/7zip/Archive/Common/DummyOutStream.cpp +7 -12
- data/ext/p7zip/CPP/7zip/Archive/Common/DummyOutStream.h +4 -3
- data/ext/p7zip/CPP/7zip/Archive/Common/FindSignature.cpp +6 -6
- data/ext/p7zip/CPP/7zip/Archive/Common/FindSignature.h +2 -2
- data/ext/p7zip/CPP/7zip/Archive/Common/HandlerOut.cpp +77 -543
- data/ext/p7zip/CPP/7zip/Archive/Common/HandlerOut.h +31 -51
- data/ext/p7zip/CPP/7zip/Archive/Common/InStreamWithCRC.cpp +18 -14
- data/ext/p7zip/CPP/7zip/Archive/Common/ItemNameUtils.cpp +34 -7
- data/ext/p7zip/CPP/7zip/Archive/Common/ItemNameUtils.h +5 -2
- data/ext/p7zip/CPP/7zip/Archive/Common/MultiStream.cpp +25 -24
- data/ext/p7zip/CPP/7zip/Archive/Common/MultiStream.h +8 -3
- data/ext/p7zip/CPP/7zip/Archive/Common/OutStreamWithCRC.h +1 -0
- data/ext/p7zip/CPP/7zip/Archive/Common/OutStreamWithSha1.cpp +2 -2
- data/ext/p7zip/CPP/7zip/Archive/Common/OutStreamWithSha1.h +5 -5
- data/ext/p7zip/CPP/7zip/Archive/Common/ParseProperties.cpp +0 -174
- data/ext/p7zip/CPP/7zip/Archive/Common/ParseProperties.h +2 -14
- data/ext/p7zip/CPP/7zip/Archive/CpioHandler.cpp +506 -335
- data/ext/p7zip/CPP/7zip/Archive/CramfsHandler.cpp +227 -84
- data/ext/p7zip/CPP/7zip/Archive/DeflateProps.cpp +0 -115
- data/ext/p7zip/CPP/7zip/Archive/DeflateProps.h +0 -29
- data/ext/p7zip/CPP/7zip/Archive/DllExports2.cpp +63 -17
- data/ext/p7zip/CPP/7zip/Archive/DmgHandler.cpp +1007 -339
- data/ext/p7zip/CPP/7zip/Archive/ElfHandler.cpp +618 -177
- data/ext/p7zip/CPP/7zip/Archive/ExtHandler.cpp +2867 -0
- data/ext/p7zip/CPP/7zip/Archive/FatHandler.cpp +136 -76
- data/ext/p7zip/CPP/7zip/Archive/FlvHandler.cpp +132 -150
- data/ext/p7zip/CPP/7zip/Archive/GptHandler.cpp +405 -0
- data/ext/p7zip/CPP/7zip/Archive/GzHandler.cpp +560 -214
- data/ext/p7zip/CPP/7zip/Archive/HandlerCont.cpp +288 -0
- data/ext/p7zip/CPP/7zip/Archive/HandlerCont.h +116 -0
- data/ext/p7zip/CPP/7zip/Archive/HfsHandler.cpp +1880 -0
- data/ext/p7zip/CPP/7zip/Archive/IArchive.h +415 -51
- data/ext/p7zip/CPP/7zip/Archive/IhexHandler.cpp +497 -0
- data/ext/p7zip/CPP/7zip/Archive/Iso/IsoHandler.cpp +158 -71
- data/ext/p7zip/CPP/7zip/Archive/Iso/IsoHandler.h +2 -1
- data/ext/p7zip/CPP/7zip/Archive/Iso/IsoHeader.cpp +0 -9
- data/ext/p7zip/CPP/7zip/Archive/Iso/IsoHeader.h +8 -5
- data/ext/p7zip/CPP/7zip/Archive/Iso/IsoIn.cpp +311 -91
- data/ext/p7zip/CPP/7zip/Archive/Iso/IsoIn.h +101 -83
- data/ext/p7zip/CPP/7zip/Archive/Iso/IsoItem.h +48 -39
- data/ext/p7zip/CPP/7zip/Archive/Iso/IsoRegister.cpp +12 -4
- data/ext/p7zip/CPP/7zip/Archive/LzhHandler.cpp +127 -114
- data/ext/p7zip/CPP/7zip/Archive/LzmaHandler.cpp +264 -121
- data/ext/p7zip/CPP/7zip/Archive/MachoHandler.cpp +402 -242
- data/ext/p7zip/CPP/7zip/Archive/MbrHandler.cpp +56 -114
- data/ext/p7zip/CPP/7zip/Archive/MslzHandler.cpp +230 -90
- data/ext/p7zip/CPP/7zip/Archive/MubHandler.cpp +129 -153
- data/ext/p7zip/CPP/7zip/Archive/Nsis/NsisDecode.cpp +179 -58
- data/ext/p7zip/CPP/7zip/Archive/Nsis/NsisDecode.h +36 -7
- data/ext/p7zip/CPP/7zip/Archive/Nsis/NsisHandler.cpp +407 -237
- data/ext/p7zip/CPP/7zip/Archive/Nsis/NsisHandler.h +9 -16
- data/ext/p7zip/CPP/7zip/Archive/Nsis/NsisIn.cpp +5535 -1098
- data/ext/p7zip/CPP/7zip/Archive/Nsis/NsisIn.h +345 -81
- data/ext/p7zip/CPP/7zip/Archive/Nsis/NsisRegister.cpp +11 -4
- data/ext/p7zip/CPP/7zip/Archive/NtfsHandler.cpp +1424 -434
- data/ext/p7zip/CPP/7zip/Archive/PeHandler.cpp +1831 -521
- data/ext/p7zip/CPP/7zip/Archive/PpmdHandler.cpp +50 -35
- data/ext/p7zip/CPP/7zip/Archive/QcowHandler.cpp +615 -0
- data/ext/p7zip/CPP/7zip/Archive/Rar/Rar5Handler.cpp +2746 -0
- data/ext/p7zip/CPP/7zip/Archive/Rar/Rar5Handler.h +411 -0
- data/ext/p7zip/CPP/7zip/Archive/Rar/RarHandler.cpp +1241 -355
- data/ext/p7zip/CPP/7zip/Archive/Rar/RarHandler.h +70 -20
- data/ext/p7zip/CPP/7zip/Archive/Rar/RarHeader.h +38 -34
- data/ext/p7zip/CPP/7zip/Archive/Rar/RarItem.h +34 -16
- data/ext/p7zip/CPP/7zip/Archive/Rar/RarVol.h +129 -0
- data/ext/p7zip/CPP/7zip/Archive/RpmHandler.cpp +641 -194
- data/ext/p7zip/CPP/7zip/Archive/SplitHandler.cpp +174 -181
- data/ext/p7zip/CPP/7zip/Archive/SquashfsHandler.cpp +237 -174
- data/ext/p7zip/CPP/7zip/Archive/SwfHandler.cpp +471 -192
- data/ext/p7zip/CPP/7zip/Archive/Tar/TarHandler.cpp +350 -59
- data/ext/p7zip/CPP/7zip/Archive/Tar/TarHandler.h +24 -7
- data/ext/p7zip/CPP/7zip/Archive/Tar/TarHandlerOut.cpp +79 -27
- data/ext/p7zip/CPP/7zip/Archive/Tar/TarHeader.cpp +5 -7
- data/ext/p7zip/CPP/7zip/Archive/Tar/TarHeader.h +20 -44
- data/ext/p7zip/CPP/7zip/Archive/Tar/TarIn.cpp +279 -64
- data/ext/p7zip/CPP/7zip/Archive/Tar/TarIn.h +10 -1
- data/ext/p7zip/CPP/7zip/Archive/Tar/TarItem.h +34 -8
- data/ext/p7zip/CPP/7zip/Archive/Tar/TarOut.cpp +145 -87
- data/ext/p7zip/CPP/7zip/Archive/Tar/TarOut.h +13 -5
- data/ext/p7zip/CPP/7zip/Archive/Tar/TarRegister.cpp +14 -9
- data/ext/p7zip/CPP/7zip/Archive/Tar/TarUpdate.cpp +154 -27
- data/ext/p7zip/CPP/7zip/Archive/Tar/TarUpdate.h +10 -6
- data/ext/p7zip/CPP/7zip/Archive/Udf/UdfHandler.cpp +53 -128
- data/ext/p7zip/CPP/7zip/Archive/Udf/UdfHandler.h +6 -5
- data/ext/p7zip/CPP/7zip/Archive/Udf/UdfIn.cpp +384 -119
- data/ext/p7zip/CPP/7zip/Archive/Udf/UdfIn.h +40 -21
- data/ext/p7zip/CPP/7zip/Archive/UefiHandler.cpp +1618 -0
- data/ext/p7zip/CPP/7zip/Archive/VdiHandler.cpp +362 -0
- data/ext/p7zip/CPP/7zip/Archive/VhdHandler.cpp +438 -247
- data/ext/p7zip/CPP/7zip/Archive/VmdkHandler.cpp +1518 -0
- data/ext/p7zip/CPP/7zip/Archive/Wim/WimHandler.cpp +837 -249
- data/ext/p7zip/CPP/7zip/Archive/Wim/WimHandler.h +73 -47
- data/ext/p7zip/CPP/7zip/Archive/Wim/WimHandlerOut.cpp +1614 -351
- data/ext/p7zip/CPP/7zip/Archive/Wim/WimIn.cpp +1519 -513
- data/ext/p7zip/CPP/7zip/Archive/Wim/WimIn.h +498 -139
- data/ext/p7zip/CPP/7zip/Archive/Wim/WimRegister.cpp +13 -9
- data/ext/p7zip/CPP/7zip/Archive/XarHandler.cpp +272 -128
- data/ext/p7zip/CPP/7zip/Archive/XzHandler.cpp +502 -253
- data/ext/p7zip/CPP/7zip/Archive/XzHandler.h +65 -0
- data/ext/p7zip/CPP/7zip/Archive/ZHandler.cpp +114 -39
- data/ext/p7zip/CPP/7zip/Archive/Zip/ZipAddCommon.cpp +118 -134
- data/ext/p7zip/CPP/7zip/Archive/Zip/ZipAddCommon.h +6 -0
- data/ext/p7zip/CPP/7zip/Archive/Zip/ZipCompressionMode.h +40 -20
- data/ext/p7zip/CPP/7zip/Archive/Zip/ZipHandler.cpp +541 -274
- data/ext/p7zip/CPP/7zip/Archive/Zip/ZipHandler.h +13 -40
- data/ext/p7zip/CPP/7zip/Archive/Zip/ZipHandlerOut.cpp +165 -254
- data/ext/p7zip/CPP/7zip/Archive/Zip/ZipHeader.h +70 -178
- data/ext/p7zip/CPP/7zip/Archive/Zip/ZipIn.cpp +1934 -550
- data/ext/p7zip/CPP/7zip/Archive/Zip/ZipIn.h +294 -63
- data/ext/p7zip/CPP/7zip/Archive/Zip/ZipItem.cpp +160 -86
- data/ext/p7zip/CPP/7zip/Archive/Zip/ZipItem.h +139 -110
- data/ext/p7zip/CPP/7zip/Archive/Zip/ZipOut.cpp +177 -154
- data/ext/p7zip/CPP/7zip/Archive/Zip/ZipOut.h +50 -18
- data/ext/p7zip/CPP/7zip/Archive/Zip/ZipRegister.cpp +18 -9
- data/ext/p7zip/CPP/7zip/Archive/Zip/ZipUpdate.cpp +367 -201
- data/ext/p7zip/CPP/7zip/Archive/Zip/ZipUpdate.h +11 -10
- data/ext/p7zip/CPP/7zip/Bundles/Format7zFree/makefile +2 -319
- data/ext/p7zip/CPP/7zip/Bundles/Format7zFree/makefile.depend +0 -4962
- data/ext/p7zip/CPP/7zip/Bundles/Format7zFree/makefile.list +1004 -259
- data/ext/p7zip/CPP/7zip/Common/CWrappers.cpp +26 -22
- data/ext/p7zip/CPP/7zip/Common/CWrappers.h +19 -14
- data/ext/p7zip/CPP/7zip/Common/CreateCoder.cpp +298 -130
- data/ext/p7zip/CPP/7zip/Common/CreateCoder.h +118 -34
- data/ext/p7zip/CPP/7zip/Common/FilePathAutoRename.cpp +24 -28
- data/ext/p7zip/CPP/7zip/Common/FilePathAutoRename.h +5 -5
- data/ext/p7zip/CPP/7zip/Common/FileStreams.cpp +268 -65
- data/ext/p7zip/CPP/7zip/Common/FileStreams.h +70 -33
- data/ext/p7zip/CPP/7zip/Common/FilterCoder.cpp +302 -131
- data/ext/p7zip/CPP/7zip/Common/FilterCoder.h +141 -43
- data/ext/p7zip/CPP/7zip/Common/InBuffer.cpp +87 -35
- data/ext/p7zip/CPP/7zip/Common/InBuffer.h +54 -45
- data/ext/p7zip/CPP/7zip/Common/InOutTempBuffer.cpp +22 -17
- data/ext/p7zip/CPP/7zip/Common/InOutTempBuffer.h +5 -5
- data/ext/p7zip/CPP/7zip/Common/LimitedStreams.cpp +256 -43
- data/ext/p7zip/CPP/7zip/Common/LimitedStreams.h +135 -8
- data/ext/p7zip/CPP/7zip/Common/MemBlocks.cpp +5 -5
- data/ext/p7zip/CPP/7zip/Common/MemBlocks.h +3 -3
- data/ext/p7zip/CPP/7zip/Common/MethodId.cpp +0 -24
- data/ext/p7zip/CPP/7zip/Common/MethodId.h +1 -1
- data/ext/p7zip/CPP/7zip/Common/MethodProps.cpp +430 -71
- data/ext/p7zip/CPP/7zip/Common/MethodProps.h +170 -17
- data/ext/p7zip/CPP/7zip/Common/OffsetStream.cpp +8 -4
- data/ext/p7zip/CPP/7zip/Common/OffsetStream.h +4 -3
- data/ext/p7zip/CPP/7zip/Common/OutBuffer.cpp +26 -31
- data/ext/p7zip/CPP/7zip/Common/OutBuffer.h +17 -18
- data/ext/p7zip/CPP/7zip/Common/OutMemStream.cpp +5 -5
- data/ext/p7zip/CPP/7zip/Common/OutMemStream.h +5 -4
- data/ext/p7zip/CPP/7zip/Common/ProgressUtils.cpp +22 -13
- data/ext/p7zip/CPP/7zip/Common/ProgressUtils.h +4 -3
- data/ext/p7zip/CPP/7zip/Common/PropId.cpp +108 -0
- data/ext/p7zip/CPP/7zip/Common/RegisterArc.h +63 -17
- data/ext/p7zip/CPP/7zip/Common/RegisterCodec.h +79 -6
- data/ext/p7zip/CPP/7zip/Common/StreamBinder.cpp +95 -90
- data/ext/p7zip/CPP/7zip/Common/StreamBinder.h +46 -23
- data/ext/p7zip/CPP/7zip/Common/StreamObjects.cpp +88 -24
- data/ext/p7zip/CPP/7zip/Common/StreamObjects.h +36 -14
- data/ext/p7zip/CPP/7zip/Common/StreamUtils.cpp +4 -4
- data/ext/p7zip/CPP/7zip/Common/StreamUtils.h +6 -6
- data/ext/p7zip/CPP/7zip/Common/UniqBlocks.cpp +57 -0
- data/ext/p7zip/CPP/7zip/Common/UniqBlocks.h +26 -0
- data/ext/p7zip/CPP/7zip/Common/VirtThread.cpp +8 -6
- data/ext/p7zip/CPP/7zip/Common/VirtThread.h +6 -5
- data/ext/p7zip/CPP/7zip/Compress/BZip2Const.h +13 -12
- data/ext/p7zip/CPP/7zip/Compress/BZip2Crc.h +1 -1
- data/ext/p7zip/CPP/7zip/Compress/BZip2Decoder.cpp +198 -147
- data/ext/p7zip/CPP/7zip/Compress/BZip2Decoder.h +60 -27
- data/ext/p7zip/CPP/7zip/Compress/BZip2Encoder.cpp +111 -116
- data/ext/p7zip/CPP/7zip/Compress/BZip2Encoder.h +53 -59
- data/ext/p7zip/CPP/7zip/Compress/BZip2Register.cpp +12 -7
- data/ext/p7zip/CPP/7zip/Compress/Bcj2Coder.cpp +554 -282
- data/ext/p7zip/CPP/7zip/Compress/Bcj2Coder.h +73 -71
- data/ext/p7zip/CPP/7zip/Compress/Bcj2Register.cpp +10 -5
- data/ext/p7zip/CPP/7zip/Compress/BcjCoder.cpp +13 -4
- data/ext/p7zip/CPP/7zip/Compress/BcjCoder.h +17 -5
- data/ext/p7zip/CPP/7zip/Compress/BcjRegister.cpp +7 -9
- data/ext/p7zip/CPP/7zip/Compress/BitlDecoder.cpp +2 -2
- data/ext/p7zip/CPP/7zip/Compress/BitlDecoder.h +58 -61
- data/ext/p7zip/CPP/7zip/Compress/BitlEncoder.h +24 -25
- data/ext/p7zip/CPP/7zip/Compress/BitmDecoder.h +46 -17
- data/ext/p7zip/CPP/7zip/Compress/BitmEncoder.h +18 -19
- data/ext/p7zip/CPP/7zip/Compress/BranchMisc.cpp +14 -28
- data/ext/p7zip/CPP/7zip/Compress/BranchMisc.h +27 -6
- data/ext/p7zip/CPP/7zip/Compress/BranchRegister.cpp +26 -15
- data/ext/p7zip/CPP/7zip/Compress/ByteSwap.cpp +45 -26
- data/ext/p7zip/CPP/7zip/Compress/CodecExports.cpp +254 -70
- data/ext/p7zip/CPP/7zip/Compress/CopyCoder.cpp +65 -17
- data/ext/p7zip/CPP/7zip/Compress/CopyCoder.h +15 -3
- data/ext/p7zip/CPP/7zip/Compress/CopyRegister.cpp +5 -4
- data/ext/p7zip/CPP/7zip/Compress/Deflate64Register.cpp +12 -6
- data/ext/p7zip/CPP/7zip/Compress/DeflateConst.h +43 -46
- data/ext/p7zip/CPP/7zip/Compress/DeflateDecoder.cpp +145 -81
- data/ext/p7zip/CPP/7zip/Compress/DeflateDecoder.h +31 -33
- data/ext/p7zip/CPP/7zip/Compress/DeflateEncoder.cpp +179 -162
- data/ext/p7zip/CPP/7zip/Compress/DeflateEncoder.h +35 -30
- data/ext/p7zip/CPP/7zip/Compress/DeflateRegister.cpp +11 -7
- data/ext/p7zip/CPP/7zip/Compress/DeltaFilter.cpp +55 -39
- data/ext/p7zip/CPP/7zip/Compress/{DllExports2.cpp → DllExports2Compress.cpp} +8 -8
- data/ext/p7zip/CPP/7zip/Compress/DllExportsCompress.cpp +48 -0
- data/ext/p7zip/CPP/7zip/Compress/HuffmanDecoder.h +220 -49
- data/ext/p7zip/CPP/7zip/Compress/ImplodeDecoder.cpp +14 -9
- data/ext/p7zip/CPP/7zip/Compress/ImplodeDecoder.h +2 -3
- data/ext/p7zip/CPP/7zip/Compress/ImplodeHuffmanDecoder.cpp +7 -7
- data/ext/p7zip/CPP/7zip/Compress/ImplodeHuffmanDecoder.h +1 -1
- data/ext/p7zip/CPP/7zip/Compress/LzOutWindow.cpp +1 -1
- data/ext/p7zip/CPP/7zip/Compress/LzOutWindow.h +21 -18
- data/ext/p7zip/CPP/7zip/Compress/LzhDecoder.cpp +171 -141
- data/ext/p7zip/CPP/7zip/Compress/LzhDecoder.h +32 -64
- data/ext/p7zip/CPP/7zip/Compress/Lzham/LICENSE +22 -0
- data/ext/p7zip/CPP/7zip/Compress/Lzham/LzhamRegister.cpp +783 -0
- data/ext/p7zip/CPP/7zip/Compress/Lzham/README.md +211 -0
- data/ext/p7zip/CPP/7zip/Compress/Lzham/include/lzham.h +803 -0
- data/ext/p7zip/CPP/7zip/Compress/Lzham/include/lzham_dynamic_lib.h +156 -0
- data/ext/p7zip/CPP/7zip/Compress/Lzham/include/lzham_exports.inc +31 -0
- data/ext/p7zip/CPP/7zip/Compress/Lzham/include/lzham_static_lib.h +59 -0
- data/ext/p7zip/CPP/7zip/Compress/Lzham/include/zlib.h +2 -0
- data/ext/p7zip/CPP/7zip/Compress/Lzham/lzhamcomp/CMakeLists.txt +69 -0
- data/ext/p7zip/CPP/7zip/Compress/Lzham/lzhamcomp/lzham_comp.h +38 -0
- data/ext/p7zip/CPP/7zip/Compress/Lzham/lzhamcomp/lzham_lzbase.cpp +244 -0
- data/ext/p7zip/CPP/7zip/Compress/Lzham/lzhamcomp/lzham_lzbase.h +46 -0
- data/ext/p7zip/CPP/7zip/Compress/Lzham/lzhamcomp/lzham_lzcomp.cpp +750 -0
- data/ext/p7zip/CPP/7zip/Compress/Lzham/lzhamcomp/lzham_lzcomp_internal.cpp +2240 -0
- data/ext/p7zip/CPP/7zip/Compress/Lzham/lzhamcomp/lzham_lzcomp_internal.h +503 -0
- data/ext/p7zip/CPP/7zip/Compress/Lzham/lzhamcomp/lzham_lzcomp_state.cpp +1684 -0
- data/ext/p7zip/CPP/7zip/Compress/Lzham/lzhamcomp/lzham_match_accel.cpp +947 -0
- data/ext/p7zip/CPP/7zip/Compress/Lzham/lzhamcomp/lzham_match_accel.h +164 -0
- data/ext/p7zip/CPP/7zip/Compress/Lzham/lzhamcomp/lzham_null_threading.h +98 -0
- data/ext/p7zip/CPP/7zip/Compress/Lzham/lzhamcomp/lzham_pthreads_threading.cpp +214 -0
- data/ext/p7zip/CPP/7zip/Compress/Lzham/lzhamcomp/lzham_pthreads_threading.h +535 -0
- data/ext/p7zip/CPP/7zip/Compress/Lzham/lzhamcomp/lzham_threading.h +12 -0
- data/ext/p7zip/CPP/7zip/Compress/Lzham/lzhamcomp/lzham_win32_threading.cpp +232 -0
- data/ext/p7zip/CPP/7zip/Compress/Lzham/lzhamcomp/lzham_win32_threading.h +387 -0
- data/ext/p7zip/CPP/7zip/Compress/Lzham/lzhamcomp/lzhamcomp.vcxproj +208 -0
- data/ext/p7zip/CPP/7zip/Compress/Lzham/lzhamdecomp/CMakeLists.txt +86 -0
- data/ext/p7zip/CPP/7zip/Compress/Lzham/lzhamdecomp/lzham_assert.cpp +80 -0
- data/ext/p7zip/CPP/7zip/Compress/Lzham/lzhamdecomp/lzham_assert.h +58 -0
- data/ext/p7zip/CPP/7zip/Compress/Lzham/lzhamdecomp/lzham_checksum.cpp +73 -0
- data/ext/p7zip/CPP/7zip/Compress/Lzham/lzhamdecomp/lzham_checksum.h +13 -0
- data/ext/p7zip/CPP/7zip/Compress/Lzham/lzhamdecomp/lzham_config.h +25 -0
- data/ext/p7zip/CPP/7zip/Compress/Lzham/lzhamdecomp/lzham_core.h +303 -0
- data/ext/p7zip/CPP/7zip/Compress/Lzham/lzhamdecomp/lzham_decomp.h +37 -0
- data/ext/p7zip/CPP/7zip/Compress/Lzham/lzhamdecomp/lzham_helpers.h +54 -0
- data/ext/p7zip/CPP/7zip/Compress/Lzham/lzhamdecomp/lzham_huffman_codes.cpp +286 -0
- data/ext/p7zip/CPP/7zip/Compress/Lzham/lzhamdecomp/lzham_huffman_codes.h +32 -0
- data/ext/p7zip/CPP/7zip/Compress/Lzham/lzhamdecomp/lzham_lzdecomp.cpp +1586 -0
- data/ext/p7zip/CPP/7zip/Compress/Lzham/lzhamdecomp/lzham_lzdecompbase.cpp +131 -0
- data/ext/p7zip/CPP/7zip/Compress/Lzham/lzhamdecomp/lzham_lzdecompbase.h +89 -0
- data/ext/p7zip/CPP/7zip/Compress/Lzham/lzhamdecomp/lzham_math.h +142 -0
- data/ext/p7zip/CPP/7zip/Compress/Lzham/lzhamdecomp/lzham_mem.cpp +463 -0
- data/ext/p7zip/CPP/7zip/Compress/Lzham/lzhamdecomp/lzham_mem.h +115 -0
- data/ext/p7zip/CPP/7zip/Compress/Lzham/lzhamdecomp/lzham_platform.cpp +159 -0
- data/ext/p7zip/CPP/7zip/Compress/Lzham/lzhamdecomp/lzham_platform.h +284 -0
- data/ext/p7zip/CPP/7zip/Compress/Lzham/lzhamdecomp/lzham_prefix_coding.cpp +431 -0
- data/ext/p7zip/CPP/7zip/Compress/Lzham/lzhamdecomp/lzham_prefix_coding.h +157 -0
- data/ext/p7zip/CPP/7zip/Compress/Lzham/lzhamdecomp/lzham_symbol_codec.cpp +1527 -0
- data/ext/p7zip/CPP/7zip/Compress/Lzham/lzhamdecomp/lzham_symbol_codec.h +494 -0
- data/ext/p7zip/CPP/7zip/Compress/Lzham/lzhamdecomp/lzham_timer.cpp +147 -0
- data/ext/p7zip/CPP/7zip/Compress/Lzham/lzhamdecomp/lzham_timer.h +99 -0
- data/ext/p7zip/CPP/7zip/Compress/Lzham/lzhamdecomp/lzham_traits.h +141 -0
- data/ext/p7zip/CPP/7zip/Compress/Lzham/lzhamdecomp/lzham_types.h +72 -0
- data/ext/p7zip/CPP/7zip/Compress/Lzham/lzhamdecomp/lzham_utils.h +58 -0
- data/ext/p7zip/CPP/7zip/Compress/Lzham/lzhamdecomp/lzham_vector.cpp +83 -0
- data/ext/p7zip/CPP/7zip/Compress/Lzham/lzhamdecomp/lzham_vector.h +628 -0
- data/ext/p7zip/CPP/7zip/Compress/Lzham/lzhamdecomp/lzhamdecomp.vcxproj +224 -0
- data/ext/p7zip/CPP/7zip/Compress/Lzham/lzhamlib/lzham_lib.cpp +179 -0
- data/ext/p7zip/CPP/7zip/Compress/Lzham/lzhamlib/lzhamlib.vcxproj +187 -0
- data/ext/p7zip/CPP/7zip/Compress/Lzham/makefile +10 -0
- data/ext/p7zip/CPP/7zip/Compress/Lzham/makefile.depend +0 -0
- data/ext/p7zip/CPP/7zip/Compress/Lzham/makefile.list +129 -0
- data/ext/p7zip/CPP/7zip/Compress/Lzma2Decoder.cpp +123 -46
- data/ext/p7zip/CPP/7zip/Compress/Lzma2Decoder.h +29 -14
- data/ext/p7zip/CPP/7zip/Compress/Lzma2Encoder.cpp +14 -9
- data/ext/p7zip/CPP/7zip/Compress/Lzma2Encoder.h +1 -1
- data/ext/p7zip/CPP/7zip/Compress/Lzma2Register.cpp +9 -7
- data/ext/p7zip/CPP/7zip/Compress/LzmaDecoder.cpp +24 -8
- data/ext/p7zip/CPP/7zip/Compress/LzmaDecoder.h +8 -1
- data/ext/p7zip/CPP/7zip/Compress/LzmaEncoder.cpp +30 -27
- data/ext/p7zip/CPP/7zip/Compress/LzmaEncoder.h +3 -1
- data/ext/p7zip/CPP/7zip/Compress/LzmaRegister.cpp +9 -7
- data/ext/p7zip/CPP/7zip/Compress/LzmsDecoder.cpp +576 -0
- data/ext/p7zip/CPP/7zip/Compress/LzmsDecoder.h +271 -0
- data/ext/p7zip/CPP/7zip/Compress/Lzx.h +32 -36
- data/ext/p7zip/CPP/7zip/Compress/LzxDecoder.cpp +380 -238
- data/ext/p7zip/CPP/7zip/Compress/LzxDecoder.h +170 -83
- data/ext/p7zip/CPP/7zip/Compress/Mtf8.h +7 -9
- data/ext/p7zip/CPP/7zip/Compress/PpmdDecoder.cpp +1 -5
- data/ext/p7zip/CPP/7zip/Compress/PpmdEncoder.cpp +51 -18
- data/ext/p7zip/CPP/7zip/Compress/PpmdEncoder.h +18 -8
- data/ext/p7zip/CPP/7zip/Compress/PpmdRegister.cpp +9 -8
- data/ext/p7zip/CPP/7zip/Compress/PpmdZip.cpp +61 -25
- data/ext/p7zip/CPP/7zip/Compress/PpmdZip.h +21 -6
- data/ext/p7zip/CPP/7zip/Compress/QuantumDecoder.cpp +122 -102
- data/ext/p7zip/CPP/7zip/Compress/QuantumDecoder.h +68 -157
- data/ext/p7zip/CPP/7zip/Compress/Rar/makefile +33 -18
- data/ext/p7zip/CPP/7zip/Compress/Rar/makefile.depend +0 -158
- data/ext/p7zip/CPP/7zip/Compress/Rar/makefile.list +105 -56
- data/ext/p7zip/CPP/7zip/Compress/Rar1Decoder.cpp +34 -21
- data/ext/p7zip/CPP/7zip/Compress/Rar1Decoder.h +2 -0
- data/ext/p7zip/CPP/7zip/Compress/Rar2Decoder.cpp +77 -67
- data/ext/p7zip/CPP/7zip/Compress/Rar2Decoder.h +12 -10
- data/ext/p7zip/CPP/7zip/Compress/Rar3Decoder.cpp +139 -118
- data/ext/p7zip/CPP/7zip/Compress/Rar3Decoder.h +48 -33
- data/ext/p7zip/CPP/7zip/Compress/Rar3Vm.cpp +148 -113
- data/ext/p7zip/CPP/7zip/Compress/Rar3Vm.h +35 -19
- data/ext/p7zip/CPP/7zip/Compress/Rar5Decoder.cpp +961 -0
- data/ext/p7zip/CPP/7zip/Compress/Rar5Decoder.h +335 -0
- data/ext/p7zip/CPP/7zip/Compress/RarCodecsRegister.cpp +13 -6
- data/ext/p7zip/CPP/7zip/Compress/ShrinkDecoder.cpp +91 -71
- data/ext/p7zip/CPP/7zip/Compress/ShrinkDecoder.h +2 -4
- data/ext/p7zip/CPP/7zip/Compress/XpressDecoder.cpp +129 -0
- data/ext/p7zip/CPP/7zip/Compress/XpressDecoder.h +13 -0
- data/ext/p7zip/CPP/7zip/Compress/ZDecoder.cpp +98 -20
- data/ext/p7zip/CPP/7zip/Compress/ZDecoder.h +19 -7
- data/ext/p7zip/CPP/7zip/Compress/ZlibDecoder.cpp +14 -11
- data/ext/p7zip/CPP/7zip/Compress/ZlibDecoder.h +32 -1
- data/ext/p7zip/CPP/7zip/Crypto/7zAes.cpp +137 -101
- data/ext/p7zip/CPP/7zip/Crypto/7zAes.h +31 -30
- data/ext/p7zip/CPP/7zip/Crypto/7zAesRegister.cpp +8 -9
- data/ext/p7zip/CPP/7zip/Crypto/HmacSha1.cpp +39 -28
- data/ext/p7zip/CPP/7zip/Crypto/HmacSha1.h +3 -3
- data/ext/p7zip/CPP/7zip/Crypto/HmacSha256.cpp +62 -0
- data/ext/p7zip/CPP/7zip/Crypto/HmacSha256.h +27 -0
- data/ext/p7zip/CPP/7zip/Crypto/MyAes.cpp +73 -7
- data/ext/p7zip/CPP/7zip/Crypto/MyAes.h +25 -8
- data/ext/p7zip/CPP/7zip/Crypto/MyAesReg.cpp +16 -0
- data/ext/p7zip/CPP/7zip/Crypto/Pbkdf2HmacSha1.cpp +29 -15
- data/ext/p7zip/CPP/7zip/Crypto/Pbkdf2HmacSha1.h +2 -1
- data/ext/p7zip/CPP/7zip/Crypto/RandGen.cpp +49 -34
- data/ext/p7zip/CPP/7zip/Crypto/RandGen.h +2 -2
- data/ext/p7zip/CPP/7zip/Crypto/Rar20Crypto.cpp +36 -39
- data/ext/p7zip/CPP/7zip/Crypto/Rar20Crypto.h +15 -17
- data/ext/p7zip/CPP/7zip/Crypto/Rar5Aes.cpp +257 -0
- data/ext/p7zip/CPP/7zip/Crypto/Rar5Aes.h +84 -0
- data/ext/p7zip/CPP/7zip/Crypto/RarAes.cpp +70 -71
- data/ext/p7zip/CPP/7zip/Crypto/RarAes.h +24 -19
- data/ext/p7zip/CPP/7zip/Crypto/Sha1Cls.h +51 -0
- data/ext/p7zip/CPP/7zip/Crypto/WzAes.cpp +68 -54
- data/ext/p7zip/CPP/7zip/Crypto/WzAes.h +37 -27
- data/ext/p7zip/CPP/7zip/Crypto/ZipCrypto.cpp +60 -34
- data/ext/p7zip/CPP/7zip/Crypto/ZipCrypto.h +28 -11
- data/ext/p7zip/CPP/7zip/Crypto/ZipStrong.cpp +90 -28
- data/ext/p7zip/CPP/7zip/Crypto/ZipStrong.h +13 -2
- data/ext/p7zip/CPP/7zip/Guid.txt +57 -11
- data/ext/p7zip/CPP/7zip/ICoder.h +202 -17
- data/ext/p7zip/CPP/7zip/IDecl.h +16 -3
- data/ext/p7zip/CPP/7zip/IPassword.h +1 -2
- data/ext/p7zip/CPP/7zip/IProgress.h +2 -16
- data/ext/p7zip/CPP/7zip/IStream.h +82 -13
- data/ext/p7zip/CPP/7zip/MyVersion.h +2 -11
- data/ext/p7zip/CPP/7zip/PropID.h +60 -9
- data/ext/p7zip/CPP/Common/C_FileIO.cpp +5 -1
- data/ext/p7zip/CPP/Common/C_FileIO.h +7 -1
- data/ext/p7zip/CPP/Common/CommandLineParser.cpp +122 -148
- data/ext/p7zip/CPP/Common/CommandLineParser.h +20 -29
- data/ext/p7zip/CPP/Common/Common.h +13 -0
- data/ext/p7zip/CPP/Common/CrcReg.cpp +98 -0
- data/ext/p7zip/CPP/Common/Defs.h +5 -10
- data/ext/p7zip/CPP/Common/DynLimBuf.cpp +93 -0
- data/ext/p7zip/CPP/Common/DynLimBuf.h +40 -0
- data/ext/p7zip/CPP/Common/DynamicBuffer.h +45 -31
- data/ext/p7zip/CPP/Common/IntToString.cpp +109 -40
- data/ext/p7zip/CPP/Common/IntToString.h +14 -9
- data/ext/p7zip/CPP/Common/Lang.cpp +120 -87
- data/ext/p7zip/CPP/Common/Lang.h +10 -15
- data/ext/p7zip/CPP/Common/ListFileUtils.cpp +82 -40
- data/ext/p7zip/CPP/Common/ListFileUtils.h +7 -4
- data/ext/p7zip/CPP/Common/MyBuffer.h +244 -0
- data/ext/p7zip/CPP/Common/MyCom.h +65 -28
- data/ext/p7zip/CPP/Common/MyGuidDef.h +1 -1
- data/ext/p7zip/CPP/Common/MyInitGuid.h +23 -0
- data/ext/p7zip/CPP/Common/MyLinux.h +42 -0
- data/ext/p7zip/CPP/Common/MyMap.cpp +8 -8
- data/ext/p7zip/CPP/Common/MyMap.h +2 -2
- data/ext/p7zip/CPP/Common/MyString.cpp +1643 -117
- data/ext/p7zip/CPP/Common/MyString.h +677 -486
- data/ext/p7zip/CPP/Common/MyTypes.h +38 -0
- data/ext/p7zip/CPP/Common/MyUnknown.h +4 -0
- data/ext/p7zip/CPP/Common/MyVector.cpp +0 -84
- data/ext/p7zip/CPP/Common/MyVector.h +472 -112
- data/ext/p7zip/CPP/Common/MyWindows.cpp +18 -1
- data/ext/p7zip/CPP/Common/MyWindows.h +8 -0
- data/ext/p7zip/CPP/Common/MyXml.cpp +169 -118
- data/ext/p7zip/CPP/Common/MyXml.h +14 -11
- data/ext/p7zip/CPP/Common/NewHandler.cpp +39 -0
- data/ext/p7zip/CPP/Common/NewHandler.h +55 -2
- data/ext/p7zip/CPP/Common/Random.h +14 -0
- data/ext/p7zip/CPP/Common/Sha1Reg.cpp +40 -0
- data/ext/p7zip/CPP/Common/Sha256Reg.cpp +40 -0
- data/ext/p7zip/CPP/Common/StdInStream.cpp +46 -27
- data/ext/p7zip/CPP/Common/StdInStream.h +11 -10
- data/ext/p7zip/CPP/Common/StdOutStream.cpp +48 -35
- data/ext/p7zip/CPP/Common/StdOutStream.h +44 -17
- data/ext/p7zip/CPP/Common/StringConvert.cpp +56 -17
- data/ext/p7zip/CPP/Common/StringConvert.h +7 -3
- data/ext/p7zip/CPP/Common/StringToInt.cpp +102 -48
- data/ext/p7zip/CPP/Common/StringToInt.h +13 -10
- data/ext/p7zip/CPP/Common/TextConfig.cpp +33 -47
- data/ext/p7zip/CPP/Common/TextConfig.h +3 -6
- data/ext/p7zip/CPP/Common/UTFConvert.cpp +218 -75
- data/ext/p7zip/CPP/Common/UTFConvert.h +4 -3
- data/ext/p7zip/CPP/Common/Wildcard.cpp +345 -125
- data/ext/p7zip/CPP/Common/Wildcard.h +82 -13
- data/ext/p7zip/CPP/Common/XzCrc64Reg.cpp +42 -0
- data/ext/p7zip/CPP/Windows/FileDir.cpp +427 -475
- data/ext/p7zip/CPP/Windows/FileDir.h +94 -72
- data/ext/p7zip/CPP/Windows/FileFind.cpp +235 -244
- data/ext/p7zip/CPP/Windows/FileFind.h +63 -59
- data/ext/p7zip/CPP/Windows/FileIO.cpp +29 -46
- data/ext/p7zip/CPP/Windows/FileIO.h +40 -42
- data/ext/p7zip/CPP/Windows/FileName.cpp +696 -17
- data/ext/p7zip/CPP/Windows/FileName.h +11 -3
- data/ext/p7zip/CPP/Windows/NtCheck.h +2 -0
- data/ext/p7zip/CPP/Windows/PropVariant.cpp +134 -30
- data/ext/p7zip/CPP/Windows/PropVariant.h +80 -24
- data/ext/p7zip/CPP/Windows/PropVariantUtils.cpp +89 -18
- data/ext/p7zip/CPP/Windows/PropVariantUtils.h +12 -7
- data/ext/p7zip/CPP/Windows/System.cpp +20 -15
- data/ext/p7zip/CPP/Windows/System.h +3 -2
- data/ext/p7zip/CPP/Windows/TimeUtils.cpp +203 -0
- data/ext/p7zip/CPP/Windows/TimeUtils.h +24 -0
- data/ext/p7zip/CPP/include_windows/basetyps.h +4 -4
- data/ext/p7zip/CPP/include_windows/windows.h +17 -11
- data/ext/p7zip/CPP/myWindows/StdAfx.h +97 -5
- data/ext/p7zip/CPP/myWindows/config.h +20 -5
- data/ext/p7zip/CPP/myWindows/myPrivate.h +8 -0
- data/ext/p7zip/CPP/myWindows/wine_date_and_time.cpp +34 -0
- data/ext/p7zip/ChangeLog +283 -35
- data/ext/p7zip/{DOCS → DOC}/7zC.txt +6 -13
- data/ext/p7zip/{DOCS → DOC}/License.txt +3 -2
- data/ext/p7zip/{DOCS/MANUAL → DOC/MANUAL/cmdline}/commands/add.htm +93 -87
- data/ext/p7zip/{DOCS/MANUAL → DOC/MANUAL/cmdline}/commands/bench.htm +88 -79
- data/ext/p7zip/{DOCS/MANUAL → DOC/MANUAL/cmdline}/commands/delete.htm +62 -59
- data/ext/p7zip/{DOCS/MANUAL → DOC/MANUAL/cmdline}/commands/extract.htm +96 -91
- data/ext/p7zip/{DOCS/MANUAL → DOC/MANUAL/cmdline}/commands/extract_full.htm +73 -68
- data/ext/p7zip/DOC/MANUAL/cmdline/commands/hash.htm +65 -0
- data/ext/p7zip/{DOCS/MANUAL → DOC/MANUAL/cmdline}/commands/index.htm +36 -33
- data/ext/p7zip/{DOCS/MANUAL → DOC/MANUAL/cmdline}/commands/list.htm +78 -77
- data/ext/p7zip/DOC/MANUAL/cmdline/commands/rename.htm +51 -0
- data/ext/p7zip/{DOCS/MANUAL → DOC/MANUAL/cmdline}/commands/style.css +232 -232
- data/ext/p7zip/{DOCS/MANUAL → DOC/MANUAL/cmdline}/commands/test.htm +47 -46
- data/ext/p7zip/{DOCS/MANUAL → DOC/MANUAL/cmdline}/commands/update.htm +71 -66
- data/ext/p7zip/{DOCS/MANUAL → DOC/MANUAL/cmdline}/exit_codes.htm +27 -27
- data/ext/p7zip/{DOCS/MANUAL → DOC/MANUAL/cmdline}/index.htm +29 -29
- data/ext/p7zip/{DOCS/MANUAL/switches → DOC/MANUAL/cmdline}/style.css +232 -232
- data/ext/p7zip/{DOCS/MANUAL → DOC/MANUAL/cmdline}/switches/ar_exclude.htm +56 -56
- data/ext/p7zip/{DOCS/MANUAL → DOC/MANUAL/cmdline}/switches/ar_include.htm +80 -83
- data/ext/p7zip/{DOCS/MANUAL → DOC/MANUAL/cmdline}/switches/ar_no.htm +52 -52
- data/ext/p7zip/DOC/MANUAL/cmdline/switches/bb.htm +61 -0
- data/ext/p7zip/DOC/MANUAL/cmdline/switches/bs.htm +67 -0
- data/ext/p7zip/DOC/MANUAL/cmdline/switches/charset.htm +61 -0
- data/ext/p7zip/{DOCS/MANUAL → DOC/MANUAL/cmdline}/switches/exclude.htm +71 -60
- data/ext/p7zip/{DOCS/MANUAL → DOC/MANUAL/cmdline}/switches/include.htm +89 -87
- data/ext/p7zip/{DOCS/MANUAL → DOC/MANUAL/cmdline}/switches/index.htm +95 -64
- data/ext/p7zip/{DOCS/MANUAL → DOC/MANUAL/cmdline}/switches/large_pages.htm +59 -50
- data/ext/p7zip/{DOCS/MANUAL → DOC/MANUAL/cmdline}/switches/list_tech.htm +36 -36
- data/ext/p7zip/{DOCS/MANUAL → DOC/MANUAL/cmdline}/switches/method.htm +738 -625
- data/ext/p7zip/{DOCS/MANUAL → DOC/MANUAL/cmdline}/switches/output_dir.htm +53 -53
- data/ext/p7zip/{DOCS/MANUAL → DOC/MANUAL/cmdline}/switches/overwrite.htm +56 -56
- data/ext/p7zip/{DOCS/MANUAL → DOC/MANUAL/cmdline}/switches/password.htm +55 -54
- data/ext/p7zip/{DOCS/MANUAL → DOC/MANUAL/cmdline}/switches/recurse.htm +85 -83
- data/ext/p7zip/DOC/MANUAL/cmdline/switches/sa.htm +58 -0
- data/ext/p7zip/DOC/MANUAL/cmdline/switches/scc.htm +42 -0
- data/ext/p7zip/DOC/MANUAL/cmdline/switches/scrc.htm +53 -0
- data/ext/p7zip/DOC/MANUAL/cmdline/switches/sdel.htm +39 -0
- data/ext/p7zip/{DOCS/MANUAL → DOC/MANUAL/cmdline}/switches/sfx.htm +153 -156
- data/ext/p7zip/DOC/MANUAL/cmdline/switches/shared.htm +40 -0
- data/ext/p7zip/DOC/MANUAL/cmdline/switches/sni.htm +56 -0
- data/ext/p7zip/DOC/MANUAL/cmdline/switches/sns.htm +77 -0
- data/ext/p7zip/DOC/MANUAL/cmdline/switches/spf.htm +80 -0
- data/ext/p7zip/{DOCS/MANUAL → DOC/MANUAL/cmdline}/switches/ssc.htm +50 -50
- data/ext/p7zip/{DOCS/MANUAL → DOC/MANUAL/cmdline}/switches/stdin.htm +56 -55
- data/ext/p7zip/{DOCS/MANUAL → DOC/MANUAL/cmdline}/switches/stdout.htm +54 -50
- data/ext/p7zip/DOC/MANUAL/cmdline/switches/stl.htm +39 -0
- data/ext/p7zip/{DOCS/MANUAL → DOC/MANUAL/cmdline}/switches/stop_switch.htm +31 -31
- data/ext/p7zip/DOC/MANUAL/cmdline/switches/stx.htm +50 -0
- data/ext/p7zip/{DOCS/MANUAL → DOC/MANUAL/cmdline/switches}/style.css +232 -232
- data/ext/p7zip/{DOCS/MANUAL → DOC/MANUAL/cmdline}/switches/type.htm +121 -83
- data/ext/p7zip/{DOCS/MANUAL → DOC/MANUAL/cmdline}/switches/update.htm +177 -176
- data/ext/p7zip/{DOCS/MANUAL → DOC/MANUAL/cmdline}/switches/volume.htm +49 -49
- data/ext/p7zip/{DOCS/MANUAL → DOC/MANUAL/cmdline}/switches/working_dir.htm +56 -55
- data/ext/p7zip/{DOCS/MANUAL → DOC/MANUAL/cmdline}/switches/yes.htm +48 -48
- data/ext/p7zip/{DOCS/MANUAL → DOC/MANUAL/cmdline}/syntax.htm +120 -120
- data/ext/p7zip/DOC/MANUAL/fm/about.htm +21 -0
- data/ext/p7zip/DOC/MANUAL/fm/benchmark.htm +56 -0
- data/ext/p7zip/DOC/MANUAL/fm/index.htm +54 -0
- data/ext/p7zip/DOC/MANUAL/fm/menu.htm +154 -0
- data/ext/p7zip/DOC/MANUAL/fm/options.htm +152 -0
- data/ext/p7zip/DOC/MANUAL/fm/plugins/7-zip/add.htm +311 -0
- data/ext/p7zip/DOC/MANUAL/fm/plugins/7-zip/extract.htm +78 -0
- data/ext/p7zip/DOC/MANUAL/fm/plugins/7-zip/index.htm +63 -0
- data/ext/p7zip/DOC/MANUAL/fm/plugins/7-zip/style.css +232 -0
- data/ext/p7zip/DOC/MANUAL/fm/plugins/index.htm +22 -0
- data/ext/p7zip/DOC/MANUAL/fm/plugins/style.css +232 -0
- data/ext/p7zip/DOC/MANUAL/fm/style.css +232 -0
- data/ext/p7zip/DOC/MANUAL/general/7z.htm +117 -0
- data/ext/p7zip/DOC/MANUAL/general/faq.htm +125 -0
- data/ext/p7zip/DOC/MANUAL/general/formats.htm +100 -0
- data/ext/p7zip/DOC/MANUAL/general/index.htm +27 -0
- data/ext/p7zip/DOC/MANUAL/general/license.htm +30 -0
- data/ext/p7zip/DOC/MANUAL/general/performance.htm +98 -0
- data/ext/p7zip/DOC/MANUAL/general/style.css +232 -0
- data/ext/p7zip/DOC/MANUAL/general/thanks.htm +43 -0
- data/ext/p7zip/DOC/MANUAL/start.htm +37 -0
- data/ext/p7zip/DOC/MANUAL/style.css +232 -0
- data/ext/p7zip/DOC/Methods.txt +158 -0
- data/ext/p7zip/{DOCS → DOC}/copying.txt +9 -11
- data/ext/p7zip/DOC/lzma.txt +328 -0
- data/ext/p7zip/{DOCS → DOC}/readme.txt +42 -65
- data/ext/p7zip/{DOCS/history.txt → DOC/src-history.txt} +88 -2
- data/ext/p7zip/README +117 -91
- data/ext/p7zip/TODO +0 -2
- data/ext/p7zip/install.sh +31 -29
- data/ext/p7zip/last_error +1 -0
- data/ext/p7zip/makefile +29 -125
- data/ext/p7zip/makefile.afl +23 -0
- data/ext/p7zip/makefile.aix_gcc +5 -4
- data/ext/p7zip/makefile.android_arm +49 -0
- data/ext/p7zip/makefile.beos +5 -4
- data/ext/p7zip/makefile.common +150 -0
- data/ext/p7zip/makefile.crc32 +3 -3
- data/ext/p7zip/makefile.cygwin +5 -4
- data/ext/p7zip/makefile.cygwin64 +21 -0
- data/ext/p7zip/makefile.cygwin64_asm +22 -0
- data/ext/p7zip/makefile.cygwin_asm +6 -4
- data/ext/p7zip/makefile.cygwin_clang +21 -0
- data/ext/p7zip/makefile.cygwin_clang_asm +23 -0
- data/ext/p7zip/{makefile.djgpp_old → makefile.djgpp} +5 -4
- data/ext/p7zip/makefile.djgpp_watt +7 -5
- data/ext/p7zip/makefile.freebsd5 +5 -4
- data/ext/p7zip/{makefile.freebsd6 → makefile.freebsd6+} +6 -5
- data/ext/p7zip/makefile.glb +27 -18
- data/ext/p7zip/makefile.gprof +3 -2
- data/ext/p7zip/makefile.haiku +19 -0
- data/ext/p7zip/makefile.hpux-acc +3 -2
- data/ext/p7zip/makefile.hpux-acc_64 +3 -2
- data/ext/p7zip/makefile.hpux-gcc +5 -4
- data/ext/p7zip/makefile.linux_amd64 +5 -4
- data/ext/p7zip/makefile.linux_amd64_asm +12 -5
- data/ext/p7zip/makefile.linux_amd64_asm_icc +5 -3
- data/ext/p7zip/makefile.linux_amd64_sanitizer +26 -0
- data/ext/p7zip/makefile.linux_any_cpu +5 -4
- data/ext/p7zip/makefile.linux_any_cpu_gcc_4.X +7 -4
- data/ext/p7zip/makefile.linux_clang_amd64_asm +25 -0
- data/ext/p7zip/makefile.linux_clang_amd64_asm_sanitize +27 -0
- data/ext/p7zip/makefile.linux_cross_aarch64 +25 -0
- data/ext/p7zip/makefile.linux_cross_arm +7 -4
- data/ext/p7zip/makefile.linux_cross_djgpp +27 -0
- data/ext/p7zip/makefile.linux_cross_m68k +26 -0
- data/ext/p7zip/makefile.linux_cross_mipsel +27 -0
- data/ext/p7zip/makefile.linux_cross_ppc +25 -0
- data/ext/p7zip/makefile.linux_cross_ppc64 +25 -0
- data/ext/p7zip/makefile.linux_cross_ppc64le +25 -0
- data/ext/p7zip/makefile.linux_cross_s390x +25 -0
- data/ext/p7zip/makefile.linux_cross_sparc64 +25 -0
- data/ext/p7zip/makefile.linux_gcc6_sanitize +23 -0
- data/ext/p7zip/makefile.linux_gcc_2.95_no_need_for_libstdc +6 -4
- data/ext/p7zip/makefile.linux_other +6 -5
- data/ext/p7zip/makefile.linux_s390x +5 -4
- data/ext/p7zip/{makefile.machine_base → makefile.linux_scan-build} +5 -4
- data/ext/p7zip/makefile.linux_valgrind +25 -0
- data/ext/p7zip/{makefile.linux_clang_amd64 → makefile.linux_x32} +6 -5
- data/ext/p7zip/makefile.linux_x86_asm_gcc_4.X +10 -5
- data/ext/p7zip/makefile.linux_x86_asm_gcc_4.X_fltk +8 -4
- data/ext/p7zip/makefile.linux_x86_asm_gcc_mudflap_4.X +4 -2
- data/ext/p7zip/makefile.linux_x86_asm_icc +4 -2
- data/ext/p7zip/makefile.linux_x86_icc +3 -2
- data/ext/p7zip/makefile.macosx_arm64 +17 -0
- data/ext/p7zip/{makefile.macosx_32bits → makefile.macosx_gcc_32bits} +3 -2
- data/ext/p7zip/{makefile.macosx_32bits_asm → makefile.macosx_gcc_32bits_asm} +5 -3
- data/ext/p7zip/{makefile.macosx_32bits_ppc → makefile.macosx_gcc_32bits_ppc} +3 -2
- data/ext/p7zip/{makefile.macosx_64bits → makefile.macosx_gcc_64bits} +3 -2
- data/ext/p7zip/makefile.macosx_llvm_64bits +9 -3
- data/ext/p7zip/makefile.netbsd +5 -4
- data/ext/p7zip/makefile.netware_asm_gcc_3.X +6 -4
- data/ext/p7zip/makefile.oldmake +41 -130
- data/ext/p7zip/makefile.openbsd +7 -3
- data/ext/p7zip/makefile.openbsd_no_port +9 -5
- data/ext/p7zip/makefile.qnx_shared.bin +5 -4
- data/ext/p7zip/makefile.qnx_static +5 -4
- data/ext/p7zip/makefile.solaris_sparc_CC_32 +5 -4
- data/ext/p7zip/makefile.solaris_sparc_CC_64 +6 -4
- data/ext/p7zip/makefile.solaris_sparc_gcc +7 -6
- data/ext/p7zip/makefile.solaris_x86 +5 -4
- data/ext/p7zip/makefile.tru64 +5 -4
- data/ext/seven_zip_ruby/extconf.rb +92 -6
- data/ext/seven_zip_ruby/seven_zip_archive.cpp +40 -17
- data/ext/seven_zip_ruby/seven_zip_archive.h +1 -1
- data/ext/seven_zip_ruby/utils.cpp +267 -124
- data/ext/seven_zip_ruby/utils.h +2 -0
- data/lib/seven_zip_ruby/7z.dll +0 -0
- data/lib/seven_zip_ruby/7z.sfx +0 -0
- data/lib/seven_zip_ruby/7z64.dll +0 -0
- data/lib/seven_zip_ruby/7zCon.sfx +0 -0
- data/lib/seven_zip_ruby/seven_zip_reader.rb +16 -1
- data/lib/seven_zip_ruby/version.rb +1 -1
- data/p7zip/.gitignore +7 -0
- data/p7zip/README.txt +29 -0
- data/p7zip/extract.sh +134 -0
- data/spec/seven_zip_ruby_spec.rb +22 -13
- data/test/res/The Flying Spaghetti Monster.txt +3 -0
- data/test/res/The Three Little Pigs.txt +5 -0
- data/test/res/UTF_content.txt +3 -0
- data/test/res/test_reader_data.7z +0 -0
- data/test/res/test_reader_filename_cp932.7z +0 -0
- data/test/res/test_reader_files.7z +0 -0
- data/test/test_seven_zip_reader.rb +187 -0
- data/test/test_seven_zip_writer.rb +184 -0
- metadata +267 -219
- data/.github/workflows/test-and-release.yml +0 -43
- data/ext/C/Types.h +0 -254
- data/ext/CPP/7zip/Archive/IArchive.h +0 -234
- data/ext/CPP/7zip/IDecl.h +0 -15
- data/ext/CPP/7zip/IPassword.h +0 -24
- data/ext/CPP/7zip/IProgress.h +0 -33
- data/ext/CPP/7zip/IStream.h +0 -58
- data/ext/CPP/7zip/PropID.h +0 -76
- data/ext/CPP/Common/MyCom.h +0 -225
- data/ext/CPP/Common/MyGuidDef.h +0 -54
- data/ext/CPP/Common/MyInitGuid.h +0 -22
- data/ext/CPP/Common/MyUnknown.h +0 -13
- data/ext/CPP/Common/MyWindows.h +0 -204
- data/ext/CPP/Common/Types.h +0 -11
- data/ext/CPP/Windows/PropVariant.h +0 -56
- data/ext/CPP/include_windows/basetyps.h +0 -19
- data/ext/CPP/include_windows/tchar.h +0 -89
- data/ext/CPP/include_windows/windows.h +0 -194
- data/ext/p7zip/Asm/x64/7zCrcT8U.asm +0 -103
- data/ext/p7zip/Asm/x86/7zCrcT8U.asm +0 -101
- data/ext/p7zip/C/7zCrcT8.c +0 -43
- data/ext/p7zip/C/Alloc.back3 +0 -238
- data/ext/p7zip/C/Alloc.c.back +0 -243
- data/ext/p7zip/C/Alloc.c.back2 +0 -222
- data/ext/p7zip/C/LzmaUtil/Lzma86Dec.h +0 -51
- data/ext/p7zip/CPP/7zip/Archive/7z/7zFolderOutStream.cpp +0 -149
- data/ext/p7zip/CPP/7zip/Archive/7z/7zFolderOutStream.h +0 -58
- data/ext/p7zip/CPP/7zip/Archive/Chm/ChmHeader.cpp +0 -24
- data/ext/p7zip/CPP/7zip/Archive/Chm/ChmHeader.h +0 -28
- data/ext/p7zip/CPP/7zip/Archive/Chm/ChmRegister.cpp +0 -13
- data/ext/p7zip/CPP/7zip/Archive/Com/ComHandler.cpp +0 -239
- data/ext/p7zip/CPP/7zip/Archive/Com/ComHandler.h +0 -28
- data/ext/p7zip/CPP/7zip/Archive/Com/ComIn.cpp +0 -389
- data/ext/p7zip/CPP/7zip/Archive/Com/ComIn.h +0 -119
- data/ext/p7zip/CPP/7zip/Archive/Com/ComRegister.cpp +0 -13
- data/ext/p7zip/CPP/7zip/Archive/Common/CoderMixer2MT.cpp +0 -240
- data/ext/p7zip/CPP/7zip/Archive/Common/CoderMixer2MT.h +0 -80
- data/ext/p7zip/CPP/7zip/Archive/Common/CoderMixer2ST.cpp +0 -239
- data/ext/p7zip/CPP/7zip/Archive/Common/CoderMixer2ST.h +0 -88
- data/ext/p7zip/CPP/7zip/Archive/Common/CrossThreadProgress.cpp +0 -15
- data/ext/p7zip/CPP/7zip/Archive/Common/CrossThreadProgress.h +0 -37
- data/ext/p7zip/CPP/7zip/Archive/DebHandler.cpp +0 -413
- data/ext/p7zip/CPP/7zip/Archive/Hfs/HfsHandler.cpp +0 -243
- data/ext/p7zip/CPP/7zip/Archive/Hfs/HfsHandler.h +0 -26
- data/ext/p7zip/CPP/7zip/Archive/Hfs/HfsIn.cpp +0 -480
- data/ext/p7zip/CPP/7zip/Archive/Hfs/HfsIn.h +0 -154
- data/ext/p7zip/CPP/7zip/Archive/Hfs/HfsRegister.cpp +0 -13
- data/ext/p7zip/CPP/7zip/Archive/Rar/RarHeader.cpp +0 -21
- data/ext/p7zip/CPP/7zip/Archive/Rar/RarIn.cpp +0 -478
- data/ext/p7zip/CPP/7zip/Archive/Rar/RarIn.h +0 -123
- data/ext/p7zip/CPP/7zip/Archive/Rar/RarItem.cpp +0 -55
- data/ext/p7zip/CPP/7zip/Archive/Rar/RarRegister.cpp +0 -13
- data/ext/p7zip/CPP/7zip/Archive/Rar/RarVolumeInStream.cpp +0 -78
- data/ext/p7zip/CPP/7zip/Archive/Rar/RarVolumeInStream.h +0 -49
- data/ext/p7zip/CPP/7zip/Archive/Udf/UdfRegister.cpp +0 -13
- data/ext/p7zip/CPP/7zip/Archive/Zip/ZipHeader.cpp +0 -36
- data/ext/p7zip/CPP/7zip/Archive/Zip/ZipItemEx.h +0 -34
- data/ext/p7zip/CPP/7zip/CMAKE/CMakeLists_7zFM.txt +0 -163
- data/ext/p7zip/CPP/7zip/CMAKE/CMakeLists_7zG.txt +0 -131
- data/ext/p7zip/CPP/7zip/CMAKE/CMakeLists_7za.txt +0 -253
- data/ext/p7zip/CPP/7zip/CMAKE/CMakeLists_ALL.txt +0 -32
- data/ext/p7zip/CPP/7zip/CMAKE/CMakeLists_Format7zFree.txt +0 -290
- data/ext/p7zip/CPP/7zip/CMAKE/generate.sh +0 -37
- data/ext/p7zip/CPP/7zip/CMAKE/generate_xcode.sh +0 -32
- data/ext/p7zip/CPP/7zip/Common/LockedStream.cpp +0 -23
- data/ext/p7zip/CPP/7zip/Common/LockedStream.h +0 -38
- data/ext/p7zip/CPP/7zip/Compress/ArjDecoder1.cpp +0 -309
- data/ext/p7zip/CPP/7zip/Compress/ArjDecoder1.h +0 -98
- data/ext/p7zip/CPP/7zip/Compress/ArjDecoder2.cpp +0 -90
- data/ext/p7zip/CPP/7zip/Compress/ArjDecoder2.h +0 -59
- data/ext/p7zip/CPP/7zip/Compress/BranchCoder.cpp +0 -19
- data/ext/p7zip/CPP/7zip/Compress/BranchCoder.h +0 -44
- data/ext/p7zip/CPP/7zip/Compress/DllExports.cpp +0 -39
- data/ext/p7zip/CPP/7zip/Compress/LZMA_Alone/LzmaAlone.cpp +0 -531
- data/ext/p7zip/CPP/7zip/Compress/LZMA_Alone/LzmaBench.cpp +0 -1018
- data/ext/p7zip/CPP/7zip/Compress/LZMA_Alone/LzmaBench.h +0 -48
- data/ext/p7zip/CPP/7zip/Compress/LZMA_Alone/LzmaBenchCon.cpp +0 -311
- data/ext/p7zip/CPP/7zip/Compress/LZMA_Alone/LzmaBenchCon.h +0 -20
- data/ext/p7zip/CPP/7zip/Compress/LZMA_Alone/makefile +0 -173
- data/ext/p7zip/CPP/7zip/Compress/Lzx86Converter.cpp +0 -90
- data/ext/p7zip/CPP/7zip/Compress/Lzx86Converter.h +0 -46
- data/ext/p7zip/CPP/7zip/Compress/RangeCoder.h +0 -205
- data/ext/p7zip/CPP/7zip/Compress/RangeCoderBit.h +0 -114
- data/ext/p7zip/CPP/7zip/Crypto/Sha1.cpp +0 -229
- data/ext/p7zip/CPP/7zip/Crypto/Sha1.h +0 -68
- data/ext/p7zip/CPP/7zip/PREMAKE/generate.sh +0 -18
- data/ext/p7zip/CPP/7zip/PREMAKE/premake4.lua +0 -263
- data/ext/p7zip/CPP/7zip/QMAKE/7ZA/7ZA.pro +0 -228
- data/ext/p7zip/CPP/7zip/QMAKE/7ZA/7ZA_osx.pro +0 -228
- data/ext/p7zip/CPP/7zip/QMAKE/test_emul/test_emul.pro +0 -26
- data/ext/p7zip/CPP/7zip/TEST/TestUI/TestUI.cpp +0 -560
- data/ext/p7zip/CPP/7zip/TEST/TestUI/makefile +0 -33
- data/ext/p7zip/CPP/7zip/TEST/TestUI/makefile.depend +0 -577
- data/ext/p7zip/CPP/7zip/TEST/TestUI/makefile.list +0 -16
- data/ext/p7zip/CPP/Common/Buffer.h +0 -77
- data/ext/p7zip/CPP/Common/Types.h +0 -11
- data/ext/p7zip/CPP/Windows/COM.cpp +0 -37
- data/ext/p7zip/CPP/Windows/COM.h +0 -69
- data/ext/p7zip/CPP/Windows/Clipboard.cpp +0 -160
- data/ext/p7zip/CPP/Windows/Clipboard.h +0 -28
- data/ext/p7zip/CPP/Windows/CommonDialog.h +0 -19
- data/ext/p7zip/CPP/Windows/Control/ComboBox.h +0 -82
- data/ext/p7zip/CPP/Windows/Control/Controls.cpp +0 -515
- data/ext/p7zip/CPP/Windows/Control/Dialog.cpp +0 -560
- data/ext/p7zip/CPP/Windows/Control/Dialog.h +0 -179
- data/ext/p7zip/CPP/Windows/Control/DialogImpl.h +0 -73
- data/ext/p7zip/CPP/Windows/Control/Edit.h +0 -24
- data/ext/p7zip/CPP/Windows/Control/ListView.h +0 -164
- data/ext/p7zip/CPP/Windows/Control/ProgressBar.h +0 -34
- data/ext/p7zip/CPP/Windows/Control/Static.h +0 -23
- data/ext/p7zip/CPP/Windows/Control/StatusBar.h +0 -56
- data/ext/p7zip/CPP/Windows/Control/Window2.cpp +0 -211
- data/ext/p7zip/CPP/Windows/Control/Window2.h +0 -111
- data/ext/p7zip/CPP/Windows/DLL.cpp +0 -193
- data/ext/p7zip/CPP/Windows/DLL.h +0 -48
- data/ext/p7zip/CPP/Windows/Error.cpp +0 -58
- data/ext/p7zip/CPP/Windows/Error.h +0 -33
- data/ext/p7zip/CPP/Windows/Menu.h +0 -4
- data/ext/p7zip/CPP/Windows/PropVariantConversions.cpp +0 -142
- data/ext/p7zip/CPP/Windows/PropVariantConversions.h +0 -14
- data/ext/p7zip/CPP/Windows/Registry.cpp +0 -313
- data/ext/p7zip/CPP/Windows/Registry.h +0 -113
- data/ext/p7zip/CPP/Windows/ResourceString.h +0 -22
- data/ext/p7zip/CPP/Windows/Shell.h +0 -21
- data/ext/p7zip/CPP/Windows/Time.cpp +0 -88
- data/ext/p7zip/CPP/Windows/Time.h +0 -21
- data/ext/p7zip/CPP/Windows/Window.cpp +0 -101
- data/ext/p7zip/CPP/Windows/Window.h +0 -43
- data/ext/p7zip/CPP/myWindows/initguid.h +0 -4
- data/ext/p7zip/CPP/myWindows/makefile +0 -21
- data/ext/p7zip/CPP/myWindows/makefile.depend +0 -32
- data/ext/p7zip/CPP/myWindows/makefile.list +0 -28
- data/ext/p7zip/CPP/myWindows/myAddExeFlag.cpp +0 -20
- data/ext/p7zip/CPP/myWindows/myGetTickCount.cpp +0 -8
- data/ext/p7zip/CPP/myWindows/mySplitCommandLine.cpp +0 -82
- data/ext/p7zip/CPP/myWindows/test_emul.cpp +0 -745
- data/ext/p7zip/CPP/myWindows/wine_GetXXXDefaultLangID.cpp +0 -741
- data/ext/p7zip/DOCS/MANUAL/switches/charset.htm +0 -49
- data/ext/p7zip/DOCS/Methods.txt +0 -152
- data/ext/p7zip/DOCS/lzma.txt +0 -598
- data/ext/p7zip/contrib/VirtualFileSystemForMidnightCommander/ChangeLog +0 -41
- data/ext/p7zip/contrib/VirtualFileSystemForMidnightCommander/readme +0 -21
- data/ext/p7zip/contrib/VirtualFileSystemForMidnightCommander/readme.u7z +0 -30
- data/ext/p7zip/contrib/VirtualFileSystemForMidnightCommander/u7z +0 -133
- data/ext/p7zip/contrib/gzip-like_CLI_wrapper_for_7z/README +0 -21
- data/ext/p7zip/contrib/gzip-like_CLI_wrapper_for_7z/check/check.sh +0 -117
- data/ext/p7zip/contrib/gzip-like_CLI_wrapper_for_7z/check/files.tar +0 -0
- data/ext/p7zip/contrib/gzip-like_CLI_wrapper_for_7z/man1/p7zip.1 +0 -33
- data/ext/p7zip/contrib/gzip-like_CLI_wrapper_for_7z/p7zip +0 -144
- data/ext/p7zip/contrib/qnx630sp3/qnx630sp3-shared +0 -14
- data/ext/p7zip/contrib/qnx630sp3/qnx630sp3-static +0 -10
- data/ext/p7zip/integration_context_menu.txt +0 -51
- data/ext/p7zip/makefile.rules +0 -661
- /data/ext/p7zip/{DOCS → DOC}/7zFormat.txt +0 -0
- /data/ext/p7zip/{DOCS → DOC}/unRarLicense.txt +0 -0
@@ -0,0 +1,1527 @@
|
|
1
|
+
// File: lzham_symbol_codec.cpp
|
2
|
+
// See Copyright Notice and license at the end of include/lzham.h
|
3
|
+
#include "lzham_core.h"
|
4
|
+
#include "lzham_symbol_codec.h"
|
5
|
+
#include "lzham_huffman_codes.h"
|
6
|
+
|
7
|
+
// Was 16 in previous versions.
|
8
|
+
#define LZHAM_DEFAULT_MAX_UPDATE_INTERVAL 64
|
9
|
+
|
10
|
+
// Was 40 in previous versions
|
11
|
+
// Keep in sync with default setting in g_table_update_settings[]
|
12
|
+
#define LZHAM_DEFAULT_ADAPT_RATE 64U
|
13
|
+
|
14
|
+
namespace lzham
|
15
|
+
{
|
16
|
+
// Using a fixed table to convert from scaled probability to scaled bits for determinism across compilers/run-time libs/platforms.
|
17
|
+
uint32 g_prob_cost[cSymbolCodecArithProbScale] =
|
18
|
+
{
|
19
|
+
0x0,0xB000000,0xA000000,0x96A3FE6,0x9000000,0x8AD961F,0x86A3FE6,0x8315130,0x8000000,0x7D47FCC,0x7AD961F,
|
20
|
+
0x78A62B0,0x76A3FE6,0x74CAFFC,0x7315130,0x717D605,0x7000000,0x6E99C09,0x6D47FCC,0x6C087D3,0x6AD961F,0x69B9116,
|
21
|
+
0x68A62B0,0x679F7D8,0x66A3FE6,0x65B2C3E,0x64CAFFC,0x63EBFB1,0x6315130,0x6245B5C,0x617D605,0x60BB9CA,0x6000000,
|
22
|
+
0x5F4A296,0x5E99C09,0x5DEE74F,0x5D47FCC,0x5CA6144,0x5C087D3,0x5B6EFE1,0x5AD961F,0x5A47779,0x59B9116,0x592E050,
|
23
|
+
0x58A62B0,0x58215EA,0x579F7D8,0x5720677,0x56A3FE6,0x562A260,0x55B2C3E,0x553DBEF,0x54CAFFC,0x545A701,0x53EBFB1,
|
24
|
+
0x537F8CF,0x5315130,0x52AC7B8,0x5245B5C,0x51E0B1B,0x517D605,0x511BB33,0x50BB9CA,0x505D0FC,0x5000000,0x4FA461A,
|
25
|
+
0x4F4A296,0x4EF14C7,0x4E99C09,0x4E437BE,0x4DEE74F,0x4D9AA2C,0x4D47FCC,0x4CF67A8,0x4CA6144,0x4C56C23,0x4C087D3,
|
26
|
+
0x4BBB3E1,0x4B6EFE1,0x4B23B6D,0x4AD961F,0x4A8FF97,0x4A47779,0x49FFD6A,0x49B9116,0x4973228,0x492E050,0x48E9B41,
|
27
|
+
0x48A62B0,0x4863655,0x48215EA,0x47E012C,0x479F7D8,0x475F9B0,0x4720677,0x46E1DF1,0x46A3FE6,0x4666C1D,0x462A260,
|
28
|
+
0x45EE27C,0x45B2C3E,0x4577F74,0x453DBEF,0x4504180,0x44CAFFC,0x4492735,0x445A701,0x4422F38,0x43EBFB1,0x43B5846,
|
29
|
+
0x437F8CF,0x434A129,0x4315130,0x42E08C0,0x42AC7B8,0x4278DF7,0x4245B5C,0x4212FC7,0x41E0B1B,0x41AED39,0x417D605,
|
30
|
+
0x414C561,0x411BB33,0x40EB75F,0x40BB9CA,0x408C25C,0x405D0FC,0x402E58F,0x4000000,0x3FD2036,0x3FA461A,0x3F77197,
|
31
|
+
0x3F4A296,0x3F1D903,0x3EF14C7,0x3EC55D0,0x3E99C09,0x3E6E75F,0x3E437BE,0x3E18D14,0x3DEE74F,0x3DC465D,0x3D9AA2C,
|
32
|
+
0x3D712AC,0x3D47FCC,0x3D1F17A,0x3CF67A8,0x3CCE246,0x3CA6144,0x3C7E492,0x3C56C23,0x3C2F7E8,0x3C087D3,0x3BE1BD5,
|
33
|
+
0x3BBB3E1,0x3B94FE9,0x3B6EFE1,0x3B493BC,0x3B23B6D,0x3AFE6E7,0x3AD961F,0x3AB4908,0x3A8FF97,0x3A6B9C0,0x3A47779,
|
34
|
+
0x3A238B5,0x39FFD6A,0x39DC58E,0x39B9116,0x3995FF7,0x3973228,0x395079E,0x392E050,0x390BC34,0x38E9B41,0x38C7D6E,
|
35
|
+
0x38A62B0,0x3884B01,0x3863655,0x38424A6,0x38215EA,0x3800A1A,0x37E012C,0x37BFB18,0x379F7D8,0x377F762,0x375F9B0,
|
36
|
+
0x373FEBA,0x3720677,0x37010E1,0x36E1DF1,0x36C2DA0,0x36A3FE6,0x36854BC,0x3666C1D,0x3648600,0x362A260,0x360C136,
|
37
|
+
0x35EE27C,0x35D062B,0x35B2C3E,0x35954AD,0x3577F74,0x355AC8C,0x353DBEF,0x3520D98,0x3504180,0x34E77A4,0x34CAFFC,
|
38
|
+
0x34AEA83,0x3492735,0x347660B,0x345A701,0x343EA12,0x3422F38,0x340766F,0x33EBFB1,0x33D0AFA,0x33B5846,0x339A78E,
|
39
|
+
0x337F8CF,0x3364C05,0x334A129,0x332F839,0x3315130,0x32FAC09,0x32E08C0,0x32C6751,0x32AC7B8,0x32929F1,0x3278DF7,
|
40
|
+
0x325F3C6,0x3245B5C,0x322C4B2,0x3212FC7,0x31F9C96,0x31E0B1B,0x31C7B53,0x31AED39,0x31960CB,0x317D605,0x3164CE2,
|
41
|
+
0x314C561,0x3133F7D,0x311BB33,0x310387F,0x30EB75F,0x30D37CE,0x30BB9CA,0x30A3D50,0x308C25C,0x30748EC,0x305D0FC,
|
42
|
+
0x3045A88,0x302E58F,0x301720E,0x3000000,0x2FE8F64,0x2FD2036,0x2FBB274,0x2FA461A,0x2F8DB27,0x2F77197,0x2F60968,
|
43
|
+
0x2F4A296,0x2F33D20,0x2F1D903,0x2F0763B,0x2EF14C7,0x2EDB4A5,0x2EC55D0,0x2EAF848,0x2E99C09,0x2E84111,0x2E6E75F,
|
44
|
+
0x2E58EEE,0x2E437BE,0x2E2E1CB,0x2E18D14,0x2E03996,0x2DEE74F,0x2DD963D,0x2DC465D,0x2DAF7AD,0x2D9AA2C,0x2D85DD7,
|
45
|
+
0x2D712AC,0x2D5C8A9,0x2D47FCC,0x2D33812,0x2D1F17A,0x2D0AC02,0x2CF67A8,0x2CE246A,0x2CCE246,0x2CBA13A,0x2CA6144,
|
46
|
+
0x2C92262,0x2C7E492,0x2C6A7D4,0x2C56C23,0x2C43180,0x2C2F7E8,0x2C1BF5A,0x2C087D3,0x2BF5151,0x2BE1BD5,0x2BCE75A,
|
47
|
+
0x2BBB3E1,0x2BA8166,0x2B94FE9,0x2B81F68,0x2B6EFE1,0x2B5C153,0x2B493BC,0x2B3671A,0x2B23B6D,0x2B110B1,0x2AFE6E7,
|
48
|
+
0x2AEBE0C,0x2AD961F,0x2AC6F1E,0x2AB4908,0x2AA23DC,0x2A8FF97,0x2A7DC39,0x2A6B9C0,0x2A5982B,0x2A47779,0x2A357A7,
|
49
|
+
0x2A238B5,0x2A11AA1,0x29FFD6A,0x29EE10F,0x29DC58E,0x29CAAE6,0x29B9116,0x29A781C,0x2995FF7,0x29848A6,0x2973228,
|
50
|
+
0x2961C7B,0x295079E,0x293F390,0x292E050,0x291CDDD,0x290BC34,0x28FAB56,0x28E9B41,0x28D8BF4,0x28C7D6E,0x28B6FAD,
|
51
|
+
0x28A62B0,0x2895677,0x2884B01,0x287404B,0x2863655,0x2852D1F,0x28424A6,0x2831CEA,0x28215EA,0x2810FA5,0x2800A1A,
|
52
|
+
0x27F0547,0x27E012C,0x27CFDC7,0x27BFB18,0x27AF91E,0x279F7D8,0x278F744,0x277F762,0x276F831,0x275F9B0,0x274FBDE,
|
53
|
+
0x273FEBA,0x2730242,0x2720677,0x2710B57,0x27010E1,0x26F1715,0x26E1DF1,0x26D2575,0x26C2DA0,0x26B3670,0x26A3FE6,
|
54
|
+
0x26949FF,0x26854BC,0x267601C,0x2666C1D,0x26578BE,0x2648600,0x26393E1,0x262A260,0x261B17D,0x260C136,0x25FD18C,
|
55
|
+
0x25EE27C,0x25DF407,0x25D062B,0x25C18E8,0x25B2C3E,0x25A402A,0x25954AD,0x25869C6,0x2577F74,0x25695B6,0x255AC8C,
|
56
|
+
0x254C3F4,0x253DBEF,0x252F47B,0x2520D98,0x2512744,0x2504180,0x24F5C4B,0x24E77A4,0x24D9389,0x24CAFFC,0x24BCCFA,
|
57
|
+
0x24AEA83,0x24A0897,0x2492735,0x248465C,0x247660B,0x2468643,0x245A701,0x244C847,0x243EA12,0x2430C63,0x2422F38,
|
58
|
+
0x2415292,0x240766F,0x23F9ACF,0x23EBFB1,0x23DE515,0x23D0AFA,0x23C3160,0x23B5846,0x23A7FAB,0x239A78E,0x238CFF0,
|
59
|
+
0x237F8CF,0x237222C,0x2364C05,0x2357659,0x234A129,0x233CC74,0x232F839,0x2322478,0x2315130,0x2307E61,0x22FAC09,
|
60
|
+
0x22EDA29,0x22E08C0,0x22D37CE,0x22C6751,0x22B974A,0x22AC7B8,0x229F89B,0x22929F1,0x2285BBA,0x2278DF7,0x226C0A6,
|
61
|
+
0x225F3C6,0x2252758,0x2245B5C,0x2238FCF,0x222C4B2,0x221FA05,0x2212FC7,0x22065F7,0x21F9C96,0x21ED3A2,0x21E0B1B,
|
62
|
+
0x21D4301,0x21C7B53,0x21BB410,0x21AED39,0x21A26CD,0x21960CB,0x2189B33,0x217D605,0x217113F,0x2164CE2,0x21588EE,
|
63
|
+
0x214C561,0x214023B,0x2133F7D,0x2127D25,0x211BB33,0x210F9A6,0x210387F,0x20F77BD,0x20EB75F,0x20DF765,0x20D37CE,
|
64
|
+
0x20C789B,0x20BB9CA,0x20AFB5C,0x20A3D50,0x2097FA6,0x208C25C,0x2080574,0x20748EC,0x2068CC4,0x205D0FC,0x2051593,
|
65
|
+
0x2045A88,0x2039FDD,0x202E58F,0x2022BA0,0x201720E,0x200B8D8,0x2000000,0x1FF4784,0x1FE8F64,0x1FDD79F,0x1FD2036,
|
66
|
+
0x1FC6928,0x1FBB274,0x1FAFC1A,0x1FA461A,0x1F99074,0x1F8DB27,0x1F82633,0x1F77197,0x1F6BD53,0x1F60968,0x1F555D3,
|
67
|
+
0x1F4A296,0x1F3EFB0,0x1F33D20,0x1F28AE6,0x1F1D903,0x1F12774,0x1F0763B,0x1EFC557,0x1EF14C7,0x1EE648C,0x1EDB4A5,
|
68
|
+
0x1ED0511,0x1EC55D0,0x1EBA6E3,0x1EAF848,0x1EA49FF,0x1E99C09,0x1E8EE64,0x1E84111,0x1E79410,0x1E6E75F,0x1E63AFE,
|
69
|
+
0x1E58EEE,0x1E4E32E,0x1E437BE,0x1E38C9D,0x1E2E1CB,0x1E23748,0x1E18D14,0x1E0E32E,0x1E03996,0x1DF904C,0x1DEE74F,
|
70
|
+
0x1DE3E9F,0x1DD963D,0x1DCEE27,0x1DC465D,0x1DB9EDF,0x1DAF7AD,0x1DA50C7,0x1D9AA2C,0x1D903DC,0x1D85DD7,0x1D7B81C,
|
71
|
+
0x1D712AC,0x1D66D86,0x1D5C8A9,0x1D52416,0x1D47FCC,0x1D3DBCA,0x1D33812,0x1D294A2,0x1D1F17A,0x1D14E9B,0x1D0AC02,
|
72
|
+
0x1D009B2,0x1CF67A8,0x1CEC5E6,0x1CE246A,0x1CD8335,0x1CCE246,0x1CC419D,0x1CBA13A,0x1CB011C,0x1CA6144,0x1C9C1B0,
|
73
|
+
0x1C92262,0x1C88358,0x1C7E492,0x1C74611,0x1C6A7D4,0x1C609DA,0x1C56C23,0x1C4CEB0,0x1C43180,0x1C39493,0x1C2F7E8,
|
74
|
+
0x1C25B80,0x1C1BF5A,0x1C12375,0x1C087D3,0x1BFEC71,0x1BF5151,0x1BEB673,0x1BE1BD5,0x1BD8177,0x1BCE75A,0x1BC4D7D,
|
75
|
+
0x1BBB3E1,0x1BB1A84,0x1BA8166,0x1B9E888,0x1B94FE9,0x1B8B789,0x1B81F68,0x1B78786,0x1B6EFE1,0x1B6587B,0x1B5C153,
|
76
|
+
0x1B52A69,0x1B493BC,0x1B3FD4D,0x1B3671A,0x1B2D125,0x1B23B6D,0x1B1A5F1,0x1B110B1,0x1B07BAE,0x1AFE6E7,0x1AF525C,
|
77
|
+
0x1AEBE0C,0x1AE29F8,0x1AD961F,0x1AD0281,0x1AC6F1E,0x1ABDBF6,0x1AB4908,0x1AAB655,0x1AA23DC,0x1A9919C,0x1A8FF97,
|
78
|
+
0x1A86DCB,0x1A7DC39,0x1A74AE0,0x1A6B9C0,0x1A628DA,0x1A5982B,0x1A507B6,0x1A47779,0x1A3E774,0x1A357A7,0x1A2C812,
|
79
|
+
0x1A238B5,0x1A1A98F,0x1A11AA1,0x1A08BEA,0x19FFD6A,0x19F6F21,0x19EE10F,0x19E5333,0x19DC58E,0x19D381F,0x19CAAE6,
|
80
|
+
0x19C1DE3,0x19B9116,0x19B047E,0x19A781C,0x199EBEF,0x1995FF7,0x198D434,0x19848A6,0x197BD4D,0x1973228,0x196A737,
|
81
|
+
0x1961C7B,0x19591F3,0x195079E,0x1947D7D,0x193F390,0x19369D7,0x192E050,0x19256FD,0x191CDDD,0x19144EF,0x190BC34,
|
82
|
+
0x19033AC,0x18FAB56,0x18F2333,0x18E9B41,0x18E1382,0x18D8BF4,0x18D0498,0x18C7D6E,0x18BF675,0x18B6FAD,0x18AE916,
|
83
|
+
0x18A62B0,0x189DC7C,0x1895677,0x188D0A4,0x1884B01,0x187C58E,0x187404B,0x186BB38,0x1863655,0x185B1A2,0x1852D1F,
|
84
|
+
0x184A8CB,0x18424A6,0x183A0B1,0x1831CEA,0x1829953,0x18215EA,0x18192B0,0x1810FA5,0x1808CC8,0x1800A1A,0x17F8799,
|
85
|
+
0x17F0547,0x17E8322,0x17E012C,0x17D7F63,0x17CFDC7,0x17C7C59,0x17BFB18,0x17B7A05,0x17AF91E,0x17A7865,0x179F7D8,
|
86
|
+
0x1797778,0x178F744,0x178773D,0x177F762,0x17777B4,0x176F831,0x17678DB,0x175F9B0,0x1757AB1,0x174FBDE,0x1747D36,
|
87
|
+
0x173FEBA,0x1738068,0x1730242,0x1728447,0x1720677,0x17188D2,0x1710B57,0x1708E07,0x17010E1,0x16F93E6,0x16F1715,
|
88
|
+
0x16E9A6E,0x16E1DF1,0x16DA19E,0x16D2575,0x16CA976,0x16C2DA0,0x16BB1F3,0x16B3670,0x16ABB16,0x16A3FE6,0x169C4DE,
|
89
|
+
0x16949FF,0x168CF49,0x16854BC,0x167DA58,0x167601C,0x166E608,0x1666C1D,0x165F25A,0x16578BE,0x164FF4B,0x1648600,
|
90
|
+
0x1640CDD,0x16393E1,0x1631B0D,0x162A260,0x16229DB,0x161B17D,0x1613946,0x160C136,0x160494D,0x15FD18C,0x15F59F0,
|
91
|
+
0x15EE27C,0x15E6B2E,0x15DF407,0x15D7D06,0x15D062B,0x15C8F77,0x15C18E8,0x15BA280,0x15B2C3E,0x15AB621,0x15A402A,
|
92
|
+
0x159CA59,0x15954AD,0x158DF27,0x15869C6,0x157F48A,0x1577F74,0x1570A82,0x15695B6,0x156210E,0x155AC8C,0x155382E,
|
93
|
+
0x154C3F4,0x1544FDF,0x153DBEF,0x1536823,0x152F47B,0x15280F7,0x1520D98,0x1519A5C,0x1512744,0x150B450,0x1504180,
|
94
|
+
0x14FCED4,0x14F5C4B,0x14EE9E6,0x14E77A4,0x14E0585,0x14D9389,0x14D21B1,0x14CAFFC,0x14C3E69,0x14BCCFA,0x14B5BAD,
|
95
|
+
0x14AEA83,0x14A797C,0x14A0897,0x14997D5,0x1492735,0x148B6B7,0x148465C,0x147D622,0x147660B,0x146F616,0x1468643,
|
96
|
+
0x1461691,0x145A701,0x1453793,0x144C847,0x144591C,0x143EA12,0x1437B2A,0x1430C63,0x1429DBD,0x1422F38,0x141C0D5,
|
97
|
+
0x1415292,0x140E470,0x140766F,0x140088F,0x13F9ACF,0x13F2D30,0x13EBFB1,0x13E5253,0x13DE515,0x13D77F8,0x13D0AFA,
|
98
|
+
0x13C9E1D,0x13C3160,0x13BC4C3,0x13B5846,0x13AEBE8,0x13A7FAB,0x13A138D,0x139A78E,0x1393BAF,0x138CFF0,0x1386450,
|
99
|
+
0x137F8CF,0x1378D6E,0x137222C,0x136B709,0x1364C05,0x135E11F,0x1357659,0x1350BB2,0x134A129,0x13436C0,0x133CC74,
|
100
|
+
0x1336248,0x132F839,0x1328E4A,0x1322478,0x131BAC5,0x1315130,0x130E7B9,0x1307E61,0x1301526,0x12FAC09,0x12F430A,
|
101
|
+
0x12EDA29,0x12E7166,0x12E08C0,0x12DA038,0x12D37CE,0x12CCF81,0x12C6751,0x12BFF3F,0x12B974A,0x12B2F73,0x12AC7B8,
|
102
|
+
0x12A601B,0x129F89B,0x1299137,0x12929F1,0x128C2C7,0x1285BBA,0x127F4CA,0x1278DF7,0x1272740,0x126C0A6,0x1265A28,
|
103
|
+
0x125F3C6,0x1258D81,0x1252758,0x124C14C,0x1245B5C,0x123F587,0x1238FCF,0x1232A33,0x122C4B2,0x1225F4E,0x121FA05,
|
104
|
+
0x12194D8,0x1212FC7,0x120CAD1,0x12065F7,0x1200139,0x11F9C96,0x11F380E,0x11ED3A2,0x11E6F51,0x11E0B1B,0x11DA700,
|
105
|
+
0x11D4301,0x11CDF1C,0x11C7B53,0x11C17A4,0x11BB410,0x11B5097,0x11AED39,0x11A89F6,0x11A26CD,0x119C3BF,0x11960CB,
|
106
|
+
0x118FDF2,0x1189B33,0x118388F,0x117D605,0x1177395,0x117113F,0x116AF04,0x1164CE2,0x115EADB,0x11588EE,0x115271A,
|
107
|
+
0x114C561,0x11463C1,0x114023B,0x113A0CF,0x1133F7D,0x112DE44,0x1127D25,0x1121C1F,0x111BB33,0x1115A60,0x110F9A6,
|
108
|
+
0x1109906,0x110387F,0x10FD811,0x10F77BD,0x10F1781,0x10EB75F,0x10E5755,0x10DF765,0x10D978D,0x10D37CE,0x10CD828,
|
109
|
+
0x10C789B,0x10C1926,0x10BB9CA,0x10B5A87,0x10AFB5C,0x10A9C4A,0x10A3D50,0x109DE6F,0x1097FA6,0x10920F5,0x108C25C,
|
110
|
+
0x10863DC,0x1080574,0x107A724,0x10748EC,0x106EACC,0x1068CC4,0x1062ED4,0x105D0FC,0x105733B,0x1051593,0x104B802,
|
111
|
+
0x1045A88,0x103FD27,0x1039FDD,0x10342AA,0x102E58F,0x102888C,0x1022BA0,0x101CECB,0x101720E,0x1011567,0x100B8D8,
|
112
|
+
0x1005C61,0x1000000,0xFFA3B6,0xFF4784,0xFEEB68,0xFE8F64,0xFE3376,0xFDD79F,0xFD7BDF,0xFD2036,0xFCC4A3,
|
113
|
+
0xFC6928,0xFC0DC2,0xFBB274,0xFB573C,0xFAFC1A,0xFAA10F,0xFA461A,0xF9EB3C,0xF99074,0xF935C2,0xF8DB27,
|
114
|
+
0xF880A2,0xF82633,0xF7CBDA,0xF77197,0xF7176A,0xF6BD53,0xF66353,0xF60968,0xF5AF93,0xF555D3,0xF4FC2A,
|
115
|
+
0xF4A296,0xF44918,0xF3EFB0,0xF3965D,0xF33D20,0xF2E3F9,0xF28AE6,0xF231EA,0xF1D903,0xF18031,0xF12774,
|
116
|
+
0xF0CECD,0xF0763B,0xF01DBF,0xEFC557,0xEF6D05,0xEF14C7,0xEEBC9F,0xEE648C,0xEE0C8E,0xEDB4A5,0xED5CD0,
|
117
|
+
0xED0511,0xECAD66,0xEC55D0,0xEBFE4F,0xEBA6E3,0xEB4F8B,0xEAF848,0xEAA119,0xEA49FF,0xE9F2FA,0xE99C09,
|
118
|
+
0xE9452D,0xE8EE64,0xE897B1,0xE84111,0xE7EA86,0xE79410,0xE73DAD,0xE6E75F,0xE69124,0xE63AFE,0xE5E4EC,
|
119
|
+
0xE58EEE,0xE53904,0xE4E32E,0xE48D6C,0xE437BE,0xE3E223,0xE38C9D,0xE3372A,0xE2E1CB,0xE28C80,0xE23748,
|
120
|
+
0xE1E224,0xE18D14,0xE13817,0xE0E32E,0xE08E58,0xE03996,0xDFE4E7,0xDF904C,0xDF3BC4,0xDEE74F,0xDE92ED,
|
121
|
+
0xDE3E9F,0xDDEA64,0xDD963D,0xDD4228,0xDCEE27,0xDC9A38,0xDC465D,0xDBF295,0xDB9EDF,0xDB4B3D,0xDAF7AD,
|
122
|
+
0xDAA431,0xDA50C7,0xD9FD70,0xD9AA2C,0xD956FB,0xD903DC,0xD8B0D0,0xD85DD7,0xD80AF1,0xD7B81C,0xD7655B,
|
123
|
+
0xD712AC,0xD6C010,0xD66D86,0xD61B0E,0xD5C8A9,0xD57656,0xD52416,0xD4D1E7,0xD47FCC,0xD42DC2,0xD3DBCA,
|
124
|
+
0xD389E5,0xD33812,0xD2E651,0xD294A2,0xD24305,0xD1F17A,0xD1A001,0xD14E9B,0xD0FD46,0xD0AC02,0xD05AD1,
|
125
|
+
0xD009B2,0xCFB8A4,0xCF67A8,0xCF16BE,0xCEC5E6,0xCE751F,0xCE246A,0xCDD3C7,0xCD8335,0xCD32B5,0xCCE246,
|
126
|
+
0xCC91E9,0xCC419D,0xCBF163,0xCBA13A,0xCB5122,0xCB011C,0xCAB127,0xCA6144,0xCA1171,0xC9C1B0,0xC97200,
|
127
|
+
0xC92262,0xC8D2D4,0xC88358,0xC833ED,0xC7E492,0xC79549,0xC74611,0xC6F6EA,0xC6A7D4,0xC658CE,0xC609DA,
|
128
|
+
0xC5BAF6,0xC56C23,0xC51D61,0xC4CEB0,0xC48010,0xC43180,0xC3E301,0xC39493,0xC34635,0xC2F7E8,0xC2A9AC,
|
129
|
+
0xC25B80,0xC20D64,0xC1BF5A,0xC1715F,0xC12375,0xC0D59C,0xC087D3,0xC03A1A,0xBFEC71,0xBF9ED9,0xBF5151,
|
130
|
+
0xBF03DA,0xBEB673,0xBE691B,0xBE1BD5,0xBDCE9E,0xBD8177,0xBD3461,0xBCE75A,0xBC9A64,0xBC4D7D,0xBC00A7,
|
131
|
+
0xBBB3E1,0xBB672A,0xBB1A84,0xBACDED,0xBA8166,0xBA34EF,0xB9E888,0xB99C31,0xB94FE9,0xB903B1,0xB8B789,
|
132
|
+
0xB86B71,0xB81F68,0xB7D36F,0xB78786,0xB73BAC,0xB6EFE1,0xB6A427,0xB6587B,0xB60CDF,0xB5C153,0xB575D6,
|
133
|
+
0xB52A69,0xB4DF0B,0xB493BC,0xB4487D,0xB3FD4D,0xB3B22C,0xB3671A,0xB31C18,0xB2D125,0xB28641,0xB23B6D,
|
134
|
+
0xB1F0A7,0xB1A5F1,0xB15B4A,0xB110B1,0xB0C628,0xB07BAE,0xB03143,0xAFE6E7,0xAF9C9A,0xAF525C,0xAF082C,
|
135
|
+
0xAEBE0C,0xAE73FA,0xAE29F8,0xADE004,0xAD961F,0xAD4C49,0xAD0281,0xACB8C8,0xAC6F1E,0xAC2583,0xABDBF6,
|
136
|
+
0xAB9278,0xAB4908,0xAAFFA7,0xAAB655,0xAA6D11,0xAA23DC,0xA9DAB5,0xA9919C,0xA94893,0xA8FF97,0xA8B6AA,
|
137
|
+
0xA86DCB,0xA824FB,0xA7DC39,0xA79386,0xA74AE0,0xA70249,0xA6B9C0,0xA67146,0xA628DA,0xA5E07B,0xA5982B,
|
138
|
+
0xA54FEA,0xA507B6,0xA4BF90,0xA47779,0xA42F6F,0xA3E774,0xA39F87,0xA357A7,0xA30FD6,0xA2C812,0xA2805D,
|
139
|
+
0xA238B5,0xA1F11B,0xA1A98F,0xA16211,0xA11AA1,0xA0D33F,0xA08BEA,0xA044A4,0x9FFD6A,0x9FB63F,0x9F6F21,
|
140
|
+
0x9F2811,0x9EE10F,0x9E9A1B,0x9E5333,0x9E0C5A,0x9DC58E,0x9D7ED0,0x9D381F,0x9CF17C,0x9CAAE6,0x9C645E,
|
141
|
+
0x9C1DE3,0x9BD776,0x9B9116,0x9B4AC3,0x9B047E,0x9ABE46,0x9A781C,0x9A31FF,0x99EBEF,0x99A5EC,0x995FF7,
|
142
|
+
0x991A0F,0x98D434,0x988E67,0x9848A6,0x9802F3,0x97BD4D,0x9777B4,0x973228,0x96ECA9,0x96A737,0x9661D3,
|
143
|
+
0x961C7B,0x95D730,0x9591F3,0x954CC2,0x95079E,0x94C287,0x947D7D,0x943880,0x93F390,0x93AEAD,0x9369D7,
|
144
|
+
0x93250D,0x92E050,0x929BA0,0x9256FD,0x921266,0x91CDDD,0x91895F,0x9144EF,0x91008B,0x90BC34,0x9077EA,
|
145
|
+
0x9033AC,0x8FEF7B,0x8FAB56,0x8F673E,0x8F2333,0x8EDF34,0x8E9B41,0x8E575B,0x8E1382,0x8DCFB5,0x8D8BF4,
|
146
|
+
0x8D4840,0x8D0498,0x8CC0FD,0x8C7D6E,0x8C39EB,0x8BF675,0x8BB30B,0x8B6FAD,0x8B2C5B,0x8AE916,0x8AA5DD,
|
147
|
+
0x8A62B0,0x8A1F90,0x89DC7C,0x899973,0x895677,0x891388,0x88D0A4,0x888DCC,0x884B01,0x880841,0x87C58E,
|
148
|
+
0x8782E6,0x87404B,0x86FDBC,0x86BB38,0x8678C1,0x863655,0x85F3F6,0x85B1A2,0x856F5B,0x852D1F,0x84EAEF,
|
149
|
+
0x84A8CB,0x8466B3,0x8424A6,0x83E2A6,0x83A0B1,0x835EC8,0x831CEA,0x82DB19,0x829953,0x825799,0x8215EA,
|
150
|
+
0x81D448,0x8192B0,0x815125,0x810FA5,0x80CE31,0x808CC8,0x804B6B,0x800A1A,0x7FC8D4,0x7F8799,0x7F466A,
|
151
|
+
0x7F0547,0x7EC42F,0x7E8322,0x7E4221,0x7E012C,0x7DC041,0x7D7F63,0x7D3E8F,0x7CFDC7,0x7CBD0B,0x7C7C59,
|
152
|
+
0x7C3BB3,0x7BFB18,0x7BBA89,0x7B7A05,0x7B398C,0x7AF91E,0x7AB8BC,0x7A7865,0x7A3819,0x79F7D8,0x79B7A2,
|
153
|
+
0x797778,0x793759,0x78F744,0x78B73B,0x78773D,0x78374A,0x77F762,0x77B786,0x7777B4,0x7737ED,0x76F831,
|
154
|
+
0x76B881,0x7678DB,0x763940,0x75F9B0,0x75BA2B,0x757AB1,0x753B42,0x74FBDE,0x74BC84,0x747D36,0x743DF2,
|
155
|
+
0x73FEBA,0x73BF8C,0x738068,0x734150,0x730242,0x72C33F,0x728447,0x72455A,0x720677,0x71C79F,0x7188D2,
|
156
|
+
0x714A0F,0x710B57,0x70CCAA,0x708E07,0x704F6F,0x7010E1,0x6FD25E,0x6F93E6,0x6F5578,0x6F1715,0x6ED8BC,
|
157
|
+
0x6E9A6E,0x6E5C2B,0x6E1DF1,0x6DDFC3,0x6DA19E,0x6D6385,0x6D2575,0x6CE770,0x6CA976,0x6C6B86,0x6C2DA0,
|
158
|
+
0x6BEFC4,0x6BB1F3,0x6B742D,0x6B3670,0x6AF8BE,0x6ABB16,0x6A7D79,0x6A3FE6,0x6A025D,0x69C4DE,0x69876A,
|
159
|
+
0x6949FF,0x690C9F,0x68CF49,0x6891FE,0x6854BC,0x681785,0x67DA58,0x679D35,0x67601C,0x67230D,0x66E608,
|
160
|
+
0x66A90D,0x666C1D,0x662F36,0x65F25A,0x65B587,0x6578BE,0x653C00,0x64FF4B,0x64C2A1,0x648600,0x644969,
|
161
|
+
0x640CDD,0x63D05A,0x6393E1,0x635772,0x631B0D,0x62DEB2,0x62A260,0x626619,0x6229DB,0x61EDA7,0x61B17D,
|
162
|
+
0x61755D,0x613946,0x60FD39,0x60C136,0x60853D,0x60494D,0x600D68,0x5FD18C,0x5F95B9,0x5F59F0,0x5F1E31,
|
163
|
+
0x5EE27C,0x5EA6D0,0x5E6B2E,0x5E2F96,0x5DF407,0x5DB882,0x5D7D06,0x5D4194,0x5D062B,0x5CCACC,0x5C8F77,
|
164
|
+
0x5C542B,0x5C18E8,0x5BDDAF,0x5BA280,0x5B675A,0x5B2C3E,0x5AF12B,0x5AB621,0x5A7B21,0x5A402A,0x5A053D,
|
165
|
+
0x59CA59,0x598F7E,0x5954AD,0x5919E5,0x58DF27,0x58A472,0x5869C6,0x582F23,0x57F48A,0x57B9FA,0x577F74,
|
166
|
+
0x5744F6,0x570A82,0x56D018,0x5695B6,0x565B5E,0x56210E,0x55E6C8,0x55AC8C,0x557258,0x55382E,0x54FE0C,
|
167
|
+
0x54C3F4,0x5489E5,0x544FDF,0x5415E2,0x53DBEF,0x53A204,0x536823,0x532E4A,0x52F47B,0x52BAB5,0x5280F7,
|
168
|
+
0x524743,0x520D98,0x51D3F5,0x519A5C,0x5160CC,0x512744,0x50EDC6,0x50B450,0x507AE4,0x504180,0x500826,
|
169
|
+
0x4FCED4,0x4F958B,0x4F5C4B,0x4F2314,0x4EE9E6,0x4EB0C0,0x4E77A4,0x4E3E90,0x4E0585,0x4DCC83,0x4D9389,
|
170
|
+
0x4D5A99,0x4D21B1,0x4CE8D2,0x4CAFFC,0x4C772E,0x4C3E69,0x4C05AD,0x4BCCFA,0x4B944F,0x4B5BAD,0x4B2314,
|
171
|
+
0x4AEA83,0x4AB1FB,0x4A797C,0x4A4105,0x4A0897,0x49D031,0x4997D5,0x495F80,0x492735,0x48EEF2,0x48B6B7,
|
172
|
+
0x487E85,0x48465C,0x480E3B,0x47D622,0x479E13,0x47660B,0x472E0C,0x46F616,0x46BE28,0x468643,0x464E66,
|
173
|
+
0x461691,0x45DEC5,0x45A701,0x456F46,0x453793,0x44FFE9,0x44C847,0x4490AD,0x44591C,0x442193,0x43EA12,
|
174
|
+
0x43B29A,0x437B2A,0x4343C2,0x430C63,0x42D50C,0x429DBD,0x426676,0x422F38,0x41F802,0x41C0D5,0x4189AF,
|
175
|
+
0x415292,0x411B7D,0x40E470,0x40AD6B,0x40766F,0x403F7B,0x40088F,0x3FD1AB,0x3F9ACF,0x3F63FB,0x3F2D30,
|
176
|
+
0x3EF66D,0x3EBFB1,0x3E88FE,0x3E5253,0x3E1BB0,0x3DE515,0x3DAE83,0x3D77F8,0x3D4175,0x3D0AFA,0x3CD488,
|
177
|
+
0x3C9E1D,0x3C67BB,0x3C3160,0x3BFB0E,0x3BC4C3,0x3B8E80,0x3B5846,0x3B2213,0x3AEBE8,0x3AB5C5,0x3A7FAB,
|
178
|
+
0x3A4998,0x3A138D,0x39DD89,0x39A78E,0x39719B,0x393BAF,0x3905CC,0x38CFF0,0x389A1C,0x386450,0x382E8C,
|
179
|
+
0x37F8CF,0x37C31B,0x378D6E,0x3757C9,0x37222C,0x36EC96,0x36B709,0x368183,0x364C05,0x36168E,0x35E11F,
|
180
|
+
0x35ABB9,0x357659,0x354102,0x350BB2,0x34D66A,0x34A129,0x346BF1,0x3436C0,0x340196,0x33CC74,0x33975A,
|
181
|
+
0x336248,0x332D3D,0x32F839,0x32C33E,0x328E4A,0x32595D,0x322478,0x31EF9B,0x31BAC5,0x3185F7,0x315130,
|
182
|
+
0x311C71,0x30E7B9,0x30B309,0x307E61,0x3049C0,0x301526,0x2FE094,0x2FAC09,0x2F7786,0x2F430A,0x2F0E96,
|
183
|
+
0x2EDA29,0x2EA5C4,0x2E7166,0x2E3D0F,0x2E08C0,0x2DD479,0x2DA038,0x2D6BFF,0x2D37CE,0x2D03A4,0x2CCF81,
|
184
|
+
0x2C9B66,0x2C6751,0x2C3345,0x2BFF3F,0x2BCB41,0x2B974A,0x2B635B,0x2B2F73,0x2AFB92,0x2AC7B8,0x2A93E6,
|
185
|
+
0x2A601B,0x2A2C57,0x29F89B,0x29C4E5,0x299137,0x295D90,0x2929F1,0x28F658,0x28C2C7,0x288F3D,0x285BBA,
|
186
|
+
0x28283F,0x27F4CA,0x27C15D,0x278DF7,0x275A98,0x272740,0x26F3EF,0x26C0A6,0x268D63,0x265A28,0x2626F4,
|
187
|
+
0x25F3C6,0x25C0A0,0x258D81,0x255A69,0x252758,0x24F44F,0x24C14C,0x248E50,0x245B5C,0x24286E,0x23F587,
|
188
|
+
0x23C2A8,0x238FCF,0x235CFD,0x232A33,0x22F76F,0x22C4B2,0x2291FD,0x225F4E,0x222CA6,0x21FA05,0x21C76B,
|
189
|
+
0x2194D8,0x21624C,0x212FC7,0x20FD49,0x20CAD1,0x209861,0x2065F7,0x203395,0x200139,0x1FCEE4,0x1F9C96,
|
190
|
+
0x1F6A4F,0x1F380E,0x1F05D5,0x1ED3A2,0x1EA176,0x1E6F51,0x1E3D32,0x1E0B1B,0x1DD90A,0x1DA700,0x1D74FD,
|
191
|
+
0x1D4301,0x1D110B,0x1CDF1C,0x1CAD34,0x1C7B53,0x1C4978,0x1C17A4,0x1BE5D7,0x1BB410,0x1B8250,0x1B5097,
|
192
|
+
0x1B1EE5,0x1AED39,0x1ABB94,0x1A89F6,0x1A585E,0x1A26CD,0x19F542,0x19C3BF,0x199241,0x1960CB,0x192F5B,
|
193
|
+
0x18FDF2,0x18CC8F,0x189B33,0x1869DE,0x18388F,0x180746,0x17D605,0x17A4C9,0x177395,0x174267,0x17113F,
|
194
|
+
0x16E01E,0x16AF04,0x167DF0,0x164CE2,0x161BDC,0x15EADB,0x15B9E1,0x1588EE,0x155801,0x15271A,0x14F63A,
|
195
|
+
0x14C561,0x14948E,0x1463C1,0x1432FB,0x14023B,0x13D182,0x13A0CF,0x137023,0x133F7D,0x130EDD,0x12DE44,
|
196
|
+
0x12ADB1,0x127D25,0x124C9F,0x121C1F,0x11EBA6,0x11BB33,0x118AC6,0x115A60,0x112A00,0x10F9A6,0x10C953,
|
197
|
+
0x109906,0x1068BF,0x10387F,0x100845,0xFD811,0xFA7E4,0xF77BD,0xF479C,0xF1781,0xEE76D,0xEB75F,
|
198
|
+
0xE8757,0xE5755,0xE275A,0xDF765,0xDC776,0xD978D,0xD67AA,0xD37CE,0xD07F8,0xCD828,0xCA85E,
|
199
|
+
0xC789B,0xC48DD,0xC1926,0xBE975,0xBB9CA,0xB8A26,0xB5A87,0xB2AEF,0xAFB5C,0xACBD0,0xA9C4A,
|
200
|
+
0xA6CCA,0xA3D50,0xA0DDC,0x9DE6F,0x9AF07,0x97FA6,0x9504A,0x920F5,0x8F1A6,0x8C25C,0x89319,
|
201
|
+
0x863DC,0x834A5,0x80574,0x7D649,0x7A724,0x77805,0x748EC,0x719D9,0x6EACC,0x6BBC5,0x68CC4,
|
202
|
+
0x65DC9,0x62ED4,0x5FFE5,0x5D0FC,0x5A218,0x5733B,0x54464,0x51593,0x4E6C7,0x4B802,0x48942,
|
203
|
+
0x45A88,0x42BD5,0x3FD27,0x3CE7F,0x39FDD,0x37141,0x342AA,0x3141A,0x2E58F,0x2B70B,0x2888C,
|
204
|
+
0x25A13,0x22BA0,0x1FD33,0x1CECB,0x1A069,0x1720E,0x143B8,0x11567,0xE71D,0xB8D8,0x8A9A,
|
205
|
+
0x5C61,0x2E2D
|
206
|
+
};
|
207
|
+
|
208
|
+
#define LZHAM_CREATE_PROB_COST_TABLE 0
|
209
|
+
|
210
|
+
#if LZHAM_CREATE_PROB_COST_TABLE
|
211
|
+
class arith_prob_cost_initializer
|
212
|
+
{
|
213
|
+
public:
|
214
|
+
arith_prob_cost_initializer()
|
215
|
+
{
|
216
|
+
const double cInvLn2 = 1.4426950408889634073599246810019; // 1.0/ln(2)
|
217
|
+
|
218
|
+
for (uint i = 0; i < cSymbolCodecArithProbScale; i++)
|
219
|
+
{
|
220
|
+
double flBits = i ? (-log(i * (1.0 / cSymbolCodecArithProbScale)) * cInvLn2) : 0;
|
221
|
+
g_prob_cost[i] = static_cast<uint32>(floor(.5f + flBits * cBitCostScale));
|
222
|
+
printf("0x%X,", g_prob_cost[i]);
|
223
|
+
if ((i % 11) == 10) printf("\n");
|
224
|
+
}
|
225
|
+
printf("\n");
|
226
|
+
}
|
227
|
+
};
|
228
|
+
static arith_prob_cost_initializer g_prob_cost_initializer;
|
229
|
+
#endif
|
230
|
+
|
231
|
+
quasi_adaptive_huffman_data_model::quasi_adaptive_huffman_data_model(lzham_malloc_context malloc_context, bool encoding, uint total_syms, uint max_update_interval, uint adapt_rate) :
|
232
|
+
m_malloc_context(malloc_context),
|
233
|
+
m_initial_sym_freq(malloc_context),
|
234
|
+
m_sym_freq(malloc_context),
|
235
|
+
m_codes(malloc_context),
|
236
|
+
m_code_sizes(malloc_context),
|
237
|
+
m_pDecode_tables(NULL),
|
238
|
+
m_total_syms(0),
|
239
|
+
m_max_cycle(0),
|
240
|
+
m_update_cycle(0),
|
241
|
+
m_symbols_until_update(0),
|
242
|
+
m_total_count(0),
|
243
|
+
m_decoder_table_bits(0),
|
244
|
+
m_max_update_interval(static_cast<uint16>(max_update_interval)),
|
245
|
+
m_adapt_rate(static_cast<uint16>(adapt_rate)),
|
246
|
+
m_encoding(encoding)
|
247
|
+
{
|
248
|
+
if (total_syms)
|
249
|
+
{
|
250
|
+
init2(malloc_context, encoding, total_syms, max_update_interval, adapt_rate, NULL);
|
251
|
+
}
|
252
|
+
}
|
253
|
+
|
254
|
+
quasi_adaptive_huffman_data_model::quasi_adaptive_huffman_data_model(const quasi_adaptive_huffman_data_model& other) :
|
255
|
+
m_malloc_context(other.m_malloc_context),
|
256
|
+
m_initial_sym_freq(other.m_malloc_context),
|
257
|
+
m_sym_freq(other.m_malloc_context),
|
258
|
+
m_codes(other.m_malloc_context),
|
259
|
+
m_code_sizes(other.m_malloc_context),
|
260
|
+
m_pDecode_tables(NULL),
|
261
|
+
m_total_syms(0),
|
262
|
+
m_max_cycle(0),
|
263
|
+
m_update_cycle(0),
|
264
|
+
m_symbols_until_update(0),
|
265
|
+
m_total_count(0),
|
266
|
+
m_decoder_table_bits(0),
|
267
|
+
m_max_update_interval(0),
|
268
|
+
m_adapt_rate(0),
|
269
|
+
m_encoding(false)
|
270
|
+
{
|
271
|
+
*this = other;
|
272
|
+
}
|
273
|
+
|
274
|
+
quasi_adaptive_huffman_data_model::~quasi_adaptive_huffman_data_model()
|
275
|
+
{
|
276
|
+
if (m_pDecode_tables)
|
277
|
+
lzham_delete(m_malloc_context, m_pDecode_tables);
|
278
|
+
}
|
279
|
+
|
280
|
+
bool quasi_adaptive_huffman_data_model::assign(const quasi_adaptive_huffman_data_model& rhs)
|
281
|
+
{
|
282
|
+
if (this == &rhs)
|
283
|
+
return true;
|
284
|
+
|
285
|
+
if (m_malloc_context != rhs.m_malloc_context)
|
286
|
+
{
|
287
|
+
clear();
|
288
|
+
|
289
|
+
m_malloc_context = rhs.m_malloc_context;
|
290
|
+
|
291
|
+
m_initial_sym_freq.set_malloc_context(m_malloc_context);
|
292
|
+
m_sym_freq.set_malloc_context(m_malloc_context);
|
293
|
+
m_codes.set_malloc_context(m_malloc_context);
|
294
|
+
m_code_sizes.set_malloc_context(m_malloc_context);
|
295
|
+
}
|
296
|
+
|
297
|
+
m_total_syms = rhs.m_total_syms;
|
298
|
+
|
299
|
+
m_max_cycle = rhs.m_max_cycle;
|
300
|
+
m_update_cycle = rhs.m_update_cycle;
|
301
|
+
m_symbols_until_update = rhs.m_symbols_until_update;
|
302
|
+
|
303
|
+
m_total_count = rhs.m_total_count;
|
304
|
+
|
305
|
+
m_sym_freq = rhs.m_sym_freq;
|
306
|
+
m_initial_sym_freq = rhs.m_initial_sym_freq;
|
307
|
+
|
308
|
+
m_codes = rhs.m_codes;
|
309
|
+
m_code_sizes = rhs.m_code_sizes;
|
310
|
+
|
311
|
+
if (rhs.m_pDecode_tables)
|
312
|
+
{
|
313
|
+
if (m_pDecode_tables)
|
314
|
+
{
|
315
|
+
if (!m_pDecode_tables->assign(*rhs.m_pDecode_tables))
|
316
|
+
{
|
317
|
+
clear();
|
318
|
+
return false;
|
319
|
+
}
|
320
|
+
}
|
321
|
+
else
|
322
|
+
{
|
323
|
+
m_pDecode_tables = lzham_new<prefix_coding::decoder_tables>(m_malloc_context, *rhs.m_pDecode_tables);
|
324
|
+
if (!m_pDecode_tables)
|
325
|
+
{
|
326
|
+
clear();
|
327
|
+
LZHAM_LOG_ERROR(4000);
|
328
|
+
return false;
|
329
|
+
}
|
330
|
+
}
|
331
|
+
}
|
332
|
+
else if (m_pDecode_tables)
|
333
|
+
{
|
334
|
+
lzham_delete(m_malloc_context, m_pDecode_tables);
|
335
|
+
m_pDecode_tables = NULL;
|
336
|
+
}
|
337
|
+
|
338
|
+
m_decoder_table_bits = rhs.m_decoder_table_bits;
|
339
|
+
m_encoding = rhs.m_encoding;
|
340
|
+
m_max_update_interval = rhs.m_max_update_interval;
|
341
|
+
m_adapt_rate = rhs.m_adapt_rate;
|
342
|
+
|
343
|
+
return true;
|
344
|
+
}
|
345
|
+
|
346
|
+
quasi_adaptive_huffman_data_model& quasi_adaptive_huffman_data_model::operator= (const quasi_adaptive_huffman_data_model& rhs)
|
347
|
+
{
|
348
|
+
assign(rhs);
|
349
|
+
return *this;
|
350
|
+
}
|
351
|
+
|
352
|
+
void quasi_adaptive_huffman_data_model::clear()
|
353
|
+
{
|
354
|
+
m_sym_freq.clear();
|
355
|
+
m_initial_sym_freq.clear();
|
356
|
+
m_codes.clear();
|
357
|
+
m_code_sizes.clear();
|
358
|
+
|
359
|
+
m_max_cycle = 0;
|
360
|
+
m_total_syms = 0;
|
361
|
+
m_update_cycle = 0;
|
362
|
+
m_symbols_until_update = 0;
|
363
|
+
m_decoder_table_bits = 0;
|
364
|
+
m_total_count = 0;
|
365
|
+
|
366
|
+
if (m_pDecode_tables)
|
367
|
+
{
|
368
|
+
lzham_delete(m_malloc_context, m_pDecode_tables);
|
369
|
+
m_pDecode_tables = NULL;
|
370
|
+
}
|
371
|
+
|
372
|
+
m_max_update_interval = 0;
|
373
|
+
m_adapt_rate = 0;
|
374
|
+
}
|
375
|
+
|
376
|
+
bool quasi_adaptive_huffman_data_model::init2(lzham_malloc_context malloc_context, bool encoding, uint total_syms, uint max_update_interval, uint adapt_rate, const uint16 *pInitial_sym_freq)
|
377
|
+
{
|
378
|
+
LZHAM_ASSERT(max_update_interval <= 0xFFFF);
|
379
|
+
LZHAM_ASSERT(adapt_rate <= 0xFFFF);
|
380
|
+
|
381
|
+
if (malloc_context != m_malloc_context)
|
382
|
+
{
|
383
|
+
clear();
|
384
|
+
|
385
|
+
m_malloc_context = malloc_context;
|
386
|
+
|
387
|
+
m_initial_sym_freq.set_malloc_context(m_malloc_context);
|
388
|
+
m_sym_freq.set_malloc_context(m_malloc_context);
|
389
|
+
m_codes.set_malloc_context(m_malloc_context);
|
390
|
+
m_code_sizes.set_malloc_context(m_malloc_context);
|
391
|
+
}
|
392
|
+
|
393
|
+
m_encoding = encoding;
|
394
|
+
m_max_update_interval = static_cast<uint16>(max_update_interval);
|
395
|
+
m_adapt_rate = static_cast<uint16>(adapt_rate);
|
396
|
+
m_symbols_until_update = 0;
|
397
|
+
|
398
|
+
if (!m_sym_freq.try_resize(total_syms))
|
399
|
+
{
|
400
|
+
clear();
|
401
|
+
LZHAM_LOG_ERROR(4001);
|
402
|
+
return false;
|
403
|
+
}
|
404
|
+
|
405
|
+
if (pInitial_sym_freq)
|
406
|
+
{
|
407
|
+
if (!m_initial_sym_freq.try_resize(total_syms))
|
408
|
+
{
|
409
|
+
clear();
|
410
|
+
LZHAM_LOG_ERROR(4002);
|
411
|
+
return false;
|
412
|
+
}
|
413
|
+
memcpy(m_initial_sym_freq.begin(), pInitial_sym_freq, total_syms * m_initial_sym_freq.size_in_bytes());
|
414
|
+
}
|
415
|
+
|
416
|
+
if (!m_code_sizes.try_resize(total_syms))
|
417
|
+
{
|
418
|
+
clear();
|
419
|
+
LZHAM_LOG_ERROR(4003);
|
420
|
+
return false;
|
421
|
+
}
|
422
|
+
|
423
|
+
m_total_syms = total_syms;
|
424
|
+
|
425
|
+
uint max_table_bits = 0;
|
426
|
+
|
427
|
+
if (m_total_syms <= 8)
|
428
|
+
max_table_bits = 4;
|
429
|
+
else
|
430
|
+
max_table_bits = 1 + math::ceil_log2i(m_total_syms);
|
431
|
+
|
432
|
+
m_decoder_table_bits = static_cast<uint8>(math::minimum(max_table_bits, prefix_coding::cMaxTableBits));
|
433
|
+
|
434
|
+
if (m_encoding)
|
435
|
+
{
|
436
|
+
lzham_delete(m_malloc_context, m_pDecode_tables);
|
437
|
+
m_pDecode_tables = NULL;
|
438
|
+
|
439
|
+
if (!m_codes.try_resize(total_syms))
|
440
|
+
{
|
441
|
+
clear();
|
442
|
+
LZHAM_LOG_ERROR(4004);
|
443
|
+
return false;
|
444
|
+
}
|
445
|
+
}
|
446
|
+
else if (!m_pDecode_tables)
|
447
|
+
{
|
448
|
+
m_pDecode_tables = lzham_new<prefix_coding::decoder_tables>(m_malloc_context, m_malloc_context);
|
449
|
+
if (!m_pDecode_tables)
|
450
|
+
{
|
451
|
+
clear();
|
452
|
+
LZHAM_LOG_ERROR(4005);
|
453
|
+
return false;
|
454
|
+
}
|
455
|
+
}
|
456
|
+
|
457
|
+
m_max_cycle = (LZHAM_MAX(24, m_total_syms) + 6) * (m_max_update_interval ? m_max_update_interval : LZHAM_DEFAULT_MAX_UPDATE_INTERVAL);
|
458
|
+
|
459
|
+
m_max_cycle = LZHAM_MIN(m_max_cycle, 32767);
|
460
|
+
|
461
|
+
reset();
|
462
|
+
|
463
|
+
return true;
|
464
|
+
}
|
465
|
+
|
466
|
+
bool quasi_adaptive_huffman_data_model::reset()
|
467
|
+
{
|
468
|
+
if (!m_total_syms)
|
469
|
+
return true;
|
470
|
+
|
471
|
+
bool sym_freq_all_ones = false;
|
472
|
+
|
473
|
+
if (m_initial_sym_freq.size())
|
474
|
+
{
|
475
|
+
m_update_cycle = 0;
|
476
|
+
for (uint i = 0; i < m_total_syms; i++)
|
477
|
+
{
|
478
|
+
uint sym_freq = m_initial_sym_freq[i];
|
479
|
+
m_sym_freq[i] = static_cast<uint16>(sym_freq);
|
480
|
+
|
481
|
+
// Slam m_update_cycle to a specific value so update_tables() sets m_total_count to the proper value
|
482
|
+
m_update_cycle += sym_freq;
|
483
|
+
}
|
484
|
+
}
|
485
|
+
else
|
486
|
+
{
|
487
|
+
#if LZHAM_LITTLE_ENDIAN_CPU
|
488
|
+
// &m_sym_freq[0] should be aligned to at least 8 bytes due to LZHAM_MIN_ALLOC_ALIGNMENT
|
489
|
+
uint64 x = 0x0001000100010001ULL;
|
490
|
+
x = (x << 32U) | x;
|
491
|
+
|
492
|
+
uint64 *p = reinterpret_cast<uint64 *>(&m_sym_freq[0]);
|
493
|
+
|
494
|
+
for (uint64 *q = p + ((m_total_syms >> 3) * 2); p != q; p += 2)
|
495
|
+
{
|
496
|
+
p[0] = x;
|
497
|
+
p[1] = x;
|
498
|
+
}
|
499
|
+
|
500
|
+
uint16 *r = reinterpret_cast<uint16 *>(p);
|
501
|
+
for (uint i = (m_total_syms & 7); i; --i)
|
502
|
+
*r++ = 1;
|
503
|
+
|
504
|
+
#ifdef LZHAM_BUILD_DEBUG
|
505
|
+
for (uint i = 0; i < m_total_syms; i++)
|
506
|
+
{
|
507
|
+
LZHAM_ASSERT(m_sym_freq[i] == 1);
|
508
|
+
}
|
509
|
+
#endif
|
510
|
+
|
511
|
+
#else
|
512
|
+
for (uint i = 0; i < m_total_syms; i++)
|
513
|
+
m_sym_freq[i] = 1;
|
514
|
+
#endif
|
515
|
+
|
516
|
+
// Slam m_update_cycle to a specific value so update_tables() sets m_total_count to the proper value
|
517
|
+
m_update_cycle = m_total_syms;
|
518
|
+
|
519
|
+
sym_freq_all_ones = true;
|
520
|
+
}
|
521
|
+
|
522
|
+
m_total_count = 0;
|
523
|
+
m_symbols_until_update = 0;
|
524
|
+
|
525
|
+
if (!update_tables(LZHAM_MIN(m_max_cycle, 16), sym_freq_all_ones)) // this was 8 in the alphas
|
526
|
+
{
|
527
|
+
LZHAM_LOG_ERROR(4006);
|
528
|
+
return false;
|
529
|
+
}
|
530
|
+
|
531
|
+
return true;
|
532
|
+
}
|
533
|
+
|
534
|
+
void quasi_adaptive_huffman_data_model::rescale()
|
535
|
+
{
|
536
|
+
uint total_freq = 0;
|
537
|
+
|
538
|
+
for (uint i = 0; i < m_total_syms; i++)
|
539
|
+
{
|
540
|
+
uint freq = (m_sym_freq[i] + 1) >> 1;
|
541
|
+
total_freq += freq;
|
542
|
+
m_sym_freq[i] = static_cast<uint16>(freq);
|
543
|
+
}
|
544
|
+
|
545
|
+
m_total_count = total_freq;
|
546
|
+
}
|
547
|
+
|
548
|
+
void quasi_adaptive_huffman_data_model::reset_update_rate()
|
549
|
+
{
|
550
|
+
m_total_count += (m_update_cycle - m_symbols_until_update);
|
551
|
+
|
552
|
+
#ifdef LZHAM_BUILD_DEBUG
|
553
|
+
uint actual_total = 0;
|
554
|
+
for (uint i = 0; i < m_sym_freq.size(); i++)
|
555
|
+
actual_total += m_sym_freq[i];
|
556
|
+
LZHAM_ASSERT(actual_total == m_total_count);
|
557
|
+
#endif
|
558
|
+
|
559
|
+
if (m_total_count > m_total_syms)
|
560
|
+
rescale();
|
561
|
+
|
562
|
+
m_symbols_until_update = m_update_cycle = LZHAM_MIN(8, m_update_cycle);
|
563
|
+
}
|
564
|
+
|
565
|
+
bool quasi_adaptive_huffman_data_model::update_tables(int force_update_cycle, bool sym_freq_all_ones)
|
566
|
+
{
|
567
|
+
LZHAM_ASSERT(!m_symbols_until_update);
|
568
|
+
m_total_count += m_update_cycle;
|
569
|
+
LZHAM_ASSERT(m_total_count <= 65535);
|
570
|
+
|
571
|
+
while (m_total_count >= 32768)
|
572
|
+
rescale();
|
573
|
+
|
574
|
+
uint max_code_size = 0;
|
575
|
+
|
576
|
+
code_size_histogram code_size_hist;
|
577
|
+
code_size_hist.clear();
|
578
|
+
|
579
|
+
if ((sym_freq_all_ones) && (m_total_syms >= 2))
|
580
|
+
{
|
581
|
+
// Shortcut building the Huffman codes if we know all the sym freqs are 1.
|
582
|
+
uint base_code_size = math::floor_log2i(m_total_syms);
|
583
|
+
uint num_left = m_total_syms - (1 << base_code_size);
|
584
|
+
num_left *= 2;
|
585
|
+
if (num_left > m_total_syms)
|
586
|
+
num_left = m_total_syms;
|
587
|
+
|
588
|
+
memset(&m_code_sizes[0], base_code_size + 1, num_left);
|
589
|
+
memset(&m_code_sizes[num_left], base_code_size, m_total_syms - num_left);
|
590
|
+
|
591
|
+
code_size_hist.init(base_code_size, m_total_syms - num_left, base_code_size + 1, num_left);
|
592
|
+
|
593
|
+
max_code_size = base_code_size + (num_left ? 1 : 0);
|
594
|
+
}
|
595
|
+
|
596
|
+
bool status = false;
|
597
|
+
if (!max_code_size)
|
598
|
+
{
|
599
|
+
uint table_size = get_generate_huffman_codes_table_size();
|
600
|
+
void *pTables = alloca(table_size);
|
601
|
+
|
602
|
+
uint total_freq = 0;
|
603
|
+
status = generate_huffman_codes(pTables, m_total_syms, &m_sym_freq[0], &m_code_sizes[0], max_code_size, total_freq, code_size_hist);
|
604
|
+
LZHAM_ASSERT(status);
|
605
|
+
LZHAM_ASSERT(total_freq == m_total_count);
|
606
|
+
if ((!status) || (total_freq != m_total_count))
|
607
|
+
{
|
608
|
+
LZHAM_LOG_ERROR(4007);
|
609
|
+
return false;
|
610
|
+
}
|
611
|
+
|
612
|
+
if (max_code_size > cMaxExpectedHuffCodeSize)
|
613
|
+
{
|
614
|
+
status = prefix_coding::limit_max_code_size(m_total_syms, &m_code_sizes[0], cMaxExpectedHuffCodeSize);
|
615
|
+
LZHAM_ASSERT(status);
|
616
|
+
if (!status)
|
617
|
+
{
|
618
|
+
LZHAM_LOG_ERROR(4008);
|
619
|
+
return false;
|
620
|
+
}
|
621
|
+
|
622
|
+
code_size_hist.clear();
|
623
|
+
code_size_hist.init(m_total_syms, &m_code_sizes[0]);
|
624
|
+
|
625
|
+
for (max_code_size = cMaxExpectedHuffCodeSize; max_code_size >= 1; max_code_size--)
|
626
|
+
if (code_size_hist.m_num_codes[max_code_size])
|
627
|
+
break;
|
628
|
+
}
|
629
|
+
}
|
630
|
+
|
631
|
+
#ifdef LZHAM_BUILD_DEBUG
|
632
|
+
{
|
633
|
+
uint check_max_code_size = 0;
|
634
|
+
uint check_total_syms[cMaxExpectedHuffCodeSize + 1];
|
635
|
+
utils::zero_object(check_total_syms);
|
636
|
+
for (uint i = 0; i < m_total_syms; i++)
|
637
|
+
{
|
638
|
+
uint code_size = m_code_sizes[i];
|
639
|
+
check_max_code_size = math::maximum(check_max_code_size, code_size);
|
640
|
+
check_total_syms[code_size]++;
|
641
|
+
}
|
642
|
+
LZHAM_ASSERT(max_code_size == check_max_code_size);
|
643
|
+
for (uint i = 0; i < (cMaxExpectedHuffCodeSize + 1); i++)
|
644
|
+
{
|
645
|
+
LZHAM_ASSERT(code_size_hist.m_num_codes[i] == check_total_syms[i]);
|
646
|
+
}
|
647
|
+
}
|
648
|
+
#endif
|
649
|
+
|
650
|
+
if (force_update_cycle >= 0)
|
651
|
+
m_symbols_until_update = m_update_cycle = force_update_cycle;
|
652
|
+
else
|
653
|
+
{
|
654
|
+
m_update_cycle = (31U + m_update_cycle * LZHAM_MAX(32U, (m_adapt_rate ? m_adapt_rate : LZHAM_DEFAULT_ADAPT_RATE))) >> 5U;
|
655
|
+
|
656
|
+
if (m_update_cycle > m_max_cycle)
|
657
|
+
m_update_cycle = m_max_cycle;
|
658
|
+
|
659
|
+
m_symbols_until_update = m_update_cycle;
|
660
|
+
}
|
661
|
+
|
662
|
+
if (m_encoding)
|
663
|
+
status = prefix_coding::generate_codes(m_total_syms, &m_code_sizes[0], &m_codes[0]);
|
664
|
+
else
|
665
|
+
{
|
666
|
+
uint actual_table_bits = m_decoder_table_bits;
|
667
|
+
|
668
|
+
// Try to see if using the accel table is actually worth the trouble of constructing it.
|
669
|
+
uint cost_to_use_table = (1 << actual_table_bits) + 64;
|
670
|
+
uint cost_to_not_use_table = m_symbols_until_update * math::floor_log2i(m_total_syms);
|
671
|
+
if (cost_to_not_use_table <= cost_to_use_table)
|
672
|
+
actual_table_bits = 0;
|
673
|
+
|
674
|
+
status = prefix_coding::generate_decoder_tables(m_total_syms, &m_code_sizes[0], m_pDecode_tables, actual_table_bits, code_size_hist, sym_freq_all_ones);
|
675
|
+
}
|
676
|
+
|
677
|
+
LZHAM_ASSERT(status);
|
678
|
+
if (!status)
|
679
|
+
{
|
680
|
+
LZHAM_LOG_ERROR(4009);
|
681
|
+
return false;
|
682
|
+
}
|
683
|
+
|
684
|
+
return true;
|
685
|
+
}
|
686
|
+
|
687
|
+
bool quasi_adaptive_huffman_data_model::update_sym(uint sym)
|
688
|
+
{
|
689
|
+
uint freq = m_sym_freq[sym];
|
690
|
+
freq++;
|
691
|
+
m_sym_freq[sym] = static_cast<uint16>(freq);
|
692
|
+
|
693
|
+
LZHAM_ASSERT(freq <= cUINT16_MAX);
|
694
|
+
|
695
|
+
if (--m_symbols_until_update == 0)
|
696
|
+
{
|
697
|
+
if (!update_tables())
|
698
|
+
{
|
699
|
+
LZHAM_LOG_ERROR(4010);
|
700
|
+
return false;
|
701
|
+
}
|
702
|
+
}
|
703
|
+
|
704
|
+
return true;
|
705
|
+
}
|
706
|
+
|
707
|
+
adaptive_bit_model::adaptive_bit_model(float prob0)
|
708
|
+
{
|
709
|
+
set_probability_0(prob0);
|
710
|
+
}
|
711
|
+
|
712
|
+
adaptive_bit_model::adaptive_bit_model(const adaptive_bit_model& other) :
|
713
|
+
m_bit_0_prob(other.m_bit_0_prob)
|
714
|
+
{
|
715
|
+
}
|
716
|
+
|
717
|
+
void adaptive_bit_model::set_probability_0(float prob0)
|
718
|
+
{
|
719
|
+
m_bit_0_prob = static_cast<uint16>(math::clamp<uint>((uint)(prob0 * cSymbolCodecArithProbScale), 1, cSymbolCodecArithProbScale - 1));
|
720
|
+
}
|
721
|
+
|
722
|
+
symbol_codec::symbol_codec(lzham_malloc_context malloc_context) :
|
723
|
+
m_malloc_context(malloc_context),
|
724
|
+
m_output_buf(malloc_context),
|
725
|
+
m_arith_output_buf(malloc_context),
|
726
|
+
m_output_syms(malloc_context)
|
727
|
+
{
|
728
|
+
clear();
|
729
|
+
}
|
730
|
+
|
731
|
+
void symbol_codec::reset()
|
732
|
+
{
|
733
|
+
m_pDecode_buf = NULL;
|
734
|
+
m_pDecode_buf_next = NULL;
|
735
|
+
m_pDecode_buf_end = NULL;
|
736
|
+
m_decode_buf_size = 0;
|
737
|
+
|
738
|
+
m_bit_buf = 0;
|
739
|
+
m_bit_count = 0;
|
740
|
+
m_total_model_updates = 0;
|
741
|
+
m_mode = cNull;
|
742
|
+
m_total_bits_written = 0;
|
743
|
+
|
744
|
+
m_arith_base = 0;
|
745
|
+
m_arith_value = 0;
|
746
|
+
m_arith_length = 0;
|
747
|
+
m_arith_total_bits = 0;
|
748
|
+
|
749
|
+
m_output_buf.try_resize(0);
|
750
|
+
m_arith_output_buf.try_resize(0);
|
751
|
+
m_output_syms.try_resize(0);
|
752
|
+
|
753
|
+
m_pDecode_need_bytes_func = NULL;
|
754
|
+
m_pDecode_private_data = NULL;
|
755
|
+
m_pSaved_huff_model = NULL;
|
756
|
+
m_pSaved_model = NULL;
|
757
|
+
m_saved_node_index = 0;
|
758
|
+
}
|
759
|
+
|
760
|
+
void symbol_codec::clear()
|
761
|
+
{
|
762
|
+
reset();
|
763
|
+
|
764
|
+
m_output_buf.clear();
|
765
|
+
m_arith_output_buf.clear();
|
766
|
+
m_output_syms.clear();
|
767
|
+
}
|
768
|
+
|
769
|
+
bool symbol_codec::start_encoding(uint expected_file_size)
|
770
|
+
{
|
771
|
+
m_mode = cEncoding;
|
772
|
+
|
773
|
+
m_total_model_updates = 0;
|
774
|
+
m_total_bits_written = 0;
|
775
|
+
|
776
|
+
if (!put_bits_init(expected_file_size))
|
777
|
+
return false;
|
778
|
+
|
779
|
+
m_output_syms.try_resize(0);
|
780
|
+
|
781
|
+
arith_start_encoding();
|
782
|
+
|
783
|
+
return true;
|
784
|
+
}
|
785
|
+
|
786
|
+
bool symbol_codec::encode_bits(uint bits, uint num_bits)
|
787
|
+
{
|
788
|
+
LZHAM_ASSERT(m_mode == cEncoding);
|
789
|
+
|
790
|
+
if (!num_bits)
|
791
|
+
return true;
|
792
|
+
|
793
|
+
LZHAM_ASSERT((num_bits == 32) || (bits <= ((1U << num_bits) - 1)));
|
794
|
+
|
795
|
+
if (num_bits > 16)
|
796
|
+
{
|
797
|
+
if (!record_put_bits(bits >> 16, num_bits - 16))
|
798
|
+
{
|
799
|
+
LZHAM_LOG_ERROR(4011);
|
800
|
+
return false;
|
801
|
+
}
|
802
|
+
if (!record_put_bits(bits & 0xFFFF, 16))
|
803
|
+
{
|
804
|
+
LZHAM_LOG_ERROR(4012);
|
805
|
+
return false;
|
806
|
+
}
|
807
|
+
}
|
808
|
+
else
|
809
|
+
{
|
810
|
+
if (!record_put_bits(bits, num_bits))
|
811
|
+
{
|
812
|
+
LZHAM_LOG_ERROR(4013);
|
813
|
+
return false;
|
814
|
+
}
|
815
|
+
}
|
816
|
+
return true;
|
817
|
+
}
|
818
|
+
|
819
|
+
bool symbol_codec::encode_arith_init()
|
820
|
+
{
|
821
|
+
LZHAM_ASSERT(m_mode == cEncoding);
|
822
|
+
|
823
|
+
output_symbol sym;
|
824
|
+
sym.m_bits = 0;
|
825
|
+
sym.m_num_bits = output_symbol::cArithInit;
|
826
|
+
sym.m_arith_prob0 = 0;
|
827
|
+
if (!m_output_syms.try_push_back(sym))
|
828
|
+
{
|
829
|
+
LZHAM_LOG_ERROR(4014);
|
830
|
+
return false;
|
831
|
+
}
|
832
|
+
|
833
|
+
return true;
|
834
|
+
}
|
835
|
+
|
836
|
+
bool symbol_codec::encode_align_to_byte()
|
837
|
+
{
|
838
|
+
LZHAM_ASSERT(m_mode == cEncoding);
|
839
|
+
|
840
|
+
output_symbol sym;
|
841
|
+
sym.m_bits = 0;
|
842
|
+
sym.m_num_bits = output_symbol::cAlignToByteSym;
|
843
|
+
sym.m_arith_prob0 = 0;
|
844
|
+
if (!m_output_syms.try_push_back(sym))
|
845
|
+
{
|
846
|
+
LZHAM_LOG_ERROR(4015);
|
847
|
+
return false;
|
848
|
+
}
|
849
|
+
|
850
|
+
return true;
|
851
|
+
}
|
852
|
+
|
853
|
+
bool symbol_codec::encode(uint sym, quasi_adaptive_huffman_data_model& model)
|
854
|
+
{
|
855
|
+
LZHAM_ASSERT(m_mode == cEncoding);
|
856
|
+
LZHAM_ASSERT(model.m_encoding);
|
857
|
+
|
858
|
+
if (!record_put_bits(model.m_codes[sym], model.m_code_sizes[sym]))
|
859
|
+
{
|
860
|
+
LZHAM_LOG_ERROR(4016);
|
861
|
+
return false;
|
862
|
+
}
|
863
|
+
|
864
|
+
uint freq = model.m_sym_freq[sym];
|
865
|
+
freq++;
|
866
|
+
model.m_sym_freq[sym] = static_cast<uint16>(freq);
|
867
|
+
|
868
|
+
LZHAM_ASSERT(freq <= cUINT16_MAX);
|
869
|
+
|
870
|
+
if (--model.m_symbols_until_update == 0)
|
871
|
+
{
|
872
|
+
m_total_model_updates++;
|
873
|
+
if (!model.update_tables())
|
874
|
+
{
|
875
|
+
LZHAM_LOG_ERROR(4018);
|
876
|
+
return false;
|
877
|
+
}
|
878
|
+
}
|
879
|
+
return true;
|
880
|
+
}
|
881
|
+
|
882
|
+
void symbol_codec::arith_propagate_carry()
|
883
|
+
{
|
884
|
+
int index = m_arith_output_buf.size() - 1;
|
885
|
+
while (index >= 0)
|
886
|
+
{
|
887
|
+
uint c = m_arith_output_buf[index];
|
888
|
+
|
889
|
+
if (c == 0xFF)
|
890
|
+
m_arith_output_buf[index] = 0;
|
891
|
+
else
|
892
|
+
{
|
893
|
+
m_arith_output_buf[index]++;
|
894
|
+
break;
|
895
|
+
}
|
896
|
+
|
897
|
+
index--;
|
898
|
+
}
|
899
|
+
}
|
900
|
+
|
901
|
+
bool symbol_codec::arith_renorm_enc_interval()
|
902
|
+
{
|
903
|
+
do
|
904
|
+
{
|
905
|
+
if (!m_arith_output_buf.try_push_back((m_arith_base >> 24) & 0xFF))
|
906
|
+
return false;
|
907
|
+
m_total_bits_written += 8;
|
908
|
+
|
909
|
+
m_arith_base <<= 8;
|
910
|
+
} while ((m_arith_length <<= 8) < cSymbolCodecArithMinLen);
|
911
|
+
return true;
|
912
|
+
}
|
913
|
+
|
914
|
+
void symbol_codec::arith_start_encoding()
|
915
|
+
{
|
916
|
+
m_arith_output_buf.try_resize(0);
|
917
|
+
|
918
|
+
m_arith_base = 0;
|
919
|
+
m_arith_value = 0;
|
920
|
+
m_arith_length = cSymbolCodecArithMaxLen;
|
921
|
+
m_arith_total_bits = 0;
|
922
|
+
}
|
923
|
+
|
924
|
+
bool symbol_codec::encode(uint bit, adaptive_bit_model& model, bool update_model)
|
925
|
+
{
|
926
|
+
LZHAM_ASSERT(m_mode == cEncoding);
|
927
|
+
|
928
|
+
m_arith_total_bits++;
|
929
|
+
|
930
|
+
output_symbol sym;
|
931
|
+
sym.m_bits = bit;
|
932
|
+
sym.m_num_bits = -1;
|
933
|
+
sym.m_arith_prob0 = model.m_bit_0_prob;
|
934
|
+
if (!m_output_syms.try_push_back(sym))
|
935
|
+
{
|
936
|
+
LZHAM_LOG_ERROR(4019);
|
937
|
+
return false;
|
938
|
+
}
|
939
|
+
|
940
|
+
uint x = model.m_bit_0_prob * (m_arith_length >> cSymbolCodecArithProbBits);
|
941
|
+
|
942
|
+
if (!bit)
|
943
|
+
{
|
944
|
+
if (update_model)
|
945
|
+
model.m_bit_0_prob += ((cSymbolCodecArithProbScale - model.m_bit_0_prob) >> cSymbolCodecArithProbMoveBits);
|
946
|
+
|
947
|
+
m_arith_length = x;
|
948
|
+
}
|
949
|
+
else
|
950
|
+
{
|
951
|
+
if (update_model)
|
952
|
+
model.m_bit_0_prob -= (model.m_bit_0_prob >> cSymbolCodecArithProbMoveBits);
|
953
|
+
|
954
|
+
uint orig_base = m_arith_base;
|
955
|
+
m_arith_base += x;
|
956
|
+
m_arith_length -= x;
|
957
|
+
if (orig_base > m_arith_base)
|
958
|
+
arith_propagate_carry();
|
959
|
+
}
|
960
|
+
|
961
|
+
if (m_arith_length < cSymbolCodecArithMinLen)
|
962
|
+
{
|
963
|
+
if (!arith_renorm_enc_interval())
|
964
|
+
{
|
965
|
+
LZHAM_LOG_ERROR(4020);
|
966
|
+
return false;
|
967
|
+
}
|
968
|
+
}
|
969
|
+
|
970
|
+
return true;
|
971
|
+
}
|
972
|
+
|
973
|
+
bool symbol_codec::arith_stop_encoding()
|
974
|
+
{
|
975
|
+
uint orig_base = m_arith_base;
|
976
|
+
|
977
|
+
if (m_arith_length > 2 * cSymbolCodecArithMinLen)
|
978
|
+
{
|
979
|
+
m_arith_base += cSymbolCodecArithMinLen;
|
980
|
+
m_arith_length = (cSymbolCodecArithMinLen >> 1);
|
981
|
+
}
|
982
|
+
else
|
983
|
+
{
|
984
|
+
m_arith_base += (cSymbolCodecArithMinLen >> 1);
|
985
|
+
m_arith_length = (cSymbolCodecArithMinLen >> 9);
|
986
|
+
}
|
987
|
+
|
988
|
+
if (orig_base > m_arith_base)
|
989
|
+
arith_propagate_carry();
|
990
|
+
|
991
|
+
if (!arith_renorm_enc_interval())
|
992
|
+
{
|
993
|
+
LZHAM_LOG_ERROR(4021);
|
994
|
+
return false;
|
995
|
+
}
|
996
|
+
|
997
|
+
while (m_arith_output_buf.size() < 4)
|
998
|
+
{
|
999
|
+
if (!m_arith_output_buf.try_push_back(0))
|
1000
|
+
{
|
1001
|
+
LZHAM_LOG_ERROR(4022);
|
1002
|
+
return false;
|
1003
|
+
}
|
1004
|
+
m_total_bits_written += 8;
|
1005
|
+
}
|
1006
|
+
return true;
|
1007
|
+
}
|
1008
|
+
|
1009
|
+
bool symbol_codec::stop_encoding(bool support_arith)
|
1010
|
+
{
|
1011
|
+
LZHAM_ASSERT(m_mode == cEncoding);
|
1012
|
+
|
1013
|
+
if (support_arith)
|
1014
|
+
{
|
1015
|
+
if (!arith_stop_encoding())
|
1016
|
+
return false;
|
1017
|
+
}
|
1018
|
+
|
1019
|
+
if (!assemble_output_buf())
|
1020
|
+
return false;
|
1021
|
+
|
1022
|
+
m_mode = cNull;
|
1023
|
+
return true;
|
1024
|
+
}
|
1025
|
+
|
1026
|
+
bool symbol_codec::record_put_bits(uint bits, uint num_bits)
|
1027
|
+
{
|
1028
|
+
LZHAM_ASSERT(m_mode == cEncoding);
|
1029
|
+
|
1030
|
+
LZHAM_ASSERT(num_bits <= 25);
|
1031
|
+
LZHAM_ASSERT(m_bit_count >= 25);
|
1032
|
+
|
1033
|
+
if (!num_bits)
|
1034
|
+
return true;
|
1035
|
+
|
1036
|
+
m_total_bits_written += num_bits;
|
1037
|
+
|
1038
|
+
output_symbol sym;
|
1039
|
+
sym.m_bits = bits;
|
1040
|
+
sym.m_num_bits = (uint16)num_bits;
|
1041
|
+
sym.m_arith_prob0 = 0;
|
1042
|
+
if (!m_output_syms.try_push_back(sym))
|
1043
|
+
{
|
1044
|
+
LZHAM_LOG_ERROR(4023);
|
1045
|
+
return false;
|
1046
|
+
}
|
1047
|
+
|
1048
|
+
return true;
|
1049
|
+
}
|
1050
|
+
|
1051
|
+
bool symbol_codec::put_bits_init(uint expected_size)
|
1052
|
+
{
|
1053
|
+
m_bit_buf = 0;
|
1054
|
+
m_bit_count = cBitBufSize;
|
1055
|
+
|
1056
|
+
m_output_buf.try_resize(0);
|
1057
|
+
if (!m_output_buf.try_reserve(expected_size))
|
1058
|
+
{
|
1059
|
+
LZHAM_LOG_ERROR(4024);
|
1060
|
+
return false;
|
1061
|
+
}
|
1062
|
+
|
1063
|
+
return true;
|
1064
|
+
}
|
1065
|
+
|
1066
|
+
bool symbol_codec::put_bits(uint bits, uint num_bits)
|
1067
|
+
{
|
1068
|
+
LZHAM_ASSERT(num_bits <= 25);
|
1069
|
+
LZHAM_ASSERT(m_bit_count >= 25);
|
1070
|
+
|
1071
|
+
if (!num_bits)
|
1072
|
+
return true;
|
1073
|
+
|
1074
|
+
m_bit_count -= num_bits;
|
1075
|
+
m_bit_buf |= (static_cast<bit_buf_t>(bits) << m_bit_count);
|
1076
|
+
|
1077
|
+
m_total_bits_written += num_bits;
|
1078
|
+
|
1079
|
+
while (m_bit_count <= (cBitBufSize - 8))
|
1080
|
+
{
|
1081
|
+
if (!m_output_buf.try_push_back(static_cast<uint8>(m_bit_buf >> (cBitBufSize - 8))))
|
1082
|
+
return false;
|
1083
|
+
|
1084
|
+
m_bit_buf <<= 8;
|
1085
|
+
m_bit_count += 8;
|
1086
|
+
}
|
1087
|
+
|
1088
|
+
return true;
|
1089
|
+
}
|
1090
|
+
|
1091
|
+
bool symbol_codec::put_bits_align_to_byte()
|
1092
|
+
{
|
1093
|
+
uint num_bits_in = cBitBufSize - m_bit_count;
|
1094
|
+
if (num_bits_in & 7)
|
1095
|
+
{
|
1096
|
+
if (!put_bits(0, 8 - (num_bits_in & 7)))
|
1097
|
+
{
|
1098
|
+
LZHAM_LOG_ERROR(4025);
|
1099
|
+
return false;
|
1100
|
+
}
|
1101
|
+
}
|
1102
|
+
return true;
|
1103
|
+
}
|
1104
|
+
|
1105
|
+
bool symbol_codec::flush_bits()
|
1106
|
+
{
|
1107
|
+
return put_bits(0, 7); // to ensure the last bits are flushed
|
1108
|
+
}
|
1109
|
+
|
1110
|
+
bool symbol_codec::assemble_output_buf()
|
1111
|
+
{
|
1112
|
+
m_total_bits_written = 0;
|
1113
|
+
|
1114
|
+
uint arith_buf_ofs = 0;
|
1115
|
+
|
1116
|
+
// Intermix the final Arithmetic, Huffman, or plain bits to a single combined bitstream.
|
1117
|
+
// All bits from each source must be output in exactly the same order that the decompressor will read them.
|
1118
|
+
for (uint sym_index = 0; sym_index < m_output_syms.size(); sym_index++)
|
1119
|
+
{
|
1120
|
+
const output_symbol& sym = m_output_syms[sym_index];
|
1121
|
+
|
1122
|
+
if (sym.m_num_bits == output_symbol::cAlignToByteSym)
|
1123
|
+
{
|
1124
|
+
if (!put_bits_align_to_byte())
|
1125
|
+
{
|
1126
|
+
LZHAM_LOG_ERROR(4026);
|
1127
|
+
return false;
|
1128
|
+
}
|
1129
|
+
}
|
1130
|
+
else if (sym.m_num_bits == output_symbol::cArithInit)
|
1131
|
+
{
|
1132
|
+
LZHAM_ASSERT(m_arith_output_buf.size());
|
1133
|
+
|
1134
|
+
if (m_arith_output_buf.size())
|
1135
|
+
{
|
1136
|
+
m_arith_length = cSymbolCodecArithMaxLen;
|
1137
|
+
m_arith_value = 0;
|
1138
|
+
for (uint i = 0; i < 4; i++)
|
1139
|
+
{
|
1140
|
+
const uint c = m_arith_output_buf[arith_buf_ofs++];
|
1141
|
+
m_arith_value = (m_arith_value << 8) | c;
|
1142
|
+
if (!put_bits(c, 8))
|
1143
|
+
{
|
1144
|
+
LZHAM_LOG_ERROR(4027);
|
1145
|
+
return false;
|
1146
|
+
}
|
1147
|
+
}
|
1148
|
+
}
|
1149
|
+
}
|
1150
|
+
else if (sym.m_num_bits == output_symbol::cArithSym)
|
1151
|
+
{
|
1152
|
+
// This renorm logic must match the logic used in the arithmetic decoder.
|
1153
|
+
if (m_arith_length < cSymbolCodecArithMinLen)
|
1154
|
+
{
|
1155
|
+
do
|
1156
|
+
{
|
1157
|
+
const uint c = (arith_buf_ofs < m_arith_output_buf.size()) ? m_arith_output_buf[arith_buf_ofs++] : 0;
|
1158
|
+
if (!put_bits(c, 8))
|
1159
|
+
{
|
1160
|
+
LZHAM_LOG_ERROR(4028);
|
1161
|
+
return false;
|
1162
|
+
}
|
1163
|
+
m_arith_value = (m_arith_value << 8) | c;
|
1164
|
+
} while ((m_arith_length <<= 8) < cSymbolCodecArithMinLen);
|
1165
|
+
}
|
1166
|
+
|
1167
|
+
uint x = sym.m_arith_prob0 * (m_arith_length >> cSymbolCodecArithProbBits);
|
1168
|
+
uint bit = (m_arith_value >= x);
|
1169
|
+
|
1170
|
+
if (bit == 0)
|
1171
|
+
{
|
1172
|
+
m_arith_length = x;
|
1173
|
+
}
|
1174
|
+
else
|
1175
|
+
{
|
1176
|
+
m_arith_value -= x;
|
1177
|
+
m_arith_length -= x;
|
1178
|
+
}
|
1179
|
+
|
1180
|
+
LZHAM_VERIFY(bit == sym.m_bits);
|
1181
|
+
}
|
1182
|
+
else
|
1183
|
+
{
|
1184
|
+
// Huffman or plain bits
|
1185
|
+
if (!put_bits(sym.m_bits, sym.m_num_bits))
|
1186
|
+
{
|
1187
|
+
LZHAM_LOG_ERROR(4029);
|
1188
|
+
return false;
|
1189
|
+
}
|
1190
|
+
}
|
1191
|
+
}
|
1192
|
+
|
1193
|
+
return flush_bits();
|
1194
|
+
}
|
1195
|
+
|
1196
|
+
//------------------------------------------------------------------------------------------------------------------
|
1197
|
+
// Decoding
|
1198
|
+
//------------------------------------------------------------------------------------------------------------------
|
1199
|
+
|
1200
|
+
bool symbol_codec::start_decoding(const uint8* pBuf, size_t buf_size, bool eof_flag, need_bytes_func_ptr pNeed_bytes_func, void *pPrivate_data)
|
1201
|
+
{
|
1202
|
+
if (!buf_size)
|
1203
|
+
{
|
1204
|
+
LZHAM_LOG_ERROR(4030);
|
1205
|
+
return false;
|
1206
|
+
}
|
1207
|
+
|
1208
|
+
m_total_model_updates = 0;
|
1209
|
+
|
1210
|
+
m_pDecode_buf = pBuf;
|
1211
|
+
m_pDecode_buf_next = pBuf;
|
1212
|
+
m_decode_buf_size = buf_size;
|
1213
|
+
m_pDecode_buf_end = pBuf + buf_size;
|
1214
|
+
|
1215
|
+
m_pDecode_need_bytes_func = pNeed_bytes_func;
|
1216
|
+
m_pDecode_private_data = pPrivate_data;
|
1217
|
+
m_decode_buf_eof = eof_flag;
|
1218
|
+
|
1219
|
+
m_bit_buf = 0;
|
1220
|
+
m_bit_count = 0;
|
1221
|
+
|
1222
|
+
m_mode = cDecoding;
|
1223
|
+
|
1224
|
+
return true;
|
1225
|
+
}
|
1226
|
+
|
1227
|
+
uint symbol_codec::decode_bits(uint num_bits)
|
1228
|
+
{
|
1229
|
+
LZHAM_ASSERT(m_mode == cDecoding);
|
1230
|
+
|
1231
|
+
if (!num_bits)
|
1232
|
+
return 0;
|
1233
|
+
|
1234
|
+
if (num_bits > 16)
|
1235
|
+
{
|
1236
|
+
uint a = get_bits(num_bits - 16);
|
1237
|
+
uint b = get_bits(16);
|
1238
|
+
|
1239
|
+
return (a << 16) | b;
|
1240
|
+
}
|
1241
|
+
else
|
1242
|
+
return get_bits(num_bits);
|
1243
|
+
}
|
1244
|
+
|
1245
|
+
void symbol_codec::decode_remove_bits(uint num_bits)
|
1246
|
+
{
|
1247
|
+
LZHAM_ASSERT(m_mode == cDecoding);
|
1248
|
+
|
1249
|
+
while (num_bits > 16)
|
1250
|
+
{
|
1251
|
+
remove_bits(16);
|
1252
|
+
num_bits -= 16;
|
1253
|
+
}
|
1254
|
+
|
1255
|
+
remove_bits(num_bits);
|
1256
|
+
}
|
1257
|
+
|
1258
|
+
uint symbol_codec::decode_peek_bits(uint num_bits)
|
1259
|
+
{
|
1260
|
+
LZHAM_ASSERT(m_mode == cDecoding);
|
1261
|
+
LZHAM_ASSERT(num_bits <= 25);
|
1262
|
+
|
1263
|
+
if (!num_bits)
|
1264
|
+
return 0;
|
1265
|
+
|
1266
|
+
while (m_bit_count < (int)num_bits)
|
1267
|
+
{
|
1268
|
+
uint c = 0;
|
1269
|
+
if (m_pDecode_buf_next == m_pDecode_buf_end)
|
1270
|
+
{
|
1271
|
+
if (!m_decode_buf_eof)
|
1272
|
+
{
|
1273
|
+
m_pDecode_need_bytes_func(m_pDecode_buf_next - m_pDecode_buf, m_pDecode_private_data, m_pDecode_buf, m_decode_buf_size, m_decode_buf_eof);
|
1274
|
+
m_pDecode_buf_end = m_pDecode_buf + m_decode_buf_size;
|
1275
|
+
m_pDecode_buf_next = m_pDecode_buf;
|
1276
|
+
if (m_pDecode_buf_next < m_pDecode_buf_end) c = *m_pDecode_buf_next++;
|
1277
|
+
}
|
1278
|
+
}
|
1279
|
+
else
|
1280
|
+
c = *m_pDecode_buf_next++;
|
1281
|
+
|
1282
|
+
m_bit_count += 8;
|
1283
|
+
LZHAM_ASSERT(m_bit_count <= cBitBufSize);
|
1284
|
+
|
1285
|
+
m_bit_buf |= (static_cast<bit_buf_t>(c) << (cBitBufSize - m_bit_count));
|
1286
|
+
}
|
1287
|
+
|
1288
|
+
return static_cast<uint>(m_bit_buf >> (cBitBufSize - num_bits));
|
1289
|
+
}
|
1290
|
+
|
1291
|
+
uint symbol_codec::decode(quasi_adaptive_huffman_data_model& model)
|
1292
|
+
{
|
1293
|
+
LZHAM_ASSERT(m_mode == cDecoding);
|
1294
|
+
LZHAM_ASSERT(!model.m_encoding);
|
1295
|
+
|
1296
|
+
const prefix_coding::decoder_tables* pTables = model.m_pDecode_tables;
|
1297
|
+
|
1298
|
+
while (m_bit_count < (cBitBufSize - 8))
|
1299
|
+
{
|
1300
|
+
uint c = 0;
|
1301
|
+
if (m_pDecode_buf_next == m_pDecode_buf_end)
|
1302
|
+
{
|
1303
|
+
if (!m_decode_buf_eof)
|
1304
|
+
{
|
1305
|
+
m_pDecode_need_bytes_func(m_pDecode_buf_next - m_pDecode_buf, m_pDecode_private_data, m_pDecode_buf, m_decode_buf_size, m_decode_buf_eof);
|
1306
|
+
m_pDecode_buf_end = m_pDecode_buf + m_decode_buf_size;
|
1307
|
+
m_pDecode_buf_next = m_pDecode_buf;
|
1308
|
+
if (m_pDecode_buf_next < m_pDecode_buf_end) c = *m_pDecode_buf_next++;
|
1309
|
+
}
|
1310
|
+
}
|
1311
|
+
else
|
1312
|
+
c = *m_pDecode_buf_next++;
|
1313
|
+
|
1314
|
+
m_bit_count += 8;
|
1315
|
+
m_bit_buf |= (static_cast<bit_buf_t>(c) << (cBitBufSize - m_bit_count));
|
1316
|
+
}
|
1317
|
+
|
1318
|
+
uint k = static_cast<uint>((m_bit_buf >> (cBitBufSize - 16)) + 1);
|
1319
|
+
uint sym, len;
|
1320
|
+
|
1321
|
+
if (k <= pTables->m_table_max_code)
|
1322
|
+
{
|
1323
|
+
uint32 t = pTables->m_lookup[m_bit_buf >> (cBitBufSize - pTables->m_table_bits)];
|
1324
|
+
|
1325
|
+
LZHAM_ASSERT(t != cUINT32_MAX);
|
1326
|
+
sym = t & cUINT16_MAX;
|
1327
|
+
len = t >> 16;
|
1328
|
+
|
1329
|
+
LZHAM_ASSERT(model.m_code_sizes[sym] == len);
|
1330
|
+
}
|
1331
|
+
else
|
1332
|
+
{
|
1333
|
+
len = pTables->m_decode_start_code_size;
|
1334
|
+
|
1335
|
+
for ( ; ; )
|
1336
|
+
{
|
1337
|
+
if (k <= pTables->m_max_codes[len - 1])
|
1338
|
+
break;
|
1339
|
+
len++;
|
1340
|
+
}
|
1341
|
+
|
1342
|
+
int val_ptr = pTables->m_val_ptrs[len - 1] + static_cast<int>((m_bit_buf >> (cBitBufSize - len)));
|
1343
|
+
|
1344
|
+
if (((uint)val_ptr >= model.m_total_syms))
|
1345
|
+
{
|
1346
|
+
// corrupted stream, or a bug
|
1347
|
+
LZHAM_ASSERT(0);
|
1348
|
+
LZHAM_LOG_ERROR(4031);
|
1349
|
+
return 0;
|
1350
|
+
}
|
1351
|
+
|
1352
|
+
sym = pTables->m_sorted_symbol_order[val_ptr];
|
1353
|
+
}
|
1354
|
+
|
1355
|
+
m_bit_buf <<= len;
|
1356
|
+
m_bit_count -= len;
|
1357
|
+
|
1358
|
+
uint freq = model.m_sym_freq[sym];
|
1359
|
+
freq++;
|
1360
|
+
model.m_sym_freq[sym] = static_cast<uint16>(freq);
|
1361
|
+
|
1362
|
+
LZHAM_ASSERT(freq <= cUINT16_MAX);
|
1363
|
+
|
1364
|
+
if (--model.m_symbols_until_update == 0)
|
1365
|
+
{
|
1366
|
+
m_total_model_updates++;
|
1367
|
+
model.update_tables();
|
1368
|
+
}
|
1369
|
+
|
1370
|
+
return sym;
|
1371
|
+
}
|
1372
|
+
|
1373
|
+
uint64 symbol_codec::stop_decoding()
|
1374
|
+
{
|
1375
|
+
LZHAM_ASSERT(m_mode == cDecoding);
|
1376
|
+
|
1377
|
+
uint64 n = m_pDecode_buf_next - m_pDecode_buf;
|
1378
|
+
|
1379
|
+
m_mode = cNull;
|
1380
|
+
|
1381
|
+
return n;
|
1382
|
+
}
|
1383
|
+
|
1384
|
+
uint symbol_codec::get_bits(uint num_bits)
|
1385
|
+
{
|
1386
|
+
LZHAM_ASSERT(num_bits <= 25);
|
1387
|
+
|
1388
|
+
if (!num_bits)
|
1389
|
+
return 0;
|
1390
|
+
|
1391
|
+
while (m_bit_count < (int)num_bits)
|
1392
|
+
{
|
1393
|
+
uint c = 0;
|
1394
|
+
if (m_pDecode_buf_next == m_pDecode_buf_end)
|
1395
|
+
{
|
1396
|
+
if (!m_decode_buf_eof)
|
1397
|
+
{
|
1398
|
+
m_pDecode_need_bytes_func(m_pDecode_buf_next - m_pDecode_buf, m_pDecode_private_data, m_pDecode_buf, m_decode_buf_size, m_decode_buf_eof);
|
1399
|
+
m_pDecode_buf_end = m_pDecode_buf + m_decode_buf_size;
|
1400
|
+
m_pDecode_buf_next = m_pDecode_buf;
|
1401
|
+
if (m_pDecode_buf_next < m_pDecode_buf_end) c = *m_pDecode_buf_next++;
|
1402
|
+
}
|
1403
|
+
}
|
1404
|
+
else
|
1405
|
+
c = *m_pDecode_buf_next++;
|
1406
|
+
|
1407
|
+
m_bit_count += 8;
|
1408
|
+
LZHAM_ASSERT(m_bit_count <= cBitBufSize);
|
1409
|
+
|
1410
|
+
m_bit_buf |= (static_cast<bit_buf_t>(c) << (cBitBufSize - m_bit_count));
|
1411
|
+
}
|
1412
|
+
|
1413
|
+
uint result = static_cast<uint>(m_bit_buf >> (cBitBufSize - num_bits));
|
1414
|
+
|
1415
|
+
m_bit_buf <<= num_bits;
|
1416
|
+
m_bit_count -= num_bits;
|
1417
|
+
|
1418
|
+
return result;
|
1419
|
+
}
|
1420
|
+
|
1421
|
+
void symbol_codec::remove_bits(uint num_bits)
|
1422
|
+
{
|
1423
|
+
LZHAM_ASSERT(num_bits <= 25);
|
1424
|
+
|
1425
|
+
if (!num_bits)
|
1426
|
+
return;
|
1427
|
+
|
1428
|
+
while (m_bit_count < (int)num_bits)
|
1429
|
+
{
|
1430
|
+
uint c = 0;
|
1431
|
+
if (m_pDecode_buf_next == m_pDecode_buf_end)
|
1432
|
+
{
|
1433
|
+
if (!m_decode_buf_eof)
|
1434
|
+
{
|
1435
|
+
m_pDecode_need_bytes_func(m_pDecode_buf_next - m_pDecode_buf, m_pDecode_private_data, m_pDecode_buf, m_decode_buf_size, m_decode_buf_eof);
|
1436
|
+
m_pDecode_buf_end = m_pDecode_buf + m_decode_buf_size;
|
1437
|
+
m_pDecode_buf_next = m_pDecode_buf;
|
1438
|
+
if (m_pDecode_buf_next < m_pDecode_buf_end) c = *m_pDecode_buf_next++;
|
1439
|
+
}
|
1440
|
+
}
|
1441
|
+
else
|
1442
|
+
c = *m_pDecode_buf_next++;
|
1443
|
+
|
1444
|
+
m_bit_count += 8;
|
1445
|
+
LZHAM_ASSERT(m_bit_count <= cBitBufSize);
|
1446
|
+
|
1447
|
+
m_bit_buf |= (static_cast<bit_buf_t>(c) << (cBitBufSize - m_bit_count));
|
1448
|
+
}
|
1449
|
+
|
1450
|
+
m_bit_buf <<= num_bits;
|
1451
|
+
m_bit_count -= num_bits;
|
1452
|
+
}
|
1453
|
+
|
1454
|
+
void symbol_codec::decode_align_to_byte()
|
1455
|
+
{
|
1456
|
+
LZHAM_ASSERT(m_mode == cDecoding);
|
1457
|
+
|
1458
|
+
if (m_bit_count & 7)
|
1459
|
+
{
|
1460
|
+
remove_bits(m_bit_count & 7);
|
1461
|
+
}
|
1462
|
+
}
|
1463
|
+
|
1464
|
+
int symbol_codec::decode_remove_byte_from_bit_buf()
|
1465
|
+
{
|
1466
|
+
if (m_bit_count < 8)
|
1467
|
+
return -1;
|
1468
|
+
int result = static_cast<int>(m_bit_buf >> (cBitBufSize - 8));
|
1469
|
+
m_bit_buf <<= 8;
|
1470
|
+
m_bit_count -= 8;
|
1471
|
+
return result;
|
1472
|
+
}
|
1473
|
+
|
1474
|
+
uint symbol_codec::decode(adaptive_bit_model& model, bool update_model)
|
1475
|
+
{
|
1476
|
+
while (m_arith_length < cSymbolCodecArithMinLen)
|
1477
|
+
{
|
1478
|
+
uint c = get_bits(8);
|
1479
|
+
m_arith_value = (m_arith_value << 8) | c;
|
1480
|
+
m_arith_length <<= 8;
|
1481
|
+
}
|
1482
|
+
|
1483
|
+
uint x = model.m_bit_0_prob * (m_arith_length >> cSymbolCodecArithProbBits);
|
1484
|
+
uint bit = (m_arith_value >= x);
|
1485
|
+
|
1486
|
+
if (!bit)
|
1487
|
+
{
|
1488
|
+
if (update_model)
|
1489
|
+
model.m_bit_0_prob += ((cSymbolCodecArithProbScale - model.m_bit_0_prob) >> cSymbolCodecArithProbMoveBits);
|
1490
|
+
|
1491
|
+
m_arith_length = x;
|
1492
|
+
}
|
1493
|
+
else
|
1494
|
+
{
|
1495
|
+
if (update_model)
|
1496
|
+
model.m_bit_0_prob -= (model.m_bit_0_prob >> cSymbolCodecArithProbMoveBits);
|
1497
|
+
m_arith_value -= x;
|
1498
|
+
m_arith_length -= x;
|
1499
|
+
}
|
1500
|
+
|
1501
|
+
return bit;
|
1502
|
+
}
|
1503
|
+
|
1504
|
+
void symbol_codec::start_arith_decoding()
|
1505
|
+
{
|
1506
|
+
LZHAM_ASSERT(m_mode == cDecoding);
|
1507
|
+
|
1508
|
+
m_arith_length = cSymbolCodecArithMaxLen;
|
1509
|
+
m_arith_value = 0;
|
1510
|
+
|
1511
|
+
m_arith_value = (get_bits(8) << 24);
|
1512
|
+
m_arith_value |= (get_bits(8) << 16);
|
1513
|
+
m_arith_value |= (get_bits(8) << 8);
|
1514
|
+
m_arith_value |= get_bits(8);
|
1515
|
+
}
|
1516
|
+
|
1517
|
+
void symbol_codec::decode_need_bytes()
|
1518
|
+
{
|
1519
|
+
if (!m_decode_buf_eof)
|
1520
|
+
{
|
1521
|
+
m_pDecode_need_bytes_func(m_pDecode_buf_next - m_pDecode_buf, m_pDecode_private_data, m_pDecode_buf, m_decode_buf_size, m_decode_buf_eof);
|
1522
|
+
m_pDecode_buf_end = m_pDecode_buf + m_decode_buf_size;
|
1523
|
+
m_pDecode_buf_next = m_pDecode_buf;
|
1524
|
+
}
|
1525
|
+
}
|
1526
|
+
|
1527
|
+
} // namespace lzham
|