blob: a68512cf18a53b9d5587f17f35c997ab78d3e901 (
plain) (
blame)
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
|
/* Copyright (C) Teemu Suutari */
#ifndef RANGEDECODER_HPP
#define RANGEDECODER_HPP
#include <cstdint>
namespace ancient::internal
{
// used by too many compressors...
class RangeDecoder
{
public:
class BitReader
{
public:
BitReader();
virtual ~BitReader();
virtual uint32_t readBit()=0;
};
RangeDecoder(BitReader &bitReader,uint16_t initialValue);
~RangeDecoder();
uint16_t decode(uint16_t length);
void scale(uint16_t newLow,uint16_t newHigh,uint16_t newRange);
private:
BitReader &_bitReader;
uint16_t _low=0;
uint16_t _high=0xffffU;
uint16_t _stream;
};
}
#endif
|