-
Notifications
You must be signed in to change notification settings - Fork 0
/
bitstream.h
63 lines (43 loc) · 1.07 KB
/
bitstream.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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#ifndef BITSTREAM_H
#define BITSTREAM_H
#include <stdlib.h>
#include <stdio.h>
/* bit stream functions */
typedef struct
{
FILE *stream;
int output;
unsigned char waiting_byte;
unsigned char mask;
} bitstream;
extern bitstream *
open_input_bitstream(const char *path);
extern bitstream *
open_output_bitstream(const char *path);
extern void
close_bitstream(bitstream *bs);
extern unsigned int
getbits(bitstream *bs, int numbits);
extern void
putbits(bitstream *bs, unsigned int value, int numbits);
/* vlc functions */
extern void
init_huffman_tables(void);
extern void
delete_huffman_tables(void);
extern int
getvlcdc(bitstream *bs);
extern void
getvlcac(bitstream *bs, int *run, int *category);
extern void
putvlcdc(bitstream *bs, int category);
extern void
putvlcac(bitstream *bs, int run, int category);
/* vli functions */
extern int
solve_category(signed int value);
extern signed int
getvli(bitstream *bs, int category);
extern void
putvli(bitstream *bs, int category, signed int value);
#endif