xref: /haiku/src/add-ons/media/plugins/ape_reader/MAClib/APECompressCore.h (revision be878f60874196f746f336f235797c8efa25004e)
1 #ifndef APE_APECOMPRESSCORE_H
2 #define APE_APECOMPRESSCORE_H
3 
4 #include "APECompress.h"
5 #include "BitArray.h"
6 
7 class CPrepare;
8 class IPredictorCompress;
9 
10 /*************************************************************************************************
11 CAPECompressCore - manages the core of compression and bitstream output
12 *************************************************************************************************/
13 class  CAPECompressCore
14 {
15 public:
16     CAPECompressCore(CIO * pIO, const WAVEFORMATEX * pwfeInput, int nMaxFrameBlocks, int nCompressionLevel);
17     ~CAPECompressCore();
18 
19     int EncodeFrame(const void * pInputData, int nInputBytes);
20 
GetBitArray()21     CBitArray * GetBitArray() { return m_spBitArray.GetPtr(); }
GetPeakLevel()22     int GetPeakLevel() { return m_nPeakLevel; }
23 
24 private:
25 
26     int Prepare(const void * pInputData, int nInputBytes, int * pSpecialCodes);
27 
28     CSmartPtr<CBitArray> m_spBitArray;
29     CSmartPtr<IPredictorCompress> m_spPredictorX;
30     CSmartPtr<IPredictorCompress> m_spPredictorY;
31     BIT_ARRAY_STATE    m_BitArrayStateX;
32     BIT_ARRAY_STATE    m_BitArrayStateY;
33     CSmartPtr<int> m_spDataX;
34     CSmartPtr<int> m_spDataY;
35     CSmartPtr<int> m_spTempData;
36     CSmartPtr<CPrepare> m_spPrepare;
37     WAVEFORMATEX m_wfeInput;
38     int    m_nPeakLevel;
39 };
40 
41 #endif // #ifndef APE_APECOMPRESSCORE_H
42