huf.h
1.57 KB
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
64
65
66
67
68
69
70
71
72
73
74
75
typedef struct huf_struct {
unsigned int
end:1,
sign:1,
stop:1, /* don't consume bits unless "sign" is set also */
nbits:2,
value:11;
} HufControl;
typedef HufControl HufTable[16];
typedef unsigned int BIT_BUFTYPE;
extern FILE *huf_file;
extern char *huf_filename;
extern BIT_BUFTYPE *in_bit_buf;
extern int in_buf_len;
extern int in_cur_bits;
extern int in_cur_used;
extern int in_cur_word;
#define AC_ERROR (0x100)
#define AC_EOB (AC_ERROR+1)
#define AC_ESCAPE (AC_ERROR+2)
#define AC_START_CODE (AC_ERROR+3)
#define AC_FIRST (0)
#define AC_START (1)
extern HufControl *(huf_mpeg1_ac_tabs[32]);
#define HUF_LEVEL_SHIFT (5)
#define LR(level,run) ((level<<HUF_LEVEL_SHIFT)+run)
#define RL(run,level) ((level<<HUF_LEVEL_SHIFT)+run)
#define MBH_ZEROS LR(1,0)
#define MBH_ERRORS LR(2,0)
#define MBH_FIRST (0)
#define MBA_START (MBH_FIRST)
#define MBT_INTRA (MBH_FIRST+7)
#define MBT_PRED (MBH_FIRST+8)
#define MBT_BIDIR (MBH_FIRST+11)
#define CBP_START (MBH_FIRST+14)
#define MV_START (MBH_FIRST+28)
#define DCL_START (MBH_FIRST+33)
#define DCC_START (MBH_FIRST+35)
#define MBA_ZEROS (MBH_ZEROS + 1)
#define MBA_ERROR (MBH_ERRORS + 1)
#define MBA_ESCAPE (33)
#define MBA_STUFF (0)
#define MBT_ERROR (MBH_ERRORS + 2)
#define CBP_ZEROS (MBH_ZEROS + 4)
#define CBP_ERROR (MBH_ERRORS + 4)
#define DCL_ERROR (MBH_ERRORS + 6)
#define DCC_ERROR (MBH_ERRORS + 7)
extern HufControl *(huf_mpeg1_mbh_tabs[40]);