1baa3858d3f5d128a5c8466b700098109edcad5f2repo sync// PpmdDecoder.h
2baa3858d3f5d128a5c8466b700098109edcad5f2repo sync// 2009-03-11 : Igor Pavlov : Public domain
3baa3858d3f5d128a5c8466b700098109edcad5f2repo sync
4baa3858d3f5d128a5c8466b700098109edcad5f2repo sync#ifndef __COMPRESS_PPMD_DECODER_H
5baa3858d3f5d128a5c8466b700098109edcad5f2repo sync#define __COMPRESS_PPMD_DECODER_H
6baa3858d3f5d128a5c8466b700098109edcad5f2repo sync
7baa3858d3f5d128a5c8466b700098109edcad5f2repo sync#include "../../../C/Ppmd7.h"
8baa3858d3f5d128a5c8466b700098109edcad5f2repo sync
9baa3858d3f5d128a5c8466b700098109edcad5f2repo sync#include "../../Common/MyCom.h"
10baa3858d3f5d128a5c8466b700098109edcad5f2repo sync
11baa3858d3f5d128a5c8466b700098109edcad5f2repo sync#include "../Common/CWrappers.h"
12baa3858d3f5d128a5c8466b700098109edcad5f2repo sync
13baa3858d3f5d128a5c8466b700098109edcad5f2repo sync#include "../ICoder.h"
14baa3858d3f5d128a5c8466b700098109edcad5f2repo sync
15baa3858d3f5d128a5c8466b700098109edcad5f2repo syncnamespace NCompress {
16baa3858d3f5d128a5c8466b700098109edcad5f2repo syncnamespace NPpmd {
17baa3858d3f5d128a5c8466b700098109edcad5f2repo sync
18baa3858d3f5d128a5c8466b700098109edcad5f2repo syncclass CDecoder :
19baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  public ICompressCoder,
20baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  public ICompressSetDecoderProperties2,
21baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  #ifndef NO_READ_FROM_CODER
22baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  public ICompressSetInStream,
23baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  public ICompressSetOutStreamSize,
24baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  public ISequentialInStream,
25baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  #endif
26baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  public CMyUnknownImp
27baa3858d3f5d128a5c8466b700098109edcad5f2repo sync{
28baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  Byte *_outBuf;
29baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  CPpmd7z_RangeDec _rangeDec;
30baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  CByteInBufWrap _inStream;
31baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  CPpmd7 _ppmd;
32baa3858d3f5d128a5c8466b700098109edcad5f2repo sync
33baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  Byte _order;
34baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  bool _outSizeDefined;
35baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  int _status;
36baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  UInt64 _outSize;
37baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  UInt64 _processedSize;
38baa3858d3f5d128a5c8466b700098109edcad5f2repo sync
39baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  HRESULT CodeSpec(Byte *memStream, UInt32 size);
40baa3858d3f5d128a5c8466b700098109edcad5f2repo sync
41baa3858d3f5d128a5c8466b700098109edcad5f2repo syncpublic:
42baa3858d3f5d128a5c8466b700098109edcad5f2repo sync
43baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  #ifndef NO_READ_FROM_CODER
44baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  CMyComPtr<ISequentialInStream> InSeqStream;
45baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  MY_UNKNOWN_IMP4(
46baa3858d3f5d128a5c8466b700098109edcad5f2repo sync      ICompressSetDecoderProperties2,
47baa3858d3f5d128a5c8466b700098109edcad5f2repo sync      ICompressSetInStream,
48baa3858d3f5d128a5c8466b700098109edcad5f2repo sync      ICompressSetOutStreamSize,
49baa3858d3f5d128a5c8466b700098109edcad5f2repo sync      ISequentialInStream)
50baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  #else
51baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  MY_UNKNOWN_IMP1(
52baa3858d3f5d128a5c8466b700098109edcad5f2repo sync      ICompressSetDecoderProperties2)
53baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  #endif
54baa3858d3f5d128a5c8466b700098109edcad5f2repo sync
55baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  STDMETHOD(Code)(ISequentialInStream *inStream, ISequentialOutStream *outStream,
56baa3858d3f5d128a5c8466b700098109edcad5f2repo sync      const UInt64 *inSize, const UInt64 *outSize, ICompressProgressInfo *progress);
57baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  STDMETHOD(SetDecoderProperties2)(const Byte *data, UInt32 size);
58baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  STDMETHOD(SetOutStreamSize)(const UInt64 *outSize);
59baa3858d3f5d128a5c8466b700098109edcad5f2repo sync
60baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  #ifndef NO_READ_FROM_CODER
61baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  STDMETHOD(SetInStream)(ISequentialInStream *inStream);
62baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  STDMETHOD(ReleaseInStream)();
63baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  STDMETHOD(Read)(void *data, UInt32 size, UInt32 *processedSize);
64baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  #endif
65baa3858d3f5d128a5c8466b700098109edcad5f2repo sync
66baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  CDecoder(): _outBuf(NULL), _outSizeDefined(false)
67baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  {
68baa3858d3f5d128a5c8466b700098109edcad5f2repo sync    Ppmd7z_RangeDec_CreateVTable(&_rangeDec);
69baa3858d3f5d128a5c8466b700098109edcad5f2repo sync    _rangeDec.Stream = &_inStream.p;
70baa3858d3f5d128a5c8466b700098109edcad5f2repo sync    Ppmd7_Construct(&_ppmd);
71baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  }
72baa3858d3f5d128a5c8466b700098109edcad5f2repo sync
73baa3858d3f5d128a5c8466b700098109edcad5f2repo sync  ~CDecoder();
74baa3858d3f5d128a5c8466b700098109edcad5f2repo sync};
75baa3858d3f5d128a5c8466b700098109edcad5f2repo sync
76baa3858d3f5d128a5c8466b700098109edcad5f2repo sync}}
77baa3858d3f5d128a5c8466b700098109edcad5f2repo sync
78baa3858d3f5d128a5c8466b700098109edcad5f2repo sync#endif
79