-
Notifications
You must be signed in to change notification settings - Fork 10
/
StreamCodec.hpp
57 lines (43 loc) · 1.15 KB
/
StreamCodec.hpp
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
47
48
49
50
51
52
53
54
55
56
57
/* Copyright (C) Teemu Suutari */
#ifndef STREAMCODEC_H
#define STREAMCODEC_H
#include <vector>
#include <string>
#include "onekpaq_common.h"
class StreamCodec
{
public:
enum class EncodeMode : uint {
Single=1,
Multi,
SingleFast,
MultiFast,
ModeLast=MultiFast
};
enum class EncoderComplexity : uint {
Low=1,
Medium,
High,
ComplexityLast=High
};
StreamCodec() { }
~StreamCodec() = default;
std::vector<u8> CreateSingleStream();
const std::vector<u8> &GetAsmDest1() { return _destAsm1; }
const std::vector<u8> &GetAsmDest2() { return _destAsm2; }
EncodeMode getMode() const { return _mode; }
uint GetShift() const { return _shift; }
void Encode(const std::vector<std::vector<u8>> &blocks,EncodeMode mode,EncoderComplexity complexity,const std::string &cacheFileName);
void LoadStream(std::vector<u8> singleStream);
std::vector<u8> Decode();
std::vector<u8> DecodeAsmStream();
private:
std::vector<u8> CreateAsmHeader();
std::vector<std::vector<u8>> _header;
std::vector<u8> _dest; // encoded stream
std::vector<u8> _destAsm1;
std::vector<u8> _destAsm2;
EncodeMode _mode=EncodeMode::Single;
uint _shift;
};
#endif