43 #define DBG(x) STB_SPDebugWrite x 77 U16BIT num_output_bytes = 0;
80 BOOLEAN compressed_char;
84 if ((encoding_type == 1) || (encoding_type == 2))
86 if (encoding_type == 1)
88 #ifndef HUFFMAN_TABLE_1_MISSING 89 table = huffman_table_1;
94 #ifndef HUFFMAN_TABLE_2_MISSING 95 table = huffman_table_2;
106 compressed_char = FALSE;
108 for (finished = FALSE; !finished && (num_output_bytes < output_size); )
110 if (((prev_char == 0x1b) && compressed_char) || ((prev_char >= 0x80) && !compressed_char))
112 compressed_char = FALSE;
113 for (i = 0, prev_char = 0; i < 8; i++)
116 prev_char |= ((*input & mask) >> mask_pos);
143 compressed_char = TRUE;
144 byte_offset = (table[2 * prev_char] << 8) + table[2 * prev_char + 1];
146 if ((*input & mask) == 0)
148 value = table[byte_offset];
152 value = table[byte_offset + 1];
164 char_decoded = FALSE;
166 while (!char_decoded)
168 if ((value & 0x80) == 0)
170 if ((*input & mask) == 0)
172 value = table[byte_offset + 2 * (value & 0x7f)];
176 value = table[byte_offset + 2 * (value & 0x7f) + 1];
190 prev_char = value & 0x7f;
192 if (prev_char != 0x1b)
217 *(output - 1) =
'\0';
224 return(num_output_bytes);
Debug functions header file.
System Wide Global Technical Data Type Definitions.
U16BIT STB_HuffmanDecompress(U8BIT encoding_type, U8BIT *input, U8BIT *output, U16BIT output_size)
Decompresses the input buffer according to the BBC's Huffman algorithm as defined in the DTG D-Book 6...
The data for this file is subject to the signing of a license agreement that can be obtained by conta...
The data for this file is subject to the signing of a license agreement that can be obtained by conta...