-
Notifications
You must be signed in to change notification settings - Fork 0
/
vitter.h
41 lines (32 loc) · 827 Bytes
/
vitter.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#ifndef __include_vitter_h__
#define __include_vitter_h__
#include "bitstream.h"
#include <stdbool.h>
typedef struct _vitter_node vitter_node_t;
typedef struct _vitter_tree vitter_tree_t;
typedef struct _vitter vitter_t;
bool vitter_alloc(vitter_t *v, uint16_t size);
void vitter_dealloc(vitter_t *v);
bool vitter_decode(uint16_t *symbol, vitter_t *v);
bool vitter_encode(vitter_t *v, uint16_t symbol);
#ifdef USE_VITTER_SCALE
void vitter_scale(vitter_tree_t *tree, uint16_t bits);
#endif /* USE_VITTER_SCALE */
struct _vitter_node {
uint16_t child;
uint16_t parent;
uint16_t symbol;
uint16_t weight;
};
struct _vitter_tree {
uint16_t escape;
uint16_t *map;
vitter_node_t *nodes;
uint16_t root;
uint16_t size;
};
struct _vitter {
bitstream_t stream;
vitter_tree_t tree;
};
#endif /* __include_vitter_h__ */