| |
Fortgeschrittene ProgrammierungKennt jemand eine LZMA-Dll? | | | Autor: TBX | Datum: 12.01.10 12:17 |
| Hallo zusammen,
weiß zufällig jemand, ob es irgendwo eine dokumentintierte LZMA-Kompressions-Dll gibt? Eine normale API-Dll würde mir reichen.
LZMA ist die beste mir bekannte Komprimierungsmethode und die würde ich gerne für mein Programm einsetzten. Mit der zlib.dll erziehle ich nicht besonders gute Resultate...
Die 7-zip Homepage kenne ich übrigens bereits. Aber der C++ Sourcecode für LZMA hilft mir nicht wirklich weiter...
Grüße,
TBX | |
Re: Kennt jemand eine LZMA-Dll? | | | Autor: TBX | Datum: 19.01.10 19:28 |
| habe sogar noch was besseres in der LZMA-SDK gefunden: Den Sourcecode für eine LZMA.dll. Keine Ahnung warum ich den nicht längst entdeckt habe. Jetzt muss ich es nur noch schaffen aus der Header-Datei den VB-Code abzuleiten. Vielen Dank. | |
Re: Kennt jemand eine LZMA-Dll? | | | Autor: luet | Datum: 17.02.10 11:53 |
| Hallo,
ich interessiere mich auch für dieses Thema.
Würde die DLL auch gerne unter vb6 einsetzen.
Hast du schon was erarbeitet?
Es wäre schön, wenn du dich zu diesem Thema noch mal melden könntest
Vielen Dank
luet | |
Re: Kennt jemand eine LZMA-Dll? | | | Autor: TBX | Datum: 17.02.10 19:27 |
| Leider habe ich keine Fortschritte gemacht. Die API-Funktion die ich aus der Header-Datei abgeleitet hat gibt mir immer einen Param-Error zurück.Hier meine (sehr experimentelle!) VB-Funktion, für dich ich mich an B2Zip orientiert habe. Mit dem outProps-Parameter kann ich einfach nichts anfangen. Der ist nirgendwo dokumentiert. Mir fehlen einfach momentan die C++ Kenntnisse. Aber ich lerne fleißig. Werde das Problem zu gegebener Zeit nochmal anpacken.
Private Declare Function LzmaCompress Lib "LZMA.dll" (Dest As Any, destLen As _
Long, Src As Any, SrcLen As Long, _
outProps As Any, outPropsSize As Long, Level As Long, dictSize As Long, lc As _
Long, lp As Long, pb As Long, _
fb As Long, numThreads As Long) As Long
sub TestLZMA()
Dim ret As Long
Dim sFile1 As String, sFile2 As String
Dim iFn1 As Integer, iFn2 As Integer
Dim bIn() As Byte, bOut() As Byte
Dim iLenIn As Long, iBufLen As Long
Dim bAny() As Byte
sFile1 = "In.txt"
sFile2 = "Out.txt"
iFn1 = FreeFile
Open sFile1 For Binary Access Read Lock Write As iFn1
iFn2 = FreeFile
Open sFile2 For Binary As iFn2
ReDim bIn(LOF(iFn1))
Get #iFn1, , bIn()
iLenIn = UBound(bIn) + 1
iBufLen = iLenIn + (iLenIn * 0.01) + 600
ReDim bOut(iBufLen)
ReDim bAny(iBufLen)
ret = LzmaCompress(bOut(0), iBufLen, bIn(0), iLenIn, bAny(0), 5, 5, 0, 3, 0, 2, _
32, 2)
Put #iFn2, , bOut()
End Sub | |
Re: Kennt jemand eine LZMA-Dll? | | | Autor: luet | Datum: 18.02.10 07:49 |
| Ich hab das hier gefunden.
Habe aber keine Ahnung, wie ich das umsetze??
Wer kann helfen?
thx
luet
Attribute VB_Name = "LZMA_Module"
'RAM requirements for LZMA:
' for compression: (dictSize * 11.5 + 6 MB) + state_size
' for decompression: dictSize + state_size
' state_size = (4 + (1.5 << (lc + lp))) KB
' by default (lc=3, lp=0), state_size = 16 KB.
'
'LZMA properties (5 bytes) format
' Offset Size Description
' 0 1 lc, lp and pb in encoded form.
' 1 4 dictSize (little endian).
'½±°Ô ÀÎÄÚµùÆû | »çÀü Å©±â (¸®Æ² ¿£µð¾È)
' 00 00 00 00 01
'*/
'
'/*
'LzmaCompress
'------------
'
'outPropsSize -
' In: the pointer to the size of outProps buffer; *outPropsSize =
LZMA_PROPS_SIZE = 5.
' Out: the pointer to the size of written properties in outProps buffer;
*outPropsSize = LZMA_PROPS_SIZE = 5.
'
' LZMA Encoder will use defult values for any parameter, if it is
' -1 for any from: level, loc, lp, pb, fb, numThreads
' 0 for dictSize
' algo = 0 means fast method
' algo = 1 means normal method
'
'dictSize - The dictionary size in bytes. The maximum value is
' 128 MB = (1 << 27) bytes for 32-bit version
' 1 GB = (1 << 30) bytes for 64-bit version
' The default value is 16 MB = (1 << 24) bytes.
' It 's recommended to use the dictionary that is larger than 4 KB and
' that can be calculated as (1 << N) or (3 << N) sizes.
'
'lc - The number of literal context bits (high bits of previous literal).
' It can be in the range from 0 to 8. The default value is 3.
' Sometimes lc=4 gives the gain for big files.
'
'lp - The number of literal pos bits (low bits of current position for
literals).
' It can be in the range from 0 to 4. The default value is 0.
' The lp switch is intended for periodical data when the period is equal
to 2^lp.
' For example, for 32-bit (4 bytes) periodical data you can use lp=2.
Often it's
' better to set lc=0, if you change lp switch.
'
'pb - The number of pos bits (low bits of current position).
' It can be in the range from 0 to 4. The default value is 2.
' The pb switch is intended for periodical data when the period is equal
2^pb.
'
'fb - Word size (the number of fast bytes).
' It can be in the range from 5 to 273. The default value is 32.
' Usually, a big number gives a little bit better compression ratio and
' slower compression process.
'
'numThreads - The number of thereads. 1 or 2. The default value is 2.
' Fast mode (algo = 0) can use only 1 thread.
Public Declare Function LzmaCompress Lib "LZMA.dll" (ByVal dest As Long,
ByRef destLen As Long, ByVal src As Long, ByVal srcLen As Long, ByVal
outProps As Long, ByRef outPropsSize As Long, _
Optional ByVal level As Long = 5, _
Optional ByVal dictSize As Long = 16777216, _
Optional ByVal lc As Long = 3, _
Optional ByVal lp As Long = 0, _
Optional ByVal pb As Long = 2, _
Optional ByVal fb As Long = 32, _
Optional ByVal numThreads As Long = 2) As Long
Public Declare Function LzmaUncompress Lib "LZMA.dll" (ByVal dest As Long,
ByRef destLen As Long, ByVal src As Long, ByRef srcLen As Long, ByVal
outProps As Long, ByVal outPropsSize As Long) As Long
'outPropsSize=5
'/*
'LzmaUncompress
'--------------
'In:
' dest - output data
' destLen - output data size
' src - input data
' srcLen - input data size
'Out:
' destLen - processed output size
' srcLen - processed input size
'Returns:
' SZ_OK -OK
' SZ_ERROR_DATA - Data error
' SZ_ERROR_MEM - Memory allocation arror
' SZ_ERROR_UNSUPPORTED - Unsupported properties
' SZ_ERROR_INPUT_EOF - it needs more bytes in input buffer (src)
'*/
Public Function VB_LzmaCompress(ByRef dest() As Byte, ByRef src() As Byte,
ByRef Props() As Byte, Optional ByVal level As Long = 5&, _
Optional ByVal dictSize As Long = 16777216, _
Optional ByVal lc As Long = 3&, _
Optional ByVal lp As Long = 0&, _
Optional ByVal pb As Long = 2&, _
Optional ByVal fb As Long = 32&, _
Optional ByVal numThreads As Long = 2&) As Long
Call LzmaCompress(VarPtr(dest(0)), VB_LzmaCompress, VarPtr(src(0)),
UBound(src), VarPtr(Props(0)), 5&, level, dictSize, lc, lp, pb, fb,
numThreads)
End Function
Public Function VB_LzmaUnCompress(ByRef dest() As Byte, ByRef src() As Byte,
ByRef Props() As Byte) As Long
VB_LzmaUnCompress = LzmaUncompress(VarPtr(dest(0)), UBound(dest),
VarPtr(src(0)), UBound(src), VarPtr(Props(0)), 5)
End Function | |
Re: Kennt jemand eine LZMA-Dll? | | | Autor: TBX | Datum: 18.02.10 10:10 |
| Ich denke da kann ich was mit anfangen. Ich werde mich heute abend damit beschäftigen. Lasse dann von mir hören. | |
Re: Kennt jemand eine LZMA-Dll? | | | Autor: luet | Datum: 28.02.10 16:28 |
| Lass mal wieder was von dir hören...
thx
luet | |
Re: Kennt jemand eine LZMA-Dll? | | | Autor: TBX | Datum: 01.03.10 09:58 |
| Ich würde dir gerne neues berichten, aber leider bin ich nicht weitergekommen. Ich suche immer noch Informationen über "outProps". | |
Re: Kennt jemand eine LZMA-Dll? | | | Autor: luet | Datum: 03.03.10 19:50 |
| 'LzmaCompress
'------------
'
'outPropsSize -
' In: the pointer to the size of outProps buffer; *outPropsSize =
LZMA_PROPS_SIZE = 5.
' Out: the pointer to the size of written properties in outProps buffer;
*outPropsSize = LZMA_PROPS_SIZE = 5.
'
' LZMA Encoder will use defult values for any parameter, if it is
' -1 for any from: level, loc, lp, pb, fb, numThreads
' 0 for dictSize
'
'level - compression level: 0 <= level <= 9;
'
' level dictSize algo fb
' 0: 16 KB 0 32
' 1: 64 KB 0 32
' 2: 256 KB 0 32
' 3: 1 MB 0 32
' 4: 4 MB 0 32
' 5: 16 MB 1 32
' 6: 32 MB 1 32
' 7+: 64 MB 1 64
'
' The default value for "level" is 5.
'
' algo = 0 means fast method
' algo = 1 means normal method
'
'dictSize - The dictionary size in bytes. The maximum value is
' 128 MB = (1 << 27) bytes for 32-bit version
' 1 GB = (1 << 30) bytes for 64-bit version
' The default value is 16 MB = (1 << 24) bytes.
' It 's recommended to use the dictionary that is larger than 4 KB and
' that can be calculated as (1 << N) or (3 << N) sizes.
'
'lc - The number of literal context bits (high bits of previous literal).
' It can be in the range from 0 to 8. The default value is 3.
' Sometimes lc=4 gives the gain for big files.
'
'lp - The number of literal pos bits (low bits of current position for
literals).
' It can be in the range from 0 to 4. The default value is 0.
' The lp switch is intended for periodical data when the period is equal
to 2^lp.
' For example, for 32-bit (4 bytes) periodical data you can use lp=2.
Often it's
' better to set lc=0, if you change lp switch.
'
'pb - The number of pos bits (low bits of current position).
' It can be in the range from 0 to 4. The default value is 2.
' The pb switch is intended for periodical data when the period is equal
2^pb.
'
'fb - Word size (the number of fast bytes).
' It can be in the range from 5 to 273. The default value is 32.
' Usually, a big number gives a little bit better compression ratio and
' slower compression process.
'
'numThreads - The number of thereads. 1 or 2. The default value is 2.
' Fast mode (algo = 0) can use only 1 thread. | |
| Sie sind nicht angemeldet! Um auf diesen Beitrag zu antworten oder neue Beiträge schreiben zu können, müssen Sie sich zunächst anmelden.
Einloggen | Neu registrieren |
|
|
sevISDN 1.0
Überwachung aller eingehender Anrufe!
Die DLL erkennt alle über die CAPI-Schnittstelle eingehenden Anrufe und teilt Ihnen sogar mit, aus welchem Ortsbereich der Anruf stammt. Weitere Highlights: Online-Rufident, Erkennung der Anrufbehandlung u.v.m. Weitere InfosTipp des Monats Neu! sevDTA 3.0 Pro
SEPA mit Kontonummernprüfung
Erstellen von SEPA-Dateien mit integriertem BIC-Verzeichnis und Konto- nummern-Prüfverfahren, so dass ungültige Bankdaten bereits im Vorfeld ermittelt werden können. Weitere Infos
|