3static constexpr uint8_t
START { 255 };
4static constexpr uint8_t
STOP { 0 };
5static constexpr uint8_t
ESCAPE { 1 };
9 const unsigned char *src = compressed;
11 if ((src[1] != 1) && (src[1] != 2))
17 QByteArray uncompressed;
18 uncompressed.reserve(size * 3);
22 while (
byte < 6 &&
byte < size)
24 value |= src[byte] << ((5-byte) * 8);
29 while (lastch !=
STOP &&
byte < size+4)
34 unsigned bitShift = 0;
41 nextCh = (value >> 24) & 0xff;
43 if ((nextCh & 0x80) == 0)
52 auto indx = (unsigned)lastch;
53 for (
unsigned j = fsat_index[indx]; j < fsat_index[indx+1]; j++)
56 unsigned maskbit = 0x80000000;
57 for (
uint16_t kk = 0; kk < fsat_table[j].m_bits; kk++)
62 if ((value & mask) == fsat_table[j].m_value)
64 nextCh = fsat_table[j].m_next;
65 bitShift = fsat_table[j].m_bits;
75 uncompressed.append(nextCh);
77 for (
unsigned b = 0; b < bitShift; b++)
79 value = (value << 1) & 0xfffffffe;
81 value |= (src[byte] >> (7-bit)) & 1;
96 QString result = QString::fromUtf8(uncompressed);
102 return QString::fromUtf8(uncompressed);
static constexpr uint8_t ESCAPE
QString freesat_huffman_to_string(const unsigned char *compressed, uint size)
static constexpr uint8_t STOP
static constexpr uint8_t START
const std::vector< fsattab > fsat_table_1
const std::vector< fsattab > fsat_table_2
const std::vector< uint16_t > fsat_index_1
const std::vector< uint16_t > fsat_index_2