Prusa MINI Firmware overview
|
#include <stdlib.h>
#include <string.h>
#include "heatshrink_decoder.h"
|
static uint16_t | get_bits (heatshrink_decoder *hsd, uint8_t count) |
|
static void | push_byte (heatshrink_decoder *hsd, output_info *oi, uint8_t byte) |
|
void | heatshrink_decoder_reset (heatshrink_decoder *hsd) |
|
HSD_sink_res | heatshrink_decoder_sink (heatshrink_decoder *hsd, uint8_t *in_buf, size_t size, size_t *input_size) |
|
static HSD_state | st_tag_bit (heatshrink_decoder *hsd) |
|
static HSD_state | st_yield_literal (heatshrink_decoder *hsd, output_info *oi) |
|
static HSD_state | st_backref_index_msb (heatshrink_decoder *hsd) |
|
static HSD_state | st_backref_index_lsb (heatshrink_decoder *hsd) |
|
static HSD_state | st_backref_count_msb (heatshrink_decoder *hsd) |
|
static HSD_state | st_backref_count_lsb (heatshrink_decoder *hsd) |
|
static HSD_state | st_yield_backref (heatshrink_decoder *hsd, output_info *oi) |
|
HSD_poll_res | heatshrink_decoder_poll (heatshrink_decoder *hsd, uint8_t *out_buf, size_t out_buf_size, size_t *output_size) |
|
HSD_finish_res | heatshrink_decoder_finish (heatshrink_decoder *hsd) |
|
◆ LOG
#define LOG |
( |
|
... | ) |
/* no-op */ |
◆ ASSERT
#define ASSERT |
( |
|
X | ) |
/* no-op */ |
◆ NO_BITS
#define NO_BITS ((uint16_t)-1) |
◆ BACKREF_COUNT_BITS
◆ BACKREF_INDEX_BITS
◆ HSD_state
libs/heatshrink/heatshrink_decoder.cpp
Enumerator |
---|
HSDS_TAG_BIT | |
HSDS_YIELD_LITERAL | |
HSDS_BACKREF_INDEX_MSB | |
HSDS_BACKREF_INDEX_LSB | |
HSDS_BACKREF_COUNT_MSB | |
HSDS_BACKREF_COUNT_LSB | |
HSDS_YIELD_BACKREF | |
◆ get_bits()
284 uint16_t accumulator = 0;
286 if (count > 15)
return NO_BITS;
287 LOG(
"-- popping %u bit(s)\n", count);
293 for (
i = 0;
i < count;
i++) {
296 LOG(
" -- out of bits, suspending w/ accumulator of %u (0x%02x)\n", accumulator, accumulator);
311 LOG(
" -- got 1, accumulator 0x%04x, bit_index 0x%02x\n",
316 LOG(
" -- got 0, accumulator 0x%04x, bit_index 0x%02x\n",
322 if (count > 1)
LOG(
" -- accumulated %08x\n", accumulator);
◆ push_byte()
352 LOG(
" -- pushing byte: 0x%02x ('%c')\n",
byte, isprint(
byte) ?
byte :
'.');
◆ heatshrink_decoder_reset()
◆ heatshrink_decoder_sink()
100 if (
hsd ==
nullptr || in_buf ==
nullptr || input_size ==
nullptr)
110 LOG(
"-- sinking %zd bytes\n",
size);
◆ st_tag_bit()
◆ st_yield_literal()
206 LOG(
"-- emitting literal byte 0x%02x ('%c')\n", c, isprint(c) ? c :
'.');
◆ st_backref_index_msb()
218 LOG(
"-- backref index (msb), got 0x%04x (+1)\n", bits);
◆ st_backref_index_lsb()
226 uint16_t bits =
get_bits(
hsd, bit_ct < 8 ? bit_ct : 8);
227 LOG(
"-- backref index (lsb), got 0x%04x (+1)\n", bits);
◆ st_backref_count_msb()
240 LOG(
"-- backref count (msb), got 0x%04x (+1)\n", bits);
◆ st_backref_count_lsb()
248 uint16_t bits =
get_bits(
hsd, br_bit_ct < 8 ? br_bit_ct : 8);
249 LOG(
"-- backref count (lsb), got 0x%04x (+1)\n", bits);
◆ st_yield_backref()
264 LOG(
"-- emitting %zu bytes from -%u bytes back\n", count, neg_offset);
265 ASSERT(neg_offset <= mask + 1);
268 for (
i = 0;
i < count;
i++) {
273 LOG(
" -- ++ 0x%02x\n", c);
◆ heatshrink_decoder_poll()
136 if (
hsd ==
nullptr || out_buf ==
nullptr || output_size ==
nullptr)
◆ heatshrink_decoder_finish()
#define HEATSHRINK_DECODER_INPUT_BUFFER_SIZE(_)
Definition: heatshrink_decoder.h:38
size_t buf_size
Definition: heatshrink_decoder.cpp:43
Definition: heatshrink_decoder.h:26
Definition: heatshrink_decoder.h:21
Definition: heatshrink_decoder.h:12
#define BACKREF_COUNT_BITS(HSD)
Definition: heatshrink_decoder.cpp:122
uint16_t output_index
Definition: heatshrink_decoder.h:50
Definition: heatshrink_decoder.h:18
static HSD_state st_backref_index_msb(heatshrink_decoder *hsd)
Definition: heatshrink_decoder.cpp:213
#define LOG(...)
Definition: heatshrink_decoder.cpp:37
Definition: heatshrink_decoder.h:13
uint8_t i
Definition: screen_test_graph.c:72
uint8_t buffers[(1<< HEATSHRINK_DECODER_WINDOW_BITS(_))+HEATSHRINK_DECODER_INPUT_BUFFER_SIZE(_)]
Definition: heatshrink_decoder.h:66
#define BACKREF_INDEX_BITS(HSD)
Definition: heatshrink_decoder.cpp:123
uint8_t state
Definition: heatshrink_decoder.h:52
Definition: heatshrink_decoder.h:19
Definition: heatshrink_decoder.h:27
static uint16_t get_bits(heatshrink_decoder *hsd, uint8_t count)
Definition: heatshrink_decoder.cpp:282
static HSD_state st_tag_bit(heatshrink_decoder *hsd)
Definition: heatshrink_decoder.cpp:181
HSD_state
Definition: heatshrink_decoder.cpp:11
static HSD_state st_yield_literal(heatshrink_decoder *hsd, output_info *oi)
Definition: heatshrink_decoder.cpp:195
Definition: heatshrink_decoder.h:25
static HSD_state st_backref_index_lsb(heatshrink_decoder *hsd)
Definition: heatshrink_decoder.cpp:223
static void push_byte(heatshrink_decoder *hsd, output_info *oi, uint8_t byte)
Definition: heatshrink_decoder.cpp:350
uint8_t bit_index
Definition: heatshrink_decoder.h:54
Definition: heatshrink_decoder.cpp:16
Definition: heatshrink_decoder.cpp:18
void
Definition: png.h:1083
size_t * output_size
Definition: heatshrink_decoder.cpp:44
Definition: heatshrink_decoder.cpp:15
static HSD_state st_yield_backref(heatshrink_decoder *hsd, output_info *oi)
Definition: heatshrink_decoder.cpp:255
uint16_t head_index
Definition: heatshrink_decoder.h:51
uint16_t input_size
Definition: heatshrink_decoder.h:47
uint16_t output_count
Definition: heatshrink_decoder.h:49
const uint8_t[]
Definition: 404_html.c:3
Definition: heatshrink_decoder.cpp:14
uint8_t current_byte
Definition: heatshrink_decoder.h:53
#define HEATSHRINK_DECODER_WINDOW_BITS(_)
Definition: heatshrink_decoder.h:40
Definition: heatshrink_decoder.cpp:41
static heatshrink_decoder hsd
Definition: binary_protocol.h:53
#define ASSERT(X)
Definition: heatshrink_decoder.cpp:38
uint16_t input_index
Definition: heatshrink_decoder.h:48
static HSD_state st_backref_count_msb(heatshrink_decoder *hsd)
Definition: heatshrink_decoder.cpp:235
Definition: heatshrink_decoder.cpp:12
uint8_t * buf
Definition: heatshrink_decoder.cpp:42
static HSD_state st_backref_count_lsb(heatshrink_decoder *hsd)
Definition: heatshrink_decoder.cpp:245
Definition: heatshrink_decoder.cpp:17
#define NO_BITS
Definition: heatshrink_decoder.cpp:47
Definition: heatshrink_decoder.h:20
Definition: heatshrink_decoder.cpp:13
Definition: heatshrink_decoder.h:14
static png_bytep size_t size
Definition: pngwrite.c:2170