-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathArcoder.h
More file actions
46 lines (32 loc) · 1.28 KB
/
Arcoder.h
File metadata and controls
46 lines (32 loc) · 1.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#ifndef ARCODER_H
#define ARCODER_H
#include <istream>
#include <ostream>
#include <vector>
/*! \brief Callback to choose model index.
*
* If not set, model with index 0 will be always used.
*
* \param i_symbol The symbol previous to the one being encoded.
* \param i_userData Pointer to the data that used wants to pass to this func.
* \return The index of the model that should be chosen for this symbol.
*/
typedef int (*modelChoosingCallback) (int i_symbol, unsigned int i_serialIndex, void* i_userData);
class Arcoder
{
public:
virtual ~Arcoder() {}
virtual bool LoadModel(std::istream& i_stream) = 0;
virtual void SaveModel(std::ostream& i_stream) = 0;
virtual void InitUniformModel(unsigned int i_symbolsCount) = 0;
virtual void SetModelChoosingCallback(modelChoosingCallback i_callback, void* i_userData) = 0;
virtual void SetElementSize(int i_size) = 0;
virtual void Compress(std::istream& i_input,
std::ostream& i_output) = 0;
virtual void Decompress(std::istream& i_input,
std::ostream& i_output) = 0;
};
Arcoder* CreateArcoder(int i_symbolCount = 256); // single model
Arcoder* CreateArcoder(const std::vector<int>& i_symbolCount);
Arcoder* CreateArcoder(std::istream& i_modelsSource);
#endif // ARCODER_H