annotate Plugins/Input/console/libjma/lzmadec.h @ 1194:0c0a5ff7b20b trunk

[svn] - add libjma (a hopefully portable snapshot of the ZSNES JMA implementation)
author nenolod
date Tue, 13 Jun 2006 20:37:25 -0700
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1194
0c0a5ff7b20b [svn] - add libjma (a hopefully portable snapshot of the ZSNES JMA implementation)
nenolod
parents:
diff changeset
1 /*
0c0a5ff7b20b [svn] - add libjma (a hopefully portable snapshot of the ZSNES JMA implementation)
nenolod
parents:
diff changeset
2 Copyright (C) 2002 Andrea Mazzoleni ( http://advancemame.sf.net )
0c0a5ff7b20b [svn] - add libjma (a hopefully portable snapshot of the ZSNES JMA implementation)
nenolod
parents:
diff changeset
3 Copyright (C) 2001-4 Igor Pavlov ( http://www.7-zip.org )
0c0a5ff7b20b [svn] - add libjma (a hopefully portable snapshot of the ZSNES JMA implementation)
nenolod
parents:
diff changeset
4
0c0a5ff7b20b [svn] - add libjma (a hopefully portable snapshot of the ZSNES JMA implementation)
nenolod
parents:
diff changeset
5 This library is free software; you can redistribute it and/or
0c0a5ff7b20b [svn] - add libjma (a hopefully portable snapshot of the ZSNES JMA implementation)
nenolod
parents:
diff changeset
6 modify it under the terms of the GNU Lesser General Public
0c0a5ff7b20b [svn] - add libjma (a hopefully portable snapshot of the ZSNES JMA implementation)
nenolod
parents:
diff changeset
7 License version 2.1 as published by the Free Software Foundation.
0c0a5ff7b20b [svn] - add libjma (a hopefully portable snapshot of the ZSNES JMA implementation)
nenolod
parents:
diff changeset
8
0c0a5ff7b20b [svn] - add libjma (a hopefully portable snapshot of the ZSNES JMA implementation)
nenolod
parents:
diff changeset
9 This library is distributed in the hope that it will be useful,
0c0a5ff7b20b [svn] - add libjma (a hopefully portable snapshot of the ZSNES JMA implementation)
nenolod
parents:
diff changeset
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
0c0a5ff7b20b [svn] - add libjma (a hopefully portable snapshot of the ZSNES JMA implementation)
nenolod
parents:
diff changeset
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
0c0a5ff7b20b [svn] - add libjma (a hopefully portable snapshot of the ZSNES JMA implementation)
nenolod
parents:
diff changeset
12 Lesser General Public License for more details.
0c0a5ff7b20b [svn] - add libjma (a hopefully portable snapshot of the ZSNES JMA implementation)
nenolod
parents:
diff changeset
13
0c0a5ff7b20b [svn] - add libjma (a hopefully portable snapshot of the ZSNES JMA implementation)
nenolod
parents:
diff changeset
14 You should have received a copy of the GNU Lesser General Public
0c0a5ff7b20b [svn] - add libjma (a hopefully portable snapshot of the ZSNES JMA implementation)
nenolod
parents:
diff changeset
15 License along with this library; if not, write to the Free Software
0c0a5ff7b20b [svn] - add libjma (a hopefully portable snapshot of the ZSNES JMA implementation)
nenolod
parents:
diff changeset
16 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
0c0a5ff7b20b [svn] - add libjma (a hopefully portable snapshot of the ZSNES JMA implementation)
nenolod
parents:
diff changeset
17 */
0c0a5ff7b20b [svn] - add libjma (a hopefully portable snapshot of the ZSNES JMA implementation)
nenolod
parents:
diff changeset
18
0c0a5ff7b20b [svn] - add libjma (a hopefully portable snapshot of the ZSNES JMA implementation)
nenolod
parents:
diff changeset
19 #ifndef __LZARITHMETIC_DECODER_H
0c0a5ff7b20b [svn] - add libjma (a hopefully portable snapshot of the ZSNES JMA implementation)
nenolod
parents:
diff changeset
20 #define __LZARITHMETIC_DECODER_H
0c0a5ff7b20b [svn] - add libjma (a hopefully portable snapshot of the ZSNES JMA implementation)
nenolod
parents:
diff changeset
21
0c0a5ff7b20b [svn] - add libjma (a hopefully portable snapshot of the ZSNES JMA implementation)
nenolod
parents:
diff changeset
22 #include "winout.h"
0c0a5ff7b20b [svn] - add libjma (a hopefully portable snapshot of the ZSNES JMA implementation)
nenolod
parents:
diff changeset
23 #include "lzma.h"
0c0a5ff7b20b [svn] - add libjma (a hopefully portable snapshot of the ZSNES JMA implementation)
nenolod
parents:
diff changeset
24 #include "lencoder.h"
0c0a5ff7b20b [svn] - add libjma (a hopefully portable snapshot of the ZSNES JMA implementation)
nenolod
parents:
diff changeset
25 #include "litcoder.h"
0c0a5ff7b20b [svn] - add libjma (a hopefully portable snapshot of the ZSNES JMA implementation)
nenolod
parents:
diff changeset
26
0c0a5ff7b20b [svn] - add libjma (a hopefully portable snapshot of the ZSNES JMA implementation)
nenolod
parents:
diff changeset
27 namespace NCompress {
0c0a5ff7b20b [svn] - add libjma (a hopefully portable snapshot of the ZSNES JMA implementation)
nenolod
parents:
diff changeset
28 namespace NLZMA {
0c0a5ff7b20b [svn] - add libjma (a hopefully portable snapshot of the ZSNES JMA implementation)
nenolod
parents:
diff changeset
29
0c0a5ff7b20b [svn] - add libjma (a hopefully portable snapshot of the ZSNES JMA implementation)
nenolod
parents:
diff changeset
30 typedef CMyBitDecoder<kNumMoveBitsForMainChoice> CMyBitDecoder2;
0c0a5ff7b20b [svn] - add libjma (a hopefully portable snapshot of the ZSNES JMA implementation)
nenolod
parents:
diff changeset
31
0c0a5ff7b20b [svn] - add libjma (a hopefully portable snapshot of the ZSNES JMA implementation)
nenolod
parents:
diff changeset
32 class CDecoder
0c0a5ff7b20b [svn] - add libjma (a hopefully portable snapshot of the ZSNES JMA implementation)
nenolod
parents:
diff changeset
33 {
0c0a5ff7b20b [svn] - add libjma (a hopefully portable snapshot of the ZSNES JMA implementation)
nenolod
parents:
diff changeset
34 NStream::NWindow::COut m_OutWindowStream;
0c0a5ff7b20b [svn] - add libjma (a hopefully portable snapshot of the ZSNES JMA implementation)
nenolod
parents:
diff changeset
35 CMyRangeDecoder m_RangeDecoder;
0c0a5ff7b20b [svn] - add libjma (a hopefully portable snapshot of the ZSNES JMA implementation)
nenolod
parents:
diff changeset
36
0c0a5ff7b20b [svn] - add libjma (a hopefully portable snapshot of the ZSNES JMA implementation)
nenolod
parents:
diff changeset
37 CMyBitDecoder2 m_MainChoiceDecoders[kNumStates][NLength::kNumPosStatesMax];
0c0a5ff7b20b [svn] - add libjma (a hopefully portable snapshot of the ZSNES JMA implementation)
nenolod
parents:
diff changeset
38 CMyBitDecoder2 m_MatchChoiceDecoders[kNumStates];
0c0a5ff7b20b [svn] - add libjma (a hopefully portable snapshot of the ZSNES JMA implementation)
nenolod
parents:
diff changeset
39 CMyBitDecoder2 m_MatchRepChoiceDecoders[kNumStates];
0c0a5ff7b20b [svn] - add libjma (a hopefully portable snapshot of the ZSNES JMA implementation)
nenolod
parents:
diff changeset
40 CMyBitDecoder2 m_MatchRep1ChoiceDecoders[kNumStates];
0c0a5ff7b20b [svn] - add libjma (a hopefully portable snapshot of the ZSNES JMA implementation)
nenolod
parents:
diff changeset
41 CMyBitDecoder2 m_MatchRep2ChoiceDecoders[kNumStates];
0c0a5ff7b20b [svn] - add libjma (a hopefully portable snapshot of the ZSNES JMA implementation)
nenolod
parents:
diff changeset
42 CMyBitDecoder2 m_MatchRepShortChoiceDecoders[kNumStates][NLength::kNumPosStatesMax];
0c0a5ff7b20b [svn] - add libjma (a hopefully portable snapshot of the ZSNES JMA implementation)
nenolod
parents:
diff changeset
43
0c0a5ff7b20b [svn] - add libjma (a hopefully portable snapshot of the ZSNES JMA implementation)
nenolod
parents:
diff changeset
44 CBitTreeDecoder<kNumMoveBitsForPosSlotCoder, kNumPosSlotBits> m_PosSlotDecoder[kNumLenToPosStates];
0c0a5ff7b20b [svn] - add libjma (a hopefully portable snapshot of the ZSNES JMA implementation)
nenolod
parents:
diff changeset
45
0c0a5ff7b20b [svn] - add libjma (a hopefully portable snapshot of the ZSNES JMA implementation)
nenolod
parents:
diff changeset
46 CReverseBitTreeDecoder2<kNumMoveBitsForPosCoders> m_PosDecoders[kNumPosModels];
0c0a5ff7b20b [svn] - add libjma (a hopefully portable snapshot of the ZSNES JMA implementation)
nenolod
parents:
diff changeset
47 CReverseBitTreeDecoder<kNumMoveBitsForAlignCoders, kNumAlignBits> m_PosAlignDecoder;
0c0a5ff7b20b [svn] - add libjma (a hopefully portable snapshot of the ZSNES JMA implementation)
nenolod
parents:
diff changeset
48 // CBitTreeDecoder2<kNumMoveBitsForPosCoders> m_PosDecoders[kNumPosModels];
0c0a5ff7b20b [svn] - add libjma (a hopefully portable snapshot of the ZSNES JMA implementation)
nenolod
parents:
diff changeset
49 // CBitTreeDecoder<kNumMoveBitsForAlignCoders, kNumAlignBits> m_PosAlignDecoder;
0c0a5ff7b20b [svn] - add libjma (a hopefully portable snapshot of the ZSNES JMA implementation)
nenolod
parents:
diff changeset
50
0c0a5ff7b20b [svn] - add libjma (a hopefully portable snapshot of the ZSNES JMA implementation)
nenolod
parents:
diff changeset
51 NLength::CDecoder m_LenDecoder;
0c0a5ff7b20b [svn] - add libjma (a hopefully portable snapshot of the ZSNES JMA implementation)
nenolod
parents:
diff changeset
52 NLength::CDecoder m_RepMatchLenDecoder;
0c0a5ff7b20b [svn] - add libjma (a hopefully portable snapshot of the ZSNES JMA implementation)
nenolod
parents:
diff changeset
53
0c0a5ff7b20b [svn] - add libjma (a hopefully portable snapshot of the ZSNES JMA implementation)
nenolod
parents:
diff changeset
54 NLiteral::CDecoder m_LiteralDecoder;
0c0a5ff7b20b [svn] - add libjma (a hopefully portable snapshot of the ZSNES JMA implementation)
nenolod
parents:
diff changeset
55
0c0a5ff7b20b [svn] - add libjma (a hopefully portable snapshot of the ZSNES JMA implementation)
nenolod
parents:
diff changeset
56 UINT32 m_DictionarySize;
0c0a5ff7b20b [svn] - add libjma (a hopefully portable snapshot of the ZSNES JMA implementation)
nenolod
parents:
diff changeset
57
0c0a5ff7b20b [svn] - add libjma (a hopefully portable snapshot of the ZSNES JMA implementation)
nenolod
parents:
diff changeset
58 UINT32 m_PosStateMask;
0c0a5ff7b20b [svn] - add libjma (a hopefully portable snapshot of the ZSNES JMA implementation)
nenolod
parents:
diff changeset
59
0c0a5ff7b20b [svn] - add libjma (a hopefully portable snapshot of the ZSNES JMA implementation)
nenolod
parents:
diff changeset
60 HRESULT Create();
0c0a5ff7b20b [svn] - add libjma (a hopefully portable snapshot of the ZSNES JMA implementation)
nenolod
parents:
diff changeset
61
0c0a5ff7b20b [svn] - add libjma (a hopefully portable snapshot of the ZSNES JMA implementation)
nenolod
parents:
diff changeset
62 HRESULT Init(ISequentialInStream *anInStream, ISequentialOutStream *anOutStream);
0c0a5ff7b20b [svn] - add libjma (a hopefully portable snapshot of the ZSNES JMA implementation)
nenolod
parents:
diff changeset
63
0c0a5ff7b20b [svn] - add libjma (a hopefully portable snapshot of the ZSNES JMA implementation)
nenolod
parents:
diff changeset
64 HRESULT Flush() { return m_OutWindowStream.Flush(); }
0c0a5ff7b20b [svn] - add libjma (a hopefully portable snapshot of the ZSNES JMA implementation)
nenolod
parents:
diff changeset
65
0c0a5ff7b20b [svn] - add libjma (a hopefully portable snapshot of the ZSNES JMA implementation)
nenolod
parents:
diff changeset
66 HRESULT CodeReal(ISequentialInStream *anInStream, ISequentialOutStream *anOutStream, const UINT64 *anInSize, const UINT64 *anOutSize);
0c0a5ff7b20b [svn] - add libjma (a hopefully portable snapshot of the ZSNES JMA implementation)
nenolod
parents:
diff changeset
67
0c0a5ff7b20b [svn] - add libjma (a hopefully portable snapshot of the ZSNES JMA implementation)
nenolod
parents:
diff changeset
68 public:
0c0a5ff7b20b [svn] - add libjma (a hopefully portable snapshot of the ZSNES JMA implementation)
nenolod
parents:
diff changeset
69
0c0a5ff7b20b [svn] - add libjma (a hopefully portable snapshot of the ZSNES JMA implementation)
nenolod
parents:
diff changeset
70 CDecoder();
0c0a5ff7b20b [svn] - add libjma (a hopefully portable snapshot of the ZSNES JMA implementation)
nenolod
parents:
diff changeset
71
0c0a5ff7b20b [svn] - add libjma (a hopefully portable snapshot of the ZSNES JMA implementation)
nenolod
parents:
diff changeset
72 HRESULT Code(ISequentialInStream *anInStream, ISequentialOutStream *anOutStream, const UINT64 *anInSize, const UINT64 *anOutSize);
0c0a5ff7b20b [svn] - add libjma (a hopefully portable snapshot of the ZSNES JMA implementation)
nenolod
parents:
diff changeset
73 HRESULT ReadCoderProperties(ISequentialInStream *anInStream);
0c0a5ff7b20b [svn] - add libjma (a hopefully portable snapshot of the ZSNES JMA implementation)
nenolod
parents:
diff changeset
74
0c0a5ff7b20b [svn] - add libjma (a hopefully portable snapshot of the ZSNES JMA implementation)
nenolod
parents:
diff changeset
75 HRESULT SetDictionarySize(UINT32 aDictionarySize);
0c0a5ff7b20b [svn] - add libjma (a hopefully portable snapshot of the ZSNES JMA implementation)
nenolod
parents:
diff changeset
76 HRESULT SetLiteralProperties(UINT32 aLiteralPosStateBits, UINT32 aLiteralContextBits);
0c0a5ff7b20b [svn] - add libjma (a hopefully portable snapshot of the ZSNES JMA implementation)
nenolod
parents:
diff changeset
77 HRESULT SetPosBitsProperties(UINT32 aNumPosStateBits);
0c0a5ff7b20b [svn] - add libjma (a hopefully portable snapshot of the ZSNES JMA implementation)
nenolod
parents:
diff changeset
78 };
0c0a5ff7b20b [svn] - add libjma (a hopefully portable snapshot of the ZSNES JMA implementation)
nenolod
parents:
diff changeset
79
0c0a5ff7b20b [svn] - add libjma (a hopefully portable snapshot of the ZSNES JMA implementation)
nenolod
parents:
diff changeset
80 }}
0c0a5ff7b20b [svn] - add libjma (a hopefully portable snapshot of the ZSNES JMA implementation)
nenolod
parents:
diff changeset
81
0c0a5ff7b20b [svn] - add libjma (a hopefully portable snapshot of the ZSNES JMA implementation)
nenolod
parents:
diff changeset
82 #endif