1#ifndef APE_NEWPREDICTOR_H
2#define APE_NEWPREDICTOR_H
3
4#include "Predictor.h"
5
6#include "RollBuffer.h"
7#include "NNFilter.h"
8#include "ScaledFirstOrderFilter.h"
9
10/*************************************************************************************************
11Functions to create the interfaces
12*************************************************************************************************/
13IPredictorCompress * __stdcall CreateIPredictorCompress();
14IPredictorDecompress * __stdcall CreateIPredictorDecompress();
15
16#define WINDOW_BLOCKS           512
17
18#define BUFFER_COUNT            1
19#define HISTORY_ELEMENTS        8
20#define M_COUNT                 8
21
22class CPredictorCompressNormal : public IPredictorCompress
23{
24public:
25    CPredictorCompressNormal(int nCompressionLevel);
26    virtual ~CPredictorCompressNormal();
27
28    int CompressValue(int nA, int nB = 0);
29    int Flush();
30
31protected:
32
33    // buffer information
34    CRollBufferFast<int, WINDOW_BLOCKS, 10> m_rbPrediction;
35    CRollBufferFast<int, WINDOW_BLOCKS, 9> m_rbAdapt;
36
37    CScaledFirstOrderFilter<31, 5> m_Stage1FilterA;
38    CScaledFirstOrderFilter<31, 5> m_Stage1FilterB;
39
40    // adaption
41    int m_aryM[9];
42
43    // other
44    int m_nCurrentIndex;
45    CNNFilter * m_pNNFilter;
46    CNNFilter * m_pNNFilter1;
47    CNNFilter * m_pNNFilter2;
48};
49
50class CPredictorDecompressNormal3930to3950 : public IPredictorDecompress
51{
52public:
53    CPredictorDecompressNormal3930to3950(int nCompressionLevel, int nVersion);
54    virtual ~CPredictorDecompressNormal3930to3950();
55
56    int DecompressValue(int nInput, int);
57    int Flush();
58
59protected:
60
61    // buffer information
62    int * m_pBuffer[BUFFER_COUNT];
63
64    // adaption
65    int m_aryM[M_COUNT];
66
67    // buffer pointers
68    int * m_pInputBuffer;
69
70    // other
71    int m_nCurrentIndex;
72    int m_nLastValue;
73    CNNFilter * m_pNNFilter;
74    CNNFilter * m_pNNFilter1;
75};
76
77class CPredictorDecompress3950toCurrent : public IPredictorDecompress
78{
79public:
80    CPredictorDecompress3950toCurrent(int nCompressionLevel, int nVersion);
81    virtual ~CPredictorDecompress3950toCurrent();
82
83    int DecompressValue(int nA, int nB = 0);
84    int Flush();
85
86protected:
87
88    // adaption
89    int m_aryMA[M_COUNT];
90    int m_aryMB[M_COUNT];
91
92    // buffer pointers
93    CRollBufferFast<int, WINDOW_BLOCKS, 8> m_rbPredictionA;
94    CRollBufferFast<int, WINDOW_BLOCKS, 8> m_rbPredictionB;
95
96    CRollBufferFast<int, WINDOW_BLOCKS, 8> m_rbAdaptA;
97    CRollBufferFast<int, WINDOW_BLOCKS, 8> m_rbAdaptB;
98
99    CScaledFirstOrderFilter<31, 5> m_Stage1FilterA;
100    CScaledFirstOrderFilter<31, 5> m_Stage1FilterB;
101
102    // other
103    int m_nCurrentIndex;
104    int m_nLastValueA;
105    int m_nVersion;
106    CNNFilter * m_pNNFilter;
107    CNNFilter * m_pNNFilter1;
108    CNNFilter * m_pNNFilter2;
109};
110
111#endif // #ifndef APE_NEWPREDICTOR_H
112