Annotation of elwix/tools/oldlzma/SRC/7zip/Compress/Branch/x86_2.h, revision 1.1.1.1
1.1 misho 1: // x86_2.h
2:
3: #ifndef __BRANCH_X86_2_H
4: #define __BRANCH_X86_2_H
5:
6: #include "../../../Common/MyCom.h"
7: #include "../RangeCoder/RangeCoderBit.h"
8: #include "../../ICoder.h"
9:
10: // {23170F69-40C1-278B-0303-010100000100}
11: #define MyClass2_a(Name, id, subId, encodingId) \
12: DEFINE_GUID(CLSID_CCompressConvert ## Name, \
13: 0x23170F69, 0x40C1, 0x278B, 0x03, 0x03, id, subId, 0x00, 0x00, encodingId, 0x00);
14:
15: #define MyClass_a(Name, id, subId) \
16: MyClass2_a(Name ## _Encoder, id, subId, 0x01) \
17: MyClass2_a(Name ## _Decoder, id, subId, 0x00)
18:
19: MyClass_a(BCJ2_x86, 0x01, 0x1B)
20:
21: const int kNumMoveBits = 5;
22:
23: #ifndef EXTRACT_ONLY
24:
25: class CBCJ2_x86_Encoder:
26: public ICompressCoder2,
27: public CMyUnknownImp
28: {
29: Byte *_buffer;
30: public:
31: CBCJ2_x86_Encoder(): _buffer(0) {};
32: ~CBCJ2_x86_Encoder();
33: bool Create();
34:
35: COutBuffer _mainStream;
36: COutBuffer _callStream;
37: COutBuffer _jumpStream;
38: NCompress::NRangeCoder::CEncoder _rangeEncoder;
39: NCompress::NRangeCoder::CBitEncoder<kNumMoveBits> _statusE8Encoder[256];
40: NCompress::NRangeCoder::CBitEncoder<kNumMoveBits> _statusE9Encoder;
41: NCompress::NRangeCoder::CBitEncoder<kNumMoveBits> _statusJccEncoder;
42:
43: HRESULT Flush();
44: void ReleaseStreams()
45: {
46: _mainStream.ReleaseStream();
47: _callStream.ReleaseStream();
48: _jumpStream.ReleaseStream();
49: _rangeEncoder.ReleaseStream();
50: }
51:
52: class CCoderReleaser
53: {
54: CBCJ2_x86_Encoder *_coder;
55: public:
56: CCoderReleaser(CBCJ2_x86_Encoder *coder): _coder(coder) {}
57: ~CCoderReleaser() { _coder->ReleaseStreams(); }
58: };
59:
60: public:
61:
62: MY_UNKNOWN_IMP
63:
64: HRESULT CodeReal(ISequentialInStream **inStreams,
65: const UInt64 **inSizes,
66: UInt32 numInStreams,
67: ISequentialOutStream **outStreams,
68: const UInt64 **outSizes,
69: UInt32 numOutStreams,
70: ICompressProgressInfo *progress);
71: STDMETHOD(Code)(ISequentialInStream **inStreams,
72: const UInt64 **inSizes,
73: UInt32 numInStreams,
74: ISequentialOutStream **outStreams,
75: const UInt64 **outSizes,
76: UInt32 numOutStreams,
77: ICompressProgressInfo *progress);
78: };
79:
80: #endif
81:
82: class CBCJ2_x86_Decoder:
83: public ICompressCoder2,
84: public CMyUnknownImp
85: {
86: public:
87: CInBuffer _mainInStream;
88: CInBuffer _callStream;
89: CInBuffer _jumpStream;
90: NCompress::NRangeCoder::CDecoder _rangeDecoder;
91: NCompress::NRangeCoder::CBitDecoder<kNumMoveBits> _statusE8Decoder[256];
92: NCompress::NRangeCoder::CBitDecoder<kNumMoveBits> _statusE9Decoder;
93: NCompress::NRangeCoder::CBitDecoder<kNumMoveBits> _statusJccDecoder;
94:
95: COutBuffer _outStream;
96:
97: void ReleaseStreams()
98: {
99: _mainInStream.ReleaseStream();
100: _callStream.ReleaseStream();
101: _jumpStream.ReleaseStream();
102: _rangeDecoder.ReleaseStream();
103: _outStream.ReleaseStream();
104: }
105:
106: HRESULT Flush() { return _outStream.Flush(); }
107: class CCoderReleaser
108: {
109: CBCJ2_x86_Decoder *_coder;
110: public:
111: CCoderReleaser(CBCJ2_x86_Decoder *coder): _coder(coder) {}
112: ~CCoderReleaser() { _coder->ReleaseStreams(); }
113: };
114:
115: public:
116: MY_UNKNOWN_IMP
117: HRESULT CodeReal(ISequentialInStream **inStreams,
118: const UInt64 **inSizes,
119: UInt32 numInStreams,
120: ISequentialOutStream **outStreams,
121: const UInt64 **outSizes,
122: UInt32 numOutStreams,
123: ICompressProgressInfo *progress);
124: STDMETHOD(Code)(ISequentialInStream **inStreams,
125: const UInt64 **inSizes,
126: UInt32 numInStreams,
127: ISequentialOutStream **outStreams,
128: const UInt64 **outSizes,
129: UInt32 numOutStreams,
130: ICompressProgressInfo *progress);
131: };
132:
133: #endif
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>