|
HERMES Modem
Hermes ARQ/Broadcast modem
|
#include <stdio.h>#include <stdint.h>#include <stdlib.h>#include <string.h>
Macros | |
| #define | NUM_SYMBOLS 39 |
| #define | CODE_BITS 32 |
| #define | MAX_CODE ((1ULL << CODE_BITS) - 1) |
| #define | HALF (1ULL << (CODE_BITS - 1)) |
| #define | QUARTER (HALF >> 1) |
| #define | THREE_QUARTERS (HALF + QUARTER) |
| #define | BUFFER_SIZE 4096 |
| #define | MAX_ENCODE_BITS (BUFFER_SIZE * 8) |
| #define | MAX_PENDING 1024 |
Functions | |
| void | init_model () |
| int | find_index (char c) |
| void | bw_init (BitWriter *bw, uint8_t *buf) |
| void | bw_write_bit (BitWriter *bw, int bit) |
| int | bw_bytes (BitWriter *bw) |
| void | br_init (BitReader *br, uint8_t *buf, int len) |
| int | br_read_bit (BitReader *br) |
| int | arithmetic_encode (const char *msg, uint8_t *output) |
| int | arithmetic_decode (uint8_t *input, int max_len, char *output, int max_output) |
Variables | |
| char | symbols [NUM_SYMBOLS] |
| uint64_t | cum_freq [NUM_SYMBOLS+1] |
| #define BUFFER_SIZE 4096 |
| #define CODE_BITS 32 |
| #define HALF (1ULL << (CODE_BITS - 1)) |
| #define MAX_CODE ((1ULL << CODE_BITS) - 1) |
| #define MAX_ENCODE_BITS (BUFFER_SIZE * 8) |
| #define MAX_PENDING 1024 |
| #define NUM_SYMBOLS 39 |
| #define QUARTER (HALF >> 1) |
| int arithmetic_decode | ( | uint8_t * | input, |
| int | max_len, | ||
| char * | output, | ||
| int | max_output | ||
| ) |
| int arithmetic_encode | ( | const char * | msg, |
| uint8_t * | output | ||
| ) |
| void br_init | ( | BitReader * | br, |
| uint8_t * | buf, | ||
| int | len | ||
| ) |
| int br_read_bit | ( | BitReader * | br | ) |
| int bw_bytes | ( | BitWriter * | bw | ) |
| void bw_init | ( | BitWriter * | bw, |
| uint8_t * | buf | ||
| ) |
| void bw_write_bit | ( | BitWriter * | bw, |
| int | bit | ||
| ) |
| int find_index | ( | char | c | ) |
| void init_model | ( | void | ) |
| uint64_t cum_freq[NUM_SYMBOLS+1] |
| char symbols[NUM_SYMBOLS] |