coder.hpp 693 B

12345678910111213141516171819202122232425
  1. /****************************************************************************
  2. * Contents: 'Carryless rangecoder' by Dmitry Subbotin *
  3. ****************************************************************************/
  4. const uint TOP=1 << 24, BOT=1 << 15;
  5. class RangeCoder
  6. {
  7. public:
  8. void InitDecoder(Unpack *UnpackRead);
  9. inline int GetCurrentCount();
  10. inline uint GetCurrentShiftCount(uint SHIFT);
  11. inline void Decode();
  12. inline void PutChar(unsigned int c);
  13. inline unsigned int GetChar();
  14. uint low, code, range;
  15. struct SUBRANGE
  16. {
  17. uint LowCount, HighCount, scale;
  18. } SubRange;
  19. Unpack *UnpackRead;
  20. };