blob: 5498061762a8f967946e5f6a8c5392888ae07ddd [file] [log] [blame]
Stefan Reinauer14e22772010-04-27 06:56:47 +00001/*
Carl-Daniel Hailfingercba07dd2006-09-14 15:12:36 +00002 LzmaDecode.h
3 LZMA Decoder interface
4
5 LZMA SDK 4.40 Copyright (c) 1999-2006 Igor Pavlov (2006-05-01)
6 http://www.7-zip.org/
7
8 LZMA SDK is licensed under two licenses:
9 1) GNU Lesser General Public License (GNU LGPL)
10 2) Common Public License (CPL)
Stefan Reinauer14e22772010-04-27 06:56:47 +000011 It means that you can select one of these two licenses and
Carl-Daniel Hailfingercba07dd2006-09-14 15:12:36 +000012 follow rules of that license.
13
14 SPECIAL EXCEPTION:
Stefan Reinauer14e22772010-04-27 06:56:47 +000015 Igor Pavlov, as the author of this code, expressly permits you to
16 statically or dynamically link your code (or bind by name) to the
17 interfaces of this file without subjecting your linked code to the
18 terms of the CPL or GNU LGPL. Any modifications or additions
Carl-Daniel Hailfingercba07dd2006-09-14 15:12:36 +000019 to this file, however, are subject to the LGPL or CPL terms.
20*/
21
22#ifndef __LZMADECODE_H
23#define __LZMADECODE_H
24
Arthur Heymans7552eb22022-11-30 23:24:31 +010025#include <types.h>
26
Carl-Daniel Hailfingercba07dd2006-09-14 15:12:36 +000027typedef unsigned char Byte;
28typedef unsigned short UInt16;
29typedef unsigned int UInt32;
Arthur Heymans7552eb22022-11-30 23:24:31 +010030typedef size_t SizeT;
Carl-Daniel Hailfingercba07dd2006-09-14 15:12:36 +000031
32#define CProb UInt16
33
34#define LZMA_RESULT_OK 0
35#define LZMA_RESULT_DATA_ERROR 1
36
37
38#define LZMA_BASE_SIZE 1846
39#define LZMA_LIT_SIZE 768
40
41#define LZMA_PROPERTIES_SIZE 5
42
Lee Leahye20a3192017-03-09 16:21:34 -080043typedef struct _CLzmaProperties {
44 int lc;
45 int lp;
46 int pb;
Lee Leahy35af5c42017-03-09 17:35:28 -080047} CLzmaProperties;
Carl-Daniel Hailfingercba07dd2006-09-14 15:12:36 +000048
Lee Leahy73402172017-03-10 15:23:24 -080049int LzmaDecodeProperties(CLzmaProperties *propsRes,
50 const unsigned char *propsData, int size);
Carl-Daniel Hailfingercba07dd2006-09-14 15:12:36 +000051
Lee Leahy73402172017-03-10 15:23:24 -080052#define LzmaGetNumProbs(Properties) (LZMA_BASE_SIZE + (LZMA_LIT_SIZE \
53 << ((Properties)->lc + (Properties)->lp)))
Carl-Daniel Hailfingercba07dd2006-09-14 15:12:36 +000054
55#define kLzmaNeedInitId (-2)
56
Lee Leahye20a3192017-03-09 16:21:34 -080057typedef struct _CLzmaDecoderState {
58 CLzmaProperties Properties;
59 CProb *Probs;
Carl-Daniel Hailfingercba07dd2006-09-14 15:12:36 +000060} CLzmaDecoderState;
61
62
63int LzmaDecode(CLzmaDecoderState *vs,
Lee Leahye20a3192017-03-09 16:21:34 -080064 const unsigned char *inStream, SizeT inSize, SizeT *inSizeProcessed,
65 unsigned char *outStream, SizeT outSize, SizeT *outSizeProcessed);
Carl-Daniel Hailfingercba07dd2006-09-14 15:12:36 +000066
67#endif