1// PpmdEncoder.h
2
3#ifndef __COMPRESS_PPMD_ENCODER_H
4#define __COMPRESS_PPMD_ENCODER_H
5
6#include "../../../C/Ppmd7.h"
7
8#include "../../Common/MyCom.h"
9
10#include "../ICoder.h"
11
12#include "../Common/CWrappers.h"
13
14namespace NCompress {
15namespace NPpmd {
16
17struct CEncProps
18{
19  UInt32 MemSize;
20  UInt32 ReduceSize;
21  int Order;
22
23  CEncProps()
24  {
25    MemSize = (UInt32)(Int32)-1;
26    ReduceSize = (UInt32)(Int32)-1;
27    Order = -1;
28  }
29  void Normalize(int level);
30};
31
32class CEncoder :
33  public ICompressCoder,
34  public ICompressSetCoderProperties,
35  public ICompressWriteCoderProperties,
36  public CMyUnknownImp
37{
38  Byte *_inBuf;
39  CByteOutBufWrap _outStream;
40  CPpmd7z_RangeEnc _rangeEnc;
41  CPpmd7 _ppmd;
42  CEncProps _props;
43public:
44  MY_UNKNOWN_IMP2(
45      ICompressSetCoderProperties,
46      ICompressWriteCoderProperties)
47  STDMETHOD(Code)(ISequentialInStream *inStream, ISequentialOutStream *outStream,
48      const UInt64 *inSize, const UInt64 *outSize, ICompressProgressInfo *progress);
49  STDMETHOD(SetCoderProperties)(const PROPID *propIDs, const PROPVARIANT *props, UInt32 numProps);
50  STDMETHOD(WriteCoderProperties)(ISequentialOutStream *outStream);
51  CEncoder();
52  ~CEncoder();
53};
54
55}}
56
57#endif
58