Archived
1
0
This repository has been archived on 2024-10-17. You can view files and clone it, but cannot push or open issues or pull requests.
Files
winamp/Src/external_dependencies/openmpt-trunk/include/ancient/src/RangeDecoder.hpp
2024-09-24 14:54:57 +02:00

41 lines
606 B
C++
Vendored

/* 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