3 static constexpr uint8_t
START {
'\0' };
4 static constexpr uint8_t
STOP {
'\0' };
5 static constexpr uint8_t
ESCAPE {
'\1' };
9 const unsigned char *src = compressed;
11 if ((src[1] != 1) && (src[1] != 2))
17 QByteArray uncompressed(size * 3,
'\0');
22 while (
byte < 6 &&
byte < size)
24 value |= src[byte] << ((5-byte) * 8);
32 unsigned bitShift = 0;
39 nextCh = (value >> 24) & 0xff;
41 if ((nextCh & 0x80) == 0)
50 auto indx = (unsigned)lastch;
51 for (
unsigned j = fsat_index[indx]; j < fsat_index[indx+1]; j++)
54 unsigned maskbit = 0x80000000;
55 for (
uint16_t kk = 0; kk < fsat_table[j].m_bits; kk++)
60 if ((value & mask) == fsat_table[j].m_value)
62 nextCh = fsat_table[j].m_next;
63 bitShift = fsat_table[j].m_bits;
74 if (
p >= uncompressed.size())
75 uncompressed.resize(
p+10);
76 uncompressed[
p++] = nextCh;
79 for (
unsigned b = 0; b < bitShift; b++)
81 value = (value << 1) & 0xfffffffe;
83 value |= (src[byte] >> (7-bit)) & 1;
98 QString result = QString::fromUtf8(uncompressed,
p);
102 }
while (lastch !=
STOP &&
byte < size+4);
104 return QString::fromUtf8(uncompressed,
p);