RetroArch
LzmaEnc.h
Go to the documentation of this file.
1 /* LzmaEnc.h -- LZMA Encoder
2 2013-01-18 : Igor Pavlov : Public domain */
3 
4 #ifndef __LZMA_ENC_H
5 #define __LZMA_ENC_H
6 
7 #include <stdint.h>
8 #include <stddef.h>
9 #include "7zTypes.h"
10 
12 
13 #define LZMA_PROPS_SIZE 5
14 
15 typedef struct _CLzmaEncProps
16 {
17  int level; /* 0 <= level <= 9 */
18  uint32_t dictSize; /* (1 << 12) <= dictSize <= (1 << 27) for 32-bit version
19  (1 << 12) <= dictSize <= (1 << 30) for 64-bit version
20  default = (1 << 24) */
21  uint64_t reduceSize; /* estimated size of data that will be compressed. default = 0xFFFFFFFF.
22  Encoder uses this value to reduce dictionary size */
23  int lc; /* 0 <= lc <= 8, default = 3 */
24  int lp; /* 0 <= lp <= 4, default = 0 */
25  int pb; /* 0 <= pb <= 4, default = 2 */
26  int algo; /* 0 - fast, 1 - normal, default = 1 */
27  int fb; /* 5 <= fb <= 273, default = 32 */
28  int btMode; /* 0 - hashChain Mode, 1 - binTree mode - normal, default = 1 */
29  int numHashBytes; /* 2, 3 or 4, default = 4 */
30  uint32_t mc; /* 1 <= mc <= (1 << 30), default = 32 */
31  unsigned writeEndMark; /* 0 - do not write EOPM, 1 - write EOPM, default = 0 */
32  int numThreads; /* 1 or 2, default = 2 */
34 
38 
39 
40 /* ---------- CLzmaEncHandle Interface ---------- */
41 
42 /* LzmaEnc_* functions can return the following exit codes:
43 Returns:
44  SZ_OK - OK
45  SZ_ERROR_MEM - Memory allocation error
46  SZ_ERROR_PARAM - Incorrect paramater in props
47  SZ_ERROR_WRITE - Write callback error.
48  SZ_ERROR_PROGRESS - some break from progress callback
49  SZ_ERROR_THREAD - errors in multithreading functions (only for Mt version)
50 */
51 
52 typedef void * CLzmaEncHandle;
53 
55 void LzmaEnc_Destroy(CLzmaEncHandle p, ISzAlloc *alloc, ISzAlloc *allocBig);
57 SRes LzmaEnc_WriteProperties(CLzmaEncHandle p, unsigned char *properties, size_t *size);
59  ICompressProgress *progress, ISzAlloc *alloc, ISzAlloc *allocBig);
60 SRes LzmaEnc_MemEncode(CLzmaEncHandle p, unsigned char *dest, size_t *destLen, const unsigned char *src, size_t srcLen,
61  int writeEndMark, ICompressProgress *progress, ISzAlloc *alloc, ISzAlloc *allocBig);
62 
63 /* ---------- One Call Interface ---------- */
64 
65 /* LzmaEncode
66 Return code:
67  SZ_OK - OK
68  SZ_ERROR_MEM - Memory allocation error
69  SZ_ERROR_PARAM - Incorrect paramater
70  SZ_ERROR_OUTPUT_EOF - output buffer overflow
71  SZ_ERROR_THREAD - errors in multithreading functions (only for Mt version)
72 */
73 
74 SRes LzmaEncode(unsigned char *dest, size_t *destLen, const unsigned char *src, size_t srcLen,
75  const CLzmaEncProps *props, unsigned char *propsEncoded, size_t *propsSize, int writeEndMark,
76  ICompressProgress *progress, ISzAlloc *alloc, ISzAlloc *allocBig);
77 
79 
80 #endif
Definition: 7zTypes.h:162
void LzmaEnc_Destroy(CLzmaEncHandle p, ISzAlloc *alloc, ISzAlloc *allocBig)
Definition: LzmaEnc.c:1710
void LzmaEncProps_Normalize(CLzmaEncProps *p)
Definition: LzmaEnc.c:48
uint32_t mc
Definition: LzmaEnc.h:30
int fb
Definition: LzmaEnc.h:27
SRes LzmaEnc_Encode(CLzmaEncHandle p, ISeqOutStream *outStream, ISeqInStream *inStream, ICompressProgress *progress, ISzAlloc *alloc, ISzAlloc *allocBig)
Definition: LzmaEnc.c:2168
int pb
Definition: LzmaEnc.h:25
Definition: LzmaEnc.h:15
GLsizeiptr size
Definition: glext.h:6559
int numThreads
Definition: LzmaEnc.h:32
int numHashBytes
Definition: LzmaEnc.h:29
Definition: 7zTypes.h:86
void LzmaEncProps_Init(CLzmaEncProps *p)
Definition: LzmaEnc.c:39
int lp
Definition: LzmaEnc.h:24
void * CLzmaEncHandle
Definition: LzmaEnc.h:52
#define EXTERN_C_END
Definition: 7zTypes.h:16
SRes LzmaEnc_SetProps(CLzmaEncHandle p, const CLzmaEncProps *props)
Definition: LzmaEnc.c:382
struct _CLzmaEncProps CLzmaEncProps
int SRes
Definition: 7zTypes.h:44
SRes LzmaEncode(unsigned char *dest, size_t *destLen, const unsigned char *src, size_t srcLen, const CLzmaEncProps *props, unsigned char *propsEncoded, size_t *propsSize, int writeEndMark, ICompressProgress *progress, ISzAlloc *alloc, ISzAlloc *allocBig)
Definition: LzmaEnc.c:2236
uint32_t LzmaEncProps_GetDictSize(const CLzmaEncProps *props2)
Definition: LzmaEnc.c:84
GLenum src
Definition: glext.h:6980
int btMode
Definition: LzmaEnc.h:28
SRes LzmaEnc_WriteProperties(CLzmaEncHandle p, unsigned char *properties, size_t *size)
Definition: LzmaEnc.c:2176
GLfloat GLfloat p
Definition: glext.h:9809
unsigned writeEndMark
Definition: LzmaEnc.h:31
GLenum GLuint GLsizei const GLenum * props
Definition: glext.h:8742
uint64_t reduceSize
Definition: LzmaEnc.h:21
CLzmaEncHandle LzmaEnc_Create(ISzAlloc *alloc)
Definition: LzmaEnc.c:1682
int lc
Definition: LzmaEnc.h:23
Definition: 7zTypes.h:157
#define EXTERN_C_BEGIN
Definition: 7zTypes.h:15
SRes LzmaEnc_MemEncode(CLzmaEncHandle p, unsigned char *dest, size_t *destLen, const unsigned char *src, size_t srcLen, int writeEndMark, ICompressProgress *progress, ISzAlloc *alloc, ISzAlloc *allocBig)
Definition: LzmaEnc.c:2204
int algo
Definition: LzmaEnc.h:26
Definition: 7zTypes.h:74
unsigned __int64 uint64_t
Definition: stdint.h:136
unsigned int uint32_t
Definition: stdint.h:126
int level
Definition: LzmaEnc.h:17
uint32_t dictSize
Definition: LzmaEnc.h:18