Path: blob/main/misc/emulator/xnes/snes9x/jma/lzmadec.h
28798 views
/*1Copyright (C) 2002 Andrea Mazzoleni ( http://advancemame.sf.net )2Copyright (C) 2001-4 Igor Pavlov ( http://www.7-zip.org )34This library is free software; you can redistribute it and/or5modify it under the terms of the GNU Lesser General Public6License version 2.1 as published by the Free Software Foundation.78This library is distributed in the hope that it will be useful,9but WITHOUT ANY WARRANTY; without even the implied warranty of10MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU11Lesser General Public License for more details.1213You should have received a copy of the GNU Lesser General Public14License along with this library; if not, write to the Free Software15Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA16*/1718#ifndef __LZARITHMETIC_DECODER_H19#define __LZARITHMETIC_DECODER_H2021#include "winout.h"22#include "lzma.h"23#include "lencoder.h"24#include "litcoder.h"2526namespace NCompress {27namespace NLZMA {2829typedef CMyBitDecoder<kNumMoveBitsForMainChoice> CMyBitDecoder2;3031class CDecoder32{33NStream::NWindow::COut m_OutWindowStream;34CMyRangeDecoder m_RangeDecoder;3536CMyBitDecoder2 m_MainChoiceDecoders[kNumStates][NLength::kNumPosStatesMax];37CMyBitDecoder2 m_MatchChoiceDecoders[kNumStates];38CMyBitDecoder2 m_MatchRepChoiceDecoders[kNumStates];39CMyBitDecoder2 m_MatchRep1ChoiceDecoders[kNumStates];40CMyBitDecoder2 m_MatchRep2ChoiceDecoders[kNumStates];41CMyBitDecoder2 m_MatchRepShortChoiceDecoders[kNumStates][NLength::kNumPosStatesMax];4243CBitTreeDecoder<kNumMoveBitsForPosSlotCoder, kNumPosSlotBits> m_PosSlotDecoder[kNumLenToPosStates];4445CReverseBitTreeDecoder2<kNumMoveBitsForPosCoders> m_PosDecoders[kNumPosModels];46CReverseBitTreeDecoder<kNumMoveBitsForAlignCoders, kNumAlignBits> m_PosAlignDecoder;47// CBitTreeDecoder2<kNumMoveBitsForPosCoders> m_PosDecoders[kNumPosModels];48// CBitTreeDecoder<kNumMoveBitsForAlignCoders, kNumAlignBits> m_PosAlignDecoder;4950NLength::CDecoder m_LenDecoder;51NLength::CDecoder m_RepMatchLenDecoder;5253NLiteral::CDecoder m_LiteralDecoder;5455UINT32 m_DictionarySize;5657UINT32 m_PosStateMask;5859HRESULT Create();6061HRESULT Init(ISequentialInStream *anInStream, ISequentialOutStream *anOutStream);6263HRESULT Flush() { return m_OutWindowStream.Flush(); }6465HRESULT CodeReal(ISequentialInStream *anInStream, ISequentialOutStream *anOutStream, const UINT64 *anInSize, const UINT64 *anOutSize);6667public:6869CDecoder();7071HRESULT Code(ISequentialInStream *anInStream, ISequentialOutStream *anOutStream, const UINT64 *anInSize, const UINT64 *anOutSize);72HRESULT ReadCoderProperties(ISequentialInStream *anInStream);7374HRESULT SetDictionarySize(UINT32 aDictionarySize);75HRESULT SetLiteralProperties(UINT32 aLiteralPosStateBits, UINT32 aLiteralContextBits);76HRESULT SetPosBitsProperties(UINT32 aNumPosStateBits);77};7879}}8081#endif828384